|
@@ -96,6 +96,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti |
|
|
connect( mCustomVariablesChkBx, &QCheckBox::toggled, this, &QgsOptions::mCustomVariablesChkBx_toggled ); |
|
|
connect( mCurrentVariablesQGISChxBx, &QCheckBox::toggled, this, &QgsOptions::mCurrentVariablesQGISChxBx_toggled ); |
|
|
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOptions::showHelp ); |
|
|
connect( cboGlobalLocale, qgis::overload< int >::of( &QComboBox::currentIndexChanged ), [ = ]( int ) { updateSampleLocaleText( ); } ); |
|
|
connect( cbShowGroupSeparator, &QCheckBox::toggled, this, [ = ]( bool ) { updateSampleLocaleText(); } ); |
|
|
|
|
|
// 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), |
|
@@ -672,30 +674,30 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti |
|
|
mRasterCumulativeCutUpperDoubleSpinBox->setValue( 100.0 * mSettings->value( QStringLiteral( "/Raster/cumulativeCutUpper" ), QString::number( QgsRasterMinMaxOrigin::CUMULATIVE_CUT_UPPER ) ).toDouble() ); |
|
|
|
|
|
//set the color for selections |
|
|
int myRed = mSettings->value( QStringLiteral( "/qgis/default_selection_color_red" ), 255 ).toInt(); |
|
|
int myGreen = mSettings->value( QStringLiteral( "/qgis/default_selection_color_green" ), 255 ).toInt(); |
|
|
int myBlue = mSettings->value( QStringLiteral( "/qgis/default_selection_color_blue" ), 0 ).toInt(); |
|
|
int myAlpha = mSettings->value( QStringLiteral( "/qgis/default_selection_color_alpha" ), 255 ).toInt(); |
|
|
pbnSelectionColor->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) ); |
|
|
int red = mSettings->value( QStringLiteral( "/qgis/default_selection_color_red" ), 255 ).toInt(); |
|
|
int green = mSettings->value( QStringLiteral( "/qgis/default_selection_color_green" ), 255 ).toInt(); |
|
|
int blue = mSettings->value( QStringLiteral( "/qgis/default_selection_color_blue" ), 0 ).toInt(); |
|
|
int alpha = mSettings->value( QStringLiteral( "/qgis/default_selection_color_alpha" ), 255 ).toInt(); |
|
|
pbnSelectionColor->setColor( QColor( red, green, blue, alpha ) ); |
|
|
pbnSelectionColor->setColorDialogTitle( tr( "Set Selection Color" ) ); |
|
|
pbnSelectionColor->setAllowOpacity( true ); |
|
|
pbnSelectionColor->setContext( QStringLiteral( "gui" ) ); |
|
|
pbnSelectionColor->setDefaultColor( QColor( 255, 255, 0, 255 ) ); |
|
|
|
|
|
//set the default color for canvas background |
|
|
myRed = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_red" ), 255 ).toInt(); |
|
|
myGreen = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_green" ), 255 ).toInt(); |
|
|
myBlue = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_blue" ), 255 ).toInt(); |
|
|
pbnCanvasColor->setColor( QColor( myRed, myGreen, myBlue ) ); |
|
|
red = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_red" ), 255 ).toInt(); |
|
|
green = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_green" ), 255 ).toInt(); |
|
|
blue = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_blue" ), 255 ).toInt(); |
|
|
pbnCanvasColor->setColor( QColor( red, green, blue ) ); |
|
|
pbnCanvasColor->setColorDialogTitle( tr( "Set Canvas Color" ) ); |
|
|
pbnCanvasColor->setContext( QStringLiteral( "gui" ) ); |
|
|
pbnCanvasColor->setDefaultColor( Qt::white ); |
|
|
|
|
|
// set the default color for the measure tool |
|
|
myRed = mSettings->value( QStringLiteral( "/qgis/default_measure_color_red" ), 222 ).toInt(); |
|
|
myGreen = mSettings->value( QStringLiteral( "/qgis/default_measure_color_green" ), 155 ).toInt(); |
|
|
myBlue = mSettings->value( QStringLiteral( "/qgis/default_measure_color_blue" ), 67 ).toInt(); |
|
|
pbnMeasureColor->setColor( QColor( myRed, myGreen, myBlue ) ); |
|
|
red = mSettings->value( QStringLiteral( "/qgis/default_measure_color_red" ), 222 ).toInt(); |
|
|
green = mSettings->value( QStringLiteral( "/qgis/default_measure_color_green" ), 155 ).toInt(); |
|
|
blue = mSettings->value( QStringLiteral( "/qgis/default_measure_color_blue" ), 67 ).toInt(); |
|
|
pbnMeasureColor->setColor( QColor( red, green, blue ) ); |
|
|
pbnMeasureColor->setColorDialogTitle( tr( "Set Measuring Tool Color" ) ); |
|
|
pbnMeasureColor->setContext( QStringLiteral( "gui" ) ); |
|
|
pbnMeasureColor->setDefaultColor( QColor( 222, 155, 67 ) ); |
|
@@ -901,38 +903,60 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti |
|
|
mOffsetYSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetY" ), 0, QgsSettings::Gui ).toDouble() ); |
|
|
|
|
|
// |
|
|
// Locale settings |
|
|
// Translation and locale settings |
|
|
// |
|
|
QString mySystemLocale = QLocale().name(); |
|
|
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( mySystemLocale ) ); |
|
|
QString myUserLocale = mSettings->value( QStringLiteral( "locale/userLocale" ), QString() ).toString(); |
|
|
QStringList myI18nList = i18nList(); |
|
|
Q_FOREACH ( const QString &l, myI18nList ) |
|
|
QString currentLocale = QLocale().name(); |
|
|
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) ); |
|
|
QString userLocale = mSettings->value( QStringLiteral( "locale/userLocale" ), QString( ) ).toString(); |
|
|
bool showGroupSeparator = mSettings->value( QStringLiteral( "locale/showGroupSeparator" ), false ).toBool(); |
|
|
QString globalLocale = mSettings->value( QStringLiteral( "locale/globalLocale" ), currentLocale ).toString(); |
|
|
const QStringList language18nList( i18nList() ); |
|
|
for ( const auto &l : language18nList ) |
|
|
{ |
|
|
// QTBUG-57802: eo locale is improperly handled |
|
|
QString displayName = l.startsWith( QLatin1String( "eo" ) ) ? QLocale::languageToString( QLocale::Esperanto ) : QLocale( l ).nativeLanguageName(); |
|
|
cboLocale->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l ); |
|
|
cboTranslation->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l ); |
|
|
} |
|
|
cboLocale->setCurrentIndex( cboLocale->findData( myUserLocale ) ); |
|
|
bool myLocaleOverrideFlag = mSettings->value( QStringLiteral( "locale/overrideFlag" ), false ).toBool(); |
|
|
grpLocale->setChecked( myLocaleOverrideFlag ); |
|
|
|
|
|
const QList<QLocale> allLocales = QLocale::matchingLocales( |
|
|
QLocale::AnyLanguage, |
|
|
QLocale::AnyScript, |
|
|
QLocale::AnyCountry ); |
|
|
|
|
|
QSet<QString> addedLocales; |
|
|
for ( const auto &l : allLocales ) |
|
|
{ |
|
|
// Do not add duplicates (like en_US) |
|
|
if ( ! addedLocales.contains( l.name() ) ) |
|
|
{ |
|
|
cboGlobalLocale->addItem( QStringLiteral( "%1 %2 (%3)" ).arg( QLocale::languageToString( l.language() ), QLocale::countryToString( l.country() ), l.name() ), l.name() ); |
|
|
addedLocales.insert( l.name() ); |
|
|
} |
|
|
} |
|
|
|
|
|
cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) ); |
|
|
cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) ); |
|
|
bool localeOverrideFlag = mSettings->value( QStringLiteral( "locale/overrideFlag" ), false ).toBool(); |
|
|
grpLocale->setChecked( localeOverrideFlag ); |
|
|
cbShowGroupSeparator->setChecked( showGroupSeparator ); |
|
|
|
|
|
|
|
|
//set elements in digitizing tab |
|
|
mLineWidthSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/digitizing/line_width" ), 1 ).toInt() ); |
|
|
myRed = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_red" ), 255 ).toInt(); |
|
|
myGreen = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_green" ), 0 ).toInt(); |
|
|
myBlue = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_blue" ), 0 ).toInt(); |
|
|
myAlpha = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_alpha" ), 200 ).toInt(); |
|
|
mLineColorToolButton->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) ); |
|
|
red = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_red" ), 255 ).toInt(); |
|
|
green = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_green" ), 0 ).toInt(); |
|
|
blue = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_blue" ), 0 ).toInt(); |
|
|
alpha = mSettings->value( QStringLiteral( "/qgis/digitizing/line_color_alpha" ), 200 ).toInt(); |
|
|
mLineColorToolButton->setColor( QColor( red, green, blue, alpha ) ); |
|
|
mLineColorToolButton->setAllowOpacity( true ); |
|
|
mLineColorToolButton->setContext( QStringLiteral( "gui" ) ); |
|
|
mLineColorToolButton->setDefaultColor( QColor( 255, 0, 0, 200 ) ); |
|
|
|
|
|
myRed = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_red" ), 255 ).toInt(); |
|
|
myGreen = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_green" ), 0 ).toInt(); |
|
|
myBlue = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_blue" ), 0 ).toInt(); |
|
|
myAlpha = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_alpha" ), 30 ).toInt(); |
|
|
mFillColorToolButton->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) ); |
|
|
red = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_red" ), 255 ).toInt(); |
|
|
green = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_green" ), 0 ).toInt(); |
|
|
blue = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_blue" ), 0 ).toInt(); |
|
|
alpha = mSettings->value( QStringLiteral( "/qgis/digitizing/fill_color_alpha" ), 30 ).toInt(); |
|
|
mFillColorToolButton->setColor( QColor( red, green, blue, alpha ) ); |
|
|
mFillColorToolButton->setAllowOpacity( true ); |
|
|
mFillColorToolButton->setContext( QStringLiteral( "gui" ) ); |
|
|
mFillColorToolButton->setDefaultColor( QColor( 255, 0, 0, 30 ) ); |
|
@@ -1586,8 +1610,12 @@ void QgsOptions::saveOptions() |
|
|
// |
|
|
// Locale settings |
|
|
// |
|
|
mSettings->setValue( QStringLiteral( "locale/userLocale" ), cboLocale->currentData().toString() ); |
|
|
mSettings->setValue( QStringLiteral( "locale/userLocale" ), cboTranslation->currentData().toString() ); |
|
|
mSettings->setValue( QStringLiteral( "locale/overrideFlag" ), grpLocale->isChecked() ); |
|
|
mSettings->setValue( QStringLiteral( "locale/globalLocale" ), cboGlobalLocale->currentData( ).toString() ); |
|
|
|
|
|
// Number settings |
|
|
mSettings->setValue( QStringLiteral( "locale/showGroupSeparator" ), cbShowGroupSeparator->isChecked( ) ); |
|
|
|
|
|
// Gdal skip driver list |
|
|
if ( mLoadedGdalDriverList ) |
|
@@ -2355,6 +2383,24 @@ void QgsOptions::refreshSchemeComboBox() |
|
|
mColorSchemesComboBox->blockSignals( false ); |
|
|
} |
|
|
|
|
|
void QgsOptions::updateSampleLocaleText() |
|
|
{ |
|
|
QLocale locale( cboGlobalLocale->currentData( ).toString() ); |
|
|
if ( cbShowGroupSeparator->isChecked( ) ) |
|
|
{ |
|
|
locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
locale.setNumberOptions( locale.numberOptions() |= QLocale::NumberOption::OmitGroupSeparator ); |
|
|
} |
|
|
lblLocaleSample->setText( tr( "Sample date: %1 money: %2 int: %3 float: %4" ).arg( |
|
|
QDate::currentDate().toString( locale.dateFormat( QLocale::FormatType::ShortFormat ) ), |
|
|
locale.toCurrencyString( 1000.00 ), |
|
|
locale.toString( 1000 ), |
|
|
locale.toString( 1000.00, 'f', 2 ) ) ); |
|
|
} |
|
|
|
|
|
void QgsOptions::updateActionsForCurrentColorScheme( QgsColorScheme *scheme ) |
|
|
{ |
|
|
if ( !scheme ) |
|
|