getting rid of tons of warnings

This commit is contained in:
confuseh 2017-01-18 13:48:42 +00:00
parent 528f539fca
commit 5eb7349b57
13 changed files with 98 additions and 69 deletions

View file

@ -112,7 +112,8 @@ HEADERS += mainwindow.h \
chatwidgetheaderbutton.h \ chatwidgetheaderbutton.h \
chatwidgetheaderbuttonlabel.h \ chatwidgetheaderbuttonlabel.h \
channels.h \ channels.h \
textinputdialog.h textinputdialog.h \
signallabel.h
PRECOMPILED_HEADER = PRECOMPILED_HEADER =

View file

@ -60,9 +60,12 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
// middle // middle
this->middleLabel.setAlignment(Qt::AlignCenter); this->middleLabel.setAlignment(Qt::AlignCenter);
QObject::connect(&this->middleLabel, /*QObject::connect(&this->middleLabel,
SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this, * SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this,
SLOT(mouseDoubleClickEvent)); * SLOT(mouseDoubleClickEvent));
* mouseDoubleClickEvent is not a signal, its an event handler
*/
connect(&this->middleLabel, &SignalLabel::mouseDoubleClick, this, &ChatWidgetHeader::mouseDoubleClickEvent);
// right // right
this->rightLabel.setMinimumWidth(height()); this->rightLabel.setMinimumWidth(height());

View file

@ -2,6 +2,7 @@
#define CHATWIDGETHEADER_H #define CHATWIDGETHEADER_H
#include "chatwidgetheaderbutton.h" #include "chatwidgetheaderbutton.h"
#include "signallabel.h"
#include <QAction> #include <QAction>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -45,7 +46,7 @@ private:
QHBoxLayout hbox; QHBoxLayout hbox;
ChatWidgetHeaderButton leftLabel; ChatWidgetHeaderButton leftLabel;
QLabel middleLabel; SignalLabel middleLabel;
ChatWidgetHeaderButton rightLabel; ChatWidgetHeaderButton rightLabel;
QMenu leftMenu; QMenu leftMenu;

View file

@ -6,6 +6,7 @@
#include "word.h" #include "word.h"
#include "wordpart.h" #include "wordpart.h"
#include <math.h>
#include <QPainter> #include <QPainter>
#include <QScroller> #include <QScroller>
#include <functional> #include <functional>
@ -105,7 +106,7 @@ ChatWidgetView::paintEvent(QPaintEvent *)
} }
int y = -(messages[start].get()->getHeight() * int y = -(messages[start].get()->getHeight() *
(std::fmod(this->scrollbar.getValue(), 1))); (fmod(this->scrollbar.getValue(), 1)));
for (int i = start; i < messages.size(); ++i) { for (int i = start; i < messages.size(); ++i) {
Message *message = messages[i].get(); Message *message = messages[i].get();

View file

@ -464,7 +464,7 @@ Message::layout(int width, bool enableEmoteMargins)
bool first = true; bool first = true;
auto alignParts = [&lineStart, &lineHeight, &parts, this] { auto alignParts = [&lineStart, &lineHeight, &parts, this] {
for (int i = lineStart; i < parts->size(); i++) { for (size_t i = lineStart; i < parts->size(); i++) {
WordPart &wordPart2 = parts->at(i); WordPart &wordPart2 = parts->at(i);
wordPart2.setY(wordPart2.getY() + lineHeight); wordPart2.setY(wordPart2.getY() + lineHeight);
@ -510,7 +510,7 @@ Message::layout(int width, bool enableEmoteMargins)
charWidths.reserve(text.length()); charWidths.reserve(text.length());
for (int i = 0; i < text.length(); i++) { for (int i = 0; i < text.length(); i++) {
charWidths.push_back(metrics.charWidth(text, i)); charWidths.push_back(metrics.width(text, i));
} }
} }

View file

@ -16,8 +16,8 @@ std::pair<int, int> NotebookPage::dropPosition = std::pair<int, int>(-1, -1);
NotebookPage::NotebookPage(QWidget *parent, NotebookTab *tab) NotebookPage::NotebookPage(QWidget *parent, NotebookTab *tab)
: QWidget(parent) : QWidget(parent)
, parentbox(this) , parentbox(this)
, preview(this)
, chatWidgets() , chatWidgets()
, preview(this)
{ {
this->tab = tab; this->tab = tab;
tab->page = this; tab->page = this;

View file

@ -37,9 +37,9 @@ public:
protected: protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void enterEvent(QEvent *); void enterEvent(QEvent *) override;
void leaveEvent(QEvent *); void leaveEvent(QEvent *) override;
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE; void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;

View file

@ -21,71 +21,71 @@ public:
void void
setMaximum(qreal value) setMaximum(qreal value)
{ {
maximum = value; this->maximum = value;
updateScroll(); this->updateScroll();
} }
void void
setMinimum(qreal value) setMinimum(qreal value)
{ {
minimum = value; this->minimum = value;
updateScroll(); this->updateScroll();
} }
void void
setLargeChange(qreal value) setLargeChange(qreal value)
{ {
largeChange = value; this->largeChange = value;
updateScroll(); this->updateScroll();
} }
void void
setSmallChange(qreal value) setSmallChange(qreal value)
{ {
smallChange = value; this->smallChange = value;
updateScroll(); this->updateScroll();
} }
void void
setValue(qreal value) setValue(qreal value)
{ {
value = value; this->value = value;
updateScroll(); this->updateScroll();
} }
qreal qreal
getMaximum() const getMaximum() const
{ {
return maximum; return this->maximum;
} }
qreal qreal
getMinimum() const getMinimum() const
{ {
return minimum; return this->minimum;
} }
qreal qreal
getLargeChange() const getLargeChange() const
{ {
return largeChange; return this->largeChange;
} }
qreal qreal
getSmallChange() const getSmallChange() const
{ {
return smallChange; return this->smallChange;
} }
qreal qreal
getValue() const getValue() const
{ {
return value; return this->value;
} }
private: private:

View file

@ -18,23 +18,23 @@ public:
void void
setSelected(bool selected) setSelected(bool selected)
{ {
if (selected == selected) if (this->selected == selected)
return; return;
selected = selected; this->selected = selected;
emit selectedChanged(selected); emit selectedChanged(selected);
} }
bool bool
getSelected() const getSelected() const
{ {
return selected; return this->selected;
} }
QWidget * QWidget *
getWidget() getWidget()
{ {
return widget; return this->widget;
} }
void void

23
signallabel.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef SIGNALLABEL_H
#define SIGNALLABEL_H
#include <QFlags>
#include <QLabel>
#include <QWidget>
class SignalLabel : public QLabel
{
Q_OBJECT
public:
explicit SignalLabel(QWidget *parent = 0, Qt::WindowFlags f = 0)
: QLabel(parent, f) {}
virtual ~SignalLabel() = default;
signals:
void mouseDoubleClick(QMouseEvent *ev);
protected:
virtual void mouseDoubleClickEvent(QMouseEvent *ev) override {
emit this->mouseDoubleClick(ev);
}
};
#endif // SIGNALLABEL_H

40
word.h
View file

@ -77,111 +77,111 @@ public:
const QString & const QString &
getText() const getText() const
{ {
return text; return this->text;
} }
int int
getWidth() const getWidth() const
{ {
return width; return this->width;
} }
int int
getHeight() const getHeight() const
{ {
return height; return this->height;
} }
void void
setSize(int width, int height) setSize(int width, int height)
{ {
width = width; this->width = width;
height = height; this->height = height;
} }
bool bool
isImage() const isImage() const
{ {
return _isImage; return this->_isImage;
} }
bool bool
isText() const isText() const
{ {
return !_isImage; return !this->_isImage;
} }
const QString & const QString &
getCopyText() const getCopyText() const
{ {
return copyText; return this->copyText;
} }
bool bool
hasTrailingSpace() const hasTrailingSpace() const
{ {
return _hasTrailingSpace; return this->_hasTrailingSpace;
} }
QFont & QFont &
getFont() const getFont() const
{ {
return Fonts::getFont(font); return Fonts::getFont(this->font);
} }
QFontMetrics & QFontMetrics &
getFontMetrics() const getFontMetrics() const
{ {
return Fonts::getFontMetrics(font); return Fonts::getFontMetrics(this->font);
} }
Type Type
getType() const getType() const
{ {
return type; return this->type;
} }
const QString & const QString &
getTooltip() const getTooltip() const
{ {
return tooltip; return this->tooltip;
} }
const QColor & const QColor &
getColor() const getColor() const
{ {
return color; return this->color;
} }
const Link & const Link &
getLink() const getLink() const
{ {
return link; return this->link;
} }
int int
getXOffset() const getXOffset() const
{ {
return xOffset; return this->xOffset;
} }
int int
getYOffset() const getYOffset() const
{ {
return yOffset; return this->yOffset;
} }
void void
setOffset(int xOffset, int yOffset) setOffset(int xOffset, int yOffset)
{ {
xOffset = std::max(0, xOffset); this->xOffset = std::max(0, xOffset);
yOffset = std::max(0, yOffset); this->yOffset = std::max(0, yOffset);
} }
std::vector<short> & std::vector<short> &
getCharacterWidthCache() getCharacterWidthCache()
{ {
return characterWidthCache; return this->characterWidthCache;
} }
private: private:

View file

@ -5,12 +5,12 @@ WordPart::WordPart(Word &word, int x, int y, const QString &copyText,
bool allowTrailingSpace) bool allowTrailingSpace)
: m_word(word) : m_word(word)
, copyText(copyText) , copyText(copyText)
, text(word.isText() ? m_word.getText() : QString())
, x(x) , x(x)
, y(y) , y(y)
, width(word.getWidth()) , width(word.getWidth())
, height(word.getHeight()) , height(word.getHeight())
, _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace) , _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace)
, text(word.isText() ? m_word.getText() : QString())
{ {
} }
@ -19,11 +19,11 @@ WordPart::WordPart(Word &word, int x, int y, int width, int height,
bool allowTrailingSpace) bool allowTrailingSpace)
: m_word(word) : m_word(word)
, copyText(copyText) , copyText(copyText)
, text(customText)
, x(x) , x(x)
, y(y) , y(y)
, width(width) , width(width)
, height(height) , height(height)
, _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace) , _trailingSpace(word.hasTrailingSpace() & allowTrailingSpace)
, text(customText)
{ {
} }

View file

@ -19,84 +19,84 @@ public:
const Word & const Word &
getWord() const getWord() const
{ {
return m_word; return this->m_word;
} }
int int
getWidth() const getWidth() const
{ {
return width; return this->width;
} }
int int
getHeight() const getHeight() const
{ {
return height; return this->height;
} }
int int
getX() const getX() const
{ {
return x; return this->x;
} }
int int
getY() const getY() const
{ {
return y; return this->y;
} }
void void
setPosition(int x, int y) setPosition(int x, int y)
{ {
x = x; this->x = x;
y = y; this->y = y;
} }
void void
setY(int y) setY(int y)
{ {
y = y; this->y = y;
} }
int int
getRight() const getRight() const
{ {
return x + width; return this->x + this->width;
} }
int int
getBottom() const getBottom() const
{ {
return y + height; return this->y + this->height;
} }
QRect QRect
getRect() const getRect() const
{ {
return QRect(x, y, width, height); return QRect(this->x, this->y, this->width, this->height);
} }
const QString const QString
getCopyText() const getCopyText() const
{ {
return copyText; return this->copyText;
} }
int int
hasTrailingSpace() const hasTrailingSpace() const
{ {
return _trailingSpace; return this->_trailingSpace;
} }
const QString & const QString &
getText() const getText() const
{ {
return text; return this->text;
} }
private: private:
Word &m_word; Word& m_word;
QString copyText; QString copyText;
QString text; QString text;