src/baseconfiguration.cpp

Wed, 08 Mar 2017 22:09:48 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 08 Mar 2017 22:09:48 +0200
changeset 1205
4597f9fc8738
parent 1204
1d25231dd7c9
child 1206
743dc95e0be6
permissions
-rw-r--r--

Whoops

1204
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 /*
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 *
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 * (at your option) any later version.
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 *
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * GNU General Public License for more details.
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 *
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 */
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #include <QSet>
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include <QSettings>
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 #include <QVariant>
1205
Teemu Piippo <teemu@hecknology.net>
parents: 1204
diff changeset
22 #include "baseconfiguration.h"
1204
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 #include "mainwindow.h"
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 BaseConfiguration::BaseConfiguration() :
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 m_settings {MainWindow::makeSettings(this)} {}
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 BaseConfiguration::~BaseConfiguration()
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 {
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 delete m_settings;
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 }
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 QVariant BaseConfiguration::defaultValueByName(const QString& name)
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 {
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 if (m_isInitialized)
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 initDefaults();
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 return m_defaults.value(name);
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 }
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 bool BaseConfiguration::existsEntry(const QString& name)
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 {
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 return m_defaults.find(name) != m_defaults.end();
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 }
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 void BaseConfiguration::initDefaults()
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47 {
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
48 m_isInitialized = true;
1d25231dd7c9 Split the configuration main interface to a new class, BaseInterface, so that moc can properly deal with it.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 }

mercurial