use alternating row colors in list views.
[Rockbox.git] / rbutil / rbutilqt / progressloggergui.cpp
blobc7282300da1a533a818dc14a86acf1e6a851f90b
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 dp.listProgress->setAlternatingRowColors(true);
28 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
32 void ProgressLoggerGui::addItem(QString text)
34 dp.listProgress->addItem(text);
37 void ProgressLoggerGui::addItem(QString text,int flag)
39 QListWidgetItem* item = new QListWidgetItem(text);
41 switch(flag)
43 case LOGOK:
44 item->setIcon(QIcon(":/icons/icons/go-next.png"));
45 break;
46 case LOGINFO:
47 item->setIcon(QIcon(":/icons/icons/dialog-information.png"));
48 break;
49 case LOGWARNING:
50 item->setIcon(QIcon(":/icons/icons/dialog-warning.png"));
51 break;
52 case LOGERROR:
53 item->setIcon(QIcon(":/icons/icons/dialog-error.png"));
54 break;
57 dp.listProgress->addItem(item);
60 void ProgressLoggerGui::setProgressValue(int value)
62 dp.progressBar->setValue(value);
65 void ProgressLoggerGui::setProgressMax(int max)
67 dp.progressBar->setMaximum(max);
70 int ProgressLoggerGui::getProgressMax()
72 return dp.progressBar->maximum();
75 void ProgressLoggerGui::abort()
77 dp.buttonAbort->setText(tr("&Ok"));
78 dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/icons/go-next.png")));
79 disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
80 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
81 connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed()));
82 emit aborted();
85 void ProgressLoggerGui::close()
87 downloadProgress->close();
90 void ProgressLoggerGui::show()
92 downloadProgress->show();