rotating screen sceenarios
authorMjolnir <thomas.pietrzak@inria.fr>
Wed, 9 Sep 2015 15:59:49 +0000 (17:59 +0200)
committerMjolnir <thomas.pietrzak@inria.fr>
Wed, 9 Sep 2015 15:59:49 +0000 (17:59 +0200)
16 files changed:
LivingDemos/LivingDemos.pro
LivingDemos/MenuPrincipal.cpp
LivingDemos/MenuPrincipal.h
LivingDemos/ScreenRotate.cpp
LivingDemos/ScreenRotate.h
LivingDemos/fullscreen.ui
LivingDemos/menuprincipal.ui
images/barbuttons.png [new file with mode: 0644]
images/calendar.png [new file with mode: 0644]
images/calendarapp.png [new file with mode: 0644]
images/email.png [new file with mode: 0644]
images/emailapp.png [new file with mode: 0644]
images/login.png [new file with mode: 0644]
images/presentation.png [new file with mode: 0644]
images/presentationapp.png [new file with mode: 0644]
images/start.png [new file with mode: 0644]

index d63a1292131890cfde6b21e195a8e9b4eb7c76d5..fa8765d60e8ad90916c833347dcbb92f35267268 100644 (file)
@@ -29,7 +29,8 @@ SOURCES += main.cpp\
     Force.cpp \
     GestureOutput.cpp \
     Peephole.cpp \
-    LargeView.cpp
+    LargeView.cpp \
+    ScreenRotate.cpp
 
 HEADERS  += MenuPrincipal.h \
     Options.h \
@@ -37,7 +38,8 @@ HEADERS  += MenuPrincipal.h \
     Force.h \
     GestureOutput.h \
     Peephole.h \
-    LargeView.h
+    LargeView.h \
+    ScreenRotate.h
 
 FORMS    += menuprincipal.ui \
     options.ui \
index a61de3d8c4ca197f480b506f85e2fd003968ec5c..98cd6dc9e658db40f872045a143ce2be9bbb1cea 100644 (file)
@@ -2,12 +2,13 @@
 #include "ui_menuprincipal.h"
 
 #include <QDebug>
+#include <QTimer>
 
 #include <Tidy.h>
 #include <Force.h>
 #include <GestureOutput.h>
 #include <Peephole.h>
-#include <QTimer>
+#include <ScreenRotate.h>
 
 MenuPrincipal::MenuPrincipal(QWidget *parent) :
     QMainWindow(parent),
@@ -26,6 +27,7 @@ MenuPrincipal::MenuPrincipal(QWidget *parent) :
     connect(ui->force, SIGNAL(clicked()), this, SLOT(openForce()));
     connect(ui->gestureoutput, SIGNAL(clicked()), this, SLOT(openGestureOutput()));
     connect(ui->peephole, SIGNAL(clicked()), this, SLOT(openPeephole()));
+    connect(ui->screenrotate, SIGNAL(clicked()), this, SLOT(openScreenRotate()));
 
 
     connectKeyboard();
@@ -180,13 +182,19 @@ void MenuPrincipal::openForce()
 
 void MenuPrincipal::openGestureOutput()
 {
-    GestureOutput * g= new GestureOutput(this);
+    GestureOutput *g= new GestureOutput(this);
     g->show();
 }
 
 void MenuPrincipal::openPeephole()
 {
-    Peephole * p= new Peephole(this);
+    Peephole *p= new Peephole(this);
     p->show();
     QTimer::singleShot(Peephole::updatedelay, p, SLOT(updatescreenpos()));
 }
+
+void MenuPrincipal::openScreenRotate()
+{
+    ScreenRotate *s = new ScreenRotate(this);
+    s->show();
+}
index 2a006994ad6966b8fa31282349162f9bb1d4a50c..736ec7bfacd5aa37adc09404c4ca509b639a943a 100644 (file)
@@ -50,6 +50,7 @@ class MenuPrincipal : public QMainWindow
         void openForce();
         void openGestureOutput();
         void openPeephole();
+        void openScreenRotate();
 
     private:
         Ui::MenuPrincipal *ui;
index e6225f7db2f5c0132960a26bfd1dcc05f1c0b30b..e8f9f5106c7b23cc75a3fbd4b6638b15b9376213 100644 (file)
@@ -1,5 +1,83 @@
 #include "ScreenRotate.h"
 
-ScreenRotate::ScreenRotate()
+#include <QDebug>
+#include <MenuPrincipal.h>
+#include <QGraphicsPixmapItem>
+
+ScreenRotate::ScreenRotate(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::Fullscreen),
+    _window(NULL)
+{
+    ui->setupUi(this);
+    setWindowState(Qt::WindowMaximized);
+    setAttribute(Qt::WA_DeleteOnClose);
+
+    ui->image->setScene(&_background);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/desktop.jpg"));
+    _background.addItem(_window);
+    ui->image->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->image->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->image->fitInView(_window);
+
+    connect(ui->start, SIGNAL(clicked()), this, SLOT(rotateScreen()));
+    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->getScreen())
+        qDebug() << "Warning: screen not connected";
+    else
+        menu->getScreen()->rotation(90);
+}
+
+ScreenRotate::~ScreenRotate()
+{
+    delete ui;
+}
+
+void ScreenRotate::rotateScreen()
+{
+    MenuPrincipal * menu = dynamic_cast<MenuPrincipal *>(this->parent());
+    if (menu->getScreen())
+    {
+        if (_straight)
+        {
+            menu->getScreen()->rotation(180);
+            _straight = false;
+        }
+        else
+        {
+            menu->getScreen()->rotation(90);
+            _straight = true;
+        }
+    }
+}
+
+void ScreenRotate::setupEmails()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/emailapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
+
+void ScreenRotate::setupPresentation()
+{
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/presentationapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
+}
+
+void ScreenRotate::setupCalendar()
 {
+    if (_window)
+        _background.removeItem(_window);
+    _window = new QGraphicsPixmapItem(QPixmap("../../images/calendarapp.png"));
+    _background.addItem(_window);
+    ui->image->fitInView(_window);
 }
index 1f3a13fb4809a8cbccb8200bda1ed44ee3c5eaac..abd88c5ff20fd879eee06aec481c0e33a098c868 100644 (file)
@@ -1,10 +1,34 @@
 #ifndef SCREENROTATE_H
 #define SCREENROTATE_H
 
-class ScreenRotate
+#include <QMainWindow>
+#include <QGraphicsScene>
+
+#include <ui_fullscreen.h>
+
+namespace Ui {
+    class Fullscreen;
+}
+
+class ScreenRotate : public QMainWindow
 {
+        Q_OBJECT
+
     public:
-        ScreenRotate();
+        explicit ScreenRotate(QWidget *parent = 0);
+        ~ScreenRotate();
+
+    public slots:
+        void rotateScreen();
+        void setupEmails();
+        void setupPresentation();
+        void setupCalendar();
+
+    private:
+        Ui::Fullscreen *ui;
+        QGraphicsScene _background;
+        QGraphicsPixmapItem *_window;
+        bool _straight;
 };
 
 #endif // SCREENROTATE_H
index 1b36056083bf762907e2f41c02353af302781696..9474b20dc5c33138c376a3e3dd9e4f0103459cc2 100644 (file)
@@ -9,7 +9,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
+    <width>1007</width>
     <height>600</height>
    </rect>
   </property>
         <property name="text">
          <string>Start</string>
         </property>
+        <property name="icon">
+         <iconset>
+          <normaloff>../../images/start.png</normaloff>../../images/start.png</iconset>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::Fixed</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>10</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="appbutton1">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>140</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">text-align: left; padding:5px;</string>
+        </property>
+        <property name="text">
+         <string>Presentation</string>
+        </property>
+        <property name="icon">
+         <iconset>
+          <normaloff>../../images/presentation.png</normaloff>../../images/presentation.png</iconset>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="appbutton2">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>140</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">text-align: left; padding:5px;</string>
+        </property>
+        <property name="text">
+         <string>Calendar</string>
+        </property>
+        <property name="icon">
+         <iconset>
+          <normaloff>../../images/calendar.png</normaloff>../../images/calendar.png</iconset>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="appbutton3">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>140</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">text-align: left; padding:5px;</string>
+        </property>
+        <property name="text">
+         <string>E-mail</string>
+        </property>
+        <property name="icon">
+         <iconset>
+          <normaloff>../../images/email.png</normaloff>../../images/email.png</iconset>
+        </property>
+        <property name="flat">
+         <bool>false</bool>
+        </property>
        </widget>
       </item>
       <item>
         </property>
        </spacer>
       </item>
+      <item>
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <string/>
+        </property>
+        <property name="pixmap">
+         <pixmap>../images/barbuttons.png</pixmap>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout_2">
+        <item>
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>4:29</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignCenter</set>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label">
+          <property name="text">
+           <string>21/10/2015</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
      </layout>
     </item>
    </layout>
index bb1689f8c3528f1bb7154e1c2fe837dadb6abbdf..34a402fd48b1775f1f0dcc7da8000c7fb2e74ee8 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>894</width>
-    <height>546</height>
+    <height>630</height>
    </rect>
   </property>
   <property name="windowTitle">
         </property>
        </widget>
       </item>
+      <item row="3" column="0">
+       <widget class="QPushButton" name="screenrotate">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>150</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>30</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>Screen rotate</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </item>
     <item>
diff --git a/images/barbuttons.png b/images/barbuttons.png
new file mode 100644 (file)
index 0000000..832175e
Binary files /dev/null and b/images/barbuttons.png differ
diff --git a/images/calendar.png b/images/calendar.png
new file mode 100644 (file)
index 0000000..80cd28d
Binary files /dev/null and b/images/calendar.png differ
diff --git a/images/calendarapp.png b/images/calendarapp.png
new file mode 100644 (file)
index 0000000..11b9a8c
Binary files /dev/null and b/images/calendarapp.png differ
diff --git a/images/email.png b/images/email.png
new file mode 100644 (file)
index 0000000..2630a09
Binary files /dev/null and b/images/email.png differ
diff --git a/images/emailapp.png b/images/emailapp.png
new file mode 100644 (file)
index 0000000..fe109a1
Binary files /dev/null and b/images/emailapp.png differ
diff --git a/images/login.png b/images/login.png
new file mode 100644 (file)
index 0000000..5aade31
Binary files /dev/null and b/images/login.png differ
diff --git a/images/presentation.png b/images/presentation.png
new file mode 100644 (file)
index 0000000..6d528ca
Binary files /dev/null and b/images/presentation.png differ
diff --git a/images/presentationapp.png b/images/presentationapp.png
new file mode 100644 (file)
index 0000000..a1eb176
Binary files /dev/null and b/images/presentationapp.png differ
diff --git a/images/start.png b/images/start.png
new file mode 100644 (file)
index 0000000..5859ea2
Binary files /dev/null and b/images/start.png differ