[rkward-cvs] rkward/rkward/plugin rkstandardcomponent.cpp,1.15,1.16 rkstandardcomponent.h,1.7,1.8

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Mar 19 18:15:59 UTC 2006


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

Modified Files:
	rkstandardcomponent.cpp rkstandardcomponent.h 
Log Message:
Dialog interface for RKStandardComponent basically working

Index: rkstandardcomponent.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkstandardcomponent.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** rkstandardcomponent.h	19 Mar 2006 16:41:26 -0000	1.7
--- rkstandardcomponent.h	19 Mar 2006 18:15:57 -0000	1.8
***************
*** 62,66 ****
  /** sometimes the plugin can't be destroyed immediately, since, for example the script-backend is
  	still busy cleaning stuff up. In that case this var is set and the plugin gets destroyed ASAP. */
- 	bool destroyed;
  	bool created;
  };
--- 62,65 ----
***************
*** 71,74 ****
--- 70,74 ----
  class QPushButton;
  class QTimer;
+ class QSplitter;
  
  /** contains the standard GUI elements for a top-level RKStandardComponent
***************
*** 98,112 ****
  
  	// standard gui-elements
! 	RKCommandEditor *codeDisplay;
  
  	// common widgets
! 	QPushButton *okButton;
! 	QPushButton *cancelButton;
! 	QPushButton *helpButton;
! 	QPushButton *switchButton;
  
  	// widgets for dialog only
! 	QPushButton *toggleCodeButton;
! 
  private:
  	RKStandardComponent *component;
--- 98,112 ----
  
  	// standard gui-elements
! 	RKCommandEditor *code_display;
  
  	// common widgets
! 	QSplitter *splitter;
! 	QPushButton *ok_button;
! 	QPushButton *cancel_button;
! 	QPushButton *help_button;
! 	QPushButton *switch_button;
  
  	// widgets for dialog only
! 	QPushButton *toggle_code_button;
  private:
  	RKStandardComponent *component;

Index: rkstandardcomponent.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkstandardcomponent.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** rkstandardcomponent.cpp	19 Mar 2006 16:41:26 -0000	1.15
--- rkstandardcomponent.cpp	19 Mar 2006 18:15:57 -0000	1.16
***************
*** 44,52 ****
  #include "../misc/rkerrordialog.h"
  #include "../misc/xmlhelper.h"
  /*#include "../rkward.h"
  #include "../rkeditormanager.h"
  #include "../rkcommandeditor.h"
  #include "../settings/rksettingsmoduleplugins.h"
! #include "../rbackend/rinterface.h"*/
  
  // component widgets
--- 44,53 ----
  #include "../misc/rkerrordialog.h"
  #include "../misc/xmlhelper.h"
+ #include "../rbackend/rinterface.h"
  /*#include "../rkward.h"
  #include "../rkeditormanager.h"
  #include "../rkcommandeditor.h"
  #include "../settings/rksettingsmoduleplugins.h"
! */
  
  // component widgets
***************
*** 94,101 ****
  //	connect (backend, SIGNAL (requestRCall (const QString&)), this, SLOT (doRCall (const QString&)));
  //	connect (backend, SIGNAL (requestRVector (const QString&)), this, SLOT (getRVector (const QString&)));
! 	connect (backend, SIGNAL (haveError ()), this, SLOT (tryDestruct ()));
  	if (!backend->initialize (dummy, code)) return;
  
! 	connect (qApp, SIGNAL (aboutToQuit ()), this, SLOT (tryDestruct ()));
  	
  /*	update_timer = new QTimer (this);
--- 95,102 ----
  //	connect (backend, SIGNAL (requestRCall (const QString&)), this, SLOT (doRCall (const QString&)));
  //	connect (backend, SIGNAL (requestRVector (const QString&)), this, SLOT (getRVector (const QString&)));
! 	connect (backend, SIGNAL (haveError ()), this, SLOT (deleteLater ()));
  	if (!backend->initialize (dummy, code)) return;
  
! 	connect (qApp, SIGNAL (aboutToQuit ()), this, SLOT (deleteLater ()));
  	
  /*	update_timer = new QTimer (this);
***************
*** 306,310 ****
  
  	QGridLayout *main_grid = new QGridLayout (this, 1, 1);
! 	QSplitter *splitter = new QSplitter (QSplitter::Vertical, this);
  	main_grid->addWidget (splitter, 0, 0);
  	QWidget *upper_widget = new QWidget (splitter);
--- 307,311 ----
  
  	QGridLayout *main_grid = new QGridLayout (this, 1, 1);
! 	splitter = new QSplitter (QSplitter::Vertical, this);
  	main_grid->addWidget (splitter, 0, 0);
  	QWidget *upper_widget = new QWidget (splitter);
***************
*** 326,361 ****
  	// buttons
  	vbox = new QVBoxLayout (hbox, RKGlobals::spacingHint ());
! 	okButton = new QPushButton ("Submit", upper_widget);
! 	connect (okButton, SIGNAL (clicked ()), this, SLOT (ok ()));
! 	vbox->addWidget (okButton);
  	
! 	cancelButton = new QPushButton ("Close", upper_widget);
! 	connect (cancelButton, SIGNAL (clicked ()), this, SLOT (cancel ()));
! 	vbox->addWidget (cancelButton);
  	vbox->addStretch (1);
  	
! 	helpButton = new QPushButton ("Help", upper_widget);
! 	connect (helpButton, SIGNAL (clicked ()), this, SLOT (help ()));
! 	vbox->addWidget (helpButton);
  	
  /*	if (wizard_available) {
! 		switchButton = new QPushButton ("Use Wizard", upper_widget);
! 		connect (switchButton, SIGNAL (clicked ()), this, SLOT (switchInterfaces ()));
! 		vbox->addWidget (switchButton);
  	} */
  	vbox->addStretch (2);
  	
! 	toggleCodeButton = new QPushButton ("Code", upper_widget);
! 	toggleCodeButton->setToggleButton (true);
! 	toggleCodeButton->setOn (true);
! 	connect (toggleCodeButton, SIGNAL (clicked ()), this, SLOT (toggleCode ()));
! 	vbox->addWidget (toggleCodeButton);
! 	
! 	// text-fields
! 	QWidget *lower_widget = new QWidget (splitter);
  	
! 	vbox = new QVBoxLayout (lower_widget, RKGlobals::spacingHint ());
! 	codeDisplay = new RKCommandEditor (lower_widget, true);
! 	vbox->addWidget (codeDisplay);
  
  	// code update timer
--- 327,358 ----
  	// buttons
  	vbox = new QVBoxLayout (hbox, RKGlobals::spacingHint ());
! 	ok_button = new QPushButton ("Submit", upper_widget);
! 	connect (ok_button, SIGNAL (clicked ()), this, SLOT (ok ()));
! 	vbox->addWidget (ok_button);
  	
! 	cancel_button = new QPushButton ("Close", upper_widget);
! 	connect (cancel_button, SIGNAL (clicked ()), this, SLOT (cancel ()));
! 	vbox->addWidget (cancel_button);
  	vbox->addStretch (1);
  	
! 	help_button = new QPushButton ("Help", upper_widget);
! 	connect (help_button, SIGNAL (clicked ()), this, SLOT (help ()));
! 	vbox->addWidget (help_button);
  	
  /*	if (wizard_available) {
! 		switch_button = new QPushButton ("Use Wizard", upper_widget);
! 		connect (switch_button, SIGNAL (clicked ()), this, SLOT (switchInterfaces ()));
! 		vbox->addWidget (switch_button);
  	} */
  	vbox->addStretch (2);
  	
! 	toggle_code_button = new QPushButton ("Code", upper_widget);
! 	toggle_code_button->setToggleButton (true);
! 	toggle_code_button->setOn (true);
! 	connect (toggle_code_button, SIGNAL (clicked ()), this, SLOT (toggleCode ()));
! 	vbox->addWidget (toggle_code_button);
  	
! 	// code display
! 	code_display = new RKCommandEditor (splitter, true);
  
  	// code update timer
***************
*** 370,373 ****
--- 367,379 ----
  void RKStandardComponentGUI::ok () {
  	RK_TRACE (PLUGIN);
+ 
+ 	RK_ASSERT (code_property->isValid ());
+ 	
+ 	RCommandChain *chain = RKGlobals::rInterface ()->startChain ();
+ 	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->preprocess (), RCommand::Plugin | RCommand::DirectToOutput), chain);
+ 	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->calculate (), RCommand::Plugin | RCommand::DirectToOutput), chain);
+ 	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->printout (), RCommand::Plugin | RCommand::DirectToOutput), chain);
+ 	RKGlobals::rInterface ()->issueCommand (new RCommand (code_property->cleanup (), RCommand::Plugin | RCommand::DirectToOutput), chain);
+ 	RKGlobals::rInterface ()->closeChain (chain);
  }
  
***************
*** 378,385 ****
--- 384,397 ----
  void RKStandardComponentGUI::cancel () {
  	RK_TRACE (PLUGIN);
+ 
+ 	hide ();
+ 	component->deleteLater ();
  }
  
  void RKStandardComponentGUI::toggleCode () {
  	RK_TRACE (PLUGIN);
+ 
+ 	code_display->setShown (toggle_code_button->isOn ());
+ 	updateCode ();
  }
  
***************
*** 392,397 ****
  
  	e->accept ();
! 	hide ();
! 	component->deleteLater ();
  }
  
--- 404,408 ----
  
  	e->accept ();
! 	cancel ();
  }
  
***************
*** 399,403 ****
  	RK_TRACE (PLUGIN);
  
! 	okButton->setEnabled (enable);
  }
  
--- 410,414 ----
  	RK_TRACE (PLUGIN);
  
! 	ok_button->setEnabled (enable);
  }
  
***************
*** 411,414 ****
--- 422,426 ----
  	RK_TRACE (PLUGIN);
  
+ 	if (!code_display->isShown ()) return;
  	code_update_timer->start (0, true);
  }
***************
*** 418,428 ****
  
  	if (!code_property->isValid ()) {
! 		codeDisplay->setText (i18n ("Processing. Please wait"));
  		RK_DO (qDebug ("code not ready to be displayed: pre %d, cal %d, pri %d, cle %d", !code_property->preprocess ().isNull (), !code_property->calculate ().isNull (), !code_property->printout ().isNull (), !code_property->cleanup ().isNull ()), PLUGIN, DL_DEBUG);
  	} else {
! 		codeDisplay->setText (code_property->preprocess () + code_property->calculate () + code_property->printout () + code_property->cleanup ());
  	}
  }
  
- 
  #include "rkstandardcomponent.moc"
--- 430,439 ----
  
  	if (!code_property->isValid ()) {
! 		code_display->setText (i18n ("Processing. Please wait"));
  		RK_DO (qDebug ("code not ready to be displayed: pre %d, cal %d, pri %d, cle %d", !code_property->preprocess ().isNull (), !code_property->calculate ().isNull (), !code_property->printout ().isNull (), !code_property->cleanup ().isNull ()), PLUGIN, DL_DEBUG);
  	} else {
! 		code_display->setText (code_property->preprocess () + code_property->calculate () + code_property->printout () + code_property->cleanup ());
  	}
  }
  
  #include "rkstandardcomponent.moc"





More information about the rkward-tracker mailing list