From: Mjolnir Date: Wed, 9 Sep 2015 15:59:49 +0000 (+0200) Subject: rotating screen sceenarios X-Git-Url: https://git.thomaspietrzak.com/?a=commitdiff_plain;h=a867e7e525b6f41e268f4b5b111462bda27d5608;p=livingdesktop.git rotating screen sceenarios --- diff --git a/LivingDemos/LivingDemos.pro b/LivingDemos/LivingDemos.pro index d63a129..fa8765d 100644 --- a/LivingDemos/LivingDemos.pro +++ b/LivingDemos/LivingDemos.pro @@ -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 \ diff --git a/LivingDemos/MenuPrincipal.cpp b/LivingDemos/MenuPrincipal.cpp index a61de3d..98cd6dc 100644 --- a/LivingDemos/MenuPrincipal.cpp +++ b/LivingDemos/MenuPrincipal.cpp @@ -2,12 +2,13 @@ #include "ui_menuprincipal.h" #include +#include #include #include #include #include -#include +#include 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(); +} diff --git a/LivingDemos/MenuPrincipal.h b/LivingDemos/MenuPrincipal.h index 2a00699..736ec7b 100644 --- a/LivingDemos/MenuPrincipal.h +++ b/LivingDemos/MenuPrincipal.h @@ -50,6 +50,7 @@ class MenuPrincipal : public QMainWindow void openForce(); void openGestureOutput(); void openPeephole(); + void openScreenRotate(); private: Ui::MenuPrincipal *ui; diff --git a/LivingDemos/ScreenRotate.cpp b/LivingDemos/ScreenRotate.cpp index e6225f7..e8f9f51 100644 --- a/LivingDemos/ScreenRotate.cpp +++ b/LivingDemos/ScreenRotate.cpp @@ -1,5 +1,83 @@ #include "ScreenRotate.h" -ScreenRotate::ScreenRotate() +#include +#include +#include + +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(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(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); } diff --git a/LivingDemos/ScreenRotate.h b/LivingDemos/ScreenRotate.h index 1f3a13f..abd88c5 100644 --- a/LivingDemos/ScreenRotate.h +++ b/LivingDemos/ScreenRotate.h @@ -1,10 +1,34 @@ #ifndef SCREENROTATE_H #define SCREENROTATE_H -class ScreenRotate +#include +#include + +#include + +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 diff --git a/LivingDemos/fullscreen.ui b/LivingDemos/fullscreen.ui index 1b36056..9474b20 100644 --- a/LivingDemos/fullscreen.ui +++ b/LivingDemos/fullscreen.ui @@ -9,7 +9,7 @@ 0 0 - 800 + 1007 600 @@ -43,6 +43,107 @@ Start + + + ../../images/start.png../../images/start.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + text-align: left; padding:5px; + + + Presentation + + + + ../../images/presentation.png../../images/presentation.png + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + text-align: left; padding:5px; + + + Calendar + + + + ../../images/calendar.png../../images/calendar.png + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + text-align: left; padding:5px; + + + E-mail + + + + ../../images/email.png../../images/email.png + + + false + @@ -58,6 +159,37 @@ + + + + + + + ../images/barbuttons.png + + + + + + + + + 4:29 + + + Qt::AlignCenter + + + + + + + 21/10/2015 + + + + + diff --git a/LivingDemos/menuprincipal.ui b/LivingDemos/menuprincipal.ui index bb1689f..34a402f 100644 --- a/LivingDemos/menuprincipal.ui +++ b/LivingDemos/menuprincipal.ui @@ -7,7 +7,7 @@ 0 0 894 - 546 + 630 @@ -123,6 +123,24 @@ + + + + + 0 + 150 + + + + + 30 + + + + Screen rotate + + + diff --git a/images/barbuttons.png b/images/barbuttons.png new file mode 100644 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 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 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 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 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 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 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 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 index 0000000..5859ea2 Binary files /dev/null and b/images/start.png differ