Skip to content

Commit

Permalink
[needs-docs] Move the install-plugin-from-ZIP menu action to the plug…
Browse files Browse the repository at this point in the history
…in manager. Also add a spacer to the left menu.
  • Loading branch information
borysiasty committed Oct 15, 2017
1 parent 3213152 commit 11ec24f
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 35 deletions.
3 changes: 2 additions & 1 deletion images/images.qrc
Expand Up @@ -301,7 +301,6 @@
<file>themes/default/mActionShowHideLabels.svg</file>
<file>themes/default/mActionShowPinnedLabels.svg</file>
<file>themes/default/mActionShowPluginManager.svg</file>
<file>themes/default/mActionInstallPluginFromZip.svg</file>
<file>themes/default/mActionShowRasterCalculator.png</file>
<file>themes/default/mActionShowSelectedLayers.svg</file>
<file>themes/default/mActionSimplify.svg</file>
Expand Down Expand Up @@ -445,6 +444,7 @@
<file>themes/default/propertyicons/plugin-installed.svg</file>
<file>themes/default/propertyicons/plugin-new.svg</file>
<file>themes/default/propertyicons/plugin-upgrade.svg</file>
<file>themes/default/propertyicons/plugin-install_from_zip.svg</file>
<file>themes/default/propertyicons/plugins.svg</file>
<file>themes/default/propertyicons/pyramids.png</file>
<file>themes/default/propertyicons/rendering.svg</file>
Expand All @@ -454,6 +454,7 @@
<file>themes/default/propertyicons/symbology.svg</file>
<file>themes/default/propertyicons/system.svg</file>
<file>themes/default/propertyicons/transparency.png</file>
<file>themes/default/propertyicons/spacer.svg</file>
<file>themes/default/rendererCategorizedSymbol.svg</file>
<file>themes/default/rendererGraduatedSymbol.svg</file>
<file>themes/default/rendererNullSymbol.svg</file>
Expand Down
2 changes: 2 additions & 0 deletions images/themes/default/propertyicons/spacer.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -74,6 +74,7 @@ QgsPluginManager::QgsPluginManager( QWidget *parent, bool pluginsAreEnabled, Qt:
connect( buttonUpgradeAll, &QPushButton::clicked, this, &QgsPluginManager::buttonUpgradeAll_clicked );
connect( buttonInstall, &QPushButton::clicked, this, &QgsPluginManager::buttonInstall_clicked );
connect( buttonUninstall, &QPushButton::clicked, this, &QgsPluginManager::buttonUninstall_clicked );
connect( buttonInstallFromZip, &QPushButton::clicked, this, &QgsPluginManager::buttonInstallFromZip_clicked );
connect( treeRepositories, &QTreeWidget::itemSelectionChanged, this, &QgsPluginManager::treeRepositories_itemSelectionChanged );
connect( treeRepositories, &QTreeWidget::doubleClicked, this, &QgsPluginManager::treeRepositories_doubleClicked );
connect( buttonAddRep, &QPushButton::clicked, this, &QgsPluginManager::buttonAddRep_clicked );
Expand Down Expand Up @@ -133,6 +134,7 @@ QgsPluginManager::QgsPluginManager( QWidget *parent, bool pluginsAreEnabled, Qt:
buttonInstall->hide();
buttonUninstall->hide();
frameSettings->setHidden( true );
mOptionsListWidget->item( PLUGMAN_TAB_INSTALL_FROM_ZIP )->setHidden( true );

voteRating->hide();
voteLabel->hide();
Expand Down Expand Up @@ -167,6 +169,7 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils )

// Now enable Python support:
// Show and preset widgets only suitable when Python support active
mOptionsListWidget->item( PLUGMAN_TAB_INSTALL_FROM_ZIP )->setHidden( false );
buttonUpgradeAll->show();
buttonInstall->show();
buttonUninstall->show();
Expand Down Expand Up @@ -1101,9 +1104,14 @@ void QgsPluginManager::reject()

void QgsPluginManager::setCurrentTab( int idx )
{
if ( idx == ( mOptionsListWidget->count() - 1 ) )
if ( idx == PLUGMAN_TAB_SETTINGS )
{
QgsDebugMsg( "Switching current tab to Settings" );
mOptionsStackedWidget->setCurrentIndex( 2 );
}
else if ( idx == PLUGMAN_TAB_INSTALL_FROM_ZIP )
{
QgsDebugMsg( "Switching current tab to Install from ZIP" );
mOptionsStackedWidget->setCurrentIndex( 1 );
}
else
Expand Down Expand Up @@ -1313,6 +1321,13 @@ void QgsPluginManager::buttonUninstall_clicked()



void QgsPluginManager::buttonInstallFromZip_clicked()
{
QgsPythonRunner::run( QStringLiteral( "pyplugin_installer.instance().installFromZipFile()" ) );
}



void QgsPluginManager::treeRepositories_itemSelectionChanged()
{
buttonEditRep->setEnabled( ! treeRepositories->selectedItems().isEmpty() );
Expand Down
8 changes: 8 additions & 0 deletions src/app/pluginmanager/qgspluginmanager.h
Expand Up @@ -38,6 +38,8 @@ const int PLUGMAN_TAB_NOT_INSTALLED = 2;
const int PLUGMAN_TAB_UPGRADEABLE = 3;
const int PLUGMAN_TAB_NEW = 4;
const int PLUGMAN_TAB_INVALID = 5;
const int PLUGMAN_TAB_INSTALL_FROM_ZIP = 7;
const int PLUGMAN_TAB_SETTINGS = 8;

/**
* \brief Plugin manager for browsing, (un)installing and (un)loading plugins
Expand Down Expand Up @@ -130,6 +132,12 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Uninstall selected plugin
void buttonUninstall_clicked();

/**
* Install plugin from ZIP file
* \since QGIS 3.0
*/
void buttonInstallFromZip_clicked();

//! Enable/disable buttons according to selected repository
void treeRepositories_itemSelectionChanged();

Expand Down
16 changes: 1 addition & 15 deletions src/app/qgisapp.cpp
Expand Up @@ -1033,15 +1033,13 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mPluginManager->setPythonUtils( mPythonUtils );
endProfile();
}
else if ( mActionShowPythonDialog || mActionInstallFromZip )
else if ( mActionShowPythonDialog )
#endif
{
// python is disabled so get rid of the action for python console
// and installing plugin from ZUIP
delete mActionShowPythonDialog;
delete mActionInstallFromZip;
mActionShowPythonDialog = nullptr;
mActionInstallFromZip = nullptr;
}

// Set icon size of toolbars
Expand Down Expand Up @@ -1875,7 +1873,6 @@ void QgisApp::createActions()
// Plugin Menu Items

connect( mActionManagePlugins, &QAction::triggered, this, &QgisApp::showPluginManager );
connect( mActionInstallFromZip, &QAction::triggered, this, &QgisApp::installPluginFromZip );
connect( mActionShowPythonDialog, &QAction::triggered, this, &QgisApp::showPythonDialog );

// Settings Menu Items
Expand Down Expand Up @@ -2830,7 +2827,6 @@ void QgisApp::setTheme( const QString &themeName )
mActionToggleFullScreen->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleFullScreen.png" ) ) );
mActionProjectProperties->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionProjectProperties.png" ) ) );
mActionManagePlugins->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionShowPluginManager.svg" ) ) );
mActionInstallFromZip->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionInstallPluginFromZip.svg" ) ) );
mActionShowPythonDialog->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconRunConsole.png" ) ) );
mActionCheckQgisVersion->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconSuccess.svg" ) ) );
mActionOptions->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOptions.svg" ) ) );
Expand Down Expand Up @@ -9224,16 +9220,6 @@ void QgisApp::showPluginManager()
}
}

