Hello community, here is the log from the commit of package juk for openSUSE:Factory checked in at 2013-07-22 16:42:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/juk (Old) and /work/SRC/openSUSE:Factory/.juk.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "juk" Changes: -------- --- /work/SRC/openSUSE:Factory/juk/juk.changes 2013-07-08 07:31:58.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.juk.new/juk.changes 2013-07-22 16:42:15.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Jul 15 08:12:30 UTC 2013 - [email protected] + +- Update to 4.10.95 + * KDE 4.11 RC 1 release + * See http://www.kde.org/announcements/announce-4.11-rc1.php + +------------------------------------------------------------------- Old: ---- juk-4.10.90.tar.xz New: ---- juk-4.10.95.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ juk.spec ++++++ --- /var/tmp/diff_new_pack.i0TmVO/_old 2013-07-22 16:42:16.000000000 +0200 +++ /var/tmp/diff_new_pack.i0TmVO/_new 2013-07-22 16:42:16.000000000 +0200 @@ -25,7 +25,7 @@ License: GPL-2.0+ Group: Productivity/Multimedia/Sound/Players Url: http://www.kde.org -Version: 4.10.90 +Version: 4.10.95 Release: 0 Source0: %{name}-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ juk-4.10.90.tar.xz -> juk-4.10.95.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/cache.cpp new/juk-4.10.95/cache.cpp --- old/juk-4.10.90/cache.cpp 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/cache.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -3,8 +3,8 @@ copyright : (C) 2002 - 2004 by Scott Wheeler email : [email protected] - copyright : (C) 2008 by Michael Pyne - email : [email protected] + copyright : (C) 2008, 2013 by Michael Pyne + email : [email protected] ***************************************************************************/ /*************************************************************************** @@ -40,7 +40,8 @@ using namespace ActionCollection; -static const int playlistCacheVersion = 3; +const int Cache::playlistListCacheVersion = 3; +const int Cache::playlistItemsCacheVersion = 2; enum PlaylistType { @@ -58,53 +59,9 @@ Cache *Cache::instance() { static Cache cache; - - // load() indirectly calls instance() so we have to protect against recursion. - static bool loaded = false; - - if(!loaded) { - loaded = true; - cache.load(); - } - return &cache; } -void Cache::save() -{ - QString dirName = KGlobal::dirs()->saveLocation("appdata"); - QString cacheFileName = dirName + "cache"; - - KSaveFile f(cacheFileName); - - if(!f.open(QIODevice::WriteOnly)) { - kError() << "Error saving cache:" << f.errorString(); - return; - } - - QByteArray data; - QDataStream s(&data, QIODevice::WriteOnly); - s.setVersion(QDataStream::Qt_4_3); - - for(Iterator it = begin(); it != end(); ++it) { - s << (*it).absFilePath(); - s << *it; - } - - QDataStream fs(&f); - - qint32 checksum = qChecksum(data.data(), data.size()); - - fs << qint32(m_currentVersion) - << checksum - << data; - - f.close(); - - if(!f.finalize()) - kError() << "Error saving cache:" << f.errorString(); -} - void Cache::loadPlaylists(PlaylistCollection *collection) // static { QString playlistsFile = KGlobal::dirs()->saveLocation("appdata") + "playlists"; @@ -318,7 +275,7 @@ } QDataStream fs(&f); - fs << qint32(playlistCacheVersion); + fs << qint32(playlistListCacheVersion); fs << qChecksum(data.data(), data.size()); fs << data; @@ -334,33 +291,28 @@ } //////////////////////////////////////////////////////////////////////////////// -// protected methods +// private methods //////////////////////////////////////////////////////////////////////////////// -Cache::Cache() : FileHandleHash() +Cache::Cache() { } -void Cache::load() +bool Cache::prepareToLoadCachedItems() { QString cacheFileName = KGlobal::dirs()->saveLocation("appdata") + "cache"; - QFile f(cacheFileName); + m_loadFile.setFileName(cacheFileName); + if(!m_loadFile.open(QIODevice::ReadOnly)) + return false; - if(!f.open(QIODevice::ReadOnly)) - return; + m_loadDataStream.setDevice(&m_loadFile); - CacheDataStream s(&f); int dataStreamVersion = CacheDataStream::Qt_3_3; qint32 version; - s >> version; - - QBuffer buffer; - QByteArray data; - - // Do the version specific stuff. + m_loadDataStream >> version; switch(version) { case 2: @@ -370,46 +322,68 @@ // to setCacheVersion case 1: { - s.setCacheVersion(1); - s.setVersion(dataStreamVersion); + m_loadDataStream.setCacheVersion(1); + m_loadDataStream.setVersion(dataStreamVersion); qint32 checksum; - s >> checksum - >> data; + m_loadDataStream >> checksum + >> m_loadFileBuffer.buffer(); - buffer.setBuffer(&data); - buffer.open(QIODevice::ReadOnly); - s.setDevice(&buffer); + m_loadFileBuffer.open(QIODevice::ReadOnly); + m_loadDataStream.setDevice(&m_loadFileBuffer); - if(s.status() != CacheDataStream::Ok || - checksum != qChecksum(data.data(), data.size())) + qint32 checksumExpected = qChecksum( + m_loadFileBuffer.data(), m_loadFileBuffer.size()); + if(m_loadDataStream.status() != CacheDataStream::Ok || + checksum != checksumExpected) { + kError() << "Music cache checksum expected to get" << checksumExpected << + "actually was" << checksum; KMessageBox::sorry(0, i18n("The music data cache has been corrupted. JuK " "needs to rescan it now. This may take some time.")); - return; + return false; } break; } default: { - s.device()->reset(); - s.setCacheVersion(0); + m_loadDataStream.device()->reset(); + m_loadDataStream.setCacheVersion(0); // This cache is so old that this is just a wild guess here that 3.3 // is compatible. - s.setVersion(CacheDataStream::Qt_3_3); + m_loadDataStream.setVersion(CacheDataStream::Qt_3_3); break; } } - // Read the cached tags. + return true; +} + +FileHandle Cache::loadNextCachedItem() +{ + if(!m_loadFile.isOpen() || !m_loadDataStream.device()) { + kWarning() << "Already completed reading cache file."; + return FileHandle::null(); + } + + if(m_loadDataStream.status() == QDataStream::ReadCorruptData) { + kError() << "Attempted to read file handle from corrupt cache file."; + return FileHandle::null(); + } - while(!s.atEnd()) { + if(!m_loadDataStream.atEnd()) { QString fileName; - s >> fileName; + m_loadDataStream >> fileName; fileName.squeeze(); - FileHandle f(fileName, s); + return FileHandle(fileName, m_loadDataStream); + } + else { + m_loadDataStream.setDevice(0); + m_loadFile.close(); + + return FileHandle::null(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/cache.h new/juk-4.10.95/cache.h --- old/juk-4.10.90/cache.h 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/cache.h 2013-07-10 01:19:32.000000000 +0200 @@ -2,6 +2,9 @@ begin : Sat Sep 7 2002 copyright : (C) 2002 - 2004 by Scott Wheeler email : [email protected] + + copyright : (C) 2008, 2013 by Michael Pyne + email : [email protected] ***************************************************************************/ /*************************************************************************** @@ -13,42 +16,22 @@ * * ***************************************************************************/ -#ifndef CACHE_H -#define CACHE_H - -#include <QDataStream> +#ifndef JUK_CACHE_H +#define JUK_CACHE_H -#include "stringhash.h" +#include <QtCore/QDataStream> +#include <QtCore/QFile> +#include <QtCore/QBuffer> class Playlist; class PlaylistCollection; +class FileHandle; template<class T> class QList; typedef QList<Playlist *> PlaylistList; -class Cache : public FileHandleHash -{ -public: - static Cache *instance(); - void save(); - - static void loadPlaylists(PlaylistCollection *collection); - static void savePlaylists(const PlaylistList &playlists); - - static bool cacheFileExists(); - -protected: - Cache(); - void load(); - -private: - // 1: Original cache version - // 2: KDE 4.0.1+, explicitly sets QDataStream encoding. - static const int m_currentVersion = 2; -}; - /** * A simple QDataStream subclass that has an extra field to indicate the cache * version. @@ -58,8 +41,7 @@ { public: CacheDataStream(QIODevice *d) : QDataStream(d), m_cacheVersion(0) {} - - virtual ~CacheDataStream() {} + CacheDataStream() : m_cacheVersion(0) { } int cacheVersion() const { return m_cacheVersion; } void setCacheVersion(int v) { m_cacheVersion = v; } @@ -68,6 +50,44 @@ int m_cacheVersion; }; + +class Cache +{ +public: + static Cache *instance(); + + static void loadPlaylists(PlaylistCollection *collection); + static void savePlaylists(const PlaylistList &playlists); + + static bool cacheFileExists(); + + bool prepareToLoadCachedItems(); + FileHandle loadNextCachedItem(); + + /** + * QDataStream version for serialized list of playlists + * 1, 2: Who knows? + * 3: Current. + */ + static const int playlistListCacheVersion; + + /** + * QDataStream version for serialized list of playlist items in a playlist + * 1: Original cache version + * 2: KDE 4.0.1+, explicitly sets QDataStream encoding. + */ + static const int playlistItemsCacheVersion; + +private: + // private to force access through instance() + Cache(); + +private: + QFile m_loadFile; + QBuffer m_loadFileBuffer; + CacheDataStream m_loadDataStream; +}; + #endif // vim: set et sw=4 tw=0 sta: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/collectionlist.cpp new/juk-4.10.95/collectionlist.cpp --- old/juk-4.10.90/collectionlist.cpp 2013-06-10 20:54:12.000000000 +0200 +++ new/juk-4.10.95/collectionlist.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -21,14 +21,20 @@ #include <kmenu.h> #include <kconfig.h> #include <kconfiggroup.h> +#include <kglobal.h> #include <kactioncollection.h> +#include <ksavefile.h> +#include <kstandarddirs.h> #include <ktoolbarpopupaction.h> #include <kdirwatch.h> +#include <QStringBuilder> #include <QList> #include <QDragMoveEvent> #include <QDropEvent> #include <QApplication> +#include <QTimer> +#include <QTime> #include <QClipboard> #include <QFileInfo> @@ -53,22 +59,59 @@ return m_list; } -void CollectionList::loadCachedItems() +static QTime stopwatch; + +void CollectionList::startLoadingCachedItems() { if(!m_list) return; - FileHandleHash::ConstIterator end = Cache::instance()->constEnd(); - for(FileHandleHash::ConstIterator it = Cache::instance()->constBegin(); it != end; ++it) { + kDebug() << "Starting to load cached items"; + stopwatch.start(); + + if(!Cache::instance()->prepareToLoadCachedItems()) { + kError() << "Unable to setup to load cache... perhaps it doesn't exist?"; + + completedLoadingCachedItems(); + return; + } + + kDebug() << "Kicked off first batch"; + QTimer::singleShot(0, this, SLOT(loadNextBatchCachedItems())); +} + +void CollectionList::loadNextBatchCachedItems() +{ + Cache *cache = Cache::instance(); + bool done = false; + + for(int i = 0; i < 20; ++i) { + FileHandle cachedItem(cache->loadNextCachedItem()); + + if(cachedItem.isNull()) { + done = true; + break; + } + // This may have already been created via a loaded playlist. - if(!m_itemsDict.contains(it.key())) { - CollectionListItem *newItem = new CollectionListItem(this, *it); + if(!m_itemsDict.contains(cachedItem.absFilePath())) { + CollectionListItem *newItem = new CollectionListItem(this, cachedItem); setupItem(newItem); } } SplashScreen::update(); + if(!done) { + QTimer::singleShot(0, this, SLOT(loadNextBatchCachedItems())); + } + else { + completedLoadingCachedItems(); + } +} + +void CollectionList::completedLoadingCachedItems() +{ // The CollectionList is created with sorting disabled for speed. Re-enable // it here, and perform the sort. KConfigGroup config(KGlobal::config(), "Playlists"); @@ -83,6 +126,11 @@ m_list->sort(); SplashScreen::finishedLoading(); + + kDebug() << "Finished loading cached items, took" << stopwatch.elapsed() << "ms"; + kDebug() << m_itemsDict.size() << "items are in the CollectionList"; + + emit cachedItemsLoaded(); } void CollectionList::initialize(PlaylistCollection *collection) @@ -129,7 +177,6 @@ void CollectionList::clearItems(const PlaylistItemList &items) { foreach(PlaylistItem *item, items) { - Cache::instance()->remove(item->file()); delete item; } @@ -190,6 +237,44 @@ delete lookup(item.url().path()); } +void CollectionList::saveItemsToCache() const +{ + kDebug() << "Saving collection list to cache"; + + QString cacheFileName = + KGlobal::dirs()->saveLocation("appdata") % QLatin1String("cache"); + + KSaveFile f(cacheFileName); + + if(!f.open(QIODevice::WriteOnly)) { + kError() << "Error saving cache:" << f.errorString(); + return; + } + + QByteArray data; + QDataStream s(&data, QIODevice::WriteOnly); + s.setVersion(QDataStream::Qt_4_3); + + QHash<QString, CollectionListItem *>::const_iterator it; + for(it = m_itemsDict.begin(); it != m_itemsDict.end(); ++it) { + s << it.key(); + s << (*it)->file(); + } + + QDataStream fs(&f); + + qint32 checksum = qChecksum(data.data(), data.size()); + + fs << qint32(Cache::playlistItemsCacheVersion) + << checksum + << data; + + f.close(); + + if(!f.finalize()) + kError() << "Error saving cache:" << f.errorString(); +} + //////////////////////////////////////////////////////////////////////////////// // public slots //////////////////////////////////////////////////////////////////////////////// @@ -215,17 +300,21 @@ void CollectionList::slotCheckCache() { - loadCachedItems(); - PlaylistItemList invalidItems; + kDebug() << "Starting to check cached items for consistency"; + stopwatch.start(); + int i = 0; foreach(CollectionListItem *item, m_itemsDict) { if(!item->checkCurrent()) invalidItems.append(item); - processEvents(); + if(++i == (m_itemsDict.size() / 2)) + kDebug() << "Checkpoint"; } clearItems(invalidItems); + + kDebug() << "Finished consistency check, took" << stopwatch.elapsed() << "ms"; } void CollectionList::slotRemoveItem(const QString &file) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/collectionlist.h new/juk-4.10.95/collectionlist.h --- old/juk-4.10.90/collectionlist.h 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/collectionlist.h 2013-07-10 01:19:32.000000000 +0200 @@ -123,6 +123,8 @@ virtual bool canReload() const { return true; } + void saveItemsToCache() const; + public slots: virtual void paste(); virtual void clear(); @@ -172,12 +174,28 @@ void signalNewTag(const QString &, unsigned); void signalRemovedTag(const QString &, unsigned); + // Emitted once cached items are loaded, which allows for folder scanning + // and invalid track detection to proceed. + void cachedItemsLoaded(); + public slots: /** * Loads the CollectionListItems from the Cache. Should be called after program * initialization. */ - void loadCachedItems(); + void startLoadingCachedItems(); + + /** + * Loads a few items at a time. Intended to be single-shotted into the event + * loop so that loading the music doesn't freeze the GUI. + */ + void loadNextBatchCachedItems(); + + /** + * Teardown from cache loading (e.g. splash screen, sorting, etc.). Should + * always be called if startLoadingCachedItems is called. + */ + void completedLoadingCachedItems(); private: /** Files old/juk-4.10.90/doc/index.cache.bz2 and new/juk-4.10.95/doc/index.cache.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/filehandle.cpp new/juk-4.10.95/filehandle.cpp --- old/juk-4.10.90/filehandle.cpp 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/filehandle.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -129,7 +129,6 @@ d->fileInfo = QFileInfo(path); d->absFilePath = path; read(s); - Cache::instance()->insert(*this); } FileHandle::~FileHandle() @@ -279,22 +278,12 @@ QString fileName = path.isEmpty() ? info.absoluteFilePath() : path; - FileHandle cached = Cache::instance()->value(resolveSymLinks(fileName)); - - if(cached != null()) { - d = cached.d; - d->ref(); - } - else { - d = new FileHandlePrivate; - d->fileInfo = info; - d->absFilePath = resolveSymLinks(fileName); - d->modificationTime = info.lastModified(); - if(info.exists()) - Cache::instance()->insert(*this); - else - kWarning() << "File" << path << "no longer exists!"; - } + d = new FileHandlePrivate; + d->fileInfo = info; + d->absFilePath = resolveSymLinks(fileName); + d->modificationTime = info.lastModified(); + if(!info.exists()) + kWarning() << "File" << path << "no longer exists!"; } //////////////////////////////////////////////////////////////////////////////// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/juk.cpp new/juk-4.10.95/juk.cpp --- old/juk-4.10.90/juk.cpp 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/juk.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -39,6 +39,7 @@ #include <QCoreApplication> #include <QKeyEvent> #include <QDir> +#include <QTime> #include <QTimer> #include <QDesktopWidget> @@ -56,7 +57,6 @@ #include "collectionlist.h" #include "covermanager.h" #include "tagtransactionmanager.h" -#include "mpris2/mpris2.h" using namespace ActionCollection; @@ -125,14 +125,12 @@ readConfig(); setupGlobalAccels(); - (void) new Mpris2(this); - connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(slotAboutToQuit())); // slotCheckCache loads the cached entries first to populate the collection list QTimer::singleShot(0, this, SLOT(slotClearOldCovers())); - QTimer::singleShot(0, CollectionList::instance(), SLOT(slotCheckCache())); + QTimer::singleShot(0, CollectionList::instance(), SLOT(startLoadingCachedItems())); QTimer::singleShot(0, this, SLOT(slotProcessArgs())); } @@ -173,6 +171,10 @@ { new TagTransactionManager(this); + kDebug() << "Creating GUI"; + QTime stopwatch; + stopwatch.start(); + m_splitter = new PlaylistSplitter(m_player, this); setCentralWidget(m_splitter); @@ -183,6 +185,8 @@ m_player->setStatusLabel(m_statusLabel); m_splitter->setFocus(); + + kDebug() << "GUI created in" << stopwatch.elapsed() << "ms"; } void JuK::setupActions() @@ -338,11 +342,14 @@ void JuK::slotSetupSystemTray() { if(m_toggleSystemTrayAction && m_toggleSystemTrayAction->isChecked()) { + kDebug() << "Setting up systray"; + QTime stopwatch; stopwatch.start(); m_systemTray = new SystemTray(m_player, this); m_systemTray->setObjectName( QLatin1String("systemTray" )); m_toggleDockOnCloseAction->setEnabled(true); m_togglePopupsAction->setEnabled(true); + kDebug() << "Finished setting up systray, took" << stopwatch.elapsed() << "ms"; } else { m_systemTray = 0; @@ -513,7 +520,6 @@ // Save configuration data. m_startDocked = !isVisible(); saveConfig(); - Cache::instance()->save(); return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/lyricswidget.cpp new/juk-4.10.95/lyricswidget.cpp --- old/juk-4.10.90/lyricswidget.cpp 2013-06-25 20:35:41.000000000 +0200 +++ new/juk-4.10.95/lyricswidget.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -30,7 +30,8 @@ LyricsWidget::LyricsWidget(QWidget* parent): QTextBrowser(parent), - m_networkAccessManager(new QNetworkAccessManager) + m_networkAccessManager(new QNetworkAccessManager), + m_lyricsCurrent(false) { setMinimumWidth(200); setReadOnly(true); @@ -60,11 +61,12 @@ config.writeEntry("Show", ActionCollection::action<KToggleAction>("showLyrics")->isChecked()); } - -void LyricsWidget::playing(const FileHandle &file) +void LyricsWidget::makeLyricsRequest() { - if(file.isNull()) { - setHtml(QLatin1String("<i>No file playing.</i>")); + m_lyricsCurrent = true; + + if(m_playingFile.isNull()) { + setHtml(QLatin1String("<i>No m_playingFile playing.</i>")); return; } @@ -74,16 +76,28 @@ listUrl.addQueryItem("action", "lyrics"); listUrl.addQueryItem("func", "getSong"); listUrl.addQueryItem("fmt", "xml"); - listUrl.addQueryItem("artist", file.tag()->artist()); - listUrl.addQueryItem("song", file.tag()->title()); - m_title = file.tag()->artist() + " – " + file.tag()->title(); + listUrl.addQueryItem("artist", m_playingFile.tag()->artist()); + listUrl.addQueryItem("song", m_playingFile.tag()->title()); + m_title = m_playingFile.tag()->artist() + " – " + m_playingFile.tag()->title(); connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(receiveListReply(QNetworkReply*))); m_networkAccessManager->get(QNetworkRequest(listUrl)); } -void LyricsWidget::hideEvent(QHideEvent *) +void LyricsWidget::playing(const FileHandle &file) { - saveConfig(); + m_playingFile = file; + m_lyricsCurrent = false; + + if(isVisible()) { + makeLyricsRequest(); + } +} + +void LyricsWidget::showEvent(QShowEvent *) +{ + if(!m_lyricsCurrent) { + makeLyricsRequest(); + } } void LyricsWidget::receiveListReply(QNetworkReply* reply) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/lyricswidget.h new/juk-4.10.95/lyricswidget.h --- old/juk-4.10.90/lyricswidget.h 2013-06-10 20:54:12.000000000 +0200 +++ new/juk-4.10.95/lyricswidget.h 2013-07-10 01:19:32.000000000 +0200 @@ -38,7 +38,10 @@ void playing(const FileHandle &file); protected: - virtual void hideEvent(QHideEvent*); + virtual void showEvent(QShowEvent*); + +private: + void makeLyricsRequest(); private Q_SLOTS: void receiveListReply(QNetworkReply*); @@ -47,8 +50,10 @@ private: + FileHandle m_playingFile; QNetworkAccessManager *m_networkAccessManager; QString m_title; + bool m_lyricsCurrent; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/mpris2/mediaplayer2.h new/juk-4.10.95/mpris2/mediaplayer2.h --- old/juk-4.10.90/mpris2/mediaplayer2.h 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/mpris2/mediaplayer2.h 2013-07-10 01:19:32.000000000 +0200 @@ -60,8 +60,8 @@ QStringList SupportedMimeTypes() const; public slots: - void Raise() const; - void Quit() const; + Q_NOREPLY void Raise() const; + Q_NOREPLY void Quit() const; }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/mpris2/mediaplayer2player.h new/juk-4.10.95/mpris2/mediaplayer2player.h --- old/juk-4.10.90/mpris2/mediaplayer2player.h 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/mpris2/mediaplayer2player.h 2013-07-10 01:19:32.000000000 +0200 @@ -56,14 +56,14 @@ QString PlaybackStatus() const; QString LoopStatus() const; - void setLoopStatus(const QString& loopStatus) const; + Q_NOREPLY void setLoopStatus(const QString& loopStatus) const; double Rate() const; - void setRate(double rate) const; + Q_NOREPLY void setRate(double rate) const; bool Shuffle() const; void setShuffle(bool shuffle) const; QVariantMap Metadata() const; double Volume() const; - void setVolume(double volume) const; + Q_NOREPLY void setVolume(double volume) const; qlonglong Position() const; double MinimumRate() const; double MaximumRate() const; @@ -78,15 +78,15 @@ void Seeked(qlonglong Position) const; public slots: - void Next() const; - void Previous() const; - void Pause() const; - void PlayPause() const; - void Stop() const; - void Play() const; - void Seek(qlonglong Offset) const; - void SetPosition(const QDBusObjectPath& TrackId, qlonglong Position) const; - void OpenUri(QString Uri) const; + Q_NOREPLY void Next() const; + Q_NOREPLY void Previous() const; + Q_NOREPLY void Pause() const; + Q_NOREPLY void PlayPause() const; + Q_NOREPLY void Stop() const; + Q_NOREPLY void Play() const; + Q_NOREPLY void Seek(qlonglong Offset) const; + Q_NOREPLY void SetPosition(const QDBusObjectPath& TrackId, qlonglong Position) const; + Q_NOREPLY void OpenUri(QString Uri) const; private slots: void currentSourceChanged() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlist.cpp new/juk-4.10.95/playlist.cpp --- old/juk-4.10.90/playlist.cpp 2013-06-25 20:35:41.000000000 +0200 +++ new/juk-4.10.95/playlist.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -1862,15 +1862,15 @@ if(hasItem(file) && !m_allowDuplicates) return; - processEvents(); addFileHelper(files, after); // Our biggest thing that we're fighting during startup is too many stats // of files. Make sure that we don't do one here if it's not needed. - FileHandle cached = Cache::instance()->value(file); + const CollectionListItem *item = CollectionList::instance()->lookup(file); - if(!cached.isNull()) { + if(item && !item->file().isNull()) { + FileHandle cached(item->file()); cached.tag(); files.append(cached); return; @@ -1945,8 +1945,6 @@ if(focus) setFocus(); - - processEvents(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlist.h new/juk-4.10.95/playlist.h --- old/juk-4.10.90/playlist.h 2013-06-25 20:35:41.000000000 +0200 +++ new/juk-4.10.95/playlist.h 2013-07-10 01:19:32.000000000 +0200 @@ -31,6 +31,7 @@ #include "playlistsearch.h" #include "tagguesser.h" #include "playlistinterface.h" +#include "filehandle.h" class KMenu; class KActionMenu; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlistbox.cpp new/juk-4.10.95/playlistbox.cpp --- old/juk-4.10.90/playlistbox.cpp 2013-06-25 20:35:41.000000000 +0200 +++ new/juk-4.10.95/playlistbox.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -37,6 +37,7 @@ #include <QDropEvent> #include <QMouseEvent> #include <QFileInfo> +#include <QTime> #include <QApplication> #include <QClipboard> @@ -151,10 +152,8 @@ this, SLOT(slotAddItem(QString,uint))); connect(CollectionList::instance(), SIGNAL(signalRemovedTag(QString,uint)), this, SLOT(slotRemoveItem(QString,uint))); - - QTimer::singleShot(0, this, SLOT(slotLoadCachedPlaylists())); - QTimer::singleShot(0, object(), SLOT(slotScanFolders())); - enableDirWatch(true); + connect(CollectionList::instance(), SIGNAL(cachedItemsLoaded()), + this, SLOT(slotLoadCachedPlaylists())); m_savePlaylistTimer = 0; @@ -220,6 +219,18 @@ p->createItems(item->playlist()->items()); } +void PlaylistBox::scanFolders() +{ + kDebug() << "Starting folder scan"; + QTime stopwatch; stopwatch.start(); + + PlaylistCollection::scanFolders(); + + kDebug() << "Folder scan complete, took" << stopwatch.elapsed() << "ms"; + kDebug() << "Startup complete!"; + emit startupComplete(); +} + //////////////////////////////////////////////////////////////////////////////// // PlaylistBox public slots //////////////////////////////////////////////////////////////////////////////// @@ -733,18 +744,27 @@ void PlaylistBox::slotLoadCachedPlaylists() { + kDebug() << "Loading cached playlists."; + QTime stopwatch; + stopwatch.start(); + Cache::loadPlaylists(this); + kDebug() << "Cached playlists loaded, took" << stopwatch.elapsed() << "ms"; + // Auto-save playlists after they change. m_savePlaylistTimer = new QTimer(this); m_savePlaylistTimer->setInterval(3000); // 3 seconds with no change? -> commit m_savePlaylistTimer->setSingleShot(true); connect(m_savePlaylistTimer, SIGNAL(timeout()), SLOT(slotSavePlaylists())); - emit startupComplete(); clearSelection(); setSelected(m_playlistDict[CollectionList::instance()], true); + + QTimer::singleShot(0, CollectionList::instance(), SLOT(slotCheckCache())); + QTimer::singleShot(0, object(), SLOT(slotScanFolders())); } + //////////////////////////////////////////////////////////////////////////////// // PlaylistBox::Item protected methods //////////////////////////////////////////////////////////////////////////////// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlistbox.h new/juk-4.10.95/playlistbox.h --- old/juk-4.10.90/playlistbox.h 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/playlistbox.h 2013-07-10 01:19:32.000000000 +0200 @@ -55,6 +55,10 @@ virtual void duplicate(); virtual void remove(); + // Called after files loaded to pickup any new files that might be present + // in managed directories. + virtual void scanFolders(); + /** * For view modes that have dynamic playlists, this freezes them from * removing playlists. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlistcollection.cpp new/juk-4.10.95/playlistcollection.cpp --- old/juk-4.10.90/playlistcollection.cpp 2013-06-10 20:54:12.000000000 +0200 +++ new/juk-4.10.95/playlistcollection.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -114,6 +114,7 @@ PlaylistCollection::~PlaylistCollection() { saveConfig(); + CollectionList::instance()->saveItemsToCache(); delete m_actionHandler; Playlist::setShuttingDown(); } @@ -512,6 +513,8 @@ if(CollectionList::instance()->count() == 0) addFolder(); + + enableDirWatch(true); } void PlaylistCollection::createPlaylist() @@ -611,13 +614,13 @@ else { action<KToggleAction>("showUpcoming")->setChecked(false); bool raiseCollection = visiblePlaylist() == m_upcomingPlaylist; - delete m_upcomingPlaylist; - m_upcomingPlaylist = 0; if(raiseCollection) { - kapp->processEvents(); // Seems to stop a crash, weird. raise(CollectionList::instance()); } + + m_upcomingPlaylist->deleteLater(); + m_upcomingPlaylist = 0; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlistcollection.h new/juk-4.10.95/playlistcollection.h --- old/juk-4.10.90/playlistcollection.h 2013-06-10 20:54:12.000000000 +0200 +++ new/juk-4.10.95/playlistcollection.h 2013-07-10 01:19:32.000000000 +0200 @@ -36,6 +36,7 @@ class PlaylistItem; class Playlist; class PlayerManager; +class FileHandle; template<class T> class QList; @@ -107,7 +108,8 @@ virtual PlaylistItemList selectedItems(); - void scanFolders(); + // virtual to allow our QWidget subclass to emit a signal after we're done + virtual void scanFolders(); void createPlaylist(); void createSearchPlaylist(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/playlistsplitter.cpp new/juk-4.10.95/playlistsplitter.cpp --- old/juk-4.10.90/playlistsplitter.cpp 2013-06-25 20:35:41.000000000 +0200 +++ new/juk-4.10.95/playlistsplitter.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -30,6 +30,7 @@ #include <QVBoxLayout> #include <QLatin1String> #include <QList> +#include <QTime> #include <QStackedWidget> #include <QSizePolicy> @@ -42,6 +43,7 @@ #include "nowplaying.h" #include "playlistbox.h" #include "lyricswidget.h" +#include "mpris2/mpris2.h" //////////////////////////////////////////////////////////////////////////////// // public methods @@ -322,8 +324,13 @@ void PlaylistSplitter::slotEnable() { + kDebug() << "Enabling GUI"; + QTime stopwatch; stopwatch.start(); setEnabled(true); // Ready to go. m_playlistStack->show(); + kDebug() << "Finished enabling GUI, took" << stopwatch.elapsed() << "ms"; + + (void) new Mpris2(this); } #include "playlistsplitter.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/splashscreen.cpp new/juk-4.10.95/splashscreen.cpp --- old/juk-4.10.90/splashscreen.cpp 2013-06-10 20:54:12.000000000 +0200 +++ new/juk-4.10.95/splashscreen.cpp 2013-07-10 01:19:32.000000000 +0200 @@ -105,7 +105,6 @@ void SplashScreen::processEvents() { setText(loadedText(count)); - kapp->processEvents(); } // vim: set et sw=4 tw=0 sta: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.10.90/stringhash.h new/juk-4.10.95/stringhash.h --- old/juk-4.10.90/stringhash.h 2013-05-28 21:31:21.000000000 +0200 +++ new/juk-4.10.95/stringhash.h 2013-07-10 01:19:32.000000000 +0200 @@ -18,8 +18,6 @@ #include <QSet> -#include "filehandle.h" - /** * A simple hash representing an (un-mapped) set of data. */ @@ -41,22 +39,6 @@ }; typedef Hash<QString> StringHash; -typedef Hash<void *> PtrHash; - -// cannot be a Hash<FileHandle> because it needs "FileHandle value(QString)" -class FileHandleHash : public QHash<QString, FileHandle> -{ -public: - inline bool insert(const FileHandle &value) - { - if(contains(value)) - return true; - QHash<QString, FileHandle>::insert(value.absFilePath(), value); - return false; - } - inline bool contains(const FileHandle &value) { return QHash<QString, FileHandle>::contains(value.absFilePath()); } - inline bool remove(const FileHandle &value) { return QHash<QString, FileHandle>::remove(value.absFilePath()); } -}; #endif -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
