mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +00:00
Migrated the ViewPropertiesDialog to Qt4.
svn path=/trunk/playground/utils/dolphin/; revision=607475
This commit is contained in:
parent
4ff8dbf5e9
commit
c2c719839c
|
@ -19,60 +19,56 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "viewpropertiesdialog.h"
|
||||
|
||||
#include <klocale.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <q3vbox.h>
|
||||
#include <q3buttongroup.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qsizepolicy.h>
|
||||
#include <q3groupbox.h>
|
||||
#include <qcombobox.h>
|
||||
//Added by qt3to4:
|
||||
#include <Q3VBoxLayout>
|
||||
#include <kiconloader.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "viewproperties.h"
|
||||
#include "dolphinview.h"
|
||||
|
||||
ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
||||
KDialog(dolphinView, static_cast<Qt::WFlags>(Ok /* KDE4-TODO: Apply | Cancel*/)),
|
||||
KDialog(dolphinView),
|
||||
m_isDirty(false),
|
||||
m_dolphinView(dolphinView)
|
||||
{
|
||||
assert(dolphinView != 0);
|
||||
|
||||
const int margin = KDialog::marginHint();
|
||||
const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
setCaption(i18n("View Properties"));
|
||||
setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
|
||||
|
||||
const KUrl& url = dolphinView->url();
|
||||
m_viewProps = new ViewProperties(url);
|
||||
m_viewProps->setAutoSaveEnabled(false);
|
||||
|
||||
Q3VBoxLayout* topLayout = new Q3VBoxLayout(mainWidget(), 0, spacingHint());
|
||||
QWidget* main = new QWidget();
|
||||
QVBoxLayout* topLayout = new QVBoxLayout();
|
||||
|
||||
// create 'Properties' group containing view mode, sorting, sort order and show hidden files
|
||||
Q3GroupBox* propsGroup = new Q3GroupBox(2, Qt::Horizontal, i18n("Properties"), mainWidget());
|
||||
propsGroup->setSizePolicy(sizePolicy);
|
||||
propsGroup->setMargin(margin);
|
||||
QGroupBox* propsBox = new QGroupBox(i18n("Properties"), main);
|
||||
|
||||
new QLabel(i18n("View mode:"), propsGroup);
|
||||
m_viewMode = new QComboBox(propsGroup);
|
||||
m_viewMode->insertItem(SmallIcon("view_icon"), i18n("Icons"));
|
||||
m_viewMode->insertItem(SmallIcon("view_text"), i18n("Details"));
|
||||
m_viewMode->insertItem(SmallIcon("gvdirpart"), i18n("Previews"));
|
||||
QLabel* viewModeLabel = new QLabel(i18n("View mode:"), propsBox);
|
||||
m_viewMode = new QComboBox(propsBox);
|
||||
m_viewMode->addItem(SmallIcon("view_icon"), i18n("Icons"));
|
||||
m_viewMode->addItem(SmallIcon("view_text"), i18n("Details"));
|
||||
m_viewMode->addItem(SmallIcon("gvdirpart"), i18n("Previews"));
|
||||
const int index = static_cast<int>(m_viewProps->viewMode());
|
||||
m_viewMode->setCurrentItem(index);
|
||||
m_viewMode->setCurrentIndex(index);
|
||||
|
||||
new QLabel(i18n("Sorting:"), propsGroup);
|
||||
m_sorting = new QComboBox(propsGroup);
|
||||
m_sorting->insertItem("By Name");
|
||||
m_sorting->insertItem("By Size");
|
||||
m_sorting->insertItem("By Date");
|
||||
QLabel* sortingLabel = new QLabel(i18n("Sorting:"), propsBox);
|
||||
m_sorting = new QComboBox(propsBox);
|
||||
m_sorting->addItem("By Name");
|
||||
m_sorting->addItem("By Size");
|
||||
m_sorting->addItem("By Date");
|
||||
int sortingIdx = 0;
|
||||
switch (m_viewProps->sorting()) {
|
||||
case DolphinView::SortByName: sortingIdx = 0; break;
|
||||
|
@ -80,34 +76,39 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
case DolphinView::SortByDate: sortingIdx = 2; break;
|
||||
default: break;
|
||||
}
|
||||
m_sorting->setCurrentItem(sortingIdx);
|
||||
m_sorting->setCurrentIndex(sortingIdx);
|
||||
|
||||
new QLabel(i18n("Sort order:"), propsGroup);
|
||||
m_sortOrder = new QComboBox(propsGroup);
|
||||
m_sortOrder->insertItem(i18n("Ascending"));
|
||||
m_sortOrder->insertItem(i18n("Descending"));
|
||||
QLabel* sortOrderLabel = new QLabel(i18n("Sort order:"), propsBox);
|
||||
m_sortOrder = new QComboBox(propsBox);
|
||||
m_sortOrder->addItem(i18n("Ascending"));
|
||||
m_sortOrder->addItem(i18n("Descending"));
|
||||
const int sortOrderIdx = (m_viewProps->sortOrder() == Qt::Ascending) ? 0 : 1;
|
||||
m_sortOrder->setCurrentItem(sortOrderIdx);
|
||||
m_sortOrder->setCurrentIndex(sortOrderIdx);
|
||||
|
||||
m_showHiddenFiles = new QCheckBox(i18n("Show hidden files"), propsGroup);
|
||||
m_showHiddenFiles = new QCheckBox(i18n("Show hidden files"), propsBox);
|
||||
m_showHiddenFiles->setChecked(m_viewProps->isShowHiddenFilesEnabled());
|
||||
|
||||
QGridLayout* propsBoxLayout = new QGridLayout(propsBox);
|
||||
propsBoxLayout->addWidget(viewModeLabel, 0, 0);
|
||||
propsBoxLayout->addWidget(m_viewMode, 0, 1);
|
||||
propsBoxLayout->addWidget(m_sorting, 1, 1);
|
||||
propsBoxLayout->addWidget(sortingLabel, 1, 0);
|
||||
propsBoxLayout->addWidget(m_sorting, 1, 1);
|
||||
propsBoxLayout->addWidget(sortOrderLabel, 2, 0);
|
||||
propsBoxLayout->addWidget(m_sortOrder, 2, 1);
|
||||
propsBoxLayout->addWidget(m_showHiddenFiles, 3, 0);
|
||||
|
||||
// create 'Apply view properties to:' group
|
||||
Q3ButtonGroup* buttonGroup = new Q3ButtonGroup(3,
|
||||
Qt::Vertical,
|
||||
i18n("Apply view properties to:"),
|
||||
mainWidget());
|
||||
buttonGroup->setSizePolicy(sizePolicy);
|
||||
buttonGroup->setMargin(margin);
|
||||
QGroupBox* buttonBox = new QGroupBox(i18n("Apply view properties to:"), main);
|
||||
m_applyToCurrentFolder = new QRadioButton(i18n("Current folder"), buttonBox);
|
||||
m_applyToSubFolders = new QRadioButton(i18n("Current folder including all sub folders"), buttonBox);
|
||||
m_applyToAllFolders = new QRadioButton(i18n("All folders"), buttonBox);
|
||||
|
||||
m_applyToCurrentFolder = new QRadioButton(i18n("Current folder"), buttonGroup);
|
||||
buttonGroup->insert(m_applyToCurrentFolder);
|
||||
|
||||
m_applyToSubFolders = new QRadioButton(i18n("Current folder including all sub folders"), buttonGroup);
|
||||
buttonGroup->insert(m_applyToSubFolders);
|
||||
|
||||
m_applyToAllFolders = new QRadioButton(i18n("All folders"), buttonGroup);
|
||||
buttonGroup->insert(m_applyToAllFolders);
|
||||
QVBoxLayout* buttonBoxLayout = new QVBoxLayout();
|
||||
buttonBoxLayout->addWidget(m_applyToCurrentFolder);
|
||||
buttonBoxLayout->addWidget(m_applyToSubFolders);
|
||||
buttonBoxLayout->addWidget(m_applyToAllFolders);
|
||||
buttonBox->setLayout(buttonBoxLayout);
|
||||
|
||||
if (m_viewProps->isValidForSubDirs()) {
|
||||
m_applyToSubFolders->setChecked(true);
|
||||
|
@ -116,8 +117,8 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
m_applyToCurrentFolder->setChecked(true);
|
||||
}
|
||||
|
||||
topLayout->addWidget(propsGroup);
|
||||
topLayout->addWidget(buttonGroup);
|
||||
topLayout->addWidget(propsBox);
|
||||
topLayout->addWidget(buttonBox);
|
||||
|
||||
connect(m_viewMode, SIGNAL(activated(int)),
|
||||
this, SLOT(slotViewModeChanged(int)));
|
||||
|
@ -133,6 +134,9 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
this, SLOT(slotApplyToSubFolders()));
|
||||
connect(m_applyToAllFolders, SIGNAL(clicked()),
|
||||
this, SLOT(slotApplyToAllFolders()));
|
||||
|
||||
main->setLayout(topLayout);
|
||||
setMainWidget(main);
|
||||
}
|
||||
|
||||
ViewPropertiesDialog::~ViewPropertiesDialog()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <kdialog.h>
|
||||
|
||||
class QCheckBox;
|
||||
class Q3ButtonGroup;
|
||||
class QComboBox;
|
||||
class QRadioButton;
|
||||
class ViewProperties;
|
||||
|
|
Loading…
Reference in New Issue
Block a user