Hello,
I've been hacking on the MediaCenter in playground for some time
now, and It has been very interesting. There is really lots of work
already done on it, well done Alessandro and Marco :) I'm writing a
draft proposal which I'll be posting for review after my exams are
over and its reaches good shape (with mockups, etc). Right now, I've
tried to add support of adding a new playlist. It basically lets the
user to add a new playlist and add media to it, but right now there
are some issues with the player not being in sync with it. So-
1. Is the patch ok? Just wanted to make sure I'm heading in the right
direction :)
2. Is it necessary for the media player to have a list of media
internally? Can't we just decide from the playlist applet and tell the
player to play the next media, say, when the current media ends.
Because I think doing this is better and cleaner than keeping both the
playlists in sync (when user switches from one playlist to another)
3. Am I supposed to use the reviewboard for patches for playground? Or
mailing to the list is the right thing?
Thanks
(P.S. I might not reply immediately due to exams, hope thats fine :)
--
Shantanu Tushar (UTC +0530)
http://www.shantanutushar.com
Index: dataengines/playlist/playlist.cpp
===================================================================
--- dataengines/playlist/playlist.cpp (revision 1104231)
+++ dataengines/playlist/playlist.cpp (working copy)
@@ -78,14 +78,14 @@
}
setData(name, Plasma::DataEngine::Data());
- return true;
+ return updateSourceEvent(name);
}
bool PlaylistEngine::updateSourceEvent(const QString &name)
{
int edit = 0;
- kDebug() << "verifying consitence";
+ kDebug() << "verifying consistency";
// if a file in the playlist does not exist anymore
// we remove it from the exposed data.
QHash<QString, QStringList>::Iterator it;
Index: applets/playlist/playlistwidget.cpp
===================================================================
--- applets/playlist/playlistwidget.cpp (revision 1104231)
+++ applets/playlist/playlistwidget.cpp (working copy)
@@ -42,6 +42,7 @@
#include <KDebug>
#include <KConfigGroup>
#include <KComboBox>
+#include <KLineEdit>
#include <KMimeType>
#include <KGlobalSettings>
@@ -54,6 +55,7 @@
#include <Plasma/Delegate>
#include <Plasma/ComboBox>
#include <Plasma/Theme>
+#include <Plasma/LineEdit>
// Taglib
#include <taglib/fileref.h>
@@ -107,9 +109,14 @@
m_playlistEngine->query("New Playlist");
}
+ m_newPlaylistEdit = new Plasma::LineEdit(this);
+ m_newPlaylistEdit->nativeWidget()->setClickMessage("New Playlist...");
+ connect(m_newPlaylistEdit, SIGNAL(editingFinished()), this, SLOT(addNewPlaylist()));
+
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
layout->addItem(m_comboBox);
layout->addItem(proxy);
+ layout->addItem(m_newPlaylistEdit);
setLayout(layout);
setAcceptDrops(true);
@@ -123,6 +130,16 @@
Plasma::DataEngineManager::self()->unloadEngine("coverfetcher");
}
+void PlaylistWidget::addNewPlaylist()
+{
+ if (m_newPlaylistEdit->text().isEmpty()) {
+ return;
+ }
+ QString item(m_newPlaylistEdit->text());
+ m_playlistEngine->query(item);
+ m_comboBox->nativeWidget()->setCurrentItem(item);
+}
+
void PlaylistWidget::showPlaylist(const QString &playlistName)
{
m_playlistEngine->connectSource(playlistName, m_pupdater);
Index: applets/playlist/playlistapplet.cpp
Index: applets/playlist/playlistwidget.h
===================================================================
--- applets/playlist/playlistwidget.h (revision 1104231)
+++ applets/playlist/playlistwidget.h (working copy)
@@ -28,6 +28,7 @@
namespace Plasma {
class TreeView;
class ComboBox;
+ class LineEdit;
}
class QStandardItemModel;
@@ -63,6 +65,7 @@
void removeFromPlaylist(const QModelIndex &index);
void reloadCover(const QModelIndex &index);
void slotMediaActivated(const QModelIndex &index);
+ void addNewPlaylist();
Q_SIGNALS:
void mediaActivated(const MediaCenter::Media &);
@@ -79,6 +82,7 @@
TreeView *m_treeView;
Plasma::ComboBox *m_comboBox;
+ Plasma::LineEdit *m_newPlaylistEdit;
Plasma::DataEngine *m_playlistEngine;
Plasma::DataEngine *m_coverEngine;
QStandardItemModel *m_model;
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel