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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Nikolaj Hald Nielsen <nhnFreespirit () gmail ! com>
Date:       2009-07-15 14:40:33
Message-ID: 1247668833.062947.29916.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 997217 by nhnielsen:

RFC: Experiments with an app wide colored toolbar that lines up with the toolbar in \
the context view. Its not perfectly consistent yet, mainly it needs to be added to \
all the terminl categories in the browsers, and it has other issues still. Also, hhis \
will lead to empty toolbars in some (many) cases, but it adds symmetry.



 M  +50 -0     ToolBar.h  
 M  +9 -1      browsers/BrowserCategory.cpp  
 M  +4 -2      browsers/BrowserCategory.h  
 M  +5 -0      browsers/BrowserCategoryList.cpp  
 M  +6 -2      playlist/PlaylistWidget.cpp  


--- trunk/extragear/multimedia/amarok/src/ToolBar.h #997216:997217
@@ -1,6 +1,7 @@
 /****************************************************************************************
                
  * Copyright (c) 2004 Max Howell <max.howell@methylblue.com>                         \
                *
  * Copyright (c) 2007 Dan Meltzer <parallelgrapefruit@gmail.com>                     \
* + * Copyright (c) 2009 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com>               \
                *
  *                                                                                   \
                *
  * This program is free software; you can redistribute it and/or modify it under     \
                *
  * the terms of the GNU General Public License as published by the Free Software     \
* @@ -20,9 +21,14 @@
 
 #include "ActionClasses.h"
 #include "EngineController.h"
+#include "PaletteHandler.h"
 
 #include <ktoolbar.h>
 
+#include <QPainter>
+#include <QPaintEvent>
+#include <QPalette>
+
 namespace Amarok {
 
     class ToolBar : public KToolBar
@@ -56,6 +62,50 @@
 
     };
 
+    class ColoredToolBar : public KToolBar
+    {
+        public:
+         /**
+         * Create a colored Toolbar.
+         * @param parent The Main Window that
+         * this toolbar belongs to.
+         * @param name The QObject name of this toolbar
+             */
+            ColoredToolBar( QMainWindow *parent, const char *name )
+            : KToolBar( name, parent, Qt::TopToolBarArea, true, false, false )
+            {
+            }
+
+            /**
+             * Create a colored toolbar that can live anywhere.
+             * @param parent The Widget that should be the parent of this toolbar
+             * @param name The QObject name of this toolbar
+             */
+            ColoredToolBar( QWidget *parent )
+            : KToolBar( parent, false, false )
+            {
+            }
+
+
+        protected:
+            virtual void paintEvent( QPaintEvent * event )
+            {
+                QPainter painter( this );
+
+                painter.setRenderHint( QPainter::Antialiasing );
+                painter.save();
+
+                QColor col = PaletteHandler::highlightColor();
+                qreal radius = 6;
+
+                QPainterPath outline;
+                outline.addRoundedRect( event->rect(), radius, radius );
+                painter.fillPath( outline, QBrush( col ) );
+
+                painter.restore();
+            }
+    };
+
 }
 
 #endif
--- trunk/extragear/multimedia/amarok/src/browsers/BrowserCategory.cpp #997216:997217
@@ -21,6 +21,8 @@
 
 #include "Debug.h"
 
+#include "ToolBar.h"
+
 #include <QVBoxLayout>
 #include <QWidget>
 
@@ -36,7 +38,8 @@
     setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
     setFrameShape( QFrame::NoFrame );
 
-    m_expandingControls = new ExpandingControlsWidget( 0 );
+    m_bottomToolbar = new Amarok::ColoredToolBar( 0 );
+    m_bottomToolbar->setFixedHeight( 28 );
 }
 
 BrowserCategory::~BrowserCategory()
@@ -132,4 +135,9 @@
     return m_imagePath;
 }
 
+KToolBar * BrowserCategory::bottomToolbar()
+{
+    return m_bottomToolbar;
+}
+
 #include "BrowserCategory.moc"
--- trunk/extragear/multimedia/amarok/src/browsers/BrowserCategory.h #997216:997217
@@ -19,7 +19,7 @@
 
 #include "amarok_export.h"
 
-#include "widgets/ExpandingControlsWidget.h"
+#include "ToolBar.h"
 
 #include <KVBox>
 
@@ -109,6 +109,8 @@
     virtual void setFilter( const QString &filter ) { Q_UNUSED( filter ) };
     virtual void setLevels( const QList<int> &levels ) { Q_UNUSED( levels ) };
 
+    KToolBar * bottomToolbar();
+
 public slots:
     void activate();
 
@@ -122,7 +124,7 @@
     BrowserCategoryList * m_parentList;
 
     BreadcrumbItem * m_breadcrumb;
-    ExpandingControlsWidget * m_expandingControls;
+    KToolBar * m_bottomToolbar;
     
 
 };
--- trunk/extragear/multimedia/amarok/src/browsers/BrowserCategoryList.cpp \
#997216:997217 @@ -71,6 +71,8 @@
     m_categoryListView->setModel( m_proxyModel );
     m_categoryListView->setMouseTracking ( true );
 
+    bottomToolbar()->setParent( this );
+
     connect( m_categoryListView, SIGNAL( activated( const QModelIndex & ) ), this, \
SLOT( categoryActivated( const QModelIndex & ) ) );  
     connect( m_categoryListView, SIGNAL( entered( const QModelIndex & ) ), this, \
SLOT( categoryEntered( const QModelIndex & ) ) ); @@ -154,6 +156,7 @@
     }
 
     m_searchWidget->hide();
+    bottomToolbar()->setParent( 0 );
 
     emit( viewChanged() );
 }
@@ -172,8 +175,10 @@
         m_categoryListView->setParent( this );
         m_currentCategory = 0; // remove any context stuff we might have added
         m_searchWidget->show();
+        bottomToolbar()->setParent( this );
 
         emit( viewChanged() );
+
     }
 }
 
--- trunk/extragear/multimedia/amarok/src/playlist/PlaylistWidget.cpp #997216:997217
@@ -32,6 +32,7 @@
 #include "PlaylistModel.h"
 #include "layouts/LayoutManager.h"
 #include "widgets/ProgressiveSearchWidget.h"
+#include "widgets/HorizontalDivider.h"
 #include "layouts/LayoutConfigAction.h"
 
 
@@ -44,7 +45,7 @@
         : KVBox( parent )
 {
     DEBUG_BLOCK
-    setContentsMargins( 1, 1, 1, 1 );
+    setContentsMargins( 0, 0, 0, 0 );
 
     m_sortWidget = new Playlist::SortWidget( this );
     new HorizontalDivider( this );
@@ -116,8 +117,11 @@
 
     KHBox *barBox = new KHBox( this );
     barBox->setMargin( 0 );
+    barBox->setContentsMargins( 0, 0, 0, 0 );
 
-    KToolBar *plBar = new Amarok::ToolBar( barBox );
+    
+    Amarok::ColoredToolBar *plBar = new Amarok::ColoredToolBar( barBox );
+    plBar->setFixedHeight( 30 );
     plBar->setObjectName( "PlaylistToolBar" );
 
     Model::instance();


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

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