mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Fix all warnings that we care about
This commit is contained in:
parent
896cf7a03b
commit
c4de5c806a
17 changed files with 95 additions and 104 deletions
|
@ -52,9 +52,7 @@ void ColorScheme::setColors(float hue, float multiplyer)
|
|||
|
||||
SystemMessageColor = QColor(140, 127, 127);
|
||||
|
||||
auto isLightTheme = IsLightTheme;
|
||||
|
||||
auto getColor = [isLightTheme, multiplyer](qreal h, qreal s, qreal l, qreal a = 1.0) {
|
||||
auto getColor = [multiplyer](qreal h, qreal s, qreal l, qreal a = 1.0) {
|
||||
return QColor::fromHslF(h, s, (((l - 0.5) * multiplyer) + 0.5), a);
|
||||
};
|
||||
|
||||
|
@ -75,10 +73,11 @@ void ColorScheme::setColors(float hue, float multiplyer)
|
|||
TabSelectedBackground = getColor(hue, 0.5, 0.5);
|
||||
TabHighlightedBackground = getColor(hue, 0.5, 0.2);
|
||||
TabNewMessageBackground = QBrush(getColor(hue, 0.5, 0.2), Qt::DiagCrossPattern);
|
||||
if (hasDarkBorder)
|
||||
if (hasDarkBorder) {
|
||||
// TabText = QColor(210, 210, 210);
|
||||
// TabHoverText = QColor(210, 210, 210);
|
||||
TabText = QColor(0, 0, 0);
|
||||
}
|
||||
TabHoverText = QColor(0, 0, 0);
|
||||
TabSelectedText = QColor(255, 255, 255);
|
||||
TabHighlightedText = QColor(0, 0, 0);
|
||||
|
|
|
@ -206,4 +206,5 @@ LazyLoadedImage *EmoteManager::getCheerBadge(long long amount)
|
|||
return Resources::getCheerBadge1();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -80,19 +80,19 @@ private:
|
|||
ConcurrentMap<long, messages::LazyLoadedImage *> _twitchEmoteFromCache;
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> _miscImageFromCache;
|
||||
|
||||
boost::signals2::signal<void()> _gifUpdateTimerSignal;
|
||||
QTimer _gifUpdateTimer;
|
||||
bool _gifUpdateTimerInitiated;
|
||||
|
||||
int _generation;
|
||||
|
||||
boost::signals2::signal<void()> _gifUpdateTimerSignal;
|
||||
|
||||
// methods
|
||||
static QString getTwitchEmoteLink(long id, qreal &scale);
|
||||
|
||||
void loadFfzEmotes();
|
||||
void loadBttvEmotes();
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
#endif // EMOTES_H
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "ircmanager.h"
|
||||
#include "accountmanager.h"
|
||||
#include "asyncexec.h"
|
||||
#include "channel.h"
|
||||
#include "channelmanager.h"
|
||||
#include "messages/messageparseargs.h"
|
||||
#include "twitch/twitchaccount.h"
|
||||
#include "twitch/twitchmessagebuilder.h"
|
||||
#include "twitch/twitchparsemessage.h"
|
||||
#include "twitch/twitchaccount.h"
|
||||
#include "accountmanager.h"
|
||||
|
||||
#include <irccommand.h>
|
||||
#include <ircconnection.h>
|
||||
|
@ -203,19 +203,20 @@ void IrcManager::partChannel(const QString &channel)
|
|||
_connectionMutex.unlock();
|
||||
}
|
||||
|
||||
void IrcManager::messageReceived(Communi::IrcMessage *message)
|
||||
void IrcManager::messageReceived(Communi::IrcMessage * /*message*/)
|
||||
{
|
||||
// qInfo(message->command().toStdString().c_str());
|
||||
|
||||
/*
|
||||
const QString &command = message->command();
|
||||
|
||||
// if (command == "CLEARCHAT") {
|
||||
// message->
|
||||
// } else if (command == "ROOMSTATE") {
|
||||
// } else if (command == "USERSTATE") {
|
||||
// } else if (command == "WHISPER") {
|
||||
// } else if (command == "USERNOTICE") {
|
||||
// }
|
||||
if (command == "CLEARCHAT") {
|
||||
} else if (command == "ROOMSTATE") {
|
||||
} else if (command == "USERSTATE") {
|
||||
} else if (command == "WHISPER") {
|
||||
} else if (command == "USERNOTICE") {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void IrcManager::privateMessageReceived(Communi::IrcPrivateMessage *message)
|
||||
|
@ -306,4 +307,4 @@ QNetworkAccessManager &IrcManager::getAccessManager()
|
|||
{
|
||||
return _accessManager;
|
||||
}
|
||||
}
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace messages {
|
|||
MessageRef::MessageRef(SharedMessage message)
|
||||
: _message(message)
|
||||
, _wordParts()
|
||||
, buffer()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -316,5 +315,6 @@ int MessageRef::getSelectionIndex(QPoint position)
|
|||
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace messages
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -47,7 +47,8 @@ private:
|
|||
// methods
|
||||
void alignWordParts(int lineStart, int lineHeight);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace messages
|
||||
} // namespace chatterino
|
||||
|
||||
#endif // MESSAGEREF_H
|
||||
|
|
|
@ -11,7 +11,6 @@ namespace chatterino {
|
|||
|
||||
SettingsManager::SettingsManager()
|
||||
: _settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat)
|
||||
, _wordTypeMask(Word::Default)
|
||||
, theme(_settingsItems, "theme", "dark")
|
||||
, themeHue(_settingsItems, "themeHue", 0)
|
||||
, selectedUser(_settingsItems, "selectedUser", "")
|
||||
|
|
|
@ -14,6 +14,30 @@ class SettingsManager : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void load();
|
||||
void save();
|
||||
|
||||
messages::Word::Type getWordTypeMask();
|
||||
bool isIgnoredEmote(const QString &emote);
|
||||
QSettings &getQSettings();
|
||||
SettingsSnapshot createSnapshot();
|
||||
|
||||
signals:
|
||||
void wordTypeMaskChanged();
|
||||
|
||||
private:
|
||||
SettingsManager();
|
||||
|
||||
// variables
|
||||
QSettings _settings;
|
||||
std::vector<std::reference_wrapper<BaseSetting>> _settingsItems;
|
||||
messages::Word::Type _wordTypeMask = messages::Word::Default;
|
||||
|
||||
// methods
|
||||
void updateWordTypeMask();
|
||||
|
||||
public:
|
||||
// Settings
|
||||
Setting<QString> theme;
|
||||
Setting<float> themeHue;
|
||||
Setting<QString> selectedUser;
|
||||
|
@ -47,28 +71,6 @@ public:
|
|||
Setting<bool> hideUserButton;
|
||||
Setting<bool> useCustomWindowFrame;
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
messages::Word::Type getWordTypeMask();
|
||||
bool isIgnoredEmote(const QString &emote);
|
||||
QSettings &getQSettings();
|
||||
SettingsSnapshot createSnapshot();
|
||||
|
||||
signals:
|
||||
void wordTypeMaskChanged();
|
||||
|
||||
private:
|
||||
SettingsManager();
|
||||
|
||||
// variables
|
||||
QSettings _settings;
|
||||
std::vector<std::reference_wrapper<BaseSetting>> _settingsItems;
|
||||
messages::Word::Type _wordTypeMask;
|
||||
|
||||
// methods
|
||||
void updateWordTypeMask();
|
||||
|
||||
public:
|
||||
static SettingsManager &getInstance()
|
||||
{
|
||||
|
|
|
@ -38,20 +38,17 @@ ChatWidget::~ChatWidget()
|
|||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel>
|
||||
ChatWidget::getChannel() const
|
||||
std::shared_ptr<Channel> ChatWidget::getChannel() const
|
||||
{
|
||||
return _channel;
|
||||
}
|
||||
|
||||
const QString &
|
||||
ChatWidget::getChannelName() const
|
||||
const QString &ChatWidget::getChannelName() const
|
||||
{
|
||||
return _channelName;
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::setChannelName(const QString &name)
|
||||
void ChatWidget::setChannelName(const QString &name)
|
||||
{
|
||||
QString channel = name.trimmed();
|
||||
|
||||
|
@ -92,27 +89,25 @@ ChatWidget::setChannelName(const QString &name)
|
|||
_view.update();
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::attachChannel(SharedChannel channel)
|
||||
void ChatWidget::attachChannel(SharedChannel channel)
|
||||
{
|
||||
// on new message
|
||||
_messageAppendedConnection =
|
||||
channel->messageAppended.connect([this](SharedMessage &message) {
|
||||
_messageAppendedConnection = channel->messageAppended.connect([this](SharedMessage &message) {
|
||||
SharedMessageRef deleted;
|
||||
|
||||
auto messageRef = new MessageRef(message);
|
||||
|
||||
if (_messages.appendItem(SharedMessageRef(messageRef), deleted)) {
|
||||
qreal value =
|
||||
std::max(0.0, _view.getScrollbar()->getDesiredValue() - 1);
|
||||
qreal value = std::max(0.0, _view.getScrollbar()->getDesiredValue() - 1);
|
||||
|
||||
_view.getScrollbar()->setDesiredValue(value, false);
|
||||
}
|
||||
});
|
||||
|
||||
// on message removed
|
||||
_messageRemovedConnection =
|
||||
_channel->messageRemovedFromStart.connect([this](SharedMessage &) {});
|
||||
_messageRemovedConnection = _channel->messageRemovedFromStart.connect([](SharedMessage &) {
|
||||
//
|
||||
});
|
||||
|
||||
auto snapshot = _channel.get()->getMessageSnapshot();
|
||||
|
||||
|
@ -125,8 +120,7 @@ ChatWidget::attachChannel(SharedChannel channel)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::detachChannel(std::shared_ptr<Channel> channel)
|
||||
void ChatWidget::detachChannel(std::shared_ptr<Channel> channel)
|
||||
{
|
||||
// on message added
|
||||
_messageAppendedConnection.disconnect();
|
||||
|
@ -135,14 +129,12 @@ ChatWidget::detachChannel(std::shared_ptr<Channel> channel)
|
|||
_messageRemovedConnection.disconnect();
|
||||
}
|
||||
|
||||
LimitedQueueSnapshot<SharedMessageRef>
|
||||
ChatWidget::getMessagesSnapshot()
|
||||
LimitedQueueSnapshot<SharedMessageRef> ChatWidget::getMessagesSnapshot()
|
||||
{
|
||||
return _messages.getSnapshot();
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::showChangeChannelPopup()
|
||||
void ChatWidget::showChangeChannelPopup()
|
||||
{
|
||||
// create new input dialog and execute it
|
||||
TextInputDialog dialog(this);
|
||||
|
@ -154,22 +146,19 @@ ChatWidget::showChangeChannelPopup()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::layoutMessages()
|
||||
void ChatWidget::layoutMessages()
|
||||
{
|
||||
if (_view.layoutMessages()) {
|
||||
_view.update();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::updateGifEmotes()
|
||||
void ChatWidget::updateGifEmotes()
|
||||
{
|
||||
_view.updateGifEmotes();
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::paintEvent(QPaintEvent *)
|
||||
void ChatWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
// color the background of the chat
|
||||
QPainter painter(this);
|
||||
|
@ -177,19 +166,16 @@ ChatWidget::paintEvent(QPaintEvent *)
|
|||
painter.fillRect(this->rect(), ColorScheme::getInstance().ChatBackground);
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidget::load(const boost::property_tree::ptree &tree)
|
||||
void ChatWidget::load(const boost::property_tree::ptree &tree)
|
||||
{
|
||||
// load tab text
|
||||
try {
|
||||
this->setChannelName(
|
||||
QString::fromStdString(tree.get<std::string>("channelName")));
|
||||
this->setChannelName(QString::fromStdString(tree.get<std::string>("channelName")));
|
||||
} catch (boost::property_tree::ptree_error) {
|
||||
}
|
||||
}
|
||||
|
||||
boost::property_tree::ptree
|
||||
ChatWidget::save()
|
||||
boost::property_tree::ptree ChatWidget::save()
|
||||
{
|
||||
boost::property_tree::ptree tree;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *widget)
|
|||
|
||||
completer->setWidget(&_edit);
|
||||
|
||||
_edit.keyPressed.connect([this, completer](QKeyEvent *event) {
|
||||
_edit.keyPressed.connect([this/*, completer*/](QKeyEvent *event) {
|
||||
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
||||
auto ptr = _chatWidget->getChannel();
|
||||
Channel *c = ptr.get();
|
||||
|
|
|
@ -220,10 +220,10 @@ void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
|||
QPoint relPoint = mapToParent(event->pos());
|
||||
|
||||
int index;
|
||||
NotebookPage *page = _notebook->tabAt(relPoint, index);
|
||||
NotebookPage *clickedPage = _notebook->tabAt(relPoint, index);
|
||||
|
||||
if (page != nullptr && page != page) {
|
||||
_notebook->rearrangePage(page, index);
|
||||
if (clickedPage != nullptr && clickedPage != page) {
|
||||
_notebook->rearrangePage(clickedPage, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
|||
return margins.top() + document()->size().height() + margins.bottom() + 5;
|
||||
}
|
||||
|
||||
void keyPressEvent(QKeyEvent *event)
|
||||
void keyPressEvent(QKeyEvent *event) override
|
||||
{
|
||||
event->ignore();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ ScrollBar::ScrollBar(QWidget *widget)
|
|||
: QWidget(widget)
|
||||
, _mutex()
|
||||
, _currentValueAnimation(this, "currentValue")
|
||||
, _highlights(NULL)
|
||||
, _highlights(nullptr)
|
||||
, _mouseOverIndex(-1)
|
||||
, _mouseDownIndex(-1)
|
||||
, _lastMousePosition()
|
||||
|
@ -25,8 +25,8 @@ ScrollBar::ScrollBar(QWidget *widget)
|
|||
, _largeChange()
|
||||
, _smallChange()
|
||||
, _desiredValue()
|
||||
, _currentValueChanged()
|
||||
, _currentValue()
|
||||
, _currentValueChanged()
|
||||
{
|
||||
resize(16, 100);
|
||||
|
||||
|
|
|
@ -43,10 +43,11 @@ private:
|
|||
Q_PROPERTY(qreal _currentValue READ getCurrentValue WRITE setCurrentValue)
|
||||
|
||||
QMutex _mutex;
|
||||
ScrollBarHighlight *_highlights;
|
||||
|
||||
QPropertyAnimation _currentValueAnimation;
|
||||
|
||||
ScrollBarHighlight *_highlights;
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
|
|
@ -5,12 +5,12 @@ namespace chatterino {
|
|||
namespace widgets {
|
||||
|
||||
ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex, Style style, QString tag)
|
||||
: _position(position)
|
||||
: _style(style)
|
||||
, _position(position)
|
||||
, _colorIndex(std::max(0, std::min(ColorScheme::getInstance().HighlightColorCount, colorIndex)))
|
||||
, _style(style)
|
||||
, _tag(tag)
|
||||
, next(NULL)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
return _tag;
|
||||
}
|
||||
|
||||
ScrollBarHighlight *next;
|
||||
ScrollBarHighlight *next = nullptr;
|
||||
|
||||
private:
|
||||
Style _style;
|
||||
|
@ -42,7 +42,8 @@ private:
|
|||
int _colorIndex;
|
||||
QString _tag;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
||||
#endif // SCROLLBARHIGHLIGHT_H
|
||||
|
|
|
@ -140,7 +140,7 @@ void SettingsDialog::addTabs()
|
|||
}
|
||||
|
||||
QObject::connect(combo, &QComboBox::currentTextChanged, this,
|
||||
[this, &settings](const QString &value) { settings.theme.set(value); });
|
||||
[&settings](const QString &value) { settings.theme.set(value); });
|
||||
|
||||
// theme hue
|
||||
slider->setMinimum(0);
|
||||
|
@ -150,7 +150,7 @@ void SettingsDialog::addTabs()
|
|||
|
||||
slider->setValue(std::min(std::max(hue, (float)0.0), (float)1.0) * 1000);
|
||||
|
||||
QObject::connect(slider, &QSlider::valueChanged, this, [this, &settings](int value) {
|
||||
QObject::connect(slider, &QSlider::valueChanged, this, [&settings](int value) {
|
||||
settings.themeHue.set(value / 1000.0);
|
||||
WindowManager::getInstance().updateAll();
|
||||
});
|
||||
|
@ -318,7 +318,7 @@ QCheckBox *SettingsDialog::createCheckbox(const QString &title, Setting<bool> &s
|
|||
checkbox->setChecked(setting.get());
|
||||
|
||||
QObject::connect(checkbox, &QCheckBox::toggled, this,
|
||||
[&setting, this](bool state) { setting.set(state); });
|
||||
[&setting](bool state) { setting.set(state); });
|
||||
|
||||
return checkbox;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue