Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aryxile
committed
Sep 25, 2023
1 parent
50c6f3c
commit 3d7c6a1
Showing
49 changed files
with
2,589 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,117 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(SubPar VERSION 1.0 LANGUAGES CXX) | ||
|
||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network) | ||
|
||
set(TS_FILES SubPar_en_IE.ts) | ||
|
||
set(PROJECT_SOURCES | ||
main.cpp | ||
mainwindow.cpp | ||
mainwindow.h | ||
mainwindow.ui | ||
assets.qrc | ||
optionsdialog.h optionsdialog.cpp optionsdialog.ui | ||
opensubtitlesapi.h opensubtitlesapi.cpp | ||
aboutdialog.h aboutdialog.cpp aboutdialog.ui | ||
|
||
filelistmodel.h filelistmodel.cpp | ||
qfileitem.h qfileitem.cpp | ||
qlistviewdrawdelegate.h qlistviewdrawdelegate.cpp | ||
listview.h listview.cpp | ||
${TS_FILES} | ||
) | ||
|
||
if (WIN32) | ||
set(app_icon_resource "${CMAKE_CURRENT_SOURCE_DIR}/resources/app_icon.rc") | ||
qt_add_executable(SubPar | ||
MANUAL_FINALIZATION | ||
${PROJECT_SOURCES} | ||
${app_icon_resource} | ||
) | ||
# qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) | ||
elseif (APPLE) | ||
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist | ||
# generated by CMake. This variable contains the .icns file name, | ||
# without the path. | ||
# set(MACOSX_BUNDLE_ICON_FILE subpar.icns) | ||
|
||
# # And the following tells CMake where to find and install the file itself. | ||
# set(app_icon_resource "${CMAKE_CURRENT_SOURCE_DIR}/resources/subpar.icns") | ||
# set_source_files_properties(${app_icon_resource} PROPERTIES | ||
# MACOSX_PACKAGE_LOCATION "Resources") | ||
|
||
# qt_add_executable(SubPar | ||
# MACOSX_BUNDLE | ||
# MANUAL_FINALIZATION | ||
# ${PROJECT_SOURCES} | ||
# ${app_icon_resource}) | ||
|
||
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist | ||
# generated by CMake. This variable contains the .icns file name, | ||
# without the path. | ||
set(MACOSX_BUNDLE_ICON_FILE subpar.icns) | ||
|
||
# And the following tells CMake where to find and install the file itself. | ||
set(app_icon_macos "${CMAKE_CURRENT_SOURCE_DIR}/resources/subpar.icns") | ||
set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") | ||
|
||
qt_add_executable(SubPar MACOSX_BUNDLE ${PROJECT_SOURCES} ${app_icon_macos}) | ||
else() | ||
qt_add_executable(SubPar ${PROJECT_SOURCES}) | ||
endif() | ||
|
||
|
||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) | ||
|
||
|
||
################# | ||
# Define target properties for Android with Qt 6 as: | ||
# set_property(TARGET SubPar APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/android) | ||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation | ||
|
||
# qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) | ||
else() | ||
if(ANDROID) | ||
add_library(SubPar SHARED | ||
${PROJECT_SOURCES} | ||
) | ||
# Define properties for Android with Qt 5 after find_package() calls as: | ||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") | ||
else() | ||
add_executable(SubPar | ||
${PROJECT_SOURCES} | ||
) | ||
endif() | ||
|
||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) | ||
endif() | ||
|
||
target_link_libraries(SubPar PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network) | ||
|
||
set_target_properties(SubPar PROPERTIES | ||
MACOSX_BUNDLE_GUI_IDENTIFIER subpar.arcanespire.com | ||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} | ||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} | ||
MACOSX_BUNDLE TRUE | ||
WIN32_EXECUTABLE TRUE | ||
) | ||
|
||
install(TARGETS SubPar | ||
BUNDLE DESTINATION . | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
if(QT_VERSION_MAJOR EQUAL 6) | ||
qt_finalize_executable(SubPar) | ||
endif() |
This file contains 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,3 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE TS> | ||
<TS version="2.1" language="en_IE"></TS> |
This file contains 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,19 @@ | ||
#include "aboutdialog.h" | ||
#include "ui_aboutdialog.h" | ||
#include <QDesktopServices> | ||
#include <QLabel> | ||
|
||
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { | ||
|
||
ui->setupUi(this); | ||
connect( findChild<QLabel*>("linkLabel"), &QLabel::linkActivated, this, &AboutDialog::OpenLink ); | ||
} | ||
|
||
AboutDialog::~AboutDialog() { | ||
delete ui; | ||
} | ||
|
||
void AboutDialog::OpenLink(const QString &link) { | ||
QDesktopServices::openUrl( QUrl("https://www.arcanespire.com/subpar", QUrl::TolerantMode) ); | ||
} | ||
|
This file contains 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,26 @@ | ||
#ifndef ABOUTDIALOG_H | ||
#define ABOUTDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class AboutDialog; | ||
} | ||
|
||
class AboutDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit AboutDialog(QWidget *parent = nullptr); | ||
~AboutDialog(); | ||
|
||
private slots: | ||
|
||
void OpenLink(const QString &link); | ||
|
||
private: | ||
Ui::AboutDialog *ui; | ||
}; | ||
|
||
#endif // ABOUTDIALOG_H |
This file contains 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,138 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>AboutDialog</class> | ||
<widget class="QDialog" name="AboutDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>411</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item alignment="Qt::AlignHCenter"> | ||
<widget class="QLabel" name="label"> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>256</width> | ||
<height>256</height> | ||
</size> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>256</width> | ||
<height>256</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
<property name="pixmap"> | ||
<pixmap resource="assets.qrc">:/icon/images/Icon.png</pixmap> | ||
</property> | ||
<property name="scaledContents"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="font"> | ||
<font> | ||
<pointsize>16</pointsize> | ||
</font> | ||
</property> | ||
<property name="text"> | ||
<string>SubPar</string> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label_3"> | ||
<property name="text"> | ||
<string>version 1.0</string> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="linkLabel"> | ||
<property name="font"> | ||
<font> | ||
<underline>true</underline> | ||
</font> | ||
</property> | ||
<property name="cursor"> | ||
<cursorShape>PointingHandCursor</cursorShape> | ||
</property> | ||
<property name="styleSheet"> | ||
<string notr="true">color: rgb(0, 0, 255)</string> | ||
</property> | ||
<property name="text"> | ||
<string><html><head/><body><p> | ||
<a href="www.arcanespire.com/subpar">www.arcanespire.com/subpar</a></p></body></html></string> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Close</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources> | ||
<include location="assets.qrc"/> | ||
</resources> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>AboutDialog</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>248</x> | ||
<y>254</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>AboutDialog</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>316</x> | ||
<y>260</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
This file contains 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,14 @@ | ||
<RCC> | ||
<qresource prefix="/images"> | ||
<file>images/cog.png</file> | ||
<file>images/logo.gif</file> | ||
<file>images/downloading.png</file> | ||
<file>images/not_found.png</file> | ||
<file>images/searching.png</file> | ||
<file>images/success.png</file> | ||
<file>images/about.png</file> | ||
</qresource> | ||
<qresource prefix="/icon"> | ||
<file>images/Icon.png</file> | ||
</qresource> | ||
</RCC> |
Oops, something went wrong.