1 // SPDX-License-Identifier: LGPL-2.1-or-later 2 // 3 // SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de> 4 // 5 6 #ifndef FILEVIEW_FLOAT_ITEM_H 7 #define FILEVIEW_FLOAT_ITEM_H 8 9 // forward declarations 10 class QListView; 11 class QPersistentModelIndex; 12 13 #include "AbstractFloatItem.h" 14 15 namespace Marble 16 { 17 18 class MarbleWidget; 19 20 /** 21 * @short Provides a float item with a list of opened files 22 * 23 */ 24 class FileViewFloatItem: public AbstractFloatItem 25 { 26 Q_OBJECT 27 Q_PLUGIN_METADATA(IID "org.kde.marble.FileViewFloatItem") 28 Q_INTERFACES( Marble::RenderPluginInterface ) 29 MARBLE_PLUGIN(FileViewFloatItem) 30 31 public: 32 explicit FileViewFloatItem( const QPointF &point = QPointF( -1, 10 ), 33 const QSizeF &size = QSizeF( 110.0, 250.0 ) ); 34 ~FileViewFloatItem(); 35 36 QStringList backendTypes() const; 37 38 QString name() const; 39 40 QString guiString() const; 41 42 QString nameId() const; 43 44 QString description() const; 45 46 QIcon icon () const; 47 48 void initialize (); 49 50 bool isInitialized () const; 51 52 void changeViewport( ViewportParams *viewport ); 53 54 virtual QPainterPath backgroundShape() const; 55 56 void paintContent( GeoPainter *painter, ViewportParams *viewport, 57 const QString& renderPos, GeoSceneLayer *layer = 0 ); 58 59 protected: 60 bool eventFilter( QObject *object, QEvent *e ); 61 62 private Q_SLOTS: 63 /** Map theme was changed, adjust controls */ 64 void selectTheme( const QString& theme ); 65 66 /** Enable/disable zoom in/out buttons */ 67 void updateFileView(); 68 69 void contextMenu(const QPoint& pos); 70 71 void addFile(); 72 73 void removeFile(); 74 75 private: 76 /** MarbleWidget this float item is installed as event filter for */ 77 MarbleWidget *m_marbleWidget; 78 79 /** FileView controls */ 80 QListView *m_fileView; 81 82 /** FileView embedding widget */ 83 QWidget *m_fileViewParent; 84 85 /** current position */ 86 QPoint m_itemPosition; 87 88 /** Radius of the viewport last time */ 89 int m_oldViewportRadius; 90 91 /** Repaint needed */ 92 bool m_repaintScheduled; 93 94 /** the last clicked ModelIndex */ 95 QPersistentModelIndex* m_persIndex; 96 }; 97 98 } 99 100 #endif // FILEVIEW_FLOAT_ITEM_H 101