From f23e9496f303995557b744c03178f5dbd9b35016 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 30 Jul 2011 20:13:09 +0200 Subject: Merged very early alpha-version of Dolphin 2.0 Dolphin 2.0 will get a new view-engine with the following improvements: - Better performance - Animated transitions - No clipped filenames due to dynamic item-sizes - Grouping support for all view-modes - Non-rectangular selection areas - Simplified code for better maintenance More details will be provided in a blog-entry during the next days. Please note that the code is in a very early alpha-stage and although the most tricky parts have been implemented already very basic things like drag and drop or selections have not been pushed yet. Those things are rather trivial to implement but this still will take some time. --- .../folders/dolphin_folderspanelsettings.kcfg | 4 +- src/panels/folders/folderspanel.cpp | 67 +++++++++++----------- src/panels/folders/folderspanel.h | 8 +-- src/panels/folders/paneltreeview.cpp | 10 ++-- src/panels/folders/treeviewcontextmenu.cpp | 4 +- .../dolphin_informationpanelsettings.kcfg | 4 +- src/panels/information/informationpanelcontent.cpp | 10 ++-- src/panels/places/placespanel.cpp | 6 +- 8 files changed, 57 insertions(+), 56 deletions(-) (limited to 'src/panels') diff --git a/src/panels/folders/dolphin_folderspanelsettings.kcfg b/src/panels/folders/dolphin_folderspanelsettings.kcfg index 716be829c..8b8ca66f8 100644 --- a/src/panels/folders/dolphin_folderspanelsettings.kcfg +++ b/src/panels/folders/dolphin_folderspanelsettings.kcfg @@ -6,8 +6,8 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"> - - + + false diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index ccdf13dec..fe0f0b134 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -39,9 +39,6 @@ #include #include -#include -#include -#include #include #include #include @@ -51,8 +48,8 @@ FoldersPanel::FoldersPanel(QWidget* parent) : m_setLeafVisible(false), m_mouseButtons(Qt::NoButton), m_dirLister(0), - m_dolphinModel(0), - m_proxyModel(0), + //m_dolphinModel(0), + //m_proxyModel(0), m_treeView(0), m_leafDir() { @@ -63,25 +60,26 @@ FoldersPanel::~FoldersPanel() { FoldersPanelSettings::self()->writeConfig(); - delete m_proxyModel; - m_proxyModel = 0; - delete m_dolphinModel; - m_dolphinModel = 0; - m_dirLister = 0; // deleted by m_dolphinModel + //delete m_proxyModel; + //m_proxyModel = 0; + //delete m_dolphinModel; + //m_dolphinModel = 0; + delete m_dirLister; + m_dirLister = 0; } -void FoldersPanel::setShowHiddenFiles(bool show) +void FoldersPanel::setHiddenFilesShown(bool show) { - FoldersPanelSettings::setShowHiddenFiles(show); + FoldersPanelSettings::setHiddenFilesShown(show); if (m_dirLister) { m_dirLister->setShowingDotFiles(show); m_dirLister->openUrl(m_dirLister->url(), KDirLister::Reload); } } -bool FoldersPanel::showHiddenFiles() const +bool FoldersPanel::hiddenFilesShown() const { - return FoldersPanelSettings::showHiddenFiles(); + return FoldersPanelSettings::hiddenFilesShown(); } void FoldersPanel::setAutoScrolling(bool enable) @@ -98,9 +96,9 @@ bool FoldersPanel::autoScrolling() const void FoldersPanel::rename(const KFileItem& item) { if (DolphinSettings::instance().generalSettings()->renameInline()) { - const QModelIndex dirIndex = m_dolphinModel->indexForItem(item); - const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); - m_treeView->edit(proxyIndex); + //const QModelIndex dirIndex = m_dolphinModel->indexForItem(item); + //const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); + //m_treeView->edit(proxyIndex); } else { RenameDialog* dialog = new RenameDialog(this, KFileItemList() << item); dialog->setAttribute(Qt::WA_DeleteOnClose); @@ -143,10 +141,10 @@ void FoldersPanel::showEvent(QShowEvent* event) m_dirLister->setMainWindow(window()); m_dirLister->setDelayedMimeTypes(true); m_dirLister->setAutoErrorHandlingEnabled(false, this); - m_dirLister->setShowingDotFiles(FoldersPanelSettings::showHiddenFiles()); + m_dirLister->setShowingDotFiles(FoldersPanelSettings::hiddenFilesShown()); connect(m_dirLister, SIGNAL(completed()), this, SLOT(slotDirListerCompleted())); - Q_ASSERT(!m_dolphinModel); + /*Q_ASSERT(!m_dolphinModel); m_dolphinModel = new DolphinModel(this); m_dolphinModel->setDirLister(m_dirLister); m_dolphinModel->setDropsAllowed(DolphinModel::DropOnDirectory); @@ -180,7 +178,7 @@ void FoldersPanel::showEvent(QShowEvent* event) QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); - layout->addWidget(m_treeView); + layout->addWidget(m_treeView);*/ } loadTree(url()); @@ -192,11 +190,11 @@ void FoldersPanel::contextMenuEvent(QContextMenuEvent* event) Panel::contextMenuEvent(event); KFileItem item; - const QModelIndex index = m_treeView->indexAt(event->pos()); + /*const QModelIndex index = m_treeView->indexAt(event->pos()); if (index.isValid()) { const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index); item = m_dolphinModel->itemForIndex(dolphinModelIndex); - } + }*/ QPointer contextMenu = new TreeViewContextMenu(this, item); contextMenu->open(); @@ -216,22 +214,25 @@ void FoldersPanel::keyPressEvent(QKeyEvent* event) void FoldersPanel::updateActiveView(const QModelIndex& index) { - const QModelIndex dirIndex = m_proxyModel->mapToSource(index); + Q_UNUSED(index); + /*const QModelIndex dirIndex = m_proxyModel->mapToSource(index); const KFileItem item = m_dolphinModel->itemForIndex(dirIndex); if (!item.isNull()) { emit changeUrl(item.url(), m_mouseButtons); - } + }*/ } void FoldersPanel::dropUrls(const QModelIndex& index, QDropEvent* event) { + Q_UNUSED(event); if (index.isValid()) { - const QModelIndex dirIndex = m_proxyModel->mapToSource(index); + /*const QModelIndex dirIndex = m_proxyModel->mapToSource(index); KFileItem item = m_dolphinModel->itemForIndex(dirIndex); Q_ASSERT(!item.isNull()); if (item.isDir()) { - DragAndDropHelper::instance().dropUrls(item, item.url(), event, this); - } + Q_UNUSED(event); + //DragAndDropHelper::instance().dropUrls(item, item.url(), event, this); + }*/ } } @@ -243,11 +244,11 @@ void FoldersPanel::expandToDir(const QModelIndex& index) void FoldersPanel::scrollToLeaf() { - const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_leafDir); + /*const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_leafDir); const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); if (proxyIndex.isValid()) { m_treeView->scrollTo(proxyIndex); - } + }*/ } void FoldersPanel::updateMouseButtons() @@ -257,7 +258,7 @@ void FoldersPanel::updateMouseButtons() void FoldersPanel::slotDirListerCompleted() { - m_treeView->resizeColumnToContents(DolphinModel::Name); +// m_treeView->resizeColumnToContents(DolphinModel::Name); } void FoldersPanel::slotHorizontalScrollBarMoved(int value) @@ -295,12 +296,12 @@ void FoldersPanel::loadTree(const KUrl& url) m_dirLister->stop(); m_dirLister->openUrl(baseUrl, KDirLister::Reload); } - m_dolphinModel->expandToUrl(m_leafDir); + //m_dolphinModel->expandToUrl(m_leafDir); } void FoldersPanel::selectLeafDirectory() { - const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_leafDir); + /*const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_leafDir); const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); if (proxyIndex.isValid()) { @@ -314,7 +315,7 @@ void FoldersPanel::selectLeafDirectory() QTimer::singleShot(0, this, SLOT(scrollToLeaf())); m_setLeafVisible = false; } - } + }*/ } #include "folderspanel.moc" diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h index 3031166e9..727fc7c71 100644 --- a/src/panels/folders/folderspanel.h +++ b/src/panels/folders/folderspanel.h @@ -45,8 +45,8 @@ public: FoldersPanel(QWidget* parent = 0); virtual ~FoldersPanel(); - void setShowHiddenFiles(bool show); - bool showHiddenFiles() const; + void setHiddenFilesShown(bool show); + bool hiddenFilesShown() const; void setAutoScrolling(bool enable); bool autoScrolling() const; @@ -123,8 +123,8 @@ private: bool m_setLeafVisible; Qt::MouseButtons m_mouseButtons; KDirLister* m_dirLister; - DolphinModel* m_dolphinModel; - DolphinSortFilterProxyModel* m_proxyModel; + //DolphinModel* m_dolphinModel; + //DolphinSortFilterProxyModel* m_proxyModel; PanelTreeView* m_treeView; KUrl m_leafDir; }; diff --git a/src/panels/folders/paneltreeview.cpp b/src/panels/folders/paneltreeview.cpp index f6aa73aea..26a543d56 100644 --- a/src/panels/folders/paneltreeview.cpp +++ b/src/panels/folders/paneltreeview.cpp @@ -26,9 +26,6 @@ #include #include -#include -#include - PanelTreeView::PanelTreeView(QWidget* parent) : KTreeView(parent) { @@ -69,10 +66,10 @@ bool PanelTreeView::event(QEvent* event) switch (event->type()) { case QEvent::Polish: // Hide all columns except of the 'Name' column - for (int i = DolphinModel::Name + 1; i < DolphinModel::ExtraColumnCount; ++i) { + /*for (int i = DolphinModel::Name + 1; i < DolphinModel::ExtraColumnCount; ++i) { hideColumn(i); } - header()->hide(); + header()->hide();*/ break; case QEvent::Show: @@ -97,7 +94,8 @@ bool PanelTreeView::event(QEvent* event) void PanelTreeView::startDrag(Qt::DropActions supportedActions) { - DragAndDropHelper::instance().startDrag(this, supportedActions); + Q_UNUSED(supportedActions); + //DragAndDropHelper::instance().startDrag(this, supportedActions); } void PanelTreeView::dragEnterEvent(QDragEnterEvent* event) diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index b66d445cc..5db3e2c2a 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -117,7 +117,7 @@ void TreeViewContextMenu::open() QAction* showHiddenFilesAction = new QAction(i18nc("@action:inmenu", "Show Hidden Files"), this); showHiddenFilesAction->setCheckable(true); - showHiddenFilesAction->setChecked(m_parent->showHiddenFiles()); + showHiddenFilesAction->setChecked(m_parent->hiddenFilesShown()); popup->addAction(showHiddenFilesAction); connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool))); @@ -199,7 +199,7 @@ void TreeViewContextMenu::showProperties() void TreeViewContextMenu::setShowHiddenFiles(bool show) { - m_parent->setShowHiddenFiles(show); + m_parent->setHiddenFilesShown(show); } void TreeViewContextMenu::setAutoScrolling(bool enable) diff --git a/src/panels/information/dolphin_informationpanelsettings.kcfg b/src/panels/information/dolphin_informationpanelsettings.kcfg index 4df3dedcd..53c756d24 100644 --- a/src/panels/information/dolphin_informationpanelsettings.kcfg +++ b/src/panels/information/dolphin_informationpanelsettings.kcfg @@ -6,8 +6,8 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"> - - + + true diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 2d90007bf..1084fa085 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -102,8 +102,8 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_nameLabel->setAlignment(Qt::AlignHCenter); m_nameLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - const bool showPreview = InformationPanelSettings::showPreview(); - m_preview->setVisible(showPreview); + const bool previewsShown = InformationPanelSettings::previewsShown(); + m_preview->setVisible(previewsShown); m_metaDataWidget = new KFileMetaDataWidget(parent); m_metaDataWidget->setFont(KGlobalSettings::smallestReadableFont()); @@ -188,7 +188,7 @@ void InformationPanelContent::showItem(const KFileItem& item) m_metaDataWidget->setItems(KFileItemList() << item); } - if (InformationPanelSettings::showPreview()) { + if (InformationPanelSettings::previewsShown()) { const QString mimeType = item.mimetype(); const bool usePhonon = Phonon::BackendCapabilities::isMimeTypeAvailable(mimeType) && (mimeType != "image/png"); // TODO: workaround, as Phonon @@ -267,7 +267,7 @@ void InformationPanelContent::configureSettings(const QList& customCon QAction* previewAction = popup.addAction(i18nc("@action:inmenu", "Preview")); previewAction->setIcon(KIcon("view-preview")); previewAction->setCheckable(true); - previewAction->setChecked(InformationPanelSettings::showPreview()); + previewAction->setChecked(InformationPanelSettings::previewsShown()); QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure...")); configureAction->setIcon(KIcon("configure")); @@ -287,7 +287,7 @@ void InformationPanelContent::configureSettings(const QList& customCon const bool isChecked = action->isChecked(); if (action == previewAction) { m_preview->setVisible(isChecked); - InformationPanelSettings::setShowPreview(isChecked); + InformationPanelSettings::setPreviewsShown(isChecked); } else if (action == configureAction) { FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(); dialog->setDescription(i18nc("@label::textbox", diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index c2af7a6d7..e70fdf574 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -22,7 +22,6 @@ #include #include -#include "views/draganddrophelper.h" PlacesPanel::PlacesPanel(QWidget* parent) : KFilePlacesView(parent), @@ -47,7 +46,10 @@ void PlacesPanel::mousePressEvent(QMouseEvent* event) void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent) { - DragAndDropHelper::instance().dropUrls(KFileItem(), dest, event, parent); + Q_UNUSED(dest); + Q_UNUSED(event); + Q_UNUSED(parent); + //DragAndDropHelper::instance().dropUrls(KFileItem(), dest, event, parent); } void PlacesPanel::emitExtendedUrlChangedSignal(const KUrl& url) -- cgit v1.3