mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-07 08:02:30 -06:00
Split ShutdownConfirmDlg into .h/.cpp files.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user