itom 2.2.1
K:/git-itom/sources/itom/Qitom/widgets/fileSystemDockWidget.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef FILESYSTEMDOCKWIDGET_H
00024 #define FILESYSTEMDOCKWIDGET_H
00025 
00026 #include "../helper/IOHelper.h"
00027 #include "abstractDockWidget.h"
00028 
00029 #include "itomQWidgets.h"
00030 
00031 #include <qwidget.h>
00032 #include <qaction.h>
00033 #include <qtoolbar.h>
00034 
00035 #include <qtextbrowser.h>
00036 #include <qtreeview.h>
00037 #include <qlabel.h>
00038 #include <qfilesystemmodel.h>
00039 #include <qhash.h>
00040 #include <qmutex.h>
00041 #include <qmenu.h>
00042 #include <qcombobox.h>
00043 #include <qprocess.h>
00044 #include <qevent.h>
00045 #include <qurl.h>
00046 
00047 #include <qsignalmapper.h>
00048 
00049 
00050 namespace ito
00051 {
00052     class FileSystemDockWidget : public AbstractDockWidget
00053     {
00054         Q_OBJECT
00055 
00056             Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor DESIGNABLE true);
00057 
00058         public:
00059             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());
00060             ~FileSystemDockWidget();
00061 
00062             QColor linkColor() { return m_linkColor; }
00063             void setLinkColor(const QColor &color);
00064 
00065         protected:
00066             void createActions();
00067             void createMenus();
00068             void createToolBars();
00069             void createStatusBar(){}
00070             void updateActions();
00071             void updatePythonActions(){ updateActions(); }
00072 
00073             QString getHtmlTag(const QString &tag);
00074 
00075             bool eventFilter(QObject *obj, QEvent *event);
00076 
00077         private:
00078             void fillFilterList();
00079             void showInGraphicalShell(const QString &filePath);
00080 
00081             QMenu* m_pShowDirListMenu;
00082             QMenu* m_pFileSystemSettingMenu;
00083             QMenu* m_pContextMenu;
00084             QTextBrowser* m_pPathEdit;
00085             QToolBar* m_pMainToolbar;
00086             QTreeViewItom* m_pTreeView;
00087             QLabel* m_pLblFilter;
00088             QComboBox* m_pCmbFilter;
00089             QFileSystemModel* m_pFileSystemModel;
00090             QSignalMapper *m_newDirSelectedMapper;
00091             QString baseDirectory;
00092             QHash<QString,QStringList> defaultFilterPatterns;
00093             QMutex baseDirChangeMutex;
00094             QList<QUrl> m_clipboardCutData; //this mime-data has recently be selected by a cut action and is no available in QClipboard
00095             int *m_pColumnWidth;
00096             QColor m_linkColor;
00097 
00098             ShortcutAction* m_pActMoveCDUp;
00099             ShortcutAction* m_pActSelectCD;
00100             ShortcutAction* m_pActCopyDir;
00101             ShortcutAction* m_pActPasteDir;
00102             ShortcutAction* m_pActOpenFile;
00103             ShortcutAction* m_pActExecuteFile;
00104             ShortcutAction* m_pActLocateOnDisk;
00105             ShortcutAction* m_pActRenameItem;
00106             ShortcutAction* m_pActDeleteItems;
00107             ShortcutAction* m_pActCutItems;
00108             ShortcutAction* m_pActCopyItems;
00109             ShortcutAction* m_pActPasteItems;
00110             ShortcutAction* m_pActNewDir;
00111             ShortcutAction* m_pActNewPyFile;
00112             ShortcutAction* m_pViewList;
00113             ShortcutAction* m_pViewDetails;
00114 
00115             QAction *m_lastMovedShowDirAction;
00116 
00117         signals:
00118             void currentDirChanged();
00119 
00120         private slots:
00121             void mnuMoveCDUp();
00122             void mnuSelectCD();
00123             void mnuCopyDir();
00124             void mnuPasteDir();
00125             void mnuLocateOnDisk();
00126             void mnuExecuteFile();
00127             void mnuOpenFile();
00128             void mnuRenameItem();
00129             void mnuDeleteItems();
00130             void mnuCutItems();
00131             void mnuCopyItems();
00132             void mnuPasteItems();
00133             void mnuNewDir();
00134             void mnuNewPyFile();
00135             void showList();
00136             void showDetails();
00137             void mnuToggleView();
00138             void newDirSelected(const QString& text);
00139             void cmbFilterEditTextChanged(const QString &text);
00140             void openFile(const QModelIndex& index);
00141             void treeViewContextMenuRequested(const QPoint &pos);
00142             void setTreeViewHideColumns(const bool &hide);
00143             void removeActionFromDirList(const int &pos);
00144             void itemDoubleClicked(const QModelIndex &index);
00145 
00146             void pathAnchorClicked(const QUrl &link);
00147 
00148         public slots:
00149             RetVal changeBaseDirectory(QString dir);
00150             void processError(QProcess::ProcessError error);
00151     };
00152 
00153 } //end namespace ito
00154 
00155 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends