Skip to content

Commit 9a63145

Browse files
author
homann
committed
Use english for logical values of band names in project files. Use String comparision properly
git-svn-id: http://svn.osgeo.org/qgis/trunk@7943 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent df926fa commit 9a63145

File tree

3 files changed

+103
-70
lines changed

3 files changed

+103
-70
lines changed

src/app/qgsrasterlayerproperties.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ rasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
162162
cboGreen->insertItem("Blue");
163163
cboBlue->insertItem("Blue");
164164

165-
cboRed->insertItem(tr("Not Set"));
166-
cboGreen->insertItem(tr("Not Set"));
167-
cboBlue->insertItem(tr("Not Set"));
165+
cboRed->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
166+
cboGreen->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
167+
cboBlue->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
168168

169169
cboGray->insertItem("Red");
170170
cboGray->insertItem("Green");
171171
cboGray->insertItem("Blue");
172-
cboGray->insertItem(tr("Not Set"));
172+
cboGray->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
173173

174174
lstHistogramLabels->insertItem(tr("Palette"));
175175
}
@@ -269,15 +269,15 @@ rasterLayer( dynamic_cast<QgsRasterLayer*>(lyr) )
269269
cboBlue->insertItem(myQString);
270270
}
271271
//TODO: Need to handle situations where a band is set to Not Set, currently if you set a band to this it will segfault.
272-
cboRed->insertItem(tr("Not Set"));
273-
cboGreen->insertItem(tr("Not Set"));
274-
cboBlue->insertItem(tr("Not Set"));
272+
cboRed->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
273+
cboGreen->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
274+
cboBlue->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
275275
if (cboGray->count() != 1)
276-
cboGray->insertItem(tr("Not Set"));
276+
cboGray->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
277277
}
278278

279-
cboxTransparencyBand->insertItem(tr("Not Set"));
280-
cboxTransparencyLayer->insertItem(tr("Not Set"));
279+
cboxTransparencyBand->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
280+
cboxTransparencyLayer->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
281281
std::map<QString, QgsMapLayer *> myLayers = QgsMapLayerRegistry::instance()->mapLayers();
282282
std::map<QString, QgsMapLayer *>::iterator it;
283283
for(it = myLayers.begin(); it != myLayers.end(); it++)
@@ -599,22 +599,22 @@ void QgsRasterLayerProperties::sync()
599599
rbtnThreeBandMinMax->setChecked(false);
600600
}
601601

602-
if(QgsRasterLayer::PALETTED_COLOR != rasterLayer->getDrawingStyle() &&
602+
if(QgsRasterLayer::PALETTED_COLOR != rasterLayer->getDrawingStyle() &&
603603
QgsRasterLayer::PALETTED_SINGLE_BAND_GRAY != rasterLayer->getDrawingStyle() &&
604604
QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR != rasterLayer->getDrawingStyle() &&
605605
QgsRasterLayer::PALETTED_MULTI_BAND_COLOR != rasterLayer->getDrawingStyle())
606606
{
607-
if(rasterLayer->getRedBandName() != tr("Not Set"))
607+
if(rasterLayer->getRedBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
608608
{
609609
leRedMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getRedBandName())));
610610
leRedMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getRedBandName())));
611611
}
612-
if(rasterLayer->getGreenBandName() != tr("Not Set"))
612+
if(rasterLayer->getGreenBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
613613
{
614614
leGreenMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getGreenBandName())));
615615
leGreenMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getGreenBandName())));
616616
}
617-
if(rasterLayer->getBlueBandName() != tr("Not Set"))
617+
if(rasterLayer->getBlueBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
618618
{
619619
leBlueMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getBlueBandName())));
620620
leBlueMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getBlueBandName())));
@@ -641,7 +641,7 @@ if(QgsRasterLayer::PALETTED_COLOR != rasterLayer->getDrawingStyle() &&
641641
QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR != rasterLayer->getDrawingStyle() &&
642642
QgsRasterLayer::PALETTED_MULTI_BAND_COLOR != rasterLayer->getDrawingStyle())
643643
{
644-
if(rasterLayer->getGrayBandName() != tr("Not Set"))
644+
if(rasterLayer->getGrayBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
645645
{
646646
leGrayMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getGrayBandName())));
647647
leGrayMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getGrayBandName())));
@@ -685,7 +685,7 @@ if(QgsRasterLayer::PALETTED_COLOR != rasterLayer->getDrawingStyle() &&
685685
}
686686
else
687687
{
688-
cboxTransparencyLayer->setCurrentIndex(cboxTransparencyLayer->findText(tr("Not Set")));
688+
cboxTransparencyLayer->setCurrentIndex(cboxTransparencyLayer->findText(tr(QgsRasterLayer::QSTRING_NOT_SET)));
689689
}
690690

691691
myIndex = cboxTransparencyBand->findText(rasterLayer->getTransparentBandName());
@@ -695,7 +695,7 @@ if(QgsRasterLayer::PALETTED_COLOR != rasterLayer->getDrawingStyle() &&
695695
}
696696
else
697697
{
698-
cboxTransparencyBand->setCurrentIndex(cboxTransparencyBand->findText(tr("Not Set")));
698+
cboxTransparencyBand->setCurrentIndex(cboxTransparencyBand->findText(tr(QgsRasterLayer::QSTRING_NOT_SET)));
699699
}
700700
//add current NoDataValue to NoDataValue line edit
701701
if(rasterLayer->isNoDataValueValid())
@@ -1059,17 +1059,17 @@ void QgsRasterLayerProperties::apply()
10591059
//Set min max based on user defined values if all are set and stdDev is 0.0
10601060
if(rbtnThreeBandMinMax->isEnabled() && rbtnThreeBandMinMax->isChecked() && validUserDefinedMinMax())
10611061
{
1062-
if(rasterLayer->getRedBandName() != tr("Not Set"))
1062+
if(rasterLayer->getRedBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
10631063
{
10641064
rasterLayer->setMinimumValue(cboRed->currentText(), leRedMin->text().toDouble(), false);
10651065
rasterLayer->setMaximumValue(cboRed->currentText(), leRedMax->text().toDouble());
10661066
}
1067-
if(rasterLayer->getGreenBandName() != tr("Not Set"))
1067+
if(rasterLayer->getGreenBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
10681068
{
10691069
rasterLayer->setMinimumValue(cboGreen->currentText(), leGreenMin->text().toDouble(), false);
10701070
rasterLayer->setMaximumValue(cboGreen->currentText(), leGreenMax->text().toDouble());
10711071
}
1072-
if(rasterLayer->getBlueBandName() != tr("Not Set"))
1072+
if(rasterLayer->getBlueBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
10731073
{
10741074
rasterLayer->setMinimumValue(cboBlue->currentText(), leBlueMin->text().toDouble(), false);
10751075
rasterLayer->setMaximumValue(cboBlue->currentText(), leBlueMax->text().toDouble());
@@ -1093,7 +1093,7 @@ void QgsRasterLayerProperties::apply()
10931093
//Set min max based on user defined values if all are set and stdDev is 0.0
10941094
if(rbtnSingleBandMinMax->isEnabled() && rbtnSingleBandMinMax->isChecked() && validUserDefinedMinMax())
10951095
{
1096-
if(rasterLayer->getGrayBandName() != tr("Not Set"))
1096+
if(rasterLayer->getGrayBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
10971097
{
10981098
rasterLayer->setMinimumValue(cboGray->currentText(), leGrayMin->text().toDouble(), false);
10991099
rasterLayer->setMaximumValue(cboGray->currentText(), leGrayMax->text().toDouble());
@@ -1411,17 +1411,17 @@ void QgsRasterLayerProperties::apply()
14111411

14121412
if(rbtnThreeBandMinMax->isEnabled())
14131413
{
1414-
if(rasterLayer->getRedBandName() != tr("Not Set"))
1414+
if(rasterLayer->getRedBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
14151415
{
14161416
leRedMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getRedBandName())));
14171417
leRedMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getRedBandName())));
14181418
}
1419-
if(rasterLayer->getGreenBandName() != tr("Not Set"))
1419+
if(rasterLayer->getGreenBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
14201420
{
14211421
leGreenMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getGreenBandName())));
14221422
leGreenMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getGreenBandName())));
14231423
}
1424-
if(rasterLayer->getBlueBandName() != tr("Not Set"))
1424+
if(rasterLayer->getBlueBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
14251425
{
14261426
leBlueMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getBlueBandName())));
14271427
leBlueMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getBlueBandName())));
@@ -1437,7 +1437,7 @@ void QgsRasterLayerProperties::apply()
14371437

