Beispiel #1
0
StatusNavigateBar::StatusNavigateBar(QWidget* parent)
    : QWidget(parent), d(new StatusNavigateBarPriv)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setFocusPolicy(Qt::NoFocus);

    QHBoxLayout* lay = new QHBoxLayout(this);

    d->firstButton = new QToolButton(this);
    d->firstButton->setFocusPolicy(Qt::NoFocus);
    d->firstButton->setAutoRaise(true);
    d->firstButton->setIcon(SmallIcon("go-first"));
    d->firstButton->setToolTip( i18n("Go to the first item"));

    d->prevButton = new QToolButton(this);
    d->prevButton->setFocusPolicy(Qt::NoFocus);
    d->prevButton->setAutoRaise(true);
    d->prevButton->setIcon(SmallIcon("go-previous"));
    d->prevButton->setToolTip( i18n("Go to the previous item"));

    d->nextButton = new QToolButton(this);
    d->nextButton->setFocusPolicy(Qt::NoFocus);
    d->nextButton->setAutoRaise(true);
    d->nextButton->setIcon(SmallIcon("go-next"));
    d->nextButton->setToolTip( i18n("Go to the next item"));

    d->lastButton = new QToolButton(this);
    d->lastButton->setFocusPolicy(Qt::NoFocus);
    d->lastButton->setAutoRaise(true);
    d->lastButton->setIcon(SmallIcon("go-last"));
    d->lastButton->setToolTip( i18n("Go to the last item"));

    lay->addWidget(d->firstButton);
    lay->addWidget(d->prevButton);
    lay->addWidget(d->nextButton);
    lay->addWidget(d->lastButton);
    lay->setMargin(0);
    lay->setSpacing(0);

    // ----------------------------------------------------------------

    connect(d->firstButton, SIGNAL(clicked()),
            this, SIGNAL(signalFirstItem()));

    connect(d->prevButton, SIGNAL(clicked()),
            this, SIGNAL(signalPrevItem()));

    connect(d->nextButton, SIGNAL(clicked()),
            this, SIGNAL(signalNextItem()));

    connect(d->lastButton, SIGNAL(clicked()),
            this, SIGNAL(signalLastItem()));
}
Beispiel #2
0
bool ImageDescEditTab::eventFilter(QObject* o, QEvent* e)
{
    if ( e->type() == QEvent::KeyPress )
    {
        QKeyEvent* const k = static_cast<QKeyEvent*>(e);

        if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return)
        {
            if (k->modifiers() == Qt::ControlModifier)
            {
                d->lastSelectedWidget = qobject_cast<QWidget*>(o);
                emit signalNextItem();
                return true;
            }
            else if (k->modifiers() == Qt::ShiftModifier)
            {
                d->lastSelectedWidget = qobject_cast<QWidget*>(o);
                emit signalPrevItem();
                return true;
            }
        }

        if (k->key() == Qt::Key_PageUp)
        {
            d->lastSelectedWidget = qobject_cast<QWidget*>(o);
            emit signalPrevItem();
            return true;
        }

        if (k->key() == Qt::Key_PageDown)
        {
            d->lastSelectedWidget = qobject_cast<QWidget*>(o);
            emit signalNextItem();
            return true;
        }
    }

    return DVBox::eventFilter(o, e);
}
Beispiel #3
0
void ImageWindow::setupConnections()
{
    setupStandardConnections();

    connect(this, SIGNAL(loadCurrentLater()),
            this, SLOT(slotLoadCurrent()), Qt::QueuedConnection);

    // To toggle properly keyboards shortcuts from comments & tags side bar tab.

    connect(d->rightSideBar, SIGNAL(signalNextItem()),
            this, SLOT(slotForward()));

    connect(d->rightSideBar, SIGNAL(signalPrevItem()),
            this, SLOT(slotBackward()));

    connect(d->rightSideBar->getFiltersHistoryTab(), SIGNAL(actionTriggered(const ImageInfo&)),
            this, SLOT(openImage(const ImageInfo&)));

    connect(this, SIGNAL(signalSelectionChanged( const QRect&)),
            d->rightSideBar, SLOT(slotImageSelectionChanged( const QRect&)));

    connect(this, SIGNAL(signalNoCurrentItem()),
            d->rightSideBar, SLOT(slotNoCurrentItem()));

    ImageAttributesWatch* watch = ImageAttributesWatch::instance();

    connect(watch, SIGNAL(signalFileMetadataChanged(const KUrl&)),
            this, SLOT(slotFileMetadataChanged(const KUrl&)));

    /*connect(DatabaseAccess::databaseWatch(), SIGNAL(collectionImageChange(const CollectionImageChangeset&)),
            this, SLOT(slotCollectionImageChange(const CollectionImageChangeset&)),
            Qt::QueuedConnection);*/

    connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
            this, SLOT(slotThemeChanged()));

    /*connect(d->imageFilterModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)),
            this, SLOT(slotRowsAboutToBeRemoved(const QModelIndex&, int, int)));*/

    connect(d->thumbBar, SIGNAL(currentChanged(const ImageInfo&)),
            this, SLOT(slotThumbBarImageSelected(const ImageInfo&)));

    connect(d->dragDropHandler, SIGNAL(imageInfosDropped(const QList<ImageInfo>&)),
            this, SLOT(slotDroppedOnThumbbar(const QList<ImageInfo>&)));

    connect(d->thumbBarDock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
            d->thumbBar, SLOT(slotDockLocationChanged(Qt::DockWidgetArea)));

    connect(AlbumSettings::instance(), SIGNAL(setupChanged()),
            this, SLOT(slotSetupChanged()));
}
Beispiel #4
0
void SeparateWindow::keyPressEvent( QKeyEvent * event )
{
  int key = event->key();
  bool control = (event->modifiers() == Qt::ControlModifier);
  if (key == Qt::Key_F && control)
    toggleFullscreen();
  else if (key == Qt::Key_1 && control)
    emit signalSingleWindowMode();
  else if (key == Qt::Key_0 && control)
    splitView->resetViews();
  else if (key == Qt::Key_9 && control)
    splitView->zoomToFit();
  else if (key == Qt::Key_Plus && control)
    splitView->zoomIn();
  else if (key == Qt::Key_BracketRight && control)
    // This seems to be a bug in the Qt localization routine. On the german keyboard layout this key is returned
    // if Ctrl + is pressed. 
    splitView->zoomIn();
  else if (key == Qt::Key_Minus && control)
    splitView->zoomOut();
  else if (key == Qt::Key_Escape)
  {
    if (isFullScreen())
      toggleFullscreen();
  }
  else if (key == Qt::Key_Space)
    emit signalPlayPauseToggle();
  else if (key == Qt::Key_Right)
    emit signalNextFrame();
  else if (key == Qt::Key_Left)
    emit signalPreviousFrame();
  else if (key == Qt::Key_Down)
    emit signalNextItem();
  else if (key == Qt::Key_Up)
    emit signalPreviousItem();
  else
    QWidget::keyPressEvent(event);
}
Beispiel #5
0
void ImportView::setupConnections()
{
    // -- ImportUI connections ----------------------------------

    connect(d->parent, SIGNAL(signalEscapePressed()),
            this, SLOT(slotEscapePreview()));

    connect(d->parent, SIGNAL(signalEscapePressed()),
            d->stackedView, SLOT(slotEscapePreview()));

    // Preview items while download.
    connect(d->parent, SIGNAL(signalPreviewRequested(CamItemInfo,bool)),
            this, SLOT(slotTogglePreviewMode(CamItemInfo,bool)));

    // -- IconView Connections -------------------------------------

    connect(d->iconView->model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(slotImageSelected()));

    connect(d->iconView->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
            this, SLOT(slotImageSelected()));

    connect(d->iconView->model(), SIGNAL(layoutChanged()),
            this, SLOT(slotImageSelected()));

    connect(d->iconView, SIGNAL(selectionChanged()),
            this, SLOT(slotImageSelected()));

    connect(d->iconView, SIGNAL(previewRequested(CamItemInfo,bool)),
            this, SLOT(slotTogglePreviewMode(CamItemInfo,bool)));

    // -- Preview image widget Connections ------------------------

    connect(d->stackedView, SIGNAL(signalNextItem()),
            this, SLOT(slotNextItem()));

    connect(d->stackedView, SIGNAL(signalPrevItem()),
            this, SLOT(slotPrevItem()));

    //connect(d->stackedView, SIGNAL(signalEditItem()),
            //this, SLOT(slotImageEdit()));

    connect(d->stackedView, SIGNAL(signalViewModeChanged()),
            this, SLOT(slotViewModeChanged()));

    connect(d->stackedView, SIGNAL(signalEscapePreview()),
            this, SLOT(slotEscapePreview()));

    connect(d->stackedView, SIGNAL(signalZoomFactorChanged(double)),
            this, SLOT(slotZoomFactorChanged(double)));

    // -- FileActionMngr progress ---------------

    connect(FileActionMngr::instance(), SIGNAL(signalImageChangeFailed(QString,QStringList)),
            this, SLOT(slotImageChangeFailed(QString,QStringList)));

    // -- timers ---------------

    connect(d->selectionTimer, SIGNAL(timeout()),
            this, SLOT(slotDispatchImageSelected()));

    connect(d->thumbSizeTimer, SIGNAL(timeout()),
            this, SLOT(slotThumbSizeEffect()) );

    // -- Import Settings ----------------

    //connect(ImportSettings::instance(), SIGNAL(setupChanged()),
            //this, SLOT(slotSidebarTabTitleStyleChanged()));
}
Beispiel #6
0
MediaPlayerView::MediaPlayerView(StackedView* parent)
    : QStackedWidget(parent), d(new MediaPlayerViewPriv)
{
    setAttribute(Qt::WA_DeleteOnClose);

    d->back2AlbumAction = new QAction(SmallIcon("folder-image"), i18n("Back to Album"),                 this);
    d->prevAction       = new QAction(SmallIcon("go-previous"),  i18nc("go to previous image", "Back"), this);
    d->nextAction       = new QAction(SmallIcon("go-next"),      i18nc("go to next image", "Forward"),  this);

    d->errorView        = new QFrame(this);
    QLabel* errorMsg    = new QLabel(i18n("An error has occurred with the media player...."), this);

    errorMsg->setAlignment(Qt::AlignCenter);
    d->errorView->setFrameStyle(QFrame::GroupBoxPanel|QFrame::Plain);
    d->errorView->setLineWidth(1);

    QGridLayout* grid = new QGridLayout;
    grid->addWidget(errorMsg, 1, 0, 1, 3 );
    grid->setColumnStretch(0, 10),
         grid->setColumnStretch(2, 10),
         grid->setRowStretch(0, 10),
         grid->setRowStretch(2, 10),
         grid->setMargin(KDialog::spacingHint());
    grid->setSpacing(KDialog::spacingHint());
    d->errorView->setLayout(grid);

    insertWidget(MediaPlayerViewPriv::ErrorView, d->errorView);

    // --------------------------------------------------------------------------

    d->mediaPlayerView = new QFrame(this);
    d->player          = new Phonon::VideoPlayer(Phonon::VideoCategory, this);
    d->slider          = new Phonon::SeekSlider(this);
    d->slider->setMediaObject(d->player->mediaObject());
    d->player->mediaObject()->setTickInterval(100);
    d->player->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    d->mediaPlayerView->setFrameStyle(QFrame::GroupBoxPanel|QFrame::Plain);
    d->mediaPlayerView->setLineWidth(1);

    d->grid = new QGridLayout;
    d->grid->addWidget(d->player->videoWidget(), 0, 0, 1, 3);
    d->grid->addWidget(d->slider,                1, 0, 1, 3);
    d->grid->setColumnStretch(0, 10),
      d->grid->setColumnStretch(2, 10),
      d->grid->setRowStretch(0, 10),
      d->grid->setMargin(KDialog::spacingHint());
    d->grid->setSpacing(KDialog::spacingHint());
    d->mediaPlayerView->setLayout(d->grid);

    insertWidget(MediaPlayerViewPriv::PlayerView, d->mediaPlayerView);

    d->toolBar = new QToolBar(this);
    d->toolBar->addAction(d->prevAction);
    d->toolBar->addAction(d->nextAction);
    d->toolBar->addAction(d->back2AlbumAction);

    setPreviewMode(MediaPlayerViewPriv::PlayerView);

    d->errorView->installEventFilter(new MediaPlayerMouseClickFilter(this));
    d->player->videoWidget()->installEventFilter(new MediaPlayerMouseClickFilter(this));

    // --------------------------------------------------------------------------

    connect(d->player->mediaObject(), SIGNAL(finished()),
            this, SLOT(slotPlayerFinished()));

    connect(d->player->mediaObject(), SIGNAL(stateChanged(Phonon::State, Phonon::State)),
            this, SLOT(slotPlayerstateChanged(Phonon::State, Phonon::State)));

    connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
            this, SLOT(slotThemeChanged()));

    connect(d->prevAction, SIGNAL(triggered()),
            this, SIGNAL(signalPrevItem()));

    connect(d->nextAction, SIGNAL(triggered()),
            this, SIGNAL(signalNextItem()));

    connect(d->back2AlbumAction, SIGNAL(triggered()),
            parent, SIGNAL(signalBack2Album()));
}