pqFileDialogModel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef pqFileDialogModel_h
6 #define pqFileDialogModel_h
7 
8 #include "pqCoreModule.h"
9 
10 #include "vtkPVFileInformation.h"
11 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_12_0
12 
13 #include <QAbstractItemModel>
14 #include <QFileIconProvider>
15 #include <QObject>
16 
17 class vtkProcessModule;
18 class pqServer;
19 class QModelIndex;
20 
29 class PQCORE_EXPORT pqFileDialogModel : public QAbstractItemModel
30 {
31  typedef QAbstractItemModel base;
32 
33  Q_OBJECT
34 
35 public:
40  pqFileDialogModel(pqServer* server, QObject* Parent = nullptr);
41  ~pqFileDialogModel() override;
42 
46  void setFileItemFlags(const Qt::ItemFlags& flags);
47 
51  void setDirectoryItemFlags(const Qt::ItemFlags& flags);
52 
54 
60  void setShowDetailedInfo(bool show);
61  bool isShowingDetailedInfo();
63 
65 
69  void setGroupFiles(bool group);
70  bool isGroupingFiles();
72 
76  PARAVIEW_DEPRECATED_IN_5_12_0("Use setGroupFiles(bool) and setCurrentPath(path) instead.")
77  void setCurrentPath(const QString& path, bool groupFiles);
78 
82  void setCurrentPath(const QString& path);
83 
87  QString getCurrentPath();
88 
92  bool isHidden(const QModelIndex&);
93 
97  bool isDir(const QModelIndex&) const;
98 
99  // Creates a directory. "dirName" can be relative or absolute path
100  bool mkdir(const QString& dirname);
101 
102  // Removes a directory. "dirName" can be relative or absolute path
103  bool rmdir(const QString& dirname);
104 
105  // Renames a directory or file.
106  bool rename(const QString& oldname, const QString& newname);
107 
112  bool fileExists(const QString& file, QString& fullpath);
113 
118  bool dirExists(const QString& dir, QString& fullpath);
119 
124  bool dirIsEmpty(const QString& dir, QString& fullpath);
125 
130  QChar separator() const;
131 
135  QString absoluteFilePath(const QString&);
136 
140  int fileType(const QString&);
141 
147  QStringList getFilePaths(const QModelIndex&);
148 
152  pqServer* server() const;
153 
157  bool setData(const QModelIndex& idx, const QVariant& value, int role) override;
158 
159  // overloads for QAbstractItemModel
160 
164  int columnCount(const QModelIndex&) const override;
168  QVariant data(const QModelIndex& idx, int role) const override;
172  QModelIndex index(int row, int column, const QModelIndex&) const override;
176  QModelIndex parent(const QModelIndex&) const override;
180  int rowCount(const QModelIndex&) const override;
184  bool hasChildren(const QModelIndex& p) const override;
188  QVariant headerData(int section, Qt::Orientation, int role) const override;
192  Qt::ItemFlags flags(const QModelIndex& idx) const override;
193 
194 private:
195  class pqImplementation;
196  pqImplementation* const Implementation;
197 };
198 
199 class pqFileDialogModelIconProvider : protected QFileIconProvider
200 {
201 public:
202  enum IconType
203  {
213  NetworkFolder
214  };
216  QIcon icon(IconType t) const;
217  QIcon icon(vtkPVFileInformation::FileTypes f) const;
218 
219 protected:
220  QIcon icon(const QFileInfo& info) const override;
221  QIcon icon(QFileIconProvider::IconType ico) const override;
222 
223  QIcon InvalidIcon;
226  QIcon DomainIcon;
227  QIcon NetworkIcon;
228 };
229 
230 #endif // !pqFileDialogModel_h
data
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
pqFileDialogModel allows remote browsing of a connected ParaView server&#39;s filesystem, as well as browsing of the local file system.
dir
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
value
index
process initialization and management core for ParaView processes.
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:35