Skip to content

Commit 716fe52

Browse files
committed
Add a button to project properties to open folder containing project
(Opens in default OS file browser)
1 parent eda1730 commit 716fe52

File tree

2 files changed

+86
-67
lines changed

2 files changed

+86
-67
lines changed

src/app/qgsprojectproperties.cpp

100644100755
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <QFileDialog>
6464
#include <QHeaderView> // Qt 4.4
6565
#include <QMessageBox>
66+
#include <QDesktopServices>
6667

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

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

153+
connect( mButtonOpenProjectFolder, &QToolButton::clicked, this, [=] {
154+
QFileInfo fi( QgsProject::instance()->fileName() );
155+
QString folder = fi.path();
156+
QDesktopServices::openUrl(QUrl::fromLocalFile( folder ));
157+
});
158+
152159
// get the manner in which the number of decimal places in the mouse
153160
// position display is set (manual or automatic)
154161
bool automaticPrecision = QgsProject::instance()->readBoolEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/Automatic" ), true );

src/ui/qgsprojectpropertiesbase.ui

Lines changed: 79 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
</sizepolicy>
231231
</property>
232232
<property name="currentIndex">
233-
<number>1</number>
233+
<number>0</number>
234234
</property>
235235
<widget class="QWidget" name="mProjOpts_01">
236236
<layout class="QVBoxLayout" name="verticalLayout_6">
@@ -259,8 +259,8 @@
259259
<rect>
260260
<x>0</x>
261261
<y>0</y>
262-
<width>455</width>
263-
<height>563</height>
262+
<width>684</width>
263+
<height>783</height>
264264
</rect>
265265
</property>
266266
<layout class="QVBoxLayout" name="verticalLayout_8">
@@ -279,6 +279,52 @@
279279
<string notr="true">projgeneral</string>
280280
</property>
281281
<layout class="QGridLayout" name="gridLayout_26">
282+
<item row="3" column="0">
283+
<widget class="QLabel" name="label_3">
284+
<property name="sizePolicy">
285+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
286+
<horstretch>0</horstretch>
287+
<verstretch>0</verstretch>
288+
</sizepolicy>
289+
</property>
290+
<property name="text">
291+
<string>Save paths</string>
292+
</property>
293+
<property name="buddy">
294+
<cstring>cbxAbsolutePath</cstring>
295+
</property>
296+
</widget>
297+
</item>
298+
<item row="3" column="1">
299+
<widget class="QComboBox" name="cbxAbsolutePath">
300+
<item>
301+
<property name="text">
302+
<string>absolute</string>
303+
</property>
304+
</item>
305+
<item>
306+
<property name="text">
307+
<string>relative</string>
308+
</property>
309+
</item>
310+
</widget>
311+
</item>
312+
<item row="0" column="0">
313+
<widget class="QLabel" name="label_4">
314+
<property name="sizePolicy">
315+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
316+
<horstretch>0</horstretch>
317+
<verstretch>0</verstretch>
318+
</sizepolicy>
319+
</property>
320+
<property name="text">
321+
<string>Project file</string>
322+
</property>
323+
<property name="buddy">
324+
<cstring>titleEdit</cstring>
325+
</property>
326+
</widget>
327+
</item>
282328
<item row="2" column="0" colspan="5">
283329
<layout class="QHBoxLayout" name="horizontalLayout_5">
284330
<item>
@@ -379,22 +425,6 @@
379425
</property>
380426
</widget>
381427
</item>
382-
<item row="0" column="0">
383-
<widget class="QLabel" name="label_4">
384-
<property name="sizePolicy">
385-
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
386-
<horstretch>0</horstretch>
387-
<verstretch>0</verstretch>
388-
</sizepolicy>
389-
</property>
390-
<property name="text">
391-
<string>Project file</string>
392-
</property>
393-
<property name="buddy">
394-
<cstring>titleEdit</cstring>
395-
</property>
396-
</widget>
397-
</item>
398428
<item row="3" column="3" colspan="2">
399429
<spacer>
400430
<property name="orientation">
@@ -408,36 +438,6 @@
408438
</property>
409439
</spacer>
410440
</item>
411-
<item row="3" column="1">
412-
<widget class="QComboBox" name="cbxAbsolutePath">
413-
<item>
414-
<property name="text">
415-
<string>absolute</string>
416-
</property>
417-
</item>
418-
<item>
419-
<property name="text">
420-
<string>relative</string>
421-
</property>
422-
</item>
423-
</widget>
424-
</item>
425-
<item row="3" column="0">
426-
<widget class="QLabel" name="label_3">
427-
<property name="sizePolicy">
428-
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
429-
<horstretch>0</horstretch>
430-
<verstretch>0</verstretch>
431-
</sizepolicy>
432-
</property>
433-
<property name="text">
434-
<string>Save paths</string>
435-
</property>
436-
<property name="buddy">
437-
<cstring>cbxAbsolutePath</cstring>
438-
</property>
439-
</widget>
440-
</item>
441441
<item row="4" column="0" colspan="5">
442442
<widget class="QCheckBox" name="mMapTileRenderingCheckBox">
443443
<property name="toolTip">
@@ -459,11 +459,32 @@
459459
</widget>
460460
</item>
461461
<item row="0" column="1" colspan="4">
462-
<widget class="QLineEdit" name="mProjectFileLineEdit">
463-
<property name="readOnly">
464-
<bool>true</bool>
465-
</property>
466-
</widget>
462+
<layout class="QHBoxLayout" name="horizontalLayout_13">
463+
<item>
464+
<widget class="QLineEdit" name="mProjectFileLineEdit">
465+
<property name="readOnly">
466+
<bool>true</bool>
467+
</property>
468+
</widget>
469+
</item>
470+
<item>
471+
<widget class="QToolButton" name="mButtonOpenProjectFolder">
472+
<property name="toolTip">
473+
<string>Open folder containing the project</string>
474+
</property>
475+
<property name="text">
476+
<string>...</string>
477+
</property>
478+
<property name="icon">
479+
<iconset resource="../../images/images.qrc">
480+
<normaloff>:/images/themes/default/mActionFileOpen.svg</normaloff>:/images/themes/default/mActionFileOpen.svg</iconset>
481+
</property>
482+
<property name="autoRaise">
483+
<bool>true</bool>
484+
</property>
485+
</widget>
486+
</item>
487+
</layout>
467488
</item>
468489
</layout>
469490
</widget>
@@ -749,8 +770,8 @@
749770
<rect>
750771
<x>0</x>
751772
<y>0</y>
752-
<width>684</width>
753-
<height>783</height>
773+
<width>249</width>
774+
<height>43</height>
754775
</rect>
755776
</property>
756777
<layout class="QVBoxLayout" name="verticalLayout_7">
@@ -2636,20 +2657,18 @@
26362657
<tabstops>
26372658
<tabstop>mOptionsListWidget</tabstop>
26382659
<tabstop>scrollArea_2</tabstop>
2639-
<tabstop>titleBox</tabstop>
26402660
<tabstop>mProjectFileLineEdit</tabstop>
2661+
<tabstop>mButtonOpenProjectFolder</tabstop>
26412662
<tabstop>titleEdit</tabstop>
26422663
<tabstop>pbnSelectionColor</tabstop>
26432664
<tabstop>pbnCanvasColor</tabstop>
26442665
<tabstop>cbxAbsolutePath</tabstop>
26452666
<tabstop>mMapTileRenderingCheckBox</tabstop>
2646-
<tabstop>btnGrpMeasureEllipsoid</tabstop>
26472667
<tabstop>cmbEllipsoid</tabstop>
26482668
<tabstop>leSemiMajor</tabstop>
26492669
<tabstop>leSemiMinor</tabstop>
26502670
<tabstop>mDistanceUnitsCombo</tabstop>
26512671
<tabstop>mAreaUnitsCombo</tabstop>
2652-
<tabstop>mCoordinateDisplayGroup</tabstop>
26532672
<tabstop>mCoordinateDisplayComboBox</tabstop>
26542673
<tabstop>radAutomatic</tabstop>
26552674
<tabstop>radManual</tabstop>
@@ -2661,11 +2680,9 @@
26612680
<tabstop>pbnExportScales</tabstop>
26622681
<tabstop>lstScales</tabstop>
26632682
<tabstop>scrollArea</tabstop>
2664-
<tabstop>cbxProjectionEnabled</tabstop>
26652683
<tabstop>scrollArea_3</tabstop>
26662684
<tabstop>twIdentifyLayers</tabstop>
26672685
<tabstop>scrollArea_4</tabstop>
2668-
<tabstop>groupBox</tabstop>
26692686
<tabstop>cboStyleMarker</tabstop>
26702687
<tabstop>pbtnStyleMarker</tabstop>
26712688
<tabstop>cboStyleLine</tabstop>
@@ -2674,12 +2691,10 @@
26742691
<tabstop>pbtnStyleFill</tabstop>
26752692
<tabstop>cboStyleColorRamp</tabstop>
26762693
<tabstop>pbtnStyleColorRamp</tabstop>
2677-
<tabstop>groupBox_2</tabstop>
26782694
<tabstop>mTransparencySlider</tabstop>
26792695
<tabstop>mTransparencySpinBox</tabstop>
26802696
<tabstop>cbxStyleRandomColors</tabstop>
26812697
<tabstop>pbtnStyleManager</tabstop>
2682-
<tabstop>groupBox_7</tabstop>
26832698
<tabstop>mButtonAddColor</tabstop>
26842699
<tabstop>mButtonRemoveColor</tabstop>
26852700
<tabstop>mButtonCopyColors</tabstop>
@@ -2700,7 +2715,6 @@
27002715
<tabstop>mWMSFeesCb</tabstop>
27012716
<tabstop>mWMSAccessConstraintsCb</tabstop>
27022717
<tabstop>mWMSKeywordList</tabstop>
2703-
<tabstop>grpWMSCapabilities</tabstop>
27042718
<tabstop>grpWMSExt</tabstop>
27052719
<tabstop>mWMSExtMinX</tabstop>
27062720
<tabstop>mWMSExtMinY</tabstop>
@@ -2737,23 +2751,21 @@
27372751
<tabstop>mMaxWidthLineEdit</tabstop>
27382752
<tabstop>mMaxHeightLineEdit</tabstop>
27392753
<tabstop>mWMSImageQualitySpinBox</tabstop>
2740-
<tabstop>grpWFSCapabilities</tabstop>
27412754
<tabstop>twWFSLayers</tabstop>
27422755
<tabstop>pbnWFSLayersSelectAll</tabstop>
27432756
<tabstop>pbnWFSLayersDeselectAll</tabstop>
27442757
<tabstop>mWFSUrlLineEdit</tabstop>
2745-
<tabstop>grpWCSCapabilities</tabstop>
27462758
<tabstop>twWCSLayers</tabstop>
27472759
<tabstop>pbnWCSLayersSelectAll</tabstop>
27482760
<tabstop>pbnWCSLayersDeselectAll</tabstop>
27492761
<tabstop>mWCSUrlLineEdit</tabstop>
2750-
<tabstop>mOWSCheckerGroupBox</tabstop>
27512762
<tabstop>pbnLaunchOWSChecker</tabstop>
27522763
<tabstop>teOWSChecker</tabstop>
27532764
<tabstop>scrollArea_6</tabstop>
27542765
<tabstop>grpPythonMacros</tabstop>
27552766
<tabstop>mAutoTransaction</tabstop>
27562767
<tabstop>mEvaluateDefaultValues</tabstop>
2768+
<tabstop>mSearchLineEdit</tabstop>
27572769
</tabstops>
27582770
<resources>
27592771
<include location="../../images/images.qrc"/>

0 commit comments

Comments
 (0)