]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/general/generalsettingspage.cpp
Q_DECL_OVERRIDE
[dolphin.git] / src / settings / general / generalsettingspage.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
3 * peter.penz@gmx.at *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #include "generalsettingspage.h"
22
23 #include "behaviorsettingspage.h"
24 #include "confirmationssettingspage.h"
25 #include "previewssettingspage.h"
26 #include <settings/settingspagebase.h>
27 #include "statusbarsettingspage.h"
28
29 #include <KDialog>
30 #include <KLocalizedString>
31 #include <KTabWidget>
32
33 #include <QVBoxLayout>
34
35 GeneralSettingsPage::GeneralSettingsPage(const QUrl& url, QWidget* parent) :
36 SettingsPageBase(parent),
37 m_pages()
38 {
39 QVBoxLayout* topLayout = new QVBoxLayout(this);
40 topLayout->setMargin(0);
41 topLayout->setSpacing(KDialog::spacingHint());
42
43 KTabWidget* tabWidget = new KTabWidget(this);
44
45 // initialize 'Behavior' tab
46 BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(url, tabWidget);
47 tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior"));
48 connect(behaviorPage, &BehaviorSettingsPage::changed, this, &GeneralSettingsPage::changed);
49
50 // initialize 'Previews' tab
51 PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget);
52 tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
53 connect(previewsPage, &PreviewsSettingsPage::changed, this, &GeneralSettingsPage::changed);
54
55 // initialize 'Context Menu' tab
56 ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
57 tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
58 connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &GeneralSettingsPage::changed);
59
60 // initialize 'Status Bar' tab
61 StatusBarSettingsPage* statusBarPage = new StatusBarSettingsPage(tabWidget);
62 tabWidget->addTab(statusBarPage, i18nc("@title:tab Status Bar settings", "Status Bar"));
63 connect(statusBarPage, &StatusBarSettingsPage::changed, this, &GeneralSettingsPage::changed);
64
65 m_pages.append(behaviorPage);
66 m_pages.append(previewsPage);
67 m_pages.append(confirmationsPage);
68 m_pages.append(statusBarPage);
69
70 topLayout->addWidget(tabWidget, 0, 0);
71 }
72
73 GeneralSettingsPage::~GeneralSettingsPage()
74 {
75 }
76
77 void GeneralSettingsPage::applySettings()
78 {
79 foreach (SettingsPageBase* page, m_pages) {
80 page->applySettings();
81 }
82 }
83
84 void GeneralSettingsPage::restoreDefaults()
85 {
86 foreach (SettingsPageBase* page, m_pages) {
87 page->restoreDefaults();
88 }
89 }
90