Merge pull request #89 from fsb4000/optionsdialog
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Wed, 31 Dec 2014 01:37:22 +0000 (04:37 +0300)
committerCryptoManiac <CryptoManiac@users.noreply.github.com>
Wed, 31 Dec 2014 01:37:22 +0000 (04:37 +0300)
cosmetic gui  improvement

src/qt/bitcoinunits.cpp
src/qt/bitcoinunits.h
src/qt/forms/optionsdialog.ui
src/qt/locale/bitcoin_ru.ts
src/qt/transactiontablemodel.cpp
src/qt/transactiontablemodel.h
src/qt/transactionview.cpp

index 863f291..496c9f7 100644 (file)
@@ -45,9 +45,9 @@ QString BitcoinUnits::description(int unit)
 {
     switch(unit)
     {
-    case BTC: return QString("NovaCoins");
-    case mBTC: return QString("Milli-NovaCoins (1 / 1,000)");
-    case uBTC: return QString("Micro-NovaCoins (1 / 1,000,000)");
+    case BTC: return QString(QObject::tr("NovaCoins"));
+    case mBTC: return QString(QObject::tr("Milli-NovaCoins (1 / 1,000)"));
+    case uBTC: return QString(QObject::tr("Micro-NovaCoins (1 / 1,000,000)"));
     default: return QString("???");
     }
 }
@@ -179,3 +179,13 @@ QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
     }
     return QVariant();
 }
+
+QString BitcoinUnits::getAmountColumnTitle(int unit)
+{
+    QString amountTitle = QObject::tr("Amount");
+    if (BitcoinUnits::valid(unit))
+    {
+        amountTitle += " ("+BitcoinUnits::name(unit) + ")";
+    }
+    return amountTitle;
+}
\ No newline at end of file
index 9b7c9e1..5ac3d47 100644 (file)
@@ -46,6 +46,8 @@ public:
     static QString formatWithUnit(int unit, qint64 amount, bool plussign=false);
     //! Parse string to coin amount
     static bool parse(int unit, const QString &value, qint64 *val_out);
+    //! Gets title for amount column including current display unit if optionsModel reference available */
+    static QString getAmountColumnTitle(int unit);
     ///@}
 
     //! @name AbstractListModel implementation
index 25ee24b..73e4801 100644 (file)
@@ -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. Fee 0.001 recommended.</string>
          </property>
          <property name="textFormat">
           <enum>Qt::PlainText</enum>
           <widget class="BitcoinAmountField" name="transactionFee"/>
          </item>
          <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>per kilobyte</string>
+           </property>
+          </widget>
+         </item>
+         <item>
           <spacer name="horizontalSpacer_Main">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>20</width>
-           <height>40</height>
+           <width>17</width>
+           <height>153</height>
           </size>
          </property>
         </spacer>
index 68c5401..a9509bc 100644 (file)
 <context>
   <name>QObject</name>
   <message>
+    <source>Amount</source>
+    <translation>Количество</translation>
+  </message>
+  <message>
+    <source>NovaCoins</source>
+    <translation>NovaCoins</translation>
+  </message>
+  <message>
+    <source>Milli-NovaCoins (1 / 1,000)</source>
+    <translation>Милли-NovaCoins (1 / 1000)</translation>
+  </message>
+  <message>
+    <source>Micro-NovaCoins (1 / 1,000,000)</source>
+    <translation>Микро-NovaCoins (1 / 1000000)</translation>
+  </message>
+  <message>
     <source>from  %1 to %2</source>
     <translation>от %1 до %2</translation>
   </message>
@@ -1712,8 +1728,8 @@ This label turns red, if the priority is smaller than &quot;medium&quot;.
     </message>
     <message>
         <location line="+6"/>
-        <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
-        <translation>Опциональная комиссия за каждый КБ транзакции, которая позволяет быть уверенным, что Ваша транзакция будет обработана быстро.  Большинство транзакций занимают 1КБ.  Рекомендуется комиссия 0.01.</translation>
+        <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.001 recommended.</source>
+        <translation>Опциональная комиссия за каждый КБ транзакции, которая позволяет быть уверенным, что Ваша транзакция будет обработана быстро.  Большинство транзакций занимают 1КБ.  Рекомендуется комиссия 0.001.</translation>
     </message>
     <message>
         <location line="+15"/>
@@ -1721,6 +1737,11 @@ This label turns red, if the priority is smaller than &quot;medium&quot;.
         <translation>Заплатить ко&amp;миссию</translation>
     </message>
     <message>
+        <location line="67"/>
+        <source>per kilobyte</source>
+        <translation>за килобайт</translation>
+    </message>
+    <message>
         <location line="+31"/>
         <source>Automatically start NovaCoin after logging in to the system.</source>
         <translation>Автоматически запускать NovaCoin после входа в систему</translation>
@@ -2971,11 +2992,6 @@ This label turns red, if the priority is smaller than &quot;medium&quot;.
         <source>Address</source>
         <translation>Адрес</translation>
     </message>
-    <message>
-        <location line="+0"/>
-        <source>Amount</source>
-        <translation>Количество</translation>
-    </message>
     <message numerus="yes">
         <location line="+57"/>
         <source>Open for %n block(s)</source>
index 8133f57..3248c1d 100644 (file)
@@ -223,7 +223,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
         priv(new TransactionTablePriv(wallet, this)),
         cachedNumBlocks(0)
 {
-    columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
+    columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
 
     priv->refreshWallet();
 
@@ -239,6 +239,13 @@ TransactionTableModel::~TransactionTableModel()
     delete priv;
 }
 
+/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+void TransactionTableModel::updateAmountColumnTitle()
+{
+    columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+    emit headerDataChanged(Qt::Horizontal,Amount,Amount);
+}
+
 void TransactionTableModel::updateTransaction(const QString &hash, int status)
 {
     uint256 updated;
@@ -639,6 +646,7 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex
 
 void TransactionTableModel::updateDisplayUnit()
 {
+    updateAmountColumnTitle();
     // emit dataChanged to update Amount column with the current unit
     emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
 }
index d74f7fd..9608948 100644 (file)
@@ -80,6 +80,8 @@ public slots:
     void updateTransaction(const QString &hash, int status);
     void updateConfirmations();
     void updateDisplayUnit();
+    /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+    void updateAmountColumnTitle();
 
     friend class TransactionTablePriv;
 };
index 61ddb26..7dae349 100644 (file)
@@ -202,7 +202,7 @@ void TransactionView::setModel(WalletModel *model, bool fShoudAddThirdPartyURL)
         transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
 #endif
         transactionView->horizontalHeader()->resizeSection(
-                TransactionTableModel::Amount, 100);
+                TransactionTableModel::Amount, 120);
 
         if (model->getOptionsModel() && fShoudAddThirdPartyURL)
         {