]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewmodes/viewsettingspage.cpp
Fix includes
[dolphin.git] / src / settings / viewmodes / viewsettingspage.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 "viewsettingspage.h"
22
23 #include <views/dolphinview.h>
24 #include "viewsettingstab.h"
25
26 #include <QVBoxLayout>
27
28 #include <KDialog>
29 #include <KLocalizedString>
30 #include <KTabWidget>
31
32 ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
33 SettingsPageBase(parent),
34 m_tabs()
35 {
36 QVBoxLayout* topLayout = new QVBoxLayout(this);
37 topLayout->setMargin(0);
38 topLayout->setSpacing(KDialog::spacingHint());
39
40 KTabWidget* tabWidget = new KTabWidget(this);
41
42 // Initialize 'Icons' tab
43 ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
44 tabWidget->addTab(iconsTab, QIcon::fromTheme("view-list-icons"), i18nc("@title:tab", "Icons"));
45 connect(iconsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
46
47 // Initialize 'Compact' tab
48 ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget);
49 tabWidget->addTab(compactTab, QIcon::fromTheme("view-list-details"), i18nc("@title:tab", "Compact"));
50 connect(compactTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
51
52 // Initialize 'Details' tab
53 ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget);
54 tabWidget->addTab(detailsTab, QIcon::fromTheme("view-list-tree"), i18nc("@title:tab", "Details"));
55 connect(detailsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
56
57 m_tabs.append(iconsTab);
58 m_tabs.append(compactTab);
59 m_tabs.append(detailsTab);
60
61 topLayout->addWidget(tabWidget, 0, 0);
62 }
63
64 ViewSettingsPage::~ViewSettingsPage()
65 {
66 }
67
68 void ViewSettingsPage::applySettings()
69 {
70 foreach (ViewSettingsTab* tab, m_tabs) {
71 tab->applySettings();
72 }
73 }
74
75 void ViewSettingsPage::restoreDefaults()
76 {
77 foreach (ViewSettingsTab* tab, m_tabs) {
78 tab->restoreDefaultSettings();
79 }
80 }
81