summaryrefslogtreecommitdiff
path: root/src/statusbar.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-06-14 01:38:07 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-06-14 01:38:07 -0400
commit616925ebbb8e916119f8dbee0c1f0cb97b14a68b (patch)
tree543883f92fced3a3cd92537d5dc6ec5d2a9e5a12 /src/statusbar.cpp
parenta7757e8ba6f5d10feea9e58611bde4dcb911079b (diff)
moved api user account classes to their own files
api label in status bar: - now shows when not logged in - changed some of the colour thresholds to correspond to real throttling numbers make sure the api key is also cleared from the access manager when clearing from the settings removed unused bool m_ValidateAttempted in NXMAccessManager update the window title and status bar api label with correct values on startup, which fixes incorrect values when "restarting" MO after changing nexus settings
Diffstat (limited to 'src/statusbar.cpp')
-rw-r--r--src/statusbar.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/statusbar.cpp b/src/statusbar.cpp
index 4effa6a3..712eb005 100644
--- a/src/statusbar.cpp
+++ b/src/statusbar.cpp
@@ -48,28 +48,34 @@ void StatusBar::setNotifications(bool hasNotifications)
void StatusBar::setAPI(const APIStats& stats, const APIUserAccount& user)
{
- m_api->setText(
- QString("API: Q: %1 | D: %2 | H: %3")
- .arg(stats.requestsQueued)
- .arg(user.limits().remainingDailyRequests)
- .arg(user.limits().remainingHourlyRequests));
-
+ QString text;
QString textColor;
QString backgroundColor;
if (user.type() == APIUserAccountTypes::None) {
- backgroundColor = "transparent";
- } else if (user.remainingRequests() > 300) {
+ text = "API: not logged in";
textColor = "white";
- backgroundColor = "darkgreen";
- } else if (user.remainingRequests() < 150) {
- textColor = "white";
- backgroundColor = "darkred";
+ backgroundColor = "transparent";
} else {
- textColor = "black";
- backgroundColor = "rgb(226, 192, 0)"; // yellow
+ text = QString("API: Queued: %1 | Daily: %2 | Hourly: %3")
+ .arg(stats.requestsQueued)
+ .arg(user.limits().remainingDailyRequests)
+ .arg(user.limits().remainingHourlyRequests);
+
+ if (user.remainingRequests() > 500) {
+ textColor = "white";
+ backgroundColor = "darkgreen";
+ } else if (user.remainingRequests() > 200) {
+ textColor = "black";
+ backgroundColor = "rgb(226, 192, 0)"; // yellow
+ } else {
+ textColor = "white";
+ backgroundColor = "darkred";
+ }
}
+ m_api->setText(text);
+
m_api->setStyleSheet(QString(R"(
QLabel
{