From 97e1d0fe3f836c42325ab039b38bc1322496f60f Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Wed, 1 Aug 2012 21:52:19 +0200
Subject: [PATCH 1/5] Replace the list widget in the settings dialog with a
 horizontal thingy.

---
 src/CMakeLists.txt           |   1 -
 src/SettingsDialog.cpp       | 104 +++++++++++++++++++--------------
 src/SettingsDialog.h         |   8 ++-
 src/SettingsListDelegate.cpp |  74 -----------------------
 src/SettingsListDelegate.h   |  39 -------------
 src/StackedSettingsDialog.ui | 110 +++++++++++------------------------
 6 files changed, 100 insertions(+), 236 deletions(-)
 delete mode 100644 src/SettingsListDelegate.cpp
 delete mode 100644 src/SettingsListDelegate.h

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c7894f210..26a4b8342 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -70,7 +70,6 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
      AudioControls.cpp
      SettingsDialog.cpp
      DiagnosticsDialog.cpp
-     SettingsListDelegate.cpp
      TomahawkWindow.cpp
      LoadXSPFDialog.cpp
      SocialWidget.cpp
diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp
index 213373ea0..7e9c07293 100644
--- a/src/SettingsDialog.cpp
+++ b/src/SettingsDialog.cpp
@@ -3,6 +3,7 @@
  *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  *   Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
+ *   Copyright 2012,      Teo Mrnjavac <teo@kde.org>
  *
  *   Tomahawk is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -28,6 +29,7 @@
 #include <QtNetwork/QNetworkProxy>
 #include <QtGui/QVBoxLayout>
 #include <QtGui/QSizeGrip>
+#include <QtGui/QToolBar>
 
 #include "AtticaManager.h"
 #include "AclRegistry.h"
@@ -39,7 +41,6 @@
 #include "ExternalResolverGui.h"
 #include "utils/TomahawkUtilsGui.h"
 #include "utils/GuiHelpers.h"
-#include "SettingsListDelegate.h"
 #include "accounts/AccountDelegate.h"
 #include "database/Database.h"
 #include "network/Servent.h"
@@ -72,11 +73,18 @@ SettingsDialog::SettingsDialog( QWidget *parent )
     TomahawkSettings* s = TomahawkSettings::instance();
 
     TomahawkUtils::unmarginLayout( layout() );
-    ui->stackedWidget->setContentsMargins( 4, 4, 4, 0 );
 
+#ifdef Q_WS_X11
+    ui->stackedWidget->setContentsMargins( 4, 4, 4, 4 );
+#else
+    ui->stackedWidget->setContentsMargins( 4, 4, 4, 0 );
+#endif
     ui->checkBoxReporter->setChecked( s->crashReporterEnabled() );
     ui->checkBoxHttp->setChecked( s->httpEnabled() );
 
+    m_toolBar = new QToolBar( tr( "Tomahawk Settings" ), this );
+    ui->horizontalLayout->insertWidget( 0, m_toolBar );
+    m_toolBar->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
 
     //Network settings
     TomahawkSettings::ExternalAddressMode mode = TomahawkSettings::instance()->externalAddressMode();
@@ -102,8 +110,6 @@ SettingsDialog::SettingsDialog( QWidget *parent )
 
     createIcons();
 #ifdef Q_WS_X11
-    ui->listWidget->setFrameShape( QFrame::StyledPanel );
-    ui->listWidget->setFrameShadow( QFrame::Sunken );
     setContentsMargins( 4, 4, 4, 4 );
 #else
     setContentsMargins( 0, 4, 4, 4 );
@@ -210,9 +216,6 @@ SettingsDialog::SettingsDialog( QWidget *parent )
     connect( ui->upnpRadioButton, SIGNAL( toggled(bool) ), SLOT( toggleRemoteMode() ) );
     connect( ui->enableProxyCheckBox, SIGNAL( toggled(bool) ), SLOT( toggleProxyEnabled() ) );
     connect( this, SIGNAL( rejected() ), SLOT( onRejected() ) );
-
-    ui->listWidget->setCurrentRow( 0 );
-    ui->listWidget->setItemDelegate(new SettingsListDelegate());
 }
 
 
@@ -280,56 +283,67 @@ SettingsDialog::serventReady()
 void
 SettingsDialog::createIcons()
 {
-    /// Not fun but QListWidget sucks. Do our max-width calculation manually
-    /// so the icons arre lined up.
-    // Resolvers is the longest string... in english. fml.
-
     ensurePolished();
 
-    int maxlen = 0;
-    QFontMetrics fm( font() );
-    QListWidgetItem *accountsButton = new QListWidgetItem( ui->listWidget );
-    accountsButton->setIcon( QIcon( RESPATH "images/account-settings.png" ) );
-    accountsButton->setText( tr( "Services" ) );
-    accountsButton->setTextAlignment( Qt::AlignHCenter );
-    accountsButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
-    maxlen = fm.width( accountsButton->text() );
+    m_settingsGroup = new QActionGroup( m_toolBar );
 
-    QListWidgetItem *musicButton = new QListWidgetItem( ui->listWidget );
-    musicButton->setIcon( QIcon( RESPATH "images/music-settings.png" ) );
-    musicButton->setText( tr( "Collection" ) );
-    musicButton->setTextAlignment( Qt::AlignHCenter );
-    musicButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
-    maxlen = qMax( fm.width( musicButton->text() ), maxlen );
+    QWidget *leftSpacer = new QWidget( m_toolBar );
+    leftSpacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
+    m_toolBar->addWidget( leftSpacer );
 
-    QListWidgetItem *advancedButton = new QListWidgetItem( ui->listWidget );
-    advancedButton->setIcon( QIcon( RESPATH "images/advanced-settings.png" ) );
-    advancedButton->setText( tr( "Advanced" ) );
-    advancedButton->setTextAlignment( Qt::AlignHCenter );
-    advancedButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
-    maxlen = qMax( fm.width( advancedButton->text() ), maxlen );
+    QAction *accountsAction = new QAction( QIcon( RESPATH "images/account-settings.png" ),
+                                           tr( "Services" ),
+                                           m_toolBar );
+    accountsAction->setCheckable( true );
+    accountsAction->setToolTip( tr( "<b>Services</b><br>"
+                                    "Configure the accounts and services used by Tomahawk "
+                                    "to search and retrieve music, find your friends and "
+                                    "update your status." ) );
+    m_settingsGroup->addAction( accountsAction );
 
-    maxlen += 15; // padding
-    accountsButton->setSizeHint( QSize( maxlen, 60 ) );
-    musicButton->setSizeHint( QSize( maxlen, 60 ) );
-    advancedButton->setSizeHint( QSize( maxlen, 60 ) );
+    QAction *musicAction = new QAction( QIcon( RESPATH "images/music-settings.png" ),
+                                        tr( "Collection" ),
+                                        m_toolBar );
+    musicAction->setCheckable( true );
+    musicAction->setToolTip( tr( "<b>Collection</b><br>"
+                                 "Manage how Tomahawk finds music on your computer." ) );
+    m_settingsGroup->addAction( musicAction );
 
-#ifndef Q_WS_MAC
-    // doesn't listen to sizehint...
-    ui->listWidget->setFixedWidth( maxlen + 8 );
-#endif
 
-    connect( ui->listWidget, SIGNAL( currentItemChanged( QListWidgetItem*, QListWidgetItem* ) ), SLOT( changePage( QListWidgetItem*, QListWidgetItem* ) ) );
+    QAction *advancedAction = new QAction( QIcon( RESPATH "images/advanced-settings.png" ),
+                                           tr( "Advanced" ),
+                                           m_toolBar );
+    advancedAction->setCheckable( true );
+    advancedAction->setToolTip( tr( "<b>Advanced</b><br>"
+                                    "Configure Tomahawk's advanced settings, including "
+                                    "network connectivity settings, browser interaction "
+                                    "and more." ) );
+    m_settingsGroup->addAction( advancedAction );
+
+    m_settingsGroup->setExclusive( true );
+
+    m_toolBar->addActions( m_settingsGroup->actions() );
+
+    QWidget *rightSpacer = new QWidget( m_toolBar );
+    rightSpacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
+    m_toolBar->addWidget( rightSpacer );
+
+    connect( m_settingsGroup, SIGNAL( triggered( QAction * ) ),
+             this, SLOT( changePage( QAction * ) ) );
+
+    accountsAction->setChecked( true );
+    changePage( accountsAction );
 }
 
 
 void
-SettingsDialog::changePage( QListWidgetItem* current, QListWidgetItem* previous )
+SettingsDialog::changePage( QAction *action )
 {
-    if ( !current )
-        current = previous;
-
-    ui->stackedWidget->setCurrentIndex( ui->listWidget->row(current) );
+    int index = m_settingsGroup->actions().indexOf( action );
+    if( ui->stackedWidget->currentIndex() != index )
+    {
+        ui->stackedWidget->setCurrentIndex( index );
+    }
 }
 
 
diff --git a/src/SettingsDialog.h b/src/SettingsDialog.h
index 487f6e4ae..88cb934a0 100644
--- a/src/SettingsDialog.h
+++ b/src/SettingsDialog.h
@@ -3,6 +3,7 @@
  *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  *   Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
+ *   Copyright 2012,      Teo Mrnjavac <teo@kde.org>
  *
  *   Tomahawk is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -23,6 +24,8 @@
 
 #include <QtGui/QDialog>
 #include <QtCore/QModelIndex>
+#include <QtGui/QActionGroup>
+#include <QtGui/QToolBar>
 
 #include "config.h"
 
@@ -94,7 +97,7 @@ private slots:
 
     void updateScanOptionsView();
 
-    void changePage( QListWidgetItem*, QListWidgetItem* );
+    void changePage( QAction *action );
     void serventReady();
 
     void aclEntryClearButtonClicked();
@@ -106,6 +109,9 @@ private:
 
     Ui_StackedSettingsDialog* ui;
 
+    QToolBar *m_toolBar;
+    QActionGroup *m_settingsGroup;
+
     ProxyDialog m_proxySettings;
     bool m_rejected;
     bool m_restartRequired;
