[rkward-cvs] rkward/rkward/rbackend rcommand.h,1.22,1.23 rcommandreceiver.h,1.5,1.6 rinterface.cpp,1.46,1.47 rthread.cpp,1.37,1.38

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri May 5 13:05:33 UTC 2006


Update of /cvsroot/rkward/rkward/rkward/rbackend
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28994/rkward/rbackend

Modified Files:
	rcommand.h rcommandreceiver.h rinterface.cpp rthread.cpp 
Log Message:
Show command output immediately in command log

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** rinterface.cpp	16 Apr 2006 23:01:22 -0000	1.46
--- rinterface.cpp	5 May 2006 13:05:31 -0000	1.47
***************
*** 116,121 ****
  	if (e->type () == RCOMMAND_OUTPUT_EVENT) {
  		RThread::ROutputContainer *container = (static_cast <RThread::ROutputContainer *> (e->data ()));
! 	// we've already made sure, there is an existing receiver in RThread
! 		container->command->receiver->newOutput (container->command, container->output);
  		delete container;
  /* TODO: not quite good, yet, but something like this should be done:
--- 116,121 ----
  	if (e->type () == RCOMMAND_OUTPUT_EVENT) {
  		RThread::ROutputContainer *container = (static_cast <RThread::ROutputContainer *> (e->data ()));
! 		if (container->command->receiver) container->command->receiver->newOutput (container->command, container->output);
! 		watch->addOutput (container->command, container->output);
  		delete container;
  /* TODO: not quite good, yet, but something like this should be done:
***************
*** 136,140 ****
  			out->output = ("--- interrupted ---");
  			command->output_list.append (out);
! 			if (command->receiver && (command->type () & RCommand::ImmediateOutput)) {
  				command->receiver->newOutput (command, out);
  			}
--- 136,140 ----
  			out->output = ("--- interrupted ---");
  			command->output_list.append (out);
! 			if (command->receiver) {
  				command->receiver->newOutput (command, out);
  			}
***************
*** 147,151 ****
  		}
  		RKGlobals::controlWindow ()->removeCommand (command);
! 		watch->addOutput (command);
  		command->finished ();
  		if (command->type () & RCommand::DirectToOutput) {
--- 147,151 ----
  		}
  		RKGlobals::controlWindow ()->removeCommand (command);
! 		watch->commandDone (command);
  		command->finished ();
  		if (command->type () & RCommand::DirectToOutput) {

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** rthread.cpp	17 Apr 2006 14:05:54 -0000	1.37
--- rthread.cpp	5 May 2006 13:05:31 -0000	1.38
***************
*** 240,256 ****
  
  // pass a signal to the main thread for real-time update of output
! 	if (current_command->type () & RCommand::ImmediateOutput) {
! 		if (!(current_command->receiver)) {
! 			RK_ASSERT (false);
! 			return;
! 		}
! 
! 		QCustomEvent *event = new QCustomEvent (RCOMMAND_OUTPUT_EVENT);
! 		ROutputContainer *outc = new ROutputContainer;
! 		outc->output = current_output;
! 		outc->command = current_command;
! 		event->setData (outc);
! 		qApp->postEvent (RKGlobals::rInterface (), event);
! 	}
  
  	RK_DO (qDebug ("output '%s'", current_output->output.latin1 ()), RBACKEND, DL_DEBUG);
--- 240,249 ----
  
  // pass a signal to the main thread for real-time update of output
! 	QCustomEvent *event = new QCustomEvent (RCOMMAND_OUTPUT_EVENT);
! 	ROutputContainer *outc = new ROutputContainer;
! 	outc->output = current_output;
! 	outc->command = current_command;
! 	event->setData (outc);
! 	qApp->postEvent (RKGlobals::rInterface (), event);
  
  	RK_DO (qDebug ("output '%s'", current_output->output.latin1 ()), RBACKEND, DL_DEBUG);

Index: rcommandreceiver.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rcommandreceiver.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rcommandreceiver.h	2 Nov 2005 21:11:38 -0000	1.5
--- rcommandreceiver.h	5 May 2006 13:05:31 -0000	1.6
***************
*** 45,49 ****
  @param command A pointer to the command. The pointer is still valid during this call, but the RCommand will be deleted shortly after! */
  	virtual void rCommandDone (RCommand *command) = 0;
! /** This function is called when there is new output for a command or this receiver (only if the command has the RCommand::ImmediateOutput flag). Default implementation does nothing. Reimplement if you use commands with RCommand::ImmediateOutput flag.
  @param command A pointer to the command
  @param output The new output-fragment */
--- 45,49 ----
  @param command A pointer to the command. The pointer is still valid during this call, but the RCommand will be deleted shortly after! */
  	virtual void rCommandDone (RCommand *command) = 0;
! /** This function is called when there is new output for a command or this receiver. Default implementation does nothing. Reimplement if you want to get at a command's output immediately (i.e. before the command is fully completed).
  @param command A pointer to the command
  @param output The new output-fragment */

Index: rcommand.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rcommand.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rcommand.h	2 Nov 2005 21:11:38 -0000	1.22
--- rcommand.h	5 May 2006 13:05:31 -0000	1.23
***************
*** 160,165 ****
  		GetStringVector=1024,	/**< Try to fetch result as an array of chars */
  		GetRealVector=2048,		/**< Try to fetch result as an array of doubles */
! 		DirectToOutput=4096,		/**< Append command output to the HTML-output file */
! 		ImmediateOutput=8192	/**< Receive notifications whenever new output is available */
  	};
  	enum CommandStatus {
--- 160,164 ----
  		GetStringVector=1024,	/**< Try to fetch result as an array of chars */
  		GetRealVector=2048,		/**< Try to fetch result as an array of doubles */
! 		DirectToOutput=4096		/**< Append command output to the HTML-output file */
  	};
  	enum CommandStatus {





More information about the rkward-tracker mailing list