diff --git a/src/emojis.cpp b/src/emojis.cpp index 329e5717..3aad860a 100644 --- a/src/emojis.cpp +++ b/src/emojis.cpp @@ -42,7 +42,7 @@ void Emojis::parseEmojis(std::vector( - NULL, text.mid(lastSlice, i - lastSlice))); + nullptr, text.mid(lastSlice, i - lastSlice))); } vector.push_back(std::tuple( @@ -63,7 +63,7 @@ void Emojis::parseEmojis(std::vector(NULL, text.mid(lastSlice))); + std::tuple(nullptr, text.mid(lastSlice))); } } diff --git a/src/ircmanager.cpp b/src/ircmanager.cpp index c39a4dab..b2a3eea0 100644 --- a/src/ircmanager.cpp +++ b/src/ircmanager.cpp @@ -254,7 +254,7 @@ void IrcManager::privateMessageReceived(Communi::IrcPrivateMessage *message) { auto c = ChannelManager::getInstance().getChannel(message->target().mid(1)); - if (c != NULL) { + if (c != nullptr) { messages::MessageParseArgs args; c->addMessage(twitch::TwitchMessageBuilder::parse(message, c.get(), args)); diff --git a/src/messages/lazyloadedimage.cpp b/src/messages/lazyloadedimage.cpp index 3a9b7238..1502be22 100644 --- a/src/messages/lazyloadedimage.cpp +++ b/src/messages/lazyloadedimage.cpp @@ -20,7 +20,7 @@ namespace messages { LazyLoadedImage::LazyLoadedImage(const QString &url, qreal scale, const QString &name, const QString &tooltip, const QMargins &margin, bool isHat) - : _currentPixmap(NULL) + : _currentPixmap(nullptr) , _currentFrame(0) , _currentFrameOffset(0) , _url(url) diff --git a/src/messages/lazyloadedimage.hpp b/src/messages/lazyloadedimage.hpp index 8e64d8df..5397e14a 100644 --- a/src/messages/lazyloadedimage.hpp +++ b/src/messages/lazyloadedimage.hpp @@ -63,7 +63,7 @@ public: int getWidth() const { - if (_currentPixmap == NULL) { + if (_currentPixmap == nullptr) { return 16; } return _currentPixmap->width(); @@ -71,7 +71,7 @@ public: int getHeight() const { - if (_currentPixmap == NULL) { + if (_currentPixmap == nullptr) { return 16; } return _currentPixmap->height(); diff --git a/src/messages/word.cpp b/src/messages/word.cpp index 46d93bbf..7a9a4434 100644 --- a/src/messages/word.cpp +++ b/src/messages/word.cpp @@ -22,7 +22,7 @@ Word::Word(LazyLoadedImage *image, Type type, const QString ©text, const QSt // Text word Word::Word(const QString &text, Type type, const QColor &color, const QString ©text, const QString &tooltip, const Link &link) - : _image(NULL) + : _image(nullptr) , _text(text) , _color(color) , _isImage(false) diff --git a/src/resources.cpp b/src/resources.cpp index 6c399499..fc31b563 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -4,23 +4,23 @@ namespace chatterino { -messages::LazyLoadedImage *Resources::badgeStaff(NULL); -messages::LazyLoadedImage *Resources::badgeAdmin(NULL); -messages::LazyLoadedImage *Resources::badgeModerator(NULL); -messages::LazyLoadedImage *Resources::badgeGlobalmod(NULL); -messages::LazyLoadedImage *Resources::badgeTurbo(NULL); -messages::LazyLoadedImage *Resources::badgeBroadcaster(NULL); -messages::LazyLoadedImage *Resources::badgePremium(NULL); +messages::LazyLoadedImage *Resources::badgeStaff(nullptr); +messages::LazyLoadedImage *Resources::badgeAdmin(nullptr); +messages::LazyLoadedImage *Resources::badgeModerator(nullptr); +messages::LazyLoadedImage *Resources::badgeGlobalmod(nullptr); +messages::LazyLoadedImage *Resources::badgeTurbo(nullptr); +messages::LazyLoadedImage *Resources::badgeBroadcaster(nullptr); +messages::LazyLoadedImage *Resources::badgePremium(nullptr); -messages::LazyLoadedImage *Resources::cheerBadge100000(NULL); -messages::LazyLoadedImage *Resources::cheerBadge10000(NULL); -messages::LazyLoadedImage *Resources::cheerBadge5000(NULL); -messages::LazyLoadedImage *Resources::cheerBadge1000(NULL); -messages::LazyLoadedImage *Resources::cheerBadge100(NULL); -messages::LazyLoadedImage *Resources::cheerBadge1(NULL); +messages::LazyLoadedImage *Resources::cheerBadge100000(nullptr); +messages::LazyLoadedImage *Resources::cheerBadge10000(nullptr); +messages::LazyLoadedImage *Resources::cheerBadge5000(nullptr); +messages::LazyLoadedImage *Resources::cheerBadge1000(nullptr); +messages::LazyLoadedImage *Resources::cheerBadge100(nullptr); +messages::LazyLoadedImage *Resources::cheerBadge1(nullptr); -messages::LazyLoadedImage *Resources::buttonBan(NULL); -messages::LazyLoadedImage *Resources::buttonTimeout(NULL); +messages::LazyLoadedImage *Resources::buttonBan(nullptr); +messages::LazyLoadedImage *Resources::buttonTimeout(nullptr); Resources::Resources() { diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp index 77b76587..2bc62d00 100644 --- a/src/twitch/twitchmessagebuilder.cpp +++ b/src/twitch/twitchmessagebuilder.cpp @@ -21,7 +21,7 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges) { for (QString badge : badges) { if (badge.startsWith("bits/")) { - long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), NULL, 10); + long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), nullptr, 10); appendWord(Word(EmoteManager::getInstance().getCheerBadge(cheer), Word::BadgeCheer, QString(), QString("Twitch Cheer" + QString::number(cheer)))); } else if (badge == "staff/1") { @@ -166,7 +166,7 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM if (parameters.length() < 2) continue; - long int id = std::stol(parameters.at(0).toStdString(), NULL, 10); + long int id = std::stol(parameters.at(0).toStdString(), nullptr, 10); QStringList occurences = parameters.at(1).split(','); @@ -176,8 +176,8 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM if (coords.length() < 2) continue; - long int start = std::stol(coords.at(0).toStdString(), NULL, 10); - long int end = std::stol(coords.at(1).toStdString(), NULL, 10); + long int start = std::stol(coords.at(0).toStdString(), nullptr, 10); + long int end = std::stol(coords.at(1).toStdString(), nullptr, 10); if (start >= end || start < 0 || end > ircMessage->content().length()) continue; @@ -235,7 +235,7 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM for (const std::tuple &tuple : parsed) { LazyLoadedImage *image = std::get<0>(tuple); - if (image == NULL) { // is text + if (image == nullptr) { // is text QString string = std::get<1>(tuple); static QRegularExpression cheerRegex("cheer[1-9][0-9]*"); diff --git a/src/twitch/twitchparsemessage.cpp b/src/twitch/twitchparsemessage.cpp index 6332197b..8c3bd82b 100644 --- a/src/twitch/twitchparsemessage.cpp +++ b/src/twitch/twitchparsemessage.cpp @@ -137,7 +137,7 @@ // if (parameters.length() < 2) // continue; // -// long int id = std::stol(parameters.at(0).toStdString(), NULL, 10); +// long int id = std::stol(parameters.at(0).toStdString(), nullptr, 10); // // QStringList occurences = parameters.at(1).split(','); // @@ -148,8 +148,8 @@ // continue; // // long int start = -// std::stol(coords.at(0).toStdString(), NULL, 10); -// long int end = std::stol(coords.at(1).toStdString(), NULL, +// std::stol(coords.at(0).toStdString(), nullptr, 10); +// long int end = std::stol(coords.at(1).toStdString(), nullptr, // 10); // // if (start >= end || start < 0 || @@ -209,7 +209,7 @@ // for (const std::tuple &tuple : parsed) { // LazyLoadedImage *image = std::get<0>(tuple); // -// if (image == NULL) { // is text +// if (image == nullptr) { // is text // QString string = std::get<1>(tuple); // // static QRegularExpression cheerRegex("cheer[1-9][0-9]*"); diff --git a/src/widgets/mainwindow.cpp b/src/widgets/mainwindow.cpp index 86a37617..aaa819f1 100644 --- a/src/widgets/mainwindow.cpp +++ b/src/widgets/mainwindow.cpp @@ -65,7 +65,7 @@ void MainWindow::layoutVisibleChatWidgets(Channel *channel) { auto *page = _notebook.getSelectedPage(); - if (page == NULL) { + if (page == nullptr) { return; } @@ -74,7 +74,7 @@ void MainWindow::layoutVisibleChatWidgets(Channel *channel) for (auto it = widgets.begin(); it != widgets.end(); ++it) { ChatWidget *widget = *it; - if (channel == NULL || channel == widget->getChannel().get()) { + if (channel == nullptr || channel == widget->getChannel().get()) { widget->layoutMessages(); } } @@ -84,7 +84,7 @@ void MainWindow::repaintVisibleChatWidgets(Channel *channel) { auto *page = _notebook.getSelectedPage(); - if (page == NULL) { + if (page == nullptr) { return; } @@ -93,7 +93,7 @@ void MainWindow::repaintVisibleChatWidgets(Channel *channel) for (auto it = widgets.begin(); it != widgets.end(); ++it) { ChatWidget *widget = *it; - if (channel == NULL || channel == widget->getChannel().get()) { + if (channel == nullptr || channel == widget->getChannel().get()) { widget->layoutMessages(); } } @@ -103,7 +103,7 @@ void MainWindow::repaintGifEmotes() { auto *page = _notebook.getSelectedPage(); - if (page == NULL) { + if (page == nullptr) { return; } diff --git a/src/widgets/notebook.cpp b/src/widgets/notebook.cpp index 960ad797..c849b093 100644 --- a/src/widgets/notebook.cpp +++ b/src/widgets/notebook.cpp @@ -67,7 +67,7 @@ void Notebook::removePage(NotebookPage *page) int index = _pages.indexOf(page); if (_pages.size() == 1) { - select(NULL); + select(nullptr); } else if (index == _pages.count() - 1) { select(_pages[index - 1]); } else { diff --git a/src/widgets/notebooktab.cpp b/src/widgets/notebooktab.cpp index d31aadbd..b70e901e 100644 --- a/src/widgets/notebooktab.cpp +++ b/src/widgets/notebooktab.cpp @@ -98,7 +98,7 @@ void NotebookTab::moveAnimated(QPoint pos, bool animated) { _posAnimationDesired = pos; - if ((window() != NULL && !window()->isVisible()) || !animated || _posAnimated == false) { + if ((window() != nullptr && !window()->isVisible()) || !animated || _posAnimated == false) { move(pos); _posAnimated = true; diff --git a/src/widgets/scrollbar.cpp b/src/widgets/scrollbar.cpp index 86eb3dee..0049f5be 100644 --- a/src/widgets/scrollbar.cpp +++ b/src/widgets/scrollbar.cpp @@ -41,7 +41,7 @@ ScrollBar::~ScrollBar() { auto highlight = _highlights; - while (highlight != NULL) { + while (highlight != nullptr) { auto tmp = highlight->next; delete highlight; highlight = tmp; @@ -52,12 +52,12 @@ void ScrollBar::removeHighlightsWhere(std::function { _mutex.lock(); - ScrollBarHighlight *last = NULL; + ScrollBarHighlight *last = nullptr; ScrollBarHighlight *current = _highlights; - while (current != NULL) { + while (current != nullptr) { if (func(*current)) { - if (last == NULL) { + if (last == nullptr) { _highlights = current->next; } else { last->next = current->next; @@ -79,7 +79,7 @@ void ScrollBar::addHighlight(ScrollBarHighlight *highlight) { _mutex.lock(); - if (_highlights == NULL) { + if (_highlights == nullptr) { _highlights = highlight; } else { highlight->next = _highlights->next; @@ -224,7 +224,7 @@ void ScrollBar::paintEvent(QPaintEvent *) // do { // painter.fillRect(); - // } while ((highlight = highlight->next()) != NULL); + // } while ((highlight = highlight->next()) != nullptr); _mutex.unlock(); } diff --git a/src/widgets/settingsdialog.cpp b/src/widgets/settingsdialog.cpp index 66951fec..a70c36ea 100644 --- a/src/widgets/settingsdialog.cpp +++ b/src/widgets/settingsdialog.cpp @@ -289,7 +289,7 @@ void SettingsDialog::select(SettingsDialogTab *tab) { _pageStack.setCurrentWidget(tab->getWidget()); - if (_selectedTab != NULL) { + if (_selectedTab != nullptr) { _selectedTab->setSelected(false); _selectedTab->setStyleSheet("color: #FFF"); } diff --git a/src/widgets/settingsdialog.hpp b/src/widgets/settingsdialog.hpp index 4fdd9033..6fd04f0c 100644 --- a/src/widgets/settingsdialog.hpp +++ b/src/widgets/settingsdialog.hpp @@ -42,7 +42,7 @@ private: void addTabs(); - SettingsDialogTab *_selectedTab = NULL; + SettingsDialogTab *_selectedTab = nullptr; /// Widget creation helpers QCheckBox *createCheckbox(const QString &title, Setting &setting); diff --git a/src/widgets/textinputdialog.hpp b/src/widgets/textinputdialog.hpp index 1e62ac41..4cf33c59 100644 --- a/src/widgets/textinputdialog.hpp +++ b/src/widgets/textinputdialog.hpp @@ -15,7 +15,7 @@ class TextInputDialog : public QDialog Q_OBJECT public: - TextInputDialog(QWidget *parent = NULL); + TextInputDialog(QWidget *parent = nullptr); QString getText() const {