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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Feb 16 15:08:16 UTC 2007


Revision: 1405
          http://svn.sourceforge.net/rkward/?rev=1405&view=rev
Author:   tfry
Date:     2007-02-16 07:08:15 -0800 (Fri, 16 Feb 2007)

Log Message:
-----------
Make large object warning limit configurable

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

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-02-16 14:38:26 UTC (rev 1404)
+++ trunk/rkward/ChangeLog	2007-02-16 15:08:15 UTC (rev 1405)
@@ -1,4 +1,4 @@
-- warn when opening very large objects								TODO: make limit / warning configurable
+- warn when opening very large objects (with more than 250000 fields; this limit is configurable)
 - add a "copy" tag to facilitate writing plugins with both dialog and wizard interfaces		TODO: document, convert all wizards to use this
 - fixed: graph previews would stop working when the interface is switched from dialog to wizard or vice versa
 - new options for plugin dialogs: Configure whether code display is by default, and at what size

Modified: trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp	2007-02-16 14:38:26 UTC (rev 1404)
+++ trunk/rkward/rkward/settings/rksettingsmodulegeneral.cpp	2007-02-16 15:08:15 UTC (rev 1405)
@@ -30,6 +30,7 @@
 #include <qradiobutton.h>
 
 #include "../misc/getfilenamewidget.h"
+#include "../misc/rkspinbox.h"
 #include "../rkglobals.h"
 #include "../debug.h"
 
@@ -39,6 +40,7 @@
 StartupDialog::Result RKSettingsModuleGeneral::startup_action;
 RKSettingsModuleGeneral::WorkplaceSaveMode RKSettingsModuleGeneral::workplace_save_mode;
 bool RKSettingsModuleGeneral::show_help_on_startup;
+int RKSettingsModuleGeneral::warn_size_object_edit;
 
 RKSettingsModuleGeneral::RKSettingsModuleGeneral (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
 	RK_TRACE (SETTINGS);
@@ -85,6 +87,16 @@
 	connect (workplace_save_chooser, SIGNAL (clicked (int)), this, SLOT (boxChanged (int)));
 	main_vbox->addWidget (workplace_save_chooser);
 
+	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
+
+	label = new QLabel (i18n ("Warn when editing objects with more than this number of fields (0 for no limit):"), this);
+	warn_size_object_edit_box = new RKSpinBox (this);
+	warn_size_object_edit_box->setIntMode (0, INT_MAX, warn_size_object_edit);
+	warn_size_object_edit_box->setSpecialValueText (i18n ("No limit"));
+	connect (warn_size_object_edit_box, SIGNAL (valueChanged (int)), this, SLOT (boxChanged (int)));
+	main_vbox->addWidget (label);
+	main_vbox->addWidget (warn_size_object_edit_box);
+
 	main_vbox->addStretch ();
 }
 
@@ -122,6 +134,7 @@
 #else
 	workplace_save_mode = static_cast<WorkplaceSaveMode> (workplace_save_chooser->selectedId ());
 #endif
+	warn_size_object_edit = warn_size_object_edit_box->value ();
 }
 
 void RKSettingsModuleGeneral::save (KConfig *config) {
@@ -141,6 +154,9 @@
 
 	config->setGroup ("Workplace");
 	config->writeEntry ("save mode", (int) workplace_save_mode);
+
+	config->setGroup ("Editor");
+	config->writeEntry ("large object warning limit", warn_size_object_edit);
 }
 
 void RKSettingsModuleGeneral::loadSettings (KConfig *config) {
@@ -155,6 +171,9 @@
 
 	config->setGroup ("Workplace");
 	workplace_save_mode = (WorkplaceSaveMode) config->readNumEntry ("save mode", SaveWorkplaceWithWorkspace);
+
+	config->setGroup ("Editor");
+	warn_size_object_edit = config->readNumEntry ("large object warning limit", 250000);
 }
 
 QString RKSettingsModuleGeneral::getSavedWorkplace (KConfig *config) {

Modified: trunk/rkward/rkward/settings/rksettingsmodulegeneral.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegeneral.h	2007-02-16 14:38:26 UTC (rev 1404)
+++ trunk/rkward/rkward/settings/rksettingsmodulegeneral.h	2007-02-16 15:08:15 UTC (rev 1405)
@@ -24,6 +24,7 @@
 class QComboBox;
 class QCheckBox;
 class QButtonGroup;
+class RKSpinBox;
 
 /**
 @author Thomas Friedrichsmeier
@@ -60,6 +61,7 @@
 	static QString getSavedWorkplace (KConfig *config);
 /** set the saved workplace description. Meaningful only is workplaceSaveMode () == SaveWorkplaceWithSession */
 	static void setSavedWorkplace (const QString &description, KConfig *config);
+	static unsigned long warnLargeObjectThreshold () { return warn_size_object_edit; };
 public slots:
 	void pathChanged ();
 	void boxChanged (int);
@@ -68,6 +70,7 @@
 	QComboBox *startup_action_choser;
 	QButtonGroup *workplace_save_chooser;
 	QCheckBox *show_help_on_startup_box;
+	RKSpinBox *warn_size_object_edit_box;
 
 	static StartupDialog::Result startup_action;
 	static QString files_path;
@@ -75,6 +78,7 @@
 	static QString new_files_path;
 	static WorkplaceSaveMode workplace_save_mode;
 	static bool show_help_on_startup;
+	static int warn_size_object_edit;
 };
 
 #endif

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2007-02-16 14:38:26 UTC (rev 1404)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2007-02-16 15:08:15 UTC (rev 1405)
@@ -216,9 +216,8 @@
 			for (unsigned int i = 0; i < iobj->numDimensions (); ++i) {
 				size *= iobj->getDimension (i);
 			}
-			if (size > 250000) {
-#warning: make limit configurable
-				if (KMessageBox::warningContinueCancel (view (), i18n ("You are about to edit object \"%1\", which is very large (%2 fields). RKWard is not optimized to handle very large objects in the built in data editor. This will use a lot of memory, and - depending on your system - might be very slow. For large objects it is generally recommended to edit then using command line means. On the other hand, if you have enough memory, or the data is simple enough (numeric data is easier to handle, than factor), editing may not be a problem at all. You can configure / turn of this warning under Settings->Somewhere TODO.\nReally edit object?").arg (iobj->getFullName ()).arg (QString::number (size)), i18n ("About to edit very large object")) != KMessageBox::Continue) {
+			if ((RKSettingsModuleGeneral::warnLargeObjectThreshold () != 0) && (size > RKSettingsModuleGeneral::warnLargeObjectThreshold ())) {
+				if (KMessageBox::warningContinueCancel (view (), i18n ("You are about to edit object \"%1\", which is very large (%2 fields). RKWard is not optimized to handle very large objects in the built in data editor. This will use a lot of memory, and - depending on your system - might be very slow. For large objects it is generally recommended to edit using command line means or to split into smaller chunks before editing. On the other hand, if you have enough memory, or the data is simple enough (numeric data is easier to handle, than factor), editing may not be a problem at all. You can configure / turn of this warning under Settings->Configure RKWard->General.\nReally edit object?").arg (iobj->getFullName ()).arg (QString::number (size)), i18n ("About to edit very large object")) != KMessageBox::Continue) {
 					return 0;
 				}
 			}


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