Skip to content
Permalink
Browse files

save size and position of the core plugins dialogs (addresses #206)

  • Loading branch information
alexbruy committed Jan 17, 2012
1 parent fdd9894 commit 2e7867a14e8fc736f4ba5de886573267e14abd18
Showing with 316 additions and 139 deletions.
  1. +1 −3 src/plugins/delimited_text/qgsdelimitedtextplugin.cpp
  2. +25 −17 src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
  3. +1 −0 src/plugins/delimited_text/qgsdelimitedtextplugingui.h
  4. +3 −3 src/plugins/dxf2shp_converter/CMakeLists.txt
  5. +32 −6 src/plugins/dxf2shp_converter/dxf2shpconvertergui.cpp
  6. +3 −0 src/plugins/dxf2shp_converter/dxf2shpconvertergui.h
  7. +39 −63 src/plugins/dxf2shp_converter/dxf2shpconvertergui.ui
  8. +17 −0 src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp
  9. +3 −0 src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h
  10. +15 −0 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  11. +3 −0 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h
  12. +19 −2 src/plugins/interpolation/qgsinterpolationdialog.cpp
  13. +3 −3 src/plugins/interpolation/qgsinterpolationdialog.h
  14. +25 −9 src/plugins/offline_editing/offline_editing_plugin_gui.cpp
  15. +2 −0 src/plugins/offline_editing/offline_editing_plugin_gui.h
  16. +28 −0 src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp
  17. +4 −0 src/plugins/oracle_raster/qgsselectgeoraster_ui.h
  18. +13 −4 src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp
  19. +3 −3 src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialogbase.ui
  20. +12 −24 src/plugins/spatialquery/qgsspatialquerydialog.cpp
  21. +1 −0 src/plugins/spatialquery/qgsspatialquerydialog.h
  22. +25 −0 src/plugins/spit/qgsspit.cpp
  23. +4 −1 src/plugins/spit/qgsspit.h
  24. +28 −1 src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
  25. +7 −0 src/plugins/zonal_statistics/qgszonalstatisticsdialog.h
@@ -35,8 +35,6 @@
//the gui subclass
#include "qgsdelimitedtextplugingui.h"

//

static const QString pluginVersion = QObject::tr( "Version 0.2" );
static const QString description_ = QObject::tr( "Loads and displays delimited text files containing x,y coordinates" );
static const QString category_ = QObject::tr( "Layers" );
@@ -115,7 +113,6 @@ void QgsDelimitedTextPlugin::initGui()
qGisInterface->insertAddLayerAction( myQActionPointer );
// this is called when the icon theme is changed
connect( qGisInterface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );

}

// Slot called when the buffer menu item is activated
@@ -131,6 +128,7 @@ void QgsDelimitedTextPlugin::run()
this, SLOT( drawVectorLayer( QString, QString, QString ) ) );
myQgsDelimitedTextPluginGui->exec();
}

//!draw a vector layer in the qui - intended to respond to signal
//sent by diolog when it as finished creating a layer
////needs to be given vectorLayerPath, baseName,
@@ -12,35 +12,39 @@
* (at your option) any later version. *
***************************************************************************/
#include "qgsdelimitedtextplugingui.h"
#include "qgscontexthelp.h"

#include "qgisinterface.h"
#include "qgscontexthelp.h"
#include "qgslogger.h"

#include <QFileDialog>
#include <QFile>
#include <QComboBox>
#include <QSettings>
#include <QFileDialog>
#include <QFileInfo>
#include <QRegExp>
#include <QMessageBox>
#include <QRegExp>
#include <QSettings>
#include <QTextStream>
#include <QUrl>
#include "qgslogger.h"

