Commit 056a8628 authored by LordTermor's avatar LordTermor

Fixed build. Termporary removed snap plugin support code

parent f453bef8
#pragma once
#include <QObject>
#include <pamac.h>
#include <Package.h>
#include <Utils.h>
namespace LibQPamac {
......
#pragma once
#include <pamac.h>
#include <QObject>
#include <SnapPackage.h>
namespace LibQPamac {
class SnapPlugin: public QObject {
Q_OBJECT
public:
explicit SnapPlugin(QObject* parent = nullptr);
Q_INVOKABLE QList<SnapPackage> searchSnaps(const QString& searchString ){
return Utils::gListToQList<SnapPackage>(pamac_snap_plugin_search_snaps(m_handle,searchString.toUtf8()),SnapPackage::fromData);
}
Q_INVOKABLE bool isInstalledSnap(const QString& name){
return pamac_snap_plugin_is_installed_snap(m_handle, name.toUtf8());
}
Q_INVOKABLE QList<SnapPackage> getInstalledSnaps(){
return Utils::gListToQList<SnapPackage>(pamac_snap_plugin_get_installed_snaps(m_handle),SnapPackage::fromData);
}
Q_INVOKABLE QList<SnapPackage> getCategorySnaps(const QString& category){
return Utils::gListToQList<SnapPackage>(pamac_snap_plugin_get_category_snaps(m_handle,category.toUtf8()),SnapPackage::fromData);
}
protected:
PamacSnapPlugin* m_handle;
};
} // namespace LibQPamac
......@@ -22,23 +22,23 @@ public:
TransactionSummary(PamacTransactionSummary* s):summary(s){}
TransactionSummary()=default;
QVariantList toInstall() const{
return Utils::gListToQList<QVariant>(pamac_transaction_summary_get_to_install(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
return Utils::gSListToQList<QVariant>(pamac_transaction_summary_get_to_install(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
}
QVariantList toRemove() const
{
return Utils::gListToQList<QVariant>(pamac_transaction_summary_get_to_remove(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
return Utils::gSListToQList<QVariant>(pamac_transaction_summary_get_to_remove(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
}
QVariantList toReinstall() const
{
return Utils::gListToQList<QVariant>(pamac_transaction_summary_get_to_reinstall(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
return Utils::gSListToQList<QVariant>(pamac_transaction_summary_get_to_reinstall(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
}
QVariantList toBuild() const
{
return Utils::gListToQList<QVariant>(pamac_transaction_summary_get_to_build(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
return Utils::gSListToQList<QVariant>(pamac_transaction_summary_get_to_build(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
}
QVariantList toUpgrade() const
{
return Utils::gListToQList<QVariant>(pamac_transaction_summary_get_to_upgrade(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
return Utils::gSListToQList<QVariant>(pamac_transaction_summary_get_to_upgrade(summary),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(Package));
}
private:
PamacTransactionSummary* summary;
......
......@@ -13,10 +13,10 @@ public:
Updates()=default;
Updates(PamacUpdates* upd):m_updates(std::shared_ptr<PamacUpdates>(upd,g_object_unref)){}
inline Q_INVOKABLE QVariantList getReposUpdates(){
return Utils::gListToQList<QVariant>(pamac_updates_get_repos_updates(m_updates.get()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return Utils::gSListToQList<QVariant>(pamac_updates_get_repos_updates(m_updates.get()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
inline Q_INVOKABLE QVariantList getAurUpdates(){
return Utils::gListToQList<QVariant>(pamac_updates_get_aur_updates(m_updates.get()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AurPackage));
return Utils::gSListToQList<QVariant>(pamac_updates_get_aur_updates(m_updates.get()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AurPackage));
}
private:
std::shared_ptr<PamacUpdates> m_updates;
......
......@@ -76,7 +76,7 @@ namespace LibQPamac::Utils{
{\
QStringList result;\
auto tmp = method;\
for(auto el = g_list_first(tmp);el!=nullptr;el=el->next){\
for(auto el = tmp;el!=nullptr;el=el->next){\
result.append((QString::fromUtf8(static_cast<char*>(el->data))));\
}\
return result;\
......@@ -100,10 +100,10 @@ std::vector<char*> qStringListToCStringVector(const QStringList&);
QStringList cStringArrayToQStringList(char** arr,int size);
GList* qVariantListToGList(const QVariantList& lst);
GVariant* qVariantToGVariant(const QVariant&);
QStringList gListToQStringList(GList* lst,bool freeOriginal = false);
QStringList gsListToQStringList(GSList* lst,bool freeOriginal = false);
template <typename T>
QList<T> gListToQList(GList* list,std::function<T(void*)> wrapFunction,GDestroyNotify freeFunc = nullptr)
QList<T> gSListToQList(GSList* list,std::function<T(void*)> wrapFunction,GDestroyNotify freeFunc = nullptr)
{
QList<T> result;
for(auto el = list;el!=nullptr;el=el->next)
......@@ -112,7 +112,7 @@ QList<T> gListToQList(GList* list,std::function<T(void*)> wrapFunction,GDestroyN
}
if(freeFunc){
g_list_free_full(list,freeFunc);
g_slist_free_full(list,freeFunc);
}
return result;
......
......@@ -25,51 +25,51 @@ Database::Database(const QString& configFile, QObject *parent):
QStringList Database::getRepos()
{
return Utils::gListToQStringList(pamac_database_get_repos_names(handle),true);
return Utils::gsListToQStringList(pamac_database_get_repos_names(handle),true);
}
QStringList Database::getGroups()
{
return Utils::gListToQStringList(pamac_database_get_groups_names(handle),true);
return Utils::gsListToQStringList(pamac_database_get_groups_names(handle),true);
}
QVariantList Database::searchPkgsInAur(const QString &name)
{
return Utils::gListToQList<QVariant>(pamac_database_search_aur_pkgs(handle,name.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AurPackage));
return Utils::gSListToQList<QVariant>(pamac_database_search_aur_pkgs(handle,name.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AurPackage));
}
QVariantList Database::getCategoryPackages(const QString &category)
{
return Utils::gListToQList<QVariant>(pamac_database_get_category_pkgs(handle,category.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return Utils::gSListToQList<QVariant>(pamac_database_get_category_pkgs(handle,category.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
QVariantList Database::searchPkgs(const QString &name)
{
return Utils::gListToQList<QVariant>(pamac_database_search_pkgs(handle,name.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return Utils::gSListToQList<QVariant>(pamac_database_search_pkgs(handle,name.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
QVariantList Database::getGroupPackages(const QString &group)
{
return Utils::gListToQList<QVariant>(pamac_database_get_group_pkgs(handle,group.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return Utils::gSListToQList<QVariant>(pamac_database_get_group_pkgs(handle,group.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
QVariantList Database::getRepoPackages(const QString &repo)
{
return Utils::gListToQList<QVariant>(pamac_database_get_repo_pkgs(handle,repo.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return Utils::gSListToQList<QVariant>(pamac_database_get_repo_pkgs(handle,repo.toUtf8()),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
QVariantList Database::getInstalledApps(){
return Utils::gListToQList<QVariant>(pamac_database_get_installed_apps(handle),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return Utils::gSListToQList<QVariant>(pamac_database_get_installed_apps(handle),PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
QStringList Database::getPkgFiles(const QString &name){
return Utils::gListToQStringList(pamac_database_get_pkg_files(handle,name.toUtf8()),true);
return Utils::gsListToQStringList(pamac_database_get_pkg_files(handle,name.toUtf8()),true);
}
QStringList Database::getMirrorsCountries(){
QStringList result = Utils::gListToQStringList(pamac_database_get_mirrors_countries(handle),true);
QStringList result = Utils::gsListToQStringList(pamac_database_get_mirrors_countries(handle),true);
result.push_front("Worldwide");
return result;
}
......@@ -148,7 +148,7 @@ void Database::init()
}
QVariantList LibQPamac::Database::getInstalledPackages(Database::InstalledPackageTypes type){
GList* result;
GSList* result;
switch (type) {
case Installed:
result = pamac_database_get_installed_pkgs(handle);
......@@ -164,7 +164,7 @@ QVariantList LibQPamac::Database::getInstalledPackages(Database::InstalledPackag
break;
}
return LibQPamac::Utils::gListToQList<QVariant>(result,PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
return LibQPamac::Utils::gSListToQList<QVariant>(result,PAMAC_QT_PACKAGE_TO_VARIANT_WRAP(AlpmPackage));
}
......
#include <SnapPlugin.h>
LibQPamac::SnapPlugin::SnapPlugin(QObject *parent)
:QObject(parent)
{
}
......@@ -66,7 +66,7 @@ GVariant *LibQPamac::Utils::qVariantToGVariant(const QVariant& value)
}
}
QStringList LibQPamac::Utils::gListToQStringList(GList *list,bool freeOriginal)
QStringList LibQPamac::Utils::gsListToQStringList(GSList *list,bool freeOriginal)
{
QStringList result;
for(auto el = list;el!=nullptr;el=el->next)
......@@ -75,7 +75,7 @@ QStringList LibQPamac::Utils::gListToQStringList(GList *list,bool freeOriginal)
}
if(freeOriginal){
g_list_free_full(list,g_free);
g_slist_free_full(list,g_free);
}
return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment