[rkward-cvs] SF.net SVN: rkward: [934] trunk/rkward/rkward/settings

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sat Nov 25 20:08:29 UTC 2006


Revision: 934
          http://svn.sourceforge.net/rkward/?rev=934&view=rev
Author:   tfry
Date:     2006-11-25 12:08:29 -0800 (Sat, 25 Nov 2006)

Log Message:
-----------
Started adding workplace save mode option

Modified Paths:
--------------
    trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp
    trunk/rkward/rkward/settings/rksettingsmodulegeneral.h

Modified: trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp	2006-11-24 15:00:59 UTC (rev 933)
+++ trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp	2006-11-25 20:08:29 UTC (rev 934)
@@ -25,6 +25,8 @@
 #include <qlabel.h>
 #include <qdir.h>
 #include <qcombobox.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
 
 #include "../misc/getfilenamewidget.h"
 #include "../rkglobals.h"
@@ -34,6 +36,7 @@
 QString RKSettingsModuleGeneral::files_path;
 QString RKSettingsModuleGeneral::new_files_path;
 StartupDialog::Result RKSettingsModuleGeneral::startup_action;
+RKSettingsModuleGeneral::WorkplaceSaveMode RKSettingsModuleGeneral::workplace_save_mode;
 
 RKSettingsModuleGeneral::RKSettingsModuleGeneral (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
 	RK_TRACE (SETTINGS);
@@ -57,6 +60,25 @@
 	connect (startup_action_choser, SIGNAL (activated (int)), this, SLOT (boxChanged (int)));
 	main_vbox->addWidget (startup_action_choser);
 
+	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
+
+	label = new QLabel (i18n ("The workplace layout (i.e. which script-, data-, help-windows are open) may be saved (and loaded) per R workspace, or independent of the R workspace. Which do you prefer?"), this);
+	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
+	main_vbox->addWidget (label);
+
+	workplace_save_chooser = new QButtonGroup (this);
+	workplace_save_chooser->setColumnLayout (0, Qt::Vertical);
+	workplace_save_chooser->layout()->setSpacing (6);
+	workplace_save_chooser->layout()->setMargin (11);
+	QVBoxLayout *group_layout = new QVBoxLayout(workplace_save_chooser->layout());
+	group_layout->addWidget (new QRadioButton (i18n ("Save/restore with R workspace, when saving/loading R workspace"), workplace_save_chooser));
+	group_layout->addWidget (new QRadioButton (i18n ("Save/restore independent of R workspace (save at end of RKWard session, restore at next start)"), workplace_save_chooser));
+	group_layout->addWidget (new QRadioButton (i18n ("Do not save/restore workplace layout"), workplace_save_chooser));
+	workplace_save_chooser->setButton (static_cast<int> (workplace_save_mode));
+	connect (workplace_save_chooser, SIGNAL (clicked (int)), this, SLOT (boxChanged (int)));
+	main_vbox->addWidget (workplace_save_chooser);
+	#warning option unfinished!
+
 	main_vbox->addStretch ();
 }
 
@@ -103,6 +125,9 @@
 
 	config->setGroup ("General");
 	config->writeEntry ("startup action", (int) startup_action);
+
+	config->setGroup ("Workplace");
+	config->writeEntry ("save mode", (int) workplace_save_mode);
 }
 
 void RKSettingsModuleGeneral::loadSettings (KConfig *config) {
@@ -113,6 +138,9 @@
 
 	config->setGroup ("General");
 	startup_action = (StartupDialog::Result) config->readNumEntry ("startup action", StartupDialog::NoSavedSetting);
+
+	config->setGroup ("Workplace");
+	workplace_save_mode = (WorkplaceSaveMode) config->readNumEntry ("save mode", SaveWorkplaceWithWorkspace);
 }
 
 #include "rksettingsmodulegeneral.moc"

Modified: trunk/rkward/rkward/settings/rksettingsmodulegeneral.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegeneral.h	2006-11-24 15:00:59 UTC (rev 933)
+++ trunk/rkward/rkward/settings/rksettingsmodulegeneral.h	2006-11-25 20:08:29 UTC (rev 934)
@@ -22,6 +22,7 @@
 
 class GetFileNameWidget;
 class QComboBox;
+class QButtonGroup;
 
 /**
 @author Thomas Friedrichsmeier
@@ -29,10 +30,16 @@
 class RKSettingsModuleGeneral : public RKSettingsModule {
 	Q_OBJECT
 public:
-    RKSettingsModuleGeneral (RKSettings *gui, QWidget *parent);
+	RKSettingsModuleGeneral (RKSettings *gui, QWidget *parent);
 
-    ~RKSettingsModuleGeneral ();
-	
+	~RKSettingsModuleGeneral ();
+
+	enum WorkplaceSaveMode {	// don't change the int values of this enum, or you'll ruin users saved settings. Append new values at the end
+		SaveWorkplaceWithWorkspace=0,
+		SaveWorkplaceWithSession=1,
+		DontSaveWorkplace=2
+	};
+
 	bool hasChanges ();
 	void applyChanges ();
 	void save (KConfig *config);
@@ -46,17 +53,23 @@
 	static QString &filesPath () { return files_path; };
 	static StartupDialog::Result startupAction () { return startup_action; };
 	static void setStartupAction (StartupDialog::Result action) { startup_action = action; };
+	static WorkplaceSaveMode workplaceSaveMode () { return workplace_save_mode; };
+/** retrieve the saved workplace description. Meaningful only is workplaceSaveMode () == SaveWorkplaceWithSession */
+	static QString getSavedWorkplace ();
+	static void setSavedWorkplace (const QString &description);
 public slots:
 	void pathChanged ();
 	void boxChanged (int);
 private:
 	GetFileNameWidget *files_choser;
 	QComboBox *startup_action_choser;
+	QButtonGroup *workplace_save_chooser;
 
 	static StartupDialog::Result startup_action;
 	static QString files_path;
 /** since changing the files_path can not easily be done while in an active session, the setting should only take effect on the next start. This string stores a changed setting, while keeping the old one intact as long as RKWard is running */
 	static QString new_files_path;
+	static WorkplaceSaveMode workplace_save_mode;
 };
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list