Remove unused screensaver classes
This commit is contained in:
@@ -37,7 +37,6 @@ set(SOURCES
|
|||||||
core/qtsystemtrayicon.cpp
|
core/qtsystemtrayicon.cpp
|
||||||
core/standarditemiconloader.cpp
|
core/standarditemiconloader.cpp
|
||||||
core/systemtrayicon.cpp
|
core/systemtrayicon.cpp
|
||||||
core/screensaver.cpp
|
|
||||||
core/scopedtransaction.cpp
|
core/scopedtransaction.cpp
|
||||||
core/translations.cpp
|
core/translations.cpp
|
||||||
|
|
||||||
@@ -596,7 +595,7 @@ if(UNIX AND HAVE_DBUS)
|
|||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
|
||||||
|
|
||||||
optional_source(HAVE_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
|
HEADERS core/mpris.h core/mpris2.h
|
||||||
)
|
)
|
||||||
optional_source(HAVE_UDISKS2
|
optional_source(HAVE_UDISKS2
|
||||||
@@ -861,7 +860,6 @@ optional_source(APPLE
|
|||||||
core/mac_utilities.mm
|
core/mac_utilities.mm
|
||||||
core/mac_startup.mm
|
core/mac_startup.mm
|
||||||
core/macsystemtrayicon.mm
|
core/macsystemtrayicon.mm
|
||||||
core/macscreensaver.cpp
|
|
||||||
core/macfslistener.mm
|
core/macfslistener.mm
|
||||||
osd/osdmac.mm
|
osd/osdmac.mm
|
||||||
widgets/qsearchfield_mac.mm
|
widgets/qsearchfield_mac.mm
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QDBusInterface>
|
|
||||||
#include <QDBusReply>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#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<quint32> 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_);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DBUSSCREENSAVER_H
|
|
||||||
#define DBUSSCREENSAVER_H
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#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
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "macscreensaver.h"
|
|
||||||
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#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_);
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MACSCREENSAVER_H
|
|
||||||
#define MACSCREENSAVER_H
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "screensaver.h"
|
|
||||||
|
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
|
||||||
|
|
||||||
class MacScreensaver : public Screensaver {
|
|
||||||
public:
|
|
||||||
explicit MacScreensaver();
|
|
||||||
|
|
||||||
void Inhibit();
|
|
||||||
void Uninhibit();
|
|
||||||
|
|
||||||
private:
|
|
||||||
IOPMAssertionID assertion_id_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#ifdef HAVE_DBUS
|
|
||||||
# include <QDBusConnection>
|
|
||||||
# include <QDBusConnectionInterface>
|
|
||||||
# include <QDBusReply>
|
|
||||||
# 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_;
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#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
|
|
||||||
Reference in New Issue
Block a user