[yast-commit] r48053 - in /trunk/ncurses-pkg: package/yast2-ncurses-pkg.changes src/NCPkgPopupDeps.cc src/NCPkgPopupDeps.h
Author: gs Date: Wed Jun 4 12:18:45 2008 New Revision: 48053 URL: http://svn.opensuse.org/viewcvs/yast?rev=48053&view=rev Log: Improve dependency popup: show solution details (NCRichText), only add NCSpacing if there's enough space Modified: trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes trunk/ncurses-pkg/src/NCPkgPopupDeps.cc trunk/ncurses-pkg/src/NCPkgPopupDeps.h Modified: trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes?rev=48053&r1=48052&r2=48053&view=diff ============================================================================== --- trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes (original) +++ trunk/ncurses-pkg/package/yast2-ncurses-pkg.changes Wed Jun 4 12:18:45 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Jun 4 12:13:54 CEST 2008 - gs@suse.de + +- Improve dependency popup: show solution details (NCRichText), + only add NCSpacing if there's enough space + +------------------------------------------------------------------- Thu May 29 10:12:08 CEST 2008 - gs@suse.de - Show the status of a language pattern and make installation Modified: trunk/ncurses-pkg/src/NCPkgPopupDeps.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgPopupDeps.cc?rev=48053&r1=48052&r2=48053&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgPopupDeps.cc (original) +++ trunk/ncurses-pkg/src/NCPkgPopupDeps.cc Wed Jun 4 12:18:45 2008 @@ -44,7 +44,7 @@ typedef NCProblemSelectionBox Self; NCProblemSelectionBox (const Self &); // prohibit copying Self & operator= (const Self &); // prohibit assignment - + NCPkgPopupDeps * depsPopup; // to notify about changes protected: @@ -66,7 +66,8 @@ Self & operator= (const Self &); // prohibit assignment NCPkgPopupDeps * depsPopup; - + std::map<YItem *, string> detailsMap; + protected: virtual NCursesEvent wHandleInput( wint_t ch ); @@ -77,6 +78,7 @@ , depsPopup (aDepsPopup) {} virtual ~NCSolutionSelectionBox () {} + void saveDetails( YItem * item, string details ) { detailsMap[item] = details; } }; using namespace std; @@ -96,6 +98,7 @@ , solutionw( 0 ) , head( 0 ) , details( 0 ) + , solDetails( 0 ) , packager( pkger ) , problemw( 0 ) @@ -129,38 +132,53 @@ // vertical split is the (only) child of the dialog NCLayoutBox * vSplit = new NCLayoutBox( this, YD_VERT ); - // FIXME - // opt.vWeight.setValue( 40 ); - vSplit->setNotify( true ); new NCSpacing( vSplit, YD_VERT, false, 1 ); - head = new NCLabel( vSplit, "", true, false ); // isHeading = true + head = new NCLabel( vSplit, "", true ); // isHeading = true - new NCSpacing( vSplit, YD_VERT, false, 1 ); + // only add spacings if there's enough space + if ( this->preferredHeight() > 25 ) + new NCSpacing( vSplit, YD_VERT, false, 1 ); + + NCAlignment * left = new NCAlignment( vSplit, YAlignBegin, YAlignUnchanged ); + left->setWeight(YD_VERT, 30 ); - // add the list containing packages with unresolved dependencies - problemw = new NCProblemSelectionBox( vSplit, _("&Problems"), this); + // the list containing the problems (the unresolved package dependencies) + problemw = new NCProblemSelectionBox( left, _("&Problems"), this); problemw->setStretchable( YD_HORIZ, true ); - new NCSpacing( vSplit, YD_VERT, false, 1 ); + NCAlignment * left1 = new NCAlignment( vSplit, YAlignBegin, YAlignUnchanged ); + left1->setWeight(YD_VERT, 10 ); - NCAlignment * left = new NCAlignment( vSplit, YAlignBegin, YAlignUnchanged ); + // show the details of the problem + details = new NCLabel ( left1, "", false, true ); // heading = false, + details->setStretchable( YD_HORIZ, true ); // outputField = true - // heading = false, outputField = true - details = new NCLabel ( left,"", false, true ); - - new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = true + if ( this->preferredHeight() > 25 ) + new NCSpacing( vSplit, YD_VERT, false, 0.5 ); // stretchable = false - // add the package list containing the dependencies - solutionw = new NCSolutionSelectionBox ( vSplit, _("Possible &Solutions"), this); + NCAlignment * left2 = new NCAlignment( vSplit, YAlignBegin, YAlignUnchanged ); + left2->setWeight( YD_VERT, 30 ); + + // the list containing the solutions of a dependency problem + solutionw = new NCSolutionSelectionBox ( left2, _("Possible &Solutions"), this); + + if ( this->preferredHeight() > 25 ) + new NCSpacing( vSplit, YD_VERT, false, 1 ); + + NCAlignment * left3 = new NCAlignment( vSplit, YAlignBegin, YAlignUnchanged ); + left3->setWeight( YD_VERT, 30 ); + + // show the details of the solution + solDetails = new NCRichText ( left3, "", true ); // plain text mode = true - new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = false + if ( this->preferredHeight() > 25 ) + new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = false NCLayoutBox * hSplit = new NCLayoutBox( vSplit, YD_HORIZ ); - - + // add the solve button solveButton = new NCPushButton( hSplit, NCPkgStrings::SolveLabel() ); solveButton->setFunctionKey( 10 ); @@ -170,8 +188,9 @@ // add the cancel button cancelButton = new NCPushButton( hSplit, NCPkgStrings::CancelLabel() ); cancelButton->setFunctionKey( 9 ); - - new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = false + + if ( this->preferredHeight() > 25 ) + new NCSpacing( vSplit, YD_VERT, false, 0.5 ); // stretchable = false } /////////////////////////////////////////////////////////////////// @@ -260,15 +279,15 @@ e = rproblems.end (), i; int idx; - yuiMilestone() << "PROBLEMS" << endl; + for (i = b, idx = 0; i != e; ++i, ++idx) { - yuiMilestone() << "PROB " << (*i)->description () << endl; - yuiMilestone() << ": " << (*i)->details () << endl; + yuiMilestone() << "Problem: " << (*i)->description () << endl; + yuiMilestone() << "Details: " << (*i)->details () << endl; // no solution yet problems.push_back (make_pair (*i, zypp::ProblemSolution_Ptr ())); - //problemw->itemAdded ((*i)->description (), idx, false /*selected*/); + problemw->addItem( (*i)->description(), false ); // selected: false } @@ -298,14 +317,34 @@ bb = solutions.begin (), ee = solutions.end (), ii; + + bool showDetails = true;; + string description; + for (ii = bb; ii != ee; ++ii) { - yuiMilestone() << " SOL " << (*ii)->description () << endl; - yuiMilestone() << " : " << (*ii)->details () << endl; + yuiMilestone() << "Solution: " << (*ii)->description () << endl; + yuiMilestone() << "Details: " << (*ii)->details () << endl; + yuiMilestone() << "User decision: " << user_solution << endl; - solutionw->addItem( new YItem ( (*ii)->description(), // label - (user_solution == *ii) ) ); // selected + description = (*ii)->description(); - yuiMilestone() << "usr: " << user_solution << " cur: " << *ii << endl; + if ( !((*ii)->details().empty()) ) + // hint for the user: more information below + description += _(" see below"); + + if ( showDetails ) + { + showSolutionDetails( (*ii)->details() ); // show details of 1. solution + showDetails = false; + } + + YItem *newItem = new YItem ( description, // text + (user_solution == *ii) ); // selected ? + + solutionw->addItem( newItem ); + solutionw->saveDetails( newItem, (*ii)->details() ); + + yuiDebug() << "Solution: " << (*ii) << endl; // Complete info } solutionw->doneMultipleChanges(); @@ -470,6 +509,21 @@ problems[prob_num] = make_pair (problem, sol); } +void NCPkgPopupDeps::showSolutionDetails( string details ) +{ + string text; + if ( details.empty() ) + // hint for the user: there isn't any additional information + // (for the currently selected solution of a dependency problem) + text = _("No further solution details available"); + else + text = details; + + if ( solDetails ) + solDetails->setText( text ); + +} + /////////////////////////////////////////////////////////////////// // // @@ -519,7 +573,7 @@ NCursesEvent NCSolutionSelectionBox::wHandleInput( wint_t key ) { NCursesEvent ret = NCMultiSelectionBox::wHandleInput( key ); - + switch ( key ) { case KEY_SPACE: @@ -536,6 +590,13 @@ } break; } + case KEY_UP: + case KEY_DOWN: { + // show details + depsPopup->showSolutionDetails( detailsMap[currentItem()] ); + break; + } + default: { break; } Modified: trunk/ncurses-pkg/src/NCPkgPopupDeps.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgPopupDeps.h?rev=48053&r1=48052&r2=48053&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgPopupDeps.h (original) +++ trunk/ncurses-pkg/src/NCPkgPopupDeps.h Wed Jun 4 12:18:45 2008 @@ -34,7 +34,8 @@ class NCSelectionBox; class NCMultiSelectionBox; class NCPackageSelector; -class NCInputField; +class NCRichText; +class NCSolutionSelectionBox; namespace PkgDep { class ErrorResult; @@ -72,11 +73,12 @@ NCPushButton * cancelButton; NCPushButton * solveButton; - NCMultiSelectionBox * solutionw; // resolver problem solutions + NCSolutionSelectionBox * solutionw; // resolver problem solutions NCLabel * head; // the headline NCLabel *details; // problem details + NCRichText *solDetails; // solution details NCPackageSelector * packager; // connection to the package selector @@ -107,6 +109,8 @@ bool showSolutions( int index ); // for the currently selected problem, choose this solution void setSolution (int index); + // show details + void showSolutionDetails( string details ); }; /////////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn.opensuse.org