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
+6 -6
View File
@@ -11,10 +11,10 @@
#include <QVBoxLayout>
#include <boost/signals2.hpp>
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ChatWidget::ChatWidget(QWidget *parent)
: QWidget(parent)
@@ -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]);
@@ -198,5 +198,5 @@ ChatWidget::save()
return tree;
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+4 -4
View File
@@ -16,8 +16,8 @@
#include <boost/property_tree/ptree.hpp>
#include <boost/signals2/connection.hpp>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ChatWidget : public QWidget
{
@@ -62,7 +62,7 @@ public:
boost::property_tree::ptree save();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // CHATWIDGET_H
+2 -2
View File
@@ -8,8 +8,8 @@
#include <QMimeData>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
: QWidget()
+2 -2
View File
@@ -13,8 +13,8 @@
#include <QPoint>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ChatWidget;
class ChatWidgetHeader : public QWidget
+2 -2
View File
@@ -4,8 +4,8 @@
#include <QBrush>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ChatWidgetHeaderButton::ChatWidgetHeaderButton(int spacing)
: QWidget()
+2 -2
View File
@@ -8,8 +8,8 @@
#include <QPaintEvent>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ChatWidgetHeaderButton : public QWidget
{
+2 -2
View File
@@ -8,8 +8,8 @@
#include <QPainter>
#include <boost/signals2.hpp>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ChatWidgetInput::ChatWidgetInput(ChatWidget *widget)
: _chatWidget(widget)
+2 -2
View File
@@ -49,7 +49,7 @@ private slots:
void editTextChanged();
// void editKeyPressed(QKeyEvent *event);
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // CHATWIDGETINPUT_H
+29 -30
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();
@@ -406,5 +405,5 @@ bool ChatWidgetView::tryGetMessageAt(QPoint p, std::shared_ptr<messages::Message
return false;
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+2 -2
View File
@@ -67,7 +67,7 @@ private slots:
update();
}
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // CHATVIEW_H
+2 -2
View File
@@ -3,8 +3,8 @@
#include <QDebug>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
FancyButton::FancyButton(QWidget *parent)
: QWidget(parent)
+2 -2
View File
@@ -7,8 +7,8 @@
#include <QTimer>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class FancyButton : public QWidget
{
struct ClickEffect {
+4 -4
View File
@@ -13,8 +13,8 @@
#include "Windows.h"
#endif
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
MainWindow::MainWindow(QWidget *parent)
: QWidget(parent)
@@ -139,5 +139,5 @@ Notebook &MainWindow::getNotebook()
{
return _notebook;
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+4 -4
View File
@@ -8,8 +8,8 @@
#include <QMainWindow>
#include <boost/property_tree/ptree.hpp>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class MainWindow : public QWidget
{
@@ -37,7 +37,7 @@ private:
TitleBar _titleBar;
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // MAINWINDOW_H
+4 -4
View File
@@ -14,8 +14,8 @@
#include <QWidget>
#include <boost/foreach.hpp>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
Notebook::Notebook(QWidget *parent)
: QWidget(parent)
@@ -242,5 +242,5 @@ void Notebook::loadDefaults()
addPage();
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+4 -4
View File
@@ -9,8 +9,8 @@
#include <QWidget>
#include <boost/property_tree/ptree.hpp>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class Notebook : public QWidget
{
@@ -61,7 +61,7 @@ public:
void loadDefaults();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOK_H
+2 -2
View File
@@ -7,8 +7,8 @@
#include <QPainterPath>
#include <QRadialGradient>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
NotebookButton::NotebookButton(QWidget *parent)
: FancyButton(parent)
+2 -2
View File
@@ -33,7 +33,7 @@ private:
bool _mouseDown = false;
QPoint _mousePos;
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKBUTTON_H
+4 -4
View File
@@ -12,8 +12,8 @@
#include <QWidget>
#include <boost/foreach.hpp>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
bool NotebookPage::isDraggingSplit = false;
ChatWidget *NotebookPage::draggingSplit = NULL;
@@ -334,5 +334,5 @@ boost::property_tree::ptree NotebookPage::save()
return tree;
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+2 -2
View File
@@ -78,7 +78,7 @@ public:
boost::property_tree::ptree save();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKPAGE_H
+2 -2
View File
@@ -4,8 +4,8 @@
#include <QDebug>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
NotebookPageDropPreview::NotebookPageDropPreview(QWidget *parent)
: QWidget(parent)
+2 -2
View File
@@ -23,7 +23,7 @@ protected:
QRect desiredGeometry;
bool animate;
};
}
}
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKPAGEDROPPREVIEW_H
+4 -4
View File
@@ -5,8 +5,8 @@
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
NotebookTab::NotebookTab(Notebook *notebook)
: QWidget(notebook)
@@ -246,5 +246,5 @@ boost::property_tree::ptree NotebookTab::save()
return tree;
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+2 -2
View File
@@ -81,7 +81,7 @@ public:
boost::property_tree::ptree save();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKTAB_H
+2 -2
View File
@@ -6,8 +6,8 @@
#define MIN_THUMB_HEIGHT 10
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ScrollBar::ScrollBar(QWidget *widget)
: QWidget(widget)
+2 -2
View File
@@ -9,8 +9,8 @@
#include <boost/signals2.hpp>
#include <functional>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ScrollBar : public QWidget
{
+2 -2
View File
@@ -1,8 +1,8 @@
#include "widgets/scrollbarhighlight.h"
#include "colorscheme.h"
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex, Style style, QString tag)
: _position(position)
+2 -2
View File
@@ -3,8 +3,8 @@
#include "QString"
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ScrollBarHighlight
{
+4 -4
View File
@@ -13,8 +13,8 @@
#include <QPalette>
#include <QResource>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
SettingsDialog::SettingsDialog()
: _snapshot(SettingsManager::getInstance().createSnapshot())
@@ -325,5 +325,5 @@ void SettingsDialog::cancelButtonClicked()
this->close();
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+4 -4
View File
@@ -16,8 +16,8 @@
#include <QVBoxLayout>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class SettingsDialog : public QWidget
{
@@ -50,7 +50,7 @@ private:
void cancelButtonClicked();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // SETTINGSDIALOG_H
+5 -4
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
+3 -3
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
+2 -2
View File
@@ -1,8 +1,8 @@
#include "widgets/textinputdialog.h"
#include <QSizePolicy>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
TextInputDialog::TextInputDialog(QWidget *parent)
: QDialog(parent)
+2 -2
View File
@@ -8,8 +8,8 @@
#include <QString>
#include <QVBoxLayout>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class TextInputDialog : public QDialog
{
+2 -2
View File
@@ -1,7 +1,7 @@
#include "titlebar.h"
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
TitleBar::TitleBar(QWidget *parent)
: QWidget(parent)
{
+2 -2
View File
@@ -3,8 +3,8 @@
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class TitleBar : public QWidget
{
public:
+4 -4
View File
@@ -4,8 +4,8 @@
#include <QDebug>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
UserPopupWidget::UserPopupWidget(std::shared_ptr<Channel> &&channel)
: QWidget(nullptr)
@@ -37,5 +37,5 @@ void UserPopupWidget::setName(const QString &name)
_ui->lblUsername->setText(name);
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
+5 -5
View File
@@ -5,15 +5,15 @@
#include <memory>
namespace Ui {
namespace Ui {
class UserPopup;
}
namespace chatterino {
namespace chatterino {
class Channel;
namespace widgets {
namespace widgets {
class UserPopupWidget : public QWidget
{
@@ -29,7 +29,7 @@ private:
std::shared_ptr<Channel> _channel;
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // USERPOPUPWIDGET_H