mirror of
https://github.com/AskDavis/Casinotest.git
synced 2025-12-31 20:55:58 -08:00
Fixes #8
This commit is contained in:
@@ -473,7 +473,7 @@ void BitcoinGUI::restoreWindowGeometry()
|
||||
{
|
||||
QSettings settings;
|
||||
QPoint pos = settings.value("nWindowPos").toPoint();
|
||||
QSize size = settings.value("nWindowSize", QSize(850, 550)).toSize();
|
||||
QSize size = settings.value("nWindowSize", QSize(900, 650)).toSize();
|
||||
if (!pos.x() && !pos.y())
|
||||
{
|
||||
QRect screen = QApplication::desktop()->screenGeometry();
|
||||
|
||||
@@ -73,10 +73,14 @@ QString Currencies::symbol(int currency)
|
||||
}
|
||||
}
|
||||
|
||||
QString Currencies::format(int currency, double value, bool useSymbol)
|
||||
QString Currencies::format(int currency, double value, bool useSymbol, int decimals, bool isSatoshi)
|
||||
{
|
||||
// divide by satoshi
|
||||
double fiatValue = value * 0.00000001;
|
||||
double fiatValue = value;
|
||||
if(isSatoshi)
|
||||
{
|
||||
fiatValue *= 0.00000001;
|
||||
}
|
||||
QString formattedValue = "";
|
||||
if(useSymbol)
|
||||
{
|
||||
@@ -84,7 +88,7 @@ QString Currencies::format(int currency, double value, bool useSymbol)
|
||||
}
|
||||
// apply format
|
||||
QLocale::setDefault( QLocale(QLocale::English, QLocale::UnitedStates) );
|
||||
formattedValue.append(QString("%L1").arg(fiatValue, 0, 'f', 2)).append(" ").append(name(currency));
|
||||
formattedValue.append(QString("%L1").arg(fiatValue, 0, 'f', decimals)).append(" ").append(name(currency));
|
||||
return formattedValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
//! symbol
|
||||
static QString symbol(int currency);
|
||||
//! Format value
|
||||
static QString format(int currency, double value, bool symbol);
|
||||
static QString format(int currency, double value, bool symbol, int decimals, bool isSatoshi);
|
||||
|
||||
//! @name AbstractListModel implementation
|
||||
//! List model for currency drop-down selection box.
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblConnections">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
@@ -423,7 +423,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="txtConnections">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -442,7 +442,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblDifficulty">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
@@ -455,7 +455,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="txtDifficulty">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -474,7 +474,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblHashRate">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
@@ -487,7 +487,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="txtHashRate">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -506,7 +506,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblTransactionCount">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
@@ -519,7 +519,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="txtTransactionCount">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -538,6 +538,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblCoinFiatValue">
|
||||
<property name="text">
|
||||
<string>Coin Fiat Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="txtCoinFiatValue">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QDateTime>
|
||||
#include "bitcoinunits.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "overviewpage.h"
|
||||
#include "qtquick_controls/cpp/guiexchangeswidget.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -17,9 +17,8 @@ InfoPage::InfoPage(QWidget *parent) :
|
||||
exchangesWidget( 0 )
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// ui->casinoInfoBox->setVisible(false);
|
||||
// ui->newsItemsBox->setVisible(false);
|
||||
|
||||
ui->coinInfoBox->setMinimumHeight(250);
|
||||
ui->exchangeInfoBox->setMinimumHeight(250);
|
||||
createExchangesWidget();
|
||||
}
|
||||
|
||||
@@ -119,3 +118,8 @@ void InfoPage::createExchangesWidget()
|
||||
exchangesWidget->slotPopulateExchangesFromWeb();
|
||||
ui->verticalLayoutExchanges->addWidget( exchangesWidget->dockQmlToWidget() );
|
||||
}
|
||||
|
||||
void InfoPage::setCoinFiatValue(QString coinValue)
|
||||
{
|
||||
ui->txtCoinFiatValue->setText(coinValue);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ public slots:
|
||||
void setNumBlocks(int count, int countOfPeers);
|
||||
/** Set number of transactions shown in the UI */
|
||||
void setNumTransactions(int count);
|
||||
/** Set Fiat coin value */
|
||||
void setCoinFiatValue(const QString coinValue);
|
||||
|
||||
public:
|
||||
explicit InfoPage(QWidget *parent = 0);
|
||||
|
||||
@@ -125,6 +125,7 @@ OverviewPage::OverviewPage(QWidget *parent) :
|
||||
ui->listTransactions->setItemDelegate(txdelegate);
|
||||
ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE));
|
||||
ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2));
|
||||
ui->listTransactions->setMinimumWidth(350);
|
||||
ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
|
||||
connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex)));
|
||||
@@ -277,8 +278,13 @@ void OverviewPage::updateFiatBalance(int currency)
|
||||
{
|
||||
QString conversionCurrency = QString("Price").append(Currencies::name(currency));
|
||||
double currencyValue = coinInformation.find(conversionCurrency).value().toDouble();
|
||||
// emit signal for change value
|
||||
QString coinValue = Currencies::format(currency, currencyValue, true, 4, false);
|
||||
emit coinFiatValueChanged(coinValue);
|
||||
// calculate and set fiat balance
|
||||
double fiatBalance = currentBalance * currencyValue;
|
||||
ui->labelBalanceFiat->setText(Currencies::format(currency,fiatBalance,true));
|
||||
QString fiatBalanceString = Currencies::format(currency,fiatBalance,true, 2, true);
|
||||
ui->labelBalanceFiat->setText(fiatBalanceString);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void transactionClicked(const QModelIndex &index);
|
||||
void coinFiatValueChanged(const QString formattedCoinFiatValue);
|
||||
|
||||
private:
|
||||
Ui::OverviewPage *ui;
|
||||
|
||||
@@ -91,7 +91,8 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
|
||||
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
|
||||
// Clicking on "Export" allows to export the transaction list
|
||||
connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));
|
||||
|
||||
// subscribe to coin value changes
|
||||
connect(overviewPage, SIGNAL(coinFiatValueChanged(const QString)), infoPage, SLOT(setCoinFiatValue(const QString)));
|
||||
gotoOverviewPage();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user