예제 #1
0
void KPrPageLayoutDocker::setView( KPrView* view )
{
    Q_ASSERT( view );
    m_view = view;
    connect( m_view->proxyObject, SIGNAL( activePageChanged() ),
             this, SLOT( slotActivePageChanged() ) );

    // remove the layouts from the last view
    m_layoutsView->clear();

    KPrPageLayouts *layouts = view->kopaDocument()->resourceManager()->resource(KPresenter::PageLayouts).value<KPrPageLayouts*>();

    Q_ASSERT( layouts );

    const QList<KPrPageLayout *> layoutMap = layouts->layouts();

    // TODO add empty layout

    foreach( KPrPageLayout * layout, layoutMap ) {
        if ( layout->type() == KPrPageLayout::Page ) {
            addLayout( layout );
        }
    }

    slotActivePageChanged();

    connect( m_layoutsView, SIGNAL( itemPressed( QListWidgetItem * ) ),
             this, SLOT( slotItemPressed( QListWidgetItem * ) ) );
    connect( m_layoutsView, SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem * ) ),
             this, SLOT( slotCurrentItemChanged( QListWidgetItem *, QListWidgetItem * ) ) );
}
void KPrViewModeSlidesSorter::activate(KoPAViewMode *previousViewMode)
{
    Q_UNUSED(previousViewMode);
    KoPAView *view = dynamic_cast<KoPAView *>(m_view);
    if (view) {
        view->replaceCentralWidget(m_centralWidget);
    }
    m_slidesSorterView->setFocus(Qt::ActiveWindowFocusReason);
    updateToActivePageIndex();

    //setup signals
    connect(m_slidesSorterView,SIGNAL(indexChanged(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
    connect(m_slidesSorterView, SIGNAL(pressed(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
    connect(m_view->proxyObject, SIGNAL(activePageChanged()), this, SLOT(updateToActivePageIndex()));

    //change zoom saving slot
    connect(m_view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(updateZoom(KoZoomMode::Mode,qreal)));

    KPrView *kPrview = dynamic_cast<KPrView *>(m_view);
    if (kPrview) {
        disconnect(kPrview->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), kPrview, SLOT(zoomChanged(KoZoomMode::Mode,qreal)));
        m_view->zoomController()->zoomAction()->setZoomModes(KoZoomMode::ZOOM_CONSTANT);
        loadZoomConfig();
        disconnect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), kPrview, SLOT(editDeleteSelection()));
        connect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), this, SLOT(deleteSlide()));
    }
}
KoPABackgroundToolWidget::KoPABackgroundToolWidget( KoPABackgroundTool *tool, QWidget *parent )
: QWidget( parent )
, m_tool( tool )
{
    setObjectName( "KoPABackgroundToolWidget" );
    widget.setupUi( this );

    widget.fillBackground->setView(m_tool->view());

    // adapt texts to type of pages
    const bool isSlideType = (m_tool->view()->kopaDocument()->pageType() == KoPageApp::Slide);
    const QString useMasterBackgroundText =
        isSlideType ? i18n("Use background of master slide") : i18n("Use background of master page");
    widget.useMasterBackground->setText(useMasterBackgroundText);
    const QString displayMasterShapesText =
        isSlideType ? i18n("Display shapes of master slide") : i18n("Display shapes of master page");
    widget.displayMasterShapes->setText(displayMasterShapesText);

    connect(widget.useMasterBackground, SIGNAL(clicked(bool)), SLOT(useMasterBackground(bool)));
    connect(widget.backgroundImage, SIGNAL(clicked(bool)), SLOT(setBackgroundImage()));
    connect(widget.displayMasterShapes, SIGNAL(clicked(bool)), SLOT(displayMasterShapes(bool)));

    connect(m_tool->view()->proxyObject, SIGNAL(activePageChanged()), SLOT(slotActivePageChanged()));

    slotActivePageChanged();
}
예제 #4
0
void KoPABackgroundTool::activate(ToolActivation toolActivation, const QSet<KoShape*> &)
{
    Q_UNUSED(toolActivation);

    canvas()->shapeManager()->selection()->deselectAll();
    canvas()->resourceManager()->setResource( KoPageApp::CurrentPage, m_view->activePage() );

    connect( m_view->proxyObject, SIGNAL( activePageChanged() ), this, SLOT( slotActivePageChanged() ) );
}
void UBWebController::webBrowserInstance()
{
    QString webHomePage = UBSettings::settings()->webHomePage->get().toString();
    QUrl currentUrl = WBBrowserWindow::guessUrlFromString(webHomePage);

    if (UBSettings::settings()->webUseExternalBrowser->get().toBool())
    {
        QDesktopServices::openUrl(currentUrl);
    }
    else
    {
        if (!mCurrentWebBrowser)
        {
            mCurrentWebBrowser = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow);

            mMainWindow->addWebWidget(mCurrentWebBrowser);

            connect(mCurrentWebBrowser, SIGNAL(activeViewChange(QWidget*)), this, SLOT(setSourceWidget(QWidget*)));

            WBBrowserWindow::downloadManager()->setParent(mCurrentWebBrowser, Qt::Tool);

            UBApplication::app()->insertSpaceToToolbarBeforeAction(mMainWindow->webToolBar, mMainWindow->actionBoard, 32);
            UBApplication::app()->decorateActionMenu(mMainWindow->actionMenu);

            bool showAddBookmarkButtons = UBSettings::settings()->webShowAddBookmarkButton->get().toBool();
            mMainWindow->actionBookmarks->setVisible(showAddBookmarkButtons);
            mMainWindow->actionAddBookmark->setVisible(showAddBookmarkButtons);

            showTabAtTop(UBSettings::settings()->appToolBarPositionedAtTop->get().toBool());

            adaptToolBar();

            mTrapFlashController = new UBTrapFlashController(mCurrentWebBrowser);

            connect(mCurrentWebBrowser, SIGNAL(activeViewPageChanged()), this, SLOT(activePageChanged()));

            mCurrentWebBrowser->loadUrl(currentUrl);

            mCurrentWebBrowser->tabWidget()->tabBar()->show();
            mCurrentWebBrowser->tabWidget()->lineEdits()->show();
        }

        UBApplication::applicationController->setMirrorSourceWidget(mCurrentWebBrowser->paintWidget());
        mMainWindow->switchToWebWidget();

        setupPalettes();
        screenLayoutChanged();

        bool mirroring = UBSettings::settings()->webShowPageImmediatelyOnMirroredScreen->get().toBool();
        UBApplication::mainWindow->actionWebShowHideOnDisplay->setChecked(mirroring);
        mToolsCurrentPalette->show();
    }
KoPABackgroundToolWidget::KoPABackgroundToolWidget( KoPABackgroundTool *tool, QWidget *parent )
: QWidget( parent )
, m_tool( tool )
{
    setObjectName( "KoPABackgroundToolWidget" );
    widget.setupUi( this );
    connect( widget.backgroundImage, SIGNAL( clicked( bool ) ), this, SLOT( setBackgroundImage() ) );
    connect( widget.useMasterBackground, SIGNAL( stateChanged( int ) ), this, SLOT( useMasterBackground( int ) ) );
    connect( widget.displayMasterShapes, SIGNAL( stateChanged( int ) ), this, SLOT( displayMasterShapes( int ) ) );

    connect( m_tool->view()->proxyObject, SIGNAL( activePageChanged() ), this, SLOT( slotActivePageChanged() ) );

    slotActivePageChanged();
}
예제 #7
0
KoPageNavigator::KoPageNavigator(KoPAView *view)
  : QStackedWidget(view)
  , d(new Private(view))
{
    const bool isSlideType = (d->view->kopaDocument()->pageType() == KoPageApp::Slide);

#ifdef Q_WS_MAC
    setAttribute(Qt::WA_MacMiniSize, true);
#endif
    // normal display
    d->displayLabel = new QLabel(this);
    d->displayLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
    addWidget(d->displayLabel);

    // add interactive variant
    QWidget* controlWidget = new QWidget(this);
    QHBoxLayout* layout = new QHBoxLayout(controlWidget);
    layout->setSpacing(0);
    layout->setMargin(0);

    // the original go-*-view-page icons as set for the actions are not reused,
    // because they look too complex, at least with the Oxygen icons
    // also installing an event filter for all buttons, to get wheel events even
    // for disabled buttons
    d->gotoFirstPageButton = new KoPageNavigatorButton(koIconNameCStr("go-first-view"), this);
    d->gotoFirstPageButton->installEventFilter(this);
    d->gotoPreviousPageButton = new KoPageNavigatorButton(koIconNameCStr("go-previous-view"), this);
    d->gotoPreviousPageButton->installEventFilter(this);
    d->gotoNextPageButton = new KoPageNavigatorButton(koIconNameCStr("go-next-view"), this);
    d->gotoNextPageButton->installEventFilter(this);
    d->gotoLastPageButton = new KoPageNavigatorButton(koIconNameCStr("go-last-view"), this);
    d->gotoLastPageButton->installEventFilter(this);

    d->pageNumberEdit = new QLineEdit(this);
    d->pageNumberEdit->installEventFilter(this);
    d->pageNumberEditValidator = new QIntValidator(d->pageNumberEdit);
    d->pageNumberEditValidator->setBottom(1);
    d->pageNumberEdit->setValidator(d->pageNumberEditValidator);
    d->pageNumberEdit->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    connect(d->pageNumberEdit, SIGNAL(returnPressed()), SLOT(onPageNumberEntered()));

    layout->addWidget(d->gotoFirstPageButton);
    layout->addWidget(d->gotoPreviousPageButton);
    layout->addWidget(d->pageNumberEdit);
    layout->addWidget(d->gotoNextPageButton);
    layout->addWidget(d->gotoLastPageButton);

    addWidget(controlWidget);

    KoPADocument *const kopaDocument = d->view->kopaDocument();
    connect(kopaDocument, SIGNAL(pageAdded(KoPAPageBase*)), SLOT(updateDisplayLabel()));
    connect(kopaDocument, SIGNAL(pageRemoved(KoPAPageBase*)), SLOT(updateDisplayLabel()));
    connect(d->view->proxyObject, SIGNAL(activePageChanged()), SLOT(updateDisplayLabel()));

    // Fix width by the largest needed
    QFontMetrics fontMetrics(font());
    d->pageNumberEdit->setMinimumWidth(fontMetrics.width(QString::number(maxPageCountPattern*10))); //one more
    const int editWidth = widget(Edit)->minimumWidth();
    const int normalWidth = fontMetrics.width(displayText(false, isSlideType, maxPageCountPattern, maxPageCountPattern));
    const int masterWidth = fontMetrics.width(displayText(true, isSlideType, maxPageCountPattern, maxPageCountPattern));
    setFixedWidth(qMax(editWidth, qMax(normalWidth, masterWidth)));

    updateDisplayLabel();
}
예제 #8
0
void KoPABackgroundTool::deactivate()
{
    disconnect( m_view->proxyObject, SIGNAL( activePageChanged() ), this, SLOT( slotActivePageChanged() ) );
    canvas()->resourceManager()->clearResource( KoPageApp::CurrentPage );
}