mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +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 amount = m_convertBalance ? AppContext::balance : 1.0;
 | 
				
			||||||
    double conversion = AppContext::prices->convert(m_symbol, fiatCurrency, amount);
 | 
					    double conversion = AppContext::prices->convert(m_symbol, fiatCurrency, amount);
 | 
				
			||||||
    if (conversion < 0) return;
 | 
					    if (conversion < 0) return;
 | 
				
			||||||
    ui->tickerPct->setHidden(conversion == 0 || m_hidePercent);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto markets = AppContext::prices->markets;
 | 
					    auto markets = AppContext::prices->markets;
 | 
				
			||||||
    if(!markets.contains(m_symbol)) return;
 | 
					    if(!markets.contains(m_symbol)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto pct24h = markets[m_symbol].price_usd_change_pct_24h;
 | 
					    bool hidePercent = (conversion == 0 || m_hidePercent);
 | 
				
			||||||
    auto pct24hText = QString::number(pct24h, 'f', 2);
 | 
					    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->setPctText(pct24hText, pct24h >= 0.0);
 | 
					 | 
				
			||||||
    this->setFiatText(fiatCurrency, conversion);
 | 
					    this->setFiatText(fiatCurrency, conversion);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,10 +88,6 @@ void TickerWidget::setFontSizes() {
 | 
				
			||||||
    ui->tickerFiat->setFont(Utils::relativeFont(0));
 | 
					    ui->tickerFiat->setFont(Utils::relativeFont(0));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TickerWidget::removePctContainer() {
 | 
					 | 
				
			||||||
    ui->tickerPct->deleteLater();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TickerWidget::~TickerWidget() {
 | 
					TickerWidget::~TickerWidget() {
 | 
				
			||||||
    delete ui;
 | 
					    delete ui;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,6 @@ class TickerWidget : public QWidget
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    explicit TickerWidget(QWidget *parent, QString symbol, QString title = "", bool convertBalance = false, bool hidePercent = false);
 | 
					    explicit TickerWidget(QWidget *parent, QString symbol, QString title = "", bool convertBalance = false, bool hidePercent = false);
 | 
				
			||||||
    void removePctContainer();
 | 
					 | 
				
			||||||
    void setFiatText(QString &fiatCurrency, double amount);
 | 
					    void setFiatText(QString &fiatCurrency, double amount);
 | 
				
			||||||
    void setPctText(QString &text, bool positive);
 | 
					    void setPctText(QString &text, bool positive);
 | 
				
			||||||
    void setFontSizes();
 | 
					    void setFontSizes();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue