[rkward-cvs] rkward/rkward/rbackend rcommand.h,1.18,1.19 rinterface.cpp,1.33,1.34 rinterface.h,1.19,1.20 rthread.cpp,1.22,1.23 rthread.h,1.16,1.17

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri Oct 14 15:57:45 UTC 2005


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

Modified Files:
	rcommand.h rinterface.cpp rinterface.h rthread.cpp rthread.h 
Log Message:
RControlWindow much better, but still incomplete

Index: rthread.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rthread.h	13 Oct 2005 21:01:57 -0000	1.16
--- rthread.h	14 Oct 2005 15:57:43 -0000	1.17
***************
*** 70,74 ****
  /** constructor. You need to specify a pointer to the RInterface, so the thread knows where to post its events. Only one RThread should ever be
  created, and that happens in RInterface::RInterface (). */
! 	RThread (RInterface *parent);
  /** destructor */
  	~RThread();
--- 70,74 ----
  /** constructor. You need to specify a pointer to the RInterface, so the thread knows where to post its events. Only one RThread should ever be
  created, and that happens in RInterface::RInterface (). */
! 	RThread ();
  /** destructor */
  	~RThread();
***************
*** 137,141 ****
  	void run ();
  private:
- 	RInterface *inter;
  /** This is the function in which an RCommand actually gets processed. Basically it passes the command to REmbedInteranl::runCommandInternal () and sends RInterface some events about what is currently happening. */
  	void doCommand (RCommand *command);
--- 137,140 ----

Index: rinterface.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rinterface.h	13 Oct 2005 21:01:57 -0000	1.19
--- rinterface.h	14 Oct 2005 15:57:43 -0000	1.20
***************
*** 70,74 ****
  
  	static QMutex mutex;
! 	static int mutex_counter;
  private:
  	RThread *r_thread;
--- 70,77 ----
  
  	static QMutex mutex;
! 	//static int mutex_counter;
! 
! /** returns the command currently running in the thread. Be careful when using the returned pointer! */
! 	RCommand *runningCommand () { return r_thread->current_command; };
  private:
  	RThread *r_thread;

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rthread.cpp	13 Oct 2005 21:01:57 -0000	1.22
--- rthread.cpp	14 Oct 2005 15:57:43 -0000	1.23
***************
*** 32,38 ****
  
  
! RThread::RThread (RInterface *parent) : QThread (), REmbedInternal () {
  	RK_TRACE (RBACKEND);
- 	inter = parent;
  	current_command = 0;
  
--- 32,37 ----
  
  
! RThread::RThread () : QThread (), REmbedInternal () {
  	RK_TRACE (RBACKEND);
  	current_command = 0;
  
***************
*** 53,59 ****
  	bool previously_idle = false;
  	if ((err = initialize ())) {
! 		qApp->postEvent (inter, new QCustomEvent (RSTARTUP_ERROR_EVENT + err));
  	}
! 	qApp->postEvent (inter, new QCustomEvent (RSTARTED_EVENT));
  
  	// wait until RKWard is set to go (esp, it has handled any errors during startup, etc.)
--- 52,58 ----
  	bool previously_idle = false;
  	if ((err = initialize ())) {
! 		qApp->postEvent (RKGlobals::rInterface (), new QCustomEvent (RSTARTUP_ERROR_EVENT + err));
  	}
! 	qApp->postEvent (RKGlobals::rInterface (), new QCustomEvent (RSTARTED_EVENT));
  
  	// wait until RKWard is set to go (esp, it has handled any errors during startup, etc.)
***************
*** 68,72 ****
  		if (previously_idle) {
  			if (!RCommandStack::regular_stack->isEmpty ()) {
! 				qApp->postEvent (inter, new QCustomEvent (RBUSY_EVENT));
  				previously_idle = false;
  			}
--- 67,71 ----
  		if (previously_idle) {
  			if (!RCommandStack::regular_stack->isEmpty ()) {
! 				qApp->postEvent (RKGlobals::rInterface (), new QCustomEvent (RBUSY_EVENT));
  				previously_idle = false;
  			}
***************
*** 92,96 ****
  		if (!previously_idle) {
  			if (RCommandStack::regular_stack->isEmpty ()) {
! 				qApp->postEvent (inter, new QCustomEvent (RIDLE_EVENT));
  				previously_idle = true;
  			}
--- 91,95 ----
  		if (!previously_idle) {
  			if (RCommandStack::regular_stack->isEmpty ()) {
! 				qApp->postEvent (RKGlobals::rInterface (), new QCustomEvent (RIDLE_EVENT));
  				previously_idle = true;
  			}
***************
*** 103,106 ****
--- 102,106 ----
  			return;
  		}
+ 		current_command = 0;
  		msleep (10);
  	}
***************
*** 112,117 ****
  	QCustomEvent *event = new QCustomEvent (RCOMMAND_IN_EVENT);
  	event->setData (command);
! 	qApp->postEvent (inter, event);
! 	RCommand *prev_command = current_command;
  	current_command = command;
  
--- 112,116 ----
  	QCustomEvent *event = new QCustomEvent (RCOMMAND_IN_EVENT);
  	event->setData (command);
! 	qApp->postEvent (RKGlobals::rInterface (), event);
  	current_command = command;
  
***************
*** 173,181 ****
  
  	// step 3: cleanup
- 	current_command = prev_command;
  	// notify GUI-thread that command was finished
  	event = new QCustomEvent (RCOMMAND_OUT_EVENT);
  	event->setData (command);
! 	qApp->postEvent (inter, event);
  }
  
--- 172,179 ----
  
  	// step 3: cleanup
  	// notify GUI-thread that command was finished
  	event = new QCustomEvent (RCOMMAND_OUT_EVENT);
  	event->setData (command);
! 	qApp->postEvent (RKGlobals::rInterface (), event);
  }
  
***************
*** 234,237 ****
--- 232,236 ----
  	RK_TRACE (RBACKEND);
  
+ 	RCommand *prev_command = current_command;
  	REvalRequest *request = new REvalRequest;
  	request->call = call;
***************
*** 244,248 ****
  	QCustomEvent *event = new QCustomEvent (R_EVAL_REQUEST_EVENT);
  	event->setData (request);
! 	qApp->postEvent (inter, event);
  	
  	bool done = false;
--- 243,247 ----
  	QCustomEvent *event = new QCustomEvent (R_EVAL_REQUEST_EVENT);
  	event->setData (request);
! 	qApp->postEvent (RKGlobals::rInterface (), event);
  	
  	bool done = false;
***************
*** 267,270 ****
--- 266,270 ----
  
  		// if no commands are in queue, sleep for a while
+ 		current_command = prev_command;
  		msleep (10);
  	}
***************
*** 280,284 ****
  	QCustomEvent *event = new QCustomEvent (R_CALLBACK_REQUEST_EVENT);
  	event->setData (args);
! 	qApp->postEvent (inter, event);
  	
  	bool done = false;
--- 280,284 ----
  	QCustomEvent *event = new QCustomEvent (R_CALLBACK_REQUEST_EVENT);
  	event->setData (args);
! 	qApp->postEvent (RKGlobals::rInterface (), event);
  	
  	bool done = false;
***************
*** 336,340 ****
  	QCustomEvent *event = new QCustomEvent (RCOMMAND_OUT_EVENT);
  	event->setData (current_command);
! 	qApp->postEvent (inter, event);
  
  	return status;
--- 336,340 ----
  	QCustomEvent *event = new QCustomEvent (RCOMMAND_OUT_EVENT);
  	event->setData (current_command);
! 	qApp->postEvent (RKGlobals::rInterface (), event);
  
  	return status;

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** rinterface.cpp	13 Oct 2005 21:01:57 -0000	1.33
--- rinterface.cpp	14 Oct 2005 15:57:43 -0000	1.34
***************
*** 57,61 ****
  //static
  QMutex RInterface::mutex;
! int RInterface::mutex_counter;
  
  RInterface::RInterface () {
--- 57,61 ----
  //static
  QMutex RInterface::mutex;
! //int RInterface::mutex_counter;
  
  RInterface::RInterface () {
***************
*** 88,92 ****
  	running_command_canceled = 0;
  	
! 	r_thread = new RThread (this);
  	r_thread->start ();
  
--- 88,92 ----
  	running_command_canceled = 0;
  	
! 	r_thread = new RThread ();
  	r_thread->start ();
  
***************
*** 125,128 ****
--- 125,129 ----
  	if (e->type () == RCOMMAND_IN_EVENT) {
  		watch->addInput (static_cast <RCommand *> (e->data ()));
+ 		RKGlobals::controlWindow ()->setCommandRunning (static_cast <RCommand *> (e->data ()));
  	} else if (e->type () == RCOMMAND_OUT_EVENT) {
  		RCommand *command = static_cast <RCommand *> (e->data ());
***************
*** 140,143 ****
--- 141,145 ----
  			}
  		}
+ 		RKGlobals::controlWindow ()->removeCommand (command);
  		watch->addOutput (command);
  		command->finished ();
***************
*** 174,178 ****
  	MUTEX_LOCK;
  	RCommandStack::issueCommand (command, chain);
! 	RKGlobals::controlWindow ()->refreshCommands ();
  	MUTEX_UNLOCK;
  }
--- 176,180 ----
  	MUTEX_LOCK;
  	RCommandStack::issueCommand (command, chain);
! 	RKGlobals::controlWindow ()->addCommand (command, chain);
  	MUTEX_UNLOCK;
  }
***************
*** 183,187 ****
  	MUTEX_LOCK;
  	ret = RCommandStack::startChain (parent);
! 	RKGlobals::controlWindow ()->refreshCommands ();
  	MUTEX_UNLOCK;
  	return ret;
--- 185,189 ----
  	MUTEX_LOCK;
  	ret = RCommandStack::startChain (parent);
! 	RKGlobals::controlWindow ()->addChain (ret);
  	MUTEX_UNLOCK;
  	return ret;
***************
*** 193,197 ****
  	MUTEX_LOCK;
  	ret = RCommandStack::closeChain (chain);
! 	RKGlobals::controlWindow ()->refreshCommands ();
  	MUTEX_UNLOCK;
  	return ret;
--- 195,199 ----
  	MUTEX_LOCK;
  	ret = RCommandStack::closeChain (chain);
! 	RKGlobals::controlWindow ()->updateChain (chain);
  	MUTEX_UNLOCK;
  	return ret;
***************
*** 215,219 ****
  	}
  	
! 	RKGlobals::controlWindow ()->refreshCommands ();
  	MUTEX_UNLOCK;
  }
--- 217,221 ----
  	}
  	
! 	RKGlobals::controlWindow ()->updateCommand (command);
  	MUTEX_UNLOCK;
  }
***************
*** 229,232 ****
--- 231,236 ----
  	RK_TRACE (RBACKEND);
  
+ 	RKGlobals::controlWindow()->addChain (request->in_chain);
+ 
  	// clear reply object
  	issueCommand (".rk.rkreply <- NULL", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);

Index: rcommand.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rcommand.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** rcommand.h	13 Oct 2005 21:01:57 -0000	1.18
--- rcommand.h	14 Oct 2005 15:57:43 -0000	1.19
***************
*** 37,40 ****
--- 37,41 ----
  protected:
  friend class RControlWindow;
+ friend class RControlWindowListViewItem;
  friend class RCommandStack;
  	QPtrList<RChainOrCommand> commands;





More information about the rkward-tracker mailing list