Fix doc path
[opentx.git] / companion / src / progressdialog.cpp
blobce2c28cf1f6e62e115908557c2c543ef95498940
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #include "progresswidget.h"
22 #include "progressdialog.h"
23 #include "ui_progressdialog.h"
24 #include "appdata.h"
25 #include <QTimer>
27 ProgressDialog::ProgressDialog(QWidget *parent, const QString &title, const QIcon &icon, bool forceOpen):
28 QDialog(parent),
29 ui(new Ui::ProgressDialog),
30 locked(false)
32 ui->setupUi(this);
33 setWindowTitle(title);
34 setWindowIcon(icon);
35 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
36 if (forceOpen) {
37 ui->outputProgress->forceOpen();
39 resize(0, 0);
40 show();
43 ProgressDialog::~ProgressDialog()
45 delete ui;
48 ProgressWidget * ProgressDialog::progress()
50 return ui->outputProgress;
53 void ProgressDialog::on_closeButton_clicked()
55 if (!locked) {
56 ui->outputProgress->stop();
57 emit rejected();
58 close();
62 void ProgressDialog::on_outputProgress_detailsToggled()
64 QTimer::singleShot(0, this, SLOT(shrink()));
67 void ProgressDialog::on_outputProgress_locked(bool lock)
69 ui->closeButton->setEnabled(!lock);
70 locked = lock;
73 void ProgressDialog::shrink()
75 resize(0, 0);
78 bool ProgressDialog::isEmpty() const
80 return ui->outputProgress->isEmpty();
83 void ProgressDialog::setProcessStarted()
85 ui->closeButton->setText(tr("Cancel"));
88 void ProgressDialog::setProcessStopped()
90 ui->closeButton->setText(tr("Close"));