1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 10:19:41 +01:00

Merge remote branch 'origin/master' into js-resolver

This commit is contained in:
Dominik Schmidt 2011-06-29 01:34:42 +02:00
commit 925da80431
16 changed files with 280 additions and 126 deletions

View File

@ -298,9 +298,11 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
ui->pauseButton->setVisible( true );
ui->playPauseButton->setVisible( false );
ui->playPauseButton->setEnabled( false );
ui->loveButton->setEnabled( true );
ui->loveButton->setVisible( true );
result->loadSocialActions();
ui->loveButton->setVisible( true );
if ( result->loved() )
{
ui->loveButton->setPixmap( RESPATH "images/loved.png" );

View File

@ -171,7 +171,9 @@ set( libSources
widgets/welcomewidget.cpp
widgets/welcomeplaylistmodel.cpp
widgets/overlaywidget.cpp
widgets/HeaderLabel.cpp
widgets/infowidgets/sourceinfowidget.cpp
# widgets/infowidgets/ArtistInfoWidget.cpp
kdsingleapplicationguard/kdsingleapplicationguard.cpp
kdsingleapplicationguard/kdsharedmemorylocker.cpp
@ -338,7 +340,9 @@ set( libHeaders
widgets/welcomewidget.h
widgets/welcomeplaylistmodel.h
widgets/overlaywidget.h
widgets/HeaderLabel.h
widgets/infowidgets/sourceinfowidget.h
# widgets/infowidgets/ArtistInfoWidget.h
kdsingleapplicationguard/kdsingleapplicationguard.h
)
@ -360,6 +364,7 @@ set( libUI ${libUI}
widgets/searchwidget.ui
widgets/welcomewidget.ui
widgets/infowidgets/sourceinfowidget.ui
# widgets/infowidgets/ArtistInfoWidget.ui
playlist/topbar/topbar.ui
playlist/infobar/infobar.ui
)

View File

@ -154,9 +154,9 @@ AudioEngine::stop()
sendWaitingNotification();
else if ( TomahawkSettings::instance()->verboseNotifications() )
{
Tomahawk::InfoSystem::InfoCriteriaHash stopInfo;
Tomahawk::InfoSystem::InfoCustomData stopInfo;
stopInfo["message"] = QString( "Tomahawk is stopped." );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( stopInfo );
}
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
@ -240,11 +240,11 @@ AudioEngine::mute()
void
AudioEngine::sendWaitingNotification() const
{
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
Tomahawk::InfoSystem::InfoCustomData retryInfo;
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( retryInfo ) );
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( retryInfo ) );
}
@ -329,12 +329,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
if ( TomahawkSettings::instance()->verboseNotifications() )
{
Tomahawk::InfoSystem::InfoCriteriaHash playInfo;
Tomahawk::InfoSystem::InfoCustomData playInfo;
playInfo["message"] = QString( "Tomahawk is playing \"%1\" by %2 on album %3." )
.arg( m_currentTrack->track() )
.arg( m_currentTrack->artist()->name() )
.arg( m_currentTrack->album()->name() );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( playInfo );
playInfo["image"] = QVariant( m_currentTrack->collection()->source()->avatar().toImage() );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( playInfo );
}
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );

View File

@ -63,12 +63,12 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf
{
Q_UNUSED( caller );
qDebug() << Q_FUNC_INFO;
if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
{
qDebug() << Q_FUNC_INFO << " not the right type or could not convert the hash";
return;
}
Tomahawk::InfoSystem::InfoCriteriaHash hash = pushData.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
Tomahawk::InfoSystem::InfoCustomData hash = pushData.value< Tomahawk::InfoSystem::InfoCustomData >();
if ( !hash.contains( "message" ) )
{
qDebug() << Q_FUNC_INFO << " hash did not contain a message";
@ -81,11 +81,18 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf
arguments << quint32( 0 ); //notification_id
arguments << QString(); //app_icon
arguments << QString( "Tomahawk" ); //summary
arguments << hash["message"]; //body
arguments << hash["message"].toString(); //body
arguments << QStringList(); //actions
QVariantMap dict;
dict["desktop-entry"] = QString( "tomahawk" );
dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
if ( hash.contains( "image" ) )
{
QVariant tempVariant = hash["image"];
QImage tempImage = tempVariant.value< QImage >();
dict["image_data"] = ImageConverter::variantForImage( tempImage );
}
else
dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
arguments << dict; //hints
arguments << qint32( -1 ); //expire_timeout
message.setArguments( arguments );

View File

@ -205,16 +205,16 @@ PlaylistItemDelegate::paintShort( QPainter* painter, const QStyleOptionViewItem&
QFont boldFont = opt.font;
boldFont.setBold( true );
r.adjust( ir.width() + 12, 0, 0, 0 );
r.adjust( ir.width() + 12, 0, -12, 0 );
QTextOption to( Qt::AlignTop );
to.setWrapMode( QTextOption::NoWrap );
painter->setFont( boldFont );
QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() - 3 );
QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() );
painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to );
to.setAlignment( Qt::AlignBottom );
painter->setFont( opt.font );
text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() - 3 );
text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() );
painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to );
}
painter->restore();

