Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jamulus.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

@pljones pljones Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Append seconds since epoch of HEAD commit id (so -dirty should really mean "some time after this").

VERSION = "$$VERSION"-$$GIT_DESCRIPTION
message("building version \"$$VERSION\" (intermediate in git repository)")
} else {
Expand Down
11 changes: 6 additions & 5 deletions src/connectdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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+)-?(.*):?(.*)$)" );
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capture seconds since epoch if present.

QRegularExpressionMatch match = semVerRegex.match ( versionStr );

if ( !match.hasMatch() )
Expand All @@ -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() )
{
Expand All @@ -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 );
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use seconds since epoch, rather than commit id, if present.


return key;
}
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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 ) );
Copy link
Collaborator Author

@pljones pljones Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this method gets passed the protocol version (APP_VERSION), it needs to call GetDisplayVersion to retain existing display behaviour.

(Also note this only gets called once each time the server is seen, not on every refresh.)


// and store sortable mapped version number
pCurListViewItem->setData ( LVC_VERSION, Qt::UserRole, mapVersionStr ( strVersion ) );
Expand Down
4 changes: 3 additions & 1 deletion src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Copy link
Collaborator Author

@pljones pljones Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetDisplayVersion ( APP_VERSION ) used where APP_VERSION is currently referenced by this define, in existing code. APP_VERSION wasn't referenced anywhere directly except here before.

#define APP_NAME "Jamulus"

// Windows registry key name of auto run entry for the server
Expand Down Expand Up @@ -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; }
Copy link
Collaborator Author

@pljones pljones Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetDisplayVersion strips the seconds since epoch, where present.

str.mid ( 0, str.lastIndexOf ( ':' ) ) for Qt 5 compatibility.

10 changes: 5 additions & 5 deletions src/protocol.cpp
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APP_VERSION passed around in the protocol messages, to retain the full string.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down