Add git hash to program version

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 1 year ago
parent c0b1f3384c
commit d54efa8cb8
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -25,6 +25,14 @@ if( WITH_GCC_VISIBILITY )
endif( WITH_GCC_VISIBILITY )
##### get commit hash information
execute_process(
COMMAND git describe --abbrev=8 --dirty --always
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
##### check for stream support
check_cxx_source_compiles(

@ -1,4 +1,5 @@
#define VERSION "@VERSION@"
#define GIT_HASH "@GIT_HASH@"
// application share location
#define APP_SHARE_PATH "@SHARE_INSTALL_PREFIX@/universal-indent-gui-tqt"

@ -52,8 +52,7 @@ AboutDialog::AboutDialog(TQWidget *parent, WFlags flags) :
//----
//---- TQString versionString = _dialogForm->versionTextBrowser->toHtml();
//---- versionString =
//---- versionString.arg(PROGRAM_VERSION_STRING).arg(UiGuiVersion::getBuildRevision()).arg(
//---- UiGuiVersion::getBuildDate());
//---- versionString.arg(PROGRAM_VERSION_STRING);
//---- _dialogForm->versionTextBrowser->setHtml(versionString);
//----
//---- _dialogForm->creditsTextBrowser->setHtml("<html><head></head><body>"
@ -115,8 +114,7 @@ void AboutDialog::changeEvent(TQEvent *event)
//----
//---- TQString versionString = _dialogForm->versionTextBrowser->toHtml();
//---- versionString =
//---- versionString.arg(PROGRAM_VERSION_STRING).arg(UiGuiVersion::getBuildRevision()).arg(
//---- UiGuiVersion::getBuildDate());
//---- versionString.arg(PROGRAM_VERSION_STRING);
//---- _dialogForm->versionTextBrowser->setHtml(versionString);
//---- }
//---- else

@ -36,7 +36,6 @@ set( ${target}_SRCS
UiGuiErrorMessage.cpp
UiGuiHighlighter.cpp
UiGuiIniFileParser.cpp
UiGuiVersion.cpp
# ongoing
AboutDialogBase.ui

@ -1,68 +0,0 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* 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 in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiVersion.h"
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqdatetime.h>
namespace UiGuiVersion
{
/*!
\brief Returns the build date as a localized string, e.g. "9. Februar 2009". If
there was some kind of error, the returned string is empty.
*/
TQString getBuildDate()
{
TQStringList monthNames;
monthNames << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"
<< "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
TQString buildDateString = "";
// __DATE__ returns a string like "Feb 4 2009"
TQStringList buildDateStringList = TQStringList::split(' ', TQString(__DATE__).simplifyWhiteSpace());
if (buildDateStringList.count() == 3)
{
TQDate buildDate(buildDateStringList.last().toInt(),
monthNames.findIndex(buildDateStringList.first()) + 1,
buildDateStringList.at(1)->toInt());
buildDateString = buildDate.toString("d. MMMM yyyy");
}
return buildDateString;
}
/*!
\brief Returns the revision number, that the current build is based on, as string. If
there was some kind of error, the returned string is empty.
*/
TQString getBuildRevision()
{
TQString buildRevision = "";
TQStringList buildRevisionStringList = TQStringList::split(' ', TQString(PROGRAM_REVISION).simplifyWhiteSpace());
if (buildRevisionStringList.count() == 3)
{
buildRevision = *buildRevisionStringList.at(1); // PROGRAM_REVISION is eg "$Revision: 907 $"
}
return buildRevision;
}
}

@ -20,19 +20,9 @@
#ifndef UIGUIVERSION_H
#define UIGUIVERSION_H
class TQString;
#include "config.h"
// Define the version number here. Update this as the last file before a release.
#define PROGRAM_VERSION 1.2.0
#define PROGRAM_VERSION_STRING "1.2.0"
#define RESOURCE_VERSION 1, 2, 0, 0
#define RESOURCE_VERSION_STRING "1,2,0,0\0"
#define PROGRAM_REVISION "$Revision: 1070 $"
namespace UiGuiVersion
{
TQString getBuildDate();
TQString getBuildRevision();
}
#define PROGRAM_VERSION_STRING "1.2.0-" GIT_HASH
#endif

@ -65,8 +65,8 @@ int main(int argc, char *argv[])
{
// Define the command line object.
TCLAP::CmdLine cmd("If -p and -s are set, -p will be used.\n"
"Giving no parameters starts full gui without server.", ' ',
"UiGUI version " PROGRAM_VERSION_STRING " " PROGRAM_REVISION);
"Giving no parameters starts full gui without server.",
' ', PROGRAM_VERSION_STRING);
cmd.setExceptionHandling(false);
// Define a value argument and add it to the command line.
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
// -- TSLogger::getInstance(verboseLevel);
// -- #endif
// -- qInstallMsgHandler(TSLogger::messageHandler);
// -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii());
// -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).toAscii());
// --
// Start normal with full gui and without server.
if (!startAsPlugin && !startAsServer) {

@ -99,7 +99,7 @@ namespace TCLAP
std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion();
std::cout << std::endl << progName << " version: " << version << std::endl << std::endl;
std::cout << std::endl << progName << " version " << version << std::endl << std::endl;
}
inline void StdOutput::usage(CmdLineInterface &_cmd)

Loading…
Cancel
Save