File indexing completed on 2024-05-05 03:49:17
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 #ifndef MARBLE_DECLARATIVE_OBJECT_H 0007 #define MARBLE_DECLARATIVE_OBJECT_H 0008 0009 #include <QObject> 0010 0011 class MarbleDeclarativeObjectPrivate; 0012 0013 /** 0014 * Provides access to global Marble related properties and methods 0015 * to QML (intended to be registered as a global QML object) 0016 */ 0017 class MarbleDeclarativeObject : public QObject 0018 { 0019 Q_OBJECT 0020 0021 Q_PROPERTY(QString version READ version CONSTANT) 0022 0023 public: 0024 explicit MarbleDeclarativeObject( QObject* parent = nullptr ); 0025 0026 ~MarbleDeclarativeObject() override; 0027 0028 /** Returns the Marble library version */ 0029 QString version() const; 0030 0031 public Q_SLOTS: 0032 /** 0033 * @brief resolvePath Resolves files in the marble data path 0034 * @param path Relative path to a file installed in Marble's data path 0035 * @return The absolute path to the given file, or an empty string if the 0036 * relative path cannot be resolved 0037 * @see MarbleDirs 0038 */ 0039 QString resolvePath( const QString &path ) const; 0040 0041 /** 0042 * @brief canExecute Check whether a given program is found in the path 0043 * @param program The name of the program 0044 * @return Returns true iff the given program is found in one of 0045 * directories defined by the PATH environment variable (as reported by 0046 * QProcessEnvironment) and has the executable bit set 0047 */ 0048 bool canExecute( const QString &program ) const; 0049 0050 private: 0051 MarbleDeclarativeObjectPrivate* const d; 0052 }; 0053 0054 #endif