]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/general/statusbarsettingspage.cpp
Fix includes
[dolphin.git] / src / settings / general / statusbarsettingspage.cpp
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #include "statusbarsettingspage.h"
21
22 #include <dolphin_generalsettings.h>
23
24 #include <KDialog>
25 #include <KLocalizedString>
26
27 #include <QCheckBox>
28 #include <QVBoxLayout>
29
30 StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) :
31 SettingsPageBase(parent),
32 m_showZoomSlider(0),
33 m_showSpaceInfo(0)
34 {
35 m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), this);
36 m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), this);
37
38 QVBoxLayout* topLayout = new QVBoxLayout(this);
39 topLayout->addSpacing(KDialog::spacingHint());
40 topLayout->addWidget(m_showZoomSlider);
41 topLayout->addWidget(m_showSpaceInfo);
42 topLayout->addStretch();
43
44 loadSettings();
45
46 connect(m_showZoomSlider, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed);
47 connect(m_showSpaceInfo, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed);
48 }
49
50 StatusBarSettingsPage::~StatusBarSettingsPage()
51 {
52 }
53
54 void StatusBarSettingsPage::applySettings()
55 {
56 GeneralSettings* settings = GeneralSettings::self();
57 settings->setShowZoomSlider(m_showZoomSlider->isChecked());
58 settings->setShowSpaceInfo(m_showSpaceInfo->isChecked());
59 settings->writeConfig();
60 }
61
62 void StatusBarSettingsPage::restoreDefaults()
63 {
64 GeneralSettings* settings = GeneralSettings::self();
65 settings->useDefaults(true);
66 loadSettings();
67 settings->useDefaults(false);
68 }
69
70 void StatusBarSettingsPage::loadSettings()
71 {
72 m_showZoomSlider->setChecked(GeneralSettings::showZoomSlider());
73 m_showSpaceInfo->setChecked(GeneralSettings::showSpaceInfo());
74 }
75