Bug 60066 - Tagging causes JuK to freeze
Summary: Tagging causes JuK to freeze
Status: RESOLVED FIXED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-19 15:45 UTC by tim
Modified: 2003-07-07 22:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tim 2003-06-19 15:45:10 UTC
Version:            (using KDE 3.1.9)
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB

Tagging, especially several files (like an album) causes JuK to freeze the GUI several seconds.
Comment 1 Scott Wheeler 2003-06-21 22:44:59 UTC
Yes, this is especially true if the files do not already have id3v2 tags since the whole file must 
be rearranged to create space for the tag at the beginning.  (If it already has an id3v2 tag, 
there is usually some "padding" that makes it possible to change details of the tag and so long 
as it doesn't grow by more than ~2 kb, it doesn't require moving the data around.) 
 
I'll add some more process events hackery, but there will still be the lag of the time it takes per 
file unless I get around to making JuK multithreaded. 
 
Also TagLib, which I've been working on again this weekend (a replacement for id3lib) is about 
20% faster at saving files, but this still of course leaves some delay. 
Comment 2 Scott Wheeler 2003-07-07 22:33:32 UTC
Subject: kdemultimedia/juk

CVS commit by 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


  M +16 -23    playlist.cpp   1.110
  M +13 -1     playlist.h   1.69
  M +2 -0      tageditor.cpp   1.30


--- kdemultimedia/juk/playlist.cpp  #1.109:1.110
@@ -973,6 +973,4 @@ void Playlist::slotRenameTag()
 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);
 
@@ -1013,19 +1011,15 @@ void Playlist::applyTag(QListViewItem *i
 }
 
-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();
-    if (selectedSongs.count() > 1) {
-        if (KMessageBox::warningYesNo(0,
+    if(text == m_editText || 
+       (selectedSongs.count() > 1 && KMessageBox::warningYesNo(
+            0,
                                       i18n("This will edit multiple files! Are you sure?"),
                                       QString::null,
                                       KStdGuiItem::yes(),
                                       KStdGuiItem::no(),
-                                      "DontWarnMultipleTags") == KMessageBox::No)
+            "DontWarnMultipleTags") == KMessageBox::No))
         {
             return;
@@ -1033,9 +1027,8 @@ void Playlist::slotApplyModification(QLi
 
         QPtrListIterator<QListViewItem> it(selectedSongs);
-        for(; it.current(); ++it)
+    for(; it.current(); ++it) {
             applyTag((*it), text, column);
+        kapp->processEvents();
     }
-    else
-        applyTag(item, text, column);
 }
 

--- kdemultimedia/juk/playlist.h  #1.68:1.69
@@ -262,4 +262,7 @@ private:
     void setup();
     void loadFile(const QString &fileName, const QFileInfo &fileInfo);
+    /**
+     * Save the tag for an individual items.
+     */
     void applyTag(QListViewItem *item, const QString &text, int column);
     int leftMostVisibleColumn() const;
@@ -274,5 +277,14 @@ private slots:
     void slotEmitSelected() { emit signalSelectionChanged(selectedItems()); }
     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 slotColumnOrderChanged(int, int from, int to);

--- kdemultimedia/juk/tageditor.cpp  #1.29:1.30
@@ -496,4 +496,6 @@ void TagEditor::save(const PlaylistItemL
             else
                 errorFiles.append(item->fileName());
+
+            kapp->processEvents();
         }