[yast-commit] r59943 - in /trunk/qt-pkg: src/YQPackageSelector.cc src/YQPkgVersionsView.cc src/YQPkgVersionsView.h src/YQZypp.h yast2-qt-pkg.spec.in
Author: tgoettlicher Date: Thu Dec 3 17:17:19 2009 New Revision: 59943 URL: http://svn.opensuse.org/viewcvs/yast?rev=59943&view=rev Log: worked on multiversion installation Modified: trunk/qt-pkg/src/YQPackageSelector.cc trunk/qt-pkg/src/YQPkgVersionsView.cc trunk/qt-pkg/src/YQPkgVersionsView.h trunk/qt-pkg/src/YQZypp.h trunk/qt-pkg/yast2-qt-pkg.spec.in Modified: trunk/qt-pkg/src/YQPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPackageSelector.cc?rev=59943&r1=59942&r2=59943&view=diff ============================================================================== --- trunk/qt-pkg/src/YQPackageSelector.cc (original) +++ trunk/qt-pkg/src/YQPackageSelector.cc Thu Dec 3 17:17:19 2009 @@ -983,6 +983,9 @@ { connect( _pkgVersionsView, SIGNAL( candidateChanged( ZyppObj ) ), _pkgList, SLOT ( updateItemData() ) ); + + connect( _pkgVersionsView, SIGNAL( multiversionSelectionChanged( ) ), + _pkgList, SLOT ( updateItemData() ) ); } Modified: trunk/qt-pkg/src/YQPkgVersionsView.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgVersionsView.cc?rev=59943&r1=59942&r2=59943&view=diff ============================================================================== --- trunk/qt-pkg/src/YQPkgVersionsView.cc (original) +++ trunk/qt-pkg/src/YQPkgVersionsView.cc Thu Dec 3 17:17:19 2009 @@ -75,10 +75,8 @@ void YQPkgVersionsView::slotRefreshDetails( ) { - if ( !_selectable ) - return; - - showDetailsIfVisible ( _selectable ); + yuiMilestone() << "slotRefreshDetails" << endl; + emit multiversionSelectionChanged( ); } @@ -168,15 +166,18 @@ // Find installed and available objects ( for multiversion view ) // { - zypp::ui::Selectable::installed_iterator it = selectable->availableBegin(); + zypp::ui::Selectable::picklist_iterator it = selectable->picklistBegin(); - while ( it != selectable->availableEnd() ) + while ( it != selectable->picklistEnd() ) { YQPkgMultiVersion * version = new YQPkgMultiVersion( this, selectable, *it, _userCanSwitch ); _installed.push_back( version ); _layout->addWidget( version ); + + connect (version, SIGNAL(statusChanged()), this, SLOT(slotRefreshDetails())); + connect (this, SIGNAL(multiversionSelectionChanged()), version, SLOT(update())); ++it; } @@ -374,26 +375,24 @@ + YQPkgMultiVersion::YQPkgMultiVersion( QWidget * parent, ZyppSel selectable, - ZyppObj zyppObj, + ZyppPoolItem zyppPoolItem, bool enabled ) : QCheckBox( parent ) , _selectable( selectable ) - , _zyppObj( zyppObj ) + , _zyppPoolItem( zyppPoolItem ) { setText (_( "%1-%2 from %3 with priority %4 and vendor %5" ) - .arg( fromUTF8( zyppObj->edition().asString().c_str() ) ) - .arg( fromUTF8( zyppObj->arch().asString().c_str() ) ) - .arg( fromUTF8( zyppObj->repository().info().name().c_str() ) ) - .arg( zyppObj->repository().info().priority() ) - .arg( fromUTF8( zyppObj->vendor().c_str() ) )); - - - connect( this, SIGNAL (toggled(bool)), this, SLOT( slotIconClicked())); - + .arg( fromUTF8( zyppPoolItem->edition().asString().c_str() ) ) + .arg( fromUTF8( zyppPoolItem->arch().asString().c_str() ) ) + .arg( fromUTF8( zyppPoolItem->repository().info().name().c_str() ) ) + .arg( zyppPoolItem->repository().info().priority() ) + .arg( fromUTF8( zyppPoolItem->vendor().c_str() ) )); + connect( this, SIGNAL (toggled(bool)), this, SLOT( slotIconClicked())); } @@ -402,19 +401,19 @@ // NOP } + void YQPkgMultiVersion::slotIconClicked() { // prevent checkmark, we draw the status icons ourselves setChecked( false ); - - cycleStatus(); } + void YQPkgMultiVersion::cycleStatus() { - ZyppStatus oldStatus = _selectable->status(); + ZyppStatus oldStatus = _selectable->pickStatus( _zyppPoolItem ); ZyppStatus newStatus = oldStatus; switch ( oldStatus ) @@ -470,37 +469,19 @@ break; } - yuiMilestone() << "new status: " << newStatus << endl; setStatus( newStatus ); -// _pkgObjList->sendStatusChanged(); - } + void YQPkgMultiVersion::setStatus( ZyppStatus newStatus ) { - ZyppStatus oldStatus = _selectable->status(); - _selectable->setStatus( newStatus ); - - if ( oldStatus != _selectable->status() ) - { -// applyChanges(); + _selectable->setPickStatus( _zyppPoolItem, newStatus ); -/* if ( sendSignals ) - { - _pkgObjList->updateItemStates(); - _pkgObjList->sendUpdatePackages(); - }*/ - } - - // setStatusIcon(); -// emit candidateChanged( ); + emit statusChanged(); } - - - void YQPkgMultiVersion::paintEvent(QPaintEvent *) { // draw the usual checkbox @@ -510,15 +491,14 @@ p.drawControl(QStyle::CE_CheckBox, opt); - // calculate position and draw the status icon QRect elementRect = style()->subElementRect ( QStyle::SE_CheckBoxIndicator, &opt); - QPixmap icon = statusIcon( _selectable->status() ); + QPixmap icon = statusIcon( _selectable->pickStatus(_zyppPoolItem) ); QPoint start = elementRect.center() - icon.rect().center(); QRect rect = QRect(start.x() - ICONOFFSET, start.y(), icon.width(), icon.height()); - p.drawItemPixmap(rect, 0, icon ); + p.drawItemPixmap( rect, 0, icon ); } Modified: trunk/qt-pkg/src/YQPkgVersionsView.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgVersionsView.h?rev=59943&r1=59942&r2=59943&view=diff ============================================================================== --- trunk/qt-pkg/src/YQPkgVersionsView.h (original) +++ trunk/qt-pkg/src/YQPkgVersionsView.h Thu Dec 3 17:17:19 2009 @@ -90,6 +90,8 @@ * Emitted when the user changes the **/ void candidateChanged( ZyppObj newCandidate ); + void multiversionSelectionChanged( ); + protected slots: @@ -179,7 +181,7 @@ **/ YQPkgMultiVersion( QWidget * parent, ZyppSel selectable, - ZyppObj zyppObj, + ZyppPoolItem zyppPoolItem, bool enabled = true ); /** @@ -188,42 +190,33 @@ virtual ~YQPkgMultiVersion(); /** - * Returns the original ZYPP object - **/ - ZyppObj zyppObj() const { return _zyppObj; } - - /** * Returns the original ZYPP selectable **/ ZyppSel selectable() const { return _selectable; } - + /** + * Paints checkboxes with status icons instead of a checkmark + **/ void paintEvent(QPaintEvent *); - - protected: void cycleStatus(); void setStatus( ZyppStatus newStatus ); QPixmap statusIcon( ZyppStatus status ); - - - - // Data members ZyppSel _selectable; - ZyppObj _zyppObj; - + ZyppPoolItem _zyppPoolItem; - int _state; protected slots: void slotIconClicked(); +signals: + void statusChanged(); }; Modified: trunk/qt-pkg/src/YQZypp.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQZypp.h?rev=59943&r1=59942&r2=59943&view=diff ============================================================================== --- trunk/qt-pkg/src/YQZypp.h (original) +++ trunk/qt-pkg/src/YQZypp.h Thu Dec 3 17:17:19 2009 @@ -55,6 +55,7 @@ typedef zypp::Pattern::constPtr ZyppPattern; typedef zypp::Patch::constPtr ZyppPatch; typedef zypp::Product::constPtr ZyppProduct; +typedef zypp::PoolItem ZyppPoolItem; typedef zypp::ResPoolProxy ZyppPool; typedef zypp::ResPoolProxy::const_iterator ZyppPoolIterator; Modified: trunk/qt-pkg/yast2-qt-pkg.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/yast2-qt-pkg.spec.in?rev=59943&r1=59942&r2=59943&view=diff ============================================================================== --- trunk/qt-pkg/yast2-qt-pkg.spec.in (original) +++ trunk/qt-pkg/yast2-qt-pkg.spec.in Thu Dec 3 17:17:19 2009 @@ -11,9 +11,9 @@ BuildRequires: yast2-devtools >= 2.16.3 Requires: yast2-qt >= 2.17.13 BuildRequires: yast2-qt-devel >= 2.17.13 -BuildRequires: libzypp-devel >= 6.19.3 +BuildRequires: libzypp-devel >= 6.26.0 BuildRequires: yast2-libyui-devel >= 2.17.14 -Requires: libzypp >= 6.19.0 +Requires: libzypp >= 6.26.0 Requires: yast2-libyui >= 2.17.14 Requires: yast2_theme >= 2.16.1 Provides: yast2-qt:/usr/lib/YaST2/plugin/libpy2qt_pkg.so.2 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
tgoettlicher@svn.opensuse.org