BlockPropertiesPanel::BlockPropertiesPanel(GraphBlock *block, QWidget *parent):
    QWidget(parent),
    _ignoreChanges(true),
    _idLabel(new QLabel(this)),
    _idLineEdit(new QLineEdit(this)),
    _affinityZoneLabel(new QLabel(this)),
    _affinityZoneBox(nullptr),
    _blockErrorLabel(new QLabel(this)),
    _updateTimer(new QTimer(this)),
    _formLayout(nullptr),
    _block(block)
{
    auto blockDesc = block->getBlockDesc();

    //master layout for this widget
    auto layout = new QVBoxLayout(this);

    //create a scroller and a form layout
    auto scroll = new QScrollArea(this);
    scroll->setWidgetResizable(true);
    scroll->setWidget(new QWidget(scroll));
    _formLayout = new QFormLayout(scroll);
    scroll->widget()->setLayout(_formLayout);
    layout->addWidget(scroll);

    //title
    {
        auto label = new QLabel(QString("<h1>%1</h1>").arg(_block->getTitle().toHtmlEscaped()), this);
        label->setAlignment(Qt::AlignCenter);
        _formLayout->addRow(label);
    }

    //errors
    {
        _formLayout->addRow(_blockErrorLabel);
    }

    //id
    {
        _idOriginal = _block->getId();
        _formLayout->addRow(_idLabel, _idLineEdit);
        connect(_idLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(handleEditWidgetChanged(const QString &)));
        connect(_idLineEdit, SIGNAL(returnPressed(void)), this, SLOT(handleCommitButton(void)));
    }

    //properties
    for (const auto &prop : _block->getProperties())
    {
        _propIdToOriginal[prop.getKey()] = _block->getPropertyValue(prop.getKey());
        auto paramDesc = _block->getParamDesc(prop.getKey());
        assert(paramDesc);

        //create editable widget
        auto editWidget = new BlockPropertyEditWidget(paramDesc, this);
        connect(editWidget, SIGNAL(valueChanged(void)), this, SLOT(handleEditWidgetChanged(void)));
        connect(editWidget, SIGNAL(commitRequested(void)), this, SLOT(handleCommitButton(void)));
        _propIdToEditWidget[prop.getKey()] = editWidget;

        //create labels
        _propIdToFormLabel[prop.getKey()] = new QLabel(this);
        _propIdToErrorLabel[prop.getKey()] = new QLabel(this);
        editWidget->setToolTip(this->getParamDocString(_block->getParamDesc(prop.getKey())));

        //layout stuff
        auto editLayout = new QVBoxLayout();
        editLayout->addWidget(editWidget);
        editLayout->addWidget(_propIdToErrorLabel[prop.getKey()]);
        _formLayout->addRow(_propIdToFormLabel[prop.getKey()], editLayout);
    }

    //affinity zone
    {
        _affinityZoneOriginal = _block->getAffinityZone();
        auto dock = dynamic_cast<AffinityZonesDock *>(getObjectMap()["affinityZonesDock"]);
        assert(dock != nullptr);
        _affinityZoneBox = dock->makeComboBox(this);
        _formLayout->addRow(_affinityZoneLabel, _affinityZoneBox);
        connect(_affinityZoneBox, SIGNAL(activated(const QString &)), this, SLOT(handleEditWidgetChanged(const QString &)));
    }

    //draw the block's preview onto a mini pixmap
    //this is cool, maybe useful, but its big, where can we put it?
    /*
    {
        const auto bounds = _block->getBoundingRect();
        QPixmap pixmap(bounds.size().toSize()+QSize(2,2));
        pixmap.fill(Qt::transparent);
        QPainter painter(&pixmap);
        painter.translate(-bounds.topLeft()+QPoint(1,1));
        painter.setRenderHint(QPainter::Antialiasing);
        painter.setRenderHint(QPainter::HighQualityAntialiasing);
        painter.setRenderHint(QPainter::SmoothPixmapTransform);
        _block->render(painter);
        painter.end();
        auto label = new QLabel(this);
        label->setPixmap(pixmap);
        _formLayout->addRow(label);
        _formLayout->setAlignment(label, Qt::AlignHCenter);
    }
    */

    //block level description
    if (blockDesc->isArray("docs"))
    {
        QString output;
        output += QString("<h1>%1</h1>").arg(QString::fromStdString(blockDesc->get("name").convert<std::string>()));
        output += QString("<p>%1</p>").arg(QString::fromStdString(block->getBlockDescPath()));
        output += "<p>";
        for (const auto &lineObj : *blockDesc->getArray("docs"))
        {
            const auto line = lineObj.extract<std::string>();
            if (line.empty()) output += "<p /><p>";
            else output += QString::fromStdString(line)+"\n";
        }
        output += "</p>";

        //enumerate properties
        if (not _block->getProperties().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Properties"));
            for (const auto &prop : _block->getProperties())
            {
                output += this->getParamDocString(_block->getParamDesc(prop.getKey()));
            }
        }

        //enumerate slots
        if (not block->getSlotPorts().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Slots"));
            output += "<ul>";
            for (const auto &port : block->getSlotPorts())
            {
                output += QString("<li>%1(...)</li>").arg(port.getName());
            }
            output += "</ul>";
        }

        //enumerate signals
        if (not block->getSignalPorts().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Signals"));
            output += "<ul>";
            for (const auto &port : block->getSignalPorts())
            {
                output += QString("<li>%1(...)</li>").arg(port.getName());
            }
            output += "</ul>";
        }

        auto text = new QLabel(output, this);
        text->setStyleSheet("QLabel{background:white;margin:1px;}");
        text->setWordWrap(true);
        _formLayout->addRow(text);
    }

    //buttons
    {
        auto buttonLayout = new QHBoxLayout();
        layout->addLayout(buttonLayout);
        auto commitButton = new QPushButton(makeIconFromTheme("dialog-ok-apply"), tr("Commit"), this);
        connect(commitButton, SIGNAL(pressed(void)), this, SLOT(handleCommitButton(void)));
        buttonLayout->addWidget(commitButton);
        auto cancelButton = new QPushButton(makeIconFromTheme("dialog-cancel"), tr("Cancel"), this);
        connect(cancelButton, SIGNAL(pressed(void)), this, SLOT(handleCancelButton(void)));
        buttonLayout->addWidget(cancelButton);
    }

    //update timer
    _updateTimer->setSingleShot(true);
    _updateTimer->setInterval(UPDATE_TIMER_MS);
    connect(_updateTimer, SIGNAL(timeout(void)), this, SLOT(handleUpdateTimerExpired(void)));

    //connect state change to the graph editor
    auto draw = dynamic_cast<GraphDraw *>(_block->parent());
    auto editor = draw->getGraphEditor();
    connect(this, SIGNAL(stateChanged(const GraphState &)), editor, SLOT(handleStateChange(const GraphState &)));
    connect(_block, SIGNAL(destroyed(QObject*)), this, SLOT(handleBlockDestroyed(QObject*)));

    this->updateAllForms();
    _ignoreChanges = false;
}
void KateMessageWidget::showNextMessage()
{
  // at this point, we should not have a currently shown message
  Q_ASSERT(m_currentMessage == 0);

  // if not message to show, just stop
  if (m_messageQueue.size() == 0) {
    hide();
    return;
  }

  // track current message
  m_currentMessage = m_messageQueue[0];

  // set text etc.
  m_messageWidget->setText(m_currentMessage->text());
  // KMessageWidget::setIcon() requires KDE >= 4.11
  m_messageWidget->setIcon(m_currentMessage->icon());

  // connect textChanged() and iconChanged(), so it's possible to change this on the fly
  connect(m_currentMessage, SIGNAL(textChanged(const QString&)),
          m_messageWidget, SLOT(setText(const QString&)), Qt::UniqueConnection);
  connect(m_currentMessage, SIGNAL(iconChanged(const QIcon&)),
          m_messageWidget, SLOT(setIcon(const QIcon&)), Qt::UniqueConnection);

  // the enums values do not necessarily match, hence translate with switch
  switch (m_currentMessage->messageType()) {
    case KTextEditor::Message::Positive:
      m_messageWidget->setMessageType(KMessageWidget::Positive);
      break;
    case KTextEditor::Message::Information:
      m_messageWidget->setMessageType(KMessageWidget::Information);
      break;
    case KTextEditor::Message::Warning:
      m_messageWidget->setMessageType(KMessageWidget::Warning);
      break;
    case KTextEditor::Message::Error:
      m_messageWidget->setMessageType(KMessageWidget::Error);
      break;
    default:
      m_messageWidget->setMessageType(KMessageWidget::Information);
      break;
  }

  // remove all actions from the message widget
  foreach (QAction* a, m_messageWidget->actions())
    m_messageWidget->removeAction(a);

  // add new actions to the message widget
  foreach (QAction* a, m_currentMessage->actions())
    m_messageWidget->addAction(a);

  // set word wrap of the message
  setWordWrap(m_currentMessage);

  // setup auto-hide timer, and start if requested
  m_autoHideTime = m_currentMessage->autoHide();
  m_autoHideTimer->stop();
  if (m_autoHideTime >= 0) {
    connect(m_autoHideTimer, SIGNAL(timeout()), m_currentMessage, SLOT(deleteLater()), Qt::UniqueConnection);
    if (m_currentMessage->autoHideMode() == KTextEditor::Message::Immediate) {
      m_autoHideTimer->start(m_autoHideTime == 0 ? s_defaultAutoHideTime : m_autoHideTime);
    }
  }

  // finally show
  show();
  m_animation->show();
}
Exemple #3
0
void WeatherWidget::setText (const QString &text)
{
	setWordWrap (true);
	QLabel::setText (text);
	adjustSize ();
}
        void SettingsMenu::init()
        {
            if (_initialized) return;
            State::init();

            setModal(true);
            setFullscreen(true);

            // background
            auto background = new UI::Image("art/intrface/prefscrn.frm");
            Point backgroundPos = Point((Game::getInstance()->renderer()->size() - background->size()) / 2);
            int backgroundX = backgroundPos.x();
            int backgroundY = backgroundPos.y();
            background->setPosition(backgroundPos);
            addUI(background);

            auto settings = Game::getInstance()->settings();

            // Switches (big)
            auto combatDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+149);
            combatDifficultySwitch->setMaxState(3);
            combatDifficultySwitch->setState(settings->combatDifficulty());
            addUI("combat_difficulty",combatDifficultySwitch);

            auto gameDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+71);
            gameDifficultySwitch->setMaxState(3);
            gameDifficultySwitch->setState(settings->gameDifficulty());
            addUI("game_difficulty",gameDifficultySwitch);

            auto violenceLevelSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+227);
            violenceLevelSwitch->setState(settings->violenceLevel());
            addUI("violence_level",violenceLevelSwitch);

            auto targetHighlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+309);
            targetHighlightSwitch->setMaxState(3);
            targetHighlightSwitch->setState(settings->targetHighlight());
            addUI("target_highlight",targetHighlightSwitch);

            auto combatLooksSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+387);
            combatLooksSwitch->setMaxState(2);
            combatLooksSwitch->setState(settings->combatLooks());
            addUI("combat_looks",combatLooksSwitch);

            // Switches (small)
            auto combatMessagesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74);
            combatMessagesSwitch->setState(settings->combatMessages());
            addUI("combat_messages",combatMessagesSwitch);

            auto combatTauntsSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66);
            combatTauntsSwitch->setState(settings->combatTaunts());
            addUI("combat_taunts",combatTauntsSwitch);

            auto languageFilterSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*2);
            languageFilterSwitch->setState(settings->languageFilter());
            addUI("language_filter",languageFilterSwitch);

            auto runningSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*3);
            runningSwitch->setState(settings->running());
            addUI("running",runningSwitch);

            auto subtitlesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*4);
            subtitlesSwitch->setState(settings->subtitles());
            addUI("subtitles",subtitlesSwitch);

            auto itemHightlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*5);
            itemHightlightSwitch->setState(settings->itemHighlight());
            addUI("item_highlight",itemHightlightSwitch);

            // LABELS
            SDL_Color color = {0x90, 0x78, 0x24, 0xff};

            std::string font1_907824ff = "font1.aaf";
            std::string font3_907824ff = "font3.aaf";
            std::string font4_907824ff = "font4.aaf";

            // GAME PREFERENCES
            _addTextArea(_t(MSG_OPTIONS, 100), backgroundX+74, backgroundY+10)->setFont(font4_907824ff, color);

            // COMBAT DIFFICULTY
            auto difficulty = _addTextArea(_t(MSG_OPTIONS, 101), backgroundX+21, backgroundY+48);
            difficulty->setWidth(158);
            difficulty->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
            difficulty->setFont(font3_907824ff, color);

            // GAME DIFFICULTY
            _addTextArea(difficulty, backgroundX+21, backgroundY+48+77)->setText(_t(MSG_OPTIONS, 102));

            // VIOLENCE LEVEL
            _addTextArea(difficulty, backgroundX+21, backgroundY+48+156)->setText(_t(MSG_OPTIONS, 103));

            // TARGET HIGHLIGHT
            _addTextArea(difficulty, backgroundX+21, backgroundY+128+158)->setText(_t(MSG_OPTIONS, 104));

            // COMBAT LOOKS
            _addTextArea(difficulty, backgroundX+21, backgroundY+128+235)->setText(_t(MSG_OPTIONS, 105));

            // COMBAT MESSAGES
            auto combatMessages = _addTextArea(_t(MSG_OPTIONS, 106), backgroundX+206, backgroundY+49);
            combatMessages->setFont(font3_907824ff, color);

            // COMBAT TAUNTS
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66)->setText(_t(MSG_OPTIONS, 107));

            // LANGUAGE FILTER
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*2)->setText(_t(MSG_OPTIONS, 108));

            // RUNNING
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*3)->setText(_t(MSG_OPTIONS, 109));

            // SUBTITLES
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*4)->setText(_t(MSG_OPTIONS, 110));

            // ITEM HIGHLIGHT
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*5)->setText(_t(MSG_OPTIONS, 111));

            // COMBAT SPEED
            auto combatSpeed = _addTextArea(_t(MSG_OPTIONS, 112), backgroundX+384, backgroundY+19);
            combatSpeed->setFont(font3_907824ff, color);

            // TEXT DELAY
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+95)->setText(_t(MSG_OPTIONS, 113));

            // MASTER AUDIO VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165)->setText(_t(MSG_OPTIONS, 114));

            // MUSIC/MOVIE VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51)->setText(_t(MSG_OPTIONS, 115));

            // SOUND EFFECTS VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*2)->setText(_t(MSG_OPTIONS, 116));

            // SPEECH VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*3)->setText(_t(MSG_OPTIONS, 117));

            // BRIGHTNESS LEVEL
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*4)->setText(_t(MSG_OPTIONS, 118));

            // MOUSE SENSITIVITY
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*5)->setText(_t(MSG_OPTIONS, 119));

            // DEFAULT BUTTON LABEL
            auto label = _addTextArea(combatSpeed, backgroundX+43, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 120));
            label->setFont(font3_907824ff, color);

            // DONE BUTTON LABEL
            label = _addTextArea(combatSpeed, backgroundX+169, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 300));
            label->setFont(font3_907824ff, color);

            // CANCEL BUTTON LABEL
            label = _addTextArea(combatSpeed, backgroundX+283, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 121));
            label->setFont(font3_907824ff, color);

            // COMBAT DIFFICULTY SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 203), backgroundX+50, backgroundY+81)->setFont(font1_907824ff, color);     // EASY
            _addTextArea(_t(MSG_OPTIONS, 204), backgroundX+81, backgroundY+67)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 205), backgroundX+122, backgroundY+81)->setFont(font1_907824ff, color);    // HARD

            // GAME DIFFICULTY SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 206), backgroundX+45, backgroundY+159)->setFont(font1_907824ff, color);    // WIMPY
            _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+83, backgroundY+145)->setFont(font1_907824ff, color);    // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 208), backgroundX+122, backgroundY+159)->setFont(font1_907824ff, color);   // ROUGH

            // VIOLENCE LEVEL SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 214), backgroundX+48, backgroundY+236)->setFont(font1_907824ff, color);    // NONE
            _addTextArea(_t(MSG_OPTIONS, 215), backgroundX+83, backgroundY+222)->setFont(font1_907824ff, color);    // MINIMUM
            _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+122, backgroundY+236)->setFont(font1_907824ff, color);   // NORMAL
            label = _addTextArea(_t(MSG_OPTIONS, 216).insert(8, " "), backgroundX+122, backgroundY+257);
            label->setFont(font1_907824ff, color);
            label->setWidth(50);
            label->setWordWrap(true); // MAXIMUM BLOOD

            // TARGET HIGHLIGHT SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+319)->setFont(font1_907824ff, color);    // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+305)->setFont(font1_907824ff, color);    // ON
            label = _addTextArea(_t(MSG_OPTIONS, 213).insert(10, " "), backgroundX+122, backgroundY+319);
            label->setFont(font1_907824ff, color);
            label->setWidth(60);
            label->setWordWrap(true); // TARGETING ONLY

            // COMBAT LOOKS SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+397)->setFont(font1_907824ff, color);    // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+383)->setFont(font1_907824ff, color);    // ON

            // COMBAT MESSAGES SWITCH LABELS
            auto verboseLabel = _addTextArea(_t(MSG_OPTIONS, 211), backgroundX+203, backgroundY+69);         // VERBOSE
            verboseLabel->setFont(font1_907824ff, color);
            verboseLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT);
            verboseLabel->setWidth(100);
            _addTextArea(_t(MSG_OPTIONS, 212), backgroundX+320, backgroundY+69)->setFont(font1_907824ff, color);    // BRIEF

            // COMBAT TAUNTS SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67)->setFont(font1_907824ff, color); // ON

            // LANGUAGE FILTER SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67+66)->setFont(font1_907824ff, color); // ON

            // RUNNING SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64)->setText(_t(MSG_OPTIONS, 209)); // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 219), backgroundX+320, backgroundY+69+67+66+64)->setFont(font1_907824ff, color); // ALWAYS

            // SUBTITLES SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+66+65)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+66+67+66+65)->setFont(font1_907824ff, color); // OFF

            // ITEM HIGHLIGHT SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64+65+68)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+64+67+66+65+68)->setFont(font1_907824ff, color); // ON

            // AFFECT PLAYER SPEECH
            _addTextArea(_t(MSG_OPTIONS, 122), backgroundX+405, backgroundY+72)->setFont(font1_907824ff, color);

            // COMBAT SPEED SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+38)->setFont(font1_907824ff, color);      // NORMAL
            auto fastestLabel = _addTextArea(_t(MSG_OPTIONS, 210), backgroundX+524, backgroundY+38);           // FASTEST
            fastestLabel->setFont(font1_907824ff, color);
            fastestLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT);
            fastestLabel->setWidth(100);

            // TEXT DELAY SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 217), backgroundX+384, backgroundY+113)->setFont(font1_907824ff, color);     // SLOW
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+484, backgroundY+113)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+113)->setText(_t(MSG_OPTIONS, 218));       // FASTER

            // MASTER AUDIO VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184)->setFont(font1_907824ff, color);     // OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184)->setFont(font1_907824ff, color);     // QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184)->setText(_t(MSG_OPTIONS, 222));       // LOUD

            // MUSIC/MOVIE VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51)->setFont(font1_907824ff, color);  // OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51)->setFont(font1_907824ff, color);  // QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51)->setFont(font1_907824ff, color);  // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51)->setText(_t(MSG_OPTIONS, 222));    // LOUD

            // SOUND EFFECTS SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*2)->setFont(font1_907824ff, color);// OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*2)->setFont(font1_907824ff, color);// QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*2)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*2)->setText(_t(MSG_OPTIONS, 222));  // LOUD

            // SPEECH VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*3)->setFont(font1_907824ff, color);// OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*3)->setFont(font1_907824ff, color);// QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*3)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*3)->setText(_t(MSG_OPTIONS, 222));  // LOUD

            // BRIGHTNESS LEVEL SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*4)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*4)->setText(_t(MSG_OPTIONS, 223));  // BRIGHTER

            // MOUSE SENSITIVITY SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*5)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*5)->setText(_t(MSG_OPTIONS, 218));  // FASTER

            // BUTTONS

            // button: Default
            auto defaultButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+23, backgroundY+450);
            defaultButton->mouseClickHandler().add(std::bind(&SettingsMenu::onDefaultButtonClick, this, std::placeholders::_1));
            addUI(defaultButton);

            // button: Done
            auto doneButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+148, backgroundY+450);
            doneButton->mouseClickHandler().add([this](Event::Event* event){ this->doSave(); });
            addUI(doneButton);

            // button: Cancel
            auto cancelButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+263, backgroundY+450);
            cancelButton->mouseClickHandler().add([this](Event::Event* event){ this->doCancel(); });
            addUI(cancelButton);

            // button: Affect player speed
            auto affectPlayerSpeedCheckBox = new UI::ImageButton(UI::ImageButton::Type::CHECKBOX, backgroundX+383, backgroundY+68);
            affectPlayerSpeedCheckBox->setChecked(settings->playerSpeedup());
            addUI("player_speedup", affectPlayerSpeedCheckBox);

            // SLIDERS
            // COMBAT SPEED SLIDER
            auto combatSpeedSlider = new UI::Slider(backgroundX+384, backgroundY+50);
            combatSpeedSlider->setMinValue(0.0);
            combatSpeedSlider->setMaxValue(50.0);
            combatSpeedSlider->setValue(settings->combatSpeed());
            addUI("combat_speed",combatSpeedSlider);

            // TEXT DELAY SLIDER
            auto textDelaySlider = new UI::Slider(backgroundX+384, backgroundY+125);
            textDelaySlider->setValue(settings->textDelay());
            addUI("text_delay",textDelaySlider);

            // MASTER AUDIO VOLUME SLIDER
            auto masterAudioVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196);
            masterAudioVolumeSlider->setValue(settings->masterVolume());
            addUI("master_volume", masterAudioVolumeSlider);

            // MUSIC VOLUME SLIDER
            auto musicVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51);
            musicVolumeSlider->setValue(settings->musicVolume());
            addUI("music_volume", musicVolumeSlider);
            musicVolumeSlider->changeHandler().add([=](Event::Event* evt)
            {
                Game::getInstance()->mixer()->setMusicVolume(musicVolumeSlider->value());
            });

            // SOUND EFFECTS VOLUME SLIDER
            auto soundEffectsVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*2);
            soundEffectsVolumeSlider->setValue(settings->sfxVolume());
            addUI("sfx_volume", soundEffectsVolumeSlider);

            // SPEECH VOLUME SLIDER
            auto speechVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*3);
            speechVolumeSlider->setValue(settings->voiceVolume());
            addUI("voice_volume", speechVolumeSlider);

            // BRIGHTNESS LEVEL SLIDER
            auto brightnessLevelSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*4);
            brightnessLevelSlider->setValue(settings->brightness());
            addUI("brightness", brightnessLevelSlider);

            // MOUSE SENSITIVITY SLIDER
            auto mouseSensitivitySlider = new UI::Slider(backgroundX+384, backgroundY+196+51*5);
            mouseSensitivitySlider->setValue(settings->mouseSensitivity());
            addUI("mouse_sensitivity",mouseSensitivitySlider);
        }
//---------------------------------------------------------------------------
// Singu Note: We could clean a lot of this up by creating derived classes for Notifications and NotificationTips.
LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
	:	LLPanel(notification->getName(), LLRect(), BORDER_NO),
		LLEventTimer(notification->getExpiration() == LLDate() 
			? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) 
			: notification->getExpiration()),
		LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()),
	  mNotification(notification),
	  mIsTip(notification->getType() == "notifytip"),
	  mAnimating(gNotifyBoxView->getChildCount() == 0), // Only animate first window
	  mNextBtn(NULL),
	  mNumOptions(0),
	  mNumButtons(0),
	  mAddedDefaultBtn(false),
	  mUserInputBox(NULL)
{
	std::string edit_text_name;
	std::string edit_text_contents;

	// setup paramaters
	const std::string& message(notification->getMessage());

	// initialize
	setFocusRoot(!mIsTip);

	// caution flag can be set explicitly by specifying it in the
	// notification payload, or it can be set implicitly if the
	// notify xml template specifies that it is a caution
	//
	// tip-style notification handle 'caution' differently -
	// they display the tip in a different color
	mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;

	LLNotificationFormPtr form(notification->getForm());

	mNumOptions = form->getNumElements();
		  
	bool is_textbox = form->getElement("message").isDefined();

	bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup");
	LLRect rect = mIsTip ? getNotifyTipRect(message)
		   		  		 : getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution);
	if ((form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE || form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE))
		rect.mBottom -= BTN_HEIGHT;
	setRect(rect);
	setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT));
	setBackgroundVisible(FALSE);
	setBackgroundOpaque(TRUE);

	const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32);
	const S32 BOTTOM = (S32)sFont->getLineHeight();
	S32 x = HPAD + HPAD;
	S32 y = TOP;

	auto icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), mIsTip ? "notify_tip_icon.tga" : mIsCaution ? "notify_caution_icon.tga" : "notify_box_icon.tga");

	icon->setMouseOpaque(FALSE);
	addChild(icon);

	x += HPAD + HPAD + 32;

	// add a caution textbox at the top of a caution notification
	if (mIsCaution && !mIsTip)
	{
		S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD;
		auto caution_box = new LLTextBox(
			std::string("caution_box"), 
			LLRect(x, y, getRect().getWidth() - 2, caution_height), 
			LLStringUtil::null, 
			sFont, 
			FALSE);

		caution_box->setFontStyle(LLFontGL::BOLD);
		caution_box->setColor(gColors.getColor("NotifyCautionWarnColor"));
		caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor"));
		caution_box->setBorderVisible(FALSE);
		caution_box->setWrappedText(notification->getMessage());
		
		addChild(caution_box);

		// adjust the vertical position of the next control so that 
		// it appears below the caution textbox
		y = y - caution_height;
	}
	else
	{
		const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD);

		// Tokenization on \n is handled by LLTextBox

		const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE;  // For script dialogs: add space for title.

		auto text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, LLStringUtil::null, sFont, FALSE, true);
		text->setWordWrap(TRUE);
		text->setMouseOpaque(TRUE);
		text->setBorderVisible(FALSE);
		text->setTakesNonScrollClicks(TRUE);
		text->setHideScrollbarForShortDocs(TRUE);
		text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually 
															// rendered under the text box, therefore we want 
															// the actual text box to be transparent

		auto text_color = gColors.getColor(mIsCaution && mIsTip ? "NotifyCautionWarnColor" : "NotifyTextColor");
		text->setReadOnlyFgColor(text_color); //sets caution text color for tip notifications
		if (!mIsCaution) // We could do some extra color math here to determine if bg's too close to link color, but let's just cross with the link color instead
			text->setLinkColor(new LLColor4(lerp(text_color, gSavedSettings.getColor4("HTMLLinkColor"), 0.4f)));
		text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard)
		text->appendText(message,false,false,nullptr,!layout_script_dialog); // Now we can set the text, since colors have been set.
		addChild(text);
	}

	if (mIsTip)
	{
		chat_notification(mNotification);
	}
	else
	{
		mNextBtn = new LLButton(std::string("next"),
						   LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD),
						   std::string("notify_next.png"),
						   std::string("notify_next.png"),
						   LLStringUtil::null,
						   boost::bind(&LLNotifyBox::moveToBack, this, true),
						   sFont);
		mNextBtn->setScaleImage(TRUE);
		mNextBtn->setToolTip(LLTrans::getString("next"));
		addChild(mNextBtn);

		for (S32 i = 0; i < mNumOptions; i++)
		{
			LLSD form_element = form->getElement(i);
			std::string element_type = form_element["type"].asString();
			if (element_type == "button") 
			{
				addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean(), layout_script_dialog);
			}
			else if (element_type == "input") 
			{
				edit_text_contents = form_element["value"].asString();
				edit_text_name = form_element["name"].asString();
			}
		}

		if (is_textbox)
		{
			S32 button_rows = layout_script_dialog ? 2 : 1;

			LLRect input_rect;
			input_rect.setOriginAndSize(x, BOTTOM_PAD + button_rows * (BTN_HEIGHT + VPAD),
										3 * 80 + 4 * HPAD, button_rows * (BTN_HEIGHT + VPAD) + BTN_HEIGHT);

			mUserInputBox = new LLTextEditor(edit_text_name, input_rect, 254,
											 edit_text_contents, sFont, FALSE);
			mUserInputBox->setBorderVisible(TRUE);
			mUserInputBox->setTakesNonScrollClicks(TRUE);
			mUserInputBox->setHideScrollbarForShortDocs(TRUE);
			mUserInputBox->setWordWrap(TRUE);
			mUserInputBox->setTabsToNextField(FALSE);
			mUserInputBox->setCommitOnFocusLost(FALSE);
			mUserInputBox->setAcceptCallingCardNames(FALSE);
			mUserInputBox->setHandleEditKeysDirectly(TRUE);

			addChild(mUserInputBox, -1);
		}
		else
		{
			setIsChrome(TRUE);
		}

		if (mNumButtons == 0)
		{
			addButton("OK", "OK", false, true, layout_script_dialog);
			mAddedDefaultBtn = true;
		}

		std::string check_title;
		if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE)
		{
			check_title = LLNotificationTemplates::instance().getGlobalString("skipnexttime");
		}
		else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
		{
			check_title = LLNotificationTemplates::instance().getGlobalString("alwayschoose");
		}
		if (!check_title.empty())
		{
			const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF);
			S32 line_height = llfloor(font->getLineHeight() + 0.99f);

			// Extend dialog for "check next time"
			S32 max_msg_width = getRect().getWidth() - HPAD * 9;
			S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
			max_msg_width = llmax(max_msg_width, check_width);

			S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;

			LLRect check_rect;
			check_rect.setOriginAndSize(msg_x, BOTTOM_PAD + BTN_HEIGHT + VPAD*2 + (BTN_HEIGHT + VPAD) * (mNumButtons / 3),
				max_msg_width, line_height);

			LLCheckboxCtrl* check = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font,
				// Lambda abuse.
				[this](LLUICtrl* ctrl, const LLSD& param)
				{
						this->mNotification->setIgnored(ctrl->getValue());
				});
			check->setEnabledColor(LLUI::sColorsGroup->getColor(mIsCaution ? "AlertCautionTextColor" : "AlertTextColor"));
			if (mIsCaution)
			{
				check->setButtonColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor"));
			}
			addChild(check);
		}
		
		if (++sNotifyBoxCount <= 0)
			LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL;
		// If this is the only notify box, don't show the next button
		else if (sNotifyBoxCount == 1 && mNextBtn)
			mNextBtn->setVisible(false);
	}
}
Exemple #6
0
void CustomLabel::processText() {
    //this should somehow reflect the size of a possible parent widget and therefore react on resize events
    if (text().length() > 20 && !disallowWordwrap_)
        setWordWrap(true);
}
void Opcode810AHandler::_run()
{
    Logger::debug("SCRIPT") << "[810A] [=] void float_msg(object who, string msg, int type) " << std::endl;
    int type = _vm->dataStack()->popInteger();
    unsigned int color;
    switch (type)
    {
        case -2:
            // CAPITAL RED LETTERS  FF 00 00
            color = 0xff0000ff;
            break;
        case -1:
            // Self-rotating colors @todo
            color = 0xff0000ff; // temporary taken from -2
            break;
        case 0:
        case 8:
        case 13:
            color = 0xffff7fff;
            break;
        case 1:
        case 5:
        case 10:
            color = 0x555555ff;
            break;
        case 2:
            color = 0xff0000ff;
            break;
        case 3:
            color = 0x3cfb00ff;
            break;
        case 4:
            color = 0x30598eff;
            break;
        case 6:
            color = 0xa2a2a2ff;
            break;
        case 7:
            color = 0xff4949ff;
            break;
        case 9:
            color = 0xffffffff;
            break;
        case 11:
            color = 0x3c3c3cff;
            break;
        case 12:
            color = 0x757575ff;
            break;
        default:
            _error("float_msg - wrong type: " + std::to_string(type));
    }

    auto string = _vm->dataStack()->popString();
    auto object = _vm->dataStack()->popObject();

    auto floatMessage = new TextArea(string);
    floatMessage->setWidth(200);
    floatMessage->setWordWrap(true);
    floatMessage->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_CENTER);
    floatMessage->setFont(ResourceManager::font("font1.aaf", color));
    object->setFloatMessage(floatMessage);

}
SignatureWidget::SignatureWidget( const DigiDocSignature &signature, unsigned int signnum, QWidget *parent )
:	QLabel( parent )
,	num( signnum )
,	s( signature )
{
	setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
	setWordWrap( true );
	const SslCertificate cert = s.cert();
	QString content;
	QTextStream st( &content );

	if( cert.isTempel() )
		st << "<img src=\":/images/ico_stamp_blue_16.png\">";
	else
		st << "<img src=\":/images/ico_person_blue_16.png\">";
	st << "<b>" << Qt::escape( cert.toString( cert.showCN() ? "CN" : "GN SN" ) ) << "</b>";

	QString tooltip;
	QTextStream t( &tooltip );
	QDateTime date = s.dateTime();
	if( !s.location().isEmpty() )
	{
		st << "<br />" << Qt::escape( s.location() );
		t << Qt::escape( s.location() ) << "<br />";
	}
	if( !s.role().isEmpty() )
	{
		st << "<br />" << Qt::escape( s.role() );
		t << Qt::escape( s.role() ) << "<br />";
	}
	if( !date.isNull() )
	{
		st << "<br />" << tr("Signed on") << " "
			<< SslCertificate::formatDate( date, "dd. MMMM yyyy" ) << " "
			<< tr("time") << " "
			<< date.toString( "hh:mm" );
		t << tr("Signed on") << " "
			<< SslCertificate::formatDate( date, "dd. MMMM yyyy" ) << " "
			<< tr("time") << " "
			<< date.toString( "hh:mm" );
	}
	setToolTip( tooltip );

	st << "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>";
	st << "<td>" << tr("Signature is") << " ";
	switch( s.validate() )
	{
	case DigiDocSignature::Valid: st << "<font color=\"green\">" << tr("valid"); break;
	case DigiDocSignature::Invalid: st << "<font color=\"red\">" << tr("not valid"); break;
	case DigiDocSignature::Unknown: st << "<font color=\"red\">" << tr("unknown"); break;
	}
	if( signature.isTest() )
		st << " (" << tr("Test signature") << ")";
	st << "</font>";
	st << "</td><td align=\"right\">";
	st << "<a href=\"details\">" << tr("Show details") << "</a>";
	st << "</td></tr><tr><td></td>";
	st << "<td align=\"right\">";
	st << "<a href=\"remove\">" << tr("Remove") << "</a>";
	st << "</td></tr></table>";

	setText( content );

	connect( this, SIGNAL(linkActivated(QString)), SLOT(link(QString)) );
}
void Inventory::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(false);

    auto game = Game::getInstance();
    auto panelHeight = Game::getInstance()->locationState()->playerPanelState()->height();

    setX((game->renderer()->width()  - 499)/2); // 499x377 = art/intrface/invbox.frm
    setY((game->renderer()->height() - 377 - panelHeight)/2);

    addUI("background", new Image("art/intrface/invbox.frm"));
    getActiveUI("background")->addEventHandler("mouserightclick", [this](Event* event){ this->backgroundRightClick(dynamic_cast<MouseEvent*>(event)); });

    addUI("button_up",   new ImageButton(ImageButton::TYPE_INVENTORY_UP_ARROW,   128, 40));
    addUI("button_down", new ImageButton(ImageButton::TYPE_INVENTORY_DOWN_ARROW, 128, 65));

    addUI("button_done", new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, 438, 328));
    getActiveUI("button_done")->addEventHandler("mouseleftclick", [this](Event* event){ this->onDoneButtonClick(dynamic_cast<MouseEvent*>(event)); });

    // screen
    auto screenX = 300;
    auto screenY = 47;

    auto player = Game::getInstance()->player();

    addUI("player_name", new TextArea(player->name(), screenX, screenY));

    auto line1 = new Image(142, 1);
    line1->setX(screenX);
    line1->setY(screenY+16);
    line1->texture()->fill(0x3ff800ff); // default green color

    std::string statsLabels;
    for (unsigned int i = 0; i != 7; ++i) statsLabels += _t(MSG_INVENTORY, i) + "\n";
    addUI("label_stats", new TextArea(statsLabels, screenX, screenY + 10*2));

    std::string statsValues;
    for (unsigned int i = 0; i != 7; ++i) statsValues += std::to_string(player->stat(i)) + "\n";
    addUI("label_stats_values", new TextArea(statsValues, screenX + 22, screenY + 20));

    std::stringstream ss;
    for (unsigned int i=7; i<14; i++)
    {
        ss << _t(MSG_INVENTORY, i) << "\n";
    }
    auto textLabel = new TextArea(ss.str(), screenX+40, screenY+20);

    // label: hit points
    ss.str("");
    ss << player->hitPoints();
    ss << "/";
    ss << player->hitPointsMax();
    auto hitPointsLabel = new TextArea(ss.str(), screenX+94, screenY+20);
    hitPointsLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    // label: armor class
    ss.str("");
    ss << player->armorClass();
    auto armorClassLabel = new TextArea(ss.str(), screenX+94, screenY+30);
    armorClassLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // armorSlot, leftHand, rightHand
    Game::GameArmorItemObject* armorSlot = player->armorSlot();
    Game::GameItemObject* leftHand = player->leftHandSlot();
    Game::GameItemObject* rightHand = player->rightHandSlot();


    // label: damage treshold levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_LASER) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_FIRE) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageThreshold(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"/";
    }
    else
    {
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(Game::GameCritterObject::DAMAGE_EXPLOSION) <<"/";
    }
    auto damageThresholdLabel = new TextArea(ss.str(), screenX+94, screenY+40);
    damageThresholdLabel->setWidth(26)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // label: damage resistance levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_LASER) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_FIRE) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageResist(Game::GameArmorItemObject::DAMAGE_NORMAL) <<"%";
    }
    else
    {
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(Game::GameCritterObject::DAMAGE_EXPLOSION) <<"%";
    }
    auto damageResistanceLabel = new TextArea(ss.str(), screenX+120, screenY+40);

    auto line2 = new Image(142, 1);
    line2->setX(screenX);
    line2->setY(screenY+94);
    line2->texture()->fill(0x3ff800ff); // default green color

    auto line3 = new Image(142, 1);
    line3->setX(screenX);
    line3->setY(screenY+134);
    line3->texture()->fill(0x3ff800ff); // default green color

    // label: Total Wt: (20)
    auto weight = player->carryWeight();
    auto weightMax = player->carryWeightMax();

    ss.str("");
    ss << weight;
    auto totalWtLabel = new TextArea(_t(MSG_INVENTORY, 20), screenX+14, screenY+180);
    auto weightLabel = new TextArea(ss.str(), screenX+70, screenY+180);
    weightLabel->setWidth(24)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    ss.str("");
    ss << "/" << weightMax;
    auto weightMaxLabel = new TextArea(ss.str(), screenX+94, screenY+180);
    if (weight>weightMax)
    {
        weightLabel->setFont(ResourceManager::font("font1.aaf", 0xff0000ff));
    }

    // label: left hand
    ss.str("");
    if (leftHand)
    {
        ss << _handItemSummary(leftHand);
    }
    auto leftHandLabel = new TextArea(ss.str(), screenX, screenY+100);

    // label: right hand
    ss.str("");
    if (rightHand)
    {
        ss << _handItemSummary(rightHand);
    }
    auto rightHandLabel = new TextArea(ss.str(), screenX, screenY+140);

    // screen info
    auto screenLabel = new TextArea("", screenX, screenY+20);
    screenLabel->setWidth(140); //screen size
    screenLabel->setHeight(168);
    screenLabel->setVisible(false);
    screenLabel->setWordWrap(true);


    addUI(line1);
    addUI("textLabel", textLabel);
    addUI("hitPointsLabel", hitPointsLabel);
    addUI("armorClassLabel", armorClassLabel);
    addUI("damageThresholdLabel", damageThresholdLabel);
    addUI("damageResistanceLabel", damageResistanceLabel);
    addUI("line2", line2);
    addUI("line3", line3);
    addUI("totalWtLabel", totalWtLabel);
    addUI("weightLabel", weightLabel);
    addUI("weightMaxLabel", weightMaxLabel);
    addUI("leftHandLabel", leftHandLabel);
    addUI("rightHandLabel", rightHandLabel);
    addUI("screenLabel", screenLabel);

    auto inventoryList = new ItemsList(40, 40);
    inventoryList->setItems(game->player()->inventory());
    addUI(inventoryList);

    // BIG ICONS
    // icon: armor
    if (armorSlot)
    {
        auto inventoryItem = new InventoryItem(armorSlot, 154, 183);
        inventoryItem->setType(InventoryItem::TYPE_SLOT);
        inventoryItem->addEventHandler("itemdragstop", [inventoryList](Event* event){ inventoryList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); });
        inventoryList->addEventHandler("itemdragstop", [inventoryItem](Event* event){ inventoryItem->onArmorDragStop(dynamic_cast<MouseEvent*>(event)); });
        addUI(inventoryItem);
    }

    // icon: left hand
    if (leftHand)
    {
        auto inventoryItem = new InventoryItem(leftHand, 154, 286);
        inventoryItem->setType(InventoryItem::TYPE_SLOT);
        inventoryItem->addEventHandler("itemdragstop", [inventoryList](Event* event){ inventoryList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); });
        inventoryList->addEventHandler("itemdragstop", [inventoryItem](Event* event){ inventoryItem->onHandDragStop(dynamic_cast<MouseEvent*>(event)); });
        addUI(inventoryItem);
    }

    // icon: right hand
    if (rightHand)
    {
        auto inventoryItem = new InventoryItem(rightHand, 247, 286);
        inventoryItem->setType(InventoryItem::TYPE_SLOT);
        inventoryItem->addEventHandler("itemdragstop", [inventoryList](Event* event){ inventoryList->onItemDragStop(dynamic_cast<MouseEvent*>(event)); });
        inventoryList->addEventHandler("itemdragstop", [inventoryItem](Event* event){ inventoryItem->onHandDragStop(dynamic_cast<MouseEvent*>(event)); });
        addUI(inventoryItem);
    }

}
Exemple #10
0
AboutDialog::AboutDialog(QWidget* parent)
    : QDialog(parent)
{
#if defined(Q_OS_WIN)
    resize(530, 620);
    setMinimumSize(530, 620);
#elif defined(Q_OS_MAC)
    resize(660, 690);
    setMinimumSize(660, 690);
#endif

    setWindowModality(Qt::WindowModal);
    QString titleText = tr("About %1").arg(Defs::APP_NAME);
    setWindowTitle(titleText);
    WidgetUtils::removeContextHelpButton(this);

    auto introduction = new QLabel;
    introduction->setText(
        tr("<h2>%1<sup>&reg;</sup> version %2 %3</h2>"
           "<h6>Built on %4 at %5<br />With %7<br /></h6>"
           ).arg(Defs::APP_NAME)
            .arg(Defs::APP_VERSION_STR)
            .arg(Defs::APP_STAGE_STR)
            .arg(QStringLiteral(__DATE__))
            .arg(QStringLiteral(__TIME__))
        #if defined(Q_OS_WIN)
            .arg(Defs::WIN_COMPILER)
        #elif defined(Q_OS_MAC)
            .arg(Defs::MAC_COMPILER)
        #endif
        );
    auto icon = new QLabel;
    auto app_logo_2x = QPixmap(QStringLiteral(":/icons/app-logo-about"));
#if defined(Q_OS_MAC)
    app_logo_2x.setDevicePixelRatio(2.0);
#endif
    icon->setPixmap(app_logo_2x);

    // About information
    auto infoWidget = new QWidget;
    auto infoLabel = new QLabel;
    infoLabel-> setText(
        tr("<br />%1 is an open source software application that is developed, "
           "maintained, supported by LI-COR Biosciences. It originates from "
           "ECO2S, the Eddy COvariance COmmunity Software project, which was "
           "developed as part of the IMECC-EU research project.</p>"
           "<p>We gratefully acknowledge the IMECC consortium, the ECO2S "
           "development team, the University of Tuscia (Italy) and scientists "
           "around the world who assisted with development and testing of the "
           "original version of this software."
           "<p>Copyright &copy; 2011-%2 LI-COR Inc.</p>"
           "<div>Contact LI-COR Inc.:</div><br />"
           "<div style=\"text-indent: 20px;\">4647 Superior Street</div>"
           "<div style=\"text-indent: 20px;\">P.O. Box 4000</div>"
           "<div style=\"text-indent: 20px;\">Lincoln, Nebraska, 68504, USA</div><br />"
           "<div style=\"text-indent: 20px;\">Phone: 1-402-467-3576</div>"
           "<div style=\"text-indent: 20px;\">Toll Free: 800-447-3576</div>"
           "<div style=\"text-indent: 20px;\">Fax: 1-402-467-2819</div>"
           "<div style=\"text-indent: 20px;\">Email: <a href=\"mailto:[email protected]?subject=EddyPro %3\">[email protected]</a></div>"
           "<div style=\"text-indent: 20px;\">Website: <a href=\"http://www.licor.com\">http://www.licor.com</a></div>"
           ).arg(Defs::APP_NAME).arg(Defs::CURRENT_COPYRIGHT_YEAR).arg(Defs::APP_VERSION_STR)
        );
    infoLabel->setOpenExternalLinks(true);
    infoLabel->setWordWrap(true);

    auto infoLayout = new QVBoxLayout;
    infoLayout->addWidget(infoLabel);
    infoLayout->addStretch();
    infoWidget->setLayout(infoLayout);

    // Thanks
    auto thanksWidget = new QWidget;
    auto thanksLabel = new QLabel;
    thanksLabel->setText(
        tr("<br />We would like to thank the whole "
            "Eddy Covariance community, the authors, testers, the users and the "
            "following people (and the missing ones), in no special "
            "order, for their collaboration and source code contribution "
            "to create this free software." ));
    thanksLabel->setWordWrap(true);

    auto thanksEdit = new QTextEdit;
    thanksEdit->setText(
        tr("<h4>Original Authors</h4>"
           "<ul type=\"square\">"
           "<li>Gerardo Fratini ([email protected]): processing engines designer and developer</li>"
           "<li>Antonio Forgione ([email protected]): GUI designer and developer</li>"
           "<li>Dario Papale ([email protected]): project manager and coordinator</li>"
           "</ul>"

           "<h4>Others contributors</h4>"
           "<ul type=\"square\">"
           "<li>Carlo Trotta: code harmonization and documentation</li>"
           "<li>Natascha Kljun: code for footprint estimation, Kljun et al. (2004, BLM)</li>"
           "<li>Taro Nakai: code for angle of attack correction, Nakai et al. (2006, AFM)</li>"
           "<li>Andreas Ibrom: supervision during implementation of a spectral correction procedure, Ibrom et al. (2007, AFM)</li>"
           "<li>Stephen Chan: Revision, refinement and testing of implementation of Massman 2000/2001 spectral correction.</li>"
           "</ul>"

           "<h4>Software validation (intercomparison)</h4>"
           "<ul type=\"square\">"
           "<li>Juha-Pekka Tuovinen</li>"
           "<li>Andreas Ibrom</li>"
           "<li>Ivan Mammarella</li>"
           "<li>Robert Clement</li>"
           "<li>Meelis Molder</li>"
           "<li>Olaf Kolle</li>"
           "<li>Corinna Rebmann</li>"
           "<li>Matthias Mauder</li>"
           "<li>Jan Elbers</li>"
           "</ul>"

           "<h4>User testing and bug notifications</h4>"
           "<ul type=\"square\">"
           "<li>Tarek El-Madany</li>"
           "<li>Sergiy Medinets</li>"
           "<li>Beniamino Gioli</li>"
           "<li>Nicola Arriga</li>"
           "<li>Luca Belelli</li>"
           "<li>Michal Heliasz</li>"
           "<li>Bernard Heinesch</li>"
           "<li>Arnaud Carrara</li>"
           "<li>Patrik Vestin</li>"
           "<li>Matthias Barthel</li>"
           "<li>Karoline Wischnewski</li>"
           "<li>Matthew Wilkinson</li>"
           "<li>Simone Sabbatini</li>"
           "</ul>"

           "<h4>Software discussions</h4>"
           "<ul type=\"square\">"
           "<li>Ian Elbers</li>"
           "<li>George Burba</li>"
           "<li>Christian Wille</li>"
           "</ul>"

           "<h4>Libraries</h4>"
           "<ul type=\"square\">"
           "<li>Arjan van Dijk: libdate module</li>"
           "<li>Michael Baudin, Arjen Markus: m_logging module</li>"
           "<li>University of Chicago: m_levenberg_marquardt from the MINPACK package</li>"
           "<li>netlib.org: FFT routines from the SLATEC Common Mathematical Library</li>"
           "<li>The Qt Company: Qt framework</li>"
           "<li>Boost::math</li>"
           "<li>Trenton Schulz (Trolltech AS): Fader widget</li>"
           "<li>Morgan Leborgne: QProgressIndicator widget</li>"
           "<li>Witold Wysota: Debug helper class</li>"
           "<li>Sergey A. Tachenov: QuaZIP</li>"
           "<li>Mark Summerfield: classes from the book 'Advanced Qt Programming'</li>"
           "</ul>"

           "<h4>Tools</h4>"
           "<ul type=\"square\">"
           "<li>GFortran compiler</li>"
           "<li>MinGW compiler and GDB debugger</li>"
           "<li>Clang compiler</li>"
           "<li>The Qt Company: Qt Creator IDE</li>"
           "<li>Code::Blocks IDE</li>"
           "<li>\n</li>"
           "</ul>"));
    thanksEdit->setReadOnly(true);

    auto thanksLayout = new QVBoxLayout;
    thanksLayout->addWidget(thanksLabel);
    thanksLayout->addWidget(thanksEdit);
    thanksWidget->setLayout(thanksLayout);

    // License
    auto licenseWidget = new QWidget;
    auto licenseLabel = new QLabel;
    licenseLabel->setText(
        tr("<br />The %1 software application is Copyright &copy; 2011-%2 "
           "LI-COR Inc.\n\n"
           "You may use, distribute and copy the %1 programs suite under "
           "the terms of the GNU General Public License version 3, "
           "which is displayed below. If you would like to obtain "
           "a copy of the source package please contact LI-COR "
           "Biosciences at "
           "<a href=\"mailto:[email protected]?subject=%1 %3&body="
           "Please, send me a copy of the source package."
           "\">[email protected]</a>."
        ).arg(Defs::APP_NAME).arg(Defs::CURRENT_COPYRIGHT_YEAR).arg(Defs::APP_VERSION_STR));
    licenseLabel->setWordWrap(true);
    licenseLabel->setOpenExternalLinks(true);

    auto licenseEdit = new QTextEdit;
    QFile licenseFile(QStringLiteral(":/docs/license"));
    qDebug() << licenseFile.open(QIODevice::ReadOnly | QIODevice::Text);
    licenseEdit->setText(QLatin1String(licenseFile.readAll()));
    licenseEdit->setReadOnly(true);
    licenseFile.close();

    auto licenseLayout = new QVBoxLayout;
    licenseLayout->addWidget(licenseLabel);
    licenseLayout->addWidget(licenseEdit);
    licenseWidget->setLayout(licenseLayout);

    // Changelog
    auto changelogWidget = new QWidget;
    auto changelogLabel = new QLabel;
    changelogLabel->setText(
        tr("<br />Software updates include bug fixes, usability "
           "improvements\n\n and feature enhancements. These are summarized "
           "in the change log below."));
    changelogLabel->setWordWrap(true);
    changelogLabel->setOpenExternalLinks(true);

    auto changelogEdit = new QTextEdit;
    QFile changelogFile(QStringLiteral(":/docs/changelog"));
    qDebug() << changelogFile.open(QIODevice::ReadOnly | QIODevice::Text);
    changelogEdit->setText(QLatin1String(changelogFile.readAll()));
    changelogEdit->setReadOnly(true);
    changelogFile.close();

    auto changelogLayout = new QVBoxLayout;
    changelogLayout->addWidget(changelogLabel);
    changelogLayout->addWidget(changelogEdit);
    changelogWidget->setLayout(changelogLayout);

    // Dialog Tabs
    auto tab = new QTabWidget;
    tab->addTab(infoWidget, tr("About"));
    tab->addTab(thanksWidget, tr("Acknowledgments"));
    tab->addTab(licenseWidget, tr("License"));
    tab->addTab(changelogWidget, tr("Changes"));

    auto okButton = WidgetUtils::createCommonButton(this, tr("Ok"));

    auto dialogLayout = new QVBoxLayout(this);
    dialogLayout->addWidget(icon, 0, Qt::AlignCenter);
    dialogLayout->addWidget(introduction, 0, Qt::AlignCenter);
    dialogLayout->addWidget(tab);
    dialogLayout->addWidget(okButton, 0, Qt::AlignCenter);
    dialogLayout->setContentsMargins(30, 30, 30, 30);
    setLayout(dialogLayout);

    connect(okButton, &QPushButton::clicked,
            [=](){ if (this->isVisible()) hide(); });
}
Exemple #11
0
EditableLabel::EditableLabel(const QString &text, QWidget *parent) : QLabel(text,parent) {
	setWordWrap(true);
}
Exemple #12
0
EditableLabel::EditableLabel(QWidget *parent) : QLabel(parent) {
	setWordWrap(true);
}
void Opcode810AHandler::_run()
{
    Logger::debug("SCRIPT") << "[810A] [=] void float_msg(void* who, string* msg, int type) " << std::endl;
    int type = _vm->popDataInteger();
    unsigned int color;
    switch (type)
    {
        case -2:
            //БОЛЬШИЕ КРАСНЫЕ БУКВЫ	FF 00 00
            color = 0xff0000ff;
            break;
        case -1:
            //Самоперебирающиеся цвета @todo
            color = 0xff0000ff; // временно взят из -2
            break;
        case 0:
        case 8:
        case 13:
            color = 0xffff7fff;
            break;
        case 1:
        case 5:
        case 10:
            color = 0x555555ff;
            break;
        case 2:
            color = 0xff0000ff;
            break;
        case 3:
            color = 0x3cfb00ff;
            break;
        case 4:
            color = 0x30598eff;
            break;
        case 6:
            color = 0xa2a2a2ff;
            break;
        case 7:
            color = 0xff4949ff;
            break;
        case 9:
            color = 0xffffffff;
            break;
        case 11:
            color = 0x3c3c3cff;
            break;
        case 12:
            color = 0x757575ff;
            break;
        default:
            throw Exception("Opcode810AHandler - wrong type: " + std::to_string(type));
    }

    auto string = static_cast<std::string*>(_vm->popDataPointer());
    auto object = static_cast<GameObject*>(_vm->popDataPointer());

    auto floatMessage = new TextArea(*string);
    floatMessage->setWidth(200);
    floatMessage->setWordWrap(true);
    floatMessage->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_CENTER);
    floatMessage->setFont(ResourceManager::font("font1.aaf", color));
    floatMessage->setOutlineColor(0x000000ff);
    object->setFloatMessage(floatMessage);

}
AutoCloseMessageBox::AutoCloseMessageBox( QWidget * parent )
    : QLabel(parent)
{
    setWordWrap(true);
}
void InventoryState::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(false);

    auto game = Game::getInstance();

    setX((game->renderer()->width()  - 499)*0.5);
    setY((game->renderer()->height() - 427)*0.5);

    addUI("background", new Image("art/intrface/invbox.frm"));
    getActiveUI("background")->addEventHandler("mouserightclick", this, (EventRecieverMethod) &InventoryState::backgroundRightClick);

    addUI("button_up",   new ImageButton(ImageButton::TYPE_INVENTORY_UP_ARROW,   128, 40));
    addUI("button_down", new ImageButton(ImageButton::TYPE_INVENTORY_DOWN_ARROW, 128, 65));

    addUI("button_done", new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, 438, 328));
    getActiveUI("button_done")->addEventHandler("mouseleftclick", this, (EventRecieverMethod) &InventoryState::onDoneButtonClick);

    // screen
    auto screenX = 300;
    auto screenY = 47;

    auto player = Game::getInstance()->player();

    addUI("player_name", new TextArea(player->name(), screenX, screenY));

    auto line1 = new Image(142, 1);
    line1->setX(screenX);
    line1->setY(screenY+16);
    line1->texture()->fill(0x3ff800ff); // default green color

    auto msg = ResourceManager::msgFileType("text/english/game/inventry.msg");

    std::string statsLabels;
    for (unsigned int i = 0; i != 7; ++i) statsLabels += msg->message(i)->text() + "\n";
    addUI("label_stats", new TextArea(statsLabels, screenX, screenY + 10*2));

    std::string statsValues;
    for (unsigned int i = 0; i != 7; ++i) statsValues += std::to_string(player->stat(i)) + "\n";
    addUI("label_stats_values", new TextArea(statsValues, screenX + 22, screenY + 20));

    std::stringstream ss;
    for (unsigned int i=7; i<14; i++)
    {
        ss << msg->message(i)->text() << "\n";
    }
    auto textLabel = new TextArea(ss.str(), screenX+40, screenY+20);

    // label: hit points
    ss.str("");
    ss << player->hitPoints();
    ss << "/";
    ss << player->hitPointsMax();
    auto hitPointsLabel = new TextArea(ss.str(), screenX+94, screenY+20);
    hitPointsLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    // label: armor class
    ss.str("");
    ss << player->armorClass();
    auto armorClassLabel = new TextArea(ss.str(), screenX+94, screenY+30);
    armorClassLabel->setWidth(46)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // armorSlot, leftHand, rightHand
    GameArmorItemObject* armorSlot = player->armorSlot();
    GameItemObject* leftHand = player->leftHandSlot();
    GameItemObject* rightHand = player->rightHandSlot();


    // label: damage treshold levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageThreshold(GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_LASER) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_FIRE) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageThreshold(GameArmorItemObject::DAMAGE_NORMAL) <<"/";
    }
    else
    {
        ss << player->damageThreshold(GameCritterObject::DAMAGE_NORMAL) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_LASER) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_FIRE) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_PLASMA) <<"/\n";
        ss << player->damageThreshold(GameCritterObject::DAMAGE_EXPLOSION) <<"/";
    }
    auto damageThresholdLabel = new TextArea(ss.str(), screenX+94, screenY+40);
    damageThresholdLabel->setWidth(26)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);

    // label: damage resistance levels
    ss.str("");
    if (armorSlot)
    {
        ss << player->damageResist(GameCritterObject::DAMAGE_NORMAL) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_LASER) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_FIRE) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_PLASMA) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_EXPLOSION) + armorSlot->damageResist(GameArmorItemObject::DAMAGE_NORMAL) <<"%";
    }
    else
    {
        ss << player->damageResist(GameCritterObject::DAMAGE_NORMAL) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_LASER) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_FIRE) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_PLASMA) <<"%\n";
        ss << player->damageResist(GameCritterObject::DAMAGE_EXPLOSION) <<"%";
    }
    auto damageResistanceLabel = new TextArea(ss.str(), screenX+120, screenY+40);

    auto line2 = new Image(142, 1);
    line2->setX(screenX);
    line2->setY(screenY+94);
    line2->texture()->fill(0x3ff800ff); // default green color

    auto line3 = new Image(142, 1);
    line3->setX(screenX);
    line3->setY(screenY+134);
    line3->texture()->fill(0x3ff800ff); // default green color

    // label: Total Wt: (20)
    auto weight = player->carryWeight();
    auto weightMax = player->carryWeightMax();

    ss.str("");
    ss << weight;
    auto totalWtLabel = new TextArea(msg->message(20), screenX+14, screenY+180);
    auto weightLabel = new TextArea(ss.str(), screenX+70, screenY+180);
    weightLabel->setWidth(24)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT);
    ss.str("");
    ss << "/" << weightMax;
    auto weightMaxLabel = new TextArea(ss.str(), screenX+94, screenY+180);
    if (weight>weightMax)
    {
        weightLabel->setFont(ResourceManager::font("font1.aaf", 0xff0000ff));
    }

    // label: left hand
    ss.str("");
    if (leftHand)
    {
        ss << _handItemSummary(leftHand);
    }
    auto leftHandLabel = new TextArea(ss.str(), screenX, screenY+100);

    // label: right hand
    ss.str("");
    if (rightHand)
    {
        ss << _handItemSummary(rightHand);
    }
    auto rightHandLabel = new TextArea(ss.str(), screenX, screenY+140);

    // screen info
    auto screenLabel = new TextArea("", screenX, screenY+20);
    screenLabel->setWidth(140); //screen size
    screenLabel->setHeight(168);
    screenLabel->setVisible(false);
    screenLabel->setWordWrap(true);


    addUI(line1);
    addUI("textLabel", textLabel);
    addUI("hitPointsLabel", hitPointsLabel);
    addUI("armorClassLabel", armorClassLabel);
    addUI("damageThresholdLabel", damageThresholdLabel);
    addUI("damageResistanceLabel", damageResistanceLabel);
    addUI("line2", line2);
    addUI("line3", line3);
    addUI("totalWtLabel", totalWtLabel);
    addUI("weightLabel", weightLabel);
    addUI("weightMaxLabel", weightMaxLabel);
    addUI("leftHandLabel", leftHandLabel);
    addUI("rightHandLabel", rightHandLabel);
    addUI("screenLabel", screenLabel);


    // BIG ICONS
    // icon: armor
    if (armorSlot)
    {
        auto armorUi = new ImageList();
        armorUi->addImage(new Image(armorSlot->inventorySlotUi()));
        armorUi->addImage(new Image(armorSlot->inventoryDragUi()));
        armorUi->setX(200 - armorUi->width()*0.5);
        armorUi->setY(215 - armorUi->height()*0.5);
        addUI(armorUi);

        armorUi->addEventHandler("mouseleftdown", this, (EventRecieverMethod) &InventoryState::onArmorSlotMouseDown);
        //armorUi->addEventHandler("mouseleftup", this, (EventRecieverMethod) &InventoryState::onArmorSlotMouseUp);
        //armorUi->addEventHandler("mousedrag", armorSlot.get(), (EventRecieverMethod) &InventoryState::onSlotDrag);
        //armorUi->addEventHandler("mouseleftdown", armorSlot.get(), (EventRecieverMethod) &InventoryState::onSlotMouseDown);
        //armorUi->addEventHandler("mouseleftup", armorSlot.get(), (EventRecieverMethod) &InventoryState::onSlotMouseUp);
    }

    // icon: left hand
    if (leftHand)
    {
        auto leftHandUi = new ImageList();
        leftHandUi->addImage(new Image(leftHand->inventorySlotUi()));
        leftHandUi->addImage(new Image(leftHand->inventoryDragUi()));
        leftHandUi->setX(200 - leftHandUi->width()*0.5);
        leftHandUi->setY(317 - leftHandUi->height()*0.5);
        addUI(leftHandUi);

        leftHandUi->addEventHandler("mouseleftdown", this, (EventRecieverMethod) &InventoryState::onLeftHandSlotMouseDown);
        //leftHandUi->addEventHandler("mousedrag", leftHand.get(), (EventRecieverMethod) &InventoryState::onSlotDrag);
        //leftHandUi->addEventHandler("mouseleftdown", leftHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseDown);
        //leftHandUi->addEventHandler("mouseleftup", leftHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseUp);
    }

    // icon: right hand
    if (rightHand)
    {
        auto rightHandUi = new ImageList();
        rightHandUi->addImage(new Image(rightHand->inventorySlotUi()));
        rightHandUi->addImage(new Image(rightHand->inventoryDragUi()));
        rightHandUi->setX(290 - rightHandUi->width()*0.5);
        rightHandUi->setY(317 - rightHandUi->height()*0.5);
        addUI(rightHandUi);

        rightHandUi->addEventHandler("mouseleftdown", this, (EventRecieverMethod) &InventoryState::onRightHandSlotMouseDown);
        //rightHandUi->addEventHandler("mousedrag", rightHand.get(), (EventRecieverMethod) &InventoryState::onSlotDrag);
        //rightHandUi->addEventHandler("mouseleftdown", rightHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseDown);
        //rightHandUi->addEventHandler("mouseleftup", rightHand.get(), (EventRecieverMethod) &InventoryState::onSlotMouseUp);
    }

}
Exemple #16
0
SignatureWidget::SignatureWidget( const DigiDocSignature &signature, unsigned int signnum, QWidget *parent )
:	QLabel( parent )
,	num( signnum )
,	s( signature )
{
	setObjectName( QString("signatureWidget%1").arg(signnum) );
	setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
	setWordWrap( true );
	setTextInteractionFlags( Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse );
	connect( this, SIGNAL(linkActivated(QString)), SLOT(link(QString)) );

	const SslCertificate cert = s.cert();
	QString accessibility, content, tooltip;
	QTextStream sa( &accessibility );
	QTextStream sc( &content );
	QTextStream st( &tooltip );

	if( cert.type() & SslCertificate::TempelType )
		sc << "<img src=\":/images/ico_stamp_blue_16.png\">";
	else
		sc << "<img src=\":/images/ico_person_blue_16.png\">";
	sc << "<b>" << Qt::escape( cert.toString( cert.showCN() ? "CN" : "GN SN" ) ) << "</b>";

	if( !s.location().isEmpty() )
	{
		sa << " " << tr("Location") << " " << s.location();
		sc << "<br />" << Qt::escape( s.location() );
		st << Qt::escape( s.location() ) << "<br />";
	}
	if( !s.role().isEmpty() )
	{
		sa << " " << tr("Role") << " " << s.role();
		sc << "<br />" << Qt::escape( s.role() );
		st << Qt::escape( s.role() ) << "<br />";
	}
	DateTime date( s.dateTime().toLocalTime() );
	if( !date.isNull() )
	{
		sa << " " << tr("Signed on") << " "
			<< date.formatDate( "dd. MMMM yyyy" ) << " "
			<< tr("time") << " "
			<< date.toString( "hh:mm" );
		sc << "<br />" << tr("Signed on") << " "
			<< date.formatDate( "dd. MMMM yyyy" ) << " "
			<< tr("time") << " "
			<< date.toString( "hh:mm" );
		st << tr("Signed on") << " "
			<< date.formatDate( "dd. MMMM yyyy" ) << " "
			<< tr("time") << " "
			<< date.toString( "hh:mm" );
	}
	setToolTip( tooltip );

	sa << " " << tr("Signature is") << " ";
	sc << "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>";
	sc << "<td>" << tr("Signature is") << " ";
	switch( s.validate() )
	{
	case DigiDocSignature::Valid:
		sa << tr("valid");
		sc << "<font color=\"green\">" << tr("valid");
		break;
	case DigiDocSignature::Warning:
		sa << tr("valid") << " (" << tr("Warnings") << ")";
		sc << "<font color=\"green\">" << tr("valid") << "</font> <font>(" << tr("Warnings") << ")";
		break;
	case DigiDocSignature::Test:
		sa << tr("valid") << " (" << tr("Test signature") << ")";
		sc << "<font color=\"green\">" << tr("valid") << "</font> <font>(" << tr("Test signature") << ")";
		break;
	case DigiDocSignature::Invalid:
		sa << tr("not valid");
		sc << "<font color=\"red\">" << tr("not valid");
		break;
	case DigiDocSignature::Unknown:
		sa << tr("unknown");
		sc << "<font color=\"red\">" << tr("unknown");
		break;
	}
	sc << "</font>";
	sc << "</td><td align=\"right\">";
	sc << "<a href=\"details\" style=\"color: #509B00\" title=\"" << tr("Show details") << "\">" << tr("Show details") << "</a>";
	sc << "</td></tr><tr><td></td>";
	sc << "<td align=\"right\">";
	if( s.parent()->isSupported() )
		sc << "<a href=\"remove\" style=\"color: #509B00\" title=\"" << tr("Remove") << "\">" << tr("Remove") << "</a>";
	sc << "</td></tr></table>";

	setText( content );
	setAccessibleName( tr("Signature") + " " + cert.toString( cert.showCN() ? "CN" : "GN SN" ) );
	setAccessibleDescription( accessibility );
}
void ConfigBitsView::SetDevice(Device* newDevice, DeviceData* newDeviceData)
{
    int i, j;

    device = newDevice;
    deviceData = newDeviceData;

    model.clear();
    model.setHorizontalHeaderItem(0, new QStandardItem("Description"));
    model.setHorizontalHeaderItem(1, new QStandardItem("Setting"));
    QList<QStandardItem*> row;
    Device::ConfigWord* word;
    unsigned int* wordValue;
    unsigned int* wordVerify;
    Device::ConfigField* field;
    ConfigBitsItem* item;

    for(i = 0; i < device->configWords.count(); i++)
    {
        word = &device->configWords[i];
        wordValue = deviceData->ConfigWordPointer(word->address);

        if(verifyData != NULL)
        {
            wordVerify = verifyData->ConfigWordPointer(word->address);
        }
        else
        {
            wordVerify = NULL;
        }

        item = new ConfigBitsItem(device, word, wordValue);
        for(j = 0; j < word->fields.count(); j++)
        {
            field = &word->fields[j];

            row.append(new ConfigBitsItem(device, field->description));
            row.append(new ConfigBitsItem(device, field, word, wordValue, wordVerify));
            item->appendRow(row);
            row.clear();
        }

        row.append(item);
        if(wordVerify != NULL)
        {
            row.append(new ConfigBitsItem(device, word, wordValue, wordVerify));
        }
        else
        {
            row.append(new ConfigBitsItem(device, wordValue));
        }
        model.appendRow(row);
        row.clear();
    }

    setModel(&model);
    setItemDelegate(new ConfigBitsDelegate(&model));
    setEditTriggers(QAbstractItemView::CurrentChanged);
    setWordWrap(true);
    setRootIsDecorated(false);
    setUniformRowHeights(true);
    setDragDropMode(QAbstractItemView::NoDragDrop);

    expandAll();
    setItemsExpandable(false);
    if(columnSplit)
    {
        setColumnWidth(0, columnSplit);
    }
    else
    {
        resizeColumnToContents(0);
    }
}
/**
 * Construct a text viewer that supports wrapping.
 * @param parent parent widget pointer
 */
