itom
Loading...
Searching...
No Matches
fileSystemDockWidget.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2024, Institut für Technische Optik (ITO),
5 Universität 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#pragma once
24
25#include "../helper/IOHelper.h"
26#include "abstractDockWidget.h"
27
28#include "itomQWidgets.h"
29#include "../models/itomFileSystemModel.h"
30
31#include <qwidget.h>
32#include <qaction.h>
33#include <qtoolbar.h>
34
35#include <qtextbrowser.h>
36#include <qtreeview.h>
37#include <qlabel.h>
38#include <qhash.h>
39#include <qmutex.h>
40#include <qmenu.h>
41#include <qcombobox.h>
42#include <qprocess.h>
43#include <qevent.h>
44#include <qurl.h>
45#include <qfileiconprovider.h>
46
47#include <qsignalmapper.h>
48
49
50namespace 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 void treeViewHideOrShowColumns(const bool& hide);
81
82 QMenu* m_pShowDirListMenu;
83 QMenu* m_pFileSystemSettingMenu;
84 QMenu* m_pContextMenu;
85 QTextBrowser* m_pPathEdit;
86 QToolBar* m_pMainToolbar;
87 QTreeViewItom* m_pTreeView;
88 QLabel* m_pLblFilter;
89 QComboBox* m_pCmbFilter;
90 ItomFileSystemModel* m_pFileSystemModel;
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 bool m_showColumnDetails;
96 QList<int> m_detailColumnsWidth;
97 QColor m_linkColor;
98
99#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
100 // since (at least) Qt 6.7, QFileSystemModel
101 // creates a default QAbstractFileIconProvider,
102 // that shows very basic folder icons. However, we
103 // would like to see the real folder icons of the
104 // operating system. Therefore, we have to pass
105 // our own instance of QFileIconProvider to the model.
106 QFileIconProvider m_fileIconProvider;
107#endif
108
109 ShortcutAction* m_pActMoveCDUp;
110 ShortcutAction* m_pActSelectCD;
111 ShortcutAction* m_pActCopyDir;
112 ShortcutAction* m_pActPasteDir;
113 ShortcutAction* m_pActOpenFile;
114 ShortcutAction* m_pActExecuteFile;
115 ShortcutAction* m_pActLocateOnDisk;
116 ShortcutAction* m_pActRenameItem;
117 ShortcutAction* m_pActDeleteItems;
118 ShortcutAction* m_pActCutItems;
119 ShortcutAction* m_pActCopyItems;
120 ShortcutAction* m_pActPasteItems;
121 ShortcutAction* m_pActNewDir;
122 ShortcutAction* m_pActNewPyFile;
123 ShortcutAction* m_pViewList;
124 ShortcutAction* m_pViewDetails;
125
126 QAction *m_lastMovedShowDirAction;
127
128 signals:
129 void currentDirChanged();
130
131 private slots:
132 void mnuMoveCDUp();
133 void mnuSelectCD();
134 void mnuCopyDir();
135 void mnuPasteDir();
136 void mnuLocateOnDisk();
137 void mnuExecuteFile();
138 void mnuOpenFile();
139 void mnuRenameItem();
140 void mnuDeleteItems();
141 void mnuCutItems();
142 void mnuCopyItems();
143 void mnuPasteItems();
144 void mnuNewDir();
145 void mnuNewPyFile();
146 void showList();
147 void showDetails();
148 void mnuToggleView();
149 void newDirSelected(const QString& text);
150 void cmbFilterEditTextChanged(const QString &text);
151 void openFile(const QModelIndex& index);
152 void treeViewContextMenuRequested(const QPoint &pos);
153 void removeActionFromDirList(const int &pos);
154 void itemDoubleClicked(const QModelIndex &index);
155
156 void pathAnchorClicked(const QUrl &link);
157
158 public slots:
159 RetVal changeBaseDirectory(QString dir);
160 void processError(QProcess::ProcessError error);
161 };
162
163} //end namespace ito
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition abstractDockWidget.h:55
tMovingStyle
The configuration if a docked AbstractDockWidget can be moved from one docking area to another one.
Definition abstractDockWidget.h:97
@ movingEnabled
Definition abstractDockWidget.h:99
tFloatingStyle
The floating style of a widget, derived from AbstractDockWidget.
Definition abstractDockWidget.h:89
@ floatingNone
Definition abstractDockWidget.h:90
Definition fileSystemDockWidget.h:53
Instead of the default QFileSystemModel, this model is able to provide a more flexible support for dr...
Definition itomFileSystemModel.h:34
Definition itomQWidgets.h:81
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition shortcutAction.h:41
Definition apiFunctionsGraph.cpp:40