Skip to content

Commit

Permalink
refactor(style): Match declaration and definition argument names
Browse files Browse the repository at this point in the history
Conform with readability-named-parameter and
readability-inconsistent-declaration-parameter-name
  • Loading branch information
anthonybilinski committed Mar 15, 2022
1 parent 47d52f9 commit cabcf41
Show file tree
Hide file tree
Showing 101 changed files with 285 additions and 231 deletions.
4 changes: 2 additions & 2 deletions audio/src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
along with qTox. If not, see <http://www.gnu.org/licenses/>.
*/

#include <memory>

#include "audio/audio.h"
#include "audio/iaudiosettings.h"
#include "backend/openal.h"

#include <memory>

/**
* @brief Select the audio backend
* @param settings Audio settings to use
Expand Down
2 changes: 1 addition & 1 deletion audio/src/backend/openal.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class OpenAL : public IAudioControl

private:
virtual bool initInput(const QString& deviceName);
virtual bool initOutput(const QString& outDevDescr);
virtual bool initOutput(const QString& deviceName);

void cleanupBuffers(uint sourceId);
void cleanupSound();
Expand Down
21 changes: 14 additions & 7 deletions src/chatlog/chatlinecontent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,38 @@ int ChatLineContent::type() const
return GraphicsItemType::ChatLineContentType;
}

void ChatLineContent::selectionMouseMove(QPointF)
void ChatLineContent::selectionMouseMove(QPointF scenePos)
{
std::ignore = scenePos;
}

void ChatLineContent::selectionStarted(QPointF)
void ChatLineContent::selectionStarted(QPointF scenePos)
{
std::ignore = scenePos;
}

void ChatLineContent::selectionCleared()
{
}

void ChatLineContent::selectionDoubleClick(QPointF)
void ChatLineContent::selectionDoubleClick(QPointF scenePos)
{
std::ignore = scenePos;
}

void ChatLineContent::selectionTripleClick(QPointF)
void ChatLineContent::selectionTripleClick(QPointF scenePos)
{
std::ignore = scenePos;
}

void ChatLineContent::selectionFocusChanged(bool)
void ChatLineContent::selectionFocusChanged(bool focusIn)
{
std::ignore = focusIn;
}

bool ChatLineContent::isOverSelection(QPointF) const
bool ChatLineContent::isOverSelection(QPointF scenePos) const
{
std::ignore = scenePos;
return false;
}

Expand All @@ -79,8 +85,9 @@ qreal ChatLineContent::getAscent() const
return 0.0;
}

void ChatLineContent::visibilityChanged(bool)
void ChatLineContent::visibilityChanged(bool visible)
{
std::ignore = visible;
}

void ChatLineContent::reloadTheme()
Expand Down
14 changes: 7 additions & 7 deletions src/chatlog/chatmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ class ChatMessage : public ChatLine
ALERT,
};

ChatMessage(DocumentCache&, Settings&);
ChatMessage(DocumentCache& documentCache, Settings& settings);
~ChatMessage();
ChatMessage(const ChatMessage&) = default;
ChatMessage(ChatMessage&&) = default;

static ChatMessage::Ptr createChatMessage(const QString& sender, const QString& rawMessage,
MessageType type, bool isMe, MessageState state,
const QDateTime& date, DocumentCache&,
SmileyPack&, Settings&, bool colorizeName = false);
const QDateTime& date, DocumentCache& documentCache,
SmileyPack& smileyPack, Settings& settings, bool colorizeName = false);
static ChatMessage::Ptr createChatInfoMessage(const QString& rawMessage, SystemMessageType type,
const QDateTime& date, DocumentCache&, Settings&);
const QDateTime& date, DocumentCache& documentCache, Settings& settings);
static ChatMessage::Ptr createFileTransferMessage(const QString& sender, CoreFile& coreFile,
ToxFile file, bool isMe, const QDateTime& date,
DocumentCache&, Settings&);
static ChatMessage::Ptr createTypingNotification(DocumentCache&, Settings&);
static ChatMessage::Ptr createBusyNotification(DocumentCache&, Settings&);
DocumentCache& documentCache, Settings& settings);
static ChatMessage::Ptr createTypingNotification(DocumentCache& documentCache, Settings& settings);
static ChatMessage::Ptr createBusyNotification(DocumentCache& documentCache, Settings& settings);

void markAsDelivered(const QDateTime& time);
void markAsBroken();
Expand Down
3 changes: 2 additions & 1 deletion src/chatlog/chatwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,8 +1304,9 @@ void ChatWidget::handleMultiClickEvent()
}
}

void ChatWidget::showEvent(QShowEvent*)
void ChatWidget::showEvent(QShowEvent* event)
{
std::ignore = event;
// Empty.
// The default implementation calls centerOn - for some reason - causing
// the scrollbar to move.
Expand Down
10 changes: 5 additions & 5 deletions src/chatlog/chatwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ChatWidget : public QGraphicsView
{
Q_OBJECT
public:
ChatWidget(IChatLog& chatLog_, const Core& core_, DocumentCache&, SmileyPack&,
Settings&, QWidget* parent = nullptr);
ChatWidget(IChatLog& chatLog_, const Core& core_, DocumentCache& documentCache,
SmileyPack& smileyPack, Settings& settings, QWidget* parent = nullptr);
virtual ~ChatWidget();

void insertChatlines(std::map<ChatLogIdx, ChatLine::Ptr> chatLines);
Expand Down Expand Up @@ -94,7 +94,7 @@ private slots:
void renderMessage(ChatLogIdx idx);
void renderMessages(ChatLogIdx begin, ChatLogIdx end);

void setRenderedWindowStart(ChatLogIdx start);
void setRenderedWindowStart(ChatLogIdx begin);
void setRenderedWindowEnd(ChatLogIdx end);

void onRenderFinished();
Expand All @@ -121,7 +121,7 @@ private slots:
void mouseMoveEvent(QMouseEvent* ev) final;
void scrollContentsBy(int dx, int dy) final;
void resizeEvent(QResizeEvent* ev) final;
void showEvent(QShowEvent*) final;
void showEvent(QShowEvent* event) final;
void hideEvent(QHideEvent* event) final;
void focusInEvent(QFocusEvent* ev) final;
void focusOutEvent(QFocusEvent* ev) final;
Expand All @@ -133,7 +133,7 @@ private slots:

ChatLine::Ptr findLineByPosY(qreal yPos) const;

void removeLines(ChatLogIdx being, ChatLogIdx end);
void removeLines(ChatLogIdx begin, ChatLogIdx end);

private:
void retranslateUi();
Expand Down
3 changes: 2 additions & 1 deletion src/chatlog/content/filetransferwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ bool FileTransferWidget::drawButtonAreaNeeded() const
&& !(ui->leftButton->isVisible() && ui->leftButton->objectName() == "ok");
}

void FileTransferWidget::paintEvent(QPaintEvent*)
void FileTransferWidget::paintEvent(QPaintEvent* event)
{
std::ignore = event;
// required by Hi-DPI support as border-image doesn't work.
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
Expand Down
4 changes: 2 additions & 2 deletions src/chatlog/content/filetransferwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileTransferWidget : public QWidget
Q_OBJECT

public:
FileTransferWidget(QWidget* parent, CoreFile& _coreFile, ToxFile file, Settings&);
FileTransferWidget(QWidget* parent, CoreFile& _coreFile, ToxFile file, Settings& settings);
virtual ~FileTransferWidget();
bool isActive() const;
void onFileTransferUpdate(ToxFile file);
Expand All @@ -60,7 +60,7 @@ class FileTransferWidget : public QWidget

bool drawButtonAreaNeeded() const;

void paintEvent(QPaintEvent*) final;
void paintEvent(QPaintEvent* event) final;

public slots:
void reloadTheme();
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/content/notificationicon.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NotificationIcon : public ChatLineContent
{
Q_OBJECT
public:
explicit NotificationIcon(Settings&, QSize size);
explicit NotificationIcon(Settings& settings, QSize size);

QRectF boundingRect() const override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
Expand Down
4 changes: 2 additions & 2 deletions src/chatlog/content/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include <QTextFragment>

Text::Text(DocumentCache& documentCache_, Settings& settings_, const QString& txt,
const QFont& font, bool enableElide, const QString& rwText, const TextType& type,
const QFont& font, bool enableElide, const QString& rawText_, const TextType& type,
const QColor& custom)
: rawText(rwText)
: rawText(rawText_)
, elide(enableElide)
, defFont(font)
, defStyleSheet(Style::getStylesheet(QStringLiteral("chatArea/innerStyle.css"), settings_, font))
Expand Down
8 changes: 4 additions & 4 deletions src/chatlog/content/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class Text : public ChatLineContent
CUSTOM
};

Text(DocumentCache&, Settings&, const QString& txt = "", const QFont& font = QFont(),
bool enableElide = false, const QString& rawText = QString(),
const TextType& type = NORMAL,
Text(DocumentCache& documentCache, Settings& settings, const QString& txt = "",
const QFont& font = QFont(), bool enableElide = false,
const QString& rawText = QString(), const TextType& type = NORMAL,
const QColor& custom = Style::getColor(Style::ColorPalette::MainText));
virtual ~Text();

Expand All @@ -66,7 +66,7 @@ class Text : public ChatLineContent
QRectF boundingRect() const final;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) final;

void visibilityChanged(bool keepInMemory) final;
void visibilityChanged(bool visible) final;
void reloadTheme() final;

qreal getAscent() const final;
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/content/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Timestamp : public Text
Q_OBJECT
public:
Timestamp(const QDateTime& time_, const QString& format, const QFont& font,
DocumentCache&, Settings&);
DocumentCache& documentCache, Settings& settings);
QDateTime getTime();

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/customtextdocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CustomTextDocument : public QTextDocument
{
Q_OBJECT
public:
CustomTextDocument(SmileyPack&, Settings&, QObject* parent = nullptr);
CustomTextDocument(SmileyPack& smileyPack, Settings& settings, QObject* parent = nullptr);

protected:
virtual QVariant loadResource(int type, const QUrl& name);
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/documentcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Settings;
class DocumentCache
{
public:
DocumentCache(SmileyPack&, Settings&);
DocumentCache(SmileyPack& smileyPack, Settings& settings);
~DocumentCache();
DocumentCache(DocumentCache&) = delete;
DocumentCache& operator=(const DocumentCache&) = delete;
Expand Down
39 changes: 26 additions & 13 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,44 +872,50 @@ void Core::bootstrapDht()
}
}

void Core::onFriendRequest(Tox*, const uint8_t* cFriendPk, const uint8_t* cMessage,
void Core::onFriendRequest(Tox* tox, const uint8_t* cFriendPk, const uint8_t* cMessage,
size_t cMessageSize, void* core)
{
std::ignore = tox;
ToxPk friendPk(cFriendPk);
QString requestMessage = ToxString(cMessage, cMessageSize).getQString();
emit static_cast<Core*>(core)->friendRequestReceived(friendPk, requestMessage);
}

void Core::onFriendMessage(Tox*, uint32_t friendId, Tox_Message_Type type, const uint8_t* cMessage,
void Core::onFriendMessage(Tox* tox, uint32_t friendId, Tox_Message_Type type, const uint8_t* cMessage,
size_t cMessageSize, void* core)
{
std::ignore = tox;
bool isAction = (type == TOX_MESSAGE_TYPE_ACTION);
QString msg = ToxString(cMessage, cMessageSize).getQString();
emit static_cast<Core*>(core)->friendMessageReceived(friendId, msg, isAction);
}

void Core::onFriendNameChange(Tox*, uint32_t friendId, const uint8_t* cName, size_t cNameSize, void* core)
void Core::onFriendNameChange(Tox* tox, uint32_t friendId, const uint8_t* cName, size_t cNameSize, void* core)
{
std::ignore = tox;
QString newName = ToxString(cName, cNameSize).getQString();
// no saveRequest, this callback is called on every connection, not just on name change
emit static_cast<Core*>(core)->friendUsernameChanged(friendId, newName);
}

void Core::onFriendTypingChange(Tox*, uint32_t friendId, bool isTyping, void* core)
void Core::onFriendTypingChange(Tox* tox, uint32_t friendId, bool isTyping, void* core)
{
std::ignore = tox;
emit static_cast<Core*>(core)->friendTypingChanged(friendId, isTyping);
}

void Core::onStatusMessageChanged(Tox*, uint32_t friendId, const uint8_t* cMessage,
void Core::onStatusMessageChanged(Tox* tox, uint32_t friendId, const uint8_t* cMessage,
size_t cMessageSize, void* core)
{
std::ignore = tox;
QString message = ToxString(cMessage, cMessageSize).getQString();
// no saveRequest, this callback is called on every connection, not just on name change
emit static_cast<Core*>(core)->friendStatusMessageChanged(friendId, message);
}

void Core::onUserStatusChanged(Tox*, uint32_t friendId, Tox_User_Status userstatus, void* core)
void Core::onUserStatusChanged(Tox* tox, uint32_t friendId, Tox_User_Status userstatus, void* core)
{
std::ignore = tox;
Status::Status status;
switch (userstatus) {
case TOX_USER_STATUS_AWAY:
Expand All @@ -929,8 +935,9 @@ void Core::onUserStatusChanged(Tox*, uint32_t friendId, Tox_User_Status userstat
emit static_cast<Core*>(core)->friendStatusChanged(friendId, status);
}

void Core::onConnectionStatusChanged(Tox*, uint32_t friendId, Tox_Connection status, void* vCore)
void Core::onConnectionStatusChanged(Tox* tox, uint32_t friendId, Tox_Connection status, void* vCore)
{
std::ignore = tox;
Core* core = static_cast<Core*>(vCore);
Status::Status friendStatus = Status::Status::Offline;
switch (status)
Expand Down Expand Up @@ -981,36 +988,40 @@ void Core::onGroupInvite(Tox* tox, uint32_t friendId, Tox_Conference_Type type,
}
}

void Core::onGroupMessage(Tox*, uint32_t groupId, uint32_t peerId, Tox_Message_Type type,
void Core::onGroupMessage(Tox* tox, uint32_t groupId, uint32_t peerId, Tox_Message_Type type,
const uint8_t* cMessage, size_t length, void* vCore)
{
std::ignore = tox;
Core* core = static_cast<Core*>(vCore);
bool isAction = type == TOX_MESSAGE_TYPE_ACTION;
QString message = ToxString(cMessage, length).getQString();
emit core->groupMessageReceived(groupId, peerId, message, isAction);
}

void Core::onGroupPeerListChange(Tox*, uint32_t groupId, void* vCore)
void Core::onGroupPeerListChange(Tox* tox, uint32_t groupId, void* vCore)
{
std::ignore = tox;
const auto core = static_cast<Core*>(vCore);
qDebug() << QString("Group %1 peerlist changed").arg(groupId);
// no saveRequest, this callback is called on every connection to group peer, not just on brand new peers
emit core->groupPeerlistChanged(groupId);
}

void Core::onGroupPeerNameChange(Tox*, uint32_t groupId, uint32_t peerId, const uint8_t* name,
void Core::onGroupPeerNameChange(Tox* tox, uint32_t groupId, uint32_t peerId, const uint8_t* name,
size_t length, void* vCore)
{
std::ignore = tox;
const auto newName = ToxString(name, length).getQString();
qDebug() << QString("Group %1, peer %2, name changed to %3").arg(groupId).arg(peerId).arg(newName);
auto* core = static_cast<Core*>(vCore);
auto peerPk = core->getGroupPeerPk(groupId, peerId);
emit core->groupPeerNameChanged(groupId, peerPk, newName);
}

void Core::onGroupTitleChange(Tox*, uint32_t groupId, uint32_t peerId, const uint8_t* cTitle,
void Core::onGroupTitleChange(Tox* tox, uint32_t groupId, uint32_t peerId, const uint8_t* cTitle,
size_t length, void* vCore)
{
std::ignore = tox;
Core* core = static_cast<Core*>(vCore);
QString author;
// from tox.h: "If peer_number == UINT32_MAX, then author is unknown (e.g. initial joining the conference)."
Expand All @@ -1024,15 +1035,17 @@ void Core::onGroupTitleChange(Tox*, uint32_t groupId, uint32_t peerId, const uin
/**
* @brief Handling of custom lossless packets received by toxcore. Currently only used to forward toxext packets to CoreExt
*/
void Core::onLosslessPacket(Tox*, uint32_t friendId,
void Core::onLosslessPacket(Tox* tox, uint32_t friendId,
const uint8_t* data, size_t length, void* vCore)
{
std::ignore = tox;
Core* core = static_cast<Core*>(vCore);
core->ext->onLosslessPacket(friendId, data, length);
}

void Core::onReadReceiptCallback(Tox*, uint32_t friendId, uint32_t receipt, void* core)
void Core::onReadReceiptCallback(Tox* tox, uint32_t friendId, uint32_t receipt, void* core)
{
std::ignore = tox;
emit static_cast<Core*>(core)->receiptRecieved(friendId, ReceiptNum{receipt});
}

Expand Down
Loading

0 comments on commit cabcf41

Please sign in to comment.