Author: coolo Date: Wed Dec 26 11:30:52 2007 New Revision: 43237 URL: http://svn.opensuse.org/viewcvs/yast?rev=43237&view=rev Log: give the package manager some love - unfinished, just a backup (I tend to format my hdd) Modified: branches/tmp/coolo/pkg-mgr-love/src/QY2ComboTabWidget.cc branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.cc branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.h branches/tmp/coolo/pkg-mgr-love/src/QY2ListView.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelector.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelectorBase.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPatternSelector.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgChangesDialog.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.h branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgDiskUsageList.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgList.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgObjList.cc branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgPatternList.cc Modified: branches/tmp/coolo/pkg-mgr-love/src/QY2ComboTabWidget.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/QY2ComboTabWidget.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/QY2ComboTabWidget.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/QY2ComboTabWidget.cc Wed Dec 26 11:30:52 2007 @@ -42,26 +42,25 @@ const char * name ) : QWidget(parent) { - QVBoxLayout *vbox = new QVBoxLayout(); - setLayout(vbox); + QVBoxLayout *vbox = new QVBoxLayout(this); + vbox->setMargin( 0 ); QHBoxLayout *hbox = new QHBoxLayout(); Q_CHECK_PTR( hbox ); // hbox->setFrameStyle( QFrame::Panel | QFrame::Raised ); // hbox->setLineWidth(2); // hbox->setMidLineWidth(2); - hbox->setSpacing( SPACING ); - hbox->setMargin ( MARGIN ); + hbox->setSpacing( 0 ); + hbox->setMargin ( 0 ); vbox->addLayout(hbox); //this->setSpacing( SPACING ); - this->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert - + this->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); // hor/vert combo_label = new QLabel(label); hbox->addWidget(combo_label); Q_CHECK_PTR( combo_label ); - + combo_box = new QComboBox( this ); Q_CHECK_PTR( combo_box ); hbox->addWidget(combo_box); @@ -69,7 +68,7 @@ combo_box->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert connect( combo_box, SIGNAL( activated( int ) ), this, SLOT ( showPageIndex ( int ) ) ); - + widget_stack = new QStackedWidget( this ); Q_CHECK_PTR( widget_stack ); vbox->addWidget(widget_stack); @@ -79,7 +78,7 @@ QY2ComboTabWidget::~QY2ComboTabWidget() { - + } @@ -125,9 +124,9 @@ // correct combo box item. return; } - + // Search the dict for this page - + QHashIterator<int, QWidget *> it( pages ); while ( it.hasNext() ) Modified: branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.cc Wed Dec 26 11:30:52 2007 @@ -132,14 +132,12 @@ QY2DiskUsageListItem *item = dynamic_cast<QY2DiskUsageListItem *>(_view->itemFromIndex(index)); if ( item ) { - item->paintPercentageBar( item->usedPercent(), - painter, + item->paintPercentageBar( painter, option, interpolateColor( item->usedPercent(), - 60, 95, - QColor( 0, 0x80, 0 ), // Medium dark green - QColor( 0xFF, 0, 0 ) ), // Bright red - background.dark( 115 ) ); + 60, 95, + QColor( 0, 0xa0, 0 ), // Medium dark green + QColor( 0xFF, 0, 0 ) ) ); // Bright red } painter->restore(); } @@ -150,7 +148,6 @@ { _nameCol = -42; _percentageBarCol = -42; - _percentageCol = -42; _usedSizeCol = -42; _freeSizeCol = -42; _totalSizeCol = -42; @@ -163,7 +160,6 @@ columnLabels << _( "Name" ); _nameCol = numCol++; // Translators: Please keep this short! columnLabels << _("Disk Usage"); _percentageBarCol = numCol++; - columnLabels << ""; _percentageCol = numCol++; setItemDelegateForColumn( _percentageBarCol, new QY2DiskUsagePercentageItem( this ) ); columnLabels << _("Used"); _usedSizeCol = numCol++; columnLabels << _( "Free"); _freeSizeCol = numCol++; @@ -175,12 +171,8 @@ setColumnCount(numCol); setHeaderLabels(columnLabels); - //FIXME -// setTextAlignment( percentageCol(), Qt::AlignRight ); -// setTextAlignment( usedSizeCol(), Qt::AlignRight ); -// setTextAlignment( freeSizeCol(), Qt::AlignRight ); -// setTextAlignment( totalSizeCol(), Qt::AlignRight ); sortItems( percentageBarCol(), Qt::AscendingOrder ); + setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); } saveColumnWidths(); @@ -222,12 +214,11 @@ void QY2DiskUsageListItem::init( bool allFields ) { - if ( percentageCol() >= 0 ) - { - QString percentageText; - percentageText.sprintf( "%d%%", usedPercent() ); - setText( percentageCol(), percentageText ); - } + setSizeHint( percentageBarCol(), QSize( 20, 10 ) ); + + setTextAlignment( usedSizeCol(), Qt::AlignRight ); + setTextAlignment( freeSizeCol(), Qt::AlignRight ); + setTextAlignment( totalSizeCol(), Qt::AlignRight ); if ( usedSizeCol() >= 0 ) setText( usedSizeCol(), usedSize() ); if ( freeSizeCol() >= 0 ) setText( freeSizeCol(), freeSize() ); @@ -235,7 +226,7 @@ if ( allFields ) { if ( totalSizeCol() >= 0 ) setText( totalSizeCol(), totalSize() ); - if ( nameCol() >= 0 ) setText( nameCol(), " " + name() ); + if ( nameCol() >= 0 ) setText( nameCol(), name() ); if ( deviceNameCol() >= 0 ) setText( deviceNameCol(), deviceName() ); } } @@ -245,7 +236,6 @@ QY2DiskUsageListItem::setText( int column, const FSize & size ) { QString sizeText = size.form( 0, 1, true ).c_str(); - sizeText += " "; setText( column, sizeText ); } @@ -290,7 +280,7 @@ * Comparison function used for sorting the list. * Reimplemented from QTreeWidgetItem **/ -bool +bool QY2DiskUsageListItem::operator<( const QTreeWidgetItem & otherListViewItem ) const { const QY2DiskUsageListItem * other = dynamic_cast<const QY2DiskUsageListItem *> (&otherListViewItem); @@ -298,8 +288,7 @@ if ( other ) { - if ( col == percentageCol() || - col == percentageBarCol() ) + if ( col == percentageBarCol() ) { // Intentionally reverting sort order: Fullest first return ( this->usedPercent() < other->usedPercent() ); @@ -325,91 +314,44 @@ * Stolen from KDirStat::KDirTreeView with the author's permission. **/ void -QY2DiskUsageListItem::paintPercentageBar( float percent, - QPainter * painter, +QY2DiskUsageListItem::paintPercentageBar( QPainter * painter, QStyleOptionViewItem option, - const QColor & fillColor, - const QColor & barBackground ) + const QColor & fillColor ) { - if ( percent > 100.0 ) percent = 100.0; - if ( percent < 0.0 ) percent = 0.0; - int penWidth = 2; - int extraMargin = 3; - int x = option.rect.left(); /*FIXME _diskUsageList->itemMargin(); */ - int y = option.rect.top() + extraMargin; - int w = option.rect.width() - 2; /*FIXME * _diskUsageList->horizontalOffset(); */ - int h = option.rect.height() - 2; /*FIXME * extraMargin; */ - int fillWidth; - - painter->eraseRect( option.rect ); - int indent=0; - w -= indent; - x += indent; - - if ( w > 0 ) - { - QPen pen( painter->pen() ); - pen.setWidth(0); - painter->setPen( pen ); - painter->setBrush( Qt::NoBrush ); - fillWidth = (int) ( ( w - 2 * penWidth ) * percent / 100.0 ); - - - // Fill bar background. - - painter->fillRect( x + penWidth, y + penWidth, - w - 2 * penWidth + 1, h - 2 * penWidth + 1, - barBackground ); - /* - * Notice: The Xlib XDrawRectangle() function always fills one - * pixel less than specified. Altough this is very likely just a - * plain old bug, it is documented that way. Obviously, Qt just - * maps the fillRect() call directly to XDrawRectangle() so they - * inherited that bug ( although the Qt doc stays silent about - * it ). So it is really necessary to compensate for that missing - * pixel in each dimension. - * - * If you don't believe it, see for yourself. - * Hint: Try the xmag program to zoom into the drawn pixels. - **/ + float percent = usedPercent(); + if ( percent > 100.0 ) percent = 100.0; + if ( percent < 0.0 ) percent = 0.0; + int x = option.rect.left() + 1; + int y = option.rect.top() + 1; + int w = option.rect.width() - 2; + int h = option.rect.height() - 2; + int fillWidth = 0; + + if ( w > 0 ) + { + fillWidth = (int) ( w * usedPercent() / 100.0 ); // Fill the desired percentage. - painter->fillRect( x + penWidth, y + penWidth, - fillWidth+1, h - 2 * penWidth+1, + painter->fillRect( x, y, fillWidth, h, fillColor ); + QString percentageText; + percentageText.sprintf( "%d%%", usedPercent() ); - // Draw 3D shadows. + if ( usedPercent() > 50 ) { + painter->setPen( treeWidget()->palette().color( QPalette::Base ) ); + painter->drawText( QRect( x, y, + fillWidth - 3, h ), + Qt::AlignRight, percentageText ); + } else { + painter->setPen( treeWidget()->palette().color( QPalette::Text ) ); + painter->drawText( QRect( x + fillWidth + 3, y, + w - fillWidth - 3, h ), + Qt::AlignLeft, percentageText ); - pen.setColor( contrastingColor ( Qt::black, - painter->background().color() ) ); - painter->setPen( pen ); - painter->drawLine( x, y, x+w, y ); - painter->drawLine( x, y, x, y+h ); - - pen.setColor( contrastingColor( barBackground.dark(), - painter->background().color() ) ); - painter->setPen( pen ); - painter->drawLine( x+1, y+1, x+w-1, y+1 ); - painter->drawLine( x+1, y+1, x+1, y+h-1 ); - - pen.setColor( contrastingColor( barBackground.light(), - painter->background().color() ) ); - painter->setPen( pen ); - painter->drawLine( x+1, y+h, x+w, y+h ); - painter->drawLine( x+w, y, x+w, y+h ); - - pen.setColor( contrastingColor( Qt::white, - painter->background().color() ) ); - painter->setPen( pen ); - painter->drawLine( x+2, y+h-1, x+w-1, y+h-1 ); - painter->drawLine( x+w-1, y+1, x+w-1, y+h-1 ); - } + } + } } - - - - #include "QY2DiskUsageList.moc" Modified: branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.h?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.h (original) +++ branches/tmp/coolo/pkg-mgr-love/src/QY2DiskUsageList.h Wed Dec 26 11:30:52 2007 @@ -57,7 +57,6 @@ int nameCol() const { return _nameCol; } int percentageBarCol() const { return _percentageBarCol; } - int percentageCol() const { return _percentageCol; } int usedSizeCol() const { return _usedSizeCol; } int freeSizeCol() const { return _freeSizeCol; } int totalSizeCol() const { return _totalSizeCol; } @@ -74,7 +73,6 @@ int _nameCol; int _percentageBarCol; - int _percentageCol; int _usedSizeCol; int _freeSizeCol; int _totalSizeCol; @@ -200,7 +198,6 @@ int nameCol() const { return _diskUsageList->nameCol(); } int percentageBarCol() const { return _diskUsageList->percentageBarCol(); } - int percentageCol() const { return _diskUsageList->percentageCol(); } int usedSizeCol() const { return _diskUsageList->usedSizeCol(); } int freeSizeCol() const { return _diskUsageList->freeSizeCol(); } int totalSizeCol() const { return _diskUsageList->totalSizeCol(); } @@ -234,13 +231,11 @@ * * Stolen from KDirStat::KDirTreeView with the author's permission. **/ - void paintPercentageBar( float percent, - QPainter * painter, + void paintPercentageBar( QPainter * painter, QStyleOptionViewItem option, - const QColor & fillColor, - const QColor & barBackground ); + const QColor & fillColor); - protected: +protected: // Modified: branches/tmp/coolo/pkg-mgr-love/src/QY2ListView.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/QY2ListView.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/QY2ListView.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/QY2ListView.cc Wed Dec 26 11:30:52 2007 @@ -367,7 +367,7 @@ bool QY2ListViewItem::operator< ( const QTreeWidgetItem & otherListViewItem ) const { - bool sortByInsertionSequence = false; + bool sortByInsertionSequence = false; QY2ListView * parentListView = dynamic_cast<QY2ListView *> (treeWidget()); if ( parentListView ) @@ -429,6 +429,9 @@ _serial = 0; QY2ListView * parentListView = dynamic_cast<QY2ListView *> ( treeWidget() ); + setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); + setCheckState(0, Qt::Unchecked); + if ( parentListView ) _serial = parentListView->nextSerial(); } Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelector.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelector.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelector.cc Wed Dec 26 11:30:52 2007 @@ -207,7 +207,7 @@ // Fire up the first dependency check in the main loop. // Don't do this right away - wait until all initializations are finished. QTimer::singleShot( 0, this, SLOT( resolveDependencies() ) ); - + } #endif } @@ -222,6 +222,7 @@ QSplitter * outer_splitter = new QSplitter( Qt::Horizontal, this ); Q_CHECK_PTR( outer_splitter ); + outer_splitter->setObjectName( "outer_splitter" ); layout->addWidget(outer_splitter); @@ -239,27 +240,23 @@ { QSplitter * splitter = new QSplitter( Qt::Vertical, parent ); Q_CHECK_PTR( splitter ); + splitter->setObjectName( "leftpanesplitter" ); QWidget * upper_vbox = new QWidget( splitter ); QVBoxLayout *layout = new QVBoxLayout(upper_vbox); upper_vbox->setLayout(layout); - + layout->setMargin( 0 ); + layout->setSpacing( 0 ); + Q_CHECK_PTR( upper_vbox ); layoutFilters( upper_vbox ); addVSpacing( upper_vbox, MARGIN ); - QWidget * lower_vbox = new QWidget( splitter ); - layout = new QVBoxLayout(lower_vbox); - lower_vbox->setLayout(layout); - - addVSpacing( lower_vbox, MARGIN ); - _diskUsageList = new YQPkgDiskUsageList( lower_vbox ); - Q_CHECK_PTR( _diskUsageList ); - layout->addWidget(_diskUsageList); - - splitter->setStretchFactor(splitter->indexOf(upper_vbox), 0); - splitter->setStretchFactor(splitter->indexOf(lower_vbox), 1); - + _diskUsageList = new YQPkgDiskUsageList( splitter ); + + splitter->setStretchFactor(splitter->indexOf(upper_vbox), 1); + splitter->setStretchFactor(splitter->indexOf( _diskUsageList ), 2); + return splitter; } @@ -418,14 +415,12 @@ YQPackageSelector::layoutRightPane( QWidget *parent ) { QWidget * right_pane_vbox = new QWidget( parent ); - - QVBoxLayout *layout = new QVBoxLayout(right_pane_vbox); - right_pane_vbox->setLayout(layout); + + QVBoxLayout *layout = new QVBoxLayout( right_pane_vbox ); Q_CHECK_PTR( right_pane_vbox ); layout->setMargin( MARGIN ); - QSplitter * splitter = new QSplitter( Qt::Vertical, right_pane_vbox ); Q_CHECK_PTR( splitter ); @@ -434,11 +429,11 @@ Q_CHECK_PTR( splitter ); layoutPkgList( splitter ); - addVSpacing( splitter, MARGIN ); + //addVSpacing( splitter, MARGIN ); layoutDetailsViews( splitter ); - layoutButtons( splitter ); + layoutButtons( right_pane_vbox ); return right_pane_vbox; } @@ -573,11 +568,12 @@ { QWidget * button_box = new QWidget( parent ); Q_CHECK_PTR( button_box ); + parent->layout()->addWidget( button_box ); QHBoxLayout *layout = new QHBoxLayout(button_box); - button_box->setLayout(layout); - layout->setSpacing( SPACING ); + //layout->setSpacing( SPACING ); + layout->setMargin( 0 ); // Button: Dependency check // Translators: Please keep this short! @@ -717,7 +713,7 @@ Q_CHECK_PTR( submenu ); submenu->addSeparator(); - + _pkgMenu->addAction(_pkgList->actionInstallListSourceRpms); _pkgMenu->addAction(_pkgList->actionDontInstallListSourceRpms); Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelectorBase.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelectorBase.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelectorBase.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPackageSelectorBase.cc Wed Dec 26 11:30:52 2007 @@ -230,7 +230,7 @@ if ( ! changes || ( QMessageBox::warning( this, "", _( "Abandon all changes?" ), - _( "&OK" ), _( "&Cancel" ), "", + _( "&Abandon" ), _( "&Cancel" ), "", 1, // defaultButtonNumber (from 0) 1 ) // escapeButtonNumber == 0 ) // Proceed upon button #0 ( OK ) Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPatternSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPatternSelector.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPatternSelector.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPatternSelector.cc Wed Dec 26 11:30:52 2007 @@ -147,8 +147,8 @@ false, // no autoFill - need to connect to details view first false ); // no autoFilter - filterMatch() is not connected Q_CHECK_PTR( _patternList ); - layout->addWidget(_patternList); - _patternList->header()->hide(); + layout->addWidget(_patternList); + _patternList->header()->hide(); } if ( ! _patternList ) @@ -168,7 +168,7 @@ false, // no autoFill - need to connect to details view first false ); // no autoFilter - filterMatch() is not connected Q_CHECK_PTR( _selList ); - layout->addWidget(_selList); + layout->addWidget(_selList); _selList->header()->hide(); } @@ -182,11 +182,11 @@ QHBoxLayout * hbox = new QHBoxLayout(); Q_CHECK_PTR( hbox ); - layout->addLayout(hbox); + layout->addLayout(hbox); QPushButton * details_button = new QPushButton( _( "&Details..." ), vbox ); Q_CHECK_PTR( details_button ); - hbox->addWidget(details_button); + hbox->addWidget(details_button); connect( details_button, SIGNAL( clicked() ), this, SLOT ( detailedPackageSelection() ) ); @@ -212,31 +212,27 @@ // QWidget *upper_vbox = new QWidget(splitter); QVBoxLayout * layout = new QVBoxLayout(upper_vbox); - + Q_CHECK_PTR( upper_vbox ); _descriptionView = new YQPkgSelDescriptionView( upper_vbox ); Q_CHECK_PTR( _descriptionView ); layout->addWidget(_descriptionView); - layout->addSpacing( MARGIN ); - - // // Disk usage // QWidget *lower_vbox = new QWidget(splitter); - layout = new QVBoxLayout(upper_vbox); + layout = new QVBoxLayout( lower_vbox); Q_CHECK_PTR( lower_vbox ); - layout->addSpacing( MARGIN ); _diskUsageList = new YQPkgDiskUsageList( lower_vbox ); Q_CHECK_PTR( _diskUsageList ); layout->addWidget(_diskUsageList); - splitter->setStretchFactor( 0, 0 ); + splitter->setStretchFactor( 0, 3 ); splitter->setStretchFactor( 0, 1 ); return splitter; @@ -248,14 +244,14 @@ YQPatternSelector::layoutButtons( QWidget * parent ) { QWidget *button_box = new QWidget(parent); + Q_CHECK_PTR( button_box ); + + parent->layout()->addWidget( button_box ); QHBoxLayout *layout = new QHBoxLayout(button_box); - Q_CHECK_PTR( button_box ); layout->setMargin ( MARGIN ); layout->setSpacing( SPACING ); - button_box->setLayout(layout); - QPushButton * details_button = new QPushButton( _( "&Details..." ), button_box ); layout->addWidget(details_button); Q_CHECK_PTR( details_button ); Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgChangesDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgChangesDialog.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgChangesDialog.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgChangesDialog.cc Wed Dec 26 11:30:52 2007 @@ -121,7 +121,7 @@ QPushButton * button = new QPushButton( acceptButtonLabel, this ); Q_CHECK_PTR( button ); - layout->addWidget( button ); + hbox->addWidget( button ); button->setDefault( true ); connect( button, SIGNAL( clicked() ), @@ -129,14 +129,13 @@ hbox->addStretch(); - if ( ! rejectButtonLabel.isEmpty() ) { // Reject button ( if desired ) - usually "Cancel" button = new QPushButton( rejectButtonLabel, this ); Q_CHECK_PTR( button ); - hbox->addWidget(button); + hbox->addWidget(button); connect( button, SIGNAL( clicked() ), this, SLOT ( reject() ) ); @@ -159,7 +158,7 @@ _pkgList->clear(); set<string> ignoredNames; - + if ( ! byUser || ! byApp ) ignoredNames = zypp::ui::userWantedPackageNames(); Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.cc Wed Dec 26 11:30:52 2007 @@ -22,7 +22,10 @@ #include <QPixmap> #include <QDateTime> #include <QMessageBox> +#include <QRadioButton> #include <QList> +#include <QDebug> +#include <QVBoxLayout> #include <errno.h> @@ -56,12 +59,14 @@ YQPkgConflictList::YQPkgConflictList( QWidget * parent ) - : QY2ListView( parent ) + : QScrollArea( parent ), _layout( 0 ) { + setWidgetResizable( true ); + clear(); - setHeaderLabel( _( "Dependency Conflict" ) ); - setRootIsDecorated( true ); - setSortByInsertionSequence( true ); + //setHeaderLabel( _( "Dependency Conflict" ) ); + //setRootIsDecorated( true ); + //setSortByInsertionSequence( true ); } @@ -70,6 +75,15 @@ // NOP } +void +YQPkgConflictList::clear() +{ + delete widget(); + delete _layout; + setWidget( new QFrame( this ) ); + widget()->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + _layout = new QVBoxLayout; +} void YQPkgConflictList::fill( zypp::ResolverProblemList problemList ) @@ -77,7 +91,6 @@ clear(); string text; - zypp::ResolverProblemList::iterator it = problemList.begin(); while ( it != problemList.end() ) @@ -85,8 +98,13 @@ YQPkgConflict * conflict = new YQPkgConflict( this, *it ); Q_CHECK_PTR( conflict ); + _layout->addWidget( conflict ); ++it; } + + widget()->setLayout( _layout ); + widget()->setMinimumSize( 100, 100 ); + widget()->show(); } @@ -95,6 +113,7 @@ { zypp::ProblemSolutionList userChoices; +#if 0 int count=0; QTreeWidgetItem * child; @@ -114,7 +133,7 @@ } zypp::getZYpp()->resolver()->applySolutions( userChoices ); - +#endif emit updatePackages(); } @@ -133,9 +152,10 @@ void YQPkgConflictList::saveToFile( const QString filename, bool interactive ) const { +#if 0 // Open file QFile file(filename); - + if ( ! file.open(QIODevice::WriteOnly) ) { y2error( "Can't open file %s", qPrintable(filename) ); @@ -184,12 +204,14 @@ if ( file.isOpen() ) file.close(); + +#endif } void YQPkgConflictList::saveItemToFile( QFile &file, - const QTreeWidgetItem * item ) const + const YQPkgConflict * item ) const { #if FIXME if ( ! item || ! file.isOpen() ) @@ -239,6 +261,7 @@ } +#if FIXME void YQPkgConflictList::dumpList( QTreeWidgetItem * parent, const QString & longText, @@ -254,7 +277,7 @@ if ( longText.isEmpty() ) return; -#if FIXME + if ( ! header.isEmpty() ) { parent = new QY2ListViewItem( parent, header ); @@ -292,28 +315,24 @@ new QY2ListViewItem( parent, *it ); ++it; } -#endif } - - - - - - +#endif YQPkgConflict::YQPkgConflict( YQPkgConflictList * parentList, zypp::ResolverProblem_Ptr problem ) - : QY2ListViewItem( parentList ) + : QFrame( parentList->widget() ) , _problem( problem ) , _resolutionsHeader( 0 ) { - setBackgroundColor( LIGHT_BLUE ); - setExpanded( true ); - + setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + setObjectName( "YQPkgConflict" ); + _layout = new QVBoxLayout( this ); formatHeading(); - YQPkgConflictList::dumpList( this, fromUTF8( _problem->details() ) ); + qDebug() << "YQPkgConflict" << fromUTF8( _problem->details() ); + //YQPkgConflictList::dumpList( this, ); addSolutions(); + _layout->activate(); } @@ -322,56 +341,41 @@ { QString text; QPixmap icon = YQIconPool::normalPkgConflict(); - setTextColor( BRIGHT_RED ); - setData( 0, Qt::DisplayRole, fromUTF8( problem()->description() ) ); - setData( 0, Qt::DecorationRole, icon ); + text = fromUTF8( problem()->description() ); + QLabel *heading = new QLabel( text, this ); + heading->setPixmap( icon ); + _layout->addWidget( heading ); } void YQPkgConflict::addSolutions() { - _resolutionsHeader = new QY2CheckListItem( this, - // Heading for the choices - // how to resolve this conflict - _( "Conflict Resolution:" ) ); + // Heading for the choices + // how to resolve this conflict + _resolutionsHeader = new QLabel( _( "Conflict Resolution:" ), this ); + _layout->addWidget( _resolutionsHeader ); Q_CHECK_PTR( _resolutionsHeader ); - _resolutionsHeader->setExpanded( true ); - _resolutionsHeader->setBackgroundColor( LIGHT_GREY ); - zypp::ProblemSolutionList solutions = problem()->solutions(); zypp::ProblemSolutionList::iterator it = solutions.begin(); while ( it != solutions.end() ) { - YQPkgConflictResolution * solution = new YQPkgConflictResolution( _resolutionsHeader, *it ); - Q_CHECK_PTR( solution ); - //FIXME solution->setExpanded(true); + QRadioButton * s = new QRadioButton( fromUTF8( ( *it )->description() ), this ); + Q_CHECK_PTR( s ); + _solutions[ s ] = *it; + _layout->addWidget( s ); ++it; } } - -// void -// YQPkgConflict::paintCell( QPainter * painter, -// const QColorGroup & colorGroup, -// int column, -// int width, -// int alignment ) -// { -// painter->setFont( YQUI::yqApp()->headingFont() ); -// #if FIXME -// QY2ListViewItem::paintCell( painter, colorGroup, column, width, alignment ); -// #endif -// } - - zypp::ProblemSolution_Ptr YQPkgConflict::userSelectedResolution() { +#if 0 QTreeWidgetItem * item; QTreeWidgetItemIterator it(_resolutionsHeader); @@ -391,25 +395,9 @@ ++it; } +#endif return zypp::ProblemSolution_Ptr(); // Null pointer } - - - - - -YQPkgConflictResolution::YQPkgConflictResolution( QY2CheckListItem * parent, - zypp::ProblemSolution_Ptr solution ) - : QY2CheckListItem( parent, - fromUTF8( solution->description() ) ) - /*, Q3CheckListItem::RadioButton) */ -{ - _solution = solution; - YQPkgConflictList::dumpList( this, fromUTF8( solution->details() ) ); -} - - - #include "YQPkgConflictList.moc" Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.h?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.h (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgConflictList.h Wed Dec 26 11:30:52 2007 @@ -24,13 +24,14 @@ #include <stdio.h> #include <QMap> #include <QFile> -#include "QY2ListView.h" +#include <QScrollArea> #include <zypp/Resolver.h> #include <zypp/ResolverProblem.h> #include <zypp/ProblemSolution.h> - +class QVBoxLayout; +class QRadioButton; class QAction; class YQPkgConflict; class YQPkgConflictResolution; @@ -41,7 +42,7 @@ * @short Display package dependency conflicts in a tree list and let the user * choose how to resolve each conflict. **/ -class YQPkgConflictList : public QY2ListView +class YQPkgConflictList : public QScrollArea { Q_OBJECT @@ -64,12 +65,12 @@ /** * Check if the conflict list is empty. **/ - bool isEmpty() const { return topLevelItemCount() == 0; } + bool isEmpty() const { return count() == 0; } /** * Returns the number of conflicts in the list. **/ - int count() const { return topLevelItemCount(); } + int count() const { return _conflicts.count(); } public slots: @@ -89,6 +90,7 @@ **/ void askSaveToFile() const; + void clear(); public: @@ -102,25 +104,15 @@ **/ void saveToFile( const QString filename, bool interactive ) const; - /** - * Dump a multi-line text to a QListView as a sequence of separate items. - * If 'longText' has considerably more lines than 'splitThreshold', fold - * all lines from no. 'splitThreshold' on into a closed list item - * "More...". - * If 'header' is not empty, it will be added as the parent of the lines. - **/ - static void dumpList( QTreeWidgetItem * parent, - const QString & longText, - const QString & header = QString::null, - int splitThreshold = 3 ); - protected: /** * (Recursively) save one item to file. **/ - void saveItemToFile( QFile &file, const QTreeWidgetItem * item ) const; + void saveItemToFile( QFile &file, const YQPkgConflict * item ) const; + QList<YQPkgConflict> _conflicts; + QVBoxLayout *_layout; signals: @@ -128,6 +120,7 @@ * Update package states - they may have changed. **/ void updatePackages(); + }; @@ -135,7 +128,7 @@ /** * @short Root item for each individual conflict **/ -class YQPkgConflict: public QY2ListViewItem +class YQPkgConflict: public QFrame { public: @@ -174,49 +167,13 @@ **/ void addSolutions(); - /** - * Paint method. Reimplemented from @ref QListViewItem so a different - * font can be used. - * - * Reimplemented from QY2ListViewItem. - **/ -// virtual void paintCell( QPainter * painter, -// const QColorGroup & colorGroup, -// int column, -// int width, -// int alignment ); - - // Data members zypp::ResolverProblem_Ptr _problem; - QY2CheckListItem * _resolutionsHeader; -}; - - - -class YQPkgConflictResolution: public QY2CheckListItem -{ -public: - - /** - * Constructor - **/ - YQPkgConflictResolution( QY2CheckListItem * parent, - zypp::ProblemSolution_Ptr _solution ); - - /** - * Return the corresponding ProblemSolution. - **/ - zypp::ProblemSolution_Ptr solution() const { return _solution; } - - -protected: - - // Data members - - zypp::ProblemSolution_Ptr _solution; + QLabel * _resolutionsHeader; + QList<zypp::ProblemSolution_Ptr> _resolutions; + QMap<QRadioButton*, zypp::ProblemSolution_Ptr> _solutions; + QVBoxLayout *_layout; }; - #endif // ifndef YQPkgConflictList_h Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgDiskUsageList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgDiskUsageList.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgDiskUsageList.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgDiskUsageList.cc Wed Dec 26 11:30:52 2007 @@ -86,7 +86,18 @@ _items.insert( QString::fromUtf8(partitionDu.dir.c_str()), item ); } } - + resizeColumnToContents( nameCol() ); + resizeColumnToContents( usedSizeCol() ); + resizeColumnToContents( freeSizeCol() ); + resizeColumnToContents( totalSizeCol() ); + + sortByColumn( percentageBarCol(), Qt::DescendingOrder ); + + header()->setResizeMode( percentageBarCol(), QHeaderView::Stretch ); + header()->setResizeMode( totalSizeCol(), QHeaderView::Fixed ); + header()->setResizeMode( nameCol(), QHeaderView::ResizeToContents ); + header()->setResizeMode( usedSizeCol(), QHeaderView::ResizeToContents ); + header()->setResizeMode( freeSizeCol(), QHeaderView::ResizeToContents ); } @@ -111,9 +122,7 @@ y2error( "No entry for mount point %s", partitionDu.dir.c_str() ); } -#if FIXME - sort(); -#endif + resizeColumnToContents( totalSizeCol() ); postPendingWarnings(); } @@ -148,6 +157,8 @@ QSize YQPkgDiskUsageList::sizeHint() const { + QFontMetrics fms( font() ); + return QSize( fms.width( "/var/usr/home 100% 100.32GB" ) + 50, 100 ); #ifdef FIXME int width = header()->headerWidth() Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgList.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgList.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgList.cc Wed Dec 26 11:30:52 2007 @@ -27,6 +27,7 @@ #include <QMenu> #include <QMessageBox> #include <QFile> +#include <QHeaderView> #include "utf8.h" @@ -45,10 +46,11 @@ int numCol = 0; QStringList headers; - - headers << ""; _statusCol = numCol++; + + //headers << ""; _statusCol = numCol++; // _statusCol = numCol; headers << _( "Package" ); _nameCol = numCol++; + _statusCol = _nameCol; headers << _( "Summary" ); _summaryCol = numCol++; headers << _( "Size" ); _sizeCol = numCol++; @@ -71,10 +73,13 @@ #endif setHeaderLabels(headers); saveColumnWidths(); - //FIXME sort( nameCol() ); + sortByColumn( nameCol(), Qt::DescendingOrder ); //FIXME setColumnAlignment( sizeCol(), Qt::AlignRight ); setAllColumnsShowFocus( true ); + header()->setResizeMode( QHeaderView::ResizeToContents ); + setIconSize( QSize( 22, 16 ) ); + createActions(); createSourceRpmContextMenu(); @@ -552,6 +557,8 @@ _zyppPkg = tryCastToZyppPkg( selectable->theObj() ); setSourceRpmIcon(); + + setTextAlignment( sizeCol(), Qt::AlignRight ); } Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgObjList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgObjList.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgObjList.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgObjList.cc Wed Dec 26 11:30:52 2007 @@ -90,6 +90,7 @@ connect( this, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ), this, SLOT ( currentItemChangedInternal( QTreeWidgetItem * ) ) ); + } @@ -366,7 +367,7 @@ //item->setSelected( false ); // Doesn't emit signals scrollToItem( *it ); // Scroll if necessary setCurrentItem( *it ); // Emits signals - + } } @@ -947,6 +948,7 @@ setText( versionCol(), zyppObj()->edition() ); } + setStatusIcon(); } @@ -1048,14 +1050,14 @@ if ( statusCol() >= 0 ) { bool enabled = editable() && _pkgObjList->editable(); - setData( statusCol(), Qt::DecorationRole, _pkgObjList->statusIcon( status(), enabled, bySelection() ) ); + setIcon( statusCol(), _pkgObjList->statusIcon( status(), enabled, bySelection() ) ); } if ( brokenIconCol() >= 0 ) { // Reset this icon now - it might be the same column as satisfiedIconCol() - setData( brokenIconCol(), Qt::DecorationRole, QPixmap() ); + setIcon( brokenIconCol(), QPixmap() ); } if ( satisfiedIconCol() >= 0 ) @@ -1064,7 +1066,7 @@ // but satisfied anyway (e.g. for patches or patterns where the user // selected all required packages manually) - setData( satisfiedIconCol(), Qt::DecorationRole, isSatisfied() ? YQIconPool::pkgSatisfied() : QPixmap() ); + setIcon( satisfiedIconCol(), isSatisfied() ? YQIconPool::pkgSatisfied() : QPixmap() ); } if ( brokenIconCol() >= 0 ) @@ -1074,7 +1076,7 @@ if ( isBroken() ) { - setData( brokenIconCol(), Qt::DecorationRole, YQIconPool::warningSign() ); + setIcon( brokenIconCol(), YQIconPool::warningSign() ); y2warning( "Broken object: %s - %s", _selectable->theObj()->name().c_str(), _selectable->theObj()->summary().c_str() ); @@ -1380,7 +1382,7 @@ if ( col == sizeCol() ) { // Numeric sort by size - + return ( this->zyppObj()->size() < other->zyppObj()->size() ); } else if ( col == statusCol() ) Modified: branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgPatternList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgPatternList.cc?rev=43237&r1=43236&r2=43237&view=diff ============================================================================== --- branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgPatternList.cc (original) +++ branches/tmp/coolo/pkg-mgr-love/src/pkg/YQPkgPatternList.cc Wed Dec 26 11:30:52 2007 @@ -139,7 +139,6 @@ _categories.insert( categoryName, cat ); } - return cat; } @@ -342,11 +341,6 @@ return QTreeWidgetItem::operator<( otherListViewItem ); } - - - - - YQPkgPatternCategoryItem::YQPkgPatternCategoryItem( YQPkgPatternList * patternList, const QString & category ) : QY2ListViewItem( patternList ) @@ -390,10 +384,10 @@ void YQPkgPatternCategoryItem::setTreeIcon() { - setData( _patternList->statusCol(), Qt::DecorationRole, - isExpanded() ? - YQIconPool::treeMinus() : - YQIconPool::treePlus() ); + setIcon( _patternList->statusCol(), + isExpanded() ? + YQIconPool::treeMinus() : + YQIconPool::treePlus() ); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org