Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 5, 2013
1 parent 4337d8d commit 3c508d6
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 83 deletions.
142 changes: 76 additions & 66 deletions src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -86,8 +86,8 @@ QgsPluginManager::QgsPluginManager( QWidget * parent, Qt::WFlags fl )
actionSortByVote->setCheckable( true );
actionSortByStatus->setCheckable( true );
actionSortByRepository->setCheckable( true );
QActionGroup * group = new QActionGroup ( vwPlugins );
actionSortByName->setActionGroup( group);
QActionGroup * group = new QActionGroup( vwPlugins );
actionSortByName->setActionGroup( group );
actionSortByDownloads->setActionGroup( group );
actionSortByVote->setActionGroup( group );
actionSortByStatus->setActionGroup( group );
Expand Down Expand Up @@ -406,9 +406,9 @@ void QgsPluginManager::reloadModelData()
mypDetailItem->setData( description, PLUGIN_DESCRIPTION_ROLE );
mypDetailItem->setData( author, PLUGIN_AUTHOR_ROLE );
mypDetailItem->setData( it->value( "tags" ), PLUGIN_TAGS_ROLE );
mypDetailItem->setData( it->value( "downloads" ).rightJustified( 10, '0' ), PLUGIN_DOWNLOADS_ROLE);
mypDetailItem->setData( it->value( "zip_repository" ), PLUGIN_REPOSITORY_ROLE);
mypDetailItem->setData( it->value( "average_vote" ), PLUGIN_VOTE_ROLE);
mypDetailItem->setData( it->value( "downloads" ).rightJustified( 10, '0' ), PLUGIN_DOWNLOADS_ROLE );
mypDetailItem->setData( it->value( "zip_repository" ), PLUGIN_REPOSITORY_ROLE );
mypDetailItem->setData( it->value( "average_vote" ), PLUGIN_VOTE_ROLE );

if ( QFileInfo( iconPath ).isFile() )
{
Expand All @@ -422,15 +422,17 @@ void QgsPluginManager::reloadModelData()
mypDetailItem->setEditable( false );

// set item display style
if ( ! it->value( "error" ).isEmpty() ) {
QBrush brush = mypDetailItem->foreground();
brush.setColor( Qt::red );
mypDetailItem->setForeground( brush );
if ( ! it->value( "error" ).isEmpty() )
{
QBrush brush = mypDetailItem->foreground();
brush.setColor( Qt::red );
mypDetailItem->setForeground( brush );
}
if ( ! it->value( "error" ).isEmpty() || it->value( "status" ) == "upgradeable" || it->value( "status" ) == "new" ) {
QFont font = mypDetailItem->font();
font.setBold( true );
mypDetailItem->setFont( font );
if ( ! it->value( "error" ).isEmpty() || it->value( "status" ) == "upgradeable" || it->value( "status" ) == "new" )
{
QFont font = mypDetailItem->font();
font.setBold( true );
mypDetailItem->setFont( font );
}

// set checkable if the plugin is loadable.
Expand All @@ -446,7 +448,7 @@ void QgsPluginManager::reloadModelData()

if ( isPluginLoaded( it->value( "id" ) ) )
{
mypDetailItem->setCheckState( Qt::Checked );
mypDetailItem->setCheckState( Qt::Checked );
}

// Add items to model
Expand Down Expand Up @@ -531,34 +533,34 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )
errorMsg = QString( "<b>%1</b><br/>%2" ).arg( tr( "This plugin is broken" ) ).arg( metadata->value( "error_details" ) );
}
html += QString( "<table bgcolor=\"#EEEE00\" cellspacing=\"2\" cellpadding=\"6\" width=\"100%\">"
" <tr><td width=\"100%\" style=\"color:#CC0000\">%1</td></tr>"
"</table>" ).arg( errorMsg );
" <tr><td width=\"100%\" style=\"color:#CC0000\">%1</td></tr>"
"</table>" ).arg( errorMsg );
}
if ( metadata->value( "status" ) == "upgradeable" )
{
html += QString( "<table bgcolor=\"#FFFFAA\" cellspacing=\"2\" cellpadding=\"6\" width=\"100%\">"
" <tr><td width=\"100%\" style=\"color:#880000\"><b>%1</b></td></tr>"
"</table>" ).arg( tr( "There is a new version available" ) );
" <tr><td width=\"100%\" style=\"color:#880000\"><b>%1</b></td></tr>"
"</table>" ).arg( tr( "There is a new version available" ) );
};
if ( metadata->value( "status" ) == "new" )
{
html += QString( "<table bgcolor=\"#CCFFCC\" cellspacing=\"2\" cellpadding=\"6\" width=\"100%\">"
" <tr><td width=\"100%\" style=\"color:#008800\"><b>%1</b></td></tr>"
"</table>" ).arg( tr( "This is a new plugin" ) );
" <tr><td width=\"100%\" style=\"color:#008800\"><b>%1</b></td></tr>"
"</table>" ).arg( tr( "This is a new plugin" ) );
};
if ( metadata->value( "status" ) == "newer" )
{
html += QString( "<table bgcolor=\"#FFFFCC\" cellspacing=\"2\" cellpadding=\"6\" width=\"100%\">"
" <tr><td width=\"100%\" style=\"color:#550000\"><b>%1</b></td></tr>"
"</table>" ).arg( tr( "Installed version of this plugin is higher than any version found in repository" ) );
" <tr><td width=\"100%\" style=\"color:#550000\"><b>%1</b></td></tr>"
"</table>" ).arg( tr( "Installed version of this plugin is higher than any version found in repository" ) );
};
if ( metadata->value( "experimental" ) == "true" )
{
html += QString( "<table bgcolor=\"#EEEEBB\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">"
" <tr><td width=\"100%\" style=\"color:#660000\">"
" <img src=\":/images/themes/default/pluginExperimental.png\" width=\"32\"><b>%1</b>"
" </td></tr>"
"</table>" ).arg( tr( "This plugin is experimental" ) );
" <tr><td width=\"100%\" style=\"color:#660000\">"
" <img src=\":/images/themes/default/pluginExperimental.png\" width=\"32\"><b>%1</b>"
" </td></tr>"
"</table>" ).arg( tr( "This plugin is experimental" ) );
};
// if ( metadata->value( "status" ) == t.b.d. )
// {
Expand All @@ -576,7 +578,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )
html += QString( "<img src=\"%1\" style=\"float:right;\">" ).arg( metadata->value( "icon" ) );
}

