summaryrefslogtreecommitdiff
path: root/src/statusbar.cpp
diff options
context:
space:
mode:
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
{