QgsDelimitedTextPluginGui::QgsDelimitedTextPluginGui( QgisInterface * _qI, QWidget * parent, Qt::WFlags fl )
: QDialog( parent, fl ), qI( _qI )
{
setupUi( this );

QSettings settings;
restoreGeometry( settings.value( "/Plugin-DelimitedText/geometry" ).toByteArray() );

pbnOK = buttonBox->button( QDialogButtonBox::Ok );

updateFieldsAndEnable();

// at startup, fetch the last used delimiter and directory from
// settings
QSettings settings;
QString key = "/Plugin-DelimitedText";
txtDelimiter->setText( settings.value( key + "/delimiter" ).toString() );

rowCounter->setValue( settings.value( key + "/startFrom", 0 ).toInt() );

// and how to use the delimiter
QString delimiterType = settings.value( key + "/delimiterType", "plain" ).toString();
if ( delimiterType == "selection" )
@@ -60,7 +64,7 @@ QgsDelimitedTextPluginGui::QgsDelimitedTextPluginGui( QgisInterface * _qI, QWidg
cbxDelimSpace->setChecked( delimiterChars.contains( " " ) );
cbxDelimTab->setChecked( delimiterChars.contains( "\\t" ) );
cbxDelimColon->setChecked( delimiterChars.contains( ":" ) );
cbxDelimSemicolon->setChecked( delimiterChars.contains( ":" ) );
cbxDelimSemicolon->setChecked( delimiterChars.contains( ";" ) );
cbxDelimComma->setChecked( delimiterChars.contains( "," ) );

cmbXField->setDisabled( true );
@@ -88,7 +92,7 @@ QgsDelimitedTextPluginGui::QgsDelimitedTextPluginGui( QgisInterface * _qI, QWidg
QgsDelimitedTextPluginGui::~QgsDelimitedTextPluginGui()
{
}
/** Autoconnected slots **/

void QgsDelimitedTextPluginGui::on_btnBrowseForFile_clicked()
{
getOpenFileName();
@@ -140,11 +144,15 @@ void QgsDelimitedTextPluginGui::on_buttonBox_accepted()
emit drawVectorLayer( QString::fromAscii( url.toEncoded() ), txtLayerName->text(), "delimitedtext" );

// store the settings
saveState();

QSettings settings;
QString key = "/Plugin-DelimitedText";
settings.setValue( key + "/geometry", saveGeometry() );
settings.setValue( key + "/delimiter", txtDelimiter->text() );
QFileInfo fi( txtFilePath->text() );
settings.setValue( key + "/text_path", fi.path() );
settings.setValue( key + "/startFrom", rowCounter->value() );

if ( delimiterSelection->isChecked() )
settings.setValue( key + "/delimiterType", "selection" );
@@ -164,6 +172,7 @@ void QgsDelimitedTextPluginGui::on_buttonBox_accepted()

void QgsDelimitedTextPluginGui::on_buttonBox_rejected()
{
saveState();
reject();
}

@@ -292,7 +301,6 @@ void QgsDelimitedTextPluginGui::updateFieldLists()

QgsDebugMsg( QString( "Split line into %1 parts" ).arg( fieldList.size() ) );

//
// We don't know anything about a text based field other
// than its name. All fields are assumed to be text
bool haveFields = false;
@@ -443,8 +451,7 @@ void QgsDelimitedTextPluginGui::getOpenFileName()
this,
tr( "Choose a delimited text file to open" ),
settings.value( "/Plugin-DelimitedText/text_path", "./" ).toString(),
"Text files (*.txt *.csv);; Well Known Text files (*.wkt);; All files (* *.*)" );

"Text files (*.txt *.csv);;Well Known Text files (*.wkt);;All files (* *.*)" );
// set path
txtFilePath->setText( s );
}
@@ -457,14 +464,12 @@ void QgsDelimitedTextPluginGui::updateFieldsAndEnable()

void QgsDelimitedTextPluginGui::enableAccept()
{

// If the geometry type field is enabled then there must be
// a valid file, and it must be
bool enabled = haveValidFileAndDelimiters();

if ( enabled )
{

if ( geomTypeXY->isChecked() )
{
enabled = !( cmbXField->currentText().isEmpty() || cmbYField->currentText().isEmpty() || cmbXField->currentText() == cmbYField->currentText() );
@@ -493,12 +498,15 @@ QString QgsDelimitedTextPluginGui::readLine( QTextStream &stream )
// skip leading CR / LF
continue;
}

break;
}

buffer.append( c );
}

return buffer;
}

