Skip to content

Commit bb88d80

Browse files
authored
Merge pull request #1 from pavel-cpp/dev
TIP 8.1
2 parents 7acfad1 + 8427886 commit bb88d80

File tree

21 files changed

+603
-638
lines changed

21 files changed

+603
-638
lines changed

CMakeLists.txt

Lines changed: 94 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,25 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../build) # path/to/build_directory
4747
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../build)
4848

4949
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${CMAKE_EXE_LINKER_FLAGS}")
50-
5150
set(CMAKE_CXX_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${CMAKE_CXX_LINKER_FLAGS}")
5251

5352
set(CMAKE_SHARED_LIBRARY_PREFIX "")
5453

54+
list(APPEND CMAKE_PREFIX_PATH "${QT5_DIR}")
55+
list(APPEND CMAKE_PREFIX_PATH "${OPEN_XLSX_DIR}")
56+
5557
set(QT_COMPONENTS Core Gui Widgets Sql PrintSupport Network)
5658

5759
find_package(
58-
Qt5
59-
COMPONENTS
60-
${QT_COMPONENTS}
61-
REQUIRED
60+
Qt5
61+
COMPONENTS
62+
${QT_COMPONENTS}
63+
REQUIRED
64+
)
65+
66+
find_package(
67+
OpenXLSX
68+
REQUIRED
6269
)
6370

6471
function(find_files dir type result)
@@ -71,69 +78,68 @@ find_files(${UI_DIRECTORY} "ui" UI_FILES)
7178

7279
include_directories(source)
7380

74-
add_library(
75-
image_downloader SHARED
76-
source/services/image-downloader/image_downloader.cpp
77-
)
78-
7981
set(CONSOLE_FLAG)
8082
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
8183
set(CONSOLE_FLAG WIN32)
8284
endif ()
8385

8486
add_executable(
85-
${PROJECT_NAME}
86-
${CONSOLE_FLAG}
87-
source/main.cpp
88-
source/interfaces/font-editor/font_editor.cpp
89-
source/interfaces/font-editor/font_editor.h
90-
source/interfaces/options/options.cpp
91-
source/interfaces/options/options.h
92-
source/interfaces/mainwindow/mainwindow.cpp
93-
source/interfaces/mainwindow/mainwindow.h
94-
source/interfaces/text-position-selector/text_position_selector.cpp
95-
source/interfaces/text-position-selector/text_position_selector.h
96-
source/interfaces/database-settings/database_settings.cpp
97-
source/interfaces/database-settings/database_settings.h
98-
source/interfaces/password-form/password_form.cpp
99-
source/interfaces/password-form/password_form.h
100-
source/interfaces/records-amount-form/records_amount_form.cpp
101-
source/interfaces/records-amount-form/records_amount_form.h
102-
${UI_FILES}
103-
source/services/settings/settings_manager.cpp
104-
source/services/text-painter/text_painter.cpp
105-
source/services/theme-loader/theme_loader.cpp
106-
source/services/image-printer/image_printer.cpp
107-
source/resources/icon.rc
87+
${PROJECT_NAME}
88+
${CONSOLE_FLAG}
89+
source/main.cpp
90+
source/interfaces/font-editor/font_editor.cpp
91+
source/interfaces/font-editor/font_editor.h
92+
source/interfaces/options/options.cpp
93+
source/interfaces/options/options.h
94+
source/interfaces/mainwindow/mainwindow.cpp
95+
source/interfaces/mainwindow/mainwindow.h
96+
source/interfaces/text-position-selector/text_position_selector.cpp
97+
source/interfaces/text-position-selector/text_position_selector.h
98+
source/interfaces/database-settings/database_settings.cpp
99+
source/interfaces/database-settings/database_settings.h
100+
source/interfaces/password-form/password_form.cpp
101+
source/interfaces/password-form/password_form.h
102+
source/interfaces/records-amount-form/records_amount_form.cpp
103+
source/interfaces/records-amount-form/records_amount_form.h
104+
${UI_FILES}
105+
source/services/settings/settings_manager.cpp
106+
source/services/text-painter/text_painter.cpp
107+
source/services/theme-loader/theme_loader.cpp
108+
source/services/image-printer/image_printer.cpp
109+
source/resources/icon.rc
108110
)
109111

110112
target_link_libraries(
111-
image_downloader
112-
PUBLIC
113-
Qt5::Network
114-
)
115-
116-
target_link_libraries(
117-
${PROJECT_NAME}
118-
PUBLIC
119-
Qt5::Core
120-
Qt5::Gui
121-
Qt5::Widgets
122-
Qt5::Sql
123-
Qt5::PrintSupport
124-
image_downloader
113+
${PROJECT_NAME}
114+
PUBLIC
115+
Qt5::Core
116+
Qt5::Gui
117+
Qt5::Widgets
118+
Qt5::Sql
119+
Qt5::PrintSupport
120+
Qt5::Network
121+
122+
OpenXLSX::OpenXLSX
125123
)
126124

127125
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
128126
set_target_properties(${PROJECT_NAME} PROPERTIES AUTOMOC ON AUTORCC ON AUTOUIC ON)
129127

130128
# Копирование содержимого папки reference в build
131129
add_custom_command(
132-
TARGET ${PROJECT_NAME}
133-
POST_BUILD
134-
COMMAND ${CMAKE_COMMAND} -E copy_directory
135-
${CMAKE_SOURCE_DIR}/build_folder_reference/
136-
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
130+
TARGET ${PROJECT_NAME}
131+
POST_BUILD
132+
COMMAND ${CMAKE_COMMAND} -E copy_directory
133+
${CMAKE_SOURCE_DIR}/build_folder_reference/
134+
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
135+
)
136+
137+
add_custom_command(
138+
TARGET ${PROJECT_NAME}
139+
POST_BUILD
140+
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPEN_XLSX_DIR}/bin/libOpenXLSX.dll"
141+
142+
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
137143
)
138144

