feat: Refactor and improve themes

This commit is contained in:
unknown 2024-07-06 06:27:08 +03:30
parent 2c5d35c4bb
commit 4f96e5efe7
No known key found for this signature in database
GPG Key ID: C2CA486E4F771093
7 changed files with 4 additions and 33 deletions

View File

@ -7,11 +7,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find Qt
if (NOT QT_VERSION_MAJOR)
set(QT_VERSION_MAJOR 6)
endif ()
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network Svg LinguistTools)
find_package(Qt6 REQUIRED COMPONENTS Widgets Network Svg LinguistTools QuickControls2)
if (NKR_CROSS)
set_property(TARGET Qt6::moc PROPERTY IMPORTED_LOCATION /usr/bin/moc)
@ -243,7 +239,7 @@ target_sources(nekoray PRIVATE ${CMAKE_BINARY_DIR}/translations.qrc)
# Target Link
target_link_libraries(nekoray PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Svg
Qt6::Widgets Qt6::Network Qt6::Svg
Threads::Threads
${NKR_EXTERNAL_TARGETS}
${PLATFORM_LIBRARIES}

View File

@ -27,8 +27,8 @@ clean() {
rm -rf dl.zip yaml-* zxing-* protobuf
}
#### ZXing v2.0.0 ####
curl -L -o dl.zip https://github.com/nu-book/zxing-cpp/archive/refs/tags/v2.0.0.zip
#### ZXing v2.2.0 ####
curl -L -o dl.zip https://github.com/nu-book/zxing-cpp/archive/refs/tags/v2.2.0.zip
unzip dl.zip
cd zxing-*

View File

@ -56,13 +56,7 @@ int main(int argc, char* argv[]) {
Windows_SetCrashHandler();
#endif
// pre-init QApplication
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
#endif
QApplication::setQuitOnLastWindowClosed(false);
auto preQApp = new QApplication(argc, argv);
@ -146,12 +140,10 @@ int main(int argc, char* argv[]) {
MF_release_runguard = [&] { guard.release(); };
// icons
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
QIcon::setFallbackSearchPaths(QStringList{
":/nekoray",
":/icon",
});
#endif
// icon for no theme
if (QIcon::themeName().isEmpty()) {

View File

@ -1,7 +0,0 @@
QT=$PWD/qtsdk/5.12.12/gcc_64
BUILD=build-sdk-qt512
rm -rf $BUILD
mkdir -p $BUILD
cd $BUILD
cmake -GNinja -DCMAKE_PREFIX_PATH=$QT ..
ninja

View File

@ -1,5 +0,0 @@
rm -rf build-qt6
mkdir -p build-qt6
cd build-qt6
cmake -GNinja -DQT_VERSION_MAJOR=6 ..
ninja

View File

@ -135,8 +135,6 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
connect(ui->theme, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [=](int index) {
themeManager->ApplyTheme(ui->theme->currentText());
NekoGui::dataStore->theme = ui->theme->currentText();
repaint();
mainwindow->repaint();
NekoGui::dataStore->Save();
});

View File

@ -22,10 +22,7 @@
#include "3rdparty/VT100Parser.hpp"
#include "3rdparty/qv2ray/v2/components/proxy/QvProxyConfigurator.hpp"
#include "3rdparty/qv2ray/v2/ui/LogHighlighter.hpp"
#ifndef NKR_NO_ZXING
#include "3rdparty/ZxingQtReader.hpp"
#endif
#ifdef Q_OS_WIN
#include "3rdparty/WinCommander.hpp"