void WalletModel::update()
{
	qint64 newBalance = getBalance();
	qint64 newUnconfirmedBalance = getUnconfirmedBalance();
	int newNumTransactions = getNumTransactions();
	EncryptionStatus newEncryptionStatus = getEncryptionStatus();
	bool newMintStatus = getMintUnlockedbool();
        qint64 newReserveBalance = getCoinStakeReserveValue();

	if (cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance)
		emit balanceChanged(newBalance, getStake(), newUnconfirmedBalance);

	if (cachedNumTransactions != newNumTransactions)
		emit numTransactionsChanged(newNumTransactions);

	if (cachedEncryptionStatus != newEncryptionStatus)
		emit encryptionStatusChanged(newEncryptionStatus);
        
	if (cachedMintStatus != newMintStatus)
		emit mintStatusChanged(newMintStatus,newReserveBalance);

	cachedBalance = newBalance;
	cachedUnconfirmedBalance = newUnconfirmedBalance;
	cachedNumTransactions = newNumTransactions;
	cachedMintStatus = newMintStatus;
        cachedReserveBalance = newReserveBalance;
}
示例#2
0
void WalletModel::updateStatus()
{
    EncryptionStatus newEncryptionStatus = getEncryptionStatus();

    if(cachedEncryptionStatus != newEncryptionStatus)
        emit encryptionStatusChanged(newEncryptionStatus);
}
void WalletView::setWalletModel(WalletModel *_walletModel)
{
    this->walletModel = _walletModel;

    // Put transaction list in tabs
    transactionView->setModel(_walletModel);
    overviewPage->setWalletModel(_walletModel);
    receiveCoinsPage->setModel(_walletModel);
    sendCoinsPage->setModel(_walletModel);
    usedReceivingAddressesPage->setModel(_walletModel ? _walletModel->getAddressTableModel() : nullptr);
    usedSendingAddressesPage->setModel(_walletModel ? _walletModel->getAddressTableModel() : nullptr);

    //added wallet model to avoid crash when start is clicked at masternode tab
    //note that at this time its not possible to run node via this tab because coins are pre-loced at start of MAC and start button trying to lock it again
    QSettings settings;
    if (settings.value("fShowMasternodesTab").toBool()) {
        masternodeListPage->setWalletModel(_walletModel);
    }

    if (_walletModel)
    {
        // Receive and pass through messages from wallet model
        connect(_walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));

        // Handle changes in encryption status
        connect(_walletModel, SIGNAL(encryptionStatusChanged()), this, SIGNAL(encryptionStatusChanged()));
        updateEncryptionStatus();

        // update HD status
        Q_EMIT hdEnabledStatusChanged();

        // Balloon pop-up for new transaction
        connect(_walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
                this, SLOT(processNewTransaction(QModelIndex,int,int)));

        // Ask for passphrase if needed
        connect(_walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));

        // Show progress dialog
        connect(_walletModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int)));
    }
}
示例#4
0
void WalletModel::update()
{
    qint64 newBalance = getBalance();
    qint64 newUnconfirmedBalance = getUnconfirmedBalance();
    int newNumTransactions = getNumTransactions();
    EncryptionStatus newEncryptionStatus = getEncryptionStatus();

    if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance)
        emit balanceChanged(newBalance, getStake(), newUnconfirmedBalance);

    if(cachedNumTransactions != newNumTransactions)
        emit numTransactionsChanged(newNumTransactions);

    if(cachedEncryptionStatus != newEncryptionStatus)
        emit encryptionStatusChanged(newEncryptionStatus);

    cachedBalance = newBalance;
    cachedUnconfirmedBalance = newUnconfirmedBalance;
    cachedNumTransactions = newNumTransactions;
}
示例#5
0
int WalletModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            balanceChanged((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2])),(*reinterpret_cast< qint64(*)>(_a[3])));
            break;
        case 1:
            numTransactionsChanged((*reinterpret_cast< int(*)>(_a[1])));
            break;
        case 2:
            encryptionStatusChanged((*reinterpret_cast< int(*)>(_a[1])));
            break;
        case 3:
            requireUnlock();
            break;
        case 4:
            error((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3])));
            break;
        case 5:
            updateStatus();
            break;
        case 6:
            updateTransaction((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])));
            break;
        case 7:
            updateAddressBook((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4])));
            break;
        case 8:
            pollBalanceChanged();
            break;
        default:
            ;
        }
        _id -= 9;
    }
    return _id;
}
void WalletView::setMachinecoinGUI(MachinecoinGUI *gui)
{
    if (gui)
    {
        // Clicking on a transaction on the overview page simply sends you to transaction history page
        connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));

        // Navigate to transaction history page after send
        connect(sendCoinsPage, SIGNAL(coinsSent(uint256)), gui, SLOT(gotoHistoryPage()));

        // Receive and report messages
        connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));

        // Pass through encryption status changed signals
        connect(this, SIGNAL(encryptionStatusChanged()), gui, SLOT(updateWalletStatus()));

        // Pass through transaction notifications
        connect(this, SIGNAL(incomingTransaction(QString,int,CAmount,QString,QString,QString,QString)), gui, SLOT(incomingTransaction(QString,int,CAmount,QString,QString,QString,QString)));

        // Connect HD enabled state signal
        connect(this, SIGNAL(hdEnabledStatusChanged()), gui, SLOT(updateWalletStatus()));
    }
}
示例#7
0
文件: walletview.cpp 项目: KaTXi/ASTC
void WalletView::updateEncryptionStatus()
{
    emit encryptionStatusChanged(walletModel->getEncryptionStatus());
}
示例#8
0
void WalletView::updateEncryptionStatus()
{
    Q_EMIT encryptionStatusChanged();
}