[Kst] branches/work/kst/1.6/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Wed Dec 5 01:17:56 CET 2007


SVN commit 744967 by arwalker:

enable Apply button for plugin dialogs. Only problem remaining is that Apply is never disabled for VectorView and Basic dialogs

 M  +14 -13    kstbasicdialog_i.cpp  
 M  +7 -0      kstplugindialog_i.cpp  


--- branches/work/kst/1.6/kst/src/libkstapp/kstbasicdialog_i.cpp #744966:744967
@@ -152,9 +152,10 @@
 void KstBasicDialogI::createInputVector(const QString &name, int row) {
   QLabel *label = new QLabel(name + ":", _w->_frame);
 
-  VectorSelector *widget = new VectorSelector(_w->_frame,
-                                              name.latin1());
+  VectorSelector *widget = new VectorSelector(_w->_frame, name.latin1());
   connect(widget, SIGNAL(newVectorCreated(const QString&)), this, SIGNAL(modified()));
+  connect(widget->_vector, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
+  connect(widget->_vector, SIGNAL(textChanged(const QString&)), this, SLOT(wasModifiedApply()));
 
   _grid->addWidget(label, row, 0);
   label->show();
@@ -166,9 +167,11 @@
 void KstBasicDialogI::createInputScalar(const QString &name, int row, double value) {
   QLabel *label = new QLabel(name + ":", _w->_frame);
 
-  ScalarSelector *widget = new ScalarSelector(_w->_frame,
-                                              name.latin1());
+  ScalarSelector *widget = new ScalarSelector(_w->_frame, name.latin1());
   connect(widget, SIGNAL(newScalarCreated()), this, SIGNAL(modified()));
+  connect(widget->_scalar, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
+  connect(widget->_scalar, SIGNAL(textChanged(const QString&)), this, SLOT(wasModifiedApply()));
+
   widget->allowDirectEntry(true);
   if (widget->_scalar->lineEdit()) {
     widget->_scalar->lineEdit()->setText(QString::number(value));
@@ -184,10 +187,10 @@
 void KstBasicDialogI::createInputString(const QString &name, int row) {
   QLabel *label = new QLabel(name + ":", _w->_frame);
 
-  StringSelector *widget = new StringSelector(_w->_frame,
-                                              name.latin1());
-  connect(widget, SIGNAL(newStringCreated()),
-          this, SIGNAL(modified()));
+  StringSelector *widget = new StringSelector(_w->_frame, name.latin1());
+  connect(widget, SIGNAL(newStringCreated()), this, SIGNAL(modified()));
+  connect(widget->_string, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
+  connect(widget->_string, SIGNAL(textChanged(const QString&)), this, SLOT(wasModifiedApply()));
 
   _grid->addWidget(label, row, 0);
   label->show();
@@ -216,9 +219,8 @@
   //return false if the specified objects can't be made, otherwise true
 
   //Need to create a new object rather than use the one in KstDataObject pluginList
-  KstBasicPluginPtr ptr = kst_cast<KstBasicPlugin>(
-      KstDataObject::createPlugin(_pluginName));
-  Q_ASSERT(ptr); //should never happen...
+  KstBasicPluginPtr ptr = kst_cast<KstBasicPlugin>(KstDataObject::createPlugin(_pluginName));
+  Q_ASSERT(ptr);
 
   KstWriteLocker pl(ptr);
 
@@ -286,7 +288,7 @@
 
 bool KstBasicDialogI::editObject() {
   //called upon clicking 'ok' in 'edit' mode
-  //return false if the specified objects can't be editted, otherwise true
+  //return false if the specified objects can't be edited, otherwise true
 
   KstBasicPluginPtr ptr = kst_cast<KstBasicPlugin>(_dp);
   Q_ASSERT(ptr); //should never happen...
@@ -560,4 +562,3 @@
 
 #include "kstbasicdialog_i.moc"
 
-// vim: ts=2 sw=2 et
--- branches/work/kst/1.6/kst/src/libkstapp/kstplugindialog_i.cpp #744966:744967
@@ -64,6 +64,7 @@
 : KstDataDialog(parent, name, modal, fl) {
   _w = new PluginDialogWidget(_contents);
   setMultiple(false);
+  connect(_w->PluginCombo, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
   connect(_w->PluginCombo, SIGNAL(activated(int)), this, SLOT(pluginChanged(int)));
   connect(_w->_pluginManager, SIGNAL(clicked()), this, SLOT(showPluginManager()));
 
@@ -715,6 +716,8 @@
       if (scalar) {
         ScalarSelector *w = new ScalarSelector(parent, (*it)._name.latin1());
         widget = w;
+        connect(w->_scalar, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
+        connect(w->_scalar, SIGNAL(textChanged(const QString&)), this, SLOT(wasModifiedApply()));
         connect(w->_scalar, SIGNAL(activated(const QString&)), this, SLOT(updateScalarTooltip(const QString&)));
         connect(widget, SIGNAL(newScalarCreated()), this, SIGNAL(modified()));
         if (!(*it)._default.isEmpty()) {
@@ -732,6 +735,8 @@
       } else if (string) {
         StringSelector *w = new StringSelector(parent, (*it)._name.latin1());
         widget = w;
+        connect(w->_string, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
+        connect(w->_string, SIGNAL(textChanged(const QString&)), this, SLOT(wasModifiedApply()));
         connect(w->_string, SIGNAL(activated(const QString&)), this, SLOT(updateStringTooltip(const QString&)));
         connect(widget, SIGNAL(newStringCreated()), this, SIGNAL(modified()));
         if (!(*it)._default.isEmpty()) {
@@ -755,6 +760,8 @@
           vectorSelector->provideNoneVector(true);
           vectorSelector->setSelection(vector);
         }
+        connect(vectorSelector->_vector, SIGNAL(highlighted(int)), this, SLOT(wasModifiedApply()));
+        connect(vectorSelector->_vector, SIGNAL(textChanged(const QString&)), this, SLOT(wasModifiedApply()));
         connect(widget, SIGNAL(newVectorCreated(const QString&)), this, SIGNAL(modified()));
       }
     } else {


More information about the Kst mailing list