From ae7155e169382587679fd0b0eb85cf9c442501e0 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 11 Oct 2008 19:49:30 +0000 Subject: optimized startup process, removed useless debug message git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@579 90c681e8-e032-0410-971d-27865f9a5e38 --- src/ui/playlistitem.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/ui/playlistitem.cpp') diff --git a/src/ui/playlistitem.cpp b/src/ui/playlistitem.cpp index 738f8fdae..f287ec0f5 100644 --- a/src/ui/playlistitem.cpp +++ b/src/ui/playlistitem.cpp @@ -30,21 +30,28 @@ PlayListItem::PlayListItem() : SongInfo(), m_flag(FREE) } //PlayListItem::PlayListItem(const QString& path) : SongInfo(), m_flag(FREE) -PlayListItem::PlayListItem(FileInfo *info) : SongInfo(), m_flag(FREE) +PlayListItem::PlayListItem(FileInfo *info, QSettings *settings) : SongInfo(), m_flag(FREE) { m_selected = FALSE; m_current = FALSE; m_info = info; setValue(SongInfo::PATH, info->path()); //TODO path? setValue(SongInfo::STREAM, path().startsWith("http://")); //TODO do this inside SongInfo - QSettings settings ( QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat ); - m_use_meta = settings.value ("PlayList/load_metadata", TRUE).toBool(); + + //use external settings or create new + QSettings *s = settings; + if (!s) + s = new QSettings (QDir::homePath() +"/.qmmp/qmmprc", QSettings::IniFormat); + + m_use_meta = s->value ("PlayList/load_metadata", TRUE).toBool(); //TODO move to libqmmp //format - m_format = settings.value("PlayList/title_format", "%p - %t").toString(); + m_format = s->value("PlayList/title_format", "%p - %t").toString(); //other properties - m_convertUnderscore = settings.value ("PlayList/convert_underscore", TRUE).toBool(); - m_convertTwenty = settings.value ("PlayList/convert_twenty", TRUE).toBool(); - m_fullStreamPath = settings.value ("PlayList/full_stream_path", FALSE).toBool(); + m_convertUnderscore = s->value ("PlayList/convert_underscore", TRUE).toBool(); + m_convertTwenty = s->value ("PlayList/convert_twenty", TRUE).toBool(); + m_fullStreamPath = s->value ("PlayList/full_stream_path", FALSE).toBool(); + if (!settings) //delete created settings only + delete s; if (m_use_meta && !path().startsWith("http://")) { -- cgit v1.2.3-13-gbd6f