mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added placeholder for Split's textEdit (#2143)
This commit is contained in:
parent
78c50399b8
commit
a27757e440
3 changed files with 29 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Unversioned
|
## Unversioned
|
||||||
|
|
||||||
|
- Minor: Added placeholder text for message text input box. (#2143)
|
||||||
- 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.
|
||||||
- Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083)
|
- Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "widgets/splits/Split.hpp"
|
#include "widgets/splits/Split.hpp"
|
||||||
|
|
||||||
|
#include "Application.hpp"
|
||||||
#include "common/Common.hpp"
|
#include "common/Common.hpp"
|
||||||
#include "common/Env.hpp"
|
#include "common/Env.hpp"
|
||||||
#include "common/NetworkRequest.hpp"
|
#include "common/NetworkRequest.hpp"
|
||||||
|
@ -132,6 +133,11 @@ Split::Split(QWidget *parent)
|
||||||
|
|
||||||
this->input_->ui_.textEdit->installEventFilter(parent);
|
this->input_->ui_.textEdit->installEventFilter(parent);
|
||||||
|
|
||||||
|
this->signalHolder_.managedConnect(
|
||||||
|
getApp()->accounts->twitch.currentUserChanged,
|
||||||
|
[this] { this->onAccountSelected(); });
|
||||||
|
this->onAccountSelected();
|
||||||
|
|
||||||
this->view_->mouseDown.connect([this](QMouseEvent *) { //
|
this->view_->mouseDown.connect([this](QMouseEvent *) { //
|
||||||
this->giveFocus(Qt::MouseFocusReason);
|
this->giveFocus(Qt::MouseFocusReason);
|
||||||
});
|
});
|
||||||
|
@ -275,6 +281,25 @@ void Split::setContainer(SplitContainer *container)
|
||||||
this->container_ = container;
|
this->container_ = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Split::onAccountSelected()
|
||||||
|
{
|
||||||
|
auto user = getApp()->accounts->twitch.getCurrent();
|
||||||
|
QString placeholderText;
|
||||||
|
|
||||||
|
if (user->isAnon())
|
||||||
|
{
|
||||||
|
placeholderText = "Log in to send messages...";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
placeholderText =
|
||||||
|
QString("Send message as %1...")
|
||||||
|
.arg(getApp()->accounts->twitch.getCurrent()->getUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
this->input_->ui_.textEdit->setPlaceholderText(placeholderText);
|
||||||
|
}
|
||||||
|
|
||||||
IndirectChannel Split::getIndirectChannel()
|
IndirectChannel Split::getIndirectChannel()
|
||||||
{
|
{
|
||||||
return this->channel_;
|
return this->channel_;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "common/Aliases.hpp"
|
#include "common/Aliases.hpp"
|
||||||
#include "common/Channel.hpp"
|
#include "common/Channel.hpp"
|
||||||
#include "common/NullablePtr.hpp"
|
#include "common/NullablePtr.hpp"
|
||||||
|
#include "pajlada/signals/signalholder.hpp"
|
||||||
#include "widgets/BaseWidget.hpp"
|
#include "widgets/BaseWidget.hpp"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
@ -95,6 +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();
|
||||||
|
|
||||||
SplitContainer *container_;
|
SplitContainer *container_;
|
||||||
IndirectChannel channel_;
|
IndirectChannel channel_;
|
||||||
|
@ -118,6 +120,7 @@ private:
|
||||||
pajlada::Signals::Connection roomModeChangedConnection_;
|
pajlada::Signals::Connection roomModeChangedConnection_;
|
||||||
|
|
||||||
pajlada::Signals::Connection indirectChannelChangedConnection_;
|
pajlada::Signals::Connection indirectChannelChangedConnection_;
|
||||||
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue