mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-10 21:05:00 +00:00
Merge pull request 'TickerWidget: minor cleanup' (#256) from tobtoht/feather:ticker_clean into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/256
This commit is contained in:
commit
136f877778
2 changed files with 8 additions and 9 deletions
|
@ -50,15 +50,19 @@ void TickerWidget::init() {
|
|||
double amount = m_convertBalance ? AppContext::balance : 1.0;
|
||||
double conversion = AppContext::prices->convert(m_symbol, fiatCurrency, amount);
|
||||
if (conversion < 0) return;
|
||||
ui->tickerPct->setHidden(conversion == 0 || m_hidePercent);
|
||||
|
||||
auto markets = AppContext::prices->markets;
|
||||
if(!markets.contains(m_symbol)) return;
|
||||
|
||||
bool hidePercent = (conversion == 0 || m_hidePercent);
|
||||
if (hidePercent) {
|
||||
ui->tickerPct->hide();
|
||||
} else {
|
||||
auto pct24h = markets[m_symbol].price_usd_change_pct_24h;
|
||||
auto pct24hText = QString::number(pct24h, 'f', 2);
|
||||
|
||||
this->setPctText(pct24hText, pct24h >= 0.0);
|
||||
}
|
||||
|
||||
this->setFiatText(fiatCurrency, conversion);
|
||||
}
|
||||
|
||||
|
@ -84,10 +88,6 @@ void TickerWidget::setFontSizes() {
|
|||
ui->tickerFiat->setFont(Utils::relativeFont(0));
|
||||
}
|
||||
|
||||
void TickerWidget::removePctContainer() {
|
||||
ui->tickerPct->deleteLater();
|
||||
}
|
||||
|
||||
TickerWidget::~TickerWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ class TickerWidget : public QWidget
|
|||
|
||||
public:
|
||||
explicit TickerWidget(QWidget *parent, QString symbol, QString title = "", bool convertBalance = false, bool hidePercent = false);
|
||||
void removePctContainer();
|
||||
void setFiatText(QString &fiatCurrency, double amount);
|
||||
void setPctText(QString &text, bool positive);
|
||||
void setFontSizes();
|
||||
|
|
Loading…
Reference in a new issue