diff --git a/src/SettingsListDelegate.cpp b/src/SettingsListDelegate.cpp
deleted file mode 100644
index 3756c5314..000000000
--- a/src/SettingsListDelegate.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
- *
- *   Copyright 2011, Michael Zanetti <mzanetti@kde.org>
- *   Copyright 2011, Leo Franchi <lfranchi@kde.org>
- *
- *   Tomahawk 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 Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Tomahawk is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "SettingsListDelegate.h"
-#include "utils/Logger.h"
-
-#include <QPainter>
-#include <QIcon>
-#include <QApplication>
-
-SettingsListDelegate::SettingsListDelegate(QObject *parent) :
-    QStyledItemDelegate(parent)
-{
-}
-
-
-void SettingsListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
-    painter->save();
-
-    QStyleOptionViewItemV4 opt = option;
-    initStyleOption( &opt, QModelIndex() );
-    qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
-
-#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
-    // On mac draw our own selection rect as we don't get one from osx (around the whole icon or around just text)
-    if ( opt.state & QStyle::State_Selected )
-    {
-        painter->setRenderHint( QPainter::Antialiasing );
-
-        QPainterPath p;
-        p.addRoundedRect( opt.rect.adjusted( 2, 1, -1, -1 ), 5, 5 );
-
-        QColor fill( 214, 214, 214 );
-        QColor border( 107, 107, 107 );
-        painter->setPen( border );
-        painter->drawPath( p );
-        painter->fillPath( p, fill );
-    }
-#else
-    if ( ( option.state & QStyle::State_Selected ) == QStyle::State_Selected )
-    {
-        painter->setPen( option.palette.color( QPalette::HighlightedText ) );
-    }
-#endif
-
-    int horizontalOffset = ( option.rect.width() - option.decorationSize.width() ) /2;
-    QRect iconRect = option.rect.adjusted( horizontalOffset, 6, -horizontalOffset, -option.rect.height() + 6 + option.decorationSize.height() );
-    QPixmap avatar = index.data( Qt::DecorationRole ).value<QIcon>().pixmap( iconRect.size() );
-    painter->drawPixmap( iconRect, avatar );
-
-    QRect textRect = option.rect.adjusted( 6, iconRect.height() + 8, -6, 0 );
-    QString text = painter->fontMetrics().elidedText( index.data( Qt::DisplayRole ).toString(), Qt::ElideRight, textRect.width() );
-    QTextOption to( Qt::AlignHCenter );
-    painter->drawText( textRect, text, to );
-
-    painter->restore();
-}
diff --git a/src/SettingsListDelegate.h b/src/SettingsListDelegate.h
deleted file mode 100644
index 730de7858..000000000
--- a/src/SettingsListDelegate.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
- *
- *   Copyright 2011, Michael Zanetti <mzanetti@kde.org>
- *   Copyright 2011, Leo Franchi <lfranchi@kde.org>
- *
- *   Tomahawk 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 Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Tomahawk is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef SETTINGSLISTDELEGATE_H
-#define SETTINGSLISTDELEGATE_H
-
-#include <QStyledItemDelegate>
-
-class SettingsListDelegate : public QStyledItemDelegate
-{
-    Q_OBJECT
-public:
-    explicit SettingsListDelegate(QObject *parent = 0);
-
-    virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
-signals:
-
-public slots:
-
-};
-
-#endif // SETTINGSLISTDELEGATE_H
diff --git a/src/StackedSettingsDialog.ui b/src/StackedSettingsDialog.ui
index 08dcdf48b..e260416d4 100644
--- a/src/StackedSettingsDialog.ui
+++ b/src/StackedSettingsDialog.ui
@@ -18,74 +18,11 @@
     <number>0</number>
    </property>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <widget class="QListWidget" name="listWidget">
-         <property name="focusPolicy">
-          <enum>Qt::NoFocus</enum>
-         </property>
-         <property name="frameShape">
-          <enum>QFrame::StyledPanel</enum>
-         </property>
-         <property name="frameShadow">
-          <enum>QFrame::Sunken</enum>
-         </property>
-         <property name="verticalScrollBarPolicy">
-          <enum>Qt::ScrollBarAlwaysOff</enum>
-         </property>
-         <property name="horizontalScrollBarPolicy">
-          <enum>Qt::ScrollBarAlwaysOff</enum>
-         </property>
-         <property name="autoScroll">
-          <bool>true</bool>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>32</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="movement">
-          <enum>QListView::Static</enum>
-         </property>
-         <property name="resizeMode">
-          <enum>QListView::Adjust</enum>
-         </property>
-         <property name="layoutMode">
-          <enum>QListView::Batched</enum>
-         </property>
-         <property name="spacing">
-          <number>1</number>
-         </property>
-         <property name="viewMode">
-          <enum>QListView::IconMode</enum>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="verticalSpacer_3">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>1</width>
-           <height>4</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </item>
+    <layout class="QVBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QStackedWidget" name="stackedWidget">
        <property name="currentIndex">
-        <number>2</number>
+        <number>0</number>
        </property>
        <widget class="QWidget" name="accountsPage">
         <layout class="QVBoxLayout" name="verticalLayout_11">
@@ -93,9 +30,12 @@
           <number>0</number>
          </property>
          <item>
