コード例 #1
0
void pageNumberEdit::setMaxPageNum(int max) { 
  int curNum = getCurrentPageNum();
  numberOfPages = max;
  if ( curNum > max ) { 
    setPageNumber( max );
  } else if ( curNum < 1 ) { 
    setPageNumber( 1 );
  }
  pageEdit->setCursorPosition( 0 );
}
コード例 #2
0
void pageNumberEdit::wantPrev() { 
  int cur = getCurrentPageNum();
  if ( getCurrentPageNum() > 1 ) {
       setPageNumber( cur-1 );
       emit prevPage();
  }
}
コード例 #3
0
void pageNumberEdit::wantNext() { 
  int cur = getCurrentPageNum();
  if ( cur < numberOfPages ) {
    setPageNumber( cur+1 );
    emit nextPage();
  }
}
コード例 #4
0
ファイル: pageitem.cpp プロジェクト: swatilodha/okular
void PageItem::documentPathChanged()
{
    m_page = 0;
    setPageNumber(0);

    m_redrawTimer->start();
}
コード例 #5
0
void pageNumberEdit::pageNumberChanged() { 
  QString pagePart = getPagePartOfEdit();
  if ( pagePart == "" ) return;
  int cPos = pageEdit->cursorPosition();
  bool ok;
  int newPageNumber = pagePart.toInt(&ok);
  if ( ok && 1 <= newPageNumber && newPageNumber <= numberOfPages ) { 
    return;
  } else { 
    setPageNumber( lastValidPageNumber );
    pageEdit->setCursorPosition( 0 );
  }
}
コード例 #6
0
ファイル: pageitem.cpp プロジェクト: swatilodha/okular
void PageItem::goToBookmark(const QString &bookmark)
{
    Okular::DocumentViewport viewPort(KUrl(bookmark).htmlRef());
    setPageNumber(viewPort.pageNumber);

    //Are we in a flickable?
    if (m_flickable) {
        //normalizedX is a proportion, so contentX will be the difference between document and viewport times normalizedX
        m_flickable.data()->setProperty("contentX", qMax((qreal)0, width() - m_flickable.data()->width()) * viewPort.rePos.normalizedX);

        m_flickable.data()->setProperty("contentY", qMax((qreal)0, height() - m_flickable.data()->height()) * viewPort.rePos.normalizedY);
    }
}
コード例 #7
0
UBPageNumberPalette::UBPageNumberPalette(QWidget *parent)
    : UBFloatingPalette(Qt::BottomRightCorner, parent)
{
    mLayout = new QHBoxLayout(this);
    mButton = new QPushButton(parent);
    mButton->setStyleSheet(QString("QPushButton { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }"));
    mButton->setFocusPolicy(Qt::NoFocus);
    connect(mButton, SIGNAL(clicked(bool)), this, SLOT(buttonClicked(bool)));

    mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4);

    mLayout->addWidget(mButton);

    setPageNumber(0, 0);
}
コード例 #8
0
/**
 * \brief Constructor
 * @param parent as the parent widget
 * @param name as the object name
 */
UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
  , mNavigator(NULL)
  , mLayout(NULL)
  , mHLayout(NULL)
  , mPageNbr(NULL)
  , mClock(NULL)
{
    setObjectName(name);
    mName = "PageNavigator";
    setAttribute(Qt::WA_StyledBackground, true);
    setStyleSheet(UBApplication::globalStyleSheet());

    mIconToRight = QPixmap(":images/pages_open.png");
    mIconToLeft = QPixmap(":images/pages_close.png");

    // Build the gui
    mLayout = new QVBoxLayout(this);
    setLayout(mLayout);

    mNavigator = new UBDocumentNavigator(this);
    mLayout->addWidget(mNavigator, 1);

    mHLayout = new QHBoxLayout();
    mLayout->addLayout(mHLayout, 0);

    mPageNbr = new QLabel(this);
    mClock = new QLabel(this);
    mHLayout->addWidget(mPageNbr);
    mHLayout->addWidget(mClock);

    // Configure the page number indicator
    mPageNbr->setStyleSheet(QString("QLabel { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }"));
    setPageNumber(0, 0);
    mPageNbr->setAlignment(Qt::AlignHCenter);

    // Configure the clock
    mClock->setStyleSheet(QString("QLabel {color: white; background-color: transparent; text-align: center; font-family: Arial; font-weight: bold; font-size: 20px}"));
    mTimeFormat = QLocale::system().timeFormat(QLocale::ShortFormat);
    mClock->setAlignment(Qt::AlignHCenter);

    //strip seconds
    mTimeFormat = mTimeFormat.remove(":ss");
    mTimeFormat = mTimeFormat.remove(":s");
    mTimerID = startTimer(1000);

    connect(mNavigator, SIGNAL(changeCurrentPage()), this, SLOT(changeCurrentPage()));
    connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(onSetDocOnPageNavigator(UBDocumentProxy*)));
}
コード例 #9
0
ファイル: pageitem.cpp プロジェクト: swatilodha/okular
void PageItem::setDocument(DocumentItem *doc)
{
    if (doc == m_documentItem.data() || !doc) {
        return;
    }

    m_page = 0;
    disconnect(doc, 0, this, 0);
    m_documentItem = doc;
    Observer *observer = m_isThumbnail ? m_documentItem.data()->thumbnailObserver() : m_documentItem.data()->pageviewObserver();
    connect(observer, SIGNAL(pageChanged(int, int)), this, SLOT(pageHasChanged(int, int)));
    connect(doc->document()->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
            this, SLOT(checkBookmarksChanged()));
    setPageNumber(0);
    emit documentChanged();
    m_redrawTimer->start();

    connect(doc, SIGNAL(pathChanged()), this, SLOT(documentPathChanged()));
}
コード例 #10
0
/**
 * \brief Constructor
 * @param parent as the parent widget
 * @param name as the object name
 */
UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):
	UBDockPalette(eUBDockPaletteType_LEFT, parent, name)
	, mNavigator(NULL)
	, mLayout(NULL)
    , mHLayout(NULL)
    , mPageNbr(NULL)
    , mClock(NULL)
{
    // Build the gui
    mLayout = new QVBoxLayout(this);
    mLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin());
    setLayout(mLayout);

    mNavigator = new UBDocumentNavigator(this);
    mNavigator->setStyleSheet(QString("background-color : transparent;"));
    mLayout->addWidget(mNavigator, 1);

    mHLayout = new QHBoxLayout();
    mLayout->addLayout(mHLayout, 0);

    mPageNbr = new QLabel(this);
    mClock = new QLabel(this);
    mHLayout->addWidget(mPageNbr);
    mHLayout->addWidget(mClock);

    // Configure the page number indicator
    mPageNbr->setStyleSheet(QString("QLabel { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }"));
    setPageNumber(0, 0);
    mPageNbr->setAlignment(Qt::AlignHCenter);

    // Configure the clock
    mClock->setStyleSheet(QString("QLabel {color: white; background-color: transparent; text-align: center; font-family: Arial; font-weight: bold; font-size: 20px}"));
    mTimeFormat = QLocale::system().timeFormat(QLocale::ShortFormat);
    mClock->setAlignment(Qt::AlignHCenter);

    //strip seconds
    mTimeFormat = mTimeFormat.remove(":ss");
    mTimeFormat = mTimeFormat.remove(":s");
    mTimerID = startTimer(1000);

}