12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include <QDesktopServices>
- #include <QUrl>
- #include <QDebug>
- #include "progressdialog.h"
- #include "ui_progressdialog.h"
- #include "settings.h"
- ProgressDialog::ProgressDialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::ProgressDialog)
- {
- ui->setupUi(this);
- setWindowTitle("Nokia Hybrid Application Generator");
- connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
- connect(ui->buttonLog, SIGNAL(clicked()), this, SLOT(openLog()));
- connect(ui->buttonSIS, SIGNAL(clicked()), this, SIGNAL(openSIS()));
- ui->buttonCancel->setFocus();
- }
- ProgressDialog::~ProgressDialog()
- {
- delete ui;
- }
- void ProgressDialog::changeEvent(QEvent *e)
- {
- QDialog::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- ui->retranslateUi(this);
- break;
- default:
- break;
- }
- }
- void ProgressDialog::setFinishedView(GeneratorTarget target, bool success)
- {
- ui->buttonCancel->setText(tr("Close"));
- if (success && (target == BUILD || target == REBUILD))
- {
- ui->buttonSIS->setEnabled(true);
- }
- }
- void ProgressDialog::setMaximumProgress(int maximum)
- {
- ui->progressBar->setMaximum(maximum);
- }
- void ProgressDialog::updateProgress(int current)
- {
- ui->progressBar->setValue(current);
- }
- void ProgressDialog::updateStatusText(QString text)
- {
- ui->label->setText(text);
- }
- void ProgressDialog::openLog()
- {
- qDebug() << "Open log";
- QDesktopServices::openUrl(QUrl::fromLocalFile(Settings::get(Settings::LogFilePath).toString()));
- }
|