コード例 #1
0
void PTabDialog::messageHandler(int fd, PukeMessage *pm)
{
    PukeMessage pmRet;

    if(pm->iCommand == PUKE_TABDIALOG_ADDTAB) {
        if(!(pm->iTextSize > 0)) {
            warning("QTabDialog/addtab: incorrent cArg size, bailing out.  Needed: >0 got: %d\n", pm->iTextSize);
            pmRet.iCommand = PUKE_TABDIALOG_ADDTAB_ACK; // ack the add widget
            pmRet.iWinId = pm->iWinId;
            pmRet.iArg = 1;
            pmRet.cArg = 0;
            emit outputMessage(fd, &pmRet);
            return;
        }
        widgetId wiWidget;
        wiWidget.fd = fd;
        wiWidget.iWinId = pm->iArg;
        PWidget *pw = controller()->id2pwidget(&wiWidget);
        //    debug("Adding widget with stretch: %d and align: %d", (int) pm->cArg[0],
        //	  (int) pm->cArg[1]);
        widget()->addTab(pw->widget(), pm->cArg);

        pmRet.iCommand = PUKE_TABDIALOG_ADDTAB_ACK; // ack the add widget
        pmRet.iWinId = pm->iWinId;
        pmRet.iArg = 0;
        pmRet.cArg = 0;
        emit outputMessage(fd, &pmRet);
    }
    else {
        PWidget::messageHandler(fd, pm);
    }

}
コード例 #2
0
ファイル: messagebox.cpp プロジェクト: DenisLaky/QtProjects
MessageBox::MessageBox(QWidget *parent) :
    QWidget(parent)
{
    informationButton = new QPushButton("Information");
    questionButton = new QPushButton("Question");
    warningButton = new QPushButton("Warning");
    customButton = new QPushButton("Custom");

    informationButton->setCheckable(true);
    questionButton->setCheckable(true);
    warningButton->setCheckable(true);
    customButton->setCheckable(true);

    QObject::connect(informationButton,SIGNAL(clicked()),SLOT(outputMessage()));
    QObject::connect(questionButton,SIGNAL(clicked()),SLOT(outputMessage()));
    QObject::connect(warningButton,SIGNAL(clicked()),SLOT(outputMessage()));
    QObject::connect(customButton,SIGNAL(clicked()),SLOT(outputMessage()));

    QBoxLayout *boxLayout = new QBoxLayout(QBoxLayout::TopToBottom);
    boxLayout->addWidget(informationButton);
    boxLayout->addWidget(questionButton);
    boxLayout->addWidget(warningButton);
    boxLayout->addWidget(customButton);

    (*this).setLayout(boxLayout);
    (*this).setGeometry(430,300,200,200);
    (*this).setWindowTitle("Message Boxe's");

}
コード例 #3
0
ファイル: Log.cpp プロジェクト: Takashi-Inoue/DnFsRenamer
void Log::debugMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
    QWriteLocker locker(&lock);

    switch (type) {
    case QtDebugMsg:
        debugLogs << outputMessage(QString("Debug: %1 (%2)").arg(msg).arg(context.function));
        break;

    case QtInfoMsg:
        debugLogs << outputMessage(QString("Info: %1").arg(msg));
        break;

    case QtWarningMsg:
        debugLogs << outputMessage(QString("Warning: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function));
        break;

    case QtCriticalMsg:
        debugLogs << outputMessage(QString("Critical: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function));
        break;

    case QtFatalMsg:
        outputMessage(QString("Fatal: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function));
        abort();
    }
}
コード例 #4
0
ファイル: pprogress.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PProgress::messageHandler(int fd, PukeMessage *pm) /*FOLD00*/
{
  //  debug("PProgress handler called");
  PukeMessage pmRet;
  if(widget() == 0){
    warning("Null widget");
    return;
  }
  switch(pm->iCommand){
  case PUKE_KSPROGRESS_SET_RANGE:
    {
      int start=0, stop=1;
      int found = sscanf(pm->cArg, "%d\t%d", &start, &stop);
      if(found != 2)
	throw(errorCommandFailed(PUKE_INVALID,13));
      if(start >= stop){
          stop = start+1;
          start = 0;
      }
      
      widget()->setRange(start, stop);
      pmRet.iCommand = PUKE_KSPROGRESS_SET_RANGE_ACK;
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = 0;
      pmRet.cArg = 0;
      emit outputMessage(fd, &pmRet);
      break;
    }
  case PUKE_KSPROGRESS_SET_TOPTEXT:
    widget()->setTopText(QString(pm->cArg));
    pmRet.iCommand = PUKE_KSPROGRESS_SET_TOPTEXT;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_KSPROGRESS_SET_BOTTEXT:
    widget()->setBotText(QString(pm->cArg));
    pmRet.iCommand = PUKE_KSPROGRESS_SET_BOTTEXT;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_KSPROGRESS_SET_VALUE:
    widget()->setValue(pm->iArg);
    pmRet.iCommand = PUKE_KSPROGRESS_SET_VALUE_ACK;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;        
  default:
    PWidget::messageHandler(fd, pm);
  }
}
コード例 #5
0
ファイル: pkfiledialog.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PKFileDialog::messageHandler(int fd, PukeMessage *pm)
{
  PukeMessage pmRet;
  if(widget() == 0){
    debug("PKFileDialog: No Widget set");
    return;
  }
  switch(pm->iCommand){
  case PUKE_KBFD_SET_PATH:
    ((KFileBaseDialog *)widget())->setDir((const char *) pm->cArg);
    
    pmRet.iCommand = - pm->iCommand;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.iTextSize = widget()->dirPath().length();
    pmRet.cArg = widget()->dirPath().data();
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_KBFD_SET_FILTER:
    widget()->setFilter(pm->cArg);
    
    pmRet.iCommand = - pm->iCommand;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.iTextSize = 0;
    pmRet.cArg = 0;
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_KBFD_SET_SELECTION:
    widget()->setSelection(pm->cArg);
    
    pmRet.iCommand = - pm->iCommand;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.iTextSize = widget()->selectedFile().length();
    pmRet.cArg = widget()->selectedFile().data();
    emit outputMessage(fd, &pmRet);
    break;
  case PUKE_WIDGET_SHOW:
    widget()->exec();
    pmRet.iCommand = PUKE_KBFD_FILE_SELECTED_ACK;
    pmRet.iWinId = pm->iWinId;
    pmRet.iArg = 0;
    pmRet.cArg = new char[widget()->selectedFile().length()];
    memcpy(pmRet.cArg, widget()->selectedFile().data(), widget()->selectedFile().length());
    pmRet.iTextSize = widget()->selectedFile().length();
    emit outputMessage(widgetIden().fd, &pmRet);
    delete pmRet.cArg;
    break;

  default:
    PWidget::messageHandler(fd, pm);
  }
}
コード例 #6
0
ファイル: pmenudta.cpp プロジェクト: serghei/kde3-kdenetwork
bool PMenuData::menuMessageHandler(int fd, PukeMessage *pm)
{
    PukeMessage pmRet;
    int id = 0;
  switch(pm->iCommand){
  case PUKE_MENUDATA_INSERT_TEXT:
    {
      QPopupMenu *widget = (QPopupMenu *) child->widget();
      id = widget->insertItem(pm->cArg);
      if(pm->iArg > 0){
          widget->setAccel(pm->iArg, id);
      }

      pmRet.iCommand = PUKE_MENUDATA_INSERT_TEXT_ACK;
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = id;
      pmRet.cArg = 0;
      emit outputMessage(fd, &pmRet);
      break;
    }
  case PUKE_MENUDATA_INSERT_PIXMAP:
    {
      QPopupMenu *widget = (QPopupMenu *) child->widget();
      id = widget->insertItem(QPixmap(pm->cArg));
      if(pm->iArg > 0){
          widget->setAccel(pm->iArg, id);
      }
    
      pmRet.iCommand = PUKE_MENUDATA_INSERT_PIXMAP_ACK;
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = id;
      pmRet.cArg = 0;
      emit outputMessage(fd, &pmRet);
      break;
    }
  case PUKE_MENUDATA_REMOVE_ITEM:
    {
      QPopupMenu *widget = (QPopupMenu *) child->widget();
      widget->removeItem(pm->iArg);
    
      pmRet.iCommand = PUKE_MENUDATA_REMOVE_ITEM_ACK;
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = pm->iArg;
      pmRet.cArg = 0;
      emit outputMessage(fd, &pmRet);
      break;
    }

  default:
    return FALSE;
  }
  return TRUE;
}
コード例 #7
0
ファイル: pwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PWidget::eventMove(QObject *, QEvent *e)  
{
  PukeMessage pm;
  widgetId wI;

  QMoveEvent *me = Q_MOVE_EVENT(e);
  
  wI = widgetIden();
  pm.iCommand = - e->type() - 1020; // 1020 offset for events
  pm.iWinId = wI.iWinId;
  pm.iArg = 0;

  // special cArg handling
  pm.iTextSize = 4*sizeof(int);
  int *icArg = new int[4];
  icArg[0] = me->pos().x();
  icArg[1] = me->pos().y();
  icArg[2] = me->oldPos().x();
  icArg[3] = me->oldPos().y();
  pm.cArg = (char *) icArg;

  emit outputMessage(wI.fd, &pm);

  delete[] icArg;
  
}
コード例 #8
0
ファイル: pwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PWidget::eventResize(QObject *, QEvent *e)  
{
  PukeMessage pm;
  widgetId wI;

  QResizeEvent *re = Q_RESIZE_EVENT(e);
  
  wI = widgetIden();
  pm.iCommand = - e->type() - 1020; // 1020 offset for events
  pm.iWinId = wI.iWinId;
  pm.iArg = 0;

  // special cArg handling
  pm.iTextSize = 4*sizeof(int);
  int *icArg = new int[4];
  icArg[0] = re->size().height();
  icArg[1] = re->size().width();
  icArg[2] = re->oldSize().height();
  icArg[3] = re->oldSize().width();
  pm.cArg = (char *) icArg;

  emit outputMessage(wI.fd, &pm);

  delete[] icArg;
  
}
コード例 #9
0
void SvnJobBase::internalJobDone( ThreadWeaver::Job* job )
{
    if ( m_status == VcsJob::JobFailed ) {
        // see: https://bugs.kde.org/show_bug.cgi?id=273759
        // this gets also called when the internal job failed
        // then the emit result in internalJobFailed might trigger
        // a nested event loop (i.e. error dialog)
        // during that the internalJobDone gets called and triggers
        // deleteLater and eventually deletes this job
        // => havoc
        // 
        // catching this state here works but I don't like it personally...
        return;
    }

    if( internalJob() == job )
    {
        outputMessage(i18n("Completed"));
        if( m_status != VcsJob::JobCanceled )
        {
            m_status = KDevelop::VcsJob::JobSucceeded;
        }
    }
    emitResult();
    if( m_status == VcsJob::JobCanceled )
    {
        deleteLater();
    }
}
コード例 #10
0
ファイル: qplaintestlogger.cpp プロジェクト: Fale/qtmoko
    static void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0)
    {
        QTEST_ASSERT(type);
        QTEST_ASSERT(msg);

        char buf[1024];

        const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction()
            : "UnknownTestFunc";
        const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "";
        const char *gtag = QTestResult::currentGlobalDataTag()
                         ? QTestResult::currentGlobalDataTag()
                         : "";
        const char *filler = (tag[0] && gtag[0]) ? ":" : "";
        if (file) {
            QTest::qt_snprintf(buf, sizeof(buf), "%s: %s::%s(%s%s%s)%s%s\n"
#ifdef Q_OS_WIN
                          "%s(%d) : failure location\n"
#else
                          "   Loc: [%s(%d)]\n"
#endif
                          , type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
                          msg[0] ? " " : "", msg, file, line);
        } else {
            QTest::qt_snprintf(buf, sizeof(buf), "%s: %s::%s(%s%s%s)%s%s\n",
                    type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
                    msg[0] ? " " : "", msg);
        }
        memcpy(buf, type, strlen(type));
        outputMessage(buf);
    }
コード例 #11
0
void ExternalLanguage::displayProcessCommand()
{
	QStringList quotedArguments;
	//QList<QString> arguments = m_languageProcess->args();
    QList<QString> arguments;
    for (QList<QByteArray>::const_iterator itArgs = m_languageProcess->args().begin();
         itArgs != m_languageProcess->args().end();
         ++itArgs) {
        arguments.append(QString(*itArgs));
    }
	
	if ( arguments.size() == 1 )
		quotedArguments << arguments[0];
		
	else
	{
		QList<QString>::const_iterator end = arguments.end();
	
		for ( QList<QString>::const_iterator it = arguments.begin(); it != end; ++it )
		{
			if ( (*it).isEmpty() || (*it).contains( QRegExp("[\\s]") ) )
				quotedArguments << K3Process::quote( *it );
			else
				quotedArguments << *it;
		}
	}
	
// 	outputMessage( "<i>" + quotedArguments.join(" ") + "</i>" );
	outputMessage( quotedArguments.join(" ") );
// 	LanguageManager::self()->logView()->addOutput( quotedArguments.join(" "), LogView::ot_info );
}
コード例 #12
0
    static void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0)
    {
        QTEST_ASSERT(type);
        QTEST_ASSERT(msg);

        QTestCharBuffer buf;

        const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction()
            : "UnknownTestFunc";
        const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "";
        const char *gtag = QTestResult::currentGlobalDataTag()
                         ? QTestResult::currentGlobalDataTag()
                         : "";
        const char *filler = (tag[0] && gtag[0]) ? ":" : "";
        if (file) {
            QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n"
#ifdef Q_OS_WIN
                          "%s(%d) : failure location\n"
#else
                          "   Loc: [%s(%d)]\n"
#endif
                          , type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
                          msg[0] ? " " : "", msg, file, line);
        } else {
            QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n",
                    type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
                    msg[0] ? " " : "", msg);
        }
        // In colored mode, printf above stripped our nonprintable control characters.
        // Put them back.
        memcpy(buf.data(), type, strlen(type));
        outputMessage(buf.data());
    }
コード例 #13
0
ファイル: pwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PWidget::eventKey(QObject *, QEvent *e)  
{
  PukeMessage pm;
  widgetId wI;

  QKeyEvent *ke = Q_KEY_EVENT(e);
  
  wI = widgetIden();
  pm.iCommand = - e->type() - 1020; // 1020 offset for events
  pm.iWinId = wI.iWinId;
  pm.iArg = 0;

  // special cArg handling
  pm.iTextSize = 3*sizeof(int);
  int *icArg = new int[3];
  icArg[0] = ke->key();
  icArg[1] = ke->ascii();
  icArg[2] = ke->state();
  pm.cArg = (char *) icArg;

  emit outputMessage(wI.fd, &pm);

  delete[] icArg;
  
}
コード例 #14
0
ファイル: controller.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PukeController::MessageDispatch(int fd, PukeMessage *pm) /*FOLD00*/
{
    try {

        /*
         * Get the object id, this may produce a errorNuSuchWidget
         */
        PObject *obj = id2pobject(fd, pm->iWinId);
        
        /*
         * Call the message hanlder for the widget
         */
        obj->messageHandler(fd, pm);
    }
    catch(errorNoSuchWidget &err){
      PukeMessage pmRet;
      pmRet.iCommand = PUKE_INVALID;
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = 0;
      pmRet.iTextSize = 0;
      emit outputMessage(fd, &pmRet);
      return;
    }
    catch(errorCommandFailed &err){
      PukeMessage pmRet;
      pmRet.iCommand = err.command();
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = err.iarg();
      pmRet.iTextSize = 0;
      emit outputMessage(fd, &pmRet);
      return;
    }
    catch(errorInvalidSet &err){
      if(err.from() != 0)
        warning("Controller-ERROR: Tried setting a %s to a %s", err.from()->className(), err.to());
      else
        warning("Controller-ERROR: Tried setting a UNKOWN-0 to a %s", err.to());
      
      PukeMessage pmRet;
      pmRet.iCommand = pm->iCommand;
      pmRet.iWinId = pm->iWinId;
      pmRet.iArg = 0;
      pmRet.iTextSize = 0;
      emit outputMessage(fd, &pmRet);
      return;
    }
}
コード例 #15
0
ファイル: LogBrowser.cpp プロジェクト: vladfi1/ShapeSynth
LogBrowser::LogBrowser(QObject *parent) :
    QObject(parent)
{
    qRegisterMetaType<QtMsgType>("QtMsgType");
    browserDialog = new LogBrowserDialog;
    connect(this, SIGNAL(sendMessage(QtMsgType,QString)), browserDialog, SLOT(outputMessage(QtMsgType,QString)), Qt::QueuedConnection);
    browserDialog->show();
}
コード例 #16
0
ファイル: prettyprint.c プロジェクト: OpenGamma/Fudge-C
void outputEnvelope ( FudgeMsgEnvelope envelope )
{
    printf ( "Schema version: %d\nTaxonomy: %d\nMessage:\n{\n",
             ( int ) FudgeMsgEnvelope_getSchemaVersion ( envelope ),
             ( int ) FudgeMsgEnvelope_getTaxonomy ( envelope ) );
    outputMessage ( FudgeMsgEnvelope_getMessage ( envelope ), 0 );
    printf ( "}\n" );
}
コード例 #17
0
ファイル: ParseContextBase.cpp プロジェクト: dumganhar/bgfx
void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReason, const char* szToken,
                                      const char* szExtraInfoFormat, ...)
{
    va_list args;
    va_start(args, szExtraInfoFormat);
    outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixWarning, args);
    va_end(args);
}
コード例 #18
0
ファイル: pprogress.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PProgress::cancelPressed(){ /*FOLD00*/
  debug("Cancel Pressed");
  PukeMessage pmRet;
  pmRet.iCommand = PUKE_KSPROGRESS_CANCEL_ACK;
  pmRet.iWinId = widgetIden().iWinId;
  pmRet.iArg = 0;
  pmRet.cArg = 0;
  emit outputMessage(widgetIden().fd, &pmRet);
}
コード例 #19
0
//    static void printBenchmarkResult(const char *bmtag, int value, int iterations)
    static void printBenchmarkResult(const QBenchmarkResult &result)
    {
        const char *bmtag = QTest::benchmarkResult2String();

        char buf1[1024];
        QTest::qt_snprintf(
            buf1, sizeof(buf1), "%s: %s::%s",
            bmtag,
            QTestResult::currentTestObjectName(),
            result.context.slotName.toAscii().data());


        char bufTag[1024];
        bufTag[0] = 0;
        QByteArray tag = result.context.tag.toAscii();
        if (tag.isEmpty() == false) {
            QTest::qt_snprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
        }


        char fillFormat[8];
        int fillLength = 5;
        QTest::qt_snprintf(
            fillFormat, sizeof(fillFormat), ":\n%%%ds", fillLength);
        char fill[1024];
        QTest::qt_snprintf(fill, sizeof(fill), fillFormat, "");


        QByteArray unitText = QBenchmarkGlobalData::current->measurer->unitText().toAscii();

        qreal valuePerIteration = qreal(result.value) / qreal(result.iterations);
        char resultBuffer[100] = "";
        formatResult(resultBuffer, 100, valuePerIteration, countSignificantDigits(result.value));

        QByteArray iterationText = "per iteration";

        char buf2[1024];
        Q_ASSERT(result.iterations > 0);
        QTest::qt_snprintf(
            buf2, sizeof(buf2), "%s %s %s",
            resultBuffer,
            unitText.data(),
            iterationText.data());

        char buf3[1024];
        Q_ASSERT(result.iterations > 0);
        QTest::qt_snprintf(
            buf3, sizeof(buf3), " (total: %s, iterations: %d)\n",
            QByteArray::number(result.value).constData(), // no 64-bit qt_snprintf support
            result.iterations);

        char buf[1024];
        QTest::qt_snprintf(buf, sizeof(buf), "%s%s%s%s%s", buf1, bufTag, fill, buf2, buf3);
        memcpy(buf, bmtag, strlen(bmtag));
        outputMessage(buf);
    }
