mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-26 12:53:41 +01:00
* Added InfoBar on top of PlaylistManager's widget. WIP.
This commit is contained in:
parent
9575dd67f3
commit
d15db5784c
@ -90,12 +90,15 @@ set( libSources
|
||||
playlist/albumproxymodel.cpp
|
||||
playlist/albumitemdelegate.cpp
|
||||
playlist/albumview.cpp
|
||||
|
||||
playlist/topbar/topbar.cpp
|
||||
playlist/topbar/clearbutton.cpp
|
||||
playlist/topbar/searchlineedit.cpp
|
||||
playlist/topbar/lineedit.cpp
|
||||
playlist/topbar/searchbutton.cpp
|
||||
|
||||
playlist/infobar/infobar.cpp
|
||||
|
||||
playlist/dynamic/DynamicPlaylist.cpp
|
||||
playlist/dynamic/DynamicControl.cpp
|
||||
playlist/dynamic/GeneratorFactory.cpp
|
||||
@ -229,6 +232,7 @@ set( libHeaders
|
||||
playlist/albumproxymodel.h
|
||||
playlist/albumitemdelegate.h
|
||||
playlist/albumview.h
|
||||
|
||||
playlist/topbar/topbar.h
|
||||
playlist/topbar/clearbutton.h
|
||||
playlist/topbar/searchlineedit.h
|
||||
@ -236,6 +240,8 @@ set( libHeaders
|
||||
playlist/topbar/lineedit_p.h
|
||||
playlist/topbar/searchbutton.h
|
||||
|
||||
playlist/infobar/infobar.h
|
||||
|
||||
playlist/dynamic/DynamicPlaylist.h
|
||||
playlist/dynamic/DynamicControl.h
|
||||
playlist/dynamic/GeneratorFactory.h
|
||||
@ -275,6 +281,7 @@ set( libUI ${libUI}
|
||||
widgets/welcomewidget.ui
|
||||
widgets/infowidgets/sourceinfowidget.ui
|
||||
playlist/topbar/topbar.ui
|
||||
playlist/infobar/infobar.ui
|
||||
)
|
||||
|
||||
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
||||
|
88
src/libtomahawk/playlist/infobar/infobar.cpp
Normal file
88
src/libtomahawk/playlist/infobar/infobar.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
#include "infobar.h"
|
||||
#include "ui_infobar.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
|
||||
InfoBar::InfoBar( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::InfoBar )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
QFont boldFont = ui->captionLabel->font();
|
||||
boldFont.setPixelSize( 18 );
|
||||
boldFont.setBold( true );
|
||||
|
||||
ui->captionLabel->setFont( boldFont );
|
||||
|
||||
QPalette whitePal = ui->captionLabel->palette();
|
||||
whitePal.setColor( QPalette::Foreground, Qt::white );
|
||||
|
||||
ui->captionLabel->setPalette( whitePal );
|
||||
ui->descriptionLabel->setPalette( whitePal );
|
||||
|
||||
setAutoFillBackground( true );
|
||||
}
|
||||
|
||||
|
||||
InfoBar::~InfoBar()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoBar::setCaption( const QString& s )
|
||||
{
|
||||
ui->captionLabel->setText( s );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoBar::setDescription( const QString& s )
|
||||
{
|
||||
ui->descriptionLabel->setText( s );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoBar::setPixmap( const QPixmap& p )
|
||||
{
|
||||
ui->imageLabel->setPixmap( p.scaledToHeight( ui->imageLabel->height(), Qt::SmoothTransformation ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoBar::changeEvent( QEvent* e )
|
||||
{
|
||||
QWidget::changeEvent( e );
|
||||
switch ( e->type() )
|
||||
{
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi( this );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InfoBar::resizeEvent( QResizeEvent* e )
|
||||
{
|
||||
QWidget::resizeEvent( e );
|
||||
|
||||
QLinearGradient gradient = QLinearGradient( contentsRect().topLeft(), contentsRect().bottomRight() );
|
||||
gradient.setColorAt( 0.0, QColor( 100, 100, 100 ) );
|
||||
gradient.setColorAt( 1.0, QColor( 63, 63, 63 ) );
|
||||
|
||||
QPalette p = palette();
|
||||
p.setBrush( QPalette::Window, QBrush( gradient ) );
|
||||
setPalette( p );
|
||||
}
|
34
src/libtomahawk/playlist/infobar/infobar.h
Normal file
34
src/libtomahawk/playlist/infobar/infobar.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef INFOBAR_H
|
||||
#define INFOBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class InfoBar;
|
||||
}
|
||||
|
||||
class DLLEXPORT InfoBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InfoBar( QWidget* parent = 0 );
|
||||
~InfoBar();
|
||||
|
||||
public slots:
|
||||
void setCaption( const QString& s );
|
||||
void setDescription( const QString& s );
|
||||
void setPixmap( const QPixmap& p );
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent* e );
|
||||
void resizeEvent( QResizeEvent* e );
|
||||
|
||||
private:
|
||||
Ui::InfoBar* ui;
|
||||
};
|
||||
|
||||
#endif // INFOBAR_H
|
124
src/libtomahawk/playlist/infobar/infobar.ui
Normal file
124
src/libtomahawk/playlist/infobar/infobar.ui
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InfoBar</class>
|
||||
<widget class="QWidget" name="InfoBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>72</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>InfoBar</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="descriptionLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/animatedsplitter.h"
|
||||
#include "infobar/infobar.h"
|
||||
#include "topbar/topbar.h"
|
||||
#include "widgets/infowidgets/sourceinfowidget.h"
|
||||
|
||||
@ -52,6 +53,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
||||
m_widget->setLayout( new QVBoxLayout() );
|
||||
|
||||
m_topbar = new TopBar();
|
||||
m_infobar = new InfoBar();
|
||||
m_stack = new QStackedWidget();
|
||||
|
||||
QFrame* line = new QFrame();
|
||||
@ -75,6 +77,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
||||
|
||||
m_widget->layout()->setMargin( 0 );
|
||||
m_widget->layout()->setSpacing( 0 );
|
||||
m_widget->layout()->addWidget( m_infobar );
|
||||
m_widget->layout()->addWidget( m_topbar );
|
||||
m_widget->layout()->addWidget( line );
|
||||
m_widget->layout()->addWidget( m_splitter );
|
||||
@ -382,7 +385,7 @@ PlaylistManager::show( const Tomahawk::source_ptr& source )
|
||||
|
||||
|
||||
bool
|
||||
PlaylistManager::show( QWidget* widget )
|
||||
PlaylistManager::show( QWidget* widget, const QString& title, const QString& desc, const QPixmap& pixmap )
|
||||
{
|
||||
unlinkPlaylist();
|
||||
|
||||
@ -391,6 +394,10 @@ PlaylistManager::show( QWidget* widget )
|
||||
m_stack->addWidget( widget );
|
||||
m_stack->setCurrentWidget( widget );
|
||||
|
||||
m_infobar->setCaption( title );
|
||||
m_infobar->setDescription( desc );
|
||||
m_infobar->setPixmap( pixmap );
|
||||
|
||||
m_superCollectionVisible = false;
|
||||
m_statsAvailable = false;
|
||||
m_modesAvailable = false;
|
||||
|
@ -23,6 +23,7 @@ class TrackProxyModel;
|
||||
class TrackModel;
|
||||
class TrackView;
|
||||
class SourceInfoWidget;
|
||||
class InfoBar;
|
||||
class TopBar;
|
||||
|
||||
namespace Tomahawk {
|
||||
@ -51,7 +52,7 @@ public:
|
||||
bool show( const Tomahawk::collection_ptr& collection );
|
||||
bool show( const Tomahawk::source_ptr& source );
|
||||
|
||||
bool show( QWidget* widget );
|
||||
bool show( QWidget* widget, const QString& title = QString(), const QString& desc = QString(), const QPixmap& pixmap = QPixmap() );
|
||||
|
||||
bool showSuperCollection();
|
||||
void showCurrentTrack();
|
||||
@ -94,6 +95,7 @@ private:
|
||||
void linkPlaylist();
|
||||
|
||||
QWidget* m_widget;
|
||||
InfoBar* m_infobar;
|
||||
TopBar* m_topbar;
|
||||
QStackedWidget* m_stack;
|
||||
AnimatedSplitter* m_splitter;
|
||||
|
@ -1,12 +1,11 @@
|
||||
#include "topbar.h"
|
||||
#include "ui_topbar.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QRadioButton>
|
||||
#include <QFile>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#define MAXDUDES 3
|
||||
#define DUDEWIDTH 10
|
||||
@ -25,8 +24,6 @@ TopBar::TopBar( QWidget* parent )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
setAutoFillBackground( true );
|
||||
|
||||
ui->statsLabelNumTracks->setFormat( "%L1 " + tr( "Tracks" ) );
|
||||
ui->statsLabelNumArtists->setFormat( "%L1 " + tr( "Artists" ) );
|
||||
connect( ui->filterEdit, SIGNAL( textChanged( QString ) ), SIGNAL( filterTextChanged( QString ) ) );
|
||||
@ -81,7 +78,7 @@ TopBar::~TopBar()
|
||||
|
||||
|
||||
void
|
||||
TopBar::changeEvent( QEvent *e )
|
||||
TopBar::changeEvent( QEvent* e )
|
||||
{
|
||||
QWidget::changeEvent( e );
|
||||
switch ( e->type() )
|
||||
@ -97,17 +94,9 @@ TopBar::changeEvent( QEvent *e )
|
||||
|
||||
|
||||
void
|
||||
TopBar::resizeEvent(QResizeEvent* e )
|
||||
TopBar::resizeEvent( QResizeEvent* e )
|
||||
{
|
||||
QWidget::resizeEvent( e );
|
||||
|
||||
QLinearGradient gradient = QLinearGradient( contentsRect().topLeft(), contentsRect().bottomRight() );
|
||||
gradient.setColorAt( 0.0, QColor( 100, 100, 100 ) );
|
||||
gradient.setColorAt( 1.0, QColor( 63, 63, 63 ) );
|
||||
|
||||
QPalette p = palette();
|
||||
p.setBrush( QPalette::Window, QBrush( gradient ) );
|
||||
setPalette( p );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,10 +2,11 @@
|
||||
#define TOPBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
|
||||
#include "sourcelist.h"
|
||||
#include "dllmacro.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -10,24 +10,7 @@
|
||||
<height>460</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>20</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Welcome to Tomahawk!</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0,2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
|
@ -83,7 +83,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
loadSettings();
|
||||
setupSignals();
|
||||
|
||||
PlaylistManager::instance()->show( new WelcomeWidget() );
|
||||
PlaylistManager::instance()->show( new WelcomeWidget(), tr( "Welcome to Tomahawk!" ), QString(), QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user