Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[BUGFIX][NEEDS-DOCS] add command line option to hide browser (refs #1…
  • Loading branch information
jef-n committed Sep 23, 2018
1 parent 7623ee8 commit 4911d2e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 15 deletions.
13 changes: 13 additions & 0 deletions src/app/main.cpp
Expand Up @@ -135,6 +135,7 @@ void usage( const QString &appName )
<< QStringLiteral( "\t[--authdbdirectory path] use the given directory for authentication database\n" )
<< QStringLiteral( "\t[--code path]\trun the given python file on load\n" )
<< QStringLiteral( "\t[--defaultui]\tstart by resetting user ui settings to default\n" )
<< QStringLiteral( "\t[--hide-browser]\thide the browser widget\n" )
<< QStringLiteral( "\t[--dxf-export filename.dxf]\temit dxf output of loaded datasets to given file\n" )
<< QStringLiteral( "\t[--dxf-extent xmin,ymin,xmax,ymax]\tset extent to export to dxf\n" )
<< QStringLiteral( "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n" )
Expand Down Expand Up @@ -511,6 +512,7 @@ int main( int argc, char *argv[] )
bool myHideSplash = false;
bool settingsMigrationForce = false;
bool mySkipVersionCheck = false;
bool hideBrowser = false;
#if defined(ANDROID)
QgsDebugMsg( QString( "Android: Splash hidden" ) );
myHideSplash = true;
Expand Down Expand Up @@ -618,6 +620,10 @@ int main( int argc, char *argv[] )
{
mySnapshotWidth = QString( args[++i] ).toInt();
}
else if ( arg == QLatin1String( "--hide-browser" ) )
{
hideBrowser = true;
}
else if ( i + 1 < argc && ( arg == QLatin1String( "--height" ) || arg == QLatin1String( "-h" ) ) )
{
mySnapshotHeight = QString( args[++i] ).toInt();
Expand Down Expand Up @@ -1243,6 +1249,13 @@ int main( int argc, char *argv[] )
settings.remove( QStringLiteral( "/qgis/restoreDefaultWindowState" ) );
}

if ( hideBrowser )
{
if ( settings.value( QStringLiteral( "/Windows/Data Source Manager/tab" ) ).toInt() == 0 )
settings.setValue( QStringLiteral( "/Windows/Data Source Manager/tab" ), 1 );
settings.setValue( QStringLiteral( "/UI/hidebrowser" ), true );
}

// set max. thread count
// this should be done in QgsApplication::init() but it doesn't know the settings dir.
QgsApplication::setMaxThreads( settings.value( QStringLiteral( "qgis/max_threads" ), -1 ).toInt() );
Expand Down
7 changes: 7 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -4291,6 +4291,13 @@ void QgisApp::restoreWindowState()
QgsDebugMsg( "restore of UI state failed" );
}

if ( settings.value( QStringLiteral( "UI/hidebrowser" ), false ).toBool() )
{
mBrowserWidget->hide();
mBrowserWidget2->hide();
settings.remove( QStringLiteral( "UI/hidebrowser" ) );
}

// restore window geometry
if ( !restoreGeometry( settings.value( QStringLiteral( "UI/geometry" ) ).toByteArray() ) )
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsattributerelationedit.cpp
Expand Up @@ -15,9 +15,9 @@
#include "qgsattributerelationedit.h"
#include "ui_qgsattributerelationedit.h"

QgsAttributeRelationEdit::QgsAttributeRelationEdit( const QString &relationid, QWidget *parent ) :
QWidget( parent ),
mRelationId( relationid )
QgsAttributeRelationEdit::QgsAttributeRelationEdit( const QString &relationid, QWidget *parent )
: QWidget( parent )
, mRelationId( relationid )
{
setupUi( this );
coCardinality->setToolTip( tr( "For a many to many (N:M) relation, the direct link has to be selected. The in-between table will be hidden." ) );
Expand Down
14 changes: 8 additions & 6 deletions src/gui/qgsdatasourcemanagerdialog.cpp
Expand Up @@ -28,21 +28,22 @@
#include "qgsmessagelog.h"
#include "qgsgui.h"

QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsBrowserModel *browserModel, QWidget *parent, QgsMapCanvas *canvas, Qt::WindowFlags fl ) :
QgsOptionsDialogBase( QStringLiteral( "Data Source Manager" ), parent, fl ),
ui( new Ui::QgsDataSourceManagerDialog ),
mPreviousRow( -1 ),
mMapCanvas( canvas )
QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsBrowserModel *browserModel, QWidget *parent, QgsMapCanvas *canvas, Qt::WindowFlags fl )
: QgsOptionsDialogBase( QStringLiteral( "Data Source Manager" ), parent, fl )
, ui( new Ui::QgsDataSourceManagerDialog )
, mPreviousRow( -1 )
, mMapCanvas( canvas )
{

ui->setupUi( this );
ui->verticalLayout_2->setSpacing( 6 );
ui->verticalLayout_2->setMargin( 0 );
ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 );

// QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states,
// switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left),
// and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots
initOptionsBase( true );
initOptionsBase( false );

// Bind list index to the stacked dialogs
connect( ui->mOptionsListWidget, &QListWidget::currentRowChanged, this, &QgsDataSourceManagerDialog::setCurrentPage );
Expand Down Expand Up @@ -71,6 +72,7 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsBrowserModel *browser
addProviderDialog( dlg, provider->providerKey(), provider->text(), provider->icon( ), provider->toolTip( ) );
}

restoreOptionsBaseUi( QStringLiteral( "Data Source Manager" ) );
}

QgsDataSourceManagerDialog::~QgsDataSourceManagerDialog()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsoptionsdialogbase.cpp
Expand Up @@ -181,7 +181,7 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi( const QString &title )
int curIndx = mSettings->value( QStringLiteral( "/Windows/%1/tab" ).arg( mOptsKey ), 0 ).toInt();

// if the last used tab is out of range or not enabled display the first enabled one
if ( mOptStackedWidget->count() < ( curIndx + 1 )
if ( mOptStackedWidget->count() < curIndx + 1
|| !mOptStackedWidget->widget( curIndx )->isEnabled() )
{
curIndx = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/grass/qgsgrass.h
Expand Up @@ -561,7 +561,7 @@ class GRASS_LIB_EXPORT QgsGrass : public QObject
// path to QGIS GRASS modules like qgis.g.info etc.
static QString qgisGrassModulePath()
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
if ( QgsApplication::isRunningFromBuildDir() )
{
return QCoreApplication::applicationDirPath() + "/../../grass/modules/" + QgsApplication::cfgIntDir();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/templates/qgsoptionsdialog_template.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsOpstionDialogTemplate</class>
<widget class="QDialog" name="QgsOpstionDialogTemplate">
<class>QgsOptionDialogTemplate</class>
<widget class="QDialog" name="QgsOptionDialogTemplate">
<property name="geometry">
<rect>
<x>0</x>
Expand Down
4 changes: 2 additions & 2 deletions tests/src/gui/testrenderergui.cpp
Expand Up @@ -24,8 +24,8 @@
#include <QApplication>
#include <QToolBar>

TestRendererGUI::TestRendererGUI( QWidget *parent ) :
QMainWindow( parent )
TestRendererGUI::TestRendererGUI( QWidget *parent )
: QMainWindow( parent )
{
resize( 640, 480 );

Expand Down

0 comments on commit 4911d2e

Please sign in to comment.