summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-09-14 20:55:23 (GMT)
committerSwift Review <review@swift.im>2013-09-16 17:57:45 (GMT)
commit10f91c4973c8d464b06149525c6eb7be979453f9 (patch)
tree164873da2d5766f75c51db5748e2152ad4591ba4
parentb1d6c4a6f8aaedcb69ed111dff87cba87ccc96cc (diff)
downloadswift-10f91c4973c8d464b06149525c6eb7be979453f9.zip
swift-10f91c4973c8d464b06149525c6eb7be979453f9.tar.bz2
Enable WebKit's Inspector if Swift is run in debug mode.
Change-Id: I758eb9e7df06887e9946d2a1fa56efed41796bb6 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
-rw-r--r--Swift/QtUI/QtChatView.cpp4
-rw-r--r--Swift/QtUI/QtWebView.cpp4
2 files changed, 7 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index 2536d39..31b9915 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -58,7 +58,9 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent, bool disableAutoScro
webPage_ = new QWebPage(this);
webPage_->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
- //webPage_->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ if (Log::getLogLevel() == Log::debug) {
+ webPage_->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ }
webView_->setPage(webPage_);
connect(webPage_, SIGNAL(selectionChanged()), SLOT(copySelectionToClipboard()));
connect(webPage_, SIGNAL(scrollRequested(int, int, const QRect&)), SLOT(handleScrollRequested(int, int, const QRect&)));
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index 1222ee2..33fa817 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -11,6 +11,7 @@
#include <QFocusEvent>
#include <boost/numeric/conversion/cast.hpp>
#include <QMenu>
+#include <Swiften/Base/Log.h>
namespace Swift {
QtWebView::QtWebView(QWidget* parent) : QWebView(parent), fontSizeIsMinimal(false) {
@@ -18,6 +19,9 @@ QtWebView::QtWebView(QWidget* parent) : QWebView(parent), fontSizeIsMinimal(fals
filteredActions.push_back(QWebPage::CopyLinkToClipboard);
filteredActions.push_back(QWebPage::CopyImageToClipboard);
filteredActions.push_back(QWebPage::Copy);
+ if (Log::getLogLevel() == Log::debug) {
+ filteredActions.push_back(QWebPage::InspectElement);
+ }
}
void QtWebView::keyPressEvent(QKeyEvent* event) {