summaryrefslogtreecommitdiff
path: root/browser/browserconfig.cpp
blob: c5d32b6115f4a0001531a1a5e3b5e0e119725568 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * Copyright (C) 2014, Pelagicore
 *
 * Author: Jonatan Palsson <jonatan.palsson@pelagicore.com>
 *
 * This file is part of the GENIVI project Browser Proof-Of-Concept
 * For further information, see http://genivi.org/
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
#include <QDebug>

#include "browserconfig.h"

template void      BrowserConfig::setValue<int>(BrowserConfig::BrowserConfigKey, int);
template void      BrowserConfig::setValue<QString>(BrowserConfig::BrowserConfigKey, QString);
template void      BrowserConfig::setValue<qlonglong>(BrowserConfig::BrowserConfigKey, qlonglong);
template void      BrowserConfig::setValue<qulonglong>(BrowserConfig::BrowserConfigKey, qulonglong);
template void      BrowserConfig::setValue<conn::brw::CACHE_POLICY>(BrowserConfig::BrowserConfigKey, conn::brw::CACHE_POLICY);

template int       BrowserConfig::getValue<int>(BrowserConfig::BrowserConfigKey);
template QString   BrowserConfig::getValue<QString>(BrowserConfig::BrowserConfigKey);
template qlonglong BrowserConfig::getValue<qlonglong>(BrowserConfig::BrowserConfigKey);
template qulonglong BrowserConfig::getValue<qulonglong>(BrowserConfig::BrowserConfigKey);
template conn::brw::CACHE_POLICY BrowserConfig::getValue<conn::brw::CACHE_POLICY>(BrowserConfig::BrowserConfigKey);

BrowserConfig* BrowserConfig::m_config = NULL;

BrowserConfig::BrowserConfig() {
    m_qsettings = new QSettings("browserpoc");
}

template<typename T>
T BrowserConfig::getValue(BrowserConfig::BrowserConfigKey key) {
    return m_qsettings->value(QString(key)).value<T>();
}

template<typename T>
void BrowserConfig::setValue(BrowserConfig::BrowserConfigKey key, T value) {
    m_qsettings->setValue(QString(key), value);
    m_qsettings->sync();
}

bool BrowserConfig::contains(BrowserConfig::BrowserConfigKey key) {
    return m_qsettings->contains(QString(key));
}