TextViewer::TextViewer(QWidget* parent) : QMultiLineEdit(parent) {
    setReadOnly(true);
    setWordWrap(QMultiLineEdit::WidgetWidth);
}
Exemple #19
0
/************************************************
 *  Widget Listing:
 * Creation of the list of drawed lovely buttons
 ************************************************/
WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
              : QListWidget( _parent )
{
    /* We need the parent to know the options checked */
    parent = qobject_cast<ToolbarEditDialog *>(_parent);
    assert( parent );

    /* Normal options */
    setViewMode( QListView::IconMode );
    setSpacing( 8 );
    setGridSize( QSize(90, 50) );
    setWrapping( true );
    setWordWrap( true );
    setTextElideMode( Qt::ElideNone );
    setDragEnabled( true );

    /* All the buttons do not need a special rendering */
    for( int i = 0; i < BUTTON_MAX; i++ )
    {
        QListWidgetItem *widgetItem = new QListWidgetItem( this );
        widgetItem->setText( qtr( nameL[i] ) );
        QPixmap pix( iconL[i] );
        widgetItem->setIcon( pix.scaled( 16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
        widgetItem->setData( Qt::UserRole, QVariant( i ) );
        addItem( widgetItem );
    }

    /* Spacers are yet again a different thing */
    QListWidgetItem *widgetItem = new QListWidgetItem( QIcon( ":/toolbar/space" ),
            qtr( "Spacer" ), this );
    widgetItem->setData( Qt::UserRole, WIDGET_SPACER );
    addItem( widgetItem );

    widgetItem = new QListWidgetItem( QIcon( ":/toolbar/space" ),
            qtr( "Expanding Spacer" ), this );
    widgetItem->setData( Qt::UserRole, WIDGET_SPACER_EXTEND );
    addItem( widgetItem );

    /**
     * For all other widgets, we create then, do a pseudo rendering in
     * a pixmaps for the view, and delete the object
     *
     * A lot of code is retaken from the Abstract, but not exactly...
     * So, rewrite.
     * They are better ways to deal with this, but I doubt that this is
     * necessary. If you feel like you have the time, be my guest.
     * --
     * jb
     **/
    for( int i = SPLITTER; i < SPECIAL_MAX; i++ )
    {
        QWidget *widget = NULL;
        QListWidgetItem *widgetItem = new QListWidgetItem( this );
        switch( i )
        {
        case SPLITTER:
            {
                QFrame *line = new QFrame( this );
                line->setFrameShape( QFrame::VLine );
                line->setFrameShadow( QFrame::Raised );
                line->setLineWidth( 0 ); line->setMidLineWidth( 1 );
                widget = line;
            }
            widgetItem->setText( qtr("Splitter") );
            break;
        case INPUT_SLIDER:
            {
                SeekSlider *slider = new SeekSlider( Qt::Horizontal, this );
                widget = slider;
            }
            widgetItem->setText( qtr("Time Slider") );
            break;
        case VOLUME:
            {
                SoundWidget *snd = new SoundWidget( this, p_intf,
                        parent->getOptions() & WIDGET_SHINY );
                widget = snd;
            }
            widgetItem->setText( qtr("Volume") );
            break;
        case VOLUME_SPECIAL:
            {
                QListWidgetItem *widgetItem = new QListWidgetItem( this );
                widgetItem->setText( qtr("Small Volume") );
                widgetItem->setIcon( QIcon( ":/toolbar/volume-medium" ) );
                widgetItem->setData( Qt::UserRole, QVariant( i ) );
                addItem( widgetItem );
            }
            continue;
        case TIME_LABEL:
            {
                QLabel *timeLabel = new QLabel( "12:42/2:12:42", this );
                widget = timeLabel;
            }
            widgetItem->setText( qtr("Time") );
            break;
        case MENU_BUTTONS:
            {
                QWidget *discFrame = new QWidget( this );
                //discFrame->setLineWidth( 1 );
                QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
                discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );

                QToolButton *prevSectionButton = new QToolButton( discFrame );
                prevSectionButton->setIcon( QIcon( ":/toolbar/dvd_prev" ) );
                prevSectionButton->setToolTip( qtr("Previous chapter") );
                discLayout->addWidget( prevSectionButton );

                QToolButton *menuButton = new QToolButton( discFrame );
                menuButton->setIcon( QIcon( ":/toolbar/dvd_menu" ) );
                menuButton->setToolTip( qtr("Go to the DVD menu") );
                discLayout->addWidget( menuButton );

                QToolButton *nextButton = new QToolButton( discFrame );
                nextButton->setIcon( QIcon( ":/toolbar/dvd_next" ) );
                nextButton->setToolTip( qtr("Next chapter") );
                discLayout->addWidget( nextButton );

                widget = discFrame;
            }
            widgetItem->setText( qtr("DVD menus") );
            break;
        case TELETEXT_BUTTONS:
            {
                QWidget *telexFrame = new QWidget( this );
                QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
                telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );

                QToolButton *telexOn = new QToolButton( telexFrame );
                telexOn->setIcon( QIcon( ":/toolbar/tv" ) );
                telexLayout->addWidget( telexOn );

                QToolButton *telexTransparent = new QToolButton;
                telexTransparent->setIcon( QIcon( ":/toolbar/tvtelx" ) );
                telexTransparent->setToolTip( qtr("Teletext transparency") );
                telexLayout->addWidget( telexTransparent );

                QSpinBox *telexPage = new QSpinBox;
                telexLayout->addWidget( telexPage );

                widget = telexFrame;
            }
            widgetItem->setText( qtr("Teletext") );
            break;
        case ADVANCED_CONTROLLER:
            {
                AdvControlsWidget *advControls = new AdvControlsWidget( p_intf, this );
                widget = advControls;
            }
            widgetItem->setText( qtr("Advanced Buttons") );
            break;
        case PLAYBACK_BUTTONS:
            {
                widget = new QWidget;
                DeckButtonsLayout *layout = new DeckButtonsLayout( widget );
                BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward );
                BrowseButton *next = new BrowseButton( widget );
                RoundButton *play = new RoundButton( widget );
                layout->setBackwardButton( prev );
                layout->setForwardButton( next );
                layout->setRoundButton( play );
            }
            widgetItem->setText( qtr("Playback Buttons") );
            break;
        case ASPECT_RATIO_COMBOBOX:
            widget = new AspectRatioComboBox( p_intf );
            widgetItem->setText( qtr("Aspect ratio selector") );
            break;
        case SPEED_LABEL:
            widget = new SpeedLabel( p_intf, this );
            widgetItem->setText( qtr("Speed selector") );
            break;
        case TIME_LABEL_ELAPSED:
            widget = new QLabel( "2:42", this );
            widgetItem->setText( qtr("Elapsed time") );
            break;
        case TIME_LABEL_REMAINING:
            widget = new QLabel( "-2:42", this );
            widgetItem->setText( qtr("Total/Remaining time") );
            break;
        default:
            msg_Warn( p_intf, "This should not happen %i", i );
            break;
        }

        if( widget == NULL ) continue;


        widgetItem->setIcon( QIcon( QPixmap::grabWidget( widget ) ) );
        widget->hide();
        widgetItem->setData( Qt::UserRole, QVariant( i ) );

        addItem( widgetItem );
        delete widget;
    }
}
void KexiTitleLabel::init()
{
    setWordWrap(true);
    updateFont();
}
int QListView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractItemView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 1)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Movement*>(_v) = movement(); break;
        case 1: *reinterpret_cast< Flow*>(_v) = flow(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isWrapping(); break;
        case 3: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break;
        case 4: *reinterpret_cast< LayoutMode*>(_v) = layoutMode(); break;
        case 5: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 6: *reinterpret_cast< QSize*>(_v) = gridSize(); break;
        case 7: *reinterpret_cast< ViewMode*>(_v) = viewMode(); break;
        case 8: *reinterpret_cast< int*>(_v) = modelColumn(); break;
        case 9: *reinterpret_cast< bool*>(_v) = uniformItemSizes(); break;
        case 10: *reinterpret_cast< int*>(_v) = batchSize(); break;
        case 11: *reinterpret_cast< bool*>(_v) = wordWrap(); break;
        case 12: *reinterpret_cast< bool*>(_v) = isSelectionRectVisible(); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setMovement(*reinterpret_cast< Movement*>(_v)); break;
        case 1: setFlow(*reinterpret_cast< Flow*>(_v)); break;
        case 2: setWrapping(*reinterpret_cast< bool*>(_v)); break;
        case 3: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break;
        case 4: setLayoutMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 5: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 6: setGridSize(*reinterpret_cast< QSize*>(_v)); break;
        case 7: setViewMode(*reinterpret_cast< ViewMode*>(_v)); break;
        case 8: setModelColumn(*reinterpret_cast< int*>(_v)); break;
        case 9: setUniformItemSizes(*reinterpret_cast< bool*>(_v)); break;
        case 10: setBatchSize(*reinterpret_cast< int*>(_v)); break;
        case 11: setWordWrap(*reinterpret_cast< bool*>(_v)); break;
        case 12: setSelectionRectVisible(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 13;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}