Author: schubi2
Date: Fri Jun 20 11:26:23 2008
New Revision: 10419
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10419&view=rev
Log:
creating tree moved to restreewidget.*
Modified:
trunk/dialogsolver/src/restreewidget.cpp
trunk/dialogsolver/src/restreewidget.h
trunk/dialogsolver/src/solvertree.cpp
trunk/dialogsolver/src/solvertree.h
Modified: trunk/dialogsolver/src/restreewidget.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/restreewidget.cpp?rev=10419&r1=10418&r2=10419&view=diff
==============================================================================
--- trunk/dialogsolver/src/restreewidget.cpp (original)
+++ trunk/dialogsolver/src/restreewidget.cpp Fri Jun 20 11:26:23 2008
@@ -207,5 +207,81 @@
}
+
+void ResTreeWidget::buildTree() {
+ if (resolver != NULL) {
+ alreadyHitItems.clear();
+ int id = 0;
+ for (zypp::ResPool::const_iterator it = resolver->pool().begin();
+ it != resolver->pool().end();
+ ++it)
+ { // find all root items and generate
+ if (it->status().isToBeInstalled()) {
+
+ zypp::ResObject::constPtr r = it->resolvable();
+ bool rootfound = false;
+ zypp::solver::detail::ItemCapKindList isInstalledList = resolver->isInstalledBy (*it);
+ if (isInstalledList.empty()) {
+ rootfound = true;
+ } else {
+ rootfound = true;
+ for (zypp::solver::detail::ItemCapKindList::const_iterator isInstall = isInstalledList.begin();
+ isInstall != isInstalledList.end(); isInstall++) {
+ if (isInstall->initialInstallation) {
+ rootfound = false;
+ }
+ }
+ }
+
+ if (rootfound) {
+ QString idStr = QString( "%1" ).arg( id++ );
+ m_RevGraphView->m_Tree[idStr].item = *it;
+
+ // we have found a root; collect all trees
+ buildTreeBranch ( m_RevGraphView->m_Tree[idStr].targets, *it, id);
+ }
+ }
+ }
+ }
+ dumpRevtree();
+}
+
+void ResTreeWidget::buildTreeBranch ( ResGraphView::tlist &childList, const zypp::PoolItem item, int &id) {
+ // generate the branches for items which will really be installed
+ zypp::solver::detail::ItemCapKindList installList = resolver->installs (item);
+ for (zypp::solver::detail::ItemCapKindList::const_iterator it = installList.begin();
+ it != installList.end(); it++) {
+ if (it->initialInstallation) {
+ // This item will REALLY triggered by the given root item (not only due required dependencies)
+ QString idStr = QString( "%1" ).arg( id++ );
+
+ childList.append(ResGraphView::targetData(idStr));
+ m_RevGraphView->m_Tree[idStr].item=it->item;
+ m_RevGraphView->m_Tree[idStr].dueto = *it;
+
+ alreadyHitItems.insert (item);
+
+ // we have found a root; collect all trees
+ if (alreadyHitItems.find(it->item) == alreadyHitItems.end())
+ buildTreeBranch ( m_RevGraphView->m_Tree[idStr].targets, it->item, id);
+ }
+ }
+
+ // generate the branches for items which are already installed
+ zypp::solver::detail::ItemCapKindList satisfiedList = resolver->satifiedByInstalled (item);
+ for (zypp::solver::detail::ItemCapKindList::const_iterator it = satisfiedList.begin();
+ it != satisfiedList.end(); it++) {
+ QString idStr = QString( "%1" ).arg( id++ );
+
+ childList.append(ResGraphView::targetData(idStr));
+ m_RevGraphView->m_Tree[idStr].item=it->item;
+ m_RevGraphView->m_Tree[idStr].dueto = *it;
+
+ alreadyHitItems.insert (item);
+ }
+}
+
+
+
#include "restreewidget.moc"
Modified: trunk/dialogsolver/src/restreewidget.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/restreewidget.h?rev=10419&r1=10418&r2=10419&view=diff
==============================================================================
--- trunk/dialogsolver/src/restreewidget.h (original)
+++ trunk/dialogsolver/src/restreewidget.h Fri Jun 20 11:26:23 2008
@@ -31,6 +31,7 @@
#include "zypp/Resolver.h"
#include
#include
+#include "resgraphview.h"
class QVBoxLayout;
@@ -45,10 +46,7 @@
class QComboBox;
class QLabel;
-namespace svn {
- class LogEntry;
- class Client;
-}
+typedef std::setzypp::PoolItem PoolItemSet;
class ResTreeWidget : public QWidget
{
@@ -64,6 +62,7 @@
void selectItem(const zypp::PoolItem item);
void dumpRevtree();
+ void buildTree();
protected:
QVBoxLayout* ResTreeWidgetLayout;
@@ -77,8 +76,11 @@
Q3ListView *installedListView;
Q3TextBrowser* m_Detailstext;
QComboBox *resolvableList;
- void selectItem(const QString & itemString);
-
+ PoolItemSet alreadyHitItems;
+
+ void selectItem(const QString & itemString);
+ void buildTreeBranch (ResGraphView::tlist &childList, const zypp::PoolItem item, int &id);
+
protected slots:
virtual void setDetailText(const QString&, const zypp::PoolItem);
Modified: trunk/dialogsolver/src/solvertree.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/solvertree.cpp?rev=10419&r1=10418&r2=10419&view=diff
==============================================================================
--- trunk/dialogsolver/src/solvertree.cpp (original)
+++ trunk/dialogsolver/src/solvertree.cpp Fri Jun 20 11:26:23 2008
@@ -68,43 +68,9 @@
m_Data->m_stopTick.restart();
m_Data->m_TreeDisplay=new ResTreeWidget(treeParent, resolver);
m_Data->m_TreeDisplay->setMinimumSize ( 700, 700 );
-
- if (resolver != NULL) {
- int id = 0;
- for (zypp::ResPool::const_iterator it = resolver->pool().begin();
- it != resolver->pool().end();
- ++it)
- { // find all root items and generate
- if (it->status().isToBeInstalled()) {
-
- zypp::ResObject::constPtr r = it->resolvable();
- bool rootfound = false;
- zypp::solver::detail::ItemCapKindList isInstalledList = resolver->isInstalledBy (*it);
- if (isInstalledList.empty()) {
- rootfound = true;
- } else {
- rootfound = true;
- for (zypp::solver::detail::ItemCapKindList::const_iterator isInstall = isInstalledList.begin();
- isInstall != isInstalledList.end(); isInstall++) {
- if (isInstall->initialInstallation) {
- rootfound = false;
- }
- }
- }
-
- if (rootfound) {
- QString idStr = QString( "%1" ).arg( id++ );
- m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].item = *it;
-
- // we have found a root; collect all trees
- buildTree ( m_Data->m_TreeDisplay, m_Data->m_TreeDisplay->m_RevGraphView->m_Tree[idStr].targets, *it, id);
- }
- }
- }
- }
+ m_Data->m_TreeDisplay->buildTree();
m_Valid=true;
- m_Data->m_TreeDisplay->dumpRevtree();
}
SolverTree::~SolverTree()
@@ -123,42 +89,6 @@
}
-void SolverTree::buildTree ( ResTreeWidget *data, ResGraphView::tlist &childList, const zypp::PoolItem item, int &id) {
- // generate the branches for items which will really be installed
- zypp::solver::detail::ItemCapKindList installList = resolver->installs (item);
- for (zypp::solver::detail::ItemCapKindList::const_iterator it = installList.begin();
- it != installList.end(); it++) {
- if (it->initialInstallation) {
- // This item will REALLY triggered by the given root item (not only due required dependencies)
- QString idStr = QString( "%1" ).arg( id++ );
-
- childList.append(ResGraphView::targetData(idStr));
- data->m_RevGraphView->m_Tree[idStr].item=it->item;
- data->m_RevGraphView->m_Tree[idStr].dueto = *it;
-
- alreadyHitItems.insert (item);
-
- // we have found a root; collect all trees
- if (alreadyHitItems.find(it->item) == alreadyHitItems.end())
- buildTree ( data, data->m_RevGraphView->m_Tree[idStr].targets, it->item, id);
- }
- }
-
- // generate the branches for items which are already installed
- zypp::solver::detail::ItemCapKindList satisfiedList = resolver->satifiedByInstalled (item);
- for (zypp::solver::detail::ItemCapKindList::const_iterator it = satisfiedList.begin();
- it != satisfiedList.end(); it++) {
- QString idStr = QString( "%1" ).arg( id++ );
-
- childList.append(ResGraphView::targetData(idStr));
- data->m_RevGraphView->m_Tree[idStr].item=it->item;
- data->m_RevGraphView->m_Tree[idStr].dueto = *it;
-
- alreadyHitItems.insert (item);
- }
-}
-
-
QWidget*SolverTree::getView()
{
return m_Data->m_TreeDisplay;
Modified: trunk/dialogsolver/src/solvertree.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/solvertree.h?rev=10419&r1=10418&r2=10419&view=diff
==============================================================================
--- trunk/dialogsolver/src/solvertree.h (original)
+++ trunk/dialogsolver/src/solvertree.h Fri Jun 20 11:26:23 2008
@@ -21,8 +21,6 @@
#define SOLVERTREE_H
#include "zypp/Resolver.h"
-#include "resgraphview.h"
-#include "restreewidget.h"
class StreeData;
class QWidget;
@@ -31,8 +29,6 @@
@author Rajko Albrecht
*/
-typedef std::setzypp::PoolItem PoolItemSet;
-
class SolverTree{
public:
SolverTree( QWidget*treeParent,
@@ -47,8 +43,6 @@
bool m_Valid;
zypp::solver::detail::Resolver_Ptr resolver;
StreeData*m_Data;
- PoolItemSet alreadyHitItems;
- void buildTree ( ResTreeWidget *data, ResGraphView::tlist &childList, const zypp::PoolItem item, int &id);
};
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org