Skip to content
Permalink
Browse files

[Plugin manager] Tabular layout for the details view

  • Loading branch information
borysiasty committed Feb 22, 2018
1 parent 92becc4 commit 454a93606ae32f9879b444267c29e9291714c6c5
Showing with 31 additions and 22 deletions.
  1. +31 −22 src/app/pluginmanager/qgspluginmanager.cpp
@@ -651,7 +651,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
" padding:0px;"
" margin:0px;"
" font-family:Verdana, Sans-serif;"
" font-size: 10pt;"
" font-size:10pt;"
" }"
" a {"
" color:#08c;"
@@ -666,8 +666,17 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
" margin-left:98px;"
" padding-top:3px;"
" }"
" span.version {"
" cursor: pointer;"
" td {"
" vertical-align:top;"
" }"
" td.key {"
" font-weight: bold;"
" white-space:nowrap;"
" padding-right:10px;"
" text-align:right;"
" }"
" td.version {"
" cursor:pointer;"
" }"
"</style>";

@@ -681,6 +690,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
" background-size: 92px 16px;"
" width:92px;"
" height:16px;"
" margin-bottom:24px;"
" }"
" div#stars {"
" background-image: url('qrc:/images/themes/default/stars_full.svg');"
@@ -825,7 +835,8 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )

// Now the metadata

html += QLatin1String( "<table cellspacing=\"4\" width=\"100%\"><tr><td>" );
html += QLatin1String( "<table cellspacing='4' width='100%'>" );
html += QLatin1String( "<tr><td colspan='2'>" );

QString iconPath = metadata->value( QStringLiteral( "icon" ) );

@@ -854,10 +865,9 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
{
QString about = metadata->value( QStringLiteral( "about" ) );
html += about.replace( '\n', QLatin1String( "<br/>" ) );
html += QLatin1String( "<br/><br/>" );
}

html += QLatin1String( "<br/><br/>" );

QString votes;
#ifndef WITH_QTWEBKIT
votes += tr( "Average rating %1" ).arg( metadata->value( "average_vote" ).toFloat(), 0, 'f', 1 );
@@ -884,20 +894,22 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
#else
voteRating->setText( votes );
#endif
html += QLatin1String( "</td></tr><tr><td>" );
html += QLatin1String( "<br/>" );

html += QLatin1String( "</td></tr>" );
html += QLatin1String( "<tr><td width='1%'> </td><td width='99%'> </td></tr>" );

if ( ! metadata->value( QStringLiteral( "category" ) ).isEmpty() )
{
html += QStringLiteral( "%1: %2 <br/>" ).arg( tr( "Category" ), metadata->value( QStringLiteral( "category" ) ) );
html += QStringLiteral( "<tr><td class='key'>%1 </td><td>%2</td></tr>" ).arg( tr( "Category" ), metadata->value( QStringLiteral( "category" ) ) );
}
if ( ! metadata->value( QStringLiteral( "tags" ) ).isEmpty() )
{
html += QStringLiteral( "%1: %2 <br/>" ).arg( tr( "Tags" ), metadata->value( QStringLiteral( "tags" ) ) );
html += QStringLiteral( "<tr><td class='key'>%1 </td><td>%2</td></tr>" ).arg( tr( "Tags" ), metadata->value( QStringLiteral( "tags" ) ) );
}

if ( ! metadata->value( QStringLiteral( "homepage" ) ).isEmpty() || ! metadata->value( QStringLiteral( "tracker" ) ).isEmpty() || ! metadata->value( QStringLiteral( "code_repository" ) ).isEmpty() )
{
html += QStringLiteral( "%1: " ).arg( tr( "More info" ) );
html += QStringLiteral( "<tr><td class='key'>%1 </td><td>" ).arg( tr( "More info" ) );
if ( ! metadata->value( QStringLiteral( "homepage" ) ).isEmpty() )
{
html += QStringLiteral( "<a href='%1'>%2</a> &nbsp; " ).arg( metadata->value( QStringLiteral( "homepage" ) ), tr( "homepage" ) );
@@ -910,43 +922,40 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
{
html += QStringLiteral( "<a href='%1'>%2</a>" ).arg( metadata->value( QStringLiteral( "code_repository" ) ), tr( "code repository" ) );
}
html += QLatin1String( "<br/>" );
html += QLatin1String( "</td></tr>" );
}
html += QLatin1String( "<br/>" );

if ( ! metadata->value( QStringLiteral( "author_email" ) ).isEmpty() )
{
html += QStringLiteral( "%1: <a href='mailto:%2'>%3</a>" ).arg( tr( "Author" ), metadata->value( QStringLiteral( "author_email" ) ), metadata->value( QStringLiteral( "author_name" ) ) );
html += QLatin1String( "<br/><br/>" );
html += QStringLiteral( "<tr><td class='key'>%1 </td><td><a href='mailto:%2'>%3</a></td></tr>" ).arg( tr( "Author" ), metadata->value( QStringLiteral( "author_email" ) ), metadata->value( QStringLiteral( "author_name" ) ) );
}
else if ( ! metadata->value( QStringLiteral( "author_name" ) ).isEmpty() )
{
html += QStringLiteral( "%1: %2" ).arg( tr( "Author" ), metadata->value( QStringLiteral( "author_name" ) ) );
html += QLatin1String( "<br/><br/>" );
html += QStringLiteral( "<tr><td class='key'>%1 </td><td>%2</td></tr>" ).arg( tr( "Author" ), metadata->value( QStringLiteral( "author_name" ) ) );
}

if ( ! metadata->value( QStringLiteral( "version_installed" ) ).isEmpty() )
{
QString ver = metadata->value( QStringLiteral( "version_installed" ) );
if ( ver == QLatin1String( "-1" ) ) ver = '?';
html += QStringLiteral( "%1 <span class='version' title='%2 %3'> %4 </span><br/>" ).arg( tr( "Installed version:" ),
html += QStringLiteral( "<tr><td class='key'>%1 </td><td class='version' title='%2 %3'> %4 </td></tr>" ).arg( tr( "Installed version" ),
tr( "in" ),
metadata->value( QStringLiteral( "library" ) ),
ver );
}
if ( ! metadata->value( QStringLiteral( "version_available" ) ).isEmpty() )
{
html += QStringLiteral( "%1 <span class='version' title='%2 %3'> %4 </span><br/>" ).arg( tr( "Available version:" ),
html += QStringLiteral( "<tr><td class='key'>%1 </td><td class='version' title='%2 %3'> %4 </td></tr>" ).arg( tr( "Available version" ),
tr( "in" ),
metadata->value( QStringLiteral( "zip_repository" ) ),
metadata->value( QStringLiteral( "version_available" ) ) );
}

if ( ! metadata->value( QStringLiteral( "changelog" ) ).isEmpty() )
{
html += QLatin1String( "<br/>" );
QString changelog = QStringLiteral( "%1:<br/>%2 <br/>" ).arg( tr( "Changelog" ), metadata->value( QStringLiteral( "changelog" ) ) );
html += changelog.replace( '\n', QLatin1String( "<br/>" ) );
QString changelog = metadata->value( QStringLiteral( "changelog" ) );
changelog = changelog.trimmed().replace( '\n', QLatin1String( "<br/>" ) );
html += QStringLiteral( "<tr><td class='key'>%1 </td><td>%2</td></tr>" ).arg( tr( "Changelog" ), changelog );
}

html += QLatin1String( "</td></tr></table>" );

1 comment on commit 454a936

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn commented on 454a936 Feb 23, 2018

@borysiasty , nice one.

Please sign in to comment.
You can’t perform that action at this time.