Prevent an unwanted action which increases volume to be triggered at the same time...
[Rockbox.git] / rbutil / rbutilqt / uninstallwindow.cpp
blob61ca8410be57e9c6726062f202d3abc8daa17110
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "uninstallwindow.h"
21 #include "ui_uninstallfrm.h"
24 UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent)
26 ui.setupUi(this);
27 ui.UninstalllistWidget->setAlternatingRowColors(true);
28 connect(ui.UninstalllistWidget,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged()));
29 connect(ui.CompleteRadioBtn,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool)));
33 void UninstallWindow::accept()
35 logger = new ProgressLoggerGui(this);
36 logger->show();
38 if(ui.CompleteRadioBtn->isChecked())
40 uninstaller->deleteAll(logger);
42 else
44 uninstaller->uninstall(logger);
46 connect(logger,SIGNAL(closed()),this,SLOT(close()));
50 void UninstallWindow::selectionChanged()
52 QList<QListWidgetItem *> itemlist = ui.UninstalllistWidget->selectedItems();
53 QStringList seletedStrings;
54 for(int i=0;i < itemlist.size(); i++ )
56 seletedStrings << itemlist.at(i)->text();
59 uninstaller->setSections(seletedStrings);
62 void UninstallWindow::UninstallMethodChanged(bool complete)
64 if(complete)
65 ui.smartGroupBox->setEnabled(false);
66 else
67 ui.smartGroupBox->setEnabled(true);
70 void UninstallWindow::setDeviceSettings(QSettings *dev)
72 devices = dev;
73 qDebug() << "Install::setDeviceSettings:" << devices;
77 void UninstallWindow::setUserSettings(QSettings *user)
79 userSettings = user;
81 QString mountpoint =userSettings->value("mountpoint").toString();
82 uninstaller = new Uninstaller(this,mountpoint);
84 // disable smart uninstall, if not possible
85 if(!uninstaller->uninstallPossible())
87 ui.smartRadioButton->setEnabled(false);
88 ui.smartGroupBox->setEnabled(false);
89 ui.CompleteRadioBtn->setChecked(true);
91 else // fill in installed parts
93 ui.smartRadioButton->setChecked(true);
94 ui.UninstalllistWidget->addItems(uninstaller->getAllSections());