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 
12 #include <QAbstractItemModel>
13 #include <QFileIconProvider>
14 #include <QObject>
15 
16 class vtkProcessModule;
17 class pqServer;
18 class QModelIndex;
19 
28 class PQCORE_EXPORT pqFileDialogModel : public QAbstractItemModel
29 {
30  typedef QAbstractItemModel base;
31 
32  Q_OBJECT
33 
34 public:
39  pqFileDialogModel(pqServer* server, QObject* Parent = nullptr);
40  ~pqFileDialogModel() override;
41 
45  void setFileItemFlags(const Qt::ItemFlags& flags);
46 
50  void setDirectoryItemFlags(const Qt::ItemFlags& flags);
51 
53 
59  void setShowDetailedInfo(bool show);
60  bool isShowingDetailedInfo();
62 
64 
68  void setGroupFiles(bool group);
69  bool isGroupingFiles();
71 
75  void setCurrentPath(const QString& path);
76 
80  QString getCurrentPath();
81 
85  bool isHidden(const QModelIndex&);
86 
90  bool isDir(const QModelIndex&) const;
91 
92  // Creates a directory. "dirName" can be relative or absolute path
93  bool mkdir(const QString& dirname);
94 
95  // Removes a directory. "dirName" can be relative or absolute path
96  bool rmdir(const QString& dirname);
97 
98  // Renames a directory or file.
99  bool rename(const QString& oldname, const QString& newname);
100 
105  bool fileExists(const QString& file, QString& fullpath);
106 
111  bool dirExists(const QString& dir, QString& fullpath);
112 
117  bool dirIsEmpty(const QString& dir, QString& fullpath);
118 
123  QChar separator() const;
124 
128  QString absoluteFilePath(const QString&);
129 
133  int fileType(const QString&);
134 
140  QStringList getFilePaths(const QModelIndex&);
141 
145  pqServer* server() const;
146 
150  bool setData(const QModelIndex& idx, const QVariant& value, int role) override;
151 
152  // overloads for QAbstractItemModel
153 
157  int columnCount(const QModelIndex&) const override;
161  QVariant data(const QModelIndex& idx, int role) const override;
165  QModelIndex index(int row, int column, const QModelIndex&) const override;
169  QModelIndex parent(const QModelIndex&) const override;
173  int rowCount(const QModelIndex&) const override;
177  bool hasChildren(const QModelIndex& p) const override;
181  QVariant headerData(int section, Qt::Orientation, int role) const override;
185  Qt::ItemFlags flags(const QModelIndex& idx) const override;
186 
187 private:
188  class pqImplementation;
189  pqImplementation* const Implementation;
190 };
191 
192 class pqFileDialogModelIconProvider : protected QFileIconProvider
193 {
194 public:
195  enum IconType
196  {
206  NetworkFolder
207  };
209  QIcon icon(IconType t) const;
210  QIcon icon(vtkPVFileInformation::FileTypes f) const;
211 
212 protected:
213  QIcon icon(const QFileInfo& info) const override;
214  QIcon icon(QFileIconProvider::IconType ico) const override;
215 
216  QIcon InvalidIcon;
219  QIcon DomainIcon;
220  QIcon NetworkIcon;
221 };
222 
223 #endif // !pqFileDialogModel_h
data
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