mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
commit
585009bc16
@ -70,7 +70,6 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
||||
AudioControls.cpp
|
||||
SettingsDialog.cpp
|
||||
DiagnosticsDialog.cpp
|
||||
SettingsListDelegate.cpp
|
||||
TomahawkWindow.cpp
|
||||
LoadXSPFDialog.cpp
|
||||
SocialWidget.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,23 @@ 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() );
|
||||
|
||||
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 );
|
||||
|
||||
//Network settings
|
||||
TomahawkSettings::ExternalAddressMode mode = TomahawkSettings::instance()->externalAddressMode();
|
||||
@ -102,8 +115,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 +221,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 +288,59 @@ 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 );
|
||||
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 );
|
||||
|
||||
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 *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 );
|
||||
|
||||
maxlen += 15; // padding
|
||||
accountsButton->setSizeHint( QSize( maxlen, 60 ) );
|
||||
musicButton->setSizeHint( QSize( maxlen, 60 ) );
|
||||
advancedButton->setSizeHint( QSize( maxlen, 60 ) );
|
||||
|
||||
#ifndef Q_WS_MAC
|
||||
// doesn't listen to sizehint...
|
||||
ui->listWidget->setFixedWidth( maxlen + 8 );
|
||||
#endif
|
||||
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 );
|
||||
|
||||
connect( ui->listWidget, SIGNAL( currentItemChanged( QListWidgetItem*, QListWidgetItem* ) ), SLOT( changePage( QListWidgetItem*, QListWidgetItem* ) ) );
|
||||
m_settingsGroup->setExclusive( true );
|
||||
|
||||
m_toolBar->addActions( m_settingsGroup->actions() );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
@ -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
|
@ -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>
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -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
|
||||
@ -76,9 +77,29 @@ 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
|
||||
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 );
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user