if no proxy type is set default to none.
[Rockbox.git] / rbutil / rbutilqt / progressloggergui.cpp
blobb4471e4476349f1fdd8ce66f18a180a50a38e61f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: progressloggergui.cpp 14027 2007-07-27 17:42:49Z domonoky $
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 "progressloggergui.h"
22 ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent)
24 downloadProgress = new QDialog();
25 downloadProgress->setModal(true);
26 dp.setupUi(downloadProgress);
27 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
31 void ProgressLoggerGui::addItem(QString text)
33 dp.listProgress->addItem(text);
36 void ProgressLoggerGui::addItem(QString text,int flag)
38 QListWidgetItem* item = new QListWidgetItem(text);
40 switch(flag)
42 case LOGOK:
43 item->setIcon(QIcon(":/icons/icons/go-next.png"));
44 break;
45 case LOGINFO:
46 item->setIcon(QIcon(":/icons/icons/dialog-information.png"));
47 break;
48 case LOGWARNING:
49 item->setIcon(QIcon(":/icons/icons/dialog-warning.png"));
50 break;
51 case LOGERROR:
52 item->setIcon(QIcon(":/icons/icons/dialog-error.png"));
53 break;
56 dp.listProgress->addItem(item);
59 void ProgressLoggerGui::setProgressValue(int value)
61 dp.progressBar->setValue(value);
64 void ProgressLoggerGui::setProgressMax(int max)
66 dp.progressBar->setMaximum(max);
69 int ProgressLoggerGui::getProgressMax()
71 return dp.progressBar->maximum();
74 void ProgressLoggerGui::abort()
76 dp.buttonAbort->setText(tr("&Ok"));
77 dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/icons/go-next.png")));
78 disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
79 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
80 connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed()));
81 emit aborted();
84 void ProgressLoggerGui::close()
86 downloadProgress->close();
89 void ProgressLoggerGui::show()
91 downloadProgress->show();