mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3162
Diadlo (4): refactor(chatmessage): Delete duplicate enum MarkdownType refactor(videoframe, camerasource, corevideosource): Change calls deprecated functions fix(main): Added check sodium_init result refactor(systemtrayicon, genericchatform): Replace C-style cast to static_cast Polshakov Dmitry (5): perf(camerasource): Passed parameter by reference fix(genericchatitemwidget, micfeedbackwidget): Added members init in the constructor style(ipc, widgets, genericcharitemlayout): Small style changes perf(contentdialog): Delete redundant conditions style(constructors): Constructors are explicit now
This commit is contained in:
commit
edc35ba9df
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -45,7 +45,7 @@ class CoreAV : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CoreAV(Tox* tox);
|
||||
explicit CoreAV(Tox* tox);
|
||||
~CoreAV();
|
||||
|
||||
const ToxAV* getToxAv() const;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<IPCMemory*>(globalMemory.data());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
QList<HistMessage> exportMessages();
|
||||
|
||||
private:
|
||||
HistoryKeeper(GenericDdInterface *db_);
|
||||
explicit HistoryKeeper(GenericDdInterface *db_);
|
||||
HistoryKeeper(HistoryKeeper &hk) = delete;
|
||||
HistoryKeeper& operator=(const HistoryKeeper&) = delete;
|
||||
QString unWrapMessage(const QString &str);
|
||||
|
|
|
@ -34,7 +34,7 @@ class OfflineMsgEngine : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OfflineMsgEngine(Friend *);
|
||||
explicit OfflineMsgEngine(Friend *);
|
||||
virtual ~OfflineMsgEngine();
|
||||
static QMutex globalMutex;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
}
|
||||
#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<height; i++)
|
||||
|
|
|
@ -30,7 +30,7 @@ class GenericNetCamView : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GenericNetCamView(QWidget* parent);
|
||||
explicit GenericNetCamView(QWidget* parent);
|
||||
|
||||
signals:
|
||||
void showMessageClicked();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <vpx/vpx_image.h>
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
#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,
|
||||
|
|
|
@ -37,7 +37,7 @@ struct vpx_image;
|
|||
class VideoFrame
|
||||
{
|
||||
public:
|
||||
VideoFrame(AVFrame* frame);
|
||||
explicit VideoFrame(AVFrame* frame);
|
||||
VideoFrame(AVFrame* frame, std::function<void()> freelistCallback);
|
||||
VideoFrame(AVFrame* frame, int w, int h, int fmt, std::function<void()> freelistCallback);
|
||||
~VideoFrame();
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
|
||||
void emitChatroomWidget(QLayout* layout, int index)
|
||||
void CategoryWidget::emitChatroomWidget(QLayout* layout, int index)
|
||||
{
|
||||
GenericChatroomWidget* chatWidget = dynamic_cast<GenericChatroomWidget*>(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<FriendWidget*>(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 (;;)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
@ -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() {}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class ContentLayout : public QVBoxLayout
|
|||
{
|
||||
public:
|
||||
ContentLayout();
|
||||
ContentLayout(QWidget* parent);
|
||||
explicit ContentLayout(QWidget* parent);
|
||||
~ContentLayout();
|
||||
|
||||
void clear();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -303,7 +303,7 @@ bool GenericChatForm::event(QEvent* e)
|
|||
|
||||
void GenericChatForm::onChatContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QWidget* sender = (QWidget*)QObject::sender();
|
||||
QWidget* sender = static_cast<QWidget*>(QObject::sender());
|
||||
pos = sender->mapToGlobal(pos);
|
||||
|
||||
menu.exec(pos);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -33,7 +33,7 @@ class GroupChatForm : public GenericChatForm
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GroupChatForm(Group* chatGroup);
|
||||
explicit GroupChatForm(Group* chatGroup);
|
||||
~GroupChatForm();
|
||||
|
||||
void onUserListChanged();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -38,7 +38,7 @@ class SettingsWidget : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SettingsWidget(QWidget* parent = nullptr);
|
||||
explicit SettingsWidget(QWidget* parent = nullptr);
|
||||
~SettingsWidget();
|
||||
|
||||
bool isShown() const;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<GenericChatItemWidget*>(layout->itemAt(mid)->widget());
|
||||
assert(atMid != nullptr);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QVariant>
|
||||
|
||||
GenericChatItemWidget::GenericChatItemWidget(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
: QFrame(parent), compact(false)
|
||||
{
|
||||
setProperty("compact", Settings::getInstance().getCompactLayout());
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
FriendOnlineItem
|
||||
};
|
||||
|
||||
GenericChatItemWidget(QWidget *parent = 0);
|
||||
explicit GenericChatItemWidget(QWidget *parent = 0);
|
||||
|
||||
bool isCompact() const;
|
||||
void setCompact(bool compact);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -76,14 +76,14 @@ SystemTrayIcon::SystemTrayIcon()
|
|||
void (*callbackTrigger)(GtkStatusIcon*, gpointer) =
|
||||
[](GtkStatusIcon*, gpointer data)
|
||||
{
|
||||
((SystemTrayIcon*)data)->activated(QSystemTrayIcon::Trigger);
|
||||
static_cast<SystemTrayIcon*>(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<SystemTrayIcon*>(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<SystemTrayIcon*>(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<SystemTrayIcon*>(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<SystemTrayIcon*>(data)->snMenu);
|
||||
gtk_menu_popup(GTK_MENU(static_cast<SystemTrayIcon*>(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<SystemTrayIcon*>(data)->gtkMenu);
|
||||
gtk_menu_popup(GTK_MENU(static_cast<SystemTrayIcon*>(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<QAction*>(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<SystemTrayIcon*>(data)->activated(QSystemTrayIcon::Unknown);
|
||||
};
|
||||
g_signal_connect(rootMenuItem, "about-to-show", G_CALLBACK(callback), this);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ CroppingLabel::CroppingLabel(QWidget* parent)
|
|||
class LineEdit : public QLineEdit
|
||||
{
|
||||
public:
|
||||
LineEdit(QWidget* parent = 0) :
|
||||
explicit LineEdit(QWidget* parent = 0) :
|
||||
QLineEdit(parent)
|
||||
{}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <QLinearGradient>
|
||||
|
||||
MicFeedbackWidget::MicFeedbackWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
: QWidget(parent), mMeterListener(nullptr)
|
||||
{
|
||||
setFixedHeight(20);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1404,7 +1404,7 @@ ContentLayout* Widget::createContentDialog(DialogType type)
|
|||
class Dialog : public ActivateDialog
|
||||
{
|
||||
public:
|
||||
Dialog(DialogType type)
|
||||
explicit Dialog(DialogType type)
|
||||
: ActivateDialog()
|
||||
, type(type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user