FluidLauncher::FluidLauncher(QStringList* args) { pictureFlowWidget = new PictureFlow(); 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))); QObject::connect(pictureFlowWidget, SIGNAL(inputReceived()), this, SLOT(resetInputTimeout())); QObject::connect(slideShowWidget, SIGNAL(inputReceived()), this, SLOT(switchToLauncher())); QObject::connect(inputTimer, SIGNAL(timeout()), this, SLOT(inputTimedout())); inputTimer->setSingleShot(true); inputTimer->setInterval(DEFAULT_INPUT_TIMEOUT); const int h = screen_size.height() * SIZING_FACTOR_HEIGHT; const int w = screen_size.width() * SIZING_FACTOR_WIDTH; const int hh = qMin(h, w); const int ww = hh / 3 * 2; pictureFlowWidget->setSlideSize(QSize(ww, hh)); bool success; int configIndex = args->indexOf("-config"); if ( (configIndex != -1) && (configIndex != args->count()-1) ) success = loadConfig(args->at(configIndex+1)); else success = loadConfig("config.xml"); if (success) { populatePictureFlow(); showFullScreen(); inputTimer->start(); } else { pictureFlowWidget->setAttribute(Qt::WA_DeleteOnClose, true); pictureFlowWidget->close(); } }
int SlideShow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: inputReceived(); break; } _id -= 1; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = slideInterval(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSlideInterval(*reinterpret_cast< int*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
void SlideShow::mouseReleaseEvent(QMouseEvent* event) { Q_UNUSED(event); emit inputReceived(); }
void SlideShow::keyPressEvent(QKeyEvent* event) { Q_UNUSED(event); emit inputReceived(); }