1 /************************************************************************** 2 * Copyright (C) 2005-2020 by Oleksandr Shneyder * 3 * <o.shneyder@phoca-gmbh.de> * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU General Public License as published by * 7 * the Free Software Foundation; either version 2 of the License, or * 8 * (at your option) any later version. * 9 * This program is distributed in the hope that it will be useful, * 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 * GNU General Public License for more details. * 13 * * 14 * You should have received a copy of the GNU General Public License * 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. * 16 ***************************************************************************/ 17 18 #ifndef SESSIONEXPLORER_H 19 #define SESSIONEXPLORER_H 20 21 #include <QObject> 22 #include <QList> 23 #include <QStringList> 24 25 class SessionButton; 26 class FolderButton; 27 class ONMainWindow; 28 class QToolButton; 29 class QLabel; 30 class QHBoxLayout; 31 32 class SessionExplorer: public QObject 33 { 34 Q_OBJECT 35 public: 36 SessionExplorer(ONMainWindow *p); 37 ~SessionExplorer(); getSessionsList()38 QList<SessionButton*> * getSessionsList() 39 { 40 return &sessions; 41 } getFoldersList()42 QList<FolderButton*> * getFoldersList() 43 { 44 return &folders; 45 } getLastSession()46 SessionButton* getLastSession() { 47 return lastSession; 48 } setLastSession(SessionButton * s)49 void setLastSession(SessionButton* s) 50 { 51 lastSession=s; 52 } 53 void cleanSessions(); 54 SessionButton* createBut ( const QString& id ); 55 void placeButtons(); getNavigationLayout()56 QHBoxLayout* getNavigationLayout() 57 { 58 return navigationLayout; 59 } 60 bool isFolderEmpty(QString path); 61 void resize(); 62 void setFolderIcon(QString path, QString icon); 63 void createNewFolder(QString path); 64 void renameFolder(QString oldPath, QString currentPath); 65 void deleteFolder(QString path); 66 getCurrentPath()67 QString getCurrentPath() 68 { 69 return currentPath; 70 } 71 setCurrrentPath(QString path)72 void setCurrrentPath(QString path) 73 { 74 currentPath=path; 75 } 76 77 void setEnable(bool enable); 78 79 80 //vars 81 private: 82 QList<SessionButton*> sessions; 83 QList<FolderButton*> folders; 84 SessionButton* lastSession; 85 ONMainWindow* parent; 86 QToolButton* backButton; 87 QLabel* pathLabel; 88 QHBoxLayout* navigationLayout; 89 QString currentPath; 90 91 //functions 92 private: 93 void setNavigationVisible(bool value); 94 int findFolder(QString path); 95 void createFolder(QString path); 96 void getFoldersFromConfig(); 97 98 public slots: 99 void slotDeleteButton ( SessionButton * bt ); 100 void slotEdit ( SessionButton* ); 101 void slotCreateDesktopIcon ( SessionButton* bt ); 102 void exportsEdit ( SessionButton* bt ); 103 private slots: 104 void slotFolderSelected(FolderButton* bt); 105 void slotLevelUp(); 106 QStringList getFolderChildren(FolderButton* folder); 107 }; 108 109 #endif 110