diff --git a/chatterino.pro b/chatterino.pro index a30538fcc..6cd331ed4 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -82,7 +82,6 @@ SOURCES += \ src/messages/messagebuilder.cpp \ src/twitch/twitchmessagebuilder.cpp \ src/widgets/titlebar.cpp \ - src/appdatapath.cpp \ src/singletons/accountmanager.cpp \ src/twitch/twitchuser.cpp \ src/ircaccount.cpp \ @@ -155,7 +154,6 @@ HEADERS += \ src/messages/messagebuilder.hpp \ src/twitch/twitchmessagebuilder.hpp \ src/widgets/titlebar.hpp \ - src/appdatapath.hpp \ src/singletons/accountmanager.hpp \ src/twitch/twitchuser.hpp \ src/ircaccount.hpp \ diff --git a/src/appdatapath.cpp b/src/appdatapath.cpp deleted file mode 100644 index 3efb693b0..000000000 --- a/src/appdatapath.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "appdatapath.hpp" - -#include -#include -#include - -QString Path::appdataPath; -std::mutex Path::appdataPathMutex; - -const QString &Path::getAppdataPath() -{ - std::lock_guard lock(appdataPathMutex); - - if (appdataPath.isEmpty()) { -#ifdef PORTABLE - QString path = QCoreApplication::applicationDirPath(); -#else - QString path = - QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/Chatterino2/"; -#endif - - QDir(QDir::root()).mkdir(path); - - appdataPath = path; - } - - return appdataPath; -} diff --git a/src/appdatapath.hpp b/src/appdatapath.hpp deleted file mode 100644 index b7296fc00..000000000 --- a/src/appdatapath.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -#include - -class Path -{ -public: - static const QString &getAppdataPath(); - -private: - static QString appdataPath; - static std::mutex appdataPathMutex; -}; diff --git a/src/singletons/settingsmanager.cpp b/src/singletons/settingsmanager.cpp index 1bda84939..82a1ac17b 100644 --- a/src/singletons/settingsmanager.cpp +++ b/src/singletons/settingsmanager.cpp @@ -1,11 +1,7 @@ #include "singletons/settingsmanager.hpp" -#include "appdatapath.hpp" #include "debug/log.hpp" #include "singletons/pathmanager.hpp" -#include -#include - using namespace chatterino::messages; namespace chatterino { diff --git a/src/singletons/windowmanager.cpp b/src/singletons/windowmanager.cpp index 103ed6d6b..5f0f85007 100644 --- a/src/singletons/windowmanager.cpp +++ b/src/singletons/windowmanager.cpp @@ -1,14 +1,13 @@ #include "windowmanager.hpp" -#include "appdatapath.hpp" +#include "debug/log.hpp" #include "singletons/fontmanager.hpp" #include "singletons/thememanager.hpp" #include -#include -#include namespace chatterino { namespace singletons { + WindowManager &WindowManager::getInstance() { static WindowManager instance(ThemeManager::getInstance()); @@ -26,13 +25,6 @@ void WindowManager::initMainWindow() this->selectedWindow = this->mainWindow = new widgets::Window("main", this->themeManager, true); } -static const std::string &getSettingsPath() -{ - static std::string path = (Path::getAppdataPath() + "uilayout.json").toStdString(); - - return path; -} - void WindowManager::layoutVisibleChatWidgets(Channel *channel) { this->layout(channel); @@ -87,7 +79,7 @@ widgets::Window *WindowManager::windowAt(int index) if (index < 0 || (size_t)index >= this->windows.size()) { return nullptr; } - qDebug() << "getting window at bad index" << index; + debug::Log("getting window at bad index {}", index); return this->windows.at(index); } @@ -103,5 +95,5 @@ void WindowManager::save() } } +} // namespace singletons } // namespace chatterino -} diff --git a/src/singletons/windowmanager.hpp b/src/singletons/windowmanager.hpp index 675a05a35..a59284fea 100644 --- a/src/singletons/windowmanager.hpp +++ b/src/singletons/windowmanager.hpp @@ -14,10 +14,10 @@ class WindowManager public: static WindowManager &getInstance(); + void initMainWindow(); void layoutVisibleChatWidgets(Channel *channel = nullptr); void repaintVisibleChatWidgets(Channel *channel = nullptr); void repaintGifEmotes(); - void initMainWindow(); // void updateAll(); widgets::Window &getMainWindow(); @@ -41,5 +41,5 @@ private: widgets::Window *selectedWindow = nullptr; }; +} // namespace singletons } // namespace chatterino -} diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index e23712e65..9dae85ec5 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -261,9 +261,8 @@ QString ChannelView::getSelectedText() if (first) { first = false; - bool isSingleWord = - isSingleMessage && - this->selection.max.charIndex - charIndex < part.getCharacterLength(); + bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex < + part.getCharacterLength(); if (isSingleWord) { // return single word @@ -394,7 +393,7 @@ void ChannelView::setChannel(std::shared_ptr newChannel) if (this->scrollBar.isAtBottom()) { this->scrollBar.scrollToBottom(); } else { - this->scrollBar.offset((qreal)-messages.size()); + this->scrollBar.offset((qreal)messages.size()); } } @@ -623,10 +622,9 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap // this->selectionMax.messageIndex >= messageIndex) { // painter.fillRect(buffer->rect(), QColor(24, 55, 25)); //} else { - painter.fillRect(buffer->rect(), - (messageRef->getMessage()->containsHighlightedPhrase()) - ? this->themeManager.messages.backgrounds.highlighted - : this->themeManager.messages.backgrounds.regular); + painter.fillRect(buffer->rect(), (messageRef->getMessage()->containsHighlightedPhrase()) + ? this->themeManager.messages.backgrounds.highlighted + : this->themeManager.messages.backgrounds.regular); //} // draw selection