Add 'never show again' checkbox/pref to auto-exit confirm dialog

This commit is contained in:
d3fault
2015-12-09 01:01:48 -07:00
committed by sledgehammer999
parent e37dfa96f9
commit f0ec94c31c
7 changed files with 103 additions and 42 deletions

View File

@@ -31,35 +31,37 @@
#ifndef SHUTDOWNCONFIRM_H
#define SHUTDOWNCONFIRM_H
#include <QMessageBox>
#include <QDialog>
#include <QTimer>
#include "base/utils/misc.h"
class ShutdownConfirmDlg : public QMessageBox
class QLabel;
class ShutdownConfirmDlg : public QDialog
{
Q_OBJECT
public:
ShutdownConfirmDlg(const ShutdownAction &action);
bool neverShowAgain() const;
bool shutdown() const;
static bool askForConfirmation(const ShutdownAction &action);
QAbstractButton *getExit_now() const;
void setExit_now(QAbstractButton *value);
static void askForConfirmation(const ShutdownAction &action, bool *shutdownConfirmed, bool *neverShowAgain = 0);
protected:
void showEvent(QShowEvent *event);
private slots:
void updateSeconds();
void handleNeverShowAgainCheckboxToggled(bool checked);
private:
// Methods
void updateText();
// Vars
QAbstractButton *m_exitNow;
QLabel *m_text;
bool m_neverShowAgain;
QTimer m_timer;
int m_timeout;
ShutdownAction m_action;