コード例 #1
0
ファイル: mididevice.cpp プロジェクト: speakman/qlc
QString MIDIDevice::infoText()
{
	MIDIInput* plugin;
	QString info;

	plugin = static_cast<MIDIInput*> (parent());
	Q_ASSERT(plugin != NULL);

        if (plugin->alsa() != NULL)
        {
                info += QString("<B>%1</B>").arg(name());
                info += QString("<P>");
                info += QString("Device is working correctly.");
                info += QString("</P>");
                info += QString("<P>");
                info += QString("<B>MIDI Channel: </B>%1<BR>")
                                .arg(m_midiChannel + 1);
                info += QString("<B>Mode: </B>%1")
                                .arg(modeToString(m_mode));
                info += QString("</P>");
        }
	else
	{
                info += QString("<B>Unknown device</B>");
                info += QString("<P>");
                info += QString("ALSA sequencer interface is not available.");
                info += QString("</P>");
        }

	return info;
}
コード例 #2
0
ファイル: IDBTransaction.cpp プロジェクト: yang-bo/webkit
const String& IDBTransaction::mode() const
{
    ExceptionCode ec = 0;
    const AtomicString& mode = modeToString(m_mode, ec);
    ASSERT(!ec);
    return mode;
}
コード例 #3
0
ファイル: mididevice.cpp プロジェクト: alexpaulzor/qlc
QString MIDIDevice::infoText() const
{
    MIDIOut* plugin;
    QString info;

    plugin = static_cast<MIDIOut*> (parent());
    Q_ASSERT(plugin != 0);

    if (plugin->client() != 0)
    {
        info += QString("<B>%1</B>").arg(name());
        info += QString("<P>");
        info += tr("Device is working correctly.");
        info += QString("</P>");
        info += QString("<P><B>");
        info += tr("MIDI Channel: %1").arg(m_midiChannel + 1);
        info += QString("</B><BR><B>");
        info += tr("Mode: %1").arg(modeToString(m_mode));
        info += QString("</B></P>");
    }
    else
    {
        info += QString("<B>");
        info += tr("Unknown device");
        info += QString("</B>");
        info += QString("<P>");
        info += tr("MIDI interface is not available.");
        info += QString("</P>");
    }

    return info;
}
コード例 #4
0
void ofApp::draw(){
    ofSetColor(255, 255, 255, alpha);
    if((type==MOVIE)&&(state!=STOPPED)) {
        videoPlayer.draw(x, y, w, h);
    } else if((type==IMAGE)&&(state!=STOPPED)) {
        stillImage.draw(x, y, w, h);
    } else if(type==NOTFOUND) {
        ofSetHexColor(0xFFFFFF);
        ofDrawBitmapString("file '"+fileName+"' not found!", 300, 300);
    }
    if(info) {
        ofSetHexColor(0xFFFFFF);
        ofDrawBitmapString("listening on port: "+ofToString(PORT), 30, 30);
        ofDrawBitmapString("last osc: "+message, 30, 50);
        ofDrawBitmapString("screen resolution: "+ofToString(ofGetScreenWidth())+"x"+ofToString(ofGetScreenHeight()), 30, 70);
        ofDrawBitmapString("framerate: "+ofToString(ofGetFrameRate()), 30, 90);
        ofDrawBitmapString("fileName: "+fileName, 30, 110);
        ofDrawBitmapString("media type: "+typeToString(type), 30, 130);
        ofDrawBitmapString("media resolution: "+ofToString(ow)+"x"+ofToString(oh), 30, 150);
        ofDrawBitmapString("mode: "+modeToString(mode), 30, 170);
        ofDrawBitmapString("loopMode: "+ofToString(loopMode), 30, 190);
        ofDrawBitmapString("frames: "+ofToString(frames), 30, 210);
        ofDrawBitmapString("speed: "+ofToString(speed), 30, 230);
        ofDrawBitmapString("alpha: "+ofToString(alpha), 30, 250);
        ofDrawBitmapString("state: "+stateToString(state), 30, 270);
    }
}
コード例 #5
0
ファイル: monitorwidget.cpp プロジェクト: Ilya87/lxqt-config
MonitorWidget::MonitorWidget(KScreen::OutputPtr output, KScreen::ConfigPtr config, QWidget* parent) :
    QGroupBox(parent)
{
    this->output = output;
    this->config = config;

    ui.setupUi(this);

    ui.enabledCheckbox->setChecked(output->isEnabled());

    QList <KScreen::ModePtr> modeList = output->modes().values();

    // Remove duplicate sizes
    QMap<QString, KScreen::ModePtr> noDuplicateModes;
    foreach(const KScreen::ModePtr &mode, modeList)
    {
        if( noDuplicateModes.keys().contains(modeToString(mode)) )
        {
            KScreen::ModePtr actual = noDuplicateModes[modeToString(mode)];
            bool isActualPreferred = output->preferredModes().contains(actual->id());
            bool isModePreferred = output->preferredModes().contains(mode->id());
            if( ( mode->refreshRate() > actual->refreshRate() && !isActualPreferred ) || isModePreferred )
                noDuplicateModes[modeToString(mode)] = mode;
        }
        else
            noDuplicateModes[modeToString(mode)] = mode;
    }

    // Sort modes by size
    modeList = noDuplicateModes.values();
    qSort(modeList.begin(), modeList.end(), sizeBiggerThan);

    // Add each mode to the list
    foreach (const KScreen::ModePtr &mode, modeList)
    {
        ui.resolutionCombo->addItem(modeToString(mode), mode->id());
        if(output->preferredModes().contains(mode->id()))
        {
             // Make bold preferredModes
             QFont font = ui.resolutionCombo->font();
             font.setBold(true);
             ui.resolutionCombo->setItemData(ui.resolutionCombo->count()-1, font, Qt::FontRole);
        }
    }
コード例 #6
0
String toString(const png_struct &png) {
  return format("PNG_STRUCT:\n"
                "  size               : %d x %d\n"
                "  rowbytes           : %d\n"
                "  mode               : %s\n"
                "  flags              : %s\n"
                "  transformations    : %s\n"
                "  color_type;        : %s\n"   
                "  bit_depth;         : %d\n"   
                "  pixel_depth;       : %d\n"   
                "  channels;          : %d\n"   
/*
                "  num_trans          : %d\n"
                "  num_palette        : %d\n"
                "  compression;       : %d\n"   
                "  filter;            : %d\n"   
                "  interlaced;        : %d\n"   
                "  pass;              : %d\n"   
                "  do_filter;         : %d\n"   
                "  usr_bit_depth;     : %d\n"   
                "  usr_channels;      : %d\n"   
                "  sig_bytes;         : %d\n"   
                "  maximum_pixel_depth: %d\n"
*/
               ,png.width,png.height
               ,png.rowbytes
               ,modeToString(png.mode).cstr()
               ,flagsToString(png.flags).cstr()
               ,transToString(png.transformations).cstr()
               ,colorTypeToString(png.color_type).cstr()
               ,png.bit_depth
               ,png.pixel_depth
               ,png.channels
/*
               ,png.num_trans
               ,png.num_palette
               ,png.compression
               ,png.filter
               ,png.interlaced
               ,png.pass
               ,png.do_filter
               ,png.usr_bit_depth
               ,png.usr_channels
               ,png.sig_bytes
               ,png.maximum_pixel_depth
*/
                );
}
コード例 #7
0
ファイル: Tools.cpp プロジェクト: zipang29/mini_maya
Modes::Mode Tools::detectCurrentMode(DataMotion * data, int lineNumber)
{
    Modes::Mode result = Modes::PAUSE;

    Point * poignetD = data->getPoint(lineNumber, "PR");
    Point * doigtsD = data->getPoint(lineNumber, "DR");

    Point * poignetG = data->getPoint(lineNumber, "PL");
    Point * doigtsG = data->getPoint(lineNumber, "DL");

    if (poignetD == NULL || doigtsD == NULL || poignetG == NULL || doigtsG == NULL)
        return Modes::PAUSE;

    double distanceMainDroite = data->calculDistance3D(poignetD, doigtsD);
    double distanceMainGauche = data->calculDistance3D(poignetG, doigtsG);

    if (distanceMainGauche > 80 && distanceMainGauche < 100)
    {
        if (distanceMainDroite > 80 && distanceMainDroite < 100)
        {
            result = Modes::PAUSE;
            qDebug() << "Mode : PAUSE";
        }
        else
        {
            result = Modes::CHANGE_TOOL;
            qDebug() << "Mode : CHANGE_TOOL";
            double distance = data->calculDistance3D(doigtsG, doigtsD);
            int max = 5;
            int value = qRound((distance * max) / 1000);
            if (value > 5)
                value = 5;
            if (value < 0)
                value = 0;
            tmpMode = nextTool(value);
            result = Modes::PAUSE;
        }
    }
    else // on valide l'outil sélectionné
    {
        qInfo() << modeToString();
        result = tmpMode;
    }

    return result;
}
コード例 #8
0
ファイル: vvimindicator.cpp プロジェクト: liunianbanbo/vnote
void VVimIndicator::update(const VVim *p_vim, const VEditTab *p_editTab)
{
    m_editTab = const_cast<VEditTab *>(p_editTab);
    if (m_vim != p_vim) {
        // Disconnect from previous Vim.
        if (m_vim) {
            disconnect(m_vim.data(), 0, this, 0);
        }

        m_vim = const_cast<VVim *>(p_vim);
        if (m_vim) {
            // Connect signal.
            connect(m_vim.data(), &VVim::commandLineTriggered,
                    this, &VVimIndicator::triggerCommandLine);

            m_cmdLineEdit->hide();
        }
    }

    if (!m_vim) {
        m_cmdLineEdit->hide();
        return;
    }

    VimMode mode = VimMode::Normal;
    QChar curRegName(' ');
    QChar lastUsedMark;
    QString pendingKeys;
    if (p_vim) {
        mode = p_vim->getMode();
        curRegName = p_vim->getCurrentRegisterName();
        lastUsedMark = p_vim->getMarks().getLastUsedMark();
        pendingKeys = p_vim->getPendingKeys();
    }

    m_modeLabel->setStyleSheet(QString("background: %1;").arg(modeBackgroundColor(mode)));
    m_modeLabel->setText(modeToString(mode));

    m_regBtn->setText(curRegName);

    QString markText = QString("[%1]")
                              .arg(lastUsedMark.isNull() ? QChar(' ') : lastUsedMark);
    m_markBtn->setText(markText);

    m_keyLabel->setText(pendingKeys);
}
コード例 #9
0
ファイル: mididevice.cpp プロジェクト: speakman/qlc
QString MIDIDevice::infoText()
{
	QString info;

	info += QString("<B>%1</B>").arg(name());
	info += QString("<P>");
	if (m_isOK == true)
		info += QString("Device is working correctly.");
	else
		info += QString("<B>MIDI Output not available.</B>");
	info += QString("</P>");
	info += QString("<P>");
	info += QString("<B>MIDI Channel: </B>%1<BR>").arg(m_midiChannel + 1);
	info += QString("<B>Mode: </B>%1").arg(modeToString(m_mode));
	info += QString("</P>");

	return info;
}
コード例 #10
0
ファイル: Camera.cpp プロジェクト: cozza13/hifi
QString Camera::getModeString() const {
    return modeToString(_mode);
}
コード例 #11
0
ファイル: MessagePassing.cpp プロジェクト: dtt13/thermostat
// Interprets commands from Linino for controlling the thermostat and touchscreen
void processCommands(TempControl *tc, ScreenControl *sc) {
  if(isStreaming && (millis() - lastStreamTime) > STREAM_DELAY) {
    isStreaming = false;
    sc->clearTouch();
    sc->hideApp(false, false);
  }
//  Serial.println("processing...");
  while(Serial1.available() > 0) {
    memset(buff_ptr, 0x00, COMMAND_BUFFER_SIZE);
    int numBytes;
    Serial1.readBytes(buff_ptr, 1);
    switch(buff_ptr[0]) {
      case GET_TEMP:
        numBytes = readPacket();
        buff_ptr[6] = tc->getRoomTemp();
        buff_ptr[8] = tc->getTargetTemp();
        Serial1.print(String(GET_TEMP));
        Serial1.write((uint8_t *)(buff_ptr + 6), 4);
        Serial1.println();
        break;
      case GET_MODE:
        numBytes = readPacket();
        Serial1.println(String(GET_MODE) + modeToString(tc));
        break;
      case GET_UNIT:
        numBytes = readPacket();
        Serial1.println(String(GET_UNIT) + unitToString(tc));
        break;
      case IS_ON:
        numBytes = readPacket();
        Serial1.println(String(IS_ON) + isOnToString(tc));
        break;
      case SET_TARGET_TEMP:
        numBytes = readPacket();
        tc->setTargetTemp(unpackNumber(buff_ptr, 3, 2));
        Serial1.println(String(SET_TARGET_TEMP));
        break;
      case SWITCH:
        numBytes = readPacket();
        Serial1.println(String(SWITCH));
        switch(buff_ptr[3]) {
          case SWITCH_MODE:
            tc->switchMode();
            break;
          case SWITCH_UNIT:
            tc->switchUnit();
            break;
          case SWITCH_FAN:
            tc->switchFan();
            break;
        }
        break;
      case WRITE_TEXT:
        numBytes = readPacket();
        Serial1.println(String(WRITE_TEXT));
        buff_ptr[numBytes + 3] = '\0';
        sc->layerMode(2);
        sc->writeText(unpackNumber(buff_ptr, 3, 2), unpackNumber(buff_ptr, 5, 2),
                            unpackNumber(buff_ptr, 7, 2), unpackNumber(buff_ptr, 9, 2),
                            unpackNumber(buff_ptr, 11, 1), buff_ptr+12);
        sc->layerMode(1);
        break;
      case STREAM_IMAGE:
        numBytes = readPacket();
        sc->hideApp(true, true);
        sc->layerMode(2);
        sc->drawImage((uint16_t *) (buff_ptr + 11), (numBytes - 8) / 2, unpackNumber(buff_ptr, 3, 2), unpackNumber(buff_ptr, 5, 2),
                      unpackNumber(buff_ptr, 7, 2), unpackNumber(buff_ptr, 9, 2));
        Serial1.println(String(STREAM_IMAGE));
        sc->layerMode(1);
        lastStreamTime = millis();
        if(!isStreaming) {
          isStreaming = true;
        }
        break;
      case CLEAR_APP:
        numBytes = readPacket();
        sc->clearApp();
        Serial1.println(String(CLEAR_APP));
        break;
      case APP_TOUCH:
        numBytes = readPacket();
        if(sc->appTouched) {
          buff_ptr[6] = sc->appX;
          buff_ptr[8] = sc->appY;
          Serial1.print(String(APP_TOUCH));
          Serial1.write((uint8_t *)(buff_ptr + 6), 4);
          Serial1.println();
          sc->appTouched = false;
        } else {
          Serial1.println(String(APP_TOUCH) + "X");
        }
        break;
      case SET_IP:
        numBytes = readPacket();
        strcpy(sc->ipaddr, buff_ptr + 3);
        Serial1.println(String(SET_IP));
        break;
      default:
        Serial.println("Error: no such command");
        numBytes = Serial1.readBytes(buff_ptr, COMMAND_BUFFER_SIZE);
    }
  }
}
コード例 #12
0
ファイル: monitorwidget.cpp プロジェクト: lxde/lxqt-config
MonitorWidget::MonitorWidget(KScreen::OutputPtr output, KScreen::ConfigPtr config, QWidget* parent) :
    QGroupBox(parent)
{
    this->output = output;
    this->config = config;

    ui.setupUi(this);

    ui.enabledCheckbox->setChecked(output->isEnabled());

    QList <KScreen::ModePtr> modeList = output->modes().values();

    // Remove duplicate sizes
    QMap<QString, KScreen::ModePtr> noDuplicateModes;
    for(const KScreen::ModePtr &mode : qAsConst(modeList))
    {
        if( noDuplicateModes.keys().contains(modeToString(mode)) )
        {
            KScreen::ModePtr actual = noDuplicateModes[modeToString(mode)];
            bool isActualPreferred = output->preferredModes().contains(actual->id());
            bool isModePreferred = output->preferredModes().contains(mode->id());
            if( ( mode->refreshRate() > actual->refreshRate() && !isActualPreferred ) || isModePreferred )
                noDuplicateModes[modeToString(mode)] = mode;
        }
        else
            noDuplicateModes[modeToString(mode)] = mode;
    }

    // Sort modes by size
    modeList = noDuplicateModes.values();
    qSort(modeList.begin(), modeList.end(), sizeBiggerThan);

    // Add each mode to the list
    for (const KScreen::ModePtr &mode : qAsConst(modeList))
    {
        ui.resolutionCombo->addItem(modeToString(mode), mode->id());
        if(output->preferredModes().contains(mode->id()))
        {
             // Make bold preferredModes
             QFont font = ui.resolutionCombo->font();
             font.setBold(true);
             ui.resolutionCombo->setItemData(ui.resolutionCombo->count()-1, font, Qt::FontRole);
        }
    }
    connect(ui.resolutionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onResolutionChanged(int)));

    // Select actual mode in list
    if (output->currentMode())
    {
        // Set the current mode in dropdown
        int idx = ui.resolutionCombo->findData(output->currentMode()->id());
        if (idx < 0)
        {
            // Select mode with same size
            for (const KScreen::ModePtr &mode : qAsConst(modeList))
            {
                if( mode->size() == output->currentMode()->size() )
                    idx = ui.resolutionCombo->findData(output->currentMode()->id());
            }
        }
        if(idx < 0)
            idx = ui.resolutionCombo->findData(output->preferredMode()->id());
        if (idx >= 0)
            ui.resolutionCombo->setCurrentIndex(idx);
    }
    updateRefreshRates();


    // Update EDID information
    // KScreen doesn't make much public but that's ok...
    KScreen::Edid* edid = output->edid();
    if (edid && edid->isValid())
    {
        ui.outputInfoLabel->setText(
            tr("Name: %1\n").arg(edid->name()) %
            tr("Vendor: %1\n").arg(edid->vendor()) %
            tr("Serial: %1\n").arg(edid->serial()) %
            tr("Display size: %1cm x %2cm\n").arg(edid->width()).arg(edid->height()) %
            tr("Serial number: %1\n").arg(edid->serial()) %
            tr("EISA device ID: %1\n").arg(edid->eisaId())
        );
    }

    if (config->connectedOutputs().count() == 1)
    {
        setOnlyMonitor(true);
        // There isn't always a primary output. Gross.
        output->setPrimary(true);
    }

    ui.xPosSpinBox->setValue(output->pos().x());
    ui.yPosSpinBox->setValue(output->pos().y());

    // Behavior chooser
    if (output->isPrimary())
        ui.behaviorCombo->setCurrentIndex(PrimaryDisplay);
    else
        ui.behaviorCombo->setCurrentIndex(ExtendDisplay);

    // Insert orientations
    ui.orientationCombo->addItem(tr("None"), KScreen::Output::None);
    ui.orientationCombo->addItem(tr("Left"), KScreen::Output::Left);
    ui.orientationCombo->addItem(tr("Right"), KScreen::Output::Right);
    ui.orientationCombo->addItem(tr("Inverted"), KScreen::Output::Inverted);
    switch(output->rotation())
    {
    case KScreen::Output::None:
            ui.orientationCombo->setCurrentIndex(0);
        break;
    case KScreen::Output::Left:
        ui.orientationCombo->setCurrentIndex(1);
        break;
    case KScreen::Output::Right:
            ui.orientationCombo->setCurrentIndex(2);
        break;
    case KScreen::Output::Inverted:
        ui.orientationCombo->setCurrentIndex(3);
        break;
    }

    connect(ui.enabledCheckbox, SIGNAL(toggled(bool)), this, SLOT(onEnabledChanged(bool)));
    connect(ui.behaviorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onBehaviorChanged(int)));
    connect(ui.xPosSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPositionChanged(int)));
    connect(ui.yPosSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPositionChanged(int)));
    connect(ui.orientationCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onOrientationChanged(int)));

    // Force update behavior visibility
    onBehaviorChanged(ui.behaviorCombo->currentIndex());
}
コード例 #13
0
void Graph::dump(const char* prefix, NodeIndex nodeIndex)
{
    Node& node = at(nodeIndex);
    NodeType op = node.op();

    unsigned refCount = node.refCount();
    bool skipped = !refCount;
    bool mustGenerate = node.mustGenerate();
    if (mustGenerate)
        --refCount;
    
    dataLog("%s", prefix);
    printNodeWhiteSpace(node);

    // Example/explanation of dataflow dump output
    //
    //   14:   <!2:7>  GetByVal(@3, @13)
    //   ^1     ^2 ^3     ^4       ^5
    //
    // (1) The nodeIndex of this operation.
    // (2) The reference count. The number printed is the 'real' count,
    //     not including the 'mustGenerate' ref. If the node is
    //     'mustGenerate' then the count it prefixed with '!'.
    // (3) The virtual register slot assigned to this node.
    // (4) The name of the operation.
    // (5) The arguments to the operation. The may be of the form:
    //         @#   - a NodeIndex referencing a prior node in the graph.
    //         arg# - an argument number.
    //         $#   - the index in the CodeBlock of a constant { for numeric constants the value is displayed | for integers, in both decimal and hex }.
    //         id#  - the index in the CodeBlock of an identifier { if codeBlock is passed to dump(), the string representation is displayed }.
    //         var# - the index of a var on the global object, used by GetGlobalVar/PutGlobalVar operations.
    dataLog("% 4d:%s<%c%u:", (int)nodeIndex, skipped ? "  skipped  " : "           ", mustGenerate ? '!' : ' ', refCount);
    if (node.hasResult() && !skipped && node.hasVirtualRegister())
        dataLog("%u", node.virtualRegister());
    else
        dataLog("-");
    dataLog(">\t%s(", opName(op));
    bool hasPrinted = false;
    if (node.flags() & NodeHasVarArgs) {
        for (unsigned childIdx = node.firstChild(); childIdx < node.firstChild() + node.numChildren(); childIdx++) {
            if (hasPrinted)
                dataLog(", ");
            else
                hasPrinted = true;
            dataLog("%s@%u%s",
                    useKindToString(m_varArgChildren[childIdx].useKind()),
                    m_varArgChildren[childIdx].index(),
                    speculationToAbbreviatedString(
                        at(m_varArgChildren[childIdx]).prediction()));
        }
    } else {
        if (!!node.child1()) {
            dataLog("%s@%u%s",
                    useKindToString(node.child1().useKind()),
                    node.child1().index(),
                    speculationToAbbreviatedString(at(node.child1()).prediction()));
        }
        if (!!node.child2()) {
            dataLog(", %s@%u%s",
                    useKindToString(node.child2().useKind()),
                    node.child2().index(),
                    speculationToAbbreviatedString(at(node.child2()).prediction()));
        }
        if (!!node.child3()) {
            dataLog(", %s@%u%s",
                    useKindToString(node.child3().useKind()),
                    node.child3().index(),
                    speculationToAbbreviatedString(at(node.child3()).prediction()));
        }
        hasPrinted = !!node.child1();
    }

    if (strlen(nodeFlagsAsString(node.flags()))) {
        dataLog("%s%s", hasPrinted ? ", " : "", nodeFlagsAsString(node.flags()));
        hasPrinted = true;
    }
    if (node.hasArrayMode()) {
        dataLog("%s%s", hasPrinted ? ", " : "", modeToString(node.arrayMode()));
        hasPrinted = true;
    }
    if (node.hasVarNumber()) {
        dataLog("%svar%u", hasPrinted ? ", " : "", node.varNumber());
        hasPrinted = true;
    }
    if (node.hasRegisterPointer()) {
        dataLog(
            "%sglobal%u(%p)", hasPrinted ? ", " : "",
            globalObjectFor(node.codeOrigin)->findRegisterIndex(node.registerPointer()),
            node.registerPointer());
        hasPrinted = true;
    }
    if (node.hasIdentifier()) {
        dataLog("%sid%u{%s}", hasPrinted ? ", " : "", node.identifierNumber(), m_codeBlock->identifier(node.identifierNumber()).ustring().utf8().data());
        hasPrinted = true;
    }
    if (node.hasStructureSet()) {
        for (size_t i = 0; i < node.structureSet().size(); ++i) {
            dataLog("%sstruct(%p)", hasPrinted ? ", " : "", node.structureSet()[i]);
            hasPrinted = true;
        }
    }
    if (node.hasStructure()) {
        dataLog("%sstruct(%p)", hasPrinted ? ", " : "", node.structure());
        hasPrinted = true;
    }
    if (node.hasStructureTransitionData()) {
        dataLog("%sstruct(%p -> %p)", hasPrinted ? ", " : "", node.structureTransitionData().previousStructure, node.structureTransitionData().newStructure);
        hasPrinted = true;
    }
    if (node.hasStorageAccessData()) {
        StorageAccessData& storageAccessData = m_storageAccessData[node.storageAccessDataIndex()];
        dataLog("%sid%u{%s}", hasPrinted ? ", " : "", storageAccessData.identifierNumber, m_codeBlock->identifier(storageAccessData.identifierNumber).ustring().utf8().data());
        
        dataLog(", %lu", static_cast<unsigned long>(storageAccessData.offset));
        hasPrinted = true;
    }
    ASSERT(node.hasVariableAccessData() == node.hasLocal());
    if (node.hasVariableAccessData()) {
        VariableAccessData* variableAccessData = node.variableAccessData();
        int operand = variableAccessData->operand();
        if (operandIsArgument(operand))
            dataLog("%sarg%u(%s)", hasPrinted ? ", " : "", operandToArgument(operand), nameOfVariableAccessData(variableAccessData));
        else
            dataLog("%sr%u(%s)", hasPrinted ? ", " : "", operand, nameOfVariableAccessData(variableAccessData));
        hasPrinted = true;
    }
    if (node.hasConstantBuffer()) {
        if (hasPrinted)
            dataLog(", ");
        dataLog("%u:[", node.startConstant());
        for (unsigned i = 0; i < node.numConstants(); ++i) {
            if (i)
                dataLog(", ");
            dataLog("%s", m_codeBlock->constantBuffer(node.startConstant())[i].description());
        }
        dataLog("]");
        hasPrinted = true;
    }
    if (op == JSConstant) {
        dataLog("%s$%u", hasPrinted ? ", " : "", node.constantNumber());
        JSValue value = valueOfJSConstant(nodeIndex);
        dataLog(" = %s", value.description());
        hasPrinted = true;
    }
    if (op == WeakJSConstant) {
        dataLog("%s%p", hasPrinted ? ", " : "", node.weakConstant());
        hasPrinted = true;
    }
    if  (node.isBranch() || node.isJump()) {
        dataLog("%sT:#%u", hasPrinted ? ", " : "", node.takenBlockIndex());
        hasPrinted = true;
    }
    if  (node.isBranch()) {
        dataLog("%sF:#%u", hasPrinted ? ", " : "", node.notTakenBlockIndex());
        hasPrinted = true;
    }
    dataLog("%sbc#%u", hasPrinted ? ", " : "", node.codeOrigin.bytecodeIndex);
    hasPrinted = true;
    (void)hasPrinted;
    
    dataLog(")");

    if (!skipped) {
        if (node.hasVariableAccessData())
            dataLog("  predicting %s%s", speculationToString(node.variableAccessData()->prediction()), node.variableAccessData()->shouldUseDoubleFormat() ? ", forcing double" : "");
        else if (node.hasHeapPrediction())
            dataLog("  predicting %s", speculationToString(node.getHeapPrediction()));
    }
    
    dataLog("\n");
}
コード例 #14
0
ファイル: channel.cpp プロジェクト: f-list/fserv
json_t* Channel::saveChannel() {
    const time_t now = time(nullptr);
    json_t* ret = json_object();
    json_object_set_new_nocheck(ret, "name",
            json_string_nocheck(name.c_str())
            );
    json_object_set_new_nocheck(ret, "description",
            json_string_nocheck(description.c_str())
            );
    json_object_set_new_nocheck(ret, "mode",
            json_string_nocheck(modeToString().c_str())
            );
    json_object_set_new_nocheck(ret, "owner",
            json_string_nocheck(owner.c_str())
            );
    json_object_set_new_nocheck(ret, "users",
            json_integer(participants.size())
            );
    json_object_set_new_nocheck(ret, "title",
            json_string_nocheck(title.c_str())
            );
    json_object_set_new_nocheck(ret, "top",
            json_integer(topUsers)
            );
    json_object_set_new_nocheck(ret, "type",
            json_string_nocheck(typeToString().c_str())
            );
    {
        json_t* bansnode = json_array();
        for (chbanmap_t::const_iterator i = bans.begin(); i != bans.end(); ++i) {
            BanRecord br = (*i).second;
            if(br.timeout != 0 && br.timeout < now)
                continue;
            json_t* ban = json_object();
            json_object_set_new_nocheck(ban, "name",
                    json_string_nocheck((*i).first.c_str())
                    );
            json_object_set_new_nocheck(ban, "banner",
                    json_string_nocheck(br.banner.c_str())
                    );
            json_object_set_new_nocheck(ban, "timeout",
                    json_integer(br.timeout)
                    );
            json_object_set_new_nocheck(ban, "time",
                    json_integer(br.time)
                    );
            json_array_append_new(bansnode, ban);
        }
        json_object_set_new_nocheck(ret, "banlist", bansnode);
    }
    {
        json_t* mods = json_array();
        for (chmodmap_t::const_iterator i = moderators.begin(); i != moderators.end(); ++i) {
            json_t* mod = json_object();
            ModRecord mr = (*i).second;
            json_object_set_new_nocheck(mod, "name",
                    json_string_nocheck((*i).first.c_str())
                    );
            json_object_set_new_nocheck(mod, "modder",
                    json_string_nocheck(mr.modder.c_str())
                    );
            json_object_set_new_nocheck(mod, "time",
                    json_integer(mr.time)
                    );
            json_array_append_new(mods, mod);
        }
        json_object_set_new_nocheck(ret, "modlist", mods);
    }


    return ret;
}
コード例 #15
0
ファイル: LegacyTransaction.cpp プロジェクト: zte-lhg/webkit
const String& LegacyTransaction::mode() const
{
    return modeToString(m_mode);
}
コード例 #16
0
ファイル: qqnxfilepicker.cpp プロジェクト: CodeDJ/qt5-hidpi
void QQnxFilePicker::open()
{
    if (m_invocationHandle)
        return;

    // Clear any previous results
    m_selectedFiles.clear();

    int errorCode = BPS_SUCCESS;

    errorCode = navigator_invoke_invocation_create(&m_invocationHandle);
    if (errorCode != BPS_SUCCESS) {
        qWarning() << "QQnxFilePicker: unable to create invocation:" << strerror(errno);
        return;
    }

    errorCode = navigator_invoke_invocation_set_target(m_invocationHandle, s_filePickerTarget);

    if (errorCode != BPS_SUCCESS) {
        cleanup();
        qWarning() << "QQnxFilePicker: unable to set target:" << strerror(errno);
        return;
    }

    errorCode = navigator_invoke_invocation_set_action(m_invocationHandle, "bb.action.OPEN");
    if (errorCode != BPS_SUCCESS) {
        cleanup();
        qWarning() << "QQnxFilePicker: unable to set action:" << strerror(errno);
        return;
    }

    errorCode = navigator_invoke_invocation_set_type(m_invocationHandle, "application/vnd.blackberry.file_picker");
    if (errorCode != BPS_SUCCESS) {
        cleanup();
        qWarning() << "QQnxFilePicker: unable to set mime type:" << strerror(errno);
        return;
    }

    QVariantMap map;
    map[QStringLiteral("Type")] = QStringLiteral("Other");
    map[QStringLiteral("Mode")] = modeToString(m_mode);
    map[QStringLiteral("Title")] = m_title;
    map[QStringLiteral("ViewMode")] = QStringLiteral("Default");
    map[QStringLiteral("SortBy")] = QStringLiteral("Default");
    map[QStringLiteral("SortOrder")] = QStringLiteral("Default");
    map[QStringLiteral("ImageCrop")] = false;
    map[QStringLiteral("AllowOverwrite")] = false;

    if (!m_defaultSaveFileNames.isEmpty())
        map[QStringLiteral("DefaultFileNames")] = m_defaultSaveFileNames.join(",");
    if (!m_filters.isEmpty())
        map[QStringLiteral("Filter")] = m_filters.join(";");

    QJsonDocument document;
    document.setObject(QJsonObject::fromVariantMap(map));
    const QByteArray jsonData = document.toJson(QJsonDocument::Compact);

    errorCode = navigator_invoke_invocation_set_data(m_invocationHandle, jsonData.constData(), jsonData.size());
    if (errorCode != BPS_SUCCESS) {
        cleanup();
        qWarning() << "QQnxFilePicker: unable to set data:" << strerror(errno);
        return;
    }

    navigator_invoke_invocation_send(m_invocationHandle);
}
コード例 #17
0
ファイル: Camera.cpp プロジェクト: cozza13/hifi
void Camera::setMode(CameraMode mode) {
    _mode = mode;
    emit modeUpdated(modeToString(mode));
}
コード例 #18
0
ファイル: pin_mode.cpp プロジェクト: PHPDOTSQL/bertha
char* PinMode::toString() {
  return modeToString(get());
}
コード例 #19
0
ファイル: IDBTransaction.cpp プロジェクト: junmin-zhu/blink
const String& IDBTransaction::mode() const
{
    return modeToString(m_mode);
}