[libcalamares] Implement "raw" handling
This commit is contained in:
parent
9931b2df44
commit
4ea29b1cf1
@ -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
|
||||
|
@ -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; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user