Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a button to project properties to open folder containing project
(Opens in default OS file browser)
  • Loading branch information
nyalldawson committed May 4, 2017
1 parent eda1730 commit 716fe52
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 67 deletions.
7 changes: 7 additions & 0 deletions src/app/qgsprojectproperties.cpp 100644 → 100755
Expand Up @@ -63,6 +63,7 @@
#include <QFileDialog>
#include <QHeaderView> // Qt 4.4
#include <QMessageBox>
#include <QDesktopServices>

const char *QgsProjectProperties::GEO_NONE_DESC = QT_TRANSLATE_NOOP( "QgsOptions", "None / Planimetric" );

Expand Down Expand Up @@ -149,6 +150,12 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
title( QgsProject::instance()->title() );
mProjectFileLineEdit->setText( QDir::toNativeSeparators( QgsProject::instance()->fileName() ) );

connect( mButtonOpenProjectFolder, &QToolButton::clicked, this, [=] {
QFileInfo fi( QgsProject::instance()->fileName() );
QString folder = fi.path();
QDesktopServices::openUrl(QUrl::fromLocalFile( folder ));
});

// get the manner in which the number of decimal places in the mouse
// position display is set (manual or automatic)
bool automaticPrecision = QgsProject::instance()->readBoolEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/Automatic" ), true );
Expand Down
146 changes: 79 additions & 67 deletions src/ui/qgsprojectpropertiesbase.ui
Expand Up @@ -230,7 +230,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="mProjOpts_01">
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -259,8 +259,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>563</height>
<width>684</width>
<height>783</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
Expand All @@ -279,6 +279,52 @@
<string notr="true">projgeneral</string>
</property>
<layout class="QGridLayout" name="gridLayout_26">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Save paths</string>
</property>
<property name="buddy">
<cstring>cbxAbsolutePath</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="cbxAbsolutePath">
<item>
<property name="text">
<string>absolute</string>
</property>
</item>
<item>
<property name="text">
<string>relative</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Project file</string>
</property>
<property name="buddy">
<cstring>titleEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
Expand Down Expand Up @@ -379,22 +425,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Project file</string>
</property>
<property name="buddy">
<cstring>titleEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="3" colspan="2">
<spacer>
<property name="orientation">
Expand All @@ -408,36 +438,6 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="cbxAbsolutePath">
<item>
<property name="text">
<string>absolute</string>
</property>
</item>
<item>
<property name="text">
<string>relative</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Save paths</string>
</property>
<property name="buddy">
<cstring>cbxAbsolutePath</cstring>
</property>
</widget>
</item>
<item row="4" column="0" colspan="5">
<widget class="QCheckBox" name="mMapTileRenderingCheckBox">
<property name="toolTip">
Expand All @@ -459,11 +459,32 @@
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLineEdit" name="mProjectFileLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QLineEdit" name="mProjectFileLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mButtonOpenProjectFolder">
<property name="toolTip">
<string>Open folder containing the project</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFileOpen.svg</normaloff>:/images/themes/default/mActionFileOpen.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -749,8 +770,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>684</width>
<height>783</height>
<width>249</width>
<height>43</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
Expand Down Expand Up @@ -2636,20 +2657,18 @@
<tabstops>
<tabstop>mOptionsListWidget</tabstop>
<tabstop>scrollArea_2</tabstop>
<tabstop>titleBox</tabstop>
<tabstop>mProjectFileLineEdit</tabstop>
<tabstop>mButtonOpenProjectFolder</tabstop>
<tabstop>titleEdit</tabstop>
<tabstop>pbnSelectionColor</tabstop>
<tabstop>pbnCanvasColor</tabstop>
<tabstop>cbxAbsolutePath</tabstop>
<tabstop>mMapTileRenderingCheckBox</tabstop>
<tabstop>btnGrpMeasureEllipsoid</tabstop>
<tabstop>cmbEllipsoid</tabstop>
<tabstop>leSemiMajor</tabstop>
<tabstop>leSemiMinor</tabstop>
<tabstop>mDistanceUnitsCombo</tabstop>
<tabstop>mAreaUnitsCombo</tabstop>
<tabstop>mCoordinateDisplayGroup</tabstop>
<tabstop>mCoordinateDisplayComboBox</tabstop>
<tabstop>radAutomatic</tabstop>
<tabstop>radManual</tabstop>
Expand All @@ -2661,11 +2680,9 @@
<tabstop>pbnExportScales</tabstop>
<tabstop>lstScales</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>cbxProjectionEnabled</tabstop>
<tabstop>scrollArea_3</tabstop>
<tabstop>twIdentifyLayers</tabstop>
<tabstop>scrollArea_4</tabstop>
<tabstop>groupBox</tabstop>
<tabstop>cboStyleMarker</tabstop>
<tabstop>pbtnStyleMarker</tabstop>
<tabstop>cboStyleLine</tabstop>
Expand All @@ -2674,12 +2691,10 @@
<tabstop>pbtnStyleFill</tabstop>
<tabstop>cboStyleColorRamp</tabstop>
<tabstop>pbtnStyleColorRamp</tabstop>
<tabstop>groupBox_2</tabstop>
<tabstop>mTransparencySlider</tabstop>
<tabstop>mTransparencySpinBox</tabstop>
<tabstop>cbxStyleRandomColors</tabstop>
<tabstop>pbtnStyleManager</tabstop>
<tabstop>groupBox_7</tabstop>
<tabstop>mButtonAddColor</tabstop>
<tabstop>mButtonRemoveColor</tabstop>
<tabstop>mButtonCopyColors</tabstop>
Expand All @@ -2700,7 +2715,6 @@
<tabstop>mWMSFeesCb</tabstop>
<tabstop>mWMSAccessConstraintsCb</tabstop>
<tabstop>mWMSKeywordList</tabstop>
<tabstop>grpWMSCapabilities</tabstop>
<tabstop>grpWMSExt</tabstop>
<tabstop>mWMSExtMinX</tabstop>
<tabstop>mWMSExtMinY</tabstop>
Expand Down Expand Up @@ -2737,23 +2751,21 @@
<tabstop>mMaxWidthLineEdit</tabstop>
<tabstop>mMaxHeightLineEdit</tabstop>
<tabstop>mWMSImageQualitySpinBox</tabstop>
<tabstop>grpWFSCapabilities</tabstop>
<tabstop>twWFSLayers</tabstop>
<tabstop>pbnWFSLayersSelectAll</tabstop>
<tabstop>pbnWFSLayersDeselectAll</tabstop>
<tabstop>mWFSUrlLineEdit</tabstop>
<tabstop>grpWCSCapabilities</tabstop>
<tabstop>twWCSLayers</tabstop>
<tabstop>pbnWCSLayersSelectAll</tabstop>
<tabstop>pbnWCSLayersDeselectAll</tabstop>
<tabstop>mWCSUrlLineEdit</tabstop>
<tabstop>mOWSCheckerGroupBox</tabstop>
<tabstop>pbnLaunchOWSChecker</tabstop>
<tabstop>teOWSChecker</tabstop>
<tabstop>scrollArea_6</tabstop>
<tabstop>grpPythonMacros</tabstop>
<tabstop>mAutoTransaction</tabstop>
<tabstop>mEvaluateDefaultValues</tabstop>
<tabstop>mSearchLineEdit</tabstop>
</tabstops>
<resources>
<include location="../../images/images.qrc"/>
Expand Down

1 comment on commit 716fe52

@NathanW2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

Please sign in to comment.