commit
9a161a0335
@ -99,7 +99,7 @@ if ((CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI
|
||||
message(STATUS "Address Sanitizer enabled for Debug builds, Turn it off with -DDEBUG_ADDRESS_SANITIZER=off")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
# using clang with clang-cl front end
|
||||
# using clang with clang-cl front end
|
||||
message(STATUS "Address Sanitizer available on Clang MSVC frontend")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address /Oy-")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address /Oy-")
|
||||
@ -225,7 +225,7 @@ set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build agains
|
||||
# Java downloader
|
||||
set(Launcher_ENABLE_JAVA_DOWNLOADER_DEFAULT ON)
|
||||
|
||||
# Although we recommend enabling this, we cannot guarantee binary compatibility on
|
||||
# Although we recommend enabling this, we cannot guarantee binary compatibility on
|
||||
# differing Linux/BSD/etc distributions. Downstream packagers should be explicitly opt-ing into this
|
||||
# feature if they know it will work with their distribution.
|
||||
if(UNIX AND NOT APPLE)
|
||||
@ -438,10 +438,10 @@ elseif(UNIX)
|
||||
set(PLUGIN_DEST_DIR "plugins")
|
||||
set(BUNDLE_DEST_DIR ".")
|
||||
set(RESOURCES_DEST_DIR ".")
|
||||
|
||||
|
||||
# Apps to bundle
|
||||
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${Launcher_APP_BINARY_NAME}")
|
||||
|
||||
|
||||
# directories to look for dependencies
|
||||
set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
endif()
|
||||
@ -495,7 +495,7 @@ if(FORCE_BUNDLED_ZLIB)
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
add_subdirectory(libraries/zlib EXCLUDE_FROM_ALL)
|
||||
|
||||
# On OS where unistd.h exists, zlib's generated header defines `Z_HAVE_UNISTD_H`, while the included header does not.
|
||||
# On OS where unistd.h exists, zlib's generated header defines `Z_HAVE_UNISTD_H`, while the included header does not.
|
||||
# We cannot safely undo the rename on those systems, and they generally have packages for zlib anyway.
|
||||
check_include_file(unistd.h NEED_GENERATED_ZCONF)
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib/zconf.h.included" AND NOT NEED_GENERATED_ZCONF)
|
||||
@ -532,10 +532,12 @@ else()
|
||||
endif()
|
||||
if(NOT cmark_FOUND)
|
||||
message(STATUS "Using bundled cmark")
|
||||
set(ORIGINAL_BUILD_TESTING ${BUILD_TESTING})
|
||||
set(BUILD_TESTING 0)
|
||||
set(BUILD_SHARED_LIBS 0)
|
||||
set(BUILD_SHARED_LIBS 0)
|
||||
add_subdirectory(libraries/cmark EXCLUDE_FROM_ALL) # Markdown parser
|
||||
add_library(cmark::cmark ALIAS cmark)
|
||||
set(BUILD_TESTING ${ORIGINAL_BUILD_TESTING})
|
||||
else()
|
||||
message(STATUS "Using system cmark")
|
||||
endif()
|
||||
|
@ -81,6 +81,12 @@ class Index;
|
||||
#endif
|
||||
#define APPLICATION (static_cast<Application*>(QCoreApplication::instance()))
|
||||
|
||||
// Used for checking if is a test
|
||||
#if defined(APPLICATION_DYN)
|
||||
#undef APPLICATION_DYN
|
||||
#endif
|
||||
#define APPLICATION_DYN (dynamic_cast<Application*>(QCoreApplication::instance()))
|
||||
|
||||
class Application : public QApplication {
|
||||
// friends for the purpose of limiting access to deprecated stuff
|
||||
Q_OBJECT
|
||||
|
@ -608,7 +608,7 @@ set(PRISMUPDATER_SOURCES
|
||||
updater/prismupdater/UpdaterDialogs.cpp
|
||||
updater/prismupdater/GitHubRelease.h
|
||||
updater/prismupdater/GitHubRelease.cpp
|
||||
|
||||
|
||||
Json.h
|
||||
Json.cpp
|
||||
FileSystem.h
|
||||
@ -625,7 +625,7 @@ set(PRISMUPDATER_SOURCES
|
||||
# Zip
|
||||
MMCZip.h
|
||||
MMCZip.cpp
|
||||
|
||||
|
||||
# Time
|
||||
MMCTime.h
|
||||
MMCTime.cpp
|
||||
@ -1265,14 +1265,10 @@ include(CompilerWarnings)
|
||||
|
||||
# Add executable
|
||||
add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHER_UI} ${LAUNCHER_RESOURCES})
|
||||
if(BUILD_TESTING)
|
||||
target_compile_definitions(Launcher_logic PUBLIC LAUNCHER_TEST)
|
||||
endif()
|
||||
set_project_warnings(Launcher_logic
|
||||
"${Launcher_MSVC_WARNINGS}"
|
||||
"${Launcher_CLANG_WARNINGS}"
|
||||
"${Launcher_GCC_WARNINGS}")
|
||||
target_compile_definitions(Launcher_logic PUBLIC LAUNCHER_APPLICATION)
|
||||
target_include_directories(Launcher_logic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_compile_definitions(Launcher_logic PUBLIC LAUNCHER_APPLICATION)
|
||||
target_link_libraries(Launcher_logic
|
||||
@ -1376,7 +1372,7 @@ if(Launcher_BUILD_UPDATER)
|
||||
add_executable("${Launcher_Name}_updater" WIN32 updater/prismupdater/updater_main.cpp)
|
||||
target_sources("${Launcher_Name}_updater" PRIVATE updater/prismupdater/updater.exe.manifest)
|
||||
target_link_libraries("${Launcher_Name}_updater" prism_updater_logic)
|
||||
|
||||
|
||||
if(DEFINED Launcher_APP_BINARY_NAME)
|
||||
set_target_properties("${Launcher_Name}_updater" PROPERTIES OUTPUT_NAME "${Launcher_APP_BINARY_NAME}_updater")
|
||||
endif()
|
||||
|
@ -35,10 +35,9 @@ ResourceFolderModel::ResourceFolderModel(QDir dir, BaseInstance* instance, QObje
|
||||
|
||||
connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &ResourceFolderModel::directoryChanged);
|
||||
connect(&m_helper_thread_task, &ConcurrentTask::finished, this, [this] { m_helper_thread_task.clear(); });
|
||||
#ifndef LAUNCHER_TEST
|
||||
// in tests the application macro doesn't work
|
||||
m_helper_thread_task.setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
#endif
|
||||
if (APPLICATION_DYN) { // in tests the application macro doesn't work
|
||||
m_helper_thread_task.setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
}
|
||||
}
|
||||
|
||||
ResourceFolderModel::~ResourceFolderModel()
|
||||
|
@ -48,7 +48,7 @@ NetJob::NetJob(QString job_name, shared_qobject_ptr<QNetworkAccessManager> netwo
|
||||
: ConcurrentTask(nullptr, job_name), m_network(network)
|
||||
{
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
if (max_concurrent < 0)
|
||||
if (APPLICATION_DYN && max_concurrent < 0)
|
||||
max_concurrent = APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt();
|
||||
#endif
|
||||
if (max_concurrent > 0)
|
||||
@ -161,7 +161,8 @@ bool NetJob::isOnline()
|
||||
void NetJob::emitFailed(QString reason)
|
||||
{
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
if (m_ask_retry && m_manual_try < APPLICATION->settings()->get("NumberOfManualRetries").toInt() && isOnline()) {
|
||||
|
||||
if (APPLICATION_DYN && m_ask_retry && m_manual_try < APPLICATION->settings()->get("NumberOfManualRetries").toInt() && isOnline()) {
|
||||
m_manual_try++;
|
||||
auto response = CustomMessageBox::selectable(nullptr, "Confirm retry",
|
||||
"The tasks failed.\n"
|
||||
|
@ -31,9 +31,9 @@ QHash<ResourceModel*, bool> ResourceModel::s_running_models;
|
||||
ResourceModel::ResourceModel(ResourceAPI* api) : QAbstractListModel(), m_api(api)
|
||||
{
|
||||
s_running_models.insert(this, true);
|
||||
#ifndef LAUNCHER_TEST
|
||||
m_current_info_job.setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
#endif
|
||||
if (APPLICATION_DYN) {
|
||||
m_current_info_job.setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
|
||||
}
|
||||
}
|
||||
|
||||
ResourceModel::~ResourceModel()
|
||||
@ -60,11 +60,15 @@ auto ResourceModel::data(const QModelIndex& index, int role) const -> QVariant
|
||||
return pack->description;
|
||||
}
|
||||
case Qt::DecorationRole: {
|
||||
if (auto icon_or_none = const_cast<ResourceModel*>(this)->getIcon(const_cast<QModelIndex&>(index), pack->logoUrl);
|
||||
icon_or_none.has_value())
|
||||
return icon_or_none.value();
|
||||
if (APPLICATION_DYN) {
|
||||
if (auto icon_or_none = const_cast<ResourceModel*>(this)->getIcon(const_cast<QModelIndex&>(index), pack->logoUrl);
|
||||
icon_or_none.has_value())
|
||||
return icon_or_none.value();
|
||||
|
||||
return APPLICATION->getThemedIcon("screenshot-placeholder");
|
||||
return APPLICATION->getThemedIcon("screenshot-placeholder");
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
case Qt::SizeHintRole:
|
||||
return QSize(0, 58);
|
||||
|
Loading…
Reference in New Issue
Block a user