1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Merge branch 'master' into single-file-cache

This commit is contained in:
Jeff Mitchell
2011-04-20 12:59:30 -04:00
7 changed files with 26 additions and 25 deletions

View File

@@ -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 );

View File

@@ -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
)

View File

@@ -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;
@@ -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;
}

View File

@@ -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;

View File

@@ -46,13 +46,8 @@ 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();
}
QStandardItem* item = new QStandardItem( name );
item->setIcon( QIcon( RESPATH "images/user-avatar.png" ) );

View File

@@ -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 );

View File

@@ -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 );