[rkward-cvs] rkward/rkward/settings rksettings.cpp, 1.10, 1.11 rksettingsmoduler.cpp, 1.14, 1.15 rksettingsmoduler.h, 1.8, 1.9

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri Aug 18 14:37:32 UTC 2006


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

Modified Files:
	rksettings.cpp rksettingsmoduler.cpp rksettingsmoduler.h 
Log Message:
Resume work on library locations. Reorganize Settings pages somewhat

Index: rksettingsmoduler.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmoduler.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** rksettingsmoduler.cpp	22 Jun 2006 18:56:17 -0000	1.14
--- rksettingsmoduler.cpp	18 Aug 2006 14:37:30 -0000	1.15
***************
*** 37,42 ****
  
  // static members
- bool RKSettingsModuleR::archive_packages;
- QStringList RKSettingsModuleR::package_repositories;
  QString RKSettingsModuleR::options_outdec;
  int RKSettingsModuleR::options_width;
--- 37,40 ----
***************
*** 56,72 ****
  	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
  
- 	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 ();
- 
  	QLabel *label = new QLabel (i18n ("The following settings mostly affect R behavior in the console. It's generally safe to keep these unchanged."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
--- 54,57 ----
***************
*** 144,147 ****
--- 129,134 ----
  	connect (checkbounds_input, SIGNAL (activated (int)), this, SLOT (boxChanged (int)));
  	grid->addWidget (checkbounds_input, row, 1);
+ 
+ 	main_vbox->addStretch ();
  }
  
***************
*** 165,174 ****
  }
  
- void RKSettingsModuleR::addRepository (QStringList *string_list) {
- 	RK_TRACE (SETTINGS);
- 	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 () {
  	RK_TRACE (SETTINGS);
--- 152,155 ----
***************
*** 184,191 ****
  	RK_TRACE (SETTINGS);
  
- 	archive_packages = archive_packages_box->isChecked ();
- 
- 	package_repositories = repository_selector->getValues ();
- 
  	options_outdec = outdec_input->text ();
  	options_width = width_input->value ();
--- 165,168 ----
***************
*** 209,222 ****
  	QStringList list;
  
- // package repositories
- 	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 + "\"");
- 	}
- 	list.append (command + "))\n");
- 
  	QString tf;
  	list.append ("options (OutDec=\"" + options_outdec.left (1) + "\")\n");
--- 186,189 ----
***************
*** 246,251 ****
  
  	config->setGroup ("R Settings");
- 	config->writeEntry ("archive packages", archive_packages);
- 	config->writeEntry ("Repositories", package_repositories);
  
  	config->writeEntry ("OutDec", options_outdec);
--- 213,216 ----
***************
*** 264,272 ****
  
  	config->setGroup ("R Settings");
- 	archive_packages = config->readBoolEntry ("archive packages", false);
- 	package_repositories = config->readListEntry ("Repositories");
- 	if (!package_repositories.count ()) {
- 		package_repositories.append ("@CRAN@");
- 	}
  
  	options_outdec = config->readEntry ("OutDec", ".");
--- 229,232 ----
***************
*** 287,290 ****
--- 247,253 ----
  // static members
  QStringList RKSettingsModuleRPackages::liblocs;
+ QStringList RKSettingsModuleRPackages::defaultliblocs;
+ bool RKSettingsModuleRPackages::archive_packages;
+ QStringList RKSettingsModuleRPackages::package_repositories;
  
  RKSettingsModuleRPackages::RKSettingsModuleRPackages (RKSettings *gui, QWidget *parent) : RKSettingsModule(gui, parent) {
***************
*** 295,308 ****
  	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
  
! 	libloc_selector = new MultiStringSelector (i18n ("R Library locations (where R addons get installed to) NOT USED, YET"), this);
  	libloc_selector->setValues (liblocs);
  	connect (libloc_selector, SIGNAL (listChanged ()), this, SLOT (listChanged ()));
  	connect (libloc_selector, SIGNAL (getNewStrings (QStringList*)), this, SLOT (addLibLoc (QStringList*)));
  	main_vbox->addWidget (libloc_selector);
! 	QLabel *label = new QLabel (i18n ("If you leave the list empty, only the startup defaults will be used"), this);
  	main_vbox->addWidget (label);
  }
  
