diff --git a/ground/openpilotgcs/src/app/app.pro b/ground/openpilotgcs/src/app/app.pro index 9d5c1446b..2eb1d8dc7 100644 --- a/ground/openpilotgcs/src/app/app.pro +++ b/ground/openpilotgcs/src/app/app.pro @@ -1,6 +1,5 @@ include(../../openpilotgcs.pri) include(../shared/qtsingleapplication/qtsingleapplication.pri) -include(gcsversioninfo.pri) TEMPLATE = app TARGET = $$GCS_APP_TARGET @@ -8,8 +7,10 @@ DESTDIR = $$GCS_APP_PATH QT += xml SOURCES += main.cpp \ gcssplashscreen.cpp + include(../rpath.pri) include(../libs/utils/utils.pri) +include(../libs/version_info/version_info.pri) LIBS *= -l$$qtLibraryName(ExtensionSystem) -l$$qtLibraryName(Aggregation) diff --git a/ground/openpilotgcs/src/app/gcssplashscreen.cpp b/ground/openpilotgcs/src/app/gcssplashscreen.cpp index 568f2c683..e522edad9 100644 --- a/ground/openpilotgcs/src/app/gcssplashscreen.cpp +++ b/ground/openpilotgcs/src/app/gcssplashscreen.cpp @@ -26,6 +26,7 @@ */ #include "gcssplashscreen.h" +#include "version_info/version_info.h" #include 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); } diff --git a/ground/openpilotgcs/src/app/gcssplashscreen.h b/ground/openpilotgcs/src/app/gcssplashscreen.h index 6c04e2367..dd26077b1 100644 --- a/ground/openpilotgcs/src/app/gcssplashscreen.h +++ b/ground/openpilotgcs/src/app/gcssplashscreen.h @@ -33,8 +33,6 @@ #include #include -#include "../gcs_version_info.h" - class GCSSplashScreen : public QSplashScreen { Q_OBJECT diff --git a/ground/openpilotgcs/src/gcs_version_info.h b/ground/openpilotgcs/src/gcs_version_info.h deleted file mode 100644 index 4f4bc2261..000000000 --- a/ground/openpilotgcs/src/gcs_version_info.h +++ /dev/null @@ -1,6 +0,0 @@ -// -// This file includes autogenerated version info header used by other plugins. -// The autogenerated file is build by app/gcsversioninfo.pri. -// - -#include "../../../build/openpilotgcs-synthetics/gcs_version_info.h" diff --git a/ground/openpilotgcs/src/libs/libs.pro b/ground/openpilotgcs/src/libs/libs.pro index 07227ff14..e741d755f 100644 --- a/ground/openpilotgcs/src/libs/libs.pro +++ b/ground/openpilotgcs/src/libs/libs.pro @@ -2,6 +2,7 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS = \ + version_info \ qscispinbox\ qtconcurrent \ aggregation \ diff --git a/ground/openpilotgcs/src/libs/version_info/version_info.cpp b/ground/openpilotgcs/src/libs/version_info/version_info.cpp new file mode 100644 index 000000000..97e4dfbf6 --- /dev/null +++ b/ground/openpilotgcs/src/libs/version_info/version_info.cpp @@ -0,0 +1,27 @@ +/** + ****************************************************************************** + * @file version_info.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013. + * @addtogroup VersionInfo + * @{ + * @brief This file includes autogenerated version info data file. + * The autogenerated file is build by app/version_info.pri. + *****************************************************************************/ +/* + * 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 "version_info.h" +#include "../../../../build/openpilotgcs-synthetics/version_info.cpp" diff --git a/ground/openpilotgcs/src/libs/version_info/version_info.cpp.template b/ground/openpilotgcs/src/libs/version_info/version_info.cpp.template new file mode 100644 index 000000000..214ad7b3b --- /dev/null +++ b/ground/openpilotgcs/src/libs/version_info/version_info.cpp.template @@ -0,0 +1,48 @@ +/** + ****************************************************************************** + * @file version_info.cpp.template + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013. + * @addtogroup VersionInfo + * @{ + * @brief The template file used to generate the real source file called + * build/openpilotgcs-synthetics/version_info.cpp + *****************************************************************************/ +/* + * 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 + */ + +VersionInfo::VersionInfo() +{ +} + +QString VersionInfo::revision() +{ + return "${REVISION}"; +} + +QString VersionInfo::year() +{ + return "${YEAR}"; +} + +QString VersionInfo::origin() +{ + return "${ORIGIN}"; +} + +QString VersionInfo::uavoHash() +{ + return "{ ${UAVOSHA1} }"; +} diff --git a/make/templates/gcs_version_info.h.template b/ground/openpilotgcs/src/libs/version_info/version_info.h similarity index 67% rename from make/templates/gcs_version_info.h.template rename to ground/openpilotgcs/src/libs/version_info/version_info.h index 04d45d580..b517e7307 100644 --- a/make/templates/gcs_version_info.h.template +++ b/ground/openpilotgcs/src/libs/version_info/version_info.h @@ -1,13 +1,10 @@ /** ****************************************************************************** - * - * @file ${OUTFILENAME} - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011. - * @brief GCS revision info file autogenerated using template - * ${TEMPLATE} - * - * @see The GNU Public License (GPL) Version 3 - * + * @file version_info.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013. + * @addtogroup VersionInfo + * @{ + * @brief GCS version info class header. *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -25,16 +22,19 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _GCSVERSIONINFO_H -#define _GCSVERSIONINFO_H +#ifndef VERSION_INFO_H +#define VERSION_INFO_H -#define GCS_REVISION "${REVISION}" -#define GCS_YEAR "${YEAR}" -#define GCS_ORIGIN "${ORIGIN}" -#define UAVO_HASH "{ ${UAVOSHA1} }" +#include -#endif // _GCSVERSIONINFO_H +class VersionInfo { +public: + static QString revision(); + static QString year(); + static QString origin(); + static QString uavoHash(); +private: + VersionInfo(); +}; -/** - * @} - */ +#endif // VERSION_INFO_H diff --git a/ground/openpilotgcs/src/libs/version_info/version_info.pri b/ground/openpilotgcs/src/libs/version_info/version_info.pri new file mode 100644 index 000000000..332f07497 --- /dev/null +++ b/ground/openpilotgcs/src/libs/version_info/version_info.pri @@ -0,0 +1 @@ +LIBS *= -l$$qtLibraryName(VersionInfo) diff --git a/ground/openpilotgcs/src/app/gcsversioninfo.pri b/ground/openpilotgcs/src/libs/version_info/version_info.pro similarity index 80% rename from ground/openpilotgcs/src/app/gcsversioninfo.pri rename to ground/openpilotgcs/src/libs/version_info/version_info.pro index bec785f58..a00cb8424 100644 --- a/ground/openpilotgcs/src/app/gcsversioninfo.pri +++ b/ground/openpilotgcs/src/libs/version_info/version_info.pro @@ -1,5 +1,13 @@ +TEMPLATE = lib +TARGET = VersionInfo + +include(../../openpilotgcslibrary.pri) + +HEADERS = version_info.h +SOURCES = version_info.cpp + # -# This qmake file generates a header with the GCS version info string. +# This qmake code generates VersionInfo class implementation. # # This is a bit tricky since the script should be run always and before # the other dependencies evaluation. @@ -32,20 +40,20 @@ PYTHON_DIR = python-2.7.4 # Define other variables VERSION_INFO_DIR = $$GCS_BUILD_TREE/../openpilotgcs-synthetics - VERSION_INFO_HEADER = $$VERSION_INFO_DIR/gcs_version_info.h VERSION_INFO_SCRIPT = $$ROOT_DIR/make/scripts/version-info.py - VERSION_INFO_TEMPLATE = $$ROOT_DIR/make/templates/gcs_version_info.h.template VERSION_INFO_COMMAND = $$PYTHON \"$$VERSION_INFO_SCRIPT\" + VERSION_INFO_TEMPLATE = $$GCS_SOURCE_TREE/src/libs/version_info/version_info.cpp.template + VERSION_INFO_FILE = $$VERSION_INFO_DIR/version_info.cpp UAVO_DEF_PATH = $$ROOT_DIR/shared/uavobjectdefinition - # Create custom version_info target which generates a header - version_info.target = $$VERSION_INFO_HEADER + # Create custom version_info target which generates a real file + version_info.target = $$VERSION_INFO_FILE version_info.commands = -$(MKDIR) $$targetPath($$VERSION_INFO_DIR) $$addNewline() version_info.commands += $$VERSION_INFO_COMMAND \ --path=\"$$GCS_SOURCE_TREE\" \ --template=\"$$VERSION_INFO_TEMPLATE\" \ --uavodir=\"$$UAVO_DEF_PATH\" \ - --outfile=\"$$VERSION_INFO_HEADER\" + --outfile=\"$$VERSION_INFO_FILE\" version_info.depends = FORCE QMAKE_EXTRA_TARGETS += version_info diff --git a/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp index 8bf76b4ea..847fb5369 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/authorsdialog.cpp @@ -11,24 +11,24 @@ * @brief The Core GCS plugin *****************************************************************************/ /* - * 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 + * 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 + * + * 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., + * + * 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 "authorsdialog.h" -#include "../../gcs_version_info.h" +#include "version_info/version_info.h" #include "coreconstants.h" #include "icore.h" @@ -43,7 +43,7 @@ #include #include #include - + #include #include #include @@ -62,71 +62,70 @@ AuthorsDialog::AuthorsDialog(QWidget *parent) setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); setWindowTitle(tr("About OpenPilot")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - // This loads a QML doc containing a Tabbed view - QDeclarativeView *view = new QDeclarativeView(this); - view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml")); + // This loads a QML doc containing a Tabbed view + QDeclarativeView *view = new QDeclarativeView(this); + view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml")); + QString version = QLatin1String(GCS_VERSION_LONG); + version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate); - 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
").arg(QString::fromLatin1(GCS_REVISION_STR).left(10)); -#endif + QString ideRev; - #ifdef UAVO_HASH - //: This gets conditionally inserted as argument %11 into the description string. - QByteArray uavoHashArray; - QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR); - uavoHash.chop(2); - uavoHash.remove(0, 2); - uavoHash = uavoHash.trimmed(); - bool ok; - foreach(QString str, uavoHash.split(",")) { - uavoHashArray.append(str.toInt(&ok, 16)); - } - QString gcsUavoHashStr; - foreach(char i, uavoHashArray) { - gcsUavoHashStr.append(QString::number(i, 16).right(2)); - } - QString uavoHashStr = gcsUavoHashStr; -#else - QString uavoHashStr = "N/A"; -#endif - const QString description = tr( - "

