diff --git a/krusader/Panel/krinterbriefview.h b/krusader/Panel/krinterbriefview.h index 88b286a2..f74070f0 100644 --- a/krusader/Panel/krinterbriefview.h +++ b/krusader/Panel/krinterbriefview.h @@ -1,122 +1,120 @@ /***************************************************************************** * Copyright (C) 2009 Csaba Karai * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This package is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this package; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #ifndef KRINTERBRIEFVIEW_H #define KRINTERBRIEFVIEW_H // QtCore #include // QtGui #include // QtWidgets #include #include #include #include "krinterview.h" /** * @brief Compact view showing only icon and file name of view items */ class KrInterBriefView : public QAbstractItemView, public KrInterView { Q_OBJECT public: KrInterBriefView(QWidget *parent, KrViewInstance &instance, KConfig *cfg); virtual ~KrInterBriefView(); // ---- reimplemented from QAbstractItemView ---- - virtual QRect visualRect(const QModelIndex&) const Q_DECL_OVERRIDE; - virtual QModelIndex indexAt(const QPoint&) const Q_DECL_OVERRIDE; - virtual void scrollTo(const QModelIndex&, QAbstractItemView::ScrollHint = QAbstractItemView::EnsureVisible) Q_DECL_OVERRIDE; + QRect visualRect(const QModelIndex&) const Q_DECL_OVERRIDE; + QModelIndex indexAt(const QPoint&) const Q_DECL_OVERRIDE; + void scrollTo(const QModelIndex &, QAbstractItemView::ScrollHint = QAbstractItemView::EnsureVisible) Q_DECL_OVERRIDE; // ---- reimplemented from KrView ---- - virtual int itemsPerPage() Q_DECL_OVERRIDE; - virtual void updateView() Q_DECL_OVERRIDE; - virtual bool ensureVisibilityAfterSelect() Q_DECL_OVERRIDE { + int itemsPerPage() Q_DECL_OVERRIDE; + void updateView() Q_DECL_OVERRIDE; + bool ensureVisibilityAfterSelect() Q_DECL_OVERRIDE { return false; } - virtual void setSortMode(KrViewProperties::ColumnType sortColumn, bool descending) Q_DECL_OVERRIDE; + void setSortMode(KrViewProperties::ColumnType sortColumn, bool descending) Q_DECL_OVERRIDE; // ---- reimplemented from QAbstractItemView ---- // Don't do anything, selections are handled by the mouse handler - virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE { - Q_UNUSED(rect); Q_UNUSED(command); - } - virtual void selectAll() Q_DECL_OVERRIDE {} + void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) Q_DECL_OVERRIDE {} + void selectAll() Q_DECL_OVERRIDE {} // this shouldn't be called - virtual QRegion visualRegionForSelection(const QItemSelection&) const Q_DECL_OVERRIDE { + QRegion visualRegionForSelection(const QItemSelection&) const Q_DECL_OVERRIDE { return QRegion(); } // ---- reimplemented from KrView ---- - virtual void setFileIconSize(int size) Q_DECL_OVERRIDE; + void setFileIconSize(int size) Q_DECL_OVERRIDE; protected slots: // ---- reimplemented from QAbstractItemView ---- - virtual void updateGeometries() Q_DECL_OVERRIDE; + void updateGeometries() Q_DECL_OVERRIDE; // ---- reimplemented from KrView ---- - virtual void currentChanged(const QModelIndex & current, const QModelIndex & previous) Q_DECL_OVERRIDE; + void currentChanged(const QModelIndex & current, const QModelIndex & previous) Q_DECL_OVERRIDE; - virtual void renameCurrentItem() Q_DECL_OVERRIDE; + void renameCurrentItem() Q_DECL_OVERRIDE; protected: // ---- reimplemented from KrView ---- - virtual bool handleKeyEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + bool handleKeyEvent(QKeyEvent *e) Q_DECL_OVERRIDE; // ---- reimplemented from QAbstractItemView ---- - virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; - virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; - virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; - virtual QModelIndex moveCursor(QAbstractItemView::CursorAction, Qt::KeyboardModifiers) Q_DECL_OVERRIDE; - virtual int horizontalOffset() const Q_DECL_OVERRIDE; - virtual int verticalOffset() const Q_DECL_OVERRIDE; - virtual bool isIndexHidden(const QModelIndex&) const Q_DECL_OVERRIDE; -// virtual QRegion visualRegionForSelection(const QItemSelection&) const Q_DECL_OVERRIDE; - virtual bool event(QEvent * e) Q_DECL_OVERRIDE; - virtual void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; - virtual void mouseDoubleClickEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; - virtual void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; - virtual void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; - virtual void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE; - virtual void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE; - virtual void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE; - virtual void dropEvent(QDropEvent *) Q_DECL_OVERRIDE; - virtual bool viewportEvent(QEvent * event) Q_DECL_OVERRIDE; + bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + QModelIndex moveCursor(QAbstractItemView::CursorAction, Qt::KeyboardModifiers) Q_DECL_OVERRIDE; + int horizontalOffset() const Q_DECL_OVERRIDE; + int verticalOffset() const Q_DECL_OVERRIDE; + bool isIndexHidden(const QModelIndex&) const Q_DECL_OVERRIDE; +// QRegion visualRegionForSelection(const QItemSelection&) const Q_DECL_OVERRIDE; + bool event(QEvent * e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; + void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE; + void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE; + void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE; + void dropEvent(QDropEvent *) Q_DECL_OVERRIDE; + bool viewportEvent(QEvent * event) Q_DECL_OVERRIDE; // ---- reimplemented from KrView ---- - virtual void setup() Q_DECL_OVERRIDE; - virtual void doRestoreSettings(KConfigGroup group) Q_DECL_OVERRIDE; - virtual void saveSettings(KConfigGroup grp, KrViewProperties::PropertyType properties) Q_DECL_OVERRIDE; - virtual void copySettingsFrom(KrView *other) Q_DECL_OVERRIDE; - virtual QRect itemRect(const vfile *vf) Q_DECL_OVERRIDE; - virtual void showContextMenu(const QPoint & p) Q_DECL_OVERRIDE; - virtual QRect mapToViewport(const QRect &rect) const; + void setup() Q_DECL_OVERRIDE; + void doRestoreSettings(KConfigGroup group) Q_DECL_OVERRIDE; + void saveSettings(KConfigGroup grp, KrViewProperties::PropertyType properties) Q_DECL_OVERRIDE; + void copySettingsFrom(KrView *other) Q_DECL_OVERRIDE; + QRect itemRect(const vfile *vf) Q_DECL_OVERRIDE; + void showContextMenu(const QPoint & p) Q_DECL_OVERRIDE; + QRect mapToViewport(const QRect &rect) const; int getItemHeight() const; int elementWidth(const QModelIndex & index); void intersectionSet(const QRect &, QVector &); private: QFont _viewFont; int _numOfColumns; QHeaderView * _header; }; #endif // KRINTERBRIEFVIEW_H diff --git a/krusader/Panel/krinterdetailedview.h b/krusader/Panel/krinterdetailedview.h index 017bdd2a..a37dc92d 100644 --- a/krusader/Panel/krinterdetailedview.h +++ b/krusader/Panel/krinterdetailedview.h @@ -1,92 +1,92 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This package is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this package; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #ifndef KRINTERDETAILEDVIEW_H #define KRINTERDETAILEDVIEW_H // QtCore #include // QtGui #include // QtWidgets #include #include "krinterview.h" class QMouseEvent; class QKeyEvent; class QDragEnterEvent; class KrInterDetailedView : public QTreeView, public KrInterView { Q_OBJECT public: KrInterDetailedView(QWidget *parent, KrViewInstance &instance, KConfig *cfg); virtual ~KrInterDetailedView(); - virtual void updateView() Q_DECL_OVERRIDE; + void updateView() Q_DECL_OVERRIDE; - virtual bool ensureVisibilityAfterSelect() Q_DECL_OVERRIDE { + bool ensureVisibilityAfterSelect() Q_DECL_OVERRIDE { return false; } - virtual int itemsPerPage() Q_DECL_OVERRIDE; - virtual void setSortMode(KrViewProperties::ColumnType sortColumn, bool descending) Q_DECL_OVERRIDE; - virtual void setFileIconSize(int size) Q_DECL_OVERRIDE; - virtual void doRestoreSettings(KConfigGroup grp) Q_DECL_OVERRIDE; + int itemsPerPage() Q_DECL_OVERRIDE; + void setSortMode(KrViewProperties::ColumnType sortColumn, bool descending) Q_DECL_OVERRIDE; + void setFileIconSize(int size) Q_DECL_OVERRIDE; + void doRestoreSettings(KConfigGroup grp) Q_DECL_OVERRIDE; protected slots: - virtual void renameCurrentItem() Q_DECL_OVERRIDE; - virtual void sectionResized(int, int, int); + void renameCurrentItem() Q_DECL_OVERRIDE; + void sectionResized(int, int, int); void sectionMoved(int, int, int); - virtual void currentChanged(const QModelIndex & current, const QModelIndex & previous) Q_DECL_OVERRIDE; + void currentChanged(const QModelIndex & current, const QModelIndex & previous) Q_DECL_OVERRIDE; protected: - virtual void setup() Q_DECL_OVERRIDE; - virtual void copySettingsFrom(KrView *other) Q_DECL_OVERRIDE; - virtual void saveSettings(KConfigGroup grp, KrViewProperties::PropertyType properties) Q_DECL_OVERRIDE; + void setup() Q_DECL_OVERRIDE; + void copySettingsFrom(KrView *other) Q_DECL_OVERRIDE; + void saveSettings(KConfigGroup grp, KrViewProperties::PropertyType properties) Q_DECL_OVERRIDE; // Don't do anything, selections are handled by the mouse handler - virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE { Q_UNUSED(rect); Q_UNUSED(command); } - virtual void selectAll() Q_DECL_OVERRIDE {} + void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) Q_DECL_OVERRIDE {} + void selectAll() Q_DECL_OVERRIDE {} - virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; - virtual void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; - virtual void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; - virtual void mouseDoubleClickEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; - virtual void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; - virtual void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; - virtual bool event(QEvent * e) Q_DECL_OVERRIDE; - virtual void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE; - virtual void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE; - virtual void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE; - virtual void dropEvent(QDropEvent *) Q_DECL_OVERRIDE; - virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; - virtual bool viewportEvent(QEvent * event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE; + bool event(QEvent * e) Q_DECL_OVERRIDE; + void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE; + void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE; + void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE; + void dropEvent(QDropEvent *) Q_DECL_OVERRIDE; + bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; + bool viewportEvent(QEvent * event) Q_DECL_OVERRIDE; - virtual QRect itemRect(const vfile *vf) Q_DECL_OVERRIDE; + QRect itemRect(const vfile *vf) Q_DECL_OVERRIDE; - virtual void showContextMenu(const QPoint & p) Q_DECL_OVERRIDE; + void showContextMenu(const QPoint & p) Q_DECL_OVERRIDE; void recalculateColumnSizes(); private: QFont _viewFont; bool _autoResizeColumns; }; #endif // __krinterview__ diff --git a/krusader/Panel/krinterview.h b/krusader/Panel/krinterview.h index 86e39f5b..12b06110 100644 --- a/krusader/Panel/krinterview.h +++ b/krusader/Panel/krinterview.h @@ -1,119 +1,118 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * Copyright (C) 2010 Jan Lepper * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This package is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this package; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #ifndef KRINTERVIEW_H #define KRINTERVIEW_H // QtCore #include // QtWidgets #include #include "krview.h" class KrVfsModel; class KrMouseHandler; class KrViewItem; /** * @brief Abstract intermediate class between KrView and full view implementations. * * It contains the methods common to all implementing subclasses of KrView. */ class KrInterView : public KrView { friend class KrViewItem; public: KrInterView(KrViewInstance &instance, KConfig *cfg, QAbstractItemView *itemView); virtual ~KrInterView(); - virtual QModelIndex getCurrentIndex() Q_DECL_OVERRIDE { + QModelIndex getCurrentIndex() Q_DECL_OVERRIDE { return _itemView->currentIndex(); } - virtual bool isSelected(const QModelIndex &ndx) Q_DECL_OVERRIDE; - virtual uint numSelected() const Q_DECL_OVERRIDE { + bool isSelected(const QModelIndex &ndx) Q_DECL_OVERRIDE; + uint numSelected() const Q_DECL_OVERRIDE { return _selection.count(); } - virtual QList selectedUrls() Q_DECL_OVERRIDE; - virtual void setSelectionUrls(const QList urls) Q_DECL_OVERRIDE; - virtual KrViewItem* getFirst() Q_DECL_OVERRIDE; - virtual KrViewItem* getLast() Q_DECL_OVERRIDE; - virtual KrViewItem* getNext(KrViewItem *current) Q_DECL_OVERRIDE; - virtual KrViewItem* getPrev(KrViewItem *current) Q_DECL_OVERRIDE; - virtual KrViewItem* getCurrentKrViewItem() Q_DECL_OVERRIDE; - virtual KrViewItem* findItemByName(const QString &name) Q_DECL_OVERRIDE; - virtual KrViewItem *findItemByVfile(vfile *vf) Q_DECL_OVERRIDE; - virtual QString getCurrentItem() const Q_DECL_OVERRIDE; - virtual KrViewItem* getKrViewItemAt(const QPoint &vp) Q_DECL_OVERRIDE; - virtual void setCurrentItem(const QString& name, const QModelIndex &fallbackToIndex=QModelIndex()) Q_DECL_OVERRIDE; - virtual void setCurrentKrViewItem(KrViewItem *item) Q_DECL_OVERRIDE; - virtual void makeItemVisible(const KrViewItem *item) Q_DECL_OVERRIDE; - virtual bool isItemVisible(const KrViewItem *item) Q_DECL_OVERRIDE; - virtual void clear() Q_DECL_OVERRIDE; - virtual void sort() Q_DECL_OVERRIDE; - virtual void refreshColors() Q_DECL_OVERRIDE; - virtual void redraw() Q_DECL_OVERRIDE; - virtual void prepareForActive() Q_DECL_OVERRIDE; - virtual void prepareForPassive() Q_DECL_OVERRIDE; - virtual void showContextMenu(const QPoint & point = QPoint(0,0)) Q_DECL_OVERRIDE; - virtual void selectRegion(KrViewItem *i1, KrViewItem *i2, bool select) Q_DECL_OVERRIDE; + QList selectedUrls() Q_DECL_OVERRIDE; + void setSelectionUrls(const QList urls) Q_DECL_OVERRIDE; + KrViewItem* getFirst() Q_DECL_OVERRIDE; + KrViewItem* getLast() Q_DECL_OVERRIDE; + KrViewItem* getNext(KrViewItem *current) Q_DECL_OVERRIDE; + KrViewItem* getPrev(KrViewItem *current) Q_DECL_OVERRIDE; + KrViewItem* getCurrentKrViewItem() Q_DECL_OVERRIDE; + KrViewItem* findItemByName(const QString &name) Q_DECL_OVERRIDE; + KrViewItem *findItemByVfile(vfile *vf) Q_DECL_OVERRIDE; + QString getCurrentItem() const Q_DECL_OVERRIDE; + KrViewItem* getKrViewItemAt(const QPoint &vp) Q_DECL_OVERRIDE; + void setCurrentItem(const QString& name, const QModelIndex &fallbackToIndex=QModelIndex()) Q_DECL_OVERRIDE; + void setCurrentKrViewItem(KrViewItem *item) Q_DECL_OVERRIDE; + void makeItemVisible(const KrViewItem *item) Q_DECL_OVERRIDE; + bool isItemVisible(const KrViewItem *item) Q_DECL_OVERRIDE; + void clear() Q_DECL_OVERRIDE; + void sort() Q_DECL_OVERRIDE; + void refreshColors() Q_DECL_OVERRIDE; + void redraw() Q_DECL_OVERRIDE; + void prepareForActive() Q_DECL_OVERRIDE; + void prepareForPassive() Q_DECL_OVERRIDE; + void showContextMenu(const QPoint & point = QPoint(0,0)) Q_DECL_OVERRIDE; + void selectRegion(KrViewItem *i1, KrViewItem *i2, bool select) Q_DECL_OVERRIDE; void sortModeUpdated(int column, Qt::SortOrder order); void redrawItem(vfile *vf) { _itemView->viewport()->update(itemRect(vf)); } protected: class DummySelectionModel : public QItemSelectionModel { public: DummySelectionModel(QAbstractItemModel *model, QObject *parent) : QItemSelectionModel(model, parent) {} // do nothing - selection is managed by KrInterView - virtual void select (const QModelIndex & index, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE { Q_UNUSED(index); Q_UNUSED(command); } - virtual void select(const QItemSelection & selection, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE { Q_UNUSED(selection); Q_UNUSED(command); } + void select(const QModelIndex &, QItemSelectionModel::SelectionFlags) Q_DECL_OVERRIDE {} + void select(const QItemSelection &, QItemSelectionModel::SelectionFlags) Q_DECL_OVERRIDE {} }; - virtual KIO::filesize_t calcSize() Q_DECL_OVERRIDE; - virtual KIO::filesize_t calcSelectedSize() Q_DECL_OVERRIDE; - virtual void populate(const QList &vfiles, vfile *dummy) Q_DECL_OVERRIDE; - virtual KrViewItem* preAddItem(vfile *vf) Q_DECL_OVERRIDE; - virtual void preDelItem(KrViewItem *item) Q_DECL_OVERRIDE; - virtual void preUpdateItem(vfile *vf) Q_DECL_OVERRIDE; - virtual void intSetSelected(const vfile* vf, bool select) Q_DECL_OVERRIDE; + KIO::filesize_t calcSize() Q_DECL_OVERRIDE; + KIO::filesize_t calcSelectedSize() Q_DECL_OVERRIDE; + void populate(const QList &vfiles, vfile *dummy) Q_DECL_OVERRIDE; + KrViewItem* preAddItem(vfile *vf) Q_DECL_OVERRIDE; + void preDelItem(KrViewItem *item) Q_DECL_OVERRIDE; + void preUpdateItem(vfile *vf) Q_DECL_OVERRIDE; + void intSetSelected(const vfile* vf, bool select) Q_DECL_OVERRIDE; virtual QRect itemRect(const vfile *vf) = 0; KrViewItem * getKrViewItem(vfile *vf); KrViewItem * getKrViewItem(const QModelIndex &); bool isSelected(const vfile *vf) const { return _selection.contains(vf); } void makeCurrentVisible(); - KrVfsModel *_model; QAbstractItemView *_itemView; KrMouseHandler *_mouseHandler; QHash _itemHash; QSet _selection; }; #endif