[rkward-cvs] rkward/rkward/settings rksettings.cpp,1.5,1.6 rksettings.h,1.4,1.5 rksettingsmodule.cpp,1.4,1.5 rksettingsmodule.h,1.3,1.4 rksettingsmoduler.cpp,1.5,1.6 rksettingsmoduler.h,1.4,1.5

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Sep 18 15:17:57 UTC 2005


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

Modified Files:
	rksettings.cpp rksettings.h rksettingsmodule.cpp 
	rksettingsmodule.h rksettingsmoduler.cpp rksettingsmoduler.h 
Log Message:
downloaded packages are now archived or deleted according to user setting. Ability to specify additional package repositories

Index: rksettingsmodule.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmodule.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rksettingsmodule.h	22 Apr 2005 13:56:18 -0000	1.3
--- rksettingsmodule.h	18 Sep 2005 15:17:55 -0000	1.4
***************
*** 23,26 ****
--- 23,27 ----
  class KConfig;
  class RKSettings;
+ class RCommandChain;
  
  /**
***************
*** 40,43 ****
--- 41,47 ----
  	
  	virtual QString caption () = 0;
+ /** Some settings modules execute R commands on "apply". If an RCommandChain is specified for the RKSettings-dialog, those commands should
+ be inserted into this chain. It's safe to use this unconditionally, as if there is no chain, this will return 0, which corresponds to using the top-level chain */
+ 	RCommandChain *commandChain () { return chain; };
  protected:
  	void change ();
***************
*** 46,49 ****
--- 50,55 ----
  private:
  	RKSettings *gui;
+ friend class RKSettings;
+ 	static RCommandChain *chain;
  };
  

Index: rksettingsmodule.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmodule.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rksettingsmodule.cpp	22 Apr 2005 13:56:18 -0000	1.4
--- rksettingsmodule.cpp	18 Sep 2005 15:17:55 -0000	1.5
***************
*** 20,23 ****
--- 20,26 ----
  #include "rksettings.h"
  
