mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
7a8cc91eec
commit
13b39e374b
|
@ -16,7 +16,7 @@
|
|||
namespace chatterino {
|
||||
namespace messages {
|
||||
|
||||
bool Message::getCanHighlightTab() const
|
||||
bool Message::containsHighlightedPhrase() const
|
||||
{
|
||||
return this->highlightTab;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ typedef std::shared_ptr<Message> SharedMessage;
|
|||
class Message
|
||||
{
|
||||
public:
|
||||
bool getCanHighlightTab() const;
|
||||
bool containsHighlightedPhrase() const;
|
||||
void setHighlight(bool value);
|
||||
const QString &getTimeoutUser() const;
|
||||
int getTimeoutCount() const;
|
||||
|
|
|
@ -354,6 +354,10 @@ void ChannelView::setChannel(std::shared_ptr<Channel> newChannel)
|
|||
}
|
||||
}
|
||||
|
||||
if (message->containsHighlightedPhrase()) {
|
||||
this->highlightedMessageReceived.invoke();
|
||||
}
|
||||
|
||||
layoutMessages();
|
||||
update();
|
||||
});
|
||||
|
@ -533,7 +537,7 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
|||
// this->selectionMax.messageIndex >= messageIndex) {
|
||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||
//} else {
|
||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->containsHighlightedPhrase())
|
||||
? this->colorScheme.ChatBackgroundHighlighted
|
||||
: this->colorScheme.ChatBackground);
|
||||
//}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include <QTimer>
|
||||
#include <QWheelEvent>
|
||||
#include <QWidget>
|
||||
|
||||
#include <boost/signals2.hpp>
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
@ -103,6 +103,7 @@ public:
|
|||
|
||||
boost::signals2::signal<void(QMouseEvent *)> mouseDown;
|
||||
boost::signals2::signal<void()> selectionChanged;
|
||||
pajlada::Signals::NoArgSignal highlightedMessageReceived;
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *) override;
|
||||
|
|
|
@ -107,11 +107,17 @@ void NotebookTab::setSelected(bool value)
|
|||
{
|
||||
this->selected = value;
|
||||
|
||||
this->highlightState = HighlightState::None;
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
||||
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
||||
{
|
||||
if (this->isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->highlightState = newHighlightStyle;
|
||||
|
||||
this->update();
|
||||
|
|
|
@ -277,7 +277,7 @@ void Split::doPopup()
|
|||
|
||||
void Split::doClearChat()
|
||||
{
|
||||
view.clearMessages();
|
||||
this->view.clearMessages();
|
||||
}
|
||||
|
||||
void Split::doOpenChannel()
|
||||
|
|
|
@ -53,6 +53,11 @@ public:
|
|||
pajlada::Settings::Setting<std::string> channelName;
|
||||
boost::signals2::signal<void()> channelChanged;
|
||||
|
||||
ChannelView &getChannelView()
|
||||
{
|
||||
return this->view;
|
||||
}
|
||||
|
||||
const std::string &getUUID() const;
|
||||
std::shared_ptr<Channel> getChannel() const;
|
||||
std::shared_ptr<Channel> &getChannelRef();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "widgets/splitcontainer.hpp"
|
||||
#include "colorscheme.hpp"
|
||||
#include "common.hpp"
|
||||
#include "util/helpers.hpp"
|
||||
#include "widgets/helper/notebooktab.hpp"
|
||||
#include "widgets/notebook.hpp"
|
||||
|
@ -431,7 +432,13 @@ std::pair<int, int> SplitContainer::getChatPosition(const Split *chatWidget)
|
|||
|
||||
Split *SplitContainer::createChatWidget(const std::string &uuid)
|
||||
{
|
||||
return new Split(this->channelManager, this, uuid);
|
||||
auto split = new Split(this->channelManager, this, uuid);
|
||||
|
||||
split->getChannelView().highlightedMessageReceived.connect([this] {
|
||||
this->tab->setHighlightState(HighlightState::Highlighted); //
|
||||
});
|
||||
|
||||
return split;
|
||||
}
|
||||
|
||||
void SplitContainer::refreshTitle()
|
||||
|
|
Loading…
Reference in a new issue