2015-09-04 14:37:01 +02:00
|
|
|
#ifndef ALPM_USER_REPOSITORY_H
|
|
|
|
#define ALPM_USER_REPOSITORY_H
|
|
|
|
|
2015-09-07 19:36:45 +02:00
|
|
|
#include "./alpm/package.h"
|
|
|
|
#include "./alpm/repository.h"
|
2015-09-04 14:37:01 +02:00
|
|
|
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
|
|
|
|
|
2015-09-05 17:25:05 +02:00
|
|
|
namespace RepoIndex {
|
2015-09-04 14:37:01 +02:00
|
|
|
|
|
|
|
class UserRepository;
|
|
|
|
|
|
|
|
class AurPackageReply : public PackageReply
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-09-29 21:52:30 +02:00
|
|
|
AurPackageReply(QNetworkReply *networkReply, const QStringList &requestedPackages, UserRepository *userRepo);
|
2015-09-05 17:25:05 +02:00
|
|
|
|
|
|
|
private slots:
|
2015-12-08 00:24:45 +01:00
|
|
|
void processData(QNetworkReply *reply);
|
2015-09-05 17:25:05 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
UserRepository *m_userRepo;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AurFullPackageReply : public PackageReply
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-09-29 21:52:30 +02:00
|
|
|
AurFullPackageReply(const QList<QNetworkReply *> &networkReplies, const QStringList &requestedPackages, UserRepository *userRepo);
|
2015-09-04 14:37:01 +02:00
|
|
|
|
|
|
|
private slots:
|
2015-12-08 00:24:45 +01:00
|
|
|
void processData(QNetworkReply *reply);
|
2015-09-04 14:37:01 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
UserRepository *m_userRepo;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AurSuggestionsReply : public SuggestionsReply
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-09-21 22:16:19 +02:00
|
|
|
AurSuggestionsReply(QNetworkReply *networkReply, const QString &term, UserRepository *repo);
|
2015-09-04 14:37:01 +02:00
|
|
|
|
|
|
|
private slots:
|
2015-12-08 00:24:45 +01:00
|
|
|
void processData(QNetworkReply *reply);
|
2015-09-04 14:37:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class UserRepository : public Repository
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
UserRepository(QNetworkAccessManager &networkAccessManager, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
RepositoryType type() const;
|
|
|
|
|
|
|
|
static const QUrl aurRpcUrl();
|
|
|
|
static void setAurRpcUrl(const QUrl &aurRpcUrl);
|
|
|
|
|
2015-09-05 17:25:05 +02:00
|
|
|
PackageDetailAvailability requestsRequired(PackageDetail packageDetail) const;
|
2015-09-27 19:29:45 +02:00
|
|
|
AurSuggestionsReply *requestSuggestions(const QString &term);
|
|
|
|
AurPackageReply *requestPackageInfo(const QStringList &packageNames, bool forceUpdate = false);
|
|
|
|
AurFullPackageReply *requestFullPackageInfo(const QStringList &packageNames, bool forceUpdate = false);
|
2015-09-04 14:37:01 +02:00
|
|
|
|
2015-09-11 21:59:47 +02:00
|
|
|
protected:
|
|
|
|
std::unique_ptr<Package> emptyPackage();
|
|
|
|
|
2015-09-04 14:37:01 +02:00
|
|
|
private:
|
2015-09-05 17:25:05 +02:00
|
|
|
QNetworkAccessManager &m_networkAccessManager;
|
2015-12-08 00:24:45 +01:00
|
|
|
QSet<QString> m_requestedSuggestions;
|
2015-10-28 19:55:36 +01:00
|
|
|
static QString m_aurBaseUrl;
|
2015-09-04 14:37:01 +02:00
|
|
|
static QUrl m_aurRpcUrl;
|
|
|
|
static QUrl m_aurPkgbuildUrl;
|
|
|
|
static QUrl m_aurSrcInfoUrl;
|
2015-09-05 17:25:05 +02:00
|
|
|
static QString m_aurSnapshotPath;
|
2015-09-04 14:37:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline const QUrl UserRepository::aurRpcUrl()
|
|
|
|
{
|
|
|
|
return m_aurRpcUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void UserRepository::setAurRpcUrl(const QUrl &aur4Url)
|
|
|
|
{
|
|
|
|
m_aurRpcUrl = aur4Url;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Alpm
|
|
|
|
|
|
|
|
#endif // ALPM_USER_REPOSITORY_H
|