Further placeholder text fixes (#2264)

This commit is contained in:
Paweł 2020-12-13 12:16:08 +01:00 committed by GitHub
parent 155b40985b
commit ddcc8545d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 21 deletions

View file

@ -12,7 +12,7 @@
- Minor: Added a keyboard shortcut (Ctrl+F5) for "Reconnect" (#2215) - Minor: Added a keyboard shortcut (Ctrl+F5) for "Reconnect" (#2215)
- Minor: Made `Try to find usernames without @ prefix` option still resolve usernames when special characters (commas, dots, (semi)colons, exclamation mark, question mark) are appended to them. (#2212) - Minor: Made `Try to find usernames without @ prefix` option still resolve usernames when special characters (commas, dots, (semi)colons, exclamation mark, question mark) are appended to them. (#2212)
- Minor: Made usercard update user's display name (#2160) - Minor: Made usercard update user's display name (#2160)
- Minor: Added placeholder text for message text input box. (#2143, #2149) - Minor: Added placeholder text for message text input box. (#2143, #2149, #2264)
- Minor: Added support for FrankerFaceZ badges. (#2101, part of #1658) - Minor: Added support for FrankerFaceZ badges. (#2101, part of #1658)
- Minor: Added a navigation list to the settings and reordered them. - Minor: Added a navigation list to the settings and reordered them.
- Minor: Added a link to twitchemotes.com to context menu when right-clicking Twitch emotes. (#2214) - Minor: Added a link to twitchemotes.com to context menu when right-clicking Twitch emotes. (#2214)

View file

@ -137,11 +137,15 @@ Split::Split(QWidget *parent)
this->input_->ui_.textEdit->installEventFilter(parent); this->input_->ui_.textEdit->installEventFilter(parent);
// update placeheolder text on Twitch account change and channel change
this->signalHolder_.managedConnect( this->signalHolder_.managedConnect(
getApp()->accounts->twitch.currentUserChanged, [this] { getApp()->accounts->twitch.currentUserChanged, [this] {
this->onAccountSelected(); this->updateInputPlaceholder();
}); });
this->onAccountSelected(); this->signalHolder_.managedConnect(channelChanged, [this] {
this->updateInputPlaceholder();
});
this->updateInputPlaceholder();
this->view_->mouseDown.connect([this](QMouseEvent *) { this->view_->mouseDown.connect([this](QMouseEvent *) {
this->giveFocus(Qt::MouseFocusReason); this->giveFocus(Qt::MouseFocusReason);
@ -290,7 +294,7 @@ void Split::setContainer(SplitContainer *container)
this->container_ = container; this->container_ = container;
} }
void Split::onAccountSelected() void Split::updateInputPlaceholder()
{ {
if (!this->getChannel()->isTwitchChannel()) if (!this->getChannel()->isTwitchChannel())
{ {
@ -312,19 +316,6 @@ void Split::onAccountSelected()
} }
this->input_->ui_.textEdit->setPlaceholderText(placeholderText); this->input_->ui_.textEdit->setPlaceholderText(placeholderText);
this->updateTooltipColor();
this->signalHolder_.managedConnect(this->theme->updated, [this]() {
this->updateTooltipColor();
});
}
void Split::updateTooltipColor()
{
QPalette dankPalette;
dankPalette.setColor(QPalette::PlaceholderText,
this->theme->messages.textColors.chatPlaceholder);
this->input_->ui_.textEdit->setPalette(dankPalette);
} }
IndirectChannel Split::getIndirectChannel() IndirectChannel Split::getIndirectChannel()

View file

@ -96,8 +96,7 @@ protected:
private: private:
void channelNameUpdated(const QString &newChannelName); void channelNameUpdated(const QString &newChannelName);
void handleModifiers(Qt::KeyboardModifiers modifiers); void handleModifiers(Qt::KeyboardModifiers modifiers);
void onAccountSelected(); void updateInputPlaceholder();
void updateTooltipColor();
SplitContainer *container_; SplitContainer *container_;
IndirectChannel channel_; IndirectChannel channel_;

View file

@ -127,13 +127,17 @@ void SplitInput::scaleChangedEvent(float scale)
void SplitInput::themeChangedEvent() void SplitInput::themeChangedEvent()
{ {
QPalette palette; QPalette palette, placeholderPalette;
palette.setColor(QPalette::Foreground, this->theme->splits.input.text); palette.setColor(QPalette::WindowText, this->theme->splits.input.text);
placeholderPalette.setColor(
QPalette::PlaceholderText,
this->theme->messages.textColors.chatPlaceholder);
this->updateEmoteButton(); this->updateEmoteButton();
this->ui_.textEditLength->setPalette(palette); this->ui_.textEditLength->setPalette(palette);
this->ui_.textEdit->setPalette(placeholderPalette);
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet); this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
this->ui_.hbox->setMargin( this->ui_.hbox->setMargin(