139145
# Qt autoDLL
@@ -142,7 +148,7 @@ if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
142148
if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug")
143149
set(DEBUG_SUFFIX "d")
144150
endif ()
145-
set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}")
151+
set(QT_INSTALL_PATH ${QT5_DIR})
146152
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
147153
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
148154
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
@@ -151,38 +157,53 @@ if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
151157
endif ()
152158
if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
153159
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
154-
COMMAND ${CMAKE_COMMAND} -E make_directory
155-
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
160+
COMMAND ${CMAKE_COMMAND} -E make_directory
161+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
156162
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
157-
COMMAND ${CMAKE_COMMAND} -E copy
158-
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
159-
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
163+
COMMAND ${CMAKE_COMMAND} -E copy
164+
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
165+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
160166
endif ()
161167
if (EXISTS "${QT_INSTALL_PATH}/plugins/sqldrivers/qsqlpsql${DEBUG_SUFFIX}.dll")
162168
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
163-
COMMAND ${CMAKE_COMMAND} -E make_directory
164-
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/sqldrivers/")
169+
COMMAND ${CMAKE_COMMAND} -E make_directory
170+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/sqldrivers/")
165171
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
166-
COMMAND ${CMAKE_COMMAND} -E copy
167-
"${QT_INSTALL_PATH}/plugins/sqldrivers/qsqlpsql${DEBUG_SUFFIX}.dll"
168-
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/sqldrivers/")
172+
COMMAND ${CMAKE_COMMAND} -E copy
173+
"${QT_INSTALL_PATH}/plugins/sqldrivers/qsqlpsql${DEBUG_SUFFIX}.dll"
174+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/sqldrivers/")
169175
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
170-
COMMAND ${CMAKE_COMMAND} -E copy_directory
171-
"${QT_INSTALL_PATH}/plugins/printsupport"
172-
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/printsupport")
176+
COMMAND ${CMAKE_COMMAND} -E copy_directory
177+
"${QT_INSTALL_PATH}/plugins/printsupport"
178+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/printsupport")
173179
endif ()
180+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
181+
COMMAND ${CMAKE_COMMAND} -E copy
182+
"${QT_INSTALL_PATH}/plugins/imageformats/qjpeg.dll"
183+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/imageformats/qjpeg.dll"
184+
)
185+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
186+
COMMAND ${CMAKE_COMMAND} -E copy
187+
"${QT_INSTALL_PATH}/plugins/imageformats/qwbmp.dll"
188+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/imageformats/qwbmp.dll"
189+
)
190+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
191+
COMMAND ${CMAKE_COMMAND} -E copy
192+
"${QT_INSTALL_PATH}/plugins/imageformats/qwebp.dll"
193+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/imageformats/qwebp.dll"
194+
)
174195
foreach (QT_LIB ${QT_COMPONENTS})
175196
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
176-
COMMAND ${CMAKE_COMMAND} -E copy
177-
"${QT_INSTALL_PATH}/bin/Qt5${QT_LIB}${DEBUG_SUFFIX}.dll"
178-
"$<TARGET_FILE_DIR:${PROJECT_NAME}>")
197+
COMMAND ${CMAKE_COMMAND} -E copy
198+
"${QT_INSTALL_PATH}/bin/Qt5${QT_LIB}${DEBUG_SUFFIX}.dll"
199+
"$<TARGET_FILE_DIR:${PROJECT_NAME}>")
179200
endforeach (QT_LIB)
180-
if (DEFINED DEPLOY_DEPENDENCY)
201+
if (DEFINED DEPLOY_DEPENDENCY)
181202
set(DEPLOY_COMMAND deployment/deploy_windows.bat ${DEPLOY_DEPENDENCY})
182203
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
183-
COMMAND ${DEPLOY_COMMAND}
184-
COMMENT "Running Inno Setup Compiler"
185-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
204+
COMMAND ${DEPLOY_COMMAND}
205+
COMMENT "Running Inno Setup Compiler"
206+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
186207
)
187208
endif ()
188209
endif ()

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
1. Install Cmake
2424
2. Download & Install **[Qt5][4]**
2525
3. ```sh
26-
cmake -DCMAKE_BUILD_TYPE={type} -DCMAKE_PREFIX_PATH=path/to/Qt5 -G {generator} -B ./cmake-build-{type}
26+
cmake -DCMAKE_BUILD_TYPE={type} -QT5_DIR=path/to/Qt5 -DOPEN_XLSX_DIR=path/to/OpenXLSX -G {generator} -B ./cmake-build-{type}
2727
cmake --build ./cmake-build-{type} --target TIP -j 14
2828
```
2929

