2007-03-27 19:08:44 +00:00
|
|
|
/***************************************************************************
|
2007-06-20 21:04:36 +00:00
|
|
|
* Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
|
2007-03-27 19:08:44 +00:00
|
|
|
* *
|
|
|
|
* 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 program 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 program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef DOLPHINCOLUMNVIEW_H
|
|
|
|
#define DOLPHINCOLUMNVIEW_H
|
|
|
|
|
2007-09-14 20:50:08 +00:00
|
|
|
#include <QAbstractItemView>
|
|
|
|
#include <QList>
|
2007-07-10 20:33:17 +00:00
|
|
|
#include <QStyleOption>
|
2007-03-27 19:08:44 +00:00
|
|
|
|
2007-09-14 20:50:08 +00:00
|
|
|
class ColumnWidget;
|
2007-03-27 19:08:44 +00:00
|
|
|
class DolphinController;
|
2007-06-28 18:52:54 +00:00
|
|
|
class KDirLister;
|
|
|
|
class KUrl;
|
2007-09-14 20:50:08 +00:00
|
|
|
class QTimeLine;
|
2007-03-27 19:08:44 +00:00
|
|
|
|
|
|
|
/**
|
2007-06-17 15:04:01 +00:00
|
|
|
* @brief Represents the view, where each directory is show as separate column.
|
|
|
|
*
|
|
|
|
* @see DolphinIconsView
|
|
|
|
* @see DolphinDetailsView
|
2007-03-27 19:08:44 +00:00
|
|
|
*/
|
2007-09-14 20:50:08 +00:00
|
|
|
class DolphinColumnView : public QAbstractItemView
|
2007-03-27 19:08:44 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DolphinColumnView(QWidget* parent, DolphinController* controller);
|
|
|
|
virtual ~DolphinColumnView();
|
|
|
|
|
2007-09-14 20:50:08 +00:00
|
|
|
virtual QModelIndex indexAt(const QPoint& point) const;
|
|
|
|
virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
|
|
|
|
virtual QRect visualRect(const QModelIndex& index) const;
|
|
|
|
virtual void setModel(QAbstractItemModel* model);
|
2007-08-06 06:56:36 +00:00
|
|
|
|
2007-03-27 19:08:44 +00:00
|
|
|
protected:
|
2007-09-14 20:50:08 +00:00
|
|
|
virtual bool isIndexHidden(const QModelIndex& index) const;
|
|
|
|
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
|
|
|
|
virtual void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags);
|
|
|
|
virtual QRegion visualRegionForSelection(const QItemSelection& selection) const;
|
|
|
|
virtual int horizontalOffset() const;
|
|
|
|
virtual int verticalOffset() const;
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
virtual void mousePressEvent(QMouseEvent* event);
|
2007-09-14 20:50:08 +00:00
|
|
|
virtual void resizeEvent(QResizeEvent* event);
|
2007-03-27 19:08:44 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
2007-06-17 15:04:01 +00:00
|
|
|
void triggerItem(const QModelIndex& index);
|
2007-03-27 19:08:44 +00:00
|
|
|
|
2007-06-28 18:52:54 +00:00
|
|
|
/**
|
2007-09-14 20:50:08 +00:00
|
|
|
* Moves the content of the columns view to represent
|
|
|
|
* the scrollbar position \a x.
|
2007-06-28 18:52:54 +00:00
|
|
|
*/
|
2007-09-14 20:50:08 +00:00
|
|
|
void moveContentHorizontally(int x);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the column which represents the URL \a url. If the column
|
|
|
|
* is already shown, it gets activated, otherwise it will be created.
|
|
|
|
*/
|
|
|
|
void showColumn(const KUrl& url);
|
2007-06-28 18:52:54 +00:00
|
|
|
|
|
|
|
/**
|
2007-07-28 22:27:58 +00:00
|
|
|
* Updates the size of the decoration dependent on the
|
|
|
|
* icon size of the ColumnModeSettings. The controller
|
|
|
|
* will get informed about possible zoom in/zoom out
|
|
|
|
* operations.
|
2007-06-28 18:52:54 +00:00
|
|
|
*/
|
2007-07-28 22:27:58 +00:00
|
|
|
void updateDecorationSize();
|
2007-06-28 18:52:54 +00:00
|
|
|
|
2007-07-28 22:27:58 +00:00
|
|
|
private:
|
|
|
|
bool isZoomInPossible() const;
|
|
|
|
bool isZoomOutPossible() const;
|
|
|
|
|
2007-09-14 20:50:08 +00:00
|
|
|
inline ColumnWidget* activeColumn() const;
|
2007-09-19 13:00:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deactivates the currently active column and activates
|
|
|
|
* the new column indicated by \a index. m_index represents
|
|
|
|
* the active column afterwards. Also the URL of the navigator
|
|
|
|
* will be adjusted to reflect the column URL.
|
|
|
|
*/
|
2007-09-14 20:50:08 +00:00
|
|
|
void setActiveColumnIndex(int index);
|
|
|
|
|
|
|
|
void layoutColumns();
|
|
|
|
void updateScrollBar();
|
|
|
|
|
2007-04-01 17:57:53 +00:00
|
|
|
/**
|
2007-09-14 20:50:08 +00:00
|
|
|
* Assures that the currently active column is fully visible
|
|
|
|
* by adjusting the horizontal position of the content.
|
2007-04-01 17:57:53 +00:00
|
|
|
*/
|
2007-09-14 20:50:08 +00:00
|
|
|
void assureVisibleActiveColumn();
|
2007-04-01 17:57:53 +00:00
|
|
|
|
2007-08-03 18:46:49 +00:00
|
|
|
/**
|
2007-09-14 20:50:08 +00:00
|
|
|
* Request the activation for the column \a column. It is assured
|
|
|
|
* that the columns gets fully visible by adjusting the horizontal
|
|
|
|
* position of the content.
|
2007-08-03 18:46:49 +00:00
|
|
|
*/
|
2007-09-14 20:50:08 +00:00
|
|
|
void requestActivation(ColumnWidget* column);
|
2007-08-03 18:46:49 +00:00
|
|
|
|
2007-08-06 06:56:36 +00:00
|
|
|
/**
|
2007-09-14 20:50:08 +00:00
|
|
|
* Deletes all inactive child columns, that are a child of
|
|
|
|
* the currently active column.
|
2007-08-06 06:56:36 +00:00
|
|
|
*/
|
2007-09-14 20:50:08 +00:00
|
|
|
void deleteInactiveChildColumns();
|
2007-08-06 06:56:36 +00:00
|
|
|
|
2007-03-27 19:08:44 +00:00
|
|
|
private:
|
|
|
|
DolphinController* m_controller;
|
2007-09-14 20:50:08 +00:00
|
|
|
int m_index;
|
|
|
|
int m_contentX;
|
|
|
|
QList<ColumnWidget*> m_columns;
|
|
|
|
QTimeLine* m_animation;
|
2007-06-15 18:52:06 +00:00
|
|
|
|
|
|
|
friend class ColumnWidget;
|
2007-03-27 19:08:44 +00:00
|
|
|
};
|
|
|
|
|
2007-09-14 20:50:08 +00:00
|
|
|
ColumnWidget* DolphinColumnView::activeColumn() const
|
|
|
|
{
|
|
|
|
return m_columns[m_index];
|
|
|
|
}
|
|
|
|
|
2007-03-27 19:08:44 +00:00
|
|
|
#endif
|