]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/general/statusbarsettingspage.cpp
85195cb637d154884efb904995931c62fbca3314
[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 <KLocalizedString>
25
26 #include <QCheckBox>
27 #include <QVBoxLayout>
28
29 StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) :
30 SettingsPageBase(parent),
31 m_showZoomSlider(nullptr),
32 m_showSpaceInfo(nullptr)
33 {
34 m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), this);
35 m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), this);
36
37 QVBoxLayout* topLayout = new QVBoxLayout(this);
38 topLayout->addWidget(m_showZoomSlider);
39 topLayout->addWidget(m_showSpaceInfo);
40 topLayout->addStretch();
41
42 loadSettings();
43
44 connect(m_showZoomSlider, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed);
45 connect(m_showSpaceInfo, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed);
46 }
47
48 StatusBarSettingsPage::~StatusBarSettingsPage()
49 {
50 }
51
52 void StatusBarSettingsPage::applySettings()
53 {
54 GeneralSettings* settings = GeneralSettings::self();
55 settings->setShowZoomSlider(m_showZoomSlider->isChecked());
56 settings->setShowSpaceInfo(m_showSpaceInfo->isChecked());
57 settings->save();
58 }
59
60 void StatusBarSettingsPage::restoreDefaults()
61 {
62 GeneralSettings* settings = GeneralSettings::self();
63 settings->useDefaults(true);
64 loadSettings();
65 settings->useDefaults(false);
66 }
67
68 void StatusBarSettingsPage::loadSettings()
69 {
70 m_showZoomSlider->setChecked(GeneralSettings::showZoomSlider());
71 m_showSpaceInfo->setChecked(GeneralSettings::showSpaceInfo());
72 }
73