Example #1
0
/*
 * starts visual ocr process. Depending on the ocr engine, this function creates
 * a new dialog, and shows it.
 */
bool KSANEOCR::startOCRVisible( QWidget *parent )
{
   if( visibleOCRRunning ) return( false );
   bool res = true;

   m_parent = parent;

   if( m_ocrEngine == GOCR )
   {
       m_ocrProcessDia = new KGOCRDialog ( parent, m_spellInitialConfig );
   }
   else if( m_ocrEngine == OCRAD )
   {
       m_ocrProcessDia = new ocradDialog( parent, m_spellInitialConfig );
   }
   else if( m_ocrEngine == KADMOS )
   {
#ifdef HAVE_KADMOS
/*** Kadmos Engine OCR ***/
       m_ocrProcessDia = new KadmosDialog( parent, m_spellInitialConfig );
#else
       KMessageBox::sorry(0, i18n("This version of Kooka was not compiled with KADMOS support.\n"
           "Please select another OCR engine in Kooka's options dialog."));
       kdDebug(28000) << "Sorry, this version of Kooka has no KADMOS support" << endl;
#endif /* HAVE_KADMOS */
   }
   else
   {
      kdDebug(28000) << "ERR Unknown OCR engine requested!" << endl;
   }

   /*
    * this part is independant from the engine again
    */
   if( m_ocrProcessDia )
   {
       m_ocrProcessDia->setupGui();

       m_ocrProcessDia->introduceImage( m_img );
       visibleOCRRunning = true;

      connect( m_ocrProcessDia, SIGNAL( user1Clicked()), this, SLOT( startOCRProcess() ));
      connect( m_ocrProcessDia, SIGNAL( closeClicked()), this, SLOT( slotClose() ));
      connect( m_ocrProcessDia, SIGNAL( user2Clicked()), this, SLOT( slotStopOCR() ));
      m_ocrProcessDia->show();

   }
   return( res );
}
Example #2
0
/*
 * starts visual ocr process. Depending on the ocr engine, this function creates
 * a new dialog, and shows it.
 */
bool OcrEngine::startOCRVisible(QWidget *parent)
{
    if (m_ocrRunning)
    {
        KMessageBox::sorry(parent, i18n("OCR is already running"));
        return (false);
    }

    m_parent = parent;

    m_ocrDialog = createOCRDialog(parent);
    if (m_ocrDialog==NULL) return (false);

    m_ocrDialog->setupGui();
    m_ocrDialog->introduceImage(&m_introducedImage);

    connect(m_ocrDialog, SIGNAL(signalOcrStart()), SLOT(startOCRProcess()));
    connect(m_ocrDialog, SIGNAL(signalOcrStop()), SLOT(slotStopOCR()));
    connect(m_ocrDialog, SIGNAL(signalOcrClose()), SLOT(slotClose()));
    m_ocrDialog->show();

    m_ocrRunning = true;
    return (true);
}