Skip to content

Commit

Permalink
[PluginManager] Move title pages for tabs to the resources. Will be i…
Browse files Browse the repository at this point in the history
…ncluded to translations when the contents is ready.
  • Loading branch information
borysiasty committed Jun 9, 2013
1 parent b3e5e62 commit c490688
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions resources/plugin_manager/get_more_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Here we have <b>not yet installed</b> plugins. You can download whatever you want.
1 change: 1 addition & 0 deletions resources/plugin_manager/installed_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Here are <b>installed plugins</b>. To <i>enable</i> or <i>disable</i> plugin, click its checkbox or doubleclick its name...
3 changes: 3 additions & 0 deletions resources/plugin_manager/invalid_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Plugins here are <b>broken, incompatible or disappointed</b>.<br/><br/>

<font size="2">How a plugin can be disappointed? Ha ha! We promised them plenty Python modules they need to run, but we sold them and now you probably need to install them manually.</font>
1 change: 1 addition & 0 deletions resources/plugin_manager/new_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Here are hot <b>news</b>. They are not yet installed plugins that are seen for the first time.
1 change: 1 addition & 0 deletions resources/plugin_manager/upgradeable_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Here are <b>upgradeable plugins</b>. It means more recent versions of installed plugins are available somewhere over the Internet (and I know where!).
26 changes: 24 additions & 2 deletions src/app/pluginmanager/qgspluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <QRegExp>
#include <QSortFilterProxyModel>
#include <QActionGroup>
#include <QTextStream>

#include "qgis.h"
#include "qgsapplication.h"
Expand Down Expand Up @@ -82,8 +83,6 @@ QgsPluginManager::QgsPluginManager( QWidget * parent, Qt::WFlags fl )
vwPlugins->setFocus();

// Preset widgets
QString wellcomeMsg = tr( "To enable or disable plugin, click its checkbox or doubleclick its name..." );
tbDetails->setHtml( wellcomeMsg );
leFilter->setFocus( Qt::MouseFocusReason );
rbFilterNames->setChecked( true );

Expand Down Expand Up @@ -894,32 +893,55 @@ void QgsPluginManager::setCurrentTab( int idx )
mOptionsStackedWidget->setCurrentIndex( 0 );

QStringList acceptedStatuses;
QString welcomePage;
switch ( idx )
{
case 0:
// installed (statuses ends with Z are for spacers to always sort properly)
acceptedStatuses << "installed" << "orphan" << "newer" << "upgradeable" << "installedZ" << "upgradeableZ" << "orphanZ" << "newerZZ" << "" ;
welcomePage = "installed_plugins";
break;
case 1:
// not installed (get more)
acceptedStatuses << "not installed" << "new" ;
welcomePage = "get_more_plugins";
break;
case 2:
// upgradeable
acceptedStatuses << "upgradeable" ;
welcomePage = "upgradeable_plugins";
break;
case 3:
// new
acceptedStatuses << "new" ;
welcomePage = "new_plugins";
break;
case 4:
// invalid
acceptedStatuses << "invalid" ;
welcomePage = "invalid_plugins";
break;
}
mModelProxy->setAcceptedStatuses( acceptedStatuses );

updateTabTitle();

// load welcome HTML to the detail browser
// // // // // // // TODO: after texts are done, read from translations instead.
QString welcomeHTML = "";
QFile welcomeFile( QgsApplication::pkgDataPath() + "/resources/plugin_manager/" + welcomePage );
if ( welcomeFile.open( QIODevice::ReadOnly ) )
{
QTextStream welcomeStream( &welcomeFile ); // Remove from includes too.
welcomeStream.setCodec( "UTF-8" );
QString myStyle = QgsApplication::reportStyleSheet();
welcomeHTML += "<style>" + myStyle + "</style>";
while ( !welcomeStream.atEnd() )
{
welcomeHTML += welcomeStream.readLine();
}
}
tbDetails->setHtml( welcomeHTML );
}
}

Expand Down

0 comments on commit c490688

Please sign in to comment.