Skip to content

Commit 46f4bda

Browse files
committed
Revise global program information
1 parent 4cfec4e commit 46f4bda

18 files changed

+50
-27
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
2020
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2121

2222
project(CupCalculator VERSION 1.1.1 LANGUAGES CXX)
23+
set(PROJECT_COPYRIGHT "(C) 2019 The OpenOrienteering developers")
24+
set(PROJECT_VERSION_DISPLAY "${PROJECT_VERSION} ${CMAKE_BUILD_TYPE}" CACHE STRING
25+
"Project version string to be displayed"
26+
)
2327

2428
option(MAKE_BUNDLE "Install all runtime libraries and plugins" OFF)
2529

ci/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ steps:
5454
-Ddefault_INSTALL_PREFIX=$(SUPERBUILD_INSTALL_DIR)
5555
-Ddefault_TOOLCHAIN_DIR=$(SUPERBUILD_INSTALL_DIR)/toolchain
5656
-DCupCalculator_CI_SOURCE_DIR=$(SOURCE_DIR)
57+
"-DCupCalculator_CI_VERSION_DISPLAY=$(VERSION_DISPLAY)"
5758
${{ parameters.cmakeArgs }}
5859
displayName: 'Configure'
5960

ci/openorienteering-cupcalculator-ci.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
set(CupCalculator_CI_SOURCE_DIR "NOTFOUND" CACHE STRING
3131
"CupCalculator (CI): Source code directory"
3232
)
33-
33+
set(CupCalculator_CI_VERSION_DISPLAY "ci" STRING BOOL
34+
"CupCalculator (CI): Version display string"
35+
)
3436
set(CupCalculator_CI_ENABLE_COVERAGE "OFF" CACHE BOOL
3537
"CupCalculator (CI): Enable test coverage analysis"
3638
)
@@ -57,7 +59,9 @@ superbuild_package(
5759
"-UCMAKE_STAGING_PREFIX"
5860
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
5961
"-ULICENSING_OPTIONAL_ITEMS" # unset here, updated via CMAKE_CACHE_ARGS
62+
"-UPROJECT_VERSION_DISPLAY" # unset here, updated via CMAKE_CACHE_ARGS
6063
CMAKE_CACHE_ARGS
64+
"-DPROJECT_VERSION_DISPLAY:STRING=@CupCalculator_CI_VERSION_DISPLAY@"
6165
"-DLICENSING_OPTIONAL_ITEMS:STRING=@CupCalculator_CI_LICENSING_OPTIONAL_ITEMS@"
6266
$<$<BOOL:@WIN32@>:
6367
"-DCMAKE_INSTALL_BINDIR:STRING=."

src/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ include("licensing_helper")
2525

2626
set(CMAKE_AUTOMOC ON)
2727

28+
29+
set(APP_NAME "CupCalculator")
30+
configure_file("config.h.in" "config.h" @ONLY)
31+
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
32+
33+
2834
add_library(CupCalculator_Common STATIC
2935
mainWindow.cpp
3036

@@ -56,6 +62,7 @@ target_link_libraries(CupCalculator_Common
5662
PUBLIC Qt5::Widgets
5763
)
5864

65+
5966
add_executable(CupCalculator WIN32 main.cpp)
6067
target_link_libraries(CupCalculator
6168
PUBLIC
@@ -70,6 +77,7 @@ if(MAKE_BUNDLE)
7077
licensing_helper_postprocess(CupCalculator COPYING.txt)
7178
endif()
7279

80+
7381
add_executable(CupCalculatorTest test.cpp)
7482
target_link_libraries(CupCalculatorTest
7583
PUBLIC

src/club.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#include "location.h"
3232
#include "util.h"
33-
#include "global.h"
33+
#include "config.h"
3434
#include "runner.h"
3535
#include "scoring.h"
3636
#include "seriesScoring.h"

src/clubDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "location.h"
2727
#include "club.h"
28-
#include "global.h"
28+
#include "config.h"
2929
#include "util.h"
3030

3131
ClubDialog::ClubDialog(Club* _club, QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint), club(_club)

src/global.h renamed to src/config.h.in

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
Copyright 2011 Thomas Schöps
3+
Copyright 2019 Kai Pastor
34
45
This file is part of OpenOrienteering's scoring tool.
56
@@ -18,12 +19,14 @@
1819
*/
1920

2021

21-
#ifndef GLOBAL_H
22-
#define GLOBAL_H
22+
#ifndef CUPCALCULATOR_CONFIG_H
23+
#define CUPCALCULATOR_CONFIG_H
2324

24-
#define APP_NAME qApp->translate("Global", QT_TRANSLATE_NOOP("Global", "CupCalculator"))
25-
#define APP_VERSION "v1.1.1"
25+
#define APP_NAME qApp->translate("Global", "@APP_NAME@")
26+
#define PROJECT_NAME qApp->translate("Global", "@PROJECT_NAME@")
27+
#define PROJECT_COPYRIGHT "@PROJECT_COPYRIGHT@"
28+
#define PROJECT_VERSION_DISPLAY "@PROJECT_VERSION_DISPLAY@"
2629

2730
extern char installationKey[33]; // 32 letters and terminating 0
2831

29-
#endif
32+
#endif // CUPCALCULATOR_CONFIG_H

src/location.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <QXmlStreamWriter>
2828
#include <QXmlStreamReader>
2929

30-
#include "global.h"
30+
#include "config.h"
3131

3232
QSortFilterProxyModel* LocationDB::sortModel;
3333

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "runner.h"
3535
#include "scoring.h"
3636
#include "seriesScoring.h"
37-
#include "global.h"
37+
#include "config.h"
3838

3939
void loadProgramSettings();
4040
void saveProgramSettings();

src/mainWindow.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <assert.h>
2525
#include <set>
2626

27-
#include "global.h"
27+
#include "config.h"
2828
#include "csvFile.h"
2929
#include "resultCsvImport.h"
3030
#include "event.h"
@@ -60,7 +60,8 @@ MainWindow::MainWindow(QWidget* parent)
6060
mainLayout->addWidget(tabWidget);
6161
setLayout(mainLayout);
6262

63-
setWindowTitle(QString("%1 %2").arg(APP_NAME).arg(APP_VERSION));
63+
void(QT_TRANSLATE_NOOP("Global", "CupCalculator"));
64+
setWindowTitle(QString("%1 %2").arg(PROJECT_NAME, PROJECT_VERSION_DISPLAY));
6465
setWindowIcon(QIcon("images/control.png"));
6566

6667
setSizeGripEnabled(true);
@@ -1207,16 +1208,18 @@ void SeriesScoringTab::seriesDoubleClicked(QListWidgetItem* item)
12071208

12081209
AboutTab::AboutTab(MainWindow* mainWindow, QWidget* parent): QWidget(parent), mainWindow(mainWindow)
12091210
{
1210-
QLabel* programLabel = new QLabel(QString("<b>%1 %2</b>").arg(APP_NAME).arg(APP_VERSION));
1211+
void(QT_TRANSLATE_NOOP("Global", "CupCalculator"));
1212+
QLabel* programLabel = new QLabel(QString("<b>%1 %2</b>").arg(PROJECT_NAME, PROJECT_VERSION_DISPLAY));
12111213
programLabel->setAlignment(Qt::AlignHCenter);
12121214
QFont hugeFont = programLabel->font();
12131215
hugeFont.setPointSize(20);
12141216
programLabel->setFont(hugeFont);
12151217

1216-
QLabel* aboutLabel = new QLabel(tr("Copyright (C) 2011, 2012, 2015 Thomas Sch&ouml;ps<br>"
1217-
"This program comes with ABSOLUTELY NO WARRANTY;<br>"
1218-
"This is free software, and you are welcome to redistribute it<br>"
1219-
"under certain conditions; see the file COPYING for details."));
1218+
QLabel* aboutLabel = new QLabel(tr("%1<br>"
1219+
"This program comes with ABSOLUTELY NO WARRANTY;<br>"
1220+
"This is free software, and you are welcome to redistribute it<br>"
1221+
"under certain conditions; see the file COPYING for details.")
1222+
.arg(PROJECT_COPYRIGHT));
12201223
aboutLabel->setAlignment(Qt::AlignHCenter);
12211224
QFont bigFont = aboutLabel->font();
12221225
bigFont.setPointSize(12);
@@ -1228,7 +1231,7 @@ AboutTab::AboutTab(MainWindow* mainWindow, QWidget* parent): QWidget(parent), ma
12281231
mediumFont.setPointSize(12);
12291232
imageLabel->setFont(mediumFont);
12301233

1231-
QLabel* aboutImage = new QLabel("<a href=\"http://www.openorienteering.org\"><img src=\"images/open_orienteering.png\"/></a>");
1234+
QLabel* aboutImage = new QLabel("<a href=\"https://www.openorienteering.org\"><img src=\"images/open_orienteering.png\"/></a>");
12321235

12331236
QVBoxLayout* layout = new QVBoxLayout();
12341237
layout->addStretch(1);

0 commit comments

Comments
 (0)