mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 00:24:12 +02:00
Show resolver version for bundles, revision for packaged bundles.
This commit is contained in:
@@ -90,6 +90,7 @@ public:
|
||||
#endif
|
||||
virtual QString description() const { return QString(); }
|
||||
virtual QString author() const { return QString(); }
|
||||
virtual QString version() const { return QString(); }
|
||||
|
||||
virtual void saveConfig() {} // called when the widget has been edited. save values from config widget, call sync() to write to disk account generic settings
|
||||
|
||||
|
@@ -371,6 +371,23 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
painter->drawText( countRect, Qt::AlignLeft, count );
|
||||
// runningEdge = authorRect.x();
|
||||
}
|
||||
else //no rating, it's not attica, let's show other stuff...
|
||||
{
|
||||
QString versionString = index.data( AccountModel::VersionRole ).toString();
|
||||
|
||||
if ( !versionString.isEmpty() )
|
||||
{
|
||||
int runningEdge = textRect.left();
|
||||
int pkgTop = runningBottom + PADDING;
|
||||
int h = painter->fontMetrics().height();
|
||||
|
||||
QRect pkgRect( runningEdge, pkgTop, h, h );
|
||||
painter->drawPixmap( pkgRect, TomahawkUtils::defaultPixmap( TomahawkUtils::ResolverBundle, TomahawkUtils::Original, pkgRect.size() ) );
|
||||
|
||||
QRect textRect( runningEdge + PADDING + h, pkgTop, painter->fontMetrics().width( versionString ), h );
|
||||
painter->drawText( textRect, Qt::AlignLeft, versionString );
|
||||
}
|
||||
}
|
||||
|
||||
// Title and description!
|
||||
return;
|
||||
|
@@ -342,6 +342,8 @@ AccountModel::data( const QModelIndex& index, int role ) const
|
||||
: acct->description();
|
||||
case AuthorRole:
|
||||
return acct->author();
|
||||
case VersionRole:
|
||||
return acct->version();
|
||||
case Qt::CheckStateRole:
|
||||
return acct->enabled() ? Qt::Checked : Qt::Unchecked;
|
||||
case AccountData:
|
||||
|
@@ -154,6 +154,12 @@ ResolverAccountFactory::metadataFromJsonFile( const QString& path )
|
||||
result[ "scripts" ] = scripts;
|
||||
}
|
||||
}
|
||||
if ( !variant[ "version" ].isNull() )
|
||||
result[ "version" ] = variant[ "version" ];
|
||||
if ( !variant[ "revision" ].isNull() )
|
||||
result[ "revision" ] = variant[ "revision" ];
|
||||
if ( !variant[ "timestamp" ].isNull() )
|
||||
result[ "timestamp" ] = variant[ "timestamp" ];
|
||||
}
|
||||
//TODO: correct baseName and rename directory maybe?
|
||||
}
|
||||
@@ -354,6 +360,17 @@ ResolverAccount::author() const
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
ResolverAccount::version() const
|
||||
{
|
||||
QString versionString = configuration().value( "version" ).toString();
|
||||
QString build = configuration().value( "revision" ).toString();
|
||||
if ( !build.isEmpty() )
|
||||
return versionString + "-" + build;
|
||||
return versionString;
|
||||
}
|
||||
|
||||
|
||||
/// AtticaResolverAccount
|
||||
|
||||
AtticaResolverAccount::AtticaResolverAccount( const QString& accountId )
|
||||
|
@@ -86,6 +86,7 @@ public:
|
||||
virtual QPixmap icon() const;
|
||||
virtual QString description() const;
|
||||
virtual QString author() const;
|
||||
virtual QString version() const;
|
||||
|
||||
// Not relevant
|
||||
virtual SipPlugin* sipPlugin() { return 0; }
|
||||
|
@@ -120,6 +120,7 @@ namespace TomahawkUtils
|
||||
StarHovered,
|
||||
SipPluginOnline,
|
||||
SipPluginOffline,
|
||||
ResolverBundle,
|
||||
Invalid
|
||||
};
|
||||
|
||||
|
@@ -707,6 +707,9 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
||||
case SoundcloudIcon:
|
||||
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/soundcloud.svg", size );
|
||||
break;
|
||||
case ResolverBundle:
|
||||
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/drop-all-songs.svg", size );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user