+ //static
+ RCommandChain* RKSettingsModule::chain = 0;
+ 
  RKSettingsModule::RKSettingsModule(RKSettings *gui, QWidget *parent) : QWidget (parent) {
  	changed = false;

Index: rksettingsmoduler.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmoduler.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rksettingsmoduler.cpp	22 Apr 2005 13:56:19 -0000	1.5
--- rksettingsmoduler.cpp	18 Sep 2005 15:17:55 -0000	1.6
***************
*** 20,23 ****
--- 20,24 ----
  #include <kconfig.h>
  #include <kstandarddirs.h>
+ #include <kinputdialog.h>
  
  #include <qlayout.h>
***************
*** 26,54 ****
  #include <qcheckbox.h>
  
! #include "../misc/getfilenamewidget.h"
  #include "../rkglobals.h"
  
  // static members
  QString RKSettingsModuleR::r_home_dir;
- QString RKSettingsModuleR::pager_app;
- //QString RKSettingsModuleR::r_startup_file;
  bool RKSettingsModuleR::r_nosave;
  bool RKSettingsModuleR::r_slave;
  
  RKSettingsModuleR::RKSettingsModuleR (RKSettings *gui, QWidget *parent) : RKSettingsModule(gui, parent) {
  	QVBoxLayout *main_vbox = new QVBoxLayout (this, RKGlobals::marginHint ());
! 	
! 	QLabel *label = new QLabel (i18n ("Note: changes in this section do not take effect until you restart RKWard!"), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	main_vbox->addWidget (label);
  	main_vbox->addStretch ();
! 	
! 	pager_choser = new GetFileNameWidget (this, GetFileNameWidget::ExistingFile, i18n ("Program to use as a pager (e.g. for R-help)"), "", pager_app);
! 	connect (pager_choser, SIGNAL (locationChanged ()), this, SLOT (pathChanged ()));
! 	main_vbox->addWidget (pager_choser);
  
  	main_vbox->addStretch ();
  
! 	QVButtonGroup *group = new QVButtonGroup (i18n ("R options"), this);
  	nosave_box = new QCheckBox ("--no-save", group);
  	nosave_box->setChecked (r_nosave);
--- 27,63 ----
  #include <qcheckbox.h>
  
! #include "../misc/multistringselector.h"
! #include "../rbackend/rinterface.h"
  #include "../rkglobals.h"
  
  // static members
  QString RKSettingsModuleR::r_home_dir;
  bool RKSettingsModuleR::r_nosave;
  bool RKSettingsModuleR::r_slave;
+ bool RKSettingsModuleR::archive_packages;
+ QStringList RKSettingsModuleR::package_repositories;
  
  RKSettingsModuleR::RKSettingsModuleR (RKSettings *gui, QWidget *parent) : RKSettingsModule(gui, parent) {
  	QVBoxLayout *main_vbox = new QVBoxLayout (this, RKGlobals::marginHint ());
! 
! 	QLabel *label = new QLabel (i18n ("Note: Settings marked with (*) will not take effect until you restart RKWard!"), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	main_vbox->addWidget (label);
  	main_vbox->addStretch ();
! 
! 	repository_selector = new MultiStringSelector (i18n ("Package repositories"), this);
! 	repository_selector->setValues (package_repositories);
! 	connect (repository_selector, SIGNAL (listChanged ()), this, SLOT (pathChanged ()));
! 	connect (repository_selector, SIGNAL (getNewStrings (QStringList*)), this, SLOT (addRepository (QStringList*)));
! 	main_vbox->addWidget (repository_selector);
! 
! 	archive_packages_box = new QCheckBox (i18n ("Archive downloaded packages"), this);
! 	archive_packages_box->setChecked (archive_packages);
! 	connect (archive_packages_box, SIGNAL (stateChanged (int)), this, SLOT (boxChanged (int)));
! 	main_vbox->addWidget (archive_packages_box);	
  
  	main_vbox->addStretch ();
  
! 	QVButtonGroup *group = new QVButtonGroup (i18n ("R options (*)"), this);
  	nosave_box = new QCheckBox ("--no-save", group);
  	nosave_box->setChecked (r_nosave);
***************
*** 59,67 ****
  
  	main_vbox->addWidget (group);	
- 
- /*	main_vbox->addStretch ();
- 	startup_file_choser = new GetFileNameWidget (this, GetFileNameWidget::ExistingFile, i18n ("Location of 'startup.R'-script"), "", r_startup_file);
- 	connect (startup_file_choser, SIGNAL (locationChanged ()), this, SLOT (pathChanged ()));
- 	main_vbox->addWidget (startup_file_choser); */
  }
  
--- 68,71 ----
***************
*** 77,80 ****
--- 81,89 ----
  }
  
+ void RKSettingsModuleR::addRepository (QStringList *string_list) {
+ 	QString new_string = KInputDialog::getText (i18n ("Add repository"), i18n ("Add URL of new repository\n(Enter \"@CRAN@\" for the standard CRAN-mirror)"), QString::null, 0, this);
+ 	(*string_list).append (new_string);
+ }
+ 
  QString RKSettingsModuleR::caption () {
  	return (i18n ("R-Backend"));
***************
*** 86,93 ****
  
  void RKSettingsModuleR::applyChanges () {
- 	pager_app = pager_choser->getLocation ();
  	r_nosave = nosave_box->isChecked ();
  	r_slave = slave_box->isChecked ();
! 	//r_startup_file = startup_file_choser->getLocation ();
  }
  
--- 95,110 ----
  
  void RKSettingsModuleR::applyChanges () {
  	r_nosave = nosave_box->isChecked ();
  	r_slave = slave_box->isChecked ();
! 	archive_packages = archive_packages_box->isChecked ();
! 
! 	QString command = "options (repos=c(";
! 	for (QStringList::const_iterator it = package_repositories.begin (); it != package_repositories.end (); ++it) {
! 		if (it != package_repositories.begin ()) {
! 			command.append (", ");
! 		}
! 		command.append ("\"" + *it + "\"");
! 	}
! 	RKGlobals::rInterface ()->issueCommand (command + "))\n", RCommand::App, "", 0, 0, commandChain ());
  }
  
***************
*** 99,106 ****
  	config->setGroup ("R Settings");
  	config->writeEntry ("R_HOME", r_home_dir);
- 	config->writeEntry ("pager app", pager_app);
- 	//config->writeEntry ("startup file", r_startup_file);
  	config->writeEntry ("--no-save", r_nosave);
  	config->writeEntry ("--slave", r_slave);
  }
  
--- 116,123 ----
  	config->setGroup ("R Settings");
  	config->writeEntry ("R_HOME", r_home_dir);
  	config->writeEntry ("--no-save", r_nosave);
  	config->writeEntry ("--slave", r_slave);
+ 	config->writeEntry ("archive packages", archive_packages);
+ 	config->writeEntry ("Repositories", package_repositories);
  }
  
***************
*** 108,115 ****
  	config->setGroup ("R Settings");
  	r_home_dir = config->readEntry ("R_HOME", "");
- 	pager_app = config->readEntry ("pager app", "xless");
- 	//r_startup_file = config->readEntry ("startup file", KGlobal::dirs ()->findResourceDir ("data", "rkward/rfiles/startup.R") + "rkward/rfiles/");
  	r_nosave = config->readBoolEntry ("--no-save", true);
  	r_slave = config->readBoolEntry ("--slave", true);
  }
  
--- 125,135 ----
  	config->setGroup ("R Settings");
  	r_home_dir = config->readEntry ("R_HOME", "");
  	r_nosave = config->readBoolEntry ("--no-save", true);
  	r_slave = config->readBoolEntry ("--slave", true);
+ 	archive_packages = config->readBoolEntry ("archive packages", false);
+ 	package_repositories = config->readListEntry ("Repositories");
+ 	if (!package_repositories.count ()) {
+ 		package_repositories.append ("@CRAN@");
+ 	}
  }
  

Index: rksettings.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettings.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rksettings.cpp	17 Sep 2005 17:16:38 -0000	1.5
--- rksettings.cpp	18 Sep 2005 15:17:55 -0000	1.6
***************
*** 36,43 ****
  
  //static 
! void RKSettings::configureSettings (SettingsPage page, QWidget *parent) {
  	if (!settings_dialog) {
  		settings_dialog = new RKSettings (parent);
  	}
  	settings_dialog->show ();
  	settings_dialog->raise ();
--- 36,46 ----
  
  //static 
! void RKSettings::configureSettings (SettingsPage page, QWidget *parent, RCommandChain *chain) {
! 	RKSettingsModule::chain = chain;
! 
  	if (!settings_dialog) {
  		settings_dialog = new RKSettings (parent);
  	}
+ 
  	settings_dialog->show ();
  	settings_dialog->raise ();

Index: rksettingsmoduler.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmoduler.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rksettingsmoduler.h	25 Aug 2004 16:09:12 -0000	1.4
--- rksettingsmoduler.h	18 Sep 2005 15:17:55 -0000	1.5
***************
*** 24,28 ****
  
  class QCheckBox;
! class GetFileNameWidget;
  
  /**
--- 24,28 ----
  
  class QCheckBox;
! class MultiStringSelector;
  
  /**
***************
*** 48,70 ****
  	
  	static QString &rHomeDir () { return r_home_dir; };
- 	static QString &pagerApp () { return pager_app; };
- 	//static QString &startupFile () { return r_startup_file; };
  	static bool rNosave () { return r_nosave; };
  	static bool rSlave () { return r_slave; };
  	static QStringList getOptionList ();
  public slots:
  	void boxChanged (int);
  	void pathChanged ();
  private:
  	QCheckBox *nosave_box;
  	QCheckBox *slave_box;
! 	//GetFileNameWidget *startup_file_choser;
! 	GetFileNameWidget *pager_choser;
  friend class RInterface;
  	static bool r_nosave;
  	static bool r_slave;
  	static QString r_home_dir;
- 	static QString pager_app;
- 	//static QString r_startup_file;
  };
  
--- 48,71 ----
  	
  	static QString &rHomeDir () { return r_home_dir; };
  	static bool rNosave () { return r_nosave; };
  	static bool rSlave () { return r_slave; };
+ 	static bool archivePackages () { return archive_packages; }
  	static QStringList getOptionList ();
+ 	static QStringList getPackageRepositories () { return package_repositories; };
  public slots:
  	void boxChanged (int);
  	void pathChanged ();
+ 	void addRepository (QStringList *string_list);
  private:
  	QCheckBox *nosave_box;
  	QCheckBox *slave_box;
! 	QCheckBox *archive_packages_box;
! 	MultiStringSelector *repository_selector;
  friend class RInterface;
  	static bool r_nosave;
  	static bool r_slave;
+ 	static bool archive_packages;
+ 	static QStringList package_repositories;
  	static QString r_home_dir;
  };
  

Index: rksettings.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettings.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rksettings.h	22 Apr 2005 13:56:17 -0000	1.4
--- rksettings.h	18 Sep 2005 15:17:55 -0000	1.5
***************
*** 28,31 ****
--- 28,32 ----
  class RKwardApp;
  class RKSettingsTracker;
+ class RCommandChain;
  
  /**
***************
*** 38,42 ****
  	enum SettingsPage { NoPage=0, Plugins=1, R=2, PHP=3, LogFiles=4, Output=5, Watch=6, ObjectBrowser=7 };
  
! 	static void configureSettings (SettingsPage page=NoPage, QWidget *parent=0);
  
  	static void loadSettings (KConfig *config);
--- 39,43 ----
  	enum SettingsPage { NoPage=0, Plugins=1, R=2, PHP=3, LogFiles=4, Output=5, Watch=6, ObjectBrowser=7 };
  
! 	static void configureSettings (SettingsPage page=NoPage, QWidget *parent=0, RCommandChain *chain=0);
  
  	static void loadSettings (KConfig *config);





More information about the rkward-tracker mailing list