14381438
if(rbtnSingleBandMinMax->isEnabled())
14391439
{
1440-
if(rasterLayer->getGrayBandName() != tr("Not Set"))
1440+
if(rasterLayer->getGrayBandName() != tr(QgsRasterLayer::QSTRING_NOT_SET))
14411441
{
14421442
leGrayMin->setText(QString::number(rasterLayer->getMinimumValue(rasterLayer->getGrayBandName())));
14431443
leGrayMax->setText(QString::number(rasterLayer->getMaximumValue(rasterLayer->getGrayBandName())));
@@ -1549,7 +1549,7 @@ void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
15491549

15501550
void QgsRasterLayerProperties::on_cboBlue_currentIndexChanged(const QString& theText)
15511551
{
1552-
if(tr("Not Set") != theText)
1552+
if(tr(QgsRasterLayer::QSTRING_NOT_SET) != theText)
15531553
{
15541554
leBlueMin->setText(QString::number(rasterLayer->getMinimumValue(theText)));
15551555
leBlueMax->setText(QString::number(rasterLayer->getMaximumValue(theText)));
@@ -1558,7 +1558,7 @@ void QgsRasterLayerProperties::on_cboBlue_currentIndexChanged(const QString& the
15581558

15591559
void QgsRasterLayerProperties::on_cboGray_currentIndexChanged(const QString& theText)
15601560
{
1561-
if(tr("Not Set") != theText)
1561+
if(tr(QgsRasterLayer::QSTRING_NOT_SET) != theText)
15621562
{
15631563
leGrayMin->setText(QString::number(rasterLayer->getMinimumValue(theText)));
15641564
leGrayMax->setText(QString::number(rasterLayer->getMaximumValue(theText)));
@@ -1567,7 +1567,7 @@ void QgsRasterLayerProperties::on_cboGray_currentIndexChanged(const QString& the
15671567

15681568
void QgsRasterLayerProperties::on_cboGreen_currentIndexChanged(const QString& theText)
15691569
{
1570-
if(tr("Not Set") != theText)
1570+
if(tr(QgsRasterLayer::QSTRING_NOT_SET) != theText)
15711571
{
15721572
leGreenMin->setText(QString::number(rasterLayer->getMinimumValue(theText)));
15731573
leGreenMax->setText(QString::number(rasterLayer->getMaximumValue(theText)));
@@ -1576,7 +1576,7 @@ void QgsRasterLayerProperties::on_cboGreen_currentIndexChanged(const QString& th
15761576

15771577
void QgsRasterLayerProperties::on_cboRed_currentIndexChanged(const QString& theText)
15781578
{
1579-
if(tr("Not Set") != theText)
1579+
if(tr(QgsRasterLayer::QSTRING_NOT_SET) != theText)
15801580
{
15811581
leRedMin->setText(QString::number(rasterLayer->getMinimumValue(theText)));
15821582
leRedMax->setText(QString::number(rasterLayer->getMaximumValue(theText)));
@@ -1659,10 +1659,10 @@ void QgsRasterLayerProperties::on_cboxColorMap_currentIndexChanged(const QString
16591659

16601660
void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged(const QString& theText)
16611661
{
1662-
if(theText == tr("Not Set"))
1662+
if(theText == tr(QgsRasterLayer::QSTRING_NOT_SET))
16631663
{
16641664
cboxTransparencyBand->clear();
1665-
cboxTransparencyBand->insertItem(tr("Not Set"));
1665+
cboxTransparencyBand->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
16661666
}
16671667
else
16681668
{
@@ -1675,7 +1675,7 @@ void QgsRasterLayerProperties::on_cboxTransparencyLayer_currentIndexChanged(cons
16751675
QgsRasterLayer* myRasterLayer = (QgsRasterLayer*)it->second;
16761676
int myBandCount = myRasterLayer->getBandCount();
16771677
cboxTransparencyBand->clear();
1678-
cboxTransparencyBand->insertItem(tr("Not Set"));
1678+
cboxTransparencyBand->insertItem(tr(QgsRasterLayer::QSTRING_NOT_SET));
16791679
for(int bandRunner = 1; bandRunner <= myBandCount; bandRunner++)
16801680
{
16811681
cboxTransparencyBand->insertItem(myRasterLayer->getRasterBandName(bandRunner));
@@ -2376,7 +2376,7 @@ void QgsRasterLayerProperties::on_rbtnSingleBand_toggled(bool b)
23762376
// Populate transparency table with single value transparency pixels
23772377
populateTransparencyTable();
23782378
// If no band is selected but there are multiple bands, selcet the first as the default
2379-
if(cboGray->currentText() == tr("Not Set") && 1 < cboGray->count())
2379+
if(cboGray->currentText() == tr(QgsRasterLayer::QSTRING_NOT_SET) && 1 < cboGray->count())
23802380
{
23812381
cboGray->setCurrentIndex(0);
23822382
}

0 commit comments

Comments
 (0)