Skip to content
Snippets Groups Projects
Commit 2e605683 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk
Browse files

project: don't use Qt keywords for signal/slot/emit

Gitlab: #320
Change-Id: Ia2a16a05be3fd6452a39df999660a5c8440eea13
parent 4ce208ec
No related branches found
No related tags found
No related merge requests found
Showing
with 84 additions and 78 deletions
......@@ -29,6 +29,9 @@ set(QML_LIBS
Qt5::DBus
Qt5::Core)
# library compatibility (boost, libnotify, etc.)
add_definitions(-DQT_NO_KEYWORDS)
set(COMMON_SOURCES
${SRC_DIR}/bannedlistmodel.cpp
${SRC_DIR}/accountlistmodel.cpp
......
......@@ -6,6 +6,9 @@ win32-msvc {
CONFIG += suppress_vcproj_warnings c++17 qtquickcompiler
# library compatibility (boost, libnotify, etc.)
CONFIG += no_keywords
QTQUICK_COMPILER_SKIPPED_RESOURCES += resources.qrc
# compiler options
......
......@@ -32,7 +32,7 @@ public:
: QAbstractListModel(parent) {};
~AbstractListModelBase() = default;
signals:
Q_SIGNALS:
void lrcInstanceChanged();
protected:
......
......@@ -79,13 +79,13 @@ AccountAdapter::connectFailure()
&lrc::api::NewAccountModel::accountRemoved,
[this](const QString& accountId) {
Q_UNUSED(accountId);
emit reportFailure();
Q_EMIT reportFailure();
});
Utils::oneShotConnect(&lrcInstance_->accountModel(),
&lrc::api::NewAccountModel::invalidAccountDetected,
[this](const QString& accountId) {
Q_UNUSED(accountId);
emit reportFailure();
Q_EMIT reportFailure();
});
}
......@@ -113,8 +113,8 @@ AccountAdapter::createJamiAccount(QString registeredName,
&lrc::api::NewAccountModel::profileUpdated,
[this, showBackup, addedAccountId = accountId](const QString& accountId) {
if (addedAccountId == accountId) {
emit lrcInstance_->accountListChanged();
emit accountAdded(accountId,
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
showBackup,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
......@@ -126,8 +126,8 @@ AccountAdapter::createJamiAccount(QString registeredName,
settings["password"].toString(),
registeredName);
} else {
emit lrcInstance_->accountListChanged();
emit accountAdded(accountId,
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
showBackup,
lrcInstance_->accountModel().getAccountList().indexOf(accountId));
}
......@@ -161,8 +161,8 @@ AccountAdapter::createSIPAccount(const QVariantMap& settings)
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
emit lrcInstance_->accountListChanged();
emit accountAdded(accountId,
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
false,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
......@@ -195,11 +195,11 @@ AccountAdapter::createJAMSAccount(const QVariantMap& settings)
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
emit accountAdded(accountId,
Q_EMIT accountAdded(accountId,
false,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
emit lrcInstance_->accountListChanged();
Q_EMIT lrcInstance_->accountListChanged();
});
connectFailure();
......@@ -215,7 +215,7 @@ void
AccountAdapter::deleteCurrentAccount()
{
lrcInstance_->accountModel().removeAccount(lrcInstance_->getCurrAccId());
emit lrcInstance_->accountListChanged();
Q_EMIT lrcInstance_->accountListChanged();
}
bool
......@@ -368,14 +368,14 @@ AccountAdapter::connectAccount(const QString& accountId)
= QObject::connect(accInfo.accountModel,
&lrc::api::NewAccountModel::accountStatusChanged,
[this](const QString& accountId) {
emit accountStatusChanged(accountId);
Q_EMIT accountStatusChanged(accountId);
});
accountProfileUpdatedConnection_
= QObject::connect(accInfo.accountModel,
&lrc::api::NewAccountModel::profileUpdated,
[this](const QString& accountId) {
emit accountStatusChanged(accountId);
Q_EMIT accountStatusChanged(accountId);
});
contactAddedConnection_
......@@ -396,7 +396,7 @@ AccountAdapter::connectAccount(const QString& accountId)
/*
* Update conversation.
*/
emit updateConversationForAddedContact();
Q_EMIT updateConversationForAddedContact();
}
});
......@@ -413,7 +413,7 @@ AccountAdapter::connectAccount(const QString& accountId)
[this](const QString& contactUri,
bool banned) {
if (!banned)
emit contactUnbanned();
Q_EMIT contactUnbanned();
});
} catch (...) {
qWarning() << "Couldn't get account: " << accountId;
......@@ -426,5 +426,5 @@ AccountAdapter::setProperties(const QString& accountId)
setProperty("currentAccountId", accountId);
auto accountType = lrcInstance_->getAccountInfo(accountId).profileInfo.type;
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
emit deviceModelChanged();
Q_EMIT deviceModelChanged();
}
......@@ -44,7 +44,7 @@ public:
lrc::api::NewAccountModel* getModel();
lrc::api::NewDeviceModel* getDeviceModel();
signals:
Q_SIGNALS:
void modelChanged();
void deviceModelChanged();
void currentAccountIdChanged();
......@@ -100,7 +100,7 @@ public:
Q_INVOKABLE void setCurrAccAvatar(bool fromFile, const QString& source);
signals:
Q_SIGNALS:
// Trigger other components to reconnect account related signals.
void accountStatusChanged(QString accountId = {});
......@@ -111,7 +111,7 @@ signals:
void accountAdded(QString accountId, bool showBackUp, int index);
void contactUnbanned();
private slots:
private Q_SLOTS:
void onCurrentAccountChanged();
private:
......
......@@ -31,7 +31,7 @@ public:
enum Role { DeviceName = Qt::UserRole + 1, RawDeviceName };
Q_ENUM(Role)
signals:
Q_SIGNALS:
void typeChanged();
public:
......
......@@ -127,7 +127,7 @@ AvAdapter::captureScreen(int screenNumber)
buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG");
emit screenCaptured(screenNumber, Utils::byteArrayToBase64String(buffer.data()));
Q_EMIT screenCaptured(screenNumber, Utils::byteArrayToBase64String(buffer.data()));
});
}
......@@ -140,7 +140,7 @@ AvAdapter::captureAllScreens()
QList<QPixmap> scrs;
int width = 0, height = 0, currentPoint = 0;
foreach (auto scr, screens) {
for(auto scr : screens) {
QPixmap pix = scr->grabWindow(0);
width += pix.width();
if (height < pix.height())
......@@ -152,7 +152,7 @@ AvAdapter::captureAllScreens()
QPainter painter(&final);
final.fill(Qt::black);
foreach (auto scr, scrs) {
for(auto scr : scrs) {
painter.drawPixmap(QPoint(currentPoint, 0), scr);
currentPoint += scr.width();
}
......@@ -160,7 +160,7 @@ AvAdapter::captureAllScreens()
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
final.save(&buffer, "PNG");
emit screenCaptured(-1, Utils::byteArrayToBase64String(buffer.data()));
Q_EMIT screenCaptured(-1, Utils::byteArrayToBase64String(buffer.data()));
});
}
......@@ -276,7 +276,7 @@ AvAdapter::slotDeviceEvent()
}
}
emit videoDeviceListChanged(currentDeviceListSize == 0);
Q_EMIT videoDeviceListChanged(currentDeviceListSize == 0);
deviceListSize_ = currentDeviceListSize;
}
......
......@@ -32,7 +32,7 @@ public:
explicit AvAdapter(LRCInstance* instance, QObject* parent = nullptr);
~AvAdapter() = default;
signals:
Q_SIGNALS:
// Emitted when the size of the video capture device list changes.
void videoDeviceListChanged(bool listIsEmpty);
......
......@@ -145,8 +145,8 @@ CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& con
return;
}
}
emit callSetupMainViewRequired(accountId, convInfo.uid);
emit lrcInstance_->updateSmartList();
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT lrcInstance_->updateSmartList();
return;
}
......@@ -155,7 +155,7 @@ CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& con
if (call.isOutgoing) {
if (isCallSelected) {
emit callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
}
} else {
auto accountProperties = lrcInstance_->accountModel().getAccountConfig(selectedAccountId);
......@@ -180,10 +180,10 @@ CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& con
showNotification(accountId, convInfo.uid);
return;
} else {
emit callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
}
} else {
emit callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
}
} else { // Not current conversation
if (currentConvHasCall) {
......@@ -195,12 +195,12 @@ CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& con
return;
}
}
emit callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
}
}
}
emit callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid);
emit lrcInstance_->updateSmartList();
Q_EMIT callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid);
Q_EMIT lrcInstance_->updateSmartList();
}
void
......@@ -212,7 +212,7 @@ CallAdapter::onShowCallView(const QString& accountId, const QString& convUid)
}
updateCall(convInfo.uid, accountId);
emit callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
}
void
......@@ -232,7 +232,7 @@ CallAdapter::updateCall(const QString& convUid, const QString& accountId, bool f
}
updateCallOverlay(convInfo);
emit previewVisibilityNeedToChange(shouldShowPreview(forceCallOnly));
Q_EMIT previewVisibilityNeedToChange(shouldShowPreview(forceCallOnly));
if (call->status == lrc::api::call::Status::IN_PROGRESS) {
lrcInstance_->renderer()->addDistantRenderer(call->id);
......@@ -334,10 +334,10 @@ CallAdapter::showNotification(const QString& accountId, const QString& convUid)
if (convInfo.uid.isEmpty()) {
return;
}
emit lrcInstance_->notificationClicked();
emit callSetupMainViewRequired(convInfo.accountId, convInfo.uid);
Q_EMIT lrcInstance_->notificationClicked();
Q_EMIT callSetupMainViewRequired(convInfo.accountId, convInfo.uid);
};
emit lrcInstance_->updateSmartList();
Q_EMIT lrcInstance_->updateSmartList();
systemTray_->showNotification(tr("is calling you"), from, onClicked);
}
......@@ -366,7 +366,7 @@ CallAdapter::connectCallModel(const QString& accountId)
map.push_back(QVariant(data));
updateCallOverlay(convInfo);
}
emit updateParticipantsInfos(map, accountId, confId);
Q_EMIT updateParticipantsInfos(map, accountId, confId);
}
});
......@@ -383,7 +383,7 @@ CallAdapter::connectCallModel(const QString& accountId)
*/
const auto& convInfo = lrcInstance_->getConversationFromCallId(callId);
if (!convInfo.uid.isEmpty()) {
emit callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid);
Q_EMIT callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid);
updateCallOverlay(convInfo);
}
......@@ -395,7 +395,7 @@ CallAdapter::connectCallModel(const QString& accountId)
case lrc::api::call::Status::TIMEOUT:
case lrc::api::call::Status::TERMINATING: {
lrcInstance_->renderer()->removeDistantRenderer(callId);
emit callSetupMainViewRequired(accountId, convInfo.uid);
Q_EMIT callSetupMainViewRequired(accountId, convInfo.uid);
if (convInfo.uid.isEmpty()) {
break;
}
......@@ -472,9 +472,9 @@ CallAdapter::connectCallModel(const QString& accountId)
}
}
if (!peers.isEmpty()) {
emit remoteRecordingChanged(peers, true);
Q_EMIT remoteRecordingChanged(peers, true);
} else if (!state) {
emit remoteRecordingChanged(peers, false);
Q_EMIT remoteRecordingChanged(peers, false);
}
}
});
......@@ -517,7 +517,7 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
? QString()
: accInfo.contactModel->bestNameForContact(convInfo.participants[0]);
emit updateOverlay(isPaused,
Q_EMIT updateOverlay(isPaused,
isAudioOnly,
isAudioMuted,
isVideoMuted,
......@@ -812,7 +812,7 @@ CallAdapter::holdThisCallToggle()
if (callModel->hasCall(callId)) {
callModel->togglePause(callId);
}
emit showOnHoldLabel(true);
Q_EMIT showOnHoldLabel(true);
}
void
......@@ -852,7 +852,7 @@ CallAdapter::videoPauseThisCallToggle()
if (callModel->hasCall(callId)) {
callModel->toggleMedia(callId, lrc::api::NewCallModel::Media::VIDEO);
}
emit previewVisibilityNeedToChange(shouldShowPreview(false));
Q_EMIT previewVisibilityNeedToChange(shouldShowPreview(false));
}
void
......@@ -866,7 +866,7 @@ CallAdapter::setTime(const QString& accountId, const QString& convUid)
if (callInfo.status == lrc::api::call::Status::IN_PROGRESS
|| callInfo.status == lrc::api::call::Status::PAUSED) {
auto timeString = lrcInstance_->getCurrentCallModel()->getFormattedCallDuration(callId);
emit updateTimeText(timeString);
Q_EMIT updateTimeText(timeString);
}
}
......
......@@ -77,7 +77,7 @@ public:
const QString& accountId = {},
bool forceCallOnly = false);
signals:
Q_SIGNALS:
void callStatusChanged(int index, const QString& accountId, const QString& convUid);
void updateConversationSmartList();
void updateParticipantsInfos(const QVariantList& infos,
......@@ -99,7 +99,7 @@ signals:
const QString& bestName);
void remoteRecordingChanged(const QStringList& peers, bool state);
public slots:
public Q_SLOTS:
void onShowIncomingCallView(const QString& accountId, const QString& convUid);
void onShowCallView(const QString& accountId, const QString& convUid);
void onAccountChanged();
......
......@@ -119,7 +119,7 @@ ConnectivityMonitor::ConnectivityMonitor(QObject* parent)
if (SUCCEEDED(hr)) {
cookie_ = NULL;
netEventHandler_ = new NetworkEventHandler;
netEventHandler_->setOnConnectivityChangedCallBack([this] { emit connectivityChanged(); });
netEventHandler_->setOnConnectivityChangedCallBack([this] { Q_EMIT connectivityChanged(); });
hr = pConnectPoint_->Advise((IUnknown*) netEventHandler_, &cookie_);
} else {
destroy();
......
......@@ -30,7 +30,7 @@ public:
bool isOnline();
signals:
Q_SIGNALS:
void connectivityChanged();
private:
......@@ -55,7 +55,7 @@ public:
bool isOnline();
signals:
Q_SIGNALS:
void connectivityChanged();
};
#endif // Q_OS_WIN
......@@ -178,7 +178,7 @@ ContactAdapter::contactSelected(int index)
lrcInstance_->accountModel().setDefaultModerator(lrcInstance_->getCurrAccId(),
contactUri,
true);
emit defaultModeratorsUpdated();
Q_EMIT defaultModeratorsUpdated();
} break;
default:
......
......@@ -88,6 +88,6 @@ private:
QStringList defaultModerators_;
signals:
Q_SIGNALS:
void defaultModeratorsUpdated();
};
......@@ -47,12 +47,12 @@ ConversationsAdapter::safeInit()
SmartListModel::Type::CONVERSATION,
lrcInstance_);
emit modelChanged(QVariant::fromValue(conversationSmartListModel_));
Q_EMIT modelChanged(QVariant::fromValue(conversationSmartListModel_));
connect(&lrcInstance_->behaviorController(),
&BehaviorController::showChatView,
[this](const QString& accountId, const QString& convId) {
emit showConversation(accountId, convId);
Q_EMIT showConversation(accountId, convId);
});
connect(&lrcInstance_->behaviorController(),
......@@ -75,7 +75,7 @@ void
ConversationsAdapter::backToWelcomePage()
{
deselectConversation();
emit navigateToWelcomePageRequested();
Q_EMIT navigateToWelcomePageRequested();
}
void
......@@ -115,7 +115,7 @@ ConversationsAdapter::selectConversation(const QString& accountId, const QString
}
if (!convInfo.uid.isEmpty()) {
emit showConversation(lrcInstance_->getCurrAccId(), convInfo.uid);
Q_EMIT showConversation(lrcInstance_->getCurrAccId(), convInfo.uid);
}
}
......@@ -158,12 +158,12 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
auto& accInfo = lrcInstance_->getAccountInfo(accountId);
auto from = accInfo.contactModel->bestNameForContact(interaction.authorUri);
auto onClicked = [this, accountId, convUid, uri = interaction.authorUri] {
emit lrcInstance_->notificationClicked();
Q_EMIT lrcInstance_->notificationClicked();
const auto& convInfo = lrcInstance_->getConversationFromConvUid(convUid, accountId);
if (!convInfo.uid.isEmpty()) {
selectConversation(accountId, convInfo.uid);
emit lrcInstance_->updateSmartList();
emit modelSorted(convInfo.uid);
Q_EMIT lrcInstance_->updateSmartList();
Q_EMIT modelSorted(convInfo.uid);
}
};
......@@ -214,7 +214,7 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
== lrc::api::profile::Type::TEMPORARY) {
return;
}
emit modelSorted(QVariant::fromValue(convInfo.uid));
Q_EMIT modelSorted(QVariant::fromValue(convInfo.uid));
});
contactProfileUpdatedConnection_
......@@ -222,14 +222,14 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
&lrc::api::ContactModel::profileUpdated,
[this](const QString& contactUri) {
conversationSmartListModel_->updateContactAvatarUid(contactUri);
emit updateListViewRequested();
Q_EMIT updateListViewRequested();
});
modelUpdatedConnection_ = QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::conversationUpdated,
[this](const QString&) {
updateConversationsFilterWidget();
emit updateListViewRequested();
Q_EMIT updateListViewRequested();
});
filterChangedConnection_
......@@ -239,8 +239,8 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
conversationSmartListModel_->fillConversationsList();
updateConversationsFilterWidget();
if (!lrcInstance_->getCurrentConvUid().isEmpty())
emit indexRepositionRequested();
emit updateListViewRequested();
Q_EMIT indexRepositionRequested();
Q_EMIT updateListViewRequested();
});
newConversationConnection_ = QObject::connect(currentConversationModel,
......@@ -271,7 +271,7 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
searchStatusChangedConnection_
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::searchStatusChanged,
[this](const QString& status) { emit showSearchStatus(status); });
[this](const QString& status) { Q_EMIT showSearchStatus(status); });
// This connection is ideal when separated search results list.
// This signal is guaranteed to fire just after filterChanged during a search if results are
......@@ -283,7 +283,7 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
&lrc::api::ConversationModel::searchResultUpdated,
[this]() {
conversationSmartListModel_->fillConversationsList();
emit updateListViewRequested();
Q_EMIT updateListViewRequested();
});
if (updateFilter) {
......
......@@ -50,7 +50,7 @@ public:
Q_INVOKABLE void refill();
Q_INVOKABLE void updateConversationsFilterWidget();
signals:
Q_SIGNALS:
void showConversation(const QString& accountId, const QString& convUid);
void showConversationTabs(bool visible);
void showSearchStatus(const QString& status);
......@@ -62,7 +62,7 @@ signals:
void currentTypeFilterChanged();
void indexRepositionRequested();
private slots:
private Q_SLOTS:
void onCurrentAccountIdChanged();
void onNewUnreadInteraction(const QString& accountId,
const QString& convUid,
......
......@@ -31,12 +31,12 @@ DBusErrorHandler::errorCallback()
qDebug() << "Dring has possibly crashed, "
"or has been killed... will wait 2.5 seconds and try to reconnect";
emit showDaemonReconnectPopup(true);
Q_EMIT showDaemonReconnectPopup(true);
QTimer::singleShot(2500, [this]() {
if ((!lrc::api::Lrc::isConnected()) || (!lrc::api::Lrc::dbusIsValid())) {
qDebug() << "Could not reconnect to the daemon";
emit daemonReconnectFailed();
Q_EMIT daemonReconnectFailed();
} else {
static_cast<DBusErrorHandler&>(GlobalInstances::dBusErrorHandler())
.finishedHandlingError();
......@@ -87,7 +87,7 @@ void
DBusErrorHandler::finishedHandlingError()
{
handlingError = false;
emit showDaemonReconnectPopup(false);
Q_EMIT showDaemonReconnectPopup(false);
}
} // namespace Interfaces
......@@ -37,7 +37,7 @@ public:
void finishedHandlingError();
signals:
Q_SIGNALS:
void showDaemonReconnectPopup(bool visible);
void daemonReconnectFailed();
......
......@@ -91,7 +91,7 @@ DistantRenderer::paint(QPainter* painter)
if (tempXOffset != xOffset_ or tempYOffset != yOffset_
or static_cast<int>(scaledWidth_ * 1000) != tempScaledWidth
or static_cast<int>(scaledHeight_ * 1000) != tempScaledHeight) {
emit offsetChanged();
Q_EMIT offsetChanged();
}
painter->drawImage(QRect(xOffset_,
yOffset_,
......
......@@ -42,7 +42,7 @@ public:
Q_INVOKABLE double getScaledWidth() const;
Q_INVOKABLE double getScaledHeight() const;
signals:
Q_SIGNALS:
void offsetChanged();
void lrcInstanceChanged();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment