summaryrefslogtreecommitdiff
path: root/src/settings.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.h')
-rw-r--r--src/settings.h62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/settings.h b/src/settings.h
index cd478a5b..1556ba1e 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -41,20 +41,6 @@ class ServerList;
class Settings;
-// helper class that calls restoreGeometry() in the constructor and
-// saveGeometry() in the destructor
-//
-class GeometrySaver
-{
-public:
- GeometrySaver(Settings& s, QDialog* dialog);
- ~GeometrySaver();
-
-private:
- Settings& m_settings;
- QDialog* m_dialog;
-};
-
// setting for the currently managed game
//
@@ -141,8 +127,11 @@ public:
void resetIfNeeded();
- void saveGeometry(const QWidget* w);
- bool restoreGeometry(QWidget* w) const;
+ void saveGeometry(const QMainWindow* w);
+ bool restoreGeometry(QMainWindow* w) const;
+
+ void saveGeometry(const QDialog* d);
+ bool restoreGeometry(QDialog* d) const;
void saveState(const QMainWindow* window);
bool restoreState(QMainWindow* window) const;
@@ -171,6 +160,11 @@ public:
QStringList modInfoTabOrder() const;
void setModInfoTabOrder(const QString& names);
+ // whether dialogs should be centered on their parent
+ //
+ bool centerDialogs() const;
+ void setCenterDialogs(bool b);
+
// assumes the given widget is a top-level
//
void centerOnMainWindowMonitor(QWidget* w);
@@ -182,6 +176,13 @@ public:
private:
QSettings& m_Settings;
bool m_Reset;
+
+ void saveWindowGeometry(const QWidget* w);
+ bool restoreWindowGeometry(QWidget* w) const;
+
+ void ensureWindowOnScreen(QWidget* w) const;
+ static void centerOnMonitor(QWidget* w, int monitor);
+ static void centerOnParent(QWidget* w, QWidget* parent=nullptr);
};
@@ -691,6 +692,11 @@ public:
bool archiveParsing() const;
void setArchiveParsing(bool b);
+ // whether the user wants to check for updates
+ //
+ bool checkForUpdates() const;
+ void setCheckForUpdates(bool b);
+
// whether the user wants to upgrade to pre-releases
//
bool usePrereleases() const;
@@ -764,4 +770,28 @@ private:
DiagnosticsSettings m_Diagnostics;
};
+
+// helper class that calls restoreGeometry() in the constructor and
+// saveGeometry() in the destructor
+//
+template <class W>
+class GeometrySaver
+{
+public:
+ GeometrySaver(Settings& s, W* w)
+ : m_settings(s), m_widget(w)
+ {
+ m_settings.geometry().restoreGeometry(m_widget);
+ }
+
+ ~GeometrySaver()
+ {
+ m_settings.geometry().saveGeometry(m_widget);
+ }
+
+private:
+ Settings& m_settings;
+ W* m_widget;
+};
+
#endif // SETTINGS_H