Skip to content

Commit e6f645c

Browse files
committed
Where available, use the commit time rather than commit id, for sort
1 parent 6c89081 commit e6f645c

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

Jamulus.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contains(CONFIG, "noupcasename") {
1515
# allow detailed version info for intermediate builds (#475)
1616
contains(VERSION, .*dev.*) {
1717
exists(".git/config") {
18-
GIT_DESCRIPTION=$$system(git describe --match=xxxxxxxxxxxxxxxxxxxx --always --abbrev --dirty) # the match should never match
18+
GIT_DESCRIPTION=$$system(git show -s --pretty=format:"%h:%ct") # commit:seconds-since-epoch
1919
VERSION = "$$VERSION"-$$GIT_DESCRIPTION
2020
message("building version \"$$VERSION\" (intermediate in git repository)")
2121
} else {

src/connectdlg.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static QString mapVersionStr ( const QString& versionStr )
3333
QString x = ">"; // default suffix is later (git, dev, nightly, etc)
3434

3535
// Regex for SemVer: major.minor.patch-suffix
36-
QRegularExpression semVerRegex ( R"(^(\d+)\.(\d+)\.(\d+)-?(.*)$)" );
36+
QRegularExpression semVerRegex ( R"(^(\d+)\.(\d+)\.(\d+)-?(.*):?(.*)$)" );
3737
QRegularExpressionMatch match = semVerRegex.match ( versionStr );
3838

3939
if ( !match.hasMatch() )
@@ -45,6 +45,7 @@ static QString mapVersionStr ( const QString& versionStr )
4545
int minor = match.captured ( 2 ).toInt();
4646
int patch = match.captured ( 3 ).toInt();
4747
QString suffix = match.captured ( 4 ); // may be empty
48+
QString tstamp = match.captured ( 5 ); // may be empty
4849

4950
if ( suffix.isEmpty() )
5051
{
@@ -66,7 +67,7 @@ static QString mapVersionStr ( const QString& versionStr )
6667
.arg ( minor, 3, 10, QLatin1Char ( '0' ) )
6768
.arg ( patch, 3, 10, QLatin1Char ( '0' ) )
6869
.arg ( x )
69-
.arg ( suffix );
70+
.arg ( tstamp.isEmpty() ? suffix : tstamp );
7071

7172
return key;
7273
}
@@ -184,13 +185,13 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
184185
lvwServers->setColumnWidth ( LVC_NAME, 200 );
185186
lvwServers->setColumnWidth ( LVC_PING, 130 );
186187
lvwServers->setColumnWidth ( LVC_CLIENTS, 100 );
187-
lvwServers->setColumnWidth ( LVC_VERSION, 110 );
188+
lvwServers->setColumnWidth ( LVC_VERSION, 150 );
188189
#else
189190
lvwServers->setColumnWidth ( LVC_NAME, 180 );
190191
lvwServers->setColumnWidth ( LVC_PING, 75 );
191192
lvwServers->setColumnWidth ( LVC_CLIENTS, 70 );
192193
lvwServers->setColumnWidth ( LVC_LOCATION, 220 );
193-
lvwServers->setColumnWidth ( LVC_VERSION, 95 );
194+
lvwServers->setColumnWidth ( LVC_VERSION, 135 );
194195
#endif
195196
lvwServers->clear();
196197

@@ -1024,7 +1025,7 @@ void CConnectDlg::SetServerVersionResult ( const CHostAddress& InetAddr, const Q
10241025

10251026
if ( pCurListViewItem )
10261027
{
1027-
pCurListViewItem->setText ( LVC_VERSION, strVersion );
1028+
pCurListViewItem->setText ( LVC_VERSION, GetDisplayVersion ( strVersion ) );
10281029

10291030
// and store sortable mapped version number
10301031
pCurListViewItem->setData ( LVC_VERSION, Qt::UserRole, mapVersionStr ( strVersion ) );

src/global.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ LED bar: lbr
7373

7474
// version and application name (use version from qt prject file)
7575
#undef VERSION
76-
#define VERSION APP_VERSION
76+
#define VERSION GetDisplayVersion ( APP_VERSION )
7777
#define APP_NAME "Jamulus"
7878

7979
// Windows registry key name of auto run entry for the server

src/protocol.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,10 +1573,10 @@ void CProtocol::CreateVersionAndOSMes()
15731573
int iPos = 0; // init position pointer
15741574

15751575
// get the version number string
1576-
const QString strVerion = VERSION;
1576+
const QString strVersion = APP_VERSION;
15771577

15781578
// convert version string to utf-8
1579-
const QByteArray strUTF8Version = strVerion.toUtf8();
1579+
const QByteArray strUTF8Version = strVersion.toUtf8();
15801580

15811581
// size of current message body
15821582
const int iEntrLen = 1 + // operating system
@@ -1864,7 +1864,7 @@ void CProtocol::CreateCLRegisterServerExMes ( const CHostAddress& InetAddr, cons
18641864
const QByteArray strUTF8LInetAddr = LInetAddr.InetAddr.toString().toUtf8();
18651865
const QByteArray strUTF8Name = ServerInfo.strName.toUtf8();
18661866
const QByteArray strUTF8City = ServerInfo.strCity.toUtf8();
1867-
const QByteArray strUTF8Version = QString ( VERSION ).toUtf8();
1867+
const QByteArray strUTF8Version = QString ( APP_VERSION ).toUtf8();
18681868

18691869
// size of current message body
18701870
const int iEntrLen = 2 + // server internal port number
@@ -2296,10 +2296,10 @@ void CProtocol::CreateCLVersionAndOSMes ( const CHostAddress& InetAddr )
22962296
int iPos = 0; // init position pointer
22972297

22982298
// get the version number string
2299-
const QString strVerion = VERSION;
2299+
const QString strVersion = APP_VERSION;
23002300

23012301
// convert version string to utf-8
2302-
const QByteArray strUTF8Version = strVerion.toUtf8();
2302+
const QByteArray strUTF8Version = strVersion.toUtf8();
23032303

23042304
// size of current message body
23052305
const int iEntrLen = 1 + // operating system

src/util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,3 +1373,5 @@ struct EnumClassHash
13731373
}
13741374
};
13751375
#endif
1376+
1377+
inline QString GetDisplayVersion ( QString str ) { return str.contains ( ':' ) ? str.mid ( 0, str.lastIndexOf ( ':' ) ) : str; }

0 commit comments

Comments
 (0)