MCPcopy Create free account
hub / github.com/bumptop/BumpTop / WebActor

Method WebActor

trunk/win/Source/BT_WebActor.cpp:84–134  ·  view source on GitHub ↗

Construct a new instance of WebActor.

Source from the content-addressed store, hash-verified

82
83// Construct a new instance of WebActor.
84WebActor::WebActor()
85: Actor()
86, _glTextureId(0)
87, _glSpinnerTextureId(0)
88, _spinnerAngle(0)
89, _textureDirty(true) // so updateTexture will make the spinner texture
90, _contentSize(winOS->GetWindowWidth(), winOS->GetWindowHeight())
91, _fullBufferSize(winOS->GetWindowWidth(), winOS->GetWindowHeight())
92, _smallBufferSize(winOS->GetWindowWidth() / 2, winOS->GetWindowHeight() / 2)
93, _focused(false)
94, _isPageDataURL(true)
95, _prevMouseDown(NULL)
96, _prevMouseUp(NULL)
97, _singleClickTimer(new PerformanceCounter(false))
98, _javaScriptAPI(NULL)
99, _isDropSourceValid(false)
100, _videoRender(NULL)
101, _mesh(NULL)
102, _autoUpdateTimer(NULL)
103, _autoUpdateTimerDelay(0)
104, _restartAutoUpdateTimerOnUnfocus(false)
105, _flyout(NULL)
106{
107 LOG_FUNCTION_REACHED();
108 pushActorType(Webpage);
109 hideText();
110
111 // give it an html icon by default
112 setTextureID(winOS->GetSystemIconInfo(".html"));
113 setGlobalPosition(Vec3(0, 20, 0));
114 setGlobalOrientation(GLOBAL(straightIconOri));
115 setDimsToDefault();
116
117 _spinnerAngle = rand() % 360;
118 _facebookWidgetDir = ::parent(winOS->GetLanguagesDirectory()) / "Facebook";
119
120 _page.init(_contentSize, true);
121 connect(&_page, SIGNAL(pageUpdate(const QImage&, const QRect&)), this, SLOT(pageUpdated(const QImage&, const QRect&)));
122 // Need to use WebActor::reload to ensure JavaAPI is set correctly after reload
123 connect(_page.getView()->pageAction(QWebPage::Reload), SIGNAL(triggered(bool)), this, SLOT(pageReloaded(bool)));
124
125 updateExpectedSize();
126
127 // setup auto-update (generate a delay of [5m..7m])
128 const int baseDelay = 30 * 60 * 1000; // 30min
129 const int offsetDelay = 30 * 1000; // 30s
130 randomSeed();
131 _autoUpdateTimerDelay = baseDelay + (offsetDelay * randomInt(0, 5));
132 _autoUpdateTimer = new QTimer(this);
133 connect(_autoUpdateTimer, SIGNAL(timeout()), this, SLOT(autoUpdateReloadPage()));
134}
135
136JavaScriptAPI* WebActor::getJavaScriptAPI() {
137 return _javaScriptAPI;

Callers

nothing calls this directly

Calls 13

hideTextFunction · 0.85
randFunction · 0.85
randomSeedFunction · 0.85
randomIntFunction · 0.85
GetWindowWidthMethod · 0.80
GetWindowHeightMethod · 0.80
GetSystemIconInfoMethod · 0.80
GetLanguagesDirectoryMethod · 0.80
getViewMethod · 0.80
parentFunction · 0.70
connectFunction · 0.50
timeoutClass · 0.50

Tested by

no test coverage detected