deleted address and txid columns, added context menu
authorfsb4000 <fsb4000@yandex.ru>
Sat, 22 Nov 2014 00:33:43 +0000 (06:33 +0600)
committerfsb4000 <fsb4000@yandex.ru>
Sat, 22 Nov 2014 00:33:43 +0000 (06:33 +0600)
В PoS вкладке убраны столбцы адреса и хеша транзакции, добавлено
контекстное меню с пунктами:
Скопировать ID транзакции входа
Скопировать адрес входа

src/qt/locale/bitcoin_ru.ts
src/qt/mintingtablemodel.cpp
src/qt/mintingview.cpp
src/qt/mintingview.h

index b71a3b5..b16e1e6 100644 (file)
       <translation>90 дней</translation>
     </message>
     <message>
+      <location filename="../mintingview.cpp" line="101"/>
+      <source>Copy transaction ID of input</source>
+      <translation>Скопировать ID транзакции входа</translation>
+    </message>
+    <message>
+      <location filename="../mintingview.cpp" line="102"/>
+      <source>Copy address of input</source>
+      <translation>Скопировать адрес входа</translation>
+    </message>
+    <message>
       <location filename="../mintingview.cpp" line="167"/>
       <source>Export Minting Data</source>
       <translation>Экспортировать данные таблицы</translation>
 <context>
   <name>QObject</name>
   <message>
-    <source>Potential PoS reward = from  %1 to %2 </source>
-    <translation>Потенциальная PoS награда = от %1 до %2 </translation>
+    <source>from  %1 NVC to %2 NVC</source>
+    <translation>от %1 NVC до %2 NVC</translation>
   </message>
   <message>
     <source>%1 d</source>
index f97520c..139116c 100644 (file)
@@ -369,7 +369,7 @@ QString MintingTableModel::formatTxPoSReward(KernelRecord *wtx) const
     QString posReward;
     const CBlockIndex *p = GetLastBlockIndex(pindexBest, true);
     double difficulty = GetDifficulty(p);
-    posReward += QString(QObject::tr("Potential PoS reward = from  %1 to %2 ")).arg(QString::number(wtx->getPoSReward(difficulty, 0),'f', 6), 
+    posReward += QString(QObject::tr("from  %1 NVC to %2 NVC")).arg(QString::number(wtx->getPoSReward(difficulty, 0),'f', 6), 
                  QString::number(wtx->getPoSReward(difficulty, mintingInterval),'f', 6)); 
     return posReward;
 }
index 40bd5ee..fe672a2 100644 (file)
@@ -17,6 +17,7 @@
 #include <QLineEdit>
 #include <QComboBox>
 #include <QMessageBox>
+#include <QMenu>
 
 MintingView::MintingView(QWidget *parent) :
     QWidget(parent), model(0), mintingView(0)
@@ -96,6 +97,18 @@ MintingView::MintingView(QWidget *parent) :
 
     connect(mintingCombo, SIGNAL(activated(int)), this, SLOT(chooseMintingInterval(int)));
 
+    // Actions
+    QAction *copyTxIDAction = new QAction(tr("Copy transaction ID of input"), this);
+    QAction *copyAddressAction = new QAction(tr("Copy address of input"), this);
+
+    contextMenu = new QMenu();
+    contextMenu->addAction(copyAddressAction);
+    contextMenu->addAction(copyTxIDAction);
+
+    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
+    connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
+
+    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
 }
 
 
@@ -118,15 +131,6 @@ void MintingView::setModel(WalletModel *model)
         mintingView->verticalHeader()->hide();
 
         mintingView->horizontalHeader()->resizeSection(
-                MintingTableModel::Address, 300);
-#if QT_VERSION < 0x050000
-        mintingView->horizontalHeader()->setResizeMode(
-                MintingTableModel::TxHash, QHeaderView::Stretch);
-#else
-        mintingView->horizontalHeader()->setSectionResizeMode(
-                MintingTableModel::TxHash, QHeaderView::Stretch);
-#endif
-        mintingView->horizontalHeader()->resizeSection(
                 MintingTableModel::Age, 120);
         mintingView->horizontalHeader()->resizeSection(
                 MintingTableModel::Balance, 120);
@@ -134,8 +138,16 @@ void MintingView::setModel(WalletModel *model)
                 MintingTableModel::CoinDay,120);
         mintingView->horizontalHeader()->resizeSection(
                 MintingTableModel::MintProbability, 120);
+#if QT_VERSION < 0x050000
+        mintingView->horizontalHeader()->setResizeMode(
+                MintingTableModel::MintReward, QHeaderView::Stretch);
+#else
+        mintingView->horizontalHeader()->setSectionResizeMode(MintingTableModel::MintReward, QHeaderView::Stretch);
+#endif
         mintingView->horizontalHeader()->resizeSection(
-            MintingTableModel::MintReward, 300);
+            MintingTableModel::Address, 0);
+        mintingView->horizontalHeader()->resizeSection(
+            MintingTableModel::TxHash, 0);
     }
 }
 
@@ -189,3 +201,22 @@ void MintingView::exportClicked()
                               QMessageBox::Abort, QMessageBox::Abort);
     }
 }
+
+void MintingView::copyTxID()
+{
+    GUIUtil::copyEntryData(mintingView, MintingTableModel::TxHash, 0);
+}
+
+void MintingView::copyAddress()
+{
+    GUIUtil::copyEntryData(mintingView, MintingTableModel::Address, 0 );
+}
+
+void MintingView::contextualMenu(const QPoint &point)
+{
+    QModelIndex index = mintingView->indexAt(point);
+    if(index.isValid())
+    {
+        contextMenu->exec(QCursor::pos());
+    }
+}
\ No newline at end of file
index 452deaa..547bc73 100644 (file)
@@ -10,6 +10,7 @@ class WalletModel;
 
 QT_BEGIN_NAMESPACE
 class QTableView;
+class QMenu;
 QT_END_NAMESPACE
 
 class MintingView : public QWidget
@@ -35,11 +36,16 @@ private:
 
     MintingFilterProxy *mintingProxyModel;
 
+    QMenu *contextMenu;
+
 signals:
 
 public slots:
     void exportClicked();
     void chooseMintingInterval(int idx);
+    void copyTxID();
+    void copyAddress();
+    void contextualMenu(const QPoint &point);
 };
 
 #endif // MINTINGVIEW_H