From 6e81289ea225f0c85ad1639fb4baaf8954f7f1fc Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 6 Jun 2010 22:28:24 +0000 Subject: [PATCH] Add a visualisation config menu --- data/data.qrc | 3 + data/icons/22x22/view-fullscreen.png | Bin 0 -> 381 bytes data/icons/32x32/view-fullscreen.png | Bin 0 -> 472 bytes data/icons/48x48/view-fullscreen.png | Bin 0 -> 883 bytes src/translations/ar.po | 21 ++++++ src/translations/cs.po | 21 ++++++ src/translations/da.po | 21 ++++++ src/translations/de.po | 21 ++++++ src/translations/el.po | 21 ++++++ src/translations/en_GB.po | 21 ++++++ src/translations/es.po | 21 ++++++ src/translations/fi.po | 21 ++++++ src/translations/fr.po | 21 ++++++ src/translations/gl.po | 21 ++++++ src/translations/it.po | 21 ++++++ src/translations/kk.po | 21 ++++++ src/translations/nb.po | 21 ++++++ src/translations/oc.po | 21 ++++++ src/translations/pl.po | 21 ++++++ src/translations/pt.po | 21 ++++++ src/translations/pt_BR.po | 21 ++++++ src/translations/ro.po | 21 ++++++ src/translations/ru.po | 21 ++++++ src/translations/sk.po | 21 ++++++ src/translations/sv.po | 21 ++++++ src/translations/tr.po | 21 ++++++ src/translations/translations.pot | 21 ++++++ src/translations/zh_TW.po | 21 ++++++ src/visualisations/projectmvisualisation.cpp | 2 +- src/visualisations/visualisationcontainer.cpp | 63 ++++++++++++++++++ src/visualisations/visualisationcontainer.h | 12 ++++ src/visualisations/visualisationoverlay.cpp | 4 +- src/visualisations/visualisationoverlay.h | 1 + 33 files changed, 587 insertions(+), 2 deletions(-) create mode 100644 data/icons/22x22/view-fullscreen.png create mode 100644 data/icons/32x32/view-fullscreen.png create mode 100644 data/icons/48x48/view-fullscreen.png diff --git a/data/data.qrc b/data/data.qrc index 678ca3f57..16a83af2b 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -178,5 +178,8 @@ schema-10.sql schema-11.sql osd_background.png + icons/22x22/view-fullscreen.png + icons/32x32/view-fullscreen.png + icons/48x48/view-fullscreen.png diff --git a/data/icons/22x22/view-fullscreen.png b/data/icons/22x22/view-fullscreen.png new file mode 100644 index 0000000000000000000000000000000000000000..ceda8189fb647c66682fa85b2e33e8271f9d5b93 GIT binary patch literal 381 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EW)6jKx9jP7LeL$-D$|I14-?i-C%- zgD|6$#_S59AbW|YuPgfv9vKmJrJp<}LF&Q-d_r7-G#dE!?b|L^){`esopyFU>+OC1 z{KYFtNms94zjf=*?b~U!|t;e!W{p3Ir^g3l_Y1@$%ifcVE7I{dVu( zpU|?E?+$}p`lNYZP2GOuw~lvfzLj*$D|O;2FL&@+vzc3B zb+1HBTI@NY>#MGNsAhNGT6=!lY>n#I;j=Cs(C`nA`@>uqst~+)YH}MWJUm_fT-G@y GGywpb^PA@Y literal 0 HcmV?d00001 diff --git a/data/icons/32x32/view-fullscreen.png b/data/icons/32x32/view-fullscreen.png new file mode 100644 index 0000000000000000000000000000000000000000..e7758fe2b3a29e9231e3cb1144b3790eb89f97e1 GIT binary patch literal 472 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|I14-?i-C%- zgD|6$#_S59AbW|YuPgfv9$7wK-St-^Cj*5_1AIbUfiyDs@#DwNojdn4Gapw{I(hQc znKS3kIXIkma=LKg(v>UMt|unmxN+-tLBSmmxOe~lgZuX%K79E2(W56%o;-avXU?-{ zFP<-0@N)U`moHzve*Na{+jsBYefWO={?DI3|9t-Z_wV0-fByXc|9_&@^wU6F*-C=^ zf*FJijf}tT_Kpt#iZCX5ySu1Gam?5X);l4Y`B(c&Mas0@8;lmNm;9~W zX&EDa!uG;)h35`_llF1{GJE;{U|i3QFZ(NJ>i@hIo5)=sc@z}Xp00i_>zopr07UTE An*aa+ literal 0 HcmV?d00001 diff --git a/data/icons/48x48/view-fullscreen.png b/data/icons/48x48/view-fullscreen.png new file mode 100644 index 0000000000000000000000000000000000000000..aed8fc369e45bb04498780678b01ac5a667821ea GIT binary patch literal 883 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sjKx9jP7LeL$-D$|I14-?iy0WW z5`sf4IXI$V{?UtSw=uT3IRSLu0SbD06!SKdGluP-o5*onfJ4> z?BBotAQ#smUfx584j+}0Iw~!FOkVz&g2FLH#p5a}Cr+F^b?Wq)Gw06P*ql3e;k=X6 zg$tK1UAl55BI0UfD;+5SFe7#cJ15UyWj5J`~Kj; zkB1L`{`~pp&!7MQ{{8>|zx0IOHDCZqlmz(&GcYnSv#@e;^YE%`Xlm)`8X23In%UYt zVqM?R3RJ_GEaktaqH>SlR->|BCfNKNzN&#;W+iAqw7*nm%`!& z9UTiyw0{2If5B$6ht|Qah^NPbujUuNx81$2>!bLLbDX|&)b9H44&PenE7|t)p2Dr1 zGnPD;o%7b4?o{?(mbh+0&A*p_->T_1Th^a6;+lT_ZQ1XCL2SkUj1=cu{Z`Qh3eTKi zbsrdP-X{~z#j728eDUqw9X!ttr5@U7=F^dNxWzel#)kF0!e1ogEjGRS_T77To@`+g zE5pNxwd>`+XKyrMh?o<=e&l-4+h{w7S921QgEHet!KE*4By4`JC)c1|PnA+~m$;+>?6gGe65h#)aD3!ll9$GdP@>Gzmvv4FO#p?PhwA_U literal 0 HcmV?d00001 diff --git a/src/translations/ar.po b/src/translations/ar.po index 4cc99a2e8..a9bfe7f23 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -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 "" diff --git a/src/translations/cs.po b/src/translations/cs.po index 4367dd25d..ebe61d73d 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -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 "" diff --git a/src/translations/da.po b/src/translations/da.po index 61cd3f090..ac1abb3e2 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -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 "" diff --git a/src/translations/de.po b/src/translations/de.po index 5154129bc..8eaf90f82 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -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 "" diff --git a/src/translations/el.po b/src/translations/el.po index 8d48b7062..10851e433 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -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 "" diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index 3f56f700e..70676d79a 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -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 "" diff --git a/src/translations/es.po b/src/translations/es.po index cf95da225..b7f827060 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -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 "" diff --git a/src/translations/fi.po b/src/translations/fi.po index 2e24601cd..698c899a1 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -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 "" diff --git a/src/translations/fr.po b/src/translations/fr.po index f54485dd2..de04c7fc3 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -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 "" diff --git a/src/translations/gl.po b/src/translations/gl.po index a1a046240..6a2af53a2 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -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 "" diff --git a/src/translations/it.po b/src/translations/it.po index 3692aea27..104fc37f7 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -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 "" diff --git a/src/translations/kk.po b/src/translations/kk.po index 12a2ac971..8169066c3 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -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 "" diff --git a/src/translations/nb.po b/src/translations/nb.po index 4bb70c908..4083a9613 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -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 "" diff --git a/src/translations/oc.po b/src/translations/oc.po index 0b42df92e..bb5779fd8 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -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 "" diff --git a/src/translations/pl.po b/src/translations/pl.po index 6c64e88a4..2416a44ac 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -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 "" diff --git a/src/translations/pt.po b/src/translations/pt.po index 939e85b20..9dfe1be27 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -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 "" diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index ac2fe17e8..31659627b 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -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 "" diff --git a/src/translations/ro.po b/src/translations/ro.po index 58ebcec2b..19094c16f 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -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 "" diff --git a/src/translations/ru.po b/src/translations/ru.po index 38bdfa50f..e864ee06f 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -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 "" diff --git a/src/translations/sk.po b/src/translations/sk.po index 5f1553536..2fb6d4bc9 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -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 "" diff --git a/src/translations/sv.po b/src/translations/sv.po index ae2df58f3..34892f618 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -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 "" diff --git a/src/translations/tr.po b/src/translations/tr.po index 17f6ec0fa..4025d0875 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -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 "" diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 60afddc61..dc99bc5c1 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -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 "" diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index cf8efbae4..78cf45b95 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -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 "" diff --git a/src/visualisations/projectmvisualisation.cpp b/src/visualisations/projectmvisualisation.cpp index 977b5ebe4..7f584e0e4 100644 --- a/src/visualisations/projectmvisualisation.cpp +++ b/src/visualisations/projectmvisualisation.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include ProjectMVisualisation::ProjectMVisualisation(QObject *parent) diff --git a/src/visualisations/visualisationcontainer.cpp b/src/visualisations/visualisationcontainer.cpp index 32decee16..55e02f68c 100644 --- a/src/visualisations/visualisationcontainer.cpp +++ b/src/visualisations/visualisationcontainer.cpp @@ -18,12 +18,15 @@ #include "visualisationcontainer.h" #include "visualisationoverlay.h" #include "engines/gstengine.h" +#include "ui/iconloader.h" #include #include #include #include #include +#include +#include #include @@ -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)); +} diff --git a/src/visualisations/visualisationcontainer.h b/src/visualisations/visualisationcontainer.h index cc5159494..c3084b38b 100644 --- a/src/visualisations/visualisationcontainer.h +++ b/src/visualisations/visualisationcontainer.h @@ -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_; }; diff --git a/src/visualisations/visualisationoverlay.cpp b/src/visualisations/visualisationoverlay.cpp index 57ed6b9cc..3b4baeb0e 100644 --- a/src/visualisations/visualisationoverlay.cpp +++ b/src/visualisations/visualisationoverlay.cpp @@ -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; diff --git a/src/visualisations/visualisationoverlay.h b/src/visualisations/visualisationoverlay.h index 5276c8691..6a9ee1d58 100644 --- a/src/visualisations/visualisationoverlay.h +++ b/src/visualisations/visualisationoverlay.h @@ -45,6 +45,7 @@ public slots: signals: void OpacityChanged(qreal value); + void ShowPopupMenu(const QPoint& pos); protected: // QWidget