Exemple #1
0
void QucsApp::slotOpenRecent()
{
  QAction *action = qobject_cast<QAction *>(sender());
  if (action) {
    gotoPage(action->data().toString());
    updateRecentFilesList(action->data().toString());
  }
}
void QDesignerQ3WidgetStack::prevPage()
{
    if (count() > 1) {
        int newIndex = currentIndex() - 1;
        if (newIndex < 0)
            newIndex = count() - 1;
        gotoPage(newIndex);
    }
}
Exemple #3
0
// ------------------------------------------------------------------------
///
/// \brief QucsApp::editFile
/// \param File is the filename, or empty for a new file
///
/// Called by :
/// - slotTextNew()
/// - slotShowLastMsg()
/// - slotShowLastNetlist()
/// - edit properties of components (such as spice, verilog)
///
void QucsApp::editFile(const QString& File)
{
    if ((QucsSettings.Editor.toLower() == "qucs") | QucsSettings.Editor.isEmpty())
    {
        // The Editor is 'qucs' or empty, open a net document tab
        if (File.isEmpty()) {
            TextDoc *d = new TextDoc(this, "");
            int i = DocumentTab->addTab(d, QPixmap(":/bitmaps/empty.xpm"), QObject::tr("untitled"));
            DocumentTab->setCurrentIndex(i);
        }
        else
        {
            slotHideEdit(); // disable text edit of component property

            statusBar()->showMessage(tr("Opening file..."));

            QFileInfo finfo(File);

            if(!finfo.exists())
                statusBar()->showMessage(tr("Opening aborted, file not found."), 2000);
            else {
                gotoPage(File);
                lastDirOpenSave = File;   // remember last directory and file
                statusBar()->showMessage(tr("Ready."));
            }
        }
    }
    else
    {
      // use an external editor
      QString prog;
      QStringList args;

      QString editorPath = QucsSettings.Editor;
      QFileInfo editor(editorPath);
      prog = QDir::toNativeSeparators(editor.canonicalFilePath());

      if (!File.isEmpty()) {
          args << File;
      }

      QProcess *externalEditor = new QProcess();
      qDebug() << "Command: " << editorPath << args.join(" ");
      externalEditor->start(prog, args);

      if( !externalEditor->waitForStarted(1000) ) {
        QMessageBox::critical(this, tr("Error"), tr("Cannot start text editor: \n\n%1").arg(editorPath));
        delete externalEditor;
        return;
      }
      qDebug() << externalEditor->readAllStandardError();

      // to kill it before qucs ends
      connect(this, SIGNAL(signalKillEmAll()), externalEditor, SLOT(kill()));
    }
}
void QStackedWidgetPreviewEventFilter::nextPage()
{
    if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(stackedWidget())) {
        fw->clearSelection();
        fw->selectWidget(stackedWidget(), true);
    }
    const int count = m_stackedWidget->count();
    if (count > 1)
        gotoPage((m_stackedWidget->currentIndex() + 1) % count);
}
Exemple #5
0
void PagePalette::pageView_gotoPage(int r, int c, int b)
{
	int p;
	bool dummy;
	if ((b == Qt::LeftButton) && (r != -1) && (c != -1))
	{
		p = pageView->GetPage(r, c, &dummy);
		emit gotoPage(p);
	}
}
Exemple #6
0
MiniBar::MiniBar( QWidget * parent, KPDFDocument * document )
    : QFrame( parent, "miniBar" ), m_document( document ),
    m_currentPage( -1 )
{
    // left spacer
    QHBoxLayout * horLayout = new QHBoxLayout( this );
    QSpacerItem * spacerL = new QSpacerItem( 20, 10, QSizePolicy::Expanding );
    horLayout->addItem( spacerL );

    // central 2r by 3c grid layout that contains all components
    QGridLayout * gridLayout = new QGridLayout( 0, 3,5, 2,1 );
     // top spacer 6x6 px
//     QSpacerItem * spacerTop = new QSpacerItem( 6, 6, QSizePolicy::Fixed, QSizePolicy::Fixed );
//     gridLayout->addMultiCell( spacerTop, 0, 0, 0, 4 );
     // center progress widget
     m_progressWidget = new ProgressWidget( this );
     gridLayout->addMultiCellWidget( m_progressWidget, 0, 0, 0, 4 );
     // bottom: left prev_page button
     m_prevButton = new HoverButton( this );
     m_prevButton->setIconSet( SmallIconSet( QApplication::reverseLayout() ? "1rightarrow" : "1leftarrow" ) );
     gridLayout->addWidget( m_prevButton, 1, 0 );
     // bottom: left lineEdit (current page box)
     m_pagesEdit = new PagesEdit( this );
     gridLayout->addWidget( m_pagesEdit, 1, 1 );
     // bottom: central '/' label
     gridLayout->addWidget( new QLabel( "/", this ), 1, 2 );
     // bottom: right button
     m_pagesButton = new HoverButton( this );
     gridLayout->addWidget( m_pagesButton, 1, 3 );
     // bottom: right next_page button
     m_nextButton = new HoverButton( this );
     m_nextButton->setIconSet( SmallIconSet( QApplication::reverseLayout() ? "1leftarrow" : "1rightarrow" ) );
     gridLayout->addWidget( m_nextButton, 1, 4 );
    horLayout->addLayout( gridLayout );

    // right spacer
    QSpacerItem * spacerR = new QSpacerItem( 20, 10, QSizePolicy::Expanding );
    horLayout->addItem( spacerR );

    // customize own look
    setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

    // connect signals from child widgets to internal handlers / signals bouncers
    connect( m_pagesEdit, SIGNAL( returnPressed() ), this, SLOT( slotChangePage() ) );
    connect( m_pagesButton, SIGNAL( clicked() ), this, SIGNAL( gotoPage() ) );
    connect( m_prevButton, SIGNAL( clicked() ), this, SIGNAL( prevPage() ) );
    connect( m_nextButton, SIGNAL( clicked() ), this, SIGNAL( nextPage() ) );

    // widget starts hidden (will be shown after opening a document)
    parent->hide();
}
void QStackedWidgetPreviewEventFilter::prevPage()
{
    if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(stackedWidget())) {
        fw->clearSelection();
        fw->selectWidget(stackedWidget(), true);
    }
    const int count = m_stackedWidget->count();
    if (count > 1) {
        int newIndex = m_stackedWidget->currentIndex() - 1;
        if (newIndex < 0)
            newIndex = count - 1;
        gotoPage(newIndex);
    }
}
Exemple #8
0
/// Select the content and broadcast position signal.
bool CatalogView::select(OData *d)
{
    int pos = data().indexOf(ODataPtr(d));
    if (pos < 0)
    {
        return false;
    }

    int page = pos / paginator().items_per_page();
    gotoPage(page + 1);
    int offset = pos - page * paginator().items_per_page();
    setFocusTo(offset / paginator().cols(), offset % paginator().cols());
    onyx::screen::watcher().enqueue(parentWidget(), onyx::screen::ScreenProxy::GC);
    return true;
}
Exemple #9
0
// ------------------------------------------------------------------------
// Is called by slotShowLastMsg(), by slotShowLastNetlist() and from the
// component edit dialog.
void QucsApp::editFile(const QString& File)
{

    if (QucsSettings.Editor.toLower() == "qucs" | QucsSettings.Editor.isEmpty())
    {
        // The Editor is 'qucs' or empty, open it in an editor tab
        editText->setHidden(true); // disable text edit of component property

        statusBar()->message(tr("Opening file..."));

        QFileInfo finfo(File);

        if(!finfo.exists())
          statusBar()->message(tr("Opening aborted, file not found."), 2000);
        else {
          gotoPage(File);
          lastDirOpenSave = File;   // remember last directory and file
          statusBar()->message(tr("Ready."));
        }
    }
    else
    {
      // use an external editor
      QStringList com;

      com << QucsSettings.Editor;

      if (!File.isEmpty())
      {
          com << File;
      }

      Q3Process *QucsEditor = new Q3Process(com);
      QucsEditor->setCommunication(0);
      if(!QucsEditor->start()) {
        QMessageBox::critical(this, tr("Error"), tr("Cannot start text editor!"));
        delete QucsEditor;
        return;
      }

      // to kill it before qucs ends
      connect(this, SIGNAL(signalKillEmAll()), QucsEditor, SLOT(kill()));
    }
}
Exemple #10
0
void UiManager::init(PhotoKitView *view)
{
	mView = view;
    mThumbPageRoot = new BaseItem;
    mCurrentPageRoot = mThumbPageRoot;
	mThumbPageRoot->setAcceptHoverEvents(true);
	X0 = qMin<qreal>(qMax<qreal>(qApp->desktop()->width() - (Config::thumbRows+1)*(2*(Config::thumbMargin + Config::thumbBorder)
			+ Config::thumbSpacing + Config::thumbItemWidth), 0.5*Config::thumbItemWidth), Config::contentHMargin);
	Y0 = qMin<qreal>(qMax<qreal>((qreal)qApp->desktop()->height() - ((qreal)Config::thumbRows + 1)*((Config::thumbBorder
            + Config::thumbMargin)*2 + Config::thumbSpacing + Config::thumbItemHeight), - 0.5*Config::thumbItemHeight), Config::contentVMargin);
	Y0 = qMax<qreal>(Y0, 0.5*(qApp->desktop()->height() - (Config::thumbRows+2)*(Config::thumbItemHeight
			+ 2*(Config::thumbMargin + Config::thumbBorder) + Config::thumbSpacing)));
	qDebug("************%f, %f", X0, Y0);
    //content can't move if setPos?
    //mThumbPageRoot->setPos(Config::contentHMargin, qMax<qreal>(Config::thumbItemHeight, y));//contentVMargin); //TODO: ensure see the reflection
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#else
	mThumbPageRoot->translate(-X0, Y0); //no this api in Qt5
#endif //QT_VERSION_CHECK(5, 0, 0)
	mThumbPageRoot->setPos(X0, Y0);
    mThumbPageRoot->setTransform(QTransform().scale(0.5, 0.5));
	mView->scene()->addItem(mThumbPageRoot);
	mPlayPageRoot = new SlideDisplay;
    //mPlayPageRoot->setPos(0, 0);
	mPlayPageRoot->hide();
	mView->scene()->addItem(mPlayPageRoot);
	mPlayControl = new SlidePlayControl(this);
	mPlayPageRoot->setPlayControl(mPlayControl);

	mSearchPageRoot = new BaseItem;
	mSearchPageRoot->setPos(0, Y0);
	mView->scene()->addItem(mSearchPageRoot);

    createMenus(); //before gotoPage
	showMenu(kThumbPageMenu);

    gotoPage(ThumbPage);
	//mView->setInitialPos(X0, Y0);
	mView->setAnimationDuration(1618);
	//mView->smartTransform(X0, Y0, 0.5, 1, 0, 0, 0, 0, 0);
	mView->smartTransform(0, 0, 0.5, 1, 0, 0, 0, 0, 0);

}
void QDesignerQ3WidgetStack::nextPage()
{
    if (count() > 1)
        gotoPage((currentIndex() + 1) % count());
}
void pageNumberEdit::wantGoTo() { 
  int cur = getCurrentPageNum();
  if ( cur <= numberOfPages && 0 < cur) { 
    emit gotoPage( cur );
  }
}
Exemple #13
0
DSPDFViewer::DSPDFViewer(const RuntimeConfiguration& r): 
	runtimeConfiguration(r),
	pdfDocument(Poppler::Document::load(r.filePathQString()))
	,
 renderFactory(r.filePathQString()),
 m_pagenumber(0),
 audienceWindow(0,  r.useFullPage()? PagePart::FullPage : PagePart::LeftHalf , false, r),
 secondaryWindow(1, r.useFullPage()? PagePart::FullPage : PagePart::RightHalf, true, r, r.useSecondScreen() )
{
  qDebug() << "Starting constructor" ;
  
  if ( ! r.useSecondScreen() ) {
    secondaryWindow.hide();
  }
  
  audienceWindow.showLoadingScreen(0);
  secondaryWindow.showLoadingScreen(0);
  
  if ( ! pdfDocument  || pdfDocument->isLocked() )
  {
    /// FIXME: Error message
    throw std::runtime_error("I was not able to open the PDF document. Sorry.");
  }
  setHighQuality(true);
  
  qDebug() << "Connecting audience window";
  
  audienceWindow.setPageNumberLimits(0, numberOfPages()-1);
  
  connect( &renderFactory, SIGNAL(pageRendered(QSharedPointer<RenderedPage>)), &audienceWindow, SLOT(renderedPageIncoming(QSharedPointer<RenderedPage>)));
  connect( &renderFactory, SIGNAL(thumbnailRendered(QSharedPointer<RenderedPage>)), &audienceWindow, SLOT(renderedThumbnailIncoming(QSharedPointer<RenderedPage>)));
  
  connect( &audienceWindow, SIGNAL(nextPageRequested()), this, SLOT(goForward()));
  connect( &audienceWindow, SIGNAL(previousPageRequested()), this, SLOT(goBackward()));
  connect( &audienceWindow, SIGNAL(pageRequested(uint)), this, SLOT(gotoPage(uint)));
  
  connect( &audienceWindow, SIGNAL(quitRequested()), this, SLOT(exit()));
  connect( &audienceWindow, SIGNAL(rerenderRequested()), this, SLOT(renderPage()));
  connect( &audienceWindow, SIGNAL(restartRequested()), this, SLOT(goToStartAndResetClocks()));
  
  connect( &audienceWindow, SIGNAL(screenSwapRequested()), this, SLOT(swapScreens()) );
  
  if ( r.useSecondScreen() )
  {
    qDebug() << "Connecting secondary window";
    
    secondaryWindow.setPageNumberLimits(0, numberOfPages()-1);
    
    connect( &renderFactory, SIGNAL(pageRendered(QSharedPointer<RenderedPage>)), &secondaryWindow, SLOT(renderedPageIncoming(QSharedPointer<RenderedPage>)));
    connect( &renderFactory, SIGNAL(thumbnailRendered(QSharedPointer<RenderedPage>)), &secondaryWindow, SLOT(renderedThumbnailIncoming(QSharedPointer<RenderedPage>)));

    connect( &secondaryWindow, SIGNAL(nextPageRequested()), this, SLOT(goForward()));
    connect( &secondaryWindow, SIGNAL(previousPageRequested()), this, SLOT(goBackward()));
    connect( &secondaryWindow, SIGNAL(pageRequested(uint)), this, SLOT(gotoPage(uint)));
    
    connect( &secondaryWindow, SIGNAL(quitRequested()), this, SLOT(exit()));
    connect( &secondaryWindow, SIGNAL(rerenderRequested()), this, SLOT(renderPage()));
    connect( &secondaryWindow, SIGNAL(restartRequested()), this, SLOT(goToStartAndResetClocks()));
    
    connect( &secondaryWindow, SIGNAL(screenSwapRequested()), this, SLOT(swapScreens()) );
    
    connect( this, SIGNAL(presentationClockUpdate(QTime)), &secondaryWindow, SLOT(updatePresentationClock(QTime)));
    connect( this, SIGNAL(slideClockUpdate(QTime)), &secondaryWindow, SLOT(updateSlideClock(QTime)));
    connect( this, SIGNAL(wallClockUpdate(QTime)), &secondaryWindow, SLOT(updateWallClock(QTime)));
  

  }
  
  renderPage();
  
  clockDisplayTimer.setInterval(TIMER_UPDATE_INTERVAL);
  clockDisplayTimer.start();
  connect( &clockDisplayTimer, SIGNAL(timeout()), this, SLOT(sendAllClockSignals()));
  sendAllClockSignals();
}
Exemple #14
0
void DSPDFViewer::goToStartAndResetClocks()
{
  presentationClockRunning=false;
  sendAllClockSignals();
  gotoPage(0);
}
Exemple #15
0
void DSPDFViewer::goForward()
{
  resetSlideClock();
  if ( pageNumber() < numberOfPages()-1 )
    gotoPage(pageNumber()+1);
}
Exemple #16
0
void DSPDFViewer::goBackward()
{
  resetSlideClock();
  if ( pageNumber() > 0 )
    gotoPage(pageNumber()-1);
}