pineapple-pictures/app/settings.h
Gary Wang 1449844fdd fix: avoid create menu actions everytime when trigger context menu.
fix the minor memory leak issue, also bring some possibility to
implement custom keybinding.

And oops I also did another feature in this commit..
Now we are able to set mouse wheel behavior in config dialog.
2021-01-24 00:07:58 +08:00

54 lines
1.2 KiB
C++

#pragma once
#include <QObject>
#include <QSettings>
enum DoubleClickBehavior {
ActionDoNothing,
ActionCloseWindow,
ActionMaximizeWindow,
DCActionStart = ActionDoNothing,
DCActionEnd = ActionMaximizeWindow
};
enum MouseWheelBehavior {
ActionZoomImage,
ActionPrevNextImage,
MWActionStart = ActionZoomImage,
MWActionEnd = ActionPrevNextImage
};
class Settings : public QObject
{
Q_OBJECT
public:
static Settings *instance();
bool stayOnTop();
DoubleClickBehavior doubleClickBehavior();
MouseWheelBehavior mouseWheelBehavior();
void setStayOnTop(bool on);
void setDoubleClickBehavior(DoubleClickBehavior dcb);
void setMouseWheelBehavior(MouseWheelBehavior mwb);
static QString doubleClickBehaviorToString(DoubleClickBehavior dcb);
static QString mouseWheelBehaviorToString(MouseWheelBehavior mwb);
static DoubleClickBehavior stringToDoubleClickBehavior(QString str);
static MouseWheelBehavior stringToMouseWheelBehavior(QString str);
private:
Settings();
static Settings *m_settings_instance;
QSettings *m_qsettings;
signals:
public slots:
};