From 60d3696ccd38204a01e365ab8ea4f27a5043517b Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 18 May 2018 14:45:29 +0200 Subject: [PATCH 1/3] Settings: Add warning when switching update channel --- src/gui/generalsettings.cpp | 49 +++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 789bc27b39..16658f8a34 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -294,18 +295,46 @@ void GeneralSettings::slotUpdateInfo() void GeneralSettings::slotUpdateChannelChanged(const QString &channel) { - ConfigFile().setUpdateChannel(channel); - auto *updater = qobject_cast(Updater::instance()); - if (updater) { - updater->setUpdateUrl(Updater::updateUrl()); - updater->checkForUpdate(); - } + if (channel == ConfigFile().updateChannel()) + return; + + auto msgBox = new QMessageBox( + QMessageBox::Warning, + tr("Change update channel?"), + tr("The update channel determines which client updates will be offered " + "for installation. The \"stable\" channel contains only upgrades that " + "are considered reliable, while the versions in the \"beta\" channel " + "may contain newer features and bugfixes, but have not yet been tested " + "thoroughly." + "\n\n" + "Note that this selects only what pool upgrades are taken from, and that " + "there are no downgrades: So going back from the beta channel to " + "the stable channel usually cannot be done immediately and means waiting " + "for a stable version that is newer than the currently installed beta " + "version."), + QMessageBox::NoButton, + this); + msgBox->addButton(tr("Change update channel"), QMessageBox::AcceptRole); + msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole); + connect(msgBox, &QMessageBox::finished, msgBox, [this, channel, msgBox](int result) { + msgBox->deleteLater(); + if (result == QMessageBox::AcceptRole) { + ConfigFile().setUpdateChannel(channel); + if (auto updater = qobject_cast(Updater::instance())) { + updater->setUpdateUrl(Updater::updateUrl()); + updater->checkForUpdate(); + } #ifdef Q_OS_MAC - else if (auto *updater = qobject_cast(Updater::instance())) { - updater->setUpdateUrl(Updater::updateUrl()); - updater->checkForUpdate(); - } + else if (auto updater = qobject_cast(Updater::instance())) { + updater->setUpdateUrl(Updater::updateUrl()); + updater->checkForUpdate(); + } #endif + } else { + _ui->updateChannel->setCurrentText(ConfigFile().updateChannel()); + } + }); + msgBox->open(); } void GeneralSettings::slotUpdateCheckNow() From 6962cbf582b4432508c0bb127dd7230868f93884 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Sat, 2 Jun 2018 20:58:33 +0800 Subject: [PATCH 2/3] Fix build without Sparkle.framework (PR #6567) --- src/gui/generalsettings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 16658f8a34..2b37a20533 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -280,7 +280,7 @@ void GeneralSettings::slotUpdateInfo() _ui->autoCheckForUpdatesCheckBox->setChecked(ConfigFile().autoUpdateCheck()); } -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE) else if (auto sparkleUpdater = qobject_cast(Updater::instance())) { _ui->updateStateLabel->setText(sparkleUpdater->statusString()); _ui->restartButton->setVisible(false); @@ -324,7 +324,7 @@ void GeneralSettings::slotUpdateChannelChanged(const QString &channel) updater->setUpdateUrl(Updater::updateUrl()); updater->checkForUpdate(); } -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE) else if (auto updater = qobject_cast(Updater::instance())) { updater->setUpdateUrl(Updater::updateUrl()); updater->checkForUpdate(); From a50c6650515251cd4dff86fc2275f8e16b710870 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Wed, 25 Nov 2020 09:43:59 +0100 Subject: [PATCH 3/3] Simplify Sparkle handling in CMake --- cmake/modules/FindSparkle.cmake | 8 +++----- src/gui/CMakeLists.txt | 15 +++++++++++---- src/libsync/CMakeLists.txt | 8 -------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/cmake/modules/FindSparkle.cmake b/cmake/modules/FindSparkle.cmake index 2c1e1944d5..2b0c75b95d 100644 --- a/cmake/modules/FindSparkle.cmake +++ b/cmake/modules/FindSparkle.cmake @@ -2,8 +2,7 @@ # # Once done this will define # SPARKLE_FOUND - system has Sparkle -# SPARKLE_INCLUDE_DIR - the Sparkle include directory -# SPARKLE_LIBRARY - The library needed to use Sparkle +# SPARKLE_LIBRARY - The framework needed to use Sparkle # Copyright (c) 2009, Vittorio Giovara # # Distributed under the OSI-approved BSD License (the "License"); @@ -15,9 +14,8 @@ include(FindPackageHandleStandardArgs) -find_path(SPARKLE_INCLUDE_DIR Sparkle.h) find_library(SPARKLE_LIBRARY NAMES Sparkle) -find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY) -mark_as_advanced(SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY) +find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_LIBRARY) +mark_as_advanced(SPARKLE_LIBRARY) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 93929fa73d..5a49920e03 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -161,9 +161,16 @@ IF( APPLE ) list(APPEND client_SRCS systray.mm) if(SPARKLE_FOUND AND BUILD_UPDATER) - # Define this, we need to check in updater.cpp - add_definitions( -DHAVE_SPARKLE ) - list(APPEND updater_SRCS updater/sparkleupdater_mac.mm updater/sparkleupdater.h) + # Define this, we need to check in updater.cpp + add_definitions(-DHAVE_SPARKLE) + list(APPEND updater_SRCS updater/sparkleupdater_mac.mm updater/sparkleupdater.h) + list(APPEND updater_DEPS ${SPARKLE_LIBRARY}) + + # Sparkle.framework is installed from here because macdeployqt's CopyFramework breaks on this bundle + # as its logic is tightly tailored around Qt5 frameworks + install(DIRECTORY "${SPARKLE_LIBRARY}" + DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks" USE_SOURCE_PERMISSIONS) + endif() ENDIF() @@ -309,7 +316,7 @@ endif() IF(BUILD_UPDATER) add_library(updater STATIC ${updater_SRCS}) - target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml) + target_link_libraries(updater ${synclib_NAME} ${updater_DEPS} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml) target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) endif() diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt index d7957dab88..0bcbe40ec5 100644 --- a/src/libsync/CMakeLists.txt +++ b/src/libsync/CMakeLists.txt @@ -15,10 +15,6 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|OpenBSD") ) ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|OpenBSD") -if(SPARKLE_FOUND AND NOT BUILD_LIBRARIES_ONLY) - list (APPEND OS_SPECIFIC_LINK_LIBRARIES ${SPARKLE_LIBRARY}) -endif() - set(libsync_SRCS account.cpp wordlist.cpp @@ -141,10 +137,6 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) ) else() install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS) - if (SPARKLE_FOUND) - install(DIRECTORY "${SPARKLE_LIBRARY}" - DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks" USE_SOURCE_PERMISSIONS) - endif (SPARKLE_FOUND) endif()