Marble

MarbleDeclarativeObject.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <[email protected]>
4 //
5 
6 #include "MarbleDeclarativeObject.h"
7 
8 #include "MarbleDirs.h"
9 #include "MarbleGlobal.h"
10 
11 #include <QProcessEnvironment>
12 
13 class MarbleDeclarativeObjectPrivate
14 {
15 public:
16  // Yet empty
17 };
18 
19 MarbleDeclarativeObject::MarbleDeclarativeObject( QObject *parent ) :
20  QObject( parent ),
21  d( new MarbleDeclarativeObjectPrivate )
22 {
23  // nothing to do
24 }
25 
26 MarbleDeclarativeObject::~MarbleDeclarativeObject()
27 {
28  delete d;
29 }
30 
32 {
33  return Marble::MARBLE_VERSION_STRING;
34 }
35 
37 {
38  return Marble::MarbleDirs::path( path );
39 }
40 
41 bool MarbleDeclarativeObject::canExecute(const QString &program) const
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"
QString version() const
Returns the Marble library version.
QString resolvePath(const QString &path) const
resolvePath Resolves files in the marble data path
QString value(const QString &name, const QString &defaultValue) const const
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool canExecute(const QString &program) const
canExecute Check whether a given program is found in the path
bool exists() const const
QProcessEnvironment systemEnvironment()
bool isExecutable() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:23:29 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.