Skip to content

Commit c490688

Browse files
committed
[PluginManager] Move title pages for tabs to the resources. Will be included to translations when the contents is ready.
1 parent b3e5e62 commit c490688

File tree

6 files changed

+31
-2
lines changed

6 files changed

+31
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Here we have <b>not yet installed</b> plugins. You can download whatever you want.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Here are <b>installed plugins</b>. To <i>enable</i> or <i>disable</i> plugin, click its checkbox or doubleclick its name...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Plugins here are <b>broken, incompatible or disappointed</b>.<br/><br/>
2+
3+
<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>

resources/plugin_manager/new_plugins

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Here are hot <b>news</b>. They are not yet installed plugins that are seen for the first time.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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!).

src/app/pluginmanager/qgspluginmanager.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <QRegExp>
2929
#include <QSortFilterProxyModel>
3030
#include <QActionGroup>
31+
#include <QTextStream>
3132

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

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

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

896895
QStringList acceptedStatuses;
896+
QString welcomePage;
897897
switch ( idx )
898898
{
899899
case 0:
900900
// installed (statuses ends with Z are for spacers to always sort properly)
901901
acceptedStatuses << "installed" << "orphan" << "newer" << "upgradeable" << "installedZ" << "upgradeableZ" << "orphanZ" << "newerZZ" << "" ;
902+
welcomePage = "installed_plugins";
902903
break;
903904
case 1:
904905
// not installed (get more)
905906
acceptedStatuses << "not installed" << "new" ;
907+
welcomePage = "get_more_plugins";
906908
break;
907909
case 2:
908910
// upgradeable
909911
acceptedStatuses << "upgradeable" ;
912+
welcomePage = "upgradeable_plugins";
910913
break;
911914
case 3:
912915
// new
913916
acceptedStatuses << "new" ;
917+
welcomePage = "new_plugins";
914918
break;
915919
case 4:
916920
// invalid
917921
acceptedStatuses << "invalid" ;
922+
welcomePage = "invalid_plugins";
918923
break;
919924
}
920925
mModelProxy->setAcceptedStatuses( acceptedStatuses );
921926

922927
updateTabTitle();
928+
929+
// load welcome HTML to the detail browser
930+
// // // // // // // TODO: after texts are done, read from translations instead.
931+
QString welcomeHTML = "";
932+
QFile welcomeFile( QgsApplication::pkgDataPath() + "/resources/plugin_manager/" + welcomePage );
933+
if ( welcomeFile.open( QIODevice::ReadOnly ) )
934+
{
935+
QTextStream welcomeStream( &welcomeFile ); // Remove from includes too.
936+
welcomeStream.setCodec( "UTF-8" );
937+
QString myStyle = QgsApplication::reportStyleSheet();
938+
welcomeHTML += "<style>" + myStyle + "</style>";
939+
while ( !welcomeStream.atEnd() )
940+
{
941+
welcomeHTML += welcomeStream.readLine();
942+
}
943+
}
944+
tbDetails->setHtml( welcomeHTML );
923945
}
924946
}
925947

0 commit comments

Comments
 (0)