[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/engine/nmm
From:       Robert Gogolok <robertgogolok () gmx ! de>
Date:       2006-03-05 13:44:27
Message-ID: 1141566267.406633.22182.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 515954 by gogolok:

- clicking on Status column for a host entry shows a more descriptive status within a \
                QWhatsThis widget
- default state: Unknown


 M  +7 -1      HostList.cpp  
 M  +20 -7     HostListItem.cpp  
 M  +9 -1      HostListItem.h  


--- trunk/extragear/multimedia/amarok/src/engine/nmm/HostList.cpp #515953:515954
@@ -48,7 +48,7 @@
   setColumnAlignment( HostListItem::Video,    Qt::AlignCenter );
   setColumnAlignment( HostListItem::Audio,    Qt::AlignCenter );
   setColumnAlignment( HostListItem::Volume,   Qt::AlignCenter );
-  setColumnAlignment( HostListItem::Status,   Qt::AlignCenter );
+  setColumnAlignment( HostListItem::Status,   Qt::AlignLeft );
 }
 
 HostList::~HostList()
@@ -75,6 +75,12 @@
       item->toggleAudio();
       item->updateColumn( HostListItem::Audio );
     }
+    // status column
+    else if( e->pos().x() > header()->sectionPos( HostListItem::Status ) &&
+             e->pos().x() < header()->sectionPos( HostListItem::Status ) + \
header()->sectionSize( HostListItem::Status ) ) +    {
+      item->statusToolTip();
+    }
 
     }
   }
--- trunk/extragear/multimedia/amarok/src/engine/nmm/HostListItem.cpp #515953:515954
@@ -27,9 +27,11 @@
 #include <qfont.h>
 #include <qheader.h>
 #include <qpainter.h>
+#include <qwhatsthis.h>
 
 #include <kglobal.h>
 #include <kiconloader.h>
+#include <klocale.h>
 
 #include "debug.h"
 #include "HostList.h"
@@ -39,12 +41,12 @@
     m_audio( audio ),
     m_video( video ),
     m_read_only( read_only ),
-    m_status_error( false )
+    m_status( 0 )
 {  
   setText( HostListItem::Hostname, hostname);
 
-  setPixmap( HostListItem::Status, SmallIcon("help") );
-  setText( HostListItem::Status, "OK" );
+  setPixmap( HostListItem::Status, SmallIcon("info") );
+  setText( HostListItem::Status, i18n("Unknown") );
 }
 
 HostListItem::~HostListItem()
@@ -62,6 +64,13 @@
       listView()->header()->sectionSize( column ) - 2, height() - 2 );
 }
 
+void HostListItem::statusToolTip()
+{
+  if( !m_status )
+    QWhatsThis::display( i18n("<html><body>So far no status available for this host \
entry.<br>Probably this means the host has not been used for \
playback.</body></html>") ); +  // TODO: display QWhatsThis messages for errors
+}
+
 void HostListItem::paintCell(QPainter * p, const QColorGroup & cg, int column, int \
width, int align )  {
   QColorGroup m_cg( cg );
@@ -83,15 +92,19 @@
   else if( column ==  HostListItem::Status )
   {
     QFont font( p->font() );
-    if( m_status_error )
+    if( ! m_status  ) // Unknown
     {
-      font.setBold( true );
-      m_cg.setColor( QColorGroup::Text, Qt::red );
+      font.setBold( false );
     }
-    else {
+    else if( m_status == 1 ) // Ok
+    {
       font.setBold( false );
       m_cg.setColor( QColorGroup::Text, Qt::darkGreen );
     }
+    else { // error
+      font.setBold( true );
+      m_cg.setColor( QColorGroup::Text, Qt::red );
+    }
     p->setFont( font );
   }
 
--- trunk/extragear/multimedia/amarok/src/engine/nmm/HostListItem.h #515953:515954
@@ -49,6 +49,14 @@
 
     void updateColumn( int column ) const;
 
+    /**
+     * Shows extended status text in a QWhatsThis widget.
+     * \todo handle different error scenarios
+     */
+    void statusToolTip();
+
+    QString prettyStatus( int );
+
   protected:
     void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int \
align );  
@@ -57,7 +65,7 @@
     bool m_audio;
     bool m_video;
     bool m_read_only;
-    bool m_status_error;
+    int m_status;
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic