From: Jonas B. <jb...@us...> - 2006-08-27 15:16:56
|
Update of /cvsroot/krusader/krusader_kde3/krusader/UserAction In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8353/krusader/UserAction Modified Files: kraction.cpp kraction.h Log Message: ADDED: UserAction: Outputcollection now supports fonts with fixed or variable width CHANGED: UserActions are now managed with ActionMan. In Konfigurator you can change settings _about_ useractions. Index: kraction.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/UserAction/kraction.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** kraction.cpp 15 Aug 2006 15:25:08 -0000 1.17 --- kraction.cpp 27 Aug 2006 15:16:49 -0000 1.18 *************** *** 17,20 **** --- 17,22 ---- #include <qtextedit.h> #include <qvbox.h> + #include <qsplitter.h> + #include <qpushbutton.h> #include <qlabel.h> #include <kaction.h> *************** *** 37,41 **** KrActionProcDlg::KrActionProcDlg( QString caption, bool enableStderr, QWidget *parent ) : ! KDialogBase( parent, 0, false, caption, KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Cancel ), _stdout(0), _stderr(0) { setButtonOK( i18n( "Close" ) ); --- 39,43 ---- KrActionProcDlg::KrActionProcDlg( QString caption, bool enableStderr, QWidget *parent ) : ! KDialogBase( parent, 0, false, caption, KDialogBase::User1 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Cancel ), _stdout(0), _stderr(0) { setButtonOK( i18n( "Close" ) ); *************** *** 47,58 **** // do we need to separate stderr and stdout? if ( enableStderr ) { // create stdout ! new QLabel( i18n( "Standard Output (stdout)" ), page ); ! _stdout = new QTextEdit( page ); _stdout->setReadOnly( true ); _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); // create stderr ! new QLabel( i18n( "Standard Error (stderr)" ), page ); ! _stderr = new QTextEdit( page ); _stderr->setReadOnly( true ); _stderr->setMinimumWidth( fontMetrics().maxWidth() * 40 ); --- 49,65 ---- // do we need to separate stderr and stdout? if ( enableStderr ) { + QSplitter *splitt = new QSplitter( QSplitter::Vertical, page ); // create stdout ! QVBox *stdoutBox = new QVBox( splitt, "stdout VBox" ); ! stdoutBox->setSpacing( 6 ); ! new QLabel( i18n( "Standard Output (stdout)" ), stdoutBox ); ! _stdout = new QTextEdit( stdoutBox ); _stdout->setReadOnly( true ); _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); // create stderr ! QVBox *stderrBox = new QVBox( splitt, "stderr VBox" ); ! stderrBox->setSpacing( 6 ); ! new QLabel( i18n( "Standard Error (stderr)" ), stderrBox ); ! _stderr = new QTextEdit( stderrBox ); _stderr->setReadOnly( true ); _stderr->setMinimumWidth( fontMetrics().maxWidth() * 40 ); *************** *** 64,67 **** --- 71,86 ---- _stdout->setMinimumWidth( fontMetrics().maxWidth() * 40 ); } + + krConfig->setGroup( "UserActions" ); + normalFont = krConfig->readFontEntry( "Normal Font", _UserActions_NormalFont ); + fixedFont = krConfig->readFontEntry( "Fixed Font", _UserActions_FixedFont ); + bool startupState = krConfig->readBoolEntry( "Use Fixed Font", _UserActions_UseFixedFont ); + toggleFixedFont( startupState ); + + setButtonText(KDialogBase::User1, i18n("Use font with fixed width") ); + QPushButton* fixedButton = actionButton( KDialogBase::User1 ); + fixedButton->setToggleButton( true ); + fixedButton->setOn( startupState ); + connect( fixedButton, SIGNAL( toggled(bool) ), SLOT( toggleFixedFont(bool) ) ); } *************** *** 80,83 **** --- 99,114 ---- } + void KrActionProcDlg::toggleFixedFont( bool state ) { + if ( state ) { + _stdout->setFont( fixedFont ); + if ( _stderr ) + _stderr->setFont( fixedFont ); + } + else { + _stdout->setFont( normalFont ); + if ( _stderr ) + _stderr->setFont( normalFont ); + } + } ////////////////////////////////////////////////////////////////////////////////////////////////////// *************** *** 120,125 **** // run in terminal if ( _action->execType() == KrAction::Terminal ) { ! krConfig->setGroup( "General" ); ! QString term = krConfig->readEntry( "Terminal UserActions", _TerminalUserActions ); if ( _action->user().isEmpty() ) --- 151,156 ---- // run in terminal if ( _action->execType() == KrAction::Terminal ) { ! krConfig->setGroup( "UserActions" ); ! QString term = krConfig->readEntry( "Terminal", _UserActions_Terminal ); if ( _action->user().isEmpty() ) Index: kraction.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/UserAction/kraction.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** kraction.h 15 Aug 2006 20:44:18 -0000 1.4 --- kraction.h 27 Aug 2006 15:16:49 -0000 1.5 *************** *** 108,112 **** }; ! /** * This diesplays the output of a process --- 108,112 ---- }; ! class QFont; /** * This diesplays the output of a process *************** *** 121,127 **** --- 121,129 ---- void addStderr( KProcess *proc, char *buffer, int buflen ); void addStdout( KProcess *proc, char *buffer, int buflen ); + void toggleFixedFont( bool state ); private: QTextEdit *_stdout, *_stderr; + QFont normalFont, fixedFont; }; |