Large update. Added Video, Image and Live item views. Added Live search

This commit is contained in:
Digital Artifex
2026-08-05 19:58:24 -04:00
parent 5b2500c841
commit e5627742d2
46 changed files with 3416 additions and 578 deletions
@@ -40,7 +40,7 @@ public:
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_FEATURED)
);
controller()->setWindowSize(20);
controller()->setWindowSize(32);
}
};
+107 -36
View File
@@ -152,30 +152,121 @@ protected:
const QVariantMap sources = resultObject.value(QString::fromUtf8("src")).toObject().toVariantMap();
QMap<QString, QString> sourceMap;
QMap<QString, QString> sizeMap;
QMapIterator<QString,QVariant> sourceIterator(sources);
QString original;
while(sourceIterator.hasNext())
{
sourceIterator.next();
QString url = sourceIterator.value().toString();
sourceMap.insert(sourceIterator.key(), url);
auto matches = s_sizeExpression.match(url);
if(matches.hasMatch())
if(sourceIterator.key().toLower() == QString::fromUtf8("original"))
{
QString size = matches.captured();
size.remove(QString::fromUtf8("w="));
size.remove(QString::fromUtf8("h="));
size.replace(QLatin1Char('&'), QLatin1Char('x'));
sizeMap.insert(sourceIterator.key(), std::move(size));
original = sourceIterator.value().toString();
break;
}
}
QSize screenSize = CoreServices::screenSize();
QSize portraitSize(screenSize.height(),screenSize.width());
QSize landscapeSize(screenSize.width(),screenSize.height());
if(screenSize.height() > screenSize.width())
{
portraitSize = screenSize;
landscapeSize = QSize(screenSize.height(),screenSize.width());
}
sourceMap.clear();
sourceMap = QMap<QString,QString>
{
{
QString::fromUtf8("original"),
original
},
{
QString::fromUtf8("screen"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=%2&w=%3").arg(
original,
QString::number(screenSize.height()),
QString::number(screenSize.width())
)
},
{
QString::fromUtf8("portrait"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=%2&w=%3").arg(
original,
QString::number(portraitSize.height()),
QString::number(portraitSize.width())
)
},
{
QString::fromUtf8("landscape"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=%2&w=%3").arg(
original,
QString::number(landscapeSize.height()),
QString::number(landscapeSize.width())
)
},
{
QString::fromUtf8("backgroundPortrait"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=%2&w=%3").arg(
original,
QString::number(portraitSize.height() / 2),
QString::number(portraitSize.width() / 2)
)
},
{
QString::fromUtf8("backgroundLandscape"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=%2&w=%3").arg(
original,
QString::number(landscapeSize.height() / 2),
QString::number(landscapeSize.width() / 2)
)
},
{
QString::fromUtf8("thumbnail"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=144&w=256%3").arg(
original
)
},
{
QString::fromUtf8("largeThumbnail"),
QString::fromUtf8("%1?auto=compress&cs=tinysrgb&fit=crop&h=450&w=800%3").arg(
original
)
}
};
QMap<QString, QString> sizeMap =
{
{
QString::fromUtf8("original"),
QString()
},
{
QString::fromUtf8("screen"),
QString::fromUtf8("%1x%2").arg(
QString::number(screenSize.width()),
QString::number(screenSize.height())
)
},
{
QString::fromUtf8("portrait"),
QString::fromUtf8("%1x%2").arg(
QString::number(portraitSize.width()),
QString::number(portraitSize.height())
)
},
{
QString::fromUtf8("landscape"),
QString::fromUtf8("%1x%2").arg(
QString::number(landscapeSize.width()),
QString::number(landscapeSize.height())
)
}
};
fetchedResults.append(
{
resultObject.value(QString::fromUtf8("alt")).toString(),
@@ -214,8 +305,8 @@ protected:
auto getNetworkReply(const QNetworkRequest &request) const -> QNetworkReply*
{
QEventLoop loop;
QWeakPointer<QNetworkAccessManager> managerReference = CoreServices::networkAccessManager();
QWeakPointer<QNetworkAccessManager> managerReference = CoreServices::networkAccessManager();
QSharedPointer<QNetworkAccessManager> manager = managerReference.toStrongRef();
LOG_ERROR_X(!manager,
@@ -238,6 +329,8 @@ protected:
loop.exec();
}
manager.clear();
LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
"NewestPacksPaginator::getNetworkReply",
reply->errorString().toStdString().c_str(),
@@ -247,28 +340,6 @@ protected:
return reply;
}
/**
* @brief getDocument
* Extracts the JSON document from the server reply
* @param reply
* @return
*/
[[nodiscard]]
auto getDocument(QNetworkReply *reply) const -> QJsonDocument
{
QByteArray data = reply->readAll();
QJsonParseError documentError;
QJsonDocument document = QJsonDocument::fromJson(data, &documentError);
LOG_ERROR_X(documentError.error != QJsonParseError::NoError,
"NewestPacksPaginator::getDocument",
documentError.errorString().toStdString().c_str(),
{}
);
return document;
}
/**
* @brief setUri
* Sets the API Endpoint URI to fetch from
@@ -254,28 +254,6 @@ protected:
return reply;
}
/**
* @brief getDocument
* Extracts the JSON document from the server reply
* @param reply
* @return
*/
[[nodiscard]]
auto getDocument(QNetworkReply *reply) const -> QJsonDocument
{
QByteArray data = reply->readAll();
QJsonParseError documentError;
QJsonDocument document = QJsonDocument::fromJson(data, &documentError);
LOG_ERROR_X(documentError.error != QJsonParseError::NoError,
"NewestPacksPaginator::getDocument",
documentError.errorString().toStdString().c_str(),
{}
);
return document;
}
/**
* @brief setUri
* Sets the API Endpoint URI to fetch from
@@ -62,35 +62,35 @@ public:
return m_uri;
}
/**
* @brief query
* Current query string, if the API Endpoint supports queries
* @return
*/
[[nodiscard]]
auto query() const -> QString
{
return m_query;
}
// /**
// * @brief query
// * Current query string, if the API Endpoint supports queries
// * @return
// */
// [[nodiscard]]
// auto query() const -> QString
// {
// return m_query;
// }
/**
* @brief setQuery
* Sets the new query string and updates the controller
* @param query
*/
auto setQuery(const QString &query) -> void
{
if(query == m_query)
{
return;
}
// /**
// * @brief setQuery
// * Sets the new query string and updates the controller
// * @param query
// */
// auto setQuery(const QString &query) -> void
// {
// if(query == m_query)
// {
// return;
// }
m_query = query;
Q_EMIT queryChanged();
// m_query = query;
// Q_EMIT queryChanged();
reset();
setOffset(0);
}
// reset();
// setOffset(0);
// }
signals:
/**
@@ -120,7 +120,7 @@ protected:
{}
);
if(queryable() && query().isEmpty())
if(queryable() && query().isEmpty())
{
return {};
}
@@ -139,7 +139,7 @@ protected:
{
{
QByteArray("query"),
m_query.toUtf8()
query().toUtf8()
},
{
QByteArray("offset"),
@@ -303,11 +303,11 @@ private:
*/
QString m_uri;
/**
* @brief m_query
* The query string used in fetch operations
*/
QString m_query;
// /**
// * @brief m_query
// * The query string used in fetch operations
// */
// QString m_query;
};
#endif // WALLPAPERPAGINATOR_H