1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

New "PathUtils" Utils function, to help plugins detect where the "share" directory is located. Should be improved but it is a start.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1569 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-09-09 15:17:37 +00:00 committed by edouard
parent c225153723
commit 2b70ed53f7
4 changed files with 203 additions and 91 deletions

View File

@ -81,6 +81,10 @@ macx {
!isEqual(GCS_SOURCE_TREE, $$GCS_BUILD_TREE):copydata = 1
}
DEFINES += GCS_DATA_PATH=\\\"$$GCS_DATA_PATH\\\"
INCLUDEPATH += \
$$GCS_SOURCE_TREE/src/libs

View File

@ -0,0 +1,57 @@
/**
******************************************************************************
*
* @file pathutils.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Utilities to find the location of openpilot GCS files:
* - Plugins Share directory path
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pathutils.h"
#include <stdint.h>
#include <QDebug>
namespace Utils {
PathUtils::PathUtils()
{
}
/**
Returns the base path of the share directory
*/
QString PathUtils::GetDataPath()
{
// Figure out root: Up one from 'bin'
//QDir rootDir = QApplication::applicationDirPath();
//rootDir.cdUp();
//const QString rootDirPath = rootDir.canonicalPath();
//QString pluginPath = rootDirPath;
//pluginPath += QLatin1Char('/');
QString pluginPath = QLatin1String(GCS_DATA_PATH);
pluginPath += QLatin1Char('/');
return pluginPath;
}
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file pathutils.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PATHUTILS_H
#define PATHUTILS_H
#include "utils_global.h"
#include "../extensionsystem/pluginmanager.h"
#include <QDir>
#include <QApplication>
namespace Utils {
class QTCREATOR_UTILS_EXPORT PathUtils
{
public:
PathUtils();
QString GetDataPath();
};
}
#endif /* PATHUTILS_H */

View File

@ -1,91 +1,93 @@
TEMPLATE = lib
TARGET = Utils
QT += gui \
network
DEFINES += QTCREATOR_UTILS_LIB
include(../../openpilotgcslibrary.pri)
SOURCES += reloadpromptutils.cpp \
settingsutils.cpp \
filesearch.cpp \
pathchooser.cpp \
pathlisteditor.cpp \
filewizardpage.cpp \
filewizarddialog.cpp \
projectintropage.cpp \
basevalidatinglineedit.cpp \
filenamevalidatinglineedit.cpp \
projectnamevalidatinglineedit.cpp \
codegeneration.cpp \
newclasswidget.cpp \
classnamevalidatinglineedit.cpp \
linecolumnlabel.cpp \
fancylineedit.cpp \
qtcolorbutton.cpp \
savedaction.cpp \
submiteditorwidget.cpp \
synchronousprocess.cpp \
submitfieldwidget.cpp \
consoleprocess.cpp \
uncommentselection.cpp \
parameteraction.cpp \
treewidgetcolumnstretcher.cpp \
checkablemessagebox.cpp \
styledbar.cpp \
stylehelper.cpp \
welcomemodetreewidget.cpp \
iwelcomepage.cpp \
fancymainwindow.cpp \
detailsbutton.cpp \
detailswidget.cpp \
coordinateconversions.cpp
win32 {
SOURCES += abstractprocess_win.cpp \
consoleprocess_win.cpp \
winutils.cpp
HEADERS += winutils.h
}
else:SOURCES += consoleprocess_unix.cpp
HEADERS += utils_global.h \
reloadpromptutils.h \
settingsutils.h \
filesearch.h \
listutils.h \
pathchooser.h \
pathlisteditor.h \
filewizardpage.h \
filewizarddialog.h \
projectintropage.h \
basevalidatinglineedit.h \
filenamevalidatinglineedit.h \
projectnamevalidatinglineedit.h \
codegeneration.h \
newclasswidget.h \
classnamevalidatinglineedit.h \
linecolumnlabel.h \
fancylineedit.h \
qtcolorbutton.h \
savedaction.h \
submiteditorwidget.h \
abstractprocess.h \
consoleprocess.h \
synchronousprocess.h \
submitfieldwidget.h \
uncommentselection.h \
parameteraction.h \
treewidgetcolumnstretcher.h \
checkablemessagebox.h \
qtcassert.h \
styledbar.h \
stylehelper.h \
welcomemodetreewidget.h \
iwelcomepage.h \
fancymainwindow.h \
detailsbutton.h \
detailswidget.h \
coordinateconversions.h
FORMS += filewizardpage.ui \
projectintropage.ui \
newclasswidget.ui \
submiteditorwidget.ui \
checkablemessagebox.ui
RESOURCES += utils.qrc
TEMPLATE = lib
TARGET = Utils
QT += gui \
network
DEFINES += QTCREATOR_UTILS_LIB
include(../../openpilotgcslibrary.pri)
SOURCES += reloadpromptutils.cpp \
settingsutils.cpp \
filesearch.cpp \
pathchooser.cpp \
pathlisteditor.cpp \
filewizardpage.cpp \
filewizarddialog.cpp \
projectintropage.cpp \
basevalidatinglineedit.cpp \
filenamevalidatinglineedit.cpp \
projectnamevalidatinglineedit.cpp \
codegeneration.cpp \
newclasswidget.cpp \
classnamevalidatinglineedit.cpp \
linecolumnlabel.cpp \
fancylineedit.cpp \
qtcolorbutton.cpp \
savedaction.cpp \
submiteditorwidget.cpp \
synchronousprocess.cpp \
submitfieldwidget.cpp \
consoleprocess.cpp \
uncommentselection.cpp \
parameteraction.cpp \
treewidgetcolumnstretcher.cpp \
checkablemessagebox.cpp \
styledbar.cpp \
stylehelper.cpp \
welcomemodetreewidget.cpp \
iwelcomepage.cpp \
fancymainwindow.cpp \
detailsbutton.cpp \
detailswidget.cpp \
coordinateconversions.cpp \
pathutils.cpp
win32 {
SOURCES += abstractprocess_win.cpp \
consoleprocess_win.cpp \
winutils.cpp
HEADERS += winutils.h
}
else:SOURCES += consoleprocess_unix.cpp
HEADERS += utils_global.h \
reloadpromptutils.h \
settingsutils.h \
filesearch.h \
listutils.h \
pathchooser.h \
pathlisteditor.h \
filewizardpage.h \
filewizarddialog.h \
projectintropage.h \
basevalidatinglineedit.h \
filenamevalidatinglineedit.h \
projectnamevalidatinglineedit.h \
codegeneration.h \
newclasswidget.h \
classnamevalidatinglineedit.h \
linecolumnlabel.h \
fancylineedit.h \
qtcolorbutton.h \
savedaction.h \
submiteditorwidget.h \
abstractprocess.h \
consoleprocess.h \
synchronousprocess.h \
submitfieldwidget.h \
uncommentselection.h \
parameteraction.h \
treewidgetcolumnstretcher.h \
checkablemessagebox.h \
qtcassert.h \
styledbar.h \
stylehelper.h \
welcomemodetreewidget.h \
iwelcomepage.h \
fancymainwindow.h \
detailsbutton.h \
detailswidget.h \
coordinateconversions.h \
pathutils.h
FORMS += filewizardpage.ui \
projectintropage.ui \
newclasswidget.ui \
submiteditorwidget.ui \
checkablemessagebox.ui
RESOURCES += utils.qrc