[libcalamares] Implement "raw" handling

This commit is contained in:
Adriaan de Groot 2019-05-09 10:40:51 -04:00
parent 9931b2df44
commit 4ea29b1cf1
2 changed files with 33 additions and 2 deletions

View File

@ -124,6 +124,16 @@ do_query( Handler::Type type, const QString& url, const QString& selector )
return interface->processReply( synchronous_get( url ) ); 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 RegionZonePair
Handler::get() const 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 } // namespace

View File

@ -77,8 +77,6 @@ public:
/// @brief Like query, but don't interpret the contents /// @brief Like query, but don't interpret the contents
QFuture< QString > queryRaw() const; QFuture< QString > queryRaw() const;
bool isValid() const { return m_type != Type::None; } bool isValid() const { return m_type != Type::None; }
Type type() const { return m_type; } Type type() const { return m_type; }