2 * This file is part of CameraPlus.
4 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "platformsettings.h"
25 #define PATH "/usr/share/cameraplus/config/cameraplus.ini"
27 #define PREVIEW_SIZE QSize(854, 480)
28 #define THUMBNAIL_FLAVOR_NAME QString("screen")
29 #define TEMPORARY_FILE_PATH "%1%2.config%2quill%2tmp"
30 #define THUMBNAIL_EXTENSION QString("jpeg")
31 #define THUMBNAIL_CREATION_ENABLED true
32 #define DBUS_THUMBNAILING_ENABLED true
33 #define BACKGROUND_RENDERING_COLOR QColor(Qt::black)
35 PlatformSettings::PlatformSettings() :
36 QSettings(PATH, QSettings::IniFormat) {
40 PlatformSettings::~PlatformSettings() {
44 QList<QPair<QString, QSize> > PlatformSettings::previewLevels() {
45 return QList<QPair<QString, QSize> >() <<
46 qMakePair<QString, QSize>(value("quill/thumbnailFlavorName", THUMBNAIL_FLAVOR_NAME).toString(),
47 value("quill/previewSize", PREVIEW_SIZE).toSize());
50 QString PlatformSettings::thumbnailExtension() {
51 return value("quill/thumbnailExtension", THUMBNAIL_EXTENSION).toString();
54 QColor PlatformSettings::backgroundRenderingColor() {
55 return value("quill/backgroundRenderingColor", BACKGROUND_RENDERING_COLOR).value<QColor>();
58 bool PlatformSettings::isDBusThumbnailingEnabled() {
59 return value("quill/dbusThumbnailingEnabled", DBUS_THUMBNAILING_ENABLED).toBool();
62 bool PlatformSettings::isThumbnailCreationEnabled() {
63 return value("quill/thumbnailCreationEnabled", THUMBNAIL_CREATION_ENABLED).toBool();
66 QString PlatformSettings::temporaryFilePath() {
67 QString defaultPath = QString(TEMPORARY_FILE_PATH).arg(QDir::homePath()).arg(QDir::separator());
68 return value("quill/temporaryFilePath", defaultPath).toString();