Package: packagesearch Version: 2.5 Severity: wishlist Tags: patch Hello,
I am preparing a new version of libept after quite aggressively simplifying its code. I'm now testing its reverse dependencies to see how the libept changes impact their code and functions. I'm posting here, for reference, the patch needed to make packagesearch work with the version of libept I just committed to the libept git repo. There is no functionality loss in packagesearch, just the code got a bit simpler. When I'm ready to upload libept 1.0, we can then followup with the packagesearch update. Ciao, Enrico -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages packagesearch depends on: ii apt [libapt-pkg-libc6.9 0.7.25.3 Advanced front-end for dpkg ii debtags 1.7.10 Enables support for package tags ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib ii libept1 1.0 High-level library for managing De ii libgcc1 1:4.4.2-9 GCC support library ii libqt4-xml 4:4.6.2-4 Qt 4 XML module ii libqtcore4 4:4.6.2-4 Qt 4 core module ii libqtgui4 4:4.6.2-4 Qt 4 GUI module ii libstdc++6 4.4.2-9 The GNU Standard C++ Library v3 ii libxapian15 1.0.19-1 Search engine library ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime Versions of packages packagesearch recommends: ii apt-file 2.3.3 search for files within Debian pac ii deborphan 1.7.28 program that can find unused packa ii gnome-terminal [x-terminal-em 2.30.0-1 The GNOME terminal emulator applic ii lxterminal [x-terminal-emulat 0.1.7-1 desktop independent vte-based term ii xterm [x-terminal-emulator] 256-1 X terminal emulator packagesearch suggests no packages. -- no debconf information
diff --git a/debian/control b/debian/control index 227536c..13a71f1 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: packagesearch Section: admin Priority: optional Maintainer: Benjamin Mesing <[email protected]> -Build-Depends: debhelper (>= 7.0.0), libept-dev (>= 0.5.26), libept-dev (<< 0.6), libqt4-dev, qt4-dev-tools, docbook-to-man, pkg-config, libwibble-dev (>= 0.1), libwibble-dev (<< 0.2), libtagcoll2-dev (>= 2.0), libtagcoll2-dev (<< 2.1) +Build-Depends: debhelper (>= 7.0.0), libept-dev (>= 1.0), libept-dev (<< 2), libqt4-dev, qt4-dev-tools, docbook-to-man, pkg-config, libwibble-dev (>= 0.1), libwibble-dev (<< 0.2), libtagcoll2-dev (>= 2.0), libtagcoll2-dev (<< 2.1) Standards-Version: 3.8.3.0 Vcs-Svn: https://packagesearch.svn.sourceforge.net/svnroot/packagesearch diff --git a/src/iprovider.h b/src/iprovider.h index b155f1d..9513b01 100644 --- a/src/iprovider.h +++ b/src/iprovider.h @@ -113,6 +113,8 @@ public: virtual const ept::apt::Apt& apt() const = 0; /** Returns a reference to the debtags object. */ virtual const ept::debtags::Debtags& debtags() const = 0; + /** Returns a reference to the debtags vocabulary object. */ + virtual const ept::debtags::Vocabulary& vocabulary() const = 0; /** Returns a reference to the debtags object. */ virtual const ept::textsearch::TextSearch& textsearch() const = 0; diff --git a/src/packagesearchimpl.cpp b/src/packagesearchimpl.cpp index 9730f13..12b9e2c 100644 --- a/src/packagesearchimpl.cpp +++ b/src/packagesearchimpl.cpp @@ -41,6 +41,7 @@ #include <ept/apt/apt.h> #include <ept/debtags/debtags.h> +#include <ept/debtags/vocabulary.h> #include <ept/textsearch/textsearch.h> @@ -102,6 +103,7 @@ PackageSearchImpl::PackageSearchImpl( QWidget* parent, const char* name, Qt::WFl _pApt = new ept::apt::Apt; _pDebtags = new ept::debtags::Debtags; + _pVocabulary = new ept::debtags::Vocabulary; _pTextsearch = new ept::textsearch::TextSearch; // set up what's this actions @@ -172,6 +174,7 @@ PackageSearchImpl::~PackageSearchImpl() delete _pScoreDisplayPlugin; delete _pApt; delete _pDebtags; + delete _pVocabulary; delete _pTextsearch; } diff --git a/src/packagesearchimpl.h b/src/packagesearchimpl.h index 6bc5d3d..bb0db55 100644 --- a/src/packagesearchimpl.h +++ b/src/packagesearchimpl.h @@ -117,6 +117,7 @@ public: virtual void reloadAptFrontCache(); const ept::apt::Apt& apt() const { return *_pApt; } const ept::debtags::Debtags& debtags() const { return *_pDebtags; } + const ept::debtags::Vocabulary& vocabulary() const { return *_pVocabulary; } const ept::textsearch::TextSearch& textsearch() const { return *_pTextsearch; } //@} /** @name IPluginUser interface @@ -288,6 +289,7 @@ private: ept::apt::Apt* _pApt; ept::debtags::Debtags* _pDebtags; + ept::debtags::Vocabulary* _pVocabulary; ept::textsearch::TextSearch* _pTextsearch; QString _iconDir; QString _docDir; diff --git a/src/plugins/debtagsplugin/debtagshelper.cpp b/src/plugins/debtagsplugin/debtagshelper.cpp index e070092..453198b 100644 --- a/src/plugins/debtagsplugin/debtagshelper.cpp +++ b/src/plugins/debtagsplugin/debtagshelper.cpp @@ -19,12 +19,7 @@ namespace NUtil std::set<Tag> stringsToTags(const set<string>& tags, const Vocabulary& vocabulary) { - std::set<Tag> result; - for (set<string>::const_iterator it = tags.begin(); it != tags.end(); ++it) - { - result.insert(vocabulary.tagByName(*it)); - } - return result; + return tags; } } // namespace NUtil diff --git a/src/plugins/debtagsplugin/debtagshelper.h b/src/plugins/debtagsplugin/debtagshelper.h index bcb6a30..00eb6e1 100644 --- a/src/plugins/debtagsplugin/debtagshelper.h +++ b/src/plugins/debtagsplugin/debtagshelper.h @@ -15,7 +15,6 @@ #include <string> -#include <ept/debtags/tag.h> #include <ept/apt/apt.h> using namespace std; @@ -34,7 +33,7 @@ namespace NUtil { typedef std::string Package; -typedef ept::debtags::Tag Tag; +typedef std::string Tag; typedef ept::debtags::Debtags Debtags; typedef ept::debtags::Vocabulary Vocabulary; @@ -60,12 +59,7 @@ inline std::set<string> packagesToStrings(const set<Package>& packages) */ inline std::set<string> tagsToStrings(const set<Tag>& tags) { - std::set<string> result; - for (set<Tag>::const_iterator it = tags.begin(); it != tags.end(); ++it) - { - result.insert(it->fullname()); - } - return result; + return tags; } /** Collects the tags from the given vocabulary diff --git a/src/plugins/debtagsplugin/debtagsplugin.cpp b/src/plugins/debtagsplugin/debtagsplugin.cpp index 3ff26fb..b16b0a8 100644 --- a/src/plugins/debtagsplugin/debtagsplugin.cpp +++ b/src/plugins/debtagsplugin/debtagsplugin.cpp @@ -37,7 +37,7 @@ #include "vocabularymodel.h" typedef std::string Package; -typedef ept::debtags::Tag Tag; +typedef std::string Tag; using namespace std; @@ -186,7 +186,7 @@ std::string DebtagsPlugin::createSearchExpression() else first = false; - oexpr << it->fullname(); + oexpr << *it; } // the list view that displays the selected tags // set<Tag> excludeTags = fill in here; diff --git a/src/plugins/debtagsplugin/debtagsplugincontainer.cpp b/src/plugins/debtagsplugin/debtagsplugincontainer.cpp index 6815c2f..e248969 100644 --- a/src/plugins/debtagsplugin/debtagsplugincontainer.cpp +++ b/src/plugins/debtagsplugin/debtagsplugincontainer.cpp @@ -10,7 +10,6 @@ #include <wibble/operators.h> #include <ept/debtags/debtags.h> -#include <ept/debtags/tag.h> #include "debtagsplugincontainer.h" @@ -165,14 +164,14 @@ QDomElement DebtagsPluginContainer::loadContainerSettings(const QDomElement sour void DebtagsPluginContainer::saveContainerSettings(NXml::XmlData& outData, QDomElement parent) const { qDebug("saveContainerSettings called"); - typedef ept::debtags::Facet Facet; + typedef std::string Facet; QDomElement containerElement = outData.addElement(parent, "ContainerSettings"); outData.addAttribute(containerElement, 0.1f, "settingsVersion"); set<Facet> hiddenFacets = _pVocabularyModel->hiddenFacets(); for (set<Facet>::const_iterator it = hiddenFacets.begin(); it != hiddenFacets.end(); ++it) { QDomElement hiddenFacetElement = outData.addElement(containerElement, "HiddenFacet"); - outData.addText(hiddenFacetElement, it->name()); + outData.addText(hiddenFacetElement, *it); } } @@ -273,9 +272,14 @@ const ept::debtags::Debtags* DebtagsPluginContainer::collection() const return &(provider()->debtags()); } +const ept::debtags::Vocabulary* DebtagsPluginContainer::vocabulary() const +{ + return &(provider()->vocabulary()); +} + const std::set<DebtagsPluginContainer::Facet> DebtagsPluginContainer::facets() const { - const Vocabulary& tags = provider()->debtags().vocabulary(); + const Vocabulary& tags = provider()->vocabulary(); return tags.facets(); } diff --git a/src/plugins/debtagsplugin/debtagsplugincontainer.h b/src/plugins/debtagsplugin/debtagsplugincontainer.h index bc77798..59ee138 100644 --- a/src/plugins/debtagsplugin/debtagsplugincontainer.h +++ b/src/plugins/debtagsplugin/debtagsplugincontainer.h @@ -14,7 +14,6 @@ using namespace std; namespace ept { namespace debtags { -class Facet; class Debtags; class Vocabulary; } @@ -48,7 +47,7 @@ class DebtagsPluginContainer : public QObject, public BasePluginContainer { Q_OBJECT - typedef ept::debtags::Facet Facet; + typedef std::string Facet; typedef ept::debtags::Debtags Debtags; typedef ept::debtags::Vocabulary Vocabulary; @@ -122,6 +121,7 @@ public: * Every item (package) appears only ones in the collection. */ const Debtags* collection() const; + const Vocabulary* vocabulary() const; /** @brief Returns a pointer to the model used to store the information about the vocabulary * * This information includes selected tags, hidden facets and possibly more. diff --git a/src/plugins/debtagsplugin/debtagssettingswidget.cpp b/src/plugins/debtagsplugin/debtagssettingswidget.cpp index b8eb7c0..094ae6d 100644 --- a/src/plugins/debtagsplugin/debtagssettingswidget.cpp +++ b/src/plugins/debtagsplugin/debtagssettingswidget.cpp @@ -34,7 +34,7 @@ DebtagsSettingsWidget::DebtagsSettingsWidget(NTagModel::VocabularyModel* pModel, using namespace wibble::operators; typedef NTagModel::FilterHiddenProxyModel FilterHiddenProxyModel; typedef ept::debtags::Vocabulary Vocabulary; - typedef ept::debtags::Facet Facet; + typedef std::string Facet; if (name) setObjectName(name); diff --git a/src/plugins/debtagsplugin/emptytagfilter.h b/src/plugins/debtagsplugin/emptytagfilter.h index aeb16ac..4ad181f 100644 --- a/src/plugins/debtagsplugin/emptytagfilter.h +++ b/src/plugins/debtagsplugin/emptytagfilter.h @@ -18,7 +18,6 @@ namespace ept { namespace debtags { -class Tag; class Debtags; } } @@ -46,7 +45,7 @@ class EmptyTagFilter : public QSortFilterProxyModel { Q_OBJECT - typedef ept::debtags::Tag Tag; + typedef std::string Tag; typedef ept::debtags::Debtags Debtags; /** The model holding the information about the selected tags. diff --git a/src/plugins/debtagsplugin/relatedplugin.h b/src/plugins/debtagsplugin/relatedplugin.h index c3a1a79..8a1eec4 100644 --- a/src/plugins/debtagsplugin/relatedplugin.h +++ b/src/plugins/debtagsplugin/relatedplugin.h @@ -13,12 +13,6 @@ #include <scoreplugin.h> #include <debtagsplugincontainer.h> -namespace ept { -namespace debtags { -class Tag; -} -} - class QMainWindow; class RelatedInput; @@ -43,7 +37,7 @@ class RelatedPlugin : public SearchPlugin, public ScorePlugin Q_OBJECT typedef std::string Package; - typedef ept::debtags::Tag Tag; + typedef std::string Tag; public: static const QString PLUGIN_NAME; RelatedPlugin(const DebtagsPluginContainer& container); diff --git a/src/plugins/debtagsplugin/selectioninputanddisplay.cpp b/src/plugins/debtagsplugin/selectioninputanddisplay.cpp index 131d1e1..5d3f454 100644 --- a/src/plugins/debtagsplugin/selectioninputanddisplay.cpp +++ b/src/plugins/debtagsplugin/selectioninputanddisplay.cpp @@ -35,8 +35,8 @@ using namespace wibble::operators; namespace NWidgets { -typedef ept::debtags::Facet Facet; -typedef ept::debtags::Tag Tag; +typedef std::string Facet; +typedef std::string Tag; SelectionInputAndDisplay::SelectionInputAndDisplay(const NPlugin::DebtagsPluginContainer* pContainer, NTagModel::VocabularyModel* pModel, QObject* pParent) diff --git a/src/plugins/debtagsplugin/selectioninputanddisplay.h b/src/plugins/debtagsplugin/selectioninputanddisplay.h index d0f0e98..6192038 100644 --- a/src/plugins/debtagsplugin/selectioninputanddisplay.h +++ b/src/plugins/debtagsplugin/selectioninputanddisplay.h @@ -13,8 +13,7 @@ #define __SELECTIONINPUTANDDISPLAY_H_2004_06_28 #include <QObject> - -#include <ept/debtags/tag.h> +#include <set> class QAbstractItemView; class QLabel; @@ -67,8 +66,8 @@ Q_OBJECT NTagModel::VocabularyModel* _pModel; - typedef ept::debtags::Facet Facet; - typedef ept::debtags::Tag Tag; + typedef std::string Facet; + typedef std::string Tag; /** @brief The label shown above #_pTagView. */ QLabel* _pViewLabel; diff --git a/src/plugins/debtagsplugin/taglistproxymodel.h b/src/plugins/debtagsplugin/taglistproxymodel.h index 9d891d0..6cb57fe 100644 --- a/src/plugins/debtagsplugin/taglistproxymodel.h +++ b/src/plugins/debtagsplugin/taglistproxymodel.h @@ -35,8 +35,8 @@ namespace NTagModel class TagListProxyModel : public QAbstractProxyModel { Q_OBJECT - typedef ept::debtags::Tag Tag; - typedef ept::debtags::Facet Facet; + typedef std::string Tag; + typedef std::string Facet; /** Maps the row to the tag with the given name. */ map<int, Tag> _rowToTag; /** Maps the tag name to the row for the tag. */ @@ -72,7 +72,7 @@ public: else { TagData* pTagData = pData->toTagData(); - int row = _tagToRow.find(pTagData->tag)->second; + int row = _tagToRow.find(pTagData->tag->name)->second; return index(row, sourceIndex.column()); } } @@ -144,8 +144,8 @@ public: QModelIndex index = pModel->index(j, 0, facetIndex); ItemData* pData = (ItemData*) index.internalPointer(); TagData* pTagData = pData->toTagData(); - _tagToRow[pTagData->tag] = row; - _rowToTag[row] = pTagData->tag; + _tagToRow[pTagData->tag->name] = row; + _rowToTag[row] = pTagData->tag->name; ++row; } } diff --git a/src/plugins/debtagsplugin/vocabularymodel.cpp b/src/plugins/debtagsplugin/vocabularymodel.cpp index 65e56be..e3c38eb 100644 --- a/src/plugins/debtagsplugin/vocabularymodel.cpp +++ b/src/plugins/debtagsplugin/vocabularymodel.cpp @@ -24,8 +24,8 @@ using namespace wibble::operators; #include <helpers.h> -typedef ept::debtags::Tag Tag; -typedef ept::debtags::Facet Facet; +typedef std::string Tag; +typedef std::string Facet; TagWrapper::TagWrapper() {} @@ -39,17 +39,22 @@ VocabularyModel::VocabularyModel(const NPlugin::DebtagsPluginContainer* pContain _pContainer = pContainer; const set<Facet> facets = _pContainer->facets(); int i = 0; + const ept::debtags::Vocabulary* dtvoc = _pContainer->vocabulary(); for (set<Facet>::const_iterator it = facets.begin(); it != facets.end(); ++it, ++i) { - _facets.push_back(FacetData(*it, i)); - _facetToFacetData[it->name()] = i; - set<Tag> tags = it->tags(); + const ept::debtags::voc::FacetData* fd = dtvoc->facetData(*it); + if (!fd) continue; + _facets.push_back(FacetData(fd, i)); + _facetToFacetData[fd->name] = i; + set<Tag> tags = fd->tags(); vector<TagData> tagData; int j = 0; for (set<Tag>::const_iterator jt = tags.begin(); jt != tags.end(); ++jt, ++j) { - tagData.push_back( TagData(*jt, i) ); - _tagToTagData[*jt] = make_pair(i, j); + const ept::debtags::voc::TagData* td = dtvoc->tagData(*jt); + if (!td) continue; + tagData.push_back( TagData(td, i) ); + _tagToTagData[td->name] = make_pair(i, j); } _tags.push_back(tagData); } @@ -92,8 +97,7 @@ int VocabularyModel::rowCount(const QModelIndex & parent) const if (pData->isFacet()) { const FacetData* pParentData = (FacetData*) pData; - const Facet facet = pParentData->facet; - return facet.tags().size(); + return pParentData->facet->tags().size(); } else // parent is a tag - tags do not have children (since tag grouping is not supported) supported) return 0; @@ -167,7 +171,7 @@ QVariant VocabularyModel::data(const QModelIndex& index, int role) const { const ItemData* pData = (ItemData*) index.internalPointer(); assert(pData->toTagData()); - Tag tag = pData->toTagData()->tag; + Tag tag = pData->toTagData()->tag->name; // dummy to pull in default constructor symbol // TagWrapper tw(); return QVariant::fromValue(TagWrapper(tag)); @@ -234,8 +238,8 @@ QModelIndex VocabularyModel::index (int row, int column, const QModelIndex & par return QModelIndex(); assert(dynamic_cast<const FacetData*>(pData) != 0); FacetData* pFacetData = (FacetData*) parent.internalPointer(); - Facet facet = pFacetData->facet; - if (row >= (int) facet.tags().size() || column >= 2) + const ept::debtags::voc::FacetData* facet = pFacetData->facet; + if (row >= (int) facet->tags().size() || column >= 2) { qDebug("[VocabularyModel::index()] Warning: row or column to large, row: %d, column, %d", row, column); qStrDebug("[VocabularyModel::index()] Facet: " + pFacetData->fullname()); @@ -261,9 +265,9 @@ bool VocabularyModel::setData(const QModelIndex& index, const QVariant& value, i qDebug("[VocabularyModel::setData()] size before insert/remove: %lu", _selectedTags.size()); // if the tag is selected if (value.toBool()) - _selectedTags.insert(pTagData->tag); + _selectedTags.insert(pTagData->tag->name); else // the tag is unselected - _selectedTags.erase(pTagData->tag); + _selectedTags.erase(pTagData->tag->name); qDebug("[VocabularyModel::setData()] size after insert/remove: %lu", _selectedTags.size()); _companionTagsValid = false; // reset(); @@ -316,7 +320,7 @@ void VocabularyModel::setAllUnselected(QModelIndex index) if (pTagData) { pTagData->selected = false; - _selectedTags.erase(pTagData->tag); + _selectedTags.erase(pTagData->tag->name); } _companionTagsValid = false; } @@ -374,7 +378,7 @@ set<Facet> VocabularyModel::hiddenFacets() const QModelIndex index = this->index(i, 0, parent); NTagModel::FacetData* pFacet = (NTagModel::FacetData*) index.internalPointer(); if (pFacet->hidden) - result.insert(pFacet->facet); + result.insert(pFacet->facet->name); } return result; } @@ -389,7 +393,7 @@ set<Facet> VocabularyModel::shownFacets() const QModelIndex index = this->index(i, 0, parent); NTagModel::FacetData* pFacet = (NTagModel::FacetData*) index.internalPointer(); if (!pFacet->hidden) - result.insert(pFacet->facet); + result.insert(pFacet->facet->name); } return result; } @@ -404,7 +408,7 @@ std::set<Tag> VocabularyModel::collectSelectedChildItems(const QModelIndex& pare if (data(index, NTagModel::SelectedRole).toBool()) { NTagModel::TagData* pTagData = (NTagModel::TagData*) index.internalPointer(); - result.insert(pTagData->tag); + result.insert(pTagData->tag->name); } result |= collectSelectedChildItems(index); } diff --git a/src/plugins/debtagsplugin/vocabularymodel.h b/src/plugins/debtagsplugin/vocabularymodel.h index f9ee672..35661ea 100644 --- a/src/plugins/debtagsplugin/vocabularymodel.h +++ b/src/plugins/debtagsplugin/vocabularymodel.h @@ -16,9 +16,8 @@ #include <QAbstractListModel> -#include <ept/debtags/tag.h> - #include <debtagsplugincontainer.h> +#include <ept/debtags/vocabulary.h> #include <helpers.h> @@ -62,7 +61,7 @@ struct ItemData struct FacetData : public ItemData { - typedef ept::debtags::Facet Facet; + typedef const ept::debtags::voc::FacetData* Facet; Facet facet; bool hidden; @@ -75,10 +74,10 @@ struct FacetData : public ItemData } virtual bool isFacet() const { return true; } - virtual QString name() const { return toQString(facet.shortDescription()); } - virtual QString fullname() const { return toQString(facet.name()); } + virtual QString name() const { return toQString(facet->shortDescription()); } + virtual QString fullname() const { return toQString(facet->name); } virtual QString fullDisplayText() const { return name(); }; - virtual QString description() const { return toQString(facet.shortDescription()); } + virtual QString description() const { return toQString(facet->shortDescription()); } virtual const FacetData* toFacetData() const { return this; }; virtual const TagData* toTagData() const { return 0; }; virtual FacetData* toFacetData() { return this; }; @@ -87,7 +86,7 @@ struct FacetData : public ItemData struct TagData : public ItemData { - typedef ept::debtags::Tag Tag; + typedef const ept::debtags::voc::TagData* Tag; int facetIndex; /** @brief Stores if the tag was selected to be searched for. @@ -104,14 +103,14 @@ struct TagData : public ItemData { } virtual bool isFacet() const { return false; } - virtual QString name() const { return toQString(tag.shortDescription()); } - virtual QString fullname() const { return toQString(tag.fullname()); } + virtual QString name() const { return toQString(tag->shortDescription()); } + virtual QString fullname() const { return toQString(tag->name); } virtual QString fullDisplayText() const - { QString tmp = toQString(tag.facet().shortDescription()); + { QString tmp = toQString(ept::debtags::voc::getfacet(tag->name)); // FIXME: needs to access vocabulary for this: toQString(tag.facet().shortDescription()); tmp += QString(": "); tmp += name(); return tmp; }; - virtual QString description() const { return toQString(tag.longDescription()); } + virtual QString description() const { return toQString(tag->longDescription()); } virtual const FacetData* toFacetData() const { return 0; }; virtual const TagData* toTagData() const { return this; }; virtual FacetData* toFacetData() { return 0; }; @@ -125,8 +124,8 @@ struct TagData : public ItemData class VocabularyModel : public QAbstractItemModel { // Q_OBJECT - typedef ept::debtags::Tag Tag; - typedef ept::debtags::Facet Facet; + typedef std::string Tag; + typedef std::string Facet; typedef ept::debtags::Debtags Debtags; /** @brief The object used to access the tag collection. @@ -250,7 +249,7 @@ private: struct TagWrapper { - typedef ept::debtags::Tag Tag; + typedef std::string Tag; public: Tag tag; TagWrapper();