View File

@ -103,16 +103,6 @@ SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& que
}
void
SourcePlaylistInterface::resolveResultsAdded( const QList<Tomahawk::result_ptr>& results ) const
{
qDebug() << Q_FUNC_INFO;
foreach ( Tomahawk::result_ptr ptr, results )
{
// qDebug() << "Found result:" << ptr->track();
}
}
void
SourcePlaylistInterface::resolvingFinished( bool hasResults )
{

View File

@ -74,7 +74,6 @@ signals:
private slots:
void onSourcePlaybackStarted( const Tomahawk::query_ptr& query );
void resolveResultsAdded( const QList<Tomahawk::result_ptr>& results ) const;
void resolvingFinished( bool hasResults );
private:

View File

@ -24,6 +24,7 @@
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QLayout>
#include <QPainter>
#include <QPixmap>
#include <QNetworkAccessManager>
@ -338,6 +339,22 @@ createDragPixmap( int itemCount )
}
void
unmarginLayout( QLayout* layout )
{
layout->setContentsMargins( 0, 0, 0, 0 );
layout->setMargin( 0 );
layout->setSpacing( 0 );
for ( int i = 0; i < layout->count(); i++ )
{
QLayout* childLayout = layout->itemAt( i )->layout();
if ( childLayout )
unmarginLayout( childLayout );
}
}
QWeakPointer< QNetworkAccessManager > s_nam;
NetworkProxyFactory* s_proxyFactory = 0;

View File

@ -24,7 +24,6 @@
#include <QThread>
#include <QNetworkProxy>
#include <QStringList>
#include <QDir>
#define RESPATH ":/data/"
@ -33,8 +32,8 @@ class QDir;
class QDateTime;
class QString;
class QPixmap;
class QLayout;
class QNetworkAccessManager;
class QNetworkProxy;
namespace TomahawkUtils
{
@ -72,6 +71,8 @@ namespace TomahawkUtils
DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity );
DLLEXPORT QPixmap createDragPixmap( int itemCount = 1 );
DLLEXPORT void unmarginLayout( QLayout* layout );
DLLEXPORT NetworkProxyFactory* proxyFactory();
DLLEXPORT QNetworkAccessManager* nam();

View File

