30 QDir::Filters filter) :
33 fileSystemModel_(new QFileSystemModel(this)),
34 packageListModel_(new QStringListModel(this)) {
38 connect(
registry_, SIGNAL(updateStarted()),
this,
40 connect(
registry_, SIGNAL(updateFinished()),
this,
81 QModelIndex& parent)
const {
82 if (!parent.isValid()) {
83 if (hostIndex.isValid()) {
104 row,
const QModelIndex& parent)
const {
105 if (!parent.isValid()) {
106 if (hostIndex.isValid()) {
116 return QModelIndex();
125 if (hostIndex.isValid())
132 QModelIndex& pathIndex)
const {
133 if (hostIndex.isValid()) {
137 return QDir(packagePath).relativeFilePath(path);
144 QModelIndex& pathIndex)
const {
145 if (hostIndex.isValid()) {
146 if (pathIndex.isValid())
160 QMap<QString, QString>::const_iterator it =
packagePaths_.find(host);
163 packagePath = it.value();
167 host.toStdString()));
169 if (!packagePath.isEmpty()) {
170 QDir packageDir(packagePath);
172 if (packageDir.exists())
173 return packageDir.absoluteFilePath(path);
197 for (QMap<QString, QString>::const_iterator it =
packagePaths_.begin();
199 if (path.startsWith(it.value()))
200 emit
pathLoaded(it.key(), QDir(it.value()).relativeFilePath(path));
QVariant getPathData(const QModelIndex &index, int role) const
QModelIndex getHostIndex(size_t row) const
void pathLoaded(const QString &host, const QString &path)
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_
void setFilter(QDir::Filters filter)
QString getHost(const QModelIndex &hostIndex) const
size_t getNumHosts() const
void modelDirectoryLoaded(const QString &path)
QDir::Filters getFilter() const
QFileSystemModel * fileSystemModel_
ROSLIB_DECL std::string getPath(const std::string &package_name)
QStringListModel * packageListModel_
size_t getNumPaths(const QModelIndex &hostIndex, const QModelIndex &parent) const
PackageRegistry * registry_
QMap< QString, QString > getPackages() const
QMap< QString, QString > packagePaths_
void registryUpdateStarted()
void registryUpdateFinished()
QModelIndex getPathIndex(const QModelIndex &hostIndex, size_t row, const QModelIndex &parent=QModelIndex()) const