Преглед изворни кода

Persist date range filter selection on the batch log.

Neal Wilson пре 11 година
родитељ
комит
e7f89da11a
2 измењених фајлова са 15 додато и 2 уклоњено
  1. 4
    0
      config/Windows/history.xml
  2. 11
    2
      src/daterangeselector.w

+ 4
- 0
config/Windows/history.xml Прегледај датотеку

21
 			}
21
 			}
22
 			dateSelect.setLifetimeRange(lifetimeStartDate, lifetimeEndDate);
22
 			dateSelect.setLifetimeRange(lifetimeStartDate, lifetimeEndDate);
23
 			dateQuery.invalidate();
23
 			dateQuery.invalidate();
24
+			dateSelect.currentIndex = QSettings.value("script/history/dateIndex", 6);
24
 			var table = findChildObject(this, 'table');
25
 			var table = findChildObject(this, 'table');
25
 			table.openEntryRow.connect(function(arg) {
26
 			table.openEntryRow.connect(function(arg) {
26
 				var details = createWindow("batchDetails");
27
 				var details = createWindow("batchDetails");
35
 				table.hideColumn(1);
36
 				table.hideColumn(1);
36
 			}
37
 			}
37
 			dateSelect.rangeUpdated.connect(function() {
38
 			dateSelect.rangeUpdated.connect(function() {
39
+				if(dateSelect.currentIndex != 24) { // Custom date range
40
+					QSettings.setValue("script/history/dateIndex", dateSelect.currentIndex);
41
+				}
38
 				refresh();
42
 				refresh();
39
 			});
43
 			});
40
 			refresh();
44
 			refresh();

+ 11
- 2
src/daterangeselector.w Прегледај датотеку

41
 class DateRangeSelector : public QWidget
41
 class DateRangeSelector : public QWidget
42
 {
42
 {
43
 	@[Q_OBJECT@]@;
43
 	@[Q_OBJECT@]@;
44
+	Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)@/
44
 	public:@/
45
 	public:@/
45
 		DateRangeSelector(QWidget *parent = NULL);
46
 		DateRangeSelector(QWidget *parent = NULL);
46
 		void setCustomRange(QVariant range);
47
 		void setCustomRange(QVariant range);
47
-		Q_INVOKABLE QVariant currentRange();@/
48
+		Q_INVOKABLE QVariant currentRange();
49
+		int currentIndex();@/
48
 	@[public slots@]:@/
50
 	@[public slots@]:@/
49
 		void setCurrentIndex(int index);
51
 		void setCurrentIndex(int index);
50
 		void setLifetimeRange(QString startDate, QString endDate);
52
 		void setLifetimeRange(QString startDate, QString endDate);
79
 @<CustomDateRangePopup implementation@>
81
 @<CustomDateRangePopup implementation@>
80
 @<DateRangeSelector implementation@>
82
 @<DateRangeSelector implementation@>
81
 
83
 
84
+#if 0
82
 #include "moc_daterangeselector.cpp"
85
 #include "moc_daterangeselector.cpp"
86
+#endif
83
 
87
 
84
 @ The custom range pop up is represented as a separate class which is not to be
88
 @ The custom range pop up is represented as a separate class which is not to be
85
 instantiated except by |DateRangeSelector|.
89
 instantiated except by |DateRangeSelector|.
403
 	return quickSelector->itemData(lastIndex);
407
 	return quickSelector->itemData(lastIndex);
404
 }
408
 }
405
 
409
 
406
-@ Similarly, a method is provided to set the current index of the combo box.
410
+@ Methods are provided to get and set the current index of the combo box.
407
 
411
 
408
 @<DateRangeSelector implementation@>=
412
 @<DateRangeSelector implementation@>=
409
 void DateRangeSelector::setCurrentIndex(int index)
413
 void DateRangeSelector::setCurrentIndex(int index)
411
 	quickSelector->setCurrentIndex(index);
415
 	quickSelector->setCurrentIndex(index);
412
 }
416
 }
413
 
417
 
418
+int DateRangeSelector::currentIndex()
419
+{
420
+	return quickSelector->currentIndex();
421
+}
422
+
414
 @ The Lifetime range is handled somewhat differently from other ranges as there
423
 @ The Lifetime range is handled somewhat differently from other ranges as there
415
 is no general way to know what that range should be without making unsafe
424
 is no general way to know what that range should be without making unsafe
416
 assumptions. As such, reports are expected to remove the option, provide a
425
 assumptions. As such, reports are expected to remove the option, provide a

Loading…
Откажи
Сачувај