oh no the bad commit descriptions are back D:

This commit is contained in:
fourtf
2017-12-23 23:24:35 +01:00
parent a617873f6a
commit 2bf53f73f8
11 changed files with 35 additions and 41 deletions
-1
View File
@@ -56,7 +56,6 @@ void ColorScheme::update()
void ColorScheme::setColors(double hue, double multiplier) void ColorScheme::setColors(double hue, double multiplier)
{ {
lightTheme = multiplier > 0; lightTheme = multiplier > 0;
bool hasDarkBorder = false;
SystemMessageColor = QColor(140, 127, 127); SystemMessageColor = QColor(140, 127, 127);
+1 -1
View File
@@ -23,11 +23,11 @@ Word::Word(const QString &text, Flags type, const MessageColor &color, FontManag
: image(nullptr) : image(nullptr)
, text(text) , text(text)
, color(color) , color(color)
, font(font)
, _isImage(false) , _isImage(false)
, type(type) , type(type)
, copyText(copytext) , copyText(copytext)
, tooltip(tooltip) , tooltip(tooltip)
, font(font)
, link(link) , link(link)
{ {
} }
+2 -2
View File
@@ -10,14 +10,14 @@ using namespace chatterino::messages;
namespace chatterino { namespace chatterino {
SettingsManager::SettingsManager() SettingsManager::SettingsManager()
: settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat) : streamlinkPath("/behaviour/streamlink/path", "")
, streamlinkPath("/behaviour/streamlink/path", "")
, preferredQuality("/behaviour/streamlink/quality", "Choose") , preferredQuality("/behaviour/streamlink/quality", "Choose")
, emoteScale(this->settingsItems, "emoteScale", 1.0) , emoteScale(this->settingsItems, "emoteScale", 1.0)
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav") , pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
, highlightProperties(this->settingsItems, "highlightProperties", , highlightProperties(this->settingsItems, "highlightProperties",
QMap<QString, QPair<bool, bool>>()) QMap<QString, QPair<bool, bool>>())
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "") , highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
, settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat)
{ {
this->wordMaskListener.addSetting(this->showTimestamps); this->wordMaskListener.addSetting(this->showTimestamps);
this->wordMaskListener.addSetting(this->showTimestampSeconds); this->wordMaskListener.addSetting(this->showTimestampSeconds);
+3 -3
View File
@@ -22,6 +22,9 @@ public:
bool canSendMessage() const override; bool canSendMessage() const override;
void sendMessage(const QString &message) override; void sendMessage(const QString &message) override;
const std::shared_ptr<EmoteMap> bttvChannelEmotes;
const std::shared_ptr<EmoteMap> ffzChannelEmotes;
const QString subscriptionURL; const QString subscriptionURL;
const QString channelURL; const QString channelURL;
const QString popoutPlayerURL; const QString popoutPlayerURL;
@@ -37,9 +40,6 @@ public:
QString streamGame; QString streamGame;
QString streamUptime; QString streamUptime;
const std::shared_ptr<EmoteMap> bttvChannelEmotes;
const std::shared_ptr<EmoteMap> ffzChannelEmotes;
private: private:
void setLive(bool newLiveStatus); void setLive(bool newLiveStatus);
void refreshLiveStatus(); void refreshLiveStatus();
+10 -10
View File
@@ -25,7 +25,7 @@ static bool tryHandleDpiChangedMessage(void *message, int &dpi)
static boost::optional<UINT> getWindowDpi(quintptr ptr) static boost::optional<UINT> getWindowDpi(quintptr ptr)
{ {
typedef UINT(WINAPI * GetDpiForWindow)(HWND); typedef UINT(WINAPI * GetDpiForWindow)(HWND);
QLibrary user32("user32.dll", NULL); QLibrary user32("user32.dll", 0);
GetDpiForWindow getDpiForWindow = (GetDpiForWindow)user32.resolve("GetDpiForWindow"); GetDpiForWindow getDpiForWindow = (GetDpiForWindow)user32.resolve("GetDpiForWindow");
@@ -44,20 +44,20 @@ class DpiNativeEventFilter : public QAbstractNativeEventFilter
public: public:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override
{ {
MSG *msg = reinterpret_cast<MSG *>(message); // MSG *msg = reinterpret_cast<MSG *>(message);
if (msg->message == WM_NCCREATE) { // if (msg->message == WM_NCCREATE) {
QLibrary user32("user32.dll", NULL); // QLibrary user32("user32.dll", 0);
{ // {
typedef BOOL(WINAPI * EnableNonClientDpiScaling)(HWND); // typedef BOOL(WINAPI * EnableNonClientDpiScaling)(HWND);
EnableNonClientDpiScaling enableNonClientDpiScaling = // EnableNonClientDpiScaling enableNonClientDpiScaling =
(EnableNonClientDpiScaling)user32.resolve("EnableNonClientDpiScaling"); // (EnableNonClientDpiScaling)user32.resolve("EnableNonClientDpiScaling");
// if (enableNonClientDpiScaling) // if (enableNonClientDpiScaling)
// enableNonClientDpiScaling(msg->hwnd); // enableNonClientDpiScaling(msg->hwnd);
} // }
} // }
return false; return false;
} }
}; };
+5 -9
View File
@@ -79,15 +79,11 @@ ChannelView::ChannelView(BaseWidget *parent)
this->updateTimer.start(); this->updateTimer.start();
}); });
auto _split = this->parent(); Window *_window = dynamic_cast<Window *>(this->window());
auto _splitContainer = _split->parent();
auto _notebook = _splitContainer->parent();
auto _window = qobject_cast<Window*>(_notebook->parent());
assert(_window); if (_window) {
_window->lostFocus.connect([this] { TooltipWidget::getInstance()->hide(); });
_window->lostFocus.connect( }
[this] { TooltipWidget::getInstance()->hide(); });
} }
ChannelView::~ChannelView() ChannelView::~ChannelView()
@@ -283,7 +279,7 @@ QString ChannelView::getSelectedText()
text += "\n"; text += "\n";
// middle lines // 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()) { for (const messages::WordPart &part : messagesSnapshot[i]->getWordParts()) {
if (!part.getCopyText().isEmpty()) { if (!part.getCopyText().isEmpty()) {
text += part.getCopyText(); text += part.getCopyText();
-2
View File
@@ -45,8 +45,6 @@ inline void ezShortcut(Split *w, const char *key, T t)
} // namespace } // namespace
static int index = 0;
Split::Split(ChannelManager &_channelManager, SplitContainer *parent, const std::string &_uuid) Split::Split(ChannelManager &_channelManager, SplitContainer *parent, const std::string &_uuid)
: BaseWidget(parent) : BaseWidget(parent)
, uuid(_uuid) , uuid(_uuid)
+9 -7
View File
@@ -12,27 +12,29 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
: BaseWidget(parent) : BaseWidget(parent)
, displayText(new QLabel()) , displayText(new QLabel())
{ {
QColor black(0,0,0); QColor black(0, 0, 0);
QColor white(255,255,255); QColor white(255, 255, 255);
QPalette palette; QPalette palette;
palette.setColor(QPalette::WindowText,white); palette.setColor(QPalette::WindowText, white);
palette.setColor(QPalette::Background,black); palette.setColor(QPalette::Background, black);
this->setPalette(palette); this->setPalette(palette);
this->setWindowOpacity(0.8); 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->setAttribute(Qt::WA_ShowWithoutActivating);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
displayText->setAlignment(Qt::AlignHCenter); displayText->setAlignment(Qt::AlignHCenter);
auto layout = new QVBoxLayout(); auto layout = new QVBoxLayout();
layout->setContentsMargins(10,5,10,5); layout->setContentsMargins(10, 5, 10, 5);
layout->addWidget(displayText); layout->addWidget(displayText);
this->setLayout(layout); this->setLayout(layout);
FontManager::getInstance().fontChanged.connect([this] { FontManager::getInstance().fontChanged.connect([this] {
this->setFont(FontManager::getInstance().getFont(FontManager::Type::MediumSmall)); this->setFont(FontManager::getInstance().getFont(FontManager::Type::MediumSmall,
this->getDpiMultiplier()));
}); });
} }
+3 -4
View File
@@ -1,8 +1,8 @@
#pragma once #pragma once
#include "widgets/basewidget.hpp" #include "widgets/basewidget.hpp"
#include <QWidget>
#include <QLabel> #include <QLabel>
#include <QWidget>
namespace chatterino { namespace chatterino {
namespace widgets { namespace widgets {
@@ -16,11 +16,10 @@ public:
void setText(QString text); void setText(QString text);
void moveTo(QPoint point); void moveTo(QPoint point);
static TooltipWidget* getInstance() static TooltipWidget *getInstance()
{ {
static TooltipWidget *tooltipWidget = nullptr; static TooltipWidget *tooltipWidget = nullptr;
if(tooltipWidget == nullptr) if (tooltipWidget == nullptr) {
{
tooltipWidget = new TooltipWidget(); tooltipWidget = new TooltipWidget();
} }
return tooltipWidget; return tooltipWidget;
+1 -1
View File
@@ -19,10 +19,10 @@ Window::Window(const QString &windowName, ChannelManager &_channelManager,
: BaseWidget(_colorScheme, nullptr) : BaseWidget(_colorScheme, nullptr)
, settingRoot(fS("/windows/{}", windowName)) , settingRoot(fS("/windows/{}", windowName))
, windowGeometry(this->settingRoot) , windowGeometry(this->settingRoot)
, dpi(this->getDpiMultiplier())
, channelManager(_channelManager) , channelManager(_channelManager)
, colorScheme(_colorScheme) , colorScheme(_colorScheme)
, notebook(this->channelManager, this, _isMainWindow, this->settingRoot) , notebook(this->channelManager, this, _isMainWindow, this->settingRoot)
, dpi(this->getDpiMultiplier())
{ {
this->initAsWindow(); this->initAsWindow();
+1 -1
View File
@@ -81,7 +81,7 @@ int WindowManager::windowCount()
widgets::Window *WindowManager::windowAt(int index) widgets::Window *WindowManager::windowAt(int index)
{ {
if (index < 0 || index >= this->windows.size()) { if (index < 0 || (size_t)index >= this->windows.size()) {
return nullptr; return nullptr;
} }
qDebug() << "getting window at bad index" << index; qDebug() << "getting window at bad index" << index;