void QgisApp::installPluginFromZip()
{
#ifdef WITH_BINDINGS
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
QgsPythonRunner::run( QStringLiteral( "pyplugin_installer.instance().installFromZipFile()" ) );
}
#endif
}


// implementation of the python runner
class QgsPythonRunnerImpl : public QgsPythonRunner
Expand Down
5 changes: 0 additions & 5 deletions src/app/qgisapp.h
Expand Up @@ -1045,11 +1045,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! load Python support if possible
void loadPythonSupport();

/**
* Install plugin from ZIP file
* \since QGIS 3.0
*/
void installPluginFromZip();
//! Find the QMenu with the given name within plugin menu (ie the user visible text on the menu item)
QMenu *getPluginMenu( const QString &menuName );
//! Add the action to the submenu with the given name under the plugin menu
Expand Down
10 changes: 0 additions & 10 deletions src/ui/qgisapp.ui
Expand Up @@ -193,7 +193,6 @@
<string>&amp;Plugins</string>
</property>
<addaction name="mActionManagePlugins"/>
<addaction name="mActionInstallFromZip"/>
<addaction name="separator"/>
<addaction name="mActionShowPythonDialog"/>
</widget>
Expand Down Expand Up @@ -2611,15 +2610,6 @@ Acts on currently active editable layer</string>
<string>Copy and Move Feature(s)</string>
</property>
</action>
<action name="mActionInstallFromZip">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionInstallPluginFromZip.svg</normaloff>:/images/themes/default/mActionInstallPluginFromZip.svg</iconset>
</property>
<property name="text">
<string>Install plugin from ZIP...</string>
</property>
</action>
<action name="mActionDecorationLayoutExtent">
<property name="icon">
<iconset resource="../../images/images.qrc">
Expand Down
151 changes: 148 additions & 3 deletions src/ui/qgspluginmanagerbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>796</width>
<height>594</height>
<height>551</height>
</rect>
</property>
<property name="minimumSize">
Expand Down Expand Up @@ -188,6 +188,27 @@
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/propertyicons/spacer.svg</normaloff>:/images/themes/default/propertyicons/spacer.svg</iconset>
</property>
<property name="flags">
<set>NoItemFlags</set>
</property>
</item>
<item>
<property name="text">
<string>Install from ZIP</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/propertyicons/plugin-install_from_zip.svg</normaloff>:/images/themes/default/propertyicons/plugin-install_from_zip.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Settings</string>
Expand Down Expand Up @@ -511,6 +532,130 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pageInstallFromZip">
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelInstallFromZip">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If you are provided with a zip package containing a plugin to install, please use the button below to choose the file and install the plugin.&lt;/p&gt;&lt;p&gt;Please note for most users this function is not applicable, as the preferable way is to install plugins from a repository.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>20</number>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>79</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonInstallFromZip">
<property name="text">
<string>Install plugin from a ZIP file</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>78</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>160</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageSettings">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
Expand Down Expand Up @@ -581,8 +726,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>419</width>
<height>626</height>
<width>589</width>
<height>638</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
Expand Down

0 comments on commit 11ec24f

Please sign in to comment.