1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 13:47:26 +02:00

Merge remote-tracking branch 'origin/master' into spotifyplaylists

This commit is contained in:
Leo Franchi
2012-04-03 09:43:01 -04:00
18 changed files with 12509 additions and 7016 deletions

9
.tx/config Normal file
View File

@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.net
[tomahawk.tomahawk-master]
file_filter = lang/tomahawk_<lang>.ts
source_file = lang/tomahawk_en.ts
source_lang = en
type = QT

View File

@@ -1,10 +1,7 @@
PROJECT( tomahawk ) PROJECT( tomahawk )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.6 ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8.6 )
SET( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) SET( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
CMAKE_POLICY(SET CMP0017 NEW)
IF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
CMAKE_POLICY(SET CMP0017 NEW)
ENDIF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
### ###
### Tomahawk application info ### Tomahawk application info

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3514
lang/tomahawk_ja.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -34,13 +34,14 @@ DatabaseCommand_UpdateSearchIndex::DatabaseCommand_UpdateSearchIndex()
{ {
tLog() << Q_FUNC_INFO << "Updating index."; tLog() << Q_FUNC_INFO << "Updating index.";
JobStatusView::instance()->model()->addJob( m_statusJob ); JobStatusView::instance()->model()->addJob( m_statusJob.data() );
} }
DatabaseCommand_UpdateSearchIndex::~DatabaseCommand_UpdateSearchIndex() DatabaseCommand_UpdateSearchIndex::~DatabaseCommand_UpdateSearchIndex()
{ {
m_statusJob->done(); if (! m_statusJob.isNull() )
m_statusJob.data()->done();
} }

View File

@@ -36,7 +36,7 @@ public:
virtual void exec( DatabaseImpl* db ); virtual void exec( DatabaseImpl* db );
private: private:
IndexingJobItem* m_statusJob; QWeakPointer<IndexingJobItem> m_statusJob;
}; };
#endif // DATABASECOMMAND_UPDATESEARCHINDEX_H #endif // DATABASECOMMAND_UPDATESEARCHINDEX_H

View File

@@ -75,7 +75,7 @@ PlaylistChartItemDelegate::sizeHint( const QStyleOptionViewItem& option, const Q
case 2: case 2:
stretch = 4; stretch = 4;
break; break;
default: default:
if ( index.row() < 10 ) if ( index.row() < 10 )
stretch = 3; stretch = 3;
@@ -108,27 +108,7 @@ PlaylistChartItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, c
{ {
initStyleOption( option, index ); initStyleOption( option, index );
if ( item->isPlaying() ) TomahawkUtils::prepareStyleOption( option, index, item );
{
option->palette.setColor( QPalette::Highlight, option->palette.color( QPalette::Mid ) );
option->state |= QStyle::State_Selected;
}
if ( option->state & QStyle::State_Selected )
{
option->palette.setColor( QPalette::Text, option->palette.color( QPalette::HighlightedText ) );
}
else
{
float opacity = 0.0;
if ( item->query()->results().count() )
opacity = item->query()->results().first()->score();
opacity = qMax( (float)0.3, opacity );
QColor textColor = TomahawkUtils::alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
option->palette.setColor( QPalette::Text, textColor );
}
} }
@@ -230,7 +210,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::ScaledCover, pixmapRect.size() ); pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::ScaledCover, pixmapRect.size() );
} }
painter->drawPixmap( pixmapRect, pixmap ); painter->drawPixmap( pixmapRect, pixmap );
r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 ); r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
QRect leftRect = r.adjusted( 0, 0, -48, 0 ); QRect leftRect = r.adjusted( 0, 0, -48, 0 );
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 ); QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );

View File

@@ -87,27 +87,7 @@ PlaylistLargeItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, c
{ {
initStyleOption( option, index ); initStyleOption( option, index );
if ( item->isPlaying() ) TomahawkUtils::prepareStyleOption( option, index, item );
{
option->palette.setColor( QPalette::Highlight, option->palette.color( QPalette::Mid ) );
option->state |= QStyle::State_Selected;
}
if ( option->state & QStyle::State_Selected )
{
option->palette.setColor( QPalette::Text, option->palette.color( QPalette::HighlightedText ) );
}
else
{
float opacity = 0.0;
if ( item->query()->results().count() )
opacity = item->query()->results().first()->score();
opacity = qMax( (float)0.3, opacity );
QColor textColor = TomahawkUtils::alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
option->palette.setColor( QPalette::Text, textColor );
}
} }
@@ -207,7 +187,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
QRect pixmapRect = r.adjusted( 6, 0, -option.rect.width() + option.rect.height() - 6 + r.left(), 0 ); QRect pixmapRect = r.adjusted( 6, 0, -option.rect.width() + option.rect.height() - 6 + r.left(), 0 );
QRect avatarRect = r.adjusted( option.rect.width() - r.left() - 12 - avatarSize.width(), ( option.rect.height() - avatarSize.height() ) / 2 - 5, 0, 0 ); QRect avatarRect = r.adjusted( option.rect.width() - r.left() - 12 - avatarSize.width(), ( option.rect.height() - avatarSize.height() ) / 2 - 5, 0, 0 );
avatarRect.setSize( avatarSize ); avatarRect.setSize( avatarSize );
pixmap = item->query()->cover( pixmapRect.size(), false ); pixmap = item->query()->cover( pixmapRect.size(), false );
if ( !pixmap ) if ( !pixmap )
{ {
@@ -215,7 +195,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
} }
painter->drawPixmap( pixmapRect, pixmap ); painter->drawPixmap( pixmapRect, pixmap );
if ( !avatar.isNull() ) if ( !avatar.isNull() )
painter->drawPixmap( avatarRect, avatar ); painter->drawPixmap( avatarRect, avatar );
@@ -250,7 +230,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
textDoc.setDocumentMargin( 0 ); textDoc.setDocumentMargin( 0 );
textDoc.setDefaultFont( painter->font() ); textDoc.setDefaultFont( painter->font() );
textDoc.setDefaultTextOption( m_bottomOption ); textDoc.setDefaultTextOption( m_bottomOption );
if ( textDoc.idealWidth() > leftRect.width() ) if ( textDoc.idealWidth() > leftRect.width() )
textDoc.setHtml( item->query()->socialActionDescription( "Love", Query::Short ) ); textDoc.setHtml( item->query()->socialActionDescription( "Love", Query::Short ) );