! RKSettingsModuleRPackages::~RKSettingsModuleRPackages() {
  	RK_TRACE (SETTINGS);
  }
--- 258,286 ----
  	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
  
! 	repository_selector = new MultiStringSelector (i18n ("Package repositories (where libraries are downloaded from)"), 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 ();
! 
! 	libloc_selector = new MultiStringSelector (i18n ("R Library locations  (where libraries get installed to, locally)"), this);
  	libloc_selector->setValues (liblocs);
  	connect (libloc_selector, SIGNAL (listChanged ()), this, SLOT (listChanged ()));
  	connect (libloc_selector, SIGNAL (getNewStrings (QStringList*)), this, SLOT (addLibLoc (QStringList*)));
  	main_vbox->addWidget (libloc_selector);
! 	QLabel *label = new QLabel (i18n ("Note: The startup defaults will always be used in addition to the locations you specify in this list"), this);
  	main_vbox->addWidget (label);
+ 
+ 	main_vbox->addStretch ();
  }
  
! RKSettingsModuleRPackages::~RKSettingsModuleRPackages () {
  	RK_TRACE (SETTINGS);
  }
***************
*** 321,324 ****
--- 299,308 ----
  }
  
+ void RKSettingsModuleRPackages::addRepository (QStringList *string_list) {
+ 	RK_TRACE (SETTINGS);
+ 	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 RKSettingsModuleRPackages::caption () {
  	RK_TRACE (SETTINGS);
***************
*** 331,338 ****
--- 315,363 ----
  }
  
+ //static
+ QStringList RKSettingsModuleRPackages::makeRRunTimeOptionCommands () {
+ 	QStringList list;
+ 
+ // package repositories
+ 	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 + "\"");
+ 	}
+ 	list.append (command + "))\n");
+ 
+ // library locations
+ 	command = ".libPaths (unique (c (";
+ 	bool first = true;
+ 	for (QStringList::const_iterator it = liblocs.begin (); it != liblocs.end (); ++it) {
+ 		if (first) first = false;
+ 		else command.append (", ");
+ 		command.append ("\"" + *it + "\"");
+ 	}
+ 	for (QStringList::const_iterator it = defaultliblocs.begin (); it != defaultliblocs.end (); ++it) {
+ 		if (first) first = false;
+ 		else command.append (", ");
+ 		command.append ("\"" + *it + "\"");
+ 	}
+ 	command.append (")))");
+ 	list.append (command);
+ 
+ 	return list;
+ }
+ 
  void RKSettingsModuleRPackages::applyChanges () {
  	RK_TRACE (SETTINGS);
  
+ 	archive_packages = archive_packages_box->isChecked ();
+ 	package_repositories = repository_selector->getValues ();
  	liblocs = libloc_selector->getValues ();
+ 
+ // apply options in R
+ 	QStringList commands = makeRRunTimeOptionCommands ();
+ 	for (QStringList::const_iterator it = commands.begin (); it != commands.end (); ++it) {
+ 		RKGlobals::rInterface ()->issueCommand (*it, RCommand::App, QString::null, 0, 0, commandChain ());
+ 	}
  }
  
***************
*** 347,350 ****
--- 372,379 ----
  
  	config->setGroup ("R Settings");
+ 
+ 	config->writeEntry ("archive packages", archive_packages);
+ 	config->writeEntry ("Repositories", package_repositories);
+ 
  	config->writeEntry ("LibraryLocations", liblocs);
  }
***************
*** 354,357 ****
--- 383,393 ----
  
  	config->setGroup ("R Settings");
+ 
+ 	archive_packages = config->readBoolEntry ("archive packages", false);
+ 	package_repositories = config->readListEntry ("Repositories");
+ 	if (!package_repositories.count ()) {
+ 		package_repositories.append ("@CRAN@");
+ 	}
+ 
  	liblocs = config->readListEntry ("LibraryLocations");
  }

Index: rksettingsmoduler.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmoduler.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rksettingsmoduler.h	22 Jun 2006 18:56:17 -0000	1.8
--- rksettingsmoduler.h	18 Aug 2006 14:37:30 -0000	1.9
***************
*** 50,56 ****
  	QString caption ();
  	
- 	static bool archivePackages () { return archive_packages; }
- //	static QStringList getPackageRepositories () { return package_repositories; };
- 
  /** generate the commands needed to set the R run time options */
  	static QStringList makeRRunTimeOptionCommands ();
