Hello community, here is the log from the commit of package yast2-ncurses checked in at Mon Jan 21 01:18:49 CET 2008. -------- --- yast2-ncurses/yast2-ncurses.changes 2008-01-07 12:48:49.000000000 +0100 +++ /mounts/work_src_done/STABLE/yast2-ncurses/yast2-ncurses.changes 2008-01-18 18:10:17.214072000 +0100 @@ -1,0 +2,23 @@ +Fri Jan 18 17:45:29 CET 2008 - kmachalkova@suse.cz + +- Running separate UI-thread re-enabled (adjusted idleLoop, file + descriptor saving/restoring) (bug #164999, FaTE #301899) +- 2.16.10 + +------------------------------------------------------------------- +Tue Jan 16 16:55:00 CET 2008 - tgoettlicher@suse.de + +- Added BusyIndicator widget +- 2.16.9 + +------------------------------------------------------------------- +Tue Jan 15 16:36:35 CET 2008 - kmachalkova@suse.cz + +- 'Press F1 for Help' in window title is gone +- No Fxx keys help pop-up (all the information moved to the bottom + status line) +- Fxx key labels rendered in reversed colours +- Improved dependency conflict popup layout (Label (`opt(`outputField + instead of TextEntry, spacing re-arrangements) (#350238) + +------------------------------------------------------------------- Old: ---- yast2-ncurses-2.16.8.tar.bz2 New: ---- yast2-ncurses-2.16.10.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-ncurses.spec ++++++ ++++ 1617 lines (skipped) ++++ between yast2-ncurses/yast2-ncurses.spec ++++ and /mounts/work_src_done/STABLE/yast2-ncurses/yast2-ncurses.spec ++++++ yast2-ncurses-2.16.8.tar.bz2 -> yast2-ncurses-2.16.10.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/Makefile.am new/yast2-ncurses-2.16.10/src/Makefile.am --- old/yast2-ncurses-2.16.8/src/Makefile.am 2007-11-19 18:09:02.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/Makefile.am 2008-01-18 17:44:04.000000000 +0100 @@ -67,6 +67,7 @@ NCCheckBox.h \ NCLabel.h \ NCProgressBar.h \ + NCBusyIndicator.h \ NCMenuButton.h \ NCPushButton.h \ NCRadioButton.h \ @@ -138,6 +139,7 @@ NCCheckBox.cc \ NCLabel.cc \ NCProgressBar.cc \ + NCBusyIndicator.cc \ NCMenuButton.cc \ NCPushButton.cc \ NCRadioButton.cc \ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/Makefile.in new/yast2-ncurses-2.16.10/src/Makefile.in --- old/yast2-ncurses-2.16.8/src/Makefile.in 2007-11-26 15:09:16.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/Makefile.in 2008-01-18 17:47:29.000000000 +0100 @@ -67,9 +67,9 @@ NCSpacing.lo NCSquash.lo NCAlignment.lo NCFrame.lo \ NCCheckBoxFrame.lo NCLayoutBox.lo NCReplacePoint.lo \ NCRadioButtonGroup.lo NCImage.lo NCCheckBox.lo NCLabel.lo \ - NCProgressBar.lo NCMenuButton.lo NCPushButton.lo \ - NCRadioButton.lo NCInputField.lo NCIntField.lo NCComboBox.lo \ - NCPadWidget.lo NCRichText.lo NCSelectionBox.lo \ + NCProgressBar.lo NCBusyIndicator.lo NCMenuButton.lo \ + NCPushButton.lo NCRadioButton.lo NCInputField.lo NCIntField.lo \ + NCComboBox.lo NCPadWidget.lo NCRichText.lo NCSelectionBox.lo \ NCMultiSelectionBox.lo NCTable.lo NCTree.lo NCLogView.lo \ NCMultiLineEdit.lo NCFileSelection.lo NCPopup.lo \ NCPopupTable.lo NCPopupList.lo NCPopupMenu.lo \ @@ -314,6 +314,7 @@ NCCheckBox.h \ NCLabel.h \ NCProgressBar.h \ + NCBusyIndicator.h \ NCMenuButton.h \ NCPushButton.h \ NCRadioButton.h \ @@ -385,6 +386,7 @@ NCCheckBox.cc \ NCLabel.cc \ NCProgressBar.cc \ + NCBusyIndicator.cc \ NCMenuButton.cc \ NCPushButton.cc \ NCRadioButton.cc \ @@ -490,6 +492,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCApplication.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCAskForDirectory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCAskForFile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCBusyIndicator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCCheckBox.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCCheckBoxFrame.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NCComboBox.Plo@am__quote@ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCBusyIndicator.cc new/yast2-ncurses-2.16.10/src/NCBusyIndicator.cc --- old/yast2-ncurses-2.16.8/src/NCBusyIndicator.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCBusyIndicator.cc 2008-01-18 17:44:04.000000000 +0100 @@ -0,0 +1,381 @@ +/*---------------------------------------------------------------------\ +| | +| __ __ ____ _____ ____ | +| \ \ / /_ _/ ___|_ _|___ \ | +| \ V / _` \___ \ | | __) | | +| | | (_| |___) || | / __/ | +| |_|\__,_|____/ |_| |_____| | +| | +| core system | +| (C) SuSE GmbH | +\----------------------------------------------------------------------/ + + File: NCBusyIndicator.cc + + Author: Thomas Goettlicher <tgoettlicher@suse.de> + Maintainer: Thomas Goettlicher <tgoettlicher@suse.de> + +/-*/ +#include "Y2Log.h" +#include "NCurses.h" +#include "NCBusyIndicator.h" +#include <signal.h> +#include <unistd.h> +#include <sys/time.h> + +#define REPAINT_INTERVAL 100 // in ms +#define STEP_SIZE .05 + +/* + Some words about the timer stuff: + With each SIG_ALRM signal _timer_progress gets incremented by _timer_divisor. + When a tick is received [=setAlive(true) is called] _timer_progress is set to 0. + If _timer_progress is larger than 1 the widget goes to stalled state. + + How the timer works: + NCBusyIndicatorHandlerWrapper is registered as signal handler for SIG_ALRM + signal and calls NCBusyIndicatorObject->handler(). This wrapper is needed + because a member function cannot be registered as signal handler. + + LIMITATIONS: + i) Only one BusyIndicator widget works at the same time, because the + wrapper function only calls the handler() member function of the last + created instance of BusyIndicator. + + ii) The UserInput widget cannot be used, because UserInput is a blocking + function. When UserInput waits for UserInput no SIG_ALRM signal is sent + and therefore the BusyIndicator widget doesn't show progress. + Please use the TimeoutUserInput widget in a loop instead. +*/ + +struct itimerval interval; +NCBusyIndicator* NCBusyIndicatorObject; +void NCBusyIndicatorHandlerWrapper(int sig_num); + + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::NCBusyIndicator +// METHOD TYPE : Constructor +// +// DESCRIPTION : +// +NCBusyIndicator::NCBusyIndicator( YWidget * parent, + const string & nlabel, + int timeout ) + : YBusyIndicator( parent, nlabel, timeout ) + , NCWidget( parent ) + , _label( nlabel ) + , _timeout( timeout ) + , _lwin( 0 ) + , _twin( 0 ) + , _position (.5) + , _rightwards (true) + , _alive (true) +{ + WIDDBG << endl; + if ( timeout <= 0 ) + timeout = 1; + hotlabel = &_label; + setLabel( nlabel ); + wstate = NC::WSdumb; + + NCBusyIndicatorObject=this; + + _timer_divisor = (double) REPAINT_INTERVAL / (double) timeout; + _timer_progress=0; + + signal(SIGALRM, NCBusyIndicatorHandlerWrapper); + interval.it_value.tv_sec=0; + interval.it_value.tv_usec=REPAINT_INTERVAL * 1000; + setitimer(ITIMER_REAL, &interval, NULL); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::~NCBusyIndicator +// METHOD TYPE : Destructor +// +// DESCRIPTION : +// +NCBusyIndicator::~NCBusyIndicator() +{ + signal(SIGALRM, SIG_IGN); + delete _lwin; + delete _twin; + WIDDBG << endl; +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::nicesize +// METHOD TYPE : long +// +// DESCRIPTION : +// +long NCBusyIndicator::nicesize( YUIDimension dim ) +{ + return dim == YD_HORIZ ? wGetDefsze().W : wGetDefsze().H; +} + +int NCBusyIndicator::preferredWidth() +{ + return wGetDefsze().W; +} + +int NCBusyIndicator::preferredHeight() +{ + return wGetDefsze().H; +} + +void NCBusyIndicator::setEnabled( bool do_bv ) +{ + NCWidget::setEnabled( do_bv ); + YBusyIndicator::setEnabled( do_bv ); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::setSize +// METHOD TYPE : void +// +// DESCRIPTION : +// +void NCBusyIndicator::setSize( int newwidth, int newheight ) +{ + wRelocate( wpos( 0 ), wsze( newheight, newwidth ) ); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::setDefsze +// METHOD TYPE : void +// +// DESCRIPTION : +// +void NCBusyIndicator::setDefsze() +{ + defsze = wsze( _label.height() + 1, + _label.width() < 5 ? 5 : _label.width() ); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::wCreate +// METHOD TYPE : void +// +// DESCRIPTION : +// +void NCBusyIndicator::wCreate( const wrect & newrect ) +{ + NCWidget::wCreate( newrect ); + + if ( !win ) + return; + + wrect lrect( 0, wsze::min( newrect.Sze, + wsze( _label.height(), newrect.Sze.W ) ) ); + wrect trect( 0, wsze( 1, newrect.Sze.W ) ); + + if ( lrect.Sze.H == newrect.Sze.H ) + lrect.Sze.H -= 1; + + trect.Pos.L = lrect.Sze.H > 0 ? lrect.Sze.H : 0; + + _lwin = new NCursesWindow( *win, + lrect.Sze.H, lrect.Sze.W, + lrect.Pos.L, lrect.Pos.C, + 'r' ); + _twin = new NCursesWindow( *win, + trect.Sze.H, trect.Sze.W, + trect.Pos.L, trect.Pos.C, + 'r' ); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::wDelete +// METHOD TYPE : void +// +// DESCRIPTION : +// +void NCBusyIndicator::wDelete() +{ + delete _lwin; + delete _twin; + _lwin = 0; + _twin = 0; + NCWidget::wDelete(); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::setLabel +// METHOD TYPE : void +// +// DESCRIPTION : +// +void NCBusyIndicator::setLabel( const string & nlabel ) +{ + _label = NCstring( nlabel ); + setDefsze(); + YBusyIndicator::setLabel( nlabel ); + Redraw(); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::handler +// METHOD TYPE : void +// +// DESCRIPTION : handler, called by NCBusyIndicatorHandlerWrapper +// +void NCBusyIndicator::handler(int sig_num) +{ + _timer_progress+=_timer_divisor; + if (_timer_progress>=1) + { + _timer_progress=0; + _alive=false; + } + update(); + interval.it_value.tv_sec=0; + interval.it_value.tv_usec=REPAINT_INTERVAL * 1000; + setitimer(ITIMER_REAL, &interval, NULL); + +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicatorHandlerWrapper +// METHOD TYPE : void +// +// DESCRIPTION : static wrapper for member function handler +// +void NCBusyIndicatorHandlerWrapper(int sig_num) +{ + signal(SIGALRM, SIG_IGN); + NCBusyIndicatorObject->handler(sig_num); + signal(SIGALRM, NCBusyIndicatorHandlerWrapper); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::update +// METHOD TYPE : void +// +// DESCRIPTION : calculate position of moving bar +// +void NCBusyIndicator::update() +{ + if (!_alive) + return; + + if (_position > 1.0 || _position < 0 ) + _rightwards = !_rightwards; + + if (_rightwards) + _position += STEP_SIZE; + else + _position -= STEP_SIZE; + + Redraw(); + refresh(); + + +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::setAlive +// METHOD TYPE : void +// +// DESCRIPTION : set alive or stalled +// +void NCBusyIndicator::setAlive( bool newAlive) +{ + _alive = newAlive; + + if (newAlive) + _timer_progress=0; +} + + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::setTimeout +// METHOD TYPE : void +// +// DESCRIPTION : set timeout +// +void NCBusyIndicator::setTimeout( int newTimeout) +{ + if (newTimeout < 1) + newTimeout = 1; + + _timeout = newTimeout; + YBusyIndicator::setTimeout( newTimeout ); + + _timer_divisor = (double) REPAINT_INTERVAL / (double) _timeout; +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::wRedraw +// METHOD TYPE : void +// +// DESCRIPTION : draw busy indicator widget +// +void NCBusyIndicator::wRedraw() +{ + if ( !win ) + return; + + // label + chtype bg = wStyle().dumb.text; + _lwin->bkgdset( bg ); + _lwin->clear(); + _label.drawAt( *_lwin, bg, bg ); + tUpdate(); +} + +/////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : NCBusyIndicator::tUpdate +// METHOD TYPE : void +// +// DESCRIPTION : draw busy bar +// +void NCBusyIndicator::tUpdate() +{ + if ( !win ) + return; + + int cp = (_twin->maxx()) * _position; + + const NCstyle::StProgbar & style( wStyle().progbar ); + _twin->bkgdset( style.nonbar.chattr ); + _twin->clear(); + + if ( cp <= _twin->maxx() ) { + _twin->bkgdset( NCattribute::getNonChar( style.bar.chattr ) ); + _twin->move( 0, cp ); + _twin->addch( NCattribute::getChar( style.bar.chattr ) ); + } +} + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCBusyIndicator.h new/yast2-ncurses-2.16.10/src/NCBusyIndicator.h --- old/yast2-ncurses-2.16.8/src/NCBusyIndicator.h 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCBusyIndicator.h 2008-01-18 17:44:04.000000000 +0100 @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------\ +| | +| __ __ ____ _____ ____ | +| \ \ / /_ _/ ___|_ _|___ \ | +| \ V / _` \___ \ | | __) | | +| | | (_| |___) || | / __/ | +| |_|\__,_|____/ |_| |_____| | +| | +| core system | +| (C) SuSE GmbH | +\----------------------------------------------------------------------/ + + File: NCBusyIndicator.h + + Author: Thomas Goettlicher <tgoettlicher@suse.de> + Maintainer: Thomas Goettlicher <tgoettlicher@suse.de> + +/-*/ +#ifndef NCBusyIndicator_h +#define NCBusyIndicator_h + +#include <iosfwd> + +#include "YBusyIndicator.h" +#include "NCWidget.h" + + +class NCBusyIndicator; + + + + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : NCBusyIndicator +// +// DESCRIPTION : +// +class NCBusyIndicator : public YBusyIndicator, public NCWidget { + + friend std::ostream & operator<<( std::ostream & STREAM, const NCBusyIndicator & OBJ ); + + NCBusyIndicator & operator=( const NCBusyIndicator & ); + NCBusyIndicator ( const NCBusyIndicator & ); + + private: + typedef long long Value_t; + + NClabel _label; + Value_t _timeout; + NCursesWindow * _lwin; + NCursesWindow * _twin; + + void setDefsze(); + void tUpdate(); + void update(); + + float _position; // the position of the bar + bool _rightwards; // direction the bar moves + bool _alive; // the widget is alive or stalled + float _timer_divisor; // =repaint interval devided by timeout + float _timer_progress; // progress until widget goes to stalled state + + + protected: + + + virtual const char * location() const { return "NCBusyIndicator"; } + + virtual void wCreate( const wrect & newrect ); + virtual void wDelete(); + + virtual void wRedraw(); + + public: + + NCBusyIndicator( YWidget * parent, + const string & label, + int timeout = 1000 ); + virtual ~NCBusyIndicator(); + + virtual long nicesize( YUIDimension dim ); + + virtual int preferredWidth(); + virtual int preferredHeight(); + + /** + * Set the new size of the widget. + * + * Reimplemented from YWidget. + **/ + virtual void setSize( int newWidth, int newHeight ); + + virtual void setLabel( const string & nlabel ); + + virtual void setTimeout( int newTimeout ); + + virtual void setAlive( bool newAlive ); + + virtual void setEnabled( bool do_bv ); + + int timeout() const { return _timeout; } + + void handler(int sig_num); + static void staticHandler(int sig_num); +}; + +/////////////////////////////////////////////////////////////////// + +#endif // NCBusyIndicator_h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCDialog.cc new/yast2-ncurses-2.16.10/src/NCDialog.cc --- old/yast2-ncurses-2.16.8/src/NCDialog.cc 2007-12-20 10:40:44.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCDialog.cc 2008-01-15 16:35:39.000000000 +0100 @@ -532,9 +532,7 @@ --inMultiDraw_i; } else { inMultiDraw_i = 0; - string text = ""; - describeFunctionKeys( text ); - NCurses::SetStatusLine( text ); + NCurses::SetStatusLine( describeFunctionKeys() ); Update(); } } @@ -1203,6 +1201,7 @@ } break; + #if 0 case KEY_F(1): if ( !helpPopup ) { @@ -1211,13 +1210,13 @@ bool hasF1 = describeFunctionKeys( helpText ); if ( hasF1 ) { - // part of help for textmode navigation (shown if there is further help available) - helpIntro = _( "<p>Press <b>F1</b> again to get further help or <b>ESC</b> to close this dialog.</p>" ); + // part of help for textmode navigation (shown if there is further help available) + helpIntro = _( "<p>Press <b>F1</b> again to get further help or <b>ESC</b> to close this dialog.</p>" ); } else { - // part of help for text mode navigation - helpIntro = _( "<p>Press <b>F1</b> or <b>ESC</b> to close this dialog.</p>" ); + // part of help for text mode navigation + helpIntro = _( "<p>Press <b>F1</b> or <b>ESC</b> to close this dialog.</p>" ); } helpPopup = new NCPopupInfo( wpos( NCurses::lines()/3, NCurses::cols()/3 ), @@ -1246,13 +1245,14 @@ } } break; + #endif default: // only handle keys if the help popup is not existing or not visible if ( !helpPopup || (helpPopup && !helpPopup->isVisible()) ) { - if ( ch >= KEY_F(2) && ch <= KEY_F(24) ) + if ( ch >= KEY_F(1) && ch <= KEY_F(24) ) { pendingEvent = getHotkeyEvent( ch ); } @@ -1383,17 +1383,14 @@ // // // METHOD NAME : NCDialog::describeFunctionKeys -// METHOD TYPE : string +// METHOD TYPE : std::map <int, string> // -// DESCRIPTION : get all PushButtons and MenuButtons with `opt(`key_Fn) -// and create a text like F1: Help, F2: Info and so on +// DESCRIPTION : Get all PushButtons and MenuButtons with `opt(`key_Fn) +// and create a map, for example: $[ 1: Help, 2: Info,... ] +// NCurses::SetStatusLine will process it // -bool NCDialog::describeFunctionKeys( string & helpText ) +std::map <int, string> NCDialog::describeFunctionKeys( ) { - string text = ""; - char key[20]; - YCPString label( "" ); - bool hasF1 = false; std::map<int, string> fkeys; for ( tnode<NCWidget*> * c = this->Next(); c; c = c->Next() ) @@ -1404,30 +1401,12 @@ { // Retrieve the widget's "shortcut property" that describes // whatever it is - regardless of widget type (PushButton, ...) - //YCPSymbol propertyName( w->shortcutProperty() ); - //YCPValue propertyValue = w->queryWidget( propertyName ); - // Get rid of unwanted '&' shortcut markers - //string desc = YShortcut::cleanShortcutString( propertyValue->asString()->value() ); - if ( w->functionKey() == 1 ) - { - hasF1 = true; - } fkeys[ w->functionKey() ] = w->debugLabel(); } } - // create the text with sorted F-keys - std::map<int, string>::iterator it; - - for ( it = fkeys.begin(); it != fkeys.end(); ++it ) - { - sprintf( key, "F%d: ", (*it).first ); - text += key + (*it).second + " "; - } - - helpText = text; - return hasF1; + return fkeys; } /****************************************************************** diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCDialog.h new/yast2-ncurses-2.16.10/src/NCDialog.h --- old/yast2-ncurses-2.16.8/src/NCDialog.h 2007-12-17 09:32:48.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCDialog.h 2008-01-15 16:35:39.000000000 +0100 @@ -104,7 +104,7 @@ void processInput( int timeout_millisec ); - bool describeFunctionKeys( string & helpText ); + std::map<int, string> describeFunctionKeys(); wint_t getinput(); // get the input (respect terminal encoding) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCurses.cc new/yast2-ncurses-2.16.10/src/NCurses.cc --- old/yast2-ncurses-2.16.8/src/NCurses.cc 2008-01-07 12:32:05.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCurses.cc 2008-01-18 17:44:04.000000000 +0100 @@ -271,11 +271,10 @@ } } - //FIXME: Enable these with multithread support //duplicate stdout and stderr before redirecting them to log //so that they can be regenerated before system() call - //stdout_save = dup(1); - //stderr_save = dup(2); + stdout_save = dup(1); + stderr_save = dup(2); RedirectToLog(); @@ -522,7 +521,8 @@ ::wclear( myself->title_w ); NCMIL << "Draw title called" << endl; - + + #if 0 setTextdomain( "packages" ); // part of title (headline) of the textmode yast NCstring helpF1 ( _( "Press F1 for Help" ) ); @@ -540,21 +540,38 @@ { ::mvwaddwstr( myself->title_w, 0, s, (wchar_t *)helpF1.str().c_str() ); } + #endif + ::mvwaddstr( myself->title_w, 0, 1, myself->title_t.c_str() ); ::wnoutrefresh( myself->title_w ); } } -void NCurses::SetStatusLine( const string & str ) +void NCurses::SetStatusLine( std::map <int,string> fkeys ) { if ( myself && myself->status_w ) { - myself->status_line = str; + myself->status_line = fkeys; ::wbkgd( myself->status_w, myself->style()(NCstyle::AppTitle) ); ::werase( myself->status_w ); - ::mvwaddstr( myself->status_w, 0, 1, myself->status_line.c_str() ); + char key[10]; + char value[100]; + + std::map<int, string>::iterator it; + for ( it = fkeys.begin(); it != fkeys.end(); ++it ) + { + sprintf( key, " F%d ", (*it).first ); + //reverse F-key to make it more visible + ::wattron( myself->status_w, A_REVERSE); + ::waddstr( myself->status_w, key ); + ::wattroff( myself->status_w, A_REVERSE); + + sprintf( value, "%s ", (*it).second.c_str() ); + ::waddstr( myself->status_w, value ); + } + ::wnoutrefresh( myself->status_w ); } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCurses.h new/yast2-ncurses-2.16.10/src/NCurses.h --- old/yast2-ncurses-2.16.8/src/NCurses.h 2007-12-20 10:40:44.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCurses.h 2008-01-18 17:44:04.000000000 +0100 @@ -160,7 +160,8 @@ WINDOW * title_w; WINDOW * status_w; string title_t; - string status_line; + + std::map <int,string> status_line; NCstyle * styleset; NCursesPanel * stdpan; @@ -179,9 +180,8 @@ NCurses(); virtual ~NCurses(); - //FIXME: Enable these with multithread support - //int stdout_save; - //int stderr_save; + int stdout_save; + int stderr_save; static int cols() { return ::COLS; } static int lines() { return ::LINES; } @@ -196,7 +196,7 @@ static void Redraw(); static void Refresh(); static void SetTitle( const string & str ); - static void SetStatusLine( const string & str ); + static void SetStatusLine( std::map <int,string> fkeys ); static void ScreenShot( const string & name = "screen.shot" ); static void drawTitle(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCWidgetFactory.cc new/yast2-ncurses-2.16.10/src/NCWidgetFactory.cc --- old/yast2-ncurses-2.16.8/src/NCWidgetFactory.cc 2007-12-03 11:20:54.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCWidgetFactory.cc 2008-01-15 16:35:39.000000000 +0100 @@ -180,6 +180,15 @@ return progressBar; } +NCBusyIndicator * +NCWidgetFactory::createBusyIndicator( YWidget * parent, const string & label, int timeout) +{ + NCBusyIndicator * busyIndicator = new NCBusyIndicator( parent, label, timeout ); + YUI_CHECK_NEW( busyIndicator ); + + return busyIndicator; +} + NCRichText * NCWidgetFactory::createRichText( YWidget * parent, const string & text, bool plainTextMode ) { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/NCWidgetFactory.h new/yast2-ncurses-2.16.10/src/NCWidgetFactory.h --- old/yast2-ncurses-2.16.8/src/NCWidgetFactory.h 2007-12-03 11:20:54.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/NCWidgetFactory.h 2008-01-18 17:44:04.000000000 +0100 @@ -23,6 +23,7 @@ #include "YWidgetFactory.h" #include "NCAlignment.h" +#include "NCBusyIndicator.h" #include "NCCheckBox.h" #include "NCCheckBoxFrame.h" #include "NCComboBox.h" @@ -119,6 +120,9 @@ virtual NCProgressBar * createProgressBar ( YWidget * parent, const string & label, int maxValue = 100 ); + virtual NCBusyIndicator * createBusyIndicator ( YWidget *parent, + const string & label, + int timeout = 1000 ); virtual NCRichText * createRichText ( YWidget * parent, const string & text = string(), diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/pkg/NCPackageSelector.cc new/yast2-ncurses-2.16.10/src/pkg/NCPackageSelector.cc --- old/yast2-ncurses-2.16.8/src/pkg/NCPackageSelector.cc 2007-12-17 09:32:48.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/pkg/NCPackageSelector.cc 2008-01-18 17:44:04.000000000 +0100 @@ -3435,7 +3435,8 @@ if ( !pkgList ) return false; - NCMIL << "Fill list: " << pkgList << endl; + // NCMIL << "Fill list: " << (const NCWidget *) pkgList << endl; + NCMIL << "Fill list: " << (NCWidget *) pkgList << endl; switch ( pkgList->getTableType() ) { case NCPkgTable::T_Patches: { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/pkg/NCPkgPopupDeps.cc new/yast2-ncurses-2.16.10/src/pkg/NCPkgPopupDeps.cc --- old/yast2-ncurses-2.16.8/src/pkg/NCPkgPopupDeps.cc 2007-12-03 11:20:54.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/pkg/NCPkgPopupDeps.cc 2008-01-15 16:35:39.000000000 +0100 @@ -13,12 +13,13 @@ File: NCPkgPopupDeps.cc Author: Gabriele Strattner <gs@suse.de> - Maintainer: Michael Andres <ma@suse.de> + Maintainer: Bubli <kmachalkova@suse.cz> /-*/ #include "Y2Log.h" #include "NCPkgPopupDeps.h" +#include "NCAlignment.h" #include "NCTree.h" #include "YDialog.h" #include "NCLayoutBox.h" @@ -125,57 +126,48 @@ void NCPkgPopupDeps::createLayout( ) { - YWidgetOpt opt; - // vertical split is the (only) child of the dialog NCLayoutBox * vSplit = new NCLayoutBox( this, YD_VERT ); - // addChild( ) is obsolete (handled by new libyui) // FIXME // opt.vWeight.setValue( 40 ); - opt.notifyMode.setValue( true ); + vSplit->setNotify( true ); - new NCSpacing( vSplit, YD_VERT, true, 0.8 ); + new NCSpacing( vSplit, YD_VERT, false, 1 ); head = new NCLabel( vSplit, "", true, false ); // isHeading = true //vSplit->addChild( new NCSpacing( vSplit, opt, 0.4, false, true ) ); - new NCSpacing( vSplit, YD_VERT, true, 0.4 ); + new NCSpacing( vSplit, YD_VERT, false, 1 ); // add the list containing packages with unresolved dependencies problemw = new NCProblemSelectionBox( vSplit, _("&Problems"), this); - - opt.isHStretchable.setValue( true ); + problemw->setStretchable( YD_HORIZ, true ); //vSplit->addChild( new NCSpacing( vSplit, opt, 0.2, false, true ) ); - new NCSpacing( vSplit, YD_VERT, true, 0.2 ); // stretchable = true + new NCSpacing( vSplit, YD_VERT, false, 1 ); - details = new NCInputField( vSplit, - "", - false ); // passwordMode = false - details->setInputMaxLength( 200 ); - // FIXME - //details->setMaxFld( 200 ); - + NCAlignment * left = new NCAlignment( vSplit, YAlignBegin, YAlignUnchanged ); + + // heading = false, outputField = true + details = new NCLabel ( left,"", false, true ); + //vSplit->addChild( new NCSpacing( vSplit, opt, 0.8, false, true ) ); - new NCSpacing( vSplit, YD_VERT, true, 0.8 ); // stretchable = true + new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = true // add the package list containing the dependencies solutionw = new NCSolutionSelectionBox ( vSplit, _("Possible &Solutions"), this); - opt.isHStretchable.setValue( false ); - //vSplit->addChild( new NCSpacing( vSplit, opt, 0.6, false, true ) ); - new NCSpacing( vSplit, YD_VERT, false, 0.6 ); // stretchable = false + new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = false NCLayoutBox * hSplit = new NCLayoutBox( vSplit, YD_HORIZ ); - opt.isHStretchable.setValue( true ); // add the solve button - opt.key_Fxx.setValue( 10 ); solveButton = new NCPushButton( hSplit, NCPkgNames::SolveLabel() ); + solveButton->setFunctionKey( 10 ); //solveButton->setId( NCPkgNames::Solve () ); YStringWidgetID * solveID = new YStringWidgetID("solve"); solveButton->setId( solveID ); @@ -184,12 +176,13 @@ new NCSpacing( hSplit, YD_HORIZ, true, 0.2 ); // stretchable = true // add the cancel button - opt.key_Fxx.setValue( 9 ); cancelButton = new NCPushButton( hSplit, NCPkgNames::CancelLabel() ); + cancelButton->setFunctionKey( 9 ); // cancelButton->setId( NCPkgNames::Cancel () ); YStringWidgetID * cancelID = new YStringWidgetID("cancel"); cancelButton->setId( cancelID ); + new NCSpacing( vSplit, YD_VERT, false, 1 ); // stretchable = false } /////////////////////////////////////////////////////////////////// @@ -304,15 +297,12 @@ return false; solutionw->startMultipleChanges(); -#warning FIXME: is this necessary if the next step is deleteAllItems()? - solutionw->clearItems (); solutionw->deleteAllItems(); zypp::ResolverProblem_Ptr problem = problems[index].first; zypp::ProblemSolution_Ptr user_solution = problems[index].second; - details->setValue( problem->details() ); - details->setCurPos( 0 ); + details->setText( problem->details() ); zypp::ProblemSolutionList solutions = problem->solutions (); zypp::ProblemSolutionList::iterator diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/pkg/NCPkgPopupDeps.h new/yast2-ncurses-2.16.10/src/pkg/NCPkgPopupDeps.h --- old/yast2-ncurses-2.16.8/src/pkg/NCPkgPopupDeps.h 2007-11-19 18:09:02.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/pkg/NCPkgPopupDeps.h 2008-01-15 16:35:39.000000000 +0100 @@ -13,7 +13,7 @@ File: NCPkgPopupDeps.h Author: Gabriele Strattner <gs@suse.de> - Maintainer: Michael Andres <ma@suse.de> + Maintainer: Bubli <kmachalkova@suse.cz> /-*/ #ifndef NCPkgPopupDeps_h @@ -76,7 +76,7 @@ NCLabel * head; // the headline - NCInputField *details; // problem details + NCLabel *details; // problem details NCPackageSelector * packager; // connection to the package selector diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/YNCursesComponent.h new/yast2-ncurses-2.16.10/src/YNCursesComponent.h --- old/yast2-ncurses-2.16.8/src/YNCursesComponent.h 2007-11-19 18:09:02.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/YNCursesComponent.h 2008-01-18 17:44:04.000000000 +0100 @@ -43,7 +43,7 @@ const char * macro_file ) { // FIXME - with_threads = false; + //with_threads = false; return new YNCursesUI( argc, argv, with_threads, macro_file ); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/src/YNCursesUI.cc new/yast2-ncurses-2.16.10/src/YNCursesUI.cc --- old/yast2-ncurses-2.16.8/src/YNCursesUI.cc 2007-12-17 09:32:48.000000000 +0100 +++ new/yast2-ncurses-2.16.10/src/YNCursesUI.cc 2008-01-18 17:44:04.000000000 +0100 @@ -135,7 +135,6 @@ // void YNCursesUI::idleLoop( int fd_ycp ) { - NCDialog * ncd = static_cast<NCDialog *>( YDialog::currentDialog() ); int timeout = 5; struct timeval tv; @@ -156,8 +155,15 @@ if ( errno != EINTR ) UIINT << "idleLoop error in select() (" << errno << ')' << endl; } else if ( retval != 0 ) { - if( ncd ) { - ncd->idleInput(); + //do not throw here, as current dialog may not necessarily exist yet + //if we have threads + YDialog *currentDialog = YDialog::currentDialog( false ); + + if (currentDialog) { + NCDialog * ncd = static_cast<NCDialog *>( currentDialog ); + if( ncd ) { + ncd->idleInput(); + } } } // else no input within timeout sec. } while ( !FD_ISSET( fd_ycp, &fdset ) ); @@ -313,7 +319,7 @@ if ( dlg ) { dlg->showDialog(); - dlg->dumpWidgetTree(); + //dlg->dumpWidgetTree(); } } @@ -442,11 +448,10 @@ ::def_prog_mode(); ::endwin(); - //FIXME: Enable these with multithread support //Regenerate saved stdout and stderr, so that app called //via system() can use them and draw something to the terminal - //dup2(NCurses::stdout_save, 1); - //dup2(NCurses::stderr_save, 2); + dup2(NCurses::stdout_save, 1); + dup2(NCurses::stderr_save, 2); //Call external program ret = system(cmd.c_str()); @@ -456,9 +461,8 @@ NCERR << cmd << " returned:" << ret << endl; } - //FIXME: Enable these with multithread support //Redirect stdout and stderr to y2log again - //NCurses::RedirectToLog(); + NCurses::RedirectToLog(); //Resume tty modes and refresh the screen ::reset_prog_mode(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.16.8/VERSION new/yast2-ncurses-2.16.10/VERSION --- old/yast2-ncurses-2.16.8/VERSION 2008-01-07 12:44:11.000000000 +0100 +++ new/yast2-ncurses-2.16.10/VERSION 2008-01-18 17:47:18.000000000 +0100 @@ -1 +1 @@ -2.16.8 +2.16.10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de