Explorar el Código

Merge branch 'phidgets1048' into release-1.6.3

Conflicts:
	src/typica.w
Neal Wilson hace 10 años
padre
commit
ba9583b545

+ 28
- 0
config/Windows/productionroaster.xml Ver fichero

@@ -70,6 +70,7 @@
70 70
 		var nidevices = new Array();
71 71
 		var dataqsdkdevices = new Array();
72 72
 		var jsdevices = new Array();
73
+		var pdevices = new Array();
73 74
 		var temperatureDisplays = new Array();
74 75
 		var columnNames = new Array();
75 76
 		var modbusdevices = new Array();
@@ -388,6 +389,27 @@
388 389
 					device.start();
389 390
 					jsdevices.push(device);
390 391
 				}
392
+				else if(driverReference.driver == "phidgets1048")
393
+				{
394
+					var device = new PhidgetsTemperatureSensor(driverIndex);
395
+					for(var j = 0; j < device.channelCount(); j++) {
396
+						channels.push(device.getChannel(j));
397
+						columnNames.push(device.channelColumnName(j));
398
+						channelType.push("T");
399
+						if(device.isChannelHidden(j)) {
400
+							channelVisibility.push(false);
401
+						} else {
402
+							channelVisibility.push(true);
403
+							var indicator = new TemperatureDisplay;
404
+							temperatureDisplays.push(indicator);
405
+							var decorator = new WidgetDecorator(indicator, device.channelIndicatorText(j), 2);
406
+							device.getChannel(j).newData.connect(indicator.setValue);
407
+							indicatorPanel.addWidget(decorator);
408
+						}
409
+					}
410
+					device.start();
411
+					pdevices.push(device);
412
+				}
391 413
 				else if(driverReference.driver == "annotationbutton")
392 414
 				{
393 415
 					var button = new AnnotationButton(driverReference.buttontext);
@@ -635,10 +657,16 @@
635 657
 				jsdevices[i].stop();
636 658
 				jsdevices[i].deleteLater();
637 659
 			}
660
+			for(var i = 0; i < pdevices.length; i++)
661
+			{
662
+				pdevices[i].stop();
663
+				pdevices[i].deleteLater();
664
+			}
638 665
 			delete nidevices;
639 666
 			delete modbusdevices;
640 667
 			delete dataqsdkdevices;
641 668
 			delete jsdevices;
669
+			delete pdevices;
642 670
             window.saveSizeAndPosition("window");
643 671
             vsplit.saveState("script/loggingView/" + roasterIndex + "/mainSplitter");
644 672
 			QSettings.setValue("script/loggingView/" + roasterIndex + "/instrumentCount", isplit.count());

+ 5
- 5
src/abouttypica.cpp Ver fichero

@@ -1,9 +1,9 @@
1
-/*222:*/
1
+/*249:*/
2 2
 #line 33 "./abouttypica.w"
3 3
 
4 4
 #include "abouttypica.h"
5 5
 
6
-/*223:*/
6
+/*250:*/
7 7
 #line 42 "./abouttypica.w"
8 8
 
9 9
 AboutTypica::AboutTypica():QMainWindow(NULL)
@@ -17,10 +17,10 @@ aboutFile.close();
17 17
 setCentralWidget(banner);
18 18
 }
19 19
 
20
-#line 5641 "./typica.w"
20
+#line 5992 "./typica.w"
21 21
 
22
-/*:223*/
22
+/*:250*/
23 23
 #line 36 "./abouttypica.w"
24 24
 
25 25
 
26
-/*:222*/
26
+/*:249*/

+ 2
- 2
src/abouttypica.h Ver fichero

@@ -1,4 +1,4 @@
1
-/*221:*/
1
+/*248:*/
2 2
 #line 14 "./abouttypica.w"
3 3
 
4 4
 #include <QMainWindow> 
@@ -17,4 +17,4 @@ AboutTypica();
17 17
 
18 18
 #endif
19 19
 
20
-/*:221*/
20
+/*:248*/

+ 37
- 62
src/daterangeselector.cpp Ver fichero

@@ -1,5 +1,5 @@
1
-/*603:*/
2
-#line 66 "./daterangeselector.w"
1
+/*639:*/
2
+#line 68 "./daterangeselector.w"
3 3
 
4 4
 #include <QCalendarWidget> 
5 5
 #include <QPushButton> 
@@ -11,33 +11,8 @@
11 11
 
12 12
 #include "daterangeselector.h"
13 13
 
14
-/*604:*/
15
-#line 86 "./daterangeselector.w"
16
-
17
-class CustomDateRangePopup:public QWidget
18
-{
19
-Q_OBJECT
20
-public:
21
-CustomDateRangePopup(QWidget*parent= NULL);
22
-public slots:
23
-void applyRange();
24
-signals:
25
-void hidingPopup();
26
-protected:
27
-virtual void hideEvent(QHideEvent*event);
28
-private slots:
29
-void validateRange();
30
-private:
31
-QCalendarWidget*startDateSelector;
32
-QCalendarWidget*endDateSelector;
33
-QPushButton*applyButton;
34
-};
35
-
36
-/*:604*/
37
-#line 77 "./daterangeselector.w"
38
-
39
-/*605:*/
40
-#line 110 "./daterangeselector.w"
14
+/*641:*/
15
+#line 111 "./daterangeselector.w"
41 16
 
42 17
 CustomDateRangePopup::CustomDateRangePopup(QWidget*parent):
43 18
 QWidget(parent,Qt::Popup),startDateSelector(new QCalendarWidget),
@@ -80,16 +55,16 @@ outerLayout->addLayout(buttonLayout);
80 55
 setLayout(outerLayout);
81 56
 }
82 57
 
83
-/*:605*//*606:*/
84
-#line 158 "./daterangeselector.w"
58
+/*:641*//*642:*/
59
+#line 159 "./daterangeselector.w"
85 60
 
86 61
 void CustomDateRangePopup::hideEvent(QHideEvent*)
87 62
 {
88 63
 emit hidingPopup();
89 64
 }
90 65
 
91
-/*:606*//*607:*/
92
-#line 167 "./daterangeselector.w"
66
+/*:642*//*643:*/
67
+#line 168 "./daterangeselector.w"
93 68
 
94 69
 void CustomDateRangePopup::applyRange()
95 70
 {
@@ -103,8 +78,8 @@ endDateSelector->selectedDate().toString(Qt::ISODate)));
103 78
 hide();
104 79
 }
105 80
 
106
-/*:607*//*608:*/
107
-#line 184 "./daterangeselector.w"
81
+/*:643*//*644:*/
82
+#line 185 "./daterangeselector.w"
108 83
 
109 84
 void CustomDateRangePopup::validateRange()
110 85
 {
@@ -118,11 +93,11 @@ applyButton->setEnabled(true);
118 93
 }
119 94
 }
120 95
 
121
-/*:608*/
122
-#line 78 "./daterangeselector.w"
96
+/*:644*/
97
+#line 79 "./daterangeselector.w"
123 98
 
124
-/*609:*/
125
-#line 202 "./daterangeselector.w"
99
+/*645:*/
100
+#line 203 "./daterangeselector.w"
126 101
 
127 102
 DateRangeSelector::DateRangeSelector(QWidget*parent):
128 103
 QWidget(parent),quickSelector(new QComboBox(this)),
