diff --git a/CMakeLists.txt b/CMakeLists.txt index 0195e6b7f..09b20ee15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ if (WIN32) find_package(ZLIB REQUIRED) find_library(MSWMDM_LIBRARIES mswmdm) find_library(SAC_SHIM_LIBRARIES sac_shim) - find_library(WINSPARKLE_LIBRARIES winsparkle) + find_library(QTSPARKLE_LIBRARIES qtsparkle) endif (WIN32) find_library(LASTFM_LIBRARIES lastfm) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4783a1950..a1e68b458 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -889,7 +889,7 @@ set_target_properties(clementine PROPERTIES ) if(WIN32) - target_link_libraries(clementine ${WINSPARKLE_LIBRARIES}) + target_link_libraries(clementine ${QTSPARKLE_LIBRARIES}) endif(WIN32) if (APPLE) diff --git a/src/main.cpp b/src/main.cpp index a65bcfcdc..6c9a12258 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ # define _WIN32_WINNT 0x0500 # include # include -# include #endif // Q_OS_WIN32 #include "config.h" @@ -155,11 +154,6 @@ int main(int argc, char *argv[]) { } #endif -#ifdef Q_OS_WIN32 - win_sparkle_set_appcast_url("http://data.clementine-player.org/winsparkle"); - win_sparkle_init(); -#endif - // This makes us show up nicely in gnome-volume-control g_type_init(); g_set_application_name(QCoreApplication::applicationName().toLocal8Bit()); @@ -287,11 +281,5 @@ int main(int argc, char *argv[]) { QObject::connect(&a, SIGNAL(messageReceived(QByteArray)), &w, SLOT(CommandlineOptionsReceived(QByteArray))); w.CommandlineOptionsReceived(options); - int ret = a.exec(); - -#ifdef Q_OS_WIN32 - win_sparkle_cleanup(); -#endif - - return ret; + return a.exec(); } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index c4eb5001e..7667d64b7 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -26,6 +26,7 @@ #include "core/mergedproxymodel.h" #include "core/modelfuturewatcher.h" #include "core/mpris_common.h" +#include "core/network.h" #include "core/player.h" #include "core/songloader.h" #include "core/stylesheetloader.h" @@ -111,6 +112,10 @@ #include #include +#ifdef Q_OS_WIN32 +# include +#endif + #include @@ -491,14 +496,14 @@ MainWindow::MainWindow(QWidget* parent) connect(tray_icon_, SIGNAL(ShowHide()), SLOT(ToggleShowHide())); connect(tray_icon_, SIGNAL(ChangeVolume(int)), SLOT(VolumeWheelEvent(int))); -#ifdef Q_OS_DARWIN - #ifdef HAVE_SPARKLE - // Add check for updates item to application menu. - QAction* check_updates = ui_->menuTools->addAction(tr("Check for updates...")); - check_updates->setMenuRole(QAction::ApplicationSpecificRole); - connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates())); - #endif +#if (defined(Q_OS_DARWIN) && defined(HAVE_SPARKLE)) || defined(Q_OS_WIN32) + // Add check for updates item to application menu. + QAction* check_updates = ui_->menuTools->addAction(tr("Check for updates...")); + check_updates->setMenuRole(QAction::ApplicationSpecificRole); + connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates())); +#endif +#ifdef Q_OS_DARWIN // Force this menu to be the app "Preferences". ui_->action_configure->setMenuRole(QAction::PreferencesRole); // Force this menu to be the app "About". @@ -507,6 +512,13 @@ MainWindow::MainWindow(QWidget* parent) ui_->action_quit->setMenuRole(QAction::QuitRole); #endif +#ifdef Q_OS_WIN32 + qtsparkle::Updater* updater = new qtsparkle::Updater( + QUrl("http://data.clementine-player.org/sparkle-windows"), this); + updater->SetNetworkAccessManager(new NetworkAccessManager(this)); + connect(check_updates, SIGNAL(triggered()), updater, SLOT(CheckNow())); +#endif + // Global shortcuts connect(global_shortcuts_, SIGNAL(Play()), player_, SLOT(Play())); connect(global_shortcuts_, SIGNAL(Pause()), player_, SLOT(Pause())); @@ -1468,7 +1480,7 @@ bool MainWindow::LoadUrl(const QString& url) { } void MainWindow::CheckForUpdates() { -#ifdef Q_OS_DARWIN +#if defined(Q_OS_DARWIN) mac::CheckForUpdates(); #endif }