]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewmodes/viewsettingspage.cpp
Merged very early alpha-version of Dolphin 2.0
[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 "iconsviewsettingspage.h"
24 #include "detailsviewsettingspage.h"
25
26 #include <QVBoxLayout>
27
28 #include <KDialog>
29 #include <KLocale>
30 #include <KIconLoader>
31 #include <KTabWidget>
32
33 ViewSettingsPage::ViewSettingsPage(QWidget* parent) :
34 SettingsPageBase(parent),
35 m_pages()
36 {
37 QVBoxLayout* topLayout = new QVBoxLayout(this);
38 topLayout->setMargin(0);
39 topLayout->setSpacing(KDialog::spacingHint());
40
41 KTabWidget* tabWidget = new KTabWidget(this);
42
43 // initialize 'Icons' tab
44 IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
45 tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
46 connect(iconsPage, SIGNAL(changed()), this, SIGNAL(changed()));
47
48 // TODO: initialize 'Compact' tab
49
50 // initialize 'Details' tab
51 DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget);
52 tabWidget->addTab(detailsPage, KIcon("view-list-text"), i18nc("@title:tab", "Details"));
53 connect(detailsPage, SIGNAL(changed()), this, SIGNAL(changed()));
54
55 m_pages.append(iconsPage);
56 m_pages.append(detailsPage);
57
58 topLayout->addWidget(tabWidget, 0, 0);
59 }
60
61 ViewSettingsPage::~ViewSettingsPage()
62 {
63 }
64
65 void ViewSettingsPage::applySettings()
66 {
67 foreach (ViewSettingsPageBase* page, m_pages) {
68 page->applySettings();
69 }
70 }
71
72 void ViewSettingsPage::restoreDefaults()
73 {
74 foreach (ViewSettingsPageBase* page, m_pages) {
75 page->restoreDefaults();
76 }
77 }
78
79 #include "viewsettingspage.moc"