mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-29 osgearth integration : added utility to get common GCS directories
This commit is contained in:
parent
01a56796c3
commit
0cdf0c0681
81
ground/openpilotgcs/src/libs/utils/gcsdirs.cpp
Normal file
81
ground/openpilotgcs/src/libs/utils/gcsdirs.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include "gcsdirs.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QApplication>
|
||||
|
||||
GCSDirs::GCSDirs()
|
||||
: d(0)
|
||||
{}
|
||||
|
||||
QString GCSDirs::rootDir()
|
||||
{
|
||||
// Figure out root : Up one from 'bin'
|
||||
QDir rootDir = QApplication::applicationDirPath();
|
||||
|
||||
rootDir.cdUp();
|
||||
return rootDir.canonicalPath();
|
||||
}
|
||||
|
||||
QString GCSDirs::libraryPath(QString provider)
|
||||
{
|
||||
QString libPath = rootDir();
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
// TODO not correct...
|
||||
libPath += QLatin1String("/Plugins");
|
||||
#else
|
||||
// GCS_LIBRARY_BASENAME is a compiler define set by qmake
|
||||
libPath += QLatin1Char('/') + QLatin1String(LIB_REL_PATH);
|
||||
libPath += QLatin1Char('/') + provider;
|
||||
#endif
|
||||
return libPath;
|
||||
}
|
||||
|
||||
QString GCSDirs::pluginPath(QString provider)
|
||||
{
|
||||
QString pluginPath = rootDir();
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
// TODO not correct...
|
||||
pluginPath += QLatin1String("/Plugins");
|
||||
#else
|
||||
// GCS_LIBRARY_BASENAME is a compiler define set by qmake
|
||||
pluginPath += QLatin1Char('/') + QLatin1String(LIB_REL_PATH);
|
||||
pluginPath += QLatin1Char('/') + provider;
|
||||
pluginPath += QLatin1String("/plugins");
|
||||
#endif
|
||||
return pluginPath;
|
||||
}
|
||||
|
||||
QString GCSDirs::sharePath(QString provider)
|
||||
{
|
||||
QString sharePath = rootDir();
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
sharePath += QLatin1String("/Resources");
|
||||
#else
|
||||
sharePath += QLatin1String("/share/openpilotgcs");
|
||||
sharePath += QLatin1Char('/') + provider;
|
||||
#endif
|
||||
return sharePath;
|
||||
}
|
||||
|
||||
QString GCSDirs::gcsPluginPath()
|
||||
{
|
||||
return pluginPath("openpilotgcs");
|
||||
}
|
||||
|
||||
QString GCSDirs::gcsSharePath()
|
||||
{
|
||||
return sharePath("openpilotgcs");
|
||||
}
|
||||
|
||||
void GCSDirs::debug()
|
||||
{
|
||||
qDebug() << "=== GCSDirs ===";
|
||||
qDebug() << "GCS Share Path :" << gcsSharePath();
|
||||
qDebug() << "GCS Plugin Path :" << gcsPluginPath();
|
||||
qDebug() << "===================";
|
||||
}
|
32
ground/openpilotgcs/src/libs/utils/gcsdirs.h
Normal file
32
ground/openpilotgcs/src/libs/utils/gcsdirs.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef GCSDIRS_H
|
||||
#define GCSDIRS_H
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
class QString;
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT GCSDirs {
|
||||
public:
|
||||
GCSDirs();
|
||||
|
||||
static QString rootDir();
|
||||
|
||||
static QString libraryPath(QString provider);
|
||||
|
||||
static QString pluginPath(QString provider);
|
||||
|
||||
static QString sharePath(QString provider);
|
||||
|
||||
static QString gcsSharePath();
|
||||
|
||||
static QString gcsPluginPath();
|
||||
|
||||
static void debug();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(GCSDirs)
|
||||
class Private;
|
||||
Private *const d;
|
||||
};
|
||||
|
||||
#endif // GCSDIRS_H
|
@ -1,21 +1,18 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = Utils
|
||||
|
||||
QT += gui \
|
||||
network \
|
||||
xml \
|
||||
svg \
|
||||
opengl \
|
||||
qml quick \
|
||||
widgets
|
||||
QT += network xml svg opengl gui widgets qml quick quickwidgets
|
||||
|
||||
DEFINES += QTCREATOR_UTILS_LIB
|
||||
|
||||
include(../../openpilotgcslibrary.pri)
|
||||
|
||||
DEFINES += DATA_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_DATA_PATH, $$GCS_APP_PATH)\")
|
||||
DEFINES += LIB_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_LIBRARY_PATH, $$GCS_PATH)\")
|
||||
|
||||
SOURCES += reloadpromptutils.cpp \
|
||||
SOURCES += \
|
||||
gcsdirs.cpp \
|
||||
reloadpromptutils.cpp \
|
||||
settingsutils.cpp \
|
||||
filesearch.cpp \
|
||||
pathchooser.cpp \
|
||||
@ -50,8 +47,8 @@ SOURCES += reloadpromptutils.cpp \
|
||||
detailswidget.cpp \
|
||||
coordinateconversions.cpp \
|
||||
pathutils.cpp \
|
||||
worldmagmodel.cpp \
|
||||
homelocationutil.cpp \
|
||||
worldmagmodel.cpp \
|
||||
homelocationutil.cpp \
|
||||
mytabbedstackwidget.cpp \
|
||||
mytabwidget.cpp \
|
||||
cachedsvgitem.cpp \
|
||||
@ -64,14 +61,17 @@ SOURCES += reloadpromptutils.cpp \
|
||||
SOURCES += xmlconfig.cpp
|
||||
|
||||
win32 {
|
||||
SOURCES += abstractprocess_win.cpp \
|
||||
SOURCES += \
|
||||
abstractprocess_win.cpp \
|
||||
consoleprocess_win.cpp \
|
||||
winutils.cpp
|
||||
HEADERS += winutils.h
|
||||
}
|
||||
else:SOURCES += consoleprocess_unix.cpp
|
||||
|
||||
HEADERS += utils_global.h \
|
||||
HEADERS += \
|
||||
utils_global.h \
|
||||
gcsdirs.h \
|
||||
reloadpromptutils.h \
|
||||
settingsutils.h \
|
||||
filesearch.h \
|
||||
@ -110,8 +110,8 @@ HEADERS += utils_global.h \
|
||||
detailswidget.h \
|
||||
coordinateconversions.h \
|
||||
pathutils.h \
|
||||
worldmagmodel.h \
|
||||
homelocationutil.h \
|
||||
worldmagmodel.h \
|
||||
homelocationutil.h \
|
||||
mytabbedstackwidget.h \
|
||||
mytabwidget.h \
|
||||
cachedsvgitem.h \
|
||||
@ -121,13 +121,13 @@ HEADERS += utils_global.h \
|
||||
crc.h \
|
||||
mustache.h
|
||||
|
||||
|
||||
HEADERS += xmlconfig.h
|
||||
|
||||
FORMS += filewizardpage.ui \
|
||||
FORMS += \
|
||||
filewizardpage.ui \
|
||||
projectintropage.ui \
|
||||
newclasswidget.ui \
|
||||
submiteditorwidget.ui \
|
||||
checkablemessagebox.ui
|
||||
checkablemessagebox.ui
|
||||
|
||||
RESOURCES += utils.qrc
|
||||
|
Loading…
x
Reference in New Issue
Block a user