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