-          <widget class="QGroupBox" name="groupBox_4">
-           <property name="title">
-            <string>Internet Services</string>
+          <widget class="QFrame" name="frame_4">
+           <property name="frameShape">
+            <enum>QFrame::NoFrame</enum>
+           </property>
+           <property name="frameShadow">
+            <enum>QFrame::Plain</enum>
            </property>
            <layout class="QVBoxLayout" name="verticalLayout_8">
             <property name="margin">
@@ -153,11 +93,17 @@
           <number>0</number>
          </property>
          <item>
-          <widget class="QGroupBox" name="groupBox_2">
-           <property name="title">
-            <string>Local Music Information</string>
+          <widget class="QFrame" name="frame_2">
+           <property name="frameShape">
+            <enum>QFrame::NoFrame</enum>
+           </property>
+           <property name="frameShadow">
+            <enum>QFrame::Plain</enum>
            </property>
            <layout class="QVBoxLayout" name="verticalLayout_17">
+            <property name="margin">
+             <number>2</number>
+            </property>
             <item>
              <layout class="QVBoxLayout" name="verticalLayout_4">
               <item>
@@ -234,17 +180,23 @@
           <number>0</number>
          </property>
          <item>
-          <widget class="QGroupBox" name="groupBoxNetworkAdvanced">
+          <widget class="QFrame" name="frameNetworkAdvanced">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
              <horstretch>0</horstretch>
              <verstretch>0</verstretch>
             </sizepolicy>
            </property>
-           <property name="title">
-            <string>Advanced Settings</string>
+           <property name="frameShape">
+            <enum>QFrame::NoFrame</enum>
+           </property>
+           <property name="frameShadow">
+            <enum>QFrame::Plain</enum>
            </property>
            <layout class="QVBoxLayout" name="verticalLayout_13">
+            <property name="spacing">
+             <number>-1</number>
+            </property>
             <property name="margin">
              <number>2</number>
             </property>
@@ -342,10 +294,13 @@
               <property name="orientation">
                <enum>Qt::Vertical</enum>
               </property>
+              <property name="sizeType">
+               <enum>QSizePolicy::Fixed</enum>
+              </property>
               <property name="sizeHint" stdset="0">
                <size>
                 <width>20</width>
-                <height>40</height>
+                <height>10</height>
                </size>
               </property>
              </spacer>
@@ -378,10 +333,13 @@
               <property name="orientation">
                <enum>Qt::Vertical</enum>
               </property>
+              <property name="sizeType">
+               <enum>QSizePolicy::Fixed</enum>
+              </property>
               <property name="sizeHint" stdset="0">
                <size>
                 <width>20</width>
-                <height>40</height>
+                <height>10</height>
                </size>
               </property>
              </spacer>

From 67611d10d12f417eff9c2708fbbfe505ee06d045 Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Wed, 1 Aug 2012 22:13:52 +0200
Subject: [PATCH 2/5] Added a styled separator line in the Settings Dialog.

---
 src/SettingsDialog.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp
index 7e9c07293..024e8a603 100644
--- a/src/SettingsDialog.cpp
+++ b/src/SettingsDialog.cpp
@@ -82,6 +82,11 @@ SettingsDialog::SettingsDialog( QWidget *parent )
     ui->checkBoxReporter->setChecked( s->crashReporterEnabled() );
     ui->checkBoxHttp->setChecked( s->httpEnabled() );
 
+    QFrame *sepLine = new QFrame( this );
+    sepLine->setFrameShape( QFrame::HLine );
+    sepLine->setFrameShadow( QFrame::Sunken );
+    ui->horizontalLayout->insertWidget( 0, sepLine );
+
     m_toolBar = new QToolBar( tr( "Tomahawk Settings" ), this );
     ui->horizontalLayout->insertWidget( 0, m_toolBar );
     m_toolBar->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );

From 2236b0ffb38e9538f08cb4b3e268e29bbac4b449 Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Wed, 1 Aug 2012 22:14:58 +0200
Subject: [PATCH 3/5] Moved the settings categories to the left.

---
 src/SettingsDialog.cpp | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp
