mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 18:30:20 +01:00
Merge branch 'master' into single-file-cache
This commit is contained in:
commit
439521424b
@ -98,9 +98,6 @@ public:
|
||||
virtual void activate();
|
||||
virtual bool loadUrl( const QString& url );
|
||||
|
||||
// because QApplication::arguments() is expensive
|
||||
bool scrubFriendlyName() const { return m_scrubFriendlyName; }
|
||||
|
||||
public slots:
|
||||
void instanceStarted( KDSingleApplicationGuard::Instance );
|
||||
|
||||
|
@ -37,7 +37,7 @@ if (APPLE)
|
||||
# We have to change the URL in the Info.plist file :-/
|
||||
FILE(READ ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist plist)
|
||||
STRING( REPLACE "TOMAHAWK_VERSION"
|
||||
${VERSION}
|
||||
${TOMAHAWK_VERSION}
|
||||
edited_plist # save in this variable
|
||||
"${plist}" # from the contents of this var
|
||||
)
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "database/databasecommand_logplayback.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
@ -40,6 +42,8 @@ Source::Source( int id, const QString& username )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << id << username;
|
||||
|
||||
m_scrubFriendlyName = qApp->arguments().contains( "--demo" );
|
||||
|
||||
if ( id == 0 )
|
||||
{
|
||||
m_isLocal = true;
|
||||
@ -98,8 +102,8 @@ Source::friendlyName() const
|
||||
return m_username;
|
||||
|
||||
//TODO: this is a terrible assumption, help me clean this up, mighty muesli!
|
||||
if ( m_friendlyname.contains( "@conference.") )
|
||||
return QString(m_friendlyname).remove( 0, m_friendlyname.lastIndexOf( "/" )+1 ).append(" via MUC");
|
||||
if ( m_friendlyname.contains( "@conference." ) )
|
||||
return QString( m_friendlyname ).remove( 0, m_friendlyname.lastIndexOf( "/" ) + 1 ).append( " via MUC" );
|
||||
|
||||
if ( m_friendlyname.contains( "/tomahawk" ) )
|
||||
return m_friendlyname.left( m_friendlyname.indexOf( "/tomahawk" ) );
|
||||
@ -108,6 +112,15 @@ Source::friendlyName() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Source::setFriendlyName( const QString& fname )
|
||||
{
|
||||
m_friendlyname = fname;
|
||||
if ( m_scrubFriendlyName )
|
||||
m_friendlyname = m_friendlyname.split( "@" ).first();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Source::addCollection( const collection_ptr& c )
|
||||
{
|
||||
@ -164,7 +177,7 @@ Source::dbLoaded( unsigned int id, const QString& fname )
|
||||
qDebug() << Q_FUNC_INFO << id << fname;
|
||||
|
||||
m_id = id;
|
||||
m_friendlyname = fname;
|
||||
setFriendlyName( fname );
|
||||
|
||||
emit syncedWithDatabase();
|
||||
}
|
||||
@ -225,10 +238,7 @@ Source::onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::Stat
|
||||
unsigned int
|
||||
Source::trackCount() const
|
||||
{
|
||||
if ( m_stats.contains( "numfiles" ) )
|
||||
return m_stats.value( "numfiles" ).toUInt();
|
||||
else
|
||||
return 0;
|
||||
return m_stats.value( "numfiles" ).toUInt();
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
QString userName() const { return m_username; }
|
||||
QString friendlyName() const;
|
||||
void setFriendlyName( const QString& fname ) { m_friendlyname = fname; }
|
||||
void setFriendlyName( const QString& fname );
|
||||
|
||||
collection_ptr collection() const;
|
||||
void addCollection( const Tomahawk::collection_ptr& c );
|
||||
@ -111,6 +111,7 @@ private:
|
||||
QList< QSharedPointer<Collection> > m_collections;
|
||||
QVariantMap m_stats;
|
||||
QString m_lastOpGuid;
|
||||
bool m_scrubFriendlyName;
|
||||
|
||||
Tomahawk::query_ptr m_currentTrack;
|
||||
QString m_textStatus;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* === 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
|
||||
@ -46,14 +46,9 @@ SourceTreeItem::SourceTreeItem( const source_ptr& source, QObject* parent )
|
||||
QString name;
|
||||
if( source.isNull() )
|
||||
name = tr( "Super Collection" );
|
||||
else
|
||||
{
|
||||
if( TomahawkApp::instance()->scrubFriendlyName() && source->friendlyName().contains( '@' ) )
|
||||
name = source->friendlyName().left( source->friendlyName().indexOf( '@' ) );
|
||||
else
|
||||
name = source->friendlyName();
|
||||
}
|
||||
|
||||
else
|
||||
name = source->friendlyName();
|
||||
|
||||
QStandardItem* item = new QStandardItem( name );
|
||||
item->setIcon( QIcon( RESPATH "images/user-avatar.png" ) );
|
||||
item->setEditable( false );
|
||||
@ -114,7 +109,7 @@ SourceTreeItem::onPlaylistsAdded( const QList<playlist_ptr>& playlists )
|
||||
{
|
||||
// const-ness is important for getting the right pointer!
|
||||
foreach( const playlist_ptr& p, playlists )
|
||||
{
|
||||
{
|
||||
m_playlists.append( p );
|
||||
qlonglong ptr = reinterpret_cast<qlonglong>( &m_playlists.last() );
|
||||
|
||||
|
@ -540,7 +540,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
||||
QString tracks;
|
||||
int figWidth = 0;
|
||||
|
||||
if ( status )
|
||||
if ( status && sti && !sti->source().isNull() )
|
||||
{
|
||||
tracks = QString::number( sti->source()->trackCount() );
|
||||
figWidth = painter->fontMetrics().width( tracks );
|
||||
|
@ -150,7 +150,6 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
, m_sipHandler( 0 )
|
||||
, m_servent( 0 )
|
||||
, m_shortcutHandler( 0 )
|
||||
, m_scrubFriendlyName( false )
|
||||
, m_mainwindow( 0 )
|
||||
{
|
||||
qDebug() << "TomahawkApp thread:" << this->thread();
|
||||
@ -193,7 +192,6 @@ TomahawkApp::init()
|
||||
qDebug() << "Init Echonest Factory.";
|
||||
GeneratorFactory::registerFactory( "echonest", new EchonestFactory );
|
||||
|
||||
m_scrubFriendlyName = arguments().contains( "--demo" );
|
||||
// Register shortcut handler for this platform
|
||||
#ifdef Q_WS_MAC
|
||||
m_shortcutHandler = new MacShortcutHandler( this );
|
||||
|
Loading…
x
Reference in New Issue
Block a user