html += QString( "<h3>%2</h3>" ).arg(metadata->value( "description" ) );
html += QString( "<h3>%2</h3>" ).arg( metadata->value( "description" ) );

if ( ! metadata->value( "category" ).isEmpty() )
{
Expand All @@ -599,15 +601,15 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )
html += QString( "%1: " ).arg( tr( "More info" ) );
if ( ! metadata->value( "homepage" ).isEmpty() )
{
html += QString( "<a href='%1'>%2</a> &nbsp; " ).arg( metadata->value( "homepage" ) ).arg( tr( "homepage" ) );
html += QString( "<a href='%1'>%2</a> &nbsp; " ).arg( metadata->value( "homepage" ) ).arg( tr( "homepage" ) );
}
if ( ! metadata->value( "tracker" ).isEmpty() )
{
html += QString( "<a href='%1'>%2</a> &nbsp; " ).arg( metadata->value( "tracker" ) ).arg( tr( "tracker" ) );
html += QString( "<a href='%1'>%2</a> &nbsp; " ).arg( metadata->value( "tracker" ) ).arg( tr( "tracker" ) );
}
if ( ! metadata->value( "code_repository" ).isEmpty() )
{
html += QString( "<a href='%1'>%2</a>" ).arg( metadata->value( "code_repository" ) ).arg( tr( "code_ repository" ) );
html += QString( "<a href='%1'>%2</a>" ).arg( metadata->value( "code_repository" ) ).arg( tr( "code_ repository" ) );
}
html += "<br/>";
}
Expand Down Expand Up @@ -781,7 +783,7 @@ void QgsPluginManager::addToRepositoryList( QMap<QString, QString> repository )
treeRepositories->resizeColumnToContents( 0 );
treeRepositories->resizeColumnToContents( 1 );
treeRepositories->resizeColumnToContents( 2 );
treeRepositories->sortItems ( 1, Qt::AscendingOrder );
treeRepositories->sortItems( 1, Qt::AscendingOrder );
buttonRefreshRepos->setEnabled( true );
}

Expand Down Expand Up @@ -818,26 +820,26 @@ void QgsPluginManager::setCurrentTab( int idx )
QStringList acceptedStatuses;
switch ( idx )
{
case 0:
// installed
acceptedStatuses << "installed" << "orphan" << "newer" << "upgradeable" << "";
break;
case 1:
// not installed (get more)
acceptedStatuses << "not installed" << "new" ;
break;
case 2:
// upgradeable
acceptedStatuses << "upgradeable" ;
break;
case 3:
// new
acceptedStatuses << "new" ;
break;
case 4:
// invalid
acceptedStatuses << "invalid" ;
break;
case 0:
// installed
acceptedStatuses << "installed" << "orphan" << "newer" << "upgradeable" << "";
break;
case 1:
// not installed (get more)
acceptedStatuses << "not installed" << "new" ;
break;
case 2:
// upgradeable
acceptedStatuses << "upgradeable" ;
break;
case 3:
// new
acceptedStatuses << "new" ;
break;
case 4:
// invalid
acceptedStatuses << "invalid" ;
break;
}
mModelProxy->setAcceptedStatuses( acceptedStatuses );