index 024e8a603..b1aa8b7a2 100644
--- a/src/SettingsDialog.cpp
+++ b/src/SettingsDialog.cpp
@@ -292,10 +292,6 @@ SettingsDialog::createIcons()
 
     m_settingsGroup = new QActionGroup( m_toolBar );
 
-    QWidget *leftSpacer = new QWidget( m_toolBar );
-    leftSpacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
-    m_toolBar->addWidget( leftSpacer );
-
     QAction *accountsAction = new QAction( QIcon( RESPATH "images/account-settings.png" ),
                                            tr( "Services" ),
                                            m_toolBar );
@@ -329,10 +325,6 @@ SettingsDialog::createIcons()
 
     m_toolBar->addActions( m_settingsGroup->actions() );
 
-    QWidget *rightSpacer = new QWidget( m_toolBar );
-    rightSpacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
-    m_toolBar->addWidget( rightSpacer );
-
     connect( m_settingsGroup, SIGNAL( triggered( QAction * ) ),
              this, SLOT( changePage( QAction * ) ) );
 

From 7e47d0efcc4dab2413bddea105663a0a0f65e458 Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Thu, 2 Aug 2012 12:24:28 +0200
Subject: [PATCH 4/5] Reenabled ProxyStyle under QtCurve, and fixed QSlider
 appearance.

---
 src/TomahawkWindow.cpp               |  6 +-----
 src/libtomahawk/utils/ProxyStyle.cpp | 16 ++++++++++++++++
 src/libtomahawk/utils/ProxyStyle.h   |  1 +
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/TomahawkWindow.cpp b/src/TomahawkWindow.cpp
index 09e6fe70d..7949baa62 100644
--- a/src/TomahawkWindow.cpp
+++ b/src/TomahawkWindow.cpp
@@ -202,11 +202,7 @@ TomahawkWindow::saveSettings()
 void
 TomahawkWindow::applyPlatformTweaks()
 {
-    // HACK QtCurve causes an infinite loop on startup. This is because setStyle calls setPalette, which calls ensureBaseStyle,
-    // which loads QtCurve. QtCurve calls setPalette, which creates an infinite loop. The UI will look like CRAP with QtCurve, but
-    // the user is asking for it explicitly... so he's gonna be stuck with an ugly UI.
-    if ( !QString( qApp->style()->metaObject()->className() ).toLower().contains( "qtcurve" ) )
-        qApp->setStyle( new ProxyStyle() );
+    qApp->setStyle( new ProxyStyle() );
 
 #ifdef Q_OS_MAC
     setUnifiedTitleAndToolBarOnMac( true );
diff --git a/src/libtomahawk/utils/ProxyStyle.cpp b/src/libtomahawk/utils/ProxyStyle.cpp
index cb7cd45e1..4a33e506f 100644
--- a/src/libtomahawk/utils/ProxyStyle.cpp
+++ b/src/libtomahawk/utils/ProxyStyle.cpp
@@ -1,6 +1,7 @@
 /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  *
  *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
+ *   Copyright 2012, Teo Mrnjavac <teo@kde.org>
  *
  *   Tomahawk is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -82,3 +83,18 @@ ProxyStyle::drawControl( ControlElement ce, const QStyleOption* opt, QPainter* p
     else
         QProxyStyle::drawControl( ce, opt, p, w );
 }
+
+QSize
+ProxyStyle::sizeFromContents( QStyle::ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget ) const
+{
+    if( type == CT_Splitter )
+    {
+        const QSplitter* splitter = qobject_cast< const QSplitter* >( widget );
+        if( splitter->orientation() == Qt::Horizontal )
+            return QSize( 1, size.height() );
+        else
+            return QSize( size.width(), 1 );
+    }
+    else
+        return QProxyStyle::sizeFromContents( type, option, size, widget );
+}
diff --git a/src/libtomahawk/utils/ProxyStyle.h b/src/libtomahawk/utils/ProxyStyle.h
index 0a8d636ca..aa1dec625 100644
--- a/src/libtomahawk/utils/ProxyStyle.h
+++ b/src/libtomahawk/utils/ProxyStyle.h
@@ -31,6 +31,7 @@ public:
 
     virtual void drawPrimitive( PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0 ) const;
     virtual void drawControl( ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w = 0 ) const;
+    virtual QSize sizeFromContents( ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget ) const;
 };
 
 #endif // PROXYSTYLE_H

