remove transparency effect and windows-specific code for now, it's not working as...
[novacoin.git] / src / qt / transactionview.cpp
index f88b6fc..b2777b7 100644 (file)
@@ -9,6 +9,7 @@
 #include "csvmodelwriter.h"
 #include "transactiondescdialog.h"
 #include "editaddressdialog.h"
+#include "optionsmodel.h"
 
 #include <QScrollBar>
 #include <QComboBox>
@@ -28,8 +29,6 @@
 #include <QLabel>
 #include <QDateTimeEdit>
 
-#include <QDebug>
-
 TransactionView::TransactionView(QWidget *parent) :
     QWidget(parent), model(0), transactionProxyModel(0),
     transactionView(0)
@@ -72,13 +71,13 @@ TransactionView::TransactionView(QWidget *parent) :
 
     addressWidget = new QLineEdit(this);
 #if QT_VERSION >= 0x040700
-    addressWidget->setPlaceholderText("Enter address or label to search");
+    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
 #endif
     hlayout->addWidget(addressWidget);
 
     amountWidget = new QLineEdit(this);
 #if QT_VERSION >= 0x040700
-    amountWidget->setPlaceholderText("Min amount");
+    amountWidget->setPlaceholderText(tr("Min amount"));
 #endif
     amountWidget->setMaximumWidth(100);
     amountWidget->setMinimumWidth(100);
@@ -106,10 +105,10 @@ TransactionView::TransactionView(QWidget *parent) :
     transactionView = view;
 
     // Actions
-    QAction *copyAddressAction = new QAction("Copy address", this);
-    QAction *copyLabelAction = new QAction("Copy label", this);
-    QAction *editLabelAction = new QAction("Edit label", this);
-    QAction *showDetailsAction = new QAction("Show details...", this);
+    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
+    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
+    QAction *editLabelAction = new QAction(tr("Edit label"), this);
+    QAction *showDetailsAction = new QAction(tr("Show details..."), this);
 
     contextMenu = new QMenu();
     contextMenu->addAction(copyAddressAction);
@@ -120,15 +119,15 @@ TransactionView::TransactionView(QWidget *parent) :
     // Connect actions
     connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
     connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
-    connect(addressWidget, SIGNAL(textChanged(const QString&)), this, SLOT(changedPrefix(const QString&)));
-    connect(amountWidget, SIGNAL(textChanged(const QString&)), this, SLOT(changedAmount(const QString&)));
+    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
+    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));
 
-    connect(view, SIGNAL(doubleClicked(const QModelIndex&)), this, SIGNAL(doubleClicked(const QModelIndex&)));
+    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
 
     connect(view,
-            SIGNAL(customContextMenuRequested(const QPoint &)),
+            SIGNAL(customContextMenuRequested(QPoint)),
             this,
-            SLOT(contextualMenu(const QPoint &)));
+            SLOT(contextualMenu(QPoint)));
 
     connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
     connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
@@ -227,7 +226,7 @@ void TransactionView::changedPrefix(const QString &prefix)
 void TransactionView::changedAmount(const QString &amount)
 {
     qint64 amount_parsed = 0;
-    if(BitcoinUnits::parse(BitcoinUnits::BTC, amount, &amount_parsed))
+    if(BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), amount, &amount_parsed))
     {
         transactionProxyModel->setMinAmount(amount_parsed);
     }
@@ -252,13 +251,13 @@ void TransactionView::exportClicked()
 
     // name, column, role
     writer.setModel(transactionProxyModel);
-    writer.addColumn("Confirmed", 0, TransactionTableModel::ConfirmedRole);
-    writer.addColumn("Date", 0, TransactionTableModel::DateRole);
-    writer.addColumn("Type", TransactionTableModel::Type, Qt::EditRole);
-    writer.addColumn("Label", 0, TransactionTableModel::LabelRole);
-    writer.addColumn("Address", 0, TransactionTableModel::AddressRole);
-    writer.addColumn("Amount", 0, TransactionTableModel::FormattedAmountRole);
-    writer.addColumn("ID", 0, TransactionTableModel::TxIDRole);
+    writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole);
+    writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole);
+    writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole);
+    writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole);
+    writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole);
+    writer.addColumn(tr("Amount"), 0, TransactionTableModel::FormattedAmountRole);
+    writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole);
 
     if(!writer.write())
     {
@@ -350,7 +349,7 @@ QWidget *TransactionView::createDateRangeWidget()
     QHBoxLayout *layout = new QHBoxLayout(dateRangeWidget);
     layout->setContentsMargins(0,0,0,0);
     layout->addSpacing(23);
-    layout->addWidget(new QLabel("Range:"));
+    layout->addWidget(new QLabel(tr("Range:")));
 
     dateFrom = new QDateTimeEdit(this);
     dateFrom->setDisplayFormat("dd/MM/yy");
@@ -358,7 +357,7 @@ QWidget *TransactionView::createDateRangeWidget()
     dateFrom->setMinimumWidth(100);
     dateFrom->setDate(QDate::currentDate().addDays(-7));
     layout->addWidget(dateFrom);
-    layout->addWidget(new QLabel("to"));
+    layout->addWidget(new QLabel(tr("to")));
 
     dateTo = new QDateTimeEdit(this);
     dateTo->setDisplayFormat("dd/MM/yy");