~ubuntu-branches/ubuntu/wily/kid3/wily

« back to all changes in this revision

Viewing changes to src/app/qt/mainwindowconfig.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2015-05-12 18:56:41 UTC
  • mfrom: (1.1.19) (2.3.3 sid)
  • Revision ID: package-import@ubuntu.com-20150512185641-hgeys2pingwq9mwn
Tags: 3.2.1-1
* New upstream release.
  - Add new build dependency qt4-dev-tools.
* Uploading to unstable.
* Switch to DEP5 debian/copyright format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * \file mainwindowconfig.cpp
3
 
 * Main window configuration.
4
 
 *
5
 
 * \b Project: Kid3
6
 
 * \author Urs Fleisch
7
 
 * \date 08 Apr 2013
8
 
 *
9
 
 * Copyright (C) 2013  Urs Fleisch
10
 
 *
11
 
 * This file is part of Kid3.
12
 
 *
13
 
 * Kid3 is free software; you can redistribute it and/or modify
14
 
 * it under the terms of the GNU General Public License as published by
15
 
 * the Free Software Foundation; either version 2 of the License, or
16
 
 * (at your option) any later version.
17
 
 *
18
 
 * Kid3 is distributed in the hope that it will be useful,
19
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 
 * GNU General Public License for more details.
22
 
 *
23
 
 * You should have received a copy of the GNU General Public License
24
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
 */
26
 
 
27
 
#include "mainwindowconfig.h"
28
 
 
29
 
int MainWindowConfig::s_index = -1;
30
 
 
31
 
/**
32
 
 * Constructor.
33
 
 */
34
 
MainWindowConfig::MainWindowConfig() :
35
 
  StoredConfig<MainWindowConfig>(QLatin1String("MainWindow")),
36
 
  m_fontSize(-1),
37
 
  m_useFont(false),
38
 
  m_hideToolBar(false),
39
 
  m_hideStatusBar(false),
40
 
  m_dontUseNativeDialogs(
41
 
#if defined Q_OS_WIN32 || defined Q_OS_MAC
42
 
    false
43
 
#else
44
 
    true
45
 
#endif
46
 
  )
47
 
{
48
 
}
49
 
 
50
 
/**
51
 
 * Destructor.
52
 
 */
53
 
MainWindowConfig::~MainWindowConfig()
54
 
{
55
 
}
56
 
 
57
 
/**
58
 
 * Persist configuration.
59
 
 *
60
 
 * @param config configuration
61
 
 */
62
 
void MainWindowConfig::writeToConfig(ISettings* config) const
63
 
{
64
 
  config->beginGroup(m_group);
65
 
  config->setValue(QLatin1String("HideToolBar"), QVariant(m_hideToolBar));
66
 
  config->setValue(QLatin1String("HideStatusBar"), QVariant(m_hideStatusBar));
67
 
  config->setValue(QLatin1String("Geometry"), m_geometry);
68
 
  config->setValue(QLatin1String("WindowState"), m_windowState);
69
 
  config->setValue(QLatin1String("UseFont"), QVariant(m_useFont));
70
 
  config->setValue(QLatin1String("FontFamily"), QVariant(m_fontFamily));
71
 
  config->setValue(QLatin1String("FontSize"), QVariant(m_fontSize));
72
 
  config->setValue(QLatin1String("Style"), QVariant(m_style));
73
 
  config->setValue(QLatin1String("DontUseNativeDialogs"), QVariant(m_dontUseNativeDialogs));
74
 
  config->endGroup();
75
 
}
76
 
 
77
 
/**
78
 
 * Read persisted configuration.
79
 
 *
80
 
 * @param config configuration
81
 
 */
82
 
void MainWindowConfig::readFromConfig(ISettings* config)
83
 
{
84
 
  config->beginGroup(m_group);
85
 
  m_hideToolBar = config->value(QLatin1String("HideToolBar"), m_hideToolBar).toBool();
86
 
  m_hideStatusBar = config->value(QLatin1String("HideStatusBar"), m_hideStatusBar).toBool();
87
 
  m_geometry = config->value(QLatin1String("Geometry"), m_geometry).toByteArray();
88
 
  m_windowState = config->value(QLatin1String("WindowState"), m_windowState).toByteArray();
89
 
  m_useFont = config->value(QLatin1String("UseFont"), m_useFont).toBool();
90
 
  m_fontFamily = config->value(QLatin1String("FontFamily"), m_fontFamily).toString();
91
 
  m_fontSize = config->value(QLatin1String("FontSize"), -1).toInt();
92
 
  m_style = config->value(QLatin1String("Style"), m_style).toString();
93
 
  m_dontUseNativeDialogs = config->value(QLatin1String("DontUseNativeDialogs"),
94
 
                                         m_dontUseNativeDialogs).toBool();
95
 
  config->endGroup();
96
 
}