Bug 263121

Summary: Playlist tooltips are always shown
Product: [Applications] amarok Reporter: Job Noorman <job>
Component: Playlist/Playlist Layout EditorAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: nhn, teo
Priority: NOR    
Version: 2.4-GIT   
Target Milestone: 2.4.1   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 2.4.1
Sentry Crash Report:

Description Job Noorman 2011-01-14 11:10:55 UTC
Version:           2.3.90 (2.4 beta 1) (using KDE 4.5.95) 
OS:                Linux

Even if I deselect "Show tooltips" option in the "Playlist Layout Editor", tooltips are shown in the playlist.

Reproducible: Always




OS: Linux (i686) release 2.6.35-24-ck
Comment 1 Myriam Schweingruber 2011-01-14 13:03:51 UTC
Confirmed in latest 2.4-git
Comment 2 Sergey Ivanov 2011-01-14 18:17:36 UTC
commit 77636f68fc28a030538baef48965fb99b0da1eff
branch master
Author: Sergey Ivanov <123kash@gmail.com>
Date:   Fri Jan 14 20:16:42 2011 +0300

    Hide playlist tooltip If It was disabled in playlist layout manager.
    BUG: 263121

diff --git a/ChangeLog b/ChangeLog
index a975985..c7ab729 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@ VERSION 2.4.1
   CHANGES:
 
   BUGFIXES:
+    * Fixed issue with playlist tooltips that was shown independetly from "Show tooltip" option. (BR 263121)
     * Fixed issues with multifiles cuesheet, when all tracks get metadata of last track
       in cuesheet, and each file defined in sheet gets all tracks of this sheet.
       (BR 262668) (BR 209341)
diff --git a/src/playlist/PlaylistModel.cpp b/src/playlist/PlaylistModel.cpp
index e3821e2..1a31083 100644
--- a/src/playlist/PlaylistModel.cpp
+++ b/src/playlist/PlaylistModel.cpp
@@ -55,6 +55,7 @@
 #include <typeinfo>
 
 bool Playlist::Model::s_tooltipColumns[NUM_COLUMNS];
+bool Playlist::Model::s_showToolTip;
 
 // ------- helper functions for the tooltip
 
@@ -186,6 +187,12 @@ Playlist::Model::setTooltipColumns( bool columns[] )
         s_tooltipColumns[i] = columns[i];
 }
 
+void
+Playlist::Model::enableToolTip( bool enable )
+{
+    s_showToolTip = enable;
+}
+
 QString
 Playlist::Model::tooltipFor( Meta::TrackPtr track ) const
 {
@@ -273,7 +280,7 @@ Playlist::Model::data( const QModelIndex& index, int role ) const
     else if ( role == StopAfterTrackRole )
         return Actions::instance()->willStopAfterTrack( idAt( row ) );
 
-    else if ( role == Qt::ToolTipRole )
+    else if ( role == Qt::ToolTipRole && s_showToolTip )
         return tooltipFor( m_items.at( row )->track() );
 
     else if ( role == Qt::DisplayRole )
diff --git a/src/playlist/PlaylistModel.h b/src/playlist/PlaylistModel.h
index 3ad8030..faffabf 100644
--- a/src/playlist/PlaylistModel.h
+++ b/src/playlist/PlaylistModel.h
@@ -107,6 +107,8 @@ class AMAROK_EXPORT Model : public QAbstractListModel, public Meta::Observer, pu
         /** Set the columns that are displayed in the tooltip */
         static void setTooltipColumns( bool columns[] );
 
+        static void enableToolTip( bool enable );
+
     signals:
         void activeTrackChanged( quint64 );
         void queueChanged();
@@ -152,6 +154,7 @@ class AMAROK_EXPORT Model : public QAbstractListModel, public Meta::Observer, pu
         int m_setStateOfItem_batchMaxRow;
 
         static bool s_tooltipColumns[NUM_COLUMNS];
+        static bool s_showToolTip;
 };
 
 } // namespace Playlist
diff --git a/src/playlist/view/listview/PrettyListView.cpp b/src/playlist/view/listview/PrettyListView.cpp
index 062c584..cd650f6 100644
--- a/src/playlist/view/listview/PrettyListView.cpp
+++ b/src/playlist/view/listview/PrettyListView.cpp
@@ -988,6 +988,7 @@ void Playlist::PrettyListView::playlistLayoutChanged()
         // excludeCover |= item.showCover();
     }
     Playlist::Model::setTooltipColumns( tooltipColumns );
+    Playlist::Model::enableToolTip( Playlist::LayoutManager::instance()->activeLayout().tooltips() );
 
     update();