--- a/ginebra2/ChromeWidget.h Wed Jun 23 17:59:43 2010 +0300
+++ b/ginebra2/ChromeWidget.h Tue Jul 06 14:03:49 2010 +0300
@@ -34,12 +34,13 @@
class MostVisitedPageStore;
class ControllableViewBase;
-class QGraphicsSceneContextMenuEvent;
+
using namespace WRT;
namespace GVA {
class ChromeSnippet;
+ class ChromeLayout;
class ChromeDOM;
class ChromeRenderer;
class GinebraApplication;
@@ -53,32 +54,11 @@
class NetworkDelegate;
class Downloads;
- enum ChromeAnchor
- {
- anchorNone,
- anchorCenter,
- anchorTop,
- anchorBottom,
- anchorLeft,
- anchorRight,
- anchorTopLeft,
- anchorTopRight,
- anchorBottomLeft,
- anchorBottomRight
- };
-
- enum Aspect
- {
- portrait,
- landscape
- };
-
/*!
* \brief This class is responsible for maintaining the browser chrome and
* most of the other major components of the application.
- *
*/
- class ChromeWidget : public QGraphicsWidget
+ class ChromeWidget : public QObject
{
Q_OBJECT
@@ -89,8 +69,10 @@
void setChromeBaseDirectory(const QString dir);
void setChromeFile(const QString file);
void addView(ControllableViewBase * controllableView);
- QGraphicsScene * getScene() { return m_scene; } //NB: change name to scene() !!
- void setScene(QGraphicsScene *scene);
+
+ void addViewToLayout(ControllableViewBase * controllableView);
+ ChromeLayout * layout() { return m_layout; }
+ void setLayout(ChromeLayout * layout) { m_layout = layout; }
ChromeRenderer * renderer() { return m_renderer; }
ChromeDOM * dom() { return m_dom; }
QRect getSnippetRect(const QString &docElementId);
@@ -99,42 +81,33 @@
ControllableViewBase * getView(const QString& name);
void showView(const QString &name);
QWebPage * page() { return m_page; }
- void anchorSnippet(ChromeSnippet * snippet);
//NB: get rid of this (see comment in .cpp)!!!
void adjustAnchorOffset(ChromeSnippet * snippet, qreal delta);
- void anchorToView(ChromeSnippet* snippet, const QString & where = "top");
- void detachFromView(ChromeSnippet* snippet, const QString & where = "top");
void anchorTogether(ChromeSnippet* first, const QString & secondId, qreal x = 0, qreal y = 0);
- void unAnchor(ChromeSnippet* first);
- //void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget* widget = 0);
QGraphicsView *graphicsView() { return m_view; }
void dump();
QString getBaseDirectory() const { return m_baseDirectory; }
ViewController * viewController() { return m_viewController; } // needed for UrlSearchSnippet
QString currentView() {return m_viewController->currentView()->type() ;}
- int bottomBarHeight() { return m_bottomBarHeight;}
void updateChromeLayout();
void sizeChange(QSize sz){ emit prepareForSizeChange(sz) ;}
void emitPopupShown(const QString &popupId);
void emitPopupHidden(const QString &popupId);
public slots:
- int width(){return (int)size().width();}
- void snippetShown(ChromeSnippet * snippet);
- void snippetHiding(ChromeSnippet * snippet);
void loadStarted();
void loadFinished(bool ok);
void exportJSObjects();
void exportJSObjectsToPage(QWebPage *page);
void alert(const QString & msg);
- qreal slideView(qreal delta);
- qreal shrinkView(qreal delta);
void onViewInstantiated(ControllableViewBase *view);
void onCurrentViewChanged();
void chromeInitialized();
void reloadChrome();
void loadUrlToCurrentPage(const QUrl & url);
void pageCreated(WRT::WrtBrowserContainer * page);
+ void onResize(QSizeF size);
+ void onAspectChanged(int aspect);
signals:
void internalChromeComplete();
@@ -150,31 +123,20 @@
public:
Q_PROPERTY(QObjectList snippets READ getSnippets)
QObjectList getSnippets();
- /// \brief Returns either "portrait" or "landscape".
- QString getDisplayMode() const;
- Q_PROPERTY(QString displayMode READ getDisplayMode)
QObject* getDisplaySize() const;
Q_PROPERTY(QObject* displaySize READ getDisplaySize)
- protected:
- virtual void resizeEvent(QGraphicsSceneResizeEvent *ev);
- virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
- //bool eventFilter(QObject *obj, QEvent *ev);
private:
void addSnippet( ChromeSnippet * snippet, const QString & docElementId);
void getInitialSnippets();
void clearChrome();
- void addAnchors();
void addJSObjectToWindow(QObject *object);
void addJSObjectToPage(QObject *object, QWebPage *page);
void updateMVGeometry();
- void addViewToLayout(ControllableViewBase * controllableView);
-
//void addJSObjectToEngine(QObject *object);
- QGraphicsScene * m_scene;
- QGraphicsView *m_view;
- QGraphicsAnchorLayout *m_layout;
+ ChromeLayout * m_layout;
+ QGraphicsView *m_view; //TBD: not used?
QString m_baseDirectory;
QWebPage * m_page;
ChromeRenderer * m_renderer;
@@ -183,21 +145,12 @@
ViewController *m_viewController;
//QList<QObject*> m_jsObjects;
//QScriptEngine m_engine;
- QGraphicsAnchorLayout *m_viewLayout;
- SlidingWidget *m_viewPort;
- QGraphicsWidget *m_topBar;
- QGraphicsWidget *m_bottomBar;
- QGraphicsWidget *m_leftBar;
- QGraphicsWidget *m_rightBar;
- //CollapsingWidget *m_viewBar;
GinebraApplication *m_app;
- Aspect m_aspect;
ChromeWidgetJSObject *m_jsObject;
LocaleDelegate *m_localeDelegate; // Owned
DeviceDelegate *m_deviceDelegate;
NetworkDelegate *m_networkDelegate;
Downloads * m_downloads; // Owned
- int m_bottomBarHeight;
};
} // end of namespace GVA