Skip to content

Commit

Permalink
use ff7tk 0.83.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Aug 31, 2022
1 parent 7ac0a18 commit 057080c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ jobs:
install: |
apt-get update -y > /dev/null
apt-get install -qqq ${{env.debianRequirments}} > /dev/null
run: |
curl -s https://api.github.com/repos/sithlord48/ff7tk/releases/latest | awk -F\" '/browser_download_url.*_${{matrix.config.debArch}}*[.deb]/{print $(NF-1)}' | wget -i -
apt -y -f install ./libff7tk*.deb
rm libff7tk*.deb
run: |
git config --global --add safe.directory /home/runner/work/blackchocobo/blackchocobo
${{env.cmakeConfigure}} -DCPACK_PACKAGE_VERSION="${{ needs.precheck.outputs.version }}" -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}}~${{matrix.config.name}}
cmake --build build --config ${{env.BuildType}} --target package
Expand Down
20 changes: 3 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)

cmake_policy(SET CMP0010 NEW)

project( blackchocobo VERSION 1.12.1 DESCRIPTION "Final Fantasy 7 Save Editor")
project( blackchocobo VERSION 1.13.0.0 DESCRIPTION "Final Fantasy 7 Save Editor")
# Get the version from git if it's a git repository
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
FIND_PACKAGE(Git)
Expand Down Expand Up @@ -50,6 +50,7 @@ add_definitions(-DBC_VERSION="${BC_VERSION}")

set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "" FORCE)
set(REQUIRED_QT_VERSION 6.2.0)
set(REQUIRED_FF7TK_VERSION 0.83.0)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
Expand All @@ -62,22 +63,7 @@ else()
set(BIN_NAME "blackchocobo")
endif()

find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS
Core5Compat
Gui
Svg
Quick
Widgets
Xml
)

set(REQUIRED_FF7TK_VERSION 0.82.1)
find_package(ff7tk ${REQUIRED_FF7TK_VERSION} REQUIRED NO_MODULE COMPONENTS
ff7tk
ff7tkQtWidgets
ff7tkWidgets
)

find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core)
get_target_property(qmake_executable Qt6::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY)
if(WIN32 OR APPLE)
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS
Xml
)

