Skip to content

Commit

Permalink
[Plugin Manager] Fix window title issues after recent changes in QgsO…
Browse files Browse the repository at this point in the history
…ptionsDialogBase
  • Loading branch information
borysiasty committed Jan 19, 2014
1 parent 72ec87d commit 377d30a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
36 changes: 36 additions & 0 deletions src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -29,6 +29,7 @@
#include <QSortFilterProxyModel>
#include <QActionGroup>
#include <QTextStream>
#include <QTimer>

#include "qgis.h"
#include "qgsapplication.h"
Expand Down Expand Up @@ -538,6 +539,8 @@ void QgsPluginManager::reloadModelData()
if ( hasAvailablePlugins() ) mModelPlugins->appendRow( createSpacerItem( tr( "Installable", "category: plugins that are available for installation" ), "not installedZ" ) );
}

updateWindowTitle();

buttonUpgradeAll->setEnabled( hasUpgradeablePlugins() );

// Disable tabs that are empty because of no suitable plugins in the model.
Expand Down Expand Up @@ -1003,6 +1006,8 @@ void QgsPluginManager::setCurrentTab( int idx )
buttonInstall->setEnabled( false );
buttonUninstall->setEnabled( false );
}

updateWindowTitle();
}


Expand Down Expand Up @@ -1336,3 +1341,34 @@ bool QgsPluginManager::hasInvalidPlugins( )

return false;
}



void QgsPluginManager::updateWindowTitle( )
{
QString newTitle = QString( "%1 - %2" ).arg( tr( "Plugins" ) ).arg( mOptionsListWidget->currentItem()->text() );
if ( mOptionsListWidget->currentRow() < mOptionsListWidget->count() - 1 )
{
// if it's not the Settings tab, add the plugin count
newTitle += QString( " (%3)" ).arg( mModelProxy->countWithCurrentStatus() );
}
setWindowTitle( newTitle );
return;
}



void QgsPluginManager::showEvent( QShowEvent* e )
{
if ( mInit )
{
updateOptionsListVerticalTabs();
}
else
{
QTimer::singleShot( 0, this, SLOT( warnAboutMissingObjects() ) );
}

QDialog::showEvent( e );
}

8 changes: 7 additions & 1 deletion src/app/pluginmanager/qgspluginmanager.h
Expand Up @@ -100,6 +100,9 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Set tab of the stacked widget (called from the vertical list item)
void setCurrentTab( int idx );

//! Update the window title according to the current filters
void updateWindowTitle();

//! Handle plugin selection
void currentPluginChanged( const QModelIndex & theIndex );

Expand Down Expand Up @@ -160,8 +163,11 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Enable all repositories disabled by "Enable selected repository only"
void clearRepositoryFilter( );

private:
protected:
//! Reimplement QgsOptionsDialogBase method as we have a custom window title what would be overwritten by this method
void showEvent( QShowEvent* e );

private:
//! Load translated descriptions. Source strings implemented in external qgspluginmanager_texts.cpp
void initTabDescriptions();

Expand Down

0 comments on commit 377d30a

Please sign in to comment.