@@ -16,7 +16,7 @@
|
|||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace messages {
|
namespace messages {
|
||||||
|
|
||||||
bool Message::getCanHighlightTab() const
|
bool Message::containsHighlightedPhrase() const
|
||||||
{
|
{
|
||||||
return this->highlightTab;
|
return this->highlightTab;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ typedef std::shared_ptr<Message> SharedMessage;
|
|||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool getCanHighlightTab() const;
|
bool containsHighlightedPhrase() const;
|
||||||
void setHighlight(bool value);
|
void setHighlight(bool value);
|
||||||
const QString &getTimeoutUser() const;
|
const QString &getTimeoutUser() const;
|
||||||
int getTimeoutCount() const;
|
int getTimeoutCount() const;
|
||||||
|
|||||||
@@ -354,6 +354,10 @@ void ChannelView::setChannel(std::shared_ptr<Channel> newChannel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message->containsHighlightedPhrase()) {
|
||||||
|
this->highlightedMessageReceived.invoke();
|
||||||
|
}
|
||||||
|
|
||||||
layoutMessages();
|
layoutMessages();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
@@ -533,7 +537,7 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
|||||||
// this->selectionMax.messageIndex >= messageIndex) {
|
// this->selectionMax.messageIndex >= messageIndex) {
|
||||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||||
//} else {
|
//} else {
|
||||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
painter.fillRect(buffer->rect(), (messageRef->getMessage()->containsHighlightedPhrase())
|
||||||
? this->colorScheme.ChatBackgroundHighlighted
|
? this->colorScheme.ChatBackgroundHighlighted
|
||||||
: this->colorScheme.ChatBackground);
|
: this->colorScheme.ChatBackground);
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include <boost/signals2.hpp>
|
#include <boost/signals2.hpp>
|
||||||
|
#include <pajlada/signals/signal.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
@@ -103,6 +103,7 @@ public:
|
|||||||
|
|
||||||
boost::signals2::signal<void(QMouseEvent *)> mouseDown;
|
boost::signals2::signal<void(QMouseEvent *)> mouseDown;
|
||||||
boost::signals2::signal<void()> selectionChanged;
|
boost::signals2::signal<void()> selectionChanged;
|
||||||
|
pajlada::Signals::NoArgSignal highlightedMessageReceived;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *) override;
|
virtual void resizeEvent(QResizeEvent *) override;
|
||||||
|
|||||||
@@ -107,11 +107,17 @@ void NotebookTab::setSelected(bool value)
|
|||||||
{
|
{
|
||||||
this->selected = value;
|
this->selected = value;
|
||||||
|
|
||||||
|
this->highlightState = HighlightState::None;
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
||||||
{
|
{
|
||||||
|
if (this->isSelected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->highlightState = newHighlightStyle;
|
this->highlightState = newHighlightStyle;
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ void Split::doPopup()
|
|||||||
|
|
||||||
void Split::doClearChat()
|
void Split::doClearChat()
|
||||||
{
|
{
|
||||||
view.clearMessages();
|
this->view.clearMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::doOpenChannel()
|
void Split::doOpenChannel()
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ public:
|
|||||||
pajlada::Settings::Setting<std::string> channelName;
|
pajlada::Settings::Setting<std::string> channelName;
|
||||||
boost::signals2::signal<void()> channelChanged;
|
boost::signals2::signal<void()> channelChanged;
|
||||||
|
|
||||||
|
ChannelView &getChannelView()
|
||||||
|
{
|
||||||
|
return this->view;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &getUUID() const;
|
const std::string &getUUID() const;
|
||||||
std::shared_ptr<Channel> getChannel() const;
|
std::shared_ptr<Channel> getChannel() const;
|
||||||
std::shared_ptr<Channel> &getChannelRef();
|
std::shared_ptr<Channel> &getChannelRef();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "widgets/splitcontainer.hpp"
|
#include "widgets/splitcontainer.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
|
#include "common.hpp"
|
||||||
#include "util/helpers.hpp"
|
#include "util/helpers.hpp"
|
||||||
#include "widgets/helper/notebooktab.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
#include "widgets/notebook.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)
|
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()
|
void SplitContainer::refreshTitle()
|
||||||
|
|||||||
Reference in New Issue
Block a user