void OTTrade::UpdateContents() { // I release this because I'm about to repopulate it. m_xmlUnsigned.Release(); const String NOTARY_ID(GetNotaryID()), NYM_ID(GetSenderNymID()), INSTRUMENT_DEFINITION_ID(GetInstrumentDefinitionID()), ASSET_ACCT_ID(GetSenderAcctID()), CURRENCY_TYPE_ID(GetCurrencyID()), CURRENCY_ACCT_ID(GetCurrencyAcctID()); Tag tag("trade"); tag.add_attribute("version", m_strVersion.Get()); tag.add_attribute("hasActivated", formatBool(hasTradeActivated_)); tag.add_attribute("notaryID", NOTARY_ID.Get()); tag.add_attribute("instrumentDefinitionID", INSTRUMENT_DEFINITION_ID.Get()); tag.add_attribute("assetAcctID", ASSET_ACCT_ID.Get()); tag.add_attribute("currencyTypeID", CURRENCY_TYPE_ID.Get()); tag.add_attribute("currencyAcctID", CURRENCY_ACCT_ID.Get()); tag.add_attribute("nymID", NYM_ID.Get()); tag.add_attribute("completedNoTrades", formatInt(tradesAlreadyDone_)); tag.add_attribute("transactionNum", formatLong(m_lTransactionNum)); tag.add_attribute("creationDate", formatTimestamp(GetCreationDate())); tag.add_attribute("validFrom", formatTimestamp(GetValidFrom())); tag.add_attribute("validTo", formatTimestamp(GetValidTo())); // There are "closing" transaction numbers, used to CLOSE a transaction. // Often where Cron items are involved such as this payment plan, or in // baskets, // where many asset accounts are involved and require receipts to be closed // out. for (int32_t i = 0; i < GetCountClosingNumbers(); i++) { int64_t closingNumber = GetClosingTransactionNoAt(i); OT_ASSERT(closingNumber > 0); TagPtr tagClosing(new Tag("closingTransactionNumber")); tagClosing->add_attribute("value", formatLong(closingNumber)); tag.add_tag(tagClosing); } if (('<' == stopSign_) || ('>' == stopSign_)) { TagPtr tagStopOrder(new Tag("stopOrder")); tagStopOrder->add_attribute("hasActivated", formatBool(stopActivated_)); tagStopOrder->add_attribute("sign", formatChar(stopSign_)); tagStopOrder->add_attribute("price", formatLong(stopPrice_)); tag.add_tag(tagStopOrder); } if (marketOffer_.Exists()) { OTASCIIArmor ascOffer(marketOffer_); tag.add_tag("offer", ascOffer.Get()); } std::string str_result; tag.output(str_result); m_xmlUnsigned.Concatenate("%s", str_result.c_str()); }
// Contructor of the component MessageWidget::MessageWidget() { global = new QVBoxLayout(); searchArea = new QHBoxLayout(); searchFieldsArea = new QVBoxLayout(); searchOptionsArea = new QGridLayout(); //tagsLines = new QVBoxLayout(); //tagsLine1 = new QHBoxLayout(); //tagsLine2 = new QHBoxLayout(); global->addLayout(searchArea); searchArea->addLayout(searchFieldsArea); searchArea->addLayout(searchOptionsArea); //searchArea->addLayout(tagsLines); //tagsLines->addLayout(tagsLine1); tagsArea = new QScrollArea(); scrollingTagsArea = new QWidget(); scrollingTagsArea->setLayout(new QHBoxLayout()); tagsArea->setWidget(scrollingTagsArea); tagsArea->setWidgetResizable(true); tagsArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); tagsArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); scrollingTagsArea->layout()->setMargin(0); scrollingTagsArea->layout()->setContentsMargins(5,0,5,0); scrollingTagsArea->layout()->addItem(new QSpacerItem(0,20, QSizePolicy::Expanding, QSizePolicy::Fixed)); scrollingTagsArea->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); tagsArea->setMaximumHeight(50); tags = new QList<QuickSearchWidget*>(); searchButton = new QPushButton("search"); CONNECT(searchButton, SIGNAL(clicked()), this, SLOT(searchButtonClicked())); searchButton->setEnabled(false); searchField = new QLineEdit; CONNECT(searchField, SIGNAL(textChanged(QString)), this, SLOT(searchFieldChanged(QString))); CONNECT(searchField, SIGNAL(returnPressed()), this, SLOT(searchByPressingEnter())); replaceField = new QLineEdit; CONNECT(replaceField, SIGNAL(textChanged(QString)), this, SLOT(replaceFieldChanged(QString))); replaceButton = new QPushButton("replace"); CONNECT(replaceButton, SIGNAL(clicked()), this, SLOT(replaceButtonClicked())); replaceButton->setEnabled(false); caseSensitiveCheckBox = new QCheckBox("Case Sensitive"); regexCheckBox = new QCheckBox("Regex"); CONNECT(regexCheckBox, SIGNAL(clicked()), this, SLOT(regexCheckBoxClicked())); replaceRules = new QComboBox(); replaceRules->addItem("One By One"); replaceRules->addItem("All In Active File"); replaceRules->addItem("In All Files"); replaceRules->setEditable(false); table = new QTableWidget(); table->setColumnCount(3); table->horizontalHeader()->setSectionResizeMode(0,QHeaderView::Interactive); table->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Interactive); table->horizontalHeader()->setSectionResizeMode(2,QHeaderView::Stretch); table->setColumnWidth(0,200); table->setColumnWidth(1, 40); CONNECT(table, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectionChanged(QModelIndex))); QStringList labels; labels << "File" << "Line" << "Description"; table->setHorizontalHeaderLabels(labels); table->setSelectionBehavior(QAbstractItemView::SelectRows); searchFieldsArea->addWidget(searchField); searchOptionsArea->addWidget(searchButton, 0, 0); searchFieldsArea->addWidget(replaceField); searchOptionsArea->addWidget(replaceButton, 1, 0); searchOptionsArea->addWidget(caseSensitiveCheckBox, 0, 1); searchOptionsArea->addWidget(regexCheckBox, 0, 2); searchOptionsArea->addWidget(replaceRules, 1, 1); global->addWidget(tagsArea); global->addWidget(table); TODOpushButton = new QuickSearchWidget("TODO", false); CONNECT(TODOpushButton, SIGNAL(hasBeenActivated()), this, SLOT(addInactiveTag())); CONNECT(TODOpushButton, SIGNAL(search(QString)), this, SLOT(searchThat(QString))); CONNECT(TODOpushButton, SIGNAL(destroyed()), this, SLOT(tagClosing())); tags->append(TODOpushButton); scrollingTagsArea->layout()->addWidget(TODOpushButton); addInactiveTag(); // balanceTagsLines(); this->setLayout(global); indexOfLastActivated = -1; }