Make encoder name conversion functions static to the base class.
[Rockbox.git] / rbutil / rbutilqt / uninstallwindow.cpp
blob86c7400b99f931ae0564ecb3e163e05227871138
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);
71 void UninstallWindow::setSettings(RbSettings *sett)
73 settings = sett;
75 QString mountpoint =settings->mountpoint();
76 uninstaller = new Uninstaller(this,mountpoint);
78 // disable smart uninstall, if not possible
79 if(!uninstaller->uninstallPossible())
81 ui.smartRadioButton->setEnabled(false);
82 ui.smartGroupBox->setEnabled(false);
83 ui.CompleteRadioBtn->setChecked(true);
85 else // fill in installed parts
87 ui.smartRadioButton->setChecked(true);
88 ui.UninstalllistWidget->addItems(uninstaller->getAllSections());