2006-11-21 06:02:05 +00:00
|
|
|
/***************************************************************************
|
2007-02-14 21:54:24 +00:00
|
|
|
* Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
|
2006-11-21 06:02:05 +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., *
|
2006-12-08 21:24:08 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
2006-11-21 06:02:05 +00:00
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef DOLPHINICONSVIEW_H
|
|
|
|
#define DOLPHINICONSVIEW_H
|
|
|
|
|
2006-11-24 22:10:33 +00:00
|
|
|
#include <QListView>
|
2007-02-27 20:46:21 +00:00
|
|
|
#include <QStyleOptionViewItem>
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-02-14 21:54:24 +00:00
|
|
|
class DolphinController;
|
2006-11-21 06:02:05 +00:00
|
|
|
class DolphinView;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Represents the view, where each item is shown as an icon.
|
|
|
|
*
|
|
|
|
* It is also possible that instead of the icon a preview of the item
|
|
|
|
* content is shown.
|
|
|
|
*/
|
2006-11-24 22:10:33 +00:00
|
|
|
class DolphinIconsView : public QListView
|
2006-11-21 06:02:05 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2007-02-14 21:54:24 +00:00
|
|
|
explicit DolphinIconsView(QWidget* parent, DolphinController* controller);
|
2006-11-21 06:02:05 +00:00
|
|
|
virtual ~DolphinIconsView();
|
2006-11-25 23:23:08 +00:00
|
|
|
|
|
|
|
protected:
|
2006-12-08 23:41:08 +00:00
|
|
|
virtual QStyleOptionViewItem viewOptions() const;
|
2006-12-04 05:48:57 +00:00
|
|
|
virtual void contextMenuEvent(QContextMenuEvent* event);
|
2006-12-02 21:51:36 +00:00
|
|
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
2007-01-06 21:11:04 +00:00
|
|
|
virtual void dragEnterEvent(QDragEnterEvent* event);
|
|
|
|
virtual void dropEvent(QDropEvent* event);
|
2006-11-25 23:23:08 +00:00
|
|
|
|
2007-02-28 19:17:26 +00:00
|
|
|
private slots:
|
|
|
|
/**
|
|
|
|
* Updates the size of the grid
|
|
|
|
* depending on the state of \a showPreview.
|
|
|
|
*/
|
|
|
|
void updateGridSize(bool showPreview);
|
|
|
|
|
2007-03-01 19:36:37 +00:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool isZoomInPossible() const;
|
|
|
|
bool isZoomOutPossible() const;
|
|
|
|
|
|
|
|
/** Returns the increased icon size for the size \a size. */
|
|
|
|
int increasedIconSize(int size) const;
|
|
|
|
|
|
|
|
/** Returns the decreased icon size for the size \a size. */
|
|
|
|
int decreasedIconSize(int size) const;
|
|
|
|
|
2006-11-25 23:23:08 +00:00
|
|
|
private:
|
2007-02-14 21:54:24 +00:00
|
|
|
DolphinController* m_controller;
|
2007-02-27 20:46:21 +00:00
|
|
|
QStyleOptionViewItem m_viewOptions;
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|