[Marble-commits] KDE/kdeedu/marble/src
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Sun Jan 9 15:55:57 CET 2011
SVN commit 1213197 by beschow:
MapWizard: have a server history in the static URL case as well
there are two reasons for this:
1) be able to provide a novice user some sample/template URLs
2) save valuable time when creating the same map again
M +6 -4 QtMainWindow.cpp
M +25 -6 lib/MapWizard.cpp
M +3 -0 lib/MapWizard.h
M +15 -12 lib/MapWizard.ui
M +6 -3 marble.kcfg
M +4 -2 marble_part.cpp
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1213196:1213197
@@ -996,8 +996,9 @@
}
settings.endGroup();
- settings.beginGroup( "WmsService" );
- m_mapWizard->setWmsServers( settings.value( "services" ).toStringList() );
+ settings.beginGroup( "MapWizard" );
+ m_mapWizard->setWmsServers( settings.value( "wmsServers" ).toStringList() );
+ m_mapWizard->setStaticUrlServers( settings.value( "staticUrlServers" ).toStringList() );
settings.endGroup();
settings.beginGroup( "Plugins");
@@ -1115,8 +1116,9 @@
settings.setValue( "activePositionTrackingPlugin", positionProvider );
settings.endGroup();
- settings.beginGroup( "WmsService" );
- settings.setValue( "services", m_mapWizard->wmsServers() );
+ settings.beginGroup( "MapWizard" );
+ settings.setValue( "wmsServers", m_mapWizard->wmsServers() );
+ settings.setValue( "staticUrlServers", m_mapWizard->staticUrlServers() );
settings.endGroup();
// The config dialog has to write settings.
--- trunk/KDE/kdeedu/marble/src/lib/MapWizard.cpp #1213196:1213197
@@ -62,6 +62,7 @@
QNetworkAccessManager legendAccessManager;
QNetworkAccessManager levelZeroAccessManager;
QStringList wmsServerList;
+ QStringList staticUrlServerList;
bool m_serverCapabilitiesValid;
enum mapType
@@ -244,6 +245,18 @@
return d->wmsServerList;
}
+QStringList MapWizard::staticUrlServers() const
+{
+ return d->staticUrlServerList;
+}
+
+void MapWizard::setStaticUrlServers( const QStringList& uris )
+{
+ d->staticUrlServerList = uris;
+ d->uiWidget.comboBoxStaticUrlServer->addItems( d->staticUrlServerList );
+ d->uiWidget.comboBoxStaticUrlServer->addItem( "http://" );
+}
+
void MapWizard::autoFillDetails()
{
int selected = d->uiWidget.comboBoxWmsMap->currentIndex();
@@ -504,7 +517,7 @@
else if( d->mapProviderType == MapWizardPrivate::StaticUrlMap )
{
- QString server = d->uiWidget.lineEditStaticUrlServer->text();
+ QString server = d->uiWidget.comboBoxStaticUrlServer->currentText();
QString format = d->uiWidget.comboBoxStaticUrlFormat->currentText();
QUrl downloadUrl;
@@ -534,17 +547,23 @@
QMessageBox::information( this,
tr( "Base Tile" ),
tr( "The base tile could not be downloaded." ) );
+ return;
}
- else if ( testImage.isNull() ) {
+
+ if ( testImage.isNull() ) {
QMessageBox::information( this,
tr( "Base Tile" ),
tr( "The base tile could not be downloaded successfully. The server replied:\n\n%1" ).arg( QString( d->levelZero ) ) );
d->levelZero.clear();
+ return;
}
- else {
+
+ if ( d->mapProviderType == MapWizardPrivate::StaticUrlMap ) {
+ d->staticUrlServerList.append( d->uiWidget.comboBoxStaticUrlServer->currentText() );
+ }
+
next();
}
-}
void MapWizard::createLegend()
{
@@ -814,7 +833,7 @@
else if( d->mapProviderType == MapWizardPrivate::StaticUrlMap )
{
texture->setFileFormat( d->uiWidget.comboBoxStaticUrlFormat->currentText() );
- downloadUrl = QUrl( d->uiWidget.lineEditStaticUrlServer->text() );
+ downloadUrl = QUrl( d->uiWidget.comboBoxStaticUrlServer->currentText() );
texture->addDownloadPolicy( DownloadBrowse, 20 );
texture->addDownloadPolicy( DownloadBulk, 2 );
texture->addDownloadUrl( downloadUrl );
@@ -881,7 +900,7 @@
else if( d->uiWidget.radioButtonStaticUrl->isChecked() )
{
- QUrl staticImageUrl( d->uiWidget.lineEditStaticUrlServer->text() );
+ QUrl staticImageUrl( d->uiWidget.comboBoxStaticUrlServer->currentText() );
d->staticUrlProtocol = staticImageUrl.toString().left( staticImageUrl.toString().indexOf( ':' ) );
d->staticUrlHost = QString( staticImageUrl.encodedHost() );
d->staticUrlPath = QUrl::fromPercentEncoding( staticImageUrl.encodedPath() );
--- trunk/KDE/kdeedu/marble/src/lib/MapWizard.h #1213196:1213197
@@ -41,6 +41,9 @@
QStringList wmsServers() const;
void setWmsServers( const QStringList& uris );
+ QStringList staticUrlServers() const;
+ void setStaticUrlServers( const QStringList& uris );
+
QString createArchive( QString mapId );
void deleteArchive( QString mapId );
--- trunk/KDE/kdeedu/marble/src/lib/MapWizard.ui #1213196:1213197
@@ -374,24 +374,14 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="lineEditStaticUrlServer">
- <property name="toolTip">
- <string>Url of the server that provides map tiles. An example would be: http://tile.openstreetmap.org/{zoomLevel}/{y}/{x}.png</string>
- </property>
- <property name="text">
- <string>http://</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="labelStaticUrlFormat">
<property name="text">
<string>Image Format:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="comboBoxStaticUrlFormat">
@@ -415,6 +405,19 @@
</item>
</layout>
</item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="comboBoxStaticUrlServer">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
--- trunk/KDE/kdeedu/marble/src/marble.kcfg #1213196:1213197
@@ -258,9 +258,12 @@
<default>true</default>
</entry>
</group>
- <group name="WmsService">
- <entry key="wmsServices" type="StringList" >
- <default>false</default>
+ <group name="MapWizard">
+ <entry key="wmsServers" type="StringList" >
+ <default></default>
</entry>
+ <entry key="staticUrlServers" type="StringList" >
+ <default></default>
+ </entry>
</group>
</kcfg>
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1213196:1213197
@@ -425,7 +425,8 @@
m_previousGraphicsSystem = m_initialGraphicsSystem;
// Map Wizard
- m_mapWizard->setWmsServers( MarbleSettings::wmsServices() );
+ m_mapWizard->setWmsServers( MarbleSettings::wmsServers() );
+ m_mapWizard->setStaticUrlServers( MarbleSettings::staticUrlServers() );
// Plugins
QHash<QString, int> pluginEnabled;
@@ -619,7 +620,8 @@
MarbleSettings::setDateTime( m_controlView->marbleWidget()->model()->clockDateTime() );
MarbleSettings::setSpeedSlider( m_controlView->marbleWidget()->model()->clockSpeed() );
- MarbleSettings::setWmsServices( m_mapWizard->wmsServers() );
+ MarbleSettings::setWmsServers( m_mapWizard->wmsServers() );
+ MarbleSettings::setStaticUrlServers( m_mapWizard->staticUrlServers() );
// Plugins
QList<int> pluginEnabled;
More information about the Marble-commits
mailing list