--- 50,53 ----
***************
*** 59,66 ****
  	void pathChanged ();
  	void textChanged (const QString &);
- 	void addRepository (QStringList *string_list);
  private:
- 	QCheckBox *archive_packages_box;
- 	MultiStringSelector *repository_selector;
  	QLineEdit *outdec_input;
  	KIntSpinBox *width_input;
--- 56,60 ----
***************
*** 73,78 ****
  	QComboBox *checkbounds_input;
  
- 	static bool archive_packages;
- 	static QStringList package_repositories;
  	static QString options_outdec;
  	static int options_width;
--- 67,70 ----
***************
*** 104,116 ****
  	static void saveSettings (KConfig *config);
  	static void loadSettings (KConfig *config);
! 	
  	QString caption ();
  public slots:
  	void listChanged ();
  	void addLibLoc (QStringList *string_list);
  private:
  	MultiStringSelector *libloc_selector;
  
  	static QStringList liblocs;
  };
  
--- 96,122 ----
  	static void saveSettings (KConfig *config);
  	static void loadSettings (KConfig *config);
! 
! /** generate the commands needed to set the R run time options */
! 	static QStringList makeRRunTimeOptionCommands ();
! 
! 	static bool archivePackages () { return archive_packages; }
! //	static QStringList getPackageRepositories () { return package_repositories; };
! 
  	QString caption ();
  public slots:
  	void listChanged ();
  	void addLibLoc (QStringList *string_list);
+ 	void addRepository (QStringList *string_list);
  private:
  	MultiStringSelector *libloc_selector;
+ 	QCheckBox *archive_packages_box;
+ 	MultiStringSelector *repository_selector;
  
  	static QStringList liblocs;
+ 	static bool archive_packages;
+ 	static QStringList package_repositories;
+ 
+ 	friend class RThread;
+ 	static QStringList defaultliblocs;
  };
  

Index: rksettings.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettings.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rksettings.cpp	22 Jun 2006 18:56:17 -0000	1.10
--- rksettings.cpp	18 Aug 2006 14:37:30 -0000	1.11
***************
*** 145,153 ****
  	RK_TRACE (SETTINGS);
  
  	RKSettingsModulePlugins::loadSettings(config);
  	RKSettingsModuleR::loadSettings(config);
  	RKSettingsModuleRPackages::loadSettings(config);
  	RKSettingsModulePHP::loadSettings(config);
- 	RKSettingsModuleGeneral::loadSettings(config);
  	RKSettingsModuleOutput::loadSettings(config);
  	RKSettingsModuleWatch::loadSettings(config);
--- 145,153 ----
  	RK_TRACE (SETTINGS);
  
+ 	RKSettingsModuleGeneral::loadSettings(config);		// alway load this first, as it contains the base path for rkward files
  	RKSettingsModulePlugins::loadSettings(config);
  	RKSettingsModuleR::loadSettings(config);
  	RKSettingsModuleRPackages::loadSettings(config);
  	RKSettingsModulePHP::loadSettings(config);
  	RKSettingsModuleOutput::loadSettings(config);
  	RKSettingsModuleWatch::loadSettings(config);
***************
*** 159,167 ****
  	RK_TRACE (SETTINGS);
  
  	RKSettingsModulePlugins::saveSettings(config);
  	RKSettingsModuleR::saveSettings(config);
  	RKSettingsModuleRPackages::saveSettings(config);
  	RKSettingsModulePHP::saveSettings(config);
- 	RKSettingsModuleGeneral::saveSettings(config);
  	RKSettingsModuleOutput::saveSettings(config);
  	RKSettingsModuleWatch::saveSettings(config);
--- 159,167 ----
  	RK_TRACE (SETTINGS);
  
+ 	RKSettingsModuleGeneral::saveSettings(config);
  	RKSettingsModulePlugins::saveSettings(config);
  	RKSettingsModuleR::saveSettings(config);
  	RKSettingsModuleRPackages::saveSettings(config);
  	RKSettingsModulePHP::saveSettings(config);
  	RKSettingsModuleOutput::saveSettings(config);
  	RKSettingsModuleWatch::saveSettings(config);





More information about the rkward-tracker mailing list