Skip to content

Commit 377d30a

Browse files
committedJan 19, 2014
[Plugin Manager] Fix window title issues after recent changes in QgsOptionsDialogBase
1 parent 72ec87d commit 377d30a

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed
 

‎src/app/pluginmanager/qgspluginmanager.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <QSortFilterProxyModel>
3030
#include <QActionGroup>
3131
#include <QTextStream>
32+
#include <QTimer>
3233

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

542+
updateWindowTitle();
543+
541544
buttonUpgradeAll->setEnabled( hasUpgradeablePlugins() );
542545

543546
// Disable tabs that are empty because of no suitable plugins in the model.
@@ -1003,6 +1006,8 @@ void QgsPluginManager::setCurrentTab( int idx )
10031006
buttonInstall->setEnabled( false );
10041007
buttonUninstall->setEnabled( false );
10051008
}
1009+
1010+
updateWindowTitle();
10061011
}
10071012

10081013

@@ -1336,3 +1341,34 @@ bool QgsPluginManager::hasInvalidPlugins( )
13361341

13371342
return false;
13381343
}
1344+
1345+
1346+
1347+
void QgsPluginManager::updateWindowTitle( )
1348+
{
1349+
QString newTitle = QString( "%1 - %2" ).arg( tr( "Plugins" ) ).arg( mOptionsListWidget->currentItem()->text() );
1350+
if ( mOptionsListWidget->currentRow() < mOptionsListWidget->count() - 1 )
1351+
{
1352+
// if it's not the Settings tab, add the plugin count
1353+
newTitle += QString( " (%3)" ).arg( mModelProxy->countWithCurrentStatus() );
1354+
}
1355+
setWindowTitle( newTitle );
1356+
return;
1357+
}
1358+
1359+
1360+
1361+
void QgsPluginManager::showEvent( QShowEvent* e )
1362+
{
1363+
if ( mInit )
1364+
{
1365+
updateOptionsListVerticalTabs();
1366+
}
1367+
else
1368+
{
1369+
QTimer::singleShot( 0, this, SLOT( warnAboutMissingObjects() ) );
1370+
}
1371+
1372+
QDialog::showEvent( e );
1373+
}
1374+

‎src/app/pluginmanager/qgspluginmanager.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
100100
//! Set tab of the stacked widget (called from the vertical list item)
101101
void setCurrentTab( int idx );
102102

103+
//! Update the window title according to the current filters
104+
void updateWindowTitle();
105+
103106
//! Handle plugin selection
104107
void currentPluginChanged( const QModelIndex & theIndex );
105108

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

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.