5 #define PATH QString("%1%2.config%2/cameraplus.conf").arg(QDir::homePath()).arg(QDir::separator())
8 #define DEFAULT_SCENE_MODE 6 // Auto
9 #define DEFAULT_TIMEOUT 0
10 #define DEFAULT_USE_GPS true
11 #define DEFAULT_USE_GEOTAGS true
12 #define DEFAULT_COLOR_FILTER 0
13 #define DEFAULT_WHITE_BALANCE 0
14 #define DEFAULT_EV_COMP 0.0
15 #define DEFAULT_FLASH_MODE 0
17 Settings::Settings(QObject *parent) :
19 m_settings(new QSettings(PATH, QSettings::IniFormat, this)) {
23 Settings::~Settings() {
24 delete m_settings; m_settings = 0;
27 int Settings::mode() const {
28 return m_settings->value("camera/mode", DEFAULT_MODE).toInt();
31 void Settings::setMode(int mode) {
32 if (mode != Settings::mode()) {
33 m_settings->setValue("camera/mode", mode);
39 QString Settings::creatorName() const {
40 return m_settings->value("camera/creatorName").toString();
43 void Settings::setCreatorName(const QString& name) {
44 if (name != creatorName()) {
45 m_settings->setValue("camera/creatorName", name);
47 emit creatorNameChanged();
51 int Settings::postCaptureTimeout() const {
52 return m_settings->value("camera/postCaptureTimeout", DEFAULT_TIMEOUT).toInt();
55 void Settings::setPostCaptureTimeout(int timeout) {
56 if (timeout != postCaptureTimeout()) {
57 m_settings->setValue("camera/postCaptureTimeout", timeout);
59 emit postCaptureTimeoutChanged();
63 bool Settings::useGps() const {
64 return m_settings->value("camera/useGps", DEFAULT_USE_GPS).toBool();
67 void Settings::setUseGps(bool enable) {
68 if (enable == useGps()) {
69 m_settings->setValue("camera/useGps", enable);
75 bool Settings::useGeotags() const {
76 return m_settings->value("camera/useGeotags", DEFAULT_USE_GEOTAGS).toBool();
79 void Settings::setUseGeotags(bool enable) {
80 if (enable != useGeotags()) {
81 m_settings->setValue("camera/useGeotags", enable);
83 emit useGeotagsChanged();
87 int Settings::imageSceneMode() const {
88 return m_settings->value("image/sceneMode", DEFAULT_SCENE_MODE).toInt();
91 void Settings::setImageSceneMode(int mode) {
92 if (mode != imageSceneMode()) {
93 m_settings->setValue("image/sceneMode", mode);
95 emit imageSceneModeChanged();
99 int Settings::imageColorFilter() const {
100 return m_settings->value("image/colorFilter", DEFAULT_COLOR_FILTER).toInt();
103 void Settings::setImageColorFilter(int filter) {
104 if (filter != imageColorFilter()) {
105 m_settings->setValue("image/colorFilter", filter);
107 emit imageColorFilterChanged();
111 int Settings::imageWhiteBalance() const {
112 return m_settings->value("image/whiteBalance", DEFAULT_WHITE_BALANCE).toInt();
115 void Settings::setImageWhiteBalance(int wb) {
116 if (wb != imageWhiteBalance()) {
117 m_settings->setValue("image/whiteBalance", wb);
119 emit imageWhiteBalanceChanged();
123 qreal Settings::imageEvComp() const {
124 return m_settings->value("image/evComp", DEFAULT_EV_COMP).toReal();
127 void Settings::setImageEvComp(qreal ev) {
128 if (ev != imageEvComp()) {
129 m_settings->setValue("image/evComp", ev);
131 emit imageEvCompChanged();
135 int Settings::videoSceneMode() const {
136 return m_settings->value("video/sceneMode", DEFAULT_SCENE_MODE).toInt();
139 void Settings::setVideoSceneMode(int mode) {
140 if (mode != videoSceneMode()) {
141 m_settings->setValue("video/sceneMode", mode);
143 emit videoSceneModeChanged();
147 int Settings::videoColorFilter() const {
148 return m_settings->value("video/colorFilter", DEFAULT_COLOR_FILTER).toInt();
151 void Settings::setVideoColorFilter(int filter) {
152 if (filter != videoColorFilter()) {
153 m_settings->setValue("video/colorFilter", filter);
155 emit videoColorFilterChanged();
159 int Settings::videoWhiteBalance() const {
160 return m_settings->value("video/whiteBalance", DEFAULT_WHITE_BALANCE).toInt();
163 void Settings::setVideoWhiteBalance(int wb) {
164 if (wb != videoWhiteBalance()) {
165 m_settings->setValue("video/whiteBalance", wb);
167 emit videoWhiteBalanceChanged();
171 qreal Settings::videoEvComp() const {
172 return m_settings->value("video/evComp", DEFAULT_EV_COMP).toReal();
175 void Settings::setVideoEvComp(qreal ev) {
176 if (ev != videoEvComp()) {
177 m_settings->setValue("video/evComp", ev);
179 emit videoEvCompChanged();
183 int Settings::imageFlashMode() const {
184 return m_settings->value("image/flashMode", DEFAULT_FLASH_MODE).toInt();
187 void Settings::setImageFlashMode(int mode) {
188 if (mode != imageFlashMode()) {
189 m_settings->setValue("image/flashMode", mode);
191 emit imageFlashModeChanged();