mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-20 07:52:30 +02:00
Add some scaling to the Accounts widget
This commit is contained in:
parent
43ceb25753
commit
1d2457c666
@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012 Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2012, 2013 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
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, TomahawkUtils::DpiScaler( this )
|
||||
, m_model( model )
|
||||
{
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout( this );
|
||||
@ -38,7 +39,7 @@ AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget*
|
||||
m_layout = new QVBoxLayout;
|
||||
TomahawkUtils::unmarginLayout( m_layout );
|
||||
mainLayout->addLayout( m_layout );
|
||||
mainLayout->setSpacing( 8 );
|
||||
mainLayout->setSpacing( scaledY( 8 ) );
|
||||
|
||||
connect( m_model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
|
||||
this, SLOT( updateEntries( QModelIndex, QModelIndex ) ) );
|
||||
@ -58,7 +59,7 @@ AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget*
|
||||
separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " +
|
||||
TomahawkStyle::BORDER_LINE.name() + "; }" ); //from ProxyStyle
|
||||
mainLayout->insertWidget( 0, separatorLine );
|
||||
mainLayout->addSpacing( 6 );
|
||||
mainLayout->addSpacing( scaledY( 6 ) );
|
||||
|
||||
QLabel *connectionsLabel = new QLabel( tr( "Connections" ).toUpper(), this );
|
||||
QFont clFont = connectionsLabel->font();
|
||||
@ -75,7 +76,7 @@ AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget*
|
||||
|
||||
QHBoxLayout *headerLayout = new QHBoxLayout();
|
||||
headerLayout->addWidget( connectionsLabel );
|
||||
headerLayout->addSpacing( 30 );
|
||||
headerLayout->addSpacing( scaledX( 30 ) );
|
||||
headerLayout->addWidget( m_toggleOnlineButton );
|
||||
mainLayout->insertLayout( 0, headerLayout );
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define ACCOUNTLISTWIDGET_H
|
||||
|
||||
#include "AccountModelFactoryProxy.h"
|
||||
#include "utils/DpiScaler.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
@ -27,7 +28,7 @@
|
||||
class AccountWidget;
|
||||
class QPushButton;
|
||||
|
||||
class AccountListWidget : public QWidget
|
||||
class AccountListWidget : public QWidget, private TomahawkUtils::DpiScaler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -45,15 +45,16 @@
|
||||
|
||||
AccountWidget::AccountWidget( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, TomahawkUtils::DpiScaler( this )
|
||||
{
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout( this );
|
||||
TomahawkUtils::unmarginLayout( mainLayout );
|
||||
setLayout( mainLayout );
|
||||
setContentsMargins( 0, 8, 0, 8 );
|
||||
setContentsMargins( 0, scaledY( 8 ), 0, scaledY( 8 ) );
|
||||
|
||||
m_imageLabel = new QLabel( this );
|
||||
mainLayout->addWidget( m_imageLabel );
|
||||
mainLayout->setSpacing( 4 );
|
||||
mainLayout->setSpacing( scaledX( 4 ) );
|
||||
|
||||
QGridLayout* vLayout = new QGridLayout( this );
|
||||
vLayout->setSpacing( 8 );
|
||||
@ -156,7 +157,7 @@ AccountWidget::update( const QPersistentModelIndex& idx, int accountIdx )
|
||||
if ( account )
|
||||
{
|
||||
const QPixmap& pixmap = account->icon();
|
||||
QSize pixmapSize( 32, 32 );
|
||||
QSize pixmapSize( scaled( 32, 32 ) );
|
||||
m_imageLabel->setPixmap( pixmap.scaled( pixmapSize, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
m_imageLabel->setFixedSize( pixmapSize );
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#ifndef ACCOUNTWIDGET_H
|
||||
#define ACCOUNTWIDGET_H
|
||||
|
||||
#include "utils/DpiScaler.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPersistentModelIndex>
|
||||
|
||||
@ -31,7 +33,7 @@ class QLineEdit;
|
||||
class QPushButton;
|
||||
class QToolButton;
|
||||
|
||||
class AccountWidget : public QWidget
|
||||
class AccountWidget : public QWidget, private TomahawkUtils::DpiScaler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
AccountsToolButton::AccountsToolButton( QWidget* parent )
|
||||
: QToolButton( parent )
|
||||
, TomahawkUtils::DpiScaler( this )
|
||||
{
|
||||
m_popup = new AccountsPopupWidget( this );
|
||||
m_popup->hide();
|
||||
@ -42,7 +43,7 @@ AccountsToolButton::AccountsToolButton( QWidget* parent )
|
||||
if ( toolbar )
|
||||
setIconSize( toolbar->iconSize() );
|
||||
else
|
||||
setIconSize( QSize( 22, 22 ) );
|
||||
setIconSize( scaled( 22, 22 ) );
|
||||
|
||||
//Set up popup...
|
||||
QWidget *w = new QWidget( this );
|
||||
@ -52,7 +53,7 @@ AccountsToolButton::AccountsToolButton( QWidget* parent )
|
||||
|
||||
TomahawkUtils::unmarginLayout( w->layout() );
|
||||
|
||||
w->setContentsMargins( 6, 6, 6, 6 );
|
||||
w->setContentsMargins( scaled( 6, 6, 6, 6 ) );
|
||||
#ifdef Q_OS_MAC
|
||||
w->setContentsMargins( 6, 6, 6, 0 );
|
||||
wMainLayout->setMargin( 12 );
|
||||
@ -82,7 +83,7 @@ AccountsToolButton::AccountsToolButton( QWidget* parent )
|
||||
TomahawkStyle::BORDER_LINE.name() + "; }" ); //from ProxyStyle
|
||||
wMainLayout->addWidget( separatorLine );
|
||||
|
||||
wMainLayout->addSpacing( 6 );
|
||||
wMainLayout->addSpacing( scaledY( 6 ) );
|
||||
|
||||
QPushButton *settingsButton = new QPushButton( w );
|
||||
settingsButton->setIcon( TomahawkUtils::defaultPixmap( TomahawkUtils::AccountSettings ) );
|
||||
|
@ -23,10 +23,11 @@
|
||||
|
||||
#include "accounts/AccountModel.h"
|
||||
#include "AccountModelFactoryProxy.h"
|
||||
#include "utils/DpiScaler.h"
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
class AccountsToolButton : public QToolButton
|
||||
class AccountsToolButton : public QToolButton, private TomahawkUtils::DpiScaler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user