QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, const Qt::WindowFlags& fl ) : QDialog( parent, fl ) { setupUi( this ); QSettings settings; restoreGeometry( settings.value( "/Windows/NewVectorLayer/geometry" ).toByteArray() ); mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) ); mRemoveAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) ); mTypeBox->addItem( tr( "Text data" ), "String" ); mTypeBox->addItem( tr( "Whole number" ), "Integer" ); mTypeBox->addItem( tr( "Decimal number" ), "Real" ); mTypeBox->addItem( tr( "Date" ), "Date" ); mWidth->setValidator( new QIntValidator( 1, 255, this ) ); mPrecision->setValidator( new QIntValidator( 0, 15, this ) ); mPointRadioButton->setChecked( true ); mFileFormatComboBox->addItem( tr( "ESRI Shapefile" ), "ESRI Shapefile" ); #if 0 // Disabled until provider properly supports editing the created file formats mFileFormatComboBox->addItem( tr( "Comma Separated Value" ), "Comma Separated Value" ); mFileFormatComboBox->addItem( tr( "GML" ), "GML" ); mFileFormatComboBox->addItem( tr( "Mapinfo File" ), "Mapinfo File" ); #endif if ( mFileFormatComboBox->count() == 1 ) { mFileFormatComboBox->setVisible( false ); mFileFormatLabel->setVisible( false ); } mFileFormatComboBox->setCurrentIndex( 0 ); mFileEncoding->addItems( QgsVectorDataProvider::availableEncodings() ); // Use default encoding if none supplied QString enc = QSettings().value( "/UI/encoding", "System" ).toString(); // The specified decoding is added if not existing alread, and then set current. // This should select it. int encindex = mFileEncoding->findText( enc ); if ( encindex < 0 ) { mFileEncoding->insertItem( 0, enc ); encindex = 0; } mFileEncoding->setCurrentIndex( encindex ); mOkButton = buttonBox->button( QDialogButtonBox::Ok ); mAttributeView->addTopLevelItem( new QTreeWidgetItem( QStringList() << "id" << "Integer" << "10" << "" ) ); QgsCoordinateReferenceSystem defaultCrs; defaultCrs.createFromOgcWmsCrs( settings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() ); defaultCrs.validate(); mCrsSelector->setCrs( defaultCrs ); connect( mNameEdit, SIGNAL( textChanged( QString ) ), this, SLOT( nameChanged( QString ) ) ); connect( mAttributeView, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) ); mAddAttributeButton->setEnabled( false ); mRemoveAttributeButton->setEnabled( false ); }
bool EditorConfig::reliabilityLossRuleWarn() { return QSettings().value("reliabilityLossRuleWarn", ReliabilityLossRuleWarnDefault).toBool(); }
bool EditorConfig::unknownProgramWarn() { return QSettings().value("unknownProgramWarn", UnknownProgramWarnDefault).toBool(); }
bool EditorConfig::bypassedRuleWarn() { return QSettings().value("bypassedRuleWarn", BypassedRuleWarnDefault).toBool(); }
bool EditorConfig::confidentialityLossRuleWarn() { return QSettings().value("confidentialityLossRuleWarn", ConfidentialityLossRuleWarnDefault).toBool(); }
bool EditorConfig::showConfRelInDomLabel() { return QSettings().value("showConfRelInDomLabel", ShowConfRelInDomLabelDefault).toBool(); }
bool EditorConfig::unreachableRuleWarn() { return QSettings().value("unreachableRuleWarn", UnreachableRuleWarnDefault).toBool(); }
int EditorConfig::arrowProgramMode() { return QSettings().value("arrowProgramMode", ArrowProgramModeDefault).toInt(); }
void EditorConfig::setHideMode(int val) { if(val>=0 && val<InvalidHideMode) QSettings().setValue("hideMode", val); }
static QVariant applicationSettingValue(const QString &appRoot, const QString &key) { QString appIni = appRoot + QDir::separator() + QLatin1String("config") + QDir::separator() + "application.ini"; return QSettings(appIni, QSettings::IniFormat).value(key); }
void EditorConfig::setArrowProgramMode(int val) { if(val>=0 && val<InvalidArrowMode) QSettings().setValue("arrowProgramMode", val); }
void Config::restoreDefaultsConfig() { QSettings(ConfigFilePath(), QSettings::IniFormat).clear(); }
QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource<QgsOgrFeatureSource>( source, ownSource, request ) , ogrLayer( 0 ) , mSubsetStringSet( false ) , mGeometrySimplifier( NULL ) , mExpressionCompiled( false ) { mFeatureFetched = false; mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mFilePath ); if ( mSource->mLayerName.isNull() ) { ogrLayer = OGR_DS_GetLayer( mConn->ds, mSource->mLayerIndex ); } else { ogrLayer = OGR_DS_GetLayerByName( mConn->ds, TO8( mSource->mLayerName ) ); } if ( !mSource->mSubsetString.isEmpty() ) { ogrLayer = QgsOgrUtils::setSubsetString( ogrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString ); mSubsetStringSet = true; } mFetchGeometry = ( !mRequest.filterRect().isNull() ) || !( mRequest.flags() & QgsFeatureRequest::NoGeometry ); QgsAttributeList attrs = ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) ? mRequest.subsetOfAttributes() : mSource->mFields.allAttributesList(); // make sure we fetch just relevant fields // unless it's a VRT data source filtered by geometry as we don't know which // attributes make up the geometry and OGR won't fetch them to evaluate the // filter if we choose to ignore them (fixes #11223) if (( mSource->mDriverName != "VRT" && mSource->mDriverName != "OGR_VRT" ) || mRequest.filterRect().isNull() ) { QgsOgrUtils::setRelevantFields( ogrLayer, mSource->mFields.count(), mFetchGeometry, attrs ); } // spatial query to select features if ( !mRequest.filterRect().isNull() ) { const QgsRectangle& rect = mRequest.filterRect(); OGR_L_SetSpatialFilterRect( ogrLayer, rect.xMinimum(), rect.yMinimum(), rect.xMaximum(), rect.yMaximum() ); } else { OGR_L_SetSpatialFilter( ogrLayer, 0 ); } if ( request.filterType() == QgsFeatureRequest::FilterExpression && QSettings().value( "/qgis/compileExpressions", true ).toBool() ) { QgsOgrExpressionCompiler compiler = QgsOgrExpressionCompiler( source ); QgsSqlExpressionCompiler::Result result = compiler.compile( request.filterExpression() ); if ( result == QgsSqlExpressionCompiler::Complete || result == QgsSqlExpressionCompiler::Partial ) { QString whereClause = compiler.result(); if ( OGR_L_SetAttributeFilter( ogrLayer, whereClause.toLocal8Bit().data() ) == OGRERR_NONE ) { //if only partial success when compiling expression, we need to double-check results using QGIS' expressions mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete ); } } else { OGR_L_SetAttributeFilter( ogrLayer, 0 ); } } else { OGR_L_SetAttributeFilter( ogrLayer, 0 ); } //start with first feature rewind(); }
void QgsRangeWidgetWrapper::initWidget( QWidget* editor ) { mDoubleSpinBox = qobject_cast<QDoubleSpinBox*>( editor ); mIntSpinBox = qobject_cast<QSpinBox*>( editor ); mDial = qobject_cast<QDial*>( editor ); mSlider = qobject_cast<QSlider*>( editor ); mQgsDial = qobject_cast<QgsDial*>( editor ); mQgsSlider = qobject_cast<QgsSlider*>( editor ); bool allowNull = config( "AllowNull" ).toBool(); QVariant min( config( "Min" ) ); QVariant max( config( "Max" ) ); QVariant step( config( "Step" ) ); if ( mDoubleSpinBox ) { // set the precision if field is integer int precision = layer()->fields()[fieldIdx()].precision(); if ( precision > 0 ) { mDoubleSpinBox->setDecimals( layer()->fields()[fieldIdx()].precision() ); } double minval = min.toDouble(); double stepval = step.toDouble(); QgsDoubleSpinBox* qgsWidget = dynamic_cast<QgsDoubleSpinBox*>( mDoubleSpinBox ); if ( qgsWidget ) qgsWidget->setShowClearButton( allowNull ); if ( allowNull ) { if ( precision > 0 ) { minval -= 10 ^ -precision; } else { minval -= stepval; } mDoubleSpinBox->setValue( minval ); mDoubleSpinBox->setSpecialValueText( QSettings().value( "qgis/nullValue", "NULL" ).toString() ); } if ( min.isValid() ) mDoubleSpinBox->setMinimum( min.toDouble() ); if ( max.isValid() ) mDoubleSpinBox->setMaximum( max.toDouble() ); if ( step.isValid() ) mDoubleSpinBox->setSingleStep( step.toDouble() ); if ( config( "Suffix" ).isValid() ) mDoubleSpinBox->setSuffix( config( "Suffix" ).toString() ); connect( mDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( valueChanged( double ) ) ); } if ( mIntSpinBox ) { int minval = min.toInt(); int stepval = step.toInt(); QgsSpinBox* qgsWidget = dynamic_cast<QgsSpinBox*>( mIntSpinBox ); if ( qgsWidget ) qgsWidget->setShowClearButton( allowNull ); if ( allowNull ) { minval -= stepval; mIntSpinBox->setValue( minval ); mIntSpinBox->setSpecialValueText( QSettings().value( "qgis/nullValue", "NULL" ).toString() ); } if ( min.isValid() ) mIntSpinBox->setMinimum( min.toInt() ); if ( max.isValid() ) mIntSpinBox->setMaximum( max.toInt() ); if ( step.isValid() ) mIntSpinBox->setSingleStep( step.toInt() ); if ( config( "Suffix" ).isValid() ) mIntSpinBox->setSuffix( config( "Suffix" ).toString() ); connect( mIntSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( valueChanged( int ) ) ); } if ( mQgsDial || mQgsSlider ) { field().convertCompatible( min ); field().convertCompatible( max ); field().convertCompatible( step ); if ( mQgsSlider ) { if ( min.isValid() ) mQgsSlider->setMinimum( min ); if ( max.isValid() ) mQgsSlider->setMaximum( max ); if ( step.isValid() ) mQgsSlider->setSingleStep( step ); } if ( mQgsDial ) { if ( min.isValid() ) mQgsDial->setMinimum( min ); if ( max.isValid() ) mQgsDial->setMaximum( max ); if ( step.isValid() ) mQgsDial->setSingleStep( step ); } connect( editor, SIGNAL( valueChanged( QVariant ) ), this, SLOT( valueChanged( QVariant ) ) ); } else if ( mDial ) { if ( min.isValid() ) mDial->setMinimum( min.toInt() ); if ( max.isValid() ) mDial->setMaximum( max.toInt() ); if ( step.isValid() ) mDial->setSingleStep( step.toInt() ); connect( mDial, SIGNAL( valueChanged( int ) ), this, SLOT( valueChanged( int ) ) ); } else if ( mSlider )
int EditorConfig::domainColorScheme() { return QSettings().value("domainColorScheme", DomainColorSchemeDefault).toInt(); }
int EditorConfig::hideMode() { return QSettings().value("hideMode", HideModeDefault).toInt(); }
void EditorConfig::setShowConfRelInDomLabel(bool show) { QSettings().setValue("showConfRelInDomLabel", show); }
void EditorConfig::setDisplayLoops(bool display) { QSettings().setValue("displayLoops", display); }
void EditorConfig::setUnreachableRuleWarn(bool warn) { QSettings().setValue("unreachableRuleWarn", warn); }
bool EditorConfig::displayLoops() { return QSettings().value("displayLoops", DisplayLoopsDefault).toBool(); }
void EditorConfig::setBypassedRuleWarn(bool warn) { QSettings().setValue("bypassedRuleWarn", warn); }
void EditorConfig::setFastDraw(bool draw) { QSettings().setValue("fastDraw", draw); }
void EditorConfig::setConfidentialityLossRuleWarn(bool warn) { QSettings().setValue("confidentialityLossRuleWarn", warn); }
bool EditorConfig::fastDraw() { return QSettings().value("fastDraw", FastDrawDefault).toBool(); }
void EditorConfig::setReliabilityLossRuleWarn(bool warn) { QSettings().setValue("reliabilityLossRuleWarn", warn); }
int EditorConfig::arrowColorScheme() { return QSettings().value("arrowColorScheme", ArrowColorSchemeDefault).toInt(); }
void EditorConfig::setUnknownProgramWarn(bool warn) { QSettings().setValue("unknownProgramWarn", warn); }
void EditorConfig::setDomainColorScheme(int val) { if(val>=0 && val<InvalidColorScheme) QSettings().setValue("domainColorScheme", val); }
void EditorConfig::setUndefinedActionWarn(bool warn) { QSettings().setValue("undefinedActionWarn", warn); }
void Clock::stop() { m_stopped = true; m_clock_timer->stop(); QSettings().remove("Current/Time"); updateText(); }