PackageScheme.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2015 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
19 #ifndef RQT_MULTIPLOT_PACKAGE_SCHEME_H
20 #define RQT_MULTIPLOT_PACKAGE_SCHEME_H
21 
22 #include <QDir>
23 #include <QFileSystemModel>
24 #include <QList>
25 #include <QMap>
26 #include <QStringListModel>
27 
30 
31 namespace rqt_multiplot {
32  class PackageScheme :
33  public UrlScheme {
34  Q_OBJECT
35  public:
36  PackageScheme(QObject* parent = 0, const QString& prefix = "package",
37  QDir::Filters filter = QDir::NoFilter);
38  virtual ~PackageScheme();
39 
40  void setFilter(QDir::Filters filter);
41  QDir::Filters getFilter() const;
42 
43  size_t getNumHosts() const;
44  QModelIndex getHostIndex(size_t row) const;
45  QVariant getHostData(const QModelIndex& index, int role) const;
46 
47  size_t getNumPaths(const QModelIndex& hostIndex, const QModelIndex&
48  parent) const;
49  QModelIndex getPathIndex(const QModelIndex& hostIndex, size_t row,
50  const QModelIndex& parent = QModelIndex()) const;
51  QVariant getPathData(const QModelIndex& index, int role) const;
52 
53  QString getHost(const QModelIndex& hostIndex) const;
54  QString getPath(const QModelIndex& hostIndex, const QModelIndex&
55  pathIndex) const;
56 
57  QString getFilePath(const QModelIndex& hostIndex, const QModelIndex&
58  pathIndex) const;
59  QString getFilePath(const QString& host, const QString& path) const;
60 
61  private:
63 
64  QFileSystemModel* fileSystemModel_;
65  QStringListModel* packageListModel_;
66 
67  QList<QString> packages_;
68  QMap<QString, QString> packagePaths_;
69 
70  private slots:
71  void registryUpdateStarted();
73 
74  void modelDirectoryLoaded(const QString& path);
75  };
76 };
77 
78 #endif
QVariant getPathData(const QModelIndex &index, int role) const
QModelIndex getHostIndex(size_t row) const
QVariant getHostData(const QModelIndex &index, int role) const
PackageScheme(QObject *parent=0, const QString &prefix="package", QDir::Filters filter=QDir::NoFilter)
QString getFilePath(const QModelIndex &hostIndex, const QModelIndex &pathIndex) const
QString getPath(const QModelIndex &hostIndex, const QModelIndex &pathIndex) const
QList< QString > packages_
Definition: PackageScheme.h:67
void setFilter(QDir::Filters filter)
QString getHost(const QModelIndex &hostIndex) const
void modelDirectoryLoaded(const QString &path)
QDir::Filters getFilter() const
QFileSystemModel * fileSystemModel_
Definition: PackageScheme.h:64
QStringListModel * packageListModel_
Definition: PackageScheme.h:65
size_t getNumPaths(const QModelIndex &hostIndex, const QModelIndex &parent) const
PackageRegistry * registry_
Definition: PackageScheme.h:62
QMap< QString, QString > packagePaths_
Definition: PackageScheme.h:68
QModelIndex getPathIndex(const QModelIndex &hostIndex, size_t row, const QModelIndex &parent=QModelIndex()) const


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Wed Jul 10 2019 03:49:44