diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index f54dfa7d0..bf8406fee 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -28,7 +28,7 @@ public: BoolSetting showBadges = {"/appearance/messages/showBadges", true}; BoolSetting showLastMessageIndicator = {"/appearance/messages/showLastMessageIndicator", false}; IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern", Qt::VerPattern}; - BoolSetting hideEmptyInput = {"/appearance/hideEmptyInputBox", false}; + BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true}; BoolSetting showMessageLength = {"/appearance/messages/showMessageLength", false}; BoolSetting separateMessages = {"/appearance/messages/separateMessages", false}; // BoolSetting collapseLongMessages = {"/appearance/messages/collapseLongMessages", false}; diff --git a/src/util/InitUpdateButton.cpp b/src/util/InitUpdateButton.cpp index 9c719bd3f..acb584175 100644 --- a/src/util/InitUpdateButton.cpp +++ b/src/util/InitUpdateButton.cpp @@ -25,13 +25,14 @@ void initUpdateButton(RippleEffectButton &button, std::unique_ptr case UpdateDialog::Dismiss: { button.hide(); } break; + case UpdateDialog::Install: { + Updates::getInstance().installUpdates(); + } break; } }); -#ifdef Q_OS_WIN - handle.reset(dialog); - dialog->closing.connect([&handle] { handle.release(); }); -#endif + // handle.reset(dialog); + // dialog->closing.connect([&handle] { handle.release(); }); }); // update image when state changes diff --git a/src/widgets/dialogs/UpdateDialog.cpp b/src/widgets/dialogs/UpdateDialog.cpp index 9796c34c7..1b66177e7 100644 --- a/src/widgets/dialogs/UpdateDialog.cpp +++ b/src/widgets/dialogs/UpdateDialog.cpp @@ -40,8 +40,9 @@ void UpdateDialog::updateStatusChanged(Updates::Status status) switch (status) { case Updates::UpdateAvailable: { - this->ui_.label->setText(QString("An update (%1) is available.") - .arg(Updates::getInstance().getOnlineVersion())); + this->ui_.label->setText( + QString("An update (%1) is available.\n\nDo you want to download and install it?") + .arg(Updates::getInstance().getOnlineVersion())); } break; case Updates::SearchFailed: { @@ -49,8 +50,8 @@ void UpdateDialog::updateStatusChanged(Updates::Status status) } break; case Updates::Downloading: { - this->ui_.label->setText("Downloading updates."); - // this->setActionOnFocusLoss(BaseWindow::Nothing); + this->ui_.label->setText("Downloading updates.\n\nChatterino will restart " + "automatically when the download is done."); } break; case Updates::DownloadFailed: { diff --git a/src/widgets/dialogs/UpdateDialog.hpp b/src/widgets/dialogs/UpdateDialog.hpp index 56f662087..7b897f0e9 100644 --- a/src/widgets/dialogs/UpdateDialog.hpp +++ b/src/widgets/dialogs/UpdateDialog.hpp @@ -12,7 +12,7 @@ namespace chatterino { class UpdateDialog : public BaseWindow { public: - enum Button { Dismiss }; + enum Button { Dismiss, Install }; UpdateDialog(); diff --git a/src/widgets/settingspages/FeelPage.cpp b/src/widgets/settingspages/FeelPage.cpp index 0cae12edd..455eca9f8 100644 --- a/src/widgets/settingspages/FeelPage.cpp +++ b/src/widgets/settingspages/FeelPage.cpp @@ -8,14 +8,9 @@ #include #include -#ifdef USEWINSDK -#define WINDOW_TOPMOST "Window always on top" -#else -#define WINDOW_TOPMOST "Window always on top (requires restart)" -#endif -#define INPUT_EMPTY "Hide input box when empty" #define PAUSE_HOVERING "When hovering" -#define LAST_MSG "Mark the last message you read (dotted line)" +#define SCROLL_SMOOTH "Smooth scrolling" +#define SCROLL_NEWMSG "Smooth scrolling for new messages" #define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS "Only fetch chatters list for viewers under X viewers" @@ -29,10 +24,12 @@ FeelPage::FeelPage() auto layout = layoutCreator.setLayoutType(); + layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling)); + layout.append( + this->createCheckBox(SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages)); + auto form = layout.emplace().withoutMargin(); { - form->addRow("Window:", this->createCheckBox(WINDOW_TOPMOST, app->settings->windowTopMost)); - form->addRow("Messages:", this->createCheckBox(INPUT_EMPTY, app->settings->hideEmptyInput)); form->addRow( "", this->createCheckBox("Show which users joined the channel (up to 1000 chatters)", app->settings->showJoins)); @@ -40,47 +37,6 @@ FeelPage::FeelPage() "", this->createCheckBox("Show which users parted the channel (up to 1000 chatters)", app->settings->showParts)); - form->addRow("", this->createCheckBox("Show message length while typing", - getSettings()->showMessageLength)); - form->addRow("", this->createCheckBox(LAST_MSG, getSettings()->showLastMessageIndicator)); - { - auto *combo = new QComboBox(this); - combo->addItems({"Dotted", "Solid"}); - - const auto currentIndex = []() -> int { - switch (getApp()->settings->lastMessagePattern.getValue()) { - case Qt::SolidLine: { - return 1; - } - default: - case Qt::VerPattern: { - return 0; - } - } - }(); - combo->setCurrentIndex(currentIndex); - - QObject::connect(combo, - static_cast(&QComboBox::currentIndexChanged), - [](int index) { - Qt::BrushStyle brush; - switch (index) { - case 1: - brush = Qt::SolidPattern; - break; - default: - case 0: - brush = Qt::VerPattern; - break; - } - getSettings()->lastMessagePattern = brush; - }); - - auto hbox = form.emplace().withoutMargin(); - hbox.emplace("Last message indicator pattern"); - hbox.append(combo); - } - form->addRow("Pause chat:", this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover)); diff --git a/src/widgets/settingspages/LookPage.cpp b/src/widgets/settingspages/LookPage.cpp index 556e45023..54619f22b 100644 --- a/src/widgets/settingspages/LookPage.cpp +++ b/src/widgets/settingspages/LookPage.cpp @@ -17,21 +17,31 @@ #define THEME_ITEMS "White", "Light", "Dark", "Black" -#define TAB_X "Tab close button" +#define TAB_X "Show tab close button" #define TAB_PREF "Preferences button (ctrl+p to show)" #define TAB_USER "User button" -#define SCROLL_SMOOTH "Smooth scrolling" -#define SCROLL_NEWMSG "Smooth scrolling for new messages" - // clang-format off #define TIMESTAMP_FORMATS "hh:mm a", "h:mm a", "hh:mm:ss a", "h:mm:ss a", "HH:mm", "H:mm", "HH:mm:ss", "H:mm:ss" // clang-format on +#ifdef USEWINSDK +#define WINDOW_TOPMOST "Window always on top" +#else +#define WINDOW_TOPMOST "Window always on top (requires restart)" +#endif +#define INPUT_EMPTY "Show input box when empty" +#define LAST_MSG "Mark the last message you read" + namespace chatterino { LookPage::LookPage() : SettingsPage("Look", ":/images/theme.svg") +{ + this->initializeUi(); +} + +void LookPage::initializeUi() { LayoutCreator layoutCreator(this); @@ -72,10 +82,15 @@ void LookPage::addInterfaceTab(LayoutCreator layout) // ui scale { auto box = layout.emplace().withoutMargin(); - box.emplace("Scale: "); + box.emplace("Window scale: "); box.append(this->createUiScaleSlider()); } + layout.append(this->createCheckBox(WINDOW_TOPMOST, getSettings()->windowTopMost)); + + // -- + layout.emplace(false); + // tab x layout.append(this->createCheckBox(TAB_X, getSettings()->showTabCloseButton)); @@ -85,10 +100,10 @@ void LookPage::addInterfaceTab(LayoutCreator layout) layout.append(this->createCheckBox(TAB_USER, getSettings()->hideUserButton)); #endif - // scrolling - layout.append(this->createCheckBox(SCROLL_SMOOTH, getSettings()->enableSmoothScrolling)); + // empty input + layout.append(this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput)); layout.append( - this->createCheckBox(SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages)); + this->createCheckBox("Show message length while typing", getSettings()->showMessageLength)); layout->addStretch(1); } @@ -102,13 +117,12 @@ void LookPage::addMessageTab(LayoutCreator layout) layout.emplace(false); // timestamps - layout.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps)); - // auto tbox = layout.emplace().withoutMargin(); - // { - // tbox.emplace("Timestamp format (a = am/pm):"); - // tbox.append(this->createComboBox({TIMESTAMP_FORMATS}, - // getSettings()->timestampFormat)); tbox->addStretch(1); - // } + { + auto box = layout.emplace().withoutMargin(); + box.append(this->createCheckBox("Show timestamps", getSettings()->showTimestamps)); + box.append(this->createComboBox({TIMESTAMP_FORMATS}, getSettings()->timestampFormat)); + box->addStretch(1); + } // badges layout.append(this->createCheckBox("Show badges", getSettings()->showBadges)); @@ -156,6 +170,9 @@ void LookPage::addMessageTab(LayoutCreator layout) hbox.emplace("lines"); } + // last read message + this->addLastReadMessageIndicatorPatternSelector(layout); + // -- layout->addStretch(1); } @@ -216,6 +233,43 @@ void LookPage::addEmoteTab(LayoutCreator layout) layout->addStretch(1); } +void LookPage::addLastReadMessageIndicatorPatternSelector(LayoutCreator layout) +{ + // combo + auto *combo = new QComboBox(this); + combo->addItems({"Dotted line", "Solid line"}); + + const auto currentIndex = []() -> int { + switch (getApp()->settings->lastMessagePattern.getValue()) { + case Qt::SolidLine: + return 1; + case Qt::VerPattern: + default: + return 0; + } + }(); + combo->setCurrentIndex(currentIndex); + + QObject::connect(combo, static_cast(&QComboBox::currentIndexChanged), + [](int index) { + getSettings()->lastMessagePattern = [&] { + switch (index) { + case 1: + return Qt::SolidPattern; + case 0: + default: + return Qt::VerPattern; + } + }(); + }); + + // layout + auto hbox = layout.emplace().withoutMargin(); + hbox.append(this->createCheckBox(LAST_MSG, getSettings()->showLastMessageIndicator)); + hbox.append(combo); + hbox->addStretch(1); +} + ChannelPtr LookPage::createPreviewChannel() { auto channel = ChannelPtr(new Channel("preview", Channel::Misc)); @@ -226,7 +280,7 @@ ChannelPtr LookPage::createPreviewChannel() MessageElement::BadgeChannelAuthority)); message->addElement(new ImageElement(getApp()->resources->badgeSubscriber, MessageElement::BadgeSubscription)); - message->addElement(new TimestampElement()); + message->addElement(new TimestampElement(QTime(8, 13, 42))); message->addElement(new TextElement("username1:", MessageElement::Username, QColor("#0094FF"), FontStyle::ChatMediumBold)); message->addElement(new TextElement("This is a preview message :)", MessageElement::Text)); @@ -236,7 +290,7 @@ ChannelPtr LookPage::createPreviewChannel() auto message = MessagePtr(new Message()); message->addElement(new ImageElement(getApp()->resources->badgePremium, MessageElement::BadgeChannelAuthority)); - message->addElement(new TimestampElement()); + message->addElement(new TimestampElement(QTime(8, 15, 21))); message->addElement(new TextElement("username2:", MessageElement::Username, QColor("#FF6A00"), FontStyle::ChatMediumBold)); message->addElement(new TextElement("This is another one :)", MessageElement::Text)); diff --git a/src/widgets/settingspages/LookPage.hpp b/src/widgets/settingspages/LookPage.hpp index 86f5c3a29..0c8bd4a6e 100644 --- a/src/widgets/settingspages/LookPage.hpp +++ b/src/widgets/settingspages/LookPage.hpp @@ -16,10 +16,15 @@ class LookPage : public SettingsPage public: LookPage(); +private: + void initializeUi(); + void addInterfaceTab(LayoutCreator layout); void addMessageTab(LayoutCreator layout); void addEmoteTab(LayoutCreator layout); + void addLastReadMessageIndicatorPatternSelector(LayoutCreator layout); + QLayout *createThemeColorChanger(); QLayout *createFontChanger(); QLayout *createUiScaleSlider(); diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 079937125..d109ded04 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -103,7 +103,7 @@ Split::Split(QWidget *parent) }); this->input.textChanged.connect([=](const QString &newText) { - if (!app->settings->hideEmptyInput) { + if (app->settings->showEmptyInput) { return; } @@ -114,9 +114,9 @@ Split::Split(QWidget *parent) } }); - app->settings->hideEmptyInput.connect( - [this](const bool &hideEmptyInput, auto) { - if (hideEmptyInput && this->input.getInputText().length() == 0) { + app->settings->showEmptyInput.connect( + [this](const bool &showEmptyInput, auto) { + if (!showEmptyInput && this->input.getInputText().length() == 0) { this->input.hide(); } else { this->input.show();