mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 07:00:04 +00:00
Adding apply/discard/reset functionality to settings dialog
This commit is contained in:
parent
a6974e31a2
commit
87f611e026
10 changed files with 276 additions and 13 deletions
67
scwx-qt/source/scwx/qt/settings/settings_interface_base.hpp
Normal file
67
scwx-qt/source/scwx/qt/settings/settings_interface_base.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
class QAbstractButton;
|
||||
class QWidget;
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace settings
|
||||
{
|
||||
|
||||
class SettingsInterfaceBase
|
||||
{
|
||||
public:
|
||||
explicit SettingsInterfaceBase();
|
||||
~SettingsInterfaceBase();
|
||||
|
||||
SettingsInterfaceBase(const SettingsInterfaceBase&) = delete;
|
||||
SettingsInterfaceBase& operator=(const SettingsInterfaceBase&) = delete;
|
||||
|
||||
SettingsInterfaceBase(SettingsInterfaceBase&&) noexcept;
|
||||
SettingsInterfaceBase& operator=(SettingsInterfaceBase&&) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the current value of the associated settings variable to the staged
|
||||
* value.
|
||||
*
|
||||
* @return true if the staged value was committed, false if no staged value
|
||||
* is present.
|
||||
*/
|
||||
virtual bool Commit() = 0;
|
||||
|
||||
/**
|
||||
* Clears the staged value of the associated settings variable.
|
||||
*/
|
||||
virtual void Reset() = 0;
|
||||
|
||||
/**
|
||||
* Stages the default value of the associated settings variable.
|
||||
*/
|
||||
virtual void StageDefault() = 0;
|
||||
|
||||
/**
|
||||
* Sets the edit widget from the settings dialog.
|
||||
*
|
||||
* @param widget Edit widget
|
||||
*/
|
||||
virtual void SetEditWidget(QWidget* widget) = 0;
|
||||
|
||||
/**
|
||||
* Sets the reset button from the settings dialog.
|
||||
*
|
||||
* @param button Reset button
|
||||
*/
|
||||
virtual void SetResetButton(QAbstractButton* button) = 0;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue