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

@ -15,9 +15,9 @@
#include <memory>
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace chatterino {
Channel::Channel(const QString &channel)
: _messages()
@ -188,4 +188,4 @@ void Channel::reloadFfzEmotes()
});
}
} // namespace chatterino
} // namespace chatterino

View file

@ -13,8 +13,8 @@
#include <boost/signals2.hpp>
#include <memory>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
class Message;
}
@ -75,6 +75,6 @@ private:
void reloadFfzEmotes();
};
} // namespace chatterino
} // namespace chatterino
#endif // CHANNEL_H

View file

@ -1,7 +1,7 @@
#include "channelmanager.h"
#include "ircmanager.h"
namespace chatterino {
namespace chatterino {
ChannelManager ChannelManager::instance;
@ -119,4 +119,4 @@ void ChannelManager::removeChannel(const QString &channel)
}
}
} // namespace chatterino
} // namespace chatterino

View file

@ -3,7 +3,7 @@
#include "channel.h"
namespace chatterino {
namespace chatterino {
class ChannelManager
{
@ -36,6 +36,6 @@ private:
SharedChannel _empty;
};
} // namespace chatterino
} // namespace chatterino
#endif // CHANNELS_H

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

@ -26,4 +26,5 @@ BraceWrapping: {
AfterFunction: 'true'
BeforeCatch: 'false'
}
ColumnLimit: 100
ColumnLimit: 100
FixNamespaceComments: true

View file

@ -6,7 +6,7 @@
#include <QColor>
namespace chatterino {
namespace chatterino {
void ColorScheme::init()
{
@ -172,4 +172,4 @@ void ColorScheme::normalizeColor(QColor &color)
// color.setHslF(color.hueF(), s, newL);
}
} // namespace chatterino
} // namespace chatterino

View file

@ -5,7 +5,7 @@
#include <QColor>
#include <boost/signals2.hpp>
namespace chatterino {
namespace chatterino {
class ColorScheme
{

View file

@ -65,6 +65,6 @@ private:
QMap<TKey, TValue> _map;
};
} // namespace chatterino
} // namespace chatterino
#endif // CONCURRENTMAP_H

View file

@ -5,7 +5,7 @@
#include <QStringBuilder>
#include <QTextStream>
namespace chatterino {
namespace chatterino {
QRegularExpression Emojis::findShortCodesRegex(":([-+\\w]+):");

View file

@ -9,7 +9,7 @@
#include <QString>
#include <unordered_map>
namespace chatterino {
namespace chatterino {
class Emojis
{

View file

@ -13,9 +13,9 @@
#define TWITCH_EMOTE_TEMPLATE "https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0"
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace chatterino {
EmoteManager EmoteManager::instance;

View file

@ -13,7 +13,7 @@
#include <QTimer>
#include <boost/signals2.hpp>
namespace chatterino {
namespace chatterino {
class EmoteManager
{
public:
@ -93,6 +93,6 @@ private:
void loadFfzEmotes();
void loadBttvEmotes();
};
} // namespace chatterino
} // namespace chatterino
#endif // EMOTES_H

View file

@ -2,7 +2,7 @@
#define DEFAULT_FONT "Arial"
namespace chatterino {
namespace chatterino {
FontManager FontManager::instance;

View file

@ -4,7 +4,7 @@
#include <QFont>
#include <QFontMetrics>
namespace chatterino {
namespace chatterino {
class FontManager
{

View file

@ -19,9 +19,9 @@
#include <future>
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace chatterino {
IrcManager IrcManager::instance;

View file

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

View file

@ -1,6 +1,6 @@
#include "ircuser2.h"
namespace chatterino {
namespace chatterino {
IrcUser2::IrcUser2(const QString &userName, const QString &nickName, const QString &realName,
const QString &password)

View file

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

View file

@ -5,8 +5,8 @@
#include <ctime>
namespace chatterino {
namespace logging {
namespace chatterino {
namespace logging {
Channel::Channel(const QString &_channelName, const QString &_baseDirectory)
: channelName(_channelName)
@ -72,5 +72,5 @@ void Channel::appendLine(const QString &line)
this->fileHandle.flush();
}
} // namespace logging
} // namespace chatterino
} // namespace logging
} // namespace chatterino

View file

@ -9,8 +9,8 @@
#include <memory>
namespace chatterino {
namespace logging {
namespace chatterino {
namespace logging {
class Channel
{
@ -33,7 +33,7 @@ private:
QFile fileHandle;
};
} // namespace logging
} // namespace chatterino
} // namespace logging
} // namespace chatterino
#endif // LOGGINGCHANNEL_H

View file

@ -5,8 +5,8 @@
#include <unordered_map>
namespace chatterino {
namespace logging {
namespace chatterino {
namespace logging {
static QString logBasePath;
static QString channelBasePath;
@ -96,5 +96,5 @@ std::shared_ptr<Channel> get(const QString &channelName)
return ret;
}
} // namespace logging
} // namespace chatterino
} // namespace logging
} // namespace chatterino

View file

@ -5,13 +5,13 @@
#include <memory>
namespace chatterino {
namespace logging {
namespace chatterino {
namespace logging {
void init();
std::shared_ptr<Channel> get(const QString &channelName);
} // namespace logging
} // namespace chatterino
} // namespace logging
} // namespace chatterino
#endif // LOGGINGMANAGER_H

View file

@ -16,8 +16,8 @@
#include <QStandardPaths>
#include <boost/signals2.hpp>
using namespace chatterino;
using namespace chatterino::widgets;
using namespace chatterino;
using namespace chatterino::widgets;
int main(int argc, char *argv[])
{

View file

@ -103,5 +103,5 @@ void LazyLoadedImage::gifUpdateTimout()
_currentPixmap = _allFrames[_currentFrame].image;
}
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino

View file

@ -103,7 +103,7 @@ private:
void gifUpdateTimout();
};
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino
#endif // LAZYLOADEDIMAGE_H

View file

@ -7,8 +7,8 @@
#include <mutex>
#include <vector>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
template <typename T>
class LimitedQueue
@ -96,7 +96,7 @@ private:
unsigned int buffer;
};
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino
#endif // LIMITEDQUEUE_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

@ -1,7 +1,7 @@
#include "messages/link.h"
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
Link::Link()
: type(None)

View file

@ -3,8 +3,8 @@
#include <QString>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
class Link
{

View file

@ -16,8 +16,8 @@
#include <list>
#include <tuple>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
Message::Message(const QString &text)
: _words()
@ -81,5 +81,5 @@ const QString &Message::getId() const
return _id;
}
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino

View file

@ -12,11 +12,11 @@
#include <chrono>
#include <memory>
namespace chatterino {
namespace chatterino {
class Channel;
namespace messages {
namespace messages {
class Message;
typedef std::shared_ptr<Message> SharedMessage;
@ -63,7 +63,7 @@ private:
std::vector<Word> _words;
};
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino
#endif // MESSAGE_H

View file

@ -3,8 +3,8 @@
#include "emotemanager.h"
#include "resources.h"
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
MessageBuilder::MessageBuilder()
: _words()

View file

@ -4,8 +4,8 @@
#include "messages/message.h"
#include <ctime>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
class MessageBuilder
{

View file

@ -1,8 +1,8 @@
#ifndef MESSAGEPARSEARGS_H
#define MESSAGEPARSEARGS_H
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
struct MessageParseArgs {
public:

View file

@ -9,10 +9,10 @@
#define MARGIN_TOP 8
#define MARGIN_BOTTOM 8
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
MessageRef::MessageRef(SharedMessage message)
: _message(message)

View file

@ -6,8 +6,8 @@
#include <QPixmap>
#include <memory>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
class MessageRef;

View file

@ -1,7 +1,7 @@
#include "messages/word.h"
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
// Image word
Word::Word(LazyLoadedImage *image, Type type, const QString &copytext, const QString &tooltip,
@ -130,5 +130,5 @@ std::vector<short> &Word::getCharacterWidthCache() const
{
return _characterWidthCache;
}
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino

View file

@ -9,8 +9,8 @@
#include <QRect>
#include <QString>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
class Word
{
@ -114,7 +114,7 @@ private:
mutable std::vector<short> _characterWidthCache;
};
} // namespace messages
} // namespace chatterino
} // namespace messages
} // namespace chatterino
#endif // WORD_H

View file

@ -1,8 +1,8 @@
#include "messages/wordpart.h"
#include "messages/word.h"
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
WordPart::WordPart(Word &word, int x, int y, int lineNumber, const QString &copyText,
bool allowTrailingSpace)

View file

@ -4,8 +4,8 @@
#include <QRect>
#include <QString>
namespace chatterino {
namespace messages {
namespace chatterino {
namespace messages {
class Word;

View file

@ -2,7 +2,7 @@
#include <QPixmap>
namespace chatterino {
namespace chatterino {
messages::LazyLoadedImage *Resources::badgeStaff(NULL);
messages::LazyLoadedImage *Resources::badgeAdmin(NULL);

View file

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

View file

@ -72,6 +72,6 @@ private:
T _value;
};
} // namespace chatterino
} // namespace chatterino
#endif // SETTING_H

View file

@ -5,9 +5,9 @@
#include <QDir>
#include <QStandardPaths>
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace chatterino {
SettingsManager SettingsManager::instance;
@ -131,4 +131,4 @@ SettingsSnapshot SettingsManager::createSnapshot()
return snapshot;
}
} // namespace chatterino
} // namespace chatterino

View file

@ -79,6 +79,6 @@ private:
static SettingsManager instance;
};
} // namespace chatterino
} // namespace chatterino
#endif // APPSETTINGS_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

@ -3,8 +3,8 @@
#include "QString"
namespace chatterino {
namespace twitch {
namespace chatterino {
namespace twitch {
struct EmoteValue {
public:

View file

@ -5,10 +5,10 @@
#include "ircmanager.h"
#include "resources.h"
using namespace chatterino::messages;
using namespace chatterino::messages;
namespace chatterino {
namespace twitch {
namespace chatterino {
namespace twitch {
TwitchMessageBuilder::TwitchMessageBuilder()
: MessageBuilder()
, messageId()

View file

@ -6,8 +6,8 @@
#include <QString>
namespace chatterino {
namespace twitch {
namespace chatterino {
namespace twitch {
class TwitchMessageBuilder : public messages::MessageBuilder
{

View file

@ -8,10 +8,10 @@
//
//#include <QRegularExpression>
//
// using namespace chatterino::messages;
// using namespace chatterino::messages;
//
// namespace chatterino {
// namespace twitch {
// namespace chatterino {
// namespace twitch {
// SharedMessage
// twitchParseMessage(const Communi::IrcPrivateMessage *ircMessage,
// Channel *channel, const MessageParseArgs &args)

View file

@ -5,8 +5,8 @@
//#include "messages/messagebuilder.h"
//#include "messages/messageparseargs.h"
//
// namespace chatterino {
// namespace twitch {
// namespace chatterino {
// namespace twitch {
//}
//}
//

View file

@ -1,7 +1,7 @@
#include "twitchuser.h"
namespace chatterino {
namespace twitch {
namespace chatterino {
namespace twitch {
TwitchUser::TwitchUser(const QString &username, const QString &oauthToken,
const QString &oauthClient)
: IrcUser2(username, username, username, "oauth:" + oauthToken)

View file

@ -5,8 +5,8 @@
#include <QString>
namespace chatterino {
namespace twitch {
namespace chatterino {
namespace twitch {
class TwitchUser : public IrcUser2
{

View file

@ -1,6 +1,6 @@
#include "usermanager.h"
namespace chatterino {
namespace chatterino {
AccountManager AccountManager::instance;
@ -41,4 +41,4 @@ void AccountManager::addTwitchUser(const twitch::TwitchUser &user)
_twitchUsers.push_back(user);
}
} // namespace chatterino
} // namespace chatterino

View file

@ -31,6 +31,6 @@ private:
std::vector<twitch::TwitchUser> _twitchUsers;
std::mutex _twitchUsersMutex;
};
} // namespace chatterino
} // namespace chatterino
#endif // ACCOUNTMANAGER_H

View file

@ -12,8 +12,8 @@
#include <functional>
namespace chatterino {
namespace util {
namespace chatterino {
namespace util {
static void urlFetch(const QString &url, std::function<void(QNetworkReply &)> successCallback)
{

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

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

View file

@ -8,8 +8,8 @@
#include <QMimeData>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
: QWidget()

View file

@ -13,8 +13,8 @@
#include <QPoint>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ChatWidget;
class ChatWidgetHeader : public QWidget

View file

@ -4,8 +4,8 @@
#include <QBrush>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
ChatWidgetHeaderButton::ChatWidgetHeaderButton(int spacing)
: QWidget()

View file

@ -8,8 +8,8 @@
#include <QPaintEvent>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ChatWidgetHeaderButton : public QWidget
{

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)

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();
@ -406,5 +405,5 @@ bool ChatWidgetView::tryGetMessageAt(QPoint p, std::shared_ptr<messages::Message
return false;
}
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino

View file

@ -67,7 +67,7 @@ private slots:
update();
}
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // CHATVIEW_H

View file

@ -3,8 +3,8 @@
#include <QDebug>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
FancyButton::FancyButton(QWidget *parent)
: QWidget(parent)

View file

@ -7,8 +7,8 @@
#include <QTimer>
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class FancyButton : public QWidget
{
struct ClickEffect {

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

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

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

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

View file

@ -7,8 +7,8 @@
#include <QPainterPath>
#include <QRadialGradient>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
NotebookButton::NotebookButton(QWidget *parent)
: FancyButton(parent)

View file

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

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

View file

@ -78,7 +78,7 @@ public:
boost::property_tree::ptree save();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKPAGE_H

View file

@ -4,8 +4,8 @@
#include <QDebug>
#include <QPainter>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
NotebookPageDropPreview::NotebookPageDropPreview(QWidget *parent)
: QWidget(parent)

View file

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

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

View file

@ -81,7 +81,7 @@ public:
boost::property_tree::ptree save();
};
} // namespace widgets
} // namespace chatterino
} // namespace widgets
} // namespace chatterino
#endif // NOTEBOOKTAB_H

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)

View file

@ -9,8 +9,8 @@
#include <boost/signals2.hpp>
#include <functional>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ScrollBar : public QWidget
{

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)

View file

@ -3,8 +3,8 @@
#include "QString"
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class ScrollBarHighlight
{

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

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

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

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)

View file

@ -8,8 +8,8 @@
#include <QString>
#include <QVBoxLayout>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class TextInputDialog : public QDialog
{

View file

@ -1,7 +1,7 @@
#include "titlebar.h"
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
TitleBar::TitleBar(QWidget *parent)
: QWidget(parent)
{

View file

@ -3,8 +3,8 @@
#include <QWidget>
namespace chatterino {
namespace widgets {
namespace chatterino {
namespace widgets {
class TitleBar : public QWidget
{
public:

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

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

View file

@ -121,4 +121,4 @@ void WindowManager::save()
boost::property_tree::write_json(settingsPath, tree);
}
} // namespace chatterino
} // namespace chatterino

View file

@ -34,6 +34,6 @@ private:
widgets::MainWindow *_mainWindow;
};
} // namespace chatterino
} // namespace chatterino
#endif // WINDOWS_H