mirror of
https://github.com/AskDavis/Casinotest.git
synced 2026-01-04 20:29:47 -08:00
Version 1.1.0.0 update
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
#include "clientmodel.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "clientmodel.h"
|
||||
#include "clientversion.h"
|
||||
|
||||
// Copyright year (2009-this)
|
||||
// Todo: update this when changing our copyright comments in the source
|
||||
const int ABOUTDIALOG_COPYRIGHT_YEAR = 2013;
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Set current copyright year
|
||||
ui->copyrightLabel->setText(tr("Copyright") + QString(" © 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin developers") + QString("<br>") + tr("Copyright") + QString(" © ") + tr("2013-%1 The CasinoCoin developers").arg(ABOUTDIALOG_COPYRIGHT_YEAR));
|
||||
}
|
||||
|
||||
void AboutDialog::setModel(ClientModel *model)
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
~AboutDialog();
|
||||
|
||||
void setModel(ClientModel *model);
|
||||
|
||||
private:
|
||||
Ui::AboutDialog *ui;
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
#include "csvmodelwriter.h"
|
||||
#include "guiutil.h"
|
||||
|
||||
#ifdef USE_QRCODE
|
||||
#include "qrcodedialog.h"
|
||||
#endif
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QClipboard>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
|
||||
#ifdef USE_QRCODE
|
||||
#include "qrcodedialog.h"
|
||||
#endif
|
||||
|
||||
AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AddressBookPage),
|
||||
@@ -27,10 +27,13 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef Q_WS_MAC // Icons on push buttons are very uncommon on Mac
|
||||
ui->newAddressButton->setIcon(QIcon());
|
||||
ui->copyToClipboard->setIcon(QIcon());
|
||||
ui->deleteButton->setIcon(QIcon());
|
||||
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
|
||||
ui->newAddress->setIcon(QIcon());
|
||||
ui->copyAddress->setIcon(QIcon());
|
||||
ui->deleteAddress->setIcon(QIcon());
|
||||
ui->verifyMessage->setIcon(QIcon());
|
||||
ui->signMessage->setIcon(QIcon());
|
||||
ui->exportButton->setIcon(QIcon());
|
||||
#endif
|
||||
|
||||
#ifndef USE_QRCODE
|
||||
@@ -43,6 +46,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
|
||||
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->tableView->setFocus();
|
||||
ui->exportButton->hide();
|
||||
break;
|
||||
case ForEditing:
|
||||
ui->buttonBox->setVisible(false);
|
||||
@@ -51,24 +55,26 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||
switch(tab)
|
||||
{
|
||||
case SendingTab:
|
||||
ui->labelExplanation->setVisible(false);
|
||||
ui->deleteButton->setVisible(true);
|
||||
ui->labelExplanation->setText(tr("These are your CasinoCoin addresses for sending payments. Always check the amount and the receiving address before sending coins."));
|
||||
ui->deleteAddress->setVisible(true);
|
||||
ui->signMessage->setVisible(false);
|
||||
break;
|
||||
case ReceivingTab:
|
||||
ui->deleteButton->setVisible(false);
|
||||
ui->labelExplanation->setText(tr("These are your CasinoCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you."));
|
||||
ui->deleteAddress->setVisible(false);
|
||||
ui->signMessage->setVisible(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Context menu actions
|
||||
QAction *copyAddressAction = new QAction(ui->copyAddress->text(), this);
|
||||
QAction *copyLabelAction = new QAction(tr("Copy &Label"), this);
|
||||
QAction *copyAddressAction = new QAction(ui->copyToClipboard->text(), this);
|
||||
QAction *editAction = new QAction(tr("&Edit"), this);
|
||||
QAction *sendCoinsAction = new QAction(tr("Send &Coins"), this);
|
||||
QAction *showQRCodeAction = new QAction(ui->showQRCode->text(), this);
|
||||
QAction *signMessageAction = new QAction(ui->signMessage->text(), this);
|
||||
QAction *verifyMessageAction = new QAction(ui->verifyMessage->text(), this);
|
||||
deleteAction = new QAction(ui->deleteButton->text(), this);
|
||||
deleteAction = new QAction(ui->deleteAddress->text(), this);
|
||||
|
||||
// Build context menu
|
||||
contextMenu = new QMenu();
|
||||
@@ -78,17 +84,22 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||
if(tab == SendingTab)
|
||||
contextMenu->addAction(deleteAction);
|
||||
contextMenu->addSeparator();
|
||||
if(tab == SendingTab)
|
||||
contextMenu->addAction(sendCoinsAction);
|
||||
#ifdef USE_QRCODE
|
||||
contextMenu->addAction(showQRCodeAction);
|
||||
#endif
|
||||
if(tab == ReceivingTab)
|
||||
contextMenu->addAction(signMessageAction);
|
||||
else if(tab == SendingTab)
|
||||
contextMenu->addAction(verifyMessageAction);
|
||||
|
||||
// Connect signals for context menu actions
|
||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyToClipboard_clicked()));
|
||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked()));
|
||||
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction()));
|
||||
connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
|
||||
connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteButton_clicked()));
|
||||
connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked()));
|
||||
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(onSendCoinsAction()));
|
||||
connect(showQRCodeAction, SIGNAL(triggered()), this, SLOT(on_showQRCode_clicked()));
|
||||
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(on_signMessage_clicked()));
|
||||
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(on_verifyMessage_clicked()));
|
||||
@@ -132,17 +143,19 @@ void AddressBookPage::setModel(AddressTableModel *model)
|
||||
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
// Set column widths
|
||||
ui->tableView->horizontalHeader()->resizeSection(
|
||||
AddressTableModel::Address, 320);
|
||||
ui->tableView->horizontalHeader()->setResizeMode(
|
||||
AddressTableModel::Label, QHeaderView::Stretch);
|
||||
#if QT_VERSION < 0x050000
|
||||
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
|
||||
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(selectionChanged()));
|
||||
|
||||
// Select row for newly created address
|
||||
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||
this, SLOT(selectNewAddress(QModelIndex,int,int)));
|
||||
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(selectNewAddress(QModelIndex,int,int)));
|
||||
|
||||
selectionChanged();
|
||||
}
|
||||
@@ -152,7 +165,7 @@ void AddressBookPage::setOptionsModel(OptionsModel *optionsModel)
|
||||
this->optionsModel = optionsModel;
|
||||
}
|
||||
|
||||
void AddressBookPage::on_copyToClipboard_clicked()
|
||||
void AddressBookPage::on_copyAddress_clicked()
|
||||
{
|
||||
GUIUtil::copyEntryData(ui->tableView, AddressTableModel::Address);
|
||||
}
|
||||
@@ -184,36 +197,43 @@ void AddressBookPage::on_signMessage_clicked()
|
||||
{
|
||||
QTableView *table = ui->tableView;
|
||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||
QString addr;
|
||||
|
||||
foreach (QModelIndex index, indexes)
|
||||
{
|
||||
QVariant address = index.data();
|
||||
addr = address.toString();
|
||||
QString address = index.data().toString();
|
||||
emit signMessage(address);
|
||||
}
|
||||
|
||||
emit signMessage(addr);
|
||||
}
|
||||
|
||||
void AddressBookPage::on_verifyMessage_clicked()
|
||||
{
|
||||
QTableView *table = ui->tableView;
|
||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||
QString addr;
|
||||
|
||||
foreach (QModelIndex index, indexes)
|
||||
{
|
||||
QVariant address = index.data();
|
||||
addr = address.toString();
|
||||
QString address = index.data().toString();
|
||||
emit verifyMessage(address);
|
||||
}
|
||||
|
||||
emit verifyMessage(addr);
|
||||
}
|
||||
|
||||
void AddressBookPage::on_newAddressButton_clicked()
|
||||
void AddressBookPage::onSendCoinsAction()
|
||||
{
|
||||
QTableView *table = ui->tableView;
|
||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||
|
||||
foreach (QModelIndex index, indexes)
|
||||
{
|
||||
QString address = index.data().toString();
|
||||
emit sendCoins(address);
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::on_newAddress_clicked()
|
||||
{
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
EditAddressDialog dlg(
|
||||
tab == SendingTab ?
|
||||
EditAddressDialog::NewSendingAddress :
|
||||
@@ -225,11 +245,12 @@ void AddressBookPage::on_newAddressButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::on_deleteButton_clicked()
|
||||
void AddressBookPage::on_deleteAddress_clicked()
|
||||
{
|
||||
QTableView *table = ui->tableView;
|
||||
if(!table->selectionModel())
|
||||
return;
|
||||
|
||||
QModelIndexList indexes = table->selectionModel()->selectedRows();
|
||||
if(!indexes.isEmpty())
|
||||
{
|
||||
@@ -250,8 +271,8 @@ void AddressBookPage::selectionChanged()
|
||||
{
|
||||
case SendingTab:
|
||||
// In sending tab, allow deletion of selection
|
||||
ui->deleteButton->setEnabled(true);
|
||||
ui->deleteButton->setVisible(true);
|
||||
ui->deleteAddress->setEnabled(true);
|
||||
ui->deleteAddress->setVisible(true);
|
||||
deleteAction->setEnabled(true);
|
||||
ui->signMessage->setEnabled(false);
|
||||
ui->signMessage->setVisible(false);
|
||||
@@ -260,8 +281,8 @@ void AddressBookPage::selectionChanged()
|
||||
break;
|
||||
case ReceivingTab:
|
||||
// Deleting receiving addresses, however, is not allowed
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->deleteButton->setVisible(false);
|
||||
ui->deleteAddress->setEnabled(false);
|
||||
ui->deleteAddress->setVisible(false);
|
||||
deleteAction->setEnabled(false);
|
||||
ui->signMessage->setEnabled(true);
|
||||
ui->signMessage->setVisible(true);
|
||||
@@ -269,14 +290,14 @@ void AddressBookPage::selectionChanged()
|
||||
ui->verifyMessage->setVisible(false);
|
||||
break;
|
||||
}
|
||||
ui->copyToClipboard->setEnabled(true);
|
||||
ui->copyAddress->setEnabled(true);
|
||||
ui->showQRCode->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->deleteAddress->setEnabled(false);
|
||||
ui->showQRCode->setEnabled(false);
|
||||
ui->copyToClipboard->setEnabled(false);
|
||||
ui->copyAddress->setEnabled(false);
|
||||
ui->signMessage->setEnabled(false);
|
||||
ui->verifyMessage->setEnabled(false);
|
||||
}
|
||||
@@ -309,7 +330,7 @@ void AddressBookPage::done(int retval)
|
||||
QDialog::done(retval);
|
||||
}
|
||||
|
||||
void AddressBookPage::exportClicked()
|
||||
void AddressBookPage::on_exportButton_clicked()
|
||||
{
|
||||
// CSV is currently the only supported format
|
||||
QString filename = GUIUtil::getSaveFileName(
|
||||
@@ -341,11 +362,11 @@ void AddressBookPage::on_showQRCode_clicked()
|
||||
|
||||
foreach (QModelIndex index, indexes)
|
||||
{
|
||||
QString address = index.data().toString(), label = index.sibling(index.row(), 0).data(Qt::EditRole).toString();
|
||||
QString address = index.data().toString();
|
||||
QString label = index.sibling(index.row(), 0).data(Qt::EditRole).toString();
|
||||
|
||||
QRCodeDialog *dialog = new QRCodeDialog(address, label, tab == ReceivingTab, this);
|
||||
if(optionsModel)
|
||||
dialog->setModel(optionsModel);
|
||||
dialog->setModel(optionsModel);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
}
|
||||
@@ -361,7 +382,7 @@ void AddressBookPage::contextualMenu(const QPoint &point)
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int end)
|
||||
void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int /*end*/)
|
||||
{
|
||||
QModelIndex idx = proxyModel->mapFromSource(model->index(begin, AddressTableModel::Address, parent));
|
||||
if(idx.isValid() && (idx.data(Qt::EditRole).toString() == newAddressToSelect))
|
||||
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
|
||||
public slots:
|
||||
void done(int retval);
|
||||
void exportClicked();
|
||||
|
||||
private:
|
||||
Ui::AddressBookPage *ui;
|
||||
@@ -54,32 +53,42 @@ private:
|
||||
QString returnValue;
|
||||
QSortFilterProxyModel *proxyModel;
|
||||
QMenu *contextMenu;
|
||||
QAction *deleteAction;
|
||||
QAction *deleteAction; // to be able to explicitly disable it
|
||||
QString newAddressToSelect;
|
||||
|
||||
private slots:
|
||||
void on_deleteButton_clicked();
|
||||
void on_newAddressButton_clicked();
|
||||
/** Delete currently selected address entry */
|
||||
void on_deleteAddress_clicked();
|
||||
/** Create a new address for receiving coins and / or add a new address book entry */
|
||||
void on_newAddress_clicked();
|
||||
/** Copy address of currently selected address entry to clipboard */
|
||||
void on_copyToClipboard_clicked();
|
||||
void on_copyAddress_clicked();
|
||||
/** Open the sign message tab in the Sign/Verify Message dialog with currently selected address */
|
||||
void on_signMessage_clicked();
|
||||
/** Open the verify message tab in the Sign/Verify Message dialog with currently selected address */
|
||||
void on_verifyMessage_clicked();
|
||||
void selectionChanged();
|
||||
/** Open send coins dialog for currently selected address (no button) */
|
||||
void onSendCoinsAction();
|
||||
/** Generate a QR Code from the currently selected address */
|
||||
void on_showQRCode_clicked();
|
||||
/** Copy label of currently selected address entry to clipboard (no button) */
|
||||
void onCopyLabelAction();
|
||||
/** Edit currently selected address entry (no button) */
|
||||
void onEditAction();
|
||||
/** Export button clicked */
|
||||
void on_exportButton_clicked();
|
||||
|
||||
/** Set button states based on selected tab and selection */
|
||||
void selectionChanged();
|
||||
/** Spawn contextual menu (right mouse menu) for address book entry */
|
||||
void contextualMenu(const QPoint &point);
|
||||
|
||||
/** Copy label of currently selected address entry to clipboard */
|
||||
void onCopyLabelAction();
|
||||
/** Edit currently selected address entry */
|
||||
void onEditAction();
|
||||
|
||||
/** New entry/entries were added to address table */
|
||||
void selectNewAddress(const QModelIndex &parent, int begin, int end);
|
||||
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
|
||||
|
||||
signals:
|
||||
void signMessage(QString addr);
|
||||
void verifyMessage(QString addr);
|
||||
void sendCoins(QString addr);
|
||||
};
|
||||
|
||||
#endif // ADDRESSBOOKDIALOG_H
|
||||
#endif // ADDRESSBOOKPAGE_H
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "addresstablemodel.h"
|
||||
|
||||
#include "guiutil.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
@@ -6,7 +7,6 @@
|
||||
#include "base58.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QColor>
|
||||
|
||||
const QString AddressTableModel::Send = "S";
|
||||
const QString AddressTableModel::Receive = "R";
|
||||
@@ -69,6 +69,8 @@ public:
|
||||
QString::fromStdString(address.ToString())));
|
||||
}
|
||||
}
|
||||
// qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order
|
||||
qSort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
|
||||
}
|
||||
|
||||
void updateEntry(const QString &address, const QString &label, bool isMine, int status)
|
||||
@@ -208,7 +210,7 @@ QVariant AddressTableModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool AddressTableModel::setData(const QModelIndex & index, const QVariant & value, int role)
|
||||
bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(!index.isValid())
|
||||
return false;
|
||||
@@ -221,18 +223,36 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu
|
||||
switch(index.column())
|
||||
{
|
||||
case Label:
|
||||
// Do nothing, if old label == new label
|
||||
if(rec->label == value.toString())
|
||||
{
|
||||
editStatus = NO_CHANGES;
|
||||
return false;
|
||||
}
|
||||
wallet->SetAddressBookName(CBitcoinAddress(rec->address.toStdString()).Get(), value.toString().toStdString());
|
||||
rec->label = value.toString();
|
||||
break;
|
||||
case Address:
|
||||
// Do nothing, if old address == new address
|
||||
if(CBitcoinAddress(rec->address.toStdString()) == CBitcoinAddress(value.toString().toStdString()))
|
||||
{
|
||||
editStatus = NO_CHANGES;
|
||||
return false;
|
||||
}
|
||||
// Refuse to set invalid address, set error status and return false
|
||||
if(!walletModel->validateAddress(value.toString()))
|
||||
else if(!walletModel->validateAddress(value.toString()))
|
||||
{
|
||||
editStatus = INVALID_ADDRESS;
|
||||
return false;
|
||||
}
|
||||
// Check for duplicate addresses to prevent accidental deletion of addresses, if you try
|
||||
// to paste an existing address over another address (with a different label)
|
||||
else if(wallet->mapAddressBook.count(CBitcoinAddress(value.toString().toStdString()).Get()))
|
||||
{
|
||||
editStatus = DUPLICATE_ADDRESS;
|
||||
return false;
|
||||
}
|
||||
// Double-check that we're not overwriting a receiving address
|
||||
if(rec->type == AddressTableEntry::Sending)
|
||||
else if(rec->type == AddressTableEntry::Sending)
|
||||
{
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
@@ -244,7 +264,6 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -262,7 +281,7 @@ QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation,
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags AddressTableModel::flags(const QModelIndex & index) const
|
||||
Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return 0;
|
||||
@@ -279,7 +298,7 @@ Qt::ItemFlags AddressTableModel::flags(const QModelIndex & index) const
|
||||
return retval;
|
||||
}
|
||||
|
||||
QModelIndex AddressTableModel::index(int row, int column, const QModelIndex & parent) const
|
||||
QModelIndex AddressTableModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
AddressTableEntry *data = priv->index(row);
|
||||
@@ -345,6 +364,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
// Add entry
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
@@ -353,7 +373,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
|
||||
return QString::fromStdString(strAddress);
|
||||
}
|
||||
|
||||
bool AddressTableModel::removeRows(int row, int count, const QModelIndex & parent)
|
||||
bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
AddressTableEntry *rec = priv->index(row);
|
||||
|
||||
@@ -14,6 +14,7 @@ class WalletModel;
|
||||
class AddressTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
|
||||
~AddressTableModel();
|
||||
@@ -29,26 +30,27 @@ public:
|
||||
|
||||
/** Return status of edit/insert operation */
|
||||
enum EditStatus {
|
||||
OK,
|
||||
INVALID_ADDRESS, /**< Unparseable address */
|
||||
DUPLICATE_ADDRESS, /**< Address already in address book */
|
||||
WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */
|
||||
KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */
|
||||
OK, /**< Everything ok */
|
||||
NO_CHANGES, /**< No changes were made during edit operation */
|
||||
INVALID_ADDRESS, /**< Unparseable address */
|
||||
DUPLICATE_ADDRESS, /**< Address already in address book */
|
||||
WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */
|
||||
KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */
|
||||
};
|
||||
|
||||
static const QString Send; /**< Specifies send address */
|
||||
static const QString Receive; /**< Specifies receive address */
|
||||
static const QString Send; /**< Specifies send address */
|
||||
static const QString Receive; /**< Specifies receive address */
|
||||
|
||||
/** @name Methods overridden from QAbstractTableModel
|
||||
@{*/
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
bool setData(const QModelIndex & index, const QVariant & value, int role);
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex & parent) const;
|
||||
bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
|
||||
Qt::ItemFlags flags(const QModelIndex & index) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
/*@}*/
|
||||
|
||||
/* Add an address to the model.
|
||||
|
||||
@@ -19,7 +19,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
|
||||
ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE);
|
||||
ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE);
|
||||
ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE);
|
||||
|
||||
|
||||
// Setup Caps Lock detection.
|
||||
ui->passEdit1->installEventFilter(this);
|
||||
ui->passEdit2->installEventFilter(this);
|
||||
@@ -98,7 +98,7 @@ void AskPassphraseDialog::accept()
|
||||
break;
|
||||
}
|
||||
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
|
||||
tr("WARNING: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR CASINOCOINS</b>!\nAre you sure you wish to encrypt your wallet?"),
|
||||
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR CASINOCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
|
||||
QMessageBox::Yes|QMessageBox::Cancel,
|
||||
QMessageBox::Cancel);
|
||||
if(retval == QMessageBox::Yes)
|
||||
@@ -108,7 +108,16 @@ void AskPassphraseDialog::accept()
|
||||
if(model->setWalletEncrypted(true, newpass1))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Wallet encrypted"),
|
||||
tr("CasinoCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your casinocoins from being stolen by malware infecting your computer."));
|
||||
"<qt>" +
|
||||
tr("CasinoCoin will close now to finish the encryption process. "
|
||||
"Remember that encrypting your wallet cannot fully protect "
|
||||
"your casinocoins from being stolen by malware infecting your computer.") +
|
||||
"<br><br><b>" +
|
||||
tr("IMPORTANT: Any previous backups you have made of your wallet file "
|
||||
"should be replaced with the newly generated, encrypted wallet file. "
|
||||
"For security reasons, previous backups of the unencrypted wallet file "
|
||||
"will become useless as soon as you start using the new, encrypted wallet.") +
|
||||
"</b></qt>");
|
||||
QApplication::quit();
|
||||
}
|
||||
else
|
||||
@@ -177,7 +186,7 @@ void AskPassphraseDialog::accept()
|
||||
|
||||
void AskPassphraseDialog::textChanged()
|
||||
{
|
||||
// Validate input, set Ok button to enabled when accepable
|
||||
// Validate input, set Ok button to enabled when acceptable
|
||||
bool acceptable = false;
|
||||
switch(mode)
|
||||
{
|
||||
@@ -204,7 +213,7 @@ bool AskPassphraseDialog::event(QEvent *event)
|
||||
fCapsLock = !fCapsLock;
|
||||
}
|
||||
if (fCapsLock) {
|
||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on."));
|
||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));
|
||||
} else {
|
||||
ui->capsLabel->clear();
|
||||
}
|
||||
@@ -212,7 +221,7 @@ bool AskPassphraseDialog::event(QEvent *event)
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
bool AskPassphraseDialog::eventFilter(QObject *, QEvent *event)
|
||||
bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
/* Detect Caps Lock.
|
||||
* There is no good OS-independent way to check a key state in Qt, but we
|
||||
@@ -226,14 +235,14 @@ bool AskPassphraseDialog::eventFilter(QObject *, QEvent *event)
|
||||
if (str.length() != 0) {
|
||||
const QChar *psz = str.unicode();
|
||||
bool fShift = (ke->modifiers() & Qt::ShiftModifier) != 0;
|
||||
if ((fShift && psz->isLower()) || (!fShift && psz->isUpper())) {
|
||||
if ((fShift && *psz >= 'a' && *psz <= 'z') || (!fShift && *psz >= 'A' && *psz <= 'Z')) {
|
||||
fCapsLock = true;
|
||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on."));
|
||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));
|
||||
} else if (psz->isLetter()) {
|
||||
fCapsLock = false;
|
||||
ui->capsLabel->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return QDialog::eventFilter(object, event);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
namespace Ui {
|
||||
class AskPassphraseDialog;
|
||||
}
|
||||
|
||||
class WalletModel;
|
||||
|
||||
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.
|
||||
@@ -39,7 +38,7 @@ private:
|
||||
private slots:
|
||||
void textChanged();
|
||||
bool event(QEvent *event);
|
||||
bool eventFilter(QObject *, QEvent *event);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
};
|
||||
|
||||
#endif // ASKPASSPHRASEDIALOG_H
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
/*
|
||||
* W.J. van der Laan 2011-2012
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "bitcoingui.h"
|
||||
#include "clientmodel.h"
|
||||
#include "walletmodel.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "guiutil.h"
|
||||
#include "guiconstants.h"
|
||||
|
||||
#include "init.h"
|
||||
#include "util.h"
|
||||
#include "ui_interface.h"
|
||||
#include "qtipcserver.h"
|
||||
#include "paymentserver.h"
|
||||
#include "splashscreen.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QTextCodec>
|
||||
#endif
|
||||
#include <QLocale>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <QSplashScreen>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#ifdef Q_OS_MAC
|
||||
#include "macdockiconhandler.h"
|
||||
#endif
|
||||
|
||||
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
|
||||
#define _BITCOIN_QT_PLUGINS_INCLUDED
|
||||
@@ -34,36 +40,44 @@ Q_IMPORT_PLUGIN(qkrcodecs)
|
||||
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
|
||||
#endif
|
||||
|
||||
// Declare meta types used for QMetaObject::invokeMethod
|
||||
Q_DECLARE_METATYPE(bool*)
|
||||
|
||||
// Need a global reference for the notifications to find the GUI
|
||||
static BitcoinGUI *guiref;
|
||||
static QSplashScreen *splashref;
|
||||
static SplashScreen *splashref;
|
||||
|
||||
static void ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style)
|
||||
static bool ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
||||
{
|
||||
// Message from network thread
|
||||
if(guiref)
|
||||
{
|
||||
bool modal = (style & CClientUIInterface::MODAL);
|
||||
// in case of modal message, use blocking connection to wait for user to click OK
|
||||
QMetaObject::invokeMethod(guiref, "error",
|
||||
bool ret = false;
|
||||
// In case of modal message, use blocking connection to wait for user to click a button
|
||||
QMetaObject::invokeMethod(guiref, "message",
|
||||
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
|
||||
Q_ARG(QString, QString::fromStdString(caption)),
|
||||
Q_ARG(QString, QString::fromStdString(message)),
|
||||
Q_ARG(bool, modal));
|
||||
Q_ARG(unsigned int, style),
|
||||
Q_ARG(bool*, &ret));
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s: %s\n", caption.c_str(), message.c_str());
|
||||
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
|
||||
static bool ThreadSafeAskFee(int64 nFeeRequired)
|
||||
{
|
||||
if(!guiref)
|
||||
return false;
|
||||
if(nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
|
||||
if(nFeeRequired < CTransaction::nMinTxFee || nFeeRequired <= nTransactionFee || fDaemon)
|
||||
return true;
|
||||
|
||||
bool payFee = false;
|
||||
|
||||
QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(),
|
||||
@@ -73,27 +87,14 @@ static bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
|
||||
return payFee;
|
||||
}
|
||||
|
||||
static void ThreadSafeHandleURI(const std::string& strURI)
|
||||
{
|
||||
if(!guiref)
|
||||
return;
|
||||
|
||||
QMetaObject::invokeMethod(guiref, "handleURI", GUIUtil::blockingGUIThreadConnection(),
|
||||
Q_ARG(QString, QString::fromStdString(strURI)));
|
||||
}
|
||||
|
||||
static void InitMessage(const std::string &message)
|
||||
{
|
||||
if(splashref)
|
||||
{
|
||||
splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200));
|
||||
QApplication::instance()->processEvents();
|
||||
splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(55,55,55));
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
static void QueueShutdown()
|
||||
{
|
||||
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
|
||||
printf("init message: %s\n", message.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -109,72 +110,56 @@ static std::string Translate(const char* psz)
|
||||
static void handleRunawayException(std::exception *e)
|
||||
{
|
||||
PrintExceptionContinue(e, "Runaway exception");
|
||||
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occured. CasinoCoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
|
||||
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. CasinoCoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifndef BITCOIN_QT_TEST
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// TODO: implement URI support on the Mac.
|
||||
#if !defined(MAC_OSX)
|
||||
// Do this early as we don't want to bother initializing if we are just calling IPC
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (boost::algorithm::istarts_with(argv[i], "casinocoin:"))
|
||||
{
|
||||
const char *strURI = argv[i];
|
||||
try {
|
||||
boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
|
||||
if (mq.try_send(strURI, strlen(strURI), 0))
|
||||
// if URI could be sent to the message queue exit here
|
||||
exit(0);
|
||||
else
|
||||
// if URI could not be sent to the message queue do a normal Bitcoin-Qt startup
|
||||
break;
|
||||
}
|
||||
catch (boost::interprocess::interprocess_exception &ex) {
|
||||
// don't log the "file not found" exception, because that's normal for
|
||||
// the first start of the first instance
|
||||
if (ex.get_error_code() != boost::interprocess::not_found_error)
|
||||
{
|
||||
printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Command-line options take precedence:
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// Internal string conversion is all UTF-8
|
||||
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
|
||||
#endif
|
||||
|
||||
Q_INIT_RESOURCE(bitcoin);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// Register meta types used for QMetaObject::invokeMethod
|
||||
qRegisterMetaType< bool* >();
|
||||
|
||||
// Do this early as we don't want to bother initializing if we are just calling IPC
|
||||
// ... but do it after creating app, so QCoreApplication::arguments is initialized:
|
||||
if (PaymentServer::ipcSendCommandLine())
|
||||
exit(0);
|
||||
PaymentServer* paymentServer = new PaymentServer(&app);
|
||||
|
||||
// Install global event filter that makes sure that long tooltips can be word-wrapped
|
||||
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
|
||||
|
||||
// Command-line options take precedence:
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
// ... then bitcoin.conf:
|
||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||
{
|
||||
fprintf(stderr, "Error: Specified directory does not exist\n");
|
||||
// This message can not be translated, as translation is not initialized yet
|
||||
// (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory)
|
||||
QMessageBox::critical(0, "CasinoCoin",
|
||||
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
|
||||
return 1;
|
||||
}
|
||||
ReadConfigFile(mapArgs, mapMultiArgs);
|
||||
|
||||
// Application identification (must be set before OptionsModel is initialized,
|
||||
// as it is used to locate QSettings)
|
||||
app.setOrganizationName("CasinoCoin");
|
||||
app.setOrganizationDomain("casinocoin.org");
|
||||
QApplication::setOrganizationName("CasinoCoin");
|
||||
QApplication::setOrganizationDomain("casinocoin.org");
|
||||
if(GetBoolArg("-testnet")) // Separate UI settings for testnet
|
||||
app.setApplicationName("CasinoCoin-Qt-testnet");
|
||||
QApplication::setApplicationName("CasinoCoin-Qt-testnet");
|
||||
else
|
||||
app.setApplicationName("CasinoCoin-Qt");
|
||||
QApplication::setApplicationName("CasinoCoin-Qt");
|
||||
|
||||
// ... then GUI settings:
|
||||
OptionsModel optionsModel;
|
||||
@@ -209,9 +194,7 @@ int main(int argc, char *argv[])
|
||||
// Subscribe to global signals from core
|
||||
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
|
||||
uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee);
|
||||
uiInterface.ThreadSafeHandleURI.connect(ThreadSafeHandleURI);
|
||||
uiInterface.InitMessage.connect(InitMessage);
|
||||
uiInterface.QueueShutdown.connect(QueueShutdown);
|
||||
uiInterface.Translate.connect(Translate);
|
||||
|
||||
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
|
||||
@@ -223,7 +206,14 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
QSplashScreen splash(QPixmap(":/images/splash"), 0);
|
||||
#ifdef Q_OS_MAC
|
||||
// on mac, also change the icon now because it would look strange to have a testnet splash (green) and a std app icon (orange)
|
||||
if(GetBoolArg("-testnet")) {
|
||||
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
|
||||
}
|
||||
#endif
|
||||
|
||||
SplashScreen splash(QPixmap(), 0);
|
||||
if (GetBoolArg("-splash", true) && !GetBoolArg("-min"))
|
||||
{
|
||||
splash.show();
|
||||
@@ -232,18 +222,27 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
app.processEvents();
|
||||
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
try
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
// Regenerate startup link, to fix links to old versions
|
||||
// OSX: makes no sense on mac and might also scan/mount external (and sleeping) volumes (can take up some secs)
|
||||
if (GUIUtil::GetStartOnSystemStartup())
|
||||
GUIUtil::SetStartOnSystemStartup(true);
|
||||
#endif
|
||||
|
||||
boost::thread_group threadGroup;
|
||||
|
||||
BitcoinGUI window;
|
||||
guiref = &window;
|
||||
if(AppInit2())
|
||||
|
||||
QTimer* pollShutdownTimer = new QTimer(guiref);
|
||||
QObject::connect(pollShutdownTimer, SIGNAL(timeout()), guiref, SLOT(detectShutdown()));
|
||||
pollShutdownTimer->start(200);
|
||||
|
||||
if(AppInit2(threadGroup))
|
||||
{
|
||||
{
|
||||
// Put this in a block, so that the Model objects are cleaned up before
|
||||
@@ -255,10 +254,16 @@ int main(int argc, char *argv[])
|
||||
splash.finish(&window);
|
||||
|
||||
ClientModel clientModel(&optionsModel);
|
||||
WalletModel walletModel(pwalletMain, &optionsModel);
|
||||
WalletModel *walletModel = 0;
|
||||
if(pwalletMain)
|
||||
walletModel = new WalletModel(pwalletMain, &optionsModel);
|
||||
|
||||
window.setClientModel(&clientModel);
|
||||
window.setWalletModel(&walletModel);
|
||||
if(walletModel)
|
||||
{
|
||||
window.addWallet("~Default", walletModel);
|
||||
window.setCurrentWallet("~Default");
|
||||
}
|
||||
|
||||
// If -min option passed, start window minimized.
|
||||
if(GetBoolArg("-min"))
|
||||
@@ -269,41 +274,30 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
window.show();
|
||||
}
|
||||
// TODO: implement URI support on the Mac.
|
||||
#if !defined(MAC_OSX)
|
||||
|
||||
// Place this here as guiref has to be defined if we dont want to lose URIs
|
||||
ipcInit();
|
||||
// Now that initialization/startup is done, process any command-line
|
||||
// bitcoin: URIs
|
||||
QObject::connect(paymentServer, SIGNAL(receivedURI(QString)), &window, SLOT(handleURI(QString)));
|
||||
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
|
||||
|
||||
// Check for URI in argv
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (boost::algorithm::istarts_with(argv[i], "casinocoin:"))
|
||||
{
|
||||
const char *strURI = argv[i];
|
||||
try {
|
||||
boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
|
||||
mq.try_send(strURI, strlen(strURI), 0);
|
||||
}
|
||||
catch (boost::interprocess::interprocess_exception &ex) {
|
||||
printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
app.exec();
|
||||
|
||||
window.hide();
|
||||
window.setClientModel(0);
|
||||
window.setWalletModel(0);
|
||||
window.removeAllWallets();
|
||||
guiref = 0;
|
||||
delete walletModel;
|
||||
}
|
||||
// Shutdown the core and it's threads, but don't exit Bitcoin-Qt here
|
||||
Shutdown(NULL);
|
||||
// Shutdown the core and its threads, but don't exit Bitcoin-Qt here
|
||||
threadGroup.interrupt_all();
|
||||
threadGroup.join_all();
|
||||
Shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
threadGroup.interrupt_all();
|
||||
threadGroup.join_all();
|
||||
Shutdown();
|
||||
return 1;
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<RCC>
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/icons">
|
||||
<file alias="bitcoin">res/icons/bitcoin.png</file>
|
||||
<file alias="address-book">res/icons/address-book.png</file>
|
||||
@@ -30,10 +30,10 @@
|
||||
<file alias="export">res/icons/export.png</file>
|
||||
<file alias="synced">res/icons/synced.png</file>
|
||||
<file alias="remove">res/icons/remove.png</file>
|
||||
<file alias="tx_mined">res/icons/tx_mined.png</file>
|
||||
<file alias="tx_input">res/icons/tx_input.png</file>
|
||||
<file alias="tx_output">res/icons/tx_output.png</file>
|
||||
<file alias="tx_inout">res/icons/tx_inout.png</file>
|
||||
<file alias="tx_mined">res/icons/tx_mined.png</file>
|
||||
<file alias="lock_closed">res/icons/lock_closed.png</file>
|
||||
<file alias="lock_open">res/icons/lock_open.png</file>
|
||||
<file alias="key">res/icons/key.png</file>
|
||||
@@ -43,20 +43,27 @@
|
||||
</qresource>
|
||||
<qresource prefix="/images">
|
||||
<file alias="about">res/images/about.png</file>
|
||||
<file alias="splash">res/images/splash2.jpg</file>
|
||||
<file alias="splash">res/images/splash.png</file>
|
||||
<file alias="splash_testnet">res/images/splash_testnet.png</file>
|
||||
<file alias="backg">res/images/wallet.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/movies">
|
||||
<file alias="update_spinner">res/movies/update_spinner.mng</file>
|
||||
</qresource>
|
||||
<qresource prefix="/translations">
|
||||
<file alias="af_ZA">locale/bitcoin_af_ZA.qm</file>
|
||||
<file alias="ar">locale/bitcoin_ar.qm</file>
|
||||
<file alias="bg">locale/bitcoin_bg.qm</file>
|
||||
<file alias="bs">locale/bitcoin_bs.ts</file>
|
||||
<file alias="ca">locale/bitcoin_ca.ts</file>
|
||||
<file alias="ca_ES">locale/bitcoin_ca_ES.qm</file>
|
||||
<file alias="cs">locale/bitcoin_cs.qm</file>
|
||||
<file alias="cy">locale/bitcoin_cy.ts</file>
|
||||
<file alias="da">locale/bitcoin_da.qm</file>
|
||||
<file alias="de">locale/bitcoin_de.qm</file>
|
||||
<file alias="el_GR">locale/bitcoin_el_GR.qm</file>
|
||||
<file alias="en">locale/bitcoin_en.qm</file>
|
||||
<file alias="eo">locale/bitcoin_eo.ts</file>
|
||||
<file alias="es">locale/bitcoin_es.qm</file>
|
||||
<file alias="es_CL">locale/bitcoin_es_CL.qm</file>
|
||||
<file alias="et">locale/bitcoin_et.qm</file>
|
||||
@@ -66,11 +73,16 @@
|
||||
<file alias="fi">locale/bitcoin_fi.qm</file>
|
||||
<file alias="fr">locale/bitcoin_fr.qm</file>
|
||||
<file alias="fr_CA">locale/bitcoin_fr_CA.qm</file>
|
||||
<file alias="gu_IN">locale/bitcoin_gu_IN.ts</file>
|
||||
<file alias="he">locale/bitcoin_he.qm</file>
|
||||
<file alias="hi_IN">locale/bitcoin_hi_IN.ts</file>
|
||||
<file alias="hr">locale/bitcoin_hr.qm</file>
|
||||
<file alias="hu">locale/bitcoin_hu.qm</file>
|
||||
<file alias="it">locale/bitcoin_it.qm</file>
|
||||
<file alias="ja">locale/bitcoin_ja.ts</file>
|
||||
<file alias="la">locale/bitcoin_la.ts</file>
|
||||
<file alias="lt">locale/bitcoin_lt.qm</file>
|
||||
<file alias="lv_LV">locale/bitcoin_lv_LV.ts</file>
|
||||
<file alias="nb">locale/bitcoin_nb.qm</file>
|
||||
<file alias="nl">locale/bitcoin_nl.qm</file>
|
||||
<file alias="pl">locale/bitcoin_pl.qm</file>
|
||||
@@ -81,6 +93,7 @@
|
||||
<file alias="sk">locale/bitcoin_sk.qm</file>
|
||||
<file alias="sr">locale/bitcoin_sr.qm</file>
|
||||
<file alias="sv">locale/bitcoin_sv.qm</file>
|
||||
<file alias="th_TH">locale/bitcoin_th_TH.ts</file>
|
||||
<file alias="tr">locale/bitcoin_tr.qm</file>
|
||||
<file alias="uk">locale/bitcoin_uk.qm</file>
|
||||
<file alias="zh_CN">locale/bitcoin_zh_CN.qm</file>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
This is:
|
||||
- All numbers except for '0'
|
||||
- All uppercase letters except for 'I' and 'O'
|
||||
- All lowercase letters except for 'l'
|
||||
- All upper-case letters except for 'I' and 'O'
|
||||
- All lower-case letters except for 'l'
|
||||
|
||||
User friendly Base58 input can map
|
||||
- 'l' and 'I' to '1'
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
#ifndef BITCOINADDRESSVALIDATOR_H
|
||||
#define BITCOINADDRESSVALIDATOR_H
|
||||
|
||||
#include <QRegExpValidator>
|
||||
#include <QValidator>
|
||||
|
||||
/** Base48 entry widget validator.
|
||||
Corrects near-miss characters and refuses characters that are no part of base48.
|
||||
/** Base58 entry widget validator.
|
||||
Corrects near-miss characters and refuses characters that are not part of base58.
|
||||
*/
|
||||
class BitcoinAddressValidator : public QValidator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BitcoinAddressValidator(QObject *parent = 0);
|
||||
|
||||
State validate(QString &input, int &pos) const;
|
||||
|
||||
static const int MaxAddressLength = 35;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // BITCOINADDRESSVALIDATOR_H
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
#include "bitcoinamountfield.h"
|
||||
|
||||
#include "qvaluecombobox.h"
|
||||
#include "bitcoinunits.h"
|
||||
|
||||
#include "guiconstants.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QRegExpValidator>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QComboBox>
|
||||
#include <QApplication>
|
||||
#include <qmath.h>
|
||||
#include <qmath.h> // for qPow()
|
||||
|
||||
BitcoinAmountField::BitcoinAmountField(QWidget *parent):
|
||||
QWidget(parent), amount(0), currentUnit(-1)
|
||||
@@ -102,7 +98,7 @@ bool BitcoinAmountField::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
// Translate a comma into a period
|
||||
QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count());
|
||||
qApp->sendEvent(object, &periodKeyEvent);
|
||||
QApplication::sendEvent(object, &periodKeyEvent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -149,6 +145,11 @@ void BitcoinAmountField::unitChanged(int idx)
|
||||
amount->setDecimals(BitcoinUnits::decimals(currentUnit));
|
||||
amount->setMaximum(qPow(10, BitcoinUnits::amountDigits(currentUnit)) - qPow(10, -amount->decimals()));
|
||||
|
||||
if(currentUnit == BitcoinUnits::uBTC)
|
||||
amount->setSingleStep(0.01);
|
||||
else
|
||||
amount->setSingleStep(0.001);
|
||||
|
||||
if(valid)
|
||||
{
|
||||
// If value was valid, re-place it in the widget with the new unit
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef BITCOINFIELD_H
|
||||
#define BITCOINFIELD_H
|
||||
#ifndef BITCOINAMOUNTFIELD_H
|
||||
#define BITCOINAMOUNTFIELD_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@@ -13,7 +13,9 @@ QT_END_NAMESPACE
|
||||
class BitcoinAmountField: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
|
||||
|
||||
public:
|
||||
explicit BitcoinAmountField(QWidget *parent = 0);
|
||||
|
||||
@@ -31,7 +33,7 @@ public:
|
||||
/** Make field empty and ready for new input. */
|
||||
void clear();
|
||||
|
||||
/** Qt messes up the tab chain by default in some cases (issue http://bugreports.qt.nokia.com/browse/QTBUG-10907),
|
||||
/** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
|
||||
in these cases we have to set it up manually.
|
||||
*/
|
||||
QWidget *setupTabChain(QWidget *prev);
|
||||
@@ -40,7 +42,7 @@ signals:
|
||||
void textChanged();
|
||||
|
||||
protected:
|
||||
/** Intercept focus-in event and ',' keypresses */
|
||||
/** Intercept focus-in event and ',' key presses */
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
private:
|
||||
@@ -56,5 +58,4 @@ private slots:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // BITCOINFIELD_H
|
||||
#endif // BITCOINAMOUNTFIELD_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,14 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMap>
|
||||
|
||||
class TransactionTableModel;
|
||||
class WalletFrame;
|
||||
class WalletView;
|
||||
class ClientModel;
|
||||
class WalletModel;
|
||||
class WalletStack;
|
||||
class TransactionView;
|
||||
class OverviewPage;
|
||||
class AddressBookPage;
|
||||
@@ -15,15 +19,17 @@ class SignVerifyMessageDialog;
|
||||
class Notificator;
|
||||
class RPCConsole;
|
||||
|
||||
class CWallet;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QTableView;
|
||||
class QAbstractItemModel;
|
||||
class QModelIndex;
|
||||
class QProgressBar;
|
||||
class QStackedWidget;
|
||||
class QUrl;
|
||||
class QListWidget;
|
||||
class QPushButton;
|
||||
class QAction;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/**
|
||||
@@ -33,7 +39,10 @@ QT_END_NAMESPACE
|
||||
class BitcoinGUI : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const QString DEFAULT_WALLET;
|
||||
|
||||
explicit BitcoinGUI(QWidget *parent = 0);
|
||||
~BitcoinGUI();
|
||||
|
||||
@@ -45,26 +54,30 @@ public:
|
||||
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
|
||||
functionality.
|
||||
*/
|
||||
void setWalletModel(WalletModel *walletModel);
|
||||
|
||||
bool addWallet(const QString& name, WalletModel *walletModel);
|
||||
bool setCurrentWallet(const QString& name);
|
||||
|
||||
void removeAllWallets();
|
||||
|
||||
/** Used by WalletView to allow access to needed QActions */
|
||||
// Todo: Use Qt signals for these
|
||||
QAction * getOverviewAction() { return overviewAction; }
|
||||
QAction * getHistoryAction() { return historyAction; }
|
||||
QAction * getAddressBookAction() { return addressBookAction; }
|
||||
QAction * getReceiveCoinsAction() { return receiveCoinsAction; }
|
||||
QAction * getSendCoinsAction() { return sendCoinsAction; }
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
private:
|
||||
ClientModel *clientModel;
|
||||
WalletModel *walletModel;
|
||||
|
||||
QStackedWidget *centralWidget;
|
||||
|
||||
OverviewPage *overviewPage;
|
||||
QWidget *transactionsPage;
|
||||
AddressBookPage *addressBookPage;
|
||||
AddressBookPage *receiveCoinsPage;
|
||||
SendCoinsDialog *sendCoinsPage;
|
||||
SignVerifyMessageDialog *signVerifyMessageDialog;
|
||||
WalletFrame *walletFrame;
|
||||
|
||||
QLabel *labelEncryptionIcon;
|
||||
QLabel *labelConnectionsIcon;
|
||||
@@ -80,12 +93,10 @@ private:
|
||||
QAction *addressBookAction;
|
||||
QAction *signMessageAction;
|
||||
QAction *verifyMessageAction;
|
||||
QAction *firstClassMessagingAction;
|
||||
QAction *aboutAction;
|
||||
QAction *receiveCoinsAction;
|
||||
QAction *optionsAction;
|
||||
QAction *toggleHideAction;
|
||||
QAction *exportAction;
|
||||
QAction *encryptWalletAction;
|
||||
QAction *backupWalletAction;
|
||||
QAction *changePassphraseAction;
|
||||
@@ -98,33 +109,49 @@ private:
|
||||
RPCConsole *rpcConsole;
|
||||
|
||||
QMovie *syncIconMovie;
|
||||
/** Keep track of previous number of blocks, to detect progress */
|
||||
int prevBlocks;
|
||||
|
||||
/** Create the main UI actions. */
|
||||
void createActions();
|
||||
/** Create the menu bar and submenus. */
|
||||
/** Create the menu bar and sub-menus. */
|
||||
void createMenuBar();
|
||||
/** Create the toolbars */
|
||||
void createToolBars();
|
||||
/** Create system tray (notification) icon */
|
||||
/** Create system tray icon and notification */
|
||||
void createTrayIcon();
|
||||
/** Create system tray menu (or setup the dock menu) */
|
||||
void createTrayIconMenu();
|
||||
/** Save window size and position */
|
||||
void saveWindowGeometry();
|
||||
/** Restore window size and position */
|
||||
void restoreWindowGeometry();
|
||||
/** Enable or disable all wallet-related actions */
|
||||
void setWalletActionsEnabled(bool enabled);
|
||||
|
||||
public slots:
|
||||
/** Set number of connections shown in the UI */
|
||||
void setNumConnections(int count);
|
||||
/** Set number of blocks shown in the UI */
|
||||
void setNumBlocks(int count, int countOfPeers);
|
||||
void setNumBlocks(int count, int nTotalBlocks);
|
||||
/** Set the encryption status as shown in the UI.
|
||||
@param[in] status current encryption status
|
||||
@see WalletModel::EncryptionStatus
|
||||
*/
|
||||
void setEncryptionStatus(int status);
|
||||
|
||||
/** Notify the user of an error in the network or transaction handling code. */
|
||||
void error(const QString &title, const QString &message, bool modal);
|
||||
/** Notify the user of an event from the core network or transaction handling code.
|
||||
@param[in] title the message box / notification title
|
||||
@param[in] message the displayed text
|
||||
@param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
|
||||
@see CClientUIInterface::MessageBoxFlags
|
||||
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
|
||||
*/
|
||||
void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
|
||||
/** Asks the user whether to pay the transaction fee or to cancel the transaction.
|
||||
It is currently not possible to pass a return value to another thread through
|
||||
BlockingQueuedConnection, so an indirected pointer is used.
|
||||
http://bugreports.qt.nokia.com/browse/QTBUG-10440
|
||||
https://bugreports.qt-project.org/browse/QTBUG-10440
|
||||
|
||||
@param[in] nFeeRequired the required fee
|
||||
@param[out] payFee true to pay the fee, false to not pay the fee
|
||||
@@ -132,6 +159,9 @@ public slots:
|
||||
void askFee(qint64 nFeeRequired, bool *payFee);
|
||||
void handleURI(QString strURI);
|
||||
|
||||
/** Show incoming transaction notification for new transactions. */
|
||||
void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
|
||||
|
||||
private slots:
|
||||
/** Switch to overview (home) page */
|
||||
void gotoOverviewPage();
|
||||
@@ -142,7 +172,7 @@ private slots:
|
||||
/** Switch to receive coins page */
|
||||
void gotoReceiveCoinsPage();
|
||||
/** Switch to send coins page */
|
||||
void gotoSendCoinsPage();
|
||||
void gotoSendCoinsPage(QString addr = "");
|
||||
|
||||
/** Show Sign/Verify Message dialog and switch to sign message tab */
|
||||
void gotoSignMessageTab(QString addr = "");
|
||||
@@ -153,28 +183,18 @@ private slots:
|
||||
void optionsClicked();
|
||||
/** Show about dialog */
|
||||
void aboutClicked();
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
/** Handle tray icon clicked */
|
||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
#endif
|
||||
/** Show incoming transaction notification for new transactions.
|
||||
|
||||
The new items are those between start and end inclusive, under the given parent item.
|
||||
*/
|
||||
void incomingTransaction(const QModelIndex & parent, int start, int end);
|
||||
/** Encrypt the wallet */
|
||||
void encryptWallet(bool status);
|
||||
/** Backup the wallet */
|
||||
void backupWallet();
|
||||
/** Change encrypted wallet passphrase */
|
||||
void changePassphrase();
|
||||
/** Ask for pass phrase to unlock wallet temporarily */
|
||||
void unlockWallet();
|
||||
|
||||
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
|
||||
void showNormalIfMinimized(bool fToggleHidden = false);
|
||||
/** simply calls showNormalIfMinimized(true) for use in SLOT() macro */
|
||||
/** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
|
||||
void toggleHidden();
|
||||
|
||||
/** called by a timer to check if fRequestShutdown has been set **/
|
||||
void detectShutdown();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // BITCOINGUI_H
|
||||
|
||||
@@ -8,129 +8,187 @@
|
||||
static const char UNUSED *bitcoin_strings[] = {
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"%s, you must set a rpcpassword in the configuration file:\n"
|
||||
" %s\n"
|
||||
"%s\n"
|
||||
"It is recommended you use the following random password:\n"
|
||||
"rpcuser=casinocoinrpc\n"
|
||||
"rpcpassword=%s\n"
|
||||
"(you do not need to remember this password)\n"
|
||||
"The username and password MUST NOT be the same.\n"
|
||||
"If the file does not exist, create it with owner-readable-only file "
|
||||
"permissions.\n"),
|
||||
"permissions.\n"
|
||||
"It is also recommended to set alertnotify so you are notified of problems;\n"
|
||||
"for example: alertnotify=echo %%s | mail -s \"CasinoCoin Alert\" admin@foo.com\n"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:"
|
||||
"@STRENGTH)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Cannot obtain a lock on data directory %s. CasinoCoin is probably already "
|
||||
"An error occurred while setting up the RPC port %u for listening on IPv4: %s"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"An error occurred while setting up the RPC port %u for listening on IPv6, "
|
||||
"falling back to IPv4: %s"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Bind to given address and always listen on it. Use [host]:port notation for "
|
||||
"IPv6"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Cannot obtain a lock on data directory %s. CasinoCoin is probably already "
|
||||
"running."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Detach block and address databases. Increases shutdown time (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Error: The transaction was rejected. This might happen if some of the coins "
|
||||
"Error: The transaction was rejected! This might happen if some of the coins "
|
||||
"in your wallet were already spent, such as if you used a copy of wallet.dat "
|
||||
"and coins were spent in the copy but not marked as spent here."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Error: This transaction requires a transaction fee of at least %s because of "
|
||||
"its amount, complexity, or use of recently received funds "),
|
||||
"its amount, complexity, or use of recently received funds!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Execute command when a relevant alert is received (%s in cmd is replaced by "
|
||||
"message)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Execute command when a wallet transaction changes (%s in cmd is replaced by "
|
||||
"TxID)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Execute command when the best block changes (%s in cmd is replaced by block "
|
||||
"hash)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Listen for JSON-RPC connections on <port> (default: 47970 or testnet: 17970)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Number of seconds to keep misbehaving peers from reconnecting (default: "
|
||||
"86400)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Set maximum size of high-priority/low-fee transactions in bytes (default: "
|
||||
"27000)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Set the number of script verification threads (up to 16, 0 = auto, <0 = "
|
||||
"leave that many cores free, default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"This is a pre-release test build - use at your own risk - do not use for "
|
||||
"mining or merchant applications"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Unable to bind to %s on this computer. CasinoCoin is probably already running."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: -paytxfee is set very high. This is the transaction fee you will "
|
||||
"Warning: -paytxfee is set very high! This is the transaction fee you will "
|
||||
"pay if you send a transaction."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: Please check that your computer's date and time are correct. If "
|
||||
"Warning: Displayed transactions may not be correct! You may need to upgrade, "
|
||||
"or other nodes may need to upgrade."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: Please check that your computer's date and time are correct! If "
|
||||
"your clock is wrong CasinoCoin will not work properly."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
|
||||
"data or address book entries might be missing or incorrect."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as "
|
||||
"wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect "
|
||||
"you should restore from a backup."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"You must set rpcpassword=<password> in the configuration file:\n"
|
||||
"%s\n"
|
||||
"If the file does not exist, create it with owner-readable-only file "
|
||||
"permissions."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"\n"
|
||||
"SSL options: (see the Bitcoin Wiki for SSL setup instructions)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "An error occured while setting up the RPC port %i for listening: %s"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Bind to given address. Use [host]:port notation for IPv6"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "CasinoCoin version"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "CasinoCoin"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot initialize keypool"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks proxy"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Don't generate coins"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading blkindex.dat"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of CasinoCoin"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Transaction creation failed "),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction "),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: could not start node"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: system error: "),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block info"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to sync block index"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block index"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block info"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write file info"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write to coin database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write transaction index"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write undo data"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1 unless -connect)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using internet relay chat (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 2500, 0 = all)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-6, default: 1)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000?.dat file"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 288, 0 = all)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-4, default: 3)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Information"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "List commands"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for JSON-RPC connections on <port> (default: 9332)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: 9333 or testnet: 19333)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: 47950 or testnet: 17950)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain a full transaction index (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: 125)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Only accept block chain matching built-in checkpoints (default: 1)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Output extra debugging information. Implies all other -debug* options"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Output extra network debugging information"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Prepend debug output with timestamp"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000??.dat files"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the CasinoCoin Wiki for SSL setup instructions)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or casinocoind"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Sending..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: server.cert)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set database disk log size in megabytes (default: 100)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: 100)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: 250000)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: casinocoin.conf)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout (in milliseconds)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: casinocoind.pid)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "System error: "),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"),
|
||||
@@ -142,7 +200,11 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default:
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart CasinoCoin to complete"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Disk space is low"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: this version is obsolete, upgrade required"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"),
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ QString BitcoinUnits::format(int unit, qint64 n, bool fPlus)
|
||||
QString quotient_str = QString::number(quotient);
|
||||
QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');
|
||||
|
||||
// Right-trim excess 0's after the decimal point
|
||||
// Right-trim excess zeros after the decimal point
|
||||
int nTrim = 0;
|
||||
for (int i = remainder_str.size()-1; i>=2 && (remainder_str.at(i) == '0'); --i)
|
||||
++nTrim;
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <QAbstractListModel>
|
||||
|
||||
/** Bitcoin unit definitions. Encapsulates parsing and formatting
|
||||
and serves as list model for dropdown selection boxes.
|
||||
and serves as list model for drop-down selection boxes.
|
||||
*/
|
||||
class BitcoinUnits: public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BitcoinUnits(QObject *parent);
|
||||
|
||||
@@ -26,7 +28,7 @@ public:
|
||||
//! Unit conversion and formatting
|
||||
///@{
|
||||
|
||||
//! Get list of units, for dropdown box
|
||||
//! Get list of units, for drop-down box
|
||||
static QList<Unit> availableUnits();
|
||||
//! Is unit ID valid?
|
||||
static bool valid(int unit);
|
||||
@@ -49,7 +51,7 @@ public:
|
||||
///@}
|
||||
|
||||
//! @name AbstractListModel implementation
|
||||
//! List model for unit dropdown selection box.
|
||||
//! List model for unit drop-down selection box.
|
||||
///@{
|
||||
enum RoleIndex {
|
||||
/** Unit identifier */
|
||||
@@ -58,6 +60,7 @@ public:
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
///@}
|
||||
|
||||
private:
|
||||
QList<BitcoinUnits::Unit> unitlist;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "clientmodel.h"
|
||||
|
||||
#include "guiconstants.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "addresstablemodel.h"
|
||||
#include "transactiontablemodel.h"
|
||||
|
||||
#include "alert.h"
|
||||
#include "main.h"
|
||||
#include "init.h" // for pwalletMain
|
||||
#include "checkpoints.h"
|
||||
#include "ui_interface.h"
|
||||
|
||||
#include <QDateTime>
|
||||
@@ -15,10 +17,10 @@ static const int64 nClientStartupTime = GetTime();
|
||||
|
||||
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
|
||||
QObject(parent), optionsModel(optionsModel),
|
||||
cachedNumBlocks(0), cachedNumBlocksOfPeers(0), cachedHashrate(0), pollTimer(0)
|
||||
cachedNumBlocks(0), cachedNumBlocksOfPeers(0),
|
||||
cachedReindexing(0), cachedImporting(0),
|
||||
numBlocksAtStartup(-1), pollTimer(0)
|
||||
{
|
||||
numBlocksAtStartup = -1;
|
||||
|
||||
pollTimer = new QTimer(this);
|
||||
pollTimer->setInterval(MODEL_UPDATE_DELAY);
|
||||
pollTimer->start();
|
||||
@@ -48,43 +50,19 @@ int ClientModel::getNumBlocksAtStartup()
|
||||
return numBlocksAtStartup;
|
||||
}
|
||||
|
||||
int ClientModel::getHashrate() const
|
||||
{
|
||||
if (GetTimeMillis() - nHPSTimerStart > 8000)
|
||||
return (boost::int64_t)0;
|
||||
return (boost::int64_t)dHashesPerSec;
|
||||
}
|
||||
|
||||
// CasinoCoin: copied from bitcoinrpc.cpp.
|
||||
double ClientModel::GetDifficulty() const
|
||||
{
|
||||
// Floating point number that is a multiple of the minimum difficulty,
|
||||
// minimum difficulty = 1.0.
|
||||
|
||||
if (pindexBest == NULL)
|
||||
return 1.0;
|
||||
int nShift = (pindexBest->nBits >> 24) & 0xff;
|
||||
|
||||
double dDiff =
|
||||
(double)0x0000ffff / (double)(pindexBest->nBits & 0x00ffffff);
|
||||
|
||||
while (nShift < 29)
|
||||
{
|
||||
dDiff *= 256.0;
|
||||
nShift++;
|
||||
}
|
||||
while (nShift > 29)
|
||||
{
|
||||
dDiff /= 256.0;
|
||||
nShift--;
|
||||
}
|
||||
|
||||
return dDiff;
|
||||
}
|
||||
|
||||
QDateTime ClientModel::getLastBlockDate() const
|
||||
{
|
||||
return QDateTime::fromTime_t(pindexBest->GetBlockTime());
|
||||
if (pindexBest)
|
||||
return QDateTime::fromTime_t(pindexBest->GetBlockTime());
|
||||
else if(!isTestNet())
|
||||
return QDateTime::fromTime_t(1231006505); // Genesis block's time
|
||||
else
|
||||
return QDateTime::fromTime_t(1296688602); // Genesis block's time (testnet)
|
||||
}
|
||||
|
||||
double ClientModel::getVerificationProgress() const
|
||||
{
|
||||
return Checkpoints::GuessVerificationProgress(pindexBest);
|
||||
}
|
||||
|
||||
void ClientModel::updateTimer()
|
||||
@@ -94,11 +72,18 @@ void ClientModel::updateTimer()
|
||||
int newNumBlocks = getNumBlocks();
|
||||
int newNumBlocksOfPeers = getNumBlocksOfPeers();
|
||||
|
||||
if(cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers)
|
||||
emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers);
|
||||
// check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
|
||||
if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers ||
|
||||
cachedReindexing != fReindex || cachedImporting != fImporting)
|
||||
{
|
||||
cachedNumBlocks = newNumBlocks;
|
||||
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
|
||||
cachedReindexing = fReindex;
|
||||
cachedImporting = fImporting;
|
||||
|
||||
cachedNumBlocks = newNumBlocks;
|
||||
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
|
||||
// ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
|
||||
emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
|
||||
}
|
||||
}
|
||||
|
||||
void ClientModel::updateNumConnections(int numConnections)
|
||||
@@ -116,13 +101,11 @@ void ClientModel::updateAlert(const QString &hash, int status)
|
||||
CAlert alert = CAlert::getAlertByHash(hash_256);
|
||||
if(!alert.IsNull())
|
||||
{
|
||||
emit error(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), false);
|
||||
emit message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), CClientUIInterface::ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// Emit a numBlocksChanged when the status message changes,
|
||||
// so that the view recomputes and updates the status bar.
|
||||
emit numBlocksChanged(getNumBlocks(), getNumBlocksOfPeers());
|
||||
emit alertsChanged(getStatusBarWarnings());
|
||||
}
|
||||
|
||||
bool ClientModel::isTestNet() const
|
||||
@@ -135,6 +118,18 @@ bool ClientModel::inInitialBlockDownload() const
|
||||
return IsInitialBlockDownload();
|
||||
}
|
||||
|
||||
enum BlockSource ClientModel::getBlockSource() const
|
||||
{
|
||||
if (fReindex)
|
||||
return BLOCK_SOURCE_REINDEX;
|
||||
else if (fImporting)
|
||||
return BLOCK_SOURCE_DISK;
|
||||
else if (getNumConnections() > 0)
|
||||
return BLOCK_SOURCE_NETWORK;
|
||||
|
||||
return BLOCK_SOURCE_NONE;
|
||||
}
|
||||
|
||||
int ClientModel::getNumBlocksOfPeers() const
|
||||
{
|
||||
return GetNumBlocksOfPeers();
|
||||
@@ -160,6 +155,11 @@ QString ClientModel::formatBuildDate() const
|
||||
return QString::fromStdString(CLIENT_DATE);
|
||||
}
|
||||
|
||||
bool ClientModel::isReleaseVersion() const
|
||||
{
|
||||
return CLIENT_VERSION_IS_RELEASE;
|
||||
}
|
||||
|
||||
QString ClientModel::clientName() const
|
||||
{
|
||||
return QString::fromStdString(CLIENT_NAME);
|
||||
|
||||
@@ -13,10 +13,18 @@ class QDateTime;
|
||||
class QTimer;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
enum BlockSource {
|
||||
BLOCK_SOURCE_NONE,
|
||||
BLOCK_SOURCE_REINDEX,
|
||||
BLOCK_SOURCE_DISK,
|
||||
BLOCK_SOURCE_NETWORK
|
||||
};
|
||||
|
||||
/** Model for Bitcoin network client. */
|
||||
class ClientModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
|
||||
~ClientModel();
|
||||
@@ -27,15 +35,15 @@ public:
|
||||
int getNumBlocks() const;
|
||||
int getNumBlocksAtStartup();
|
||||
|
||||
int getHashrate() const;
|
||||
double GetDifficulty() const;
|
||||
|
||||
double getVerificationProgress() const;
|
||||
QDateTime getLastBlockDate() const;
|
||||
|
||||
//! Return true if client connected to testnet
|
||||
bool isTestNet() const;
|
||||
//! Return true if core is doing initial block download
|
||||
bool inInitialBlockDownload() const;
|
||||
//! Return true if core is importing blocks
|
||||
enum BlockSource getBlockSource() const;
|
||||
//! Return conservative estimate of total number of blocks, or 0 if unknown
|
||||
int getNumBlocksOfPeers() const;
|
||||
//! Return warnings to be displayed in status bar
|
||||
@@ -43,6 +51,7 @@ public:
|
||||
|
||||
QString formatFullVersion() const;
|
||||
QString formatBuildDate() const;
|
||||
bool isReleaseVersion() const;
|
||||
QString clientName() const;
|
||||
QString formatClientStartupTime() const;
|
||||
|
||||
@@ -51,7 +60,8 @@ private:
|
||||
|
||||
int cachedNumBlocks;
|
||||
int cachedNumBlocksOfPeers;
|
||||
int cachedHashrate;
|
||||
bool cachedReindexing;
|
||||
bool cachedImporting;
|
||||
|
||||
int numBlocksAtStartup;
|
||||
|
||||
@@ -59,12 +69,14 @@ private:
|
||||
|
||||
void subscribeToCoreSignals();
|
||||
void unsubscribeFromCoreSignals();
|
||||
|
||||
signals:
|
||||
void numConnectionsChanged(int count);
|
||||
void numBlocksChanged(int count, int countOfPeers);
|
||||
void alertsChanged(const QString &warnings);
|
||||
|
||||
//! Asynchronous error notification
|
||||
void error(const QString &title, const QString &message, bool modal);
|
||||
//! Asynchronous message notification
|
||||
void message(const QString &title, const QString &message, unsigned int style);
|
||||
|
||||
public slots:
|
||||
void updateTimer();
|
||||
|
||||
773
src/qt/coincontroldialog.cpp
Normal file
773
src/qt/coincontroldialog.cpp
Normal file
@@ -0,0 +1,773 @@
|
||||
#include "coincontroldialog.h"
|
||||
#include "ui_coincontroldialog.h"
|
||||
|
||||
#include "init.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include "walletmodel.h"
|
||||
#include "addresstablemodel.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "guiutil.h"
|
||||
#include "coincontrol.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QClipboard>
|
||||
#include <QColor>
|
||||
#include <QCursor>
|
||||
#include <QDateTime>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFlags>
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
using namespace std;
|
||||
QList<qint64> CoinControlDialog::payAmounts;
|
||||
CCoinControl* CoinControlDialog::coinControl = new CCoinControl();
|
||||
|
||||
CoinControlDialog::CoinControlDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CoinControlDialog),
|
||||
model(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// context menu actions
|
||||
QAction *copyAddressAction = new QAction(tr("Copy address"), this);
|
||||
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
||||
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
||||
copyTransactionHashAction = new QAction(tr("Copy transaction ID"), this); // we need to enable/disable this
|
||||
lockAction = new QAction(tr("Lock unspent"), this); // we need to enable/disable this
|
||||
unlockAction = new QAction(tr("Unlock unspent"), this); // we need to enable/disable this
|
||||
|
||||
// context menu
|
||||
contextMenu = new QMenu();
|
||||
contextMenu->addAction(copyAddressAction);
|
||||
contextMenu->addAction(copyLabelAction);
|
||||
contextMenu->addAction(copyAmountAction);
|
||||
contextMenu->addAction(copyTransactionHashAction);
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(lockAction);
|
||||
contextMenu->addAction(unlockAction);
|
||||
|
||||
// context menu signals
|
||||
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint)));
|
||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
|
||||
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
|
||||
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
|
||||
connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash()));
|
||||
connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin()));
|
||||
connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin()));
|
||||
|
||||
// clipboard actions
|
||||
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
|
||||
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this);
|
||||
QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this);
|
||||
QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this);
|
||||
QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this);
|
||||
QAction *clipboardPriorityAction = new QAction(tr("Copy priority"), this);
|
||||
QAction *clipboardLowOutputAction = new QAction(tr("Copy low output"), this);
|
||||
QAction *clipboardChangeAction = new QAction(tr("Copy change"), this);
|
||||
|
||||
connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity()));
|
||||
connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount()));
|
||||
connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee()));
|
||||
connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee()));
|
||||
connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes()));
|
||||
connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority()));
|
||||
connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput()));
|
||||
connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange()));
|
||||
|
||||
ui->labelCoinControlQuantity->addAction(clipboardQuantityAction);
|
||||
ui->labelCoinControlAmount->addAction(clipboardAmountAction);
|
||||
ui->labelCoinControlFee->addAction(clipboardFeeAction);
|
||||
ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction);
|
||||
ui->labelCoinControlBytes->addAction(clipboardBytesAction);
|
||||
ui->labelCoinControlPriority->addAction(clipboardPriorityAction);
|
||||
ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction);
|
||||
ui->labelCoinControlChange->addAction(clipboardChangeAction);
|
||||
|
||||
// toggle tree/list mode
|
||||
connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool)));
|
||||
connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool)));
|
||||
|
||||
// click on checkbox
|
||||
connect(ui->treeWidget, SIGNAL(itemChanged( QTreeWidgetItem*, int)), this, SLOT(viewItemChanged( QTreeWidgetItem*, int)));
|
||||
|
||||
// click on header
|
||||
#if QT_VERSION < 0x050000
|
||||
ui->treeWidget->header()->setClickable(true);
|
||||
#else
|
||||
ui->treeWidget->header()->setSectionsClickable(true);
|
||||
#endif
|
||||
connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int)));
|
||||
|
||||
// ok button
|
||||
connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*)));
|
||||
|
||||
// (un)select all
|
||||
connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked()));
|
||||
|
||||
ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_LABEL, 170);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 290);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_DATE, 110);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_PRIORITY, 100);
|
||||
ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transacton hash in this column, but dont show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but dont show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_AMOUNT_INT64, true); // store amount int64 in this column, but dont show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_PRIORITY_INT64, true); // store priority int64 in this column, but dont show it
|
||||
|
||||
// default view is sorted by amount desc
|
||||
sortView(COLUMN_AMOUNT_INT64, Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
CoinControlDialog::~CoinControlDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CoinControlDialog::setModel(WalletModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
|
||||
if(model && model->getOptionsModel() && model->getAddressTableModel())
|
||||
{
|
||||
updateView();
|
||||
updateLabelLocked();
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
}
|
||||
|
||||
// helper function str_pad
|
||||
QString CoinControlDialog::strPad(QString s, int nPadLength, QString sPadding)
|
||||
{
|
||||
while (s.length() < nPadLength)
|
||||
s = sPadding + s;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// ok button
|
||||
void CoinControlDialog::buttonBoxClicked(QAbstractButton* button)
|
||||
{
|
||||
if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
done(QDialog::Accepted); // closes the dialog
|
||||
}
|
||||
|
||||
// (un)select all
|
||||
void CoinControlDialog::buttonSelectAllClicked()
|
||||
{
|
||||
Qt::CheckState state = Qt::Checked;
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
|
||||
{
|
||||
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != Qt::Unchecked)
|
||||
{
|
||||
state = Qt::Unchecked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->treeWidget->setEnabled(false);
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
|
||||
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
|
||||
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
|
||||
ui->treeWidget->setEnabled(true);
|
||||
if (state == Qt::Unchecked)
|
||||
coinControl->UnSelectAll(); // just to be sure
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
|
||||
// context menu
|
||||
void CoinControlDialog::showMenu(const QPoint &point)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if(item)
|
||||
{
|
||||
contextMenuItem = item;
|
||||
|
||||
// disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu
|
||||
if (item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode)
|
||||
{
|
||||
copyTransactionHashAction->setEnabled(true);
|
||||
if (model->isLockedCoin(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt()))
|
||||
{
|
||||
lockAction->setEnabled(false);
|
||||
unlockAction->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
lockAction->setEnabled(true);
|
||||
unlockAction->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else // this means click on parent node in tree mode -> disable all
|
||||
{
|
||||
copyTransactionHashAction->setEnabled(false);
|
||||
lockAction->setEnabled(false);
|
||||
unlockAction->setEnabled(false);
|
||||
}
|
||||
|
||||
// show context menu
|
||||
contextMenu->exec(QCursor::pos());
|
||||
}
|
||||
}
|
||||
|
||||
// context menu action: copy amount
|
||||
void CoinControlDialog::copyAmount()
|
||||
{
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_AMOUNT));
|
||||
}
|
||||
|
||||
// context menu action: copy label
|
||||
void CoinControlDialog::copyLabel()
|
||||
{
|
||||
if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_LABEL).length() == 0 && contextMenuItem->parent())
|
||||
GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_LABEL));
|
||||
else
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_LABEL));
|
||||
}
|
||||
|
||||
// context menu action: copy address
|
||||
void CoinControlDialog::copyAddress()
|
||||
{
|
||||
if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_ADDRESS).length() == 0 && contextMenuItem->parent())
|
||||
GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_ADDRESS));
|
||||
else
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_ADDRESS));
|
||||
}
|
||||
|
||||
// context menu action: copy transaction id
|
||||
void CoinControlDialog::copyTransactionHash()
|
||||
{
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_TXHASH));
|
||||
}
|
||||
|
||||
// context menu action: lock coin
|
||||
void CoinControlDialog::lockCoin()
|
||||
{
|
||||
if (contextMenuItem->checkState(COLUMN_CHECKBOX) == Qt::Checked)
|
||||
contextMenuItem->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||
|
||||
COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
model->lockCoin(outpt);
|
||||
contextMenuItem->setDisabled(true);
|
||||
contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
|
||||
updateLabelLocked();
|
||||
}
|
||||
|
||||
// context menu action: unlock coin
|
||||
void CoinControlDialog::unlockCoin()
|
||||
{
|
||||
COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
model->unlockCoin(outpt);
|
||||
contextMenuItem->setDisabled(false);
|
||||
contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon());
|
||||
updateLabelLocked();
|
||||
}
|
||||
|
||||
// copy label "Quantity" to clipboard
|
||||
void CoinControlDialog::clipboardQuantity()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlQuantity->text());
|
||||
}
|
||||
|
||||
// copy label "Amount" to clipboard
|
||||
void CoinControlDialog::clipboardAmount()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" ")));
|
||||
}
|
||||
|
||||
// copy label "Fee" to clipboard
|
||||
void CoinControlDialog::clipboardFee()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")));
|
||||
}
|
||||
|
||||
// copy label "After fee" to clipboard
|
||||
void CoinControlDialog::clipboardAfterFee()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")));
|
||||
}
|
||||
|
||||
// copy label "Bytes" to clipboard
|
||||
void CoinControlDialog::clipboardBytes()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlBytes->text());
|
||||
}
|
||||
|
||||
// copy label "Priority" to clipboard
|
||||
void CoinControlDialog::clipboardPriority()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlPriority->text());
|
||||
}
|
||||
|
||||
// copy label "Low output" to clipboard
|
||||
void CoinControlDialog::clipboardLowOutput()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text());
|
||||
}
|
||||
|
||||
// copy label "Change" to clipboard
|
||||
void CoinControlDialog::clipboardChange()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")));
|
||||
}
|
||||
|
||||
// treeview: sort
|
||||
void CoinControlDialog::sortView(int column, Qt::SortOrder order)
|
||||
{
|
||||
sortColumn = column;
|
||||
sortOrder = order;
|
||||
ui->treeWidget->sortItems(column, order);
|
||||
ui->treeWidget->header()->setSortIndicator((sortColumn == COLUMN_AMOUNT_INT64 ? COLUMN_AMOUNT : (sortColumn == COLUMN_PRIORITY_INT64 ? COLUMN_PRIORITY : sortColumn)), sortOrder);
|
||||
}
|
||||
|
||||
// treeview: clicked on header
|
||||
void CoinControlDialog::headerSectionClicked(int logicalIndex)
|
||||
{
|
||||
if (logicalIndex == COLUMN_CHECKBOX) // click on most left column -> do nothing
|
||||
{
|
||||
ui->treeWidget->header()->setSortIndicator((sortColumn == COLUMN_AMOUNT_INT64 ? COLUMN_AMOUNT : (sortColumn == COLUMN_PRIORITY_INT64 ? COLUMN_PRIORITY : sortColumn)), sortOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logicalIndex == COLUMN_AMOUNT) // sort by amount
|
||||
logicalIndex = COLUMN_AMOUNT_INT64;
|
||||
|
||||
if (logicalIndex == COLUMN_PRIORITY) // sort by priority
|
||||
logicalIndex = COLUMN_PRIORITY_INT64;
|
||||
|
||||
if (sortColumn == logicalIndex)
|
||||
sortOrder = ((sortOrder == Qt::AscendingOrder) ? Qt::DescendingOrder : Qt::AscendingOrder);
|
||||
else
|
||||
{
|
||||
sortColumn = logicalIndex;
|
||||
sortOrder = ((sortColumn == COLUMN_AMOUNT_INT64 || sortColumn == COLUMN_PRIORITY_INT64 || sortColumn == COLUMN_DATE || sortColumn == COLUMN_CONFIRMATIONS) ? Qt::DescendingOrder : Qt::AscendingOrder); // if amount,date,conf,priority then default => desc, else default => asc
|
||||
}
|
||||
|
||||
sortView(sortColumn, sortOrder);
|
||||
}
|
||||
}
|
||||
|
||||
// toggle tree mode
|
||||
void CoinControlDialog::radioTreeMode(bool checked)
|
||||
{
|
||||
if (checked && model)
|
||||
updateView();
|
||||
}
|
||||
|
||||
// toggle list mode
|
||||
void CoinControlDialog::radioListMode(bool checked)
|
||||
{
|
||||
if (checked && model)
|
||||
updateView();
|
||||
}
|
||||
|
||||
// checkbox clicked by user
|
||||
void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
|
||||
{
|
||||
if (column == COLUMN_CHECKBOX && item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode)
|
||||
{
|
||||
COutPoint outpt(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
|
||||
if (item->checkState(COLUMN_CHECKBOX) == Qt::Unchecked)
|
||||
coinControl->UnSelect(outpt);
|
||||
else if (item->isDisabled()) // locked (this happens if "check all" through parent node)
|
||||
item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||
else
|
||||
coinControl->Select(outpt);
|
||||
|
||||
// selection changed -> update labels
|
||||
if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
}
|
||||
|
||||
// helper function, return human readable label for priority number
|
||||
QString CoinControlDialog::getPriorityLabel(double dPriority)
|
||||
{
|
||||
if (CTransaction::AllowFree(dPriority)) // at least medium
|
||||
{
|
||||
if (CTransaction::AllowFree(dPriority / 10000)) return tr("highest");
|
||||
else if (CTransaction::AllowFree(dPriority / 1000)) return tr("high");
|
||||
else if (CTransaction::AllowFree(dPriority / 100)) return tr("medium-high");
|
||||
else return tr("medium");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CTransaction::AllowFree(dPriority * 100)) return tr("low-medium");
|
||||
else if (CTransaction::AllowFree(dPriority * 10000)) return tr("low");
|
||||
else return tr("lowest");
|
||||
}
|
||||
}
|
||||
|
||||
// shows count of locked unspent outputs
|
||||
void CoinControlDialog::updateLabelLocked()
|
||||
{
|
||||
vector<COutPoint> vOutpts;
|
||||
model->listLockedCoins(vOutpts);
|
||||
if (vOutpts.size() > 0)
|
||||
{
|
||||
ui->labelLocked->setText(tr("(%1 locked)").arg(vOutpts.size()));
|
||||
ui->labelLocked->setVisible(true);
|
||||
}
|
||||
else ui->labelLocked->setVisible(false);
|
||||
}
|
||||
|
||||
void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
{
|
||||
if (!model) return;
|
||||
|
||||
// nPayAmount
|
||||
qint64 nPayAmount = 0;
|
||||
bool fLowOutput = false;
|
||||
bool fDust = false;
|
||||
unsigned int nQuantityDust = 0;
|
||||
CTransaction txDummy;
|
||||
foreach(const qint64 &amount, CoinControlDialog::payAmounts)
|
||||
{
|
||||
nPayAmount += amount;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
if (amount < CENT) {
|
||||
fLowOutput = true;
|
||||
nQuantityDust++;
|
||||
}
|
||||
|
||||
CTxOut txout(amount, (CScript)vector<unsigned char>(24, 0));
|
||||
txDummy.vout.push_back(txout);
|
||||
if (txout.IsDust())
|
||||
fDust = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString sPriorityLabel = "";
|
||||
int64 nAmount = 0;
|
||||
int64 nPayFee = 0;
|
||||
int64 nAfterFee = 0;
|
||||
int64 nChange = 0;
|
||||
unsigned int nBytes = 0;
|
||||
unsigned int nBytesInputs = 0;
|
||||
double dPriority = 0;
|
||||
double dPriorityInputs = 0;
|
||||
unsigned int nQuantity = 0;
|
||||
|
||||
vector<COutPoint> vCoinControl;
|
||||
vector<COutput> vOutputs;
|
||||
coinControl->ListSelected(vCoinControl);
|
||||
model->getOutputs(vCoinControl, vOutputs);
|
||||
|
||||
BOOST_FOREACH(const COutput& out, vOutputs)
|
||||
{
|
||||
// unselect already spent, very unlikely scenario, this could happen when selected are spent elsewhere, like rpc or another computer
|
||||
if (out.tx->IsSpent(out.i))
|
||||
{
|
||||
uint256 txhash = out.tx->GetHash();
|
||||
COutPoint outpt(txhash, out.i);
|
||||
coinControl->UnSelect(outpt);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Quantity
|
||||
nQuantity++;
|
||||
|
||||
// Amount
|
||||
nAmount += out.tx->vout[out.i].nValue;
|
||||
|
||||
// Priority
|
||||
dPriorityInputs += (double)out.tx->vout[out.i].nValue * (out.nDepth+1);
|
||||
|
||||
// Bytes
|
||||
CTxDestination address;
|
||||
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
|
||||
{
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get<CKeyID>(&address);
|
||||
if (keyid && model->getPubKey(*keyid, pubkey))
|
||||
nBytesInputs += (pubkey.IsCompressed() ? 148 : 180);
|
||||
else
|
||||
nBytesInputs += 148; // in all error cases, simply assume 148 here
|
||||
}
|
||||
else nBytesInputs += 148;
|
||||
}
|
||||
|
||||
// calculation
|
||||
if (nQuantity > 0)
|
||||
{
|
||||
// Bytes
|
||||
nBytes = nBytesInputs + ((CoinControlDialog::payAmounts.size() > 0 ? CoinControlDialog::payAmounts.size() + 1 : 2) * 34) + 10; // always assume +1 output for change here
|
||||
|
||||
// Priority
|
||||
dPriority = dPriorityInputs / nBytes;
|
||||
sPriorityLabel = CoinControlDialog::getPriorityLabel(dPriority);
|
||||
|
||||
// Fee
|
||||
int64 nFee = nTransactionFee * (1 + (int64)nBytes / 1000);
|
||||
|
||||
// Min Fee
|
||||
int64 nMinFee = CTransaction::nMinTxFee * (1 + (int64)nBytes / 1000) + CTransaction::nMinTxFee * nQuantityDust;
|
||||
if (CTransaction::AllowFree(dPriority) && nBytes < 5000)
|
||||
nMinFee = 0;
|
||||
|
||||
nPayFee = max(nFee, nMinFee);
|
||||
|
||||
if (nPayAmount > 0)
|
||||
{
|
||||
nChange = nAmount - nPayFee - nPayAmount;
|
||||
|
||||
// require CTransaction::nMinTxFee if any output is less than 0.01
|
||||
if (nPayFee < CTransaction::nMinTxFee && fLowOutput)
|
||||
{
|
||||
nChange = nChange + nPayFee - CTransaction::nMinTxFee;
|
||||
nPayFee = CTransaction::nMinTxFee * nQuantityDust;
|
||||
}
|
||||
|
||||
// if sub-cent change is required, the fee must be raised to at least CTransaction::nMinTxFee
|
||||
if (nPayFee < CTransaction::nMinTxFee && nChange > 0 && nChange < CENT)
|
||||
{
|
||||
if (nChange < CTransaction::nMinTxFee) // change < 0.0001 => simply move all change to fees
|
||||
{
|
||||
nPayFee += nChange;
|
||||
nChange = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
nChange = nChange + nPayFee - CTransaction::nMinTxFee;
|
||||
nPayFee = CTransaction::nMinTxFee;
|
||||
}
|
||||
}
|
||||
|
||||
// Never create dust outputs; if we would, just add the dust to the fee.
|
||||
if (nChange > 0 && nChange < CENT)
|
||||
{
|
||||
CTxOut txout(nChange, (CScript)vector<unsigned char>(24, 0));
|
||||
if (txout.IsDust())
|
||||
{
|
||||
nPayFee += nChange;
|
||||
nChange = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (nChange == 0)
|
||||
nBytes -= 34;
|
||||
}
|
||||
|
||||
// after fee
|
||||
nAfterFee = nAmount - nPayFee;
|
||||
if (nAfterFee < 0)
|
||||
nAfterFee = 0;
|
||||
}
|
||||
|
||||
// actually update labels
|
||||
int nDisplayUnit = BitcoinUnits::BTC;
|
||||
if (model && model->getOptionsModel())
|
||||
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
QLabel *l1 = dialog->findChild<QLabel *>("labelCoinControlQuantity");
|
||||
QLabel *l2 = dialog->findChild<QLabel *>("labelCoinControlAmount");
|
||||
QLabel *l3 = dialog->findChild<QLabel *>("labelCoinControlFee");
|
||||
QLabel *l4 = dialog->findChild<QLabel *>("labelCoinControlAfterFee");
|
||||
QLabel *l5 = dialog->findChild<QLabel *>("labelCoinControlBytes");
|
||||
QLabel *l6 = dialog->findChild<QLabel *>("labelCoinControlPriority");
|
||||
QLabel *l7 = dialog->findChild<QLabel *>("labelCoinControlLowOutput");
|
||||
QLabel *l8 = dialog->findChild<QLabel *>("labelCoinControlChange");
|
||||
|
||||
// enable/disable "low output" and "change"
|
||||
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setEnabled(nPayAmount > 0);
|
||||
dialog->findChild<QLabel *>("labelCoinControlLowOutput") ->setEnabled(nPayAmount > 0);
|
||||
dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setEnabled(nPayAmount > 0);
|
||||
dialog->findChild<QLabel *>("labelCoinControlChange") ->setEnabled(nPayAmount > 0);
|
||||
|
||||
// stats
|
||||
l1->setText(QString::number(nQuantity)); // Quantity
|
||||
l2->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount
|
||||
l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee
|
||||
l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
|
||||
l5->setText(((nBytes > 0) ? "~" : "") + QString::number(nBytes)); // Bytes
|
||||
l6->setText(sPriorityLabel); // Priority
|
||||
l7->setText((fLowOutput ? (fDust ? tr("DUST") : tr("yes")) : tr("no"))); // Low Output / Dust
|
||||
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
|
||||
|
||||
// turn labels "red"
|
||||
l5->setStyleSheet((nBytes >= 5000) ? "color:red;" : ""); // Bytes >= 5000
|
||||
l6->setStyleSheet((!CTransaction::AllowFree(dPriority)) ? "color:red;" : ""); // Priority < "medium"
|
||||
l7->setStyleSheet((fLowOutput) ? "color:red;" : ""); // Low Output = "yes"
|
||||
l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01BTC
|
||||
|
||||
// tool tips
|
||||
l5->setToolTip(tr("This label turns red, if the transaction size is bigger than 5000 bytes.\n\n This means a fee of at least %1 per kb is required.\n\n Can vary +/- 1 Byte per input.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
|
||||
l6->setToolTip(tr("Transactions with higher priority get more likely into a block.\n\nThis label turns red, if the priority is smaller than \"medium\".\n\n This means a fee of at least %1 per kb is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
|
||||
l7->setToolTip(tr("This label turns red, if any recipient receives an amount smaller than %1.\n\n This means a fee of at least %2 is required. \n\n Amounts below 0.546 times the minimum relay fee are shown as DUST.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
|
||||
l8->setToolTip(tr("This label turns red, if the change is smaller than %1.\n\n This means a fee of at least %2 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)));
|
||||
dialog->findChild<QLabel *>("labelCoinControlBytesText") ->setToolTip(l5->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlPriorityText") ->setToolTip(l6->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setToolTip(l8->toolTip());
|
||||
|
||||
// Insufficient funds
|
||||
QLabel *label = dialog->findChild<QLabel *>("labelCoinControlInsuffFunds");
|
||||
if (label)
|
||||
label->setVisible(nChange < 0);
|
||||
}
|
||||
|
||||
void CoinControlDialog::updateView()
|
||||
{
|
||||
bool treeMode = ui->radioTreeMode->isChecked();
|
||||
|
||||
ui->treeWidget->clear();
|
||||
ui->treeWidget->setEnabled(false); // performance, otherwise updateLabels would be called for every checked checkbox
|
||||
ui->treeWidget->setAlternatingRowColors(!treeMode);
|
||||
QFlags<Qt::ItemFlag> flgCheckbox=Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
|
||||
QFlags<Qt::ItemFlag> flgTristate=Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
|
||||
|
||||
int nDisplayUnit = BitcoinUnits::BTC;
|
||||
if (model && model->getOptionsModel())
|
||||
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
map<QString, vector<COutput> > mapCoins;
|
||||
model->listCoins(mapCoins);
|
||||
|
||||
BOOST_FOREACH(PAIRTYPE(QString, vector<COutput>) coins, mapCoins)
|
||||
{
|
||||
QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem();
|
||||
QString sWalletAddress = coins.first;
|
||||
QString sWalletLabel = "";
|
||||
if (model->getAddressTableModel())
|
||||
sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
|
||||
if (sWalletLabel.length() == 0)
|
||||
sWalletLabel = tr("(no label)");
|
||||
|
||||
if (treeMode)
|
||||
{
|
||||
// wallet address
|
||||
ui->treeWidget->addTopLevelItem(itemWalletAddress);
|
||||
|
||||
itemWalletAddress->setFlags(flgTristate);
|
||||
itemWalletAddress->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
|
||||
|
||||
for (int i = 0; i < ui->treeWidget->columnCount(); i++)
|
||||
itemWalletAddress->setBackground(i, QColor(248, 247, 246));
|
||||
|
||||
// label
|
||||
itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel);
|
||||
|
||||
// address
|
||||
itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress);
|
||||
}
|
||||
|
||||
int64 nSum = 0;
|
||||
double dPrioritySum = 0;
|
||||
int nChildren = 0;
|
||||
int nInputSum = 0;
|
||||
BOOST_FOREACH(const COutput& out, coins.second)
|
||||
{
|
||||
int nInputSize = 148; // 180 if uncompressed public key
|
||||
nSum += out.tx->vout[out.i].nValue;
|
||||
nChildren++;
|
||||
|
||||
QTreeWidgetItem *itemOutput;
|
||||
if (treeMode) itemOutput = new QTreeWidgetItem(itemWalletAddress);
|
||||
else itemOutput = new QTreeWidgetItem(ui->treeWidget);
|
||||
itemOutput->setFlags(flgCheckbox);
|
||||
itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
|
||||
|
||||
// address
|
||||
CTxDestination outputAddress;
|
||||
QString sAddress = "";
|
||||
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress))
|
||||
{
|
||||
sAddress = CBitcoinAddress(outputAddress).ToString().c_str();
|
||||
|
||||
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
|
||||
if (!treeMode || (!(sAddress == sWalletAddress)))
|
||||
itemOutput->setText(COLUMN_ADDRESS, sAddress);
|
||||
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get<CKeyID>(&outputAddress);
|
||||
if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed())
|
||||
nInputSize = 180;
|
||||
}
|
||||
|
||||
// label
|
||||
if (!(sAddress == sWalletAddress)) // change
|
||||
{
|
||||
// tooltip from where the change comes from
|
||||
itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress));
|
||||
itemOutput->setText(COLUMN_LABEL, tr("(change)"));
|
||||
}
|
||||
else if (!treeMode)
|
||||
{
|
||||
QString sLabel = "";
|
||||
if (model->getAddressTableModel())
|
||||
sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
|
||||
if (sLabel.length() == 0)
|
||||
sLabel = tr("(no label)");
|
||||
itemOutput->setText(COLUMN_LABEL, sLabel);
|
||||
}
|
||||
|
||||
// amount
|
||||
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->vout[out.i].nValue));
|
||||
itemOutput->setText(COLUMN_AMOUNT_INT64, strPad(QString::number(out.tx->vout[out.i].nValue), 15, " ")); // padding so that sorting works correctly
|
||||
|
||||
// date
|
||||
itemOutput->setText(COLUMN_DATE, QDateTime::fromTime_t(out.tx->GetTxTime()).toString("yy-MM-dd hh:mm"));
|
||||
|
||||
// confirmations
|
||||
itemOutput->setText(COLUMN_CONFIRMATIONS, strPad(QString::number(out.nDepth), 8, " "));
|
||||
|
||||
// priority
|
||||
double dPriority = ((double)out.tx->vout[out.i].nValue / (nInputSize + 78)) * (out.nDepth+1); // 78 = 2 * 34 + 10
|
||||
itemOutput->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPriority));
|
||||
itemOutput->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64)dPriority), 20, " "));
|
||||
dPrioritySum += (double)out.tx->vout[out.i].nValue * (out.nDepth+1);
|
||||
nInputSum += nInputSize;
|
||||
|
||||
// transaction hash
|
||||
uint256 txhash = out.tx->GetHash();
|
||||
itemOutput->setText(COLUMN_TXHASH, txhash.GetHex().c_str());
|
||||
|
||||
// vout index
|
||||
itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));
|
||||
|
||||
// disable locked coins
|
||||
if (model->isLockedCoin(txhash, out.i))
|
||||
{
|
||||
COutPoint outpt(txhash, out.i);
|
||||
coinControl->UnSelect(outpt); // just to be sure
|
||||
itemOutput->setDisabled(true);
|
||||
itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
|
||||
}
|
||||
|
||||
// set checkbox
|
||||
if (coinControl->IsSelected(txhash, out.i))
|
||||
itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Checked);
|
||||
}
|
||||
|
||||
// amount
|
||||
if (treeMode)
|
||||
{
|
||||
dPrioritySum = dPrioritySum / (nInputSum + 78);
|
||||
itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")");
|
||||
itemWalletAddress->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum));
|
||||
itemWalletAddress->setText(COLUMN_AMOUNT_INT64, strPad(QString::number(nSum), 15, " "));
|
||||
itemWalletAddress->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPrioritySum));
|
||||
itemWalletAddress->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64)dPrioritySum), 20, " "));
|
||||
}
|
||||
}
|
||||
|
||||
// expand all partially selected
|
||||
if (treeMode)
|
||||
{
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
|
||||
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked)
|
||||
ui->treeWidget->topLevelItem(i)->setExpanded(true);
|
||||
}
|
||||
|
||||
// sort view
|
||||
sortView(sortColumn, sortOrder);
|
||||
ui->treeWidget->setEnabled(true);
|
||||
}
|
||||
92
src/qt/coincontroldialog.h
Normal file
92
src/qt/coincontroldialog.h
Normal file
@@ -0,0 +1,92 @@
|
||||
#ifndef COINCONTROLDIALOG_H
|
||||
#define COINCONTROLDIALOG_H
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QAction>
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
namespace Ui {
|
||||
class CoinControlDialog;
|
||||
}
|
||||
class WalletModel;
|
||||
class CCoinControl;
|
||||
|
||||
class CoinControlDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CoinControlDialog(QWidget *parent = 0);
|
||||
~CoinControlDialog();
|
||||
|
||||
void setModel(WalletModel *model);
|
||||
|
||||
// static because also called from sendcoinsdialog
|
||||
static void updateLabels(WalletModel*, QDialog*);
|
||||
static QString getPriorityLabel(double);
|
||||
|
||||
static QList<qint64> payAmounts;
|
||||
static CCoinControl *coinControl;
|
||||
|
||||
private:
|
||||
Ui::CoinControlDialog *ui;
|
||||
WalletModel *model;
|
||||
int sortColumn;
|
||||
Qt::SortOrder sortOrder;
|
||||
|
||||
QMenu *contextMenu;
|
||||
QTreeWidgetItem *contextMenuItem;
|
||||
QAction *copyTransactionHashAction;
|
||||
QAction *lockAction;
|
||||
QAction *unlockAction;
|
||||
|
||||
QString strPad(QString, int, QString);
|
||||
void sortView(int, Qt::SortOrder);
|
||||
void updateView();
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_CHECKBOX,
|
||||
COLUMN_AMOUNT,
|
||||
COLUMN_LABEL,
|
||||
COLUMN_ADDRESS,
|
||||
COLUMN_DATE,
|
||||
COLUMN_CONFIRMATIONS,
|
||||
COLUMN_PRIORITY,
|
||||
COLUMN_TXHASH,
|
||||
COLUMN_VOUT_INDEX,
|
||||
COLUMN_AMOUNT_INT64,
|
||||
COLUMN_PRIORITY_INT64
|
||||
};
|
||||
|
||||
private slots:
|
||||
void showMenu(const QPoint &);
|
||||
void copyAmount();
|
||||
void copyLabel();
|
||||
void copyAddress();
|
||||
void copyTransactionHash();
|
||||
void lockCoin();
|
||||
void unlockCoin();
|
||||
void clipboardQuantity();
|
||||
void clipboardAmount();
|
||||
void clipboardFee();
|
||||
void clipboardAfterFee();
|
||||
void clipboardBytes();
|
||||
void clipboardPriority();
|
||||
void clipboardLowOutput();
|
||||
void clipboardChange();
|
||||
void radioTreeMode(bool);
|
||||
void radioListMode(bool);
|
||||
void viewItemChanged(QTreeWidgetItem*, int);
|
||||
void headerSectionClicked(int);
|
||||
void buttonBoxClicked(QAbstractButton*);
|
||||
void buttonSelectAllClicked();
|
||||
void updateLabelLocked();
|
||||
};
|
||||
|
||||
#endif // COINCONTROLDIALOG_H
|
||||
28
src/qt/coincontroltreewidget.cpp
Normal file
28
src/qt/coincontroltreewidget.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "coincontroltreewidget.h"
|
||||
#include "coincontroldialog.h"
|
||||
|
||||
CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) :
|
||||
QTreeWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox
|
||||
{
|
||||
event->ignore();
|
||||
int COLUMN_CHECKBOX = 0;
|
||||
this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked));
|
||||
}
|
||||
else if (event->key() == Qt::Key_Escape) // press esc -> close dialog
|
||||
{
|
||||
event->ignore();
|
||||
CoinControlDialog *coinControlDialog = (CoinControlDialog*)this->parentWidget();
|
||||
coinControlDialog->done(QDialog::Accepted);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->QTreeWidget::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
17
src/qt/coincontroltreewidget.h
Normal file
17
src/qt/coincontroltreewidget.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef COINCONTROLTREEWIDGET_H
|
||||
#define COINCONTROLTREEWIDGET_H
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QTreeWidget>
|
||||
|
||||
class CoinControlTreeWidget : public QTreeWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CoinControlTreeWidget(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
};
|
||||
|
||||
#endif // COINCONTROLTREEWIDGET_H
|
||||
@@ -14,6 +14,7 @@ QT_END_NAMESPACE
|
||||
class CSVModelWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
|
||||
|
||||
@@ -36,11 +37,6 @@ private:
|
||||
int role;
|
||||
};
|
||||
QList<Column> columns;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // CSVMODELWRITER_H
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "editaddressdialog.h"
|
||||
#include "ui_editaddressdialog.h"
|
||||
|
||||
#include "addresstablemodel.h"
|
||||
#include "guiutil.h"
|
||||
|
||||
@@ -25,7 +26,7 @@ EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) :
|
||||
break;
|
||||
case EditReceivingAddress:
|
||||
setWindowTitle(tr("Edit receiving address"));
|
||||
ui->addressEdit->setDisabled(true);
|
||||
ui->addressEdit->setEnabled(false);
|
||||
break;
|
||||
case EditSendingAddress:
|
||||
setWindowTitle(tr("Edit sending address"));
|
||||
@@ -44,6 +45,9 @@ EditAddressDialog::~EditAddressDialog()
|
||||
void EditAddressDialog::setModel(AddressTableModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
mapper->setModel(model);
|
||||
mapper->addMapping(ui->labelEdit, AddressTableModel::Label);
|
||||
mapper->addMapping(ui->addressEdit, AddressTableModel::Address);
|
||||
@@ -58,6 +62,7 @@ bool EditAddressDialog::saveCurrentRow()
|
||||
{
|
||||
if(!model)
|
||||
return false;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case NewReceivingAddress:
|
||||
@@ -82,35 +87,39 @@ void EditAddressDialog::accept()
|
||||
{
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
if(!saveCurrentRow())
|
||||
{
|
||||
switch(model->getEditStatus())
|
||||
{
|
||||
case AddressTableModel::DUPLICATE_ADDRESS:
|
||||
QMessageBox::warning(this, windowTitle(),
|
||||
tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
case AddressTableModel::OK:
|
||||
// Failed with unknown reason. Just reject.
|
||||
break;
|
||||
case AddressTableModel::NO_CHANGES:
|
||||
// No changes were made during edit operation. Just reject.
|
||||
break;
|
||||
case AddressTableModel::INVALID_ADDRESS:
|
||||
QMessageBox::warning(this, windowTitle(),
|
||||
tr("The entered address \"%1\" is not a valid CasinoCoin address.").arg(ui->addressEdit->text()),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
break;
|
||||
case AddressTableModel::DUPLICATE_ADDRESS:
|
||||
QMessageBox::warning(this, windowTitle(),
|
||||
tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
case AddressTableModel::WALLET_UNLOCK_FAILURE:
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Could not unlock wallet."),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
break;
|
||||
case AddressTableModel::KEY_GENERATION_FAILURE:
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("New key generation failed."),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
case AddressTableModel::OK:
|
||||
// Failed with unknown reason. Just reject.
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
QDialog::accept();
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDataWidgetMapper;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class EditAddressDialog;
|
||||
}
|
||||
class AddressTableModel;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDataWidgetMapper;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/** Dialog for editing an address and associated information.
|
||||
*/
|
||||
class EditAddressDialog : public QDialog
|
||||
@@ -27,15 +27,17 @@ public:
|
||||
};
|
||||
|
||||
explicit EditAddressDialog(Mode mode, QWidget *parent = 0);
|
||||
~EditAddressDialog();
|
||||
~EditAddressDialog();
|
||||
|
||||
void setModel(AddressTableModel *model);
|
||||
void loadRow(int row);
|
||||
|
||||
void accept();
|
||||
|
||||
QString getAddress() const;
|
||||
void setAddress(const QString &address);
|
||||
|
||||
public slots:
|
||||
void accept();
|
||||
|
||||
private:
|
||||
bool saveCurrentRow();
|
||||
|
||||
|
||||
@@ -63,10 +63,7 @@
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.3.666-beta</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
<string notr="true">1.1.0.0</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
@@ -88,6 +85,23 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="copyrightLabel">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Copyright &copy; 2009-2014 The Bitcoin developers
|
||||
Copyright &copy; 2013-2014 The CasinoCoin developers</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="cursor">
|
||||
@@ -95,18 +109,14 @@
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>
|
||||
Copyright © 2009-2012 Bitcoin Developers
|
||||
Copyright © 2011-2012 Litecoin Developers
|
||||
Copyright © 2013 CasinoCoin Developers
|
||||
This is experimental software.
|
||||
|
||||
This is experimental software.
|
||||
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.
|
||||
|
||||
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.
|
||||
|
||||
Official forum: http://forum.casinoco.in
|
||||
</string>
|
||||
Official forum: http://forum.casinoco.in
|
||||
</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelExplanation">
|
||||
<property name="text">
|
||||
<string>These are your CasinoCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
@@ -58,7 +55,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="newAddressButton">
|
||||
<widget class="QPushButton" name="newAddress">
|
||||
<property name="toolTip">
|
||||
<string>Create a new address</string>
|
||||
</property>
|
||||
@@ -72,7 +69,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyToClipboard">
|
||||
<widget class="QPushButton" name="copyAddress">
|
||||
<property name="toolTip">
|
||||
<string>Copy the currently selected address to the system clipboard</string>
|
||||
</property>
|
||||
@@ -99,10 +96,10 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="signMessage">
|
||||
<property name="toolTip">
|
||||
<string>Sign a message to prove you own a Bitcoin address</string>
|
||||
<string>Sign a message to prove you own a CasinoCoin address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Sign Message</string>
|
||||
<string>Sign &Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
@@ -113,7 +110,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="verifyMessage">
|
||||
<property name="toolTip">
|
||||
<string>Verify a message to ensure it was signed with a specified Bitcoin address</string>
|
||||
<string>Verify a message to ensure it was signed with a specified CasinoCoin address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Verify Message</string>
|
||||
@@ -125,9 +122,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteButton">
|
||||
<widget class="QPushButton" name="deleteAddress">
|
||||
<property name="toolTip">
|
||||
<string>Delete the currently selected address from the list. Only sending addresses can be deleted.</string>
|
||||
<string>Delete the currently selected address from the list</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
@@ -151,6 +148,20 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="exportButton">
|
||||
<property name="toolTip">
|
||||
<string>Export the data in the current tab to a file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
<normaloff>:/icons/export</normaloff>:/icons/export</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
|
||||
556
src/qt/forms/coincontroldialog.ui
Normal file
556
src/qt/forms/coincontroldialog.ui
Normal file
@@ -0,0 +1,556 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CoinControlDialog</class>
|
||||
<widget class="QDialog" name="CoinControlDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Coin Control</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutTop" stretch="0,0,0,0">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl1">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlQuantityText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quantity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlQuantity">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlBytesText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bytes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlBytes">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlAmountText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Amount:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlAmount">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlPriorityText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Priority:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlPriority">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl3">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlFeeText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fee:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlFee">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlLowOutputText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Low Output:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlLowOutput">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>no</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl4">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlAfterFeeText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>After Fee:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlAfterFee">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlChangeText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlChange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutPanel" stretch="0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonSelectAll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>(un)select all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioTreeMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tree mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioListMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>List mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelLocked">
|
||||
<property name="text">
|
||||
<string>(1 locked)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CoinControlTreeWidget" name="treeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<attribute name="headerShowSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Amount</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">Label</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Confirmations</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Confirmed</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Priority</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CoinControlTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>coincontroltreewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -23,7 +23,7 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabMain">
|
||||
<attribute name="title">
|
||||
@@ -33,7 +33,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="transactionFeeInfoLabel">
|
||||
<property name="text">
|
||||
<string>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</string>
|
||||
<string>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
@@ -44,7 +44,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Main">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_1_Main">
|
||||
<item>
|
||||
<widget class="QLabel" name="transactionFeeLabel">
|
||||
<property name="text">
|
||||
@@ -62,7 +62,7 @@
|
||||
<widget class="BitcoinAmountField" name="transactionFee"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_Main">
|
||||
<spacer name="horizontalSpacer_1_Main">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -86,16 +86,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="detachDatabases">
|
||||
<property name="toolTip">
|
||||
<string>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Detach databases at shutdown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_Main">
|
||||
<property name="orientation">
|
||||
@@ -109,6 +99,36 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2_Main">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2_Main">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetButton">
|
||||
<property name="toolTip">
|
||||
<string>Reset all client options to default.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Reset Options</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabNetwork">
|
||||
@@ -343,6 +363,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="coinControlFeatures">
|
||||
<property name="toolTip">
|
||||
<string>Whether to show coin control features or not.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display coin &control features (experts only!)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_Display">
|
||||
<property name="orientation">
|
||||
@@ -432,12 +462,6 @@
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -13,308 +13,308 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
|
||||
<layout class="QVBoxLayout" name="topLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Wallet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelWalletStatus">
|
||||
<property name="toolTip">
|
||||
<string>The displayed information may be out of date. Your wallet automatically synchronizes with the CasinoCoin network after a connection is established, but this process has not completed yet.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { color: red; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">(out of sync)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Balance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelBalance">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Your current balance</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0 CSC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Unconfirmed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelUnconfirmed">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0 CSC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Number of transactions:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelNumTransactions">
|
||||
<property name="toolTip">
|
||||
<string>Total number of transactions in wallet</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelImmatureText">
|
||||
<property name="text">
|
||||
<string>Immature:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelImmature">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Mined balance that has not yet matured</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0 CSC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../bitcoin.qrc">:/images/backg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>-2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QLabel" name="labelAlerts">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000;</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><b>Recent transactions</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Wallet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelWalletStatus">
|
||||
<property name="toolTip">
|
||||
<string>The displayed information may be out of date. Your wallet automatically synchronizes with the CasinoCoin network after a connection is established, but this process has not completed yet.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { color: red; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">(out of sync)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTransactionsStatus">
|
||||
<property name="toolTip">
|
||||
<string>The displayed information may be out of date. Your wallet automatically synchronizes with the CasinoCoin network after a connection is established, but this process has not completed yet.</string>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { color: red; }</string>
|
||||
<property name="horizontalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">(out of sync)</string>
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Balance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelBalance">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Your current balance</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0 CSC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Unconfirmed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelUnconfirmed">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0 CSC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelImmatureText">
|
||||
<property name="text">
|
||||
<string>Immature:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelImmature">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Mined balance that has not yet matured</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0 CSC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listTransactions">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListView { background: transparent; }</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../bitcoin.qrc">:/images/backg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>-2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><b>Recent transactions</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTransactionsStatus">
|
||||
<property name="toolTip">
|
||||
<string>The displayed information may be out of date. Your wallet automatically synchronizes with the CasinoCoin network after a connection is established, but this process has not completed yet.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { color: red; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">(out of sync)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listTransactions">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListView { background: transparent; }</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../bitcoin.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bitcoin Core</string>
|
||||
<string>CasinoCoin Core</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -292,14 +292,14 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Debug logfile</string>
|
||||
<string>Debug log file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QPushButton" name="openDebugLogfileButton">
|
||||
<property name="toolTip">
|
||||
<string>Open the CasinoCoin debug logfile from the current data directory. This can take a few seconds for large logfiles.</string>
|
||||
<string>Open the CasinoCoin debug log file from the current data directory. This can take a few seconds for large log files.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Open</string>
|
||||
@@ -333,9 +333,6 @@
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
|
||||
@@ -6,14 +6,615 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>686</width>
|
||||
<height>217</height>
|
||||
<width>850</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Send Coins</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frameCoinControl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutCoinControl2">
|
||||
<property name="spacing">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutCoinControl" stretch="0,0,0,0,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl1">
|
||||
<property name="bottomMargin">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCoinControlFeatures">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Coin Control Features</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl2" stretch="0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonCoinControl">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Inputs...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCoinControlAutomaticallySelected">
|
||||
<property name="text">
|
||||
<string>automatically selected</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCoinControlInsuffFunds">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:red;font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Insufficient funds!</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerCoinControl">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetCoinControl" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl5">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl3" stretch="0,0,0,1">
|
||||
<property name="spacing">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl1">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlQuantityText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quantity:</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlQuantity">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlBytesText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bytes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlBytes">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlAmountText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Amount:</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlAmount">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlPriorityText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Priority:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlPriority">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>medium</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl3">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlFeeText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fee:</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlFee">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlLowOutputText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Low Output:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlLowOutput">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>no</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl4">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlAfterFeeText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>After Fee:</string>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlAfterFee">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlChangeText">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-weight:bold;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlChange">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Monospace</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl4" stretch="0,0,0">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxCoinControlChange">
|
||||
<property name="text">
|
||||
<string>custom change address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditCoinControlChange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCoinControlChangeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacerCoinControl">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
@@ -24,7 +625,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>666</width>
|
||||
<width>830</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -64,7 +665,7 @@
|
||||
<string>Send to multiple recipients at once</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add Recipient</string>
|
||||
<string>Add &Recipient</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
@@ -153,7 +754,7 @@
|
||||
<string>Confirm the send action</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Send</string>
|
||||
<string>S&end</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
|
||||
@@ -52,23 +52,6 @@
|
||||
<item row="5" column="1">
|
||||
<widget class="BitcoinAmountField" name="payAmount"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QValidatedLineEdit" name="addAsLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter a label for this address to add it to your address book</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
@@ -90,7 +73,7 @@
|
||||
<item>
|
||||
<widget class="QValidatedLineEdit" name="payTo">
|
||||
<property name="toolTip">
|
||||
<string>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
|
||||
<string>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>34</number>
|
||||
@@ -147,6 +130,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QValidatedLineEdit" name="addAsLabel">
|
||||
<property name="toolTip">
|
||||
<string>Enter a label for this address to add it to your address book</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<item>
|
||||
<widget class="QValidatedLineEdit" name="addressIn_SM">
|
||||
<property name="toolTip">
|
||||
<string>The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
|
||||
<string>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>34</number>
|
||||
@@ -104,6 +104,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="signatureLabel_SM">
|
||||
<property name="text">
|
||||
<string>Signature</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2_SM">
|
||||
<property name="spacing">
|
||||
@@ -145,10 +155,10 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="signMessageButton_SM">
|
||||
<property name="toolTip">
|
||||
<string>Sign the message to prove you own this Bitcoin address</string>
|
||||
<string>Sign the message to prove you own this CasinoCoin address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Sign Message</string>
|
||||
<string>Sign &Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
@@ -251,7 +261,7 @@
|
||||
<item>
|
||||
<widget class="QValidatedLineEdit" name="addressIn_VM">
|
||||
<property name="toolTip">
|
||||
<string>The address the message was signed with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
|
||||
<string>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>34</number>
|
||||
@@ -291,10 +301,10 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="verifyMessageButton_VM">
|
||||
<property name="toolTip">
|
||||
<string>Verify the message to ensure it was signed with the specified Bitcoin address</string>
|
||||
<string>Verify the message to ensure it was signed with the specified CasinoCoin address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Verify Message</string>
|
||||
<string>Verify &Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define GUICONSTANTS_H
|
||||
|
||||
/* Milliseconds between model updates */
|
||||
static const int MODEL_UPDATE_DELAY = 500;
|
||||
static const int MODEL_UPDATE_DELAY = 250;
|
||||
|
||||
/* AskPassphraseDialog -- Maximum passphrase length */
|
||||
static const int MAX_PASSPHRASE_SIZE = 1024;
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
#include <QApplication>
|
||||
|
||||
#include "guiutil.h"
|
||||
|
||||
#include "bitcoinaddressvalidator.h"
|
||||
#include "walletmodel.h"
|
||||
#include "bitcoinunits.h"
|
||||
|
||||
#include "util.h"
|
||||
#include "init.h"
|
||||
#include "base58.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QDoubleValidator>
|
||||
#include <QFont>
|
||||
#include <QLineEdit>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#else
|
||||
#include <QUrl>
|
||||
#include <QTextDocument> // For Qt::escape
|
||||
#endif
|
||||
#include <QTextDocument> // for Qt::mightBeRichText
|
||||
#include <QAbstractItemView>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QDesktopServices>
|
||||
@@ -78,18 +83,20 @@ void setupAmountWidget(QLineEdit *widget, QWidget *parent)
|
||||
|
||||
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
{
|
||||
if(uri.scheme() != QString("casinocoin"))
|
||||
return false;
|
||||
|
||||
// check if the address is valid
|
||||
CBitcoinAddress addressFromUri(uri.path().toStdString());
|
||||
if (!addressFromUri.IsValid())
|
||||
// return if URI is not valid or is no bitcoin URI
|
||||
if(!uri.isValid() || uri.scheme() != QString("casinocoin"))
|
||||
return false;
|
||||
|
||||
SendCoinsRecipient rv;
|
||||
rv.address = uri.path();
|
||||
rv.amount = 0;
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
QList<QPair<QString, QString> > items = uri.queryItems();
|
||||
#else
|
||||
QUrlQuery uriQuery(uri);
|
||||
QList<QPair<QString, QString> > items = uriQuery.queryItems();
|
||||
#endif
|
||||
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
|
||||
{
|
||||
bool fShouldReturnFalse = false;
|
||||
@@ -128,10 +135,10 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
|
||||
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
|
||||
{
|
||||
// Convert casinocoin:// to casinocoin:
|
||||
// Convert bitcoin:// to bitcoin:
|
||||
//
|
||||
// Cannot handle this later, because casinocoin:// will cause Qt to see the part after // as host,
|
||||
// which will lowercase it (and thus invalidate the address).
|
||||
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
|
||||
// which will lower-case it (and thus invalidate the address).
|
||||
if(uri.startsWith("casinocoin://"))
|
||||
{
|
||||
uri.replace(0, 11, "casinocoin:");
|
||||
@@ -142,7 +149,11 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
|
||||
|
||||
QString HtmlEscape(const QString& str, bool fMultiLine)
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
QString escaped = Qt::escape(str);
|
||||
#else
|
||||
QString escaped = str.toHtmlEscaped();
|
||||
#endif
|
||||
if(fMultiLine)
|
||||
{
|
||||
escaped = escaped.replace("\n", "<br>\n");
|
||||
@@ -163,11 +174,19 @@ void copyEntryData(QAbstractItemView *view, int column, int role)
|
||||
|
||||
if(!selection.isEmpty())
|
||||
{
|
||||
// Copy first item
|
||||
QApplication::clipboard()->setText(selection.at(0).data(role).toString());
|
||||
// Copy first item (global clipboard)
|
||||
QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Clipboard);
|
||||
// Copy first item (global mouse selection for e.g. X11 - NOP on Windows)
|
||||
QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Selection);
|
||||
}
|
||||
}
|
||||
|
||||
void setClipboard(const QString& str)
|
||||
{
|
||||
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
|
||||
QApplication::clipboard()->setText(str, QClipboard::Selection);
|
||||
}
|
||||
|
||||
QString getSaveFileName(QWidget *parent, const QString &caption,
|
||||
const QString &dir,
|
||||
const QString &filter,
|
||||
@@ -177,7 +196,11 @@ QString getSaveFileName(QWidget *parent, const QString &caption,
|
||||
QString myDir;
|
||||
if(dir.isEmpty()) // Default to user documents location
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
||||
#else
|
||||
myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,7 +239,7 @@ QString getSaveFileName(QWidget *parent, const QString &caption,
|
||||
|
||||
Qt::ConnectionType blockingGUIThreadConnection()
|
||||
{
|
||||
if(QThread::currentThread() != QCoreApplication::instance()->thread())
|
||||
if(QThread::currentThread() != qApp->thread())
|
||||
{
|
||||
return Qt::BlockingQueuedConnection;
|
||||
}
|
||||
@@ -228,7 +251,7 @@ Qt::ConnectionType blockingGUIThreadConnection()
|
||||
|
||||
bool checkPoint(const QPoint &p, const QWidget *w)
|
||||
{
|
||||
QWidget *atW = qApp->widgetAt(w->mapToGlobal(p));
|
||||
QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p));
|
||||
if (!atW) return false;
|
||||
return atW->topLevelWidget() == w;
|
||||
}
|
||||
@@ -283,7 +306,7 @@ boost::filesystem::path static StartupShortcutPath()
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
// check for CasinoCoin.lnk
|
||||
// check for Bitcoin.lnk
|
||||
return boost::filesystem::exists(StartupShortcutPath());
|
||||
}
|
||||
|
||||
@@ -398,7 +421,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
|
||||
if (!optionFile.good())
|
||||
return false;
|
||||
// Write a casinocoin.desktop file to the autostart directory:
|
||||
// Write a bitcoin.desktop file to the autostart directory:
|
||||
optionFile << "[Desktop Entry]\n";
|
||||
optionFile << "Type=Application\n";
|
||||
optionFile << "Name=CasinoCoin\n";
|
||||
@@ -409,10 +432,60 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
// TODO: OSX startup stuff; see:
|
||||
// https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html
|
||||
#elif defined(Q_OS_MAC)
|
||||
// based on: https://github.com/Mozketo/LaunchAtLoginController/blob/master/LaunchAtLoginController.m
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
|
||||
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
|
||||
{
|
||||
// loop through the list of startup items and try to find the bitcoin app
|
||||
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
|
||||
for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
|
||||
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
|
||||
UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
|
||||
CFURLRef currentItemURL = NULL;
|
||||
LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL);
|
||||
if(currentItemURL && CFEqual(currentItemURL, findUrl)) {
|
||||
// found
|
||||
CFRelease(currentItemURL);
|
||||
return item;
|
||||
}
|
||||
if(currentItemURL) {
|
||||
CFRelease(currentItemURL);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
|
||||
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
|
||||
return !!foundItem; // return boolified object
|
||||
}
|
||||
|
||||
bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
|
||||
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
|
||||
|
||||
if(fAutoStart && !foundItem) {
|
||||
// add bitcoin app to startup item list
|
||||
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, bitcoinAppUrl, NULL, NULL);
|
||||
}
|
||||
else if(!fAutoStart && foundItem) {
|
||||
// remove item
|
||||
LSSharedFileListItemRemove(loginItems, foundItem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
bool GetStartOnSystemStartup() { return false; }
|
||||
bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
|
||||
@@ -436,7 +509,7 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) :
|
||||
|
||||
setWindowTitle(tr("CasinoCoin-Qt"));
|
||||
setTextFormat(Qt::PlainText);
|
||||
// setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider.
|
||||
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
|
||||
setText(header + QString(QChar(0x2003)).repeated(50));
|
||||
setDetailedText(coreOptions + "\n" + uiOptions);
|
||||
}
|
||||
@@ -445,13 +518,13 @@ void HelpMessageBox::printToConsole()
|
||||
{
|
||||
// On other operating systems, the expected action is to print the message to the console.
|
||||
QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions;
|
||||
fprintf(stderr, "%s", strUsage.toStdString().c_str());
|
||||
fprintf(stdout, "%s", strUsage.toStdString().c_str());
|
||||
}
|
||||
|
||||
void HelpMessageBox::showOrPrint()
|
||||
{
|
||||
#if defined(WIN32)
|
||||
// On windows, show a message box, as there is no stderr/stdout in windowed applications
|
||||
// On Windows, show a message box, as there is no stderr/stdout in windowed applications
|
||||
exec();
|
||||
#else
|
||||
// On other operating systems, print help text to console
|
||||
@@ -460,4 +533,3 @@ void HelpMessageBox::showOrPrint()
|
||||
}
|
||||
|
||||
} // namespace GUIUtil
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
|
||||
class SendCoinsRecipient;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QFont;
|
||||
class QLineEdit;
|
||||
@@ -13,9 +15,8 @@ class QDateTime;
|
||||
class QUrl;
|
||||
class QAbstractItemView;
|
||||
QT_END_NAMESPACE
|
||||
class SendCoinsRecipient;
|
||||
|
||||
/** Utility functions used by the CasinoCoin Qt UI.
|
||||
/** Utility functions used by the Bitcoin Qt UI.
|
||||
*/
|
||||
namespace GUIUtil
|
||||
{
|
||||
@@ -23,14 +24,14 @@ namespace GUIUtil
|
||||
QString dateTimeStr(const QDateTime &datetime);
|
||||
QString dateTimeStr(qint64 nTime);
|
||||
|
||||
// Render CasinoCoin addresses in monospace font
|
||||
// Render Bitcoin addresses in monospace font
|
||||
QFont bitcoinAddressFont();
|
||||
|
||||
// Set up widgets for address and amounts
|
||||
void setupAddressWidget(QLineEdit *widget, QWidget *parent);
|
||||
void setupAmountWidget(QLineEdit *widget, QWidget *parent);
|
||||
|
||||
// Parse "casinocoin:" URI into recipient object, return true on succesful parsing
|
||||
// Parse "bitcoin:" URI into recipient object, return true on successful parsing
|
||||
// See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
|
||||
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
|
||||
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
|
||||
@@ -46,8 +47,10 @@ namespace GUIUtil
|
||||
@see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
|
||||
*/
|
||||
void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
|
||||
|
||||
/** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
|
||||
|
||||
void setClipboard(const QString& str);
|
||||
|
||||
/** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
|
||||
when no suffix is provided by the user.
|
||||
|
||||
@param[in] parent Parent window (or 0)
|
||||
@@ -95,7 +98,7 @@ namespace GUIUtil
|
||||
bool GetStartOnSystemStartup();
|
||||
bool SetStartOnSystemStartup(bool fAutoStart);
|
||||
|
||||
/** Help message for CasinoCoin-Qt, shown with --help. */
|
||||
/** Help message for Bitcoin-Qt, shown with --help. */
|
||||
class HelpMessageBox : public QMessageBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
2917
src/qt/locale/bitcoin_af_ZA.ts
Normal file
2917
src/qt/locale/bitcoin_af_ZA.ts
Normal file
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_ar.ts
Normal file
2917
src/qt/locale/bitcoin_ar.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_bs.ts
Normal file
2917
src/qt/locale/bitcoin_bs.ts
Normal file
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_ca.ts
Normal file
2917
src/qt/locale/bitcoin_ca.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_cy.ts
Normal file
2917
src/qt/locale/bitcoin_cy.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_eo.ts
Normal file
2917
src/qt/locale/bitcoin_eo.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_gu_IN.ts
Normal file
2917
src/qt/locale/bitcoin_gu_IN.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2922
src/qt/locale/bitcoin_hi_IN.ts
Normal file
2922
src/qt/locale/bitcoin_hi_IN.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_ja.ts
Normal file
2917
src/qt/locale/bitcoin_ja.ts
Normal file
File diff suppressed because it is too large
Load Diff
2937
src/qt/locale/bitcoin_la.ts
Normal file
2937
src/qt/locale/bitcoin_la.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2923
src/qt/locale/bitcoin_lv_LV.ts
Normal file
2923
src/qt/locale/bitcoin_lv_LV.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2917
src/qt/locale/bitcoin_th_TH.ts
Normal file
2917
src/qt/locale/bitcoin_th_TH.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,14 @@
|
||||
#ifndef MACDOCKICONHANDLER_H
|
||||
#define MACDOCKICONHANDLER_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QMenu;
|
||||
class QIcon;
|
||||
class QWidget;
|
||||
class objc_object;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#ifdef __OBJC__
|
||||
@class DockIconClickEventHandler;
|
||||
@@ -19,12 +21,13 @@ class DockIconClickEventHandler;
|
||||
class MacDockIconHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
~MacDockIconHandler();
|
||||
|
||||
QMenu *dockMenu();
|
||||
void setIcon(const QIcon &icon);
|
||||
|
||||
void setMainWindow(QMainWindow *window);
|
||||
static MacDockIconHandler *instance();
|
||||
|
||||
void handleDockIconClickEvent();
|
||||
@@ -32,14 +35,13 @@ public:
|
||||
signals:
|
||||
void dockIconClicked();
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
MacDockIconHandler();
|
||||
|
||||
DockIconClickEventHandler *m_dockIconClickEventHandler;
|
||||
QWidget *m_dummyWidget;
|
||||
QMenu *m_dockMenu;
|
||||
QMainWindow *mainWindow;
|
||||
};
|
||||
|
||||
#endif // MACDOCKICONCLICKHANDLER_H
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
|
||||
#include "macdockiconhandler.h"
|
||||
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
extern void qt_mac_set_dock_menu(QMenu*);
|
||||
#include <QMenu>
|
||||
#include <QWidget>
|
||||
#include <QTemporaryFile>
|
||||
#include <QImageWriter>
|
||||
|
||||
#undef slots
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
extern void qt_mac_set_dock_menu(QMenu *);
|
||||
#endif
|
||||
|
||||
@interface DockIconClickEventHandler : NSObject
|
||||
{
|
||||
MacDockIconHandler* dockIconHandler;
|
||||
@@ -38,8 +41,9 @@ extern void qt_mac_set_dock_menu(QMenu*);
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(replyEvent)
|
||||
|
||||
if (dockIconHandler)
|
||||
if (dockIconHandler) {
|
||||
dockIconHandler->handleDockIconClickEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -47,18 +51,26 @@ extern void qt_mac_set_dock_menu(QMenu*);
|
||||
MacDockIconHandler::MacDockIconHandler() : QObject()
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
this->m_dockIconClickEventHandler = [[DockIconClickEventHandler alloc] initWithDockIconHandler:this];
|
||||
|
||||
this->m_dockIconClickEventHandler = [[DockIconClickEventHandler alloc] initWithDockIconHandler:this];
|
||||
this->m_dummyWidget = new QWidget();
|
||||
this->m_dockMenu = new QMenu(this->m_dummyWidget);
|
||||
this->setMainWindow(NULL);
|
||||
#if QT_VERSION < 0x050000
|
||||
qt_mac_set_dock_menu(this->m_dockMenu);
|
||||
#endif
|
||||
[pool release];
|
||||
}
|
||||
|
||||
void MacDockIconHandler::setMainWindow(QMainWindow *window) {
|
||||
this->mainWindow = window;
|
||||
}
|
||||
|
||||
MacDockIconHandler::~MacDockIconHandler()
|
||||
{
|
||||
[this->m_dockIconClickEventHandler release];
|
||||
delete this->m_dummyWidget;
|
||||
this->setMainWindow(NULL);
|
||||
}
|
||||
|
||||
QMenu *MacDockIconHandler::dockMenu()
|
||||
@@ -69,15 +81,29 @@ QMenu *MacDockIconHandler::dockMenu()
|
||||
void MacDockIconHandler::setIcon(const QIcon &icon)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSImage *image;
|
||||
NSImage *image = nil;
|
||||
if (icon.isNull())
|
||||
image = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
|
||||
else {
|
||||
// generate NSImage from QIcon and use this as dock icon.
|
||||
QSize size = icon.actualSize(QSize(128, 128));
|
||||
QPixmap pixmap = icon.pixmap(size);
|
||||
CGImageRef cgImage = pixmap.toMacCGImageRef();
|
||||
image = [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
|
||||
CFRelease(cgImage);
|
||||
|
||||
// write temp file hack (could also be done through QIODevice [memory])
|
||||
QTemporaryFile notificationIconFile;
|
||||
if (!pixmap.isNull() && notificationIconFile.open()) {
|
||||
QImageWriter writer(¬ificationIconFile, "PNG");
|
||||
if (writer.write(pixmap.toImage())) {
|
||||
const char *cString = notificationIconFile.fileName().toUtf8().data();
|
||||
NSString *macString = [NSString stringWithCString:cString encoding:NSUTF8StringEncoding];
|
||||
image = [[NSImage alloc] initWithContentsOfFile:macString];
|
||||
}
|
||||
}
|
||||
|
||||
if(!image) {
|
||||
// if testnet image could not be created, load std. app icon
|
||||
image = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
|
||||
}
|
||||
}
|
||||
|
||||
[NSApp setApplicationIconImage:image];
|
||||
@@ -95,5 +121,11 @@ MacDockIconHandler *MacDockIconHandler::instance()
|
||||
|
||||
void MacDockIconHandler::handleDockIconClickEvent()
|
||||
{
|
||||
if (this->mainWindow)
|
||||
{
|
||||
this->mainWindow->activateWindow();
|
||||
this->mainWindow->show();
|
||||
}
|
||||
|
||||
emit this->dockIconClicked();
|
||||
}
|
||||
|
||||
25
src/qt/macnotificationhandler.h
Normal file
25
src/qt/macnotificationhandler.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef MACNOTIFICATIONHANDLER_H
|
||||
#define MACNOTIFICATIONHANDLER_H
|
||||
#include <QObject>
|
||||
|
||||
/** Macintosh-specific notification handler (supports UserNotificationCenter and Growl).
|
||||
*/
|
||||
class MacNotificationHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** shows a 10.8+ UserNotification in the UserNotificationCenter
|
||||
*/
|
||||
void showNotification(const QString &title, const QString &text);
|
||||
|
||||
/** executes AppleScript */
|
||||
void sendAppleScript(const QString &script);
|
||||
|
||||
/** check if OS can handle UserNotifications */
|
||||
bool hasUserNotificationCenterSupport(void);
|
||||
static MacNotificationHandler *instance();
|
||||
};
|
||||
|
||||
|
||||
#endif // MACNOTIFICATIONHANDLER_H
|
||||
65
src/qt/macnotificationhandler.mm
Normal file
65
src/qt/macnotificationhandler.mm
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "macnotificationhandler.h"
|
||||
|
||||
#undef slots
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
void MacNotificationHandler::showNotification(const QString &title, const QString &text)
|
||||
{
|
||||
// check if users OS has support for NSUserNotification
|
||||
if(this->hasUserNotificationCenterSupport()) {
|
||||
// okay, seems like 10.8+
|
||||
QByteArray utf8 = title.toUtf8();
|
||||
char* cString = (char *)utf8.constData();
|
||||
NSString *titleMac = [[NSString alloc] initWithUTF8String:cString];
|
||||
|
||||
utf8 = text.toUtf8();
|
||||
cString = (char *)utf8.constData();
|
||||
NSString *textMac = [[NSString alloc] initWithUTF8String:cString];
|
||||
|
||||
// do everything weak linked (because we will keep <10.8 compatibility)
|
||||
id userNotification = [[NSClassFromString(@"NSUserNotification") alloc] init];
|
||||
[userNotification performSelector:@selector(setTitle:) withObject:titleMac];
|
||||
[userNotification performSelector:@selector(setInformativeText:) withObject:textMac];
|
||||
|
||||
id notificationCenterInstance = [NSClassFromString(@"NSUserNotificationCenter") performSelector:@selector(defaultUserNotificationCenter)];
|
||||
[notificationCenterInstance performSelector:@selector(deliverNotification:) withObject:userNotification];
|
||||
|
||||
[titleMac release];
|
||||
[textMac release];
|
||||
[userNotification release];
|
||||
}
|
||||
}
|
||||
|
||||
// sendAppleScript just take a QString and executes it as apple script
|
||||
void MacNotificationHandler::sendAppleScript(const QString &script)
|
||||
{
|
||||
QByteArray utf8 = script.toUtf8();
|
||||
char* cString = (char *)utf8.constData();
|
||||
NSString *scriptApple = [[NSString alloc] initWithUTF8String:cString];
|
||||
|
||||
NSAppleScript *as = [[NSAppleScript alloc] initWithSource:scriptApple];
|
||||
NSDictionary *err = nil;
|
||||
[as executeAndReturnError:&err];
|
||||
[as release];
|
||||
[scriptApple release];
|
||||
}
|
||||
|
||||
bool MacNotificationHandler::hasUserNotificationCenterSupport(void)
|
||||
{
|
||||
Class possibleClass = NSClassFromString(@"NSUserNotificationCenter");
|
||||
|
||||
// check if users OS has support for NSUserNotification
|
||||
if(possibleClass!=nil) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
MacNotificationHandler *MacNotificationHandler::instance()
|
||||
{
|
||||
static MacNotificationHandler *s_instance = NULL;
|
||||
if (!s_instance)
|
||||
s_instance = new MacNotificationHandler();
|
||||
return s_instance;
|
||||
}
|
||||
@@ -9,7 +9,6 @@ MonitoredDataMapper::MonitoredDataMapper(QObject *parent) :
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void MonitoredDataMapper::addMapping(QWidget *widget, int section)
|
||||
{
|
||||
QDataWidgetMapper::addMapping(widget, section);
|
||||
|
||||
@@ -13,19 +13,18 @@ QT_END_NAMESPACE
|
||||
class MonitoredDataMapper : public QDataWidgetMapper
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MonitoredDataMapper(QObject *parent=0);
|
||||
|
||||
void addMapping(QWidget *widget, int section);
|
||||
void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
|
||||
|
||||
private:
|
||||
void addChangeMonitor(QWidget *widget);
|
||||
|
||||
signals:
|
||||
void viewModified();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // MONITOREDDATAMAPPER_H
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
#include <QImageWriter>
|
||||
|
||||
#ifdef USE_DBUS
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <QtDBus>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
extern bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);
|
||||
#include "macnotificationhandler.h"
|
||||
#endif
|
||||
|
||||
// https://wiki.ubuntu.com/NotificationDevelopmentGuidelines recommends at least 128
|
||||
@@ -46,20 +46,26 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
|
||||
mode = Freedesktop;
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
// Check if Growl is installed (based on Qt's tray icon implementation)
|
||||
CFURLRef cfurl;
|
||||
OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
|
||||
if (status != kLSApplicationNotFoundErr) {
|
||||
CFBundleRef bundle = CFBundleCreate(0, cfurl);
|
||||
if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), kCFCompareCaseInsensitive | kCFCompareBackwards) == kCFCompareEqualTo) {
|
||||
if (CFStringHasSuffix(CFURLGetString(cfurl), CFSTR("/Growl.app/")))
|
||||
mode = Growl13;
|
||||
else
|
||||
mode = Growl12;
|
||||
#ifdef Q_OS_MAC
|
||||
// check if users OS has support for NSUserNotification
|
||||
if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) {
|
||||
mode = UserNotificationCenter;
|
||||
}
|
||||
else {
|
||||
// Check if Growl is installed (based on Qt's tray icon implementation)
|
||||
CFURLRef cfurl;
|
||||
OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
|
||||
if (status != kLSApplicationNotFoundErr) {
|
||||
CFBundleRef bundle = CFBundleCreate(0, cfurl);
|
||||
if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), kCFCompareCaseInsensitive | kCFCompareBackwards) == kCFCompareEqualTo) {
|
||||
if (CFStringHasSuffix(CFURLGetString(cfurl), CFSTR("/Growl.app/")))
|
||||
mode = Growl13;
|
||||
else
|
||||
mode = Growl12;
|
||||
}
|
||||
CFRelease(cfurl);
|
||||
CFRelease(bundle);
|
||||
}
|
||||
CFRelease(cfurl);
|
||||
CFRelease(bundle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -82,7 +88,7 @@ public:
|
||||
|
||||
static int metaType();
|
||||
|
||||
// Image to variant that can be marshaled over DBus
|
||||
// Image to variant that can be marshalled over DBus
|
||||
static QVariant toVariant(const QImage &img);
|
||||
|
||||
private:
|
||||
@@ -113,7 +119,7 @@ FreedesktopImage::FreedesktopImage(const QImage &img):
|
||||
{
|
||||
// Convert 00xAARRGGBB to RGBA bytewise (endian-independent) format
|
||||
QImage tmp = img.convertToFormat(QImage::Format_ARGB32);
|
||||
const uint32_t *data = reinterpret_cast<const uint32_t*>(tmp.constBits());
|
||||
const uint32_t *data = reinterpret_cast<const uint32_t*>(tmp.bits());
|
||||
|
||||
unsigned int num_pixels = width * height;
|
||||
image.resize(num_pixels * BYTES_PER_PIXEL);
|
||||
@@ -225,7 +231,7 @@ void Notificator::notifySystray(Class cls, const QString &title, const QString &
|
||||
}
|
||||
|
||||
// Based on Qt's tray icon implementation
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
void Notificator::notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon)
|
||||
{
|
||||
const QString script(
|
||||
@@ -269,8 +275,14 @@ void Notificator::notifyGrowl(Class cls, const QString &title, const QString &te
|
||||
quotedTitle.replace("\\", "\\\\").replace("\"", "\\");
|
||||
quotedText.replace("\\", "\\\\").replace("\"", "\\");
|
||||
QString growlApp(this->mode == Notificator::Growl13 ? "Growl" : "GrowlHelperApp");
|
||||
qt_mac_execute_apple_script(script.arg(notificationApp, quotedTitle, quotedText, notificationIcon, growlApp), 0);
|
||||
MacNotificationHandler::instance()->sendAppleScript(script.arg(notificationApp, quotedTitle, quotedText, notificationIcon, growlApp));
|
||||
}
|
||||
|
||||
void Notificator::notifyMacUserNotificationCenter(Class cls, const QString &title, const QString &text, const QIcon &icon) {
|
||||
// icon is not supported by the user notification center yet. OSX will use the app icon.
|
||||
MacNotificationHandler::instance()->showNotification(title, text);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void Notificator::notify(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout)
|
||||
@@ -285,7 +297,10 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
|
||||
case QSystemTray:
|
||||
notifySystray(cls, title, text, icon, millisTimeout);
|
||||
break;
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
case UserNotificationCenter:
|
||||
notifyMacUserNotificationCenter(cls, title, text, icon);
|
||||
break;
|
||||
case Growl12:
|
||||
case Growl13:
|
||||
notifyGrowl(cls, title, text, icon);
|
||||
@@ -294,7 +309,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
|
||||
default:
|
||||
if(cls == Critical)
|
||||
{
|
||||
// Fall back to old fashioned popup dialog if critical and no other notification available
|
||||
// Fall back to old fashioned pop-up dialog if critical and no other notification available
|
||||
QMessageBox::critical(parent, title, text, QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -15,6 +15,7 @@ QT_END_NAMESPACE
|
||||
class Notificator: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Create a new notificator.
|
||||
@note Ownership of trayIcon is not transferred to this object.
|
||||
@@ -25,13 +26,12 @@ public:
|
||||
// Message class
|
||||
enum Class
|
||||
{
|
||||
Information, /**< Informational message */
|
||||
Warning, /**< Notify user of potential problem */
|
||||
Critical /**< An error occured */
|
||||
Information, /**< Informational message */
|
||||
Warning, /**< Notify user of potential problem */
|
||||
Critical /**< An error occurred */
|
||||
};
|
||||
|
||||
public slots:
|
||||
|
||||
/** Show notification message.
|
||||
@param[in] cls general message class
|
||||
@param[in] title title shown with message
|
||||
@@ -46,11 +46,12 @@ public slots:
|
||||
private:
|
||||
QWidget *parent;
|
||||
enum Mode {
|
||||
None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */
|
||||
Freedesktop, /**< Use DBus org.freedesktop.Notifications */
|
||||
QSystemTray, /**< Use QSystemTray::showMessage */
|
||||
Growl12, /**< Use the Growl 1.2 notification system (Mac only) */
|
||||
Growl13 /**< Use the Growl 1.3 notification system (Mac only) */
|
||||
None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */
|
||||
Freedesktop, /**< Use DBus org.freedesktop.Notifications */
|
||||
QSystemTray, /**< Use QSystemTray::showMessage */
|
||||
Growl12, /**< Use the Growl 1.2 notification system (Mac only) */
|
||||
Growl13, /**< Use the Growl 1.3 notification system (Mac only) */
|
||||
UserNotificationCenter /**< Use the 10.8+ User Notification Center (Mac only) */
|
||||
};
|
||||
QString programName;
|
||||
Mode mode;
|
||||
@@ -61,8 +62,9 @@ private:
|
||||
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
|
||||
#endif
|
||||
void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
void notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon);
|
||||
void notifyMacUserNotificationCenter(Class cls, const QString &title, const QString &text, const QIcon &icon);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
#include "optionsdialog.h"
|
||||
#include "ui_optionsdialog.h"
|
||||
|
||||
#include "bitcoinamountfield.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include "monitoreddatamapper.h"
|
||||
#include "netbase.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "qvalidatedlineedit.h"
|
||||
#include "qvaluecombobox.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDir>
|
||||
#include <QIntValidator>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QLocale>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QRegExp>
|
||||
#include <QRegExpValidator>
|
||||
#include <QTabWidget>
|
||||
#include <QWidget>
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -38,24 +27,26 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
ui->mapPortUpnp->setEnabled(false);
|
||||
#endif
|
||||
|
||||
ui->proxyIp->setEnabled(false);
|
||||
ui->proxyPort->setEnabled(false);
|
||||
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
|
||||
|
||||
ui->socksVersion->setEnabled(false);
|
||||
ui->socksVersion->addItem("5", 5);
|
||||
ui->socksVersion->addItem("4", 4);
|
||||
ui->socksVersion->setCurrentIndex(0);
|
||||
|
||||
ui->proxyIp->setEnabled(false);
|
||||
ui->proxyPort->setEnabled(false);
|
||||
ui->proxyPort->setValidator(new QIntValidator(0, 65535, this));
|
||||
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));
|
||||
|
||||
ui->proxyIp->installEventFilter(this);
|
||||
|
||||
/* Window elements init */
|
||||
#ifdef Q_WS_MAC
|
||||
ui->tabWindow->setVisible(false);
|
||||
#ifdef Q_OS_MAC
|
||||
/* remove Window tab on Mac */
|
||||
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
|
||||
#endif
|
||||
|
||||
/* Display elements init */
|
||||
@@ -90,20 +81,17 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
|
||||
ui->unit->setModel(new BitcoinUnits(this));
|
||||
|
||||
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));
|
||||
connect(ui->lang, SIGNAL(activated(int)), this, SLOT(showRestartWarning_Lang()));
|
||||
|
||||
/* Widget-to-option mapper */
|
||||
mapper = new MonitoredDataMapper(this);
|
||||
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
|
||||
mapper->setOrientation(Qt::Vertical);
|
||||
|
||||
/* enable save buttons when data modified */
|
||||
connect(mapper, SIGNAL(viewModified()), this, SLOT(enableSaveButtons()));
|
||||
/* disable save buttons when new data loaded */
|
||||
connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableSaveButtons()));
|
||||
/* disable/enable save buttons when proxy IP is invalid/valid */
|
||||
connect(this, SIGNAL(proxyIpValid(bool)), this, SLOT(setSaveButtonState(bool)));
|
||||
/* enable apply button when data modified */
|
||||
connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
|
||||
/* disable apply button when new data loaded */
|
||||
connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
|
||||
/* setup/change UI elements when proxy IP is invalid/valid */
|
||||
connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));
|
||||
}
|
||||
|
||||
OptionsDialog::~OptionsDialog()
|
||||
@@ -124,8 +112,14 @@ void OptionsDialog::setModel(OptionsModel *model)
|
||||
mapper->toFirst();
|
||||
}
|
||||
|
||||
// update the display unit, to not use the default ("BTC")
|
||||
/* update the display unit, to not use the default ("BTC") */
|
||||
updateDisplayUnit();
|
||||
|
||||
/* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */
|
||||
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang()));
|
||||
|
||||
/* disable apply button after settings are loaded as there is nothing to save */
|
||||
disableApplyButton();
|
||||
}
|
||||
|
||||
void OptionsDialog::setMapper()
|
||||
@@ -133,17 +127,17 @@ void OptionsDialog::setMapper()
|
||||
/* Main */
|
||||
mapper->addMapping(ui->transactionFee, OptionsModel::Fee);
|
||||
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
|
||||
mapper->addMapping(ui->detachDatabases, OptionsModel::DetachDatabases);
|
||||
|
||||
/* Network */
|
||||
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
|
||||
|
||||
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
|
||||
mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
|
||||
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
|
||||
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
|
||||
mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
|
||||
|
||||
/* Window */
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
|
||||
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
|
||||
#endif
|
||||
@@ -152,11 +146,22 @@ void OptionsDialog::setMapper()
|
||||
mapper->addMapping(ui->lang, OptionsModel::Language);
|
||||
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
|
||||
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
|
||||
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
|
||||
}
|
||||
|
||||
void OptionsDialog::enableApplyButton()
|
||||
{
|
||||
ui->applyButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void OptionsDialog::disableApplyButton()
|
||||
{
|
||||
ui->applyButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void OptionsDialog::enableSaveButtons()
|
||||
{
|
||||
// prevent enabling of the save buttons when data modified, if there is an invalid proxy address present
|
||||
/* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */
|
||||
if(fProxyIpValid)
|
||||
setSaveButtonState(true);
|
||||
}
|
||||
@@ -172,6 +177,33 @@ void OptionsDialog::setSaveButtonState(bool fState)
|
||||
ui->okButton->setEnabled(fState);
|
||||
}
|
||||
|
||||
void OptionsDialog::on_resetButton_clicked()
|
||||
{
|
||||
if(model)
|
||||
{
|
||||
// confirmation dialog
|
||||
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"),
|
||||
tr("Some settings may require a client restart to take effect.") + "<br><br>" + tr("Do you want to proceed?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if(btnRetVal == QMessageBox::Cancel)
|
||||
return;
|
||||
|
||||
disableApplyButton();
|
||||
|
||||
/* disable restart warning messages display */
|
||||
fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = true;
|
||||
|
||||
/* reset all options and save the default values (QSettings) */
|
||||
model->Reset();
|
||||
mapper->toFirst();
|
||||
mapper->submit();
|
||||
|
||||
/* re-enable restart warning messages display */
|
||||
fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = false;
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::on_okButton_clicked()
|
||||
{
|
||||
mapper->submit();
|
||||
@@ -186,7 +218,7 @@ void OptionsDialog::on_cancelButton_clicked()
|
||||
void OptionsDialog::on_applyButton_clicked()
|
||||
{
|
||||
mapper->submit();
|
||||
ui->applyButton->setEnabled(false);
|
||||
disableApplyButton();
|
||||
}
|
||||
|
||||
void OptionsDialog::showRestartWarning_Proxy()
|
||||
@@ -211,30 +243,39 @@ void OptionsDialog::updateDisplayUnit()
|
||||
{
|
||||
if(model)
|
||||
{
|
||||
// Update transactionFee with the current unit
|
||||
/* Update transactionFee with the current unit */
|
||||
ui->transactionFee->setDisplayUnit(model->getDisplayUnit());
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::handleProxyIpValid(QValidatedLineEdit *object, bool fState)
|
||||
{
|
||||
// this is used in a check before re-enabling the save buttons
|
||||
fProxyIpValid = fState;
|
||||
|
||||
if(fProxyIpValid)
|
||||
{
|
||||
enableSaveButtons();
|
||||
ui->statusLabel->clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
disableSaveButtons();
|
||||
object->setValid(fProxyIpValid);
|
||||
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
|
||||
}
|
||||
}
|
||||
|
||||
bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if(object == ui->proxyIp && event->type() == QEvent::FocusOut)
|
||||
if(event->type() == QEvent::FocusOut)
|
||||
{
|
||||
// Check proxyIP for a valid IPv4/IPv6 address
|
||||
CService addr;
|
||||
if(!LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr))
|
||||
if(object == ui->proxyIp)
|
||||
{
|
||||
ui->proxyIp->setValid(false);
|
||||
fProxyIpValid = false;
|
||||
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
|
||||
emit proxyIpValid(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
fProxyIpValid = true;
|
||||
ui->statusLabel->clear();
|
||||
emit proxyIpValid(true);
|
||||
CService addr;
|
||||
/* Check proxyIp for a valid IPv4/IPv6 address and emit the proxyIpValid signal */
|
||||
emit proxyIpValid(ui->proxyIp, LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr));
|
||||
}
|
||||
}
|
||||
return QDialog::eventFilter(object, event);
|
||||
|
||||
@@ -8,6 +8,7 @@ class OptionsDialog;
|
||||
}
|
||||
class OptionsModel;
|
||||
class MonitoredDataMapper;
|
||||
class QValidatedLineEdit;
|
||||
|
||||
/** Preferences dialog. */
|
||||
class OptionsDialog : public QDialog
|
||||
@@ -25,12 +26,17 @@ protected:
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
private slots:
|
||||
/* enable only apply button */
|
||||
void enableApplyButton();
|
||||
/* disable only apply button */
|
||||
void disableApplyButton();
|
||||
/* enable apply button and OK button */
|
||||
void enableSaveButtons();
|
||||
/* disable apply button and OK button */
|
||||
void disableSaveButtons();
|
||||
/* set apply button and OK button state (enabled / disabled) */
|
||||
void setSaveButtonState(bool fState);
|
||||
void on_resetButton_clicked();
|
||||
void on_okButton_clicked();
|
||||
void on_cancelButton_clicked();
|
||||
void on_applyButton_clicked();
|
||||
@@ -38,9 +44,10 @@ private slots:
|
||||
void showRestartWarning_Proxy();
|
||||
void showRestartWarning_Lang();
|
||||
void updateDisplayUnit();
|
||||
void handleProxyIpValid(QValidatedLineEdit *object, bool fState);
|
||||
|
||||
signals:
|
||||
void proxyIpValid(bool fValid);
|
||||
void proxyIpValid(QValidatedLineEdit *object, bool fValid);
|
||||
|
||||
private:
|
||||
Ui::OptionsDialog *ui;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "optionsmodel.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include <QSettings>
|
||||
|
||||
#include "bitcoinunits.h"
|
||||
#include "init.h"
|
||||
#include "walletdb.h"
|
||||
#include "guiutil.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
OptionsModel::OptionsModel(QObject *parent) :
|
||||
QAbstractListModel(parent)
|
||||
{
|
||||
@@ -47,6 +48,7 @@ void OptionsModel::Init()
|
||||
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
|
||||
nTransactionFee = settings.value("nTransactionFee").toLongLong();
|
||||
language = settings.value("language", "").toString();
|
||||
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
|
||||
|
||||
// These are shared with core Bitcoin; we want
|
||||
// command-line options to override the GUI settings:
|
||||
@@ -56,12 +58,28 @@ void OptionsModel::Init()
|
||||
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
|
||||
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
|
||||
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
|
||||
if (settings.contains("detachDB"))
|
||||
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
|
||||
if (!language.isEmpty())
|
||||
SoftSetArg("-lang", language.toStdString());
|
||||
}
|
||||
|
||||
void OptionsModel::Reset()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
// Remove all entries in this QSettings object
|
||||
settings.clear();
|
||||
|
||||
// default setting for OptionsModel::StartAtStartup - disabled
|
||||
if (GUIUtil::GetStartOnSystemStartup())
|
||||
GUIUtil::SetStartOnSystemStartup(false);
|
||||
|
||||
// Re-Init to get default values
|
||||
Init();
|
||||
|
||||
// Ensure Upgrade() is not running again by setting the bImportFinished flag
|
||||
settings.setValue("bImportFinished", true);
|
||||
}
|
||||
|
||||
bool OptionsModel::Upgrade()
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -139,43 +157,55 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||
case MinimizeToTray:
|
||||
return QVariant(fMinimizeToTray);
|
||||
case MapPortUPnP:
|
||||
#ifdef USE_UPNP
|
||||
return settings.value("fUseUPnP", GetBoolArg("-upnp", true));
|
||||
#else
|
||||
return QVariant(false);
|
||||
#endif
|
||||
case MinimizeOnClose:
|
||||
return QVariant(fMinimizeOnClose);
|
||||
case ProxyUse:
|
||||
return settings.value("fUseProxy", false);
|
||||
case ProxyUse: {
|
||||
proxyType proxy;
|
||||
return QVariant(GetProxy(NET_IPV4, proxy));
|
||||
}
|
||||
case ProxyIP: {
|
||||
CService addrProxy;
|
||||
if (GetProxy(NET_IPV4, addrProxy))
|
||||
return QVariant(QString::fromStdString(addrProxy.ToStringIP()));
|
||||
proxyType proxy;
|
||||
if (GetProxy(NET_IPV4, proxy))
|
||||
return QVariant(QString::fromStdString(proxy.first.ToStringIP()));
|
||||
else
|
||||
return QVariant(QString::fromStdString("127.0.0.1"));
|
||||
}
|
||||
case ProxyPort: {
|
||||
CService addrProxy;
|
||||
if (GetProxy(NET_IPV4, addrProxy))
|
||||
return QVariant(addrProxy.GetPort());
|
||||
proxyType proxy;
|
||||
if (GetProxy(NET_IPV4, proxy))
|
||||
return QVariant(proxy.first.GetPort());
|
||||
else
|
||||
return 9050;
|
||||
return QVariant(9050);
|
||||
}
|
||||
case ProxySocksVersion: {
|
||||
proxyType proxy;
|
||||
if (GetProxy(NET_IPV4, proxy))
|
||||
return QVariant(proxy.second);
|
||||
else
|
||||
return QVariant(5);
|
||||
}
|
||||
case ProxySocksVersion:
|
||||
return settings.value("nSocksVersion", 5);
|
||||
case Fee:
|
||||
return QVariant(nTransactionFee);
|
||||
case DisplayUnit:
|
||||
return QVariant(nDisplayUnit);
|
||||
case DisplayAddresses:
|
||||
return QVariant(bDisplayAddresses);
|
||||
case DetachDatabases:
|
||||
return QVariant(bitdb.GetDetach());
|
||||
case Language:
|
||||
return settings.value("language", "");
|
||||
case CoinControlFeatures:
|
||||
return QVariant(fCoinControlFeatures);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
|
||||
{
|
||||
bool successful = true; /* set to false on parse error */
|
||||
@@ -192,9 +222,8 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
settings.setValue("fMinimizeToTray", fMinimizeToTray);
|
||||
break;
|
||||
case MapPortUPnP:
|
||||
fUseUPnP = value.toBool();
|
||||
settings.setValue("fUseUPnP", fUseUPnP);
|
||||
MapPort();
|
||||
settings.setValue("fUseUPnP", value.toBool());
|
||||
MapPort(value.toBool());
|
||||
break;
|
||||
case MinimizeOnClose:
|
||||
fMinimizeOnClose = value.toBool();
|
||||
@@ -202,34 +231,43 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
break;
|
||||
case ProxyUse:
|
||||
settings.setValue("fUseProxy", value.toBool());
|
||||
ApplyProxySettings();
|
||||
break;
|
||||
case ProxyIP:
|
||||
{
|
||||
CService addrProxy("127.0.0.1", 9050);
|
||||
GetProxy(NET_IPV4, addrProxy);
|
||||
CNetAddr addr(value.toString().toStdString());
|
||||
addrProxy.SetIP(addr);
|
||||
settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
|
||||
successful = ApplyProxySettings();
|
||||
}
|
||||
break;
|
||||
case ProxyPort:
|
||||
{
|
||||
CService addrProxy("127.0.0.1", 9050);
|
||||
GetProxy(NET_IPV4, addrProxy);
|
||||
addrProxy.SetPort(value.toInt());
|
||||
settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
|
||||
successful = ApplyProxySettings();
|
||||
}
|
||||
break;
|
||||
case ProxySocksVersion:
|
||||
settings.setValue("nSocksVersion", value.toInt());
|
||||
ApplyProxySettings();
|
||||
successful = ApplyProxySettings();
|
||||
break;
|
||||
case ProxyIP: {
|
||||
proxyType proxy;
|
||||
proxy.first = CService("127.0.0.1", 9050);
|
||||
GetProxy(NET_IPV4, proxy);
|
||||
|
||||
CNetAddr addr(value.toString().toStdString());
|
||||
proxy.first.SetIP(addr);
|
||||
settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str());
|
||||
successful = ApplyProxySettings();
|
||||
}
|
||||
break;
|
||||
case ProxyPort: {
|
||||
proxyType proxy;
|
||||
proxy.first = CService("127.0.0.1", 9050);
|
||||
GetProxy(NET_IPV4, proxy);
|
||||
|
||||
proxy.first.SetPort(value.toInt());
|
||||
settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str());
|
||||
successful = ApplyProxySettings();
|
||||
}
|
||||
break;
|
||||
case ProxySocksVersion: {
|
||||
proxyType proxy;
|
||||
proxy.second = 5;
|
||||
GetProxy(NET_IPV4, proxy);
|
||||
|
||||
proxy.second = value.toInt();
|
||||
settings.setValue("nSocksVersion", proxy.second);
|
||||
successful = ApplyProxySettings();
|
||||
}
|
||||
break;
|
||||
case Fee:
|
||||
nTransactionFee = value.toLongLong();
|
||||
settings.setValue("nTransactionFee", nTransactionFee);
|
||||
emit transactionFeeChanged(nTransactionFee);
|
||||
break;
|
||||
case DisplayUnit:
|
||||
nDisplayUnit = value.toInt();
|
||||
@@ -240,15 +278,15 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
bDisplayAddresses = value.toBool();
|
||||
settings.setValue("bDisplayAddresses", bDisplayAddresses);
|
||||
break;
|
||||
case DetachDatabases: {
|
||||
bool fDetachDB = value.toBool();
|
||||
bitdb.SetDetach(fDetachDB);
|
||||
settings.setValue("detachDB", fDetachDB);
|
||||
}
|
||||
break;
|
||||
case Language:
|
||||
settings.setValue("language", value);
|
||||
break;
|
||||
case CoinControlFeatures: {
|
||||
fCoinControlFeatures = value.toBool();
|
||||
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
|
||||
emit coinControlFeaturesChanged(fCoinControlFeatures);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -263,22 +301,8 @@ qint64 OptionsModel::getTransactionFee()
|
||||
return nTransactionFee;
|
||||
}
|
||||
|
||||
bool OptionsModel::getMinimizeToTray()
|
||||
bool OptionsModel::getCoinControlFeatures()
|
||||
{
|
||||
return fMinimizeToTray;
|
||||
return fCoinControlFeatures;
|
||||
}
|
||||
|
||||
bool OptionsModel::getMinimizeOnClose()
|
||||
{
|
||||
return fMinimizeOnClose;
|
||||
}
|
||||
|
||||
int OptionsModel::getDisplayUnit()
|
||||
{
|
||||
return nDisplayUnit;
|
||||
}
|
||||
|
||||
bool OptionsModel::getDisplayAddresses()
|
||||
{
|
||||
return bDisplayAddresses;
|
||||
}
|
||||
|
||||
@@ -28,12 +28,13 @@ public:
|
||||
Fee, // qint64
|
||||
DisplayUnit, // BitcoinUnits::Unit
|
||||
DisplayAddresses, // bool
|
||||
DetachDatabases, // bool
|
||||
Language, // QString
|
||||
CoinControlFeatures, // bool
|
||||
OptionIDRowCount,
|
||||
};
|
||||
|
||||
void Init();
|
||||
void Reset();
|
||||
|
||||
/* Migrate settings from wallet.dat after app initialization */
|
||||
bool Upgrade(); /* returns true if settings upgraded */
|
||||
@@ -44,11 +45,12 @@ public:
|
||||
|
||||
/* Explicit getters */
|
||||
qint64 getTransactionFee();
|
||||
bool getMinimizeToTray();
|
||||
bool getMinimizeOnClose();
|
||||
int getDisplayUnit();
|
||||
bool getDisplayAddresses();
|
||||
bool getMinimizeToTray() { return fMinimizeToTray; }
|
||||
bool getMinimizeOnClose() { return fMinimizeOnClose; }
|
||||
int getDisplayUnit() { return nDisplayUnit; }
|
||||
bool getDisplayAddresses() { return bDisplayAddresses; }
|
||||
QString getLanguage() { return language; }
|
||||
bool getCoinControlFeatures();
|
||||
|
||||
private:
|
||||
int nDisplayUnit;
|
||||
@@ -56,9 +58,12 @@ private:
|
||||
bool fMinimizeToTray;
|
||||
bool fMinimizeOnClose;
|
||||
QString language;
|
||||
bool fCoinControlFeatures;
|
||||
|
||||
signals:
|
||||
void displayUnitChanged(int unit);
|
||||
void transactionFeeChanged(qint64);
|
||||
void coinControlFeaturesChanged(bool);
|
||||
};
|
||||
|
||||
#endif // OPTIONSMODEL_H
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "overviewpage.h"
|
||||
#include "ui_overviewpage.h"
|
||||
|
||||
#include "clientmodel.h"
|
||||
#include "walletmodel.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include "optionsmodel.h"
|
||||
@@ -45,9 +46,10 @@ public:
|
||||
bool confirmed = index.data(TransactionTableModel::ConfirmedRole).toBool();
|
||||
QVariant value = index.data(Qt::ForegroundRole);
|
||||
QColor foreground = option.palette.color(QPalette::Text);
|
||||
if(qVariantCanConvert<QColor>(value))
|
||||
if(value.canConvert<QBrush>())
|
||||
{
|
||||
foreground = qvariant_cast<QColor>(value);
|
||||
QBrush brush = qvariant_cast<QBrush>(value);
|
||||
foreground = brush.color();
|
||||
}
|
||||
|
||||
painter->setPen(foreground);
|
||||
@@ -92,6 +94,8 @@ public:
|
||||
OverviewPage::OverviewPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OverviewPage),
|
||||
clientModel(0),
|
||||
walletModel(0),
|
||||
currentBalance(-1),
|
||||
currentUnconfirmedBalance(-1),
|
||||
currentImmatureBalance(-1),
|
||||
@@ -109,8 +113,8 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
||||
connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
|
||||
|
||||
// init "out of sync" warning labels
|
||||
ui->labelWalletStatus->setText("(" + tr("Out of sync") + ")");
|
||||
ui->labelTransactionsStatus->setText("(" + tr("Out of sync") + ")");
|
||||
ui->labelWalletStatus->setText("(" + tr("out of sync") + ")");
|
||||
ui->labelTransactionsStatus->setText("(" + tr("out of sync") + ")");
|
||||
|
||||
// start with displaying the "out of sync" warnings
|
||||
showOutOfSyncWarning(true);
|
||||
@@ -129,7 +133,7 @@ OverviewPage::~OverviewPage()
|
||||
|
||||
void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
|
||||
{
|
||||
int unit = model->getOptionsModel()->getDisplayUnit();
|
||||
int unit = walletModel->getOptionsModel()->getDisplayUnit();
|
||||
currentBalance = balance;
|
||||
currentUnconfirmedBalance = unconfirmedBalance;
|
||||
currentImmatureBalance = immatureBalance;
|
||||
@@ -144,14 +148,20 @@ void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64
|
||||
ui->labelImmatureText->setVisible(showImmature);
|
||||
}
|
||||
|
||||
void OverviewPage::setNumTransactions(int count)
|
||||
void OverviewPage::setClientModel(ClientModel *model)
|
||||
{
|
||||
ui->labelNumTransactions->setText(QLocale::system().toString(count));
|
||||
this->clientModel = model;
|
||||
if(model)
|
||||
{
|
||||
// Show warning if this is a prerelease version
|
||||
connect(model, SIGNAL(alertsChanged(QString)), this, SLOT(updateAlerts(QString)));
|
||||
updateAlerts(model->getStatusBarWarnings());
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewPage::setModel(WalletModel *model)
|
||||
void OverviewPage::setWalletModel(WalletModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
this->walletModel = model;
|
||||
if(model && model->getOptionsModel())
|
||||
{
|
||||
// Set up transaction list
|
||||
@@ -169,30 +179,33 @@ void OverviewPage::setModel(WalletModel *model)
|
||||
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance());
|
||||
connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
|
||||
|
||||
setNumTransactions(model->getNumTransactions());
|
||||
connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
|
||||
|
||||
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
|
||||
}
|
||||
|
||||
// update the display unit, to not use the default ("CSC")
|
||||
// update the display unit, to not use the default ("BTC")
|
||||
updateDisplayUnit();
|
||||
}
|
||||
|
||||
void OverviewPage::updateDisplayUnit()
|
||||
{
|
||||
if(model && model->getOptionsModel())
|
||||
if(walletModel && walletModel->getOptionsModel())
|
||||
{
|
||||
if(currentBalance != -1)
|
||||
setBalance(currentBalance, currentUnconfirmedBalance, currentImmatureBalance);
|
||||
|
||||
// Update txdelegate->unit with the current unit
|
||||
txdelegate->unit = model->getOptionsModel()->getDisplayUnit();
|
||||
txdelegate->unit = walletModel->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
ui->listTransactions->update();
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewPage::updateAlerts(const QString &warnings)
|
||||
{
|
||||
this->ui->labelAlerts->setVisible(!warnings.isEmpty());
|
||||
this->ui->labelAlerts->setText(warnings);
|
||||
}
|
||||
|
||||
void OverviewPage::showOutOfSyncWarning(bool fShow)
|
||||
{
|
||||
ui->labelWalletStatus->setVisible(fShow);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user