mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added pausable
property to ChannelView
This commit is contained in:
parent
2e68852768
commit
0d4d301aa0
3 changed files with 16 additions and 3 deletions
|
@ -184,10 +184,20 @@ void ChannelView::initializeSignals()
|
||||||
getApp()->fonts->fontChanged.connect([this] { this->queueLayout(); }));
|
getApp()->fonts->fontChanged.connect([this] { this->queueLayout(); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChannelView::pausable() const
|
||||||
|
{
|
||||||
|
return pausable_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChannelView::setPausable(bool value)
|
||||||
|
{
|
||||||
|
this->pausable_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool ChannelView::paused() const
|
bool ChannelView::paused() const
|
||||||
{
|
{
|
||||||
/// No elements in the map -> not paused
|
/// No elements in the map -> not paused
|
||||||
return !this->pauses_.empty();
|
return this->pausable() && !this->pauses_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelView::pause(PauseReason reason, boost::optional<uint> msecs)
|
void ChannelView::pause(PauseReason reason, boost::optional<uint> msecs)
|
||||||
|
|
|
@ -66,6 +66,8 @@ public:
|
||||||
void updateLastReadMessage();
|
void updateLastReadMessage();
|
||||||
|
|
||||||
/// Pausing
|
/// Pausing
|
||||||
|
bool pausable() const;
|
||||||
|
void setPausable(bool value);
|
||||||
bool paused() const;
|
bool paused() const;
|
||||||
void pause(PauseReason reason, boost::optional<uint> msecs = boost::none);
|
void pause(PauseReason reason, boost::optional<uint> msecs = boost::none);
|
||||||
void unpause(PauseReason reason);
|
void unpause(PauseReason reason);
|
||||||
|
@ -153,6 +155,7 @@ private:
|
||||||
bool lastMessageHasAlternateBackground_ = false;
|
bool lastMessageHasAlternateBackground_ = false;
|
||||||
bool lastMessageHasAlternateBackgroundReverse_ = true;
|
bool lastMessageHasAlternateBackgroundReverse_ = true;
|
||||||
|
|
||||||
|
bool pausable_ = false;
|
||||||
QTimer pauseTimer_;
|
QTimer pauseTimer_;
|
||||||
std::unordered_map<PauseReason, boost::optional<SteadyClock::time_point>>
|
std::unordered_map<PauseReason, boost::optional<SteadyClock::time_point>>
|
||||||
pauses_;
|
pauses_;
|
||||||
|
|
|
@ -88,6 +88,7 @@ Split::Split(QWidget *parent)
|
||||||
, overlay_(new SplitOverlay(this))
|
, overlay_(new SplitOverlay(this))
|
||||||
{
|
{
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
|
this->view_->setPausable(true);
|
||||||
|
|
||||||
this->vbox_->setSpacing(0);
|
this->vbox_->setSpacing(0);
|
||||||
this->vbox_->setMargin(1);
|
this->vbox_->setMargin(1);
|
||||||
|
@ -124,8 +125,7 @@ Split::Split(QWidget *parent)
|
||||||
|
|
||||||
this->input_->ui_.textEdit->installEventFilter(parent);
|
this->input_->ui_.textEdit->installEventFilter(parent);
|
||||||
|
|
||||||
this->view_->mouseDown.connect([this](QMouseEvent *) {
|
this->view_->mouseDown.connect([this](QMouseEvent *) { //
|
||||||
//
|
|
||||||
this->giveFocus(Qt::MouseFocusReason);
|
this->giveFocus(Qt::MouseFocusReason);
|
||||||
});
|
});
|
||||||
this->view_->selectionChanged.connect([this]() {
|
this->view_->selectionChanged.connect([this]() {
|
||||||
|
|
Loading…
Reference in a new issue