Fix all warnings that we care about
This commit is contained in:
+24
-38
@@ -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) {
|
||||
SharedMessageRef deleted;
|
||||
_messageAppendedConnection = channel->messageAppended.connect([this](SharedMessage &message) {
|
||||
SharedMessageRef deleted;
|
||||
|
||||
auto messageRef = new MessageRef(message);
|
||||
auto messageRef = new MessageRef(message);
|
||||
|
||||
if (_messages.appendItem(SharedMessageRef(messageRef), deleted)) {
|
||||
qreal value =
|
||||
std::max(0.0, _view.getScrollbar()->getDesiredValue() - 1);
|
||||
if (_messages.appendItem(SharedMessageRef(messageRef), deleted)) {
|
||||
qreal value = std::max(0.0, _view.getScrollbar()->getDesiredValue() - 1);
|
||||
|
||||
_view.getScrollbar()->setDesiredValue(value, false);
|
||||
}
|
||||
});
|
||||
_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);
|
||||
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user