diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef9bab962..d48ce62b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,7 +37,6 @@ set(SOURCES core/qtsystemtrayicon.cpp core/standarditemiconloader.cpp core/systemtrayicon.cpp - core/screensaver.cpp core/scopedtransaction.cpp core/translations.cpp @@ -596,7 +595,7 @@ if(UNIX AND HAVE_DBUS) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus) optional_source(HAVE_DBUS - SOURCES core/mpris.cpp core/mpris2.cpp core/dbusscreensaver.cpp + SOURCES core/mpris.cpp core/mpris2.cpp HEADERS core/mpris.h core/mpris2.h ) optional_source(HAVE_UDISKS2 @@ -861,7 +860,6 @@ optional_source(APPLE core/mac_utilities.mm core/mac_startup.mm core/macsystemtrayicon.mm - core/macscreensaver.cpp core/macfslistener.mm osd/osdmac.mm widgets/qsearchfield_mac.mm diff --git a/src/core/dbusscreensaver.cpp b/src/core/dbusscreensaver.cpp deleted file mode 100644 index bce2dc47d..000000000 --- a/src/core/dbusscreensaver.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * - * Strawberry is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Strawberry is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Strawberry. If not, see . - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "dbusscreensaver.h" - -DBusScreensaver::DBusScreensaver(const QString &service, const QString &path, const QString &interface) - : service_(service), path_(path), interface_(interface) {} - -void DBusScreensaver::Inhibit() { - - QDBusInterface gnome_screensaver("org.gnome.ScreenSaver", "/", "org.gnome.ScreenSaver"); - QDBusReply reply = gnome_screensaver.call("Inhibit", QCoreApplication::applicationName(), QObject::tr("Visualizations")); - if (reply.isValid()) { - cookie_ = reply.value(); - } - -} - -void DBusScreensaver::Uninhibit() { - - QDBusInterface gnome_screensaver("org.gnome.ScreenSaver", "/", "org.gnome.ScreenSaver"); - gnome_screensaver.call("UnInhibit", cookie_); - -} diff --git a/src/core/dbusscreensaver.h b/src/core/dbusscreensaver.h deleted file mode 100644 index 76f92f946..000000000 --- a/src/core/dbusscreensaver.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * - * Strawberry is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Strawberry is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Strawberry. If not, see . - * - */ - -#ifndef DBUSSCREENSAVER_H -#define DBUSSCREENSAVER_H - -#include "config.h" - -#include -#include - -#include "screensaver.h" - -class DBusScreensaver : public Screensaver { - public: - explicit DBusScreensaver(const QString &service, const QString &path, const QString &interface); - - void Inhibit() override; - void Uninhibit() override; - -private: - QString service_; - QString path_; - QString interface_; - - quint32 cookie_; -}; - -#endif diff --git a/src/core/macscreensaver.cpp b/src/core/macscreensaver.cpp deleted file mode 100644 index 77eef8c62..000000000 --- a/src/core/macscreensaver.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * - * Strawberry is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Strawberry is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Strawberry. If not, see . - * - */ - -#include "config.h" - -#include "macscreensaver.h" - -#include - -#include "core/utilities.h" -#include "core/mac_utilities.h" - -// kIOPMAssertionTypePreventUserIdleDisplaySleep from Lion. -#define kLionDisplayAssertion CFSTR("PreventUserIdleDisplaySleep") - -MacScreensaver::MacScreensaver() : assertion_id_(0) {} - -void MacScreensaver::Inhibit() { - CFStringRef assertion_type = (Utilities::GetMacOsVersion() >= 7) ? kLionDisplayAssertion : kIOPMAssertionTypeNoDisplaySleep; - - IOPMAssertionCreateWithName( - assertion_type, - kIOPMAssertionLevelOn, - CFSTR("Showing full-screen Strawberry visualisations"), - &assertion_id_); -} - -void MacScreensaver::Uninhibit() { - IOPMAssertionRelease(assertion_id_); -} diff --git a/src/core/macscreensaver.h b/src/core/macscreensaver.h deleted file mode 100644 index 26255c4c5..000000000 --- a/src/core/macscreensaver.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * - * Strawberry is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Strawberry is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Strawberry. If not, see . - * - */ - -#ifndef MACSCREENSAVER_H -#define MACSCREENSAVER_H - -#include "config.h" - -#include "screensaver.h" - -#include - -class MacScreensaver : public Screensaver { - public: - explicit MacScreensaver(); - - void Inhibit(); - void Uninhibit(); - - private: - IOPMAssertionID assertion_id_; -}; - -#endif diff --git a/src/core/screensaver.cpp b/src/core/screensaver.cpp deleted file mode 100644 index 7395ab649..000000000 --- a/src/core/screensaver.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * - * Strawberry is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Strawberry is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Strawberry. If not, see . - * - */ - -#include "config.h" - -#include - -#ifdef HAVE_DBUS -# include -# include -# include -# include "dbusscreensaver.h" -#endif - -#include "screensaver.h" - -#ifdef Q_OS_MACOS - #include "macscreensaver.h" -#endif - -const char *Screensaver::kGnomeService = "org.gnome.ScreenSaver"; -const char *Screensaver::kGnomePath = "/"; -const char *Screensaver::kGnomeInterface = "org.gnome.ScreenSaver"; -const char *Screensaver::kKdeService = "org.kde.ScreenSaver"; -const char *Screensaver::kKdePath = "/ScreenSaver/"; -const char *Screensaver::kKdeInterface = "org.freedesktop.ScreenSaver"; - -Screensaver *Screensaver::screensaver_ = nullptr; - -Screensaver *Screensaver::GetScreensaver() { - if (!screensaver_) { - #if defined(HAVE_DBUS) - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kGnomeService)) { - screensaver_ = new DBusScreensaver(kGnomeService, kGnomePath, kGnomeInterface); - } - else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) { - screensaver_ = new DBusScreensaver(kKdeService, kKdePath, kKdeInterface); - } - #elif defined(Q_OS_MACOS) - screensaver_ = new MacScreensaver(); - #endif - } - return screensaver_; -} diff --git a/src/core/screensaver.h b/src/core/screensaver.h deleted file mode 100644 index c8fec06d3..000000000 --- a/src/core/screensaver.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Strawberry Music Player - * This file was part of Clementine. - * Copyright 2010, David Sansome - * - * Strawberry is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Strawberry is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Strawberry. If not, see . - * - */ - -#ifndef SCREENSAVER_H -#define SCREENSAVER_H - -#include "config.h" - -class Screensaver { - public: - virtual ~Screensaver() {} - - static const char *kGnomeService; - static const char *kGnomePath; - static const char *kGnomeInterface; - - static const char *kKdeService; - static const char *kKdePath; - static const char *kKdeInterface; - - virtual void Inhibit() = 0; - virtual void Uninhibit() = 0; - - static Screensaver *GetScreensaver(); - - private: - static Screensaver *screensaver_; -}; - -#endif