[rkward-cvs] SF.net SVN: rkward: [1360] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Feb 8 16:30:21 UTC 2007
Revision: 1360
http://svn.sourceforge.net/rkward/?rev=1360&view=rev
Author: tfry
Date: 2007-02-08 08:30:21 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
Make save object chooser widget less jumpy
Modified Paths:
--------------
trunk/rkward/rkward/misc/rksaveobjectchooser.cpp
trunk/rkward/rkward/misc/rksaveobjectchooser.h
trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp
trunk/rkward/rkward/windows/rkwindowcatcher.cpp
Modified: trunk/rkward/rkward/misc/rksaveobjectchooser.cpp
===================================================================
--- trunk/rkward/rkward/misc/rksaveobjectchooser.cpp 2007-02-08 15:20:52 UTC (rev 1359)
+++ trunk/rkward/rkward/misc/rksaveobjectchooser.cpp 2007-02-08 16:30:21 UTC (rev 1360)
@@ -28,10 +28,9 @@
#include "../debug.h"
-RKSaveObjectChooser::RKSaveObjectChooser (QWidget *parent, bool allow_overwrite, const QString &initial, const QString &prompt) : QWidget (parent) {
+RKSaveObjectChooser::RKSaveObjectChooser (QWidget *parent, const QString &initial, const QString &prompt) : QWidget (parent) {
RK_TRACE (MISC);
- RKSaveObjectChooser::allow_overwrite = allow_overwrite;
prev_ok = true;
object_exists = false;
@@ -45,13 +44,8 @@
connect (name_edit, SIGNAL (textChanged (const QString &)), this, SLOT (nameEditChanged (const QString &)));
layout->addWidget (name_edit);
- inuse_label = new QLabel (i18n ("The given symbol already exists"), this);
- inuse_label->hide ();
- layout->addWidget (inuse_label);
-
- overwrite_confirm = new QCheckBox (i18n ("Overwrite?"), this);
+ overwrite_confirm = new QCheckBox (this);
connect (overwrite_confirm, SIGNAL (stateChanged (int)), this, SLOT (overwriteConfirmChanged (int)));
- overwrite_confirm->hide ();
layout->addWidget (overwrite_confirm);
nameEditChanged (QString ()); // initialize
@@ -77,7 +71,7 @@
bool RKSaveObjectChooser::isOk () const {
RK_TRACE (MISC);
- return ((!object_exists) || (allow_overwrite && overwrite_confirm->isChecked ()));
+ return ((!object_exists) || (overwrite_confirm->isChecked ()));
}
void RKSaveObjectChooser::nameEditChanged (const QString &) {
@@ -86,15 +80,13 @@
RObject *object = RObjectList::getObjectList ()->findObject (validizedSelectedObjectName ());
if (object) {
object_exists = true;
- inuse_label->show ();
- if (allow_overwrite) overwrite_confirm->show ();
+ overwrite_confirm->setText ("Overwrite? (The given object name already exists)");
+ overwrite_confirm->setEnabled (true);
} else {
object_exists = false;
- inuse_label->hide ();
- if (allow_overwrite) {
- overwrite_confirm->hide ();
- overwrite_confirm->setChecked (false);
- }
+ overwrite_confirm->setText ("Overwrite?");
+ overwrite_confirm->setEnabled (false);
+ overwrite_confirm->setChecked (false);
}
if (isOk () != prev_ok) {
Modified: trunk/rkward/rkward/misc/rksaveobjectchooser.h
===================================================================
--- trunk/rkward/rkward/misc/rksaveobjectchooser.h 2007-02-08 15:20:52 UTC (rev 1359)
+++ trunk/rkward/rkward/misc/rksaveobjectchooser.h 2007-02-08 16:30:21 UTC (rev 1360)
@@ -22,13 +22,12 @@
class QLineEdit;
class QCheckBox;
-class QLabel;
/** Simple helper widget to select an R symbol name to write something to. */
class RKSaveObjectChooser : public QWidget {
Q_OBJECT
public:
- RKSaveObjectChooser (QWidget *parent, bool allow_overwrite, const QString &initial, const QString &prompt = QString::null);
+ RKSaveObjectChooser (QWidget *parent, const QString &initial, const QString &prompt = QString::null);
~RKSaveObjectChooser ();
QString validizedSelectedObjectName ();
@@ -42,13 +41,11 @@
void okStatusChanged (bool);
void changed ();
private:
- bool allow_overwrite;
bool object_exists;
bool prev_ok;
QLineEdit *name_edit;
QCheckBox *overwrite_confirm;
- QLabel *inuse_label;
};
#endif
Modified: trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp 2007-02-08 15:20:52 UTC (rev 1359)
+++ trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp 2007-02-08 16:30:21 UTC (rev 1360)
@@ -38,7 +38,7 @@
QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
- selector = new RKSaveObjectChooser (this, true, xml->getStringAttribute (element, "initial", i18n ("my.data"), DL_INFO), xml->getStringAttribute (element, "label", i18n ("Save to:"), DL_INFO));
+ selector = new RKSaveObjectChooser (this, xml->getStringAttribute (element, "initial", i18n ("my.data"), DL_INFO), xml->getStringAttribute (element, "label", i18n ("Save to:"), DL_INFO));
connect (selector, SIGNAL (changed ()), SLOT (selectionChanged ()));
connect (selector, SIGNAL (okStatusChanged (bool)), SLOT (selectionChanged (bool)));
Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp 2007-02-08 15:20:52 UTC (rev 1359)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp 2007-02-08 16:30:21 UTC (rev 1360)
@@ -242,7 +242,7 @@
KDialogBase *dialog = new KDialogBase (this, 0, true, i18n ("Specify R object"), KDialogBase::Ok|KDialogBase::Cancel);
QVBox *page = dialog->makeVBoxMainWidget ();
- RKSaveObjectChooser *chooser = new RKSaveObjectChooser (page, true, "my.plot", i18n ("Specify the R object name, you want to save the graph to"));
+ RKSaveObjectChooser *chooser = new RKSaveObjectChooser (page, "my.plot", i18n ("Specify the R object name, you want to save the graph to"));
connect (chooser, SIGNAL (okStatusChanged (bool)), dialog, SLOT (enableButtonOK (bool)));
if (!chooser->isOk ()) dialog->enableButtonOK (false);
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