]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewsettingspage.cpp
Group classes into folders, Dolphin is too big in the meantime for having a flat...
[dolphin.git] / src / settings / 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 "settings/columnviewsettingspage.h"
24 #include "settings/detailsviewsettingspage.h"
25 #include "dolphinmainwindow.h"
26 #include "dolphinviewcontainer.h"
27 #include "settings/generalviewsettingspage.h"
28 #include "settings/iconsviewsettingspage.h"
29
30 #include <QtGui/QBoxLayout>
31 #include <QtGui/QLayout>
32 #include <QtGui/QLabel>
33
34 #include <kdialog.h>
35 #include <klocale.h>
36 #include <kiconloader.h>
37 #include <ktabwidget.h>
38
39
40 ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
41 QWidget* parent) :
42 SettingsPageBase(parent),
43 m_pages()
44 {
45 QVBoxLayout* topLayout = new QVBoxLayout(this);
46 topLayout->setMargin(0);
47 topLayout->setSpacing(KDialog::spacingHint());
48
49 KTabWidget* tabWidget = new KTabWidget(this);
50
51 // initialize 'General' tab
52 const KUrl& url = mainWindow->activeViewContainer()->url();
53 GeneralViewSettingsPage* generalPage = new GeneralViewSettingsPage(url, tabWidget);
54 tabWidget->addTab(generalPage, KIcon("view-choose"), i18nc("@title:tab General settings", "General"));
55 connect(generalPage, SIGNAL(changed()), this, SIGNAL(changed()));
56
57 // initialize 'Icons' tab
58 IconsViewSettingsPage* iconsPage = new IconsViewSettingsPage(tabWidget);
59 tabWidget->addTab(iconsPage, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
60 connect(iconsPage, SIGNAL(changed()), this, SIGNAL(changed()));
61
62 // initialize 'Details' tab
63 DetailsViewSettingsPage* detailsPage = new DetailsViewSettingsPage(tabWidget);
64 tabWidget->addTab(detailsPage, KIcon("view-list-details"), i18nc("@title:tab", "Details"));
65 connect(detailsPage, SIGNAL(changed()), this, SIGNAL(changed()));
66
67 // initialize 'Column' tab
68 ColumnViewSettingsPage* columnPage = new ColumnViewSettingsPage(tabWidget);
69 tabWidget->addTab(columnPage, KIcon("view-file-columns"), i18nc("@title:tab", "Column"));
70 connect(columnPage, SIGNAL(changed()), this, SIGNAL(changed()));
71
72 m_pages.append(generalPage);
73 m_pages.append(iconsPage);
74 m_pages.append(detailsPage);
75 m_pages.append(columnPage);
76
77 topLayout->addWidget(tabWidget, 0, 0);
78 }
79
80 ViewSettingsPage::~ViewSettingsPage()
81 {
82 }
83
84 void ViewSettingsPage::applySettings()
85 {
86 foreach (ViewSettingsPageBase* page, m_pages) {
87 page->applySettings();
88 }
89 }
90
91 void ViewSettingsPage::restoreDefaults()
92 {
93 foreach (ViewSettingsPageBase* page, m_pages) {
94 page->restoreDefaults();
95 }
96 }
97
98 #include "viewsettingspage.moc"