find_package(ff7tk 0.82.00 REQUIRED NO_MODULE COMPONENTS
find_package(ff7tk ${REQUIRED_FF7TK_VERSION} REQUIRED NO_MODULE COMPONENTS
ff7tk
ff7tkData
ff7tkQtWidgets
ff7tkWidgets
)

Expand All @@ -20,12 +22,14 @@ if(WIN32)
if(CMAKE_COMPILER_IS_GNUCC)
set (FF7TK_DEPENDS
${ff7tk_DIR}/../../../bin/libff7tk.dll
${ff7tk_DIR}/../../../bin/libff7tkData.dll
${ff7tk_DIR}/../../../bin/libff7tkQtWidgets.dll
${ff7tk_DIR}/../../../bin/libff7tkWidgets.dll
)
else()
set (FF7TK_DEPENDS
${ff7tk_DIR}/../../../bin/ff7tk.dll
${ff7tk_DIR}/../../../bin/ff7tkData.dll
${ff7tk_DIR}/../../../bin/ff7tkQtWidgets.dll
${ff7tk_DIR}/../../../bin/ff7tkWidgets.dll
)
Expand Down
33 changes: 3 additions & 30 deletions src/blackchocobo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "ui_blackchocobo.h"

//ff7tk includes
#include <ff7tkInfo>
#include <FF7Char>
#include <FF7Item>
#include <FF7ItemModel>
Expand Down Expand Up @@ -115,6 +116,7 @@ void BlackChocobo::detectTranslations()
{
m_translations.clear();

QMap<QString, QTranslator *> ff7tk_translations = ff7tkInfo::translations();
QStringList nameFilter ={QStringLiteral("blackchocobo_*.qm")};
QMap<QString, QTranslator *> app_translations;
QDir dir (QStringLiteral("%1").arg(BCSettings::value(SETTINGS::LANGPATH).toString()));
Expand All @@ -128,39 +130,10 @@ void BlackChocobo::detectTranslations()
if (currentLang) {
BCSettings::setValue(SETTINGS::LANG, lang);
QApplication::installTranslator(translator);
QApplication::installTranslator(ff7tk_translations.value(lang));
}
}

QMap<QString, QTranslator *> ff7tk_translations;
nameFilter = QStringList{QStringLiteral("ff7tk_*.qm")};
dir.setPath(QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), QStringLiteral("translations")));
langList = dir.entryList(nameFilter, QDir::Files, QDir::Name);
if (langList.isEmpty()) {
dir.setPath(QStringLiteral("%1/../share/ff7tk/translations").arg(QCoreApplication::applicationDirPath()));
langList = dir.entryList(nameFilter, QDir::Files, QDir::Name);
if(langList.isEmpty()) {
dir.setPath(QStringLiteral("%1/%2").arg(QDir::homePath(), QStringLiteral(".local/share/ff7tk/translations")));
langList = dir.entryList(nameFilter, QDir::Files, QDir::Name);
if(langList.isEmpty()) {
dir.setPath(QStringLiteral("/usr/local/share/ff7tk/translations"));
langList = dir.entryList(nameFilter, QDir::Files, QDir::Name);
if(langList.isEmpty()) {
dir.setPath(QStringLiteral("/usr/share/ff7tk/translations"));
langList = dir.entryList(nameFilter, QDir::Files, QDir::Name);
}
}
}
}
for (const QString &translation : qAsConst(langList)) {
QTranslator *translator = new QTranslator;
std::ignore = translator->load(translation, dir.absolutePath());
QString lang = translation.mid(6, 2);
ff7tk_translations.insert(lang, translator);
bool currentLang = (BCSettings::value(SETTINGS::LANG, QStringLiteral("en")).toString() == lang);
if (currentLang)
QApplication::installTranslator(translator);
}

QMap<QString, QTranslator *> qt_translations;
nameFilter = QStringList{QStringLiteral("qt_*.qm")};
dir.setPath(QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), QStringLiteral("translations")));
Expand Down
1 change: 1 addition & 0 deletions src/dialogs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_link_libraries(BCDIALOGS
Qt::Gui
Qt::Widgets
ff7tk::ff7tk
ff7tk::ff7tkData
ff7tk::ff7tkWidgets
)

4 changes: 2 additions & 2 deletions src/dialogs/about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "about.h"
#include "ui_about.h"

#include <ff7tkAbout>
#include <ff7tkInfo>

About::About(QWidget *parent) :
QDialog(parent),
Expand All @@ -30,7 +30,7 @@ About::About(QWidget *parent) :
ui->lbl_icon->setPixmap(QPixmap(":/icons/common/blackchocobo"));
ui->lbl_name->setText(QCoreApplication::applicationName());
ui->lbl_bc_version->setText(QString(tr("Version: %1")).arg(QCoreApplication::applicationVersion()));
ui->lbl_ff7tk_version->setText(QString(tr("ff7tk: %1")).arg(ff7tk_version()));
ui->lbl_ff7tk_version->setText(QString(tr("ff7tk: %1")).arg(ff7tkInfo::version()));
ui->lbl_qt_version->setText(QString(tr("Qt: %1")).arg(qVersion()));
move(parent->x() + ((parent->width() - width()) / 2), parent->y() + ((parent->sizeHint().height() - height()) / 2));
}
Expand Down
10 changes: 9 additions & 1 deletion src/widgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@ add_library(BCWIDGETS STATIC
partytab.h
)
target_include_directories(BCWIDGETS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(BCWIDGETS PUBLIC Qt::Core Qt::Gui Qt::Widgets ff7tk::ff7tk ff7tk::ff7tkWidgets)
target_link_libraries(BCWIDGETS PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
ff7tk::ff7tk
ff7tk::ff7tkData
ff7tk::ff7tkQtWidgets
ff7tk::ff7tkWidgets
)

0 comments on commit 057080c

Please sign in to comment.