OpenPilot Ground Control Station

" - "GCS Revision: %1
" - "UAVO Hash: %2
" - "
" - "Built from %3
" - "Built on %4 at %5
" - "Based on Qt %6 (%7 bit)
" - "
" - "© %8, 2010-%9. All rights reserved.
" - "
" - "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.
" - "
" - "The program is provided AS IS with NO WARRANTY OF ANY KIND, " - "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " - "PARTICULAR PURPOSE.
" - ).arg( - QString::fromLatin1(GCS_REVISION_STR).left(60), // %1 - uavoHashStr, // %2 - QLatin1String(GCS_ORIGIN_STR), // $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 - ); - // Expose the version description to the QML doc - view->rootContext()->setContextProperty("version", description); - + // : This gets conditionally inserted as argument %8 into the description string. + ideRev = tr("From revision %1
").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 = VersionInfo::uavoHash(); + uavoHash.chop(2); + uavoHash.remove(0, 2); + uavoHash = uavoHash.trimmed(); + bool ok; + foreach(QString str, uavoHash.split(",")) { + uavoHashArray.append(str.toInt(&ok, 16)); + } + QString gcsUavoHashStr; + foreach(char i, uavoHashArray) { + gcsUavoHashStr.append(QString::number(i, 16).right(2)); + } + uavoHashStr = gcsUavoHashStr; + } else { + uavoHashStr = "N/A"; + } + + const QString description = tr( + "

