added namespace comments

This commit is contained in:
fourtf 2017-04-14 17:47:28 +02:00
parent 043ddfafa6
commit a0d29ebae8
97 changed files with 268 additions and 267 deletions

View file

@ -17,7 +17,7 @@ TARGET = chatterino
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += IRC_NAMESPACE=Communi
DEFINES += IRC_namespace =Communi
# do not use windows min/max macros
win32 {

View file

@ -27,3 +27,4 @@ BraceWrapping: {
BeforeCatch: 'false'
}
ColumnLimit: 100
FixNamespaceComments: true

View file

@ -70,6 +70,6 @@ private:
void messageReceived(Communi::IrcMessage *message);
void privateMessageReceived(Communi::IrcPrivateMessage *message);
};
}
} // namespace chatterino
#endif // IRCMANAGER_H

View file

@ -22,6 +22,6 @@ private:
QString _realName;
QString _password;
};
}
} // namespace chatterino
#endif // IRCUSER_H

View file

@ -11,30 +11,30 @@ template <typename T>
class LimitedQueueSnapshot
{
public:
LimitedQueueSnapshot(std::shared_ptr<std::vector<T>> ptr, int offset, int length)
: vector(ptr)
, offset(offset)
, length(length)
LimitedQueueSnapshot(std::shared_ptr<std::vector<T>> vector, int offset, int size)
: _vector(vector)
, _offset(offset)
, _length(size)
{
}
int getLength()
int getSize()
{
return this->length;
return _length;
}
T const &operator[](int index) const
{
return this->vector->at(index + this->offset);
return _vector->at(index + _offset);
}
private:
std::shared_ptr<std::vector<T>> vector;
std::shared_ptr<std::vector<T>> _vector;
int offset;
int length;
int _offset;
int _length;
};
}
}
} // namespace messages
} // namespace chatterino
#endif // LIMITEDQUEUESNAPSHOT_H

View file

@ -108,6 +108,6 @@ private:
static messages::LazyLoadedImage *buttonBan;
static messages::LazyLoadedImage *buttonTimeout;
};
}
} // namespace chatterino
#endif // RESOURCES_H

View file

@ -28,6 +28,6 @@ public:
private:
std::vector<std::pair<std::reference_wrapper<BaseSetting>, QVariant>> _items;
};
}
} // namespace chatterino
#endif // SETTINGSSNAPSHOT_H

View file

