Commit a5978904 authored by Scott Wheeler's avatar Scott Wheeler

fix delayed cache checking

svn path=/trunk/kdemultimedia/juk/; revision=211443
parent ec4c44ee
......@@ -98,11 +98,19 @@ void CollectionList::clear()
Playlist::clear();
}
void CollectionList::slotCheckCache()
{
for(QDictIterator<CollectionListItem>it(m_itemsDict); it.current(); ++it) {
it.current()->checkCurrent();
kapp->processEvents();
}
}
////////////////////////////////////////////////////////////////////////////////
// protected methods
////////////////////////////////////////////////////////////////////////////////
CollectionList::CollectionList(PlaylistSplitter *s, QWidget *parent) : Playlist(s, parent, i18n("Collection List"))
CollectionList::CollectionList(PlaylistSplitter *s, QWidget *parent) : Playlist(s, parent, i18n("Collection List")) //, m_finishedLoading(false)
{
}
......@@ -206,7 +214,6 @@ CollectionListItem::CollectionListItem(const QFileInfo &file, const QString &pat
<< "CollectionList::initialize() has been called." << endl;
SplashScreen::increment();
QTimer::singleShot(3 * 1000, this, SLOT(slotCheckCurrent()));
}
CollectionListItem::~CollectionListItem()
......@@ -222,11 +229,7 @@ void CollectionListItem::addChildItem(PlaylistItem *child)
connect(this, SIGNAL(signalRefreshed()), child, SLOT(slotRefreshImpl()));
}
////////////////////////////////////////////////////////////////////////////////
// CollectionListItem private slots
////////////////////////////////////////////////////////////////////////////////
void CollectionListItem::slotCheckCurrent()
void CollectionListItem::checkCurrent()
{
if(!data()->exists() || !data()->isFile())
CollectionList::instance()->clearItem(this);
......
......@@ -57,6 +57,7 @@ public:
public slots:
virtual void paste();
virtual void clear();
void slotCheckCache();
protected:
CollectionList(PlaylistSplitter *s, QWidget *parent);
......@@ -113,14 +114,13 @@ protected:
void addChildItem(PlaylistItem *child);
private slots:
/**
* This slot, called from a QTimer::singleShot() set in the constructor, allows for
* delayed consistancy checking for the cache at the cost of a few CPU cycles. The
* effect however is that stating files is delayed until after the GUI is shown by
* moving this action into the event loop.
*/
void slotCheckCurrent();
void checkCurrent();
};
#endif
......@@ -59,6 +59,7 @@ JuK::JuK(QWidget *parent, const char *name) : KMainWindow(parent, name, WDestruc
processArgs();
SplashScreen::finishedLoading();
QTimer::singleShot(0, CollectionList::instance(), SLOT(slotCheckCache()));
}
JuK::~JuK()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment