Neal Wilson 9 лет назад
Родитель
Сommit
8fe93b07c1
2 измененных файлов: 30 добавлений и 6 удалений
  1. 10
    6
      config/Windows/productionroaster.xml
  2. 20
    0
      src/typica.w

+ 10
- 6
config/Windows/productionroaster.xml Просмотреть файл

@@ -64,6 +64,7 @@
64 64
 		var translationCurrentColumn = -1;
65 65
 		var configModel = new DeviceTreeModel;
66 66
 		var rootIndex = configModel.index(roasterlist.currentIndex, 0);
67
+		var roasterIndex = roasterlist.currentIndex;
67 68
 		var channels = new Array();
68 69
 		var annotationButtons = new Array();
69 70
 		var nidevices = new Array();
@@ -639,17 +640,20 @@
639 640
 			delete dataqsdkdevices;
640 641
 			delete jsdevices;
641 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 647
             log.saveState("script/log", 7);
646 648
 			window.navigationWindow.loggingWindow = undefined;
647 649
 			Windows.loggingWindow = undefined;
648 650
         });
649 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 657
 		log.restoreState("script/log", 7);
654 658
 		var offsets = new Array();
655 659
 		var zeroemitters = new Array();

+ 20
- 0
src/typica.w Просмотреть файл

@@ -1414,6 +1414,8 @@ QScriptValue QSplitter_saveState(QScriptContext *context,
1414 1414
 									QScriptEngine *engine);
1415 1415
 QScriptValue QSplitter_restoreState(QScriptContext *context,
1416 1416
 									QScriptEngine *engine);
1417
+QScriptValue QSplitter_count(QScriptContext *context,
1418
+                             QScriptEngine *engine);
1417 1419
 void setQSplitterProperties(QScriptValue value, QScriptEngine *engine);
1418 1420
 
1419 1421
 @ Of these, the scripting engine must be informed of the constructor.
@@ -1440,6 +1442,7 @@ void setQSplitterProperties(QScriptValue value, QScriptEngine *engine)
1440 1442
 	value.setProperty("saveState", engine->newFunction(QSplitter_saveState));
1441 1443
 	value.setProperty("restoreState",
1442 1444
 	                  engine->newFunction(QSplitter_restoreState));
1445
+	value.setProperty("count", engine->newFunction(QSplitter_count));
1443 1446
 }
1444 1447
 
1445 1448
 @ The |"addWidget"| property is a simple wrapper around
@@ -1472,6 +1475,23 @@ QScriptValue QSplitter_addWidget(QScriptContext *context, QScriptEngine *)
1472 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 1495
 @ When saving and restoring the state of a splitter, we always want to do this
1476 1496
 through a |QSettings| object. For this, we take an extra argument specifying the
1477 1497
 settings key to read from or write to. Unlike the equivalent functions called

Загрузка…
Отмена
Сохранить