void QgsDelimitedTextPluginGui::saveState()
{
QSettings settings;
settings.setValue( "/Plugin-DelimitedText/geometry", saveGeometry() );
}
@@ -38,6 +38,7 @@ class QgsDelimitedTextPluginGui : public QDialog, private Ui::QgsDelimitedTextPl
void updateFieldLists();
void getOpenFileName();
QString selectedChars();
void saveState();

QgisInterface * qI;
QAbstractButton *pbnOK;
@@ -33,9 +33,9 @@ ADD_LIBRARY (dxf2shpconverterplugin MODULE ${dxf2shpconverter_SRCS} ${dxf2shpcon

INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
../../core
../../core/raster
../../core/renderer
../../core
../../core/raster
../../core/renderer
../../core/symbology
../../gui
..
@@ -32,6 +32,7 @@ dxf2shpConverterGui::dxf2shpConverterGui( QWidget *parent, Qt::WFlags fl ):
QDialog( parent, fl )
{
setupUi( this );
restoreState();
}

dxf2shpConverterGui::~dxf2shpConverterGui()
@@ -40,6 +41,8 @@ dxf2shpConverterGui::~dxf2shpConverterGui()

void dxf2shpConverterGui::on_buttonBox_accepted()
{
saveState();

QString inf = name->text();
QString outd = dirout->text();

@@ -117,6 +120,7 @@ void dxf2shpConverterGui::on_buttonBox_accepted()

void dxf2shpConverterGui::on_buttonBox_rejected()
{
saveState();
reject();
}

@@ -137,7 +141,6 @@ void dxf2shpConverterGui::on_buttonBox_helpRequested()
QMessageBox::information( this, "Help", s );
}


void dxf2shpConverterGui::on_btnBrowseForFile_clicked()
{
getInputFileName();
@@ -148,25 +151,48 @@ void dxf2shpConverterGui::on_btnBrowseOutputDir_clicked()
getOutputDir();
}


void dxf2shpConverterGui::getInputFileName()
{
QSettings settings;

QString s = QFileDialog::getOpenFileName( this,
tr( "Choose a DXF file to open" ),
settings.value( "/Plugin-DXF/text_path", "./" ).toString(),
tr( "DXF files (*.dxf)" ) );

name->setText( s );
if ( !s.isEmpty() )
{
name->setText( s );
settings.setValue( "/Plugin-DXF/text_path", QFileInfo( s ).absolutePath() );
}
}

void dxf2shpConverterGui::getOutputDir()
{
QSettings settings;
QString s = QFileDialog::getSaveFileName( this,
tr( "Choose a file name to save to" ),
"output.shp",
settings.value( "/UI/lastShapefileDir", "./" ).toString(),
tr( "Shapefile (*.shp)" ) );

dirout->setText( s );
if ( !s.isEmpty() )
{
if ( !s.toLower().endsWith( ".shp" ) )
{
s += ".shp";
}
dirout->setText( s );
settings.setValue( "/UI/lastShapefileDir", QFileInfo( s ).absolutePath() );
}
}

void dxf2shpConverterGui::saveState()
{
QSettings settings;
settings.setValue( "/Plugin-DXF/geometry", saveGeometry() );
}

void dxf2shpConverterGui::restoreState()
{
QSettings settings;
restoreGeometry( settings.value( "/Plugin-DXF/geometry" ).toByteArray() );
}
@@ -34,6 +34,9 @@ class dxf2shpConverterGui: public QDialog, private Ui::dxf2shpConverterGui
void getOutputFileName();
void getOutputDir();

void saveState();
void restoreState();

private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();

0 comments on commit 2e7867a

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