Skip to content

Commit

Permalink
Update version number and display it in the about window
Browse files Browse the repository at this point in the history
  • Loading branch information
afichet committed May 30, 2023
1 parent 88d1d3b commit e42a3be
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
29 changes: 17 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.5)

project(openexr-viewer
VERSION 0.5.2
project(openexr-viewer
VERSION 0.6.0
DESCRIPTION "Simple Viewer for OpenEXR files with detailed metadata display"
HOMEPAGE_URL "https://github.com/afichet/openexr-viewer"
LANGUAGES CXX
LANGUAGES CXX
)

set(CMAKE_AUTOUIC ON)
Expand Down Expand Up @@ -58,6 +58,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
# ----------------------------------------------------------------------------
# Source
# ----------------------------------------------------------------------------
message(${CMAKE_PROJECT_VERSION})

configure_file(src/config.h.in config.h)

set(PROJECT_SOURCES
src/main.cpp
Expand Down Expand Up @@ -166,7 +169,7 @@ else()
else()
add_executable(openexr-viewer
${PROJECT_SOURCES}
)
)
endif()
endif()

Expand All @@ -187,6 +190,7 @@ endif ()

target_include_directories(openexr-viewer PRIVATE src)
target_include_directories(openexr-viewer PRIVATE 3rdparty/data)
target_include_directories(openexr-viewer PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")

target_link_libraries(openexr-viewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
target_link_libraries(openexr-viewer PRIVATE Imath::Imath OpenEXR::OpenEXR)
Expand Down Expand Up @@ -226,17 +230,17 @@ if (UNIX AND NOT APPLE)

# Application desktop entry
install(
FILES
FILES
deploy/linux/openexr-viewer.desktop
DESTINATION
DESTINATION
share/applications
)

# MIME data
install(
FILES
FILES
deploy/linux/openexr-viewer.xml
DESTINATION
DESTINATION
share/mime/packages
)

Expand All @@ -261,9 +265,9 @@ elseif (APPLE)
macdeployqt(openexr-viewer)
elseif (WIN32)
install(
TARGETS
openexr-viewer
DESTINATION
TARGETS
openexr-viewer
DESTINATION
${CMAKE_INSTALL_BINDIR}
)

Expand All @@ -278,7 +282,7 @@ elseif (WIN32)
$<TARGET_FILE:OpenEXR::IlmThread>
$<TARGET_FILE:OpenEXR::OpenEXR>
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} # Windows DLLs
DESTINATION
DESTINATION
${CMAKE_INSTALL_BINDIR}
)

Expand Down Expand Up @@ -313,6 +317,7 @@ if(CPACK_GENERATOR MATCHES "NSIS")
set(CPACK_NSIS_MODIFY_PATH OFF)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "openexr-viewer.exe")
set(CPACK_PACKAGE_VENDOR "Lambda")
endif(CPACK_GENERATOR MATCHES "NSIS")

if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
Expand Down
1 change: 1 addition & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#cmakedefine CMAKE_PROJECT_VERSION "@CMAKE_PROJECT_VERSION@"
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/

#include <view/mainwindow.h>

#include <config.h>
#include <QApplication>
#include <QFile>

Expand All @@ -53,6 +53,7 @@ int main(int argc, char* argv[])
{
#endif
QApplication a(argc, argv);
a.setApplicationVersion(CMAKE_PROJECT_VERSION);

QFile f(":/dark_flat/theme.css");

Expand Down
6 changes: 3 additions & 3 deletions src/view/about.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include "about.h"
#include "ui_about.h"
#include <config.h>

About::About(QWidget* parent): QDialog(parent), ui(new Ui::About)
{
ui->setupUi(this);

ui->textBrowser->setHtml(
"<h1>OpenEXR Viewer</h1>"
"<p><em>"
//TODO + tr("Version ") + QApplication::applicationVersion() + "</em></p>"
"<p><em>" + tr("Version ") + QApplication::applicationVersion() + "</em></p>"
+ tr(" \
BSD 3-Clause License \
<p>BSD 3-Clause License \
\
<p>Copyright (c) 2021 - 2022, Alban Fichet <br/> \
All rights reserved. </p>\
Expand Down

0 comments on commit e42a3be

Please sign in to comment.