mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-22 08:52:12 +02:00
* Added Flexibleheader and PlaylistHeader.ui.
This commit is contained in:
parent
96c6ebfe99
commit
aa82c276c9
src/libtomahawk
@ -48,6 +48,7 @@ set( libGuiSources
|
||||
|
||||
infobar/InfoBar.cpp
|
||||
|
||||
playlist/FlexibleHeader.cpp
|
||||
playlist/FlexibleView.cpp
|
||||
playlist/TreeModel.cpp
|
||||
playlist/TreeProxyModel.cpp
|
||||
@ -88,8 +89,6 @@ set( libGuiSources
|
||||
playlist/dynamic/widgets/CollapsibleControls.cpp
|
||||
playlist/dynamic/widgets/DynamicSetupWidget.cpp
|
||||
|
||||
|
||||
|
||||
ExternalResolverGui.cpp
|
||||
resolvers/ScriptResolver.cpp
|
||||
resolvers/QtScriptResolver.cpp
|
||||
@ -320,6 +319,7 @@ set( libUI ${libUI}
|
||||
widgets/infowidgets/AlbumInfoWidget.ui
|
||||
widgets/infowidgets/TrackInfoWidget.ui
|
||||
playlist/QueueView.ui
|
||||
playlist/PlaylistHeader.ui
|
||||
filemetadata/MetadataEditor.ui
|
||||
context/ContextWidget.ui
|
||||
infobar/InfoBar.ui
|
||||
|
156
src/libtomahawk/playlist/FlexibleHeader.cpp
Normal file
156
src/libtomahawk/playlist/FlexibleHeader.cpp
Normal file
@ -0,0 +1,156 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.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 "FlexibleHeader.h"
|
||||
#include "ui_PlaylistHeader.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QCheckBox>
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include "playlist/FlexibleView.h"
|
||||
#include "ViewManager.h"
|
||||
#include "thirdparty/Qocoa/qsearchfield.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "widgets/QueryLabel.h"
|
||||
#include "Source.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
FlexibleHeader::FlexibleHeader( FlexibleView* parent )
|
||||
: QWidget( parent )
|
||||
, m_parent( parent )
|
||||
, ui( new Ui::PlaylistHeader )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
|
||||
QPalette pal = palette();
|
||||
pal.setColor( QPalette::Foreground, Qt::white );
|
||||
|
||||
ui->captionLabel->setPalette( pal );
|
||||
ui->descLabel->setPalette( pal );
|
||||
|
||||
QFont font = ui->captionLabel->font();
|
||||
font.setPixelSize( 16 );
|
||||
font.setBold( true );
|
||||
ui->captionLabel->setFont( font );
|
||||
|
||||
font.setPixelSize( 11 );
|
||||
ui->descLabel->setFont( font );
|
||||
|
||||
ui->radioNormal->setFocusPolicy( Qt::NoFocus );
|
||||
ui->radioDetailed->setFocusPolicy( Qt::NoFocus );
|
||||
ui->radioCloud->setFocusPolicy( Qt::NoFocus );
|
||||
|
||||
QFile f( RESPATH "stylesheets/topbar-radiobuttons.css" );
|
||||
f.open( QFile::ReadOnly );
|
||||
QString css = QString::fromAscii( f.readAll() );
|
||||
f.close();
|
||||
|
||||
ui->modeWidget->setStyleSheet( css );
|
||||
|
||||
ui->radioNormal->setChecked( true );
|
||||
ui->filter->setPlaceholderText( tr( "Filter..." ) );
|
||||
|
||||
pal = palette();
|
||||
pal.setColor( QPalette::Window, QColor( "#454e59" ) );
|
||||
|
||||
setPalette( pal );
|
||||
setAutoFillBackground( true );
|
||||
|
||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
||||
connect( ui->filter, SIGNAL( textChanged( QString ) ), SLOT( onFilterEdited() ) );
|
||||
|
||||
NewClosure( ui->radioNormal, SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Flat )->setAutoDelete( false );
|
||||
NewClosure( ui->radioDetailed, SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Detailed )->setAutoDelete( false );
|
||||
NewClosure( ui->radioCloud, SIGNAL( clicked() ), const_cast< FlexibleView* >( parent ), SLOT( setCurrentMode( FlexibleViewMode ) ), FlexibleView::Grid )->setAutoDelete( false );
|
||||
}
|
||||
|
||||
|
||||
FlexibleHeader::~FlexibleHeader()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::setCaption( const QString& s )
|
||||
{
|
||||
ui->captionLabel->setText( s );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::setDescription( const QString& s )
|
||||
{
|
||||
ui->descLabel->setText( s );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::setPixmap( const QPixmap& p )
|
||||
{
|
||||
ui->imageLabel->setPixmap( p.scaledToHeight( ui->imageLabel->height(), Qt::SmoothTransformation ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::setFilter( const QString& filter )
|
||||
{
|
||||
ui->filter->setText( filter );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::onFilterEdited()
|
||||
{
|
||||
m_filter = ui->filter->text();
|
||||
|
||||
m_filterTimer.stop();
|
||||
m_filterTimer.setInterval( 280 );
|
||||
m_filterTimer.setSingleShot( true );
|
||||
m_filterTimer.start();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::applyFilter()
|
||||
{
|
||||
emit filterTextChanged( ui->filter->text() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleHeader::changeEvent( QEvent* e )
|
||||
{
|
||||
QWidget::changeEvent( e );
|
||||
switch ( e->type() )
|
||||
{
|
||||
case QEvent::LanguageChange:
|
||||
// ui->retranslateUi( this );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
68
src/libtomahawk/playlist/FlexibleHeader.h
Normal file
68
src/libtomahawk/playlist/FlexibleHeader.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.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 FLEXIBLEHEADER_H
|
||||
#define FLEXIBLEHEADER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
#include "DllMacro.h"
|
||||
#include "Artist.h"
|
||||
|
||||
class FlexibleView;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PlaylistHeader;
|
||||
}
|
||||
|
||||
class DLLEXPORT FlexibleHeader : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FlexibleHeader( FlexibleView* parent );
|
||||
~FlexibleHeader();
|
||||
|
||||
public slots:
|
||||
void setCaption( const QString& s );
|
||||
void setDescription( const QString& s );
|
||||
void setPixmap( const QPixmap& p );
|
||||
|
||||
void setFilter( const QString& filter );
|
||||
|
||||
signals:
|
||||
void filterTextChanged( const QString& filter );
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent* e );
|
||||
|
||||
private slots:
|
||||
void onFilterEdited();
|
||||
void applyFilter();
|
||||
|
||||
private:
|
||||
FlexibleView* m_parent;
|
||||
Ui::PlaylistHeader* ui;
|
||||
|
||||
QString m_filter;
|
||||
QTimer m_filterTimer;
|
||||
};
|
||||
|
||||
#endif
|
279
src/libtomahawk/playlist/PlaylistHeader.ui
Normal file
279
src/libtomahawk/playlist/PlaylistHeader.ui
Normal file
@ -0,0 +1,279 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PlaylistHeader</class>
|
||||
<widget class="QWidget" name="PlaylistHeader">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>774</width>
|
||||
<height>80</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_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</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>16</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="ElidedLabel" name="captionLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Caption</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="descLabel">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>156</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="modeWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>87</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>87</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioNormal">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioDetailed">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioCloud">
|
||||
<property name="text">
|
||||
<string>RadioButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSearchField" name="filter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ElidedLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>widgets/ElidedLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QSearchField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>thirdparty/Qocoa/qsearchfield.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user