change app background
authorMjolnir <thomas.pietrzak@inria.fr>
Mon, 14 Sep 2015 08:51:39 +0000 (10:51 +0200)
committerMjolnir <thomas.pietrzak@inria.fr>
Mon, 14 Sep 2015 08:51:39 +0000 (10:51 +0200)
LivingDemos/Force.cpp
LivingDemos/Force.h
LivingDemos/Tidy.cpp
LivingDemos/Tidy.h

index c15f723784566f40c071973c994b57b13e35e9db..80bcb9eff86bfe51e61f77672ae87e91c7bee0c3 100644 (file)
@@ -6,7 +6,8 @@
 Force::Force(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::Fullscreen),
-    _origin(false)
+    _origin(false),
+    _window(NULL)
 {
     ui->setupUi(this);
     setWindowState(Qt::WindowMaximized);
@@ -18,6 +19,9 @@ Force::Force(QWidget *parent) :
     ui->image->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
     connect(ui->start, SIGNAL(clicked()), this, SLOT(moveMouse()));
+    connect(ui->appbutton1, SIGNAL(clicked()), this, SLOT(setupPresentation()));
+    connect(ui->appbutton2, SIGNAL(clicked()), this, SLOT(setupCalendar()));
+    connect(ui->appbutton3, SIGNAL(clicked()), this, SLOT(setupEmails()));
 
     MenuPrincipal * menu = dynamic_cast<MenuPrincipal *>(parent);
     if (!menu->getMouse())
@@ -44,3 +48,30 @@ void Force::moveMouse()
         _origin = !_origin;
     }
 }
+
+void Force::setupEmails()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/emailapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
+
+void Force::setupPresentation()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/presentationapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
+
+void Force::setupCalendar()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/calendarapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
index 8c6941781af349505aef50297293be4b9ecdb289..58ddca67ec593bbc9c159673632fd0376c79dbc3 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <QGraphicsScene>
 
+#include <QGraphicsPixmapItem>
 #include <ui_fullscreen.h>
 
 namespace Ui {
@@ -21,11 +22,15 @@ class Force : public QMainWindow
 
     private slots:
         void moveMouse();
+        void setupEmails();
+        void setupPresentation();
+        void setupCalendar();
 
     private:
         Ui::Fullscreen *ui;
         QGraphicsScene _background;
         bool _origin;
+        QGraphicsPixmapItem *_window;
 };
 
 #endif // FORCE_H
index 3ce922056d7addb847d3bc42128563114b24e41d..2bb50f6ab103a2d974f06a268ead6351e836cb11 100644 (file)
@@ -6,7 +6,8 @@
 
 Tidy::Tidy(QWidget *parent) :
     QMainWindow(parent),
-    ui(new Ui::Fullscreen)
+    ui(new Ui::Fullscreen),
+    _window(NULL)
 {
     ui->setupUi(this);
     setWindowState(Qt::WindowMaximized);
@@ -18,6 +19,9 @@ Tidy::Tidy(QWidget *parent) :
     ui->image->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
     connect(ui->start, SIGNAL(clicked()), this, SLOT(moveDevices()));
+    connect(ui->appbutton1, SIGNAL(clicked()), this, SLOT(setupPresentation()));
+    connect(ui->appbutton2, SIGNAL(clicked()), this, SLOT(setupCalendar()));
+    connect(ui->appbutton3, SIGNAL(clicked()), this, SLOT(setupEmails()));
 
     MenuPrincipal * menu = dynamic_cast<MenuPrincipal *>(parent);
     if (!menu->getMouse())
@@ -39,3 +43,30 @@ void Tidy::moveDevices()
     if (menu->getKeyboard())
         menu->getKeyboard()->translation(LivingKeyboard::FORWARD, 100);
 }
+
+void Tidy::setupEmails()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/emailapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
+
+void Tidy::setupPresentation()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/presentationapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
+
+void Tidy::setupCalendar()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/calendarapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
index 8e9d702cc30aa1cc674adba2a64dc7112387f38a..10c19dcf1a04cd1eff91ed3407127eb76a1edb7e 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <QMainWindow>
 #include <QGraphicsScene>
+#include <QGraphicsPixmapItem>
 
 #include <ui_fullscreen.h>
 
@@ -20,10 +21,14 @@ class Tidy : public QMainWindow
 
     public slots:
         void moveDevices();
+        void setupEmails();
+        void setupPresentation();
+        void setupCalendar();
 
     private:
         Ui::Fullscreen *ui;
         QGraphicsScene _background;
+        QGraphicsPixmapItem *_window;
 };
 
 #endif // TIDY_H