Use sparkle to check for updates on macOS and Windows
This commit is contained in:
parent
b07903c3e9
commit
af0d092054
@ -252,9 +252,20 @@ set(SINGLEAPPLICATION_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/singleap
|
||||
set(SINGLEAPPLICATION_LIBRARIES singleapplication)
|
||||
set(SINGLECOREAPPLICATION_LIBRARIES singlecoreapplication)
|
||||
|
||||
if (APPLE)
|
||||
find_library(SPARKLE Sparkle)
|
||||
endif (APPLE)
|
||||
if(APPLE)
|
||||
find_library(SPARKLE Sparkle PATHS /usr/local/Caskroom/sparkle/1.22.0 NAMES Sparkle Sparkle.framework)
|
||||
endif(APPLE)
|
||||
|
||||
if((NOT SPARKLE) AND (APPLE OR WIN32))
|
||||
if(WITH_QT6)
|
||||
pkg_check_modules(QTSPARKLE qtsparkle-qt6)
|
||||
else()
|
||||
pkg_check_modules(QTSPARKLE qtsparkle-qt5)
|
||||
endif()
|
||||
if(QTSPARKLE_FOUND)
|
||||
set(HAVE_QTSPARKLE ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
# RC compiler
|
||||
|
2
dist/windows/strawberry.nsi.in
vendored
2
dist/windows/strawberry.nsi.in
vendored
@ -223,6 +223,7 @@ Section "Strawberry" Strawberry
|
||||
File "libbrotlidec.dll"
|
||||
File "libpsl-5.dll"
|
||||
File "liborc-0.4-0.dll"
|
||||
File "libqtsparkle-qt5.dll"
|
||||
|
||||
!ifdef arch_x86
|
||||
File "libgcc_s_sjlj-1.dll"
|
||||
@ -452,6 +453,7 @@ Section "Uninstall"
|
||||
Delete "$INSTDIR\libbrotlidec.dll"
|
||||
Delete "$INSTDIR\libpsl-5.dll"
|
||||
Delete "$INSTDIR\liborc-0.4-0.dll"
|
||||
Delete "$INSTDIR\libqtsparkle-qt5.dll"
|
||||
|
||||
!ifdef arch_x86
|
||||
Delete "$INSTDIR\libgcc_s_sjlj-1.dll"
|
||||
|
@ -973,6 +973,7 @@ link_directories(
|
||||
${QT_LIBRARY_DIRS}
|
||||
${SINGLEAPPLICATION_LIBRARY_DIRS}
|
||||
${SINGLECOREAPPLICATION_LIBRARY_DIRS}
|
||||
${QTSPARKLE_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(HAVE_ALSA)
|
||||
@ -1076,6 +1077,7 @@ target_link_libraries(strawberry_lib PUBLIC
|
||||
${QT_LIBRARIES}
|
||||
${SINGLEAPPLICATION_LIBRARIES}
|
||||
${SINGLECOREAPPLICATION_LIBRARIES}
|
||||
${QTSPARKLE_LIBRARIES}
|
||||
libstrawberry-common
|
||||
libstrawberry-tagreader
|
||||
)
|
||||
|
@ -37,6 +37,7 @@
|
||||
#cmakedefine HAVE_LIBMTP
|
||||
#cmakedefine HAVE_LIBPULSE
|
||||
#cmakedefine HAVE_SPARKLE
|
||||
#cmakedefine HAVE_QTSPARKLE
|
||||
#cmakedefine HAVE_CHROMAPRINT
|
||||
#cmakedefine HAVE_GLOBALSHORTCUTS
|
||||
#cmakedefine USE_INSTALL_PREFIX
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
@ -70,6 +71,7 @@
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/closure.h"
|
||||
#include "core/network.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
@ -181,6 +183,10 @@
|
||||
# include "windows7thumbbar.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
# include <qtsparkle-qt5/Updater>
|
||||
#endif
|
||||
|
||||
const char *MainWindow::kSettingsGroup = "MainWindow";
|
||||
const char *MainWindow::kAllFilesFilterSpec = QT_TR_NOOP("All Files (*)");
|
||||
|
||||
@ -681,8 +687,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
thumbbar_->SetActions(QList<QAction*>() << ui_->action_previous_track << ui_->action_play_pause << ui_->action_stop << ui_->action_next_track << nullptr << ui_->action_love);
|
||||
#endif
|
||||
|
||||
#if (defined(Q_OS_MACOS) && defined(HAVE_SPARKLE))
|
||||
// Add check for updates item to application menu.
|
||||
#if defined(HAVE_SPARKLE) || defined(HAVE_QTSPARKLE)
|
||||
QAction *check_updates = ui_->menu_tools->addAction(tr("Check for updates..."));
|
||||
check_updates->setMenuRole(QAction::ApplicationSpecificRole);
|
||||
connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates()));
|
||||
@ -887,6 +892,22 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
||||
app_->scrobbler()->Submit();
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
QUrl sparkle_url;
|
||||
#if defined(Q_OS_MACOS)
|
||||
sparkle_url.setUrl("https://www.strawberrymusicplayer.org/sparkle-macos");
|
||||
#elif defined(Q_OS_WIN)
|
||||
sparkle_url.setUrl("https://www.strawberrymusicplayer.org/sparkle-windows");
|
||||
#endif
|
||||
if (!sparkle_url.isEmpty()) {
|
||||
qLog(Debug) << "Creating Qt Sparkle updater";
|
||||
qtsparkle::Updater *updater = new qtsparkle::Updater(sparkle_url, this);
|
||||
updater->SetNetworkAccessManager(new NetworkAccessManager(this));
|
||||
updater->SetVersion(STRAWBERRY_VERSION_PACKAGE);
|
||||
connect(check_updates, SIGNAL(triggered()), updater, SLOT(CheckNow()));
|
||||
}
|
||||
#endif
|
||||
|
||||
qLog(Debug) << "Started" << QThread::currentThread();
|
||||
initialized_ = true;
|
||||
|
||||
|
@ -77,6 +77,10 @@
|
||||
#include <singleapplication.h>
|
||||
#include <singlecoreapplication.h>
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
# include <qtsparkle-qt5/Updater>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
# include "core/mpris.h"
|
||||
#endif
|
||||
@ -242,6 +246,11 @@ int main(int argc, char* argv[]) {
|
||||
translations->LoadTranslation("strawberry", ":/translations", language);
|
||||
translations->LoadTranslation("strawberry", a.applicationDirPath(), language);
|
||||
translations->LoadTranslation("strawberry", QDir::currentPath(), language);
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
qtsparkle::LoadTranslations(language);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Application app;
|
||||
|
Loading…
x
Reference in New Issue
Block a user