summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-03 17:59:48 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-03 17:59:48 (GMT)
commitc60720c32c4b6e8745ae4ec8eead825a06a93555 (patch)
tree8e467c1fb561a90bcbfacb7c5d31e96a9aee5d2c /Swift
parenta487e087022105ae82a1e30abf70bfcc4e6b8281 (diff)
downloadswift-c60720c32c4b6e8745ae4ec8eead825a06a93555.zip
swift-c60720c32c4b6e8745ae4ec8eead825a06a93555.tar.bz2
Make the webkit view loads synchronous.
Hopefully Resolves: #589
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtChatView.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index eea18f7..1ad274f 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -7,6 +7,7 @@
#include "QtChatView.h"
#include <QtDebug>
+#include <QEventLoop>
#include <QFile>
#include <QDesktopServices>
#include <QVBoxLayout>
@@ -163,7 +164,16 @@ void QtChatView::resetView() {
pageHTML.replace(pageHTML.indexOf("%@"), 2, "Variants/Blue on Green.css");
pageHTML.replace(pageHTML.indexOf("%@"), 2, ""/*headerSnippet.getContent()*/);
pageHTML.replace(pageHTML.indexOf("%@"), 2, ""/*footerSnippet.getContent()*/);
+ QEventLoop syncLoop;
+ connect(webView_, SIGNAL(loadFinished(bool)), &syncLoop, SLOT(quit()));
webPage_->mainFrame()->setHtml(pageHTML);
+ while (!viewReady_) {
+ QTimer t;
+ t.setSingleShot(true);
+ connect(&t, SIGNAL(timeout()), &syncLoop, SLOT(quit()));
+ t.start(50);
+ syncLoop.exec();
+ }
document_ = webPage_->mainFrame()->documentElement();
QWebElement chatElement = document_.findFirst("#Chat");
newInsertPoint_ = chatElement.clone();