mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
OP-955 Moved generated version info to its own lib. Updated code using version info in all referenced places.
This commit is contained in:
parent
76be45242c
commit
62ee55fbb8
@ -1,16 +1,16 @@
|
||||
include(../../openpilotgcs.pri)
|
||||
include(../shared/qtsingleapplication/qtsingleapplication.pri)
|
||||
include(version_info.pri)
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = $$GCS_APP_TARGET
|
||||
DESTDIR = $$GCS_APP_PATH
|
||||
QT += xml
|
||||
SOURCES += main.cpp \
|
||||
gcssplashscreen.cpp \
|
||||
version_info.cpp
|
||||
gcssplashscreen.cpp
|
||||
|
||||
include(../rpath.pri)
|
||||
include(../libs/utils/utils.pri)
|
||||
include(../libs/versioninfo/versioninfo.pri)
|
||||
|
||||
LIBS *= -l$$qtLibraryName(ExtensionSystem) -l$$qtLibraryName(Aggregation)
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "gcssplashscreen.h"
|
||||
#include "versioninfo/version_info.h"
|
||||
#include <QDebug>
|
||||
|
||||
const QChar CopyrightSymbol(0x00a9);
|
||||
@ -33,20 +34,6 @@ const QChar CopyrightSymbol(0x00a9);
|
||||
GCSSplashScreen::GCSSplashScreen() :
|
||||
QSplashScreen(), m_pixmap(0), m_painter(0)
|
||||
{
|
||||
QString revision;
|
||||
QString year;
|
||||
#ifdef GCS_REVISION
|
||||
revision = GCS_REVISION;
|
||||
#else
|
||||
revision = tr("N/A");
|
||||
#endif
|
||||
|
||||
#ifdef GCS_YEAR
|
||||
year = GCS_YEAR;
|
||||
#else
|
||||
year = "2013";
|
||||
#endif
|
||||
|
||||
setWindowFlags(windowFlags());
|
||||
m_pixmap = new QPixmap(":/app/splash.png");
|
||||
|
||||
@ -55,11 +42,11 @@ GCSSplashScreen::GCSSplashScreen() :
|
||||
QFont font("Tahoma", 8);
|
||||
m_painter->setFont(font);
|
||||
m_painter->drawText(405, 170, QString(CopyrightSymbol) +
|
||||
QString(" 2010-") + year +
|
||||
QString(" 2010-") + VersionInfo::year() +
|
||||
QString(tr(" The OpenPilot Project - All Rights Reserved")));
|
||||
|
||||
m_painter->drawText(406, 173, 310, 100, Qt::TextWordWrap|Qt::AlignTop|Qt::AlignLeft,
|
||||
QString(tr("GCS Revision - ")) + revision);
|
||||
QString(tr("GCS Revision - ")) + VersionInfo::revision());
|
||||
setPixmap(*m_pixmap);
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include <QPainter>
|
||||
#include <extensionsystem/pluginspec.h>
|
||||
|
||||
#include "../gcs_version_info.h"
|
||||
|
||||
class GCSSplashScreen : public QSplashScreen
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -2,6 +2,7 @@ TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS = \
|
||||
versioninfo \
|
||||
qscispinbox\
|
||||
qtconcurrent \
|
||||
aggregation \
|
||||
|
@ -23,5 +23,5 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../version_info.h"
|
||||
#include "version_info.h"
|
||||
#include "../../../../build/openpilotgcs-synthetics/version_info.cpp"
|
1
ground/openpilotgcs/src/libs/versioninfo/versioninfo.pri
Normal file
1
ground/openpilotgcs/src/libs/versioninfo/versioninfo.pri
Normal file
@ -0,0 +1 @@
|
||||
LIBS *= -l$$qtLibraryName(VersionInfo)
|
@ -1,3 +1,10 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = VersionInfo
|
||||
|
||||
include(../../openpilotgcslibrary.pri)
|
||||
|
||||
HEADERS = version_info.h
|
||||
|
||||
#
|
||||
# This qmake file generates a version info class implementation.
|
||||
#
|
||||
@ -34,7 +41,7 @@ PYTHON_DIR = python-2.7.4
|
||||
VERSION_INFO_DIR = $$GCS_BUILD_TREE/../openpilotgcs-synthetics
|
||||
VERSION_INFO_SCRIPT = $$ROOT_DIR/make/scripts/version-info.py
|
||||
VERSION_INFO_COMMAND = $$PYTHON \"$$VERSION_INFO_SCRIPT\"
|
||||
VERSION_INFO_TEMPLATE = $$GCS_SOURCE_TREE/src/app/version_info.cpp.template
|
||||
VERSION_INFO_TEMPLATE = $$GCS_SOURCE_TREE/src/libs/versioninfo/version_info.cpp.template
|
||||
VERSION_INFO_FILE = $$VERSION_INFO_DIR/version_info.cpp
|
||||
UAVO_DEF_PATH = $$ROOT_DIR/shared/uavobjectdefinition
|
||||
|
||||
@ -60,3 +67,7 @@ PYTHON_DIR = python-2.7.4
|
||||
}
|
||||
QMAKE_EXTRA_TARGETS += version_info_hook
|
||||
}
|
||||
|
||||
|
||||
SOURCES = version_info.cpp
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "authorsdialog.h"
|
||||
|
||||
#include "../../gcs_version_info.h"
|
||||
#include "versioninfo/version_info.h"
|
||||
#include "coreconstants.h"
|
||||
#include "icore.h"
|
||||
|
||||
@ -67,20 +67,19 @@ AuthorsDialog::AuthorsDialog(QWidget *parent)
|
||||
view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml"));
|
||||
|
||||
|
||||
|
||||
QString version = QLatin1String(GCS_VERSION_LONG);
|
||||
version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate);
|
||||
|
||||
QString ideRev;
|
||||
#ifdef GCS_REVISION
|
||||
//: This gets conditionally inserted as argument %8 into the description string.
|
||||
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(GCS_REVISION_STR).left(10));
|
||||
#endif
|
||||
|
||||
#ifdef UAVO_HASH
|
||||
// : This gets conditionally inserted as argument %8 into the description string.
|
||||
ideRev = tr("From revision %1<br/>").arg(VersionInfo::revision().left(10));
|
||||
|
||||
QString uavoHashStr;
|
||||
if (VersionInfo::uavoHash().length() > 15) {
|
||||
// : This gets conditionally inserted as argument %11 into the description string.
|
||||
QByteArray uavoHashArray;
|
||||
QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR);
|
||||
QString uavoHash = VersionInfo::uavoHash();
|
||||
uavoHash.chop(2);
|
||||
uavoHash.remove(0, 2);
|
||||
uavoHash = uavoHash.trimmed();
|
||||
@ -92,10 +91,11 @@ AuthorsDialog::AuthorsDialog(QWidget *parent)
|
||||
foreach(char i, uavoHashArray) {
|
||||
gcsUavoHashStr.append(QString::number(i, 16).right(2));
|
||||
}
|
||||
QString uavoHashStr = gcsUavoHashStr;
|
||||
#else
|
||||
QString uavoHashStr = "N/A";
|
||||
#endif
|
||||
uavoHashStr = gcsUavoHashStr;
|
||||
} else {
|
||||
uavoHashStr = "N/A";
|
||||
}
|
||||
|
||||
const QString description = tr(
|
||||
"<h3>OpenPilot Ground Control Station</h3>"
|
||||
"GCS Revision: <b>%1</b><br/>"
|
||||
@ -116,17 +116,16 @@ AuthorsDialog::AuthorsDialog(QWidget *parent)
|
||||
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
|
||||
"PARTICULAR PURPOSE.</small>"
|
||||
).arg(
|
||||
QString::fromLatin1(GCS_REVISION_STR).left(60), // %1
|
||||
VersionInfo::revision().left(60), // %1
|
||||
uavoHashStr, // %2
|
||||
QLatin1String(GCS_ORIGIN_STR), // $3
|
||||
VersionInfo::origin(), // $3
|
||||
QLatin1String(__DATE__), // %4
|
||||
QLatin1String(__TIME__), // %5
|
||||
QLatin1String(QT_VERSION_STR), // %6
|
||||
QString::number(QSysInfo::WordSize), // %7
|
||||
QLatin1String(GCS_AUTHOR), // %8
|
||||
QLatin1String(GCS_YEAR_STR) // %9
|
||||
VersionInfo::year() // %9
|
||||
);
|
||||
// Expose the version description to the QML doc
|
||||
view->rootContext()->setContextProperty("version", description);
|
||||
|
||||
}
|
||||
|
@ -44,31 +44,6 @@ namespace Constants {
|
||||
"." STRINGIFY(GCS_VERSION_RELEASE)
|
||||
|
||||
const char * const GCS_VERSION_LONG = GCS_VERSION;
|
||||
|
||||
#ifdef GCS_REVISION
|
||||
const char * const GCS_REVISION_STR = GCS_REVISION;
|
||||
#else
|
||||
const char * const GCS_REVISION_STR = "N/A";
|
||||
#endif
|
||||
|
||||
#ifdef GCS_YEAR
|
||||
const char * const GCS_YEAR_STR = GCS_YEAR;
|
||||
#else
|
||||
const char * const GCS_YEAR_STR = "2013";
|
||||
#endif
|
||||
|
||||
#ifdef GCS_ORIGIN
|
||||
const char * const GCS_ORIGIN_STR = GCS_ORIGIN;
|
||||
#else
|
||||
const char * const GCS_ORIGIN_STR = "unknown repository";
|
||||
#endif
|
||||
|
||||
#ifdef UAVO_HASH
|
||||
const char * const UAVOSHA1_STR = STRINGIFY(UAVO_HASH);
|
||||
#else
|
||||
const char * const UAVOSHA1_STR = "";
|
||||
#endif
|
||||
|
||||
const char * const GCS_AUTHOR = "The OpenPilot Project";
|
||||
const char * const GCS_HELP = "http://wiki.openpilot.org";
|
||||
|
||||
|
@ -11,6 +11,7 @@ QT += declarative \
|
||||
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../libs/utils/utils.pri)
|
||||
include(../../libs/versioninfo/versioninfo.pri)
|
||||
include(../../shared/scriptwrapper/scriptwrapper.pri)
|
||||
include(coreplugin_dependencies.pri)
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include "versiondialog.h"
|
||||
|
||||
#include "versioninfo/version_info.h"
|
||||
#include "coreconstants.h"
|
||||
#include "icore.h"
|
||||
|
||||
@ -59,27 +59,26 @@ VersionDialog::VersionDialog(QWidget *parent)
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
#ifdef UAVO_HASH
|
||||
QString uavoHashStr;
|
||||
if (VersionInfo::uavoHash().length() > 15) {
|
||||
// : This gets conditionally inserted as argument %11 into the description string.
|
||||
QByteArray uavoHashArray;
|
||||
QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR);
|
||||
QString uavoHash = VersionInfo::uavoHash();
|
||||
uavoHash.chop(2);
|
||||
uavoHash.remove(0, 2);
|
||||
uavoHash = uavoHash.trimmed();
|
||||
bool ok;
|
||||
foreach(QString str,uavoHash.split(","))
|
||||
{
|
||||
foreach(QString str, uavoHash.split(",")) {
|
||||
uavoHashArray.append(str.toInt(&ok, 16));
|
||||
}
|
||||
QString gcsUavoHashStr;
|
||||
foreach(char i, uavoHashArray)
|
||||
{
|
||||
foreach(char i, uavoHashArray) {
|
||||
gcsUavoHashStr.append(QString::number(i, 16).right(2));
|
||||
}
|
||||
QString uavoHashStr = gcsUavoHashStr;
|
||||
#else
|
||||
QString uavoHashStr = "N/A";
|
||||
#endif
|
||||
uavoHashStr = gcsUavoHashStr;
|
||||
} else {
|
||||
uavoHashStr = "N/A";
|
||||
}
|
||||
|
||||
const QString description = tr(
|
||||
"<h3>OpenPilot Ground Control Station</h3>"
|
||||
@ -101,15 +100,15 @@ VersionDialog::VersionDialog(QWidget *parent)
|
||||
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
|
||||
"PARTICULAR PURPOSE.</small>"
|
||||
).arg(
|
||||
QString::fromLatin1(GCS_REVISION_STR).left(60), // %1
|
||||
VersionInfo::revision().left(60), // %1
|
||||
uavoHashStr, // %2
|
||||
QLatin1String(GCS_ORIGIN_STR), // $3
|
||||
VersionInfo::origin(), // $3
|
||||
QLatin1String(__DATE__), // %4
|
||||
QLatin1String(__TIME__), // %5
|
||||
QLatin1String(QT_VERSION_STR), // %6
|
||||
QString::number(QSysInfo::WordSize), // %7
|
||||
QLatin1String(GCS_AUTHOR), // %8
|
||||
QLatin1String(GCS_YEAR_STR) // %9
|
||||
VersionInfo::year() // %9
|
||||
);
|
||||
|
||||
QLabel *copyRightLabel = new QLabel(description);
|
||||
|
@ -29,8 +29,6 @@
|
||||
#ifndef VERSIONDIALOG_H
|
||||
#define VERSIONDIALOG_H
|
||||
|
||||
#include "../../gcs_version_info.h"
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
namespace Core {
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include "uavobjectutil/uavobjectutilmanager.h"
|
||||
#include "uavsettingsimportexport_global.h"
|
||||
#include "../../gcs_version_info.h"
|
||||
#include "uavsettingsimportexportfactory.h"
|
||||
|
||||
class UAVSETTINGSIMPORTEXPORT_EXPORT UAVSettingsImportExportPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -6,6 +6,7 @@ TARGET = UAVSettingsImportExport
|
||||
DEFINES += UAVSETTINGSIMPORTEXPORT_LIBRARY
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(uavsettingsimportexport_dependencies.pri)
|
||||
include(../../libs/versioninfo/versioninfo.pri)
|
||||
|
||||
HEADERS += uavsettingsimportexport.h \
|
||||
importsummary.h \
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <QDebug>
|
||||
#include <QCheckBox>
|
||||
#include "importsummary.h"
|
||||
#include "versioninfo/version_info.h"
|
||||
|
||||
// for menu item
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@ -244,7 +245,7 @@ QString UAVSettingsImportExportFactory::createXMLDocument(const enum storedData
|
||||
fw.setAttribute("tag", board.gitTag);
|
||||
versionInfo.appendChild(fw);
|
||||
|
||||
QString gcsRevision = QString::fromLatin1(Core::Constants::GCS_REVISION_STR);
|
||||
QString gcsRevision = VersionInfo::revision();
|
||||
QString gcsGitDate = gcsRevision.mid(gcsRevision.indexOf(" ") + 1, 14);
|
||||
QString gcsGitHash = gcsRevision.mid(gcsRevision.indexOf(":") + 1, 8);
|
||||
QString gcsGitTag = gcsRevision.left(gcsRevision.indexOf(":"));
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define UAVSETTINGSIMPORTEXPORTFACTORY_H
|
||||
#include "uavsettingsimportexport_global.h"
|
||||
#include "uavobjectutil/uavobjectutilmanager.h"
|
||||
#include "../../gcs_version_info.h"
|
||||
|
||||
class UAVSETTINGSIMPORTEXPORT_EXPORT UAVSettingsImportExportFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -3,6 +3,7 @@ TARGET = Uploader
|
||||
DEFINES += UPLOADER_LIBRARY
|
||||
QT += svg
|
||||
include(uploader_dependencies.pri)
|
||||
include(../../libs/versioninfo/versioninfo.pri)
|
||||
INCLUDEPATH += ../../libs/qextserialport/src
|
||||
macx {
|
||||
QMAKE_CXXFLAGS += -fpermissive
|
||||
|
@ -25,7 +25,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "uploadergadgetwidget.h"
|
||||
#include "../../gcs_version_info.h"
|
||||
#include "versioninfo/version_info.h"
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <QDebug>
|
||||
#include "flightstatus.h"
|
||||
@ -907,7 +907,7 @@ void UploaderGadgetWidget::versionMatchCheck()
|
||||
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||
deviceDescriptorStruct boardDescription = utilMngr->getBoardDescriptionStruct();
|
||||
QByteArray uavoHashArray;
|
||||
QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR);
|
||||
QString uavoHash = VersionInfo::uavoHash();
|
||||
uavoHash.chop(2);
|
||||
uavoHash.remove(0,2);
|
||||
uavoHash=uavoHash.trimmed();
|
||||
@ -920,7 +920,7 @@ void UploaderGadgetWidget::versionMatchCheck()
|
||||
QByteArray fwVersion=boardDescription.uavoHash;
|
||||
if (fwVersion != uavoHashArray) {
|
||||
|
||||
QString gcsDescription = QString::fromLatin1(Core::Constants::GCS_REVISION_STR);
|
||||
QString gcsDescription = VersionInfo::revision();
|
||||
QString gcsGitHash = gcsDescription.mid(gcsDescription.indexOf(":")+1, 8);
|
||||
gcsGitHash.remove( QRegExp("^[0]*") );
|
||||
QString gcsGitDate = gcsDescription.mid(gcsDescription.indexOf(" ")+1, 14);
|
||||
|
Loading…
Reference in New Issue
Block a user