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(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()));
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::setProgressValue(int value
)
64 dp
.progressBar
->setValue(value
);
67 void ProgressLoggerGui::setProgressMax(int max
)
69 dp
.progressBar
->setMaximum(max
);
72 int ProgressLoggerGui::getProgressMax()
74 return dp
.progressBar
->maximum();
77 void ProgressLoggerGui::abort()
79 dp
.buttonAbort
->setText(tr("&Ok"));
80 dp
.buttonAbort
->setIcon(QIcon(QString::fromUtf8(":/icons/go-next.png")));
81 disconnect(dp
.buttonAbort
, SIGNAL(clicked()), this, SLOT(abort()));
82 connect(dp
.buttonAbort
, SIGNAL(clicked()), downloadProgress
, SLOT(close()));
83 connect(dp
.buttonAbort
, SIGNAL(clicked()), this, SIGNAL(closed()));
87 void ProgressLoggerGui::undoAbort()
89 dp
.buttonAbort
->setText(tr("&Abort"));
90 dp
.buttonAbort
->setIcon(QIcon(QString::fromUtf8(":/icons/process-stop.png")));
91 connect(dp
.buttonAbort
, SIGNAL(clicked()), this, SLOT(abort()));
94 void ProgressLoggerGui::close()
96 downloadProgress
->close();
99 void ProgressLoggerGui::show()
101 downloadProgress
->show();