|
|
@ -16,6 +16,20 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <QtDebug> |
|
|
|
#include <QtDebug> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CREATE_QT_PROPERTY |
|
|
|
|
|
|
|
#define CREATE_QT_PROPERTY(type, name) \ |
|
|
|
|
|
|
|
Q_PROPERTY(type _##name READ name WRITE name USER true) \
|
|
|
|
|
|
|
|
public: \
|
|
|
|
|
|
|
|
void name(const type& v) { \
|
|
|
|
|
|
|
|
_##name = v; \
|
|
|
|
|
|
|
|
} \
|
|
|
|
|
|
|
|
type name() { \
|
|
|
|
|
|
|
|
return _##name; \
|
|
|
|
|
|
|
|
} \
|
|
|
|
|
|
|
|
private: \
|
|
|
|
|
|
|
|
type _##name |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//! @addtogroup qbrowserlib
|
|
|
|
//! @addtogroup qbrowserlib
|
|
|
|
//! @{
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
@ -30,6 +44,8 @@ namespace qbrowserlib { |
|
|
|
|
|
|
|
|
|
|
|
Q_OBJECT; |
|
|
|
Q_OBJECT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE_QT_PROPERTY(QUrl, homeUrl); |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
SwissWebWidget(QWidget* p=0): QWidget(p) { |
|
|
|
SwissWebWidget(QWidget* p=0): QWidget(p) { |
|
|
@ -40,7 +56,7 @@ namespace qbrowserlib { |
|
|
|
moveToMain(qobject_cast<QMainWindow*>(p?p->parentWidget():p)); |
|
|
|
moveToMain(qobject_cast<QMainWindow*>(p?p->parentWidget():p)); |
|
|
|
connects(); |
|
|
|
connects(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//! Moves status widgets to status bar, tool widgets to toolbar
|
|
|
|
//! Moves status widgets to status bar, tool widgets to toolbar
|
|
|
|
/*! You can use this method to reparent the tools and the status
|
|
|
|
/*! You can use this method to reparent the tools and the status
|
|
|
|
part of the widget into the toolbar and statusbar of your |
|
|
|
part of the widget into the toolbar and statusbar of your |
|
|
@ -49,7 +65,7 @@ namespace qbrowserlib { |
|
|
|
@note If used as central widget of a QMainWindow, status and |
|
|
|
@note If used as central widget of a QMainWindow, status and |
|
|
|
tools are automatically reparented in the constructor. */ |
|
|
|
tools are automatically reparented in the constructor. */ |
|
|
|
void moveToMain(QMainWindow* w) { |
|
|
|
void moveToMain(QMainWindow* w) { |
|
|
|
if (!w) return; |
|
|
|
if (!w || !_statusbar || !_tools) return; |
|
|
|
QToolBar* t(w->addToolBar(trUtf8("Browser Tools", |
|
|
|
QToolBar* t(w->addToolBar(trUtf8("Browser Tools", |
|
|
|
"name of the browser's toolbar"))); |
|
|
|
"name of the browser's toolbar"))); |
|
|
|
while (_tools->count()) |
|
|
|
while (_tools->count()) |
|
|
@ -66,11 +82,16 @@ namespace qbrowserlib { |
|
|
|
void load() { |
|
|
|
void load() { |
|
|
|
_webview->load(_url->text()); |
|
|
|
_webview->load(_url->text()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void goHome() { |
|
|
|
|
|
|
|
_webview->load(_homeUrl); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
|
|
void connects() { |
|
|
|
void connects() { |
|
|
|
connect(_url, SIGNAL(returnPressed()), SLOT(load())); |
|
|
|
connect(_url, SIGNAL(returnPressed()), SLOT(load())); |
|
|
|
|
|
|
|
connect(_home, SIGNAL(pressed()), SLOT(goHome())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|