[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/graphics/kipi-plugins/advancedslideshow
From: Andi Clemens <andi.clemens () gmx ! net>
Date: 2009-07-31 21:19:34
Message-ID: 1249075174.531273.24928.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1005358 by aclemens:
Use m3u files instead of *.playlist.
We only support the simple m3u format, all metadata from the advanced
version will be skipped.
M +1 -7 listsounditems.cpp
M +26 -9 soundtrackdialog.cpp
--- trunk/extragear/graphics/kipi-plugins/advancedslideshow/listsounditems.cpp \
#1005357:1005358 @@ -49,7 +49,7 @@
: QListWidgetItem(parent)
{
m_url = url;
- setIcon(SmallIcon( "audio-x-generic", KIconLoader::SizeLarge, \
KIconLoader::DisabledState )); + setIcon(SmallIcon("audio-x-generic", \
KIconLoader::SizeLarge, KIconLoader::DisabledState));
m_totalTime = QTime(0, 0, 0);
m_mediaObject = new Phonon::MediaObject();
@@ -61,7 +61,6 @@
SoundItem::~SoundItem()
{
-// delete m_mediaObject;
}
KUrl SoundItem::url()
@@ -109,17 +108,12 @@
return;
long int total = m_mediaObject->totalTime();
-
int hours = (int)(total / (long int)( 60 * 60 * 1000 ));
-
int mins = (int)((total / (long int)( 60 * 1000 )) - (long int)(hours * \
60));
-
int secs = (int)((total / (long int)1000) - (long int)(hours * 60 * 60) - \
(long int)(mins * 60));
-
m_totalTime = QTime(hours, mins, secs);
m_artist = (m_mediaObject->metaData(Phonon::ArtistMetaData)).join(",");
-
m_title = (m_mediaObject->metaData(Phonon::TitleMetaData)).join(",");
if ( m_artist.isEmpty() && m_title.isEmpty() )
--- trunk/extragear/graphics/kipi-plugins/advancedslideshow/soundtrackdialog.cpp \
#1005357:1005358 @@ -181,17 +181,18 @@
void SoundtrackDialog::addItems(const KUrl::List& fileList)
{
- if (fileList.isEmpty()) return;
+ if (fileList.isEmpty())
+ return;
KUrl::List Files = fileList;
- for ( KUrl::List::ConstIterator it = Files.constBegin() ; it != Files.constEnd() \
; ++it ) + for (KUrl::List::ConstIterator it = Files.constBegin(); it != \
Files.constEnd(); ++it) {
KUrl currentFile = *it;
KUrl path = KUrl(currentFile.path().section('/', 0, -1));
m_sharedData->soundtrackPath = path;
- SoundItem *item = new SoundItem( m_SoundFilesListBox, path );
- item->setName( currentFile.path().section('/', -1) );
+ SoundItem *item = new SoundItem(m_SoundFilesListBox, path);
+ item->setName(currentFile.path().section('/', -1));
m_SoundFilesListBox->insertItem(m_SoundFilesListBox->count() - 1, item);
m_soundItems->insert(path, item);
@@ -432,10 +433,13 @@
QPointer<KFileDialog> dlg = new KFileDialog(QString(), QString(), this);
dlg->setOperationMode(KFileDialog::Opening);
dlg->setMode(KFile::File);
- dlg->setFilter(QString("*.playlist|Slideshow Playlist (*.playlist)"));
- dlg->setWindowTitle(i18n("Select playlist file"));
+ dlg->setFilter(QString("*.m3u|Playlist (*.m3u)"));
+ dlg->setWindowTitle(i18n("Load playlist"));
+
if (dlg->exec() != KFileDialog::Accepted)
+ {
return;
+ }
QString filename = dlg->selectedFile();
@@ -449,12 +453,20 @@
while (!in.atEnd())
{
- KUrl fUrl(in.readLine());
+ QString line = in.readLine();
+
+ // we ignore the extended information of the m3u playlist file
+ if (line.startsWith('#') || line.isEmpty())
+ continue;
+
+ KUrl fUrl(line);
if (fUrl.isValid())
+ {
if (fUrl.isLocalFile())
{
playlistFiles << fUrl;
}
+ }
}
if (!playlistFiles.isEmpty())
@@ -474,10 +486,13 @@
QPointer<KFileDialog> dlg = new KFileDialog(QString(), QString(), this);
dlg->setOperationMode(KFileDialog::Saving);
dlg->setMode(KFile::File);
- dlg->setFilter(QString("*.playlist|Slideshow Playlist (*.playlist)"));
- dlg->setWindowTitle(i18n("Save playlist file"));
+ dlg->setFilter(QString("*.m3u|Playlist (*.m3u)"));
+ dlg->setWindowTitle(i18n("Save playlist"));
+
if (dlg->exec() != KFileDialog::Accepted)
+ {
return;
+ }
QString filename = dlg->selectedFile();
@@ -493,10 +508,12 @@
{
KUrl fUrl(playlistFiles.at(i));
if (fUrl.isValid())
+ {
if (fUrl.isLocalFile())
{
out << fUrl.toLocalFile() << endl;
}
+ }
}
file.close();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic