From: Stefan Bund Date: Tue, 25 Jan 2011 14:01:35 +0000 (+0100) Subject: add QWebInspector and debug config option X-Git-Url: http://g0dil.de/git?p=pykit.git;a=commitdiff_plain;h=13e3625a86aaba79be17e62acb4ee46a8d682ea3 add QWebInspector and debug config option --- diff --git a/Viewer.cc b/Viewer.cc index 56708ee..46b8419 100644 --- a/Viewer.cc +++ b/Viewer.cc @@ -18,6 +18,7 @@ #endif #include #include +#include //#include "Viewer.mpp" #define prefix_ @@ -104,6 +105,14 @@ prefix_ pykit::Viewer::Viewer(QUrl const & url, Publisher * publisher, QWidget * #endif connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SLOT(printRequested())); load(url); + inspector_ = new QWebInspector(); + inspector_->setPage(page()); +} + +prefix_ pykit::Viewer::~Viewer() +{ + if (inspector_) + delete inspector_; } prefix_ void pykit::Viewer::printRequested() diff --git a/Viewer.hh b/Viewer.hh index 3634e25..e7bed7a 100644 --- a/Viewer.hh +++ b/Viewer.hh @@ -16,6 +16,8 @@ //#include "Viewer.mpp" ///////////////////////////////hh.p//////////////////////////////////////// +class QWebInspector; + namespace pykit { class Publisher; @@ -26,9 +28,13 @@ namespace pykit { Q_OBJECT; public: Viewer(QUrl const & url, Publisher * publisher, QWidget * parent = 0); + ~Viewer(); private slots: void printRequested(); + + private: + QWebInspector * inspector_; }; } diff --git a/main.cc b/main.cc index e6c4f27..c4d4910 100644 --- a/main.cc +++ b/main.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "MainWindow.hh" #include "PythonPublisher.hh" @@ -90,6 +91,10 @@ int main(int argc, char *argv[]) QString url (settings.value("home").toString()); if (arguments.size()>1) url = arguments.at(1); + + if (settings.value("debug").toBool()) + QWebSettings::globalSettings()->setAttribute( + QWebSettings::DeveloperExtrasEnabled, true); pykit::MainWindow window (QUrl(url), &publisher); window.setWindowTitle(app.applicationName()); if (!iconPath.isEmpty()) diff --git a/pykit.ini b/pykit.ini index ef666df..5d20f62 100644 --- a/pykit.ini +++ b/pykit.ini @@ -4,5 +4,5 @@ version=0.1 organization=g0dil.de [Viewer] -init=init.py home=http://pykit/ +debug=true \ No newline at end of file