23 #include <QInputDialog> 24 #include <QMessageBox> 26 #include <QMouseEvent> 32 , mProvider( provider )
36 mSaveOptionsWidget->setProvider( provider );
48 void QgsRasterPyramidsOptionsWidget::updateUi()
51 QString prefix = mProvider +
"/driverOptions/_pyramids/";
55 tmpStr = mySettings.
value( prefix +
"format",
"external" ).
toString();
56 if ( tmpStr ==
"internal" )
57 cbxPyramidsFormat->setCurrentIndex( INTERNAL );
58 else if ( tmpStr ==
"external_erdas" )
59 cbxPyramidsFormat->setCurrentIndex( ERDAS );
61 cbxPyramidsFormat->setCurrentIndex( GTIFF );
64 cboResamplingMethod->
clear();
68 cboResamplingMethod->addItem( method.second, method.first );
71 int idx = cboResamplingMethod->findData( defaultMethod );
72 cboResamplingMethod->setCurrentIndex( idx );
75 lePyramidsLevels->setEnabled( cbxPyramidsLevelsCustom->isChecked() );
77 connect( lePyramidsLevels, SIGNAL( textEdited(
const QString & ) ),
78 this, SLOT( setOverviewList() ) );
81 if ( mOverviewCheckBoxes.
isEmpty() )
84 overviewList << 2 << 4 << 8 << 16 << 32 << 64;
85 mOverviewCheckBoxes.
clear();
86 Q_FOREACH (
int i, overviewList )
89 connect( mOverviewCheckBoxes[ i ], SIGNAL( toggled(
bool ) ),
90 this, SLOT( setOverviewList() ) );
91 layoutPyramidsLevels->addWidget( mOverviewCheckBoxes[ i ] );
96 Q_FOREACH (
int i, mOverviewCheckBoxes.
keys() )
97 mOverviewCheckBoxes[ i ]->setChecked(
false );
99 tmpStr = mySettings.
value( prefix +
"overviewList",
"" ).
toString();
100 Q_FOREACH (
const QString& lev, tmpStr.
split(
' ', QString::SkipEmptyParts ) )
103 mOverviewCheckBoxes[ lev.
toInt()]->setChecked(
true );
107 mSaveOptionsWidget->updateProfiles();
109 connect( cbxPyramidsFormat, SIGNAL( currentIndexChanged(
int ) ),
111 connect( cboResamplingMethod, SIGNAL( currentIndexChanged(
int ) ),
113 connect( mSaveOptionsWidget, SIGNAL( optionsChanged() ),
119 return cboResamplingMethod->itemData( cboResamplingMethod->currentIndex() ).toString();
125 QString prefix = mProvider +
"/driverOptions/_pyramids/";
129 if ( cbxPyramidsFormat->currentIndex() == INTERNAL )
131 else if ( cbxPyramidsFormat->currentIndex() == ERDAS )
132 tmpStr =
"external_erdas";
135 mySettings.
setValue( prefix +
"format", tmpStr );
137 mySettings.
setValue( prefix +
"overviewStr", lePyramidsLevels->text().
trimmed() );
141 Q_FOREACH (
int i, mOverviewCheckBoxes.
keys() )
143 if ( mOverviewCheckBoxes[ i ]->isChecked() )
148 mSaveOptionsWidget->apply();
153 Q_FOREACH (
int i, mOverviewCheckBoxes.
keys() )
154 mOverviewCheckBoxes[ i ]->setChecked( checked );
157 void QgsRasterPyramidsOptionsWidget::on_cbxPyramidsLevelsCustom_toggled(
bool toggled )
160 lePyramidsLevels->setEnabled( toggled );
161 Q_FOREACH (
int i, mOverviewCheckBoxes.
keys() )
162 mOverviewCheckBoxes[ i ]->
setEnabled( ! toggled );
166 void QgsRasterPyramidsOptionsWidget::on_cbxPyramidsFormat_currentIndexChanged(
int index )
168 mSaveOptionsWidget->setEnabled( index != ERDAS );
186 mSaveOptionsWidget->setPyramidsFormat( format );
189 void QgsRasterPyramidsOptionsWidget::setOverviewList()
192 mOverviewList.
clear();
195 if ( cbxPyramidsLevelsCustom->isChecked() )
198 Q_FOREACH (
const QString& lev, lePyramidsLevels->text().
trimmed().
split(
' ', QString::SkipEmptyParts ) )
201 int tmpInt = lev.
toInt();
206 mOverviewList << tmpInt;
212 Q_FOREACH (
int i, mOverviewCheckBoxes.
keys() )
214 if ( mOverviewCheckBoxes[ i ]->isChecked() )
bool contains(const Key &key) const
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QList< Key > keys() const
void setValue(const QString &key, const QVariant &value)
QString number(int n, int base)
int toInt(bool *ok, int base) const
static QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns a list of pyramid resampling method name and label pairs for given provider.
QVariant value(const QString &key, const QVariant &defaultValue) const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)