aboutsummaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/fileloader.cpp22
-rw-r--r--src/ui/fileloader.h50
-rw-r--r--src/ui/mainwindow.cpp2
-rw-r--r--src/ui/playlistitem.cpp22
-rw-r--r--src/ui/playlistitem.h3
-rw-r--r--src/ui/playlistmodel.cpp18
6 files changed, 66 insertions, 51 deletions
diff --git a/src/ui/fileloader.cpp b/src/ui/fileloader.cpp
index 6cf71e3b2..ce5ccb56c 100644
--- a/src/ui/fileloader.cpp
+++ b/src/ui/fileloader.cpp
@@ -43,8 +43,13 @@ void FileLoader::addFiles(const QStringList &files)
foreach(QString s, files)
{
- if (s.startsWith("http://") || Decoder::supports(s))
- emit newPlayListItem(new PlayListItem(s));
+ /*if (s.startsWith("http://") || Decoder::supports(s))
+ {*/
+ //emit newPlayListItem(new PlayListItem(s));
+ QList <FileInfo *> playList = Decoder::createPlayList(s);
+ foreach(FileInfo *info, playList)
+ emit newPlayListItem(new PlayListItem(info));
+ //}
if (m_finished) return;
}
}
@@ -52,6 +57,7 @@ void FileLoader::addFiles(const QStringList &files)
void FileLoader::addDirectory(const QString& s)
{
+ QList <FileInfo *> playList;
QDir dir(s);
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name);
@@ -62,8 +68,13 @@ void FileLoader::addDirectory(const QString& s)
QString suff = fileInfo.completeSuffix();
list << fileInfo;
- if (Decoder::supports(fileInfo.absoluteFilePath ()))
- emit newPlayListItem(new PlayListItem(fileInfo.absoluteFilePath ()));
+ /*if (Decoder::supports(fileInfo.absoluteFilePath ()))
+ {*/
+ playList = Decoder::createPlayList(fileInfo.absoluteFilePath ());
+ foreach(FileInfo *info, playList)
+ emit newPlayListItem(new PlayListItem(info));
+ //emit newPlayListItem(new PlayListItem(fileInfo.absoluteFilePath ()));
+ //}
if (m_finished) return;
}
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
@@ -79,7 +90,6 @@ void FileLoader::addDirectory(const QString& s)
}
}
-
void FileLoader::run()
{
if (!m_files_to_load.isEmpty())
@@ -88,8 +98,6 @@ void FileLoader::run()
addDirectory(m_directory);
}
-
-
void FileLoader::setFilesToLoad(const QStringList & l)
{
m_files_to_load = l;
diff --git a/src/ui/fileloader.h b/src/ui/fileloader.h
index a67ec3567..d2dcc0748 100644
--- a/src/ui/fileloader.h
+++ b/src/ui/fileloader.h
@@ -27,46 +27,46 @@
class PlayListItem;
/*!
- * This class represents fileloader object that
+ * This class represents fileloader object that
* processes file list in separate thread and emits
* \b newPlayListItem(PlayListItem*) signal for every newly
* created media file.
- @author Ilya Kotov <forkotov02@hotmail.ru>
+ @author Ilya Kotov <forkotov02@hotmail.ru>
*/
class FileLoader : public QThread
{
-Q_OBJECT
+ Q_OBJECT
public:
FileLoader(QObject *parent = 0);
~FileLoader();
- virtual void run();
-
- /*!
- * Call this method when you want to notify the thread about finishing
- */
- void finish();
-
- /*!
- * Sets filelist to load( directory to load will be cleaned )
- */
- void setFilesToLoad(const QStringList&);
-
- /*!
- * Sets directory to load( filelist to load will be cleaned )
- */
- void setDirectoryToLoad(const QString&);
+ virtual void run();
+
+ /*!
+ * Call this method when you want to notify the thread about finishing
+ */
+ void finish();
+
+ /*!
+ * Sets filelist to load( directory to load will be cleaned )
+ */
+ void setFilesToLoad(const QStringList&);
+
+ /*!
+ * Sets directory to load( filelist to load will be cleaned )
+ */
+ void setDirectoryToLoad(const QString&);
signals:
- void newPlayListItem(PlayListItem*);
+ void newPlayListItem(PlayListItem*);
protected:
- void addFiles(const QStringList &files);
- void addDirectory(const QString& s);
+ void addFiles(const QStringList &files);
+ void addDirectory(const QString& s);
private:
QFileInfoList list;
QStringList m_filters;
- QStringList m_files_to_load;
- QString m_directory;
- bool m_finished;
+ QStringList m_files_to_load;
+ QString m_directory;
+ bool m_finished;
};
#endif
diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp
index d2e50a98c..1cd0a26d3 100644
--- a/src/ui/mainwindow.cpp
+++ b/src/ui/mainwindow.cpp
@@ -181,7 +181,7 @@ void MainWindow::play()
return;
m_equalizer->loadPreset(m_playListModel->currentItem()->fileName());
- m_playListModel->currentItem()->updateTags();
+ //m_playListModel->currentItem()->updateTags();
m_playlist->listWidget()->updateList();
QString s = m_playListModel->currentItem()->path();
if (s.isEmpty())
diff --git a/src/ui/playlistitem.cpp b/src/ui/playlistitem.cpp
index b5321c8ca..738f8fdae 100644
--- a/src/ui/playlistitem.cpp
+++ b/src/ui/playlistitem.cpp
@@ -29,13 +29,14 @@ PlayListItem::PlayListItem() : SongInfo(), m_flag(FREE)
m_info = 0;
}
-PlayListItem::PlayListItem(const QString& path) : SongInfo(), m_flag(FREE)
+//PlayListItem::PlayListItem(const QString& path) : SongInfo(), m_flag(FREE)
+PlayListItem::PlayListItem(FileInfo *info) : SongInfo(), m_flag(FREE)
{
m_selected = FALSE;
m_current = FALSE;
- m_info = 0;
- setValue(SongInfo::PATH, path);
- setValue(SongInfo::STREAM, path.startsWith("http://")); //TODO do this inside SongInfo
+ 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();
//format
@@ -45,15 +46,15 @@ PlayListItem::PlayListItem(const QString& path) : SongInfo(), m_flag(FREE)
m_convertTwenty = settings.value ("PlayList/convert_twenty", TRUE).toBool();
m_fullStreamPath = settings.value ("PlayList/full_stream_path", FALSE).toBool();
- if (m_use_meta && !path.startsWith("http://"))
+ if (m_use_meta && !path().startsWith("http://"))
{
- m_info = Decoder::createFileInfo(path);
+ //m_info = Decoder::createFileInfo(path);
readMetadata();
}
- else if (path.startsWith("http://") && m_fullStreamPath)
- m_title = path;
+ else if (path().startsWith("http://") && m_fullStreamPath)
+ m_title = path();
else
- m_title = path.split('/',QString::SkipEmptyParts).takeLast ();
+ m_title = path().split('/',QString::SkipEmptyParts).takeLast ();
}
PlayListItem::~PlayListItem()
@@ -111,7 +112,8 @@ void PlayListItem::updateTags()
delete m_info;
m_info = 0;
}
- m_info = Decoder::createFileInfo(path());
+ //m_info = Decoder::createFileInfo(path());
+ m_info = Decoder::createPlayList(path()).at(0);
readMetadata();
}
diff --git a/src/ui/playlistitem.h b/src/ui/playlistitem.h
index 818bc7eeb..29181dcce 100644
--- a/src/ui/playlistitem.h
+++ b/src/ui/playlistitem.h
@@ -39,7 +39,8 @@ public:
*/
enum FLAGS{FREE = 0,EDITING,SCHEDULED_FOR_DELETION};
PlayListItem();
- PlayListItem(const QString& path);
+ //PlayListItem(const QString& path);
+ PlayListItem(FileInfo *info);
~PlayListItem();
diff --git a/src/ui/playlistmodel.cpp b/src/ui/playlistmodel.cpp
index 327b88598..1a92d0bc3 100644
--- a/src/ui/playlistmodel.cpp
+++ b/src/ui/playlistmodel.cpp
@@ -314,10 +314,10 @@ void PlayListModel::showDetails()
str.append(tr("Album:") + " %4\n");
str.append(tr("Comment:") + " %5");
str = str.arg(item->path())
- .arg(item->title().isEmpty() ? item->text() : item->title())
- .arg(item->artist())
- .arg(item->album())
- .arg(item->comment());
+ .arg(item->title().isEmpty() ? item->text() : item->title())
+ .arg(item->artist())
+ .arg(item->album())
+ .arg(item->comment());
QMessageBox::information(0, m_items.at (i)->path(), str);
return;
}
@@ -365,7 +365,8 @@ void PlayListModel::readSettings()
for (int i = 0;i < preload;i++)
{
- load(new PlayListItem(files.takeAt(0)));
+ //TODO load tags from cache
+ load(new PlayListItem(Decoder::createPlayList(files.takeAt(0)).at(0)));
}
if (files.isEmpty())
@@ -398,10 +399,13 @@ void PlayListModel::addFile(const QString& path)
{
if (path.isEmpty ())
return;
- if (path.startsWith("http://"))
+ /*if (path.startsWith("http://"))
load(new PlayListItem(path));
else if (Decoder::supports(path))
- load(new PlayListItem(path));
+ load(new PlayListItem(path));*/
+ QList <FileInfo *> playList = Decoder::createPlayList(path);
+ foreach(FileInfo *info, playList)
+ emit load(new PlayListItem(info));
m_play_state->prepare();
}