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 ) 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 for stream support
check_cxx_source_compiles( check_cxx_source_compiles(

@ -1,4 +1,5 @@
#define VERSION "@VERSION@" #define VERSION "@VERSION@"
#define GIT_HASH "@GIT_HASH@"
// application share location // application share location
#define APP_SHARE_PATH "@SHARE_INSTALL_PREFIX@/universal-indent-gui-tqt" #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(); //---- TQString versionString = _dialogForm->versionTextBrowser->toHtml();
//---- versionString = //---- versionString =
//---- versionString.arg(PROGRAM_VERSION_STRING).arg(UiGuiVersion::getBuildRevision()).arg( //---- versionString.arg(PROGRAM_VERSION_STRING);
//---- UiGuiVersion::getBuildDate());
//---- _dialogForm->versionTextBrowser->setHtml(versionString); //---- _dialogForm->versionTextBrowser->setHtml(versionString);
//---- //----
//---- _dialogForm->creditsTextBrowser->setHtml("<html><head></head><body>" //---- _dialogForm->creditsTextBrowser->setHtml("<html><head></head><body>"
@ -115,8 +114,7 @@ void AboutDialog::changeEvent(TQEvent *event)
//---- //----
//---- TQString versionString = _dialogForm->versionTextBrowser->toHtml(); //---- TQString versionString = _dialogForm->versionTextBrowser->toHtml();
//---- versionString = //---- versionString =
//---- versionString.arg(PROGRAM_VERSION_STRING).arg(UiGuiVersion::getBuildRevision()).arg( //---- versionString.arg(PROGRAM_VERSION_STRING);
//---- UiGuiVersion::getBuildDate());
//---- _dialogForm->versionTextBrowser->setHtml(versionString); //---- _dialogForm->versionTextBrowser->setHtml(versionString);
//---- } //---- }
//---- else //---- else

@ -7,9 +7,9 @@
################################################# #################################################
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
) )
@ -26,31 +26,30 @@ link_directories(
set( target universal-indent-gui-tqt ) set( target universal-indent-gui-tqt )
set( ${target}_SRCS set( ${target}_SRCS
# completed # completed
MainWindowBase.ui MainWindowBase.ui
ToolBarWidget.ui ToolBarWidget.ui
IndentHandler.cpp IndentHandler.cpp
SettingsPaths.cpp SettingsPaths.cpp
TemplateBatchScript.cpp TemplateBatchScript.cpp
UiGuiErrorMessage.cpp UiGuiErrorMessage.cpp
UiGuiHighlighter.cpp UiGuiHighlighter.cpp
UiGuiIniFileParser.cpp UiGuiIniFileParser.cpp
UiGuiVersion.cpp
# ongoing
# ongoing AboutDialogBase.ui
AboutDialogBase.ui UiGuiSettingsDialogBase.ui
UiGuiSettingsDialogBase.ui
AboutDialog.cpp
AboutDialog.cpp MainWindow.cpp
MainWindow.cpp main.cpp
main.cpp UiGuiSettings.cpp
UiGuiSettings.cpp UiGuiSettingsDialog.cpp
UiGuiSettingsDialog.cpp
) )
tde_add_executable( ${target} AUTOMOC tde_add_executable( ${target} AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
LINK ${TQT_LIBRARIES} ${TQSCINTILLA_LIBRARIES} LINK ${TQT_LIBRARIES} ${TQSCINTILLA_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR} DESTINATION ${BIN_INSTALL_DIR}
) )

@ -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 #ifndef UIGUIVERSION_H
#define 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 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-" GIT_HASH
#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();
}
#endif #endif

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

@ -99,7 +99,7 @@ namespace TCLAP
std::string progName = _cmd.getProgramName(); std::string progName = _cmd.getProgramName();
std::string version = _cmd.getVersion(); 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) inline void StdOutput::usage(CmdLineInterface &_cmd)

Loading…
Cancel
Save