diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b2f67d3..b1ec3beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unversioned +- Minor: Added customizable timeout buttons to the user info popup - Minor: Deprecate loading of "v1" window layouts. If you haven't updated Chatterino in more than 2 years, there's a chance you will lose your window layout. - Minor: Disable checking for updates on unsupported platforms (#1874) - Bugfix: Fix bug preventing users from setting the highlight color of the second entry in the "User" highlights tab (#1898) diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index a48c3489..93157ba7 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -11,6 +11,8 @@ #include "singletons/Toasts.hpp" #include "widgets/Notebook.hpp" +using TimeoutButton = std::pair; + namespace chatterino { class HighlightPhrase; @@ -339,6 +341,13 @@ public: IntSetting hideSimilarMaxMessagesToCheck = { "/similarity/hideSimilarMaxMessagesToCheck", 3}; + /// Timeout buttons + + ChatterinoSetting> timeoutButtons = { + "/timeouts/timeoutButtons", + { { "s", 1 }, { "s", 30 }, { "m", 1 }, { "m", 5 }, + { "m", 30 }, { "h", 1 }, { "d", 1 }, { "w", 1 } } }; + private: void updateModerationActions(); }; diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 4e773866..feee5807 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -85,6 +85,17 @@ namespace { return channelPtr; }; + + const auto borderColor = QColor(255, 255, 255, 80); + + int calculateTimeoutDuration(TimeoutButton timeout) + { + static const QMap durations{ + {"s", 1}, {"m", 60}, {"h", 3600}, {"d", 86400}, {"w", 604800}, + }; + return timeout.second * durations[timeout.first]; + } + } // namespace UserInfoPopup::UserInfoPopup(bool closeAutomatically) @@ -628,99 +639,126 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget() QColor color1(255, 255, 255, 80); QColor color2(255, 255, 255, 0); - int buttonWidth = 24; + int buttonWidth = 40; + // int buttonWidth = 24; int buttonWidth2 = 32; int buttonHeight = 32; layout->setSpacing(16); - auto addButton = [&](Action action, const QString &text, - const QPixmap &pixmap) { + //auto addButton = [&](Action action, const QString &text, + // const QPixmap &pixmap) { + // auto vbox = layout.emplace().withoutMargin(); + // { + // auto title = vbox.emplace().withoutMargin(); + // title->addStretch(1); + // auto label = title.emplace