@@ -133,8 +108,8 @@ connect(quickSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateRange(int
133 108
 QDate currentDate= QDate::currentDate();
134 109
 
135 110
 QHBoxLayout*layout= new QHBoxLayout;
136
-/*610:*/
137
-#line 231 "./daterangeselector.w"
111
+/*646:*/
112
+#line 232 "./daterangeselector.w"
138 113
 
139 114
 quickSelector->addItem("Yesterday",QVariant(QStringList()<<
140 115
 currentDate.addDays(-1).toString(Qt::ISODate)));
@@ -213,8 +188,8 @@ quickSelector->insertSeparator(quickSelector->count());
213 188
 quickSelector->addItem("Lifetime");
214 189
 quickSelector->addItem("Custom");
215 190
 
216
-/*:610*/
217
-#line 212 "./daterangeselector.w"
191
+/*:646*/
192
+#line 213 "./daterangeselector.w"
218 193
 
219 194
 QToolButton*customButton= new QToolButton;
220 195
 customButton->setIcon(QIcon::fromTheme("office-calendar",
@@ -226,8 +201,8 @@ setLayout(layout);
226 201
 connect(customButton,SIGNAL(clicked()),this,SLOT(toggleCustom()));
227 202
 }
228 203
 
229
-/*:609*//*611:*/
230
-#line 314 "./daterangeselector.w"
204
+/*:645*//*647:*/
205
+#line 315 "./daterangeselector.w"
231 206
 
232 207
 void DateRangeSelector::updateRange(int index)
233 208
 {
@@ -242,8 +217,8 @@ emit rangeUpdated(quickSelector->itemData(quickSelector->currentIndex()));
242 217
 }
243 218
 }
244 219
 
245
-/*:611*//*612:*/
246
-#line 331 "./daterangeselector.w"
220
+/*:647*//*648:*/
221
+#line 332 "./daterangeselector.w"
247 222
 
248 223
 void DateRangeSelector::popupHidden()
249 224
 {
@@ -252,8 +227,8 @@ customRangeSelector= NULL;
252 227
 quickSelector->setCurrentIndex(lastIndex);
253 228
 }
254 229
 
255
-/*:612*//*613:*/
256
-#line 342 "./daterangeselector.w"
230
+/*:648*//*649:*/
231
+#line 343 "./daterangeselector.w"
257 232
 
258 233
 void DateRangeSelector::setCustomRange(QVariant range)
259 234
 {
@@ -263,8 +238,8 @@ lastIndex= quickSelector->count()-1;
263 238
 quickSelector->setCurrentIndex(lastIndex);
264 239
 }
265 240
 
266
-/*:613*//*614:*/
267
-#line 357 "./daterangeselector.w"
241
+/*:649*//*650:*/
242
+#line 358 "./daterangeselector.w"
268 243
 
269 244
 void DateRangeSelector::toggleCustom()
270 245
 {
@@ -304,24 +279,24 @@ customRangeSelector= NULL;
304 279
 }
305 280
 }
306 281
 
307
-/*:614*//*615:*/
308
-#line 399 "./daterangeselector.w"
282
+/*:650*//*651:*/
283
+#line 400 "./daterangeselector.w"
309 284
 
310 285
 QVariant DateRangeSelector::currentRange()
311 286
 {
312 287
 return quickSelector->itemData(lastIndex);
313 288
 }
314 289
 
315
-/*:615*//*616:*/
316
-#line 407 "./daterangeselector.w"
290
+/*:651*//*652:*/
291
+#line 408 "./daterangeselector.w"
317 292
 
318 293
 void DateRangeSelector::setCurrentIndex(int index)
319 294
 {
320 295
 quickSelector->setCurrentIndex(index);
321 296
 }
322 297
 
323
-/*:616*//*617:*/
324
-#line 422 "./daterangeselector.w"
298
+/*:652*//*653:*/
299
+#line 423 "./daterangeselector.w"
325 300
 
326 301
 void DateRangeSelector::setLifetimeRange(QString startDate,QString endDate)
327 302
 {
@@ -329,18 +304,18 @@ quickSelector->setItemData(quickSelector->count()-2,
329 304
 QVariant(QStringList()<<startDate<<endDate));
330 305
 }
331 306
 
332
-/*:617*//*618:*/
333
-#line 432 "./daterangeselector.w"
307
+/*:653*//*654:*/
308
+#line 433 "./daterangeselector.w"
334 309
 
335 310
 void DateRangeSelector::removeIndex(int index)
336 311
 {
337 312
 quickSelector->removeItem(index);
338 313
 }
339 314
 
340
-/*:618*/
341
-#line 79 "./daterangeselector.w"
315
+/*:654*/
316
+#line 80 "./daterangeselector.w"
342 317
 
343 318
 
344 319
 #include "moc_daterangeselector.cpp"
345 320
 
346
-/*:603*/
321
+/*:639*/

+ 29
- 3
src/daterangeselector.h Ver fichero

@@ -1,13 +1,39 @@
1
-/*602:*/
1
+/*638:*/
2 2
 #line 30 "./daterangeselector.w"
3 3
 
4 4
 
5 5
 #include <QComboBox> 
6
+#include <QPushButton> 
7
+#include <QCalendarWidget> 
6 8
 
7 9
 #ifndef TypicaDateRangeSelectorHeader
8 10
 #define TypicaDateRangeSelectorHeader
9 11
 
10
-class CustomDateRangePopup;
12
+/*640:*/
13
+#line 87 "./daterangeselector.w"
14
+
15
+class CustomDateRangePopup:public QWidget
16
+{
17
+Q_OBJECT
18
+public:
19
+CustomDateRangePopup(QWidget*parent= NULL);
20
+public slots:
21
+void applyRange();
22
+signals:
23
+void hidingPopup();
24
+protected:
25
+virtual void hideEvent(QHideEvent*event);
26
+private slots:
27
+void validateRange();
28
+private:
29
+QCalendarWidget*startDateSelector;
30
+QCalendarWidget*endDateSelector;
31
+QPushButton*applyButton;
32
+};
33
+
34
+/*:640*/
35
+#line 39 "./daterangeselector.w"
36
+
11 37
 
12 38
 class DateRangeSelector:public QWidget
13 39
 {
@@ -34,4 +60,4 @@ int lastIndex;
34 60
 
35 61
 #endif
36 62
 
37
-/*:602*/
63
+/*:638*/

+ 2
- 2
src/draglabel.cpp Ver fichero

@@ -1,4 +1,4 @@
1
-/*863:*/
1
+/*958:*/
2 2
 #line 33 "./scales.w"
3 3
 
4 4
 #include "draglabel.h"
@@ -26,4 +26,4 @@ drag->exec();
26 26
 }
27 27
 }
28 28
 
29
-/*:863*/
29
+/*:958*/

+ 2
- 2
src/draglabel.h Ver fichero

@@ -1,4 +1,4 @@
1
-/*862:*/
1
+/*957:*/
2 2
 #line 13 "./scales.w"
3 3
 
4 4
 #ifndef TypicaDragLabelInclude
@@ -17,4 +17,4 @@ void mousePressEvent(QMouseEvent*event);
17 17
 
18 18
 #endif
19 19
 
20
-/*:862*/
20
+/*:957*/

+ 25
- 10
src/helpmenu.cpp Ver fichero

@@ -1,11 +1,12 @@
1
-/*163:*/
2
-#line 35 "./helpmenu.w"
1
+/*182:*/
2
+#line 36 "./helpmenu.w"
3 3
 
4 4
 #include "helpmenu.h"
5 5
 #include "abouttypica.h"
6
+#include "feedback.h"
6 7
 
7
-/*164:*/
8
-#line 47 "./helpmenu.w"
8
+/*183:*/
9
+#line 49 "./helpmenu.w"
9 10
 
10 11
 HelpMenu::HelpMenu():QMenu()
11 12
 {
@@ -15,10 +16,14 @@ QAction*aboutTypicaAction= new QAction(tr("About Typica"),this);
15 16
 aboutTypicaAction->setObjectName("aboutTypicaAction");
16 17
 addAction(aboutTypicaAction);
17 18
 connect(aboutTypicaAction,SIGNAL(triggered()),this,SLOT(displayAboutTypica()));
19
+QAction*sendFeedbackAction= new QAction(tr("Send Feedback"),this);
20
+sendFeedbackAction->setObjectName("sendFeedback");
21
+addAction(sendFeedbackAction);
22
+connect(sendFeedbackAction,SIGNAL(triggered()),this,SLOT(displayFeedbackWizard()));
18 23
 }
19 24
 
20
-/*:164*//*165:*/
21
-#line 61 "./helpmenu.w"
25
+/*:183*//*184:*/
26
+#line 67 "./helpmenu.w"
22 27
 
23 28
 void HelpMenu::displayAboutTypica()
24 29
 {
@@ -26,10 +31,20 @@ AboutTypica*aboutBox= new AboutTypica;
26 31
 aboutBox->show();
27 32
 }
28 33
 
29
-#line 3946 "./typica.w"
34
+/*:184*//*185:*/
35
+#line 76 "./helpmenu.w"
30 36
 
31
-/*:165*/
32
-#line 39 "./helpmenu.w"
37
+void HelpMenu::displayFeedbackWizard()
38
+{
39
+FeedbackWizard*window= new FeedbackWizard;
40
+window->show();
41
+}
42
+
43
+#line 4266 "./typica.w"
44
+
45
+#line 1 "./feedback.w"
46
+/*:185*/
47
+#line 41 "./helpmenu.w"
33 48
 
34 49
 
35
-/*:163*/
50
+/*:182*/

+ 3
- 2
src/helpmenu.h Ver fichero

@@ -1,4 +1,4 @@
1
-/*162:*/
1
+/*181:*/
2 2
 #line 16 "./helpmenu.w"
3 3
 
4 4
 #include <QMenu> 
@@ -13,8 +13,9 @@ public:
13 13
 HelpMenu();
14 14
 public slots:
15 15
 void displayAboutTypica();
16
+void displayFeedbackWizard();
16 17
 };
17 18
 
18 19
 #endif
19 20
 
20
-/*:162*/
21
+/*:181*/

+ 3
- 13
src/moc_feedback.cpp Ver fichero

@@ -22,7 +22,7 @@ static const uint qt_meta_data_FeedbackWizard[] = {
22 22
        6,       // revision
23 23
        0,       // classname
24 24
        0,    0, // classinfo
25
-       5,   14, // methods
25
+       1,   14, // methods
26 26
        0,    0, // properties
27 27
        0,    0, // enums/sets
28 28
        0,    0, // constructors
@@ -31,18 +31,12 @@ static const uint qt_meta_data_FeedbackWizard[] = {
31 31
 
32 32
  // slots: signature, parameters, type, tag, flags
33 33
       22,   16,   15,   15, 0x08,
34
-      50,   15,   15,   15, 0x08,
35
-      70,   15,   15,   15, 0x08,
36
-      91,   15,   15,   15, 0x08,
37
-     107,   15,   15,   15, 0x08,
38 34
 
39 35
        0        // eod
40 36
 };
41 37
 
42 38
 static const char qt_meta_stringdata_FeedbackWizard[] = {
43 39
     "FeedbackWizard\0\0index\0setCommentInstructions(int)\0"
44
-    "updateMessageText()\0printButtonPressed()\0"
45
-    "printAccepted()\0copyButtonPressed()\0"
46 40
 };
47 41
 
48 42
 void FeedbackWizard::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
@@ -52,10 +46,6 @@ void FeedbackWizard::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _
52 46
         FeedbackWizard *_t = static_cast<FeedbackWizard *>(_o);
53 47
         switch (_id) {
54 48
         case 0: _t->setCommentInstructions((*reinterpret_cast< int(*)>(_a[1]))); break;
55
-        case 1: _t->updateMessageText(); break;
56
-        case 2: _t->printButtonPressed(); break;
57
-        case 3: _t->printAccepted(); break;
58
-        case 4: _t->copyButtonPressed(); break;
59 49
         default: ;
60 50
         }
61 51
     }
@@ -93,9 +83,9 @@ int FeedbackWizard::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
93 83
     if (_id < 0)
94 84
         return _id;
95 85
     if (_c == QMetaObject::InvokeMetaMethod) {
96
-        if (_id < 5)
86
+        if (_id < 1)
97 87
             qt_static_metacall(this, _c, _id, _a);
98
-        _id -= 5;
88
+        _id -= 1;
99 89
     }
100 90
     return _id;
101 91
 }

+ 372
- 14
src/moc_typica.cpp Ver fichero

@@ -1,8 +1,7 @@
1 1
 /****************************************************************************
2 2
 ** Meta object code from reading C++ file 'typica.cpp'
3 3
 **
4
-** Created: Thu Jul 3 12:34:58 2014
5
-**      by: The Qt Meta Object Compiler version 63 (Qt 4.8.4)
4
+** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.6)
6 5
 **
7 6
 ** WARNING! All changes made in this file will be lost!
8 7
 *****************************************************************************/
@@ -10,7 +9,7 @@
10 9
 #if !defined(Q_MOC_OUTPUT_REVISION)
11 10
 #error "The header file 'typica.cpp' doesn't include <QObject>."
12 11
 #elif Q_MOC_OUTPUT_REVISION != 63
13
-#error "This file was generated using the moc from 4.8.4. It"
12
+#error "This file was generated using the moc from 4.8.6. It"
14 13
 #error "cannot be used with the include files from this version of Qt."
15 14
 #error "(The moc has changed too much.)"
16 15
 #endif
@@ -5625,13 +5624,87 @@ int GraphSettingsRelativeTab::qt_metacall(QMetaObject::Call _c, int _id, void **
5625 5624
     }
5626 5625
     return _id;
5627 5626
 }
5627
+static const uint qt_meta_data_AdvancedSettingsWidget[] = {
5628
+
5629
+ // content:
5630
+       6,       // revision
5631
+       0,       // classname
5632
+       0,    0, // classinfo
5633
+       1,   14, // methods
5634
+       0,    0, // properties
5635
+       0,    0, // enums/sets
5636
+       0,    0, // constructors
5637
+       0,       // flags
5638
+       0,       // signalCount
5639
+
5640
+ // slots: signature, parameters, type, tag, flags
5641
+      32,   24,   23,   23, 0x0a,
5642
+
5643
+       0        // eod
5644
+};
5645
+
5646
+static const char qt_meta_stringdata_AdvancedSettingsWidget[] = {
5647
+    "AdvancedSettingsWidget\0\0enabled\0"
5648
+    "enableDiagnosticLogging(bool)\0"
5649
+};
5650
+
5651
+void AdvancedSettingsWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
5652
+{
5653
+    if (_c == QMetaObject::InvokeMetaMethod) {
5654
+        Q_ASSERT(staticMetaObject.cast(_o));
5655
+        AdvancedSettingsWidget *_t = static_cast<AdvancedSettingsWidget *>(_o);
5656
+        switch (_id) {
5657
+        case 0: _t->enableDiagnosticLogging((*reinterpret_cast< bool(*)>(_a[1]))); break;
5658
+        default: ;
5659
+        }
5660
+    }
5661
+}
5662
+
5663
+const QMetaObjectExtraData AdvancedSettingsWidget::staticMetaObjectExtraData = {
5664
+    0,  qt_static_metacall 
5665
+};
5666
+
5667
+const QMetaObject AdvancedSettingsWidget::staticMetaObject = {
5668
+    { &QWidget::staticMetaObject, qt_meta_stringdata_AdvancedSettingsWidget,
5669
+      qt_meta_data_AdvancedSettingsWidget, &staticMetaObjectExtraData }
5670
+};
5671
+
5672
+#ifdef Q_NO_DATA_RELOCATION
5673
+const QMetaObject &AdvancedSettingsWidget::getStaticMetaObject() { return staticMetaObject; }
5674
+#endif //Q_NO_DATA_RELOCATION
5675
+
5676
+const QMetaObject *AdvancedSettingsWidget::metaObject() const
5677
+{
5678
+    return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
5679
+}
5680
+
5681
+void *AdvancedSettingsWidget::qt_metacast(const char *_clname)
5682
+{
5683
+    if (!_clname) return 0;
5684
+    if (!strcmp(_clname, qt_meta_stringdata_AdvancedSettingsWidget))
5685
+        return static_cast<void*>(const_cast< AdvancedSettingsWidget*>(this));
5686
+    return QWidget::qt_metacast(_clname);
5687
+}
5688
+
5689
+int AdvancedSettingsWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
5690
+{
5691
+    _id = QWidget::qt_metacall(_c, _id, _a);
5692
+    if (_id < 0)
5693
+        return _id;
5694
+    if (_c == QMetaObject::InvokeMetaMethod) {
5695
+        if (_id < 1)
5696
+            qt_static_metacall(this, _c, _id, _a);
5697
+        _id -= 1;
5698
+    }
5699
+    return _id;
5700
+}
5628 5701
 static const uint qt_meta_data_ModbusRTUDevice[] = {
5629 5702
 
5630 5703
  // content:
5631 5704
        6,       // revision
5632 5705
        0,       // classname
5633 5706
        0,    0, // classinfo
5634
-      17,   14, // methods
5707
+      18,   14, // methods
5635 5708
        0,    0, // properties
5636 5709
        0,    0, // enums/sets
5637 5710
        0,    0, // constructors
@@ -5655,11 +5728,12 @@ static const uint qt_meta_data_ModbusRTUDevice[] = {
5655 5728
      262,   16,   16,   16, 0x08,
5656 5729
      283,  152,   16,   16, 0x08,
5657 5730
      305,  152,   16,   16, 0x08,
5731
+     324,   16,   16,   16, 0x08,
5658 5732
 
5659 5733
  // methods: signature, parameters, type, tag, flags
5660
-     331,   16,  324,   16, 0x02,
5661
-     341,   16,  324,   16, 0x02,
5662
-     355,   16,  351,   16, 0x02,
5734
+     341,   16,  334,   16, 0x02,
5735
+     351,   16,  334,   16, 0x02,
5736
+     365,   16,  361,   16, 0x02,
5663 5737
 
5664 5738
        0        // eod
5665 5739
 };
@@ -5673,8 +5747,8 @@ static const char qt_meta_stringdata_ModbusRTUDevice[] = {
5673 5747
     "unitResponse(QByteArray)\0"
5674 5748
     "svlResponse(QByteArray)\0svuResponse(QByteArray)\0"
5675 5749
     "requestMeasurement()\0mResponse(QByteArray)\0"
5676
-    "ignore(QByteArray)\0double\0SVLower()\0"
5677
-    "SVUpper()\0int\0decimals()\0"
5750
+    "ignore(QByteArray)\0timeout()\0double\0"
5751
+    "SVLower()\0SVUpper()\0int\0decimals()\0"
5678 5752
 };
5679 5753
 
5680 5754
 void ModbusRTUDevice::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
@@ -5697,11 +5771,12 @@ void ModbusRTUDevice::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int
5697 5771
         case 11: _t->requestMeasurement(); break;
5698 5772
         case 12: _t->mResponse((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
5699 5773
         case 13: _t->ignore((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
5700
-        case 14: { double _r = _t->SVLower();
5774
+        case 14: _t->timeout(); break;
5775
+        case 15: { double _r = _t->SVLower();
5701 5776
             if (_a[0]) *reinterpret_cast< double*>(_a[0]) = _r; }  break;
5702
-        case 15: { double _r = _t->SVUpper();
5777
+        case 16: { double _r = _t->SVUpper();
5703 5778
             if (_a[0]) *reinterpret_cast< double*>(_a[0]) = _r; }  break;
5704
-        case 16: { int _r = _t->decimals();
5779
+        case 17: { int _r = _t->decimals();
5705 5780
             if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
5706 5781
         default: ;
5707 5782
         }
@@ -5740,9 +5815,9 @@ int ModbusRTUDevice::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
5740 5815
     if (_id < 0)
5741 5816
         return _id;
5742 5817
     if (_c == QMetaObject::InvokeMetaMethod) {
5743
-        if (_id < 17)
5818
+        if (_id < 18)
5744 5819
             qt_static_metacall(this, _c, _id, _a);
5745
-        _id -= 17;
5820
+        _id -= 18;
5746 5821
     }
5747 5822
     return _id;
5748 5823
 }
@@ -6261,6 +6336,289 @@ void JavaScriptDevice::deviceStopRequested()
6261 6336
 {
6262 6337
     QMetaObject::activate(this, &staticMetaObject, 3, 0);
6263 6338
 }
6339
+static const uint qt_meta_data_PhidgetsTemperatureSensorConfWidget[] = {
6340
+
6341
+ // content:
6342
+       6,       // revision
6343
+       0,       // classname
6344
+       0,    0, // classinfo
6345
+       2,   14, // methods
6346
+       0,    0, // properties
6347
+       0,    0, // enums/sets
6348
+       1,   24, // constructors
6349
+       0,       // flags
6350
+       0,       // signalCount
6351
+
6352
+ // slots: signature, parameters, type, tag, flags
6353
+      37,   36,   36,   36, 0x08,
6354
+      53,   50,   36,   36, 0x08,
6355
+
6356
+ // constructors: signature, parameters, type, tag, flags
6357
+      81,   69,   36,   36, 0x0e,
6358
+
6359
+       0        // eod
6360
+};
6361
+
6362
+static const char qt_meta_stringdata_PhidgetsTemperatureSensorConfWidget[] = {
6363
+    "PhidgetsTemperatureSensorConfWidget\0"
6364
+    "\0addChannel()\0ms\0updateRate(int)\0"
6365
+    "model,index\0"
6366
+    "PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*,QModelIndex)\0"
6367
+};
6368
+
6369
+void PhidgetsTemperatureSensorConfWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
6370
+{
6371
+    if (_c == QMetaObject::CreateInstance) {
6372
+        switch (_id) {
6373
+        case 0: { PhidgetsTemperatureSensorConfWidget *_r = new PhidgetsTemperatureSensorConfWidget((*reinterpret_cast< DeviceTreeModel*(*)>(_a[1])),(*reinterpret_cast< const QModelIndex(*)>(_a[2])));
6374
+            if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break;
6375
+        }
6376
+    } else if (_c == QMetaObject::InvokeMetaMethod) {
6377
+        Q_ASSERT(staticMetaObject.cast(_o));
6378
+        PhidgetsTemperatureSensorConfWidget *_t = static_cast<PhidgetsTemperatureSensorConfWidget *>(_o);
6379
+        switch (_id) {
6380
+        case 0: _t->addChannel(); break;
6381
+        case 1: _t->updateRate((*reinterpret_cast< int(*)>(_a[1]))); break;
6382
+        default: ;
6383
+        }
6384
+    }
6385
+}
6386
+
6387
+const QMetaObjectExtraData PhidgetsTemperatureSensorConfWidget::staticMetaObjectExtraData = {
6388
+    0,  qt_static_metacall 
6389
+};
6390
+
6391
+const QMetaObject PhidgetsTemperatureSensorConfWidget::staticMetaObject = {
6392
+    { &BasicDeviceConfigurationWidget::staticMetaObject, qt_meta_stringdata_PhidgetsTemperatureSensorConfWidget,
6393
+      qt_meta_data_PhidgetsTemperatureSensorConfWidget, &staticMetaObjectExtraData }
6394
+};
6395
+
6396
+#ifdef Q_NO_DATA_RELOCATION
6397
+const QMetaObject &PhidgetsTemperatureSensorConfWidget::getStaticMetaObject() { return staticMetaObject; }
6398
+#endif //Q_NO_DATA_RELOCATION
6399
+
6400
+const QMetaObject *PhidgetsTemperatureSensorConfWidget::metaObject() const
6401
+{
6402
+    return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
6403
+}
6404
+
6405
+void *PhidgetsTemperatureSensorConfWidget::qt_metacast(const char *_clname)
6406
+{
6407
+    if (!_clname) return 0;
6408
+    if (!strcmp(_clname, qt_meta_stringdata_PhidgetsTemperatureSensorConfWidget))
6409
+        return static_cast<void*>(const_cast< PhidgetsTemperatureSensorConfWidget*>(this));
6410
+    return BasicDeviceConfigurationWidget::qt_metacast(_clname);
6411
+}
6412
+
6413
+int PhidgetsTemperatureSensorConfWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
6414
+{
6415
+    _id = BasicDeviceConfigurationWidget::qt_metacall(_c, _id, _a);
6416
+    if (_id < 0)
6417
+        return _id;
6418
+    if (_c == QMetaObject::InvokeMetaMethod) {
6419
+        if (_id < 2)
6420
+            qt_static_metacall(this, _c, _id, _a);
6421
+        _id -= 2;
6422
+    }
6423
+    return _id;
6424
+}
6425
+static const uint qt_meta_data_PhidgetTemperatureSensorChannelConfWidget[] = {
6426
+
6427
+ // content:
6428
+       6,       // revision
6429
+       0,       // classname
6430
+       0,    0, // classinfo
6431
+       4,   14, // methods
6432
+       0,    0, // properties
6433
+       0,    0, // enums/sets
6434
+       1,   34, // constructors
6435
+       0,       // flags
6436
+       0,       // signalCount
6437
+
6438
+ // slots: signature, parameters, type, tag, flags
6439
+      49,   43,   42,   42, 0x08,
6440
+      82,   75,   42,   42, 0x08,
6441
+     107,  101,   42,   42, 0x08,
6442
+     129,  121,   42,   42, 0x08,
6443
+
6444
+ // constructors: signature, parameters, type, tag, flags
6445
+     160,  148,   42,   42, 0x0e,
6446
+
6447
+       0        // eod
6448
+};
6449
+
6450
+static const char qt_meta_stringdata_PhidgetTemperatureSensorChannelConfWidget[] = {
6451
+    "PhidgetTemperatureSensorChannelConfWidget\0"
6452
+    "\0value\0updateColumnName(QString)\0"
6453
+    "hidden\0updateHidden(bool)\0index\0"
6454
+    "updateTC(int)\0channel\0updateChannel(int)\0"
6455
+    "model,index\0"
6456
+    "PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel*,QModelIndex"
6457
+    ")\0"
6458
+};
6459
+
6460
+void PhidgetTemperatureSensorChannelConfWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
6461
+{
6462
+    if (_c == QMetaObject::CreateInstance) {
6463
+        switch (_id) {
6464
+        case 0: { PhidgetTemperatureSensorChannelConfWidget *_r = new PhidgetTemperatureSensorChannelConfWidget((*reinterpret_cast< DeviceTreeModel*(*)>(_a[1])),(*reinterpret_cast< const QModelIndex(*)>(_a[2])));
6465
+            if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break;
6466
+        }
6467
+    } else if (_c == QMetaObject::InvokeMetaMethod) {
6468
+        Q_ASSERT(staticMetaObject.cast(_o));
6469
+        PhidgetTemperatureSensorChannelConfWidget *_t = static_cast<PhidgetTemperatureSensorChannelConfWidget *>(_o);
6470
+        switch (_id) {
6471
+        case 0: _t->updateColumnName((*reinterpret_cast< const QString(*)>(_a[1]))); break;
6472
+        case 1: _t->updateHidden((*reinterpret_cast< bool(*)>(_a[1]))); break;
6473
+        case 2: _t->updateTC((*reinterpret_cast< int(*)>(_a[1]))); break;
6474
+        case 3: _t->updateChannel((*reinterpret_cast< int(*)>(_a[1]))); break;
6475
+        default: ;
6476
+        }
6477
+    }
6478
+}
6479
+
6480
+const QMetaObjectExtraData PhidgetTemperatureSensorChannelConfWidget::staticMetaObjectExtraData = {
6481
+    0,  qt_static_metacall 
6482
+};
6483
+
6484
+const QMetaObject PhidgetTemperatureSensorChannelConfWidget::staticMetaObject = {
6485
+    { &BasicDeviceConfigurationWidget::staticMetaObject, qt_meta_stringdata_PhidgetTemperatureSensorChannelConfWidget,
6486
+      qt_meta_data_PhidgetTemperatureSensorChannelConfWidget, &staticMetaObjectExtraData }
6487
+};
6488
+
6489
+#ifdef Q_NO_DATA_RELOCATION
6490
+const QMetaObject &PhidgetTemperatureSensorChannelConfWidget::getStaticMetaObject() { return staticMetaObject; }
6491
+#endif //Q_NO_DATA_RELOCATION
6492
+
6493
+const QMetaObject *PhidgetTemperatureSensorChannelConfWidget::metaObject() const
6494
+{
6495
+    return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
6496
+}
6497
+
6498
+void *PhidgetTemperatureSensorChannelConfWidget::qt_metacast(const char *_clname)
6499
+{
6500
+    if (!_clname) return 0;
6501
+    if (!strcmp(_clname, qt_meta_stringdata_PhidgetTemperatureSensorChannelConfWidget))
6502
+        return static_cast<void*>(const_cast< PhidgetTemperatureSensorChannelConfWidget*>(this));
6503
+    return BasicDeviceConfigurationWidget::qt_metacast(_clname);
6504
+}
6505
+
6506
+int PhidgetTemperatureSensorChannelConfWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
6507
+{
6508
+    _id = BasicDeviceConfigurationWidget::qt_metacall(_c, _id, _a);
6509
+    if (_id < 0)
6510
+        return _id;
6511
+    if (_c == QMetaObject::InvokeMetaMethod) {
6512
+        if (_id < 4)
6513
+            qt_static_metacall(this, _c, _id, _a);
6514
+        _id -= 4;
6515
+    }
6516
+    return _id;
6517
+}
6518
+static const uint qt_meta_data_PhidgetsTemperatureSensor[] = {
6519
+
6520
+ // content:
6521
+       6,       // revision
6522
+       0,       // classname
6523
+       0,    0, // classinfo
6524
+       7,   14, // methods
6525
+       0,    0, // properties
6526
+       0,    0, // enums/sets
6527
+       1,   49, // constructors
6528
+       0,       // flags
6529
+       0,       // signalCount
6530
+
6531
+ // slots: signature, parameters, type, tag, flags
6532
+      27,   26,   26,   26, 0x0a,
6533
+      35,   26,   26,   26, 0x0a,
6534
+      42,   26,   26,   26, 0x08,
6535
+
6536
+ // methods: signature, parameters, type, tag, flags
6537
+      64,   26,   60,   26, 0x02,
6538
+      92,   84,   79,   26, 0x02,
6539
+     121,   84,  113,   26, 0x02,
6540
+     144,   84,  113,   26, 0x02,
6541
+
6542
+ // constructors: signature, parameters, type, tag, flags
6543
+     182,  170,   26,   26, 0x0e,
6544
+
6545
+       0        // eod
6546
+};
6547
+
6548
+static const char qt_meta_stringdata_PhidgetsTemperatureSensor[] = {
6549
+    "PhidgetsTemperatureSensor\0\0start()\0"
6550
+    "stop()\0getMeasurements()\0int\0"
6551
+    "channelCount()\0bool\0channel\0"
6552
+    "isChannelHidden(int)\0QString\0"
6553
+    "channelColumnName(int)\0channelIndicatorText(int)\0"
6554
+    "deviceIndex\0PhidgetsTemperatureSensor(QModelIndex)\0"
6555
+};
6556
+
6557
+void PhidgetsTemperatureSensor::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
6558
+{
6559
+    if (_c == QMetaObject::CreateInstance) {
6560
+        switch (_id) {
6561
+        case 0: { PhidgetsTemperatureSensor *_r = new PhidgetsTemperatureSensor((*reinterpret_cast< const QModelIndex(*)>(_a[1])));
6562
+            if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break;
6563
+        }
6564
+    } else if (_c == QMetaObject::InvokeMetaMethod) {
6565
+        Q_ASSERT(staticMetaObject.cast(_o));
6566
+        PhidgetsTemperatureSensor *_t = static_cast<PhidgetsTemperatureSensor *>(_o);
6567
+        switch (_id) {
6568
+        case 0: _t->start(); break;
6569
+        case 1: _t->stop(); break;
6570
+        case 2: _t->getMeasurements(); break;
6571
+        case 3: { int _r = _t->channelCount();
6572
+            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
6573
+        case 4: { bool _r = _t->isChannelHidden((*reinterpret_cast< int(*)>(_a[1])));
6574
+            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
6575
+        case 5: { QString _r = _t->channelColumnName((*reinterpret_cast< int(*)>(_a[1])));
6576
+            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; }  break;
6577
+        case 6: { QString _r = _t->channelIndicatorText((*reinterpret_cast< int(*)>(_a[1])));
6578
+            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; }  break;
6579
+        default: ;
6580
+        }
6581
+    }
6582
+}
6583
+
6584
+const QMetaObjectExtraData PhidgetsTemperatureSensor::staticMetaObjectExtraData = {
6585
+    0,  qt_static_metacall 
6586
+};
6587
+
6588
+const QMetaObject PhidgetsTemperatureSensor::staticMetaObject = {
6589
+    { &QObject::staticMetaObject, qt_meta_stringdata_PhidgetsTemperatureSensor,
6590
+      qt_meta_data_PhidgetsTemperatureSensor, &staticMetaObjectExtraData }
6591
+};
6592
+
6593
+#ifdef Q_NO_DATA_RELOCATION
6594
+const QMetaObject &PhidgetsTemperatureSensor::getStaticMetaObject() { return staticMetaObject; }
6595
+#endif //Q_NO_DATA_RELOCATION
6596
+
6597
+const QMetaObject *PhidgetsTemperatureSensor::metaObject() const
6598
+{
6599
+    return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
6600
+}
6601
+
6602
+void *PhidgetsTemperatureSensor::qt_metacast(const char *_clname)
6603
+{
6604
+    if (!_clname) return 0;
6605
+    if (!strcmp(_clname, qt_meta_stringdata_PhidgetsTemperatureSensor))
6606
+        return static_cast<void*>(const_cast< PhidgetsTemperatureSensor*>(this));
6607
+    return QObject::qt_metacast(_clname);
6608
+}
6609
+
6610
+int PhidgetsTemperatureSensor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
6611
+{
6612
+    _id = QObject::qt_metacall(_c, _id, _a);
6613
+    if (_id < 0)
6614
+        return _id;
6615
+    if (_c == QMetaObject::InvokeMetaMethod) {
6616
+        if (_id < 7)
6617
+            qt_static_metacall(this, _c, _id, _a);
6618
+        _id -= 7;
6619
+    }
6620
+    return _id;
6621
+}
6264 6622
 static const uint qt_meta_data_LinearSplineInterpolationConfWidget[] = {
6265 6623
 
6266 6624
  // content:

+ 491
- 0
src/phidgets.w Ver fichero

@@ -0,0 +1,491 @@
1
+@** Phidgets 1048.
2
+
3
+\noindent Phidgets, Inc. has provided one of their four channel temperature
4
+sensor devices so that support could be added to \pn{}. This was originally
5
+planned for version 1.7, however early support was rushed in for the 1.6.3
6
+release. As a result, this support is not full featured, but it should still be
7
+adequate for the most common uses.
8
+
9
+Two configuration widgets are required. The first is for the device as a whole.
10
+
11
+@<Class declarations@>=
12
+class PhidgetsTemperatureSensorConfWidget : public BasicDeviceConfigurationWidget
13
+{
14
+	Q_OBJECT
15
+	public:
16
+		Q_INVOKABLE PhidgetsTemperatureSensorConfWidget(DeviceTreeModel *model,
17
+                                                        const QModelIndex &index);
18
+	private slots:
19
+		void addChannel();
20
+		void updateRate(int ms);
21
+};
22
+
23
+@ This widget allows specification of a device wide sample rate and allows
24
+adding channels for the device to monitor. The device specifications indicate
25
+temperature updates happen up to 25 times per second, but this is generally
26
+excessive for \pn{} so a default rate is set to a multiple of this close to
27
+3 updates per second. There are other options for collecting measurements from
28
+this device and I have not yet had time to experiment with all of the options
29
+to determine the best approach suitable for coffee roasting applications.
30
+
31
+@<Phidgets implementation@>=
32
+PhidgetsTemperatureSensorConfWidget::PhidgetsTemperatureSensorConfWidget(DeviceTreeModel *model,
33
+                                                                         const QModelIndex &index)
34
+	: BasicDeviceConfigurationWidget(model, index)
35
+{
36
+	QFormLayout *layout = new QFormLayout;
37
+	QPushButton *addChannelButton = new QPushButton(tr("Add Channel"));
38
+	QSpinBox *sampleRate = new QSpinBox;
39
+	sampleRate->setMinimum(40);
40
+	sampleRate->setMaximum(600);
41
+	sampleRate->setSingleStep(40);
42
+	sampleRate->setValue(360);
43
+
44
+	@<Get device configuration data for current node@>@;
45
+	for(int i = 0; i < configData.size(); i++)
46
+	{
47
+		node = configData.at(i).toElement();
48
+		if(node.attribute("name") == "sampleRate")
49
+		{
50
+			sampleRate->setValue(node.attribute("value").toInt());
51
+		}
52
+	}
53
+	updateRate(sampleRate->value());
54
+
55
+	connect(sampleRate, SIGNAL(valueChanged(int)), this, SLOT(updateRate(int)));
56
+	connect(addChannelButton, SIGNAL(clicked()), this, SLOT(addChannel()));
57
+
58
+	layout->addRow(addChannelButton);
59
+	layout->addRow(tr("Sample rate:"), sampleRate);
60
+	setLayout(layout);
61
+}
62
+
63
+@ Adding another channel is handled in the usual way, with the channel
64
+configured in a separate widget.
65
+
66
+@<Phidgets implementation@>=
67
+void PhidgetsTemperatureSensorConfWidget::addChannel()
68
+{
69
+	insertChildNode(tr("Channel"), "phidgets1048channel");
70
+}
71
+
72
+@ Changes to the sample rate are saved as an attribute of the node as usual.
73
+
74
+@<Phidgets implementation@>=
75
+void PhidgetsTemperatureSensorConfWidget::updateRate(int ms)
76
+{
77
+	updateAttribute("sampleRate", QString("%1").arg(ms));
78
+}
79
+
80
+@ The other required configuration widget is for a single channel.
81
+
82
+@<Class declarations@>=
83
+class PhidgetTemperatureSensorChannelConfWidget : public BasicDeviceConfigurationWidget
84
+{
85
+	Q_OBJECT
86
+	public:
87
+		Q_INVOKABLE PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel *model,
88
+                                                              const QModelIndex &index);
89
+	private slots:
90
+		void updateColumnName(const QString &value);
91
+		void updateHidden(bool hidden);
92
+		void updateTC(int index);
93
+		void updateChannel(int channel);
94
+	private:
95
+		QComboBox *tcType;
96
+};
97
+
98
+@ For each channel it is necessary to specify which channel of the device
99
+measurements will come in on. The thermocouple type should be set to match the
100
+type of the thermocouple attached to that channel. The column name and if the
101
+channel is hidden has the same meaning as in channels on other devices.
102
+
103
+@<Phidgets implementation@>=
104
+PhidgetTemperatureSensorChannelConfWidget::PhidgetTemperatureSensorChannelConfWidget(
105
+	DeviceTreeModel *model, const QModelIndex &index)
106
+	: BasicDeviceConfigurationWidget(model, index),
107
+	tcType(new QComboBox)
108
+{
109
+	QFormLayout *layout = new QFormLayout;
110
+	QLineEdit *columnName = new QLineEdit;
111
+	layout->addRow(tr("Column Name:"), columnName);
112
+	QCheckBox *hideSeries = new QCheckBox("Hide this channel");
113
+	layout->addRow(hideSeries);
114
+	layout->addRow(tr("Thermocouple Type:"), tcType);
115
+	tcType->addItem("Type K", "1");
116
+	tcType->addItem("Type J", "2");
117
+	tcType->addItem("Type E", "3");
118
+	tcType->addItem("Type T", "4");
119
+	QSpinBox *channel = new QSpinBox;
120
+	layout->addRow(tr("Channel:"), channel);
121
+	channel->setMinimum(0);
122
+	channel->setMaximum(3);
123
+	setLayout(layout);
124
+	@<Get device configuration data for current node@>@;
125
+	for(int i = 0; i < configData.size(); i++)
126
+	{
127
+		node = configData.at(i).toElement();
128
+		if(node.attribute("name") == "columnname")
129
+		{
130
+			columnName->setText(node.attribute("value"));
131
+		}
132
+		else if(node.attribute("name") == "hidden")
133
+		{
134
+			hideSeries->setChecked(node.attribute("value") == "true");
135
+		}
136
+		else if(node.attribute("name") == "tctype")
137
+		{
138
+			tcType->setCurrentIndex(tcType->findData(node.attribute("value")));
139
+		}
140
+		else if(node.attribute("name") == "channel")
141
+		{
142
+			channel->setValue(node.attribute("value").toInt());
143
+		}
144
+	}
145
+	updateColumnName(columnName->text());
146
+	updateHidden(hideSeries->isChecked());
147
+	updateTC(tcType->currentIndex());
148
+	updateChannel(channel->value());
149
+	connect(columnName, SIGNAL(textEdited(QString)), this, SLOT(updateColumnName(QString)));
150
+	connect(hideSeries, SIGNAL(toggled(bool)), this, SLOT(updateHidden(bool)));
151
+	connect(tcType, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTC(int)));
152
+	connect(channel, SIGNAL(valueChanged(int)), this, SLOT(updateChannel(int)));
153
+}
154
+
155
+@ Channel configuration settings are persisted as they are made.
156
+
157
+@<Phidgets implementation@>=
158
+void PhidgetTemperatureSensorChannelConfWidget::updateColumnName(const QString &value)
159
+{
160
+	updateAttribute("columnname", value);
161
+}
162
+
163
+void PhidgetTemperatureSensorChannelConfWidget::updateHidden(bool hidden)
164
+{
165
+	updateAttribute("hidden", hidden ? "true" : "false");
166
+}
167
+
168
+void PhidgetTemperatureSensorChannelConfWidget::updateTC(int index)
169
+{
170
+	updateAttribute("tctype", tcType->itemData(index).toString());
171
+}
172
+
173
+void PhidgetTemperatureSensorChannelConfWidget::updateChannel(int channel)
174
+{
175
+	updateAttribute("channel", QString("%1").arg(channel));
176
+}
177
+
178
+@ The configuration widgets need to be registered so they can be instantiated as
179
+appropriate.
180
+
181
+@<Register device configuration widgets@>=
182
+app.registerDeviceConfigurationWidget("phidgets1048",
183
+	PhidgetsTemperatureSensorConfWidget::staticMetaObject);
184
+app.registerDeviceConfigurationWidget("phidgets1048channel",
185
+	PhidgetTemperatureSensorChannelConfWidget::staticMetaObject);
186
+
187
+@ A |NodeInserter| for the device node is also required, but this should only
188
+be provided if the required library is installed.
189
+
190
+@<Register top level device configuration nodes@>=
191
+QLibrary phidgetsCheck("phidget21");
192
+if(phidgetsCheck.load())
193
+{
194
+	inserter = new NodeInserter(tr("Phidgets 1048"), tr("Phidgets 1048"),
195
+		"phidgets1048", NULL);
196
+	topLevelNodeInserters.append(inserter);
197
+	phidgetsCheck.unload();
198
+}
199
+else
200
+{
201
+	phidgetsCheck.setFileName("Phidget21.framework/Phidget21");
202
+	if(phidgetsCheck.load())
203
+	{
204
+		inserter = new NodeInserter(tr("Phidgets 1048"), tr("Phidgets 1048"),
205
+		"phidgets1048", NULL);
206
+		topLevelNodeInserters.append(inserter);
207
+		phidgetsCheck.unload();
208
+	}
209
+}
210
+
211
+@ As usual, a class representing the device is provided.
212
+
213
+@<Class declarations@>=
214
+class PhidgetsTemperatureSensor : public QObject
215
+{
216
+	Q_OBJECT
217
+	public:
218
+		Q_INVOKABLE PhidgetsTemperatureSensor(const QModelIndex &deviceIndex);
219
+		Q_INVOKABLE int channelCount();
220
+		Channel* getChannel(int channel);
221
+		Q_INVOKABLE bool isChannelHidden(int channel);
222
+		Q_INVOKABLE QString channelColumnName(int channel);
223
+		Q_INVOKABLE QString channelIndicatorText(int channel);
224
+	public slots:
225
+		void start();
226
+		void stop();
227
+	private slots:
228
+		void getMeasurements();
229
+	private:
230
+		QList<int> channelIndices;
231
+		QList<int> tctypes;
232
+		QList<Channel*> channelList;
233
+		QMap<int, Channel*> channelMap;
234
+		QList<bool> hiddenState;
235
+		QList<QString> columnNames;
236
+		QList<QString> indicatorTexts;
237
+		QLibrary driver;
238
+		QTimer sampleTimer;
239
+		void *device;
240
+		@<Phidgets 1048 function pointers@>@;
241
+};
242
+
243
+@ The constructor uses the configuration data to set up the interface used for
244
+integration with the logging view.
245
+
246
+@<Phidgets implementation@>=
247
+PhidgetsTemperatureSensor::PhidgetsTemperatureSensor(const QModelIndex &index)
248
+	: QObject(NULL), driver("phidget21"), device(NULL)
249
+{
250
+	DeviceTreeModel *model = (DeviceTreeModel *)(index.model());
251
+	QDomElement deviceReferenceElement =
252
+		model->referenceElement(model->data(index, Qt::UserRole).toString());
253
+	QDomNodeList deviceConfigData = deviceReferenceElement.elementsByTagName("attribute");
254
+	QDomElement node;
255
+	for(int i = 0; i < deviceConfigData.size(); i++)
256
+	{
257
+		node = deviceConfigData.at(i).toElement();
258
+		if(node.attribute("name") == "sampleRate")
259
+		{
260
+			sampleTimer.setInterval(node.attribute("value").toInt());
261
+		}
262
+	}
263
+	if(model->hasChildren(index))
264
+	{
265
+		for(int i = 0; i < model->rowCount(index); i++)
266
+		{
267
+			QModelIndex channelIndex = model->index(i, 0, index);
268
+			QDomElement channelReference = model->referenceElement(model->data(channelIndex, 32).toString());
269
+			QDomElement channelReferenceElement = model->referenceElement(model->data(channelIndex, Qt::UserRole).toString());
270
+			QDomNodeList channelConfigData = channelReferenceElement.elementsByTagName("attribute");
271
+			for(int j = 0; j < channelConfigData.size(); j++)
272
+			{
273
+				node = channelConfigData.at(j).toElement();
274
+				if(node.attribute("name") == "channel")
275
+				{
276
+					int channelID = node.attribute("value").toInt();
277
+					channelIndices.append(channelID);
278
+					Channel* channel = new Channel;
279
+					channelList.append(channel);
280
+					channelMap.insert(channelID, channel);
281
+				}
282
+				else if(node.attribute("name") == "hidden")
283
+				{
284
+					hiddenState.append(node.attribute("value") == "true");
285
+				}
286
+				else if(node.attribute("name") == "columnname")
287
+				{
288
+					columnNames.append(node.attribute("value"));
289
+				}
290
+				else if(node.attribute("name") == "tctype")
291
+				{
292
+					tctypes.append(node.attribute("value").toInt());
293
+				}
294
+			}
295
+			indicatorTexts.append(model->data(channelIndex, Qt::DisplayRole).toString());
296
+		}
297
+	}
298
+}
299
+
300
+@ There is a distinction between logical and physical channels. Physical
301
+channels are specified as a configuration attribute and are used for
302
+communication with hardware. Logical channels are determined by the order of
303
+nodes in the configuration and are used for integrating device support with the
304
+rest of the program.
305
+
306
+@<Phidgets implementation@>=
307
+int PhidgetsTemperatureSensor::channelCount()
308
+{
309
+	return channelList.length();
310
+}
311
+
312
+Channel* PhidgetsTemperatureSensor::getChannel(int channel)
313
+{
314
+	return channelList.at(channel);
315
+}
316
+
317
+@ Some information is available about each channel.
318
+
319
+@<Phidgets implementation@>=
320
+bool PhidgetsTemperatureSensor::isChannelHidden(int channel)
321
+{
322
+	return hiddenState.at(channel);
323
+}
324
+
325
+QString PhidgetsTemperatureSensor::channelColumnName(int channel)
326
+{
327
+	if(channel >= 0 && channel < columnNames.length())
328
+	{
329
+		return columnNames.at(channel);
330
+	}
331
+	return QString();
332
+}
333
+
334
+QString PhidgetsTemperatureSensor::channelIndicatorText(int channel)
335
+{
336
+	if(channel >= 0 && channel < indicatorTexts.length())
337
+	{
338
+		return indicatorTexts.at(channel);
339
+	}
340
+	return QString();
341
+}
342
+
343
+@ To avoid introducing dependencies on a library that is only needed for
344
+hardware that may not exist, the phidget21 library is only loaded at runtime
345
+if it is needed. Some function pointers and associated types are, therefore,
346
+required. This approach also means the associated header does not need to
347
+exist at compile time.
348
+
349
+@<Phidgets 1048 function pointers@>=
350
+#ifdef _WIN32
351
+typedef int (__stdcall *PhidgetHandleOnly)(void *);
352
+typedef int (__stdcall *PhidgetHandleInt)(void *, int);
353
+typedef int (__stdcall *PhidgetHandleIntInt)(void *, int, int);
354
+typedef int (__stdcall *PhidgetHandleIntDoubleOut)(void *, int, double*);
355
+#else
356
+typedef int (*PhidgetHandleOnly)(void *);
357
+typedef int (*PhidgetHandleInt)(void *, int);
358
+typedef int (*PhidgetHandleIntInt)(void *, int, int);
359
+typedef int (*PhidgetHandleIntDoubleOut)(void *, int, double*);
360
+#endif
361
+PhidgetHandleOnly createDevice;
362
+PhidgetHandleInt openDevice;
363
+PhidgetHandleInt waitForOpen;
364
+PhidgetHandleIntInt setTCType;
365
+PhidgetHandleIntDoubleOut getTemperature;
366
+PhidgetHandleOnly closeDevice;
367
+PhidgetHandleOnly deleteDevice;
368
+
369
+@ Library loading is deferred until we are ready to open a device.
370
+
371
+@<Phidgets implementation@>=
372
+void PhidgetsTemperatureSensor::start()
373
+{
374
+	if(!driver.load())
375
+	{
376
+		driver.setFileName("Phidget21.framework/Phidget21");
377
+		if(!driver.load())
378
+		{
379
+			QMessageBox::critical(NULL, tr("Typica: Driver not found"),
380
+				tr("Failed to find phidget21. Please install it."));
381
+			return;
382
+		}
383
+	}
384
+	if((createDevice = (PhidgetHandleOnly) driver.resolve("CPhidgetTemperatureSensor_create")) == 0 || @|
385
+       (openDevice = (PhidgetHandleInt) driver.resolve("CPhidget_open")) == 0 || @|
386
+       (waitForOpen = (PhidgetHandleInt) driver.resolve("CPhidget_waitForAttachment")) == 0 || @|
387
+       (setTCType = (PhidgetHandleIntInt) driver.resolve("CPhidgetTemperatureSensor_setThermocoupleType")) == 0 || @|
388
+       (getTemperature = (PhidgetHandleIntDoubleOut) driver.resolve("CPhidgetTemperatureSensor_getTemperature")) == 0 || @|
389
+       (closeDevice = (PhidgetHandleOnly) driver.resolve("CPhidget_close")) == 0 || @|
390
+       (deleteDevice = (PhidgetHandleOnly) driver.resolve("CPhidget_delete")) == 0)
391
+	{
392
+		QMessageBox::critical(NULL, tr("Typica: Link error"),
393
+			tr("Failed to link a required symbol in phidget21."));
394
+		return;
395
+	}
396
+	createDevice(&device);
397
+	openDevice(device, -1);
398
+	int error;
399
+	if(error = waitForOpen(device, 10000))
400
+	{
401
+		closeDevice(device);
402
+		deleteDevice(device);
403
+		QMessageBox::critical(NULL, tr("Typica: Failed to Open Device"),
404
+			tr("CPhidget_waitForAttachment returns error %n", 0, error));
405
+		return;
406
+	}
407
+	for(int i = 0; i < channelIndices.length(); i++)
408
+	{
409
+		setTCType(device, channelIndices.at(i), tctypes.at(i));
410
+	}
411
+	connect(&sampleTimer, SIGNAL(timeout()), this, SLOT(getMeasurements()));
412
+	sampleTimer.start();
413
+}
414
+
415
+@ Once the device is started, we periodically request measurements and pass
416
+them to the appropriate |Channel|.
417
+
418
+@<Phidgets implementation@>=
419
+void PhidgetsTemperatureSensor::getMeasurements()
420
+{
421
+	double value = 0.0;
422
+	QTime time = QTime::currentTime();
423
+	foreach(int i, channelIndices)
424
+	{
425
+		getTemperature(device, i, &value);
426
+		Measurement measure(value * 9.0 / 5.0 + 32.0, time);
427
+		channelMap[i]->input(measure);
428
+	}
429
+}
430
+
431
+@ Some clean up is needed in the |stop()| method.
432
+
433
+@<Phidgets implementation@>=
434
+void PhidgetsTemperatureSensor::stop()
435
+{
436
+	sampleTimer.stop();
437
+	closeDevice(device);
438
+	deleteDevice(device);
439
+	driver.unload();
440
+}
441
+
442
+@ The implementation currently goes into typica.cpp.
443
+
444
+@<Class implementations@>=
445
+@<Phidgets implementation@>@;
446
+
447
+@ The |PhidgetsTemperatureSensor| needs to be available from the host
448
+environment. This detail is likely to change in the future.
449
+
450
+@<Set up the scripting engine@>=
451
+constructor = engine->newFunction(constructPhidgetsTemperatureSensor);
452
+value = engine->newQMetaObject(&PhidgetsTemperatureSensor::staticMetaObject, constructor);
453
+engine->globalObject().setProperty("PhidgetsTemperatureSensor", value);
454
+
455
+@ Two function prototypes are needed.
456
+
457
+@<Function prototypes for scripting@>=
458
+QScriptValue constructPhidgetsTemperatureSensor(QScriptContext *context, QScriptEngine *engine);
459
+QScriptValue Phidgets_getChannel(QScriptContext *context, QScriptEngine *engine);
460
+
461
+@ The script constructor is trivial.
462
+
463
+@<Functions for scripting@>=
464
+QScriptValue constructPhidgetsTemperatureSensor(QScriptContext *context, QScriptEngine *engine)
465
+{
466
+	if(context->argumentCount() != 1)
467
+	{
468
+		context->throwError("Incorrect number of arguments passed to "@|
469
+                            "PhidgetsTemperatureSensor constructor. This takes "@|
470
+                            "a QModelIndex.");
471
+	}
472
+	QScriptValue object = engine->newQObject(new PhidgetsTemperatureSensor(argument<QModelIndex>(0, context)), QScriptEngine::ScriptOwnership);
473
+	setQObjectProperties(object, engine);
474
+	object.setProperty("getChannel", engine->newFunction(Phidgets_getChannel));
475
+	return object;
476
+}
477
+
478
+@ As usual, a wrapper is needed for getting channels.
479
+
480
+@<Functions for scripting@>=
481
+QScriptValue Phidgets_getChannel(QScriptContext *context, QScriptEngine *engine)
482
+{
483
+	PhidgetsTemperatureSensor *self = getself<PhidgetsTemperatureSensor *>(context);
484
+	QScriptValue object;
485
+	if(self)
486
+	{
487
+		object = engine->newQObject(self->getChannel(argument<int>(0, context)));
488
+		setChannelProperties(object, engine);
489
+	}
490
+	return object;
491
+}

+ 1164
- 435
src/qrc_resources.cpp
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 6
- 6
src/scale.cpp Ver fichero

@@ -1,4 +1,4 @@
1
-/*869:*/
1
+/*964:*/
2 2
 #line 131 "./scales.w"
3 3
 
4 4
 #include "scale.h"
@@ -10,7 +10,7 @@ QextSerialPort(port,QextSerialPort::EventDriven)
10 10
 connect(this,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
11 11
 }
12 12
 
13
-/*:869*//*870:*/
13
+/*:964*//*965:*/
14 14
 #line 149 "./scales.w"
15 15
 
16 16
 void SerialScale::dataAvailable()
@@ -24,7 +24,7 @@ responseBuffer.clear();
24 24
 }
25 25
 else
26 26
 {
27
-/*871:*/
27
+/*966:*/
28 28
 #line 189 "./scales.w"
29 29
 
30 30
 QStringList responseParts= QString(responseBuffer.simplified()).split(' ');
@@ -53,7 +53,7 @@ unit= Units::Ounce;
53 53
 }
54 54
 emit newMeasurement(weight,unit);
55 55
 
56
-/*:871*/
56
+/*:966*/
57 57
 #line 161 "./scales.w"
58 58
 
59 59
 responseBuffer.clear();
@@ -61,7 +61,7 @@ responseBuffer.clear();
61 61
 }
62 62
 }
63 63
 
64
-/*:870*//*872:*/
64
+/*:965*//*967:*/
65 65
 #line 220 "./scales.w"
66 66
 
67 67
 void SerialScale::tare()
@@ -74,4 +74,4 @@ void SerialScale::weigh()
74 74
 write("!KP\x0D");
75 75
 }
76 76
 
77
-/*:872*/
77
+/*:967*/

+ 2
- 2
src/scale.h Ver fichero

@@ -1,4 +1,4 @@
1
-/*868:*/
1
+/*963:*/
2 2
 #line 103 "./scales.w"
3 3
 
4 4
 #ifndef TypicaScaleInclude
@@ -25,4 +25,4 @@ QByteArray responseBuffer;
25 25
 
26 26
 #endif
27 27
 
28
-/*:868*/
28
+/*:963*/

+ 1695
- 1135
src/typica.cpp
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 2
- 0
src/typica.w Ver fichero

@@ -18963,6 +18963,8 @@ topLevelNodeInserters.append(inserter);
18963 18963
 
18964 18964
 @i unsupportedserial.w
18965 18965
 
18966
+@i phidgets.w
18967
+
18966 18968
 @* Configuration widget for a calibrated data series.
18967 18969
 
18968 18970
 \noindent This control is used for adding a |LinearSplineInterpolator| to the

+ 6
- 6
src/units.cpp Ver fichero

@@ -1,9 +1,9 @@
1
-/*226:*/
1
+/*253:*/
2 2
 #line 42 "./units.w"
3 3
 
4 4
 #include "units.h"
5 5
 
6
-/*:226*//*227:*/
6
+/*:253*//*254:*/
7 7
 #line 52 "./units.w"
8 8
 
9 9
 bool Units::isTemperatureUnit(Unit unit)
@@ -14,7 +14,7 @@ unit==Kelvin||
14 14
 unit==Rankine);
15 15
 }
16 16
 
17
-/*:227*//*228:*/
17
+/*:254*//*255:*/
18 18
 #line 70 "./units.w"
19 19
 
20 20
 double Units::convertTemperature(double value,Unit fromUnit,Unit toUnit)
@@ -100,7 +100,7 @@ break;
100 100
 return 0;
101 101
 }
102 102
 
103
-/*:228*//*229:*/
103
+/*:255*//*256:*/
104 104
 #line 156 "./units.w"
105 105
 
106 106
 double Units::convertRelativeTemperature(double value,Unit fromUnit,Unit toUnit)
@@ -198,7 +198,7 @@ break;
198 198
 return 0;
199 199
 }
200 200
 
201
-/*:229*//*230:*/
201
+/*:256*//*257:*/
202 202
 #line 254 "./units.w"
203 203
 
204 204
 double Units::convertWeight(double value,Unit fromUnit,Unit toUnit)
@@ -303,4 +303,4 @@ unit==Ounce||
303 303
 unit==Gram);
304 304
 }
305 305
 
306
-/*:230*/
306
+/*:257*/

+ 2
- 2
src/units.h Ver fichero

@@ -1,4 +1,4 @@
1
-/*225:*/
1
+/*252:*/
2 2
 #line 8 "./units.w"
3 3
 
4 4
 #include <QObject> 
@@ -32,4 +32,4 @@ static bool isWeightUnit(Unit unit);
32 32
 
33 33
 #endif
34 34
 
35
-/*:225*/
35
+/*:252*/

+ 9
- 9
src/webelement.cpp Ver fichero

@@ -1,18 +1,18 @@
1
-/*513:*/
2
-#line 365 "./webview.w"
1
+/*546:*/
2
+#line 368 "./webview.w"
3 3
 
4 4
 #include "webelement.h"
5 5
 
6
-/*511:*/
7
-#line 308 "./webview.w"
6
+/*544:*/
7
+#line 311 "./webview.w"
8 8
 
9 9
 TypicaWebElement::TypicaWebElement(QWebElement element):e(element)
10 10
 {
11 11
 
12 12
 }
13 13
 
14
-/*:511*//*512:*/
15
-#line 317 "./webview.w"
14
+/*:544*//*545:*/
15
+#line 320 "./webview.w"
16 16
 
17 17
 void TypicaWebElement::appendInside(const QString&markup)
18 18
 {
@@ -59,8 +59,8 @@ void TypicaWebElement::setPlainText(const QString&text)
59 59
 e.setPlainText(text);
60 60
 }
61 61
 
62
-/*:512*/
63
-#line 368 "./webview.w"
62
+/*:545*/
63
+#line 371 "./webview.w"
64 64
 
65 65
 
66
-/*:513*/
66
+/*:546*/

+ 3
- 3
src/webelement.h Ver fichero

@@ -1,5 +1,5 @@
1
-/*506:*/
2
-#line 245 "./webview.w"
1
+/*539:*/
2
+#line 248 "./webview.w"
3 3
 
4 4
 #include <QWebElement> 
5 5
 #include <QObject> 
@@ -27,4 +27,4 @@ QWebElement e;
27 27
 
28 28
 #endif
29 29
 
30
-/*:506*/
30
+/*:539*/

+ 24
- 22
src/webview.cpp Ver fichero

@@ -1,10 +1,10 @@
1
-/*491:*/
2
-#line 49 "./webview.w"
1
+/*524:*/
2
+#line 50 "./webview.w"
3 3
 
4 4
 #include "webview.h"
5 5
 
6
-/*492:*/
7
-#line 56 "./webview.w"
6
+/*525:*/
7
+#line 57 "./webview.w"
8 8
 
9 9
 TypicaWebView::TypicaWebView():QWebView()
10 10
 {
@@ -12,16 +12,16 @@ page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
12 12
 connect(page(),SIGNAL(linkClicked(QUrl)),this,SLOT(linkDelegate(QUrl)));
13 13
 }
14 14
 
15
-/*:492*//*493:*/
16
-#line 72 "./webview.w"
15
+/*:525*//*526:*/
16
+#line 73 "./webview.w"
17 17
 
18 18
 void TypicaWebView::linkDelegate(const QUrl&url)
19 19
 {
20 20
 if(url.scheme()=="typica")
21 21
 {
22 22
 QString address(url.toEncoded());
23
-/*494:*/
24
-#line 90 "./webview.w"
23
+/*527:*/
24
+#line 91 "./webview.w"
25 25
 
26 26
 if(address=="typica://aboutqt")
27 27
 {
@@ -29,11 +29,11 @@ QMessageBox::aboutQt(this);
29 29
 return;
30 30
 }
31 31
 
32
-/*:494*/
33
-#line 78 "./webview.w"
32
+/*:527*/
33
+#line 79 "./webview.w"
34 34
 
35
-/*495:*/
36
-#line 99 "./webview.w"
35
+/*528:*/
36
+#line 100 "./webview.w"
37 37
 
38 38
 if(address.startsWith("typica://script/"))
39 39
 {
@@ -41,8 +41,8 @@ emit scriptLinkClicked(address.remove(0,16));
41 41
 return;
42 42
 }
43 43
 
44
-/*:495*/
45
-#line 79 "./webview.w"
44
+/*:528*/
45
+#line 80 "./webview.w"
46 46
 
47 47
 }
48 48
 else
@@ -51,8 +51,8 @@ QDesktopServices::openUrl(url);
51 51
 }
52 52
 }
53 53
 
54
-/*:493*//*496:*/
55
-#line 111 "./webview.w"
54
+/*:526*//*529:*/
55
+#line 112 "./webview.w"
56 56
 
57 57
 void TypicaWebView::load(const QString&url)
58 58
 {
@@ -76,9 +76,11 @@ QWebView::setHtml(html,baseUrl);
76 76
 
77 77
 void TypicaWebView::setContent(QIODevice*device)
78 78
 {
79
+QSettings settings;
79 80
 device->reset();
80 81
 QByteArray content= device->readAll();
81
-QWebView::setContent(content,"application/xhtml+xml");
82
+QUrl baseDir= QUrl("file://"+settings.value("config").toString()+"/");
83
+QWebView::setContent(content,"application/xhtml+xml",baseDir);
82 84
 }
83 85
 
84 86
 QString TypicaWebView::saveXml()
@@ -86,8 +88,8 @@ QString TypicaWebView::saveXml()
86 88
 return page()->currentFrame()->documentElement().toOuterXml();
87 89
 }
88 90
 
89
-/*:496*//*502:*/
90
-#line 202 "./webview.w"
91
+/*:529*//*535:*/
92
+#line 205 "./webview.w"
91 93
 
92 94
 QWebElement TypicaWebView::documentElement()
93 95
 {
@@ -99,8 +101,8 @@ QWebElement TypicaWebView::findFirstElement(const QString&selector)
99 101
 return page()->mainFrame()->findFirstElement(selector);
100 102
 }
101 103
 
102
-/*:502*/
103
-#line 52 "./webview.w"
104
+/*:535*/
105
+#line 53 "./webview.w"
104 106
 
105 107
 
106
-/*:491*/
108
+/*:524*/

+ 3
- 2
src/webview.h Ver fichero

@@ -1,4 +1,4 @@
1
-/*490:*/
1
+/*523:*/
2 2
 #line 14 "./webview.w"
3 3
 
4 4
 #include <QWebView> 
@@ -9,6 +9,7 @@
9 9
 #include <QPrintDialog> 
10 10
 #include <QWebFrame> 
11 11
 #include <QWebElement> 
12
+#include <QSettings> 
12 13
 
13 14
 #ifndef TypicaWebViewHeader
14 15
 #define TypicaWebViewHeader
@@ -33,4 +34,4 @@ void linkDelegate(const QUrl&url);
33 34
 
34 35
 #endif
35 36
 
36
-/*:490*/
37
+/*:523*/

Loading…
Cancelar
Guardar