@@ -32,7 +32,7 @@
3232
2. Install **[Inno Download Plugin][6]**
3333
3. To activate deployment mode, add the following flag to the CMake configuration:
3434
```sh
35-
cmake -DCMAKE_BUILD_TYPE={type} -DCMAKE_PREFIX_PATH=path/to/Qt5 "-DDEPLOY_DEPENDENCY=\"path/to/idp.iss\"" -G {generator} -B ./cmake-build-{type}
35+
cmake -DCMAKE_BUILD_TYPE={type} -QT5_DIR=path/to/Qt5 -DOPEN_XLSX_DIR=path/to/OpenXLSX "-DDEPLOY_DEPENDENCY=\"path/to/idp.iss\"" -G {generator} -B ./cmake-build-{type}
3636
cmake --build ./cmake-build-{type} --target TIP -j 14
3737
```
3838
or run [windows_deploy.bat][8] after building the project and enter `"path/to/idp.iss"` as an argument.

build_folder_reference/settings/settings.ini

Lines changed: 0 additions & 11 deletions
This file was deleted.

deployment/database/insert_default_records.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ VALUES (DEFAULT, 'Arial', '#000000', 0, 0, 50, false),
2020
(DEFAULT, 'Arial', '#000000', 100, 100, 50, false),
2121
(DEFAULT, 'Arial', '#000000', 200, 200, 50, false);
2222

23-
INSERT INTO main.image (url, id, format)
24-
VALUES (null, DEFAULT, null);
23+
INSERT INTO main.image (base64, id)
24+
VALUES (null, DEFAULT);

deployment/database/tables_creation.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ create table if not exists main.font_settings
3030

3131
create table if not exists main.image
3232
(
33-
url text,
33+
base64 bytea,
3434
id serial
3535
constraint image_pk
3636
primary key,
37-
format text
3837
);
3938

4039
create table if not exists main.advanced_settings_passwords

deployment/windows_installer/tip_setup_offline.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
; along with this program. If not, see <https://www.gnu.org/licenses/>.
1717

1818
#define MyAppName "TIP"
19-
#define MyAppVersion "8.0"
19+
#define MyAppVersion "8.1"
2020
#define MyAppPublisher "Pavel Remdenok"
2121
#define MyAppURL "https://github.com/pavel-cpp"
2222
#define MyAppExeName "TIP.exe"

deployment/windows_installer/tip_setup_online.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
; along with this program. If not, see <https://www.gnu.org/licenses/>.
1717

1818
#define MyAppName "TIP"
19-
#define MyAppVersion "8.0"
19+
#define MyAppVersion "8.1"
2020
#define MyAppPublisher "Pavel Remdenok"
2121
#define MyAppURL "https://github.com/pavel-cpp"
2222
#define MyAppExeName "TIP.exe"

0 commit comments

Comments
 (0)