Split ShutdownConfirmDlg into .h/.cpp files.

This commit is contained in:
sledgehammer999
2014-08-23 19:06:20 +03:00
parent da81d3351d
commit f75f5616b1
3 changed files with 63 additions and 24 deletions

View File

@@ -39,30 +39,9 @@ class ShutdownConfirmDlg : public QMessageBox {
Q_OBJECT
public:
ShutdownConfirmDlg(const QString &message) {
// Text
setWindowTitle(tr("Shutdown confirmation"));
setText(message);
// Cancel Button
addButton(QMessageBox::Cancel);
// Icon
setIcon(QMessageBox::Warning);
// Always on top
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
show();
// Move to center
move(misc::screenCenter(this));
}
ShutdownConfirmDlg(const QString &message);
static bool askForConfirmation(const QString &message) {
ShutdownConfirmDlg dlg(message);
// Auto shutdown timer
QTimer timer;
connect(&timer, SIGNAL(timeout()), &dlg, SLOT(accept()));
timer.start(15000); // 15sec
dlg.exec();
return (dlg.result() == QDialog::Accepted);
}
static bool askForConfirmation(const QString &message);
};
#endif // SHUTDOWNCONFIRM_H