aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-12-14 15:12:20 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-12-14 15:12:20 +0000
commit92f1159a134f4d9dbd93176107afc48e4f77cb81 (patch)
tree4aa971c42e00d36cc8d588273f3ad0ff6b46fb16 /src/plugins/General
parent8351bd6fbf8b9b6b3360a0cfd6546127794d0b89 (diff)
downloadqmmp-92f1159a134f4d9dbd93176107afc48e4f77cb81.tar.gz
qmmp-92f1159a134f4d9dbd93176107afc48e4f77cb81.tar.bz2
qmmp-92f1159a134f4d9dbd93176107afc48e4f77cb81.zip
fixed saving of the playlist settings (Fixes issue 622)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3960 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General')
-rw-r--r--src/plugins/General/mpris/mpris1/playerobject.cpp19
-rw-r--r--src/plugins/General/mpris/mpris1/playerobject.h6
-rw-r--r--src/plugins/General/mpris/mpris1/tracklistobject.cpp7
-rw-r--r--src/plugins/General/mpris/mpris1/tracklistobject.h4
-rw-r--r--src/plugins/General/mpris/mpris2/player2object.cpp27
-rw-r--r--src/plugins/General/mpris/mpris2/player2object.h2
6 files changed, 38 insertions, 27 deletions
diff --git a/src/plugins/General/mpris/mpris1/playerobject.cpp b/src/plugins/General/mpris/mpris1/playerobject.cpp
index 8d6d0e165..27c9ca9fa 100644
--- a/src/plugins/General/mpris/mpris1/playerobject.cpp
+++ b/src/plugins/General/mpris/mpris1/playerobject.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2009 by Ilya Kotov *
+ * Copyright (C) 2008-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -25,7 +25,7 @@
#include <qmmp/metadatamanager.h>
#include <qmmpui/mediaplayer.h>
#include <qmmpui/playlistmanager.h>
-
+#include <qmmpui/qmmpuisettings.h>
#include "playerobject.h"
@@ -59,12 +59,13 @@ PlayerObject::PlayerObject(QObject *parent) : QObject(parent)
m_core = SoundCore::instance();
m_player = MediaPlayer::instance();
m_pl_manager = m_player->playListManager();
+ m_ui_settings = QmmpUiSettings::instance();
connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateCaps()));
connect(m_core, SIGNAL(metaDataChanged ()), SLOT(updateTrack()));
connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateStatus()));
- connect(m_pl_manager, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus()));
- connect(m_pl_manager, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus()));
- connect(m_player, SIGNAL(repeatableChanged(bool)), SLOT(updateStatus()));
+ connect(m_ui_settings, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus()));
+ connect(m_ui_settings, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus()));
+ connect(m_ui_settings, SIGNAL(repeatableTrackChanged(bool)), SLOT(updateStatus()));
}
PlayerObject::~PlayerObject()
@@ -97,7 +98,7 @@ void PlayerObject::Play()
void PlayerObject::Repeat(bool in0)
{
- m_player->setRepeatable(in0);
+ m_ui_settings->setRepeatableTrack(in0);
}
PlayerStatus PlayerObject::GetStatus()
@@ -117,9 +118,9 @@ PlayerStatus PlayerObject::GetStatus()
case Qmmp::Paused:
st.state = 1;
};
- st.random = int(m_pl_manager->isShuffle());
- st.repeat = int(m_player->isRepeatable());
- st.repeatPlayList = int(m_pl_manager->isRepeatableList());
+ st.random = int(m_ui_settings->isShuffle());
+ st.repeat = int(m_ui_settings->isRepeatableTrack());
+ st.repeatPlayList = int(m_ui_settings->isRepeatableList());
return st;
}
diff --git a/src/plugins/General/mpris/mpris1/playerobject.h b/src/plugins/General/mpris/mpris1/playerobject.h
index 632ca989f..c4f07587e 100644
--- a/src/plugins/General/mpris/mpris1/playerobject.h
+++ b/src/plugins/General/mpris/mpris1/playerobject.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2009 by Ilya Kotov *
+ * Copyright (C) 2008-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -26,6 +26,7 @@
class SoundCore;
class MediaPlayer;
class PlayListManager;
+class QmmpUiSettings;
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
@@ -39,7 +40,7 @@ struct PlayerStatus
int repeatPlayList; // 0 = Stop playing once the last element has been played, 1 = Never give up playing
};
-Q_DECLARE_METATYPE(PlayerStatus);
+Q_DECLARE_METATYPE(PlayerStatus)
class PlayerObject : public QObject
{
@@ -95,6 +96,7 @@ private:
SoundCore *m_core;
MediaPlayer *m_player;
PlayListManager *m_pl_manager;
+ QmmpUiSettings *m_ui_settings;
};
diff --git a/src/plugins/General/mpris/mpris1/tracklistobject.cpp b/src/plugins/General/mpris/mpris1/tracklistobject.cpp
index 0fb498788..c7176c371 100644
--- a/src/plugins/General/mpris/mpris1/tracklistobject.cpp
+++ b/src/plugins/General/mpris/mpris1/tracklistobject.cpp
@@ -24,12 +24,13 @@
#include <qmmpui/playlistmanager.h>
#include <qmmpui/mediaplayer.h>
#include <qmmpui/playlistitem.h>
-
+#include <qmmpui/qmmpuisettings.h>
#include "tracklistobject.h"
TrackListObject::TrackListObject(QObject *parent) : QObject(parent)
{
m_player = MediaPlayer::instance();
+ m_ui_settings = QmmpUiSettings::instance();
m_pl_manager = m_player->playListManager();
m_model = m_pl_manager->currentPlayList();
connect (m_model, SIGNAL(listChanged()), SLOT(updateTrackList()));
@@ -104,12 +105,12 @@ QVariantMap TrackListObject::GetMetadata(int in0)
void TrackListObject::SetLoop(bool in0)
{
- m_pl_manager->setRepeatableList(in0);
+ m_ui_settings->setRepeatableList(in0);
}
void TrackListObject::SetRandom(bool in0)
{
- m_pl_manager->setShuffle(in0);
+ m_ui_settings->setShuffle(in0);
}
void TrackListObject::disconnectPl()
diff --git a/src/plugins/General/mpris/mpris1/tracklistobject.h b/src/plugins/General/mpris/mpris1/tracklistobject.h
index c92844d9f..b7532656a 100644
--- a/src/plugins/General/mpris/mpris1/tracklistobject.h
+++ b/src/plugins/General/mpris/mpris1/tracklistobject.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2009 by Ilya Kotov *
+ * Copyright (C) 2008-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -27,6 +27,7 @@
class PlayListModel;
class PlayListManager;
class MediaPlayer;
+class QmmpUiSettings;
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
@@ -63,6 +64,7 @@ private:
PlayListModel *m_model;
PlayListManager *m_pl_manager;
MediaPlayer *m_player;
+ QmmpUiSettings *m_ui_settings;
int m_prev_count;
};
diff --git a/src/plugins/General/mpris/mpris2/player2object.cpp b/src/plugins/General/mpris/mpris2/player2object.cpp
index 7427e15c4..e7fedac5e 100644
--- a/src/plugins/General/mpris/mpris2/player2object.cpp
+++ b/src/plugins/General/mpris/mpris2/player2object.cpp
@@ -27,6 +27,7 @@
#include <qmmp/metadatamanager.h>
#include <qmmpui/mediaplayer.h>
#include <qmmpui/playlistmanager.h>
+#include <qmmpui/qmmpuisettings.h>
#include "player2object.h"
Player2Object::Player2Object(QObject *parent) : QDBusAbstractAdaptor(parent)
@@ -36,17 +37,18 @@ Player2Object::Player2Object(QObject *parent) : QDBusAbstractAdaptor(parent)
m_core = SoundCore::instance();
m_player = MediaPlayer::instance();
m_pl_manager = m_player->playListManager();
+ m_ui_settings = QmmpUiSettings::instance();
connect(m_core, SIGNAL(metaDataChanged ()), SLOT(updateId()));
connect(m_core, SIGNAL(metaDataChanged ()), SLOT(emitPropertiesChanged()));
connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(checkState(Qmmp::State)));
connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(emitPropertiesChanged()));
connect(m_core, SIGNAL(volumeChanged(int,int)), SLOT(emitPropertiesChanged()));
connect(m_core, SIGNAL(elapsedChanged(qint64)), SLOT(checkSeeking(qint64)));
- connect(m_pl_manager, SIGNAL(repeatableListChanged(bool)), SLOT(emitPropertiesChanged()));
- connect(m_pl_manager, SIGNAL(shuffleChanged(bool)), SLOT(emitPropertiesChanged()));
+ connect(m_ui_settings, SIGNAL(repeatableListChanged(bool)), SLOT(emitPropertiesChanged()));
+ connect(m_ui_settings, SIGNAL(shuffleChanged(bool)), SLOT(emitPropertiesChanged()));
connect(m_pl_manager, SIGNAL(currentPlayListChanged(PlayListModel*,PlayListModel*)),
SLOT(setModel(PlayListModel*,PlayListModel*)));
- connect(m_player, SIGNAL(repeatableChanged(bool)), SLOT(emitPropertiesChanged()));
+ connect(m_ui_settings, SIGNAL(repeatableListChanged(bool)), SLOT(emitPropertiesChanged()));
setModel(m_pl_manager->currentPlayList(), 0);
updateId();
syncProperties();
@@ -86,9 +88,9 @@ bool Player2Object::canSeek() const
QString Player2Object::loopStatus() const
{
- if(m_player->isRepeatable())
+ if(m_ui_settings->isRepeatableTrack())
return "Track";
- else if(m_pl_manager->isRepeatableList())
+ else if(m_ui_settings->isRepeatableList())
return "Playlist";
else
return "None";
@@ -98,17 +100,18 @@ void Player2Object::setLoopStatus(const QString &value)
{
if(value == "Track")
{
- m_player->setRepeatable(true);
+ m_ui_settings->setRepeatableList(false);
+ m_ui_settings->setRepeatableTrack(true);
}
else if(value == "Playlist")
{
- m_pl_manager->setRepeatableList(true);
- m_player->setRepeatable(false);
+ m_ui_settings->setRepeatableList(true);
+ m_ui_settings->setRepeatableTrack(false);
}
else
{
- m_pl_manager->setRepeatableList(false);
- m_player->setRepeatable(false);
+ m_ui_settings->setRepeatableList(false);
+ m_ui_settings->setRepeatableTrack(false);
}
}
@@ -184,12 +187,12 @@ void Player2Object::setRate(double value)
bool Player2Object::shuffle() const
{
- return m_pl_manager->isShuffle();
+ return m_ui_settings->isShuffle();
}
void Player2Object::setShuffle(bool value)
{
- m_pl_manager->setShuffle(value);
+ m_ui_settings->setShuffle(value);
}
double Player2Object::volume() const
diff --git a/src/plugins/General/mpris/mpris2/player2object.h b/src/plugins/General/mpris/mpris2/player2object.h
index 19c7d24e0..f66b55664 100644
--- a/src/plugins/General/mpris/mpris2/player2object.h
+++ b/src/plugins/General/mpris/mpris2/player2object.h
@@ -32,6 +32,7 @@ class MediaPlayer;
class PlayListManager;
class PlayListTrack;
class PlayListModel;
+class QmmpUiSettings;
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
@@ -107,6 +108,7 @@ private:
SoundCore *m_core;
MediaPlayer *m_player;
PlayListManager *m_pl_manager;
+ QmmpUiSettings *m_ui_settings;
QMap<QString, QVariant> m_props;
QDBusObjectPath m_trackID;
PlayListTrack *m_prev_track;