1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Wenger
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(QWidget
* parent
): ProgressloggerInterface(parent
)
24 downloadProgress
= new QDialog(parent
);
25 downloadProgress
->setModal(true);
26 dp
.setupUi(downloadProgress
);
27 dp
.listProgress
->setAlternatingRowColors(true);
28 connect(dp
.buttonAbort
, SIGNAL(clicked()), this, SLOT(abort()));
31 void ProgressLoggerGui::addItem(const QString
&text
)
33 addItem(text
, LOGNOICON
);
36 void ProgressLoggerGui::addItem(const QString
&text
, int flag
)
38 QListWidgetItem
* item
= new QListWidgetItem(text
);
45 item
->setIcon(QIcon(":/icons/go-next.png"));
48 item
->setIcon(QIcon(":/icons/dialog-information.png"));
51 item
->setIcon(QIcon(":/icons/dialog-warning.png"));
54 item
->setIcon(QIcon(":/icons/dialog-error.png"));
58 dp
.listProgress
->addItem(item
);
59 dp
.listProgress
->scrollToItem(item
);
62 void ProgressLoggerGui::setProgress(int value
, int max
)
64 setProgressValue(value
);
69 void ProgressLoggerGui::setProgressValue(int value
)
71 dp
.progressBar
->setValue(value
);
74 void ProgressLoggerGui::setProgressMax(int max
)
76 dp
.progressBar
->setMaximum(max
);
79 int ProgressLoggerGui::getProgressMax()
81 return dp
.progressBar
->maximum();
84 void ProgressLoggerGui::setProgressVisible(bool b
)
86 dp
.progressBar
->setVisible(b
);
90 void ProgressLoggerGui::abort()
92 dp
.buttonAbort
->setText(tr("&Ok"));
93 dp
.buttonAbort
->setIcon(QIcon(QString::fromUtf8(":/icons/go-next.png")));
94 disconnect(dp
.buttonAbort
, SIGNAL(clicked()), this, SLOT(abort()));
95 connect(dp
.buttonAbort
, SIGNAL(clicked()), downloadProgress
, SLOT(close()));
96 connect(dp
.buttonAbort
, SIGNAL(clicked()), this, SIGNAL(closed()));
100 void ProgressLoggerGui::undoAbort()
102 dp
.buttonAbort
->setText(tr("&Abort"));
103 dp
.buttonAbort
->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.png")));
104 connect(dp
.buttonAbort
, SIGNAL(clicked()), this, SLOT(abort()));
107 void ProgressLoggerGui::close()
109 downloadProgress
->close();
112 void ProgressLoggerGui::show()
114 downloadProgress
->show();