void SphereBot::sendNextLine(){ if(state!=Spherebot::SB_Printing) return; if(fileStream->atEnd()){ state=Spherebot::SB_Idle; file->close(); fileStream->reset(); disableSteppers(); emit printDone(); return; } QString line=fileStream->readLine(); QString stripped = QString(line); stripped.remove(QRegExp("\\((.*)\\)")); if (stripped.length()>1){ if (stripped.startsWith("M01")){ state=Spherebot::SB_WaitUserOk; emit printPause(line); return; } else { state=Spherebot::SB_WaitPrinterOk; serial->write(stripped.append("\n").toUtf8()); return; } } sendNextLine(); }
void RecipeActionsHandler::print(bool ok) { Q_UNUSED(ok) QPrinter printer; QPointer<QPrintPreviewDialog> previewdlg = new QPrintPreviewDialog(&printer); //Show the print preview dialog. connect(previewdlg, SIGNAL(paintRequested(QPrinter *)), m_printPage->mainFrame(), SLOT(print(QPrinter *))); previewdlg->exec(); delete previewdlg; //Remove the temporary directory which stores the HTML and free memory. m_tempdir->unlink(); delete m_tempdir; emit( printDone() ); }
RecipeActionsHandler::RecipeActionsHandler( K3ListView *_parentListView, RecipeDB *db ) : QObject( _parentListView ), parentListView( _parentListView ), database( db ), categorizeAction( 0 ), removeFromCategoryAction( 0 ) { kpop = new KMenu( parentListView ); catPop = new KMenu( parentListView ); connect( parentListView, SIGNAL( contextMenu( K3ListView *, Q3ListViewItem *, const QPoint & ) ), SLOT( showPopup( K3ListView *, Q3ListViewItem *, const QPoint & ) ) ); connect( parentListView, SIGNAL( doubleClicked( Q3ListViewItem*, const QPoint &, int ) ), SLOT( open() ) ); connect( parentListView, SIGNAL( selectionChanged() ), SLOT( selectionChangedSlot() ) ); connect( this, SIGNAL( printDone() ), this, SLOT( printDoneSlot() ), Qt::QueuedConnection ); }