Author: schubi2 Date: Thu Jun 19 11:54:52 2008 New Revision: 10397 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10397&view=rev Log: /** Constructor * Make a complete new solverrun by installing item * \param item which will be installed */ QZyppSolverDialog(const zypp::PoolItem item); Modified: trunk/dialogsolver/src/QZyppSolverDialog.cpp trunk/dialogsolver/src/QZyppSolverDialog.h trunk/dialogsolver/src/pannerview.cpp trunk/dialogsolver/src/pannerview.h trunk/dialogsolver/src/resgraphview.cpp trunk/dialogsolver/src/restreewidget.cpp Modified: trunk/dialogsolver/src/QZyppSolverDialog.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/QZyppSolverDialo... ============================================================================== --- trunk/dialogsolver/src/QZyppSolverDialog.cpp (original) +++ trunk/dialogsolver/src/QZyppSolverDialog.cpp Thu Jun 19 11:54:52 2008 @@ -8,6 +8,11 @@ #include "QZyppSolverDialog.h" #include "solvertree.h" #include "getText.h" +#include "zypp/ZYppFactory.h" +#include "zypp/ResFilters.h" +#include "zypp/base/Algorithm.h" + +using namespace zypp; QZyppSolverDialog::QZyppSolverDialog(zypp::solver::detail::Resolver_Ptr r) : QDialog(0,"Solvertree",true) @@ -27,10 +32,65 @@ } +struct UndoTransact : public resfilter::PoolItemFilterFunctor +{ + ResStatus::TransactByValue resStatus; + UndoTransact ( const ResStatus::TransactByValue &status) + :resStatus(status) + { } + + bool operator()( PoolItem item ) // only transacts() items go here + { + item.status().resetTransact( resStatus );// clear any solver/establish transactions + return true; + } +}; + + +QZyppSolverDialog::QZyppSolverDialog(const zypp::PoolItem item) + : QDialog(0,"Solvertree",true) + , resolver (NULL) + , solvertree(0) +{ + zypp::ResPool pool( zypp::getZYpp()->pool() ); + pool.proxy().saveState(); // Save old pool + const QCursor oldCursor = cursor (); + setCursor (Qt::WaitCursor); + + // resetting all selections + UndoTransact resetting (ResStatus::USER); + invokeOnEach ( pool.begin(), pool.end(), + resfilter::ByTransact( ), // Resetting all transcations + functor::functorRef<bool,PoolItem>(resetting) ); + + // set the selected item for installation only + item.status().setToBeInstalled( ResStatus::USER); + + // and resolve + resolver = new zypp::solver::detail::Resolver( pool ); + resolver->resolvePool(); + + // show the results + QHBoxLayout* layout = new QHBoxLayout (this); + solvertree = new SolverTree(this, resolver); + layout->addWidget( solvertree->getView()); + selectItem(item); + pool.proxy().restoreState(); // Restore old state + + if (resolver == NULL + || (resolver->problems()).size() > 0 ) { + QMessageBox::critical( 0, + i18n("Critical Error") , + i18n("No valid solver result")); + } +} + + QZyppSolverDialog::~QZyppSolverDialog() { } + void QZyppSolverDialog::selectItem(const zypp::PoolItem item) { solvertree->selectItem(item); }; Modified: trunk/dialogsolver/src/QZyppSolverDialog.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/QZyppSolverDialo... ============================================================================== --- trunk/dialogsolver/src/QZyppSolverDialog.h (original) +++ trunk/dialogsolver/src/QZyppSolverDialog.h Thu Jun 19 11:54:52 2008 @@ -24,9 +24,16 @@ public: /** Constructor + * Show the result of the given solver * \param Resolver pointer of a valid solver run */ QZyppSolverDialog(zypp::solver::detail::Resolver_Ptr r = NULL); + + /** Constructor + * Make a complete new solverrun by installing item + * \param item which will be installed + */ + QZyppSolverDialog(const zypp::PoolItem item); /** ctor */ Modified: trunk/dialogsolver/src/pannerview.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/pannerview.cpp?r... ============================================================================== --- trunk/dialogsolver/src/pannerview.cpp (original) +++ trunk/dialogsolver/src/pannerview.cpp Thu Jun 19 11:54:52 2008 @@ -47,6 +47,12 @@ } } +void PannerView::drawContents(QPainter* p) +{ + drawContents (p,0,0,0,0); +} + + void PannerView::setZoomRect(const QRect& theValue) { QRect oldRect = m_ZoomRect; Modified: trunk/dialogsolver/src/pannerview.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/pannerview.h?rev... ============================================================================== --- trunk/dialogsolver/src/pannerview.h (original) +++ trunk/dialogsolver/src/pannerview.h Thu Jun 19 11:54:52 2008 @@ -41,6 +41,7 @@ protected: virtual void drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph); + virtual void drawContents(QPainter* p); virtual void contentsMouseMoveEvent(QMouseEvent* e); virtual void contentsMousePressEvent(QMouseEvent* e); virtual void contentsMouseReleaseEvent(QMouseEvent*); Modified: trunk/dialogsolver/src/resgraphview.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/resgraphview.cpp... ============================================================================== --- trunk/dialogsolver/src/resgraphview.cpp (original) +++ trunk/dialogsolver/src/resgraphview.cpp Thu Jun 19 11:54:52 2008 @@ -436,7 +436,7 @@ << "shape=box, " << "label=""<<getLabelstring(it1.key())<<""," << "];\n"; - for (unsigned j=0;j<it1.data().targets.count();++j) { + for (int j=0;j<it1.data().targets.count();++j) { stream<<" "<<it1.key().latin1()<< " " << "->"<<" "<<it1.data().targets[j].key << " [fontsize=10,style="solid"" @@ -457,7 +457,7 @@ if (!renderProcess->start(&envs)) { QString argu; - for (unsigned c=0;c<renderProcess->arguments().count();++c) { + for (int c=0;c<renderProcess->arguments().count();++c) { argu+=QString(" %1").arg(renderProcess->arguments()[c]); } QString error = i18n("Could not start process "%1".").arg(argu); @@ -483,7 +483,7 @@ if (!full) { sm = sp[0]+"..."; } else { - for (unsigned j = 0; j<sp.count(); ++j) { + for (int j = 0; j<sp.count(); ++j) { if (j>0) sm+="<br>"; sm+=sp[j]; } @@ -756,6 +756,7 @@ it = m_Tree.find(((GraphTreeLabel*)i)->nodename()); if (it!=m_Tree.end()) { zypp::ResPool pool( zypp::getZYpp()->pool() ); + pool.proxy().saveState(); // Save old pool const QCursor oldCursor = cursor (); setCursor (Qt::WaitCursor); // resetting all selections @@ -778,6 +779,7 @@ dialog->raise(); dialog->activateWindow(); dialog->selectItem(it.data().item); + pool.proxy().restoreState(); // Restore old state } } } Modified: trunk/dialogsolver/src/restreewidget.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/dialogsolver/src/restreewidget.cp... ============================================================================== --- trunk/dialogsolver/src/restreewidget.cpp (original) +++ trunk/dialogsolver/src/restreewidget.cpp Thu Jun 19 11:54:52 2008 @@ -144,6 +144,7 @@ edition, QString(iter->cap.asString().c_str()), QString(iter->capKind.asString().c_str())); + element = NULL; } for (zypp::solver::detail::ItemCapKindList::const_iterator iter = installList.begin(); iter != installList.end(); ++iter) { @@ -154,7 +155,8 @@ QString(iter->item->name().c_str()), edition, QString(iter->cap.asString().c_str()), - QString(iter->capKind.asString().c_str())); + QString(iter->capKind.asString().c_str())); + element = NULL; } } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org