void QgsHttpRequestHandler::sendResponse() { QgsMessageLog::logMessage( QString( "Sending HTTP response" ) ); if ( ! responseReady() ) { QgsMessageLog::logMessage( QString( "Trying to send out an invalid response" ) ); return; } #ifdef HAVE_SERVER_PYTHON_PLUGINS // Plugin hook // Iterate filters and call their sendResponse() method QgsServerFiltersMap::const_iterator filtersIterator; for ( filtersIterator = mPluginFilters.constBegin(); filtersIterator != mPluginFilters.constEnd(); ++filtersIterator ) { filtersIterator.value()->sendResponse(); } #endif if ( ! headersSent() ) { sendHeaders(); } sendBody(); //Clear the body to allow for streaming content to stdout clearBody(); }
void CSCMail::sendHTMLFileAttach(const std::string& filename, const std::string& text) { TraceNoise("CSCMail::sendHTMLFileAttach", filename.c_str(), text.size()); // copies the HTML created into a temp file then attarches that std::string systemCmd; // change the name std::string filename2 = filename; filename2 += ".html"; Trace("Temp file name", filename2.c_str(), filename2.size()); // rename to .html systemCmd = "cp "; systemCmd += filename; systemCmd += " "; systemCmd += filename2; system (systemCmd.c_str()); addAttachFile(filename2.c_str()); // now empty out the current email text clearBody(); // add some more text addToBody(text); sendAttach(); // remove temp file unlink(filename2.c_str()); }
// send the HTML mail as an attachment void CSCMail::sendHTMLAttach(const std::string& text) { TraceNoise("CSCMail::sendHTMLAttach", "", text.size()); // copies the HTML created into a temp file then attarches that char tmpName[] = TMP_WTT_MAIL_FILENAME; std::string systemCmd; std::string tmpName2; int filePtr; // create temp output file if ((filePtr = mkstemp(tmpName)) == -1) { // can't create file - just send nothing LogError("CSCMail::send()", "Unable to create temp file", 0); strcpy(tmpName, "/dev/null"); return; } else { // output the body to the file write(filePtr, m_body.c_str(), m_body.size()); close(filePtr); } // change the name tmpName2 = tmpName; tmpName2 += ".html"; Trace("Temp file name", tmpName, strlen(tmpName)); Trace("Temp file name", tmpName2.c_str(), tmpName2.size()); // rename to .html rename(tmpName, tmpName2.c_str()); // systemCmd = "mv "; // systemCmd += tmpName; // systemCmd += " "; // systemCmd += tmpName; // systemCmd += ".html"; // system (systemCmd.c_str()); addAttachFile(tmpName2.c_str()); // now empty out the current email text clearBody(); // add some more text addToBody(text); sendAttach(); // remove temp file unlink(tmpName2.c_str()); }
BoolVector::BoolVector(const BoolVector &obj) :body(nullptr) { length = obj.length; n = obj.n; n_ones = obj.n_ones; body = new unsigned int[n]; clearBody(); if (body) { for (int i = 0; i < n; i++) { body[i] = obj.body[i]; } } }
BoolVector::BoolVector() :body(nullptr) { length = DEFAULT_SIZE; n = (length / 32) + (length % 32 ? 1 : 0); n_ones = 0; body = new unsigned int[n]; clearBody(); if (body) { for (int i = 0; i < n; i++) { body[i] = 0; } } }
BoolVector& BoolVector::operator=(const BoolVector &a) { if (&a == this) return *this; if (body) delete[] body; length = a.length; n = a.n; n_ones = a.n_ones; body = new unsigned int[n]; clearBody(); for (int i = 0; i < n; i++) { body[i] = a.body[i]; } return *this; };
BoolVector::BoolVector(int length, bool arr[]) :length(length), body(nullptr) { n = length / 32 + length % 32 ? 1 : 0; body = new unsigned int[n]; clearBody(); for (int i = 0, curr = 0; i < length; i++) { if (i == (curr + 1) * 32) curr++; int bit = arr[length - i - 1] ? 1 : 0; bit <<= i; body[curr] |= bit; } update(); }
BoolVector::BoolVector(int length) :length(length), body(nullptr) { n = length / 32 + length % 32 ? 1 : 0; body = new unsigned int[n]; clearBody(); for (int i = 0; i < n; i++) { body[i] = 0; } if (body) { for (int i = 0; i < n; i++) { body[i] = 0; } } update(); }
void QgsHttpRequestHandler::setServiceException( QgsMapServiceException ex ) { mException = &ex; //create Exception DOM document QDomDocument exceptionDoc; QDomElement serviceExceptionReportElem = exceptionDoc.createElement( "ServiceExceptionReport" ); serviceExceptionReportElem.setAttribute( "version", "1.3.0" ); serviceExceptionReportElem.setAttribute( "xmlns", "http://www.opengis.net/ogc" ); exceptionDoc.appendChild( serviceExceptionReportElem ); QDomElement serviceExceptionElem = exceptionDoc.createElement( "ServiceException" ); serviceExceptionElem.setAttribute( "code", ex.code() ); QDomText messageText = exceptionDoc.createTextNode( ex.message() ); serviceExceptionElem.appendChild( messageText ); serviceExceptionReportElem.appendChild( serviceExceptionElem ); QByteArray ba = exceptionDoc.toByteArray(); // Clear response headers and body and set new exception // TODO: check for headersSent() clearHeaders(); clearBody(); setHttpResponse( &ba, "text/xml" ); }
void astroInfo::loadBodySet(){ for(int i = 0; i <= 10; i++){ Body currentBody = bodyPositions[i]; clearBody(¤tBody); }; this->bodyPositions[0].name = QString("Sun"); this->bodyPositions[0].number = 0; this->bodyPositions[1].name = QString("Mercury"); this->bodyPositions[1].number = 2; this->bodyPositions[2].name = QString("Venus"); this->bodyPositions[2].number = 3; this->bodyPositions[3].name = QString("Earth"); this->bodyPositions[3].number = 14; this->bodyPositions[4].name = QString("Moon"); this->bodyPositions[4].number = 1; this->bodyPositions[5].name = QString("Mars"); this->bodyPositions[5].number = 4; this->bodyPositions[6].name = QString("Jupiter"); this->bodyPositions[6].number = 5; this->bodyPositions[7].name = QString("Saturn"); this->bodyPositions[7].number = 6; this->bodyPositions[8].name = QString("Uranus"); this->bodyPositions[8].number = 7; this->bodyPositions[9].name = QString("Neptune"); this->bodyPositions[9].number = 8; this->bodyPositions[10].name = QString("Pluto"); this->bodyPositions[10].number = 9; this->bodyPositions[11].name = QString("Mean Node"); this->bodyPositions[11].number = 10; this->bodyPositions[12].name = QString("Lilith"); this->bodyPositions[12].number = 12; this->bodyPositions[13].name = QString("Part of Fortune"); this->bodyPositions[13].number = 11; this->bodyPositions[14].name = QString("Asc"); this->bodyPositions[14].number = 15; this->bodyPositions[15].name = QString("Mc"); this->bodyPositions[15].number = 13; }
void QtButton::mousePressEvent(QMouseEvent *e) { _QtEdit = QtEdit::getInstance(); if (e->button() == Qt::RightButton && this_button_id <= _QtEdit->FPX) { //if (Is_AttFra || Is_InjFra || Is_ActFra || Is_BodyFra) if (_QtEdit->is_import) { _QtEdit->_DrawRectLayer->EndUpdate(); if (_QtEdit->is_import) { //_QtEdit->_DrawRectLayer->unscheduleUpdate(); _QtEdit->_DrawRectLayer->EndUpdate(); _QtEdit->ui.PauseButton->setText("Start"); _QtEdit->pu = -1; //_DrawRectLayer->drawPositionEdit(btn->Singl_ID); } _QtEdit->btn = this; _QtEdit->SlderAnimationAction(); popMenu = new QMenu(this); if (Is_ActFra) { DeleteActAction = new QAction(this); DeleteActAction->setObjectName(QStringLiteral("mydeleteAction")); DeleteActAction->setText(QStringLiteral("ɾ³ý¶¯×÷¹Ø¼üÖ¡")); QObject::connect(DeleteActAction, SIGNAL(triggered()), this, SLOT(deleteAct())); popMenu->addAction(DeleteActAction); popMenu->addSeparator(); } if (Is_AttFra) { DeleteAttAction = new QAction(this); DeleteAttAction->setObjectName(QStringLiteral("mydeleteAction")); DeleteAttAction->setText(QStringLiteral("ɾ³ý¹¥»÷¹Ø¼üÖ¡")); QObject::connect(DeleteAttAction, SIGNAL(triggered()), this, SLOT(deleteAtt())); popMenu->addAction(DeleteAttAction); ClearAttAction = new QAction(this); ClearAttAction->setObjectName(QStringLiteral("mydeleteAction")); ClearAttAction->setText(QStringLiteral("Çå¿Õ¹¥»÷¹Ø¼üÖ¡")); QObject::connect(ClearAttAction, SIGNAL(triggered()), this, SLOT(clearAtt())); popMenu->addAction(ClearAttAction); popMenu->addSeparator(); } else { AddAttAction = new QAction(this); AddAttAction->setObjectName(QStringLiteral("mydeleteAction")); AddAttAction->setText(QStringLiteral("Ôö¼Ó¹¥»÷¹Ø¼üÖ¡")); QObject::connect(AddAttAction, SIGNAL(triggered()), this, SLOT(addAtt())); popMenu->addAction(AddAttAction); popMenu->addSeparator(); } if (Is_InjFra) { DeleteInjAction = new QAction(this); DeleteInjAction->setObjectName(QStringLiteral("mydeleteAction")); DeleteInjAction->setText(QStringLiteral("ɾ³ýÊÜ»÷¹Ø¼üÖ¡")); QObject::connect(DeleteInjAction, SIGNAL(triggered()), this, SLOT(deleteInj())); popMenu->addAction(DeleteInjAction); ClearInjAction = new QAction(this); ClearInjAction->setObjectName(QStringLiteral("mydeleteAction")); ClearInjAction->setText(QStringLiteral("Çå¿ÕÊÜ»÷¹Ø¼üÖ¡")); QObject::connect(ClearInjAction, SIGNAL(triggered()), this, SLOT(clearInj())); popMenu->addAction(ClearInjAction); popMenu->addSeparator(); } else { AddInjAction = new QAction(this); AddInjAction->setObjectName(QStringLiteral("mydeleteAction")); AddInjAction->setText(QStringLiteral("Ôö¼ÓÊÜ»÷¹Ø¼üÖ¡")); QObject::connect(AddInjAction, SIGNAL(triggered()), this, SLOT(addInj())); popMenu->addAction(AddInjAction); popMenu->addSeparator(); } if (Is_BodyFra) { DeleteBodyAction = new QAction(this); DeleteBodyAction->setObjectName(QStringLiteral("mydeleteAction")); DeleteBodyAction->setText(QStringLiteral("ɾ³ýÅöײ¹Ø¼üÖ¡")); QObject::connect(DeleteBodyAction, SIGNAL(triggered()), this, SLOT(deleteBody())); popMenu->addAction(DeleteBodyAction); ClearBodyAction = new QAction(this); ClearBodyAction->setObjectName(QStringLiteral("mydeleteAction")); ClearBodyAction->setText(QStringLiteral("Çå¿ÕÅöײ¹Ø¼üÖ¡")); QObject::connect(ClearBodyAction, SIGNAL(triggered()), this, SLOT(clearBody())); popMenu->addAction(ClearBodyAction); popMenu->addSeparator(); } else { AddBodyAction = new QAction(this); AddBodyAction->setObjectName(QStringLiteral("mydeleteAction")); AddBodyAction->setText(QStringLiteral("Ôö¼ÓÅöײ¹Ø¼üÖ¡")); QObject::connect(AddBodyAction, SIGNAL(triggered()), this, SLOT(addBody())); popMenu->addAction(AddBodyAction); popMenu->addSeparator(); } if (Is_EffFra) { DeleteEffAction = new QAction(this); DeleteEffAction->setObjectName(QStringLiteral("mydeleteAction")); DeleteEffAction->setText(QStringLiteral("ɾ³ýÌØЧ¹Ø¼üÖ¡")); QObject::connect(DeleteEffAction, SIGNAL(triggered()), this, SLOT(deleteEff())); popMenu->addAction(DeleteEffAction); ClearEffAction = new QAction(this); ClearEffAction->setObjectName(QStringLiteral("mydeleteAction")); ClearEffAction->setText(QStringLiteral("Çå¿ÕÌØЧ¹Ø¼üÖ¡")); QObject::connect(ClearEffAction, SIGNAL(triggered()), this, SLOT(clearEff())); popMenu->addAction(ClearEffAction); popMenu->addSeparator(); } else { AddEffAction = new QAction(this); AddEffAction->setObjectName(QStringLiteral("mydeleteAction")); AddEffAction->setText(QStringLiteral("Ôö¼ÓÌØЧ¹Ø¼üÖ¡")); QObject::connect(AddEffAction, SIGNAL(triggered()), this, SLOT(addEff())); popMenu->addAction(AddEffAction); popMenu->addSeparator(); } if (Is_AttFra || Is_InjFra || Is_ActFra || Is_BodyFra || Is_EffFra) { DeleteAllAction = new QAction(this); DeleteAllAction->setObjectName(QStringLiteral("mydeleteAction")); DeleteAllAction->setText(QStringLiteral("ɾ³ýËùÓйؼüÖ¡")); QObject::connect(DeleteAllAction, SIGNAL(triggered()), this, SLOT(deleteFra())); popMenu->addAction(DeleteAllAction); } //else if (!(Is_AttFra && Is_InjFra && Is_ActFra && Is_BodyFra)) //{ // AddAllAction = new QAction(this); // AddAllAction->setObjectName(QStringLiteral("mydeleteAction")); // AddAllAction->setText(QStringLiteral("Ôö¼ÓËùÓйؼüÖ¡")); // QObject::connect(AddAllAction, SIGNAL(triggered()), this, SLOT(addFra())); // popMenu->addAction(AddAllAction); //} popMenu->setStyleSheet("QMenu{background-color:rgb(255,255,255);color:rgb(0, 0, 0);font:10pt ""ËÎÌå"";}" "QMenu::item:selected{background-color:#CCDAE7;}"); popMenu->exec(QCursor::pos()); } } else { //ÆäËûµÄ·µ»Ø¸¸ÀàʹÓà __super::mousePressEvent(e); } }