mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 17:43:59 +02:00
* Added InfoBar on top of PlaylistManager's widget. WIP.
This commit is contained in:
@@ -90,12 +90,15 @@ set( libSources
|
|||||||
playlist/albumproxymodel.cpp
|
playlist/albumproxymodel.cpp
|
||||||
playlist/albumitemdelegate.cpp
|
playlist/albumitemdelegate.cpp
|
||||||
playlist/albumview.cpp
|
playlist/albumview.cpp
|
||||||
|
|
||||||
playlist/topbar/topbar.cpp
|
playlist/topbar/topbar.cpp
|
||||||
playlist/topbar/clearbutton.cpp
|
playlist/topbar/clearbutton.cpp
|
||||||
playlist/topbar/searchlineedit.cpp
|
playlist/topbar/searchlineedit.cpp
|
||||||
playlist/topbar/lineedit.cpp
|
playlist/topbar/lineedit.cpp
|
||||||
playlist/topbar/searchbutton.cpp
|
playlist/topbar/searchbutton.cpp
|
||||||
|
|
||||||
|
playlist/infobar/infobar.cpp
|
||||||
|
|
||||||
playlist/dynamic/DynamicPlaylist.cpp
|
playlist/dynamic/DynamicPlaylist.cpp
|
||||||
playlist/dynamic/DynamicControl.cpp
|
playlist/dynamic/DynamicControl.cpp
|
||||||
playlist/dynamic/GeneratorFactory.cpp
|
playlist/dynamic/GeneratorFactory.cpp
|
||||||
@@ -229,6 +232,7 @@ set( libHeaders
|
|||||||
playlist/albumproxymodel.h
|
playlist/albumproxymodel.h
|
||||||
playlist/albumitemdelegate.h
|
playlist/albumitemdelegate.h
|
||||||
playlist/albumview.h
|
playlist/albumview.h
|
||||||
|
|
||||||
playlist/topbar/topbar.h
|
playlist/topbar/topbar.h
|
||||||
playlist/topbar/clearbutton.h
|
playlist/topbar/clearbutton.h
|
||||||
playlist/topbar/searchlineedit.h
|
playlist/topbar/searchlineedit.h
|
||||||
@@ -236,6 +240,8 @@ set( libHeaders
|
|||||||
playlist/topbar/lineedit_p.h
|
playlist/topbar/lineedit_p.h
|
||||||
playlist/topbar/searchbutton.h
|
playlist/topbar/searchbutton.h
|
||||||
|
|
||||||
|
playlist/infobar/infobar.h
|
||||||
|
|
||||||
playlist/dynamic/DynamicPlaylist.h
|
playlist/dynamic/DynamicPlaylist.h
|
||||||
playlist/dynamic/DynamicControl.h
|
playlist/dynamic/DynamicControl.h
|
||||||
playlist/dynamic/GeneratorFactory.h
|
playlist/dynamic/GeneratorFactory.h
|
||||||
@@ -275,6 +281,7 @@ set( libUI ${libUI}
|
|||||||
widgets/welcomewidget.ui
|
widgets/welcomewidget.ui
|
||||||
widgets/infowidgets/sourceinfowidget.ui
|
widgets/infowidgets/sourceinfowidget.ui
|
||||||
playlist/topbar/topbar.ui
|
playlist/topbar/topbar.ui
|
||||||
|
playlist/infobar/infobar.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
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 "audio/audioengine.h"
|
||||||
#include "utils/animatedsplitter.h"
|
#include "utils/animatedsplitter.h"
|
||||||
|
#include "infobar/infobar.h"
|
||||||
#include "topbar/topbar.h"
|
#include "topbar/topbar.h"
|
||||||
#include "widgets/infowidgets/sourceinfowidget.h"
|
#include "widgets/infowidgets/sourceinfowidget.h"
|
||||||
|
|
||||||
@@ -52,6 +53,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
|||||||
m_widget->setLayout( new QVBoxLayout() );
|
m_widget->setLayout( new QVBoxLayout() );
|
||||||
|
|
||||||
m_topbar = new TopBar();
|
m_topbar = new TopBar();
|
||||||
|
m_infobar = new InfoBar();
|
||||||
m_stack = new QStackedWidget();
|
m_stack = new QStackedWidget();
|
||||||
|
|
||||||
QFrame* line = new QFrame();
|
QFrame* line = new QFrame();
|
||||||
@@ -75,6 +77,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
|||||||
|
|
||||||
m_widget->layout()->setMargin( 0 );
|
m_widget->layout()->setMargin( 0 );
|
||||||
m_widget->layout()->setSpacing( 0 );
|
m_widget->layout()->setSpacing( 0 );
|
||||||
|
m_widget->layout()->addWidget( m_infobar );
|
||||||
m_widget->layout()->addWidget( m_topbar );
|
m_widget->layout()->addWidget( m_topbar );
|
||||||
m_widget->layout()->addWidget( line );
|
m_widget->layout()->addWidget( line );
|
||||||
m_widget->layout()->addWidget( m_splitter );
|
m_widget->layout()->addWidget( m_splitter );
|
||||||
@@ -382,7 +385,7 @@ PlaylistManager::show( const Tomahawk::source_ptr& source )
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PlaylistManager::show( QWidget* widget )
|
PlaylistManager::show( QWidget* widget, const QString& title, const QString& desc, const QPixmap& pixmap )
|
||||||
{
|
{
|
||||||
unlinkPlaylist();
|
unlinkPlaylist();
|
||||||
|
|
||||||
@@ -391,6 +394,10 @@ PlaylistManager::show( QWidget* widget )
|
|||||||
m_stack->addWidget( widget );
|
m_stack->addWidget( widget );
|
||||||
m_stack->setCurrentWidget( widget );
|
m_stack->setCurrentWidget( widget );
|
||||||
|
|
||||||
|
m_infobar->setCaption( title );
|
||||||
|
m_infobar->setDescription( desc );
|
||||||
|
m_infobar->setPixmap( pixmap );
|
||||||
|
|
||||||
m_superCollectionVisible = false;
|
m_superCollectionVisible = false;
|
||||||
m_statsAvailable = false;
|
m_statsAvailable = false;
|
||||||
m_modesAvailable = false;
|
m_modesAvailable = false;
|
||||||
|
@@ -23,6 +23,7 @@ class TrackProxyModel;
|
|||||||
class TrackModel;
|
class TrackModel;
|
||||||
class TrackView;
|
class TrackView;
|
||||||
class SourceInfoWidget;
|
class SourceInfoWidget;
|
||||||
|
class InfoBar;
|
||||||
class TopBar;
|
class TopBar;
|
||||||
|
|
||||||
namespace Tomahawk {
|
namespace Tomahawk {
|
||||||
@@ -51,7 +52,7 @@ public:
|
|||||||
bool show( const Tomahawk::collection_ptr& collection );
|
bool show( const Tomahawk::collection_ptr& collection );
|
||||||
bool show( const Tomahawk::source_ptr& source );
|
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();
|
bool showSuperCollection();
|
||||||
void showCurrentTrack();
|
void showCurrentTrack();
|
||||||
@@ -94,6 +95,7 @@ private:
|
|||||||
void linkPlaylist();
|
void linkPlaylist();
|
||||||
|
|
||||||
QWidget* m_widget;
|
QWidget* m_widget;
|
||||||
|
InfoBar* m_infobar;
|
||||||
TopBar* m_topbar;
|
TopBar* m_topbar;
|
||||||
QStackedWidget* m_stack;
|
QStackedWidget* m_stack;
|
||||||
AnimatedSplitter* m_splitter;
|
AnimatedSplitter* m_splitter;
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
#include "topbar.h"
|
#include "topbar.h"
|
||||||
#include "ui_topbar.h"
|
#include "ui_topbar.h"
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
#include "tomahawk/tomahawkapp.h"
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
#define MAXDUDES 3
|
#define MAXDUDES 3
|
||||||
#define DUDEWIDTH 10
|
#define DUDEWIDTH 10
|
||||||
@@ -25,8 +24,6 @@ TopBar::TopBar( QWidget* parent )
|
|||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
setAutoFillBackground( true );
|
|
||||||
|
|
||||||
ui->statsLabelNumTracks->setFormat( "%L1 " + tr( "Tracks" ) );
|
ui->statsLabelNumTracks->setFormat( "%L1 " + tr( "Tracks" ) );
|
||||||
ui->statsLabelNumArtists->setFormat( "%L1 " + tr( "Artists" ) );
|
ui->statsLabelNumArtists->setFormat( "%L1 " + tr( "Artists" ) );
|
||||||
connect( ui->filterEdit, SIGNAL( textChanged( QString ) ), SIGNAL( filterTextChanged( QString ) ) );
|
connect( ui->filterEdit, SIGNAL( textChanged( QString ) ), SIGNAL( filterTextChanged( QString ) ) );
|
||||||
@@ -81,7 +78,7 @@ TopBar::~TopBar()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TopBar::changeEvent( QEvent *e )
|
TopBar::changeEvent( QEvent* e )
|
||||||
{
|
{
|
||||||
QWidget::changeEvent( e );
|
QWidget::changeEvent( e );
|
||||||
switch ( e->type() )
|
switch ( e->type() )
|
||||||
@@ -97,17 +94,9 @@ TopBar::changeEvent( QEvent *e )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TopBar::resizeEvent(QResizeEvent* e )
|
TopBar::resizeEvent( QResizeEvent* e )
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent( 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
|
#define TOPBAR_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QList>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@@ -10,24 +10,7 @@
|
|||||||
<height>460</height>
|
<height>460</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0,2">
|
||||||
<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>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@@ -83,7 +83,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
loadSettings();
|
loadSettings();
|
||||||
setupSignals();
|
setupSignals();
|
||||||
|
|
||||||
PlaylistManager::instance()->show( new WelcomeWidget() );
|
PlaylistManager::instance()->show( new WelcomeWidget(), tr( "Welcome to Tomahawk!" ), QString(), QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user