Skip to content

Commit

Permalink
Switch browser dock buttons to toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 30, 2015
1 parent 2ab8a0b commit 5a93f4c
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 140 deletions.
17 changes: 6 additions & 11 deletions src/app/qgsbrowserdockwidget.cpp
Expand Up @@ -447,11 +447,6 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QString name, QWidget * parent ) :
mBrowserView = new QgsDockBrowserTreeView( this );
mLayoutBrowser->addWidget( mBrowserView );

mBtnRefresh->setIcon( QgsApplication::getThemeIcon( "mActionDraw.svg" ) );
mBtnAddLayers->setIcon( QgsApplication::getThemeIcon( "mActionAdd.svg" ) );
mBtnCollapse->setIcon( QgsApplication::getThemeIcon( "mActionCollapseTree.svg" ) );
mBtnPropertiesWidget->setIcon( QgsApplication::getThemeIcon( "mActionPropertiesWidget.svg" ) );

mWidgetFilter->hide();
mLeFilter->setPlaceholderText( tr( "Type here to filter current item..." ) );
// icons from http://www.fatcow.com/free-icons License: CC Attribution 3.0
Expand Down Expand Up @@ -483,11 +478,11 @@ QgsBrowserDockWidget::QgsBrowserDockWidget( QString name, QWidget * parent ) :
action->setCheckable( true );
menu->addAction( action );

connect( mBtnRefresh, SIGNAL( clicked() ), this, SLOT( refresh() ) );
connect( mBtnAddLayers, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) );
connect( mBtnCollapse, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) );
connect( mBtnFilterShow, SIGNAL( toggled( bool ) ), this, SLOT( showFilterWidget( bool ) ) );
connect( mBtnPropertiesWidget, SIGNAL( toggled( bool ) ), this, SLOT( enablePropertiesWidget( bool ) ) );
connect( mActionRefresh, SIGNAL( triggered( bool ) ), this, SLOT( refresh() ) );
connect( mActionAddLayers, SIGNAL( triggered( bool ) ), this, SLOT( addSelectedLayers() ) );
connect( mActionCollapse, SIGNAL( triggered( bool ) ), mBrowserView, SLOT( collapseAll() ) );
connect( mActionShowFilter, SIGNAL( triggered( bool ) ), this, SLOT( showFilterWidget( bool ) ) );
connect( mActionPropertiesWidget, SIGNAL( triggered( bool ) ), this, SLOT( enablePropertiesWidget( bool ) ) );
connect( mLeFilter, SIGNAL( returnPressed() ), this, SLOT( setFilter() ) );
connect( mLeFilter, SIGNAL( cleared() ), this, SLOT( setFilter() ) );
connect( mLeFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( setFilter() ) );
Expand Down Expand Up @@ -530,7 +525,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent * e )
// objectName used by settingsSection() is not yet set in constructor
QSettings settings;
mPropertiesWidgetEnabled = settings.value( settingsSection() + "/propertiesWidgetEnabled", false ).toBool();
mBtnPropertiesWidget->setChecked( mPropertiesWidgetEnabled );
mActionPropertiesWidget->setChecked( mPropertiesWidgetEnabled );
mPropertiesWidget->setVisible( false ); // false until item is selected

mPropertiesWidgetHeight = settings.value( settingsSection() + "/propertiesWidgetHeight" ).toFloat();
Expand Down
210 changes: 81 additions & 129 deletions src/ui/qgsbrowserdockwidgetbase.ui
Expand Up @@ -7,14 +7,17 @@
<x>0</x>
<y>0</y>
<width>216</width>
<height>121</height>
<height>138</height>
</rect>
</property>
<property name="windowTitle">
<string>Browser</string>
</property>
<widget class="QWidget" name="mContents">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
Expand All @@ -28,136 +31,22 @@
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="mLayoutHeader">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>5</number>
<widget class="QToolBar" name="mBrowserToolbar">
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="rightMargin">
<number>5</number>
<property name="floatable">
<bool>false</bool>
</property>
<item>
<widget class="QToolButton" name="mBtnRefresh">
<property name="toolTip">
<string>Refresh</string>
</property>
<property name="text">
<string>Refresh</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionDraw.svg</normaloff>:/images/themes/default/mActionDraw.svg</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnAddLayers">
<property name="toolTip">
<string>Add Selected Layers</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAdd.svg</normaloff>:/images/themes/default/mActionAdd.svg</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnFilterShow">
<property name="toolTip">
<string>Filter Files</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFilter2.svg</normaloff>:/images/themes/default/mActionFilter2.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnCollapse">
<property name="toolTip">
<string>Collapse All</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionCollapseTree.png</normaloff>:/images/themes/default/mActionCollapseTree.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mBtnPropertiesWidget">
<property name="toolTip">
<string>Enable / disable properties widget</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionPropertiesWidget.png</normaloff>:/images/themes/default/mActionPropertiesWidget.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
<addaction name="mActionRefresh"/>
<addaction name="mActionAddLayers"/>
<addaction name="mActionShowFilter"/>
<addaction name="mActionCollapse"/>
<addaction name="mActionPropertiesWidget"/>
</widget>
</item>
<item>
<widget class="QWidget" name="mWidgetFilter" native="true">
Expand Down Expand Up @@ -301,6 +190,69 @@
</item>
</layout>
</widget>
<action name="mActionRefresh">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionDraw.svg</normaloff>:/images/themes/default/mActionDraw.svg</iconset>
</property>
<property name="text">
<string>Refresh</string>
</property>
</action>
<action name="mActionAddLayers">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAdd.svg</normaloff>:/images/themes/default/mActionAdd.svg</iconset>
</property>
<property name="text">
<string>Add Layers</string>
</property>
<property name="toolTip">
<string>Add Selected Layers</string>
</property>
</action>
<action name="mActionShowFilter">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFilter2.svg</normaloff>:/images/themes/default/mActionFilter2.svg</iconset>
</property>
<property name="text">
<string>Filter browser</string>
</property>
<property name="toolTip">
<string>Filter Browser</string>
</property>
</action>
<action name="mActionCollapse">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionCollapseTree.svg</normaloff>:/images/themes/default/mActionCollapseTree.svg</iconset>
</property>
<property name="text">
<string>Collapse All</string>
</property>
<property name="toolTip">
<string>Collapse All</string>
</property>
</action>
<action name="mActionPropertiesWidget">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionPropertiesWidget.svg</normaloff>:/images/themes/default/mActionPropertiesWidget.svg</iconset>
</property>
<property name="text">
<string>Show Properties</string>
</property>
<property name="toolTip">
<string>Enable/disable properties widget</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down

0 comments on commit 5a93f4c

Please sign in to comment.