1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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
);
44 item
->setIcon(QIcon(":/icons/icons/go-next.png"));
47 item
->setIcon(QIcon(":/icons/icons/dialog-information.png"));
50 item
->setIcon(QIcon(":/icons/icons/dialog-warning.png"));
53 item
->setIcon(QIcon(":/icons/icons/dialog-error.png"));
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()));
85 void ProgressLoggerGui::close()
87 downloadProgress
->close();
90 void ProgressLoggerGui::show()
92 downloadProgress
->show();