added namespace comments
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ TARGET = chatterino
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
DEFINES += IRC_NAMESPACE=Communi
|
DEFINES += IRC_namespace =Communi
|
||||||
|
|
||||||
# do not use windows min/max macros
|
# do not use windows min/max macros
|
||||||
win32 {
|
win32 {
|
||||||
|
|||||||
@@ -27,3 +27,4 @@ BraceWrapping: {
|
|||||||
BeforeCatch: 'false'
|
BeforeCatch: 'false'
|
||||||
}
|
}
|
||||||
ColumnLimit: 100
|
ColumnLimit: 100
|
||||||
|
FixNamespaceComments: true
|
||||||
+1
-1
@@ -70,6 +70,6 @@ private:
|
|||||||
void messageReceived(Communi::IrcMessage *message);
|
void messageReceived(Communi::IrcMessage *message);
|
||||||
void privateMessageReceived(Communi::IrcPrivateMessage *message);
|
void privateMessageReceived(Communi::IrcPrivateMessage *message);
|
||||||
};
|
};
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // IRCMANAGER_H
|
#endif // IRCMANAGER_H
|
||||||
|
|||||||
+1
-1
@@ -22,6 +22,6 @@ private:
|
|||||||
QString _realName;
|
QString _realName;
|
||||||
QString _password;
|
QString _password;
|
||||||
};
|
};
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // IRCUSER_H
|
#endif // IRCUSER_H
|
||||||
|
|||||||
@@ -11,30 +11,30 @@ template <typename T>
|
|||||||
class LimitedQueueSnapshot
|
class LimitedQueueSnapshot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LimitedQueueSnapshot(std::shared_ptr<std::vector<T>> ptr, int offset, int length)
|
LimitedQueueSnapshot(std::shared_ptr<std::vector<T>> vector, int offset, int size)
|
||||||
: vector(ptr)
|
: _vector(vector)
|
||||||
, offset(offset)
|
, _offset(offset)
|
||||||
, length(length)
|
, _length(size)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int getLength()
|
int getSize()
|
||||||
{
|
{
|
||||||
return this->length;
|
return _length;
|
||||||
}
|
}
|
||||||
|
|
||||||
T const &operator[](int index) const
|
T const &operator[](int index) const
|
||||||
{
|
{
|
||||||
return this->vector->at(index + this->offset);
|
return _vector->at(index + _offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<std::vector<T>> vector;
|
std::shared_ptr<std::vector<T>> _vector;
|
||||||
|
|
||||||
int offset;
|
int _offset;
|
||||||
int length;
|
int _length;
|
||||||
};
|
};
|
||||||
}
|
} // namespace messages
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // LIMITEDQUEUESNAPSHOT_H
|
#endif // LIMITEDQUEUESNAPSHOT_H
|
||||||
|
|||||||
+1
-1
@@ -108,6 +108,6 @@ private:
|
|||||||
static messages::LazyLoadedImage *buttonBan;
|
static messages::LazyLoadedImage *buttonBan;
|
||||||
static messages::LazyLoadedImage *buttonTimeout;
|
static messages::LazyLoadedImage *buttonTimeout;
|
||||||
};
|
};
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // RESOURCES_H
|
#endif // RESOURCES_H
|
||||||
|
|||||||
+1
-1
@@ -28,6 +28,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::vector<std::pair<std::reference_wrapper<BaseSetting>, QVariant>> _items;
|
std::vector<std::pair<std::reference_wrapper<BaseSetting>, QVariant>> _items;
|
||||||
};
|
};
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // SETTINGSSNAPSHOT_H
|
#endif // SETTINGSSNAPSHOT_H
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ ChatWidget::attachChannel(SharedChannel channel)
|
|||||||
|
|
||||||
auto snapshot = _channel.get()->getMessageSnapshot();
|
auto snapshot = _channel.get()->getMessageSnapshot();
|
||||||
|
|
||||||
for (int i = 0; i < snapshot.getLength(); i++) {
|
for (int i = 0; i < snapshot.getSize(); i++) {
|
||||||
SharedMessageRef deleted;
|
SharedMessageRef deleted;
|
||||||
|
|
||||||
auto messageRef = new MessageRef(snapshot[i]);
|
auto messageRef = new MessageRef(snapshot[i]);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ private slots:
|
|||||||
void editTextChanged();
|
void editTextChanged();
|
||||||
// void editKeyPressed(QKeyEvent *event);
|
// void editKeyPressed(QKeyEvent *event);
|
||||||
};
|
};
|
||||||
}
|
} // namespace widgets
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // CHATWIDGETINPUT_H
|
#endif // CHATWIDGETINPUT_H
|
||||||
|
|||||||
+27
-28
@@ -26,9 +26,9 @@ ChatWidgetView::ChatWidgetView(ChatWidget *parent)
|
|||||||
, _mouseDown(false)
|
, _mouseDown(false)
|
||||||
, _lastPressPosition()
|
, _lastPressPosition()
|
||||||
{
|
{
|
||||||
this->setAttribute(Qt::WA_OpaquePaintEvent);
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
_scrollbar.setSmallChange(5);
|
_scrollbar.setSmallChange(5);
|
||||||
this->setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
QObject::connect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged, this,
|
QObject::connect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged, this,
|
||||||
&ChatWidgetView::wordTypeMaskChanged);
|
&ChatWidgetView::wordTypeMaskChanged);
|
||||||
@@ -46,7 +46,7 @@ bool ChatWidgetView::layoutMessages()
|
|||||||
{
|
{
|
||||||
auto messages = _chatWidget->getMessagesSnapshot();
|
auto messages = _chatWidget->getMessagesSnapshot();
|
||||||
|
|
||||||
if (messages.getLength() == 0) {
|
if (messages.getSize() == 0) {
|
||||||
_scrollbar.setVisible(false);
|
_scrollbar.setVisible(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -57,14 +57,13 @@ bool ChatWidgetView::layoutMessages()
|
|||||||
int start = _scrollbar.getCurrentValue();
|
int start = _scrollbar.getCurrentValue();
|
||||||
|
|
||||||
// layout the visible messages in the view
|
// layout the visible messages in the view
|
||||||
if (messages.getLength() > start) {
|
if (messages.getSize() > start) {
|
||||||
int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1)));
|
int y = -(messages[start]->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1)));
|
||||||
|
|
||||||
for (int i = start; i < messages.getLength(); ++i) {
|
for (int i = start; i < messages.getSize(); ++i) {
|
||||||
auto messagePtr = messages[i];
|
auto message = messages[i];
|
||||||
auto message = messagePtr.get();
|
|
||||||
|
|
||||||
redraw |= message->layout(this->width(), true);
|
redraw |= message->layout(width(), true);
|
||||||
|
|
||||||
y += message->getHeight();
|
y += message->getHeight();
|
||||||
|
|
||||||
@@ -75,17 +74,17 @@ bool ChatWidgetView::layoutMessages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// layout the messages at the bottom to determine the scrollbar thumb size
|
// layout the messages at the bottom to determine the scrollbar thumb size
|
||||||
int h = this->height() - 8;
|
int h = height() - 8;
|
||||||
|
|
||||||
for (int i = messages.getLength() - 1; i >= 0; i--) {
|
for (int i = messages.getSize() - 1; i >= 0; i--) {
|
||||||
auto *message = messages[i].get();
|
auto *message = messages[i].get();
|
||||||
|
|
||||||
message->layout(this->width(), true);
|
message->layout(width(), true);
|
||||||
|
|
||||||
h -= message->getHeight();
|
h -= message->getHeight();
|
||||||
|
|
||||||
if (h < 0) {
|
if (h < 0) {
|
||||||
_scrollbar.setLargeChange((messages.getLength() - i) + (qreal)h / message->getHeight());
|
_scrollbar.setLargeChange((messages.getSize() - i) + (qreal)h / message->getHeight());
|
||||||
_scrollbar.setDesiredValue(_scrollbar.getDesiredValue());
|
_scrollbar.setDesiredValue(_scrollbar.getDesiredValue());
|
||||||
|
|
||||||
showScrollbar = true;
|
showScrollbar = true;
|
||||||
@@ -99,7 +98,7 @@ bool ChatWidgetView::layoutMessages()
|
|||||||
_scrollbar.setDesiredValue(0);
|
_scrollbar.setDesiredValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_scrollbar.setMaximum(messages.getLength());
|
_scrollbar.setMaximum(messages.getSize());
|
||||||
|
|
||||||
return redraw;
|
return redraw;
|
||||||
}
|
}
|
||||||
@@ -107,7 +106,7 @@ bool ChatWidgetView::layoutMessages()
|
|||||||
void ChatWidgetView::updateGifEmotes()
|
void ChatWidgetView::updateGifEmotes()
|
||||||
{
|
{
|
||||||
_onlyUpdateEmotes = true;
|
_onlyUpdateEmotes = true;
|
||||||
this->update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar *ChatWidgetView::getScrollbar()
|
ScrollBar *ChatWidgetView::getScrollbar()
|
||||||
@@ -188,13 +187,13 @@ void ChatWidgetView::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
int start = _scrollbar.getCurrentValue();
|
int start = _scrollbar.getCurrentValue();
|
||||||
|
|
||||||
if (start >= messages.getLength()) {
|
if (start >= messages.getSize()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1)));
|
int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1)));
|
||||||
|
|
||||||
for (int i = start; i < messages.getLength(); ++i) {
|
for (int i = start; i < messages.getSize(); ++i) {
|
||||||
messages::MessageRef *messageRef = messages[i].get();
|
messages::MessageRef *messageRef = messages[i].get();
|
||||||
|
|
||||||
std::shared_ptr<QPixmap> bufferPtr = messageRef->buffer;
|
std::shared_ptr<QPixmap> bufferPtr = messageRef->buffer;
|
||||||
@@ -203,7 +202,7 @@ void ChatWidgetView::paintEvent(QPaintEvent *event)
|
|||||||
bool updateBuffer = messageRef->updateBuffer;
|
bool updateBuffer = messageRef->updateBuffer;
|
||||||
|
|
||||||
if (buffer == nullptr) {
|
if (buffer == nullptr) {
|
||||||
buffer = new QPixmap(this->width(), messageRef->getHeight());
|
buffer = new QPixmap(width(), messageRef->getHeight());
|
||||||
bufferPtr = std::shared_ptr<QPixmap>(buffer);
|
bufferPtr = std::shared_ptr<QPixmap>(buffer);
|
||||||
updateBuffer = true;
|
updateBuffer = true;
|
||||||
}
|
}
|
||||||
@@ -282,10 +281,10 @@ void ChatWidgetView::paintEvent(QPaintEvent *event)
|
|||||||
void ChatWidgetView::wheelEvent(QWheelEvent *event)
|
void ChatWidgetView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (_scrollbar.isVisible()) {
|
if (_scrollbar.isVisible()) {
|
||||||
|
auto mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier.get();
|
||||||
|
|
||||||
_scrollbar.setDesiredValue(
|
_scrollbar.setDesiredValue(
|
||||||
_scrollbar.getDesiredValue() -
|
_scrollbar.getDesiredValue() - event->delta() / 10.0 * mouseMultiplier, true);
|
||||||
event->delta() / 10.0 * SettingsManager::getInstance().mouseScrollMultiplier.get(),
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +294,7 @@ void ChatWidgetView::mouseMoveEvent(QMouseEvent *event)
|
|||||||
QPoint relativePos;
|
QPoint relativePos;
|
||||||
|
|
||||||
if (!tryGetMessageAt(event->pos(), message, relativePos)) {
|
if (!tryGetMessageAt(event->pos(), message, relativePos)) {
|
||||||
this->setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,16 +304,16 @@ void ChatWidgetView::mouseMoveEvent(QMouseEvent *event)
|
|||||||
messages::Word hoverWord;
|
messages::Word hoverWord;
|
||||||
|
|
||||||
if (!message->tryGetWordPart(relativePos, hoverWord)) {
|
if (!message->tryGetWordPart(relativePos, hoverWord)) {
|
||||||
this->setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = message->getSelectionIndex(relativePos);
|
int index = message->getSelectionIndex(relativePos);
|
||||||
|
|
||||||
if (hoverWord.getLink().getIsValid()) {
|
if (hoverWord.getLink().getIsValid()) {
|
||||||
this->setCursor(Qt::PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
} else {
|
} else {
|
||||||
this->setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,13 +385,13 @@ bool ChatWidgetView::tryGetMessageAt(QPoint p, std::shared_ptr<messages::Message
|
|||||||
|
|
||||||
int start = _scrollbar.getCurrentValue();
|
int start = _scrollbar.getCurrentValue();
|
||||||
|
|
||||||
if (start >= messages.getLength()) {
|
if (start >= messages.getSize()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))) + 12;
|
int y = -(messages[start]->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))) + 12;
|
||||||
|
|
||||||
for (int i = start; i < messages.getLength(); ++i) {
|
for (int i = start; i < messages.getSize(); ++i) {
|
||||||
auto message = messages[i];
|
auto message = messages[i];
|
||||||
|
|
||||||
y += message->getHeight();
|
y += message->getHeight();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ private:
|
|||||||
bool _mouseDown = false;
|
bool _mouseDown = false;
|
||||||
QPoint _mousePos;
|
QPoint _mousePos;
|
||||||
};
|
};
|
||||||
}
|
} // namespace widgets
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // NOTEBOOKBUTTON_H
|
#endif // NOTEBOOKBUTTON_H
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ protected:
|
|||||||
QRect desiredGeometry;
|
QRect desiredGeometry;
|
||||||
bool animate;
|
bool animate;
|
||||||
};
|
};
|
||||||
}
|
} // namespace widgets
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // NOTEBOOKPAGEDROPPREVIEW_H
|
#endif // NOTEBOOKPAGEDROPPREVIEW_H
|
||||||
|
|||||||
@@ -63,12 +63,13 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
|
|||||||
QTextOption(Qt::AlignLeft | Qt::AlignVCenter));
|
QTextOption(Qt::AlignLeft | Qt::AlignVCenter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialogTab::mouseReleaseEvent(QMouseEvent *event)
|
void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() != Qt::LeftButton)
|
if (event->button() != Qt::LeftButton) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_dialog->select(this);
|
_dialog->select(this);
|
||||||
}
|
}
|
||||||
}
|
} // namespace widgets
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
QWidget *_widget;
|
QWidget *_widget;
|
||||||
QString _label;
|
QString _label;
|
||||||
@@ -37,7 +37,7 @@ private:
|
|||||||
|
|
||||||
bool _selected;
|
bool _selected;
|
||||||
};
|
};
|
||||||
}
|
} // namespace widgets
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
#endif // SETTINGSNOTEBOOKTAB_H
|
#endif // SETTINGSNOTEBOOKTAB_H
|
||||||
|
|||||||
Reference in New Issue
Block a user