Skip to content

Commit

Permalink
transaction details dialog on doubleclick
Browse files Browse the repository at this point in the history
  • Loading branch information
laanwj committed Jun 10, 2011
1 parent 8e86dca commit 66d536e
Show file tree
Hide file tree
Showing 11 changed files with 486 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ This has been implemented:

- Sending coins (including ask for fee when needed)

- Show messages from core
- Show error messages from core

- Show details dialog for transactions (on double click)

This has to be done:

Expand All @@ -34,6 +36,4 @@ This has to be done:

- Build on Windows

- Show details dialog for transactions (on double click)

- More thorough testing of the view with all the kinds of transactions (sendmany, generation)
11 changes: 8 additions & 3 deletions bitcoin.pro
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ HEADERS += gui/include/bitcoingui.h \
gui/include/guiconstants.h \
gui/include/optionsmodel.h \
gui/include/monitoreddatamapper.h \
core/include/externui.h
core/include/externui.h \
gui/include/transactiondesc.h \
gui/include/transactiondescdialog.h
SOURCES += gui/src/bitcoin.cpp gui/src/bitcoingui.cpp \
gui/src/transactiontablemodel.cpp \
gui/src/addresstablemodel.cpp \
Expand All @@ -90,7 +92,9 @@ SOURCES += gui/src/bitcoin.cpp gui/src/bitcoingui.cpp \
gui/src/guiutil.cpp \
gui/src/transactionrecord.cpp \
gui/src/optionsmodel.cpp \
gui/src/monitoreddatamapper.cpp
gui/src/monitoreddatamapper.cpp \
gui/src/transactiondesc.cpp \
gui/src/transactiondescdialog.cpp

RESOURCES += \
gui/bitcoin.qrc
Expand All @@ -99,4 +103,5 @@ FORMS += \
gui/forms/sendcoinsdialog.ui \
gui/forms/addressbookdialog.ui \
gui/forms/aboutdialog.ui \
gui/forms/editaddressdialog.ui
gui/forms/editaddressdialog.ui \
gui/forms/transactiondescdialog.ui
67 changes: 67 additions & 0 deletions gui/forms/transactiondescdialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TransactionDescDialog</class>
<widget class="QDialog" name="TransactionDescDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Transaction details</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="detailText"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>TransactionDescDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>TransactionDescDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
7 changes: 6 additions & 1 deletion gui/include/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <QMainWindow>
#include <QSystemTrayIcon>

/* Forward declarations */
class TransactionTableModel;
class ClientModel;

Expand All @@ -13,6 +12,7 @@ class QLabel;
class QLineEdit;
class QTableView;
class QAbstractItemModel;
class QModelIndex;
QT_END_NAMESPACE

class BitcoinGUI : public QMainWindow
Expand Down Expand Up @@ -66,6 +66,10 @@ public slots:
void setNumBlocks(int count);
void setNumTransactions(int count);
void error(const QString &title, const QString &message);
/* It is currently not possible to pass a return value to another thread through
BlockingQueuedConnection, so use an indirected pointer.
http://bugreports.qt.nokia.com/browse/QTBUG-10440
*/
void askFee(qint64 nFeeRequired, bool *payFee);

private slots:
Expand All @@ -77,6 +81,7 @@ private slots:
void newAddressClicked();
void copyClipboardClicked();
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
void transactionDetails(const QModelIndex& idx);
};

#endif
15 changes: 15 additions & 0 deletions gui/include/transactiondesc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef TRANSACTIONDESC_H
#define TRANSACTIONDESC_H

#include <string>

class CWalletTx;

class TransactionDesc
{
public:
/* Provide human-readable extended HTML description of a transaction */
static std::string toHTML(CWalletTx &wtx);
};

#endif // TRANSACTIONDESC_H
25 changes: 25 additions & 0 deletions gui/include/transactiondescdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef TRANSACTIONDESCDIALOG_H
#define TRANSACTIONDESCDIALOG_H

#include <QDialog>

namespace Ui {
class TransactionDescDialog;
}
QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE

class TransactionDescDialog : public QDialog
{
Q_OBJECT

public:
explicit TransactionDescDialog(const QModelIndex &idx, QWidget *parent = 0);
~TransactionDescDialog();

private:
Ui::TransactionDescDialog *ui;
};

#endif // TRANSACTIONDESCDIALOG_H
3 changes: 2 additions & 1 deletion gui/include/transactiontablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class TransactionTableModel : public QAbstractTableModel
} ColumnIndex;

enum {
TypeRole = Qt::UserRole
TypeRole = Qt::UserRole,
LongDescriptionRole = Qt::UserRole+1
} RoleIndex;

/* TypeRole values */
Expand Down
11 changes: 11 additions & 0 deletions gui/src/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "guiutil.h"
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "transactiondescdialog.h"

#include "main.h"

Expand Down Expand Up @@ -212,6 +213,8 @@ QWidget *BitcoinGUI::createTabs()
{
QTableView *view = new QTableView(this);
tabs->addTab(view, tab_labels.at(i));

connect(view, SIGNAL(activated(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
transactionViews.append(view);
}

Expand Down Expand Up @@ -396,3 +399,11 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
*payFee = (retval == QMessageBox::Yes);
}

void BitcoinGUI::transactionDetails(const QModelIndex& idx)
{
/* A transaction is doubleclicked */
TransactionDescDialog dlg(idx);
dlg.exec();
}

0 comments on commit 66d536e

Please sign in to comment.