mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 22:58:15 +00:00
feat(app): explicit usage of global namespace on inline functions
This commit is contained in:
parent
8dbb3217e3
commit
06c97e4c90
12 changed files with 108 additions and 124 deletions
|
|
@ -128,7 +128,7 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) {
|
|||
|
||||
inline void activeSplashScreen (App *app) {
|
||||
qInfo() << QStringLiteral("Open splash screen...");
|
||||
QQuickWindow *splashScreen = createSubWindow(app, QML_VIEW_SPLASH_SCREEN);
|
||||
QQuickWindow *splashScreen = ::createSubWindow(app, QML_VIEW_SPLASH_SCREEN);
|
||||
QObject::connect(CoreManager::getInstance()->getHandlers().get(), &CoreHandlers::coreStarted, splashScreen, [splashScreen] {
|
||||
splashScreen->close();
|
||||
splashScreen->deleteLater();
|
||||
|
|
@ -187,7 +187,7 @@ void App::initContentApp () {
|
|||
// Load splashscreen.
|
||||
bool selfTest = mParser->isSet("self-test");
|
||||
if (!selfTest)
|
||||
activeSplashScreen(this);
|
||||
::activeSplashScreen(this);
|
||||
// Set a self test limit.
|
||||
else
|
||||
QTimer::singleShot(SELF_TEST_DELAY, this, [] {
|
||||
|
|
@ -225,7 +225,7 @@ void App::executeCommand (const QString &command) {
|
|||
|
||||
QQuickWindow *App::getCallsWindow () {
|
||||
if (!mCallsWindow)
|
||||
mCallsWindow = createSubWindow(this, QML_VIEW_CALLS_WINDOW);
|
||||
mCallsWindow = ::createSubWindow(this, QML_VIEW_CALLS_WINDOW);
|
||||
|
||||
return mCallsWindow;
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ QQuickWindow *App::getMainWindow () const {
|
|||
|
||||
QQuickWindow *App::getSettingsWindow () {
|
||||
if (!mSettingsWindow) {
|
||||
mSettingsWindow = createSubWindow(this, QML_VIEW_SETTINGS_WINDOW);
|
||||
mSettingsWindow = ::createSubWindow(this, QML_VIEW_SETTINGS_WINDOW);
|
||||
QObject::connect(mSettingsWindow, &QWindow::visibilityChanged, this, [](QWindow::Visibility visibility) {
|
||||
if (visibility == QWindow::Hidden) {
|
||||
qInfo() << QStringLiteral("Update nat policy.");
|
||||
|
|
@ -450,15 +450,14 @@ void App::initLocale () {
|
|||
// Try to use preferred locale.
|
||||
QString locale;
|
||||
string configPath = Paths::getConfigFilePath(mParser->value("config"), false);
|
||||
if (Paths::filePathExists(configPath)) {
|
||||
if (Paths::filePathExists(configPath))
|
||||
locale = ::Utils::coreStringToAppString(
|
||||
linphone::Config::newWithFactory(configPath, "")->getString(
|
||||
SettingsModel::UI_SECTION, "locale", ""
|
||||
)
|
||||
);
|
||||
}
|
||||
linphone::Config::newWithFactory(configPath, "")->getString(
|
||||
SettingsModel::UI_SECTION, "locale", ""
|
||||
)
|
||||
);
|
||||
|
||||
if (!locale.isEmpty() && installLocale(*this, *mTranslator, QLocale(locale))) {
|
||||
if (!locale.isEmpty() && ::installLocale(*this, *mTranslator, QLocale(locale))) {
|
||||
mLocale = locale;
|
||||
qInfo() << QStringLiteral("Use preferred locale: %1").arg(locale);
|
||||
return;
|
||||
|
|
@ -466,7 +465,7 @@ void App::initLocale () {
|
|||
|
||||
// Try to use system locale.
|
||||
QLocale sysLocale = QLocale::system();
|
||||
if (installLocale(*this, *mTranslator, sysLocale)) {
|
||||
if (::installLocale(*this, *mTranslator, sysLocale)) {
|
||||
mLocale = sysLocale.name();
|
||||
qInfo() << QStringLiteral("Use system locale: %1").arg(mLocale);
|
||||
return;
|
||||
|
|
@ -474,7 +473,7 @@ void App::initLocale () {
|
|||
|
||||
// Use english.
|
||||
mLocale = DEFAULT_LOCALE;
|
||||
if (!installLocale(*this, *mTranslator, QLocale(mLocale)))
|
||||
if (!::installLocale(*this, *mTranslator, QLocale(mLocale)))
|
||||
qFatal("Unable to install default translator.");
|
||||
qInfo() << QStringLiteral("Use default locale: %1").arg(mLocale);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ static void linphoneLog (const char *domain, OrtpLogLevel type, const char *fmt,
|
|||
else
|
||||
return;
|
||||
|
||||
QByteArray dateTime = getFormattedCurrentTime();
|
||||
QByteArray dateTime = ::getFormattedCurrentTime();
|
||||
char *msg = bctbx_strdup_vprintf(fmt, args);
|
||||
|
||||
fprintf(stderr, format, dateTime.constData(), domain ? domain : "linphone", msg);
|
||||
|
|
@ -140,7 +140,7 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
|
|||
#endif // ifdef QT_MESSAGELOGCONTEXT
|
||||
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
QByteArray dateTime = getFormattedCurrentTime();
|
||||
QByteArray dateTime = ::getFormattedCurrentTime();
|
||||
|
||||
mMutex.lock();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ inline bool dirPathExists (const QString &path) {
|
|||
|
||||
inline bool filePathExists (const QString &path) {
|
||||
QFileInfo info(path);
|
||||
if (!dirPathExists(info.path()))
|
||||
if (!::dirPathExists(info.path()))
|
||||
return false;
|
||||
|
||||
QFile file(path);
|
||||
|
|
@ -74,7 +74,7 @@ inline void ensureDirPathExists (const QString &path) {
|
|||
|
||||
inline void ensureFilePathExists (const QString &path) {
|
||||
QFileInfo info(path);
|
||||
ensureDirPathExists(info.path());
|
||||
::ensureDirPathExists(info.path());
|
||||
|
||||
QFile file(path);
|
||||
if (!file.exists() && !file.open(QIODevice::ReadWrite))
|
||||
|
|
@ -86,8 +86,8 @@ inline string getReadableDirPath (const QString &dirname) {
|
|||
}
|
||||
|
||||
inline string getWritableDirPath (const QString &dirname) {
|
||||
ensureDirPathExists(dirname);
|
||||
return getReadableDirPath(dirname);
|
||||
::ensureDirPathExists(dirname);
|
||||
return ::getReadableDirPath(dirname);
|
||||
}
|
||||
|
||||
inline string getReadableFilePath (const QString &filename) {
|
||||
|
|
@ -95,8 +95,8 @@ inline string getReadableFilePath (const QString &filename) {
|
|||
}
|
||||
|
||||
inline string getWritableFilePath (const QString &filename) {
|
||||
ensureFilePathExists(filename);
|
||||
return getReadableFilePath(filename);
|
||||
::ensureFilePathExists(filename);
|
||||
return ::getReadableFilePath(filename);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -112,19 +112,19 @@ inline QDir getAppPackageDir () {
|
|||
}
|
||||
|
||||
inline QString getAppPackageDataDirPath () {
|
||||
QDir dir = getAppPackageDir();
|
||||
QDir dir = ::getAppPackageDir();
|
||||
dir.cd("share");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
inline QString getAppPackageMsPluginsDirPath () {
|
||||
QDir dir = getAppPackageDir();
|
||||
QDir dir = ::getAppPackageDir();
|
||||
dir.cd(MSPLUGINS_DIR);
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
inline QString getAppAssistantConfigDirPath () {
|
||||
return getAppPackageDataDirPath() + PATH_ASSISTANT_CONFIG;
|
||||
return ::getAppPackageDataDirPath() + PATH_ASSISTANT_CONFIG;
|
||||
}
|
||||
|
||||
inline QString getAppConfigFilePath () {
|
||||
|
|
@ -136,11 +136,11 @@ inline QString getAppCallHistoryFilePath () {
|
|||
}
|
||||
|
||||
inline QString getAppFactoryConfigFilePath () {
|
||||
return getAppPackageDataDirPath() + PATH_FACTORY_CONFIG;
|
||||
return ::getAppPackageDataDirPath() + PATH_FACTORY_CONFIG;
|
||||
}
|
||||
|
||||
inline QString getAppRootCaFilePath () {
|
||||
return getAppPackageDataDirPath() + PATH_ROOT_CA;
|
||||
return ::getAppPackageDataDirPath() + PATH_ROOT_CA;
|
||||
}
|
||||
|
||||
inline QString getAppFriendsFilePath () {
|
||||
|
|
@ -154,84 +154,84 @@ inline QString getAppMessageHistoryFilePath () {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool Paths::filePathExists (const string &path) {
|
||||
return filePathExists(Utils::coreStringToAppString(path));
|
||||
return ::filePathExists(Utils::coreStringToAppString(path));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
string Paths::getAssistantConfigDirPath () {
|
||||
return getReadableDirPath(getAppAssistantConfigDirPath());
|
||||
return ::getReadableDirPath(::getAppAssistantConfigDirPath());
|
||||
}
|
||||
|
||||
string Paths::getAvatarsDirPath () {
|
||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_AVATARS);
|
||||
return ::getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_AVATARS);
|
||||
}
|
||||
|
||||
string Paths::getCallHistoryFilePath () {
|
||||
return getWritableFilePath(getAppCallHistoryFilePath());
|
||||
return ::getWritableFilePath(::getAppCallHistoryFilePath());
|
||||
}
|
||||
|
||||
string Paths::getCapturesDirPath () {
|
||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
|
||||
return ::getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
|
||||
}
|
||||
|
||||
string Paths::getConfigFilePath (const QString &configPath, bool writable) {
|
||||
const QString &path = configPath.isEmpty()
|
||||
? getAppConfigFilePath()
|
||||
? ::getAppConfigFilePath()
|
||||
: QFileInfo(configPath).absoluteFilePath();
|
||||
|
||||
return writable ? getWritableFilePath(path) : getReadableFilePath(path);
|
||||
return writable ? ::getWritableFilePath(path) : ::getReadableFilePath(path);
|
||||
}
|
||||
|
||||
string Paths::getFactoryConfigFilePath () {
|
||||
return getReadableFilePath(getAppFactoryConfigFilePath());
|
||||
return ::getReadableFilePath(::getAppFactoryConfigFilePath());
|
||||
}
|
||||
|
||||
string Paths::getFriendsListFilePath () {
|
||||
return getWritableFilePath(getAppFriendsFilePath());
|
||||
return ::getWritableFilePath(::getAppFriendsFilePath());
|
||||
}
|
||||
|
||||
string Paths::getDownloadDirPath () {
|
||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||
return ::getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||
}
|
||||
|
||||
string Paths::getLogsDirPath () {
|
||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_LOGS);
|
||||
return ::getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_LOGS);
|
||||
}
|
||||
|
||||
string Paths::getMessageHistoryFilePath () {
|
||||
return getWritableFilePath(getAppMessageHistoryFilePath());
|
||||
return ::getWritableFilePath(::getAppMessageHistoryFilePath());
|
||||
}
|
||||
|
||||
string Paths::getPackageDataDirPath () {
|
||||
return getReadableDirPath(getAppPackageDataDirPath());
|
||||
return ::getReadableDirPath(::getAppPackageDataDirPath());
|
||||
}
|
||||
|
||||
string Paths::getPackageMsPluginsDirPath () {
|
||||
return getReadableDirPath(getAppPackageMsPluginsDirPath());
|
||||
return ::getReadableDirPath(::getAppPackageMsPluginsDirPath());
|
||||
}
|
||||
|
||||
string Paths::getRootCaFilePath () {
|
||||
return getReadableFilePath(getAppRootCaFilePath());
|
||||
return ::getReadableFilePath(::getAppRootCaFilePath());
|
||||
}
|
||||
|
||||
string Paths::getThumbnailsDirPath () {
|
||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS);
|
||||
return ::getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS);
|
||||
}
|
||||
|
||||
string Paths::getUserCertificatesDirPath () {
|
||||
return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
|
||||
return ::getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
|
||||
}
|
||||
|
||||
string Paths::getZrtpSecretsFilePath () {
|
||||
return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_ZRTP_SECRETS);
|
||||
return ::getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_ZRTP_SECRETS);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void migrateFile (const QString &oldPath, const QString &newPath) {
|
||||
QFileInfo info(newPath);
|
||||
ensureDirPathExists(info.path());
|
||||
::ensureDirPathExists(info.path());
|
||||
|
||||
if (QFile::copy(oldPath, newPath)) {
|
||||
QFile::remove(oldPath);
|
||||
|
|
@ -243,7 +243,7 @@ static void migrateFile (const QString &oldPath, const QString &newPath) {
|
|||
|
||||
static void migrateConfigurationFile (const QString &oldPath, const QString &newPath) {
|
||||
QFileInfo info(newPath);
|
||||
ensureDirPathExists(info.path());
|
||||
::ensureDirPathExists(info.path());
|
||||
|
||||
if (QFile::copy(oldPath, newPath)) {
|
||||
QFile oldFile(oldPath);
|
||||
|
|
@ -268,33 +268,33 @@ static void setRlsUri (const QString &configPath) {
|
|||
}
|
||||
|
||||
void Paths::migrate () {
|
||||
QString newPath = getAppConfigFilePath();
|
||||
QString newPath = ::getAppConfigFilePath();
|
||||
QString oldBaseDir = QSysInfo::productType() == "windows"
|
||||
? QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
|
||||
: QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
QString oldPath = oldBaseDir + "/.linphonerc";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath)) {
|
||||
if (!::filePathExists(newPath) && ::filePathExists(oldPath)) {
|
||||
migrateConfigurationFile(oldPath, newPath);
|
||||
/* Define RLS uri so that presence switches from peer-to-peer mode to list mode. */
|
||||
setRlsUri(newPath);
|
||||
}
|
||||
|
||||
newPath = getAppCallHistoryFilePath();
|
||||
newPath = ::getAppCallHistoryFilePath();
|
||||
oldPath = oldBaseDir + "/.linphone-call-history.db";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!::filePathExists(newPath) && ::filePathExists(oldPath))
|
||||
migrateFile(oldPath, newPath);
|
||||
|
||||
newPath = getAppFriendsFilePath();
|
||||
newPath = ::getAppFriendsFilePath();
|
||||
oldPath = oldBaseDir + "/.linphone-friends.db";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!::filePathExists(newPath) && ::filePathExists(oldPath))
|
||||
migrateFile(oldPath, newPath);
|
||||
|
||||
newPath = getAppMessageHistoryFilePath();
|
||||
newPath = ::getAppMessageHistoryFilePath();
|
||||
oldPath = oldBaseDir + "/.linphone-history.db";
|
||||
|
||||
if (!filePathExists(newPath) && filePathExists(oldPath))
|
||||
if (!::filePathExists(newPath) && ::filePathExists(oldPath))
|
||||
migrateFile(oldPath, newPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,19 +595,19 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
|
||||
statsList.clear();
|
||||
|
||||
statsList << createStat(tr("callStatsCodec"), payloadType
|
||||
statsList << ::createStat(tr("callStatsCodec"), payloadType
|
||||
? QString("%1 / %2kHz").arg(Utils::coreStringToAppString(payloadType->getMimeType())).arg(payloadType->getClockRate() / 1000)
|
||||
: "");
|
||||
statsList << createStat(tr("callStatsUploadBandwidth"), QString("%1 kbits/s").arg(int(callStats->getUploadBandwidth())));
|
||||
statsList << createStat(tr("callStatsDownloadBandwidth"), QString("%1 kbits/s").arg(int(callStats->getDownloadBandwidth())));
|
||||
statsList << createStat(tr("callStatsIceState"), iceStateToString(callStats->getIceState()));
|
||||
statsList << createStat(tr("callStatsIpFamily"), family);
|
||||
statsList << createStat(tr("callStatsSenderLossRate"), QString("%1 %").arg(callStats->getSenderLossRate()));
|
||||
statsList << createStat(tr("callStatsReceiverLossRate"), QString("%1 %").arg(callStats->getReceiverLossRate()));
|
||||
statsList << ::createStat(tr("callStatsUploadBandwidth"), QString("%1 kbits/s").arg(int(callStats->getUploadBandwidth())));
|
||||
statsList << ::createStat(tr("callStatsDownloadBandwidth"), QString("%1 kbits/s").arg(int(callStats->getDownloadBandwidth())));
|
||||
statsList << ::createStat(tr("callStatsIceState"), iceStateToString(callStats->getIceState()));
|
||||
statsList << ::createStat(tr("callStatsIpFamily"), family);
|
||||
statsList << ::createStat(tr("callStatsSenderLossRate"), QString("%1 %").arg(callStats->getSenderLossRate()));
|
||||
statsList << ::createStat(tr("callStatsReceiverLossRate"), QString("%1 %").arg(callStats->getReceiverLossRate()));
|
||||
|
||||
switch (callStats->getType()) {
|
||||
case linphone::StreamTypeAudio:
|
||||
statsList << createStat(tr("callStatsJitterBuffer"), QString("%1 ms").arg(callStats->getJitterBufferSizeMs()));
|
||||
statsList << ::createStat(tr("callStatsJitterBuffer"), QString("%1 ms").arg(callStats->getJitterBufferSizeMs()));
|
||||
break;
|
||||
case linphone::StreamTypeVideo: {
|
||||
QString sentVideoDefinitionName = ::Utils::coreStringToAppString(params->getSentVideoDefinition()->getName());
|
||||
|
|
@ -615,7 +615,7 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
.arg(params->getSentVideoDefinition()->getWidth())
|
||||
.arg(params->getSentVideoDefinition()->getHeight());
|
||||
|
||||
statsList << createStat(tr("callStatsSentVideoDefinition"), sentVideoDefinition == sentVideoDefinitionName
|
||||
statsList << ::createStat(tr("callStatsSentVideoDefinition"), sentVideoDefinition == sentVideoDefinitionName
|
||||
? sentVideoDefinition
|
||||
: QString("%1 (%2)").arg(sentVideoDefinition).arg(sentVideoDefinitionName));
|
||||
|
||||
|
|
@ -624,7 +624,7 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
.arg(params->getReceivedVideoDefinition()->getWidth())
|
||||
.arg(params->getReceivedVideoDefinition()->getHeight());
|
||||
|
||||
statsList << createStat(tr("callStatsReceivedVideoDefinition"), receivedVideoDefinition == receivedVideoDefinitionName
|
||||
statsList << ::createStat(tr("callStatsReceivedVideoDefinition"), receivedVideoDefinition == receivedVideoDefinitionName
|
||||
? receivedVideoDefinition
|
||||
: QString("%1 (%2)").arg(receivedVideoDefinition).arg(receivedVideoDefinitionName));
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ inline int findCallIndex (QList<CallModel *> &list, const shared_ptr<linphone::C
|
|||
}
|
||||
|
||||
inline int findCallIndex (QList<CallModel *> &list, const CallModel &callModel) {
|
||||
return findCallIndex(list, callModel.getCall());
|
||||
return ::findCallIndex(list, callModel.getCall());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -150,7 +150,7 @@ void CallsListModel::handleCallStateChanged (const shared_ptr<linphone::Call> &c
|
|||
break;
|
||||
|
||||
case linphone::CallStateStreamsRunning: {
|
||||
int index = findCallIndex(mList, call);
|
||||
int index = ::findCallIndex(mList, call);
|
||||
emit callRunning(index, &call->getData<CallModel>("call-model"));
|
||||
} break;
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
|
|||
|
||||
// This connection is (only) useful for `CallsListProxyModel`.
|
||||
QObject::connect(callModel, &CallModel::isInConferenceChanged, this, [this, callModel](bool) {
|
||||
int id = findCallIndex(mList, *callModel);
|
||||
int id = ::findCallIndex(mList, *callModel);
|
||||
emit dataChanged(index(id, 0), index(id, 0));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ inline QString getDownloadPath (const shared_ptr<linphone::ChatMessage> &message
|
|||
}
|
||||
|
||||
inline bool fileWasDownloaded (const shared_ptr<linphone::ChatMessage> &message) {
|
||||
const QString &path = getDownloadPath(message);
|
||||
const QString &path = ::getDownloadPath(message);
|
||||
return !path.isEmpty() && QFileInfo(path).isFile();
|
||||
}
|
||||
|
||||
inline void fillThumbnailProperty (QVariantMap &dest, const shared_ptr<linphone::ChatMessage> &message) {
|
||||
QString fileId = getFileId(message);
|
||||
QString fileId = ::getFileId(message);
|
||||
if (!fileId.isEmpty() && !dest.contains("thumbnail"))
|
||||
dest["thumbnail"] = QStringLiteral("image://%1/%2")
|
||||
.arg(ThumbnailProvider::PROVIDER_ID).arg(fileId);
|
||||
|
|
@ -168,11 +168,11 @@ private:
|
|||
|
||||
// File message downloaded.
|
||||
if (state == linphone::ChatMessageStateFileTransferDone && !message->isOutgoing()) {
|
||||
createThumbnail(message);
|
||||
fillThumbnailProperty((*it).first, message);
|
||||
::createThumbnail(message);
|
||||
::fillThumbnailProperty((*it).first, message);
|
||||
|
||||
message->setAppdata(
|
||||
::Utils::appStringToCoreString(getFileId(message)) + ':' + message->getFileTransferFilepath()
|
||||
::Utils::appStringToCoreString(::getFileId(message)) + ':' + message->getFileTransferFilepath()
|
||||
);
|
||||
(*it).first["wasDownloaded"] = true;
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ void ChatModel::sendFileMessage (const QString &path) {
|
|||
message->setFileTransferFilepath(::Utils::appStringToCoreString(path));
|
||||
message->setListener(mMessageHandlers);
|
||||
|
||||
createThumbnail(message);
|
||||
::createThumbnail(message);
|
||||
|
||||
insertMessageAtEnd(message);
|
||||
mChatRoom->sendChatMessage(message);
|
||||
|
|
@ -462,7 +462,7 @@ void ChatModel::openFile (int id, bool showDirectory) {
|
|||
return;
|
||||
}
|
||||
|
||||
QFileInfo info(getDownloadPath(message));
|
||||
QFileInfo info(::getDownloadPath(message));
|
||||
QDesktopServices::openUrl(
|
||||
QUrl(QStringLiteral("file:///%1").arg(showDirectory ? info.absolutePath() : info.absoluteFilePath()))
|
||||
);
|
||||
|
|
@ -514,7 +514,7 @@ void ChatModel::fillMessageEntry (QVariantMap &dest, const shared_ptr<linphone::
|
|||
dest["fileName"] = ::Utils::coreStringToAppString(content->getName());
|
||||
dest["wasDownloaded"] = ::fileWasDownloaded(message);
|
||||
|
||||
fillThumbnailProperty(dest, message);
|
||||
::fillThumbnailProperty(dest, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ void ChatModel::removeEntry (ChatEntryData &pair) {
|
|||
switch (type) {
|
||||
case ChatModel::MessageEntry: {
|
||||
shared_ptr<linphone::ChatMessage> message = static_pointer_cast<linphone::ChatMessage>(pair.second);
|
||||
removeFileMessageThumbnail(message);
|
||||
::removeFileMessageThumbnail(message);
|
||||
mChatRoom->deleteMessage(message);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void AbstractCodecsModel::enableCodec (int id, bool status) {
|
|||
Q_ASSERT(id >= 0 && id < mCodecs.count());
|
||||
|
||||
QVariantMap &map = mCodecs[id];
|
||||
shared_ptr<linphone::PayloadType> codec = getCodecFromMap(map);
|
||||
shared_ptr<linphone::PayloadType> codec = ::getCodecFromMap(map);
|
||||
|
||||
codec->enable(status);
|
||||
map["enabled"] = codec->enabled();
|
||||
|
|
@ -81,7 +81,7 @@ void AbstractCodecsModel::setBitrate (int id, int bitrate) {
|
|||
Q_ASSERT(id >= 0 && id < mCodecs.count());
|
||||
|
||||
QVariantMap &map = mCodecs[id];
|
||||
shared_ptr<linphone::PayloadType> codec = getCodecFromMap(map);
|
||||
shared_ptr<linphone::PayloadType> codec = ::getCodecFromMap(map);
|
||||
|
||||
codec->setNormalBitrate(bitrate);
|
||||
map["bitrate"] = codec->getNormalBitrate();
|
||||
|
|
@ -93,7 +93,7 @@ void AbstractCodecsModel::setRecvFmtp (int id, const QString &recvFmtp) {
|
|||
Q_ASSERT(id >= 0 && id < mCodecs.count());
|
||||
|
||||
QVariantMap &map = mCodecs[id];
|
||||
shared_ptr<linphone::PayloadType> codec = getCodecFromMap(map);
|
||||
shared_ptr<linphone::PayloadType> codec = ::getCodecFromMap(map);
|
||||
|
||||
codec->setRecvFmtp(::Utils::appStringToCoreString(recvFmtp));
|
||||
map["recvFmtp"] = ::Utils::coreStringToAppString(codec->getRecvFmtp());
|
||||
|
|
@ -141,7 +141,7 @@ bool AbstractCodecsModel::moveRows (
|
|||
// Update linphone codecs list.
|
||||
list<shared_ptr<linphone::PayloadType> > codecs;
|
||||
for (const auto &map : mCodecs)
|
||||
codecs.push_back(getCodecFromMap(map));
|
||||
codecs.push_back(::getCodecFromMap(map));
|
||||
updateCodecs(codecs);
|
||||
|
||||
endMoveRows();
|
||||
|
|
|
|||
|
|
@ -44,18 +44,16 @@ using namespace std;
|
|||
|
||||
template<class T>
|
||||
inline shared_ptr<T> findBelCardValue (const list<shared_ptr<T> > &list, const string &value) {
|
||||
auto it = find_if(
|
||||
list.cbegin(), list.cend(), [&value](const shared_ptr<T> &entry) {
|
||||
auto it = find_if(list.cbegin(), list.cend(), [&value](const shared_ptr<T> &entry) {
|
||||
return value == entry->getValue();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return it != list.cend() ? *it : nullptr;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline shared_ptr<T> findBelCardValue (const list<shared_ptr<T> > &list, const QString &value) {
|
||||
return findBelCardValue(list, ::Utils::appStringToCoreString(value));
|
||||
return ::findBelCardValue(list, ::Utils::appStringToCoreString(value));
|
||||
}
|
||||
|
||||
inline bool isLinphoneDesktopPhoto (const shared_ptr<belcard::BelCardPhoto> &photo) {
|
||||
|
|
@ -64,7 +62,7 @@ inline bool isLinphoneDesktopPhoto (const shared_ptr<belcard::BelCardPhoto> &pho
|
|||
|
||||
static shared_ptr<belcard::BelCardPhoto> findBelcardPhoto (const shared_ptr<belcard::BelCard> &belcard) {
|
||||
const list<shared_ptr<belcard::BelCardPhoto> > &photos = belcard->getPhotos();
|
||||
auto it = find_if(photos.cbegin(), photos.cend(), isLinphoneDesktopPhoto);
|
||||
auto it = find_if(photos.cbegin(), photos.cend(), ::isLinphoneDesktopPhoto);
|
||||
if (it != photos.cend())
|
||||
return *it;
|
||||
|
||||
|
|
@ -74,7 +72,7 @@ static shared_ptr<belcard::BelCardPhoto> findBelcardPhoto (const shared_ptr<belc
|
|||
static void removeBelcardPhoto (const shared_ptr<belcard::BelCard> &belcard, bool cleanPathsOnly = false) {
|
||||
list<shared_ptr<belcard::BelCardPhoto> > photos;
|
||||
for (const auto photo : belcard->getPhotos()) {
|
||||
if (isLinphoneDesktopPhoto(photo))
|
||||
if (::isLinphoneDesktopPhoto(photo))
|
||||
photos.push_back(photo);
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +158,7 @@ bool VcardModel::setAvatar (const QString &path) {
|
|||
// not a application path like `image:`.
|
||||
if (!path.isEmpty()) {
|
||||
if (path.startsWith("image:"))
|
||||
fileId = getFileIdFromAppPath(path);
|
||||
fileId = ::getFileIdFromAppPath(path);
|
||||
else {
|
||||
file.setFileName(path);
|
||||
|
||||
|
|
@ -253,7 +251,7 @@ QVariantMap VcardModel::getAddress () const {
|
|||
void VcardModel::setStreet (const QString &street) {
|
||||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCardAddress> address = getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
shared_ptr<belcard::BelCardAddress> address = ::getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
address->setStreet(::Utils::appStringToCoreString(street));
|
||||
emit vcardUpdated();
|
||||
}
|
||||
|
|
@ -261,7 +259,7 @@ void VcardModel::setStreet (const QString &street) {
|
|||
void VcardModel::setLocality (const QString &locality) {
|
||||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCardAddress> address = getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
shared_ptr<belcard::BelCardAddress> address = ::getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
address->setLocality(::Utils::appStringToCoreString(locality));
|
||||
emit vcardUpdated();
|
||||
}
|
||||
|
|
@ -269,7 +267,7 @@ void VcardModel::setLocality (const QString &locality) {
|
|||
void VcardModel::setPostalCode (const QString &postalCode) {
|
||||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCardAddress> address = getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
shared_ptr<belcard::BelCardAddress> address = ::getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
address->setPostalCode(::Utils::appStringToCoreString(postalCode));
|
||||
emit vcardUpdated();
|
||||
}
|
||||
|
|
@ -277,7 +275,7 @@ void VcardModel::setPostalCode (const QString &postalCode) {
|
|||
void VcardModel::setCountry (const QString &country) {
|
||||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCardAddress> address = getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
shared_ptr<belcard::BelCardAddress> address = ::getOrCreateBelCardAddress(mVcard->getVcard());
|
||||
address->setCountry(::Utils::appStringToCoreString(country));
|
||||
emit vcardUpdated();
|
||||
}
|
||||
|
|
@ -311,7 +309,7 @@ bool VcardModel::addSipAddress (const QString &sipAddress) {
|
|||
|
||||
// Add sip address in belcard.
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
if (findBelCardValue(belcard->getImpp(), interpretedSipAddress))
|
||||
if (::findBelCardValue(belcard->getImpp(), interpretedSipAddress))
|
||||
return false;
|
||||
|
||||
shared_ptr<belcard::BelCardImpp> value = belcard::BelCardGeneric::create<belcard::BelCardImpp>();
|
||||
|
|
@ -333,7 +331,7 @@ void VcardModel::removeSipAddress (const QString &sipAddress) {
|
|||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
list<shared_ptr<belcard::BelCardImpp> > addresses = belcard->getImpp();
|
||||
shared_ptr<belcard::BelCardImpp> value = findBelCardValue(
|
||||
shared_ptr<belcard::BelCardImpp> value = ::findBelCardValue(
|
||||
addresses, ::Utils::coreStringToAppString(interpretSipAddress(sipAddress))
|
||||
);
|
||||
|
||||
|
|
@ -375,7 +373,7 @@ bool VcardModel::addCompany (const QString &company) {
|
|||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
if (findBelCardValue(belcard->getRoles(), company))
|
||||
if (::findBelCardValue(belcard->getRoles(), company))
|
||||
return false;
|
||||
|
||||
shared_ptr<belcard::BelCardRole> value = belcard::BelCardGeneric::create<belcard::BelCardRole>();
|
||||
|
|
@ -396,7 +394,7 @@ void VcardModel::removeCompany (const QString &company) {
|
|||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
shared_ptr<belcard::BelCardRole> value = findBelCardValue(belcard->getRoles(), company);
|
||||
shared_ptr<belcard::BelCardRole> value = ::findBelCardValue(belcard->getRoles(), company);
|
||||
|
||||
if (!value) {
|
||||
qWarning() << QStringLiteral("Unable to remove company on vcard: `%1`.").arg(company);
|
||||
|
|
@ -429,7 +427,7 @@ bool VcardModel::addEmail (const QString &email) {
|
|||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
if (findBelCardValue(belcard->getEmails(), email))
|
||||
if (::findBelCardValue(belcard->getEmails(), email))
|
||||
return false;
|
||||
|
||||
shared_ptr<belcard::BelCardEmail> value = belcard::BelCardGeneric::create<belcard::BelCardEmail>();
|
||||
|
|
@ -451,7 +449,7 @@ void VcardModel::removeEmail (const QString &email) {
|
|||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
shared_ptr<belcard::BelCardEmail> value = findBelCardValue(belcard->getEmails(), email);
|
||||
shared_ptr<belcard::BelCardEmail> value = ::findBelCardValue(belcard->getEmails(), email);
|
||||
|
||||
if (!value) {
|
||||
qWarning() << QStringLiteral("Unable to remove email on vcard: `%1`.").arg(email);
|
||||
|
|
@ -484,7 +482,7 @@ bool VcardModel::addUrl (const QString &url) {
|
|||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
if (findBelCardValue(belcard->getURLs(), url))
|
||||
if (::findBelCardValue(belcard->getURLs(), url))
|
||||
return false;
|
||||
|
||||
shared_ptr<belcard::BelCardURL> value = belcard::BelCardGeneric::create<belcard::BelCardURL>();
|
||||
|
|
@ -506,7 +504,7 @@ void VcardModel::removeUrl (const QString &url) {
|
|||
CHECK_VCARD_IS_WRITABLE(this);
|
||||
|
||||
shared_ptr<belcard::BelCard> belcard = mVcard->getVcard();
|
||||
shared_ptr<belcard::BelCardURL> value = findBelCardValue(belcard->getURLs(), url);
|
||||
shared_ptr<belcard::BelCardURL> value = ::findBelCardValue(belcard->getURLs(), url);
|
||||
|
||||
if (!value) {
|
||||
qWarning() << QStringLiteral("Unable to remove url on vcard: `%1`.").arg(url);
|
||||
|
|
|
|||
|
|
@ -77,19 +77,6 @@ using namespace std;
|
|||
|
||||
// =============================================================================
|
||||
|
||||
inline int getIntegerFromNotification (const QObject &object, const char *property) {
|
||||
QVariant variant = object.property(property);
|
||||
bool soFarSoGood;
|
||||
|
||||
int value = variant.toInt(&soFarSoGood);
|
||||
if (!soFarSoGood) {
|
||||
qWarning() << QStringLiteral("Unable to get int from: `%1`.").arg(property);
|
||||
abort();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void setProperty (QObject &object, const char *property, const T &value) {
|
||||
if (!object.setProperty(property, QVariant(value))) {
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ inline void addBuildStatus (QVariantList &list, Presence::PresenceStatus status)
|
|||
QVariantList OwnPresenceModel::getStatuses () const {
|
||||
QVariantList statuses;
|
||||
|
||||
addBuildStatus(statuses, Presence::Online);
|
||||
addBuildStatus(statuses, Presence::Busy);
|
||||
addBuildStatus(statuses, Presence::DoNotDisturb);
|
||||
addBuildStatus(statuses, Presence::Offline);
|
||||
::addBuildStatus(statuses, Presence::Online);
|
||||
::addBuildStatus(statuses, Presence::Busy);
|
||||
::addBuildStatus(statuses, Presence::DoNotDisturb);
|
||||
::addBuildStatus(statuses, Presence::Offline);
|
||||
|
||||
return statuses;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ QVariantMap AccountSettingsModel::getProxyConfigDescription (const shared_ptr<li
|
|||
map["registerEnabled"] = proxyConfig->registerEnabled();
|
||||
map["publishPresence"] = proxyConfig->publishEnabled();
|
||||
map["avpfEnabled"] = proxyConfig->getAvpfMode() == linphone::AVPFMode::AVPFModeEnabled;
|
||||
map["registrationState"] = mapLinphoneRegistrationStateToUi(proxyConfig->getState());
|
||||
map["registrationState"] = ::mapLinphoneRegistrationStateToUi(proxyConfig->getState());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
@ -215,7 +215,7 @@ QString AccountSettingsModel::getSipAddress () const {
|
|||
|
||||
AccountSettingsModel::RegistrationState AccountSettingsModel::getRegistrationState () const {
|
||||
shared_ptr<linphone::ProxyConfig> proxyConfig = CoreManager::getInstance()->getCore()->getDefaultProxyConfig();
|
||||
return proxyConfig ? mapLinphoneRegistrationStateToUi(proxyConfig->getState()) : RegistrationStateNotRegistered;
|
||||
return proxyConfig ? ::mapLinphoneRegistrationStateToUi(proxyConfig->getState()) : RegistrationStateNotRegistered;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -218,12 +218,12 @@ inline QVariantMap createMapFromVideoDefinition (const shared_ptr<const linphone
|
|||
QVariantList SettingsModel::getSupportedVideoDefinitions () const {
|
||||
QVariantList list;
|
||||
for (const auto &definition : linphone::Factory::get()->getSupportedVideoDefinitions())
|
||||
list << createMapFromVideoDefinition(definition);
|
||||
list << ::createMapFromVideoDefinition(definition);
|
||||
return list;
|
||||
}
|
||||
|
||||
QVariantMap SettingsModel::getVideoDefinition () const {
|
||||
return createMapFromVideoDefinition(CoreManager::getInstance()->getCore()->getPreferredVideoDefinition());
|
||||
return ::createMapFromVideoDefinition(CoreManager::getInstance()->getCore()->getPreferredVideoDefinition());
|
||||
}
|
||||
|
||||
void SettingsModel::setVideoDefinition (const QVariantMap &definition) {
|
||||
|
|
@ -290,13 +290,13 @@ QVariantList SettingsModel::getSupportedMediaEncryptions () const {
|
|||
QVariantList list;
|
||||
|
||||
if (core->mediaEncryptionSupported(linphone::MediaEncryptionDTLS))
|
||||
list << buildEncryptionDescription(MediaEncryptionDtls, "DTLS");
|
||||
list << ::buildEncryptionDescription(MediaEncryptionDtls, "DTLS");
|
||||
|
||||
if (core->mediaEncryptionSupported(linphone::MediaEncryptionSRTP))
|
||||
list << buildEncryptionDescription(MediaEncryptionSrtp, "SRTP");
|
||||
list << ::buildEncryptionDescription(MediaEncryptionSrtp, "SRTP");
|
||||
|
||||
if (core->mediaEncryptionSupported(linphone::MediaEncryptionZRTP))
|
||||
list << buildEncryptionDescription(MediaEncryptionZrtp, "ZRTP");
|
||||
list << ::buildEncryptionDescription(MediaEncryptionZrtp, "ZRTP");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue