2015-02-07 00:32:25 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* Copyright (C) 2008, 2012 by Volker Lanz <vl@fidra.de> *
|
2016-03-02 18:33:40 +00:00
|
|
|
* Copyright (C) 2016 by Andrius Štikonas <andrius@stikonas.eu> *
|
2015-02-07 00:32:25 +00:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
|
|
|
*************************************************************************/
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-02-11 18:47:51 +00:00
|
|
|
#if !defined(APPLYPROGRESSDIALOG__H)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-02-11 18:47:51 +00:00
|
|
|
#define APPLYPROGRESSDIALOG__H
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2014-05-17 03:06:58 +01:00
|
|
|
#include <QDialog>
|
2008-09-24 20:32:01 +01:00
|
|
|
#include <QString>
|
2014-05-17 03:06:58 +01:00
|
|
|
#include <QTime>
|
|
|
|
#include <QTimer>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
class OperationRunner;
|
|
|
|
class Operation;
|
|
|
|
class Job;
|
2010-02-11 18:47:51 +00:00
|
|
|
class ApplyProgressDialogWidget;
|
|
|
|
class ApplyProgressDetailsWidget;
|
2008-09-24 20:32:01 +01:00
|
|
|
class Report;
|
|
|
|
|
2014-05-17 03:06:58 +01:00
|
|
|
class QDialogButtonBox;
|
2008-09-24 20:32:01 +01:00
|
|
|
class QTreeWidgetItem;
|
|
|
|
class QCloseEvent;
|
|
|
|
class QKeyEvent;
|
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** Show progress.
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
The progress dialog telling the user about the progress of the Operations that are being applied.
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
2014-05-17 03:06:58 +01:00
|
|
|
class ApplyProgressDialog : public QDialog
|
2008-09-24 20:32:01 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
Q_DISABLE_COPY(ApplyProgressDialog)
|
|
|
|
|
|
|
|
public:
|
|
|
|
ApplyProgressDialog(QWidget* parent, OperationRunner& orunner);
|
|
|
|
~ApplyProgressDialog();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void show();
|
|
|
|
|
|
|
|
Report& report() {
|
|
|
|
Q_ASSERT(m_Report); /**< @return the Report object for this dialog */
|
|
|
|
return *m_Report;
|
|
|
|
}
|
|
|
|
const Report& report() const {
|
|
|
|
Q_ASSERT(m_Report); /**< @return the Report object for this dialog */
|
|
|
|
return *m_Report;
|
|
|
|
}
|
|
|
|
|
2016-05-22 20:03:49 +01:00
|
|
|
protected:
|
2015-07-13 15:17:41 +01:00
|
|
|
void onAllOpsFinished();
|
|
|
|
void onAllOpsCancelled();
|
|
|
|
void onAllOpsError();
|
|
|
|
void onCancelButton();
|
|
|
|
void onDetailsButton();
|
|
|
|
void onOkButton();
|
|
|
|
void onOpStarted(int num, Operation* op);
|
|
|
|
void onOpFinished(int num, Operation* op);
|
|
|
|
void onSecondElapsed();
|
|
|
|
void saveReport();
|
|
|
|
void browserReport();
|
2016-05-22 20:03:49 +01:00
|
|
|
void updateReportUnforced();
|
2015-07-13 15:17:41 +01:00
|
|
|
void updateReport(bool force = false);
|
|
|
|
|
2016-05-18 22:23:59 +01:00
|
|
|
void onJobStarted(Job* job, Operation* op);
|
|
|
|
void onJobFinished(Job* job, Operation* op);
|
|
|
|
void toggleDetails();
|
|
|
|
|
2016-04-28 00:17:47 +01:00
|
|
|
void closeEvent(QCloseEvent* e) override;
|
|
|
|
void keyPressEvent(QKeyEvent* e) override;
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
void setupConnections();
|
|
|
|
|
|
|
|
const OperationRunner& operationRunner() const {
|
|
|
|
return m_OperationRunner;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApplyProgressDialogWidget
|
|
|
|
& dialogWidget() {
|
|
|
|
Q_ASSERT(m_ProgressDialogWidget);
|
|
|
|
return *m_ProgressDialogWidget;
|
|
|
|
}
|
|
|
|
const ApplyProgressDialogWidget
|
|
|
|
& dialogWidget() const {
|
|
|
|
Q_ASSERT(m_ProgressDialogWidget);
|
|
|
|
return *m_ProgressDialogWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApplyProgressDetailsWidget
|
|
|
|
& detailsWidget() {
|
|
|
|
Q_ASSERT(m_ProgressDetailsWidget);
|
|
|
|
return *m_ProgressDetailsWidget;
|
|
|
|
}
|
|
|
|
const ApplyProgressDetailsWidget
|
|
|
|
& detailsWidget() const {
|
|
|
|
Q_ASSERT(m_ProgressDetailsWidget);
|
|
|
|
return *m_ProgressDetailsWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setStatus(const QString& s);
|
|
|
|
|
|
|
|
void setParentTitle(const QString& s);
|
|
|
|
|
|
|
|
void addTaskOutput(int num, const Operation& op);
|
|
|
|
|
|
|
|
QString opDesc(int num, const Operation& op) const;
|
|
|
|
|
|
|
|
void resetReport();
|
|
|
|
|
|
|
|
void allOpsDone(const QString& msg);
|
|
|
|
|
|
|
|
QTime& time() {
|
|
|
|
return m_Time;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTimer& timer() {
|
|
|
|
return m_Timer;
|
|
|
|
}
|
|
|
|
const QTimer& timer() const {
|
|
|
|
return m_Timer;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString& savedParentTitle() const {
|
|
|
|
return m_SavedParentTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCurrentOpItem(QTreeWidgetItem* item) {
|
|
|
|
m_CurrentOpItem = item;
|
|
|
|
}
|
|
|
|
QTreeWidgetItem* currentOpItem() {
|
|
|
|
return m_CurrentOpItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCurrentJobItem(QTreeWidgetItem* item) {
|
|
|
|
m_CurrentJobItem = item;
|
|
|
|
}
|
|
|
|
QTreeWidgetItem* currentJobItem() {
|
|
|
|
return m_CurrentJobItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lastReportUpdate() const {
|
|
|
|
return m_LastReportUpdate;
|
|
|
|
}
|
|
|
|
void setLastReportUpdate(int t) {
|
|
|
|
m_LastReportUpdate = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const QString& timeFormat() {
|
|
|
|
return m_TimeFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ApplyProgressDialogWidget* m_ProgressDialogWidget;
|
|
|
|
ApplyProgressDetailsWidget* m_ProgressDetailsWidget;
|
|
|
|
const OperationRunner& m_OperationRunner;
|
|
|
|
Report* m_Report;
|
|
|
|
QString m_SavedParentTitle;
|
|
|
|
QTimer m_Timer;
|
|
|
|
QTime m_Time;
|
|
|
|
QTreeWidgetItem* m_CurrentOpItem;
|
|
|
|
QTreeWidgetItem* m_CurrentJobItem;
|
|
|
|
int m_LastReportUpdate;
|
|
|
|
|
|
|
|
QDialogButtonBox* dialogButtonBox;
|
|
|
|
QPushButton* okButton;
|
|
|
|
QPushButton* cancelButton;
|
|
|
|
QPushButton* detailsButton;
|
|
|
|
|
|
|
|
static const QString m_TimeFormat;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|