diff --git a/Jamulus.pro b/Jamulus.pro index 3d1d5acd45..41a43e48d6 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -15,7 +15,7 @@ contains(CONFIG, "noupcasename") { # allow detailed version info for intermediate builds (#475) contains(VERSION, .*dev.*) { exists(".git/config") { - GIT_DESCRIPTION=$$system(git describe --match=xxxxxxxxxxxxxxxxxxxx --always --abbrev --dirty) # the match should never match + GIT_DESCRIPTION=$$system(git describe --match=xxxxxxxxxxxxxxxxxxxx --always --abbrev --dirty):$$system(git show -s "--pretty=format:%ct") # commit_id(-dirty):seconds_since_epoch VERSION = "$$VERSION"-$$GIT_DESCRIPTION message("building version \"$$VERSION\" (intermediate in git repository)") } else { diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 1c4404ea2b..6e3b28fb9d 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -33,7 +33,7 @@ static QString mapVersionStr ( const QString& versionStr ) QString x = ">"; // default suffix is later (git, dev, nightly, etc) // Regex for SemVer: major.minor.patch-suffix - QRegularExpression semVerRegex ( R"(^(\d+)\.(\d+)\.(\d+)-?(.*)$)" ); + QRegularExpression semVerRegex ( R"(^(\d+)\.(\d+)\.(\d+)-?(.*):?(.*)$)" ); QRegularExpressionMatch match = semVerRegex.match ( versionStr ); if ( !match.hasMatch() ) @@ -45,6 +45,7 @@ static QString mapVersionStr ( const QString& versionStr ) int minor = match.captured ( 2 ).toInt(); int patch = match.captured ( 3 ).toInt(); QString suffix = match.captured ( 4 ); // may be empty + QString tstamp = match.captured ( 5 ); // may be empty if ( suffix.isEmpty() ) { @@ -66,7 +67,7 @@ static QString mapVersionStr ( const QString& versionStr ) .arg ( minor, 3, 10, QLatin1Char ( '0' ) ) .arg ( patch, 3, 10, QLatin1Char ( '0' ) ) .arg ( x ) - .arg ( suffix ); + .arg ( tstamp.isEmpty() ? suffix : tstamp ); return key; } @@ -184,13 +185,13 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR lvwServers->setColumnWidth ( LVC_NAME, 200 ); lvwServers->setColumnWidth ( LVC_PING, 130 ); lvwServers->setColumnWidth ( LVC_CLIENTS, 100 ); - lvwServers->setColumnWidth ( LVC_VERSION, 110 ); + lvwServers->setColumnWidth ( LVC_VERSION, 150 ); #else lvwServers->setColumnWidth ( LVC_NAME, 180 ); lvwServers->setColumnWidth ( LVC_PING, 75 ); lvwServers->setColumnWidth ( LVC_CLIENTS, 70 ); lvwServers->setColumnWidth ( LVC_LOCATION, 220 ); - lvwServers->setColumnWidth ( LVC_VERSION, 95 ); + lvwServers->setColumnWidth ( LVC_VERSION, 135 ); #endif lvwServers->clear(); @@ -1024,7 +1025,7 @@ void CConnectDlg::SetServerVersionResult ( const CHostAddress& InetAddr, const Q if ( pCurListViewItem ) { - pCurListViewItem->setText ( LVC_VERSION, strVersion ); + pCurListViewItem->setText ( LVC_VERSION, GetDisplayVersion ( strVersion ) ); // and store sortable mapped version number pCurListViewItem->setData ( LVC_VERSION, Qt::UserRole, mapVersionStr ( strVersion ) ); diff --git a/src/global.h b/src/global.h index 55d2b57683..6e6717e58e 100644 --- a/src/global.h +++ b/src/global.h @@ -73,7 +73,7 @@ LED bar: lbr // version and application name (use version from qt prject file) #undef VERSION -#define VERSION APP_VERSION +#define VERSION GetDisplayVersion ( APP_VERSION ) #define APP_NAME "Jamulus" // Windows registry key name of auto run entry for the server @@ -374,3 +374,5 @@ bool GetNumericArgument ( int argc, double rRangeStart, double rRangeStop, double& rValue ); + +inline QString GetDisplayVersion ( QString str ) { return str.contains ( ':' ) ? str.mid ( 0, str.lastIndexOf ( ':' ) ) : str; } diff --git a/src/protocol.cpp b/src/protocol.cpp index db012c0c32..2d080361cc 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1573,10 +1573,10 @@ void CProtocol::CreateVersionAndOSMes() int iPos = 0; // init position pointer // get the version number string - const QString strVerion = VERSION; + const QString strVersion = APP_VERSION; // convert version string to utf-8 - const QByteArray strUTF8Version = strVerion.toUtf8(); + const QByteArray strUTF8Version = strVersion.toUtf8(); // size of current message body const int iEntrLen = 1 + // operating system @@ -1864,7 +1864,7 @@ void CProtocol::CreateCLRegisterServerExMes ( const CHostAddress& InetAddr, cons const QByteArray strUTF8LInetAddr = LInetAddr.InetAddr.toString().toUtf8(); const QByteArray strUTF8Name = ServerInfo.strName.toUtf8(); const QByteArray strUTF8City = ServerInfo.strCity.toUtf8(); - const QByteArray strUTF8Version = QString ( VERSION ).toUtf8(); + const QByteArray strUTF8Version = QString ( APP_VERSION ).toUtf8(); // size of current message body const int iEntrLen = 2 + // server internal port number @@ -2296,10 +2296,10 @@ void CProtocol::CreateCLVersionAndOSMes ( const CHostAddress& InetAddr ) int iPos = 0; // init position pointer // get the version number string - const QString strVerion = VERSION; + const QString strVersion = APP_VERSION; // convert version string to utf-8 - const QByteArray strUTF8Version = strVerion.toUtf8(); + const QByteArray strUTF8Version = strVersion.toUtf8(); // size of current message body const int iEntrLen = 1 + // operating system