Marble

MarbleDeclarativeObject.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#include "MarbleDeclarativeObject.h"
7
8#include "MarbleDirs.h"
9#include "MarbleGlobal.h"
10
11#include <QProcessEnvironment>
12
13class MarbleDeclarativeObjectPrivate
14{
15public:
16 // Yet empty
17};
18
19MarbleDeclarativeObject::MarbleDeclarativeObject( QObject *parent ) :
20 QObject( parent ),
21 d( new MarbleDeclarativeObjectPrivate )
22{
23 // nothing to do
24}
25
26MarbleDeclarativeObject::~MarbleDeclarativeObject()
27{
28 delete d;
29}
30
31QString MarbleDeclarativeObject::version() const
32{
33 return Marble::MARBLE_VERSION_STRING;
34}
35
37{
38 return Marble::MarbleDirs::path( path );
39}
40
42{
43 QString path = QProcessEnvironment::systemEnvironment().value(QStringLiteral("PATH"), QStringLiteral("/usr/local/bin:/usr/bin:/bin"));
44 for( const QString &dir: path.split( QLatin1Char( ':' ) ) ) {
45 QFileInfo const executable( QDir( dir ), program );
46 if ( executable.exists() && executable.isExecutable() ) {
47 return true;
48 }
49 }
50
51 return false;
52}
53
54#include "moc_MarbleDeclarativeObject.cpp"
bool canExecute(const QString &program) const
canExecute Check whether a given program is found in the path
QString resolvePath(const QString &path) const
resolvePath Resolves files in the marble data path
bool exists(const QString &path)
bool isExecutable() const const
QProcessEnvironment systemEnvironment()
QString value(const QString &name, const QString &defaultValue) const const
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.