From 288ea5036b0826a17f28279cd22445d0d6af6c56 Mon Sep 17 00:00:00 2001 From: TranRed Date: Sun, 25 Aug 2019 14:57:31 +0200 Subject: [PATCH] did first requested refactors --- src/widgets/dialogs/UserInfoPopup.cpp | 25 ++++++++++++------------- src/widgets/dialogs/UserInfoPopup.hpp | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 45320eb54..960e58613 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -30,14 +30,14 @@ namespace { -const auto kBorderColor = QColor(255, 255, 255, 80); +const auto borderColor = QColor(255, 255, 255, 80); -int calculateTimeoutDuration(int durationPerUnit, const QString &unit) +int calculateTimeoutDuration(TimeoutButton timeout) { static const QMap durations{ {"s", 1}, {"m", 60}, {"h", 3600}, {"d", 86400}, {"w", 604800}, }; - return durationPerUnit * durations[unit]; + return timeout.second * durations[timeout.first]; } } // namespace @@ -104,8 +104,8 @@ UserInfoPopup::UserInfoPopup() auto usercard = user.emplace(this); usercard->getLabel().setText("Usercard"); - usercard->setBorderColor(kBorderColor); - viewLogs->setBorderColor(kBorderColor); + usercard->setBorderColor(borderColor); + viewLogs->setBorderColor(borderColor); auto mod = user.emplace