コード例 #20
0
//----------------------------------------------------------------------------
void ctkHostAppExampleWidget::startButtonClicked()
{
  qDebug() << "start button clicked";
  if (this->Host)
    {
    this->Host->StartApplication(this->AppFileName);
    //forward output to textedit
    connect(&this->Host->getAppProcess(),SIGNAL(readyReadStandardOutput()),this,SLOT(outputMessage()));
    }
}
コード例 #21
0
void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
{
    const char *bmtag = QTest::benchmarkResult2String();

    char buf1[1024];
    qsnprintf(
        buf1, sizeof(buf1), "%s: %s::%s",
        bmtag,
        QTestResult::currentTestObjectName(),
        result.context.slotName.toLatin1().data());

    char bufTag[1024];
    bufTag[0] = 0;
    QByteArray tag = result.context.tag.toLocal8Bit();
    if (tag.isEmpty() == false) {
        qsnprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data());
    }


    char fillFormat[8];
    int fillLength = 5;
    qsnprintf(fillFormat, sizeof(fillFormat), ":\n%%%ds", fillLength);
    char fill[1024];
    qsnprintf(fill, sizeof(fill), fillFormat, "");

    const char * unitText = QTest::benchmarkMetricUnit(result.metric);

    qreal valuePerIteration = qreal(result.value) / qreal(result.iterations);
    char resultBuffer[100] = "";
    QTest::formatResult(resultBuffer, 100, valuePerIteration, QTest::countSignificantDigits(result.value));

    char buf2[1024];
    qsnprintf(buf2, sizeof(buf2), "%s %s", resultBuffer, unitText);

    char buf2_[1024];
    QByteArray iterationText = " per iteration";
    Q_ASSERT(result.iterations > 0);
    qsnprintf(buf2_, sizeof(buf2_), "%s", iterationText.data());

    char buf3[1024];
    Q_ASSERT(result.iterations > 0);
    QTest::formatResult(resultBuffer, 100, result.value, QTest::countSignificantDigits(result.value));
    qsnprintf(buf3, sizeof(buf3), " (total: %s, iterations: %d)", resultBuffer, result.iterations);

    char buf[1024];

    if (result.setByMacro) {
        qsnprintf(buf, sizeof(buf), "%s%s%s%s%s%s\n", buf1, bufTag, fill, buf2, buf2_, buf3);
    } else {
        qsnprintf(buf, sizeof(buf), "%s%s%s%s\n", buf1, bufTag, fill, buf2);
    }

    memcpy(buf, bmtag, strlen(bmtag));
    outputMessage(buf);
}
コード例 #22
0
ファイル: ParseContextBase.cpp プロジェクト: dumganhar/bgfx
void C_DECL TParseContextBase::ppError(const TSourceLoc& loc, const char* szReason, const char* szToken,
                                       const char* szExtraInfoFormat, ...)
{
    va_list args;
    va_start(args, szExtraInfoFormat);
    outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args);
    va_end(args);

    if ((messages & EShMsgCascadingErrors) == 0)
        currentScanner->setEndOfInput();
}
コード例 #23
0
ファイル: pwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PWidget::eventPaint(QObject *, QEvent *e)  
{
  PukeMessage pm;
  widgetId wI;

  wI = widgetIden();
  pm.iCommand = - e->type() - 1020; // 1020 offset for events
  pm.iWinId = wI.iWinId;
  pm.iArg = 0;
  pm.cArg = 0;

  emit outputMessage(wI.fd, &pm);
  
}
コード例 #24
0
void QPlainTestLogger::startLogging()
{
    QAbstractTestLogger::startLogging();

    char buf[1024];
    if (QTestLog::verboseLevel() < 0) {
        qsnprintf(buf, sizeof(buf), "Testing %s\n", QTestResult::currentTestObjectName());
    } else {
        qsnprintf(buf, sizeof(buf),
                  "********* Start testing of %s *********\n"
                  "Config: Using QtTest library " QTEST_VERSION_STR
                  ", %s\n", QTestResult::currentTestObjectName(), QLibraryInfo::build());
    }
    outputMessage(buf);
}
コード例 #25
0
ファイル: pwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PWidget::eventTimer(QObject *, QEvent *e)  
{
  PukeMessage pm;
  widgetId wI;

  QTimerEvent *et = Q_TIMER_EVENT(e);
  
  wI = widgetIden();
  pm.iCommand = PUKE_WIDGET_EVENT_TIMER;
  pm.iWinId = wI.iWinId;
  pm.iArg = et->timerId();
  pm.cArg = 0;

  emit outputMessage(wI.fd, &pm);
  
}
コード例 #26
0
void QPlainTestLogger::stopLogging()
{
    char buf[1024];
    if (QTestLog::verboseLevel() < 0) {
        qsnprintf(buf, sizeof(buf), "Totals: %d passed, %d failed, %d skipped\n",
                  QTestLog::passCount(), QTestLog::failCount(),
                  QTestLog::skipCount());
    } else {
        qsnprintf(buf, sizeof(buf),
                  "Totals: %d passed, %d failed, %d skipped\n"
                  "********* Finished testing of %s *********\n",
                  QTestLog::passCount(), QTestLog::failCount(),
                  QTestLog::skipCount(), QTestResult::currentTestObjectName());
    }
    outputMessage(buf);

    QAbstractTestLogger::stopLogging();
}
コード例 #27
0
ファイル: controller.cpp プロジェクト: kthxbyte/KDE1-Linaro
void PukeController::hdlrPukeDeleteWidget(int fd, PukeMessage *pm) /*FOLD00*/
{
  widgetId wI;
  wI.fd = fd;
  wI.iWinId = pm->iWinId;

  if(pm->iWinId == ControllerWinId) // Don't try and delete ourselves
    throw(errorCommandFailed(PUKE_INVALID, INVALID_DEL_NO_CONTROL));

  /*
  QIntDict<WidgetS> *qidWS = WidgetList[fd];
  if(qidWS == 0){
    debug("WidgetRunner:: no such set of widget descriptors?");
    throw(errorCommandFailed(PUKE_INVALID, INVALID_DEL_NO_SUCH_CONNECTION));
  }
  if(qidWS->find(wI.iWinId)){
    debug("Closing: %d", wI.iWinId);
    // Remove the list item then delete the widget.  This will stop
    // the destroyed signal from trying to remove it again.
    PObject *pw = qidWS->find(wI.iWinId)->pwidget;
    qidWS->remove(wI.iWinId);
    delete pw; pw = 0;
    pmRet.iCommand = PUKE_WIDGET_DELETE_ACK;
  }
  else {
    warning("WidgetRunner: no such widget: %d", wI.iWinId);
    throw(errorCommandFailed(PUKE_INVALID, INVALID_DEL_NO_SUCH_WIDGET));
    }
  */

  if(checkWidgetId(&wI) == FALSE){
    warning("WidgetRunner: no such widget: %d", wI.iWinId);
    throw(errorCommandFailed(PUKE_INVALID, INVALID_DEL_NO_SUCH_WIDGET));
  }

  debug("Delete widget %d", wI.iWinId);
  WidgetList[fd]->find(wI.iWinId)->pwidget->manTerm();
  delete WidgetList[fd]->find(wI.iWinId)->pwidget;
  
  PukeMessage pmRet = *pm;
  pmRet.iCommand = PUKE_WIDGET_DELETE_ACK;
  
  emit outputMessage(fd, &pmRet);
}
コード例 #28
0
void SvnJobBase::internalJobFailed( ThreadWeaver::Job* job )
{
    if( internalJob() == job )
    {
        setError( 255 );
        QString msg = internalJob()->errorMessage();
        if( !msg.isEmpty() )
            setErrorText( i18n( "Error executing Job:\n%1", msg ) );
        outputMessage(errorText());
        kDebug(9510) << "Job failed";
        if( m_status != VcsJob::JobCanceled )
        {
            m_status = KDevelop::VcsJob::JobFailed;
        }
        emitResult();
    }
    if( m_status == VcsJob::JobCanceled )
    {
        deleteLater();
    }
}
コード例 #29
0
ファイル: pwidget.cpp プロジェクト: kthxbyte/KDE1-Linaro
// PWidget specific
bool PWidget::eventFilter(QObject *o, QEvent *e)
{
//  debug("PWidget(%d): Got event: %d", widget(), e->type());
//  fprintf(stderr, "Blah\n");
  if(e->type() < 20 && e->type() >= 0){
    (this->*(eventList[e->type()]))(o,e);
  }
  else{
    PukeMessage pm;
    widgetId wI;
    
    wI = widgetIden();
    pm.iCommand = PUKE_EVENT_UNKOWN;
    pm.iWinId = wI.iWinId;
    pm.iArg = e->type();
    pm.cArg = 0;
    emit outputMessage(wI.fd, &pm);

  }

  return false;
}
コード例 #30
0
		/**
		 * @brief The Logger calls this method to write Messages
		 *
		 * @todo Another method that takes a Message would definetly
		 * make sense :)
		 */
		void
		write(const std::string& aModuleRef,
		      const std::string& aLocationRef,
		      const std::string& aMsgRef)
		{
			if (doLogging)
			{
				// If we have loggin enabled we have to process
				// the message
				RawMessage m;
				/**
				 * @todo libwns can have an own EventScheduler
				 * which can forward stuff to the EventScheduler
				 */
				m.time = wns::simulator::getEventScheduler()->getTime();
				m.module = aModuleRef;
				m.location = aLocationRef;
				m.message = aMsgRef;

				if (haveBacktrace)
				{
					// if we have logging enabled, and the
					// backtracing is enabled we will not
					// write the message, but rather keep it
					// in the backtrace buffer
					saveForBacktrace(m);
				}
				else
				{
					// if we have logging enabled and
					// backtrace disable we are going to
					// write the message
					outputMessage(m);
				}
			}
			// If we have don't have debugging and backtrace
			// enabled we will do nothing
		};