2016-07-04 23:26:48 +02:00
|
|
|
#ifndef DIALOGS_SETTINGSDIALOG_H
|
|
|
|
#define DIALOGS_SETTINGSDIALOG_H
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2016-08-29 15:41:11 +02:00
|
|
|
#include "../global.h"
|
2015-04-22 18:57:44 +02:00
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2019-06-10 21:57:46 +02:00
|
|
|
namespace QtUtilities {
|
2015-04-22 18:57:44 +02:00
|
|
|
|
|
|
|
class OptionCategoryModel;
|
|
|
|
class OptionCategoryFilterModel;
|
|
|
|
class OptionCategory;
|
|
|
|
class OptionPage;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class SettingsDialog;
|
|
|
|
}
|
|
|
|
|
2017-05-01 03:16:25 +02:00
|
|
|
class QT_UTILITIES_EXPORT SettingsDialog : public QDialog {
|
2015-04-22 18:57:44 +02:00
|
|
|
Q_OBJECT
|
2016-04-04 14:49:40 +02:00
|
|
|
Q_PROPERTY(bool tabBarAlwaysVisible READ isTabBarAlwaysVisible WRITE setTabBarAlwaysVisible)
|
2017-05-01 03:16:25 +02:00
|
|
|
|
2015-04-22 18:57:44 +02:00
|
|
|
public:
|
|
|
|
explicit SettingsDialog(QWidget *parent = nullptr);
|
2018-10-10 21:12:58 +02:00
|
|
|
~SettingsDialog() override;
|
2015-04-22 18:57:44 +02:00
|
|
|
bool isTabBarAlwaysVisible() const;
|
|
|
|
void setTabBarAlwaysVisible(bool value);
|
|
|
|
OptionCategoryModel *categoryModel();
|
|
|
|
OptionCategory *category(int categoryIndex) const;
|
|
|
|
OptionPage *page(int categoryIndex, int pageIndex) const;
|
2016-08-16 00:36:19 +02:00
|
|
|
void showCategory(OptionCategory *category);
|
|
|
|
void setSingleCategory(OptionCategory *singleCategory);
|
2022-08-23 18:43:28 +02:00
|
|
|
QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
|
|
|
|
void setCornerWidget(QWidget *widget, Qt::Corner corner = Qt::TopRightCorner);
|
2022-08-27 15:02:16 +02:00
|
|
|
void addHeadingWidget(QWidget *widget);
|
2022-10-02 20:31:35 +02:00
|
|
|
void selectPage(int categoryIndex, int pageIndex);
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2022-10-01 21:38:40 +02:00
|
|
|
public Q_SLOTS:
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
|
2015-08-10 23:27:26 +02:00
|
|
|
Q_SIGNALS:
|
2015-04-22 18:57:44 +02:00
|
|
|
void applied();
|
|
|
|
void resetted();
|
|
|
|
|
|
|
|
protected:
|
2018-10-10 21:12:58 +02:00
|
|
|
void showEvent(QShowEvent *event) override;
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2015-08-10 23:27:26 +02:00
|
|
|
private Q_SLOTS:
|
2015-04-22 18:57:44 +02:00
|
|
|
void currentCategoryChanged(const QModelIndex &index);
|
|
|
|
void updateTabWidget();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::SettingsDialog> m_ui;
|
|
|
|
OptionCategoryModel *m_categoryModel;
|
|
|
|
OptionCategoryFilterModel *m_categoryFilterModel;
|
|
|
|
OptionCategory *m_currentCategory;
|
|
|
|
bool m_tabBarAlwaysVisible;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns whether the tab bar is always visible.
|
|
|
|
*
|
|
|
|
* The tab bar is always visible by default.
|
|
|
|
*
|
|
|
|
* \sa SettingsDialog::setTabBarAlwaysVisible()
|
|
|
|
*/
|
|
|
|
inline bool SettingsDialog::isTabBarAlwaysVisible() const
|
|
|
|
{
|
|
|
|
return m_tabBarAlwaysVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2017-05-04 22:46:37 +02:00
|
|
|
* \brief Returns the category model used by the settings dialog to manage the
|
|
|
|
* categories.
|
2015-04-22 18:57:44 +02:00
|
|
|
*/
|
|
|
|
inline OptionCategoryModel *SettingsDialog::categoryModel()
|
|
|
|
{
|
|
|
|
return m_categoryModel;
|
|
|
|
}
|
2019-06-10 21:57:46 +02:00
|
|
|
} // namespace QtUtilities
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2016-07-04 23:26:48 +02:00
|
|
|
#endif // DIALOGS_SETTINGSDIALOG_H
|