Neal Wilson 9 years ago
parent
commit
8fe93b07c1
2 changed files with 30 additions and 6 deletions
  1. 10
    6
      config/Windows/productionroaster.xml
  2. 20
    0
      src/typica.w

+ 10
- 6
config/Windows/productionroaster.xml View File

64
 		var translationCurrentColumn = -1;
64
 		var translationCurrentColumn = -1;
65
 		var configModel = new DeviceTreeModel;
65
 		var configModel = new DeviceTreeModel;
66
 		var rootIndex = configModel.index(roasterlist.currentIndex, 0);
66
 		var rootIndex = configModel.index(roasterlist.currentIndex, 0);
67
+		var roasterIndex = roasterlist.currentIndex;
67
 		var channels = new Array();
68
 		var channels = new Array();
68
 		var annotationButtons = new Array();
69
 		var annotationButtons = new Array();
69
 		var nidevices = new Array();
70
 		var nidevices = new Array();
639
 			delete dataqsdkdevices;
640
 			delete dataqsdkdevices;
640
 			delete jsdevices;
641
 			delete jsdevices;
641
             window.saveSizeAndPosition("window");
642
             window.saveSizeAndPosition("window");
642
-            vsplit.saveState("script/mainSplitter");
643
-            isplit.saveState("script/instrumentSplitter");
644
-            lsplit.saveState("script/logSplitter");
643
+            vsplit.saveState("script/loggingView/" + roasterIndex + "/mainSplitter");
644
+			QSettings.setValue("script/loggingView/" + roasterIndex + "/instrumentCount", isplit.count());
645
+            isplit.saveState("script/loggingView/" + roasterIndex + "/instrumentSplitter");
646
+            lsplit.saveState("script/loggingView/" + roasterIndex + "/logSplitter");
645
             log.saveState("script/log", 7);
647
             log.saveState("script/log", 7);
646
 			window.navigationWindow.loggingWindow = undefined;
648
 			window.navigationWindow.loggingWindow = undefined;
647
 			Windows.loggingWindow = undefined;
649
 			Windows.loggingWindow = undefined;
648
         });
650
         });
649
 		this.restoreSizeAndPosition('window');
651
 		this.restoreSizeAndPosition('window');
650
-        vsplit.restoreState("script/mainSplitter");
651
-        isplit.restoreState("script/instrumentSplitter");
652
-        lsplit.restoreState("script/logSplitter");
652
+        vsplit.restoreState("script/loggingView/" + roasterIndex + "/mainSplitter");
653
+		if(QSettings.value("script/loggingView/" + roasterIndex + "/instrumentCount") == isplit.count()) {
654
+			isplit.restoreState("script/loggingView/" + roasterIndex + "/instrumentSplitter");
655
+		}
656
+        lsplit.restoreState("script/loggingView/" + roasterIndex + "/logSplitter");
653
 		log.restoreState("script/log", 7);
657
 		log.restoreState("script/log", 7);
654
 		var offsets = new Array();
658
 		var offsets = new Array();
655
 		var zeroemitters = new Array();
659
 		var zeroemitters = new Array();

+ 20
- 0
src/typica.w View File

1414
 									QScriptEngine *engine);
1414
 									QScriptEngine *engine);
1415
 QScriptValue QSplitter_restoreState(QScriptContext *context,
1415
 QScriptValue QSplitter_restoreState(QScriptContext *context,
1416
 									QScriptEngine *engine);
1416
 									QScriptEngine *engine);
1417
+QScriptValue QSplitter_count(QScriptContext *context,
1418
+                             QScriptEngine *engine);
1417
 void setQSplitterProperties(QScriptValue value, QScriptEngine *engine);
1419
 void setQSplitterProperties(QScriptValue value, QScriptEngine *engine);
1418
 
1420
 
1419
 @ Of these, the scripting engine must be informed of the constructor.
1421
 @ Of these, the scripting engine must be informed of the constructor.
1440
 	value.setProperty("saveState", engine->newFunction(QSplitter_saveState));
1442
 	value.setProperty("saveState", engine->newFunction(QSplitter_saveState));
1441
 	value.setProperty("restoreState",
1443
 	value.setProperty("restoreState",
1442
 	                  engine->newFunction(QSplitter_restoreState));
1444
 	                  engine->newFunction(QSplitter_restoreState));
1445
+	value.setProperty("count", engine->newFunction(QSplitter_count));
1443
 }
1446
 }
1444
 
1447
 
1445
 @ The |"addWidget"| property is a simple wrapper around
1448
 @ The |"addWidget"| property is a simple wrapper around
1472
 	return QScriptValue();
1475
 	return QScriptValue();
1473
 }
1476
 }
1474
 
1477
 
1478
+@ The methods for saving and restoring the state of a splitter do not behave
1479
+well when the number of widgets contained in the splitter increase. This is a
1480
+problem in the logging view where we may want to allow zero width indicators
1481
+but reconfiguration can cause the number of indicators to increase. This would
1482
+result in the right most indicators such as the batch timer disappearing. Most
1483
+people do not notice the splitter handle or think to drag that to the left to
1484
+correct this issue so it would be better to save the number of indicators when
1485
+saving the state and if the number of indicators does not match, we should not
1486
+restore the obsolete saved state.
1487
+
1488
+@<Functions for scripting@>=
1489
+QScriptValue QSplitter_count(QScriptContext *context, QScriptEngine *)
1490
+{
1491
+	QSplitter *self = getself<QSplitter *>(context);
1492
+	return QScriptValue(self->count());
1493
+}
1494
+
1475
 @ When saving and restoring the state of a splitter, we always want to do this
1495
 @ When saving and restoring the state of a splitter, we always want to do this
1476
 through a |QSettings| object. For this, we take an extra argument specifying the
1496
 through a |QSettings| object. For this, we take an extra argument specifying the
1477
 settings key to read from or write to. Unlike the equivalent functions called
1497
 settings key to read from or write to. Unlike the equivalent functions called

Loading…
Cancel
Save