View File

@@ -94,30 +94,7 @@ PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const
{ {
initStyleOption( option, index ); initStyleOption( option, index );
if ( item->isPlaying() ) TomahawkUtils::prepareStyleOption( option, index, item );
{
option->palette.setColor( QPalette::Highlight, option->palette.color( QPalette::Mid ) );
option->backgroundBrush = option->palette.color( QPalette::Mid );
option->palette.setColor( QPalette::Text, option->palette.color( QPalette::Text ) );
}
if ( option->state & QStyle::State_Selected && !item->isPlaying() )
{
option->palette.setColor( QPalette::Text, option->palette.color( QPalette::HighlightedText ) );
}
else
{
float opacity = 0.0;
if ( item->query()->results().count() )
opacity = item->query()->results().first()->score();
opacity = qMax( (float)0.3, opacity );
QColor textColor = TomahawkUtils::alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
option->palette.setColor( QPalette::Text, textColor );
}
} }

View File

@@ -17,16 +17,21 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include "tomahawkutilsgui.h" #include "tomahawkutilsgui.h"
#include "config.h"
#include "query.h"
#include "result.h"
#include "logger.h" #include "logger.h"
#include "trackmodelitem.h"
#include <QtGui/QLayout> #include <QtGui/QLayout>
#include <QtGui/QPainter> #include <QtGui/QPainter>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
#include <QtGui/QPalette> #include <QtGui/QPalette>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QStyleOption>
#ifdef Q_WS_X11 #ifdef Q_WS_X11
#include <QtGui/QX11Info> #include <QtGui/QX11Info>
@@ -344,7 +349,7 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
case DefaultTrackImage: case DefaultTrackImage:
pixmap = QPixmap( RESPATH "images/track-placeholder.png" ); pixmap = QPixmap( RESPATH "images/track-placeholder.png" );
break; break;
case DefaultSourceAvatar: case DefaultSourceAvatar:
if ( mode == AvatarInFrame ) if ( mode == AvatarInFrame )
pixmap = TomahawkUtils::createAvatarFrame( QPixmap( RESPATH "images/user-avatar.png" ) ); pixmap = TomahawkUtils::createAvatarFrame( QPixmap( RESPATH "images/user-avatar.png" ) );
@@ -380,4 +385,33 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
} }
void
prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, TrackModelItem* item )
{
if ( item->isPlaying() )
{
option->palette.setColor( QPalette::Highlight, option->palette.color( QPalette::Mid ) );
option->backgroundBrush = option->palette.color( QPalette::Mid );
option->palette.setColor( QPalette::Text, option->palette.color( QPalette::Text ) );
}
if ( option->state & QStyle::State_Selected && !item->isPlaying() )
{
option->palette.setColor( QPalette::Text, option->palette.color( QPalette::HighlightedText ) );
}
else
{
float opacity = 0.0;
if ( item->query()->results().count() )
opacity = item->query()->results().first()->score();
opacity = qMax( (float)0.3, opacity );
QColor textColor = alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
option->palette.setColor( QPalette::Text, textColor );
}
}
} // ns } // ns

View File

@@ -21,10 +21,13 @@
#define TOMAHAWKUTILSGUI_H #define TOMAHAWKUTILSGUI_H
#include <QSize> #include <QSize>
#include <QModelIndex>
#include "tomahawkutils.h" #include "tomahawkutils.h"
#include "dllmacro.h" #include "dllmacro.h"
class TrackModelItem;
class QStyleOptionViewItemV4;
class QPainter; class QPainter;
class QColor; class QColor;
class QPixmap; class QPixmap;
@@ -52,6 +55,8 @@ namespace TomahawkUtils
DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) ); DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) );
DLLEXPORT void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, TrackModelItem* item );
} }
#endif // TOMAHAWKUTILSGUI_H #endif // TOMAHAWKUTILSGUI_H

View File

@@ -741,11 +741,21 @@ TomahawkWindow::setWindowTitle( const QString& title )
void void
TomahawkWindow::showAboutTomahawk() TomahawkWindow::showAboutTomahawk()
{ {
QMessageBox::about( this, tr( "About Tomahawk" ), QString head, desc;
tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>Copyright 2010 - 2012<br/>Christian Muehlhaeuser &lt;muesli@tomahawk-player.org&gt;<br/><br/>"
"Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Michael Zanetti, Harald Sitter and Steve Robertson" ) #ifdef DEBUG_BUILD
.arg( TomahawkUtils::appFriendlyVersion() ) head = tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>" )
.arg( qApp->applicationVersion() ) ); .arg( TomahawkUtils::appFriendlyVersion() )
.arg( qApp->applicationVersion() );
#else
head = tr( "<h2><b>Tomahawk %1</h2>" )
.arg( TomahawkUtils::appFriendlyVersion() );
#endif
desc = tr( "Copyright 2010 - 2012<br/>Christian Muehlhaeuser &lt;muesli@tomahawk-player.org&gt;<br/><br/>"
"Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Michael Zanetti, Harald Sitter and Steve Robertson" );
QMessageBox::about( this, tr( "About Tomahawk" ), head + desc );
} }