Change dock item icon to cover
This commit is contained in:
@@ -25,6 +25,7 @@ SET( CANTATA_SRCS
|
||||
gui/updatedialog.cpp
|
||||
gui/covers.cpp
|
||||
gui/interfacesettings.cpp
|
||||
gui/externalsettings.cpp
|
||||
gui/playbacksettings.cpp
|
||||
gui/serversettings.cpp
|
||||
gui/outputsettings.cpp
|
||||
@@ -72,6 +73,7 @@ SET( CANTATA_SRCS
|
||||
network/networkaccessmanager.cpp
|
||||
network/network.cpp
|
||||
dbus/mpris.cpp
|
||||
dbus/dockmanager.cpp
|
||||
)
|
||||
|
||||
SET( CANTATA_MOC_HDRS
|
||||
@@ -91,6 +93,7 @@ SET( CANTATA_MOC_HDRS
|
||||
gui/preferencesdialog.h
|
||||
gui/settings.h
|
||||
gui/interfacesettings.h
|
||||
gui/externalsettings.h
|
||||
models/musiclibrarymodel.h
|
||||
models/musiclibraryproxymodel.h
|
||||
models/playlistsmodel.h
|
||||
@@ -115,6 +118,7 @@ SET( CANTATA_MOC_HDRS
|
||||
network/networkaccessmanager.h
|
||||
network/network.h
|
||||
dbus/mpris.h
|
||||
dbus/dockmanager.h
|
||||
)
|
||||
|
||||
SET( CANTATA_UIS
|
||||
@@ -126,6 +130,7 @@ SET( CANTATA_UIS
|
||||
gui/streamspage.ui
|
||||
gui/serverinfopage.ui
|
||||
gui/interfacesettings.ui
|
||||
gui/externalsettings.ui
|
||||
gui/playbacksettings.ui
|
||||
gui/serversettings.ui
|
||||
gui/outputsettings.ui
|
||||
@@ -156,6 +161,8 @@ FIND_PACKAGE( Qt4 REQUIRED QtCore QtGui QtXml QtNetwork )
|
||||
FIND_PACKAGE( KDE4 )
|
||||
|
||||
qt4_add_dbus_adaptor(CANTATA_SRCS dbus/org.mpris.MediaPlayer2.Player.xml dbus/mpris.h Mpris)
|
||||
qt4_add_dbus_interfaces(CANTATA_SRCS dbus/net.launchpad.DockItem.xml )
|
||||
qt4_add_dbus_interfaces(CANTATA_SRCS dbus/net.launchpad.DockManager.xml)
|
||||
|
||||
configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
actions.
|
||||
6. Add basic MPRISv2 interface - maily so that Cantata can be controlled via
|
||||
IconTasks's media buttons.
|
||||
7. Add option to set icon in dockmanager docks (IconTasks, Docky, DockBarX, etc)
|
||||
to that of the current track.
|
||||
|
||||
0.1.2
|
||||
-----
|
||||
|
||||
132
dbus/dockmanager.cpp
Normal file
132
dbus/dockmanager.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Cantata
|
||||
*
|
||||
* Copyright (c) 2011 Craig Drummond <craig.p.drummond@gmail.com>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "dockmanager.h"
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
DockManager::DockManager(QObject *p)
|
||||
: QObject(p)
|
||||
, isEnabled(false)
|
||||
, mgr(0)
|
||||
, item(0)
|
||||
, watcher(0)
|
||||
{
|
||||
}
|
||||
|
||||
void DockManager::setEnabled(bool e)
|
||||
{
|
||||
if (e==isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
isEnabled=e;
|
||||
if(!isEnabled) {
|
||||
if (watcher) {
|
||||
disconnect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), this, SLOT(serviceOwnerChanged(QString, QString, QString)));
|
||||
watcher->deleteLater();
|
||||
watcher=0;
|
||||
}
|
||||
if (item) {
|
||||
QString old=currentIcon;
|
||||
setIcon(QString());
|
||||
currentIcon=old;
|
||||
item->deleteLater();
|
||||
item = 0;
|
||||
}
|
||||
if (mgr) {
|
||||
mgr->deleteLater();
|
||||
mgr = 0;
|
||||
}
|
||||
} else {
|
||||
watcher = new QDBusServiceWatcher(this);
|
||||
watcher->setConnection(QDBusConnection::sessionBus());
|
||||
watcher->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange);
|
||||
watcher->addWatchedService(net::launchpad::DockManager::staticInterfaceName());
|
||||
connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), this, SLOT(serviceOwnerChanged(QString, QString, QString)));
|
||||
|
||||
QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered(net::launchpad::DockManager::staticInterfaceName());
|
||||
if (reply.isValid() && reply.value()) {
|
||||
serviceOwnerChanged(net::launchpad::DockManager::staticInterfaceName(), QString(), QLatin1String("X"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::setIcon(const QString &file)
|
||||
{
|
||||
currentIcon=file;
|
||||
// If we are unregistering an icon, and the dock manager item does not exist - dont bother connecting!
|
||||
if (file.isEmpty() && !item) {
|
||||
return;
|
||||
}
|
||||
getDockItem();
|
||||
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
QVariantMap settings;
|
||||
settings.insert("icon-file", file);
|
||||
item->UpdateDockItem(settings);
|
||||
}
|
||||
|
||||
void DockManager::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
if (newOwner.isEmpty()) {
|
||||
if (item) {
|
||||
item->deleteLater();
|
||||
item = 0;
|
||||
}
|
||||
if (mgr) {
|
||||
mgr->deleteLater();
|
||||
mgr = 0;
|
||||
}
|
||||
} else if (oldOwner.isEmpty()) {
|
||||
mgr = new net::launchpad::DockManager(net::launchpad::DockManager::staticInterfaceName(), "/net/launchpad/DockManager", QDBusConnection::sessionBus(), this);
|
||||
if (!currentIcon.isEmpty()) {
|
||||
setIcon(currentIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::getDockItem()
|
||||
{
|
||||
if (!mgr || item) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusReply<QList<QDBusObjectPath> > reply = mgr->GetItems();
|
||||
|
||||
if (reply.isValid()) {
|
||||
QList<QDBusObjectPath> paths = reply.value();
|
||||
foreach(const QDBusObjectPath &path, paths) {
|
||||
item = new net::launchpad::DockItem(net::launchpad::DockManager::staticInterfaceName(), path.path(), QDBusConnection::sessionBus(), this);
|
||||
if (item->desktopFile().endsWith("cantata.desktop")) {
|
||||
break;
|
||||
} else {
|
||||
item->deleteLater();
|
||||
item=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
dbus/dockmanager.h
Normal file
55
dbus/dockmanager.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Cantata
|
||||
*
|
||||
* Copyright (c) 2011 Craig Drummond <craig.p.drummond@gmail.com>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef DOCKMANAGER_H
|
||||
#define DOCKMANAGER_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include "dockmanagerinterface.h"
|
||||
#include "dockiteminterface.h"
|
||||
|
||||
class QDBusServiceWatcher;
|
||||
|
||||
class DockManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DockManager(QObject *p);
|
||||
void setEnabled(bool e);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIcon(const QString &file);
|
||||
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
|
||||
|
||||
private:
|
||||
void getDockItem();
|
||||
|
||||
private:
|
||||
bool isEnabled;
|
||||
net::launchpad::DockManager *mgr;
|
||||
net::launchpad::DockItem *item;
|
||||
QDBusServiceWatcher *watcher;
|
||||
QString currentIcon;
|
||||
};
|
||||
|
||||
#endif
|
||||
24
dbus/net.launchpad.DockItem.xml
Normal file
24
dbus/net.launchpad.DockItem.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="net.launchpad.DockItem">
|
||||
<property name="DesktopFile" type="s" access="read"/>
|
||||
<property name="Uri" type="s" access="read"/>
|
||||
<signal name="MenuItemActivated">
|
||||
<arg name="id" type="u" direction="out"/>
|
||||
</signal>
|
||||
<method name="AddMenuItem">
|
||||
<arg type="u" direction="out"/>
|
||||
<arg name="hints" type="a{sv}" direction="in"/>
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
</method>
|
||||
<method name="RemoveMenuItem">
|
||||
<arg name="id" type="u" direction="in"/>
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||
</method>
|
||||
<method name="UpdateDockItem">
|
||||
<arg name="hints" type="a{sv}" direction="in"/>
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
33
dbus/net.launchpad.DockManager.xml
Normal file
33
dbus/net.launchpad.DockManager.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="net.launchpad.DockManager">
|
||||
<signal name="ItemAdded">
|
||||
<arg name="path" type="o" direction="out"/>
|
||||
</signal>
|
||||
<signal name="ItemRemoved">
|
||||
<arg name="path" type="o" direction="out"/>
|
||||
</signal>
|
||||
<method name="GetCapabilities">
|
||||
<arg type="as" direction="out"/>
|
||||
</method>
|
||||
<method name="GetItemByXid">
|
||||
<arg type="o" direction="out"/>
|
||||
<arg name="xid" type="x" direction="in"/>
|
||||
</method>
|
||||
<method name="GetItems">
|
||||
<arg type="ao" direction="out"/>
|
||||
</method>
|
||||
<method name="GetItemsByDesktopFile">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="desktopFile" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="GetItemsByName">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="name" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="GetItemsByPid">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="pid" type="i" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
@@ -66,8 +66,8 @@ AlbumsPage::AlbumsPage(MainWindow *p)
|
||||
connect(view, SIGNAL(searchItems()), this, SLOT(searchItems()));
|
||||
connect(view, SIGNAL(itemsSelected(bool)), addToPlaylist, SLOT(setEnabled(bool)));
|
||||
connect(view, SIGNAL(itemsSelected(bool)), replacePlaylist, SLOT(setEnabled(bool)));
|
||||
connect(Covers::self(), SIGNAL(cover(const QString &, const QString &, const QImage &)),
|
||||
&model, SLOT(setCover(const QString &, const QString &, const QImage &)));
|
||||
connect(Covers::self(), SIGNAL(cover(const QString &, const QString &, const QImage &, const QString &)),
|
||||
&model, SLOT(setCover(const QString &, const QString &, const QImage &, const QString &)));
|
||||
connect(MPDConnection::self(), SIGNAL(updatingLibrary()), view, SLOT(showSpinner()));
|
||||
connect(MPDConnection::self(), SIGNAL(updatedLibrary()), view, SLOT(hideSpinner()));
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void Covers::get(const Song &song)
|
||||
QImage img(dirName+constFileName+ext);
|
||||
|
||||
if (!img.isNull()) {
|
||||
emit cover(song.albumArtist(), song.album, img);
|
||||
emit cover(song.albumArtist(), song.album, img, dirName+constFileName+ext);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ void Covers::get(const Song &song)
|
||||
if (QFile::exists(dir+album+ext)) {
|
||||
QImage img(dir+album+ext);
|
||||
if (!img.isNull()) {
|
||||
emit cover(artist, album, img);
|
||||
emit cover(artist, album, img, dir+album+ext);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void Covers::get(const Song &song)
|
||||
// See if amarok, or clementine, has it...
|
||||
QImage img=otherAppCover(job);
|
||||
if (!img.isNull()) {
|
||||
emit cover(artist, album, img);
|
||||
emit cover(artist, album, img, QString());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ void Covers::albumInfo(QVariant &value, QNetworkReply *reply)
|
||||
jobs.remove(it.key());
|
||||
jobs.insert(manager->get(QNetworkRequest(u)), job);
|
||||
} else {
|
||||
emit cover(job.artist, job.album, QImage());
|
||||
emit cover(job.artist, job.album, QImage(), QString());
|
||||
}
|
||||
}
|
||||
reply->deleteLater();
|
||||
@@ -276,7 +276,7 @@ void Covers::albumFailure(int, const QString &, QNetworkReply *reply)
|
||||
|
||||
if (it!=end) {
|
||||
Job job=it.value();
|
||||
emit cover(job.artist, job.album, otherAppCover(job));
|
||||
emit cover(job.artist, job.album, otherAppCover(job), QString());
|
||||
jobs.remove(it.key());
|
||||
}
|
||||
|
||||
@@ -291,6 +291,7 @@ void Covers::jobFinished(QNetworkReply *reply)
|
||||
if (it!=end) {
|
||||
QByteArray data=QNetworkReply::NoError==reply->error() ? reply->readAll() : QByteArray();
|
||||
QImage img = data.isEmpty() ? QImage() : QImage::fromData(data);
|
||||
QString fileName;
|
||||
Job job=it.value();
|
||||
|
||||
if (!img.isNull() && img.size().width()<32) {
|
||||
@@ -298,36 +299,40 @@ void Covers::jobFinished(QNetworkReply *reply)
|
||||
}
|
||||
|
||||
if (!img.isNull()) {
|
||||
saveImg(job, img, data);
|
||||
fileName=saveImg(job, img, data);
|
||||
}
|
||||
|
||||
jobs.remove(it.key());
|
||||
|
||||
if (img.isNull()) {
|
||||
emit cover(job.artist, job.album, otherAppCover(job));
|
||||
emit cover(job.artist, job.album, otherAppCover(job), QString());
|
||||
} else {
|
||||
emit cover(job.artist, job.album, img);
|
||||
emit cover(job.artist, job.album, img, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
void Covers::saveImg(const Job &job, const QImage &img, const QByteArray &raw)
|
||||
QString Covers::saveImg(const Job &job, const QImage &img, const QByteArray &raw)
|
||||
{
|
||||
QString mimeType=typeFromRaw(raw);
|
||||
QString extension=mimeType.isEmpty() ? constExtension : mimeType;
|
||||
|
||||
// Try to save as cover.jpg in album dir...
|
||||
if (!job.dir.isEmpty() && save(mimeType, extension, job.dir+constFileName, img, raw)) {
|
||||
return;
|
||||
return job.dir+constFileName;
|
||||
}
|
||||
|
||||
// Could not save with album, save in cache dir...
|
||||
// Could not save with album, save in cache dir...
|
||||
QString dir = Network::cacheDir(constCoverDir+encodeName(job.artist));
|
||||
if (!dir.isEmpty()) {
|
||||
save(mimeType, extension, dir+encodeName(job.album), img, raw);
|
||||
if (save(mimeType, extension, dir+encodeName(job.album), img, raw)) {
|
||||
return dir+encodeName(job.album);
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QHash<QNetworkReply *, Covers::Job>::Iterator Covers::findJob(const Song &song)
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void setMpdDir(const QString &dir) { mpdDir=dir; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void cover(const QString &artist, const QString &album, const QImage &img);
|
||||
void cover(const QString &artist, const QString &album, const QImage &img, const QString &file);
|
||||
|
||||
private Q_SLOTS:
|
||||
void albumInfo(QVariant &value, QNetworkReply *reply);
|
||||
@@ -63,7 +63,7 @@ private Q_SLOTS:
|
||||
void jobFinished(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
void saveImg(const Job &job, const QImage &img, const QByteArray &raw);
|
||||
QString saveImg(const Job &job, const QImage &img, const QByteArray &raw);
|
||||
QHash<QNetworkReply *, Job>::Iterator findJob(const Song &song);
|
||||
|
||||
private:
|
||||
|
||||
48
gui/externalsettings.cpp
Normal file
48
gui/externalsettings.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Cantata
|
||||
*
|
||||
* Copyright (c) 2011 Craig Drummond <craig.p.drummond@gmail.com>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "externalsettings.h"
|
||||
#include "settings.h"
|
||||
#include <QtGui/QCheckBox>
|
||||
|
||||
ExternalSettings::ExternalSettings(QWidget *p)
|
||||
: QWidget(p)
|
||||
{
|
||||
setupUi(this);
|
||||
};
|
||||
|
||||
void ExternalSettings::load()
|
||||
{
|
||||
systemTrayCheckBox->setChecked(Settings::self()->useSystemTray());
|
||||
systemTrayPopup->setChecked(Settings::self()->showPopups());
|
||||
mpris->setChecked(Settings::self()->mpris());
|
||||
dockManager->setChecked(Settings::self()->dockManager());
|
||||
}
|
||||
|
||||
void ExternalSettings::save()
|
||||
{
|
||||
Settings::self()->saveUseSystemTray(systemTrayCheckBox->isChecked());
|
||||
Settings::self()->saveShowPopups(systemTrayPopup->isChecked());
|
||||
Settings::self()->saveMpris(mpris->isChecked());
|
||||
Settings::self()->saveDockManager(dockManager->isChecked());
|
||||
}
|
||||
41
gui/externalsettings.h
Normal file
41
gui/externalsettings.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Cantata
|
||||
*
|
||||
* Copyright (c) 2011 Craig Drummond <craig.p.drummond@gmail.com>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef EXTERNALSETTINGS_H
|
||||
#define EXTERNALSETTINGS_H
|
||||
|
||||
#include "ui_externalsettings.h"
|
||||
|
||||
class ExternalSettings : public QWidget, private Ui::ExternalSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExternalSettings(QWidget *p);
|
||||
virtual ~ExternalSettings() { }
|
||||
|
||||
void load();
|
||||
void save();
|
||||
};
|
||||
|
||||
#endif
|
||||
101
gui/externalsettings.ui
Normal file
101
gui/externalsettings.ui
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExternalSettings</class>
|
||||
<widget class="QWidget" name="ExternalSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>368</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Show icon in notification area:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>systemTrayCheckBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="systemTrayCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Show popup up messages when changing tracks:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>systemTrayPopup</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="systemTrayPopup">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5b">
|
||||
<property name="text">
|
||||
<string>Enable basic MPRISv2 interface:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mpris</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="mpris">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5c">
|
||||
<property name="text">
|
||||
<string>Use current cover as dock icon:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>dockManager</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="dockManager">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>systemTrayCheckBox</tabstop>
|
||||
<tabstop>systemTrayPopup</tabstop>
|
||||
<tabstop>mpris</tabstop>
|
||||
<tabstop>dockManager</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "settings.h"
|
||||
#include "itemview.h"
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QCheckBox>
|
||||
|
||||
InterfaceSettings::InterfaceSettings(QWidget *p)
|
||||
: QWidget(p)
|
||||
@@ -36,8 +37,6 @@ InterfaceSettings::InterfaceSettings(QWidget *p)
|
||||
|
||||
void InterfaceSettings::load()
|
||||
{
|
||||
systemTrayCheckBox->setChecked(Settings::self()->useSystemTray());
|
||||
systemTrayPopup->setChecked(Settings::self()->showPopups());
|
||||
libraryView->setCurrentIndex(Settings::self()->libraryView());
|
||||
libraryCoverSize->setCurrentIndex(Settings::self()->libraryCoverSize());
|
||||
libraryYear->setChecked(Settings::self()->libraryYear());
|
||||
@@ -51,8 +50,6 @@ void InterfaceSettings::load()
|
||||
|
||||
void InterfaceSettings::save()
|
||||
{
|
||||
Settings::self()->saveUseSystemTray(systemTrayCheckBox->isChecked());
|
||||
Settings::self()->saveShowPopups(systemTrayPopup->isChecked());
|
||||
Settings::self()->saveLibraryView(libraryView->currentIndex());
|
||||
Settings::self()->saveLibraryCoverSize(libraryCoverSize->currentIndex());
|
||||
Settings::self()->saveLibraryYear(libraryYear->isChecked());
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define INTERFACESETTINGS_H
|
||||
|
||||
#include "ui_interfacesettings.h"
|
||||
#include <QtGui/QCheckBox>
|
||||
|
||||
class InterfaceSettings : public QWidget, private Ui::InterfaceSettings
|
||||
{
|
||||
@@ -37,7 +36,6 @@ public:
|
||||
|
||||
void load();
|
||||
void save();
|
||||
bool sysTrayEnabled() const { return systemTrayCheckBox->isChecked(); }
|
||||
|
||||
private Q_SLOTS:
|
||||
void albumsViewChanged();
|
||||
|
||||
@@ -7,51 +7,17 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>368</width>
|
||||
<height>275</height>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Show icon in notification area:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>systemTrayCheckBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="systemTrayCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Show popup up messages when changing tracks:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>systemTrayPopup</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="systemTrayPopup">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Library view:</string>
|
||||
@@ -61,7 +27,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="libraryView">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -75,7 +41,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5b">
|
||||
<property name="text">
|
||||
<string>Covers in library view:</string>
|
||||
@@ -85,7 +51,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="libraryCoverSize">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -109,7 +75,41 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Show album year in library view:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>libraryYear</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="libraryYear">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Group single track albums:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>groupSingle</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="groupSingle">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3a">
|
||||
<property name="text">
|
||||
<string>Albums view:</string>
|
||||
@@ -119,7 +119,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="albumsView">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -138,7 +138,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5c">
|
||||
<property name="text">
|
||||
<string>Covers in albums view:</string>
|
||||
@@ -148,7 +148,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="albumsCoverSize">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -172,7 +172,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Folder view:</string>
|
||||
@@ -182,7 +182,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="folderView">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -196,7 +196,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Playlists view:</string>
|
||||
@@ -206,7 +206,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="playlistsView">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -220,7 +220,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_x">
|
||||
<property name="text">
|
||||
<string>Streams view:</string>
|
||||
@@ -230,7 +230,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="streamsView">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -244,45 +244,9 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Show album year in library view:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>libraryYear</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="libraryYear">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Group single track albums:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>groupSingle</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="groupSingle">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>systemTrayCheckBox</tabstop>
|
||||
<tabstop>systemTrayPopup</tabstop>
|
||||
<tabstop>libraryView</tabstop>
|
||||
<tabstop>libraryCoverSize</tabstop>
|
||||
<tabstop>libraryYear</tabstop>
|
||||
|
||||
@@ -61,8 +61,8 @@ LibraryPage::LibraryPage(MainWindow *p)
|
||||
connect(MPDConnection::self(), SIGNAL(musicLibraryUpdated(MusicLibraryItemRoot *, QDateTime)), &model, SLOT(updateMusicLibrary(MusicLibraryItemRoot *, QDateTime)));
|
||||
connect(MPDConnection::self(), SIGNAL(updatingLibrary()), view, SLOT(showSpinner()));
|
||||
connect(MPDConnection::self(), SIGNAL(updatedLibrary()), view, SLOT(hideSpinner()));
|
||||
connect(Covers::self(), SIGNAL(cover(const QString &, const QString &, const QImage &)),
|
||||
&model, SLOT(setCover(const QString &, const QString &, const QImage &)));
|
||||
connect(Covers::self(), SIGNAL(cover(const QString &, const QString &, const QImage &, const QString &)),
|
||||
&model, SLOT(setCover(const QString &, const QString &, const QImage &, const QString &)));
|
||||
connect(&model, SIGNAL(updateGenres(const QStringList &)), this, SLOT(updateGenres(const QStringList &)));
|
||||
connect(this, SIGNAL(listAllInfo(const QDateTime &)), MPDConnection::self(), SLOT(listAllInfo(const QDateTime &)));
|
||||
connect(view, SIGNAL(itemsSelected(bool)), addToPlaylist, SLOT(setEnabled(bool)));
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "fancytabwidget.h"
|
||||
#include "timeslider.h"
|
||||
#include "mpris.h"
|
||||
#include "dockmanager.h"
|
||||
|
||||
class ProxyStyle : public QProxyStyle
|
||||
{
|
||||
@@ -224,7 +225,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
lastSongId(-1),
|
||||
fetchStatsFactor(0),
|
||||
nowPlayingFactor(0),
|
||||
draggingPositionSlider(false)
|
||||
draggingPositionSlider(false),
|
||||
dock(0),
|
||||
mpris(0)
|
||||
{
|
||||
loaded=0;
|
||||
updateDialog = 0;
|
||||
@@ -459,8 +462,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
|
||||
menuButton->setIcon(QIcon::fromTheme("configure"));
|
||||
volumeButton->setIcon(QIcon::fromTheme("player-volume"));
|
||||
connect(Covers::self(), SIGNAL(cover(const QString &, const QString &, const QImage &)),
|
||||
SLOT(cover(const QString &, const QString &, const QImage &)));
|
||||
connect(Covers::self(), SIGNAL(cover(const QString &, const QString &, const QImage &, const QString &)),
|
||||
SLOT(cover(const QString &, const QString &, const QImage &, const QString &)));
|
||||
|
||||
menuButton->setMenu(mainMenu);
|
||||
menuButton->setPopupMode(QToolButton::InstantPopup);
|
||||
@@ -731,7 +734,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
folderPage->setView(0==Settings::self()->folderView());
|
||||
currentTabChanged(tabWidget->current_index());
|
||||
playlistsPage->refresh();
|
||||
new Mpris(this);
|
||||
toggleMpris();
|
||||
toggleDockManager();
|
||||
}
|
||||
|
||||
struct Thread : public QThread
|
||||
@@ -741,6 +745,9 @@ struct Thread : public QThread
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if (dock) {
|
||||
dock->setIcon(QString());
|
||||
}
|
||||
#ifndef ENABLE_KDE_SUPPORT
|
||||
Settings::self()->saveMainWindowSize(size());
|
||||
#endif
|
||||
@@ -962,6 +969,8 @@ void MainWindow::updateSettings()
|
||||
folderPage->setView(0==Settings::self()->folderView());
|
||||
|
||||
setupTrayIcon();
|
||||
toggleDockManager();
|
||||
toggleMpris();
|
||||
}
|
||||
|
||||
#ifndef ENABLE_KDE_SUPPORT
|
||||
@@ -1716,13 +1725,15 @@ bool MainWindow::currentIsStream()
|
||||
return !current.title.isEmpty() && (current.file.isEmpty() || current.file.contains("://"));
|
||||
}
|
||||
|
||||
void MainWindow::cover(const QString &artist, const QString &album, const QImage &img)
|
||||
void MainWindow::cover(const QString &artist, const QString &album, const QImage &img, const QString &file)
|
||||
{
|
||||
if (artist==current.albumArtist() && album==current.album) {
|
||||
if (img.isNull()) {
|
||||
coverWidget->setPixmap(currentIsStream() ? noStreamCover : noCover);
|
||||
emit coverFile(QString());
|
||||
} else {
|
||||
coverWidget->setPixmap(QPixmap::fromImage(img).scaled(coverWidget->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
emit coverFile(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1731,3 +1742,28 @@ void MainWindow::showTab(int page)
|
||||
{
|
||||
tabWidget->SetCurrentIndex(page);
|
||||
}
|
||||
|
||||
void MainWindow::toggleMpris()
|
||||
{
|
||||
bool on=Settings::self()->mpris();
|
||||
if (on) {
|
||||
if (!mpris) {
|
||||
mpris=new Mpris(this);
|
||||
}
|
||||
} else {
|
||||
if (mpris) {
|
||||
mpris->deleteLater();
|
||||
mpris=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggleDockManager()
|
||||
{
|
||||
if (!dock) {
|
||||
dock=new DockManager(this);
|
||||
connect(this, SIGNAL(coverFile(const QString &)), dock, SLOT(setIcon(const QString &)));
|
||||
}
|
||||
|
||||
dock->setEnabled(Settings::self()->dockManager());
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ class InfoPage;
|
||||
class ServerInfoPage;
|
||||
class QThread;
|
||||
class QAbstractItemView;
|
||||
class DockManager;
|
||||
class Mpris;
|
||||
|
||||
class DeleteKeyEventHandler : public QObject
|
||||
{
|
||||
@@ -186,6 +188,8 @@ Q_SIGNALS:
|
||||
void setSeekId(quint32, quint32);
|
||||
void startPlayingSongId(quint32);
|
||||
|
||||
void coverFile(const QString &);
|
||||
|
||||
public Q_SLOTS:
|
||||
void showError(const QString &message);
|
||||
|
||||
@@ -236,7 +240,7 @@ private Q_SLOTS:
|
||||
void copyTrackInfo();
|
||||
void togglePlaylist();
|
||||
void currentTabChanged(int index);
|
||||
void cover(const QString &artist, const QString &album, const QImage &img);
|
||||
void cover(const QString &artist, const QString &album, const QImage &img, const QString &file);
|
||||
void showLibraryTab() { showTab(PAGE_LIBRARY); }
|
||||
void showAlbumsTab() { showTab(PAGE_ALBUMS); }
|
||||
void showFoldersTab() { showTab(PAGE_FOLDERS); }
|
||||
@@ -245,6 +249,8 @@ private Q_SLOTS:
|
||||
void showLyricsTab() { showTab(PAGE_LYRICS); }
|
||||
void showInfoTab() { showTab(PAGE_INFO); }
|
||||
void showServerInfoTab() { showTab(PAGE_SERVER_INFO); }
|
||||
void toggleMpris();
|
||||
void toggleDockManager();
|
||||
|
||||
private:
|
||||
bool currentIsStream();
|
||||
@@ -333,6 +339,8 @@ private:
|
||||
#endif
|
||||
ServerInfoPage *serverInfoPage;
|
||||
QThread *mpdThread;
|
||||
DockManager *dock;
|
||||
Mpris *mpris;
|
||||
friend class VolumeSliderEventHandler;
|
||||
// friend class CoverEventHandler;
|
||||
friend class LibraryPage;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "settings.h"
|
||||
#include "interfacesettings.h"
|
||||
#include "externalsettings.h"
|
||||
#include "playbacksettings.h"
|
||||
#include "outputsettings.h"
|
||||
#include "serversettings.h"
|
||||
@@ -85,11 +86,13 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, LyricsPage *lp)
|
||||
playback = new PlaybackSettings(widget);
|
||||
output = new OutputSettings(widget);
|
||||
interface = new InterfaceSettings(widget);
|
||||
ext = new ExternalSettings(widget);
|
||||
lyrics = new LyricSettings(widget);
|
||||
server->load();
|
||||
playback->load();
|
||||
output->load();
|
||||
interface->load();
|
||||
ext->load();
|
||||
const QList<UltimateLyricsProvider *> &lprov=lp->getProviders();
|
||||
lyrics->Load(lprov);
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
@@ -105,6 +108,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, LyricsPage *lp)
|
||||
page=widget->addPage(interface, i18n("Interface"));
|
||||
page->setHeader(i18n("Interface Settings"));
|
||||
page->setIcon(KIcon("preferences-desktop-color"));
|
||||
page=widget->addPage(ext, i18n("External"));
|
||||
page->setHeader(i18n("External Settings"));
|
||||
page->setIcon(KIcon("video-display"));
|
||||
page=widget->addPage(lyrics, i18n("Lyrics"));
|
||||
page->setHeader(i18n("Lyrics Settings"));
|
||||
page->setIcon(KIcon("view-media-lyrics"));
|
||||
@@ -121,6 +127,8 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, LyricsPage *lp)
|
||||
QIcon::fromTheme("speaker"), tr("Output"));
|
||||
widget->AddTab(new ConfigPage(this, tr("Interface Settings"), QIcon::fromTheme("preferences-desktop-color"), interface),
|
||||
QIcon::fromTheme("preferences-desktop-color"), tr("Interface"));
|
||||
widget->AddTab(new ConfigPage(this, tr("External Settings"), QIcon::fromTheme("video-display"), ext),
|
||||
QIcon::fromTheme("video-display"), tr("External"));
|
||||
widget->AddTab(new ConfigPage(this, tr("Lyrics Settings"), QIcon::fromTheme("view-media-lyrics"), lyrics),
|
||||
QIcon::fromTheme("view-media-lyrics"), tr("Lyrics"));
|
||||
proxy = new ProxySettings(this);
|
||||
@@ -149,6 +157,7 @@ void PreferencesDialog::writeSettings()
|
||||
playback->save();
|
||||
output->save();
|
||||
interface->save();
|
||||
ext->save();
|
||||
#ifndef ENABLE_KDE_SUPPORT
|
||||
proxy->save();
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,7 @@ class OutputSettings;
|
||||
class InterfaceSettings;
|
||||
class LyricSettings;
|
||||
class LyricsPage;
|
||||
class ExternalSettings;
|
||||
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
class PreferencesDialog : public KDialog
|
||||
@@ -70,6 +71,7 @@ private:
|
||||
PlaybackSettings *playback;
|
||||
OutputSettings *output;
|
||||
InterfaceSettings *interface;
|
||||
ExternalSettings *ext;
|
||||
LyricSettings *lyrics;
|
||||
#ifndef ENABLE_KDE_SUPPORT
|
||||
QDialogButtonBox *buttonBox;
|
||||
|
||||
@@ -269,6 +269,16 @@ QStringList Settings::hiddenPages()
|
||||
return GET_STRINGLIST("hiddenPages", def);
|
||||
}
|
||||
|
||||
bool Settings::mpris()
|
||||
{
|
||||
return GET_BOOL("mpris", false);
|
||||
}
|
||||
|
||||
bool Settings::dockManager()
|
||||
{
|
||||
return GET_BOOL("dockManager", false);
|
||||
}
|
||||
|
||||
void Settings::saveConnectionHost(const QString &v)
|
||||
{
|
||||
SET_VALUE("connectionHost", v);
|
||||
@@ -421,6 +431,16 @@ void Settings::saveHiddenPages(const QStringList &p)
|
||||
SET_VALUE("hiddenPages", p);
|
||||
}
|
||||
|
||||
void Settings::saveMpris(bool v)
|
||||
{
|
||||
SET_VALUE("mpris", v);
|
||||
}
|
||||
|
||||
void Settings::saveDockManager(bool v)
|
||||
{
|
||||
SET_VALUE("dockManager", v);
|
||||
}
|
||||
|
||||
void Settings::save(bool force)
|
||||
{
|
||||
if (force) {
|
||||
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
QStringList lyricProviders();
|
||||
QString page();
|
||||
QStringList hiddenPages();
|
||||
bool mpris();
|
||||
bool dockManager();
|
||||
|
||||
void saveConnectionHost(const QString &v);
|
||||
void saveConnectionPasswd(const QString &v);
|
||||
@@ -102,6 +104,8 @@ public:
|
||||
void saveLyricProviders(const QStringList &p);
|
||||
void savePage(const QString &v);
|
||||
void saveHiddenPages(const QStringList &p);
|
||||
void saveMpris(bool v);
|
||||
void saveDockManager(bool v);
|
||||
void save(bool force=false);
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
bool openWallet();
|
||||
|
||||
@@ -385,8 +385,9 @@ void AlbumsModel::update(const MusicLibraryItemRoot *root)
|
||||
}
|
||||
}
|
||||
|
||||
void AlbumsModel::setCover(const QString &artist, const QString &album, const QImage &img)
|
||||
void AlbumsModel::setCover(const QString &artist, const QString &album, const QImage &img, const QString &file)
|
||||
{
|
||||
Q_UNUSED(file)
|
||||
if (img.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ Q_SIGNALS:
|
||||
void updated();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCover(const QString &artist, const QString &album, const QImage &img);
|
||||
void setCover(const QString &artist, const QString &album, const QImage &img, const QString &file);
|
||||
|
||||
private:
|
||||
mutable QList<AlbumItem *> items;
|
||||
|
||||
@@ -289,8 +289,9 @@ void MusicLibraryModel::updateMusicLibrary(MusicLibraryItemRoot *newroot, QDateT
|
||||
emit updateGenres(genres);
|
||||
}
|
||||
|
||||
void MusicLibraryModel::setCover(const QString &artist, const QString &album, const QImage &img)
|
||||
void MusicLibraryModel::setCover(const QString &artist, const QString &album, const QImage &img, const QString &file)
|
||||
{
|
||||
Q_UNUSED(file)
|
||||
if (MusicLibraryItemAlbum::CoverNone==MusicLibraryItemAlbum::currentCoverSize()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateMusicLibrary(MusicLibraryItemRoot * root, QDateTime db_update = QDateTime(), bool fromFile = false);
|
||||
void setCover(const QString &artist, const QString &album, const QImage &img);
|
||||
void setCover(const QString &artist, const QString &album, const QImage &img, const QString &file);
|
||||
|
||||
Q_SIGNALS:
|
||||
void xmlWritten(QDateTime db_update);
|
||||
|
||||
Reference in New Issue
Block a user