@ -0,0 +1,86 @@
/* === 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 "HeaderLabel.h"
#include <QDebug>
#include <QPainter>
#define FONT_SIZE 16
HeaderLabel::HeaderLabel( QWidget* parent )
: QLabel( parent )
, m_parent( parent )
{
QFont f( font() );
f.setBold( true );
f.setPointSize( 11 );
#ifdef Q_WS_MAC
f.setPointSize( f.pointSize() - 2 );
#endif
setFont( f );
setFixedHeight( sizeHint().height() + 8 );
}
HeaderLabel::~HeaderLabel()
{
}
QSize
HeaderLabel::sizeHint() const
{
return QLabel::sizeHint();
}
void
HeaderLabel::paintEvent( QPaintEvent* event )
{
QPainter p( this );
QRect r = contentsRect();
// p.setRenderHint( QPainter::Antialiasing );
QRect upperHalf( 0, 0, r.width(), r.height() / 2 );
QRect lowerHalf( 0, upperHalf.height(), r.width(), r.height() );
p.fillRect( upperHalf, QColor( 80, 80, 80 ) );
p.fillRect( lowerHalf, QColor( 72, 72, 72 ) );
{
QColor lineColor( 100, 100, 100 );
QLine line( 0, 0, r.width(), 0 );
p.setPen( lineColor );
p.drawLine( line );
}
{
QColor lineColor( 30, 30, 30 );
QLine line( 0, r.height() - 1, r.width(), r.height() - 1 );
p.setPen( lineColor );
p.drawLine( line );
}
QTextOption to( Qt::AlignVCenter );
r.adjust( 8, 0, -8, 0 );
p.setPen( Qt::white );
p.drawText( r, text(), to );
}

View File

@ -0,0 +1,47 @@
/* === 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 HEADERLABEL_H
#define HEADERLABEL_H
#include <QLabel>
#include "dllmacro.h"
class DLLEXPORT HeaderLabel : public QLabel
{
Q_OBJECT
public:
HeaderLabel( QWidget* parent );
~HeaderLabel();
QSize minimumSizeHint() const { return sizeHint(); }
QSize sizeHint() const;
public slots:
protected:
// void changeEvent( QEvent* e );
void paintEvent( QPaintEvent* event );
private:
QWidget* m_parent;
};
#endif // HEADERLABEL_H

View File

@ -38,6 +38,15 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
{
ui->setupUi( this );
ui->historyView->setFrameShape( QFrame::NoFrame );
ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->recentAlbumView->setFrameShape( QFrame::NoFrame );
ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->recentCollectionView->setFrameShape( QFrame::NoFrame );
ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
TomahawkUtils::unmarginLayout( layout() );
ui->historyView->overlay()->setEnabled( false );
m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>985</width>
<width>831</width>
<height>460</height>
</rect>
</property>
@ -14,14 +14,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<widget class="HeaderLabel" name="label_2">
<property name="text">
<string>Recent Albums</string>
</property>
@ -56,14 +49,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<widget class="HeaderLabel" name="label">
<property name="text">
<string>Latest Additions to their Collection</string>
</property>
@ -77,14 +63,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<widget class="HeaderLabel" name="label_3">
<property name="text">
<string>Recently played Tracks</string>
</property>
@ -100,21 +79,26 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderLabel</class>
<extends>QLabel</extends>
<header location="global">widgets/HeaderLabel.h</header>
</customwidget>
<customwidget>
<class>PlaylistView</class>
<extends>QTreeView</extends>
<header>playlist/playlistview.h</header>
</customwidget>
<customwidget>
<class>CollectionView</class>
<extends>QTreeView</extends>
<header>playlist/collectionview.h</header>
</customwidget>
<customwidget>
<class>AlbumView</class>
<extends>QListView</extends>
<header>playlist/albumview.h</header>
</customwidget>
<customwidget>
<class>CollectionView</class>
<extends>QTreeView</extends>
<header>playlist/collectionview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -48,10 +48,26 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
ui->setupUi( this );
ui->splitter->setHandleWidth( 1 );
ui->splitter_2->setHandleWidth( 1 );
ui->splitter_2->setStretchFactor( 0, 2 );
ui->splitter_2->setStretchFactor( 0, 1 );
WelcomePlaylistModel* model = new WelcomePlaylistModel( this );
model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS );
ui->playlistWidget->setFrameShape( QFrame::NoFrame );
ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->tracksView->setFrameShape( QFrame::NoFrame );
ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->additionsView->setFrameShape( QFrame::NoFrame );
ui->additionsView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
TomahawkUtils::unmarginLayout( layout() );
TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() );
TomahawkUtils::unmarginLayout( ui->verticalLayout_2->layout() );
TomahawkUtils::unmarginLayout( ui->verticalLayout_3->layout() );
TomahawkUtils::unmarginLayout( ui->verticalLayout_4->layout() );
ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
ui->playlistWidget->setModel( model );
ui->playlistWidget->overlay()->resize( 380, 86 );

View File

@ -6,106 +6,95 @@
<rect>
<x>0</x>
<y>0</y>
<width>985</width>
<height>459</height>
<width>875</width>
<height>513</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="2,1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QSplitter" name="splitter">
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Recent Additions</string>
</property>
</widget>
</item>
<item>
<widget class="AlbumView" name="additionsView"/>
</item>
</layout>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="HeaderLabel" name="label_4">
<property name="text">
<string>Recent Additions</string>
</property>
</widget>
</item>
<item>
<widget class="AlbumView" name="additionsView"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="HeaderLabel" name="label_2">
<property name="text">
<string>Newest Stations &amp; Playlists</string>
</property>
</widget>
</item>
<item>
<widget class="PlaylistWidget" name="playlistWidget"/>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<widget class="HeaderLabel" name="label_3">
<property name="text">
<string>Newest Stations &amp; Playlists</string>
<string>Recently Played Tracks</string>
</property>
</widget>
</item>
<item>
<widget class="PlaylistWidget" name="playlistWidget"/>
<widget class="PlaylistView" name="tracksView">
<property name="minimumSize">
<size>
<width>320</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Recently Played Tracks</string>
</property>
</widget>
</item>
<item>
<widget class="PlaylistView" name="tracksView">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderLabel</class>
<extends>QLabel</extends>
<header location="global">widgets/HeaderLabel.h</header>
</customwidget>
<customwidget>
<class>PlaylistView</class>
<extends>QTreeView</extends>
<header>playlist/playlistview.h</header>
</customwidget>
<customwidget>
<class>PlaylistWidget</class>
<extends>QListWidget</extends>
<header>widgets/welcomewidget.h</header>
</customwidget>
<customwidget>
<class>AlbumView</class>
<extends>QListView</extends>
<header>playlist/albumview.h</header>
</customwidget>
<customwidget>
<class>PlaylistWidget</class>
<extends>QListWidget</extends>
<header>widgets/welcomewidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -26,6 +26,7 @@
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QThread>
#include <QtWebKit/QWebPage>