2020-07-28 21:14:38 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
enum DoubleClickBehavior {
|
|
|
|
ActionDoNothing,
|
|
|
|
ActionCloseWindow,
|
2020-07-29 00:57:43 +08:00
|
|
|
ActionMaximizeWindow,
|
|
|
|
|
2021-01-24 00:07:58 +08:00
|
|
|
DCActionStart = ActionDoNothing,
|
|
|
|
DCActionEnd = ActionMaximizeWindow
|
|
|
|
};
|
|
|
|
|
|
|
|
enum MouseWheelBehavior {
|
|
|
|
ActionZoomImage,
|
|
|
|
ActionPrevNextImage,
|
|
|
|
|
|
|
|
MWActionStart = ActionZoomImage,
|
|
|
|
MWActionEnd = ActionPrevNextImage
|
2020-07-28 21:14:38 +08:00
|
|
|
};
|
|
|
|
|
2022-03-11 16:21:56 +08:00
|
|
|
enum WindowSizeBehavior {
|
|
|
|
ActionAutoSize,
|
|
|
|
ActionMaximize,
|
|
|
|
|
|
|
|
IWSActionStart = ActionAutoSize,
|
|
|
|
IWSActionEnd = ActionMaximize
|
|
|
|
};
|
|
|
|
|
2020-07-28 21:14:38 +08:00
|
|
|
class Settings : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static Settings *instance();
|
|
|
|
|
2020-07-29 00:57:43 +08:00
|
|
|
bool stayOnTop();
|
2022-03-11 16:21:56 +08:00
|
|
|
DoubleClickBehavior doubleClickBehavior() const;
|
|
|
|
MouseWheelBehavior mouseWheelBehavior() const;
|
|
|
|
WindowSizeBehavior initWindowSizeBehavior() const;
|
2020-07-28 21:14:38 +08:00
|
|
|
|
2020-07-29 00:57:43 +08:00
|
|
|
void setStayOnTop(bool on);
|
|
|
|
void setDoubleClickBehavior(DoubleClickBehavior dcb);
|
2021-01-24 00:07:58 +08:00
|
|
|
void setMouseWheelBehavior(MouseWheelBehavior mwb);
|
2022-03-11 16:21:56 +08:00
|
|
|
void setInitWindowSizeBehavior(WindowSizeBehavior wsb);
|
2020-07-29 00:57:43 +08:00
|
|
|
|
2020-07-28 21:14:38 +08:00
|
|
|
static QString doubleClickBehaviorToString(DoubleClickBehavior dcb);
|
2021-01-24 00:07:58 +08:00
|
|
|
static QString mouseWheelBehaviorToString(MouseWheelBehavior mwb);
|
2022-03-11 16:21:56 +08:00
|
|
|
static QString windowSizeBehaviorToString(WindowSizeBehavior wsb);
|
2020-07-28 21:14:38 +08:00
|
|
|
static DoubleClickBehavior stringToDoubleClickBehavior(QString str);
|
2021-01-24 00:07:58 +08:00
|
|
|
static MouseWheelBehavior stringToMouseWheelBehavior(QString str);
|
2022-03-11 16:21:56 +08:00
|
|
|
static WindowSizeBehavior stringToWindowSizeBehavior(QString str);
|
2020-07-28 21:14:38 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
Settings();
|
|
|
|
|
|
|
|
static Settings *m_settings_instance;
|
|
|
|
|
|
|
|
QSettings *m_qsettings;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
};
|
|
|
|
|