unsigned long HelpFindTopicOffset( HelpHdl hdl, char *topic ) { unsigned entry_num; PageIndexEntry *entry; char *foundtopic; if( hdl == NULL ) return( -1 ); loadPage( hdl, 0 ); while( pageHeader->type != PAGE_DATA ) { loadNextPage( hdl, topic ); } foundtopic = findEntry( hdl, topic, &entry_num ); if( !stricmp( foundtopic, topic ) ) { entry = pageIndex; return( entry[ entry_num ].entry_offset ); } else { return( -1 ); } }
unsigned HelpFindFirst( HelpHdl hdl, char *name, HelpSrchInfo *info ) { unsigned ret; PageIndexEntry *entry; loadPage( hdl, 0 ); while( pageHeader->type != PAGE_DATA ) { loadNextPage( hdl, name ); } findEntry( hdl, name, &ret ); if( info != NULL ) { info->hdl = hdl; info->entry = ret; info->page = pageHeader->page_num; entry = pageIndex; info->offset = entry[ info->entry ].entry_offset; } ret += hdl->itemindex[ pageHeader->page_num - hdl->header.indexpagecnt ]; return( ret ); }
void ValueTabView::initPagination() { paginationGrid = new QGridLayout(); previousPage = new QPushButton(); previousPage->setText("<"); previousPage->setEnabled(false); nextPage = new QPushButton(); nextPage->setText(">"); nextPage->setEnabled(false); pagination = new QLabel; pagination->setAlignment(Qt::AlignCenter); paginationGrid->addWidget(previousPage, 0, 0, 1, 1); paginationGrid->addWidget(pagination, 0, 1, 1, 1); paginationGrid->addWidget(nextPage, 0, 2, 1, 1); gridLayout->addLayout(paginationGrid, 2, 0, 1, 2); connect(keyValue->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(onSelectedItemChanged(const QModelIndex &, const QModelIndex &))); paginatedModel = (PaginatedModel *) keyValue->model(); int pagesCount = paginatedModel->getPagesCount(); pagination->setText( QString("Page <b>1</b> of <b>%1</b> (Items: %2)") .arg(pagesCount) .arg(paginatedModel->itemsCount()) ); if (pagesCount > 1) { nextPage->setEnabled(true); connect(nextPage, SIGNAL(clicked()), this, SLOT(loadNextPage())); connect(previousPage, SIGNAL(clicked()), this, SLOT(loadPreviousPage())); } }
MainForm::MainForm(QWidget *parent): QMainWindow(parent) { setupUi(this); ///!!!!! //alignButton->hide(); //unalignButton->hide(); setWindowTitle("YAGF"); spellChecker = new SpellChecker(textEdit); spellChecker->enumerateDicts(); selectLangsBox = new QComboBox(); QLabel *label = new QLabel(); label->setMargin(4); label->setText(trUtf8("Recognition language")); frame->show(); toolBar->addWidget(label); selectLangsBox->setFrame(true); toolBar->addWidget(selectLangsBox); graphicsInput = new QGraphicsInput(QRectF(0, 0, 2000, 2000), graphicsView) ; graphicsInput->addToolBarAction(actionHideShowTolbar); graphicsInput->addToolBarAction(this->actionTBLV); graphicsInput->addToolBarAction(this->actionSmaller_view); graphicsInput->addToolBarSeparator(); graphicsInput->addToolBarAction(actionRotate_90_CCW); graphicsInput->addToolBarAction(actionRotate_180); graphicsInput->addToolBarAction(actionRotate_90_CW); graphicsInput->addToolBarAction(actionDeskew); graphicsInput->addToolBarSeparator(); graphicsInput->addToolBarAction(actionSelect_Text_Area); graphicsInput->addToolBarAction(actionSelect_multiple_blocks); graphicsInput->addToolBarAction(ActionClearAllBlocks); statusBar()->show(); imageLoaded = false; useXSane = TRUE; textSaved = TRUE; hasCopy = false; //rotation = 0; m_menu = new QMenu(graphicsView); ifCounter = 0; connect(actionOpen, SIGNAL(triggered()), this, SLOT(loadImage())); connect(actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(this, SIGNAL(windowShown()), this, SLOT(onShowWindow()), Qt::QueuedConnection); connect(actionScan, SIGNAL(triggered()), this, SLOT(scanImage())); connect(actionPreviousPage, SIGNAL(triggered()), this, SLOT(loadPreviousPage())); connect(actionNextPage, SIGNAL(triggered()), this, SLOT(loadNextPage())); connect(actionRecognize, SIGNAL(triggered()), this, SLOT(recognize())); connect(action_Save, SIGNAL(triggered()), this, SLOT(saveText())); connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDlg())); connect(actionOnlineHelp, SIGNAL(triggered()), this, SLOT(showHelp())); connect(actionCopyToClipboard, SIGNAL(triggered()), this, SLOT(copyClipboard())); textEdit->setContextMenuPolicy(Qt::CustomContextMenu); connect(textEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); connect(textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(copyAvailable(bool))); connect(textEdit, SIGNAL(textChanged()), this, SLOT(textChanged())); connect(graphicsInput, SIGNAL(rightMouseClicked(int, int, bool)), this, SLOT(rightMouseClicked(int, int, bool))); tesMap = new TesMap(); fillLanguagesBox(); initSettings(); delTmpFiles(); scanProcess = new QProcess(this); QXtUnixSignalCatcher::connectUnixSignal(SIGUSR2); ba = new QByteArray(); connect(QXtUnixSignalCatcher::catcher(), SIGNAL(unixSignal(int)), this, SLOT(readyRead(int))); connect(textEdit->document(), SIGNAL(cursorPositionChanged(const QTextCursor &)), this, SLOT(updateSP())); //displayLabel->installEventFilter(this); textEdit->installEventFilter(this); QPixmap l_cursor; l_cursor.load(":/resize.png"); resizeCursor = new QCursor(l_cursor); graphicsInput->setMagnifierCursor(resizeCursor); l_cursor.load(":/resize_block.png"); resizeBlockCursor = new QCursor(l_cursor); // textEdit->setContextMenuPolicy(Qt::ActionsContextMenu); this->sideBar->show(); connect(sideBar, SIGNAL(fileSelected(const QString &)), this, SLOT(fileSelected(const QString &))); connect(actionRecognize_All_Pages, SIGNAL(triggered()), this, SLOT(recognizeAll())); graphicsInput->setSideBar(sideBar); QPixmap pm; pm.load(":/align.png"); //alignButton->setIcon(pm); pm.load(":/undo.png"); //unalignButton->setIcon(pm); //connect(unalignButton, SIGNAL(clicked()), this, SLOT(unalignButtonClicked())); //clearBlocksButton->setDefaultAction(ActionClearAllBlocks); loadFromCommandLine(); emit windowShown(); pdfx = NULL; if (findProgram("pdftoppm")) { pdfx = new PDF2PPT(); } else if (findProgram("gs")) { pdfx = new GhostScr(); } if (pdfx) { connect(pdfx, SIGNAL(addPage(QString)), this, SLOT(addPDFPage(QString)), Qt::QueuedConnection); connect (pdfx, SIGNAL(finished()), this, SLOT(finishedPDF())); } pdfPD.setWindowTitle("YAGF"); pdfPD.setLabelText(trUtf8("Importing pages from the PDF document...")); pdfPD.setCancelButtonText(trUtf8("Cancel")); pdfPD.setMinimum(-1); pdfPD.setMaximum(-1); pdfPD.setWindowIcon(QIcon(":/yagf.png")); if (pdfx) connect(&pdfPD, SIGNAL(canceled()), pdfx, SLOT(cancel())); }