@ -116,7 +116,7 @@ ChatWidget::attachChannel(SharedChannel channel)
auto snapshot = _channel.get()->getMessageSnapshot();
for (int i = 0; i < snapshot.getLength(); i++) {
for (int i = 0; i < snapshot.getSize(); i++) {
SharedMessageRef deleted;
auto messageRef = new MessageRef(snapshot[i]);

View file

@ -49,7 +49,7 @@ private slots:
void editTextChanged();
// void editKeyPressed(QKeyEvent *event);
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // CHATWIDGETINPUT_H

View file

@ -26,9 +26,9 @@ ChatWidgetView::ChatWidgetView(ChatWidget *parent)
, _mouseDown(false)
, _lastPressPosition()
{
this->setAttribute(Qt::WA_OpaquePaintEvent);
setAttribute(Qt::WA_OpaquePaintEvent);
_scrollbar.setSmallChange(5);
this->setMouseTracking(true);
setMouseTracking(true);
QObject::connect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged, this,
&ChatWidgetView::wordTypeMaskChanged);
@ -46,7 +46,7 @@ bool ChatWidgetView::layoutMessages()
{
auto messages = _chatWidget->getMessagesSnapshot();
if (messages.getLength() == 0) {
if (messages.getSize() == 0) {
_scrollbar.setVisible(false);
return false;
@ -57,14 +57,13 @@ bool ChatWidgetView::layoutMessages()
int start = _scrollbar.getCurrentValue();
// layout the visible messages in the view
if (messages.getLength() > start) {
int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1)));
if (messages.getSize() > start) {
int y = -(messages[start]->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1)));
for (int i = start; i < messages.getLength(); ++i) {
auto messagePtr = messages[i];
auto message = messagePtr.get();
for (int i = start; i < messages.getSize(); ++i) {
auto message = messages[i];
redraw |= message->layout(this->width(), true);
redraw |= message->layout(width(), true);
y += message->getHeight();
@ -75,17 +74,17 @@ bool ChatWidgetView::layoutMessages()
}
// 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();
message->layout(this->width(), true);
message->layout(width(), true);
h -= message->getHeight();
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());
showScrollbar = true;
@ -99,7 +98,7 @@ bool ChatWidgetView::layoutMessages()
_scrollbar.setDesiredValue(0);
}
_scrollbar.setMaximum(messages.getLength());
_scrollbar.setMaximum(messages.getSize());
return redraw;
}
@ -107,7 +106,7 @@ bool ChatWidgetView::layoutMessages()
void ChatWidgetView::updateGifEmotes()
{
_onlyUpdateEmotes = true;
this->update();
update();
}
ScrollBar *ChatWidgetView::getScrollbar()
@ -188,13 +187,13 @@ void ChatWidgetView::paintEvent(QPaintEvent *event)
int start = _scrollbar.getCurrentValue();
if (start >= messages.getLength()) {
if (start >= messages.getSize()) {
return;
}
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();
std::shared_ptr<QPixmap> bufferPtr = messageRef->buffer;
@ -203,7 +202,7 @@ void ChatWidgetView::paintEvent(QPaintEvent *event)
bool updateBuffer = messageRef->updateBuffer;
if (buffer == nullptr) {
buffer = new QPixmap(this->width(), messageRef->getHeight());
buffer = new QPixmap(width(), messageRef->getHeight());
bufferPtr = std::shared_ptr<QPixmap>(buffer);
updateBuffer = true;
}
@ -282,10 +281,10 @@ void ChatWidgetView::paintEvent(QPaintEvent *event)
void ChatWidgetView::wheelEvent(QWheelEvent *event)
{
if (_scrollbar.isVisible()) {
auto mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier.get();
_scrollbar.setDesiredValue(
_scrollbar.getDesiredValue() -
event->delta() / 10.0 * SettingsManager::getInstance().mouseScrollMultiplier.get(),
true);
_scrollbar.getDesiredValue() - event->delta() / 10.0 * mouseMultiplier, true);
}
}
@ -295,7 +294,7 @@ void ChatWidgetView::mouseMoveEvent(QMouseEvent *event)
QPoint relativePos;
if (!tryGetMessageAt(event->pos(), message, relativePos)) {
this->setCursor(Qt::ArrowCursor);
setCursor(Qt::ArrowCursor);
return;
}
@ -305,16 +304,16 @@ void ChatWidgetView::mouseMoveEvent(QMouseEvent *event)
messages::Word hoverWord;
if (!message->tryGetWordPart(relativePos, hoverWord)) {
this->setCursor(Qt::ArrowCursor);
setCursor(Qt::ArrowCursor);
return;
}
int index = message->getSelectionIndex(relativePos);
if (hoverWord.getLink().getIsValid()) {
this->setCursor(Qt::PointingHandCursor);
setCursor(Qt::PointingHandCursor);
} 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();
if (start >= messages.getLength()) {
if (start >= messages.getSize()) {
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];
y += message->getHeight();

View file

@ -33,7 +33,7 @@ private:
bool _mouseDown = false;
QPoint _mousePos;
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKBUTTON_H

View file

@ -23,7 +23,7 @@ protected:
QRect desiredGeometry;
bool animate;
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKPAGEDROPPREVIEW_H

View file

@ -63,12 +63,13 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
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;
}
_dialog->select(this);
}
}
}
} // namespace widgets
} // namespace chatterino

View file

@ -27,7 +27,7 @@ signals:
private:
void paintEvent(QPaintEvent *);
void mouseReleaseEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
QWidget *_widget;
QString _label;
@ -37,7 +37,7 @@ private:
bool _selected;
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // SETTINGSNOTEBOOKTAB_H