mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
Show resolver version for bundles, revision for packaged bundles.
This commit is contained in:
@@ -90,6 +90,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
virtual QString description() const { return QString(); }
|
virtual QString description() const { return QString(); }
|
||||||
virtual QString author() 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
|
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 );
|
painter->drawText( countRect, Qt::AlignLeft, count );
|
||||||
// runningEdge = authorRect.x();
|
// 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!
|
// Title and description!
|
||||||
return;
|
return;
|
||||||
|
@@ -342,6 +342,8 @@ AccountModel::data( const QModelIndex& index, int role ) const
|
|||||||
: acct->description();
|
: acct->description();
|
||||||
case AuthorRole:
|
case AuthorRole:
|
||||||
return acct->author();
|
return acct->author();
|
||||||
|
case VersionRole:
|
||||||
|
return acct->version();
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
return acct->enabled() ? Qt::Checked : Qt::Unchecked;
|
return acct->enabled() ? Qt::Checked : Qt::Unchecked;
|
||||||
case AccountData:
|
case AccountData:
|
||||||
|
@@ -154,6 +154,12 @@ ResolverAccountFactory::metadataFromJsonFile( const QString& path )
|
|||||||
result[ "scripts" ] = scripts;
|
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?
|
//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::AtticaResolverAccount( const QString& accountId )
|
AtticaResolverAccount::AtticaResolverAccount( const QString& accountId )
|
||||||
|
@@ -86,6 +86,7 @@ public:
|
|||||||
virtual QPixmap icon() const;
|
virtual QPixmap icon() const;
|
||||||
virtual QString description() const;
|
virtual QString description() const;
|
||||||
virtual QString author() const;
|
virtual QString author() const;
|
||||||
|
virtual QString version() const;
|
||||||
|
|
||||||
// Not relevant
|
// Not relevant
|
||||||
virtual SipPlugin* sipPlugin() { return 0; }
|
virtual SipPlugin* sipPlugin() { return 0; }
|
||||||
|
@@ -120,6 +120,7 @@ namespace TomahawkUtils
|
|||||||
StarHovered,
|
StarHovered,
|
||||||
SipPluginOnline,
|
SipPluginOnline,
|
||||||
SipPluginOffline,
|
SipPluginOffline,
|
||||||
|
ResolverBundle,
|
||||||
Invalid
|
Invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -707,6 +707,9 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
|||||||
case SoundcloudIcon:
|
case SoundcloudIcon:
|
||||||
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/soundcloud.svg", size );
|
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/soundcloud.svg", size );
|
||||||
break;
|
break;
|
||||||
|
case ResolverBundle:
|
||||||
|
pixmap = ImageRegistry::instance()->pixmap( RESPATH "images/drop-all-songs.svg", size );
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user