27 #include "WMainWindow.h"
28 #include "WSettingAction.h"
31 bool showRestartInfo,
const QKeySequence& shortcut ):
32 QAction( QString::fromStdString( actionName ), parent ),
33 m_settingName( QString::fromStdString( settingName ) ),
34 m_showRestartInfo( showRestartInfo )
38 shortcuts.push_back( shortcut );
39 setShortcuts( shortcuts );
44 setToolTip( QString::fromStdString( tooltip ) );
47 setChecked(
WQtGui::getSettings().value( QString::fromStdString( settingName ), defaultValue ).toBool() );
50 connect(
this, SIGNAL( toggled(
bool ) ),
this, SLOT(
stateChange(
bool ) ) );
70 QMessageBox::information(
WQtGui::getMainWindow(), QString(
"Restart required" ), QString(
"This setting is applied after restart." ) );
static QSettings & getSettings()
Returns the settings object.
static WMainWindow * getMainWindow()
Returns the current main window instance or NULL if not existent.
WSettingAction(QObject *parent, std::string settingName, std::string actionName, std::string tooltip, bool defaultValue, bool showRestartInfo=false, const QKeySequence &shortcut=0)
Constructs an action which handles a certain setting.
bool get() const
Gets the current state.
virtual ~WSettingAction()
Destructor.
QString m_settingName
The name of the setting handled here.
void stateChange(bool state)
The state has changed by the action.
bool m_showRestartInfo
If true, a change of the setting causes an restart notification dialog.
void change(bool value)
This signal is emitted if this setting changes.