OpenPilot Ground Control Station

" + "GCS Revision: %1
" + "UAVO Hash: %2
" + "
" + "Built from %3
" + "Built on %4 at %5
" + "Based on Qt %6 (%7 bit)
" + "
" + "© %8, 2010-%9. All rights reserved.
" + "
" + "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.
" + "
" + "The program is provided AS IS with NO WARRANTY OF ANY KIND, " + "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " + "PARTICULAR PURPOSE.
" + ).arg( + VersionInfo::revision().left(60), // %1 + uavoHashStr, // %2 + VersionInfo::origin(), // $3 + QLatin1String(__DATE__), // %4 + QLatin1String(__TIME__), // %5 + QLatin1String(QT_VERSION_STR), // %6 + QString::number(QSysInfo::WordSize), // %7 + QLatin1String(GCS_AUTHOR), // %8 + VersionInfo::year() // %9 + ); + // Expose the version description to the QML doc + view->rootContext()->setContextProperty("version", description); } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/coreconstants.h b/ground/openpilotgcs/src/plugins/coreplugin/coreconstants.h index 6373fc28b..3f73cc65c 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/coreconstants.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/coreconstants.h @@ -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"; diff --git a/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro b/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro index 78f3c9f6b..3bdbaacd5 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro +++ b/ground/openpilotgcs/src/plugins/coreplugin/coreplugin.pro @@ -11,6 +11,7 @@ QT += declarative \ include(../../openpilotgcsplugin.pri) include(../../libs/utils/utils.pri) +include(../../libs/version_info/version_info.pri) include(../../shared/scriptwrapper/scriptwrapper.pri) include(coreplugin_dependencies.pri) diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp index 01cf29feb..8fb160ef3 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp @@ -11,23 +11,23 @@ * @brief The Core GCS plugin *****************************************************************************/ /* - * 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 + * 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 + * + * 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., + * + * 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 "versiondialog.h" - +#include "version_info/version_info.h" #include "coreconstants.h" #include "icore.h" @@ -59,29 +59,28 @@ VersionDialog::VersionDialog(QWidget *parent) QGridLayout *layout = new QGridLayout(this); layout->setSizeConstraint(QLayout::SetFixedSize); -#ifdef UAVO_HASH - //: This gets conditionally inserted as argument %11 into the description string. - QByteArray uavoHashArray; - QString uavoHash = QString::fromLatin1(Core::Constants::UAVOSHA1_STR); - uavoHash.chop(2); - uavoHash.remove(0,2); - uavoHash=uavoHash.trimmed(); - bool ok; - foreach(QString str,uavoHash.split(",")) - { - uavoHashArray.append(str.toInt(&ok,16)); - } - QString gcsUavoHashStr; - foreach(char i, uavoHashArray) - { - gcsUavoHashStr.append(QString::number(i,16).right(2)); - } - QString uavoHashStr = gcsUavoHashStr; -#else - QString uavoHashStr = "N/A"; -#endif + QString uavoHashStr; + if (VersionInfo::uavoHash().length() > 15) { + // : This gets conditionally inserted as argument %11 into the description string. + QByteArray uavoHashArray; + QString uavoHash = VersionInfo::uavoHash(); + uavoHash.chop(2); + uavoHash.remove(0, 2); + uavoHash = uavoHash.trimmed(); + bool ok; + foreach(QString str, uavoHash.split(",")) { + uavoHashArray.append(str.toInt(&ok, 16)); + } + QString gcsUavoHashStr; + foreach(char i, uavoHashArray) { + gcsUavoHashStr.append(QString::number(i, 16).right(2)); + } + uavoHashStr = gcsUavoHashStr; + } else { + uavoHashStr = "N/A"; + } - const QString description = tr( + const QString description = tr( "

OpenPilot Ground Control Station

" "GCS Revision: %1
" "UAVO Hash: %2
" @@ -100,17 +99,17 @@ VersionDialog::VersionDialog(QWidget *parent) "The program is provided AS IS with NO WARRANTY OF ANY KIND, " "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " "PARTICULAR PURPOSE." - ).arg( - QString::fromLatin1(GCS_REVISION_STR).left(60), // %1 - uavoHashStr, // %2 - QLatin1String(GCS_ORIGIN_STR), // $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 - ); + ).arg( + VersionInfo::revision().left(60), // %1 + uavoHashStr, // %2 + VersionInfo::origin(), // $3 + QLatin1String(__DATE__), // %4 + QLatin1String(__TIME__), // %5 + QLatin1String(QT_VERSION_STR), // %6 + QString::number(QSysInfo::WordSize), // %7 + QLatin1String(GCS_AUTHOR), // %8 + VersionInfo::year() // %9 + ); QLabel *copyRightLabel = new QLabel(description); copyRightLabel->setWordWrap(true); @@ -118,14 +117,14 @@ VersionDialog::VersionDialog(QWidget *parent) copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); - QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); + QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); QTC_ASSERT(closeButton, /**/); buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole)); - connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); QLabel *logoLabel = new QLabel; logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/openpilot_logo_128.png"))); - layout->addWidget(logoLabel , 0, 0, 1, 1); + layout->addWidget(logoLabel, 0, 0, 1, 1); layout->addWidget(copyRightLabel, 0, 1, 4, 4); layout->addWidget(buttonBox, 4, 0, 1, 5); } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h index fa5a8a89c..cc8294e66 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h @@ -29,8 +29,6 @@ #ifndef VERSIONDIALOG_H #define VERSIONDIALOG_H -#include "../../gcs_version_info.h" - #include namespace Core { diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h index 3cc77a9fc..da5dcec71 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h @@ -30,8 +30,8 @@ #include #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 diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro index aa8abccf1..d03f46ccf 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro @@ -6,6 +6,7 @@ TARGET = UAVSettingsImportExport DEFINES += UAVSETTINGSIMPORTEXPORT_LIBRARY include(../../openpilotgcsplugin.pri) include(uavsettingsimportexport_dependencies.pri) +include(../../libs/version_info/version_info.pri) HEADERS += uavsettingsimportexport.h \ importsummary.h \ diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp index 01557a4a1..cc29a5726 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp @@ -31,6 +31,7 @@ #include #include #include "importsummary.h" +#include "version_info/version_info.h" // for menu item #include @@ -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(":")); diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.h b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.h index aa07d62e1..d706e8b55 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.h +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.h @@ -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 diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.pro b/ground/openpilotgcs/src/plugins/uploader/uploader.pro index 6a1c17407..6fc9bc488 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.pro +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.pro @@ -3,6 +3,7 @@ TARGET = Uploader DEFINES += UPLOADER_LIBRARY QT += svg include(uploader_dependencies.pri) +include(../../libs/version_info/version_info.pri) INCLUDEPATH += ../../libs/qextserialport/src macx { QMAKE_CXXFLAGS += -fpermissive diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index aeab03d8f..a682fe288 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -25,7 +25,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "uploadergadgetwidget.h" -#include "../../gcs_version_info.h" +#include "version_info/version_info.h" #include #include #include "flightstatus.h" @@ -907,7 +907,7 @@ void UploaderGadgetWidget::versionMatchCheck() UAVObjectUtilManager *utilMngr = pm->getObject(); 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);