Renamed private members
This commit is contained in:
@@ -17,10 +17,10 @@ AccountSwitchPopupWidget::AccountSwitchPopupWidget(QWidget *parent)
|
||||
|
||||
this->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
this->ui.accountSwitchWidget = new AccountSwitchWidget(this);
|
||||
this->ui_.accountSwitchWidget = new AccountSwitchWidget(this);
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
this->ui.accountSwitchWidget->setFocusPolicy(Qt::NoFocus);
|
||||
vbox->addWidget(this->ui.accountSwitchWidget);
|
||||
this->ui_.accountSwitchWidget->setFocusPolicy(Qt::NoFocus);
|
||||
vbox->addWidget(this->ui_.accountSwitchWidget);
|
||||
|
||||
// vbox->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
|
||||
@@ -41,7 +41,7 @@ AccountSwitchPopupWidget::AccountSwitchPopupWidget(QWidget *parent)
|
||||
|
||||
void AccountSwitchPopupWidget::refresh()
|
||||
{
|
||||
this->ui.accountSwitchWidget->refresh();
|
||||
this->ui_.accountSwitchWidget->refresh();
|
||||
}
|
||||
|
||||
void AccountSwitchPopupWidget::focusOutEvent(QFocusEvent *)
|
||||
|
||||
@@ -22,7 +22,7 @@ protected:
|
||||
private:
|
||||
struct {
|
||||
AccountSwitchWidget *accountSwitchWidget = nullptr;
|
||||
} ui;
|
||||
} ui_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -32,6 +32,21 @@ protected:
|
||||
// override;
|
||||
|
||||
private:
|
||||
struct {
|
||||
Split *split;
|
||||
} ui_;
|
||||
|
||||
struct Item {
|
||||
void *hwnd;
|
||||
AttachedWindow *window;
|
||||
QString winId;
|
||||
};
|
||||
|
||||
static std::vector<Item> items;
|
||||
|
||||
void attachToHwnd(void *attached);
|
||||
void updateWindowRect(void *attached);
|
||||
|
||||
void *target_;
|
||||
int yOffset_;
|
||||
int currentYOffset_;
|
||||
@@ -42,21 +57,6 @@ private:
|
||||
bool attached_ = false;
|
||||
#endif
|
||||
QTimer timer_;
|
||||
|
||||
struct {
|
||||
Split *split;
|
||||
} ui_;
|
||||
|
||||
void attachToHwnd(void *attached);
|
||||
void updateWindowRect(void *attached);
|
||||
|
||||
struct Item {
|
||||
void *hwnd;
|
||||
AttachedWindow *window;
|
||||
QString winId;
|
||||
};
|
||||
|
||||
static std::vector<Item> items;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -160,7 +160,7 @@ void BaseWindow::init()
|
||||
::SetWindowPos(HWND(this->winId()), topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0,
|
||||
0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
},
|
||||
this->managedConnections);
|
||||
this->managedConnections_);
|
||||
});
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
} ui_;
|
||||
|
||||
pajlada::Signals::SignalHolder connections_;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -34,7 +34,8 @@ protected:
|
||||
virtual QSize minimumSizeHint() const override;
|
||||
|
||||
private:
|
||||
pajlada::Signals::SignalHolder connections_;
|
||||
void updateSize();
|
||||
int getOffset();
|
||||
|
||||
QString text_;
|
||||
FontStyle fontStyle_;
|
||||
@@ -42,8 +43,7 @@ private:
|
||||
bool centered_ = false;
|
||||
bool hasOffset_ = true;
|
||||
|
||||
void updateSize();
|
||||
int getOffset();
|
||||
pajlada::Signals::SignalHolder connections_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
+68
-68
@@ -27,9 +27,9 @@ namespace chatterino {
|
||||
|
||||
Notebook::Notebook(QWidget *parent)
|
||||
: BaseWidget(parent)
|
||||
, addButton(this)
|
||||
, addButton_(this)
|
||||
{
|
||||
this->addButton.setHidden(true);
|
||||
this->addButton_.setHidden(true);
|
||||
|
||||
auto *shortcut_next = new QShortcut(QKeySequence("Ctrl+Tab"), this);
|
||||
QObject::connect(shortcut_next, &QShortcut::activated, [this] { this->selectNextTab(); });
|
||||
@@ -49,12 +49,12 @@ NotebookTab *Notebook::addPage(QWidget *page, QString title, bool select)
|
||||
item.page = page;
|
||||
item.tab = tab;
|
||||
|
||||
this->items.append(item);
|
||||
this->items_.append(item);
|
||||
|
||||
page->hide();
|
||||
page->setParent(this);
|
||||
|
||||
if (select || this->items.count() == 1) {
|
||||
if (select || this->items_.count() == 1) {
|
||||
this->select(page);
|
||||
}
|
||||
|
||||
@@ -67,24 +67,24 @@ NotebookTab *Notebook::addPage(QWidget *page, QString title, bool select)
|
||||
|
||||
void Notebook::removePage(QWidget *page)
|
||||
{
|
||||
for (int i = 0; i < this->items.count(); i++) {
|
||||
if (this->items[i].page == page) {
|
||||
if (this->items.count() == 1) {
|
||||
for (int i = 0; i < this->items_.count(); i++) {
|
||||
if (this->items_[i].page == page) {
|
||||
if (this->items_.count() == 1) {
|
||||
this->select(nullptr);
|
||||
} else if (i == this->items.count() - 1) {
|
||||
this->select(this->items[i - 1].page);
|
||||
} else if (i == this->items_.count() - 1) {
|
||||
this->select(this->items_[i - 1].page);
|
||||
} else {
|
||||
this->select(this->items[i + 1].page);
|
||||
this->select(this->items_[i + 1].page);
|
||||
}
|
||||
|
||||
this->items[i].page->deleteLater();
|
||||
this->items[i].tab->deleteLater();
|
||||
this->items_[i].page->deleteLater();
|
||||
this->items_[i].tab->deleteLater();
|
||||
|
||||
// if (this->items.empty()) {
|
||||
// this->addNewPage();
|
||||
// }
|
||||
|
||||
this->items.removeAt(i);
|
||||
this->items_.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -94,15 +94,15 @@ void Notebook::removePage(QWidget *page)
|
||||
|
||||
void Notebook::removeCurrentPage()
|
||||
{
|
||||
if (this->selectedPage != nullptr) {
|
||||
this->removePage(this->selectedPage);
|
||||
if (this->selectedPage_ != nullptr) {
|
||||
this->removePage(this->selectedPage_);
|
||||
}
|
||||
}
|
||||
|
||||
int Notebook::indexOf(QWidget *page) const
|
||||
{
|
||||
for (int i = 0; i < this->items.count(); i++) {
|
||||
if (this->items[i].page == page) {
|
||||
for (int i = 0; i < this->items_.count(); i++) {
|
||||
if (this->items_[i].page == page) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int Notebook::indexOf(QWidget *page) const
|
||||
|
||||
void Notebook::select(QWidget *page)
|
||||
{
|
||||
if (page == this->selectedPage) {
|
||||
if (page == this->selectedPage_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,35 +137,35 @@ void Notebook::select(QWidget *page)
|
||||
}
|
||||
}
|
||||
|
||||
if (this->selectedPage != nullptr) {
|
||||
this->selectedPage->setHidden(true);
|
||||
if (this->selectedPage_ != nullptr) {
|
||||
this->selectedPage_->setHidden(true);
|
||||
|
||||
Item &item = this->findItem(selectedPage);
|
||||
Item &item = this->findItem(selectedPage_);
|
||||
item.tab->setSelected(false);
|
||||
|
||||
// for (auto split : this->selectedPage->getSplits()) {
|
||||
// split->updateLastReadMessage();
|
||||
// }
|
||||
|
||||
item.selectedWidget = this->selectedPage->focusWidget();
|
||||
item.selectedWidget = this->selectedPage_->focusWidget();
|
||||
}
|
||||
|
||||
this->selectedPage = page;
|
||||
this->selectedPage_ = page;
|
||||
|
||||
this->performLayout();
|
||||
}
|
||||
|
||||
bool Notebook::containsPage(QWidget *page)
|
||||
{
|
||||
return std::any_of(this->items.begin(), this->items.end(),
|
||||
return std::any_of(this->items_.begin(), this->items_.end(),
|
||||
[page](const auto &item) { return item.page == page; });
|
||||
}
|
||||
|
||||
Notebook::Item &Notebook::findItem(QWidget *page)
|
||||
{
|
||||
auto it = std::find_if(this->items.begin(), this->items.end(),
|
||||
auto it = std::find_if(this->items_.begin(), this->items_.end(),
|
||||
[page](const auto &item) { return page == item.page; });
|
||||
assert(it != this->items.end());
|
||||
assert(it != this->items_.end());
|
||||
return *it;
|
||||
}
|
||||
|
||||
@@ -182,64 +182,64 @@ bool Notebook::containsChild(const QObject *obj, const QObject *child)
|
||||
|
||||
void Notebook::selectIndex(int index)
|
||||
{
|
||||
if (index < 0 || this->items.count() <= index) {
|
||||
if (index < 0 || this->items_.count() <= index) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->select(this->items[index].page);
|
||||
this->select(this->items_[index].page);
|
||||
}
|
||||
|
||||
void Notebook::selectNextTab()
|
||||
{
|
||||
if (this->items.size() <= 1) {
|
||||
if (this->items_.size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = (this->indexOf(this->selectedPage) + 1) % this->items.count();
|
||||
int index = (this->indexOf(this->selectedPage_) + 1) % this->items_.count();
|
||||
|
||||
this->select(this->items[index].page);
|
||||
this->select(this->items_[index].page);
|
||||
}
|
||||
|
||||
void Notebook::selectPreviousTab()
|
||||
{
|
||||
if (this->items.size() <= 1) {
|
||||
if (this->items_.size() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = this->indexOf(this->selectedPage) - 1;
|
||||
int index = this->indexOf(this->selectedPage_) - 1;
|
||||
|
||||
if (index < 0) {
|
||||
index += this->items.count();
|
||||
index += this->items_.count();
|
||||
}
|
||||
|
||||
this->select(this->items[index].page);
|
||||
this->select(this->items_[index].page);
|
||||
}
|
||||
|
||||
int Notebook::getPageCount() const
|
||||
{
|
||||
return this->items.count();
|
||||
return this->items_.count();
|
||||
}
|
||||
|
||||
QWidget *Notebook::getPageAt(int index) const
|
||||
{
|
||||
return this->items[index].page;
|
||||
return this->items_[index].page;
|
||||
}
|
||||
|
||||
int Notebook::getSelectedIndex() const
|
||||
{
|
||||
return this->indexOf(this->selectedPage);
|
||||
return this->indexOf(this->selectedPage_);
|
||||
}
|
||||
|
||||
QWidget *Notebook::getSelectedPage() const
|
||||
{
|
||||
return this->selectedPage;
|
||||
return this->selectedPage_;
|
||||
}
|
||||
|
||||
QWidget *Notebook::tabAt(QPoint point, int &index, int maxWidth)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (auto &item : this->items) {
|
||||
for (auto &item : this->items_) {
|
||||
QRect rect = item.tab->getDesiredRect();
|
||||
rect.setHeight((int)(this->getScale() * 24));
|
||||
|
||||
@@ -259,40 +259,40 @@ QWidget *Notebook::tabAt(QPoint point, int &index, int maxWidth)
|
||||
|
||||
void Notebook::rearrangePage(QWidget *page, int index)
|
||||
{
|
||||
this->items.move(this->indexOf(page), index);
|
||||
this->items_.move(this->indexOf(page), index);
|
||||
|
||||
this->performLayout(true);
|
||||
}
|
||||
|
||||
bool Notebook::getAllowUserTabManagement() const
|
||||
{
|
||||
return this->allowUserTabManagement;
|
||||
return this->allowUserTabManagement_;
|
||||
}
|
||||
|
||||
void Notebook::setAllowUserTabManagement(bool value)
|
||||
{
|
||||
this->allowUserTabManagement = value;
|
||||
this->allowUserTabManagement_ = value;
|
||||
}
|
||||
|
||||
bool Notebook::getShowAddButton() const
|
||||
{
|
||||
return this->showAddButton;
|
||||
return this->showAddButton_;
|
||||
}
|
||||
|
||||
void Notebook::setShowAddButton(bool value)
|
||||
{
|
||||
this->showAddButton = value;
|
||||
this->showAddButton_ = value;
|
||||
|
||||
this->addButton.setHidden(!value);
|
||||
this->addButton_.setHidden(!value);
|
||||
}
|
||||
|
||||
void Notebook::scaleChangedEvent(float scale)
|
||||
{
|
||||
float h = NOTEBOOK_TAB_HEIGHT * this->getScale();
|
||||
|
||||
this->addButton.setFixedSize(h, h);
|
||||
this->addButton_.setFixedSize(h, h);
|
||||
|
||||
for (auto &i : this->items) {
|
||||
for (auto &i : this->items_) {
|
||||
i.tab->updateSize();
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ void Notebook::performLayout(bool animated)
|
||||
|
||||
int h = int(NOTEBOOK_TAB_HEIGHT * this->getScale());
|
||||
|
||||
for (auto *btn : this->customButtons) {
|
||||
for (auto *btn : this->customButtons_) {
|
||||
if (!btn->isVisible()) {
|
||||
continue;
|
||||
}
|
||||
@@ -324,9 +324,9 @@ void Notebook::performLayout(bool animated)
|
||||
int tabHeight = static_cast<int>(NOTEBOOK_TAB_HEIGHT * scale);
|
||||
bool first = true;
|
||||
|
||||
for (auto i = this->items.begin(); i != this->items.end(); i++) {
|
||||
for (auto i = this->items_.begin(); i != this->items_.end(); i++) {
|
||||
bool wrap =
|
||||
!first && (((i + 1 == this->items.end() && this->showAddButton) ? tabHeight : 0) + x +
|
||||
!first && (((i + 1 == this->items_.end() && this->showAddButton_) ? tabHeight : 0) + x +
|
||||
i->tab->width()) > width();
|
||||
|
||||
if (wrap) {
|
||||
@@ -343,29 +343,29 @@ void Notebook::performLayout(bool animated)
|
||||
first = false;
|
||||
}
|
||||
|
||||
if (this->showAddButton) {
|
||||
this->addButton.move(x, y);
|
||||
if (this->showAddButton_) {
|
||||
this->addButton_.move(x, y);
|
||||
}
|
||||
|
||||
if (this->lineY != y + tabHeight) {
|
||||
this->lineY = y + tabHeight;
|
||||
if (this->lineY_ != y + tabHeight) {
|
||||
this->lineY_ = y + tabHeight;
|
||||
this->update();
|
||||
}
|
||||
|
||||
y += int(3 * scale);
|
||||
|
||||
for (auto &i : this->items) {
|
||||
for (auto &i : this->items_) {
|
||||
i.tab->raise();
|
||||
}
|
||||
|
||||
if (this->showAddButton) {
|
||||
this->addButton.raise();
|
||||
if (this->showAddButton_) {
|
||||
this->addButton_.raise();
|
||||
}
|
||||
|
||||
if (this->selectedPage != nullptr) {
|
||||
this->selectedPage->move(0, y + tabHeight);
|
||||
this->selectedPage->resize(width(), height() - y - tabHeight);
|
||||
this->selectedPage->raise();
|
||||
if (this->selectedPage_ != nullptr) {
|
||||
this->selectedPage_->move(0, y + tabHeight);
|
||||
this->selectedPage_->resize(width(), height() - y - tabHeight);
|
||||
this->selectedPage_->raise();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,20 +374,20 @@ void Notebook::paintEvent(QPaintEvent *event)
|
||||
BaseWidget::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(0, this->lineY, this->width(), (int)(3 * this->getScale()),
|
||||
painter.fillRect(0, this->lineY_, this->width(), (int)(3 * this->getScale()),
|
||||
this->theme->tabs.bottomLine);
|
||||
}
|
||||
|
||||
NotebookButton *Notebook::getAddButton()
|
||||
{
|
||||
return &this->addButton;
|
||||
return &this->addButton_;
|
||||
}
|
||||
|
||||
NotebookButton *Notebook::addCustomButton()
|
||||
{
|
||||
NotebookButton *btn = new NotebookButton(this);
|
||||
|
||||
this->customButtons.push_back(btn);
|
||||
this->customButtons_.push_back(btn);
|
||||
|
||||
this->performLayout();
|
||||
return btn;
|
||||
@@ -395,7 +395,7 @@ NotebookButton *Notebook::addCustomButton()
|
||||
|
||||
NotebookTab *Notebook::getTabFromPage(QWidget *page)
|
||||
{
|
||||
for (auto &it : this->items) {
|
||||
for (auto &it : this->items_) {
|
||||
if (it.page == page) {
|
||||
return it.tab;
|
||||
}
|
||||
@@ -426,7 +426,7 @@ void SplitNotebook::addCustomButtons()
|
||||
|
||||
getApp()->settings->hidePreferencesButton.connect(
|
||||
[settingsBtn](bool hide, auto) { settingsBtn->setVisible(!hide); },
|
||||
this->uniqueConnections);
|
||||
this->connections_);
|
||||
|
||||
settingsBtn->setIcon(NotebookButton::Settings);
|
||||
|
||||
@@ -437,7 +437,7 @@ void SplitNotebook::addCustomButtons()
|
||||
auto userBtn = this->addCustomButton();
|
||||
userBtn->setVisible(!getApp()->settings->hideUserButton.getValue());
|
||||
getApp()->settings->hideUserButton.connect(
|
||||
[userBtn](bool hide, auto) { userBtn->setVisible(!hide); }, this->uniqueConnections);
|
||||
[userBtn](bool hide, auto) { userBtn->setVisible(!hide); }, this->connections_);
|
||||
|
||||
userBtn->setIcon(NotebookButton::User);
|
||||
QObject::connect(userBtn, &NotebookButton::clicked, [this, userBtn] {
|
||||
|
||||
+11
-12
@@ -64,22 +64,21 @@ private:
|
||||
QWidget *selectedWidget = nullptr;
|
||||
};
|
||||
|
||||
QList<Item> items;
|
||||
QWidget *selectedPage = nullptr;
|
||||
|
||||
bool containsPage(QWidget *page);
|
||||
Item &findItem(QWidget *page);
|
||||
|
||||
static bool containsChild(const QObject *obj, const QObject *child);
|
||||
|
||||
NotebookButton addButton;
|
||||
std::vector<NotebookButton *> customButtons;
|
||||
|
||||
bool allowUserTabManagement = false;
|
||||
bool showAddButton = false;
|
||||
int lineY = 20;
|
||||
|
||||
NotebookTab *getTabFromPage(QWidget *page);
|
||||
|
||||
QList<Item> items_;
|
||||
QWidget *selectedPage_ = nullptr;
|
||||
|
||||
NotebookButton addButton_;
|
||||
std::vector<NotebookButton *> customButtons_;
|
||||
|
||||
bool allowUserTabManagement_ = false;
|
||||
bool showAddButton_ = false;
|
||||
int lineY_ = 20;
|
||||
};
|
||||
|
||||
class SplitNotebook : public Notebook, pajlada::Signals::SignalHolder
|
||||
@@ -96,7 +95,7 @@ private:
|
||||
pajlada::Signals::SignalHolder signalHolder_;
|
||||
std::unique_ptr<UpdateDialog> updateDialogHandle_;
|
||||
|
||||
std::vector<pajlada::Signals::ScopedConnection> uniqueConnections;
|
||||
std::vector<pajlada::Signals::ScopedConnection> connections_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -64,6 +64,9 @@ protected:
|
||||
private:
|
||||
Q_PROPERTY(qreal currentValue_ READ getCurrentValue WRITE setCurrentValue)
|
||||
|
||||
LimitedQueueSnapshot<ScrollbarHighlight> getHighlightSnapshot();
|
||||
void updateScroll();
|
||||
|
||||
QMutex mutex_;
|
||||
|
||||
QPropertyAnimation currentValueAnimation_;
|
||||
@@ -71,7 +74,6 @@ private:
|
||||
LimitedQueue<ScrollbarHighlight> highlights_;
|
||||
bool highlightsPaused_{false};
|
||||
LimitedQueueSnapshot<ScrollbarHighlight> highlightSnapshot_;
|
||||
LimitedQueueSnapshot<ScrollbarHighlight> getHighlightSnapshot();
|
||||
|
||||
bool atBottom_{false};
|
||||
|
||||
@@ -94,8 +96,6 @@ private:
|
||||
|
||||
pajlada::Signals::NoArgSignal currentValueChanged_;
|
||||
pajlada::Signals::NoArgSignal desiredValueChanged_;
|
||||
|
||||
void updateScroll();
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -26,7 +26,7 @@ TooltipWidget *TooltipWidget::getInstance()
|
||||
|
||||
TooltipWidget::TooltipWidget(BaseWidget *parent)
|
||||
: BaseWindow(parent, BaseWindow::TopMost)
|
||||
, displayText(new QLabel())
|
||||
, displayText_(new QLabel())
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
@@ -39,19 +39,19 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
|
||||
this->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint |
|
||||
Qt::BypassWindowManagerHint);
|
||||
|
||||
displayText->setAlignment(Qt::AlignHCenter);
|
||||
displayText->setText("tooltip text");
|
||||
displayText_->setAlignment(Qt::AlignHCenter);
|
||||
displayText_->setText("tooltip text");
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(10, 5, 10, 5);
|
||||
layout->addWidget(displayText);
|
||||
layout->addWidget(displayText_);
|
||||
this->setLayout(layout);
|
||||
|
||||
this->fontChangedConnection = app->fonts->fontChanged.connect([this] { this->updateFont(); });
|
||||
this->fontChangedConnection_ = app->fonts->fontChanged.connect([this] { this->updateFont(); });
|
||||
}
|
||||
|
||||
TooltipWidget::~TooltipWidget()
|
||||
{
|
||||
this->fontChangedConnection.disconnect();
|
||||
this->fontChangedConnection_.disconnect();
|
||||
}
|
||||
|
||||
#ifdef USEWINSDK
|
||||
@@ -81,7 +81,7 @@ void TooltipWidget::updateFont()
|
||||
|
||||
void TooltipWidget::setText(QString text)
|
||||
{
|
||||
this->displayText->setText(text);
|
||||
this->displayText_->setText(text);
|
||||
}
|
||||
|
||||
void TooltipWidget::changeEvent(QEvent *)
|
||||
|
||||
@@ -31,10 +31,10 @@ protected:
|
||||
void scaleChangedEvent(float) override;
|
||||
|
||||
private:
|
||||
QLabel *displayText;
|
||||
pajlada::Signals::Connection fontChangedConnection;
|
||||
|
||||
void updateFont();
|
||||
|
||||
QLabel *displayText_;
|
||||
pajlada::Signals::Connection fontChangedConnection_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -15,16 +15,16 @@ namespace chatterino {
|
||||
EmotePopup::EmotePopup()
|
||||
: BaseWindow(nullptr, BaseWindow::EnableCustomFrame)
|
||||
{
|
||||
this->viewEmotes = new ChannelView();
|
||||
this->viewEmojis = new ChannelView();
|
||||
this->viewEmotes_ = new ChannelView();
|
||||
this->viewEmojis_ = new ChannelView();
|
||||
|
||||
this->viewEmotes->setOverrideFlags(MessageElement::Flags(
|
||||
this->viewEmotes_->setOverrideFlags(MessageElement::Flags(
|
||||
MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages));
|
||||
this->viewEmojis->setOverrideFlags(MessageElement::Flags(
|
||||
this->viewEmojis_->setOverrideFlags(MessageElement::Flags(
|
||||
MessageElement::Default | MessageElement::AlwaysShow | MessageElement::EmoteImages));
|
||||
|
||||
this->viewEmotes->setEnableScrollingToBottom(false);
|
||||
this->viewEmojis->setEnableScrollingToBottom(false);
|
||||
this->viewEmotes_->setEnableScrollingToBottom(false);
|
||||
this->viewEmojis_->setEnableScrollingToBottom(false);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
this->getLayoutContainer()->setLayout(layout);
|
||||
@@ -33,14 +33,14 @@ EmotePopup::EmotePopup()
|
||||
layout->addWidget(notebook);
|
||||
layout->setMargin(0);
|
||||
|
||||
notebook->addPage(this->viewEmotes, "Emotes");
|
||||
notebook->addPage(this->viewEmojis, "Emojis");
|
||||
notebook->addPage(this->viewEmotes_, "Emotes");
|
||||
notebook->addPage(this->viewEmojis_, "Emojis");
|
||||
|
||||
this->loadEmojis();
|
||||
|
||||
this->viewEmotes->linkClicked.connect(
|
||||
this->viewEmotes_->linkClicked.connect(
|
||||
[this](const Link &link) { this->linkClicked.invoke(link); });
|
||||
this->viewEmojis->linkClicked.connect(
|
||||
this->viewEmojis_->linkClicked.connect(
|
||||
[this](const Link &link) { this->linkClicked.invoke(link); });
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
|
||||
addEmotes(*channel->ffzChannelEmotes.get(), "FrankerFaceZ Channel Emotes",
|
||||
"FrankerFaceZ Channel Emote");
|
||||
|
||||
this->viewEmotes->setChannel(emoteChannel);
|
||||
this->viewEmotes_->setChannel(emoteChannel);
|
||||
}
|
||||
|
||||
void EmotePopup::loadEmojis()
|
||||
@@ -155,7 +155,7 @@ void EmotePopup::loadEmojis()
|
||||
});
|
||||
emojiChannel->addMessage(builder.getMessage());
|
||||
|
||||
this->viewEmojis->setChannel(emojiChannel);
|
||||
this->viewEmojis_->setChannel(emojiChannel);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -19,8 +19,8 @@ public:
|
||||
pajlada::Signals::Signal<Link> linkClicked;
|
||||
|
||||
private:
|
||||
ChannelView *viewEmotes;
|
||||
ChannelView *viewEmojis;
|
||||
ChannelView *viewEmotes_;
|
||||
ChannelView *viewEmojis_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -63,22 +63,22 @@ void LogInWithCredentials(const std::string &userID, const std::string &username
|
||||
|
||||
BasicLoginWidget::BasicLoginWidget()
|
||||
{
|
||||
this->setLayout(&this->ui.layout);
|
||||
this->setLayout(&this->ui_.layout);
|
||||
|
||||
this->ui.loginButton.setText("Log in (Opens in browser)");
|
||||
this->ui.pasteCodeButton.setText("Paste code");
|
||||
this->ui_.loginButton.setText("Log in (Opens in browser)");
|
||||
this->ui_.pasteCodeButton.setText("Paste code");
|
||||
|
||||
this->ui.horizontalLayout.addWidget(&this->ui.loginButton);
|
||||
this->ui.horizontalLayout.addWidget(&this->ui.pasteCodeButton);
|
||||
this->ui_.horizontalLayout.addWidget(&this->ui_.loginButton);
|
||||
this->ui_.horizontalLayout.addWidget(&this->ui_.pasteCodeButton);
|
||||
|
||||
this->ui.layout.addLayout(&this->ui.horizontalLayout);
|
||||
this->ui_.layout.addLayout(&this->ui_.horizontalLayout);
|
||||
|
||||
connect(&this->ui.loginButton, &QPushButton::clicked, []() {
|
||||
connect(&this->ui_.loginButton, &QPushButton::clicked, []() {
|
||||
printf("open login in browser\n");
|
||||
QDesktopServices::openUrl(QUrl("https://chatterino.com/client_login"));
|
||||
});
|
||||
|
||||
connect(&this->ui.pasteCodeButton, &QPushButton::clicked, [this]() {
|
||||
connect(&this->ui_.pasteCodeButton, &QPushButton::clicked, [this]() {
|
||||
QClipboard *clipboard = QGuiApplication::clipboard();
|
||||
QString clipboardString = clipboard->text();
|
||||
QStringList parameters = clipboardString.split(';');
|
||||
@@ -115,78 +115,80 @@ BasicLoginWidget::BasicLoginWidget()
|
||||
|
||||
AdvancedLoginWidget::AdvancedLoginWidget()
|
||||
{
|
||||
this->setLayout(&this->ui.layout);
|
||||
this->setLayout(&this->ui_.layout);
|
||||
|
||||
this->ui.instructionsLabel.setText("1. Fill in your username\n2. Fill in your user ID or press "
|
||||
"the 'Get user ID from username' button\n3. Fill in your "
|
||||
"Client ID\n4. Fill in your OAuth Token\n5. Press Add User");
|
||||
this->ui.instructionsLabel.setWordWrap(true);
|
||||
this->ui_.instructionsLabel.setText(
|
||||
"1. Fill in your username\n2. Fill in your user ID or press "
|
||||
"the 'Get user ID from username' button\n3. Fill in your "
|
||||
"Client ID\n4. Fill in your OAuth Token\n5. Press Add User");
|
||||
this->ui_.instructionsLabel.setWordWrap(true);
|
||||
|
||||
this->ui.layout.addWidget(&this->ui.instructionsLabel);
|
||||
this->ui.layout.addLayout(&this->ui.formLayout);
|
||||
this->ui.layout.addLayout(&this->ui.buttonUpperRow.layout);
|
||||
this->ui.layout.addLayout(&this->ui.buttonLowerRow.layout);
|
||||
this->ui_.layout.addWidget(&this->ui_.instructionsLabel);
|
||||
this->ui_.layout.addLayout(&this->ui_.formLayout);
|
||||
this->ui_.layout.addLayout(&this->ui_.buttonUpperRow.layout);
|
||||
this->ui_.layout.addLayout(&this->ui_.buttonLowerRow.layout);
|
||||
|
||||
this->refreshButtons();
|
||||
|
||||
/// Form
|
||||
this->ui.formLayout.addRow("Username", &this->ui.usernameInput);
|
||||
this->ui.formLayout.addRow("User ID", &this->ui.userIDInput);
|
||||
this->ui.formLayout.addRow("Client ID", &this->ui.clientIDInput);
|
||||
this->ui.formLayout.addRow("Oauth token", &this->ui.oauthTokenInput);
|
||||
this->ui_.formLayout.addRow("Username", &this->ui_.usernameInput);
|
||||
this->ui_.formLayout.addRow("User ID", &this->ui_.userIDInput);
|
||||
this->ui_.formLayout.addRow("Client ID", &this->ui_.clientIDInput);
|
||||
this->ui_.formLayout.addRow("Oauth token", &this->ui_.oauthTokenInput);
|
||||
|
||||
this->ui.oauthTokenInput.setEchoMode(QLineEdit::Password);
|
||||
this->ui_.oauthTokenInput.setEchoMode(QLineEdit::Password);
|
||||
|
||||
connect(&this->ui.userIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui.usernameInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui.clientIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui.oauthTokenInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.userIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.usernameInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged, [=]() { this->refreshButtons(); });
|
||||
|
||||
/// Upper button row
|
||||
|
||||
this->ui.buttonUpperRow.addUserButton.setText("Add user");
|
||||
this->ui.buttonUpperRow.clearFieldsButton.setText("Clear fields");
|
||||
this->ui_.buttonUpperRow.addUserButton.setText("Add user");
|
||||
this->ui_.buttonUpperRow.clearFieldsButton.setText("Clear fields");
|
||||
|
||||
this->ui.buttonUpperRow.layout.addWidget(&this->ui.buttonUpperRow.addUserButton);
|
||||
this->ui.buttonUpperRow.layout.addWidget(&this->ui.buttonUpperRow.clearFieldsButton);
|
||||
this->ui_.buttonUpperRow.layout.addWidget(&this->ui_.buttonUpperRow.addUserButton);
|
||||
this->ui_.buttonUpperRow.layout.addWidget(&this->ui_.buttonUpperRow.clearFieldsButton);
|
||||
|
||||
connect(&this->ui.buttonUpperRow.clearFieldsButton, &QPushButton::clicked, [=]() {
|
||||
this->ui.userIDInput.clear();
|
||||
this->ui.usernameInput.clear();
|
||||
this->ui.clientIDInput.clear();
|
||||
this->ui.oauthTokenInput.clear();
|
||||
connect(&this->ui_.buttonUpperRow.clearFieldsButton, &QPushButton::clicked, [=]() {
|
||||
this->ui_.userIDInput.clear();
|
||||
this->ui_.usernameInput.clear();
|
||||
this->ui_.clientIDInput.clear();
|
||||
this->ui_.oauthTokenInput.clear();
|
||||
});
|
||||
|
||||
connect(&this->ui.buttonUpperRow.addUserButton, &QPushButton::clicked, [=]() {
|
||||
std::string userID = this->ui.userIDInput.text().toStdString();
|
||||
std::string username = this->ui.usernameInput.text().toStdString();
|
||||
std::string clientID = this->ui.clientIDInput.text().toStdString();
|
||||
std::string oauthToken = this->ui.oauthTokenInput.text().toStdString();
|
||||
connect(&this->ui_.buttonUpperRow.addUserButton, &QPushButton::clicked, [=]() {
|
||||
std::string userID = this->ui_.userIDInput.text().toStdString();
|
||||
std::string username = this->ui_.usernameInput.text().toStdString();
|
||||
std::string clientID = this->ui_.clientIDInput.text().toStdString();
|
||||
std::string oauthToken = this->ui_.oauthTokenInput.text().toStdString();
|
||||
|
||||
LogInWithCredentials(userID, username, clientID, oauthToken);
|
||||
});
|
||||
|
||||
/// Lower button row
|
||||
this->ui.buttonLowerRow.fillInUserIDButton.setText("Get user ID from username");
|
||||
this->ui_.buttonLowerRow.fillInUserIDButton.setText("Get user ID from username");
|
||||
|
||||
this->ui.buttonLowerRow.layout.addWidget(&this->ui.buttonLowerRow.fillInUserIDButton);
|
||||
this->ui_.buttonLowerRow.layout.addWidget(&this->ui_.buttonLowerRow.fillInUserIDButton);
|
||||
|
||||
connect(&this->ui.buttonLowerRow.fillInUserIDButton, &QPushButton::clicked, [=]() {
|
||||
twitchApiGetUserID(this->ui.usernameInput.text(), this, [=](const QString &userID) {
|
||||
this->ui.userIDInput.setText(userID); //
|
||||
connect(&this->ui_.buttonLowerRow.fillInUserIDButton, &QPushButton::clicked, [=]() {
|
||||
twitchApiGetUserID(this->ui_.usernameInput.text(), this, [=](const QString &userID) {
|
||||
this->ui_.userIDInput.setText(userID); //
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void AdvancedLoginWidget::refreshButtons()
|
||||
{
|
||||
this->ui.buttonLowerRow.fillInUserIDButton.setEnabled(!this->ui.usernameInput.text().isEmpty());
|
||||
this->ui_.buttonLowerRow.fillInUserIDButton.setEnabled(
|
||||
!this->ui_.usernameInput.text().isEmpty());
|
||||
|
||||
if (this->ui.userIDInput.text().isEmpty() || this->ui.usernameInput.text().isEmpty() ||
|
||||
this->ui.clientIDInput.text().isEmpty() || this->ui.oauthTokenInput.text().isEmpty()) {
|
||||
this->ui.buttonUpperRow.addUserButton.setEnabled(false);
|
||||
if (this->ui_.userIDInput.text().isEmpty() || this->ui_.usernameInput.text().isEmpty() ||
|
||||
this->ui_.clientIDInput.text().isEmpty() || this->ui_.oauthTokenInput.text().isEmpty()) {
|
||||
this->ui_.buttonUpperRow.addUserButton.setEnabled(false);
|
||||
} else {
|
||||
this->ui.buttonUpperRow.addUserButton.setEnabled(true);
|
||||
this->ui_.buttonUpperRow.addUserButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,21 +199,21 @@ LoginWidget::LoginWidget()
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
#endif
|
||||
|
||||
this->setLayout(&this->ui.mainLayout);
|
||||
this->setLayout(&this->ui_.mainLayout);
|
||||
|
||||
this->ui.mainLayout.addWidget(&this->ui.tabWidget);
|
||||
this->ui_.mainLayout.addWidget(&this->ui_.tabWidget);
|
||||
|
||||
this->ui.tabWidget.addTab(&this->ui.basic, "Basic");
|
||||
this->ui_.tabWidget.addTab(&this->ui_.basic, "Basic");
|
||||
|
||||
this->ui.tabWidget.addTab(&this->ui.advanced, "Advanced");
|
||||
this->ui_.tabWidget.addTab(&this->ui_.advanced, "Advanced");
|
||||
|
||||
this->ui.buttonBox.setStandardButtons(QDialogButtonBox::Close);
|
||||
this->ui_.buttonBox.setStandardButtons(QDialogButtonBox::Close);
|
||||
|
||||
QObject::connect(&this->ui.buttonBox, &QDialogButtonBox::rejected, [this]() {
|
||||
QObject::connect(&this->ui_.buttonBox, &QDialogButtonBox::rejected, [this]() {
|
||||
this->close(); //
|
||||
});
|
||||
|
||||
this->ui.mainLayout.addWidget(&this->ui.buttonBox);
|
||||
this->ui_.mainLayout.addWidget(&this->ui_.buttonBox);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
QHBoxLayout horizontalLayout;
|
||||
QPushButton loginButton;
|
||||
QPushButton pasteCodeButton;
|
||||
} ui;
|
||||
} ui_;
|
||||
};
|
||||
|
||||
class AdvancedLoginWidget : public QWidget
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
QPushButton fillInUserIDButton;
|
||||
} buttonLowerRow;
|
||||
} ui;
|
||||
} ui_;
|
||||
};
|
||||
|
||||
class LoginWidget : public QDialog
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
BasicLoginWidget basic;
|
||||
|
||||
AdvancedLoginWidget advanced;
|
||||
} ui;
|
||||
} ui_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -16,15 +16,15 @@ public:
|
||||
void setInfo(std::shared_ptr<Channel> channel, QString userName);
|
||||
|
||||
private:
|
||||
ChannelView *channelView_ = nullptr;
|
||||
ChannelPtr channel_ = Channel::getEmpty();
|
||||
|
||||
QString userName_;
|
||||
|
||||
void initLayout();
|
||||
void setMessages(std::vector<MessagePtr> &messages);
|
||||
void getOverrustleLogs();
|
||||
void getLogviewerLogs();
|
||||
|
||||
ChannelView *channelView_ = nullptr;
|
||||
ChannelPtr channel_ = Channel::getEmpty();
|
||||
|
||||
QString userName_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -10,17 +10,17 @@ namespace chatterino {
|
||||
|
||||
NotificationPopup::NotificationPopup()
|
||||
: BaseWindow((QWidget *)nullptr, BaseWindow::Frameless)
|
||||
, channel(std::make_shared<Channel>("notifications", Channel::Type::None))
|
||||
, channel_(std::make_shared<Channel>("notifications", Channel::Type::None))
|
||||
|
||||
{
|
||||
this->channelView = new ChannelView(this);
|
||||
this->channelView_ = new ChannelView(this);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
this->setLayout(layout);
|
||||
|
||||
layout->addWidget(this->channelView);
|
||||
layout->addWidget(this->channelView_);
|
||||
|
||||
this->channelView->setChannel(this->channel);
|
||||
this->channelView_->setChannel(this->channel_);
|
||||
this->setScaleIndependantSize(300, 150);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void NotificationPopup::updatePosition()
|
||||
|
||||
void NotificationPopup::addMessage(MessagePtr msg)
|
||||
{
|
||||
this->channel->addMessage(msg);
|
||||
this->channel_->addMessage(msg);
|
||||
|
||||
// QTimer::singleShot(5000, this, [this, msg] { this->channel->remove });
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public:
|
||||
void updatePosition();
|
||||
|
||||
private:
|
||||
ChannelView *channelView;
|
||||
ChannelPtr channel;
|
||||
ChannelView *channelView_;
|
||||
ChannelPtr channel_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
QualityPopup::QualityPopup(const QString &_channelName, QStringList options)
|
||||
: channelName(_channelName)
|
||||
: channelName_(_channelName)
|
||||
{
|
||||
this->ui_.okButton.setText("OK");
|
||||
this->ui_.cancelButton.setText("Cancel");
|
||||
@@ -41,10 +41,10 @@ void QualityPopup::showDialog(const QString &channelName, QStringList options)
|
||||
|
||||
void QualityPopup::okButtonClicked()
|
||||
{
|
||||
QString channelURL = "twitch.tv/" + this->channelName;
|
||||
QString channelURL = "twitch.tv/" + this->channelName_;
|
||||
|
||||
try {
|
||||
OpenStreamlink(channelURL, this->ui_.selector.currentText());
|
||||
openStreamlink(channelURL, this->ui_.selector.currentText());
|
||||
} catch (const Exception &ex) {
|
||||
Log("Exception caught trying to open streamlink: {}", ex.what());
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ public:
|
||||
static void showDialog(const QString &_channelName, QStringList options);
|
||||
|
||||
private:
|
||||
void okButtonClicked();
|
||||
void cancelButtonClicked();
|
||||
|
||||
struct {
|
||||
QVBoxLayout vbox;
|
||||
QComboBox selector;
|
||||
@@ -24,10 +27,7 @@ private:
|
||||
QPushButton cancelButton;
|
||||
} ui_;
|
||||
|
||||
QString channelName;
|
||||
|
||||
void okButtonClicked();
|
||||
void cancelButtonClicked();
|
||||
QString channelName_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace chatterino {
|
||||
|
||||
SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
: BaseWindow(parent, BaseWindow::EnableCustomFrame)
|
||||
, selectedChannel(Channel::getEmpty())
|
||||
, selectedChannel_(Channel::getEmpty())
|
||||
{
|
||||
this->setWindowTitle("Select a channel to join");
|
||||
|
||||
this->tabFilter.dialog = this;
|
||||
this->tabFilter_.dialog = this;
|
||||
|
||||
LayoutCreator<QWidget> layoutWidget(this->getLayoutContainer());
|
||||
auto layout = layoutWidget.setLayoutType<QVBoxLayout>().withoutMargin();
|
||||
@@ -50,8 +50,8 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
channel_lbl->setVisible(enabled);
|
||||
});
|
||||
|
||||
channel_btn->installEventFilter(&this->tabFilter);
|
||||
channel_edit->installEventFilter(&this->tabFilter);
|
||||
channel_btn->installEventFilter(&this->tabFilter_);
|
||||
channel_edit->installEventFilter(&this->tabFilter_);
|
||||
|
||||
// whispers_btn
|
||||
auto whispers_btn =
|
||||
@@ -61,7 +61,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
.hidden();
|
||||
|
||||
whispers_lbl->setWordWrap(true);
|
||||
whispers_btn->installEventFilter(&this->tabFilter);
|
||||
whispers_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(whispers_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable { whispers_lbl->setVisible(enabled); });
|
||||
@@ -74,7 +74,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
.hidden();
|
||||
|
||||
mentions_lbl->setWordWrap(true);
|
||||
mentions_btn->installEventFilter(&this->tabFilter);
|
||||
mentions_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(mentions_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable { mentions_lbl->setVisible(enabled); });
|
||||
@@ -86,7 +86,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
vbox.emplace<QLabel>("Requires the chatterino browser extension.").hidden();
|
||||
|
||||
watching_lbl->setWordWrap(true);
|
||||
watching_btn->installEventFilter(&this->tabFilter);
|
||||
watching_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(watching_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable { watching_lbl->setVisible(enabled); });
|
||||
@@ -138,7 +138,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
|
||||
void SelectChannelDialog::ok()
|
||||
{
|
||||
this->_hasSelectedChannel = true;
|
||||
this->hasSelectedChannel_ = true;
|
||||
this->close();
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
|
||||
|
||||
assert(channel);
|
||||
|
||||
this->selectedChannel = channel;
|
||||
this->selectedChannel_ = channel;
|
||||
|
||||
switch (_channel.getType()) {
|
||||
case Channel::Type::Twitch: {
|
||||
@@ -174,13 +174,13 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
|
||||
}
|
||||
}
|
||||
|
||||
this->_hasSelectedChannel = false;
|
||||
this->hasSelectedChannel_ = false;
|
||||
}
|
||||
|
||||
IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
||||
{
|
||||
if (!this->_hasSelectedChannel) {
|
||||
return this->selectedChannel;
|
||||
if (!this->hasSelectedChannel_) {
|
||||
return this->selectedChannel_;
|
||||
}
|
||||
|
||||
auto app = getApp();
|
||||
@@ -199,12 +199,12 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
||||
}
|
||||
}
|
||||
|
||||
return this->selectedChannel;
|
||||
return this->selectedChannel_;
|
||||
}
|
||||
|
||||
bool SelectChannelDialog::hasSeletedChannel() const
|
||||
{
|
||||
return this->_hasSelectedChannel;
|
||||
return this->hasSelectedChannel_;
|
||||
}
|
||||
|
||||
bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched, QEvent *event)
|
||||
|
||||
@@ -16,7 +16,7 @@ class SelectChannelDialog : public BaseWindow
|
||||
public:
|
||||
SelectChannelDialog(QWidget *parent = nullptr);
|
||||
|
||||
void setSelectedChannel(IndirectChannel selectedChannel);
|
||||
void setSelectedChannel(IndirectChannel selectedChannel_);
|
||||
IndirectChannel getSelectedChannel() const;
|
||||
bool hasSeletedChannel() const;
|
||||
|
||||
@@ -47,10 +47,10 @@ private:
|
||||
} twitch;
|
||||
} ui_;
|
||||
|
||||
EventFilter tabFilter;
|
||||
EventFilter tabFilter_;
|
||||
|
||||
ChannelPtr selectedChannel;
|
||||
bool _hasSelectedChannel = false;
|
||||
ChannelPtr selectedChannel_;
|
||||
bool hasSelectedChannel_ = false;
|
||||
|
||||
void ok();
|
||||
friend class EventFilter;
|
||||
|
||||
@@ -28,7 +28,6 @@ SettingsDialog::SettingsDialog()
|
||||
: BaseWindow(nullptr, BaseWindow::DisableCustomScaling)
|
||||
{
|
||||
this->initUi();
|
||||
|
||||
this->addTabs();
|
||||
|
||||
this->scaleChangedEvent(this->getScale());
|
||||
@@ -63,10 +62,9 @@ void SettingsDialog::initUi()
|
||||
this->ui_.tabContainerContainer->setObjectName("tabWidget");
|
||||
this->ui_.pageStack->setObjectName("pages");
|
||||
|
||||
QObject::connect(this->ui_.okButton, &QPushButton::clicked, this,
|
||||
&SettingsDialog::okButtonClicked);
|
||||
QObject::connect(this->ui_.okButton, &QPushButton::clicked, this, &SettingsDialog::onOkClicked);
|
||||
QObject::connect(this->ui_.cancelButton, &QPushButton::clicked, this,
|
||||
&SettingsDialog::cancelButtonClicked);
|
||||
&SettingsDialog::onCancelClicked);
|
||||
}
|
||||
|
||||
SettingsDialog *SettingsDialog::getHandle()
|
||||
@@ -111,25 +109,25 @@ void SettingsDialog::addTab(SettingsPage *page, Qt::Alignment alignment)
|
||||
|
||||
this->ui_.pageStack->addWidget(page);
|
||||
this->ui_.tabContainer->addWidget(tab, 0, alignment);
|
||||
this->tabs.push_back(tab);
|
||||
this->tabs_.push_back(tab);
|
||||
|
||||
if (this->tabs.size() == 1) {
|
||||
this->select(tab);
|
||||
if (this->tabs_.size() == 1) {
|
||||
this->selectTab(tab);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::select(SettingsDialogTab *tab)
|
||||
void SettingsDialog::selectTab(SettingsDialogTab *tab)
|
||||
{
|
||||
this->ui_.pageStack->setCurrentWidget(tab->getSettingsPage());
|
||||
|
||||
if (this->selectedTab != nullptr) {
|
||||
this->selectedTab->setSelected(false);
|
||||
this->selectedTab->setStyleSheet("color: #FFF");
|
||||
if (this->selectedTab_ != nullptr) {
|
||||
this->selectedTab_->setSelected(false);
|
||||
this->selectedTab_->setStyleSheet("color: #FFF");
|
||||
}
|
||||
|
||||
tab->setSelected(true);
|
||||
tab->setStyleSheet("background: #555; color: #FFF");
|
||||
this->selectedTab = tab;
|
||||
this->selectedTab_ = tab;
|
||||
}
|
||||
|
||||
void SettingsDialog::showDialog(PreferredTab preferredTab)
|
||||
@@ -139,7 +137,7 @@ void SettingsDialog::showDialog(PreferredTab preferredTab)
|
||||
|
||||
switch (preferredTab) {
|
||||
case SettingsDialog::PreferredTab::Accounts: {
|
||||
instance->select(instance->tabs.at(0));
|
||||
instance->selectTab(instance->tabs_.at(0));
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -153,7 +151,7 @@ void SettingsDialog::refresh()
|
||||
{
|
||||
getApp()->settings->saveSnapshot();
|
||||
|
||||
for (auto *tab : this->tabs) {
|
||||
for (auto *tab : this->tabs_) {
|
||||
tab->getSettingsPage()->onShow();
|
||||
}
|
||||
}
|
||||
@@ -166,7 +164,7 @@ void SettingsDialog::scaleChangedEvent(float newDpi)
|
||||
styleSheet.replace("<font-size>", QString::number(int(14 * newDpi)));
|
||||
styleSheet.replace("<checkbox-size>", QString::number(int(14 * newDpi)));
|
||||
|
||||
for (SettingsDialogTab *tab : this->tabs) {
|
||||
for (SettingsDialogTab *tab : this->tabs_) {
|
||||
tab->setFixedHeight(int(30 * newDpi));
|
||||
}
|
||||
|
||||
@@ -185,14 +183,14 @@ void SettingsDialog::themeChangedEvent()
|
||||
}
|
||||
|
||||
///// Widget creation helpers
|
||||
void SettingsDialog::okButtonClicked()
|
||||
void SettingsDialog::onOkClicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void SettingsDialog::cancelButtonClicked()
|
||||
void SettingsDialog::onCancelClicked()
|
||||
{
|
||||
for (auto &tab : this->tabs) {
|
||||
for (auto &tab : this->tabs_) {
|
||||
tab->getSettingsPage()->cancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,18 @@ protected:
|
||||
virtual void themeChangedEvent() override;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
static SettingsDialog *handle;
|
||||
|
||||
void refresh();
|
||||
|
||||
void initUi();
|
||||
void addTabs();
|
||||
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
|
||||
void selectTab(SettingsDialogTab *tab);
|
||||
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
struct {
|
||||
QWidget *tabContainerContainer;
|
||||
QVBoxLayout *tabContainer;
|
||||
@@ -42,23 +51,10 @@ private:
|
||||
QPushButton *okButton;
|
||||
QPushButton *cancelButton;
|
||||
} ui_;
|
||||
|
||||
std::vector<SettingsDialogTab *> tabs;
|
||||
|
||||
void initUi();
|
||||
void addTabs();
|
||||
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
|
||||
|
||||
void select(SettingsDialogTab *tab);
|
||||
|
||||
SettingsDialogTab *selectedTab = nullptr;
|
||||
|
||||
void okButtonClicked();
|
||||
void cancelButtonClicked();
|
||||
std::vector<SettingsDialogTab *> tabs_;
|
||||
SettingsDialogTab *selectedTab_ = nullptr;
|
||||
|
||||
friend class SettingsDialogTab;
|
||||
|
||||
// static void setChildrensFont(QLayout *object, QFont &font, int indent = 0);
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -5,40 +5,50 @@ namespace chatterino {
|
||||
|
||||
TextInputDialog::TextInputDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, _vbox(this)
|
||||
, _okButton("OK")
|
||||
, _cancelButton("Cancel")
|
||||
, vbox_(this)
|
||||
, okButton_("OK")
|
||||
, cancelButton_("Cancel")
|
||||
{
|
||||
_vbox.addWidget(&_lineEdit);
|
||||
_vbox.addLayout(&_buttonBox);
|
||||
_buttonBox.addStretch(1);
|
||||
_buttonBox.addWidget(&_okButton);
|
||||
_buttonBox.addWidget(&_cancelButton);
|
||||
this->vbox_.addWidget(&lineEdit_);
|
||||
this->vbox_.addLayout(&buttonBox_);
|
||||
this->buttonBox_.addStretch(1);
|
||||
this->buttonBox_.addWidget(&okButton_);
|
||||
this->buttonBox_.addWidget(&cancelButton_);
|
||||
|
||||
QObject::connect(&_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
|
||||
QObject::connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
|
||||
QObject::connect(&this->okButton_, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
|
||||
QObject::connect(&this->cancelButton_, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
|
||||
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
setWindowFlags((windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
|
||||
Qt::MSWindowsFixedSizeDialogHint);
|
||||
this->setWindowFlags((this->windowFlags() & ~(Qt::WindowContextHelpButtonHint)) | Qt::Dialog |
|
||||
Qt::MSWindowsFixedSizeDialogHint);
|
||||
}
|
||||
|
||||
QString TextInputDialog::getText() const
|
||||
{
|
||||
return this->lineEdit_.text();
|
||||
}
|
||||
|
||||
void TextInputDialog::setText(const QString &text)
|
||||
{
|
||||
this->lineEdit_.setText(text);
|
||||
}
|
||||
|
||||
void TextInputDialog::okButtonClicked()
|
||||
{
|
||||
accept();
|
||||
close();
|
||||
this->accept();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void TextInputDialog::cancelButtonClicked()
|
||||
{
|
||||
reject();
|
||||
close();
|
||||
this->reject();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void TextInputDialog::highlightText()
|
||||
{
|
||||
this->_lineEdit.selectAll();
|
||||
this->lineEdit_.selectAll();
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -16,24 +16,17 @@ class TextInputDialog : public QDialog
|
||||
public:
|
||||
TextInputDialog(QWidget *parent = nullptr);
|
||||
|
||||
QString getText() const
|
||||
{
|
||||
return _lineEdit.text();
|
||||
}
|
||||
|
||||
void setText(const QString &text)
|
||||
{
|
||||
_lineEdit.setText(text);
|
||||
}
|
||||
QString getText() const;
|
||||
void setText(const QString &text);
|
||||
|
||||
void highlightText();
|
||||
|
||||
private:
|
||||
QVBoxLayout _vbox;
|
||||
QLineEdit _lineEdit;
|
||||
QHBoxLayout _buttonBox;
|
||||
QPushButton _okButton;
|
||||
QPushButton _cancelButton;
|
||||
QVBoxLayout vbox_;
|
||||
QLineEdit lineEdit_;
|
||||
QHBoxLayout buttonBox_;
|
||||
QPushButton okButton_;
|
||||
QPushButton cancelButton_;
|
||||
|
||||
private slots:
|
||||
void okButtonClicked();
|
||||
|
||||
@@ -94,7 +94,7 @@ UserInfoPopup::UserInfoPopup()
|
||||
[this] { this->channel_->sendMessage("/unmod " + this->userName_); });
|
||||
|
||||
// userstate
|
||||
this->userStateChanged.connect([this, mod, unmod]() mutable {
|
||||
this->userStateChanged_.connect([this, mod, unmod]() mutable {
|
||||
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(this->channel_.get());
|
||||
|
||||
if (twitchChannel) {
|
||||
@@ -118,7 +118,7 @@ UserInfoPopup::UserInfoPopup()
|
||||
{
|
||||
auto timeout = moderation.emplace<TimeoutWidget>();
|
||||
|
||||
this->userStateChanged.connect([this, lineMod, timeout]() mutable {
|
||||
this->userStateChanged_.connect([this, lineMod, timeout]() mutable {
|
||||
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(this->channel_.get());
|
||||
|
||||
if (twitchChannel) {
|
||||
@@ -232,7 +232,7 @@ void UserInfoPopup::setData(const QString &name, const ChannelPtr &channel)
|
||||
|
||||
this->updateUserData();
|
||||
|
||||
this->userStateChanged.invoke();
|
||||
this->userStateChanged_.invoke();
|
||||
}
|
||||
|
||||
void UserInfoPopup::updateUserData()
|
||||
|
||||
@@ -24,6 +24,10 @@ protected:
|
||||
virtual void themeChangedEvent() override;
|
||||
|
||||
private:
|
||||
void installEvents();
|
||||
void updateUserData();
|
||||
|
||||
void loadAvatar(const QUrl &url);
|
||||
bool isMod_;
|
||||
bool isBroadcaster_;
|
||||
|
||||
@@ -31,12 +35,7 @@ private:
|
||||
QString userId_;
|
||||
ChannelPtr channel_;
|
||||
|
||||
pajlada::Signals::NoArgSignal userStateChanged;
|
||||
|
||||
void installEvents();
|
||||
|
||||
void updateUserData();
|
||||
void loadAvatar(const QUrl &url);
|
||||
pajlada::Signals::NoArgSignal userStateChanged_;
|
||||
|
||||
std::shared_ptr<bool> hack_;
|
||||
|
||||
|
||||
@@ -70,13 +70,26 @@ protected:
|
||||
|
||||
void hideEvent(QHideEvent *) override;
|
||||
|
||||
void handleLinkClick(QMouseEvent *event, const Link &link,
|
||||
MessageLayout *layout);
|
||||
void handleLinkClick(QMouseEvent *event, const Link &link, MessageLayout *layout);
|
||||
|
||||
bool tryGetMessageAt(QPoint p, std::shared_ptr<MessageLayout> &message,
|
||||
QPoint &relativePos, int &index);
|
||||
bool tryGetMessageAt(QPoint p, std::shared_ptr<MessageLayout> &message, QPoint &relativePos,
|
||||
int &index);
|
||||
|
||||
private:
|
||||
void updatePauseStatus();
|
||||
void detachChannel();
|
||||
void actuallyLayoutMessages(bool causedByScollbar = false);
|
||||
|
||||
void drawMessages(QPainter &painter);
|
||||
void setSelection(const SelectionItem &start, const SelectionItem &end);
|
||||
MessageElement::Flags getFlags() const;
|
||||
bool isPaused();
|
||||
|
||||
void handleMouseClick(QMouseEvent *event, const MessageLayoutElement *hoverLayoutElement,
|
||||
MessageLayout *layout);
|
||||
void addContextMenuItems(const MessageLayoutElement *hoveredElement, MessageLayout *layout);
|
||||
int getLayoutWidth() const;
|
||||
|
||||
QTimer *layoutCooldown_;
|
||||
bool layoutQueued_;
|
||||
|
||||
@@ -88,7 +101,6 @@ private:
|
||||
bool pausedTemporarily_ = false;
|
||||
bool pausedBySelection_ = false;
|
||||
bool pausedByScrollingUp_ = false;
|
||||
void updatePauseStatus();
|
||||
int messagesAddedSinceSelectionPause_ = 0;
|
||||
|
||||
QTimer pauseTimeout_;
|
||||
@@ -97,23 +109,6 @@ private:
|
||||
|
||||
LimitedQueueSnapshot<MessageLayoutPtr> snapshot_;
|
||||
|
||||
void detachChannel();
|
||||
void actuallyLayoutMessages(bool causedByScollbar = false);
|
||||
|
||||
void drawMessages(QPainter &painter);
|
||||
void setSelection(const SelectionItem &start, const SelectionItem &end);
|
||||
MessageElement::Flags getFlags() const;
|
||||
bool isPaused();
|
||||
|
||||
void handleMouseClick(QMouseEvent *event,
|
||||
const MessageLayoutElement *hoverLayoutElement,
|
||||
MessageLayout *layout);
|
||||
void addContextMenuItems(const MessageLayoutElement *hoveredElement,
|
||||
MessageLayout *layout);
|
||||
|
||||
// void beginPause();
|
||||
// void endPause();
|
||||
|
||||
ChannelPtr channel_;
|
||||
|
||||
Scrollbar scrollBar_;
|
||||
@@ -149,8 +144,6 @@ private:
|
||||
|
||||
std::unordered_set<std::shared_ptr<MessageLayout>> messagesOnScreen_;
|
||||
|
||||
int getLayoutWidth() const;
|
||||
|
||||
private slots:
|
||||
void wordFlagsChanged()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ class ComboBoxItemDelegate : public QStyledItemDelegate
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ComboBoxItemDelegate(QObject *parent = 0);
|
||||
ComboBoxItemDelegate(QObject *parent = nullptr);
|
||||
~ComboBoxItemDelegate();
|
||||
|
||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
//#include "DropOverlay.hpp"
|
||||
|
||||
// namespace chatterino {
|
||||
// namespace widgets {
|
||||
// namespace helper {
|
||||
|
||||
// DropOverlay::DropOverlay()
|
||||
//{
|
||||
//}
|
||||
|
||||
//} // namespace helper
|
||||
//} // namespace widgets
|
||||
//} // namespace chatterino
|
||||
@@ -1,11 +0,0 @@
|
||||
//#pragma once
|
||||
|
||||
//#include "widgets/helper/SplitNode.hpp"
|
||||
|
||||
// namespace chatterino {
|
||||
// namespace widgets {
|
||||
// namespace helper {
|
||||
|
||||
//} // namespace helper
|
||||
//} // namespace widgets
|
||||
//} // namespace chatterino
|
||||
@@ -1,53 +0,0 @@
|
||||
#include "widgets/helper/DropPreview.hpp"
|
||||
#include "Application.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
NotebookPageDropPreview::NotebookPageDropPreview(BaseWidget *parent)
|
||||
: BaseWidget(parent)
|
||||
// , positionAnimation(this, "geometry")
|
||||
{
|
||||
// this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
||||
this->setHidden(true);
|
||||
}
|
||||
|
||||
void NotebookPageDropPreview::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||
painter.drawRect(8, 8, this->width() - 17, this->height() - 17);
|
||||
}
|
||||
|
||||
void NotebookPageDropPreview::hideEvent(QHideEvent *)
|
||||
{
|
||||
// this->animate = false;
|
||||
}
|
||||
|
||||
void NotebookPageDropPreview::setBounds(const QRect &rect)
|
||||
{
|
||||
// if (rect == this->desiredGeometry) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (this->animate) {
|
||||
// this->positionAnimation.stop();
|
||||
// this->positionAnimation.setDuration(50);
|
||||
// this->positionAnimation.setStartValue(this->geometry());
|
||||
// this->positionAnimation.setEndValue(rect);
|
||||
// this->positionAnimation.start();
|
||||
// } else {
|
||||
this->setGeometry(rect);
|
||||
// }
|
||||
|
||||
// this->desiredGeometry = rect;
|
||||
|
||||
// this->animate = true;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "widgets/BaseWidget.hpp"
|
||||
|
||||
#include <QPropertyAnimation>
|
||||
#include <QWidget>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class NotebookPageDropPreview : public BaseWidget
|
||||
{
|
||||
public:
|
||||
NotebookPageDropPreview(BaseWidget *parent);
|
||||
|
||||
void setBounds(const QRect &rect);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void hideEvent(QHideEvent *) override;
|
||||
|
||||
// QPropertyAnimation positionAnimation;
|
||||
// QRect desiredGeometry;
|
||||
// bool animate = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -9,20 +9,20 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
EditableModelView::EditableModelView(QAbstractTableModel *_model)
|
||||
: tableView(new QTableView(this))
|
||||
, model(_model)
|
||||
EditableModelView::EditableModelView(QAbstractTableModel *model)
|
||||
: tableView_(new QTableView(this))
|
||||
, model_(model)
|
||||
{
|
||||
this->model->setParent(this);
|
||||
this->tableView->setModel(_model);
|
||||
this->tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
this->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
this->tableView->verticalHeader()->hide();
|
||||
this->model_->setParent(this);
|
||||
this->tableView_->setModel(model);
|
||||
this->tableView_->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
this->tableView_->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
this->tableView_->verticalHeader()->hide();
|
||||
|
||||
// create layout
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
vbox->addWidget(this->tableView);
|
||||
vbox->addWidget(this->tableView_);
|
||||
|
||||
// create button layout
|
||||
QHBoxLayout *buttons = new QHBoxLayout(this);
|
||||
@@ -39,7 +39,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *_model)
|
||||
QObject::connect(remove, &QPushButton::clicked, [this] {
|
||||
QModelIndexList list;
|
||||
while ((list = this->getTableView()->selectionModel()->selectedRows(0)).length() > 0) {
|
||||
model->removeRow(list[0].row());
|
||||
model_->removeRow(list[0].row());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,22 +51,22 @@ void EditableModelView::setTitles(std::initializer_list<QString> titles)
|
||||
{
|
||||
int i = 0;
|
||||
for (const QString &title : titles) {
|
||||
if (this->model->columnCount() == i) {
|
||||
if (this->model_->columnCount() == i) {
|
||||
break;
|
||||
}
|
||||
|
||||
this->model->setHeaderData(i++, Qt::Horizontal, title, Qt::DisplayRole);
|
||||
this->model_->setHeaderData(i++, Qt::Horizontal, title, Qt::DisplayRole);
|
||||
}
|
||||
}
|
||||
|
||||
QTableView *EditableModelView::getTableView()
|
||||
{
|
||||
return this->tableView;
|
||||
return this->tableView_;
|
||||
}
|
||||
|
||||
QAbstractTableModel *EditableModelView::getModel()
|
||||
{
|
||||
return this->model;
|
||||
return this->model_;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -22,8 +22,8 @@ public:
|
||||
pajlada::Signals::NoArgSignal addButtonPressed;
|
||||
|
||||
private:
|
||||
QTableView *tableView;
|
||||
QAbstractTableModel *model;
|
||||
QTableView *tableView_;
|
||||
QAbstractTableModel *model_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
explicit NotebookButton(Notebook *parent);
|
||||
|
||||
void setIcon(Icon icon_);
|
||||
void setIcon(Icon icon);
|
||||
Icon getIcon() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -22,7 +22,7 @@ class NotebookTab : public RippleEffectButton
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NotebookTab(Notebook *_notebook);
|
||||
explicit NotebookTab(Notebook *notebook);
|
||||
|
||||
void updateSize();
|
||||
|
||||
@@ -61,7 +61,10 @@ protected:
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
bool hasXButton();
|
||||
bool shouldDrawXButton();
|
||||
QRect getXRect();
|
||||
void titleUpdated();
|
||||
|
||||
QPropertyAnimation positionChangedAnimation_;
|
||||
bool positionChangedAnimationRunning_ = false;
|
||||
@@ -78,15 +81,11 @@ private:
|
||||
bool mouseOverX_ = false;
|
||||
bool mouseDownX_ = false;
|
||||
|
||||
bool hasXButton();
|
||||
bool shouldDrawXButton();
|
||||
|
||||
HighlightState highlightState_ = HighlightState::None;
|
||||
|
||||
QMenu menu_;
|
||||
|
||||
QRect getXRect();
|
||||
void titleUpdated();
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -82,7 +82,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
if (doComplete) {
|
||||
// check if there is a completer
|
||||
if (!this->completer) {
|
||||
if (!this->completer_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,32 +93,32 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
auto *completionModel = static_cast<CompletionModel *>(this->completer->model());
|
||||
auto *completionModel = static_cast<CompletionModel *>(this->completer_->model());
|
||||
|
||||
if (!this->completionInProgress) {
|
||||
if (!this->completionInProgress_) {
|
||||
// First type pressing tab after modifying a message, we refresh our completion model
|
||||
this->completer->setModel(completionModel);
|
||||
this->completer_->setModel(completionModel);
|
||||
completionModel->refresh();
|
||||
this->completionInProgress = true;
|
||||
this->completer->setCompletionPrefix(currentCompletionPrefix);
|
||||
this->completer->complete();
|
||||
this->completionInProgress_ = true;
|
||||
this->completer_->setCompletionPrefix(currentCompletionPrefix);
|
||||
this->completer_->complete();
|
||||
return;
|
||||
}
|
||||
|
||||
// scrolling through selections
|
||||
if (event->key() == Qt::Key_Tab) {
|
||||
if (!this->completer->setCurrentRow(this->completer->currentRow() + 1)) {
|
||||
if (!this->completer_->setCurrentRow(this->completer_->currentRow() + 1)) {
|
||||
// wrap over and start again
|
||||
this->completer->setCurrentRow(0);
|
||||
this->completer_->setCurrentRow(0);
|
||||
}
|
||||
} else {
|
||||
if (!this->completer->setCurrentRow(this->completer->currentRow() - 1)) {
|
||||
if (!this->completer_->setCurrentRow(this->completer_->currentRow() - 1)) {
|
||||
// wrap over and start again
|
||||
this->completer->setCurrentRow(this->completer->completionCount() - 1);
|
||||
this->completer_->setCurrentRow(this->completer_->completionCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
this->completer->complete();
|
||||
this->completer_->complete();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||
if (event->key() != Qt::Key_Shift && event->key() != Qt::Key_Control &&
|
||||
event->key() != Qt::Key_Alt && event->key() != Qt::Key_Super_L &&
|
||||
event->key() != Qt::Key_Super_R) {
|
||||
this->completionInProgress = false;
|
||||
this->completionInProgress_ = false;
|
||||
}
|
||||
|
||||
if (!event->isAccepted()) {
|
||||
@@ -158,27 +158,27 @@ void ResizingTextEdit::focusOutEvent(QFocusEvent *event)
|
||||
|
||||
void ResizingTextEdit::setCompleter(QCompleter *c)
|
||||
{
|
||||
if (this->completer) {
|
||||
QObject::disconnect(this->completer, nullptr, this, nullptr);
|
||||
if (this->completer_) {
|
||||
QObject::disconnect(this->completer_, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
this->completer = c;
|
||||
this->completer_ = c;
|
||||
|
||||
if (!this->completer) {
|
||||
if (!this->completer_) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->completer->setWidget(this);
|
||||
this->completer->setCompletionMode(QCompleter::InlineCompletion);
|
||||
this->completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
QObject::connect(completer,
|
||||
this->completer_->setWidget(this);
|
||||
this->completer_->setCompletionMode(QCompleter::InlineCompletion);
|
||||
this->completer_->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
QObject::connect(completer_,
|
||||
static_cast<void (QCompleter::*)(const QString &)>(&QCompleter::highlighted),
|
||||
this, &ResizingTextEdit::insertCompletion);
|
||||
}
|
||||
|
||||
void ResizingTextEdit::insertCompletion(const QString &completion)
|
||||
{
|
||||
if (this->completer->widget() != this) {
|
||||
if (this->completer_->widget() != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ void ResizingTextEdit::insertCompletion(const QString &completion)
|
||||
|
||||
QCompleter *ResizingTextEdit::getCompleter() const
|
||||
{
|
||||
return this->completer;
|
||||
return this->completer_;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -31,12 +31,12 @@ protected:
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
|
||||
private:
|
||||
QCompleter *completer = nullptr;
|
||||
bool completionInProgress = false;
|
||||
|
||||
// hadSpace is set to true in case the "textUnderCursor" word was after a space
|
||||
QString textUnderCursor(bool *hadSpace = nullptr) const;
|
||||
|
||||
QCompleter *completer_ = nullptr;
|
||||
bool completionInProgress_ = false;
|
||||
|
||||
private slots:
|
||||
void insertCompletion(const QString &completion);
|
||||
};
|
||||
|
||||
@@ -48,11 +48,6 @@ signals:
|
||||
void leftMousePress();
|
||||
|
||||
protected:
|
||||
bool enabled_ = true;
|
||||
bool selected_ = false;
|
||||
bool mouseOver_ = false;
|
||||
bool mouseDown_ = false;
|
||||
|
||||
virtual void paintEvent(QPaintEvent *) override;
|
||||
virtual void enterEvent(QEvent *) override;
|
||||
virtual void leaveEvent(QEvent *) override;
|
||||
@@ -62,7 +57,14 @@ protected:
|
||||
|
||||
void fancyPaint(QPainter &painter);
|
||||
|
||||
bool enabled_ = true;
|
||||
bool selected_ = false;
|
||||
bool mouseOver_ = false;
|
||||
bool mouseDown_ = false;
|
||||
|
||||
private:
|
||||
void onMouseEffectTimeout();
|
||||
|
||||
QColor borderColor_;
|
||||
QPixmap pixmap_;
|
||||
bool dimPixmap_ = true;
|
||||
@@ -71,8 +73,6 @@ private:
|
||||
QTimer effectTimer_;
|
||||
std::vector<ClickEffect> clickEffects_;
|
||||
boost::optional<QColor> mouseEffectColor_ = boost::none;
|
||||
|
||||
void onMouseEffectTimeout();
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -9,16 +9,16 @@ namespace chatterino {
|
||||
|
||||
RippleEffectLabel::RippleEffectLabel(BaseWidget *parent, int spacing)
|
||||
: RippleEffectButton(parent)
|
||||
, label(this)
|
||||
, label_(this)
|
||||
{
|
||||
setLayout(&this->hbox);
|
||||
setLayout(&this->hbox_);
|
||||
|
||||
this->label.setAlignment(Qt::AlignCenter);
|
||||
this->label_.setAlignment(Qt::AlignCenter);
|
||||
|
||||
this->hbox.setMargin(0);
|
||||
this->hbox.addSpacing(spacing);
|
||||
this->hbox.addWidget(&this->label);
|
||||
this->hbox.addSpacing(spacing);
|
||||
this->hbox_.setMargin(0);
|
||||
this->hbox_.addSpacing(spacing);
|
||||
this->hbox_.addWidget(&this->label_);
|
||||
this->hbox_.addSpacing(spacing);
|
||||
}
|
||||
|
||||
RippleEffectLabel2::RippleEffectLabel2(BaseWidget *parent, int padding)
|
||||
|
||||
@@ -19,12 +19,12 @@ public:
|
||||
|
||||
SignalLabel &getLabel()
|
||||
{
|
||||
return this->label;
|
||||
return this->label_;
|
||||
}
|
||||
|
||||
private:
|
||||
QHBoxLayout hbox;
|
||||
SignalLabel label;
|
||||
QHBoxLayout hbox_;
|
||||
SignalLabel label_;
|
||||
};
|
||||
|
||||
class RippleEffectLabel2 : public RippleEffectButton
|
||||
|
||||
@@ -5,30 +5,30 @@
|
||||
namespace chatterino {
|
||||
|
||||
ScrollbarHighlight::ScrollbarHighlight()
|
||||
: color(Color::Highlight)
|
||||
, style(Style::None)
|
||||
: color_(Color::Highlight)
|
||||
, style_(Style::None)
|
||||
{
|
||||
}
|
||||
|
||||
ScrollbarHighlight::ScrollbarHighlight(Color _color, Style _style)
|
||||
: color(_color)
|
||||
, style(_style)
|
||||
ScrollbarHighlight::ScrollbarHighlight(Color color, Style style)
|
||||
: color_(color)
|
||||
, style_(style)
|
||||
{
|
||||
}
|
||||
|
||||
ScrollbarHighlight::Color ScrollbarHighlight::getColor() const
|
||||
{
|
||||
return this->color;
|
||||
return this->color_;
|
||||
}
|
||||
|
||||
ScrollbarHighlight::Style ScrollbarHighlight::getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
return this->style_;
|
||||
}
|
||||
|
||||
bool ScrollbarHighlight::isNull() const
|
||||
{
|
||||
return this->style == None;
|
||||
return this->style_ == None;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -11,15 +11,15 @@ public:
|
||||
enum Color : char { Highlight, Subscription };
|
||||
|
||||
ScrollbarHighlight();
|
||||
ScrollbarHighlight(Color _color, Style _style = Default);
|
||||
ScrollbarHighlight(Color color, Style style = Default);
|
||||
|
||||
Color getColor() const;
|
||||
Style getStyle() const;
|
||||
bool isNull() const;
|
||||
|
||||
private:
|
||||
Color color;
|
||||
Style style;
|
||||
Color color_;
|
||||
Style style_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -30,9 +30,9 @@ void SearchPopup::initLayout()
|
||||
|
||||
// SEARCH INPUT
|
||||
{
|
||||
this->searchInput = new QLineEdit(this);
|
||||
layout2->addWidget(this->searchInput);
|
||||
QObject::connect(this->searchInput, &QLineEdit::returnPressed,
|
||||
this->searchInput_ = new QLineEdit(this);
|
||||
layout2->addWidget(this->searchInput_);
|
||||
QObject::connect(this->searchInput_, &QLineEdit::returnPressed,
|
||||
[this] { this->performSearch(); });
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ void SearchPopup::initLayout()
|
||||
|
||||
// CHANNELVIEW
|
||||
{
|
||||
this->channelView = new ChannelView(this);
|
||||
this->channelView_ = new ChannelView(this);
|
||||
|
||||
layout1->addWidget(this->channelView);
|
||||
layout1->addWidget(this->channelView_);
|
||||
}
|
||||
|
||||
this->setLayout(layout1);
|
||||
@@ -61,7 +61,7 @@ void SearchPopup::initLayout()
|
||||
|
||||
void SearchPopup::setChannel(ChannelPtr channel)
|
||||
{
|
||||
this->snapshot = channel->getMessageSnapshot();
|
||||
this->snapshot_ = channel->getMessageSnapshot();
|
||||
this->performSearch();
|
||||
|
||||
this->setWindowTitle("Searching in " + channel->name + "s history");
|
||||
@@ -69,20 +69,20 @@ void SearchPopup::setChannel(ChannelPtr channel)
|
||||
|
||||
void SearchPopup::performSearch()
|
||||
{
|
||||
QString text = searchInput->text();
|
||||
QString text = searchInput_->text();
|
||||
|
||||
ChannelPtr channel(new Channel("search", Channel::Type::None));
|
||||
|
||||
for (size_t i = 0; i < this->snapshot.getLength(); i++) {
|
||||
MessagePtr message = this->snapshot[i];
|
||||
for (size_t i = 0; i < this->snapshot_.getLength(); i++) {
|
||||
MessagePtr message = this->snapshot_[i];
|
||||
|
||||
if (text.isEmpty() ||
|
||||
message->searchText.indexOf(this->searchInput->text(), 0, Qt::CaseInsensitive) != -1) {
|
||||
message->searchText.indexOf(this->searchInput_->text(), 0, Qt::CaseInsensitive) != -1) {
|
||||
channel->addMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
this->channelView->setChannel(channel);
|
||||
this->channelView_->setChannel(channel);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -21,12 +21,12 @@ public:
|
||||
void setChannel(std::shared_ptr<Channel> channel);
|
||||
|
||||
private:
|
||||
LimitedQueueSnapshot<MessagePtr> snapshot;
|
||||
QLineEdit *searchInput;
|
||||
ChannelView *channelView;
|
||||
|
||||
void initLayout();
|
||||
void performSearch();
|
||||
|
||||
LimitedQueueSnapshot<MessagePtr> snapshot_;
|
||||
QLineEdit *searchInput_;
|
||||
ChannelView *channelView_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -10,11 +10,11 @@ namespace chatterino {
|
||||
SettingsDialogTab::SettingsDialogTab(SettingsDialog *_dialog, SettingsPage *_page,
|
||||
QString imageFileName)
|
||||
: BaseWidget(_dialog)
|
||||
, dialog(_dialog)
|
||||
, page(_page)
|
||||
, dialog_(_dialog)
|
||||
, page_(_page)
|
||||
{
|
||||
this->ui.labelText = page->getName();
|
||||
this->ui.icon.addFile(imageFileName);
|
||||
this->ui_.labelText = page_->getName();
|
||||
this->ui_.icon.addFile(imageFileName);
|
||||
|
||||
this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
|
||||
@@ -23,19 +23,19 @@ SettingsDialogTab::SettingsDialogTab(SettingsDialog *_dialog, SettingsPage *_pag
|
||||
|
||||
void SettingsDialogTab::setSelected(bool _selected)
|
||||
{
|
||||
if (this->selected == _selected) {
|
||||
if (this->selected_ == _selected) {
|
||||
return;
|
||||
}
|
||||
|
||||
// height: <checkbox-size>px;
|
||||
|
||||
this->selected = _selected;
|
||||
emit selectedChanged(selected);
|
||||
this->selected_ = _selected;
|
||||
emit selectedChanged(selected_);
|
||||
}
|
||||
|
||||
SettingsPage *SettingsDialogTab::getSettingsPage()
|
||||
{
|
||||
return this->page;
|
||||
return this->page_;
|
||||
}
|
||||
|
||||
void SettingsDialogTab::paintEvent(QPaintEvent *)
|
||||
@@ -48,13 +48,13 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
|
||||
this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
|
||||
|
||||
int a = (this->height() - (20 * this->getScale())) / 2;
|
||||
QPixmap pixmap = this->ui.icon.pixmap(QSize(this->height() - a * 2, this->height() - a * 2));
|
||||
QPixmap pixmap = this->ui_.icon.pixmap(QSize(this->height() - a * 2, this->height() - a * 2));
|
||||
|
||||
painter.drawPixmap(a, a, pixmap);
|
||||
|
||||
a = a + a + 20 + a;
|
||||
|
||||
painter.drawText(QRect(a, 0, width() - a, height()), this->ui.labelText,
|
||||
painter.drawText(QRect(a, 0, width() - a, height()), this->ui_.labelText,
|
||||
QTextOption(Qt::AlignLeft | Qt::AlignVCenter));
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
this->dialog->select(this);
|
||||
this->dialog_->selectTab(this);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -16,9 +16,9 @@ class SettingsDialogTab : public BaseWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsDialogTab(SettingsDialog *dialog, SettingsPage *page, QString imageFileName);
|
||||
SettingsDialogTab(SettingsDialog *dialog_, SettingsPage *page_, QString imageFileName);
|
||||
|
||||
void setSelected(bool selected);
|
||||
void setSelected(bool selected_);
|
||||
SettingsPage *getSettingsPage();
|
||||
|
||||
signals:
|
||||
@@ -31,13 +31,13 @@ private:
|
||||
struct {
|
||||
QString labelText;
|
||||
QIcon icon;
|
||||
} ui;
|
||||
} ui_;
|
||||
|
||||
// Parent settings dialog
|
||||
SettingsDialog *dialog;
|
||||
SettingsPage *page;
|
||||
SettingsDialog *dialog_;
|
||||
SettingsPage *page_;
|
||||
|
||||
bool selected = false;
|
||||
bool selected_ = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -11,12 +11,12 @@ TitleBarButton::TitleBarButton()
|
||||
|
||||
TitleBarButton::Style TitleBarButton::getButtonStyle() const
|
||||
{
|
||||
return this->style;
|
||||
return this->style_;
|
||||
}
|
||||
|
||||
void TitleBarButton::setButtonStyle(Style _style)
|
||||
{
|
||||
this->style = _style;
|
||||
this->style_ = _style;
|
||||
this->update();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void TitleBarButton::paintEvent(QPaintEvent *event)
|
||||
|
||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
switch (this->style) {
|
||||
switch (this->style_) {
|
||||
case Minimize: {
|
||||
painter.fillRect(centerX - xD / 2, xD * 3 / 2, xD, 1, color);
|
||||
break;
|
||||
|
||||
@@ -20,13 +20,13 @@ public:
|
||||
TitleBarButton();
|
||||
|
||||
Style getButtonStyle() const;
|
||||
void setButtonStyle(Style style);
|
||||
void setButtonStyle(Style style_);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
|
||||
private:
|
||||
Style style;
|
||||
Style style_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -30,7 +30,7 @@ AboutPage::AboutPage()
|
||||
QPixmap pixmap;
|
||||
pixmap.load(":/images/aboutlogo.png");
|
||||
|
||||
auto logo = layout.emplace<QLabel>().assign(&this->logo);
|
||||
auto logo = layout.emplace<QLabel>().assign(&this->logo_);
|
||||
logo->setPixmap(pixmap);
|
||||
logo->setFixedSize(PIXMAP_WIDTH, PIXMAP_WIDTH * pixmap.height() / pixmap.width());
|
||||
logo->setScaledContents(true);
|
||||
|
||||
@@ -13,10 +13,10 @@ public:
|
||||
AboutPage();
|
||||
|
||||
private:
|
||||
QLabel *logo;
|
||||
|
||||
void addLicense(QFormLayout *form, const QString &name, const QString &website,
|
||||
void addLicense(QFormLayout *form, const QString &name_, const QString &website,
|
||||
const QString &licenseLink);
|
||||
|
||||
QLabel *logo_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -13,9 +13,9 @@ public:
|
||||
AccountsPage();
|
||||
|
||||
private:
|
||||
QPushButton *addButton;
|
||||
QPushButton *removeButton;
|
||||
AccountSwitchWidget *accSwitchWidget;
|
||||
QPushButton *addButton_;
|
||||
QPushButton *removeButton_;
|
||||
AccountSwitchWidget *accountSwitchWidget_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -51,7 +51,7 @@ CommandPage::CommandPage()
|
||||
text->setStyleSheet("color: #bbb");
|
||||
|
||||
// ---- end of layout
|
||||
this->commandsEditTimer.setSingleShot(true);
|
||||
this->commandsEditTimer_.setSingleShot(true);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
CommandPage();
|
||||
|
||||
private:
|
||||
QTimer commandsEditTimer;
|
||||
QTimer commandsEditTimer_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -66,7 +66,7 @@ ExternalToolsPage::ExternalToolsPage()
|
||||
[=](const auto &value, auto) {
|
||||
customPath->setEnabled(value); //
|
||||
},
|
||||
this->managedConnections);
|
||||
this->managedConnections_);
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
|
||||
@@ -131,7 +131,7 @@ HighlightingPage::HighlightingPage()
|
||||
}
|
||||
|
||||
// ---- misc
|
||||
this->disabledUsersChangedTimer.setSingleShot(true);
|
||||
this->disabledUsersChangedTimer_.setSingleShot(true);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
HighlightingPage();
|
||||
|
||||
private:
|
||||
QTimer disabledUsersChangedTimer;
|
||||
QTimer disabledUsersChangedTimer_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -34,7 +34,7 @@ IgnoresPage::IgnoresPage()
|
||||
auto tabs = layout.emplace<QTabWidget>();
|
||||
|
||||
addPhrasesTab(tabs.appendTab(new QVBoxLayout, "Phrases"));
|
||||
addUsersTab(*this, tabs.appendTab(new QVBoxLayout, "Users"), this->userListModel);
|
||||
addUsersTab(*this, tabs.appendTab(new QVBoxLayout, "Users"), this->userListModel_);
|
||||
|
||||
auto label = layout.emplace<QLabel>(INFO);
|
||||
label->setWordWrap(true);
|
||||
@@ -95,7 +95,7 @@ void IgnoresPage::onShow()
|
||||
for (const auto &ignoredUser : user->getIgnores()) {
|
||||
users << ignoredUser.name;
|
||||
}
|
||||
this->userListModel.setStringList(users);
|
||||
this->userListModel_.setStringList(users);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
void onShow() final;
|
||||
|
||||
private:
|
||||
QStringListModel userListModel;
|
||||
QStringListModel userListModel_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -355,8 +355,8 @@ QLayout *LookPage::createFontChanger()
|
||||
", " + QString::number(app->fonts->chatFontSize) + "pt)");
|
||||
};
|
||||
|
||||
app->fonts->chatFontFamily.connectSimple(updateFontFamilyLabel, this->managedConnections);
|
||||
app->fonts->chatFontSize.connectSimple(updateFontFamilyLabel, this->managedConnections);
|
||||
app->fonts->chatFontFamily.connectSimple(updateFontFamilyLabel, this->managedConnections_);
|
||||
app->fonts->chatFontSize.connectSimple(updateFontFamilyLabel, this->managedConnections_);
|
||||
|
||||
// BUTTON
|
||||
QPushButton *button = new QPushButton("Select");
|
||||
|
||||
@@ -146,7 +146,7 @@ ModerationPage::ModerationPage()
|
||||
}
|
||||
|
||||
// ---- misc
|
||||
this->itemsChangedTimer.setSingleShot(true);
|
||||
this->itemsChangedTimer_.setSingleShot(true);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
ModerationPage();
|
||||
|
||||
private:
|
||||
QTimer itemsChangedTimer;
|
||||
QTimer itemsChangedTimer_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -4,25 +4,25 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
SettingsPage::SettingsPage(const QString &_name, const QString &_iconResource)
|
||||
: name(_name)
|
||||
, iconResource(_iconResource)
|
||||
SettingsPage::SettingsPage(const QString &name, const QString &iconResource)
|
||||
: name_(name)
|
||||
, iconResource_(iconResource)
|
||||
{
|
||||
}
|
||||
|
||||
const QString &SettingsPage::getName()
|
||||
{
|
||||
return this->name;
|
||||
return this->name_;
|
||||
}
|
||||
|
||||
const QString &SettingsPage::getIconResource()
|
||||
{
|
||||
return this->iconResource;
|
||||
return this->iconResource_;
|
||||
}
|
||||
|
||||
void SettingsPage::cancel()
|
||||
{
|
||||
this->onCancel.invoke();
|
||||
this->onCancel_.invoke();
|
||||
}
|
||||
|
||||
QCheckBox *SettingsPage::createCheckBox(const QString &text,
|
||||
@@ -35,7 +35,7 @@ QCheckBox *SettingsPage::createCheckBox(const QString &text,
|
||||
[checkbox](const bool &value, auto) {
|
||||
checkbox->setChecked(value); //
|
||||
},
|
||||
this->managedConnections);
|
||||
this->managedConnections_);
|
||||
|
||||
// update setting on toggle
|
||||
QObject::connect(checkbox, &QCheckBox::toggled, this, [&setting](bool state) {
|
||||
@@ -56,7 +56,7 @@ QComboBox *SettingsPage::createComboBox(const QStringList &items,
|
||||
|
||||
// update when setting changes
|
||||
setting.connect([combo](const QString &value, auto) { combo->setCurrentText(value); },
|
||||
this->managedConnections);
|
||||
this->managedConnections_);
|
||||
|
||||
QObject::connect(combo, &QComboBox::currentTextChanged,
|
||||
[&setting](const QString &newValue) { setting = newValue; });
|
||||
|
||||
@@ -31,11 +31,11 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
QString name;
|
||||
QString iconResource;
|
||||
QString name_;
|
||||
QString iconResource_;
|
||||
|
||||
pajlada::Signals::NoArgSignal onCancel;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
pajlada::Signals::NoArgSignal onCancel_;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -43,29 +43,29 @@ Qt::KeyboardModifiers Split::modifierStatus = Qt::NoModifier;
|
||||
Split::Split(SplitContainer *parent)
|
||||
: Split(static_cast<QWidget *>(parent))
|
||||
{
|
||||
this->container = parent;
|
||||
this->container_ = parent;
|
||||
}
|
||||
|
||||
Split::Split(QWidget *parent)
|
||||
: BaseWidget(parent)
|
||||
, container(nullptr)
|
||||
, channel(Channel::getEmpty())
|
||||
, vbox(this)
|
||||
, header(this)
|
||||
, view(this)
|
||||
, input(this)
|
||||
, overlay(new SplitOverlay(this))
|
||||
, container_(nullptr)
|
||||
, channel_(Channel::getEmpty())
|
||||
, vbox_(this)
|
||||
, header_(this)
|
||||
, view_(this)
|
||||
, input_(this)
|
||||
, overlay_(new SplitOverlay(this))
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
this->setMouseTracking(true);
|
||||
|
||||
this->vbox.setSpacing(0);
|
||||
this->vbox.setMargin(1);
|
||||
this->vbox_.setSpacing(0);
|
||||
this->vbox_.setMargin(1);
|
||||
|
||||
this->vbox.addWidget(&this->header);
|
||||
this->vbox.addWidget(&this->view, 1);
|
||||
this->vbox.addWidget(&this->input);
|
||||
this->vbox_.addWidget(&this->header_);
|
||||
this->vbox_.addWidget(&this->view_, 1);
|
||||
this->vbox_.addWidget(&this->input_);
|
||||
|
||||
// Initialize chat widget-wide hotkeys
|
||||
// CTRL+W: Close Split
|
||||
@@ -90,148 +90,148 @@ Split::Split(QWidget *parent)
|
||||
// CreateShortcut(this, "ALT+SHIFT+UP", &Split::doIncFlexY);
|
||||
// CreateShortcut(this, "ALT+SHIFT+DOWN", &Split::doDecFlexY);
|
||||
|
||||
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->view.selectionChanged.connect([this]() {
|
||||
if (view.hasSelection()) {
|
||||
this->input.clearSelection();
|
||||
this->view_.selectionChanged.connect([this]() {
|
||||
if (view_.hasSelection()) {
|
||||
this->input_.clearSelection();
|
||||
}
|
||||
});
|
||||
|
||||
this->input.textChanged.connect([=](const QString &newText) {
|
||||
this->input_.textChanged.connect([=](const QString &newText) {
|
||||
if (app->settings->showEmptyInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (newText.length() == 0) {
|
||||
this->input.hide();
|
||||
} else if (this->input.isHidden()) {
|
||||
this->input.show();
|
||||
this->input_.hide();
|
||||
} else if (this->input_.isHidden()) {
|
||||
this->input_.show();
|
||||
}
|
||||
});
|
||||
|
||||
app->settings->showEmptyInput.connect(
|
||||
[this](const bool &showEmptyInput, auto) {
|
||||
if (!showEmptyInput && this->input.getInputText().length() == 0) {
|
||||
this->input.hide();
|
||||
if (!showEmptyInput && this->input_.getInputText().length() == 0) {
|
||||
this->input_.hide();
|
||||
} else {
|
||||
this->input.show();
|
||||
this->input_.show();
|
||||
}
|
||||
},
|
||||
this->managedConnections);
|
||||
this->managedConnections_);
|
||||
|
||||
this->header.updateModerationModeIcon();
|
||||
this->overlay->hide();
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->overlay_->hide();
|
||||
|
||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
this->managedConnect(modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
|
||||
if ((status == showSplitOverlayModifiers /*|| status == showAddSplitRegions*/) &&
|
||||
this->isMouseOver) {
|
||||
this->overlay->show();
|
||||
this->isMouseOver_) {
|
||||
this->overlay_->show();
|
||||
} else {
|
||||
this->overlay->hide();
|
||||
this->overlay_->hide();
|
||||
}
|
||||
});
|
||||
|
||||
this->input.ui_.textEdit->focused.connect([this] { this->focused.invoke(); });
|
||||
this->input.ui_.textEdit->focusLost.connect([this] { this->focusLost.invoke(); });
|
||||
this->input_.ui_.textEdit->focused.connect([this] { this->focused.invoke(); });
|
||||
this->input_.ui_.textEdit->focusLost.connect([this] { this->focusLost.invoke(); });
|
||||
}
|
||||
|
||||
Split::~Split()
|
||||
{
|
||||
this->usermodeChangedConnection.disconnect();
|
||||
this->roomModeChangedConnection.disconnect();
|
||||
this->channelIDChangedConnection.disconnect();
|
||||
this->indirectChannelChangedConnection.disconnect();
|
||||
this->usermodeChangedConnection_.disconnect();
|
||||
this->roomModeChangedConnection_.disconnect();
|
||||
this->channelIDChangedConnection_.disconnect();
|
||||
this->indirectChannelChangedConnection_.disconnect();
|
||||
}
|
||||
|
||||
ChannelView &Split::getChannelView()
|
||||
{
|
||||
return this->view;
|
||||
return this->view_;
|
||||
}
|
||||
|
||||
SplitContainer *Split::getContainer()
|
||||
{
|
||||
return this->container;
|
||||
return this->container_;
|
||||
}
|
||||
|
||||
bool Split::isInContainer() const
|
||||
{
|
||||
return this->container != nullptr;
|
||||
return this->container_ != nullptr;
|
||||
}
|
||||
|
||||
void Split::setContainer(SplitContainer *_container)
|
||||
void Split::setContainer(SplitContainer *container)
|
||||
{
|
||||
this->container = _container;
|
||||
this->container_ = container;
|
||||
}
|
||||
|
||||
IndirectChannel Split::getIndirectChannel()
|
||||
{
|
||||
return this->channel;
|
||||
return this->channel_;
|
||||
}
|
||||
|
||||
ChannelPtr Split::getChannel()
|
||||
{
|
||||
return this->channel.get();
|
||||
return this->channel_.get();
|
||||
}
|
||||
|
||||
void Split::setChannel(IndirectChannel newChannel)
|
||||
{
|
||||
this->channel = newChannel;
|
||||
this->channel_ = newChannel;
|
||||
|
||||
this->view.setChannel(newChannel.get());
|
||||
this->view_.setChannel(newChannel.get());
|
||||
|
||||
this->usermodeChangedConnection.disconnect();
|
||||
this->roomModeChangedConnection.disconnect();
|
||||
this->indirectChannelChangedConnection.disconnect();
|
||||
this->usermodeChangedConnection_.disconnect();
|
||||
this->roomModeChangedConnection_.disconnect();
|
||||
this->indirectChannelChangedConnection_.disconnect();
|
||||
|
||||
TwitchChannel *tc = dynamic_cast<TwitchChannel *>(newChannel.get().get());
|
||||
|
||||
if (tc != nullptr) {
|
||||
this->usermodeChangedConnection = tc->userStateChanged.connect([this] {
|
||||
this->header.updateModerationModeIcon();
|
||||
this->header.updateRoomModes();
|
||||
this->usermodeChangedConnection_ = tc->userStateChanged.connect([this] {
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->header_.updateRoomModes();
|
||||
});
|
||||
|
||||
this->roomModeChangedConnection =
|
||||
tc->roomModesChanged.connect([this] { this->header.updateRoomModes(); });
|
||||
this->roomModeChangedConnection_ =
|
||||
tc->roomModesChanged.connect([this] { this->header_.updateRoomModes(); });
|
||||
}
|
||||
|
||||
this->indirectChannelChangedConnection = newChannel.getChannelChanged().connect([this] { //
|
||||
QTimer::singleShot(0, [this] { this->setChannel(this->channel); });
|
||||
this->indirectChannelChangedConnection_ = newChannel.getChannelChanged().connect([this] { //
|
||||
QTimer::singleShot(0, [this] { this->setChannel(this->channel_); });
|
||||
});
|
||||
|
||||
this->header.updateModerationModeIcon();
|
||||
this->header.updateChannelText();
|
||||
this->header.updateRoomModes();
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->header_.updateChannelText();
|
||||
this->header_.updateRoomModes();
|
||||
|
||||
this->channelChanged.invoke();
|
||||
}
|
||||
|
||||
void Split::setModerationMode(bool value)
|
||||
{
|
||||
if (value != this->moderationMode) {
|
||||
this->moderationMode = value;
|
||||
this->header.updateModerationModeIcon();
|
||||
this->view.layoutMessages();
|
||||
if (value != this->moderationMode_) {
|
||||
this->moderationMode_ = value;
|
||||
this->header_.updateModerationModeIcon();
|
||||
this->view_.layoutMessages();
|
||||
}
|
||||
}
|
||||
|
||||
bool Split::getModerationMode() const
|
||||
{
|
||||
return this->moderationMode;
|
||||
return this->moderationMode_;
|
||||
}
|
||||
|
||||
void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||
std::function<void(bool)> callback)
|
||||
{
|
||||
if (this->selectChannelDialog.hasElement()) {
|
||||
this->selectChannelDialog->raise();
|
||||
if (this->selectChannelDialog_.hasElement()) {
|
||||
this->selectChannelDialog_->raise();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -246,39 +246,39 @@ void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
|
||||
if (dialog->hasSeletedChannel()) {
|
||||
this->setChannel(dialog->getSelectedChannel());
|
||||
if (this->isInContainer()) {
|
||||
this->container->refreshTabTitle();
|
||||
this->container_->refreshTabTitle();
|
||||
}
|
||||
}
|
||||
|
||||
callback(dialog->hasSeletedChannel());
|
||||
this->selectChannelDialog = nullptr;
|
||||
this->selectChannelDialog_ = nullptr;
|
||||
});
|
||||
this->selectChannelDialog = dialog;
|
||||
this->selectChannelDialog_ = dialog;
|
||||
}
|
||||
|
||||
void Split::layoutMessages()
|
||||
{
|
||||
this->view.layoutMessages();
|
||||
this->view_.layoutMessages();
|
||||
}
|
||||
|
||||
void Split::updateGifEmotes()
|
||||
{
|
||||
this->view.queueUpdate();
|
||||
this->view_.queueUpdate();
|
||||
}
|
||||
|
||||
void Split::updateLastReadMessage()
|
||||
{
|
||||
this->view.updateLastReadMessage();
|
||||
this->view_.updateLastReadMessage();
|
||||
}
|
||||
|
||||
void Split::giveFocus(Qt::FocusReason reason)
|
||||
{
|
||||
this->input.ui_.textEdit->setFocus(reason);
|
||||
this->input_.ui_.textEdit->setFocus(reason);
|
||||
}
|
||||
|
||||
bool Split::hasFocus() const
|
||||
{
|
||||
return this->input.ui_.textEdit->hasFocus();
|
||||
return this->input_.ui_.textEdit->hasFocus();
|
||||
}
|
||||
|
||||
void Split::paintEvent(QPaintEvent *)
|
||||
@@ -296,13 +296,13 @@ void Split::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
void Split::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
this->view.unsetCursor();
|
||||
this->view_.unsetCursor();
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
|
||||
void Split::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
this->view.unsetCursor();
|
||||
this->view_.unsetCursor();
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
|
||||
@@ -310,29 +310,29 @@ void Split::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
BaseWidget::resizeEvent(event);
|
||||
|
||||
this->overlay->setGeometry(this->rect());
|
||||
this->overlay_->setGeometry(this->rect());
|
||||
}
|
||||
|
||||
void Split::enterEvent(QEvent *event)
|
||||
{
|
||||
this->isMouseOver = true;
|
||||
this->isMouseOver_ = true;
|
||||
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
|
||||
if (modifierStatus == showSplitOverlayModifiers /*|| modifierStatus == showAddSplitRegions*/) {
|
||||
this->overlay->show();
|
||||
this->overlay_->show();
|
||||
}
|
||||
|
||||
if (this->container != nullptr) {
|
||||
this->container->resetMouseStatus();
|
||||
if (this->container_ != nullptr) {
|
||||
this->container_->resetMouseStatus();
|
||||
}
|
||||
}
|
||||
|
||||
void Split::leaveEvent(QEvent *event)
|
||||
{
|
||||
this->isMouseOver = false;
|
||||
this->isMouseOver_ = false;
|
||||
|
||||
this->overlay->hide();
|
||||
this->overlay_->hide();
|
||||
|
||||
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
|
||||
}
|
||||
@@ -353,15 +353,15 @@ void Split::handleModifiers(Qt::KeyboardModifiers modifiers)
|
||||
/// Slots
|
||||
void Split::doAddSplit()
|
||||
{
|
||||
if (this->container) {
|
||||
this->container->appendNewSplit(true);
|
||||
if (this->container_) {
|
||||
this->container_->appendNewSplit(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Split::doCloseSplit()
|
||||
{
|
||||
if (this->container) {
|
||||
this->container->deleteSplit(this);
|
||||
if (this->container_) {
|
||||
this->container_->deleteSplit(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ void Split::doPopup()
|
||||
|
||||
void Split::doClearChat()
|
||||
{
|
||||
this->view.clearMessages();
|
||||
this->view_.clearMessages();
|
||||
}
|
||||
|
||||
void Split::doOpenChannel()
|
||||
@@ -418,7 +418,7 @@ void Split::doOpenPopupPlayer()
|
||||
void Split::doOpenStreamlink()
|
||||
{
|
||||
try {
|
||||
Start(this->getChannel()->name);
|
||||
openStreamlinkForChannel(this->getChannel()->name);
|
||||
} catch (const Exception &ex) {
|
||||
Log("Error in doOpenStreamlink: {}", ex.what());
|
||||
}
|
||||
@@ -431,8 +431,8 @@ void Split::doOpenViewerList()
|
||||
viewerDock->setFeatures(QDockWidget::DockWidgetVerticalTitleBar |
|
||||
QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
|
||||
viewerDock->resize(0.5 * this->width(),
|
||||
this->height() - this->header.height() - this->input.height());
|
||||
viewerDock->move(0, this->header.height());
|
||||
this->height() - this->header_.height() - this->input_.height());
|
||||
viewerDock->move(0, this->header_.height());
|
||||
|
||||
auto multiWidget = new QWidget(viewerDock);
|
||||
auto dockVbox = new QVBoxLayout(viewerDock);
|
||||
@@ -521,7 +521,7 @@ void Split::doOpenUserInfoPopup(const QString &user)
|
||||
|
||||
void Split::doCopy()
|
||||
{
|
||||
QApplication::clipboard()->setText(this->view.getSelectedText());
|
||||
QApplication::clipboard()->setText(this->view_.getSelectedText());
|
||||
}
|
||||
|
||||
void Split::doSearch()
|
||||
|
||||
@@ -88,34 +88,34 @@ protected:
|
||||
void focusInEvent(QFocusEvent *event) override;
|
||||
|
||||
private:
|
||||
SplitContainer *container;
|
||||
IndirectChannel channel;
|
||||
|
||||
QVBoxLayout vbox;
|
||||
SplitHeader header;
|
||||
ChannelView view;
|
||||
SplitInput input;
|
||||
SplitOverlay *overlay;
|
||||
|
||||
NullablePtr<SelectChannelDialog> selectChannelDialog;
|
||||
|
||||
bool moderationMode = false;
|
||||
|
||||
bool isMouseOver = false;
|
||||
bool isDragging = false;
|
||||
|
||||
pajlada::Signals::Connection channelIDChangedConnection;
|
||||
pajlada::Signals::Connection usermodeChangedConnection;
|
||||
pajlada::Signals::Connection roomModeChangedConnection;
|
||||
|
||||
pajlada::Signals::Connection indirectChannelChangedConnection;
|
||||
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
|
||||
void doOpenUserInfoPopup(const QString &user);
|
||||
void channelNameUpdated(const QString &newChannelName);
|
||||
void handleModifiers(Qt::KeyboardModifiers modifiers);
|
||||
|
||||
SplitContainer *container_;
|
||||
IndirectChannel channel_;
|
||||
|
||||
QVBoxLayout vbox_;
|
||||
SplitHeader header_;
|
||||
ChannelView view_;
|
||||
SplitInput input_;
|
||||
SplitOverlay *overlay_;
|
||||
|
||||
NullablePtr<SelectChannelDialog> selectChannelDialog_;
|
||||
|
||||
bool moderationMode_ = false;
|
||||
|
||||
bool isMouseOver_ = false;
|
||||
bool isDragging_ = false;
|
||||
|
||||
pajlada::Signals::Connection channelIDChangedConnection_;
|
||||
pajlada::Signals::Connection usermodeChangedConnection_;
|
||||
pajlada::Signals::Connection roomModeChangedConnection_;
|
||||
|
||||
pajlada::Signals::Connection indirectChannelChangedConnection_;
|
||||
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
|
||||
public slots:
|
||||
// Add new split to the notebook page that this chat widget is in
|
||||
// This is only activated from the menu now. Hotkey is handled in Notebook
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "widgets/BaseWidget.hpp"
|
||||
#include "widgets/helper/DropPreview.hpp"
|
||||
#include "widgets/helper/NotebookTab.hpp"
|
||||
#include "widgets/splits/Split.hpp"
|
||||
|
||||
@@ -41,14 +40,14 @@ public:
|
||||
struct Position final {
|
||||
private:
|
||||
Position() = default;
|
||||
Position(Node *_relativeNode, Direction _direcion)
|
||||
: relativeNode(_relativeNode)
|
||||
, direction(_direcion)
|
||||
Position(Node *relativeNode, Direction direcion)
|
||||
: relativeNode_(relativeNode)
|
||||
, direction_(direcion)
|
||||
{
|
||||
}
|
||||
|
||||
Node *relativeNode;
|
||||
Direction direction;
|
||||
Node *relativeNode_;
|
||||
Direction direction_;
|
||||
|
||||
friend struct Node;
|
||||
friend class SplitContainer;
|
||||
@@ -91,15 +90,6 @@ public:
|
||||
const std::vector<std::unique_ptr<Node>> &getChildren();
|
||||
|
||||
private:
|
||||
Type type;
|
||||
Split *split;
|
||||
Node *preferedFocusTarget;
|
||||
Node *parent;
|
||||
QRectF geometry;
|
||||
qreal flexH = 1;
|
||||
qreal flexV = 1;
|
||||
std::vector<std::unique_ptr<Node>> children;
|
||||
|
||||
Node();
|
||||
Node(Split *_split, Node *_parent);
|
||||
|
||||
@@ -107,17 +97,26 @@ public:
|
||||
Node *findNodeContainingSplit(Split *_split);
|
||||
void insertSplitRelative(Split *_split, Direction _direction);
|
||||
void nestSplitIntoCollection(Split *_split, Direction _direction);
|
||||
void _insertNextToThis(Split *_split, Direction _direction);
|
||||
void insertNextToThis(Split *_split, Direction _direction);
|
||||
void setSplit(Split *_split);
|
||||
Position releaseSplit();
|
||||
qreal getFlex(bool isVertical);
|
||||
qreal getSize(bool isVertical);
|
||||
qreal getChildrensTotalFlex(bool isVertical);
|
||||
void layout(bool addSpacing, float _scale, std::vector<DropRect> &dropRects,
|
||||
void layout(bool addSpacing, float _scale, std::vector<DropRect> &dropRects_,
|
||||
std::vector<ResizeRect> &resizeRects);
|
||||
|
||||
static Type toContainerType(Direction _dir);
|
||||
|
||||
Type type_;
|
||||
Split *split_;
|
||||
Node *preferedFocusTarget_;
|
||||
Node *parent_;
|
||||
QRectF geometry_;
|
||||
qreal flexH_ = 1;
|
||||
qreal flexV_ = 1;
|
||||
std::vector<std::unique_ptr<Node>> children_;
|
||||
|
||||
friend class SplitContainer;
|
||||
};
|
||||
|
||||
@@ -139,9 +138,9 @@ private:
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
std::vector<DropRect> rects;
|
||||
QPoint mouseOverPoint;
|
||||
SplitContainer *parent;
|
||||
std::vector<DropRect> rects_;
|
||||
QPoint mouseOverPoint_;
|
||||
SplitContainer *parent_;
|
||||
};
|
||||
|
||||
class ResizeHandle final : public QWidget
|
||||
@@ -161,8 +160,8 @@ private:
|
||||
friend class SplitContainer;
|
||||
|
||||
private:
|
||||
bool vertical;
|
||||
bool isMouseDown = false;
|
||||
bool vertical_;
|
||||
bool isMouseDown_ = false;
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -186,7 +185,7 @@ public:
|
||||
NotebookTab *getTab() const;
|
||||
Node *getBaseNode();
|
||||
|
||||
void setTab(NotebookTab *tab);
|
||||
void setTab(NotebookTab *tab_);
|
||||
void hideResizeHandles();
|
||||
void resetMouseStatus();
|
||||
|
||||
@@ -206,6 +205,16 @@ protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
void layout();
|
||||
void setSelected(Split *selected_);
|
||||
void selectSplitRecursive(Node *node, Direction direction);
|
||||
void focusSplitRecursive(Node *node, Direction direction);
|
||||
void setPreferedTargetRecursive(Node *node);
|
||||
|
||||
void addSplit(Split *split);
|
||||
|
||||
void decodeNodeRecusively(QJsonObject &obj, Node *node);
|
||||
|
||||
struct DropRegion {
|
||||
QRect rect;
|
||||
std::pair<int, int> position;
|
||||
@@ -217,30 +226,19 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
void addSplit(Split *split);
|
||||
std::vector<DropRect> dropRects_;
|
||||
std::vector<DropRegion> dropRegions_;
|
||||
DropOverlay overlay_;
|
||||
std::vector<std::unique_ptr<ResizeHandle>> resizeHandles_;
|
||||
QPoint mouseOverPoint_;
|
||||
|
||||
std::vector<DropRect> dropRects;
|
||||
std::vector<DropRegion> dropRegions;
|
||||
NotebookPageDropPreview dropPreview;
|
||||
DropOverlay overlay;
|
||||
std::vector<std::unique_ptr<ResizeHandle>> resizeHandles;
|
||||
QPoint mouseOverPoint;
|
||||
Node baseNode_;
|
||||
Split *selected_;
|
||||
|
||||
void layout();
|
||||
NotebookTab *tab_;
|
||||
std::vector<Split *> splits_;
|
||||
|
||||
Node baseNode;
|
||||
Split *selected;
|
||||
void setSelected(Split *selected);
|
||||
void selectSplitRecursive(Node *node, Direction direction);
|
||||
void focusSplitRecursive(Node *node, Direction direction);
|
||||
void setPreferedTargetRecursive(Node *node);
|
||||
|
||||
NotebookTab *tab;
|
||||
std::vector<Split *> splits;
|
||||
|
||||
bool isDragging = false;
|
||||
|
||||
void decodeNodeRecusively(QJsonObject &obj, Node *node);
|
||||
bool isDragging_ = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace chatterino {
|
||||
|
||||
SplitHeader::SplitHeader(Split *_split)
|
||||
: BaseWidget(_split)
|
||||
, split(_split)
|
||||
, split_(_split)
|
||||
{
|
||||
this->split->focused.connect([this]() { this->themeChangedEvent(); });
|
||||
this->split->focusLost.connect([this]() { this->themeChangedEvent(); });
|
||||
this->split_->focused.connect([this]() { this->themeChangedEvent(); });
|
||||
this->split_->focusLost.connect([this]() { this->themeChangedEvent(); });
|
||||
|
||||
auto app = getApp();
|
||||
|
||||
@@ -44,7 +44,7 @@ SplitHeader::SplitHeader(Split *_split)
|
||||
title->setHasOffset(false);
|
||||
|
||||
// mode button
|
||||
auto mode = layout.emplace<RippleEffectLabel>(nullptr).assign(&this->modeButton);
|
||||
auto mode = layout.emplace<RippleEffectLabel>(nullptr).assign(&this->modeButton_);
|
||||
|
||||
mode->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
mode->hide();
|
||||
@@ -53,38 +53,38 @@ SplitHeader::SplitHeader(Split *_split)
|
||||
|
||||
QObject::connect(mode.getElement(), &RippleEffectLabel::clicked, this, [this] {
|
||||
QTimer::singleShot(80, this, [&, this] {
|
||||
ChannelPtr _channel = this->split->getChannel();
|
||||
ChannelPtr _channel = this->split_->getChannel();
|
||||
if (_channel->hasModRights()) {
|
||||
this->modeMenu.move(
|
||||
this->modeButton->mapToGlobal(QPoint(0, this->modeButton->height())));
|
||||
this->modeMenu.show();
|
||||
this->modeMenu_.move(
|
||||
this->modeButton_->mapToGlobal(QPoint(0, this->modeButton_->height())));
|
||||
this->modeMenu_.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// moderation mode
|
||||
auto moderator = layout.emplace<RippleEffectButton>(this).assign(&this->moderationButton);
|
||||
auto moderator = layout.emplace<RippleEffectButton>(this).assign(&this->moderationButton_);
|
||||
|
||||
QObject::connect(moderator.getElement(), &RippleEffectButton::clicked, this,
|
||||
[this, moderator]() mutable {
|
||||
this->split->setModerationMode(!this->split->getModerationMode());
|
||||
this->split_->setModerationMode(!this->split_->getModerationMode());
|
||||
|
||||
moderator->setDim(!this->split->getModerationMode());
|
||||
moderator->setDim(!this->split_->getModerationMode());
|
||||
});
|
||||
|
||||
this->updateModerationModeIcon();
|
||||
|
||||
// dropdown label
|
||||
auto dropdown = layout.emplace<RippleEffectButton>(this).assign(&this->dropdownButton);
|
||||
auto dropdown = layout.emplace<RippleEffectButton>(this).assign(&this->dropdownButton_);
|
||||
dropdown->setMouseTracking(true);
|
||||
// dropdown->setPixmap(*app->resources->splitHeaderContext->getPixmap());
|
||||
// dropdown->setScaleIndependantSize(23, 23);
|
||||
this->addDropdownItems(dropdown.getElement());
|
||||
QObject::connect(dropdown.getElement(), &RippleEffectButton::leftMousePress, this, [this] {
|
||||
QTimer::singleShot(80, [&, this] {
|
||||
this->dropdownMenu.move(
|
||||
this->dropdownButton->mapToGlobal(QPoint(0, this->dropdownButton->height())));
|
||||
this->dropdownMenu.show();
|
||||
this->dropdownMenu_.move(
|
||||
this->dropdownButton_->mapToGlobal(QPoint(0, this->dropdownButton_->height())));
|
||||
this->dropdownMenu_.show();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -97,34 +97,34 @@ SplitHeader::SplitHeader(Split *_split)
|
||||
|
||||
this->initializeChannelSignals();
|
||||
|
||||
this->split->channelChanged.connect([this]() {
|
||||
this->split_->channelChanged.connect([this]() {
|
||||
this->initializeChannelSignals(); //
|
||||
});
|
||||
|
||||
this->managedConnect(app->accounts->twitch.currentUserChanged,
|
||||
[this] { this->updateModerationModeIcon(); });
|
||||
|
||||
this->addModeActions(this->modeMenu);
|
||||
this->addModeActions(this->modeMenu_);
|
||||
|
||||
this->setMouseTracking(true);
|
||||
}
|
||||
|
||||
SplitHeader::~SplitHeader()
|
||||
{
|
||||
this->onlineStatusChangedConnection.disconnect();
|
||||
this->onlineStatusChangedConnection_.disconnect();
|
||||
}
|
||||
|
||||
void SplitHeader::addDropdownItems(RippleEffectButton *)
|
||||
{
|
||||
// clang-format off
|
||||
this->dropdownMenu.addAction("New split", this->split, &Split::doAddSplit, QKeySequence(tr("Ctrl+T")));
|
||||
this->dropdownMenu.addAction("Close split", this->split, &Split::doCloseSplit, QKeySequence(tr("Ctrl+W")));
|
||||
this->dropdownMenu.addAction("Change channel", this->split, &Split::doChangeChannel, QKeySequence(tr("Ctrl+R")));
|
||||
this->dropdownMenu.addSeparator();
|
||||
this->dropdownMenu.addAction("Viewer list", this->split, &Split::doOpenViewerList);
|
||||
this->dropdownMenu.addAction("Search", this->split, &Split::doSearch, QKeySequence(tr("Ctrl+F")));
|
||||
this->dropdownMenu.addSeparator();
|
||||
this->dropdownMenu.addAction("Popup", this->split, &Split::doPopup);
|
||||
this->dropdownMenu_.addAction("New split", this->split_, &Split::doAddSplit, QKeySequence(tr("Ctrl+T")));
|
||||
this->dropdownMenu_.addAction("Close split", this->split_, &Split::doCloseSplit, QKeySequence(tr("Ctrl+W")));
|
||||
this->dropdownMenu_.addAction("Change channel", this->split_, &Split::doChangeChannel, QKeySequence(tr("Ctrl+R")));
|
||||
this->dropdownMenu_.addSeparator();
|
||||
this->dropdownMenu_.addAction("Viewer list", this->split_, &Split::doOpenViewerList);
|
||||
this->dropdownMenu_.addAction("Search", this->split_, &Split::doSearch, QKeySequence(tr("Ctrl+F")));
|
||||
this->dropdownMenu_.addSeparator();
|
||||
this->dropdownMenu_.addAction("Popup", this->split_, &Split::doPopup);
|
||||
#ifdef USEWEBENGINE
|
||||
this->dropdownMenu.addAction("Start watching", this, [this]{
|
||||
ChannelPtr _channel = this->split->getChannel();
|
||||
@@ -137,15 +137,15 @@ void SplitHeader::addDropdownItems(RippleEffectButton *)
|
||||
}
|
||||
});
|
||||
#endif
|
||||
this->dropdownMenu.addAction("Open browser", this->split, &Split::doOpenChannel);
|
||||
this->dropdownMenu_.addAction("Open browser", this->split_, &Split::doOpenChannel);
|
||||
#ifndef USEWEBENGINE
|
||||
this->dropdownMenu.addAction("Open browser popup", this->split, &Split::doOpenPopupPlayer);
|
||||
this->dropdownMenu_.addAction("Open browser popup", this->split_, &Split::doOpenPopupPlayer);
|
||||
#endif
|
||||
this->dropdownMenu.addAction("Open streamlink", this->split, &Split::doOpenStreamlink);
|
||||
this->dropdownMenu.addSeparator();
|
||||
this->dropdownMenu.addAction("Reload channel emotes", this, SLOT(menuReloadChannelEmotes()));
|
||||
this->dropdownMenu.addAction("Reconnect", this, SLOT(menuManualReconnect()));
|
||||
this->dropdownMenu.addAction("Clear messages", this->split, &Split::doClearChat);
|
||||
this->dropdownMenu_.addAction("Open streamlink", this->split_, &Split::doOpenStreamlink);
|
||||
this->dropdownMenu_.addSeparator();
|
||||
this->dropdownMenu_.addAction("Reload channel emotes", this, SLOT(menuReloadChannelEmotes()));
|
||||
this->dropdownMenu_.addAction("Reconnect", this, SLOT(menuManualReconnect()));
|
||||
this->dropdownMenu_.addAction("Clear messages", this->split_, &Split::doClearChat);
|
||||
// this->dropdownMenu.addSeparator();
|
||||
// this->dropdownMenu.addAction("Show changelog", this, SLOT(menuShowChangelog()));
|
||||
// clang-format on
|
||||
@@ -158,8 +158,8 @@ void SplitHeader::updateRoomModes()
|
||||
|
||||
void SplitHeader::setupModeLabel(RippleEffectLabel &label)
|
||||
{
|
||||
this->managedConnections.push_back(this->modeUpdateRequested_.connect([this, &label] {
|
||||
auto twitchChannel = dynamic_cast<TwitchChannel *>(this->split->getChannel().get());
|
||||
this->managedConnections_.push_back(this->modeUpdateRequested_.connect([this, &label] {
|
||||
auto twitchChannel = dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
||||
|
||||
// return if the channel is not a twitch channel
|
||||
if (twitchChannel == nullptr) {
|
||||
@@ -224,11 +224,11 @@ void SplitHeader::addModeActions(QMenu &menu)
|
||||
menu.addAction(setSlow);
|
||||
menu.addAction(setR9k);
|
||||
|
||||
this->managedConnections.push_back(this->modeUpdateRequested_.connect( //
|
||||
this->managedConnections_.push_back(this->modeUpdateRequested_.connect( //
|
||||
[this, setSub, setEmote, setSlow, setR9k]() {
|
||||
auto twitchChannel = dynamic_cast<TwitchChannel *>(this->split->getChannel().get());
|
||||
auto twitchChannel = dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
||||
if (twitchChannel == nullptr) {
|
||||
this->modeButton->hide();
|
||||
this->modeButton_->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ void SplitHeader::addModeActions(QMenu &menu)
|
||||
action->setChecked(!action->isChecked());
|
||||
|
||||
qDebug() << command;
|
||||
this->split->getChannel().get()->sendMessage(command);
|
||||
this->split_->getChannel().get()->sendMessage(command);
|
||||
};
|
||||
|
||||
QObject::connect(setSub, &QAction::triggered, this,
|
||||
@@ -260,7 +260,7 @@ void SplitHeader::addModeActions(QMenu &menu)
|
||||
|
||||
QObject::connect(setSlow, &QAction::triggered, this, [setSlow, this]() {
|
||||
if (!setSlow->isChecked()) {
|
||||
this->split->getChannel().get()->sendMessage("/slowoff");
|
||||
this->split_->getChannel().get()->sendMessage("/slowoff");
|
||||
setSlow->setChecked(false);
|
||||
return;
|
||||
};
|
||||
@@ -268,7 +268,7 @@ void SplitHeader::addModeActions(QMenu &menu)
|
||||
int slowSec =
|
||||
QInputDialog::getInt(this, "", "Seconds:", 10, 0, 500, 1, &ok, Qt::FramelessWindowHint);
|
||||
if (ok) {
|
||||
this->split->getChannel().get()->sendMessage(QString("/slow %1").arg(slowSec));
|
||||
this->split_->getChannel().get()->sendMessage(QString("/slow %1").arg(slowSec));
|
||||
} else {
|
||||
setSlow->setChecked(false);
|
||||
}
|
||||
@@ -281,13 +281,13 @@ void SplitHeader::addModeActions(QMenu &menu)
|
||||
void SplitHeader::initializeChannelSignals()
|
||||
{
|
||||
// Disconnect any previous signal first
|
||||
this->onlineStatusChangedConnection.disconnect();
|
||||
this->onlineStatusChangedConnection_.disconnect();
|
||||
|
||||
auto channel = this->split->getChannel();
|
||||
auto channel = this->split_->getChannel();
|
||||
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
||||
if (twitchChannel) {
|
||||
this->managedConnections.emplace_back(twitchChannel->updateLiveInfo.connect([this]() {
|
||||
this->managedConnections_.emplace_back(twitchChannel->updateLiveInfo.connect([this]() {
|
||||
this->updateChannelText(); //
|
||||
}));
|
||||
}
|
||||
@@ -298,16 +298,16 @@ void SplitHeader::scaleChangedEvent(float scale)
|
||||
int w = int(28 * scale);
|
||||
|
||||
this->setFixedHeight(w);
|
||||
this->dropdownButton->setFixedWidth(w);
|
||||
this->moderationButton->setFixedWidth(w);
|
||||
this->dropdownButton_->setFixedWidth(w);
|
||||
this->moderationButton_->setFixedWidth(w);
|
||||
// this->titleLabel->setFont(
|
||||
// FontManager::getInstance().getFont(FontStyle::Medium, scale));
|
||||
}
|
||||
|
||||
void SplitHeader::updateChannelText()
|
||||
{
|
||||
auto indirectChannel = this->split->getIndirectChannel();
|
||||
auto channel = this->split->getChannel();
|
||||
auto indirectChannel = this->split_->getIndirectChannel();
|
||||
auto channel = this->split_->getChannel();
|
||||
|
||||
QString title = channel->name;
|
||||
|
||||
@@ -321,8 +321,8 @@ void SplitHeader::updateChannelText()
|
||||
const auto streamStatus = twitchChannel->getStreamStatus();
|
||||
|
||||
if (streamStatus.live) {
|
||||
this->isLive = true;
|
||||
this->tooltip = "<style>.center { text-align: center; }</style>"
|
||||
this->isLive_ = true;
|
||||
this->tooltip_ = "<style>.center { text-align: center; }</style>"
|
||||
"<p class = \"center\">" +
|
||||
streamStatus.title + "<br><br>" + streamStatus.game + "<br>" +
|
||||
(streamStatus.rerun ? "Vod-casting" : "Live") + " for " +
|
||||
@@ -338,7 +338,7 @@ void SplitHeader::updateChannelText()
|
||||
title += " (live)";
|
||||
}
|
||||
} else {
|
||||
this->tooltip = QString();
|
||||
this->tooltip_ = QString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ void SplitHeader::updateChannelText()
|
||||
title = "<empty>";
|
||||
}
|
||||
|
||||
this->isLive = false;
|
||||
this->isLive_ = false;
|
||||
this->titleLabel->setText(title);
|
||||
}
|
||||
|
||||
@@ -354,12 +354,12 @@ void SplitHeader::updateModerationModeIcon()
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
this->moderationButton->setPixmap(this->split->getModerationMode()
|
||||
this->moderationButton_->setPixmap(this->split_->getModerationMode()
|
||||
? *app->resources->moderationmode_enabled->getPixmap()
|
||||
: *app->resources->moderationmode_disabled->getPixmap());
|
||||
|
||||
bool modButtonVisible = false;
|
||||
ChannelPtr channel = this->split->getChannel();
|
||||
ChannelPtr channel = this->split_->getChannel();
|
||||
|
||||
TwitchChannel *tc = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
||||
@@ -367,7 +367,7 @@ void SplitHeader::updateModerationModeIcon()
|
||||
modButtonVisible = true;
|
||||
}
|
||||
|
||||
this->moderationButton->setVisible(modButtonVisible);
|
||||
this->moderationButton_->setVisible(modButtonVisible);
|
||||
}
|
||||
|
||||
void SplitHeader::paintEvent(QPaintEvent *)
|
||||
@@ -382,26 +382,26 @@ void SplitHeader::paintEvent(QPaintEvent *)
|
||||
void SplitHeader::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
this->dragging = true;
|
||||
this->dragging_ = true;
|
||||
|
||||
this->dragStart = event->pos();
|
||||
this->dragStart_ = event->pos();
|
||||
}
|
||||
|
||||
this->doubleClicked = false;
|
||||
this->doubleClicked_ = false;
|
||||
}
|
||||
|
||||
void SplitHeader::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (this->dragging && event->button() == Qt::LeftButton) {
|
||||
if (this->dragging_ && event->button() == Qt::LeftButton) {
|
||||
QPoint pos = event->globalPos();
|
||||
|
||||
if (!showingHelpTooltip) {
|
||||
this->showingHelpTooltip = true;
|
||||
if (!showingHelpTooltip_) {
|
||||
this->showingHelpTooltip_ = true;
|
||||
|
||||
QTimer::singleShot(400, this, [this, pos] {
|
||||
if (this->doubleClicked) {
|
||||
this->doubleClicked = false;
|
||||
this->showingHelpTooltip = false;
|
||||
if (this->doubleClicked_) {
|
||||
this->doubleClicked_ = false;
|
||||
this->showingHelpTooltip_ = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,22 +416,22 @@ void SplitHeader::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
QTimer::singleShot(3000, widget, [this, widget] {
|
||||
widget->close();
|
||||
this->showingHelpTooltip = false;
|
||||
this->showingHelpTooltip_ = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this->dragging = false;
|
||||
this->dragging_ = false;
|
||||
}
|
||||
|
||||
void SplitHeader::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (this->dragging) {
|
||||
if (std::abs(this->dragStart.x() - event->pos().x()) > int(12 * this->getScale()) ||
|
||||
std::abs(this->dragStart.y() - event->pos().y()) > int(12 * this->getScale())) {
|
||||
this->split->drag();
|
||||
this->dragging = false;
|
||||
if (this->dragging_) {
|
||||
if (std::abs(this->dragStart_.x() - event->pos().x()) > int(12 * this->getScale()) ||
|
||||
std::abs(this->dragStart_.y() - event->pos().y()) > int(12 * this->getScale())) {
|
||||
this->split_->drag();
|
||||
this->dragging_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -439,17 +439,17 @@ void SplitHeader::mouseMoveEvent(QMouseEvent *event)
|
||||
void SplitHeader::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
this->split->doChangeChannel();
|
||||
this->split_->doChangeChannel();
|
||||
}
|
||||
this->doubleClicked = true;
|
||||
this->doubleClicked_ = true;
|
||||
}
|
||||
|
||||
void SplitHeader::enterEvent(QEvent *event)
|
||||
{
|
||||
if (!this->tooltip.isEmpty()) {
|
||||
if (!this->tooltip_.isEmpty()) {
|
||||
auto tooltipWidget = TooltipWidget::getInstance();
|
||||
tooltipWidget->moveTo(this, this->mapToGlobal(this->rect().bottomLeft()), false);
|
||||
tooltipWidget->setText(this->tooltip);
|
||||
tooltipWidget->setText(this->tooltip_);
|
||||
tooltipWidget->show();
|
||||
tooltipWidget->raise();
|
||||
}
|
||||
@@ -472,16 +472,16 @@ void SplitHeader::themeChangedEvent()
|
||||
{
|
||||
QPalette palette;
|
||||
|
||||
if (this->split->hasFocus()) {
|
||||
if (this->split_->hasFocus()) {
|
||||
palette.setColor(QPalette::Foreground, this->theme->splits.header.focusedText);
|
||||
} else {
|
||||
palette.setColor(QPalette::Foreground, this->theme->splits.header.text);
|
||||
}
|
||||
|
||||
if (this->theme->isLightTheme()) {
|
||||
this->dropdownButton->setPixmap(QPixmap(":/images/menu_black.png"));
|
||||
this->dropdownButton_->setPixmap(QPixmap(":/images/menu_black.png"));
|
||||
} else {
|
||||
this->dropdownButton->setPixmap(QPixmap(":/images/menu_white.png"));
|
||||
this->dropdownButton_->setPixmap(QPixmap(":/images/menu_white.png"));
|
||||
}
|
||||
|
||||
this->titleLabel->setPalette(palette);
|
||||
@@ -493,7 +493,7 @@ void SplitHeader::menuMoveSplit()
|
||||
|
||||
void SplitHeader::menuReloadChannelEmotes()
|
||||
{
|
||||
auto channel = this->split->getChannel();
|
||||
auto channel = this->split_->getChannel();
|
||||
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
||||
if (twitchChannel) {
|
||||
|
||||
@@ -55,33 +55,32 @@ private:
|
||||
void setupModeLabel(RippleEffectLabel &label);
|
||||
void addDropdownItems(RippleEffectButton *label);
|
||||
|
||||
Split *const split;
|
||||
Split *const split_;
|
||||
|
||||
QPoint dragStart;
|
||||
bool dragging = false;
|
||||
bool doubleClicked = false;
|
||||
bool showingHelpTooltip = false;
|
||||
QPoint dragStart_;
|
||||
bool dragging_ = false;
|
||||
bool doubleClicked_ = false;
|
||||
bool showingHelpTooltip_ = false;
|
||||
|
||||
pajlada::Signals::Connection onlineStatusChangedConnection;
|
||||
pajlada::Signals::Connection onlineStatusChangedConnection_;
|
||||
|
||||
RippleEffectButton *dropdownButton = nullptr;
|
||||
RippleEffectButton *dropdownButton_ = nullptr;
|
||||
// Label *titleLabel;
|
||||
Label *titleLabel = nullptr;
|
||||
RippleEffectLabel *modeButton = nullptr;
|
||||
RippleEffectButton *moderationButton = nullptr;
|
||||
RippleEffectLabel *modeButton_ = nullptr;
|
||||
RippleEffectButton *moderationButton_ = nullptr;
|
||||
|
||||
QMenu dropdownMenu;
|
||||
QMenu modeMenu;
|
||||
QMenu dropdownMenu_;
|
||||
QMenu modeMenu_;
|
||||
|
||||
pajlada::Signals::NoArgSignal modeUpdateRequested_;
|
||||
|
||||
QString tooltip;
|
||||
bool isLive;
|
||||
QString tooltip_;
|
||||
bool isLive_;
|
||||
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
|
||||
public slots:
|
||||
|
||||
void menuMoveSplit();
|
||||
void menuReloadChannelEmotes();
|
||||
void menuManualReconnect();
|
||||
|
||||
@@ -91,7 +91,7 @@ void SplitInput::initLayout()
|
||||
// clear channelview selection when selecting in the input
|
||||
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable, [this](bool available) {
|
||||
if (available) {
|
||||
this->split_->view.clearSelection();
|
||||
this->split_->view_.clearSelection();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -254,7 +254,7 @@ void SplitInput::installKeyPressedEvent()
|
||||
notebook->selectPreviousTab();
|
||||
}
|
||||
} else if (event->key() == Qt::Key_C && event->modifiers() == Qt::ControlModifier) {
|
||||
if (this->split_->view.hasSelection()) {
|
||||
if (this->split_->view_.hasSelection()) {
|
||||
this->split_->doCopy();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
void initLayout();
|
||||
void installKeyPressedEvent();
|
||||
void updateEmoteButton();
|
||||
|
||||
Split *const split_;
|
||||
std::unique_ptr<EmotePopup> emotePopup_;
|
||||
|
||||
@@ -56,11 +60,6 @@ private:
|
||||
QString currMsg_;
|
||||
int prevIndex_ = 0;
|
||||
|
||||
void initLayout();
|
||||
void installKeyPressedEvent();
|
||||
|
||||
void updateEmoteButton();
|
||||
|
||||
private slots:
|
||||
void editTextChanged();
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace chatterino {
|
||||
|
||||
SplitOverlay::SplitOverlay(Split *parent)
|
||||
: BaseWidget(parent)
|
||||
, split(parent)
|
||||
, split_(parent)
|
||||
{
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
this->_layout = layout;
|
||||
this->layout_ = layout;
|
||||
layout->setMargin(1);
|
||||
layout->setSpacing(1);
|
||||
|
||||
@@ -30,11 +30,11 @@ SplitOverlay::SplitOverlay(Split *parent)
|
||||
layout->setColumnStretch(3, 1);
|
||||
|
||||
QPushButton *move = new QPushButton(getApp()->resources->split.move, QString());
|
||||
QPushButton *left = this->_left = new QPushButton(getApp()->resources->split.left, QString());
|
||||
QPushButton *right = this->_right =
|
||||
QPushButton *left = this->left_ = new QPushButton(getApp()->resources->split.left, QString());
|
||||
QPushButton *right = this->right_ =
|
||||
new QPushButton(getApp()->resources->split.right, QString());
|
||||
QPushButton *up = this->_up = new QPushButton(getApp()->resources->split.up, QString());
|
||||
QPushButton *down = this->_down = new QPushButton(getApp()->resources->split.down, QString());
|
||||
QPushButton *up = this->up_ = new QPushButton(getApp()->resources->split.up, QString());
|
||||
QPushButton *down = this->down_ = new QPushButton(getApp()->resources->split.down, QString());
|
||||
|
||||
move->setGraphicsEffect(new QGraphicsOpacityEffect(this));
|
||||
left->setGraphicsEffect(new QGraphicsOpacityEffect(this));
|
||||
@@ -98,7 +98,7 @@ void SplitOverlay::paintEvent(QPaintEvent *)
|
||||
}
|
||||
|
||||
QRect rect;
|
||||
switch (this->hoveredElement) {
|
||||
switch (this->hoveredElement_) {
|
||||
case SplitLeft: {
|
||||
rect = QRect(0, 0, this->width() / 2, this->height());
|
||||
} break;
|
||||
@@ -134,10 +134,10 @@ void SplitOverlay::resizeEvent(QResizeEvent *event)
|
||||
bool wideEnough = event->size().width() > 150 * _scale;
|
||||
bool highEnough = event->size().height() > 150 * _scale;
|
||||
|
||||
this->_left->setVisible(wideEnough);
|
||||
this->_right->setVisible(wideEnough);
|
||||
this->_up->setVisible(highEnough);
|
||||
this->_down->setVisible(highEnough);
|
||||
this->left_->setVisible(wideEnough);
|
||||
this->right_->setVisible(wideEnough);
|
||||
this->up_->setVisible(highEnough);
|
||||
this->down_->setVisible(highEnough);
|
||||
}
|
||||
|
||||
void SplitOverlay::mouseMoveEvent(QMouseEvent *event)
|
||||
@@ -169,7 +169,7 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched, QEvent *even
|
||||
effect->setOpacity(0.99);
|
||||
}
|
||||
|
||||
this->parent->hoveredElement = this->hoveredElement;
|
||||
this->parent->hoveredElement_ = this->hoveredElement;
|
||||
this->parent->update();
|
||||
} break;
|
||||
case QEvent::Leave: {
|
||||
@@ -180,27 +180,27 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched, QEvent *even
|
||||
effect->setOpacity(0.7);
|
||||
}
|
||||
|
||||
this->parent->hoveredElement = HoveredElement::None;
|
||||
this->parent->hoveredElement_ = HoveredElement::None;
|
||||
this->parent->update();
|
||||
} break;
|
||||
case QEvent::MouseButtonPress: {
|
||||
if (this->hoveredElement == HoveredElement::SplitMove) {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
this->parent->split->drag();
|
||||
this->parent->split_->drag();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} break;
|
||||
case QEvent::MouseButtonRelease: {
|
||||
if (this->hoveredElement != HoveredElement::SplitMove) {
|
||||
SplitContainer *container = this->parent->split->getContainer();
|
||||
SplitContainer *container = this->parent->split_->getContainer();
|
||||
|
||||
if (container != nullptr) {
|
||||
auto *_split = new Split(container);
|
||||
auto dir = SplitContainer::Direction(this->hoveredElement +
|
||||
SplitContainer::Left - SplitLeft);
|
||||
container->insertSplit(_split, dir, this->parent->split);
|
||||
container->insertSplit(_split, dir, this->parent->split_);
|
||||
this->parent->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,6 @@ protected:
|
||||
private:
|
||||
// fourtf: !!! preserve the order of left, up, right and down
|
||||
enum HoveredElement { None, SplitMove, SplitLeft, SplitUp, SplitRight, SplitDown };
|
||||
HoveredElement hoveredElement = None;
|
||||
Split *split;
|
||||
QGridLayout *_layout;
|
||||
QPushButton *_left;
|
||||
QPushButton *_up;
|
||||
QPushButton *_right;
|
||||
QPushButton *_down;
|
||||
|
||||
class ButtonEventFilter : public QObject
|
||||
{
|
||||
@@ -44,6 +37,14 @@ private:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
};
|
||||
|
||||
HoveredElement hoveredElement_ = None;
|
||||
Split *split_;
|
||||
QGridLayout *layout_;
|
||||
QPushButton *left_;
|
||||
QPushButton *up_;
|
||||
QPushButton *right_;
|
||||
QPushButton *down_;
|
||||
|
||||
friend class ButtonEventFilter;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user