Add a visualisation config menu

This commit is contained in:
David Sansome 2010-06-06 22:28:24 +00:00
parent 038c7b1bbf
commit 6e81289ea2
33 changed files with 587 additions and 2 deletions

View File

@ -178,5 +178,8 @@
<file>schema-10.sql</file>
<file>schema-11.sql</file>
<file>osd_background.png</file>
<file>icons/22x22/view-fullscreen.png</file>
<file>icons/32x32/view-fullscreen.png</file>
<file>icons/48x48/view-fullscreen.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

View File

@ -1212,6 +1212,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1218,6 +1218,27 @@ msgstr "Vyber barvu..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1221,6 +1221,27 @@ msgstr "Vælg farve..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1221,6 +1221,27 @@ msgstr "Farbe wählen..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1222,6 +1222,27 @@ msgstr "Επέλεξε χρώμα..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1216,6 +1216,27 @@ msgstr "Choose colour..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1228,6 +1228,27 @@ msgstr "Elegir color..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1212,6 +1212,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1226,6 +1226,27 @@ msgstr "Choisir une couleur..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1214,6 +1214,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1225,6 +1225,27 @@ msgstr "Scegli colore..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1214,6 +1214,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1218,6 +1218,27 @@ msgstr "Velg farge..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1212,6 +1212,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1216,6 +1216,27 @@ msgstr "Wybierz kolor..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1219,6 +1219,27 @@ msgstr "Escolher a cor.."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1212,6 +1212,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1213,6 +1213,27 @@ msgstr "Alege culoare..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1219,6 +1219,27 @@ msgstr "Выберете цвет"
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1220,6 +1220,27 @@ msgstr "Vybrať farbu..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1221,6 +1221,27 @@ msgstr "Välj färg..."
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1212,6 +1212,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1203,6 +1203,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -1212,6 +1212,27 @@ msgstr ""
msgid "Clementine Visualisation"
msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Framerate"
msgstr ""
msgid "Low (15 fps)"
msgstr ""
msgid "Medium (25 fps)"
msgstr ""
msgid "High (35 fps)"
msgstr ""
msgid "Super high (60 fps)"
msgstr ""
msgid "Close visualisation"
msgstr ""
msgid "Visualisations Settings"
msgstr ""

View File

@ -23,7 +23,7 @@
#include <QGLWidget>
#include <QGraphicsView>
#include <libprojectM/projectM.hpp>
#include <projectM.hpp>
#include <GL/gl.h>
ProjectMVisualisation::ProjectMVisualisation(QObject *parent)

View File

@ -18,12 +18,15 @@
#include "visualisationcontainer.h"
#include "visualisationoverlay.h"
#include "engines/gstengine.h"
#include "ui/iconloader.h"
#include <QHBoxLayout>
#include <QSettings>
#include <QGLWidget>
#include <QtDebug>
#include <QGraphicsProxyWidget>
#include <QMenu>
#include <QSignalMapper>
#include <QLabel>
@ -37,6 +40,7 @@ VisualisationContainer::VisualisationContainer(QWidget *parent)
engine_(NULL),
vis_(new ProjectMVisualisation(this)),
overlay_(new VisualisationOverlay),
menu_(new QMenu(this)),
fps_(kDefaultFps)
{
setWindowTitle(tr("Clementine Visualisation"));
@ -52,6 +56,7 @@ VisualisationContainer::VisualisationContainer(QWidget *parent)
// Add the overlay
overlay_proxy_ = scene()->addWidget(overlay_);
connect(overlay_, SIGNAL(OpacityChanged(qreal)), SLOT(ChangeOverlayOpacity(qreal)));
connect(overlay_, SIGNAL(ShowPopupMenu(QPoint)), SLOT(ShowPopupMenu(QPoint)));
ChangeOverlayOpacity(0.0);
// Load settings
@ -63,6 +68,33 @@ VisualisationContainer::VisualisationContainer(QWidget *parent)
fps_ = s.value("fps", kDefaultFps).toInt();
SizeChanged();
// Settings menu
menu_->addAction(IconLoader::Load("view-fullscreen"), tr("Toggle fullscreen"),
this, SLOT(ToggleFullscreen()));
QMenu* fps_menu = menu_->addMenu(tr("Framerate"));
QSignalMapper* fps_mapper = new QSignalMapper(this);
QActionGroup* fps_group = new QActionGroup(this);
AddMenuItem(tr("Low (15 fps)"), 15, fps_, fps_group, fps_mapper);
AddMenuItem(tr("Medium (25 fps)"), 25, fps_, fps_group, fps_mapper);
AddMenuItem(tr("High (35 fps)"), 35, fps_, fps_group, fps_mapper);
AddMenuItem(tr("Super high (60 fps)"), 60, fps_, fps_group, fps_mapper);
fps_menu->addActions(fps_group->actions());
connect(fps_mapper, SIGNAL(mapped(int)), SLOT(SetFps(int)));
menu_->addSeparator();
menu_->addAction(IconLoader::Load("application-exit"), tr("Close visualisation"),
this, SLOT(hide()));
}
void VisualisationContainer::AddMenuItem(const QString &name, int value, int def,
QActionGroup* group, QSignalMapper *mapper) {
QAction* action = group->addAction(name);
action->setCheckable(true);
action->setChecked(value == def);
mapper->setMapping(action, value);
connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
}
void VisualisationContainer::SetEngine(GstEngine* engine) {
@ -127,6 +159,12 @@ void VisualisationContainer::Stopped() {
void VisualisationContainer::ChangeOverlayOpacity(qreal value) {
overlay_proxy_->setOpacity(value);
// Hide the cursor if the overlay is hidden
if (value < 0.5)
setCursor(Qt::BlankCursor);
else
unsetCursor();
}
void VisualisationContainer::enterEvent(QEvent* e) {
@ -146,5 +184,30 @@ void VisualisationContainer::mouseMoveEvent(QMouseEvent* e) {
void VisualisationContainer::mouseDoubleClickEvent(QMouseEvent* e) {
QGraphicsView::mouseDoubleClickEvent(e);
ToggleFullscreen();
}
void VisualisationContainer::contextMenuEvent(QContextMenuEvent *event) {
QGraphicsView::contextMenuEvent(event);
ShowPopupMenu(event->pos());
}
void VisualisationContainer::ToggleFullscreen() {
setWindowState(windowState() ^ Qt::WindowFullScreen);
}
void VisualisationContainer::SetFps(int fps) {
fps_ = fps;
// Save settings
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("fps", fps_);
update_timer_.stop();
update_timer_.start(1000 / fps_, this);
}
void VisualisationContainer::ShowPopupMenu(const QPoint &pos) {
menu_->popup(mapToGlobal(pos));
}

View File

@ -26,6 +26,10 @@ class GstEngine;
class ProjectMVisualisation;
class VisualisationOverlay;
class QMenu;
class QSignalMapper;
class QActionGroup;
class VisualisationContainer : public QGraphicsView {
Q_OBJECT
@ -55,12 +59,18 @@ protected:
void enterEvent(QEvent* e);
void leaveEvent(QEvent* e);
void mouseDoubleClickEvent(QMouseEvent* e);
void contextMenuEvent(QContextMenuEvent *event);
private:
void SizeChanged();
void AddMenuItem(const QString& name, int value, int def,
QActionGroup* group, QSignalMapper* mapper);
private slots:
void ChangeOverlayOpacity(qreal value);
void ShowPopupMenu(const QPoint& pos);
void ToggleFullscreen();
void SetFps(int fps);
private:
GstEngine* engine_;
@ -70,6 +80,8 @@ private:
QGraphicsProxyWidget* overlay_proxy_;
QMenu* menu_;
int fps_;
};

View File

@ -61,7 +61,7 @@ void VisualisationOverlay::SetActions(QAction* previous, QAction* play_pause,
}
void VisualisationOverlay::ShowSettingsMenu() {
emit ShowPopupMenu(ui_->settings->mapToGlobal(ui_->settings->rect().bottomLeft()));
}
void VisualisationOverlay::timerEvent(QTimerEvent* e) {
@ -73,10 +73,12 @@ void VisualisationOverlay::timerEvent(QTimerEvent* e) {
}
void VisualisationOverlay::SetVisible(bool visible) {
// If we're showing the overlay, then fade out again in a little while
fade_out_timeout_.stop();
if (visible)
fade_out_timeout_.start(kFadeTimeout, this);
// Don't change to the state we're in already
if (visible == visible_)
return;
visible_ = visible;

View File

@ -45,6 +45,7 @@ public slots:
signals:
void OpacityChanged(qreal value);
void ShowPopupMenu(const QPoint& pos);
protected:
// QWidget