diff --git a/src/colorscheme.cpp b/src/colorscheme.cpp index 70a670f82..4dc602b8b 100644 --- a/src/colorscheme.cpp +++ b/src/colorscheme.cpp @@ -56,7 +56,6 @@ void ColorScheme::update() void ColorScheme::setColors(double hue, double multiplier) { lightTheme = multiplier > 0; - bool hasDarkBorder = false; SystemMessageColor = QColor(140, 127, 127); diff --git a/src/messages/word.cpp b/src/messages/word.cpp index fb120cd70..245d67fcc 100644 --- a/src/messages/word.cpp +++ b/src/messages/word.cpp @@ -23,11 +23,11 @@ Word::Word(const QString &text, Flags type, const MessageColor &color, FontManag : image(nullptr) , text(text) , color(color) - , font(font) , _isImage(false) , type(type) , copyText(copytext) , tooltip(tooltip) + , font(font) , link(link) { } diff --git a/src/settingsmanager.cpp b/src/settingsmanager.cpp index cfada6bed..8c9745f0e 100644 --- a/src/settingsmanager.cpp +++ b/src/settingsmanager.cpp @@ -10,14 +10,14 @@ using namespace chatterino::messages; namespace chatterino { SettingsManager::SettingsManager() - : settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat) - , streamlinkPath("/behaviour/streamlink/path", "") + : streamlinkPath("/behaviour/streamlink/path", "") , preferredQuality("/behaviour/streamlink/quality", "Choose") , emoteScale(this->settingsItems, "emoteScale", 1.0) , pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav") , highlightProperties(this->settingsItems, "highlightProperties", QMap>()) , highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "") + , settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat) { this->wordMaskListener.addSetting(this->showTimestamps); this->wordMaskListener.addSetting(this->showTimestampSeconds); diff --git a/src/twitch/twitchchannel.hpp b/src/twitch/twitchchannel.hpp index 260f20f64..cba47fd4e 100644 --- a/src/twitch/twitchchannel.hpp +++ b/src/twitch/twitchchannel.hpp @@ -22,6 +22,9 @@ public: bool canSendMessage() const override; void sendMessage(const QString &message) override; + const std::shared_ptr bttvChannelEmotes; + const std::shared_ptr ffzChannelEmotes; + const QString subscriptionURL; const QString channelURL; const QString popoutPlayerURL; @@ -37,9 +40,6 @@ public: QString streamGame; QString streamUptime; - const std::shared_ptr bttvChannelEmotes; - const std::shared_ptr ffzChannelEmotes; - private: void setLive(bool newLiveStatus); void refreshLiveStatus(); diff --git a/src/util/nativeeventhelper.hpp b/src/util/nativeeventhelper.hpp index 844b451fa..da41d68d8 100644 --- a/src/util/nativeeventhelper.hpp +++ b/src/util/nativeeventhelper.hpp @@ -25,7 +25,7 @@ static bool tryHandleDpiChangedMessage(void *message, int &dpi) static boost::optional getWindowDpi(quintptr ptr) { typedef UINT(WINAPI * GetDpiForWindow)(HWND); - QLibrary user32("user32.dll", NULL); + QLibrary user32("user32.dll", 0); GetDpiForWindow getDpiForWindow = (GetDpiForWindow)user32.resolve("GetDpiForWindow"); @@ -44,20 +44,20 @@ class DpiNativeEventFilter : public QAbstractNativeEventFilter public: bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override { - MSG *msg = reinterpret_cast(message); +// MSG *msg = reinterpret_cast(message); - if (msg->message == WM_NCCREATE) { - QLibrary user32("user32.dll", NULL); - { - typedef BOOL(WINAPI * EnableNonClientDpiScaling)(HWND); +// if (msg->message == WM_NCCREATE) { +// QLibrary user32("user32.dll", 0); +// { +// typedef BOOL(WINAPI * EnableNonClientDpiScaling)(HWND); - EnableNonClientDpiScaling enableNonClientDpiScaling = - (EnableNonClientDpiScaling)user32.resolve("EnableNonClientDpiScaling"); +// EnableNonClientDpiScaling enableNonClientDpiScaling = +// (EnableNonClientDpiScaling)user32.resolve("EnableNonClientDpiScaling"); // if (enableNonClientDpiScaling) // enableNonClientDpiScaling(msg->hwnd); - } - } +// } +// } return false; } }; diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index 0be0a1a0d..9bbd58ffc 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -79,15 +79,11 @@ ChannelView::ChannelView(BaseWidget *parent) this->updateTimer.start(); }); - auto _split = this->parent(); - auto _splitContainer = _split->parent(); - auto _notebook = _splitContainer->parent(); - auto _window = qobject_cast(_notebook->parent()); + Window *_window = dynamic_cast(this->window()); - assert(_window); - - _window->lostFocus.connect( - [this] { TooltipWidget::getInstance()->hide(); }); + if (_window) { + _window->lostFocus.connect([this] { TooltipWidget::getInstance()->hide(); }); + } } ChannelView::~ChannelView() @@ -283,7 +279,7 @@ QString ChannelView::getSelectedText() text += "\n"; // middle lines - for (i++; i < this->selection.max.messageIndex; i++) { + for (i++; (int)i < this->selection.max.messageIndex; i++) { for (const messages::WordPart &part : messagesSnapshot[i]->getWordParts()) { if (!part.getCopyText().isEmpty()) { text += part.getCopyText(); diff --git a/src/widgets/split.cpp b/src/widgets/split.cpp index 1c1ca32bd..b9c364006 100644 --- a/src/widgets/split.cpp +++ b/src/widgets/split.cpp @@ -45,8 +45,6 @@ inline void ezShortcut(Split *w, const char *key, T t) } // namespace -static int index = 0; - Split::Split(ChannelManager &_channelManager, SplitContainer *parent, const std::string &_uuid) : BaseWidget(parent) , uuid(_uuid) diff --git a/src/widgets/tooltipwidget.cpp b/src/widgets/tooltipwidget.cpp index 9f5e0c85f..f3ff543bd 100644 --- a/src/widgets/tooltipwidget.cpp +++ b/src/widgets/tooltipwidget.cpp @@ -12,27 +12,29 @@ TooltipWidget::TooltipWidget(BaseWidget *parent) : BaseWidget(parent) , displayText(new QLabel()) { - QColor black(0,0,0); - QColor white(255,255,255); + QColor black(0, 0, 0); + QColor white(255, 255, 255); QPalette palette; - palette.setColor(QPalette::WindowText,white); - palette.setColor(QPalette::Background,black); + palette.setColor(QPalette::WindowText, white); + palette.setColor(QPalette::Background, black); this->setPalette(palette); this->setWindowOpacity(0.8); - this->setFont(FontManager::getInstance().getFont(FontManager::Type::MediumSmall)); + this->setFont(FontManager::getInstance().getFont(FontManager::Type::MediumSmall, + this->getDpiMultiplier())); this->setAttribute(Qt::WA_ShowWithoutActivating); this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); displayText->setAlignment(Qt::AlignHCenter); auto layout = new QVBoxLayout(); - layout->setContentsMargins(10,5,10,5); + layout->setContentsMargins(10, 5, 10, 5); layout->addWidget(displayText); this->setLayout(layout); FontManager::getInstance().fontChanged.connect([this] { - this->setFont(FontManager::getInstance().getFont(FontManager::Type::MediumSmall)); + this->setFont(FontManager::getInstance().getFont(FontManager::Type::MediumSmall, + this->getDpiMultiplier())); }); } diff --git a/src/widgets/tooltipwidget.hpp b/src/widgets/tooltipwidget.hpp index 51fd84ddd..561f0f354 100644 --- a/src/widgets/tooltipwidget.hpp +++ b/src/widgets/tooltipwidget.hpp @@ -1,8 +1,8 @@ #pragma once #include "widgets/basewidget.hpp" -#include #include +#include namespace chatterino { namespace widgets { @@ -16,11 +16,10 @@ public: void setText(QString text); void moveTo(QPoint point); - static TooltipWidget* getInstance() + static TooltipWidget *getInstance() { static TooltipWidget *tooltipWidget = nullptr; - if(tooltipWidget == nullptr) - { + if (tooltipWidget == nullptr) { tooltipWidget = new TooltipWidget(); } return tooltipWidget; diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp index 572f4072f..5f334404d 100644 --- a/src/widgets/window.cpp +++ b/src/widgets/window.cpp @@ -19,10 +19,10 @@ Window::Window(const QString &windowName, ChannelManager &_channelManager, : BaseWidget(_colorScheme, nullptr) , settingRoot(fS("/windows/{}", windowName)) , windowGeometry(this->settingRoot) + , dpi(this->getDpiMultiplier()) , channelManager(_channelManager) , colorScheme(_colorScheme) , notebook(this->channelManager, this, _isMainWindow, this->settingRoot) - , dpi(this->getDpiMultiplier()) { this->initAsWindow(); diff --git a/src/windowmanager.cpp b/src/windowmanager.cpp index 6311e12c5..fbea63c0c 100644 --- a/src/windowmanager.cpp +++ b/src/windowmanager.cpp @@ -81,7 +81,7 @@ int WindowManager::windowCount() widgets::Window *WindowManager::windowAt(int index) { - if (index < 0 || index >= this->windows.size()) { + if (index < 0 || (size_t)index >= this->windows.size()) { return nullptr; } qDebug() << "getting window at bad index" << index;