diff options
| author | Peter Penz <[email protected]> | 2008-08-05 20:15:51 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-08-05 20:15:51 +0000 |
| commit | 7308c7d03e182795d6b64d85a3f0725d8af32436 (patch) | |
| tree | 4d7414dccbfbf6d28864ee2bb3615b3a27a59b26 /src/dolphincontroller.h | |
| parent | 208549cefcd47b4454b8e38b2c5cb12b82189b7b (diff) | |
First step of refactoring to improve the zooming capabilities of views:
* Let classes that use DolphinView know about the currently used zoom level.
* Provide more zoom levels for all views (the settings dialogs have not been adjusted yet).
* Fixed issue that when using the wheel that the enabled state of the zoom actions has not been updated.
svn path=/trunk/KDE/kdebase/apps/; revision=842715
Diffstat (limited to 'src/dolphincontroller.h')
| -rw-r--r-- | src/dolphincontroller.h | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h index d5e9325d3..4e8885ef9 100644 --- a/src/dolphincontroller.h +++ b/src/dolphincontroller.h @@ -59,8 +59,6 @@ class QWidget; * - indicateDroppedUrls() * - indicateSortingChange() * - indicateSortOrderChanged() - * - setZoomInPossible() - * - setZoomOutPossible() * - triggerItem() * - handleKeyPressEvent() * - emitItemEntered() @@ -72,8 +70,7 @@ class QWidget; * - setShowHiddenFiles() * - setShowPreview() * - indicateActivationChange() - * - triggerZoomIn() - * - triggerZoomOut() + * - setZoomLevel() */ class LIBDOLPHINPRIVATE_EXPORT DolphinController : public QObject { @@ -179,18 +176,24 @@ public: void indicateActivationChange(bool active); /** - * Tells the view implementation to zoom in by emitting the signal zoomIn() - * and is invoked by the abstract Dolphin view. + * Sets the zoom level to \a level and emits the signal zoomLevelChanged(). + * It must be assured that the used level is inside the range + * DolphinController::zoomLevelMinimum() and + * DolphinController::zoomLevelMaximum(). + * Is invoked by the abstract Dolphin view. */ - void triggerZoomIn(); - + void setZoomLevel(int level); + int zoomLevel() const; + + int zoomLevelMinimum() const; + int zoomLevelMaximum() const; + /** - * Is invoked by the view implementation to indicate whether a zooming in - * is possible. The abstract Dolphin view updates the corresponding menu - * action depending on this state. + * Helper method for the view implementation to get + * the icon size for the zoom level \a level + * (see DolphinController::zoomLevel()). */ - void setZoomInPossible(bool possible); - bool isZoomInPossible() const; + static int iconSizeForZoomLevel(int level); /** * Tells the view implementation to zoom out by emitting the signal zoomOut() @@ -199,14 +202,6 @@ public: void triggerZoomOut(); /** - * Is invoked by the view implementation to indicate whether a zooming out - * is possible. The abstract Dolphin view updates the corresponding menu - * action depending on this state. - */ - void setZoomOutPossible(bool possible); - bool isZoomOutPossible() const; - - /** * Should be invoked in each view implementation whenever a key has been * pressed. If the selection model of \a view is not empty and * the return key has been pressed, the selected items will get triggered. @@ -345,23 +340,16 @@ signals: void viewportEntered(); /** - * Is emitted if the view should zoom in. The view implementation - * must connect to this signal if it supports zooming. - */ - void zoomIn(); - - /** - * Is emitted if the view should zoom out. The view implementation + * Is emitted if the view should change the zoom to \a level. The view implementation * must connect to this signal if it supports zooming. */ - void zoomOut(); + void zoomLevelChanged(int level); private slots: void updateOpenTabState(); private: - bool m_zoomInPossible; - bool m_zoomOutPossible; + int m_zoomLevel; bool m_openTab; // TODO: this is a workaround until Qt-issue 176832 has been fixed KUrl m_url; DolphinView* m_dolphinView; @@ -383,24 +371,19 @@ inline QAbstractItemView* DolphinController::itemView() const return m_itemView; } -inline void DolphinController::setZoomInPossible(bool possible) -{ - m_zoomInPossible = possible; -} - -inline bool DolphinController::isZoomInPossible() const +inline int DolphinController::zoomLevel() const { - return m_zoomInPossible; + return m_zoomLevel; } -inline void DolphinController::setZoomOutPossible(bool possible) +inline int DolphinController::zoomLevelMinimum() const { - m_zoomOutPossible = possible; + return 0; } -inline bool DolphinController::isZoomOutPossible() const +inline int DolphinController::zoomLevelMaximum() const { - return m_zoomOutPossible; + return 6; } #endif |
