Mailinglist Archive: yast-commit (683 mails)

< Previous Next >
[yast-commit] r43239 - in /trunk/qt/src/pkg: YQPkgConflictList.cc YQPkgList.cc YQPkgObjList.cc
  • From: coolo@xxxxxxxxxxxxxxxx
  • Date: Fri, 28 Dec 2007 22:38:41 -0000
  • Message-id: <20071228223841.C67D623BE4@xxxxxxxxxxxxxxxx>
Author: coolo
Date: Fri Dec 28 23:38:41 2007
New Revision: 43239

URL: http://svn.opensuse.org/viewcvs/yast?rev=43239&view=rev
Log:
play around with sorting of the package list

Modified:
trunk/qt/src/pkg/YQPkgConflictList.cc
trunk/qt/src/pkg/YQPkgList.cc
trunk/qt/src/pkg/YQPkgObjList.cc

Modified: trunk/qt/src/pkg/YQPkgConflictList.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgConflictList.cc?rev=43239&r1=43238&r2=43239&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgConflictList.cc (original)
+++ trunk/qt/src/pkg/YQPkgConflictList.cc Fri Dec 28 23:38:41 2007
@@ -66,10 +66,6 @@
widget()->setLayout( _layout );
clear();

- QLayoutItem *b = new QSpacerItem(0, 0, QSizePolicy::Minimum,
- QSizePolicy::Expanding);
-
-
//setHeaderLabel( _( "Dependency Conflict" ) );
//setRootIsDecorated( true );
//setSortByInsertionSequence( true );

Modified: trunk/qt/src/pkg/YQPkgList.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgList.cc?rev=43239&r1=43238&r2=43239&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgList.cc (original)
+++ trunk/qt/src/pkg/YQPkgList.cc Fri Dec 28 23:38:41 2007
@@ -27,6 +27,8 @@
#include <QMenu>
#include <QMessageBox>
#include <QFile>
+#include <QTreeView>
+#include <QDebug>
#include <QHeaderView>

#include "utf8.h"
@@ -47,10 +49,8 @@
QStringList headers;


- //headers << ""; _statusCol = numCol++;
- // _statusCol = numCol;
+ headers << ""; _statusCol = numCol++;
headers << _( "Package" ); _nameCol = numCol++;
- _statusCol = _nameCol;

headers << _( "Summary" ); _summaryCol = numCol++;
headers << _( "Size" ); _sizeCol = numCol++;
@@ -72,13 +72,28 @@
headers << _( "Source" ); _srpmStatusCol = numCol++;
#endif
setHeaderLabels(headers);
- saveColumnWidths();
- sortByColumn( nameCol(), Qt::DescendingOrder );
- //FIXME setColumnAlignment( sizeCol(), Qt::AlignRight );
+
+ setSortingEnabled( true );
+ header()->setSortIndicatorShown( true );
+ header()->setClickable( true );
+
+ sortByColumn( nameCol(), Qt::AscendingOrder );
+
setAllColumnsShowFocus( true );

- header()->setResizeMode( QHeaderView::ResizeToContents );
setIconSize( QSize( 22, 16 ) );
+ // resize to minimum
+ setColumnWidth( statusCol(), 25 );
+ QFontMetrics fms( font() );
+ setColumnWidth( sizeCol(), fms.width( "8780.2 K" ) );
+ setColumnWidth( instVersionCol(), fms.width( " 20071220pre" ) );
+ setColumnWidth( versionCol(), fms.width( " 20071220pre" ) );
+ setColumnWidth( nameCol(), fms.width( "opensuse-release " ) );
+ setColumnWidth( summaryCol(), fms.width( "A really really long text, but
not too long" ) );
+
+ header()->setResizeMode( QHeaderView::Interactive );
+
+ saveColumnWidths();

createActions();

@@ -442,7 +457,7 @@
if ( instVersion.isEmpty() ) instVersion = "---";

QString status = "[" + statusText( pkg->status() ) + "]";
- QString format;
+ QString format;
format.sprintf("%-20s %-30s | %10s | %-16s | %-16s\n",
(const char *) status.toUtf8(),
(const char *) pkg->text( nameCol() ),
@@ -450,7 +465,7 @@
(const char *) candVersion,
(const char *) instVersion
);
- file.write(format.toUtf8());
+ file.write(format.toUtf8());
}

item = item->nextSibling();
@@ -460,7 +475,7 @@
// Clean up

if ( file.isOpen() )
- file.close();
+ file.close();
}


@@ -559,6 +574,7 @@
setSourceRpmIcon();

setTextAlignment( sizeCol(), Qt::AlignRight );
+ setSizeHint( sizeCol(), QSize( QFontMetrics( pkgList->font() ).width(
text( sizeCol() ) ), 10 ) );
}


@@ -738,11 +754,11 @@

bool YQPkgListItem::operator< ( const QTreeWidgetItem & otherListViewItem )
const
{
+ const YQPkgListItem * other = dynamic_cast<const YQPkgListItem *>
(&otherListViewItem);
+
int col = treeWidget()->sortColumn();
if ( col == srpmStatusCol() )
{
- const YQPkgListItem * other = dynamic_cast<const YQPkgListItem *>
(&otherListViewItem);
-
if ( other )
{
int thisPoints = ( this->hasSourceRpm() ? 1 : 0 ) + (
this->installSourceRpm() ? 1 : 0 );

Modified: trunk/qt/src/pkg/YQPkgObjList.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgObjList.cc?rev=43239&r1=43238&r2=43239&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgObjList.cc (original)
+++ trunk/qt/src/pkg/YQPkgObjList.cc Fri Dec 28 23:38:41 2007
@@ -24,8 +24,8 @@
#include <QHeaderView>
#include <QMenu>
#include <QAction>
-//Added by qt3to4:
-#include <qevent.h>
+#include <QDebug>
+#include <QKeyEvent>

#include "utf8.h"

@@ -129,7 +129,6 @@
if ( sizeCol() >= 0 && size > 0L )
{
QString sizeStr = size.form().c_str();
- sizeStr += " ";
item->setText( sizeCol(), sizeStr );
}
}
@@ -776,7 +775,6 @@
}
}

-
void
YQPkgObjList::applyExcludeRules( QTreeWidgetItem * listViewItem )
{
@@ -925,7 +923,7 @@
zypp::ByteCount size = zyppObj()->size();

if ( size > 0L )
- setText( sizeCol(), size.asString() + " " );
+ setText( sizeCol(), size.asString() );
}

if ( instVersionCol() >= 0 )
@@ -1393,7 +1391,10 @@
// dangerous or noteworthy states first - e.g., "taboo" which should
// seldeom occur, but when it does, it is important.

- return ( this->status() < other->status() );
+ bool b = ( this->status() < other->status() );
+ if ( !b && this->status() == other->status() )
+ b = this->zyppObj()->name() < other->zyppObj()->name();
+ return b;
}
else if ( col == instVersionCol() ||
col == versionCol() )
@@ -1441,9 +1442,6 @@
_excluded = excl;
}

-
-
-
YQPkgObjList::ExcludeRule::ExcludeRule( YQPkgObjList * parent,
const QRegExp & regexp,
int column )

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages