aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/Qt/CMakeLists.txt8
-rw-r--r--src/Qt/helper.cpp28
-rw-r--r--src/Qt/helper.h5
-rw-r--r--src/Qt/qportage.cpp178
-rw-r--r--src/Qt/qportage.h67
6 files changed, 282 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 149d05d..e9823d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,4 @@ cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${c-portage_SOURCE_DIR}/cmake)
find_package(PortageApi REQUIRED)
-install(DIRECTORY src/ DESTINATION include/c-portage
- FILES_MATCHING PATTERN "*.h")
-
add_subdirectory(src)
diff --git a/src/Qt/CMakeLists.txt b/src/Qt/CMakeLists.txt
index b2849e8..d673e61 100644
--- a/src/Qt/CMakeLists.txt
+++ b/src/Qt/CMakeLists.txt
@@ -1,9 +1,9 @@
find_package(Qt4 REQUIRED)
-include_directories(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
+include_directories(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ..)
remove_definitions(-std=c99)
-set(cpp-portage_SRCS qportagesettings.cpp qpackageproperties.cpp qlistconverter.cpp)
-set(cpp-portage_HDRS qportagesettings.h qpackageproperties.h qlistconverter.h)
+set(cpp-portage_SRCS helper.cpp qportage.cpp qportagesettings.cpp qpackageproperties.cpp qlistconverter.cpp)
+set(cpp-portage_HDRS helper.h qportage.h qportagesettings.h qpackageproperties.h qlistconverter.h)
QT4_WRAP_CPP(cpp-portage_MOC_SRCS ${cpp-portage_HDRS})
@@ -13,4 +13,4 @@ target_link_libraries(cpp-portage c-portage ${QT_QTCORE_LIBRARY})
install(TARGETS cpp-portage DESTINATION lib)
install(FILES ${cpp-portage_HDRS} DESTINATION include/cpp-portage)
-add_subdirectory(tests) \ No newline at end of file
+add_subdirectory(tests)
diff --git a/src/Qt/helper.cpp b/src/Qt/helper.cpp
new file mode 100644
index 0000000..93a00fe
--- /dev/null
+++ b/src/Qt/helper.cpp
@@ -0,0 +1,28 @@
+#include "helper.h"
+#include <stringlist.h>
+
+QStringList CListToQStringList(StringList *clist)
+{
+ QStringList list;
+
+ for (int i=0; i<stringListCount(clist); i++) {
+ list << stringListGetAt(clist, i);
+ }
+
+ return list;
+}
+
+StringList* QStringListToCList(const QStringList &list)
+{
+ StringList *clist;
+
+ clist = stringListCreate(list.count());
+
+ if (clist) { // Not null
+ for (int i=0; i<list.count(); i++) {
+ stringListInsertAt(clist, i, list.at(i).toUtf8().data());
+ }
+ }
+
+ return clist;
+}
diff --git a/src/Qt/helper.h b/src/Qt/helper.h
new file mode 100644
index 0000000..b45c14a
--- /dev/null
+++ b/src/Qt/helper.h
@@ -0,0 +1,5 @@
+#include <QStringList>
+#include <stringlist.h>
+
+QStringList CListToQStringList(StringList *);
+StringList* QStringListToCList(const QStringList&); \ No newline at end of file
diff --git a/src/Qt/qportage.cpp b/src/Qt/qportage.cpp
new file mode 100644
index 0000000..bf313ea
--- /dev/null
+++ b/src/Qt/qportage.cpp
@@ -0,0 +1,178 @@
+/*
+ <one line to give the library's name and an idea of what it does.>
+ Copyright (C) 2011 Θεόφιλος Ιντζόγλου <int.teo@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+
+#include "helper.h"
+#include "qportage.h"
+#include <stringlist.h>
+#include <dataconnect.h>
+
+namespace CppPortage {
+
+portage::portage(QObject* parent): QObject(parent)
+{
+
+}
+
+portage::~portage()
+{
+
+}
+
+QString portage::bestVersion(QStringList )
+{
+
+}
+
+QStringList portage::getAllNodes()
+{
+ StringList *clist;
+ QStringList strlist;
+
+ clist = portageGetAllNodes();
+ strlist = CListToQStringList(clist);
+ stringListFree(clist);
+
+ return strlist;
+}
+
+QString portage::getBestEbuild(const QString& )
+{
+
+}
+
+QString portage::getDepEbuild(const QString& )
+{
+
+}
+
+int portage::getHardMasked(const QString& , QStringList& , QStringList& )
+{
+
+}
+
+QStringList portage::getInstalledFiles(const QString &package)
+{
+ StringList *clist;
+ QStringList strlist;
+
+ clist = portageGetInstalledFiles(package.toUtf8().data());
+ strlist = CListToQStringList(clist);
+ stringListFree(clist);
+
+ return strlist;
+}
+
+QStringList portage::getInstalledList()
+{
+ StringList *clist;
+ QStringList strlist;
+
+ clist = portageGetInstalledList();
+ strlist = CListToQStringList(clist);
+ stringListFree(clist);
+
+ return strlist;
+}
+
+QString portage::getMaskingReason(const QString& )
+{
+
+}
+
+QStringList portage::getMaskingStatus(const QString& )
+{
+
+}
+
+QString portage::getOverlay(const QString& )
+{
+
+}
+
+QString portage::getOverlayNameFromPath(const QString& )
+{
+
+}
+
+QString portage::getOverlayNameFromPkg(const QString& )
+{
+
+}
+
+long int portage::getPackageSizeInt(const QString& )
+{
+
+}
+
+QString portage::getPackageSizeString(const QString& )
+{
+
+}
+
+QString portage::getPath(const QString &package, int )
+{
+
+}
+
+PackageProperties* portage::getProperties(const QString &package)
+{
+ return portageGetProperties(package.toUtf8().data());
+}
+
+QStringList portage::getResolvedPkgs()
+{
+ StringList *clist;
+ QStringList strlist;
+
+ clist = portageGetResolvedPkgs();
+ strlist = CListToQStringList(clist);
+ stringListFree(clist);
+
+ return strlist;
+}
+
+QStringList portage::getUnresolvedPkgs()
+{
+ StringList *clist;
+ QStringList strlist;
+
+ clist = portageGetUnresolvedPkgs();
+ strlist = CListToQStringList(clist);
+ stringListFree(clist);
+
+ return strlist;
+}
+
+QStringList portage::getVersions(const QString &package, bool include_masked)
+{
+ StringList *clist = portageGetVersions(package.toUtf8().data(), include_masked);
+ QStringList strlist = CListToQStringList(clist);
+ stringListFree(clist);
+
+ return strlist;
+}
+
+bool portage::isOverlay(const QString &package)
+{
+ return portageIsOverlay(package.toUtf8().data());
+}
+
+
+} // End of namespace \ No newline at end of file
diff --git a/src/Qt/qportage.h b/src/Qt/qportage.h
new file mode 100644
index 0000000..8cdd7b3
--- /dev/null
+++ b/src/Qt/qportage.h
@@ -0,0 +1,67 @@
+/*
+ <one line to give the library's name and an idea of what it does.>
+ Copyright (C) 2011 Θεόφιλος Ιντζόγλου <int.teo@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+
+#ifndef QPORTAGE_H
+#define QPORTAGE_H
+
+#include <QObject>
+#include <QStringList>
+
+class PackageProperties;
+
+namespace CppPortage {
+
+class portage : public QObject
+{
+ Q_OBJECT
+
+ explicit portage(QObject* parent = 0);
+ virtual ~portage();
+
+ QStringList getVersions(const QString&, bool);
+ int getHardMasked(const QString&, QStringList&, QStringList&);
+ QStringList getInstalledFiles(const QString&);
+
+ QString bestVersion(QStringList);
+ QString getBestEbuild(const QString&);
+ QString getDepEbuild(const QString&);
+
+ QStringList getMaskingStatus(const QString&);
+ QString getMaskingReason(const QString&);
+
+ long int getPackageSizeInt(const QString&);
+ QString getPackageSizeString(const QString&);
+ PackageProperties* getProperties(const QString&);
+ bool isOverlay(const QString&);
+ QString getOverlay(const QString&);
+ QString getOverlayNameFromPath(const QString&);
+ QString getOverlayNameFromPkg(const QString&);
+ QString getPath(const QString&, int);
+
+ QStringList getResolvedPkgs();
+ QStringList getUnresolvedPkgs();
+ QStringList getAllNodes();
+ QStringList getInstalledList();
+
+}; // End of class
+
+} // End of namespace
+
+#endif // QPORTAGE_H