Expand Down Expand Up @@ -869,10 +871,11 @@ void QgsPluginManager::on_vwPlugins_clicked( const QModelIndex &theIndex )
// so we need to jump through this little hoop to get the correct item
QModelIndex realIndex = mModelProxy->mapToSource( theIndex );
QStandardItem* mypItem = mModelPlugins->itemFromIndex( realIndex );
if ( !mypItem->isEnabled() ) {
//The item is inactive (uncompatible or broken plugin), so it can't be selected. Display it's data anyway.
vwPlugins->clearSelection();
showPluginDetails( mypItem );
if ( !mypItem->isEnabled() )
{
//The item is inactive (uncompatible or broken plugin), so it can't be selected. Display it's data anyway.
vwPlugins->clearSelection();
showPluginDetails( mypItem );
}
}
}
Expand All @@ -889,9 +892,12 @@ void QgsPluginManager::on_vwPlugins_doubleClicked( const QModelIndex & theIndex
QStandardItem* mypItem = mModelPlugins->itemFromIndex( realIndex );
if ( mypItem->isCheckable() )
{
if ( mypItem->checkState() == Qt::Checked ) {
if ( mypItem->checkState() == Qt::Checked )
{
mypItem->setCheckState( Qt::Unchecked );
} else {
}
else
{
mypItem->setCheckState( Qt::Checked );
}
}
Expand All @@ -913,16 +919,18 @@ void QgsPluginManager::on_leFilter_textChanged( QString theText )

void QgsPluginManager::on_rbFilterNames_toggled( bool checked )
{
if ( checked ) {
mModelProxy->setFilterRole( Qt::DisplayRole );
if ( checked )
{
mModelProxy->setFilterRole( Qt::DisplayRole );
}
}



void QgsPluginManager::on_rbFilterDescriptions_toggled( bool checked )
{
if ( checked ) {
if ( checked )
{
mModelProxy->setFilterRole( PLUGIN_DESCRIPTION_ROLE );
}
}
Expand All @@ -931,7 +939,8 @@ void QgsPluginManager::on_rbFilterDescriptions_toggled( bool checked )

void QgsPluginManager::on_rbFilterTags_toggled( bool checked )
{
if ( checked ) {
if ( checked )
{
mModelProxy->setFilterRole( PLUGIN_TAGS_ROLE );
}
}
Expand All @@ -940,7 +949,8 @@ void QgsPluginManager::on_rbFilterTags_toggled( bool checked )

void QgsPluginManager::on_rbFilterAuthors_toggled( bool checked )
{
if ( checked ) {
if ( checked )
{
mModelProxy->setFilterRole( PLUGIN_AUTHOR_ROLE );
}
}
Expand Down Expand Up @@ -1030,7 +1040,7 @@ void QgsPluginManager::on_buttonDeleteRep_clicked( )
void QgsPluginManager::on_ckbExperimental_toggled( bool state )
{
QSettings settings;
settings.setValue( settingsGroup+"/allowExperimental", QVariant( state ) );
settings.setValue( settingsGroup + "/allowExperimental", QVariant( state ) );
QgsPythonRunner::run( "pyplugin_installer.installer_data.plugins.rebuild()" );
QgsPythonRunner::run( "pyplugin_installer.instance().exportPluginsToManager()" );
}
Expand Down Expand Up @@ -1124,8 +1134,8 @@ bool QgsPluginManager::hasInvalidPlugins( )

void QgsPluginManager::updateTabTitle()
{
lbStatusFilter->setText ( QString( " %1 > %2 (%3)" ).arg( tr( "Plugins" ) )
.arg( mOptionsListWidget->currentItem()->text() )
.arg( mModelProxy->countWithCurrentStatus() ) );
lbStatusFilter->setText( QString( " %1 > %2 (%3)" ).arg( tr( "Plugins" ) )
.arg( mOptionsListWidget->currentItem()->text() )
.arg( mModelProxy->countWithCurrentStatus() ) );
}

12 changes: 6 additions & 6 deletions src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp
Expand Up @@ -23,9 +23,9 @@ QgsPluginSortFilterProxyModel::QgsPluginSortFilterProxyModel( QObject *parent )



bool QgsPluginSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
bool QgsPluginSortFilterProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const
{
QModelIndex inx = sourceModel()->index(sourceRow, 0, sourceParent);
QModelIndex inx = sourceModel()->index( sourceRow, 0, sourceParent );

return ( filterByStatus( inx ) && sourceModel()->data( inx, filterRole() ).toString().contains( filterRegExp() ) );
}
Expand All @@ -43,15 +43,15 @@ void QgsPluginSortFilterProxyModel::setAcceptedStatuses( QStringList statuses )
bool QgsPluginSortFilterProxyModel::filterByStatus( QModelIndex &index ) const
{
if ( mAcceptedStatuses.contains( "invalid" )
&& sourceModel()->data( index, PLUGIN_ERROR_ROLE ).toString().isEmpty() )
&& sourceModel()->data( index, PLUGIN_ERROR_ROLE ).toString().isEmpty() )
{
// Don't accept if the "invalid" filter is set and the plugin is ok
return false;
}

if ( ! mAcceptedStatuses.isEmpty()
&& ! mAcceptedStatuses.contains( "invalid" )
&& ! mAcceptedStatuses.contains( sourceModel()->data(index, PLUGIN_STATUS_ROLE).toString() ) )
&& ! mAcceptedStatuses.contains( "invalid" )
&& ! mAcceptedStatuses.contains( sourceModel()->data( index, PLUGIN_STATUS_ROLE ).toString() ) )
{
// Don't accept if the status doesn't match
return false;
Expand All @@ -66,7 +66,7 @@ bool QgsPluginSortFilterProxyModel::filterByStatus( QModelIndex &index ) const
int QgsPluginSortFilterProxyModel::countWithCurrentStatus( )
{
int result = 0;
for ( int i=0; i < sourceModel()->rowCount(); ++i )
for ( int i = 0; i < sourceModel()->rowCount(); ++i )
{
QModelIndex idx = sourceModel()->index( i, 0 );
if ( filterByStatus( idx ) )
Expand Down
14 changes: 7 additions & 7 deletions src/app/pluginmanager/qgspluginsortfilterproxymodel.h
Expand Up @@ -36,7 +36,7 @@ const int PLUGIN_REPOSITORY_ROLE = Qt::UserRole + 9; // for sorting
*/
class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_OBJECT

public:
QgsPluginSortFilterProxyModel( QObject *parent = 0 );
Expand All @@ -45,7 +45,7 @@ class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel
void setAcceptedStatuses( QStringList statuses );

//! Return number of item with status filter matching (no other filters are considered)
int countWithCurrentStatus( );
int countWithCurrentStatus( );

public slots:
void sortPluginsByName( );
Expand All @@ -55,14 +55,14 @@ class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel
void sortPluginsByRepository( );

protected:
//! Filter by status: this method is used in both filterAcceptsRow and countWithCurrentStatus.
bool filterByStatus( QModelIndex &index ) const;
//! Filter by status: this method is used in both filterAcceptsRow and countWithCurrentStatus.
bool filterByStatus( QModelIndex &index ) const;

//! The main filter method
bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const;
//! The main filter method
bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const;

private:
QStringList mAcceptedStatuses;
QStringList mAcceptedStatuses;
};

#endif
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -6300,7 +6300,7 @@ void QgisApp::showPluginManager()
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
// Call pluginManagerInterface()->showPluginManager() as soon as the plugin installer says the remote data is fetched.
QgsPythonRunner::run( "pyplugin_installer.instance().showPluginManagerWhenReady()");
QgsPythonRunner::run( "pyplugin_installer.instance().showPluginManagerWhenReady()" );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspluginregistry.cpp
Expand Up @@ -406,7 +406,7 @@ void QgsPluginRegistry::unloadCppPlugin( QString theFullPathName )
settings.setValue( "/Plugins/" + baseName, false );
// remove the plugin from the registry
removePlugin( baseName );
QgsDebugMsg( "Cpp plugin successfully unloaded: " + baseName);
QgsDebugMsg( "Cpp plugin successfully unloaded: " + baseName );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -133,8 +133,8 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
#ifdef Q_OS_WIN
// Enable touch event on Windows.
// Qt on Windows needs to be told it can take touch events or else it ignores them.
grabGesture(Qt::PinchGesture);
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
grabGesture( Qt::PinchGesture );
viewport()->setAttribute( Qt::WA_AcceptTouchEvents );
#endif
} // QgsMapCanvas ctor

Expand Down

0 comments on commit 3c508d6

Please sign in to comment.