[locale] Refactor GeoIP handler
- Move GeoIP to its own cpp file - Provide a default implementation of the URL mangler
This commit is contained in:
parent
445f181cc3
commit
c0d5a153d4
@ -4,6 +4,7 @@ calamares_add_plugin( locale
|
||||
TYPE viewmodule
|
||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||
SOURCES
|
||||
GeoIP.cpp
|
||||
GeoIPFreeGeoIP.cpp
|
||||
LCLocaleDialog.cpp
|
||||
LocaleConfiguration.cpp
|
||||
|
29
src/modules/locale/GeoIP.cpp
Normal file
29
src/modules/locale/GeoIP.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GeoIP.h"
|
||||
|
||||
GeoIP::~GeoIP()
|
||||
{
|
||||
}
|
||||
|
||||
QUrl
|
||||
GeoIP::fullUrl(const QString& configUrl)
|
||||
{
|
||||
return QUrl::fromUserInput( configUrl );
|
||||
}
|
@ -41,8 +41,10 @@ struct GeoIP
|
||||
* Some GeoIP providers are configured with one URL, but actually
|
||||
* do retrieval with another (e.g. when using the original
|
||||
* implementation of FreeGeoIP, or when adding an API key).
|
||||
*
|
||||
* The default implementation uses the @p configUrl unchanged.
|
||||
*/
|
||||
virtual QUrl fullUrl( const QString& configUrl ) = 0;
|
||||
virtual QUrl fullUrl( const QString& configUrl );
|
||||
|
||||
/** @brief Handle a (successful) request by interpreting the data.
|
||||
*
|
||||
@ -55,7 +57,7 @@ struct GeoIP
|
||||
*/
|
||||
virtual RegionZonePair processReply( QNetworkReply* ) = 0;
|
||||
|
||||
virtual ~GeoIP(); // Defined in LocaleViewStep
|
||||
virtual ~GeoIP();
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
@ -270,9 +270,3 @@ LocaleViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_geoipUrl = configurationMap.value( "geoipUrl" ).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Defined here since the struct has nothing else in it
|
||||
GeoIP::~GeoIP()
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user