From 446626dabe3981ee514f6ef7f56d3d5eb7ce1f3c Mon Sep 17 00:00:00 2001 From: Diadlo Date: Wed, 13 Apr 2016 23:26:50 +0300 Subject: [PATCH 1/9] refactor(chatmessage): Delete duplicate enum MarkdownType --- src/chatlog/chatmessage.cpp | 4 ++-- src/chatlog/chatmessage.h | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/chatlog/chatmessage.cpp b/src/chatlog/chatmessage.cpp index 017c34e57..09d72853c 100644 --- a/src/chatlog/chatmessage.cpp +++ b/src/chatlog/chatmessage.cpp @@ -57,7 +57,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt text = detectQuotes(detectAnchors(text), type); //markdown - if (Settings::getInstance().getMarkdownPreference() != MarkdownType::NONE) + if (Settings::getInstance().getMarkdownPreference() != NONE) text = detectMarkdown(text); switch(type) @@ -209,7 +209,7 @@ QString ChatMessage::detectMarkdown(const QString &str) { int mul = 0; // Determines how many characters to strip from markdown text // Set mul depending on markdownPreference - if (Settings::getInstance().getMarkdownPreference() == MarkdownType::WITHOUT_CHARS) + if (Settings::getInstance().getMarkdownPreference() == WITHOUT_CHARS) mul = 2; // Match captured string to corresponding md format diff --git a/src/chatlog/chatmessage.h b/src/chatlog/chatmessage.h index 0cb133563..2de1d668c 100644 --- a/src/chatlog/chatmessage.h +++ b/src/chatlog/chatmessage.h @@ -45,13 +45,6 @@ public: ALERT, }; - enum MarkdownType - { - NONE, - WITH_CHARS, - WITHOUT_CHARS, - }; - ChatMessage(); static ChatMessage::Ptr createChatMessage(const QString& sender, const QString& rawMessage, MessageType type, bool isMe, const QDateTime& date = QDateTime()); From 082fb4c05615afb980e88fa1bbba390072914b04 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Thu, 14 Apr 2016 00:33:44 +0300 Subject: [PATCH 2/9] refactor(videoframe, camerasource, corevideosource): Change calls deprecated functions --- src/video/camerasource.cpp | 2 +- src/video/corevideosource.cpp | 8 ++++++-- src/video/videoframe.cpp | 15 +++++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/video/camerasource.cpp b/src/video/camerasource.cpp index dd1beb143..a2b3be41f 100644 --- a/src/video/camerasource.cpp +++ b/src/video/camerasource.cpp @@ -337,7 +337,7 @@ void CameraSource::stream() } // Free the packet that was allocated by av_read_frame - av_free_packet(&packet); + av_packet_unref(&packet); }; forever { diff --git a/src/video/corevideosource.cpp b/src/video/corevideosource.cpp index 0a71b9b14..0e76df947 100644 --- a/src/video/corevideosource.cpp +++ b/src/video/corevideosource.cpp @@ -20,6 +20,7 @@ extern "C" { #include +#include } #include "corevideosource.h" #include "videoframe.h" @@ -53,7 +54,8 @@ void CoreVideoSource::pushFrame(const vpx_image_t* vpxframe) avframe->height = height; avframe->format = AV_PIX_FMT_YUV420P; - buf = (uint8_t*)av_malloc(avpicture_get_size(AV_PIX_FMT_YUV420P, width, height)); + int imgBufferSize = av_image_get_buffer_size(AV_PIX_FMT_YUV420P, width, height, 1); + buf = (uint8_t*)av_malloc(imgBufferSize); if (!buf) { av_frame_free(&avframe); @@ -61,7 +63,9 @@ void CoreVideoSource::pushFrame(const vpx_image_t* vpxframe) } avframe->opaque = buf; - avpicture_fill((AVPicture*)avframe, buf, AV_PIX_FMT_YUV420P, width, height); + uint8_t** data = avframe->data; + int* linesize = avframe->linesize; + av_image_fill_arrays(data, linesize, buf, AV_PIX_FMT_YUV420P, width, height, 1); dstStride=avframe->linesize[0], srcStride=vpxframe->stride[0], minStride=std::min(dstStride, srcStride); for (int i=0; i extern "C" { #include +#include #include } #include "videoframe.h" @@ -154,7 +155,8 @@ bool VideoFrame::convertToRGB24(QSize size) return false; } - uint8_t* buf = (uint8_t*)av_malloc(avpicture_get_size(AV_PIX_FMT_RGB24, size.width(), size.height())); + int imgBufferSize = av_image_get_buffer_size(AV_PIX_FMT_RGB24, size.width(), size.height(), 1); + uint8_t* buf = (uint8_t*)av_malloc(imgBufferSize); if (!buf) { qCritical() << "av_malloc failed"; @@ -163,7 +165,9 @@ bool VideoFrame::convertToRGB24(QSize size) } frameRGB24->opaque = buf; - avpicture_fill((AVPicture*)frameRGB24, buf, AV_PIX_FMT_RGB24, size.width(), size.height()); + uint8_t** data = frameRGB24->data; + int* linesize = frameRGB24->linesize; + av_image_fill_arrays(data, linesize, buf, AV_PIX_FMT_RGB24, size.width(), size.height(), 1); frameRGB24->width = size.width(); frameRGB24->height = size.height(); @@ -211,7 +215,8 @@ bool VideoFrame::convertToYUV420() return false; } - uint8_t* buf = (uint8_t*)av_malloc(avpicture_get_size(AV_PIX_FMT_RGB24, width, height)); + int imgBufferSize = av_image_get_buffer_size(AV_PIX_FMT_RGB24, width, height, 1); + uint8_t* buf = (uint8_t*)av_malloc(imgBufferSize); if (!buf) { qCritical() << "av_malloc failed"; @@ -220,7 +225,9 @@ bool VideoFrame::convertToYUV420() } frameYUV420->opaque = buf; - avpicture_fill((AVPicture*)frameYUV420, buf, AV_PIX_FMT_YUV420P, width, height); + uint8_t** data = frameYUV420->data; + int* linesize = frameYUV420->linesize; + av_image_fill_arrays(data, linesize, buf, AV_PIX_FMT_YUV420P, width, height, 1); SwsContext *swsCtx = sws_getContext(width, height, (AVPixelFormat)pixFmt, width, height, AV_PIX_FMT_YUV420P, From 64a19d34192e2ca9f864b1ccc3a320fb90bc780b Mon Sep 17 00:00:00 2001 From: Diadlo Date: Thu, 14 Apr 2016 01:21:31 +0300 Subject: [PATCH 3/9] fix(main): Added check sodium_init result --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c2cd3e763..b48623f98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -150,7 +150,11 @@ int main(int argc, char *argv[]) IPC& ipc = IPC::getInstance(); #endif - sodium_init(); // For the auto-updater + if (sodium_init() < 0) // For the auto-updater + { + qCritical() << "Can't init libsodium"; + return EXIT_FAILURE; + } #ifdef LOG_TO_FILE QString logFileDir = Settings::getInstance().getAppCacheDirPath(); From 25cec623fac7c0814f5d8c018a65600380998d24 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Thu, 14 Apr 2016 01:51:34 +0300 Subject: [PATCH 4/9] refactor(systemtrayicon, genericchatform): Replace C-style cast to static_cast --- src/widget/form/genericchatform.cpp | 2 +- src/widget/systemtrayicon.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 0f41c5a5f..c9901e6c1 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -303,7 +303,7 @@ bool GenericChatForm::event(QEvent* e) void GenericChatForm::onChatContextMenuRequested(QPoint pos) { - QWidget* sender = (QWidget*)QObject::sender(); + QWidget* sender = static_cast(QObject::sender()); pos = sender->mapToGlobal(pos); menu.exec(pos); diff --git a/src/widget/systemtrayicon.cpp b/src/widget/systemtrayicon.cpp index a7f3ef183..f9df37445 100644 --- a/src/widget/systemtrayicon.cpp +++ b/src/widget/systemtrayicon.cpp @@ -76,14 +76,14 @@ SystemTrayIcon::SystemTrayIcon() void (*callbackTrigger)(GtkStatusIcon*, gpointer) = [](GtkStatusIcon*, gpointer data) { - ((SystemTrayIcon*)data)->activated(QSystemTrayIcon::Trigger); + static_cast(data)->activated(QSystemTrayIcon::Trigger); }; g_signal_connect(gtkIcon, "activate", G_CALLBACK(callbackTrigger), this); void (*callbackButtonClick)(GtkStatusIcon*, GdkEvent*, gpointer) = [](GtkStatusIcon*, GdkEvent* event, gpointer data) { if (event->button.button == 2) - ((SystemTrayIcon*)data)->activated(QSystemTrayIcon::MiddleClick); + static_cast(data)->activated(QSystemTrayIcon::MiddleClick); }; g_signal_connect(gtkIcon, "button-release-event", G_CALLBACK(callbackButtonClick), this); } @@ -124,13 +124,13 @@ void SystemTrayIcon::setContextMenu(QMenu* menu) void (*callbackClick)(StatusNotifier*, gint, gint, gpointer) = [](StatusNotifier*, gint, gint, gpointer data) { - ((SystemTrayIcon*)data)->activated(QSystemTrayIcon::Trigger); + static_cast(data)->activated(QSystemTrayIcon::Trigger); }; g_signal_connect(statusNotifier, "activate", G_CALLBACK(callbackClick), this); void (*callbackMiddleClick)(StatusNotifier*, gint, gint, gpointer) = [](StatusNotifier*, gint, gint, gpointer data) { - ((SystemTrayIcon*)data)->activated(QSystemTrayIcon::MiddleClick); + static_cast(data)->activated(QSystemTrayIcon::MiddleClick); }; g_signal_connect(statusNotifier, "secondary_activate", G_CALLBACK(callbackMiddleClick), this); @@ -175,8 +175,8 @@ void SystemTrayIcon::setContextMenu(QMenu* menu) void (*callbackMenu)(StatusNotifier*, gint, gint, gpointer) = [](StatusNotifier*, gint, gint, gpointer data) { - gtk_widget_show_all(((SystemTrayIcon*)data)->snMenu); - gtk_menu_popup(GTK_MENU(((SystemTrayIcon*)data)->snMenu), 0, 0, 0, 0, 3, gtk_get_current_event_time()); + gtk_widget_show_all(static_cast(data)->snMenu); + gtk_menu_popup(GTK_MENU(static_cast(data)->snMenu), 0, 0, 0, 0, 3, gtk_get_current_event_time()); }; g_signal_connect(statusNotifier, "context-menu", G_CALLBACK(callbackMenu), this); } @@ -225,8 +225,8 @@ void SystemTrayIcon::setContextMenu(QMenu* menu) void (*callbackMenu)(GtkMenu*, gint, gint, gpointer) = [](GtkMenu*, gint, gint, gpointer data) { - gtk_widget_show_all(((SystemTrayIcon*)data)->gtkMenu); - gtk_menu_popup(GTK_MENU(((SystemTrayIcon*)data)->gtkMenu), 0, 0, 0, 0, 3, gtk_get_current_event_time()); + gtk_widget_show_all(static_cast(data)->gtkMenu); + gtk_menu_popup(GTK_MENU(static_cast(data)->gtkMenu), 0, 0, 0, 0, 3, gtk_get_current_event_time()); }; g_signal_connect(gtkIcon, "popup-menu", G_CALLBACK(callbackMenu), this); } @@ -253,7 +253,7 @@ void SystemTrayIcon::setContextMenu(QMenu* menu) gtk_menu_shell_append(GTK_MENU_SHELL(unityMenu), item); void (*callback)(GtkMenu*, gpointer data) = [](GtkMenu*, gpointer a) { - ((QAction*)a)->activate(QAction::Trigger); + static_cast(a)->activate(QAction::Trigger); }; g_signal_connect(item, "activate", G_CALLBACK(callback), a); gtk_widget_show(item); @@ -266,7 +266,7 @@ void SystemTrayIcon::setContextMenu(QMenu* menu) void (*callback)(DbusmenuMenuitem *, gpointer) = [](DbusmenuMenuitem *, gpointer data) { - ((SystemTrayIcon*)data)->activated(QSystemTrayIcon::Unknown); + static_cast(data)->activated(QSystemTrayIcon::Unknown); }; g_signal_connect(rootMenuItem, "about-to-show", G_CALLBACK(callback), this); } From 910c41f4fab106e1c736685ffad33141c1528107 Mon Sep 17 00:00:00 2001 From: Polshakov Dmitry Date: Thu, 14 Apr 2016 14:42:16 +0300 Subject: [PATCH 5/9] perf(camerasource): Passed parameter by reference --- src/video/camerasource.cpp | 4 ++-- src/video/camerasource.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/video/camerasource.cpp b/src/video/camerasource.cpp index a2b3be41f..bfb9646c1 100644 --- a/src/video/camerasource.cpp +++ b/src/video/camerasource.cpp @@ -65,12 +65,12 @@ void CameraSource::open() open(CameraDevice::getDefaultDeviceName()); } -void CameraSource::open(const QString deviceName) +void CameraSource::open(const QString& deviceName) { open(deviceName, VideoMode{0,0,0,0}); } -void CameraSource::open(const QString DeviceName, VideoMode Mode) +void CameraSource::open(const QString& DeviceName, VideoMode Mode) { streamBlocker = true; QMutexLocker l{&biglock}; diff --git a/src/video/camerasource.h b/src/video/camerasource.h index 8b59ce850..8005069cc 100644 --- a/src/video/camerasource.h +++ b/src/video/camerasource.h @@ -52,8 +52,8 @@ public: /// Opens the source for the camera device in argument, in the settings, or the system default /// If a device is already open, the source will seamlessly switch to the new device void open(); - void open(const QString deviceName); - void open(const QString deviceName, VideoMode mode); + void open(const QString& deviceName); + void open(const QString& deviceName, VideoMode mode); void close(); ///< Equivalent to opening the source with the video device "none". Stops streaming. bool isOpen(); From 27faec918a023c5bba4b6ee67854438507220b35 Mon Sep 17 00:00:00 2001 From: Polshakov Dmitry Date: Tue, 19 Apr 2016 12:44:46 +0300 Subject: [PATCH 6/9] fix(genericchatitemwidget, micfeedbackwidget): Added members init in the constructor --- src/widget/genericchatitemwidget.cpp | 2 +- src/widget/tool/micfeedbackwidget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widget/genericchatitemwidget.cpp b/src/widget/genericchatitemwidget.cpp index 05f0293ba..2600238b0 100644 --- a/src/widget/genericchatitemwidget.cpp +++ b/src/widget/genericchatitemwidget.cpp @@ -24,7 +24,7 @@ #include GenericChatItemWidget::GenericChatItemWidget(QWidget *parent) - : QFrame(parent) + : QFrame(parent), compact(false) { setProperty("compact", Settings::getInstance().getCompactLayout()); diff --git a/src/widget/tool/micfeedbackwidget.cpp b/src/widget/tool/micfeedbackwidget.cpp index 64457277c..47c53c8ae 100644 --- a/src/widget/tool/micfeedbackwidget.cpp +++ b/src/widget/tool/micfeedbackwidget.cpp @@ -23,7 +23,7 @@ #include MicFeedbackWidget::MicFeedbackWidget(QWidget *parent) - : QWidget(parent) + : QWidget(parent), mMeterListener(nullptr) { setFixedHeight(20); } From 2143e21e890b54def34201c7fa51a76940e85f27 Mon Sep 17 00:00:00 2001 From: Polshakov Dmitry Date: Tue, 19 Apr 2016 15:06:06 +0300 Subject: [PATCH 7/9] style(ipc, widgets, genericcharitemlayout): Small style changes --- src/ipc.cpp | 4 +++- src/widget/categorywidget.cpp | 29 ++++++++++++++-------------- src/widget/categorywidget.h | 1 + src/widget/genericchatitemlayout.cpp | 4 ++-- src/widget/genericchatroomwidget.cpp | 7 +++++-- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/ipc.cpp b/src/ipc.cpp index f2d6314b8..31aae4fc9 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -281,7 +281,9 @@ void IPC::processEvents() evt->processed = time(0); } else + { evt->processed = time(0); + } } } @@ -293,5 +295,5 @@ void IPC::processEvents() IPC::IPCMemory *IPC::global() { - return (IPCMemory*)globalMemory.data(); + return static_cast(globalMemory.data()); } diff --git a/src/widget/categorywidget.cpp b/src/widget/categorywidget.cpp index 3964a1bce..31140ecd4 100644 --- a/src/widget/categorywidget.cpp +++ b/src/widget/categorywidget.cpp @@ -28,7 +28,7 @@ #include -void emitChatroomWidget(QLayout* layout, int index) +void CategoryWidget::emitChatroomWidget(QLayout* layout, int index) { GenericChatroomWidget* chatWidget = dynamic_cast(layout->itemAt(index)->widget()); if (chatWidget != nullptr) @@ -83,11 +83,12 @@ void CategoryWidget::setExpanded(bool isExpanded, bool save) setMouseTracking(true); listWidget->setVisible(isExpanded); + QString pixmapPath; if (isExpanded) - statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarDownArrow.svg")); + pixmapPath = ":/ui/chatArea/scrollBarDownArrow.svg"; else - statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg")); - + pixmapPath = ":/ui/chatArea/scrollBarRightArrow.svg"; + statusPic.setPixmap(QPixmap(pixmapPath)); // The listWidget will recieve a enterEvent for some reason if now visible. // Using the following, we prevent that. QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers); @@ -199,19 +200,17 @@ bool CategoryWidget::cycleContacts(FriendWidget* activeChatroomWidget, bool forw QLayout* currentLayout = nullptr; FriendWidget* friendWidget = dynamic_cast(activeChatroomWidget); - if (friendWidget != nullptr) - { - currentLayout = listLayout->getLayoutOnline(); - index = listLayout->indexOfFriendWidget(friendWidget, true); - if (index == -1) - { - currentLayout = listLayout->getLayoutOffline(); - index = listLayout->indexOfFriendWidget(friendWidget, false); - } - } - else + if (friendWidget == nullptr) return false; + currentLayout = listLayout->getLayoutOnline(); + index = listLayout->indexOfFriendWidget(friendWidget, true); + if (index == -1) + { + currentLayout = listLayout->getLayoutOffline(); + index = listLayout->indexOfFriendWidget(friendWidget, false); + } + index += forward ? 1 : -1; for (;;) { diff --git a/src/widget/categorywidget.h b/src/widget/categorywidget.h index ff91a40f8..2f5066618 100644 --- a/src/widget/categorywidget.h +++ b/src/widget/categorywidget.h @@ -60,6 +60,7 @@ protected: QLayout* friendOnlineLayout() const; QLayout* friendOfflineLayout() const; void moveFriendWidgets(FriendListWidget* friendList); + void emitChatroomWidget(QLayout *layout, int index); private: virtual void onSetName() {} diff --git a/src/widget/genericchatitemlayout.cpp b/src/widget/genericchatitemlayout.cpp index ec88944ec..4f98850a3 100644 --- a/src/widget/genericchatitemlayout.cpp +++ b/src/widget/genericchatitemlayout.cpp @@ -99,10 +99,10 @@ QLayout* GenericChatItemLayout::getLayout() const int GenericChatItemLayout::indexOfClosestSortedWidget(GenericChatItemWidget* widget) const { // Binary search: Deferred test of equality. - int min = 0, max = layout->count(), mid; + int min = 0, max = layout->count(); while (min < max) { - mid = (max - min) / 2 + min; + int mid = (max - min) / 2 + min; GenericChatItemWidget* atMid = dynamic_cast(layout->itemAt(mid)->widget()); assert(atMid != nullptr); diff --git a/src/widget/genericchatroomwidget.cpp b/src/widget/genericchatroomwidget.cpp index fc5e96458..f263f474f 100644 --- a/src/widget/genericchatroomwidget.cpp +++ b/src/widget/genericchatroomwidget.cpp @@ -29,10 +29,13 @@ GenericChatroomWidget::GenericChatroomWidget(QWidget *parent) : GenericChatItemWidget(parent), active{false} { // avatar + QSize size; if (isCompact()) - avatar = new MaskablePixmapWidget(this, QSize(20,20), ":/img/avatar_mask.svg"); + size = QSize(20,20); else - avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.svg"); + size = QSize(40,40); + + avatar = new MaskablePixmapWidget(this, size, ":/img/avatar_mask.svg"); // status text statusMessageLabel = new CroppingLabel(this); From 904a1d490973ed57327bc093aeaae1e7317b52e8 Mon Sep 17 00:00:00 2001 From: Polshakov Dmitry Date: Tue, 19 Apr 2016 15:09:00 +0300 Subject: [PATCH 8/9] perf(contentdialog): Delete redundant conditions --- src/widget/contentdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widget/contentdialog.cpp b/src/widget/contentdialog.cpp index 4a3c31014..28928526f 100644 --- a/src/widget/contentdialog.cpp +++ b/src/widget/contentdialog.cpp @@ -518,7 +518,7 @@ void ContentDialog::dragEnterEvent(QDragEnterEvent *event) auto iter = friendList.find(friendId); // If friend is already in a dialog then you can't drop friend where it already is. - if (iter == friendList.end() || (iter != friendList.end() && std::get<0>(iter.value()) != this)) + if (iter == friendList.end() || std::get<0>(iter.value()) != this) event->acceptProposedAction(); } else if (event->mimeData()->hasFormat("group")) @@ -526,7 +526,7 @@ void ContentDialog::dragEnterEvent(QDragEnterEvent *event) int groupId = event->mimeData()->data("group").toInt(); auto iter = groupList.find(groupId); - if (iter == groupList.end() || (iter != groupList.end() && std::get<0>(iter.value()) != this)) + if (iter == groupList.end() || std::get<0>(iter.value()) != this) event->acceptProposedAction(); } } From 343568339f6d7e51c99c0aa7f843c1b21c0874ed Mon Sep 17 00:00:00 2001 From: Polshakov Dmitry Date: Tue, 19 Apr 2016 12:56:21 +0300 Subject: [PATCH 9/9] style(constructors): Constructors are explicit now --- src/chatlog/content/notificationicon.h | 2 +- src/core/coreav.h | 2 +- src/core/toxcall.h | 2 +- src/persistence/historykeeper.h | 2 +- src/persistence/offlinemsgengine.h | 2 +- src/video/genericnetcamview.h | 2 +- src/video/videoframe.h | 2 +- src/widget/categorywidget.h | 2 +- src/widget/contentlayout.h | 2 +- src/widget/form/chatform.h | 2 +- src/widget/form/genericchatform.h | 2 +- src/widget/form/groupchatform.h | 2 +- src/widget/form/profileform.h | 2 +- src/widget/form/settings/generalform.h | 2 +- src/widget/form/settings/genericsettings.h | 2 +- src/widget/form/settingswidget.h | 2 +- src/widget/form/tabcompleter.h | 2 +- src/widget/genericchatitemwidget.h | 2 +- src/widget/genericchatroomwidget.h | 2 +- src/widget/notificationscrollarea.h | 2 +- src/widget/tool/croppinglabel.cpp | 2 +- src/widget/tool/movablewidget.h | 2 +- src/widget/tool/screengrabberchooserrectitem.h | 2 +- src/widget/tool/screengrabberoverlayitem.h | 2 +- src/widget/tool/screenshotgrabber.h | 2 +- src/widget/widget.cpp | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/chatlog/content/notificationicon.h b/src/chatlog/content/notificationicon.h index 1637a1348..e918e6a74 100644 --- a/src/chatlog/content/notificationicon.h +++ b/src/chatlog/content/notificationicon.h @@ -31,7 +31,7 @@ class NotificationIcon : public QObject, public ChatLineContent { Q_OBJECT public: - NotificationIcon(QSize size); + explicit NotificationIcon(QSize size); virtual QRectF boundingRect() const override; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; diff --git a/src/core/coreav.h b/src/core/coreav.h index f8b5f204f..c09240172 100644 --- a/src/core/coreav.h +++ b/src/core/coreav.h @@ -45,7 +45,7 @@ class CoreAV : public QObject Q_OBJECT public: - CoreAV(Tox* tox); + explicit CoreAV(Tox* tox); ~CoreAV(); const ToxAV* getToxAv() const; diff --git a/src/core/toxcall.h b/src/core/toxcall.h index cf559db88..222803c58 100644 --- a/src/core/toxcall.h +++ b/src/core/toxcall.h @@ -18,7 +18,7 @@ struct ToxCall { protected: ToxCall() = default; - ToxCall(uint32_t CallId); + explicit ToxCall(uint32_t CallId); ~ToxCall(); public: ToxCall(const ToxCall& other) = delete; diff --git a/src/persistence/historykeeper.h b/src/persistence/historykeeper.h index 6315a7249..cd96ab242 100644 --- a/src/persistence/historykeeper.h +++ b/src/persistence/historykeeper.h @@ -69,7 +69,7 @@ public: QList exportMessages(); private: - HistoryKeeper(GenericDdInterface *db_); + explicit HistoryKeeper(GenericDdInterface *db_); HistoryKeeper(HistoryKeeper &hk) = delete; HistoryKeeper& operator=(const HistoryKeeper&) = delete; QString unWrapMessage(const QString &str); diff --git a/src/persistence/offlinemsgengine.h b/src/persistence/offlinemsgengine.h index 3f4189cd8..deadbf257 100644 --- a/src/persistence/offlinemsgengine.h +++ b/src/persistence/offlinemsgengine.h @@ -34,7 +34,7 @@ class OfflineMsgEngine : public QObject { Q_OBJECT public: - OfflineMsgEngine(Friend *); + explicit OfflineMsgEngine(Friend *); virtual ~OfflineMsgEngine(); static QMutex globalMutex; diff --git a/src/video/genericnetcamview.h b/src/video/genericnetcamview.h index 05d3bc6bd..7cb1a79a2 100644 --- a/src/video/genericnetcamview.h +++ b/src/video/genericnetcamview.h @@ -30,7 +30,7 @@ class GenericNetCamView : public QWidget { Q_OBJECT public: - GenericNetCamView(QWidget* parent); + explicit GenericNetCamView(QWidget* parent); signals: void showMessageClicked(); diff --git a/src/video/videoframe.h b/src/video/videoframe.h index e6003541c..6dadae9e0 100644 --- a/src/video/videoframe.h +++ b/src/video/videoframe.h @@ -37,7 +37,7 @@ struct vpx_image; class VideoFrame { public: - VideoFrame(AVFrame* frame); + explicit VideoFrame(AVFrame* frame); VideoFrame(AVFrame* frame, std::function freelistCallback); VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function freelistCallback); ~VideoFrame(); diff --git a/src/widget/categorywidget.h b/src/widget/categorywidget.h index 2f5066618..ab35f6595 100644 --- a/src/widget/categorywidget.h +++ b/src/widget/categorywidget.h @@ -33,7 +33,7 @@ class CategoryWidget : public GenericChatItemWidget { Q_OBJECT public: - CategoryWidget(QWidget* parent = 0); + explicit CategoryWidget(QWidget* parent = 0); bool isExpanded() const; void setExpanded(bool isExpanded, bool save = true); diff --git a/src/widget/contentlayout.h b/src/widget/contentlayout.h index be69decc5..5493867c6 100644 --- a/src/widget/contentlayout.h +++ b/src/widget/contentlayout.h @@ -27,7 +27,7 @@ class ContentLayout : public QVBoxLayout { public: ContentLayout(); - ContentLayout(QWidget* parent); + explicit ContentLayout(QWidget* parent); ~ContentLayout(); void clear(); diff --git a/src/widget/form/chatform.h b/src/widget/form/chatform.h index 46b87c49b..842af1ac0 100644 --- a/src/widget/form/chatform.h +++ b/src/widget/form/chatform.h @@ -40,7 +40,7 @@ class ChatForm : public GenericChatForm { Q_OBJECT public: - ChatForm(Friend* chatFriend); + explicit ChatForm(Friend* chatFriend); ~ChatForm(); void setStatusMessage(QString newMessage); void loadHistory(QDateTime since, bool processUndelivered = false); diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index 9f09246fb..a1d4d4d1a 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -52,7 +52,7 @@ class GenericChatForm : public QWidget { Q_OBJECT public: - GenericChatForm(QWidget *parent = 0); + explicit GenericChatForm(QWidget *parent = 0); ~GenericChatForm(); void setName(const QString &newName); diff --git a/src/widget/form/groupchatform.h b/src/widget/form/groupchatform.h index 73eaeed5c..b25ccb38d 100644 --- a/src/widget/form/groupchatform.h +++ b/src/widget/form/groupchatform.h @@ -33,7 +33,7 @@ class GroupChatForm : public GenericChatForm { Q_OBJECT public: - GroupChatForm(Group* chatGroup); + explicit GroupChatForm(Group* chatGroup); ~GroupChatForm(); void onUserListChanged(); diff --git a/src/widget/form/profileform.h b/src/widget/form/profileform.h index 9575655cc..288d62ca2 100644 --- a/src/widget/form/profileform.h +++ b/src/widget/form/profileform.h @@ -52,7 +52,7 @@ class ProfileForm : public QWidget { Q_OBJECT public: - ProfileForm(QWidget *parent = nullptr); + explicit ProfileForm(QWidget *parent = nullptr); ~ProfileForm(); virtual void show() final{} void show(ContentLayout* contentLayout); diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index 1c141e51f..6b27e6f06 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -32,7 +32,7 @@ class GeneralForm : public GenericForm { Q_OBJECT public: - GeneralForm(SettingsWidget *parent); + explicit GeneralForm(SettingsWidget *parent); ~GeneralForm(); virtual QString getFormName() final override {return tr("General");} diff --git a/src/widget/form/settings/genericsettings.h b/src/widget/form/settings/genericsettings.h index 735eed642..e2833f96b 100644 --- a/src/widget/form/settings/genericsettings.h +++ b/src/widget/form/settings/genericsettings.h @@ -24,7 +24,7 @@ class GenericForm : public QWidget { Q_OBJECT public: - GenericForm(const QPixmap &icon) : formIcon(icon) {;} + explicit GenericForm(const QPixmap &icon) : formIcon(icon) {;} virtual ~GenericForm() {} virtual QString getFormName() = 0; diff --git a/src/widget/form/settingswidget.h b/src/widget/form/settingswidget.h index 8d696b069..997355efc 100644 --- a/src/widget/form/settingswidget.h +++ b/src/widget/form/settingswidget.h @@ -38,7 +38,7 @@ class SettingsWidget : public QWidget { Q_OBJECT public: - SettingsWidget(QWidget* parent = nullptr); + explicit SettingsWidget(QWidget* parent = nullptr); ~SettingsWidget(); bool isShown() const; diff --git a/src/widget/form/tabcompleter.h b/src/widget/form/tabcompleter.h index b3fc23222..919fdf57b 100644 --- a/src/widget/form/tabcompleter.h +++ b/src/widget/form/tabcompleter.h @@ -37,7 +37,7 @@ class TabCompleter : public QObject { Q_OBJECT public: - explicit TabCompleter(ChatTextEdit* msgEdit, Group* group); + TabCompleter(ChatTextEdit* msgEdit, Group* group); public slots: void complete(); diff --git a/src/widget/genericchatitemwidget.h b/src/widget/genericchatitemwidget.h index 3d03a4dd6..1a96be5b7 100644 --- a/src/widget/genericchatitemwidget.h +++ b/src/widget/genericchatitemwidget.h @@ -36,7 +36,7 @@ public: FriendOnlineItem }; - GenericChatItemWidget(QWidget *parent = 0); + explicit GenericChatItemWidget(QWidget *parent = 0); bool isCompact() const; void setCompact(bool compact); diff --git a/src/widget/genericchatroomwidget.h b/src/widget/genericchatroomwidget.h index f2670c7e1..67130dcb7 100644 --- a/src/widget/genericchatroomwidget.h +++ b/src/widget/genericchatroomwidget.h @@ -34,7 +34,7 @@ class GenericChatroomWidget : public GenericChatItemWidget { Q_OBJECT public: - GenericChatroomWidget(QWidget *parent = 0); + explicit GenericChatroomWidget(QWidget *parent = 0); virtual void setAsActiveChatroom() = 0; virtual void setAsInactiveChatroom() = 0; diff --git a/src/widget/notificationscrollarea.h b/src/widget/notificationscrollarea.h index 43b14787e..362dab46b 100644 --- a/src/widget/notificationscrollarea.h +++ b/src/widget/notificationscrollarea.h @@ -29,7 +29,7 @@ class NotificationEdgeWidget; class NotificationScrollArea final : public AdjustingScrollArea { public: - NotificationScrollArea(QWidget* parent = 0); + explicit NotificationScrollArea(QWidget* parent = 0); public slots: void trackWidget(GenericChatroomWidget* widget); diff --git a/src/widget/tool/croppinglabel.cpp b/src/widget/tool/croppinglabel.cpp index 61eeca301..95c957441 100644 --- a/src/widget/tool/croppinglabel.cpp +++ b/src/widget/tool/croppinglabel.cpp @@ -34,7 +34,7 @@ CroppingLabel::CroppingLabel(QWidget* parent) class LineEdit : public QLineEdit { public: - LineEdit(QWidget* parent = 0) : + explicit LineEdit(QWidget* parent = 0) : QLineEdit(parent) {} diff --git a/src/widget/tool/movablewidget.h b/src/widget/tool/movablewidget.h index ffa7354c0..9d1e6b21a 100644 --- a/src/widget/tool/movablewidget.h +++ b/src/widget/tool/movablewidget.h @@ -25,7 +25,7 @@ class MovableWidget : public QWidget { public: - MovableWidget(QWidget* parent); + explicit MovableWidget(QWidget* parent); void resetBoundary(QRect newBoundary); void setBoundary(QRect newBoundary); float getRatio() const; diff --git a/src/widget/tool/screengrabberchooserrectitem.h b/src/widget/tool/screengrabberchooserrectitem.h index 8fc56717a..6461109f6 100644 --- a/src/widget/tool/screengrabberchooserrectitem.h +++ b/src/widget/tool/screengrabberchooserrectitem.h @@ -26,7 +26,7 @@ class ScreenGrabberChooserRectItem final : public QObject, public QGraphicsItemG { Q_OBJECT public: - ScreenGrabberChooserRectItem(QGraphicsScene* scene); + explicit ScreenGrabberChooserRectItem(QGraphicsScene* scene); ~ScreenGrabberChooserRectItem(); virtual QRectF boundingRect() const final override; diff --git a/src/widget/tool/screengrabberoverlayitem.h b/src/widget/tool/screengrabberoverlayitem.h index c9e2e7716..61428a502 100644 --- a/src/widget/tool/screengrabberoverlayitem.h +++ b/src/widget/tool/screengrabberoverlayitem.h @@ -28,7 +28,7 @@ class ScreenGrabberOverlayItem final : public QObject, public QGraphicsRectItem { Q_OBJECT public: - ScreenGrabberOverlayItem(ScreenshotGrabber* grabber); + explicit ScreenGrabberOverlayItem(ScreenshotGrabber* grabber); ~ScreenGrabberOverlayItem(); void setChosenRect(QRect rect); diff --git a/src/widget/tool/screenshotgrabber.h b/src/widget/tool/screenshotgrabber.h index 04438f473..0a0a36b62 100644 --- a/src/widget/tool/screenshotgrabber.h +++ b/src/widget/tool/screenshotgrabber.h @@ -39,7 +39,7 @@ class ScreenshotGrabber : public QObject Q_OBJECT public: - ScreenshotGrabber(QObject* parent); + explicit ScreenshotGrabber(QObject* parent); ~ScreenshotGrabber() override; bool eventFilter(QObject* object, QEvent* event) override; diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index f56706db8..7fcc3ba34 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1404,7 +1404,7 @@ ContentLayout* Widget::createContentDialog(DialogType type) class Dialog : public ActivateDialog { public: - Dialog(DialogType type) + explicit Dialog(DialogType type) : ActivateDialog() , type(type) {