[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10510: Add Gnash icon to kde4 gui.
From: |
John Wimer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10510: Add Gnash icon to kde4 gui. |
Date: |
Sun, 04 Jan 2009 22:58:31 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10510
committer: John Wimer <address@hidden>
branch nick: trunk
timestamp: Sun 2009-01-04 22:58:31 +0100
message:
Add Gnash icon to kde4 gui.
Add Properties dialog to kde4 gui.
Update moc file with new slot.
modified:
gui/Kde4Gui.cpp
gui/Kde4Gui.h
gui/klash4.moc.in
=== modified file 'gui/Kde4Gui.cpp'
--- a/gui/Kde4Gui.cpp 2008-12-30 12:42:02 +0000
+++ b/gui/Kde4Gui.cpp 2009-01-04 21:58:31 +0000
@@ -37,6 +37,13 @@
#include <QResizeEvent>
#include <QTimer>
#include <QEvent>
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QLayout>
+#include <QPushButton>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QStack>
#include "Range2d.h"
@@ -117,6 +124,7 @@
_drawingWidget->setMouseTracking(true);
_drawingWidget->setFocusPolicy(Qt::StrongFocus);
_window->setWindowTitle(windowtitle);
+ _window->setWindowIcon(QIcon(PKGDATADIR"/GnashG.png"));
if(_xid) {
_drawingWidget->embedInto(_xid);
@@ -368,6 +376,88 @@
resize_view(width, height);
}
+void
+Kde4Gui::showProperties()
+{
+ QDialog* propsDialog = new QDialog(_drawingWidget);
+ propsDialog->setWindowTitle(_("Movie properties"));
+ propsDialog->setAttribute(Qt::WA_DeleteOnClose);
+ propsDialog->resize(500, 300);
+
+ QDialogButtonBox *dialogButtons = new QDialogButtonBox(
+ QDialogButtonBox::Close, Qt::Horizontal, propsDialog);
+ dialogButtons->button(QDialogButtonBox::Close)->setDefault(true);
+
+ QVBoxLayout* layout = new QVBoxLayout(propsDialog);
+ propsDialog->connect(dialogButtons->button(QDialogButtonBox::Close),
+ SIGNAL(clicked()), SLOT(close()));
+
+#ifdef USE_SWFTREE
+ std::auto_ptr<InfoTree> infoptr = getMovieInfo();
+ InfoTree& info = *infoptr;
+
+ QTreeWidget *tree = new QTreeWidget();
+ tree->setColumnCount(2);
+ QStringList treeHeader;
+ treeHeader.append(_("Variable"));
+ treeHeader.append(_("Value"));
+ tree->setHeaderLabels(treeHeader);
+
+ QList<QTreeWidgetItem *> items;
+
+ int prevDepth = 0;
+ QStack<QTreeWidgetItem*> stack;
+ for (InfoTree::iterator i=info.begin(), e=info.end(); i!=e; ++i) {
+ StringPair& p = *i;
+
+ QStringList cols;
+ cols.append(p.first.c_str());
+ cols.append(p.second.c_str());
+ QTreeWidgetItem* item = new QTreeWidgetItem(cols);
+
+ int newDepth = info.depth(i);
+
+ if (newDepth == 0) {
+ // Insert top level entries directly into the tree widget.
+ items.append(item);
+ stack.empty();
+ } else {
+ // The position to insert the new row.
+ QTreeWidgetItem* parent = NULL;
+
+ if (newDepth == prevDepth ) {
+ // Pop an extra time if there is a sibling on the stack.
+ int size = stack.size();
+ if (size + 1 > newDepth)
+ stack.pop();
+
+ parent = stack.pop();
+ } else if (newDepth > prevDepth) {
+ parent = stack.pop();
+ } else if (newDepth < prevDepth) {
+ // Pop until the stack has the right depth.
+ int size = stack.size();
+ for (int j = 0; j < (size + 1) - newDepth; ++j) {
+ parent = stack.pop();
+ }
+ }
+
+ parent->addChild(item);
+ stack.push(parent);
+ }
+
+ stack.push(item);
+ prevDepth = newDepth;
+ }
+ tree->insertTopLevelItems(0, items);
+ layout->addWidget(tree);
+
+#endif // USE_SWFTREE
+ layout->addWidget(dialogButtons);
+
+ propsDialog->show();
+ propsDialog->activateWindow();
+}
void
Kde4Gui::quit()
@@ -381,6 +471,10 @@
{
// File Menu actions
+ propertiesAction = new QAction(_("Properties"), _window.get());
+ _drawingWidget->connect(propertiesAction, SIGNAL(triggered()),
+ _drawingWidget, SLOT(properties()));
+
quitAction = new QAction(_("Quit Gnash"), _window.get());
// This is connected directly to the QApplication's quit() slot
_drawingWidget->connect(quitAction, SIGNAL(triggered()),
@@ -424,6 +518,7 @@
// Set up the File menu.
fileMenu = new QMenu(_("File"), _window.get());
+ fileMenu->addAction(propertiesAction);
fileMenu->addAction(quitAction);
// Set up the Movie Control menu
@@ -566,6 +661,13 @@
void
+DrawingWidget::properties()
+{
+ _gui.showProperties();
+}
+
+
+void
DrawingWidget::play()
{
_gui.play();
=== modified file 'gui/Kde4Gui.h'
--- a/gui/Kde4Gui.h 2008-12-30 12:42:02 +0000
+++ b/gui/Kde4Gui.h 2009-01-04 21:58:31 +0000
@@ -62,6 +62,7 @@
public slots:
+ void properties();
void play();
void pause();
void stop();
@@ -106,6 +107,7 @@
virtual void unsetFullscreen();
void setInvalidatedRegions(const InvalidatedRanges& ranges);
void resize(int width, int height);
+ void showProperties();
void quit();
bool want_multiple_regions() { return true; }
@@ -159,6 +161,7 @@
// File Menu
QMenu* fileMenu;
+ QAction* propertiesAction;
QAction* quitAction;
// Movie Control Menu;
=== modified file 'gui/klash4.moc.in'
--- a/gui/klash4.moc.in 2008-12-04 09:27:57 +0000
+++ b/gui/klash4.moc.in 2009-01-04 21:58:31 +0000
@@ -1,12 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'Kde4Gui.h'
**
-** Created: Thu Dec 4 10:02:08 2008
+** Created: Sun Jan 4 18:31:55 2009
** by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
+#include "Kde4Gui.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'Kde4Gui.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
@@ -22,25 +23,26 @@
1, // revision
0, // classname
0, 0, // classinfo
- 6, 10, // methods
+ 7, 10, // methods
0, 0, // properties
0, 0, // enums/sets
// slots: signature, parameters, type, tag, flags
22, 21, 21, 21, 0x0a,
- 29, 21, 21, 21, 0x0a,
- 37, 21, 21, 21, 0x0a,
- 44, 21, 21, 21, 0x0a,
- 54, 21, 21, 21, 0x0a,
- 71, 64, 21, 21, 0x0a,
+ 35, 21, 21, 21, 0x0a,
+ 42, 21, 21, 21, 0x0a,
+ 50, 21, 21, 21, 0x0a,
+ 57, 21, 21, 21, 0x0a,
+ 67, 21, 21, 21, 0x0a,
+ 84, 77, 21, 21, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_gnash__DrawingWidget[] = {
- "gnash::DrawingWidget\0\0play()\0pause()\0"
- "stop()\0restart()\0refresh()\0isFull\0"
- "fullscreen(bool)\0"
+ "gnash::DrawingWidget\0\0properties()\0"
+ "play()\0pause()\0stop()\0restart()\0"
+ "refresh()\0isFull\0fullscreen(bool)\0"
};
const QMetaObject gnash::DrawingWidget::staticMetaObject = {
@@ -68,14 +70,15 @@
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
- case 0: play(); break;
- case 1: pause(); break;
- case 2: stop(); break;
- case 3: restart(); break;
- case 4: refresh(); break;
- case 5: fullscreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
+ case 0: properties(); break;
+ case 1: play(); break;
+ case 2: pause(); break;
+ case 3: stop(); break;
+ case 4: restart(); break;
+ case 5: refresh(); break;
+ case 6: fullscreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
}
- _id -= 6;
+ _id -= 7;
}
return _id;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10510: Add Gnash icon to kde4 gui.,
John Wimer <=