Author: coolo
Date: Sun Jan 13 11:59:18 2008
New Revision: 43569
URL: http://svn.opensuse.org/viewcvs/yast?rev=43569&view=rev
Log:
show the details of a solution too
Modified:
trunk/qt/src/pkg/YQPkgConflictList.cc
trunk/qt/src/pkg/YQPkgConflictList.h
Modified: trunk/qt/src/pkg/YQPkgConflictList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgConflictList.cc?rev=43569&r1=43568&r2=43569&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgConflictList.cc (original)
+++ trunk/qt/src/pkg/YQPkgConflictList.cc Sun Jan 13 11:59:18 2008
@@ -24,6 +24,7 @@
#include <QMessageBox>
#include <QRadioButton>
#include <QList>
+#include <QToolTip>
#include <QDebug>
#include <QVBoxLayout>
@@ -66,9 +67,9 @@
widget()->setLayout( _layout );
clear();
+ widget()->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
+
//setHeaderLabel( _( "Dependency Conflict" ) );
- //setRootIsDecorated( true );
- //setSortByInsertionSequence( true );
}
@@ -97,10 +98,6 @@
clear();
string text;
- // for some weired reason, the layout's minSize is still 18x18 even after 3000 pixels
- // inserted, so we have to do the math on our own
- QSize minSize = QSize( _layout->margin() * 2, _layout->margin() * 2 );
-
zypp::ResolverProblemList::iterator it = problemList.begin();
while ( it != problemList.end() )
@@ -108,19 +105,32 @@
YQPkgConflict *conflict = new YQPkgConflict( widget(), *it );
Q_CHECK_PTR( conflict );
- minSize = minSize.expandedTo( conflict->minimumSizeHint() );
- minSize.rheight() += conflict->minimumSizeHint().height() + _layout->spacing();
+ connect( conflict, SIGNAL( expanded() ),
+ SLOT( relayout() ) );
_layout->addWidget( conflict );
_conflicts.push_back( conflict );
++it;
}
_layout->addStretch( 1 );
+ relayout();
+}
+
+void YQPkgConflictList::relayout()
+{
+ // for some weired reason, the layout's minSize is still 18x18 even after 3000 pixels
+ // inserted, so we have to do the math on our own
+ QSize minSize = QSize( _layout->margin() * 2, _layout->margin() * 2 );
+
+ YQPkgConflict * conflict;
+ foreach( conflict, _conflicts )
+ {
+ minSize = minSize.expandedTo( conflict->minimumSizeHint() );
+ minSize.rheight() += conflict->minimumSizeHint().height() + _layout->spacing();
+ }
widget()->resize( minSize );
- setWidgetResizable( false );
}
-
void
YQPkgConflictList::applyResolutions()
{
@@ -215,10 +225,10 @@
formatHeading();
QLabel *label = new QLabel( fromUTF8 ( _problem->details() ), this );
_layout->addWidget( label );
- //YQPkgConflictList::dumpList( this, );
addSolutions();
setMinimumSize( _layout->minimumSize() );
+ setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
}
@@ -270,10 +280,48 @@
_solutions[ s ] = *it;
vbox->addWidget( s );
+ QString details = fromUTF8( ( *it )->details() );
+ if ( !details.isEmpty() )
+ {
+ QStringList lines = details.split( "\n" );
+ if ( lines.count() > 7 )
+ {
+ details = "<qt>";
+ for ( int i = 0; i < 4; i++ )
+ details += lines[i] + "<br>\n";
+ details += _( "<a href='/'>%1 more...</a>" ).arg( lines.count() - 4 );
+ }
+ QLabel * d = new QLabel( details, this );
+ connect( d, SIGNAL( linkActivated ( const QString & ) ),
+ SLOT( detailsExpanded() ) );
+ connect( d, SIGNAL( linkHovered ( const QString & ) ),
+ SLOT( detailsTooltip() ) );
+
+ QHBoxLayout *hbox = new QHBoxLayout();
+ hbox->addSpacing( 15 );
+ hbox->addWidget( d );
+ vbox->addLayout( hbox );
+ _details[ d ] = *it;
+ }
++it;
}
}
+void
+YQPkgConflict::detailsExpanded()
+{
+ QLabel *obj = qobject_cast