Rename "History" tab to more logical "Transactions", move "Number of transactions...
[novacoin.git] / src / qt / clientmodel.cpp
index b70b71e..06ad5ad 100644 (file)
@@ -9,8 +9,7 @@
 #include <QTimer>
 
 ClientModel::ClientModel(CWallet *wallet, QObject *parent) :
-    QObject(parent), wallet(wallet), optionsModel(0), addressTableModel(0),
-    transactionTableModel(0)
+    QObject(parent), wallet(wallet), optionsModel(0)
 {
     // Until signal notifications is built into the bitcoin core,
     //  simply update everything after polling using a timer.
@@ -19,13 +18,6 @@ ClientModel::ClientModel(CWallet *wallet, QObject *parent) :
     timer->start(MODEL_UPDATE_DELAY);
 
     optionsModel = new OptionsModel(wallet, this);
-    addressTableModel = new AddressTableModel(wallet, this);
-    transactionTableModel = new TransactionTableModel(wallet, this);
-}
-
-qint64 ClientModel::getBalance() const
-{
-    return wallet->GetBalance();
 }
 
 int ClientModel::getNumConnections() const
@@ -38,86 +30,18 @@ int ClientModel::getNumBlocks() const
     return nBestHeight;
 }
 
-int ClientModel::getNumTransactions() const
-{
-    int numTransactions = 0;
-    CRITICAL_BLOCK(wallet->cs_mapWallet)
-    {
-        numTransactions = wallet->mapWallet.size();
-    }
-    return numTransactions;
-}
-
 void ClientModel::update()
 {
     // Plainly emit all signals for now. To be more efficient this should check
     //   whether the values actually changed first, although it'd be even better if these
     //   were events coming in from the bitcoin core.
-    emit balanceChanged(getBalance());
     emit numConnectionsChanged(getNumConnections());
     emit numBlocksChanged(getNumBlocks());
-    emit numTransactionsChanged(getNumTransactions());
-
-    addressTableModel->update();
 }
 
-ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payAmount, const QString &addToAddressBookAs)
+bool ClientModel::isTestNet() const
 {
-    uint160 hash160 = 0;
-    bool valid = false;
-
-    if(!AddressToHash160(payTo.toUtf8().constData(), hash160))
-    {
-        return InvalidAddress;
-    }
-
-    if(payAmount <= 0)
-    {
-        return InvalidAmount;
-    }
-
-    if(payAmount > getBalance())
-    {
-        return AmountExceedsBalance;
-    }
-
-    if((payAmount + nTransactionFee) > getBalance())
-    {
-        return AmountWithFeeExceedsBalance;
-    }
-
-    CRITICAL_BLOCK(cs_main)
-    {
-        // Send to bitcoin address
-        CWalletTx wtx;
-        CScript scriptPubKey;
-        scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
-
-        std::string strError = wallet->SendMoney(scriptPubKey, payAmount, wtx, true);
-        if (strError == "")
-        {
-            // OK
-        }
-        else if (strError == "ABORTED")
-        {
-            return Aborted;
-        }
-        else
-        {
-            emit error(tr("Sending..."), QString::fromStdString(strError));
-            return MiscError;
-        }
-    }
-
-    // Add addresses that we've sent to to the address book
-    std::string strAddress = payTo.toStdString();
-    CRITICAL_BLOCK(wallet->cs_mapAddressBook)
-    {
-        if (!wallet->mapAddressBook.count(strAddress))
-            wallet->SetAddressBookName(strAddress, addToAddressBookAs.toStdString());
-    }
-
-    return OK;
+    return fTestNet;
 }
 
 bool ClientModel::inInitialBlockDownload() const
@@ -130,18 +54,12 @@ int ClientModel::getTotalBlocksEstimate() const
     return GetTotalBlocksEstimate();
 }
 
-
 OptionsModel *ClientModel::getOptionsModel()
 {
     return optionsModel;
 }
 
-AddressTableModel *ClientModel::getAddressTableModel()
-{
-    return addressTableModel;
-}
-
-TransactionTableModel *ClientModel::getTransactionTableModel()
+QString ClientModel::formatFullVersion() const
 {
-    return transactionTableModel;
+    return QString::fromStdString(FormatFullVersion());
 }