]>
cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewsettingspage.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
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. *
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. *
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 ***************************************************************************/
21 #include "viewsettingspage.h"
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"
30 #include <QtGui/QBoxLayout>
31 #include <QtGui/QLayout>
32 #include <QtGui/QLabel>
36 #include <kiconloader.h>
37 #include <ktabwidget.h>
40 ViewSettingsPage::ViewSettingsPage(DolphinMainWindow
* mainWindow
,
42 SettingsPageBase(parent
),
45 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
46 topLayout
->setMargin(0);
47 topLayout
->setSpacing(KDialog::spacingHint());
49 KTabWidget
* tabWidget
= new KTabWidget(this);
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()));
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()));
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()));
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()));
72 m_pages
.append(generalPage
);
73 m_pages
.append(iconsPage
);
74 m_pages
.append(detailsPage
);
75 m_pages
.append(columnPage
);
77 topLayout
->addWidget(tabWidget
, 0, 0);
80 ViewSettingsPage::~ViewSettingsPage()
84 void ViewSettingsPage::applySettings()
86 foreach (ViewSettingsPageBase
* page
, m_pages
) {
87 page
->applySettings();
91 void ViewSettingsPage::restoreDefaults()
93 foreach (ViewSettingsPageBase
* page
, m_pages
) {
94 page
->restoreDefaults();
98 #include "viewsettingspage.moc"