Commit 20979495 authored by Scott Wheeler's avatar Scott Wheeler

Some interactivity hacks for staying responsive while tagging a list of

files.  This is the best that can be done without going multithreaded.

Added docs and simplified Playlist::slotApplyModification() while I was in
there.

CCMAIL:60066-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=236006
parent d1df75e0
...@@ -972,8 +972,6 @@ void Playlist::slotRenameTag() ...@@ -972,8 +972,6 @@ void Playlist::slotRenameTag()
void Playlist::applyTag(QListViewItem *item, const QString &text, int column) void Playlist::applyTag(QListViewItem *item, const QString &text, int column)
{ {
// kdDebug(65432) << "Applying " << text << " at column " << column << ", replacing \"" << item->text(column) << "\"" << endl;
PlaylistItem *i = static_cast<PlaylistItem *>(item); PlaylistItem *i = static_cast<PlaylistItem *>(item);
switch(column) switch(column)
...@@ -1012,31 +1010,26 @@ void Playlist::applyTag(QListViewItem *item, const QString &text, int column) ...@@ -1012,31 +1010,26 @@ void Playlist::applyTag(QListViewItem *item, const QString &text, int column)
i->slotRefresh(); i->slotRefresh();
} }
void Playlist::slotApplyModification(QListViewItem *item, const QString &text, int column) void Playlist::slotApplyModification(QListViewItem *, const QString &text, int column)
{ {
// kdDebug(65432) << "Playlist::slotApplyModification()" << endl;
if(text == m_editText)
return;
QPtrList<QListViewItem> selectedSongs = KListView::selectedItems(); QPtrList<QListViewItem> selectedSongs = KListView::selectedItems();
if (selectedSongs.count() > 1) { if(text == m_editText ||
if (KMessageBox::warningYesNo(0, (selectedSongs.count() > 1 && KMessageBox::warningYesNo(
i18n("This will edit multiple files! Are you sure?"), 0,
QString::null, i18n("This will edit multiple files! Are you sure?"),
KStdGuiItem::yes(), QString::null,
KStdGuiItem::no(), KStdGuiItem::yes(),
"DontWarnMultipleTags") == KMessageBox::No) KStdGuiItem::no(),
{ "DontWarnMultipleTags") == KMessageBox::No))
return; {
} return;
}
QPtrListIterator<QListViewItem> it(selectedSongs); QPtrListIterator<QListViewItem> it(selectedSongs);
for(; it.current(); ++it) for(; it.current(); ++it) {
applyTag((*it), text, column); applyTag((*it), text, column);
kapp->processEvents();
} }
else
applyTag(item, text, column);
} }
void Playlist::slotColumnOrderChanged(int, int from, int to) void Playlist::slotColumnOrderChanged(int, int from, int to)
......
...@@ -261,6 +261,9 @@ signals: ...@@ -261,6 +261,9 @@ signals:
private: private:
void setup(); void setup();
void loadFile(const QString &fileName, const QFileInfo &fileInfo); void loadFile(const QString &fileName, const QFileInfo &fileInfo);
/**
* Save the tag for an individual items.
*/
void applyTag(QListViewItem *item, const QString &text, int column); void applyTag(QListViewItem *item, const QString &text, int column);
int leftMostVisibleColumn() const; int leftMostVisibleColumn() const;
...@@ -273,7 +276,16 @@ private: ...@@ -273,7 +276,16 @@ private:
private slots: private slots:
void slotEmitSelected() { emit signalSelectionChanged(selectedItems()); } void slotEmitSelected() { emit signalSelectionChanged(selectedItems()); }
void slotShowRMBMenu(QListViewItem *item, const QPoint &point, int column); void slotShowRMBMenu(QListViewItem *item, const QPoint &point, int column);
void slotApplyModification(QListViewItem *item, const QString &text, int column);
/**
* This slot applys the tag for
*/
void slotApplyModification(QListViewItem *, const QString &text, int column);
/**
* This starts the renaming process by displaying a line edit if the mouse is in
* an appropriate position.
*/
void slotRenameTag(); void slotRenameTag();
void slotColumnOrderChanged(int, int from, int to); void slotColumnOrderChanged(int, int from, int to);
void slotToggleColumnVisible(int column); void slotToggleColumnVisible(int column);
......
...@@ -495,6 +495,8 @@ void TagEditor::save(const PlaylistItemList &list) ...@@ -495,6 +495,8 @@ void TagEditor::save(const PlaylistItemList &list)
} }
else else
errorFiles.append(item->fileName()); errorFiles.append(item->fileName());
kapp->processEvents();
} }
if(!errorFiles.isEmpty()) if(!errorFiles.isEmpty())
......
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