Skip to content

Commit 6b3a7fb

Browse files
committed
Merge branch 'WD_1.X_dev' of https://portal-ua.globallogic.com/git/wd into WD_1.X_dev
2 parents dedc1ee + b812bf9 commit 6b3a7fb

17 files changed

+955
-5
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef EVENTDISPATCHER_H
2+
#define EVENTDISPATCHER_H
3+
4+
#include <QtCore/QEvent>
5+
6+
class EventDispatcher
7+
{
8+
public:
9+
virtual bool dispatch(QEvent *event, bool consumed)=0;
10+
};
11+
12+
#endif // EVENTDISPATCHER_H

inc/extension_qt/q_view_executor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace webdriver {
2121

22-
#define NOT_SUPPORTED_IMPL {*error = new Error(kUnknownError, "Current view doesnt support this command.");}
22+
#define NOT_SUPPORTED_IMPL {*error = new Error(kCommandNotSupported, "Current view doesnt support this command.");}
2323
//#define NOT_IMPLEMENTED_IMPL {*error = new Error(kUnknownError, "Command not implemented.");}
2424
//#define RET_IF_ERROR(e) {if(e) {*error = e; return;}}
2525

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef VNCEVENTDISPATCHER_H
2+
#define VNCEVENTDISPATCHER_H
3+
4+
#include "event_dispatcher.h"
5+
#include "vnc/vncclient.h"
6+
7+
class VNCEventDispatcher : public EventDispatcher
8+
{
9+
public:
10+
VNCEventDispatcher(VNCClient *client);
11+
virtual ~VNCEventDispatcher();
12+
13+
bool dispatch(QEvent *event, bool consumed);
14+
15+
private:
16+
VNCClient *_vncClient;
17+
};
18+
19+
#endif // VNCEVENTDISPATCHER_H
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef WDEVENTDISPATCHER_H
2+
#define WDEVENTDISPATCHER_H
3+
4+
#include <QtCore/QVector>
5+
6+
#include "event_dispatcher.h"
7+
8+
class WDEventDispatcher
9+
{
10+
private:
11+
WDEventDispatcher();
12+
virtual ~WDEventDispatcher();
13+
14+
public:
15+
static WDEventDispatcher *getInstance();
16+
void add(EventDispatcher *dispatcher);
17+
QVector<EventDispatcher*>& getDispatchers();
18+
19+
private:
20+
static WDEventDispatcher *_instance;
21+
QVector<EventDispatcher*> _dispatchers;
22+
};
23+
24+
#endif // WDEVENTDISPATCHER_H

inc/webdriver_error.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ enum ErrorCode {
3030
kUnexpectedAlertOpen = 26,
3131
kNoAlertOpenError = 27,
3232
kMoveTargetOutOfBounds = 34,
33+
kCommandNotSupported = 50,
3334

3435
// HTTP status codes.
3536
kSeeOther = 303,

src/Test/main.cc

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
#include "extension_qt/widget_view_creator.h"
5050
#include "extension_qt/widget_view_enumerator.h"
5151
#include "extension_qt/widget_view_executor.h"
52+
#include "extension_qt/wd_event_dispatcher.h"
53+
#include "extension_qt/vnc_event_dispatcher.h"
54+
55+
#include "vnc/vncclient.h"
5256

5357
void setQtSettings();
5458
void PrintVersion();
@@ -122,12 +126,26 @@ int main(int argc, char *argv[])
122126
PrintVersion();
123127
return 0;
124128
}
129+
130+
#if defined(OS_WIN)
131+
#if (QT_VERSION == QT_VERSION_CHECK(5, 1, 0))
132+
system("qtenv2.bat vsvars");
133+
#else //QT_VERSION
134+
system("qtvars.bat vsvars");
135+
#endif //QT_VERSION
136+
#endif //OS_WIN
137+
125138
webdriver::Server* wd_server = webdriver::Server::GetInstance();
126139
if (0 != wd_server->Configure(cmd_line)) {
127140
return 1;
128141
}
129142

130-
setQtSettings();
143+
VNCClient *client = new VNCClient();
144+
client->Init("http://127.0.0.1", 5900);
145+
146+
WDEventDispatcher::getInstance()->add(new VNCEventDispatcher(client));
147+
148+
setQtSettings();
131149
wd_server->Start();
132150

133151
return app.exec();

0 commit comments

Comments
 (0)