diff options
Diffstat (limited to 'demos/embedded/fluidlauncher')
-rw-r--r-- | demos/embedded/fluidlauncher/fluidlauncher.cpp | 28 | ||||
-rw-r--r-- | demos/embedded/fluidlauncher/fluidlauncher.h | 5 | ||||
-rw-r--r-- | demos/embedded/fluidlauncher/slideshow.cpp | 5 | ||||
-rw-r--r-- | demos/embedded/fluidlauncher/slideshow.h | 2 |
4 files changed, 32 insertions, 8 deletions
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.cpp b/demos/embedded/fluidlauncher/fluidlauncher.cpp index 808f362..c065bc9 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.cpp +++ b/demos/embedded/fluidlauncher/fluidlauncher.cpp @@ -54,6 +54,11 @@ FluidLauncher::FluidLauncher(QStringList* args) slideShowWidget = new SlideShow(); inputTimer = new QTimer(); + addWidget(pictureFlowWidget); + addWidget(slideShowWidget); + setCurrentWidget(pictureFlowWidget); + pictureFlowWidget->setFocus(); + QRect screen_size = QApplication::desktop()->screenGeometry(); QObject::connect(pictureFlowWidget, SIGNAL(itemActivated(int)), this, SLOT(launchApplication(int))); @@ -80,7 +85,7 @@ FluidLauncher::FluidLauncher(QStringList* args) if (success) { populatePictureFlow(); - pictureFlowWidget->showFullScreen(); + showFullScreen(); inputTimer->start(); } else { pictureFlowWidget->setAttribute(Qt::WA_DeleteOnClose, true); @@ -222,7 +227,6 @@ void FluidLauncher::launchApplication(int index) } inputTimer->stop(); - pictureFlowWidget->hide(); QObject::connect(demoList[index], SIGNAL(demoFinished()), this, SLOT(demoFinished())); @@ -234,6 +238,7 @@ void FluidLauncher::switchToLauncher() { slideShowWidget->stopShow(); inputTimer->start(); + setCurrentWidget(pictureFlowWidget); } @@ -253,11 +258,28 @@ void FluidLauncher::switchToSlideshow() { inputTimer->stop(); slideShowWidget->startShow(); + setCurrentWidget(slideShowWidget); } void FluidLauncher::demoFinished() { - pictureFlowWidget->showFullScreen(); + setCurrentWidget(pictureFlowWidget); inputTimer->start(); } +void FluidLauncher::changeEvent(QEvent* event) +{ + if (event->type() == QEvent::ActivationChange) { + if (isActiveWindow()) { + if(currentWidget() == pictureFlowWidget) { + resetInputTimeout(); + } else { + slideShowWidget->startShow(); + } + } else { + inputTimer->stop(); + slideShowWidget->stopShow(); + } + } + QStackedWidget::changeEvent(event); +} diff --git a/demos/embedded/fluidlauncher/fluidlauncher.h b/demos/embedded/fluidlauncher/fluidlauncher.h index 2c40526..ff742e2 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.h +++ b/demos/embedded/fluidlauncher/fluidlauncher.h @@ -50,7 +50,7 @@ #include "slideshow.h" #include "demoapplication.h" -class FluidLauncher : public QObject +class FluidLauncher : public QStackedWidget { Q_OBJECT @@ -65,6 +65,9 @@ public slots: void inputTimedout(); void demoFinished(); +protected: + void changeEvent(QEvent *event); + private: PictureFlow* pictureFlowWidget; SlideShow* slideShowWidget; diff --git a/demos/embedded/fluidlauncher/slideshow.cpp b/demos/embedded/fluidlauncher/slideshow.cpp index a397c2b..55daedf 100644 --- a/demos/embedded/fluidlauncher/slideshow.cpp +++ b/demos/embedded/fluidlauncher/slideshow.cpp @@ -83,7 +83,8 @@ void SlideShowPrivate::showNextSlide() -SlideShow::SlideShow() +SlideShow::SlideShow(QWidget* parent) : + QWidget(parent) { d = new SlideShowPrivate; @@ -125,7 +126,6 @@ void SlideShow::clearImages() void SlideShow::startShow() { - showFullScreen(); d->interSlideTimer.start(d->slideInterval, this); d->showNextSlide(); update(); @@ -134,7 +134,6 @@ void SlideShow::startShow() void SlideShow::stopShow() { - hide(); d->interSlideTimer.stop(); } diff --git a/demos/embedded/fluidlauncher/slideshow.h b/demos/embedded/fluidlauncher/slideshow.h index 6d51662..214652e 100644 --- a/demos/embedded/fluidlauncher/slideshow.h +++ b/demos/embedded/fluidlauncher/slideshow.h @@ -53,7 +53,7 @@ class SlideShow : public QWidget Q_PROPERTY(int slideInterval READ slideInterval WRITE setSlideInterval) public: - SlideShow(); + SlideShow(QWidget* parent = 0); ~SlideShow(); void addImage(QString filename); void addImageDir(QString dirName); |