From a19198b206e0123868d75c0641043b1db7032b7c Mon Sep 17 00:00:00 2001
From: Teo Mrnjavac <teo@kde.org>
Date: Thu, 2 Aug 2012 19:01:30 +0200
Subject: [PATCH 5/5] Removed the annoying thin grey line from the Queue
 splitter widget. Also made the ContextWidget header cursor a PointingHand
 because consistency is good.

---
 src/libtomahawk/context/ContextWidget.cpp    | 1 +
 src/libtomahawk/utils/ProxyStyle.cpp         | 7 ++++++-
 src/libtomahawk/widgets/AnimatedSplitter.cpp | 9 ++++-----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/libtomahawk/context/ContextWidget.cpp b/src/libtomahawk/context/ContextWidget.cpp
index bbf0e8334..618d1a0fb 100644
--- a/src/libtomahawk/context/ContextWidget.cpp
+++ b/src/libtomahawk/context/ContextWidget.cpp
@@ -84,6 +84,7 @@ ContextWidget::ContextWidget( QWidget* parent )
     QPalette whitePal = ui->toggleButton->palette();
     whitePal.setColor( QPalette::Foreground, Qt::white );
     ui->toggleButton->setPalette( whitePal );
+    ui->toggleButton->setCursor( Qt::PointingHandCursor );
 
     QFont boldFont = ui->toggleButton->font();
     boldFont.setPixelSize( 12 );
diff --git a/src/libtomahawk/utils/ProxyStyle.cpp b/src/libtomahawk/utils/ProxyStyle.cpp
index 4a33e506f..fe57817c8 100644
--- a/src/libtomahawk/utils/ProxyStyle.cpp
+++ b/src/libtomahawk/utils/ProxyStyle.cpp
@@ -77,7 +77,12 @@ ProxyStyle::drawControl( ControlElement ce, const QStyleOption* opt, QPainter* p
         if ( !splitter->sizes().contains( 0 ) )
         {
             p->setPen( QColor( 0x8c, 0x8c, 0x8c ) );
-            p->drawLine( opt->rect.topLeft(), opt->rect.bottomRight() );
+            // We must special-case this because of the AnimatedSplitterHandle which has a
+            // SizeHint of 0,0.
+            if( splitter->orientation() == Qt::Vertical )
+                p->drawLine( opt->rect.topLeft(), opt->rect.topRight() );
+            else
+                p->drawLine( opt->rect.topLeft(), opt->rect.bottomRight() );
         }
     }
     else
diff --git a/src/libtomahawk/widgets/AnimatedSplitter.cpp b/src/libtomahawk/widgets/AnimatedSplitter.cpp
index 539433136..95992e19a 100644
--- a/src/libtomahawk/widgets/AnimatedSplitter.cpp
+++ b/src/libtomahawk/widgets/AnimatedSplitter.cpp
@@ -298,9 +298,8 @@ AnimatedSplitterHandle::sizeHint() const
         m_lastCount = splitter()->count();
     }
 
-    // sizeHint is 0,0 if widget below handle has size 0 or is hidden
-    if ( splitter()->widget( m_indexInSplitter )->height() == 0 )
-        return QSize( 0, 0 );
-    else
-        return QSize( 1, 1 );
+    // Since we are in an AnimatedSplitter, we always return 0,0 for SizeHint, simply
+    // because we know there's going to be a handle in the bottom widget to move the
+    // splitter.
+    return QSize( 0, 0 );
 }