Commit 130cb096 authored by Maks Orlovich's avatar Maks Orlovich

Speed up first-time directory scan when tag editor is not visible by not updating it in this case

(setting up an tearing down KCompletions is quite expensive); seems to give between 2x-4.25x speed up in my tests,
depending a lot on the size of the collection and on GUI visibility. Hint: if you're importing a huge collection into
JuK, close it into tray. Updating that GUI is a lot more expensive than scanning the files when there are thousands of items (due to some
QListView stupidity), so you can get a huge speed up doing that.

svn path=/trunk/kdemultimedia/juk/; revision=331347
parent 9876ad9d
......@@ -110,6 +110,7 @@ TagEditor::TagEditor(QWidget *parent, const char *name) :
setupLayout();
readConfig();
m_dataChanged = false;
m_collectionChanged = false;
}
TagEditor::~TagEditor()
......@@ -306,6 +307,16 @@ void TagEditor::slotClear()
void TagEditor::slotUpdateCollection()
{
if(isVisible())
updateCollection();
else
m_collectionChanged = true;
}
void TagEditor::updateCollection()
{
m_collectionChanged = false;
CollectionList *list = CollectionList::instance();
if(!list)
......@@ -692,6 +703,9 @@ void TagEditor::addItem(const QString &text, QWidget *item, QBoxLayout *layout,
void TagEditor::showEvent(QShowEvent *e)
{
if(m_collectionChanged)
updateCollection();
slotRefresh();
QWidget::showEvent(e);
}
......
......@@ -46,9 +46,11 @@ public slots:
void slotSetItems(const PlaylistItemList &list);
void slotRefresh();
void slotClear();
void slotUpdateCollection();
void slotUpdateCollection(); //Update collection if we're visible, or defer otherwise
private:
void updateCollection(); //Update collection
void setupActions();
void setupLayout();
void readConfig();
......@@ -98,6 +100,7 @@ private:
Playlist *m_currentPlaylist;
bool m_dataChanged;
bool m_collectionChanged;
};
#endif
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