Sfoglia il codice sorgente

Release version 1.6

Neal Wilson 11 anni fa
commit
9f2e607056
15 ha cambiato i file con 5753 aggiunte e 2470 eliminazioni
  1. 9
    34
      src/abouttypica.cpp
  2. 4
    9
      src/abouttypica.h
  3. 29
    0
      src/draglabel.cpp
  4. 20
    0
      src/draglabel.h
  5. 6
    6
      src/helpmenu.cpp
  6. 2
    2
      src/helpmenu.h
  7. 77
    0
      src/scale.cpp
  8. 28
    0
      src/scale.h
  9. 4991
    2419
      src/typica.cpp
  10. 314
    0
      src/units.cpp
  11. 35
    0
      src/units.h
  12. 66
    0
      src/webelement.cpp
  13. 30
    0
      src/webelement.h
  14. 106
    0
      src/webview.cpp
  15. 36
    0
      src/webview.h

+ 9
- 34
src/abouttypica.cpp Vedi File

@@ -1,51 +1,26 @@
1
-/*228:*/
2
-#line 36 "./abouttypica.w"
1
+/*231:*/
2
+#line 33 "./abouttypica.w"
3 3
 
4 4
 #include "abouttypica.h"
5 5
 
6
-/*229:*/
7
-#line 45 "./abouttypica.w"
6
+/*232:*/
7
+#line 42 "./abouttypica.w"
8 8
 
9 9
 AboutTypica::AboutTypica():QMainWindow(NULL)
10 10
 {
11 11
 QFile aboutFile(":/resources/html/about.html");
12 12
 aboutFile.open(QIODevice::ReadOnly);
13 13
 QByteArray content= aboutFile.readAll();
14
-QWebView*banner= new QWebView;
14
+TypicaWebView*banner= new TypicaWebView;
15 15
 banner->setHtml(content,QUrl("qrc:/resources/html/about.html"));
16 16
 aboutFile.close();
17 17
 setCentralWidget(banner);
18
-QWebPage*page= banner->page();
19
-page->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
20
-connect(page,SIGNAL(linkClicked(QUrl)),this,SLOT(linkClicked(QUrl)));
21 18
 }
22 19
 
23
-/*:229*//*230:*/
24
-#line 63 "./abouttypica.w"
20
+#line 5770 "./typica.w"
25 21
 
26
-void AboutTypica::linkClicked(const QUrl&url)
27
-{
28
-if(url.scheme()=="typica")
29
-{
30
-QString address(url.toEncoded());
31
-if(address=="typica://aboutqt")
32
-{
33
-QMessageBox::aboutQt(this);
34
-}
35
-else
36
-{
37
-qDebug()<<"Unexpected link. Got: "<<address;
38
-}
39
-}
40
-else
41
-{
42
-QDesktopServices::openUrl(url);
43
-}
44
-}
45
-#line 5697 "./typica.w"
46
-
47
-/*:230*/
48
-#line 39 "./abouttypica.w"
22
+/*:232*/
23
+#line 36 "./abouttypica.w"
49 24
 
50 25
 
51
-/*:228*/
26
+/*:231*/

+ 4
- 9
src/abouttypica.h Vedi File

@@ -1,12 +1,9 @@
1
-/*227:*/
2
-#line 12 "./abouttypica.w"
1
+/*230:*/
2
+#line 14 "./abouttypica.w"
3 3
 
4 4
 #include <QMainWindow> 
5
-#include <QWebView> 
6 5
 #include <QFile> 
7
-#include <QtDebug> 
8
-#include <QMessageBox> 
9
-#include <QDesktopServices> 
6
+#include "webview.h"
10 7
 
11 8
 #ifndef AboutTypicaHeader
12 9
 #define AboutTypicaHeader
@@ -16,10 +13,8 @@ class AboutTypica:public QMainWindow
16 13
 Q_OBJECT
17 14
 public:
18 15
 AboutTypica();
19
-public slots:
20
-void linkClicked(const QUrl&url);
21 16
 };
22 17
 
23 18
 #endif
24 19
 
25
-/*:227*/
20
+/*:230*/

+ 29
- 0
src/draglabel.cpp Vedi File

