Esempio n. 1
0
MultisigInputEntry * MultisigDialog::addInput()
{
    MultisigInputEntry *entry = new MultisigInputEntry(this);

    entry->setModel(model);
    ui->inputs->addWidget(entry);
    connect(entry, SIGNAL(removeEntry(MultisigInputEntry *)), this, SLOT(removeEntry(MultisigInputEntry *)));
    connect(entry, SIGNAL(updateAmount()), this, SLOT(updateAmounts()));
    updateRemoveEnabled();
    entry->clear();
    ui->scrollAreaWidgetContents_2->resize(ui->scrollAreaWidgetContents_2->sizeHint());
    QScrollBar *bar = ui->scrollArea_2->verticalScrollBar();
    if(bar)
        bar->setSliderPosition(bar->maximum());

    return entry;
}
Esempio n. 2
0
void MultisigInputEntry::on_transactionOutput_currentIndexChanged(int index)
{
    if(ui->transactionOutput->itemText(index).isEmpty())
        return;

    CTransaction tx;
    uint256 blockHash = 0;
    if(!GetTransaction(txHash, tx, blockHash))
        return;
    const CTxOut& txOut = tx.vout[index];
    CScript script = txOut.scriptPubKey;

    if(script.IsPayToScriptHash())
    {
        ui->redeemScript->setEnabled(true);

        if(model)
        {
            /* FIXME
            // Try to find the redeem script
            CBitcoinAddress dest;
            if(ExtractAddress(script, dest))
            {
                CScriptID scriptID = boost::get<CScriptID>(dest);
                CScriptID scriptID;
                if(dest.GetScriptID(scriptID))
                {
                    CScript redeemScript;
                    if(model->getWallet()->GetCScript(scriptID, redeemScript))
                        ui->redeemScript->setText(HexStr(redeemScript.begin(), redeemScript.end()).c_str());
                }
            }
            */
        }
    }
    else
    {
        ui->redeemScript->setEnabled(false);
    }

    emit updateAmount();
}
ResourceEntity::ResourceEntity(int x, int y, int cur_amount, SModel* model, Ogre::SceneManager* sceneMgr, int total_amount)
{
	static int i = 0;
	int cur;

	type = ET_RESOURCE;

	m_total_amount = total_amount;
	m_current_amount = cur_amount;

	for (vector<SMesh*>::iterator it = model->meshes.begin(); it != model->meshes.end(); it++)
	{
		cur = i++;
		SMesh* mesh = (*it);

		entity = sceneMgr->createEntity(Ogre::String("resourceEntity") + Ogre::StringConverter::toString(cur), mesh->name);
		node = sceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::String("resourceNode") + Ogre::StringConverter::toString(cur), Ogre::Vector3(x, 0, y));
		node->attachObject(entity);
	}

	initAnimation("shrink");
	updateAmount(cur_amount);
}
//------------------------------------------------------------------------------
EstimateDetailsForm::EstimateDetailsForm(EstimateModel* model,
		QSharedPointer<BudgetingPeriod> period, QUndoStack* stack,
		QWidget* parent)
	: QWidget(parent), model(model), period(period), undoStack(stack)
{
	// Setup name field
	nameField = new LineEdit("", this);
	nameField->setEnabled(false);
	connect(nameField, SIGNAL(textEdited(QString)),
		this, SLOT(updateName(QString)));

	// Setup description field
	descriptionField = new LineEdit("", this);
	descriptionField->setEnabled(false);
	connect(descriptionField, SIGNAL(textEdited(QString)),
		this, SLOT(updateDescription(QString)));

	// Setup type field
	typeField = new QComboBox(this);
	typeField->addItem(tr("Expense"), Estimate::Expense);
	typeField->addItem(tr("Income"), Estimate::Income);
	typeField->addItem(tr("Transfer"), Estimate::Transfer);
	typeField->setEnabled(false);
	connect(typeField, SIGNAL(currentIndexChanged(int)),
		this, SLOT(updateType(int)));

	// Setup amount field
	amountField = new MoneyEdit(this);
	amountField->setEnabled(false);
	connect(amountField, SIGNAL(valueEdited(Money)),
		this, SLOT(updateAmount(Money)));

	// Setup due date field
	dueDateField = new QDateEdit(this);
	dueDateField->installEventFilter(new IgnoreUndoRedo(this, this));
	dueDateField->setCalendarPopup(true);
	dueDateField->setSpecialValueText(tr("None"));
	dueDateField->setEnabled(false);
	clearDueDate();
	connect(dueDateField, SIGNAL(dateChanged(QDate)),
		this, SLOT(updateDueDate(QDate)));

	// Setup clear-due date button
	clearDueDateButton = new QPushButton(tr("Clear"), this);
	clearDueDateButton->setEnabled(false);
	connect(clearDueDateButton, SIGNAL(clicked(bool)),
		this, SLOT(clearDueDate()));

	// Make sure we pick up changes to the budgeting period start date
	// (have to use Qt5 style connect because of namespaced type)
	connect(period.data(), &BudgetingPeriod::paramsChanged,
		this, &EstimateDetailsForm::startDateChanged);
	startDateChanged(); // initial populate

	// Put due date entry and clear button side-by-side
	QHBoxLayout* dueDateLayout = new QHBoxLayout;
	dueDateLayout->addWidget(dueDateField, 1);
	dueDateLayout->addWidget(clearDueDateButton);

	// Setup finished field
	finishedField = new QCheckBox(this);
	connect(finishedField, SIGNAL(toggled(bool)),
		this, SLOT(updateFinishedState(bool)));

	// Setup form layout
	QFormLayout* form = new QFormLayout;
	form->addRow(tr("Name"), nameField);
	form->addRow(tr("Description"), descriptionField);
	form->addRow(tr("Type"), typeField);
	form->addRow(tr("Amount"), amountField);
	form->addRow(tr("Due Date"), dueDateLayout);
	form->addRow(tr("Finished"), finishedField);

	// Add to widget
	setLayout(form);

	// Get updated data when the estimates change
	connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
		this, SLOT(dataChanged(QModelIndex,QModelIndex)));
}