1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2021-08-27 7 * Description : Side Bar Widget for the Showfoto folder view. 8 * 9 * Copyright (C) 2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef SHOWFOTO_FOLDER_VIEW_SIDEBAR_H 25 #define SHOWFOTO_FOLDER_VIEW_SIDEBAR_H 26 27 // QT includes 28 29 #include <QListView> 30 #include <QPixmap> 31 #include <QWidget> 32 #include <QEvent> 33 #include <QAction> 34 #include <QStringList> 35 #include <QModelIndex> 36 37 // Local includes 38 39 #include "statesavingobject.h" 40 #include "showfotoitemsortsettings.h" 41 #include "dpluginaction.h" 42 43 using namespace Digikam; 44 45 namespace ShowFoto 46 { 47 48 class Showfoto; 49 50 class ShowfotoFolderViewSideBar : public QWidget, 51 public StateSavingObject 52 { 53 Q_OBJECT 54 55 public: 56 57 explicit ShowfotoFolderViewSideBar(Showfoto* const parent); 58 ~ShowfotoFolderViewSideBar() override; 59 60 void doLoadState() override; 61 void doSaveState() override; 62 const QIcon getIcon(); 63 const QString getCaption(); 64 65 QString currentFolder() const; 66 QString currentPath() const; 67 68 void setCurrentPath(const QString& newPathNative); 69 void setCurrentPathWithoutUndo(const QString& newPath); 70 71 void setSortOrder(int order); 72 void setSortRole(int role); 73 74 void loadContents(const QModelIndex& index, bool append = false); 75 76 void registerPluginActions(const QList<DPluginAction*>& actions); 77 QList<QAction*> pluginActions() const; 78 79 public Q_SLOTS: 80 81 void slotUndo(); 82 void slotRedo(); 83 void slotGoHome(); 84 void slotGoUp(); 85 void slotLoadContents(); 86 void slotAppendContents(); 87 88 private Q_SLOTS: 89 90 void slotCustomPathChanged(const QString&); 91 void slotViewModeChanged(int); 92 void slotShowBookmarks(bool); 93 void slotPluginActionTriggered(QAction*); 94 void slotTypeMimesChanged(const QString& patterns); 95 96 Q_SIGNALS: 97 98 void signalAddBookmark(); 99 void signalSetup(); 100 void signalLoadContentsFromPath(const QString& path); 101 void signalLoadContentsFromFiles(const QStringList& files, const QString& current); 102 void signalAppendContentsFromFiles(const QStringList& files, const QString& current); 103 104 private: 105 106 class Private; 107 Private* const d; 108 }; 109 110 } // namespace ShowFoto 111 112 #endif // SHOWFOTO_FOLDER_VIEW_SIDEBAR_H 113