@@ -0,0 +1,29 @@
1
+/*848:*/
2
+#line 33 "./scales.w"
3
+
4
+#include "draglabel.h"
5
+
6
+#include <QDrag> 
7
+#include <QMouseEvent> 
8
+
9
+DragLabel::DragLabel(const QString&labelText,QWidget*parent):
10
+QLabel(labelText,parent)
11
+{
12
+QFont labelFont= font();
13
+labelFont.setPointSize(14);
14
+setFont(labelFont);
15
+}
16
+
17
+void DragLabel::mousePressEvent(QMouseEvent*event)
18
+{
19
+if(event->button()==Qt::LeftButton)
20
+{
21
+QDrag*drag= new QDrag(this);
22
+QMimeData*mimeData= new QMimeData;
23
+mimeData->setText(text());
24
+drag->setMimeData(mimeData);
25
+drag->exec();
26
+}
27
+}
28
+
29
+/*:848*/

+ 20
- 0
src/draglabel.h Vedi File

@@ -0,0 +1,20 @@
1
+/*847:*/
2
+#line 13 "./scales.w"
3
+
4
+#ifndef TypicaDragLabelInclude
5
+#define TypicaDragLabelInclude
6
+
7
+#include <QLabel> 
8
+
9
+class DragLabel:public QLabel
10
+{
11
+Q_OBJECT
12
+public:
13
+explicit DragLabel(const QString&labelText,QWidget*parent= NULL);
14
+protected:
15
+void mousePressEvent(QMouseEvent*event);
16
+};
17
+
18
+#endif
19
+
20
+/*:847*/

+ 6
- 6
src/helpmenu.cpp Vedi File

@@ -1,10 +1,10 @@
1
-/*172:*/
1
+/*175:*/
2 2
 #line 35 "./helpmenu.w"
3 3
 
4 4
 #include "helpmenu.h"
5 5
 #include "abouttypica.h"
6 6
 
7
-/*173:*/
7
+/*176:*/
8 8
 #line 47 "./helpmenu.w"
9 9
 
10 10
 HelpMenu::HelpMenu():QMenu()
@@ -17,7 +17,7 @@ addAction(aboutTypicaAction);
17 17
 connect(aboutTypicaAction,SIGNAL(triggered()),this,SLOT(displayAboutTypica()));
18 18
 }
19 19
 
20
-/*:173*//*174:*/
20
+/*:176*//*177:*/
21 21
 #line 61 "./helpmenu.w"
22 22
 
23 23
 void HelpMenu::displayAboutTypica()
@@ -26,10 +26,10 @@ AboutTypica*aboutBox= new AboutTypica;
26 26
 aboutBox->show();
27 27
 }
28 28
 
29
-#line 4074 "./typica.w"
29
+#line 4138 "./typica.w"
30 30
 
31
-/*:174*/
31
+/*:177*/
32 32
 #line 39 "./helpmenu.w"
33 33
 
34 34
 
35
-/*:172*/
35
+/*:175*/

+ 2
- 2
src/helpmenu.h Vedi File

@@ -1,4 +1,4 @@
1
-/*171:*/
1
+/*174:*/
2 2
 #line 16 "./helpmenu.w"
3 3
 
4 4
 #include <QMenu> 
@@ -17,4 +17,4 @@ void displayAboutTypica();
17 17
 
18 18
 #endif
19 19
 
20
-/*:171*/
20
+/*:174*/

+ 77
- 0
src/scale.cpp Vedi File

@@ -0,0 +1,77 @@
1
+/*854:*/
2
+#line 131 "./scales.w"
3
+
4
+#include "scale.h"
5
+#include <QStringList> 
6
+
7
+SerialScale::SerialScale(const QString&port):
8
+QextSerialPort(port,QextSerialPort::EventDriven)
9
+{
10
+connect(this,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
11
+}
12
+
13
+/*:854*//*855:*/
14
+#line 149 "./scales.w"
15
+
16
+void SerialScale::dataAvailable()
17
+{
18
+responseBuffer.append(readAll());
19
+if(responseBuffer.contains("\x0D"))
20
+{
21
+if(responseBuffer.contains("!"))
22
+{
23
+responseBuffer.clear();
24
+}
25
+else
26
+{
27
+/*856:*/
28
+#line 189 "./scales.w"
29
+
30
+QStringList responseParts= QString(responseBuffer.simplified()).split(' ');
31
+if(responseParts.size()> 2)
32
+{
33
+responseParts.removeFirst();
34
+responseParts.replace(0,QString("-%1").arg(responseParts[0]));
35
+}
36
+double weight= responseParts[0].toDouble();
37
+Units::Unit unit= Units::Unitless;
38
+if(responseParts[1]=="lb")
39
+{
40
+unit= Units::Pound;
41
+}
42
+else if(responseParts[1]=="kg")
43
+{
44
+unit= Units::Kilogram;
45
+}
46
+else if(responseParts[1]=="g")
47
+{
48
+unit= Units::Gram;
49
+}
50
+else if(responseParts[1]=="oz")
51
+{
52
+unit= Units::Ounce;
53
+}
54
+emit newMeasurement(weight,unit);
55
+
56
+/*:856*/
57
+#line 161 "./scales.w"
58
+
59
+responseBuffer.clear();
60
+}
61
+}
62
+}
63
+
64
+/*:855*//*857:*/
65
+#line 220 "./scales.w"
66
+
67
+void SerialScale::tare()
68
+{
69
+write("!KT\x0D");
70
+}
71
+
72
+void SerialScale::weigh()
73
+{
74
+write("!KP\x0D");
75
+}
76
+
77
+/*:857*/

+ 28
- 0
src/scale.h Vedi File

@@ -0,0 +1,28 @@
1
+/*853:*/
2
+#line 103 "./scales.w"
3
+
4
+#ifndef TypicaScaleInclude
5
+#define TypicaScaleInclude
6
+
7
+#include "3rdparty/qextserialport/src/qextserialport.h"
8
+#include "units.h"
9
+
10
+class SerialScale:public QextSerialPort
11
+{
12
+Q_OBJECT
13
+public:
14
+SerialScale(const QString&port);
15
+public slots:
16
+void tare();
17
+void weigh();
18
+signals:
19
+void newMeasurement(double weight,Units::Unit unit);
20
+private slots:
21
+void dataAvailable();
22
+private:
23
+QByteArray responseBuffer;
24
+};
25
+
26
+#endif
27
+
28
+/*:853*/

+ 4991
- 2419
src/typica.cpp
File diff soppresso perché troppo grande
Vedi File


+ 314
- 0
src/units.cpp Vedi File

@@ -0,0 +1,314 @@
1
+/*235:*/
2
+#line 42 "./units.w"
3
+
4
+#include "units.h"
5
+
6
+/*:235*//*236:*/
7
+#line 52 "./units.w"
8
+
9
+bool Units::isTemperatureUnit(Unit unit)
10
+{
11
+if(unit==Fahrenheit||
12
+unit==Celsius||
13
+unit==Kelvin||
14
+unit==Rankine)
15
+{
16
+return true;
17
+}
18
+return false;
19
+}
20
+
21
+/*:236*//*237:*/
22
+#line 74 "./units.w"
23
+
24
+double Units::convertTemperature(double value,Unit fromUnit,Unit toUnit)
25
+{
26
+if(isTemperatureUnit(fromUnit)&&isTemperatureUnit(toUnit)==false)
27
+{
28
+return 0;
29
+}
30
+switch(fromUnit)
31
+{
32
+case Fahrenheit:
33
+switch(toUnit)
34
+{
35
+case Fahrenheit:
36
+return value;
37
+break;
38
+case Celsius:
39
+return(value-32.0)*5.0/9.0;
40
+break;
41
+case Kelvin:
42
+return(value+459.67)*5.0/9.0;
43
+break;
44
+case Rankine:
45
+return value+459.67;
46
+break;
47
+}
48
+break;
49
+case Celsius:
50
+switch(toUnit)
51
+{
52
+case Fahrenheit:
53
+return value*9.0/5.0+32.0;
54
+break;
55
+case Celsius:
56
+return value;
57
+break;
58
+case Kelvin:
59
+return value+273.15;
60
+break;
61
+case Rankine:
62
+return(value+273.15)*9.0/5.0;
63
+break;
64
+}
65
+break;
66
+case Kelvin:
67
+switch(toUnit)
68
+{
69
+case Fahrenheit:
70
+return value*5.0/9.0-459.67;
71
+break;
72
+case Celsius:
73
+return value-273.15;
74
+break;
75
+case Kelvin:
76
+return value;
77
+break;
78
+case Rankine:
79
+return value*9.0/5.0;
80
+break;
81
+}
82
+break;
83
+case Rankine:
84
+switch(toUnit)
85
+{
86
+case Fahrenheit:
87
+return value-457.67;
88
+break;
89
+case Celsius:
90
+return(value-491.67)*5.0/9.0;
91
+break;
92
+case Kelvin:
93
+return value*5.0/9.0;
94
+break;
95
+case Rankine:
96
+return value;
97
+break;
98
+}
99
+break;
100
+default:
101
+return 0;
102
+break;
103
+}
104
+return 0;
105
+}
106
+
107
+/*:237*//*238:*/
108
+#line 160 "./units.w"
109
+
110
+double Units::convertRelativeTemperature(double value,Unit fromUnit,Unit toUnit)
111
+{
112
+if(isTemperatureUnit(fromUnit)&&isTemperatureUnit(toUnit)==false)
113
+{
114
+return 0;
115
+}
116
+switch(fromUnit)
117
+{
118
+case Fahrenheit:
119
+switch(toUnit)
120
+{
121
+case Fahrenheit:
122
+return value;
123
+break;
124
+case Celsius:
125
+return value*(5.0/9.0);
126
+break;
127
+case Kelvin:
128
+return value*(5.0/9.0);
129
+break;
130
+case Rankine:
131
+return value;
132
+break;
133
+default:
134
+return 0;
135
+break;
136
+}
137
+break;
138
+case Celsius:
139
+switch(toUnit)
140
+{
141
+case Fahrenheit:
142
+return value*(9.0/5.0);
143
+break;
144
+case Celsius:
145
+return value;
146
+break;
147
+case Kelvin:
148
+return value;
149
+break;
150
+case Rankine:
151
+return value*(9.0/5.0);
152
+break;
153
+default:
154
+return 0;
155
+break;
156
+}
157
+break;
158
+case Kelvin:
159
+switch(toUnit)
160
+{
161
+case Fahrenheit:
162
+return value*(5.0/9.0);
163
+break;
164
+case Celsius:
165
+return value;
166
+break;
167
+case Kelvin:
168
+return value;
169
+break;
170
+case Rankine:
171
+return value*(9.0/5.0);
172
+break;
173
+default:
174
+return 0;
175
+break;
176
+}
177
+break;
178
+case Rankine:
179
+switch(toUnit)
180
+{
181
+case Fahrenheit:
182
+return value;
183
+break;
184
+case Celsius:
185
+return value*(5.0/9.0);
186
+break;
187
+case Kelvin:
188
+return value*(5.0/9.0);
189
+break;
190
+case Rankine:
191
+return value;
192
+break;
193
+default:
194
+return 0;
195
+break;
196
+}
197
+break;
198
+default:
199
+return 0;
200
+break;
201
+}
202
+return 0;
203
+}
204
+
205
+/*:238*//*239:*/
206
+#line 258 "./units.w"
207
+
208
+double Units::convertWeight(double value,Unit fromUnit,Unit toUnit)
209
+{
210
+if(isWeightUnit(fromUnit)&&isWeightUnit(toUnit))
211
+{
212
+switch(fromUnit)
213
+{
214
+case Pound:
215
+switch(toUnit)
216
+{
217
+case Pound:
218
+return value;
219
+break;
220
+case Kilogram:
221
+return value/2.2;
222
+break;
223
+case Ounce:
224
+return value*16.0;
225
+break;
226
+case Gram:
227
+return value/0.0022;
228
+break;
229
+default:
230
+return 0;
231
+break;
232
+}
233
+break;
234
+case Kilogram:
235
+switch(toUnit)
236
+{
237
+case Pound:
238
+return value*2.2;
239
+break;
240
+case Kilogram:
241
+return value;
242
+break;
243
+case Ounce:
244
+return value*35.2;
245
+break;
246
+case Gram:
247
+return value*1000.0;
248
+break;
249
+default:
250
+return 0;
251
+break;
252
+}
253
+break;
254
+case Ounce:
255
+switch(toUnit)
256
+{
257
+case Pound:
258
+return value/16.0;
259
+break;
260
+case Kilogram:
261
+return value/35.2;
262
+break;
263
+case Ounce:
264
+return value;
265
+break;
266
+case Gram:
267
+return value/0.0352;
268
+break;
269
+default:
270
+return 0;
271
+break;
272
+}
273
+break;
274
+case Gram:
275
+switch(toUnit)
276
+{
277
+case Pound:
278
+return value*0.0022;
279
+break;
280
+case Kilogram:
281
+return value/1000.0;
282
+break;
283
+case Ounce:
284
+return value*0.0352;
285
+break;
286
+case Gram:
287
+return value;
288
+break;
289
+default:
290
+return 0;
291
+break;
292
+}
293
+break;
294
+default:
295
+return 0;
296
+break;
297
+}
298
+}
299
+return 0;
300
+}
301
+
302
+bool Units::isWeightUnit(Unit unit)
303
+{
304
+if(unit==Pound||
305
+unit==Kilogram||
306
+unit==Ounce||
307
+unit==Gram)
308
+{
309
+return true;
310
+}
311
+return false;
312
+}
313
+
314
+/*:239*/

+ 35
- 0
src/units.h Vedi File

@@ -0,0 +1,35 @@
1
+/*234:*/
2
+#line 8 "./units.w"
3
+
4
+#include <QObject> 
5
+
6
+#ifndef TypicaUnitsIncluded
7
+#define TypicaUnitsIncluded
8
+
9
+class Units:public QObject
10
+{
11
+Q_OBJECT
12
+Q_ENUMS(Unit)
13
+public:
14
+enum Unit
15
+{
16
+Unitless= 0,
17
+Fahrenheit= 10144,
18
+Celsius= 10143,
19
+Kelvin= 10325,
20
+Rankine= 10145,
21
+Pound= 15876,
22
+Kilogram= 15877,
23
+Ounce= 1,
24
+Gram= 2
25
+};
26
+static double convertTemperature(double value,Unit fromUnit,Unit toUnit);
27
+static double convertRelativeTemperature(double value,Unit fromUnit,Unit toUnit);
28
+static bool isTemperatureUnit(Unit unit);
29
+static double convertWeight(double value,Unit fromUnit,Unit toUnit);
30
+static bool isWeightUnit(Unit unit);
31
+};
32
+
33
+#endif
34
+
35
+/*:234*/

+ 66
- 0
src/webelement.cpp Vedi File

@@ -0,0 +1,66 @@
1
+/*522:*/
2
+#line 363 "./webview.w"
3
+
4
+#include "webelement.h"
5
+
6
+/*520:*/
7
+#line 306 "./webview.w"
8
+
9
+TypicaWebElement::TypicaWebElement(QWebElement element):e(element)
10
+{
11
+
12
+}
13
+
14
+/*:520*//*521:*/
15
+#line 315 "./webview.w"
16
+
17
+void TypicaWebElement::appendInside(const QString&markup)
18
+{
19
+e.appendInside(markup);
20
+}
21
+
22
+void TypicaWebElement::appendOutside(const QString&markup)
23
+{
24
+e.appendOutside(markup);
25
+}
26
+
27
+void TypicaWebElement::prependInside(const QString&markup)
28
+{
29
+e.prependInside(markup);
30
+}
31
+
32
+void TypicaWebElement::prependOutside(const QString&markup)
33
+{
34
+e.prependOutside(markup);
35
+}
36
+
37
+void TypicaWebElement::removeFromDocument()
38
+{
39
+e.removeFromDocument();
40
+}
41
+
42
+void TypicaWebElement::replace(const QString&markup)
43
+{
44
+e.replace(markup);
45
+}
46
+
47
+void TypicaWebElement::setInnerXml(const QString&markup)
48
+{
49
+e.setInnerXml(markup);
50
+}
51
+
52
+void TypicaWebElement::setOuterXml(const QString&markup)
53
+{
54
+e.setOuterXml(markup);
55
+}
56
+
57
+void TypicaWebElement::setPlainText(const QString&text)
58
+{
59
+e.setPlainText(text);
60
+}
61
+
62
+/*:521*/
63
+#line 366 "./webview.w"
64
+
65
+
66
+/*:522*/

+ 30
- 0
src/webelement.h Vedi File

@@ -0,0 +1,30 @@
1
+/*515:*/
2
+#line 243 "./webview.w"
3
+
4
+#include <QWebElement> 
5
+#include <QObject> 
6
+
7
+#ifndef TypicaWebElementHeader
8
+#define TypicaWebElementHeader
9
+
10
+class TypicaWebElement:public QObject
11
+{
12
+Q_OBJECT
13
+public:
14
+TypicaWebElement(QWebElement element);
15
+Q_INVOKABLE void appendInside(const QString&markup);
16
+Q_INVOKABLE void appendOutside(const QString&markup);
17
+Q_INVOKABLE void prependInside(const QString&markup);
18
+Q_INVOKABLE void prependOutside(const QString&markup);
19
+Q_INVOKABLE void removeFromDocument();
20
+Q_INVOKABLE void replace(const QString&markup);
21
+Q_INVOKABLE void setInnerXml(const QString&markup);
22
+Q_INVOKABLE void setOuterXml(const QString&markup);
23
+Q_INVOKABLE void setPlainText(const QString&text);
24
+private:
25
+QWebElement e;
26
+};
27
+
28
+#endif
29
+
30
+/*:515*/

+ 106
- 0
src/webview.cpp Vedi File

@@ -0,0 +1,106 @@
1
+/*500:*/
2
+#line 47 "./webview.w"
3
+
4
+#include "webview.h"
5
+
6
+/*501:*/
7
+#line 54 "./webview.w"
8
+
9
+TypicaWebView::TypicaWebView():QWebView()
10
+{
11
+page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
12
+connect(page(),SIGNAL(linkClicked(QUrl)),this,SLOT(linkDelegate(QUrl)));
13
+}
14
+
15
+/*:501*//*502:*/
16
+#line 70 "./webview.w"
17
+
18
+void TypicaWebView::linkDelegate(const QUrl&url)
19
+{
20
+if(url.scheme()=="typica")
21
+{
22
+QString address(url.toEncoded());
23
+/*503:*/
24
+#line 88 "./webview.w"
25
+
26
+if(address=="typica://aboutqt")
27
+{
28
+QMessageBox::aboutQt(this);
29
+return;
30
+}
31
+
32
+/*:503*/
33
+#line 76 "./webview.w"
34
+
35
+/*504:*/
36
+#line 97 "./webview.w"
37
+
38
+if(address.startsWith("typica://script/"))
39
+{
40
+emit scriptLinkClicked(address.remove(0,16));
41
+return;
42
+}
43
+
44
+/*:504*/
45
+#line 77 "./webview.w"
46
+
47
+}
48
+else
49
+{
50
+QDesktopServices::openUrl(url);
51
+}
52
+}
53
+
54
+/*:502*//*505:*/
55
+#line 109 "./webview.w"
56
+
57
+void TypicaWebView::load(const QString&url)
58
+{
59
+QWebView::load(QUrl(url));
60
+}
61
+
62
+void TypicaWebView::print()
63
+{
64
+QPrinter*printer= new QPrinter(QPrinter::HighResolution);
65
+QPrintDialog printDialog(printer,NULL);
66
+if(printDialog.exec()==QDialog::Accepted)
67
+{
68
+QWebView::print(printer);
69
+}
70
+}
71
+
72
+void TypicaWebView::setHtml(const QString&html,const QUrl&baseUrl)
73
+{
74
+QWebView::setHtml(html,baseUrl);
75
+}
76
+
77
+void TypicaWebView::setContent(QIODevice*device)
78
+{
79
+device->reset();
80
+QByteArray content= device->readAll();
81
+QWebView::setContent(content,"application/xhtml+xml");
82
+}
83
+
84
+QString TypicaWebView::saveXml()
85
+{
86
+return page()->currentFrame()->documentElement().toOuterXml();
87
+}
88
+
89
+/*:505*//*511:*/
90
+#line 200 "./webview.w"
91
+
92
+QWebElement TypicaWebView::documentElement()
93
+{
94
+return page()->mainFrame()->documentElement();
95
+}
96
+
97
+QWebElement TypicaWebView::findFirstElement(const QString&selector)
98
+{
99
+return page()->mainFrame()->findFirstElement(selector);
100
+}
101
+
102
+/*:511*/
103
+#line 50 "./webview.w"
104
+
105
+
106
+/*:500*/

+ 36
- 0
src/webview.h Vedi File

@@ -0,0 +1,36 @@
1
+/*499:*/
2
+#line 12 "./webview.w"
3
+
4
+#include <QWebView> 
5
+#include <QFile> 
6
+#include <QMessageBox> 
7
+#include <QDesktopServices> 
8
+#include <QPrinter> 
9
+#include <QPrintDialog> 
10
+#include <QWebFrame> 
11
+#include <QWebElement> 
12
+
13
+#ifndef TypicaWebViewHeader
14
+#define TypicaWebViewHeader
15
+
16
+class TypicaWebView:public QWebView
17
+{
18
+Q_OBJECT
19
+public:
20
+TypicaWebView();
21
+Q_INVOKABLE void load(const QString&url);
22
+Q_INVOKABLE void print();
23
+Q_INVOKABLE void setHtml(const QString&html,const QUrl&baseUrl= QUrl());
24
+Q_INVOKABLE void setContent(QIODevice*device);
25
+Q_INVOKABLE QString saveXml();
26
+Q_INVOKABLE QWebElement documentElement();
27
+Q_INVOKABLE QWebElement findFirstElement(const QString&selector);
28
+signals:
29
+void scriptLinkClicked(const QString&link);
30
+private slots:
31
+void linkDelegate(const QUrl&url);
32
+};
33
+
34
+#endif
35
+
36
+/*:499*/

Loading…
Annulla
Salva