Skip to content
Permalink
Browse files

revert 637359a and manually merge pull request #1232

Signed-off-by: Juergen E. Fischer <jef@norbit.de>
  • Loading branch information
rduivenvoorde authored and jef-n committed Mar 23, 2014
1 parent f020bbf commit 5b4d076898e7489f94ea12ab773ec5872d4dc88c
@@ -339,7 +339,6 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )

QMenu *settingsMenu = menuBar()->addMenu( tr( "Settings" ) );
settingsMenu->addAction( mActionOptions );
settingsMenu->addAction( mActionResetUIdefaults );

#ifdef Q_WS_MAC
// this doesn't work on Mac anymore: menuBar()->addMenu( mQgis->windowMenu() );
@@ -2499,17 +2498,6 @@ void QgsComposer::restoreWindowState()
}
}

void QgsComposer::on_mActionResetUIdefaults_triggered()
{
if ( QMessageBox::warning( this, tr( "Restore UI defaults" ), tr( "Are you sure to reset the UI to default?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
return;

saveWindowState();
QSettings settings;
settings.remove( "/ComposerUI/state" );
restoreWindowState();
}

void QgsComposer::writeXML( QDomDocument& doc )
{

@@ -326,9 +326,6 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//!Show options dialog
void on_mActionOptions_triggered();

//! Restore the default window and toolbar state
void on_mActionResetUIdefaults_triggered();

//!Toggle atlas preview
void on_mActionAtlasPreview_triggered( bool checked );

@@ -115,6 +115,7 @@ void usage( std::string const & appName )
<< "\t[--optionspath path]\tuse the given QSettings path\n"
<< "\t[--configpath path]\tuse the given path for all user configuration\n"
<< "\t[--code path]\trun the given python file on load\n"
<< "\t[--defaultui]\tstart by resetting user ui settings to default\n"
<< "\t[--help]\t\tthis text\n\n"
<< " FILE:\n"
<< " Files specified on the command line can include rasters,\n"
@@ -453,6 +454,7 @@ int main( int argc, char *argv[] )
myHideSplash = true;
#endif

bool myRestoreDefaultWindowState = false;
bool myRestorePlugins = true;
bool myCustomization = true;

@@ -554,6 +556,10 @@ int main( int argc, char *argv[] )
{
customizationfile = QDir::convertSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
}
else if ( arg == "--defaultui" || arg == "-d" )
{
myRestoreDefaultWindowState = true;
}
else
{
myFileList.append( QDir::convertSeparators( QFileInfo( args[i] ).absoluteFilePath() ) );
@@ -858,6 +864,15 @@ int main( int argc, char *argv[] )
mypSplash->show();
}

// optionally restore default window state
// use restoreDefaultWindowState setting only if NOT using command line (then it is set already)
if ( myRestoreDefaultWindowState || mySettings.value( "/qgis/restoreDefaultWindowState", false ).toBool() )
{
QgsDebugMsg( "Resetting /UI/state settings!" );
mySettings.remove( "/UI/state" );
mySettings.remove( "/qgis/restoreDefaultWindowState" );
}

QgisApp *qgis = new QgisApp( mypSplash, myRestorePlugins ); // "QgisApp" used to find canonical instance
qgis->setObjectName( "QgisApp" );

@@ -1101,7 +1101,6 @@ void QgisApp::createActions()
connect( mActionConfigureShortcuts, SIGNAL( triggered() ), this, SLOT( configureShortcuts() ) );
connect( mActionStyleManagerV2, SIGNAL( triggered() ), this, SLOT( showStyleManagerV2() ) );
connect( mActionCustomization, SIGNAL( triggered() ), this, SLOT( customize() ) );
connect( mActionResetUIdefaults, SIGNAL( triggered() ), this, SLOT( restoreDefaultWindowState() ) );

#ifdef Q_WS_MAC
// Window Menu Items
@@ -2371,20 +2370,6 @@ void QgisApp::restoreWindowState()
}

}

void QgisApp::restoreDefaultWindowState()
{
if ( QMessageBox::warning( this, tr( "Restore UI defaults" ), tr( "Are you sure to reset the UI to default?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
return;

saveWindowState();

QSettings settings;
settings.remove( "/UI/state" );

restoreWindowState();
}

///////////// END OF GUI SETUP ROUTINES ///////////////
void QgisApp::sponsors()
{
@@ -838,8 +838,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void saveWindowState();
//! Restore the window and toolbar state
void restoreWindowState();
//! Restore the default window and toolbar state
void restoreDefaultWindowState();
//! Save project. Returns true if the user selected a file to save to, false if not.
bool fileSave();
//! Save project as
@@ -1531,6 +1531,15 @@ QStringList QgsOptions::i18nList()
return myList;
}

void QgsOptions::on_mRestoreDefaultWindowStateBtn_clicked()
{
// richard
QSettings mySettings;
if ( QMessageBox::warning( this, tr( "Restore UI defaults" ), tr( "Are you sure to reset the UI to default (needs restart)?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
return;
mySettings.setValue( "/qgis/restoreDefaultWindowState", true );
}

void QgsOptions::on_mCustomVariablesChkBx_toggled( bool chkd )
{
mAddCustomVarBtn->setEnabled( chkd );
@@ -141,6 +141,9 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
/**Remove an URL to exclude from Proxy*/
void on_mRemoveUrlPushButton_clicked();

/**Slot to flag restoring/delete window state settings upon restart*/
void on_mRestoreDefaultWindowStateBtn_clicked();

/** Slot to enable custom environment variables table and buttons
* @note added in QGIS 1.9
*/
@@ -194,7 +194,6 @@
<addaction name="mActionCustomization"/>
<addaction name="mActionOptions"/>
<addaction name="mActionSnappingOptions"/>
<addaction name="mActionResetUIdefaults"/>
</widget>
<widget class="QMenu" name="mRasterMenu">
<property name="title">
@@ -2159,11 +2158,6 @@ Acts on currently active editable layer</string>
<string>Fill Ring</string>
</property>
</action>
<action name="mActionResetUIdefaults">
<property name="text">
<string>Reset UI defaults</string>
</property>
</action>
<action name="mActionAddLayerDefinition">
<property name="text">
<string>Add from Layer Definition File...</string>
@@ -836,18 +836,6 @@
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="mActionResetUIdefaults">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionOptions.svg</normaloff>:/images/themes/default/mActionOptions.svg</iconset>
</property>
<property name="text">
<string>Reset UI defaults...</string>
</property>
<property name="menuRole">
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="mActionShowRulers">
<property name="text">
<string>Show Rulers</string>
@@ -1042,6 +1042,42 @@
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="mQSettingsGrpBx">
<property name="title">
<string>QSettings</string>
</property>
<layout class="QGridLayout" name="gridLayout_13">
<item row="0" column="1">
<spacer name="horizontalSpacer_42">
<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 row="0" column="2">
<widget class="QPushButton" name="mRestoreDefaultWindowStateBtn">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mRestoreDefaultWindowStateLbl">
<property name="text">
<string>Reset the User Interface settings, to reset QGIS to it's default view</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="mEnvironmentGrpBx">
<property name="minimumSize">

0 comments on commit 5b4d076

Please sign in to comment.
You can’t perform that action at this time.