itom  4.1.0
fileSystemDockWidget.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef FILESYSTEMDOCKWIDGET_H
24 #define FILESYSTEMDOCKWIDGET_H
25 
26 #include "../helper/IOHelper.h"
27 #include "abstractDockWidget.h"
28 
29 #include "itomQWidgets.h"
30 #include "../models/itomFileSystemModel.h"
31 
32 #include <qwidget.h>
33 #include <qaction.h>
34 #include <qtoolbar.h>
35 
36 #include <qtextbrowser.h>
37 #include <qtreeview.h>
38 #include <qlabel.h>
39 #include <qhash.h>
40 #include <qmutex.h>
41 #include <qmenu.h>
42 #include <qcombobox.h>
43 #include <qprocess.h>
44 #include <qevent.h>
45 #include <qurl.h>
46 
47 #include <qsignalmapper.h>
48 
49 
50 namespace ito
51 {
53  {
54  Q_OBJECT
55 
56  Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor DESIGNABLE true);
57 
58  public:
59  FileSystemDockWidget(const QString &title, const QString &objName, QWidget *parent = NULL, bool docked = true, bool isDockAvailable = true, tFloatingStyle floatingStyle = floatingNone, tMovingStyle movingStyle = movingEnabled, const QString &baseDirectory = QDir::currentPath());
61 
62  QColor linkColor() { return m_linkColor; }
63  void setLinkColor(const QColor &color);
64 
65  protected:
66  void createActions();
67  void createMenus();
68  void createToolBars();
69  void createStatusBar(){}
70  void updateActions();
71  void updatePythonActions(){ updateActions(); }
72 
73  QString getHtmlTag(const QString &tag);
74 
75  bool eventFilter(QObject *obj, QEvent *event);
76 
77  private:
78  void fillFilterList();
79  void showInGraphicalShell(const QString &filePath);
80 
81  QMenu* m_pShowDirListMenu;
82  QMenu* m_pFileSystemSettingMenu;
83  QMenu* m_pContextMenu;
84  QTextBrowser* m_pPathEdit;
85  QToolBar* m_pMainToolbar;
86  QTreeViewItom* m_pTreeView;
87  QLabel* m_pLblFilter;
88  QComboBox* m_pCmbFilter;
89  ItomFileSystemModel* m_pFileSystemModel;
90  QSignalMapper *m_newDirSelectedMapper;
91  QString baseDirectory;
92  QHash<QString,QStringList> defaultFilterPatterns;
93  QMutex baseDirChangeMutex;
94  QList<QUrl> m_clipboardCutData; //this mime-data has recently be selected by a cut action and is no available in QClipboard
95  int *m_pColumnWidth;
96  QColor m_linkColor;
97 
98  ShortcutAction* m_pActMoveCDUp;
99  ShortcutAction* m_pActSelectCD;
100  ShortcutAction* m_pActCopyDir;
101  ShortcutAction* m_pActPasteDir;
102  ShortcutAction* m_pActOpenFile;
103  ShortcutAction* m_pActExecuteFile;
104  ShortcutAction* m_pActLocateOnDisk;
105  ShortcutAction* m_pActRenameItem;
106  ShortcutAction* m_pActDeleteItems;
107  ShortcutAction* m_pActCutItems;
108  ShortcutAction* m_pActCopyItems;
109  ShortcutAction* m_pActPasteItems;
110  ShortcutAction* m_pActNewDir;
111  ShortcutAction* m_pActNewPyFile;
112  ShortcutAction* m_pViewList;
113  ShortcutAction* m_pViewDetails;
114 
115  QAction *m_lastMovedShowDirAction;
116 
117  signals:
118  void currentDirChanged();
119 
120  private slots:
121  void mnuMoveCDUp();
122  void mnuSelectCD();
123  void mnuCopyDir();
124  void mnuPasteDir();
125  void mnuLocateOnDisk();
126  void mnuExecuteFile();
127  void mnuOpenFile();
128  void mnuRenameItem();
129  void mnuDeleteItems();
130  void mnuCutItems();
131  void mnuCopyItems();
132  void mnuPasteItems();
133  void mnuNewDir();
134  void mnuNewPyFile();
135  void showList();
136  void showDetails();
137  void mnuToggleView();
138  void newDirSelected(const QString& text);
139  void cmbFilterEditTextChanged(const QString &text);
140  void openFile(const QModelIndex& index);
141  void treeViewContextMenuRequested(const QPoint &pos);
142  void setTreeViewHideColumns(const bool &hide);
143  void removeActionFromDirList(const int &pos);
144  void itemDoubleClicked(const QModelIndex &index);
145 
146  void pathAnchorClicked(const QUrl &link);
147 
148  public slots:
149  RetVal changeBaseDirectory(QString dir);
150  void processError(QProcess::ProcessError error);
151  };
152 
153 } //end namespace ito
154 
155 #endif
Class for managing status values (like errors or warning)
Definition: retVal.h:54
Instead of the default QFileSystemModel, this model is able to provide a more flexible support for dr...
Definition: itomFileSystemModel.h:33
Definition: fileSystemDockWidget.h:52
Definition: apiFunctionsGraph.cpp:39
Definition: itomQWidgets.h:62
Definition: shortcutAction.h:40
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition: abstractDockWidget.h:54
tFloatingStyle
The floating style of a widget, derived from AbstractDockWidget.
Definition: abstractDockWidget.h:88
Definition: abstractDockWidget.h:90
Definition: abstractDockWidget.h:99
bool docked() const
Definition: abstractDockWidget.h:128
tMovingStyle
The configuration if a docked AbstractDockWidget can be moved from one docking area to another one...
Definition: abstractDockWidget.h:96