[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10786: Create a seperate widget tha
From: |
John Wimer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10786: Create a seperate widget that is embedded which contains both the drawing |
Date: |
Mon, 13 Apr 2009 17:08:49 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10786
committer: John Wimer <address@hidden>
branch nick: trunk
timestamp: Mon 2009-04-13 17:08:49 +0200
message:
Create a seperate widget that is embedded which contains both the drawing
area and the click to play button.
modified:
gui/Kde4Gui.cpp
gui/Kde4Gui.h
gui/klash4.moc.in
=== modified file 'gui/Kde4Gui.cpp'
--- a/gui/Kde4Gui.cpp 2009-03-17 12:01:42 +0000
+++ b/gui/Kde4Gui.cpp 2009-04-13 15:08:49 +0000
@@ -95,7 +95,8 @@
_application.reset(new QApplication(*i, r));
_window.reset(new QMainWindow());
- _drawingWidget = new DrawingWidget(*this);
+ _embedWidget = new EmbedWidget(*this);
+ _drawingWidget = _embedWidget->drawingWidget();
_glue.init (argc, argv);
@@ -137,17 +138,16 @@
_window->setWindowIcon(QIcon(PKGDATADIR"/GnashG.png"));
if(_xid) {
- _drawingWidget->embedInto(_xid);
- _drawingWidget->show();
+ _embedWidget->embedInto(_xid);
+ _embedWidget->show();
// Adjust width and height to the window we're being embedded into...
XWindowAttributes winAttributes;
XGetWindowAttributes(QX11Info::display(), _xid, &winAttributes);
_width=winAttributes.width;
_height=winAttributes.height;
- _drawingWidget->resize(_width, _height);
} else {
- // The QMainWindow takes ownership of the DrawingWidget.
- _window->setCentralWidget(_drawingWidget);
+ // The QMainWindow takes ownership of the widgets.
+ _window->setCentralWidget(_embedWidget);
_window->show();
}
@@ -287,9 +287,8 @@
_fullscreen = true;
fullscreenAction->setChecked(_fullscreen);
- // Make the widget a top level window so it can be fullscreen
- _drawingWidget->setWindowFlags(Qt::Window);
- _drawingWidget->showFullScreen();
+ _embedWidget->setWindowFlags(Qt::Window);
+ _embedWidget->showFullScreen();
}
void
@@ -298,18 +297,13 @@
_fullscreen = false;
fullscreenAction->setChecked(_fullscreen);
- if (_drawingWidget->isFullScreen()) {
- // Re-embed the drawing wiget into the browser
+ if (_embedWidget->isFullScreen()) {
+ _embedWidget->setWindowFlags(Qt::Widget);
+ _embedWidget->showNormal();
if (_xid) {
- _drawingWidget->showNormal();
- _drawingWidget->embedInto(_xid);
- }
- else {
- _drawingWidget->setWindowFlags(Qt::Widget);
- _drawingWidget->showNormal();
+ _embedWidget->embedInto(_xid);
}
}
-
}
gnash::key::code
@@ -636,9 +630,54 @@
(Qt::Key_QuoteDbl, gnash::key::DOUBLE_QUOTE);
}
+void
+Kde4Gui::playHook()
+{
+ _embedWidget->hidePlayButton();
+}
+
+void
+Kde4Gui::stopHook()
+{
+ _embedWidget->showPlayButton();
+}
+
+/// EmbedWidget implementation
+
+EmbedWidget::EmbedWidget(Kde4Gui& gui)
+ : QX11EmbedWidget()
+{
+ _drawingWidget = new DrawingWidget(gui);
+ _playButton = new QPushButton(_q("Click to Play"), this);
+
+ QVBoxLayout* layout = new QVBoxLayout(this);
+ layout->setContentsMargins(0,0,0,0);
+ layout->setSpacing(0);
+ layout->addWidget(_playButton);
+ layout->addWidget(_drawingWidget);
+ _playButton->hide();
+
+ connect(_playButton, SIGNAL(clicked()), this, SLOT(hidePlayButton()));
+ connect(_playButton, SIGNAL(clicked()), _drawingWidget, SLOT(play()));
+}
+
+void EmbedWidget::hidePlayButton()
+{
+ _playButton->hide();
+}
+
+void EmbedWidget::showPlayButton()
+{
+ _playButton->show();
+}
/// DrawingWidget implementation
+DrawingWidget::DrawingWidget(Kde4Gui& gui)
+ : _gui(gui)
+{
+}
+
void
DrawingWidget::paintEvent(QPaintEvent *event)
{
=== modified file 'gui/Kde4Gui.h'
--- a/gui/Kde4Gui.h 2009-02-08 21:11:17 +0000
+++ b/gui/Kde4Gui.h 2009-04-13 15:08:49 +0000
@@ -45,6 +45,7 @@
class QSlider;
class QLineEdit;
class QSpinBox;
+class QStackedWidget;
namespace gnash {
class Kde4Gui;
@@ -53,17 +54,12 @@
namespace gnash
{
-class DrawingWidget : public QX11EmbedWidget
+class DrawingWidget : public QWidget
{
Q_OBJECT
public:
- DrawingWidget(Kde4Gui& gui)
- :
- QX11EmbedWidget(),
- _gui(gui)
- {}
-
+ DrawingWidget(Kde4Gui& gui);
~DrawingWidget() {}
public slots:
@@ -95,6 +91,26 @@
};
+class EmbedWidget : public QX11EmbedWidget
+{
+ Q_OBJECT
+
+public:
+ EmbedWidget(Kde4Gui& gui);
+ ~EmbedWidget() {};
+
+ DrawingWidget* drawingWidget() { return _drawingWidget; }
+
+public slots:
+ void hidePlayButton();
+ void showPlayButton();
+
+private:
+ QPushButton* _playButton;
+ DrawingWidget* _drawingWidget;
+};
+
+
class DSOEXPORT Kde4Gui : public Gui
{
@@ -136,12 +152,23 @@
/// Set up the map of Qt to Gnash keys.
void setupKeyMap();
+ /// Called when the movie is stopped. Also called at startup if
+ /// start stopped is configured.
+ void stopHook();
+
+ /// Called when the movie is played.
+ void playHook();
+
+
DrawBounds _drawbounds;
/// The main application, which should destroy everything
/// left on closing.
std::auto_ptr<QApplication> _application;
+ /// The widget that is used for embedding between processes.
+ EmbedWidget* _embedWidget;
+
/// The widget for rendering and handling user events.
//
/// Ownership is transferred to the main window, which
=== modified file 'gui/klash4.moc.in'
--- a/gui/klash4.moc.in 2009-03-19 16:27:50 +0000
+++ b/gui/klash4.moc.in 2009-04-13 15:08:49 +0000
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'Kde4Gui.h'
**
-** Created: Mon Feb 9 08:36:10 2009
+** Created: Sun Apr 12 21:07:39 2009
** by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
**
** WARNING! All changes made in this file will be lost!
@@ -47,7 +47,7 @@
};
const QMetaObject gnash::DrawingWidget::staticMetaObject = {
- { &QX11EmbedWidget::staticMetaObject,
qt_meta_stringdata_gnash__DrawingWidget,
+ { &QWidget::staticMetaObject, qt_meta_stringdata_gnash__DrawingWidget,
qt_meta_data_gnash__DrawingWidget, 0 }
};
@@ -61,12 +61,12 @@
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_gnash__DrawingWidget))
return static_cast<void*>(const_cast< DrawingWidget*>(this));
- return QX11EmbedWidget::qt_metacast(_clname);
+ return QWidget::qt_metacast(_clname);
}
int gnash::DrawingWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
- _id = QX11EmbedWidget::qt_metacall(_c, _id, _a);
+ _id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
@@ -84,6 +84,60 @@
}
return _id;
}
+static const uint qt_meta_data_gnash__EmbedWidget[] = {
+
+ // content:
+ 1, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 2, 10, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+
+ // slots: signature, parameters, type, tag, flags
+ 20, 19, 19, 19, 0x0a,
+ 37, 19, 19, 19, 0x0a,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_gnash__EmbedWidget[] = {
+ "gnash::EmbedWidget\0\0hidePlayButton()\0"
+ "showPlayButton()\0"
+};
+
+const QMetaObject gnash::EmbedWidget::staticMetaObject = {
+ { &QX11EmbedWidget::staticMetaObject,
qt_meta_stringdata_gnash__EmbedWidget,
+ qt_meta_data_gnash__EmbedWidget, 0 }
+};
+
+const QMetaObject *gnash::EmbedWidget::metaObject() const
+{
+ return &staticMetaObject;
+}
+
+void *gnash::EmbedWidget::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_gnash__EmbedWidget))
+ return static_cast<void*>(const_cast< EmbedWidget*>(this));
+ return QX11EmbedWidget::qt_metacast(_clname);
+}
+
+int gnash::EmbedWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QX11EmbedWidget::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: hidePlayButton(); break;
+ case 1: showPlayButton(); break;
+ }
+ _id -= 2;
+ }
+ return _id;
+}
static const uint qt_meta_data_gnash__Kde4GuiPrefs__PreferencesDialog[] = {
// content:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10786: Create a seperate widget that is embedded which contains both the drawing,
John Wimer <=