]>
cloud.milkyroute.net Git - dolphin.git/blob - src/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 "columnviewsettingspage.h"
24 #include "detailsviewsettingspage.h"
25 #include "dolphinmainwindow.h"
26 #include "dolphinviewcontainer.h"
27 #include "generalviewsettingspage.h"
28 #include "iconsviewsettingspage.h"
30 #include <QtGui/QBoxLayout>
31 #include <QtGui/QTabWidget>
32 #include <QtGui/QLayout>
33 #include <QtGui/QLabel>
37 #include <kiconloader.h>
39 ViewSettingsPage::ViewSettingsPage(DolphinMainWindow
* mainWindow
,
41 SettingsPageBase(parent
),
44 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
45 topLayout
->setMargin(0);
46 topLayout
->setSpacing(KDialog::spacingHint());
48 QTabWidget
* tabWidget
= new QTabWidget(this);
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()));
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()));
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()));
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()));
71 m_pages
.append(generalPage
);
72 m_pages
.append(iconsPage
);
73 m_pages
.append(detailsPage
);
74 m_pages
.append(columnPage
);
76 topLayout
->addWidget(tabWidget
, 0, 0);
79 ViewSettingsPage::~ViewSettingsPage()
83 void ViewSettingsPage::applySettings()
85 foreach (ViewSettingsPageBase
* page
, m_pages
) {
86 page
->applySettings();
90 void ViewSettingsPage::restoreDefaults()
92 foreach (ViewSettingsPageBase
* page
, m_pages
) {
93 page
->restoreDefaults();
97 #include "viewsettingspage.moc"