diff options
author | Adriaan de Groot <groot@kde.org> | 2019-05-09 10:40:51 -0400 |
---|---|---|
committer | Adriaan de Groot <groot@kde.org> | 2019-05-09 10:40:51 -0400 |
commit | 4ea29b1cf1c8a583126a71b0db2a60a2efb75897 (patch) | |
tree | d3894fefcbb67ec543cb6095538a4ac98b4c85a1 | |
parent | 9931b2df4448d17673c356c87b100ec6bdb19da8 (diff) |
[libcalamares] Implement "raw" handling
-rw-r--r-- | src/libcalamares/geoip/Handler.cpp | 33 | ||||
-rw-r--r-- | src/libcalamares/geoip/Handler.h | 2 |
2 files changed, 33 insertions, 2 deletions
diff --git a/src/libcalamares/geoip/Handler.cpp b/src/libcalamares/geoip/Handler.cpp index f98ac897d..7aa8ee701 100644 --- a/src/libcalamares/geoip/Handler.cpp +++ b/src/libcalamares/geoip/Handler.cpp @@ -124,6 +124,16 @@ do_query( Handler::Type type, const QString& url, const QString& selector ) return interface->processReply( synchronous_get( url ) ); } +static QString +do_raw_query( Handler::Type type, const QString& url, const QString& selector ) +{ + const auto interface = create_interface( type, selector ); + if ( !interface ) + return QString(); + + return interface->rawReply( synchronous_get( url ) ); +} + RegionZonePair Handler::get() const { @@ -146,4 +156,27 @@ Handler::query() const } ); } +QString +Handler::getRaw() const +{ + if ( !isValid() ) + return QString(); + return do_raw_query( m_type, m_url, m_selector ); +} + + +QFuture< QString > +Handler::queryRaw() const +{ + Handler::Type type = m_type; + QString url = m_url; + QString selector = m_selector; + + return QtConcurrent::run( [=] + { + return do_raw_query( type, url, selector ); + } ); +} + + } // namespace diff --git a/src/libcalamares/geoip/Handler.h b/src/libcalamares/geoip/Handler.h index b095c59ac..92e5f326e 100644 --- a/src/libcalamares/geoip/Handler.h +++ b/src/libcalamares/geoip/Handler.h @@ -77,8 +77,6 @@ public: /// @brief Like query, but don't interpret the contents QFuture< QString > queryRaw() const; - - bool isValid() const { return m_type != Type::None; } Type type() const { return m_type; } |