void KuickShow::nextSlide() { if ( !m_viewer ) { m_slideshowCycle = 1; fileWidget->actionCollection()->action("kuick_slideshow")->setEnabled( true ); return; } KFileItem *item = fileWidget->getNext( true ); if ( !item ) { // last image if ( m_slideshowCycle < kdata->slideshowCycles || kdata->slideshowCycles == 0 ) { item = fileWidget->gotoFirstImage(); if ( item ) { nextSlide( item ); m_slideshowCycle++; return; } } m_viewer->close( true ); fileWidget->actionCollection()->action("kuick_slideshow")->setEnabled( true ); return; } nextSlide( item ); }
MainWindowAdaptor::MainWindowAdaptor( MainWindow * window ) : QDBusAbstractAdaptor(window), m_window( window ) { connect( m_window, SIGNAL( presentationStarted( ) ), this, SIGNAL( presentationStarted( ) ) ); connect( m_window, SIGNAL( presentationStopped() ), this, SIGNAL( presentationStopped() ) ); connect( m_window, SIGNAL( nextSlide() ), this, SIGNAL( nextSlide() ) ); connect( m_window, SIGNAL( previousSlide() ), this, SIGNAL( previousSlide() ) ); }
static gboolean onMouseReleased(GtkWidget *widget, GdkEventButton *ev, gpointer data) { /* Unused parameters. */ (void)widget; (void)data; /* forward on left click, backward on right click */ if (ev->type == GDK_BUTTON_RELEASE) { if (ev->button == 1) { nextSlide(); refreshPorts(); } else if (ev->button == 3) { prevSlide(); refreshPorts(); } } return TRUE; }
void ShowImageWindow::_StartSlideShow() { _StopSlideShow(); BMessage nextSlide(kMsgNextSlide); fSlideShowRunner = new BMessageRunner(this, &nextSlide, fSlideShowDelay); }
Slideshow::Slideshow(Gallery *gallery, ThumbnailModel *model, QVector<int> selection, QWidget *parent) : QGraphicsView(parent), m_gallery(gallery), m_model(model), m_selection(selection), m_picture(0) { setWindowTitle(tr("Slideshow")); setAttribute(Qt::WA_DeleteOnClose, true); setWindowFlags(windowFlags() | Qt::Window); setFrameShape(QFrame::NoFrame); setFocusPolicy(Qt::StrongFocus); m_scene = new QGraphicsScene(); m_scene->setBackgroundBrush(Qt::black); setScene(m_scene); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setInteractive(false); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); m_slidetimer = new QTimer(this); connect(m_slidetimer, SIGNAL(timeout()), this, SLOT(nextSlide())); // Construct the pause glyph QGraphicsLineItem *p1 = new QGraphicsLineItem(QLineF(20, 20, 20, 70)); QGraphicsLineItem *p2 = new QGraphicsLineItem(QLineF(60, 20, 60, 70)); QPen pen; pen.setWidth(15); pen.setCapStyle(Qt::RoundCap); pen.setColor(Qt::white); p1->setPen(pen); p2->setPen(pen); QGraphicsItemGroup *pauseglyph = new QGraphicsItemGroup(); pauseglyph->setZValue(100); pauseglyph->addToGroup(p1); pauseglyph->addToGroup(p2); addShadowEffect(pauseglyph); pauseglyph->hide(); m_pauseglyph = pauseglyph; m_scene->addItem(m_pauseglyph); // Construct timer text item m_timertext = new QGraphicsTextItem(); m_timertext->setZValue(100); QFont font; font.setPixelSize(20); m_timertext->setFont(font); m_timertext->setDefaultTextColor(Qt::white); setTimerText(); addShadowEffect(m_timertext); m_timertext->hide(); m_scene->addItem(m_timertext); m_scalefill = gallery->database()->getSetting("slideshow.scale").toString() == "fill"; m_upscale = gallery->database()->getSetting("slideshow.upscale").toBool(); }
bool CAPresentationHandler::openDocument (const QString& uri) { QString error; QString mimetype = KMimeType::findByPath (uri)->name(); KoDocumentEntry documentEntry = KoDocumentEntry::queryByMimeType(mimetype); KoPart *part = documentEntry.createKoPart(&error); if (!part) { kDebug() << "Doc can't be openend" << error; return false; } d->document = qobject_cast<KPrDocument*> (part->document()); d->document->openUrl (KUrl (uri)); KoCanvasBase* paCanvas = dynamic_cast<KoCanvasBase*>(part->canvasItem(d->document)); KoPACanvasItem* paCanvasItem = dynamic_cast<KoPACanvasItem*> (paCanvas); if (!paCanvasItem) { kDebug() << "Failed to fetch a canvas item"; return false; } if (paCanvasItem) { d->paView = new CAPAView (documentController()->canvasController(), dynamic_cast<KoPACanvasBase*> (paCanvas), d->document); paCanvasItem->setView (d->paView); documentController()->canvasController()->setZoomHandler (static_cast<KoZoomHandler*> (paCanvasItem->viewConverter())); d->paView->connectToZoomController(); // update the canvas whenever we scroll, the canvas controller must emit this signal on scrolling/panning connect (documentController()->canvasController()->canvasControllerProxyObject(), SIGNAL(moveDocumentOffset(QPoint)), paCanvasItem, SLOT(slotSetDocumentOffset(QPoint))); // whenever the size of the document viewed in the canvas changes, inform the zoom controller connect (paCanvasItem, SIGNAL(documentSize(QSize)), this, SLOT(tellZoomControllerToSetDocumentSize(QSize))); paCanvasItem->update(); } setCanvas (paCanvas); KoToolManager::instance()->addController (documentController()->canvasController()); connect(documentController()->canvasController(), SIGNAL(needsCanvasResize(QSizeF)), SLOT(resizeCanvas(QSizeF))); connect (documentController()->canvasController(), SIGNAL(needCanvasUpdate()), SLOT(updateCanvas())); d->paDocumentModel = new CAPADocumentModel(this, d->document); emit totalNumberOfSlidesChanged(); QTimer::singleShot(0, this, SLOT(nextSlide())); return true; }
void Slideshow::keyPressEvent(QKeyEvent *e) { switch(e->key()) { case Qt::Key_Return: case Qt::Key_Enter: if(e->modifiers() & Qt::AltModifier) { if(this->isFullScreen()) { this->setWindowState(Qt::WindowMaximized); this->setGeometry(QDesktopWidget().screenGeometry(this).adjusted(50,50,-50,-50)); } else this->setWindowState(Qt::WindowFullScreen); } break; case Qt::Key_Space: togglePause(); break; case Qt::Key_Left: if(!m_paused) m_slidetimer->start(); prevSlide(); break; case Qt::Key_Right: if(!m_paused) m_slidetimer->start(); nextSlide(); break; case Qt::Key_Escape: this->close(); break; case Qt::Key_Plus: { int i = m_slidetimer->interval() + 500; m_slidetimer->setInterval(i); setTimerText(); m_timertext->show(); break; } case Qt::Key_Minus: { int i = m_slidetimer->interval() - 500; if(i>=1000) { m_slidetimer->setInterval(i); setTimerText(); } m_timertext->show(); break; } default: QGraphicsView::keyPressEvent(e); } }
Image::Image(QObject *parent, const QVariantList &args) : Plasma::Wallpaper(parent, args), m_delay(10), m_fileWatch(new KDirWatch(this)), m_configWidget(0), m_wallpaperPackage(0), m_currentSlide(-1), m_fadeValue(0), m_animation(0), m_model(0), m_dialog(0), m_randomize(true), m_nextWallpaperAction(0), m_openImageAction(0) { connect(this, SIGNAL(renderCompleted(QImage)), this, SLOT(updateBackground(QImage))); connect(&m_timer, SIGNAL(timeout()), this, SLOT(nextSlide())); connect(m_fileWatch, SIGNAL(dirty(QString)), this, SLOT(imageFileAltered(QString))); connect(m_fileWatch, SIGNAL(created(QString)), this, SLOT(imageFileAltered(QString))); }
void SlideEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv) { if (_autoSteppingActive && nv->getFrameStamp()) { double time = nv->getFrameStamp()->getSimulationTime(); if (_firstTraversal) { _firstTraversal = false; _previousTime = time; } else if (time-_previousTime>_timePerSlide) { _previousTime = time; nextSlide(); } } traverse(node,nv); }
static gboolean onScroll(GtkWidget *widget, GdkEventScroll *ev, gpointer data) { /* Unused parameters. */ (void)widget; (void)data; /* forward on down/right scroll, backward on up/left scroll */ if (ev->direction == GDK_SCROLL_DOWN || ev->direction == GDK_SCROLL_RIGHT) { nextSlide(); refreshPorts(); } else if (ev->direction == GDK_SCROLL_UP || ev->direction == GDK_SCROLL_LEFT) { prevSlide(); refreshPorts(); } return TRUE; }
void Slide::connections() { connect(Delay,SIGNAL(timeout()),SLOT(nextSlide())); connect(timerPoint,SIGNAL(timeout()),SLOT(mouseOn())); connect(lRightArrow,SIGNAL(onClick()),SLOT(onClick_lRightArrow())); connect(lLefttArrow,SIGNAL(onClick()),SLOT(onClick_lLefttArrow())); connect(lB0,SIGNAL(onClick()),SLOT(onClick_lB0())); connect(lB1,SIGNAL(onClick()),SLOT(onClick_lB1())); connect(lB2,SIGNAL(onClick()),SLOT(onClick_lB2())); connect(lB3,SIGNAL(onClick()),SLOT(onClick_lB3())); connect(lB4,SIGNAL(onClick()),SLOT(onClick_lB4())); connect(Slide0,SIGNAL(onClick()),SLOT(onClick_slide0())); connect(Slide1,SIGNAL(onClick()),SLOT(onClick_slide1())); connect(Slide2,SIGNAL(onClick()),SLOT(onClick_slide2())); connect(Slide3,SIGNAL(onClick()),SLOT(onClick_slide3())); connect(Slide4,SIGNAL(onClick()),SLOT(onClick_slide4())); connect(this,SIGNAL(onNow(bool)),SLOT(mouseOn_slide(bool))); }
void Slideshow::start() { m_paused = false; this->show(); // Note. If we start in fullscreen mode, the window won't get focus properly. //this->setWindowState(Qt::WindowFullScreen); this->setGeometry(QDesktopWidget().screenGeometry(this)); this->setWindowState(Qt::WindowMaximized); this->raise(); this->activateWindow(); m_pos = -1; nextSlide(); bool ok; double interval = this->m_gallery->database()->getSetting("slideshow.delay").toDouble(&ok); if(!ok) interval = 10; m_slidetimer->setInterval(interval * 1000); m_slidetimer->start(); }
static gboolean onKeyPressed(GtkWidget *widget, GdkEventKey *ev, gpointer data) { /* Unused parameters. */ (void)data; guint key = ev->keyval; gchar *msg = NULL; /* When inside the note pad, don't do anything here. */ if (isInsideNotePad) return FALSE; /* Jump command? * * Note: This works as long as the values of GDK keysyms satisfy: * 1) GDK_0 < GDK_1 < GDK_2 < ... < GDK_9 * 2) All of them must be >= 0. */ key -= GDK_0; if (key <= 9) { /* The initial value is -1, so we have to reset this on the * first key stroke. */ if (target_page < 0) target_page = 0; /* Do a "decimal left shift" and add the given value. */ target_page *= 10; target_page += (int)key; /* Catch overflow and announce what would happen. */ if (target_page < 0) { target_page = -1; setStatusText_strdup("Invalid page."); } else { msg = g_strdup_printf("Jump to page: %d", target_page); setStatusText_strdup(msg); g_free(msg); } return FALSE; } gboolean changed = TRUE; saveCurrentNote(); switch (ev->keyval) { case GDK_Right: case GDK_Down: case GDK_Page_Down: case GDK_space: nextSlide(); break; case GDK_Left: case GDK_Up: case GDK_Page_Up: prevSlide(); break; case GDK_F5: /* Switch to fullscreen (if needed) and start the timer * (unless it's already running). */ if (!isFullScreen) toggleFullScreen(); if (timerMode != 1) toggleTimer(); break; case GDK_F6: /* this shall trigger a hard refresh, so empty the cache. */ clearCache(); break; case GDK_w: runpref.fit_mode = FIT_WIDTH; break; case GDK_h: runpref.fit_mode = FIT_HEIGHT; break; case GDK_p: runpref.fit_mode = FIT_PAGE; break; case GDK_l: current_fixate(); break; case GDK_L: current_release(FALSE); break; case GDK_J: current_release(TRUE); break; case GDK_f: toggleFullScreen(); break; case GDK_s: toggleTimer(); changed = FALSE; break; case GDK_c: toggleCurserVisibility(); break; case GDK_r: resetTimer(); changed = FALSE; break; case GDK_Escape: case GDK_q: if (prefs.q_exits_fullscreen && isFullScreen) { toggleFullScreen(); if (prefs.stop_timer_on_fs) { toggleTimer(); } } else { changed = FALSE; onQuit(NULL, NULL, NULL); } break; case GDK_i: /* This must not work when we're on the beamer window. */ if (widget != win_beamer) setEditingState(TRUE); changed = FALSE; break; case GDK_Return: if (executeJump() == 0) nextSlide(); break; case GDK_G: executeJump(); break; case GDK_period: case GDK_b: toggleBlankBeamer(); changed = FALSE; break; default: changed = FALSE; } if (changed == TRUE) { refreshPorts(); } return TRUE; }
bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN): { if (ea.getKey()=='a') { _autoSteppingActive = !_autoSteppingActive; _previousTime = ea.getTime(); return true; } else if ((ea.getKey()=='n') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Right)) { nextSlide(); return true; } else if ((ea.getKey()=='p') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Left)) { previousSlide(); return true; } else if ((ea.getKey()=='w') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Add)) { scaleImage(0.99f); return true; } else if ((ea.getKey()=='s') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Subtract)) { scaleImage(1.01f); return true; } else if (ea.getKey()=='j') { offsetImage(-0.001f,0.0f); return true; } else if (ea.getKey()=='k') { offsetImage(0.001f,0.0f); return true; } else if (ea.getKey()=='i') { offsetImage(0.0f,-0.001f); return true; } else if (ea.getKey()=='m') { offsetImage(0.0f,0.001f); return true; } else if (ea.getKey()==' ') { initTexMatrices(); return true; } return false; } case(osgGA::GUIEventAdapter::DRAG): case(osgGA::GUIEventAdapter::MOVE): { static float px = ea.getXnormalized(); static float py = ea.getYnormalized(); float dx = ea.getXnormalized()-px; float dy = ea.getYnormalized()-py; px = ea.getXnormalized(); py = ea.getYnormalized(); rotateImage(dx,dy); return true; } default: return false; } }
void CAPresentationHandler::gotoNextPage() { nextSlide(); }
KuickShow::KuickShow( const char *name ) : KMainWindow( 0L, name ), m_slideshowCycle( 1 ), fileWidget( 0L ), dialog( 0L ), id( 0L ), m_viewer( 0L ), oneWindowAction( 0L ), m_accel( 0L ), m_delayedRepeatItem( 0L ), m_slideShowStopped(false) { aboutWidget = 0L; kdata = new KuickData; kdata->load(); initImlib(); resize( 400, 500 ); m_slideTimer = new QTimer( this ); connect( m_slideTimer, SIGNAL( timeout() ), SLOT( nextSlide() )); KConfig *kc = KGlobal::config(); bool isDir = false; // true if we get a directory on the commandline // parse commandline options KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); // files to display // either a directory to display, an absolute path, a relative path, or a URL KURL startDir; startDir.setPath( QDir::currentDirPath() + '/' ); int numArgs = args->count(); if ( numArgs >= 10 ) { // Even though the 1st i18n string will never be used, it needs to exist for plural handling - mhunter if ( KMessageBox::warningYesNo( this, i18n("Do you really want to display this 1 image at the same time? This might be quite resource intensive and could overload your computer.<br>If you choose %1, only the first image will be shown.", "Do you really want to display these %n images at the same time? This might be quite resource intensive and could overload your computer.<br>If you choose %1, only the first image will be shown.", numArgs).arg(KStdGuiItem::no().plainText()), i18n("Display Multiple Images?")) != KMessageBox::Yes ) { numArgs = 1; } } for ( int i = 0; i < numArgs; i++ ) { KURL url = args->url( i ); KFileItem item( KFileItem::Unknown, KFileItem::Unknown, url, false ); // for remote URLs, we don't know if it's a file or directory, but // FileWidget::isImage() should correct in most cases. // For non-local non-images, we just assume directory. if ( FileWidget::isImage( &item ) ) { showImage( &item, true, false, true ); // show in new window, not fullscreen-forced and move to 0,0 // showImage( &item, true, false, false ); // show in new window, not fullscreen-forced and not moving to 0,0 } else if ( item.isDir() ) { startDir = url; isDir = true; } // need to check remote files else if ( !url.isLocalFile() ) { KMimeType::Ptr mime = KMimeType::findByURL( url ); QString name = mime->name(); if ( name == "application/octet-stream" ) // unknown -> stat() name = KIO::NetAccess::mimetype( url, this ); // text/* is a hack for bugs.kde.org-attached-images urls. // The real problem here is that NetAccess::mimetype does a HTTP HEAD, which doesn't // always return the right mimetype. The rest of KDE start a get() instead.... if ( name.startsWith( "image/" ) || name.startsWith( "text/" ) ) { FileWidget::setImage( item, true ); showImage( &item, true, false, true ); } else // assume directory, KDirLister will tell us if we can't list { startDir = url; isDir = true; } } // else // we don't handle local non-images } if ( (kdata->startInLastDir && args->count() == 0) || args->isSet( "lastfolder" )) { kc->setGroup( "SessionSettings"); startDir = kc->readPathEntry( "CurrentDirectory", startDir.url() ); } if ( s_viewers.isEmpty() || isDir ) { initGUI( startDir ); if (!kapp->isRestored()) // during session management, readProperties() will show() show(); } else { // don't show browser, when image on commandline hide(); KStartupInfo::appStarted(); } }