void MainResourceLoader::receivedError(const ResourceError& error) { // Calling receivedMainResourceError will likely result in the last reference to this object to go away. RefPtr<MainResourceLoader> protect(this); RefPtr<Frame> protectFrame(m_frame); // It is important that we call FrameLoader::receivedMainResourceError before calling // FrameLoader::didFailToLoad because receivedMainResourceError clears out the relevant // document loaders. Also, receivedMainResourceError ends up calling a FrameLoadDelegate method // and didFailToLoad calls a ResourceLoadDelegate method and they need to be in the correct order. frameLoader()->receivedMainResourceError(error, true); if (!cancelled()) { ASSERT(!reachedTerminalState()); frameLoader()->didFailToLoad(this, error); releaseResources(); } ASSERT(reachedTerminalState()); }
void FlatTextarea::keyPressEvent(QKeyEvent *e) { bool shift = e->modifiers().testFlag(Qt::ShiftModifier); bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier), ctrlGood = (ctrl && cCtrlEnter()) || (!ctrl && !shift && !cCtrlEnter()) || (ctrl && shift); bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return); if (enter && ctrlGood) { emit submitted(ctrl && shift); } else if (e->key() == Qt::Key_Escape) { emit cancelled(); } else if (e->key() == Qt::Key_Tab || (ctrl && e->key() == Qt::Key_Backtab)) { if (ctrl) { e->ignore(); } else { emit tabbed(); } } else { QTextCursor tc(textCursor()); if (enter && ctrl) { e->setModifiers(e->modifiers() & ~Qt::ControlModifier); } QTextEdit::keyPressEvent(e); if (tc == textCursor()) { bool check = false; if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Up) { tc.movePosition(QTextCursor::Start, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor); check = true; } else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Down) { tc.movePosition(QTextCursor::End, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor); check = true; } if (check) { if (tc == textCursor()) { e->ignore(); } else { setTextCursor(tc); } } } } }
void WlanSnifferMainWindow::startWlanWizard(const WlanQtUtilsAp *ap) { OstTraceFunctionEntry0(WLANSNIFFERMAINWINDOW_STARTWLANWIZARD_ENTRY); if (mWizard == NULL) { // Stop WLAN scanning for the duration of WLAN Wizard mEngine->stopWlanScanning(); mWizard = QSharedPointer<WlanWizard>(new WlanWizard(this)); bool connectStatus = connect( mWizard.data(), SIGNAL(finished(int,bool)), this, SLOT(handleWlanWizardComplete(int,bool)), Qt::QueuedConnection); Q_ASSERT(connectStatus == true); connectStatus = connect( mWizard.data(), SIGNAL(cancelled()), this, SLOT(handleWlanWizardCancelled()), Qt::QueuedConnection); Q_ASSERT(connectStatus == true); // Create an IAP for a specific AP if (ap) { mWizard->setParameters( ap->value(WlanQtUtilsAp::ConfIdName).toString(), ap->value(WlanQtUtilsAp::ConfIdSsid).toByteArray(), ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toInt(), ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()); } // else: Add WLAN IAP manually mWizard->show(); }
void RemoteDevicePropertiesDialog::slotButtonClicked(int button) { switch (button) { case Ok: { RemoteFsDevice::Details d=remoteProp->details(); if (d.name!=remoteProp->origDetails().name && DevicesModel::self()->device(RemoteFsDevice::createUdi(d.name))) { MessageBox::error(this, tr("A remote device named '%1' already exists!\n\nPlease choose a different name.").arg(d.name)); } else { emit updatedSettings(devProp->settings(), remoteProp->details()); accept(); } break; } case Cancel: emit cancelled(); reject(); break; default: Dialog::slotButtonClicked(button); break; } }
void FlatInput::keyPressEvent(QKeyEvent *e) { QString was(text()); _kev = e; if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) { e->ignore(); } else { QLineEdit::keyPressEvent(e); } if (was == text()) { // call correct manually correctValue(_kev, was); _oldtext = text(); if (was != _oldtext) emit changed(); updatePlaceholder(); } if (e->key() == Qt::Key_Escape) { emit cancelled(); } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { emit accepted(); } _kev = 0; }
void Canvas::addRubber() { if (!d->wrapItem) { d->wrapItem = new ClickDragReleaseItem(d->canvasItem); } d->wrapItem->setFocus(); setFocus(); connect(d->wrapItem, SIGNAL(started(QPointF)), this, SLOT(slotAddItemStarted(QPointF))); connect(d->wrapItem, SIGNAL(moving(QRectF)), this, SLOT(slotAddItemMoving(QRectF))); connect(d->wrapItem, SIGNAL(finished(QRectF)), this, SLOT(slotAddItemFinished(QRectF))); connect(d->wrapItem, SIGNAL(cancelled()), this, SLOT(cancelAddItem())); }
AMControl::FailureExplanation CLSMAXvMotor::calibrate(double oldValue, double newValue) { // Check that this motor is connected and able to be calibrated before proceeding. if (!isConnected()) { AMErrorMon::alert(this, CLSMAXVMOTOR_NOT_CONNECTED, QString("Failed to calibrate %1: motor is not connected.").arg(name())); return AMControl::NotConnectedFailure; } if (!canCalibrate()) { AMErrorMon::alert(this, CLSMAXVMOTOR_CANNOT_CALIBRATE, QString("Failed to calibrate %1: motor cannot currently be calibrated.").arg(name())); return AMControl::OtherFailure; } // Proceed with creating calibration action. AMAction3 *action = createCalibrationAction(oldValue, newValue); // Check that a valid calibration action was generated. // If an invalid calibration action was generated, abort the calibration. if (!action) { AMErrorMon::alert(this, CLSMAXVMOTOR_INVALID_CALIBRATION_ACTION, QString("Did not calibrate %1: invalid calibration action generated.").arg(name())); return AMControl::LimitFailure; } // Proceed with initializing the calibration action. // Connect it's final-state signals to its deleteLater() slot to prevent memory leak. connect( action, SIGNAL(cancelled()), action, SLOT(deleteLater()) ); connect( action, SIGNAL(failed()), action, SLOT(deleteLater()) ); connect( action, SIGNAL(succeeded()), action, SLOT(deleteLater()) ); // Run action. action->start(); return AMControl::NoFailure; }
void SubresourceLoader::didCancel(const ResourceError& error) { ASSERT(!reachedTerminalState()); // Calling removeSubresourceLoader will likely result in a call to deref, so we must protect ourselves. RefPtr<SubresourceLoader> protect(this); if (m_client) m_client->didFail(this, error); if (cancelled()) return; // The only way the subresource loader can reach the terminal state here is if the run loop spins when calling // m_client->didFail. This should in theory not happen which is why the assert is here. ASSERT(!reachedTerminalState()); if (reachedTerminalState()) return; m_documentLoader->removeSubresourceLoader(this); ResourceLoader::didCancel(error); }
USAcquisition::USAcquisition(AcquisitionPtr base, QObject* parent) : QObject(parent), mBase(base), mReady(true), mInfoText("") { mCore.reset(new USSavingRecorder()); connect(mCore.get(), SIGNAL(saveDataCompleted(QString)), this, SLOT(checkIfReadySlot())); connect(mCore.get(), SIGNAL(saveDataCompleted(QString)), this, SIGNAL(saveDataCompleted(QString))); connect(this->getServices()->tracking().get(), &TrackingService::stateChanged, this, &USAcquisition::checkIfReadySlot); connect(this->getServices()->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(checkIfReadySlot())); connect(this->getServices()->video().get(), SIGNAL(activeVideoSourceChanged()), this, SLOT(checkIfReadySlot())); connect(this->getServices()->video().get(), &VideoService::connected, this, &USAcquisition::checkIfReadySlot); connect(mBase.get(), SIGNAL(started()), this, SLOT(recordStarted())); connect(mBase.get(), SIGNAL(acquisitionStopped()), this, SLOT(recordStopped()), Qt::QueuedConnection); connect(mBase.get(), SIGNAL(cancelled()), this, SLOT(recordCancelled())); this->checkIfReadySlot(); }
DownloadManager::DownloadManager(const QString &url, QString const & filename, QString const & title, QWidget *parent): QWidget( parent ), m_downloadManager( new Download ), m_buttonCancel( new QPushButton("Cancel")), m_buttonPause( new QPushButton( "Pause") ), m_buttonResume( new QPushButton("Resume") ), m_progressBar( new QProgressBar ), m_gLayout( new QGridLayout ) { m_progressBar->setRange( 1, 100 ); m_gLayout->addWidget( new QLabel(title), 0, 0 ); m_gLayout->addWidget( m_progressBar, 1, 0 ); m_gLayout->addWidget( m_buttonPause, 1, 1 ); m_gLayout->addWidget( m_buttonResume, 1, 2 ); m_gLayout->addWidget( m_buttonCancel, 1, 3 ); m_downloadManager->download( url, filename ); QObject::connect( m_downloadManager , SIGNAL(downloadProgress(int)), m_progressBar, SLOT(setValue(int)) ); QObject::connect( m_buttonPause, SIGNAL(clicked()), this, SLOT( paused()) ); QObject::connect( m_buttonCancel, SIGNAL(clicked()), this, SLOT(cancelled()) ); QObject::connect( m_buttonResume, SIGNAL(clicked()), this, SLOT(resumed()) ); QObject::connect( m_downloadManager, SIGNAL(downloadComplete()), this, SLOT(downloadCompleted()) ); setLayout( m_gLayout ); }
bool YaExpandingOverlayLineEdit::eventFilter(QObject* obj, QEvent* e) { if (e->type() == QEvent::KeyPress && obj == this) { QKeyEvent* ke = static_cast<QKeyEvent*>(e); if (ke->key() == Qt::Key_Escape) { emit cancelled(); setText(QString()); return true; } if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return) { emit enteredText(text()); // setText(QString()); return true; } } if ((e->type() == QEvent::Move || e->type() == QEvent::Resize || e->type() == QEvent::Show || e->type() == QEvent::Hide) && grounding_.contains((QWidget*)obj)) { groundingChanged(); } return YaEmptyTextLineEdit::eventFilter(obj, e); }
void FormBase::cancel() { emit cancelled(); }
void MagnatunePurchaseDialog::cancel( ) { hide(); emit ( cancelled() ); }
void FlatTextarea::keyPressEvent(QKeyEvent *e) { bool shift = e->modifiers().testFlag(Qt::ShiftModifier); bool macmeta = (cPlatform() == dbipMac || cPlatform() == dbipMacOld) && e->modifiers().testFlag(Qt::ControlModifier) && !e->modifiers().testFlag(Qt::MetaModifier) && !e->modifiers().testFlag(Qt::AltModifier); bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier); bool enterSubmit = (ctrl && shift); if (ctrl && _submitSettings != SubmitSettings::None && _submitSettings != SubmitSettings::Enter) { enterSubmit = true; } if (!ctrl && !shift && _submitSettings != SubmitSettings::None && _submitSettings != SubmitSettings::CtrlEnter) { enterSubmit = true; } bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return); if (macmeta && e->key() == Qt::Key_Backspace) { QTextCursor tc(textCursor()), start(tc); start.movePosition(QTextCursor::StartOfLine); tc.setPosition(start.position(), QTextCursor::KeepAnchor); tc.removeSelectedText(); } else if (enter && enterSubmit) { emit submitted(ctrl && shift); } else if (e->key() == Qt::Key_Escape) { emit cancelled(); } else if (e->key() == Qt::Key_Tab || (ctrl && e->key() == Qt::Key_Backtab)) { if (ctrl) { e->ignore(); } else { emit tabbed(); } } else if (e->key() == Qt::Key_Search || e == QKeySequence::Find) { e->ignore(); } else { QTextCursor tc(textCursor()); if (enter && ctrl) { e->setModifiers(e->modifiers() & ~Qt::ControlModifier); } bool spaceOrReturn = false; QString t(e->text()); if (!t.isEmpty() && t.size() < 3) { if (t.at(0) == '\n' || t.at(0) == '\r' || t.at(0).isSpace() || t.at(0) == QChar::LineSeparator) { spaceOrReturn = true; } } QTextEdit::keyPressEvent(e); if (tc == textCursor()) { bool check = false; if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Up) { tc.movePosition(QTextCursor::Start, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor); check = true; } else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Down) { tc.movePosition(QTextCursor::End, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor); check = true; } if (check) { if (tc == textCursor()) { e->ignore(); } else { setTextCursor(tc); } } } if (spaceOrReturn) emit spacedReturnedPasted(); } }
void NotificationBox::cancel() { emit cancelled(this->node); exit(); }
void SubAdapterStep::execute() { RGData rgDataIn; RGData rgDataOut; Row rowIn; Row rowFe; Row rowOut; fRowGroupIn.initRow(&rowIn); fRowGroupOut.initRow(&rowOut); RGData rowFeData; bool usesFE = false; if (fRowGroupFe.getColumnCount() != (uint32_t) -1) { usesFE = true; fRowGroupFe.initRow(&rowFe, true); rowFeData = RGData(fRowGroupFe, 1); fRowGroupFe.setData(&rowFeData); fRowGroupFe.getRow(0, &rowFe); } bool more = false; try { fSubStep->run(); more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn()) dlTimes.setFirstReadTime(); while (more && !cancelled()) { fRowGroupIn.setData(&rgDataIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(fRowGroupIn.getBaseRid()); fRowGroupIn.getRow(0, &rowIn); fRowGroupOut.getRow(0, &rowOut); for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i) { if(fExpression.get() == NULL) { outputRow(rowIn, rowOut); } else if (!usesFE) { if(fExpression->evaluate(&rowIn)) { outputRow(rowIn, rowOut); } } else { copyRow(rowIn, &rowFe, rowIn.getColumnCount()); //memcpy(rowFe.getData(), rowIn.getData(), rowIn.getSize()); if(fExpression->evaluate(&rowFe)) { outputRow(rowFe, rowOut); } } rowIn.nextRow(); } if (fRowGroupOut.getRowCount() > 0) { fRowsReturned += fRowGroupOut.getRowCount(); fOutputDL->insert(rgDataOut); } more = fInputDL->next(fInputIterator, &rgDataIn); } } catch(const std::exception& ex) { catchHandler(ex.what(), ERR_EXEMGR_MALFUNCTION, fErrorInfo, fSessionId); } catch(...) { catchHandler("SubAdapterStep execute caught an unknown exception", ERR_EXEMGR_MALFUNCTION, fErrorInfo, fSessionId); } if (cancelled()) while (more) more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn()) { dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); printCalTrace(); } // Bug 3136, let mini stats to be formatted if traceOn. fOutputDL->endOfInput(); }
US_SyncWithDB::US_SyncWithDB() : US_WidgetsDialog( 0, 0 ) { setAttribute ( Qt::WA_DeleteOnClose ); setWindowTitle( tr( "Synchronize Reports with Database" ) ); setPalette ( US_GuiSettings::frameColor() ); setMinimumSize( 300, 160 ); resize ( 400, 200 ); // Main layout QVBoxLayout* main = new QVBoxLayout( this ); main->setContentsMargins( 2, 2, 2, 2 ); main->setSpacing ( 2 ); // Top layout: buttons and fields above list widget QGridLayout* top = new QGridLayout; int row = 0; // Investigator // Only enable the investigator button for privileged users pb_invest = us_pushbutton( tr( "Select Investigator" ) ); int invlev = US_Settings::us_inv_level(); pb_invest->setEnabled( invlev > 0 ); connect( pb_invest, SIGNAL( clicked() ), SLOT( get_person() ) ); top->addWidget( pb_invest, row, 0 ); QString name = ( invlev > 0 ) ? QString::number( US_Settings::us_inv_ID() ) + ": " : ""; le_invest = us_lineedit( name + US_Settings::us_inv_name(), -1, true ); top->addWidget( le_invest, row++, 1 ); // Instructions text te_desc = us_textedit(); us_setReadOnly( te_desc, true ); QString desc = tr( "<b>Note:</b> Proceeding may result in local reports<br/>" "being replaced from the database.<ul>" "<li><b>Cancel</b> to abort synchronizing from the DB.</li>" "<li><b>Download</b> to proceed with DB synchronization.</li>" "<li><b>New Only</b> to only download new DB records.</li></ul>" ); te_desc->setHtml( desc ); top->addWidget( te_desc, row, 0, 4, 2 ); main->addLayout( top ); // Button Row QHBoxLayout* buttons = new QHBoxLayout; QPushButton* pb_cancel = us_pushbutton( tr( "Cancel" ) ); QPushButton* pb_accept = us_pushbutton( tr( "Download" ) ); QPushButton* pb_newonly = us_pushbutton( tr( "New Only" ) ); connect( pb_cancel, SIGNAL( clicked() ), SLOT( cancelled() ) ); connect( pb_accept, SIGNAL( clicked() ), SLOT( accepted() ) ); connect( pb_newonly, SIGNAL( clicked() ), SLOT( downnew() ) ); buttons->addWidget( pb_cancel ); buttons->addWidget( pb_accept ); buttons->addWidget( pb_newonly ); main->addLayout( buttons ); }
uint32_t TupleHavingStep::nextBand(messageqcpp::ByteStream &bs) { RGData rgDataIn; RGData rgDataOut; bool more = false; uint32_t rowCount = 0; try { bs.restart(); more = fInputDL->next(fInputIterator, &rgDataIn); if (dlTimes.FirstReadTime().tv_sec ==0) dlTimes.setFirstReadTime(); if (!more || cancelled()) { fEndOfResult = true; } bool emptyRowGroup = true; while (more && !fEndOfResult && emptyRowGroup) { if (cancelled()) { while (more) more = fInputDL->next(fInputIterator, &rgDataIn); break; } fRowGroupIn.setData(&rgDataIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); doHavingFilters(); if (fRowGroupOut.getRowCount() > 0) { emptyRowGroup = false; fRowGroupOut.serializeRGData(bs); rowCount = fRowGroupOut.getRowCount(); } else { more = fInputDL->next(fInputIterator, &rgDataIn); } } if (!more) { fEndOfResult = true; } } catch(const std::exception& ex) { catchHandler(ex.what(), tupleHavingStepErr, fErrorInfo, fSessionId); while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; } catch(...) { catchHandler("TupleHavingStep next band caught an unknown exception", tupleHavingStepErr, fErrorInfo, fSessionId); while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; } if (fEndOfResult) { // send an empty / error band rgDataOut.reinit(fRowGroupOut, 0); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(0); fRowGroupOut.setStatus(status()); fRowGroupOut.serializeRGData(bs); dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); if (traceOn()) printCalTrace(); } return rowCount; }
void TupleHavingStep::execute() { RGData rgDataIn; RGData rgDataOut; bool more = false; StepTeleStats sts; sts.query_uuid = fQueryUuid; sts.step_uuid = fStepUuid; try { more = fInputDL->next(fInputIterator, &rgDataIn); dlTimes.setFirstReadTime(); sts.msg_type = StepTeleStats::ST_START; sts.total_units_of_work = 1; postStepStartTele(sts); if (!more && cancelled()) { fEndOfResult = true; } while (more && !fEndOfResult) { fRowGroupIn.setData(&rgDataIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); doHavingFilters(); more = fInputDL->next(fInputIterator, &rgDataIn); if (cancelled()) { fEndOfResult = true; } else { fOutputDL->insert(rgDataOut); } } } catch(const std::exception& ex) { catchHandler(ex.what(), tupleHavingStepErr, fErrorInfo, fSessionId); } catch(...) { catchHandler("TupleHavingStep execute caught an unknown exception", tupleHavingStepErr, fErrorInfo, fSessionId); } while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; fOutputDL->endOfInput(); sts.msg_type = StepTeleStats::ST_SUMMARY; sts.total_units_of_work = sts.units_of_work_completed = 1; sts.rows = fRowsReturned; postStepSummaryTele(sts); dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); if (traceOn()) printCalTrace(); }
bool MReportViewer::printGhostReportToPS(const QString &outPsFile) { if (report == 0) return false; int cnt = report->pageCount(); if (cnt == 0) return false; psprinter = new PSPrinter(PSPrinter::HighResolution); psprinter->setPageSize((PSPrinter::PageSize) report->pageSize()); if ((PSPrinter::PageSize) report->pageSize() == PSPrinter::Custom) psprinter->setCustomPaperSize(report->pageDimensions()); psprinter->setOrientation((PSPrinter::Orientation) report->pageOrientation()); psprinter->setMinMax(1, cnt); psprinter->setFromTo(1, cnt); psprinter->setFullPage(true); psprinter->setColorMode((PSPrinter::ColorMode) colorMode_); psprinter->setNumCopies(numCopies_); psprinter->setResolution(dpi_); QPicture *page; QPainter painter; bool printRev = false; int viewIdx = report->getCurrentIndex(); if (psprinter->pageOrder() == QPrinter::LastPageFirst) printRev = true; int printFrom = psprinter->fromPage() - 1; int printTo = psprinter->toPage(); int printCnt = (printTo - printFrom); int printCopies = psprinter->numCopies(); int totalSteps = printCnt * printCopies; int currentStep = 1; psprinter->setNumCopies(1); psprinter->setOutputToFile(true); psprinter->setOutputFileName(outPsFile); QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true); progress.setMinimumDuration(M_PROGRESS_DELAY); QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting())); progress.setProgress(0); qApp->processEvents(); painter.begin(psprinter); QPaintDeviceMetrics pdm(psprinter); QSize dim(report->pageDimensions()); painter.setWindow(0, 0, dim.width(), dim.height()); painter.setViewport(0, 0, pdm.width(), pdm.height()); for (int j = 0; j < printCopies; j++) { for (int i = printFrom; i < printTo; i++, currentStep++) { if (!psprinter->aborted()) { progress.setProgress(currentStep); qApp->processEvents(); if (printRev) report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i); else report->setCurrentPage(i); page = report->getCurrentPage(); page->play(&painter); if ((i - printFrom) < printCnt - 1) psprinter->newPage(); } else { j = printCopies; break; } } if (j < printCopies - 1) psprinter->newPage(); } painter.end(); report->setCurrentPage(viewIdx); delete psprinter; return true; }
bool OCompletionBox::eventFilter( QObject *o, QEvent *e ) { int type = e->type(); if ( o == d->m_parent ) { if ( isVisible() ) { if ( type == QEvent::KeyPress ) { QKeyEvent *ev = static_cast<QKeyEvent *>( e ); switch ( ev->key() ) { case Key_BackTab: if ( d->tabHandling ) { up(); ev->accept(); return true; } break; case Key_Tab: if ( d->tabHandling ) { down(); // Only on TAB!! ev->accept(); return true; } break; case Key_Down: down(); ev->accept(); return true; case Key_Up: up(); ev->accept(); return true; case Key_Prior: pageUp(); ev->accept(); return true; case Key_Next: pageDown(); ev->accept(); return true; case Key_Escape: cancelled(); ev->accept(); return true; case Key_Enter: case Key_Return: if ( ev->state() & ShiftButton ) { hide(); ev->accept(); // Consume the Enter event return true; } break; default: break; } } else if ( type == QEvent::AccelOverride ) { // Override any acceleartors that match // the key sequences we use here... QKeyEvent *ev = static_cast<QKeyEvent *>( e ); switch ( ev->key() ) { case Key_Tab: case Key_BackTab: case Key_Down: case Key_Up: case Key_Prior: case Key_Next: case Key_Escape: case Key_Enter: case Key_Return: ev->accept(); return true; break; default: break; } } // parent loses focus or gets a click -> we hide else if ( type == QEvent::FocusOut || type == QEvent::Resize || type == QEvent::Close || type == QEvent::Hide || type == QEvent::Move ) { hide(); } else if ( type == QEvent::Move ) move( d->m_parent->mapToGlobal(QPoint(0, d->m_parent->height()))); else if ( type == QEvent::Resize ) resize( sizeHint() ); } } // any mouse-click on something else than "this" makes us hide else if ( type == QEvent::MouseButtonPress ) { QMouseEvent *ev = static_cast<QMouseEvent *>( e ); if ( !rect().contains( ev->pos() )) // this widget hide(); } return OListBox::eventFilter( o, e ); }
/** Imprime directamente sobre formato PS */ bool MReportViewer::printReportToPS(const QString &outPsFile) { // Check for a report if (report == 0) return false; #if defined(Q_OS_WIN32) || defined(Q_OS_MACX) return printGhostReportToPS(outPsFile); #endif // Get the page count int cnt = report->pageCount(); // Check if there is a report or any pages to print if (cnt == 0) { QMessageBox::critical(this, "Kugar", tr("No hay páginas en el\ninforme para."), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); return false; } // Set the printer dialog printer = new QPrinter(QPrinter::HighResolution); printer->setPageSize((QPrinter::PageSize) report->pageSize()); if ((QPrinter::PageSize) report->pageSize() == QPrinter::Custom) printer->setCustomPaperSize(report->pageDimensions()); printer->setOrientation((QPrinter::Orientation) report->pageOrientation()); printer->setMinMax(1, cnt); printer->setFromTo(1, cnt); printer->setFullPage(true); printer->setColorMode((QPrinter::ColorMode) colorMode_); printer->setNumCopies(numCopies_); printer->setOutputToFile(true); printer->setOutputFileName(outPsFile); QPicture *page; QPainter painter; bool printRev = false; // Save the viewer's page index int viewIdx = report->getCurrentIndex(); // Check the order we are printing the pages if (printer->pageOrder() == QPrinter::LastPageFirst) printRev = true; // Get the count of pages and copies to print int printFrom = printer->fromPage() - 1; int printTo = printer->toPage(); int printCnt = (printTo - printFrom); int printCopies = printer->numCopies(); int totalSteps = printCnt * printCopies; int currentStep = 1; // Set copies to 1, QPrinter copies does not appear to work ... printer->setNumCopies(numCopies_); printer->setResolution(dpi_); // Setup the progress dialog QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true); progress.setMinimumDuration(M_PROGRESS_DELAY); QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting())); progress.setProgress(0); qApp->processEvents(); // Start the printer painter.begin(printer); QPaintDeviceMetrics pdm(printer); QSize dim(report->pageDimensions()); painter.setWindow(0, 0, dim.width(), dim.height()); painter.setViewport(0, 0, pdm.width(), pdm.height()); // Print each page in the collection for (int j = 0; j < printCopies; j++) { for (int i = printFrom; i < printTo; i++, currentStep++) { if (!printer->aborted()) { progress.setProgress(currentStep); qApp->processEvents(); if (printRev) report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i); else report->setCurrentPage(i); page = report->getCurrentPage(); page->play(&painter); if ((i - printFrom) < printCnt - 1) printer->newPage(); } else { j = printCopies; break; } } if (j < printCopies - 1) printer->newPage(); } // Cleanup printing painter.end(); report->setCurrentPage(viewIdx); delete printer; return true; }
QString::fromLatin1("TextEditor")); search->setTextToReplace(txt); search->setSearchAgainSupported(true); FileFindParameters parameters; parameters.text = txt; parameters.flags = findFlags; parameters.nameFilters = fileNameFilters(); parameters.additionalParameters = additionalParameters(); search->setUserData(qVariantFromValue(parameters)); connect(search, SIGNAL(activated(Core::SearchResultItem)), this, SLOT(openEditor(Core::SearchResultItem))); if (searchMode == SearchResultWindow::SearchAndReplace) { connect(search, SIGNAL(replaceButtonClicked(QString,QList<Core::SearchResultItem>,bool)), this, SLOT(doReplace(QString,QList<Core::SearchResultItem>,bool))); } connect(search, SIGNAL(visibilityChanged(bool)), this, SLOT(hideHighlightAll(bool))); connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool))); connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); connect(this, SIGNAL(enabledChanged(bool)), search, SIGNAL(requestEnabledCheck())); connect(search, SIGNAL(requestEnabledCheck()), this, SLOT(recheckEnabled())); runSearch(search); } void BaseFileFind::runSearch(Core::SearchResult *search) { FileFindParameters parameters = search->userData().value<FileFindParameters>(); CountingLabel *label = new CountingLabel; connect(search, SIGNAL(countChanged(int)), label, SLOT(updateCount(int))); CountingLabel *statusLabel = new CountingLabel; connect(search, SIGNAL(countChanged(int)), statusLabel, SLOT(updateCount(int)));
/** Prints the rendered report to the selected printer - displays Qt print dialog */ bool MReportViewer::printReport() { // Check for a report if (report == 0) return false; report->setPrintToPos(printToPos_); if (report->printToPos()) return printPosReport(); #if defined(Q_OS_WIN32) bool gsOk = false; QProcess *procTemp = new QProcess(); procTemp->addArgument(aqApp->gsExecutable()); procTemp->addArgument("--version"); gsOk = procTemp->start(); delete procTemp; if (gsOk) { if (printGhostReport()) return true; } QMessageBox *m = new QMessageBox(tr("Sugerencia"), tr("Si instala Ghostscript (http://www.ghostscript.com) y añade\n" "el directorio de instalación a la ruta de búsqueda de programas\n" "del sistema (PATH), Eneboo podrá utilizarlo para optimizar\n" "sustancialmente la calidad de impresión y para poder generar códigos\nde barras.\n\n"), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this, 0, false); m->show(); #endif // Get the page count int cnt = report->pageCount(); // Check if there is a report or any pages to print if (cnt == 0) { QMessageBox::critical(this, "Kugar", tr("No hay páginas en el\ninforme para."), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); return false; } // Set the printer dialog printer = new QPrinter(QPrinter::HighResolution); printer->setPageSize((QPrinter::PageSize) report->pageSize()); if ((QPrinter::PageSize) report->pageSize() == QPrinter::Custom) printer->setCustomPaperSize(report->pageDimensions()); printer->setOrientation((QPrinter::Orientation) report->pageOrientation()); printer->setMinMax(1, cnt); printer->setFromTo(1, cnt); printer->setFullPage(true); printer->setColorMode((QPrinter::ColorMode) colorMode_); printer->setNumCopies(numCopies_); printer->setResolution(dpi_); if (!printerName_.isEmpty()) printer->setPrinterName(printerName_); QString printProg(aqApp->printProgram()); if (!printProg.isEmpty()) printer->setPrintProgram(aqApp->printProgram()); bool printNow = true; if (!printerName_.isNull()) printNow = true; else printNow = printer->setup(qApp->focusWidget()); if (printNow) { QPicture *page; QPainter painter; bool printRev = false; // Save the viewer's page index int viewIdx = report->getCurrentIndex(); // Check the order we are printing the pages if (printer->pageOrder() == QPrinter::LastPageFirst) printRev = true; // Get the count of pages and copies to print int printFrom = printer->fromPage() - 1; int printTo = printer->toPage(); int printCnt = (printTo - printFrom); int printCopies = printer->numCopies(); int totalSteps = printCnt * printCopies; int currentStep = 1; // Set copies to 1, QPrinter copies does not appear to work ... printer->setNumCopies(1); // Setup the progress dialog QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true); progress.setMinimumDuration(M_PROGRESS_DELAY); QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting())); progress.setProgress(0); qApp->processEvents(); // Start the printer painter.begin(printer); QPaintDeviceMetrics pdm(printer); QSize dim(report->pageDimensions()); painter.setWindow(0, 0, dim.width(), dim.height()); painter.setViewport(0, 0, pdm.width(), pdm.height()); // Print each copy for (int j = 0; j < printCopies; j++) { // Print each page in the collection for (int i = printFrom; i < printTo; i++, currentStep++) { if (!printer->aborted()) { progress.setProgress(currentStep); qApp->processEvents(); if (printRev) report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i); else report->setCurrentPage(i); page = report->getCurrentPage(); page->play(&painter); if ((i - printFrom) < printCnt - 1) printer->newPage(); } else { j = printCopies; break; } } if (j < printCopies - 1) printer->newPage(); } // Cleanup printing painter.end(); report->setCurrentPage(viewIdx); delete printer; return true; } delete printer; return false; }
void ConfirmBox::closePressed() { emit cancelled(); }
bool QgsShapeFile::insertLayer(QString dbname, QString schema, QString geom_col, QString srid, PGconn * conn, QProgressDialog * pro, bool &fin){ connect(pro, SIGNAL(cancelled()), this, SLOT(cancelImport())); import_cancelled = false; bool result = true; QString query = "CREATE TABLE "+schema+"."+table_name+"(gid int4 PRIMARY KEY, "; for(int n=0; n<column_names.size() && result; n++){ if(!column_names[n][0].isLetter()) result = false; char * esc_str = new char[column_names[n].length()*2+1]; PQescapeString(esc_str, (const char *)column_names[n].lower(), column_names[n].length()); query += esc_str; query += " "; query += column_types[n]; if(n<column_names.size()-1) query += ", "; delete[] esc_str; } query += " )"; PGresult *res = PQexec(conn, (const char *)query); qWarning(query); if(PQresultStatus(res)!=PGRES_COMMAND_OK){ // flag error and send query and error message to stdout on debug result = false; qWarning(PQresultErrorMessage(res)); } else { PQclear(res); } query = "SELECT AddGeometryColumn(\'" + dbname + "\', \'" + table_name + "\', \'"+geom_col+"\', " + srid + ", \'" + geom_type + "\', 2)"; if(result) res = PQexec(conn, (const char *)query); if(PQresultStatus(res)!=PGRES_TUPLES_OK){ result = false; } else{ qWarning(query); qWarning(PQresultErrorMessage(res)); PQclear(res); } //adding the data into the table for(int m=0;m<features && result; m++){ if(import_cancelled){ fin = true; break; } OGRFeature *feat = ogrLayer->GetNextFeature(); if(feat){ OGRGeometry *geom = feat->GetGeometryRef(); if(geom){ query = "INSERT INTO "+schema+"."+table_name+QString(" VALUES( %1, ").arg(m); int num = geom->WkbSize(); char * geo_temp = new char[num*3]; geom->exportToWkt(&geo_temp); QString geometry(geo_temp); QString quotes; for(int n=0; n<column_types.size(); n++){ if(column_types[n] == "int" || column_types[n] == "float") quotes = " "; else quotes = "\'"; query += quotes; // escape the string value QString val = feat->GetFieldAsString(n); char * esc_str = new char[val.length()*2+1]; PQescapeString(esc_str, (const char *)val.lower(), val.length()); // add escaped value to the query query += esc_str; query += QString(quotes + ", "); delete[] esc_str; } query += QString("GeometryFromText(\'")+geometry+QString("\', ")+srid+QString("))"); if(result) res = PQexec(conn, (const char *)query); if(PQresultStatus(res)!=PGRES_COMMAND_OK){ // flag error and send query and error message to stdout on debug result = false; qWarning(PQresultErrorMessage(res)); } else { PQclear(res); } pro->setProgress(pro->progress()+1); qApp->processEvents(); delete[] geo_temp; } delete feat; } } ogrLayer->ResetReading(); return result; }
void FloatingEdit::focusOutEvent(QFocusEvent* e) { emit cancelled(); }
SnapshotActionDialog::SnapshotActionDialog( QWidget *parent, virConnectPtr *ptr_ConnPtr, QString _domName) : QDialog(parent), ptr_ConnPtr(ptr_ConnPtr), domName(_domName) { params.clear(); QString winTitle = QString("<%1> Snapshot Actions").arg(domName); setWindowTitle(winTitle); settings.beginGroup("SnapshotActionDialog"); restoreGeometry( settings.value("Geometry").toByteArray() ); int c0 = settings.value("column0", 132).toInt(); int c1 = settings.value("column1", 64).toInt(); settings.endGroup(); revertFlagsMenu = new RevertSnapshotFlags(this); revertAction = new QAction(QIcon::fromTheme("document-revert"), "Revert To", this); revertAction->setMenu(revertFlagsMenu); deleteFlagsMenu = new DeleteSnapshotFlags(this); deleteAction = new QAction(QIcon::fromTheme("list-remove"), "Delete", this); deleteAction->setMenu(deleteFlagsMenu); refreshAction = new QAction(QIcon::fromTheme("view-refresh"), "Refresh", this); getXMLDescAction = new QAction(QIcon::fromTheme("application-xml"), "get XML Description", this); toolBar = new QToolBar(this); toolBar->addAction(revertAction); toolBar->addAction(deleteAction); toolBar->addAction(refreshAction); toolBar->addAction(getXMLDescAction); model = new SnapshotTreeModel; snapshotTree = new QTreeView(this); snapshotTree->setRootIsDecorated(true); snapshotTree->setModel(model); snapshotTree->setExpandsOnDoubleClick(true); snapshotTree->setColumnWidth(0, c0); snapshotTree->setColumnWidth(1, c1); info = new QLabel( "<a href='https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html'>About</a>", this); info->setOpenExternalLinks(true); info->setToolTip("https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html"); ok = new QPushButton("Ok", this); cancel = new QPushButton("Cancel", this); closeWdg = new QPushButton("Close", this); buttonsLayout = new QHBoxLayout(this); buttonsLayout->addWidget(info); buttonsLayout->addWidget(ok); buttonsLayout->addWidget(cancel); buttonsLayout->addWidget(closeWdg); buttonsWdg = new QWidget(this); buttonsWdg->setLayout(buttonsLayout); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(toolBar); commonLayout->addWidget(snapshotTree); commonLayout->addWidget(buttonsWdg); commonLayout->addStretch(-1); setLayout(commonLayout); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(cancelled())); connect(closeWdg, SIGNAL(clicked()), this, SLOT(reject())); setDomainSnapshots(); connect(toolBar, SIGNAL(actionTriggered(QAction*)), this, SLOT(detectTriggeredAction(QAction*))); changeDialogState(false); }
void MagnatuneRedownloadDialog::reject( ) { hide(); emit(cancelled()); }
void STAuthorizeView::cancelButtonPressed(){ emit cancelled();; }