Renamed private members

This commit is contained in:
fourtf
2018-07-06 19:23:47 +02:00
parent 6935619820
commit 280bb4cf8e
141 changed files with 1754 additions and 1861 deletions
+17 -24
View File
@@ -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()
{
+1 -1
View File
@@ -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,
-13
View File
@@ -1,13 +0,0 @@
//#include "DropOverlay.hpp"
// namespace chatterino {
// namespace widgets {
// namespace helper {
// DropOverlay::DropOverlay()
//{
//}
//} // namespace helper
//} // namespace widgets
//} // namespace chatterino
-11
View File
@@ -1,11 +0,0 @@
//#pragma once
//#include "widgets/helper/SplitNode.hpp"
// namespace chatterino {
// namespace widgets {
// namespace helper {
//} // namespace helper
//} // namespace widgets
//} // namespace chatterino
-53
View File
@@ -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
-26
View File
@@ -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
+14 -14
View File
@@ -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
+2 -2
View File
@@ -22,8 +22,8 @@ public:
pajlada::Signals::NoArgSignal addButtonPressed;
private:
QTableView *tableView;
QAbstractTableModel *model;
QTableView *tableView_;
QAbstractTableModel *model_;
};
} // namespace chatterino
+1 -1
View File
@@ -17,7 +17,7 @@ public:
explicit NotebookButton(Notebook *parent);
void setIcon(Icon icon_);
void setIcon(Icon icon);
Icon getIcon() const;
protected:
+6 -7
View File
@@ -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
+23 -23
View File
@@ -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
+3 -3
View File
@@ -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);
};
+7 -7
View File
@@ -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
+7 -7
View File
@@ -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)
+3 -3
View File
@@ -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
+8 -8
View File
@@ -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
+3 -3
View File
@@ -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
+11 -11
View File
@@ -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
+4 -4
View File
@@ -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
+11 -11
View File
@@ -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
+6 -6
View File
@@ -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
+3 -3
View File
@@ -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;
+2 -2
View File
@@ -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