1
0
Fork 0
flightgear/src/GUI/SettingsSection.hxx

70 lines
1.4 KiB
C++
Raw Normal View History

2017-01-30 08:00:37 +01:00
#ifndef SETTINGSSECTION_H
#define SETTINGSSECTION_H
#include <QFrame>
#include <QLabel>
class AdvancedSettingsButton;
2017-02-21 11:01:06 +00:00
class QSettings;
class LaunchConfig;
2017-01-30 08:00:37 +01:00
class SettingsSection : public QFrame
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(bool showAdvanced READ showAdvanced WRITE setShowAdvanced NOTIFY showAdvancedChanged)
public:
SettingsSection(QWidget* pr = nullptr);
2017-02-21 11:01:06 +00:00
virtual void setLaunchConfig(LaunchConfig* config);
virtual bool showAdvanced() const
2017-01-30 08:00:37 +01:00
{
return m_showAdvanced;
}
QString title() const
{
return m_title;
}
void insertSettingsHeader();
2017-02-21 11:01:06 +00:00
virtual void saveState(QSettings& settings) const;
virtual void restoreState(QSettings& settings);
virtual void doApply() = 0;
virtual QString summary() const = 0;
2017-01-30 08:00:37 +01:00
public slots:
void setShowAdvanced(bool showAdvanced);
void setTitle(QString title);
void toggleShowAdvanced();
2017-02-21 11:01:06 +00:00
2017-01-30 08:00:37 +01:00
signals:
void showAdvancedChanged(bool showAdvanced);
void titleChanged(QString title);
2017-02-21 11:01:06 +00:00
void summaryChanged(QString summary);
protected:
virtual void internalUpdateAdvanced();
virtual void updateShowAdvanced();
2017-01-30 08:00:37 +01:00
QString m_title;
bool m_showAdvanced = false;
QLabel* m_titleLabel;
AdvancedSettingsButton* m_advancedModeToggle;
};
#endif // SETTINGSSECTION_H