aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-08-15 20:03:29 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-08-15 20:03:29 +0000
commit186d72f60e89b181b7c634768b5fc3c6a2c4056a (patch)
tree6152b0839a2c0757c4db23b4f61b82b8c0dbccbe /src
parentf9bfec087195e864e3cca52a1313c5927c496036 (diff)
downloadqmmp-186d72f60e89b181b7c634768b5fc3c6a2c4056a.tar.gz
qmmp-186d72f60e89b181b7c634768b5fc3c6a2c4056a.tar.bz2
qmmp-186d72f60e89b181b7c634768b5fc3c6a2c4056a.zip
refactoring
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3609 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/qmmpui/playlistmanager.cpp38
-rw-r--r--src/qmmpui/playlistmanager.h1
-rw-r--r--src/qmmpui/qmmpuisettings.cpp8
-rw-r--r--src/qmmpui/qmmpuisettings.h6
4 files changed, 14 insertions, 39 deletions
diff --git a/src/qmmpui/playlistmanager.cpp b/src/qmmpui/playlistmanager.cpp
index 4a2bbfb81..9249dcbf9 100644
--- a/src/qmmpui/playlistmanager.cpp
+++ b/src/qmmpui/playlistmanager.cpp
@@ -44,15 +44,10 @@ PlayListManager::PlayListManager(QObject *parent) : QObject(parent)
m_timer = new QTimer(this);
m_timer->setInterval(5000);
m_timer->setSingleShot(true);
- QmmpUiSettings *ui_settings = QmmpUiSettings::instance();
- connect(ui_settings, SIGNAL(playListSettingsChanged()), SLOT(readSettings()));
+
connect(m_timer, SIGNAL(timeout()), SLOT(writePlayLists()));
readPlayLists(); //read playlists
-
- QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
- setRepeatableList(settings.value("Playlist/repeatable",false).toBool());
- setShuffle(settings.value("Playlist/shuffle",false).toBool());
- readSettings(); //read other settings
+ readSettings(); //read settings
}
PlayListManager::~PlayListManager()
@@ -490,29 +485,20 @@ void PlayListManager::stopAfterSelected()
void PlayListManager::readSettings()
{
- QmmpUiSettings *ui_settings = QmmpUiSettings::instance();
- bool enabled = ui_settings->autoSavePlayList();
- if (m_autosave_playlist != enabled)
- {
- m_autosave_playlist = enabled;
- setAutoSavePlayList();
- }
-}
+ QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
+ setRepeatableList(settings.value("Playlist/repeatable",false).toBool());
+ setShuffle(settings.value("Playlist/shuffle",false).toBool());
-void PlayListManager::setAutoSavePlayList()
-{
- if (m_autosave_playlist)
- {
- foreach(PlayListModel *model, m_models)
- {
- connect(model, SIGNAL(countChanged()), m_timer, SLOT(start()), Qt::UniqueConnection);
- }
- }
- else
+ QmmpUiSettings *ui_settings = QmmpUiSettings::instance();
+ if (m_autosave_playlist != ui_settings->autoSavePlayList())
{
+ m_autosave_playlist = ui_settings->autoSavePlayList();
foreach(PlayListModel *model, m_models)
{
- disconnect(model, SIGNAL(countChanged()), m_timer, SLOT(start()));
+ if (m_autosave_playlist)
+ connect(model, SIGNAL(countChanged()), m_timer, SLOT(start()), Qt::UniqueConnection);
+ else
+ disconnect(model, SIGNAL(countChanged()), m_timer, SLOT(start()));
}
}
}
diff --git a/src/qmmpui/playlistmanager.h b/src/qmmpui/playlistmanager.h
index 3e9a41cab..d543e14fa 100644
--- a/src/qmmpui/playlistmanager.h
+++ b/src/qmmpui/playlistmanager.h
@@ -272,7 +272,6 @@ private slots:
private:
void readPlayLists();
- void setAutoSavePlayList();
static PlayListManager* m_instance;
QList <PlayListModel *> m_models;
PlayListModel *m_current;
diff --git a/src/qmmpui/qmmpuisettings.cpp b/src/qmmpui/qmmpuisettings.cpp
index c6e83d495..cab477ad7 100644
--- a/src/qmmpui/qmmpuisettings.cpp
+++ b/src/qmmpui/qmmpuisettings.cpp
@@ -91,7 +91,6 @@ void QmmpUiSettings::setTitleFormat(const QString &format)
if(format != m_title_format)
{
m_title_format = format;
- emit playListSettingsChanged();
foreach(PlayListModel *model, PlayListManager::instance()->playLists())
{
model->doCurrentVisibleRequest();
@@ -186,11 +185,8 @@ void QmmpUiSettings::setDefaultPlayList(const QString &name, bool enabled)
void QmmpUiSettings::setAutoSavePlayList(bool enabled)
{
- if (autoSavePlayList() != enabled)
- {
- m_autosave_playlist = enabled;
- emit playListSettingsChanged();
- }
+ m_autosave_playlist = enabled;
+ PlayListManager::instance()->readSettings();
}
bool QmmpUiSettings::autoSavePlayList() const
diff --git a/src/qmmpui/qmmpuisettings.h b/src/qmmpui/qmmpuisettings.h
index 965683ae6..45e36feea 100644
--- a/src/qmmpui/qmmpuisettings.h
+++ b/src/qmmpui/qmmpuisettings.h
@@ -147,12 +147,6 @@ public:
*/
static QmmpUiSettings* instance();
-signals:
- /*!
- * Emitted when the playlist settings change.
- */
- void playListSettingsChanged();
-
public slots:
/*!
* Writes all unsaved settings to configuration file