forked from QNapi/qnapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to CMake/Qt6 and modernize code (regex, encoding, GUI centering, build) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mskpluk
wants to merge
2
commits into
master
Choose a base branch
from
codex/przenies-qnapi-na-qt6
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| cmake_minimum_required(VERSION 3.21) | ||
|
|
||
| set(QNAPI_VERSION "0.4.0") | ||
| if(EXISTS "${CMAKE_SOURCE_DIR}/debian/control") | ||
| file(STRINGS "${CMAKE_SOURCE_DIR}/debian/control" _debian_version_line | ||
| REGEX "^Version:[ \t]*") | ||
| if(_debian_version_line) | ||
| string(REGEX REPLACE "^Version:[ \t]*([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" | ||
| QNAPI_VERSION "${_debian_version_line}") | ||
| endif() | ||
| endif() | ||
|
|
||
| project(qnapi VERSION ${QNAPI_VERSION} LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
|
||
| set(CMAKE_AUTOMOC ON) | ||
| set(CMAKE_AUTORCC ON) | ||
| set(CMAKE_AUTOUIC ON) | ||
|
|
||
| option(QNAPI_BUILD_GUI "Build GUI app" ON) | ||
| option(QNAPI_BUILD_CLI "Build CLI app" ON) | ||
|
|
||
| find_package(Qt6 REQUIRED COMPONENTS Core Network Xml) | ||
|
|
||
| add_subdirectory(libqnapi) | ||
|
|
||
| if(QNAPI_BUILD_CLI) | ||
| add_subdirectory(cli) | ||
| endif() | ||
|
|
||
| if(QNAPI_BUILD_GUI) | ||
| add_subdirectory(gui) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| find_package(Qt6 REQUIRED COMPONENTS Core Network Xml) | ||
|
|
||
| set(CLI_SOURCES | ||
| src/main.cpp | ||
| src/clisubtitlesdownloader.cpp | ||
| src/climain.cpp | ||
| res/resources.qrc) | ||
|
|
||
| add_executable(qnapic ${CLI_SOURCES}) | ||
|
|
||
| target_include_directories(qnapic PRIVATE | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/src") | ||
|
|
||
| target_link_libraries(qnapic PRIVATE | ||
| qnapi::libqnapi | ||
| Qt6::Core | ||
| Qt6::Network | ||
| Qt6::Xml) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| find_package(Qt6 REQUIRED COMPONENTS Core Network Xml Gui Widgets) | ||
|
|
||
| if(UNIX AND NOT APPLE) | ||
| find_package(Qt6 REQUIRED COMPONENTS DBus) | ||
| endif() | ||
|
|
||
| file(GLOB_RECURSE GUI_SOURCES CONFIGURE_DEPENDS | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") | ||
|
|
||
| set(GUI_FORMS | ||
| ui/frmprogress.ui | ||
| ui/frmlistsubtitles.ui | ||
| ui/frmsummary.ui | ||
| ui/frmscan.ui | ||
| ui/frmoptions.ui | ||
| ui/frmabout.ui | ||
| ui/frmconvert.ui | ||
| ui/subDataWidget.ui | ||
| ui/napiprojekt/frmnapiprojektconfig.ui | ||
| ui/opensubtitles/frmopensubtitlesconfig.ui | ||
| ui/napisy24/frmnapisy24config.ui) | ||
|
|
||
| set(GUI_RESOURCES res/resources.qrc) | ||
|
|
||
| if(WIN32) | ||
| list(REMOVE_ITEM GUI_SOURCES | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/src/qcumber/qinterprocesschannel.cpp") | ||
| else() | ||
| list(REMOVE_ITEM GUI_SOURCES | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/src/qcumber/qinterprocesschannel_win32.cpp") | ||
| endif() | ||
|
|
||
| if(APPLE) | ||
| list(APPEND GUI_SOURCES | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/src/utils/infoplistdockicon.cpp") | ||
| endif() | ||
|
|
||
| add_executable(qnapi | ||
| ${GUI_SOURCES} | ||
| ${GUI_FORMS} | ||
| ${GUI_RESOURCES}) | ||
|
|
||
| target_include_directories(qnapi PRIVATE | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/src") | ||
|
|
||
| target_link_libraries(qnapi PRIVATE | ||
| qnapi::libqnapi | ||
| Qt6::Core | ||
| Qt6::Network | ||
| Qt6::Xml | ||
| Qt6::Gui | ||
| Qt6::Widgets) | ||
|
|
||
| if(UNIX AND NOT APPLE) | ||
| target_link_libraries(qnapi PRIVATE Qt6::DBus) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching this path from
QTextCodec::availableCodecs()toEncodingUtils::availableEncodings()silently narrows “show all” to the same short internal codec list used for heuristics, so users lose access to many previously selectable encodings. This also makes existing configs with values outside that shortlist failfindText(...), increasing the chance those settings are unintentionally replaced when options are saved.Useful? React with 👍 / 👎.