feat(MangeTokensController): add method returning order of given token

This commit is contained in:
Michał Cieślak 2024-06-13 14:14:31 +02:00 committed by Michał
parent 3aa48b0549
commit 45863ad4c1
2 changed files with 7 additions and 0 deletions

View File

@ -272,6 +272,12 @@ bool ManageTokensController::hasSettings() const
return !m_settingsData.isEmpty(); return !m_settingsData.isEmpty();
} }
int ManageTokensController::order(const QString& symbol) const
{
const auto entry = m_settingsData.value(symbol, TokenOrder());
return entry.visible ? entry.sortOrder : undefinedTokenOrder;
}
int ManageTokensController::compareTokens(const QString& lhsSymbol, const QString& rhsSymbol) const int ManageTokensController::compareTokens(const QString& lhsSymbol, const QString& rhsSymbol) const
{ {
const auto left = m_settingsData.value(lhsSymbol, TokenOrder()); const auto left = m_settingsData.value(lhsSymbol, TokenOrder());

View File

@ -64,6 +64,7 @@ public:
Q_INVOKABLE QString serializeSettingsAsJson(); Q_INVOKABLE QString serializeSettingsAsJson();
Q_INVOKABLE int order(const QString& symbol) const;
Q_INVOKABLE int compareTokens(const QString& lhsSymbol, const QString& rhsSymbol) const; Q_INVOKABLE int compareTokens(const QString& lhsSymbol, const QString& rhsSymbol) const;
Q_INVOKABLE bool filterAcceptsSymbol(const QString& symbol) const; Q_INVOKABLE bool filterAcceptsSymbol(const QString& symbol) const;