Commit dc1cce15 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): replace `broghammerus_reticulatus` variables by `camelusBactrianus`

parent 48b5aff6
...@@ -64,23 +64,23 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) { ...@@ -64,23 +64,23 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) {
// List available locales. // List available locales.
for (const auto &locale : QDir(LANGUAGES_PATH).entryList()) for (const auto &locale : QDir(LANGUAGES_PATH).entryList())
m_available_locales << QLocale(locale); mAvailableLocales << QLocale(locale);
m_translator = new DefaultTranslator(this); mTranslator = new DefaultTranslator(this);
// Try to use system locale. // Try to use system locale.
QLocale sys_locale = QLocale::system(); QLocale sysLocale = QLocale::system();
if (installLocale(*this, *m_translator, sys_locale)) { if (installLocale(*this, *mTranslator, sysLocale)) {
m_locale = sys_locale.name(); mLocale = sysLocale.name();
qInfo() << QStringLiteral("Use system locale: %1").arg(m_locale); qInfo() << QStringLiteral("Use system locale: %1").arg(mLocale);
return; return;
} }
// Use english. // Use english.
m_locale = DEFAULT_LOCALE; mLocale = DEFAULT_LOCALE;
if (!installLocale(*this, *m_translator, QLocale(m_locale))) if (!installLocale(*this, *mTranslator, QLocale(mLocale)))
qFatal("Unable to install default translator."); qFatal("Unable to install default translator.");
qInfo() << QStringLiteral("Use default locale: %1").arg(m_locale); qInfo() << QStringLiteral("Use default locale: %1").arg(mLocale);
} }
App::~App () { App::~App () {
...@@ -108,29 +108,29 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) { ...@@ -108,29 +108,29 @@ inline QQuickWindow *createSubWindow (App *app, const char *path) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
inline void activeSplashScreen (App *app) { inline void activeSplashScreen (App *app) {
QQuickWindow *splash_screen = createSubWindow(app, QML_VIEW_SPLASH_SCREEN); QQuickWindow *splashScreen = createSubWindow(app, QML_VIEW_SPLASH_SCREEN);
QObject::connect(CoreManager::getInstance(), &CoreManager::linphoneCoreCreated, splash_screen, [splash_screen] { QObject::connect(CoreManager::getInstance(), &CoreManager::linphoneCoreCreated, splashScreen, [splashScreen] {
splash_screen->close(); splashScreen->close();
splash_screen->deleteLater(); splashScreen->deleteLater();
}); });
} }
void App::initContentApp () { void App::initContentApp () {
// Init core. // Init core.
CoreManager::init(this, m_parser.value("config")); CoreManager::init(this, mParser.value("config"));
qInfo() << "Activated selectors:" << QQmlFileSelector::get(&m_engine)->selector()->allSelectors(); qInfo() << "Activated selectors:" << QQmlFileSelector::get(&mEngine)->selector()->allSelectors();
// Provide `+custom` folders for custom components. // Provide `+custom` folders for custom components.
(new QQmlFileSelector(&m_engine, this))->setExtraSelectors(QStringList("custom")); (new QQmlFileSelector(&mEngine, this))->setExtraSelectors(QStringList("custom"));
// Set modules paths. // Set modules paths.
m_engine.addImportPath(":/ui/modules"); mEngine.addImportPath(":/ui/modules");
m_engine.addImportPath(":/ui/scripts"); mEngine.addImportPath(":/ui/scripts");
m_engine.addImportPath(":/ui/views"); mEngine.addImportPath(":/ui/views");
// Provide avatars/thumbnails providers. // Provide avatars/thumbnails providers.
m_engine.addImageProvider(AvatarProvider::PROVIDER_ID, new AvatarProvider()); mEngine.addImageProvider(AvatarProvider::PROVIDER_ID, new AvatarProvider());
m_engine.addImageProvider(ThumbnailProvider::PROVIDER_ID, new ThumbnailProvider()); mEngine.addImageProvider(ThumbnailProvider::PROVIDER_ID, new ThumbnailProvider());
// Don't quit if last window is closed!!! // Don't quit if last window is closed!!!
setQuitOnLastWindowClosed(false); setQuitOnLastWindowClosed(false);
...@@ -139,12 +139,12 @@ void App::initContentApp () { ...@@ -139,12 +139,12 @@ void App::initContentApp () {
registerTypes(); registerTypes();
// Enable notifications. // Enable notifications.
m_notifier = new Notifier(this); mNotifier = new Notifier(this);
// Load main view. // Load main view.
qInfo() << "Loading main view..."; qInfo() << "Loading main view...";
m_engine.load(QUrl(QML_VIEW_MAIN_WINDOW)); mEngine.load(QUrl(QML_VIEW_MAIN_WINDOW));
if (m_engine.rootObjects().isEmpty()) if (mEngine.rootObjects().isEmpty())
qFatal("Unable to open main window."); qFatal("Unable to open main window.");
// Load splashscreen. // Load splashscreen.
...@@ -153,7 +153,7 @@ void App::initContentApp () { ...@@ -153,7 +153,7 @@ void App::initContentApp () {
QObject::connect( QObject::connect(
CoreManager::getInstance(), CoreManager::getInstance(),
&CoreManager::linphoneCoreCreated, &CoreManager::linphoneCoreCreated,
this, m_parser.isSet("selftest") ? &App::quit : &App::openAppAfterInit this, mParser.isSet("selftest") ? &App::quit : &App::openAppAfterInit
); );
QObject::connect( QObject::connect(
...@@ -167,10 +167,10 @@ void App::initContentApp () { ...@@ -167,10 +167,10 @@ void App::initContentApp () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void App::parseArgs () { void App::parseArgs () {
m_parser.setApplicationDescription(tr("applicationDescription")); mParser.setApplicationDescription(tr("applicationDescription"));
m_parser.addHelpOption(); mParser.addHelpOption();
m_parser.addVersionOption(); mParser.addVersionOption();
m_parser.addOptions({ mParser.addOptions({
{ "config", tr("commandLineOptionConfig"), "file" }, { "config", tr("commandLineOptionConfig"), "file" },
#ifndef __APPLE__ #ifndef __APPLE__
{ "iconified", tr("commandLineOptionIconified") }, { "iconified", tr("commandLineOptionIconified") },
...@@ -179,13 +179,13 @@ void App::parseArgs () { ...@@ -179,13 +179,13 @@ void App::parseArgs () {
{ { "V", "verbose" }, tr("commandLineOptionVerbose") } { { "V", "verbose" }, tr("commandLineOptionVerbose") }
}); });
m_parser.process(*this); mParser.process(*this);
// Initialize logger. (Do not do this before this point because the // Initialize logger. (Do not do this before this point because the
// application has to be created for the logs to be put in the correct // application has to be created for the logs to be put in the correct
// directory.) // directory.)
Logger::init(); Logger::init();
if (m_parser.isSet("verbose")) { if (mParser.isSet("verbose")) {
Logger::getInstance()->setVerbose(true); Logger::getInstance()->setVerbose(true);
} }
} }
...@@ -200,9 +200,9 @@ void App::tryToUsePreferredLocale () { ...@@ -200,9 +200,9 @@ void App::tryToUsePreferredLocale () {
if (installLocale(*this, *translator, QLocale(locale))) { if (installLocale(*this, *translator, QLocale(locale))) {
// Use config. // Use config.
m_translator->deleteLater(); mTranslator->deleteLater();
m_translator = translator; mTranslator = translator;
m_locale = locale; mLocale = locale;
qInfo() << QStringLiteral("Use preferred locale: %1").arg(locale); qInfo() << QStringLiteral("Use preferred locale: %1").arg(locale);
} else { } else {
...@@ -216,23 +216,23 @@ void App::tryToUsePreferredLocale () { ...@@ -216,23 +216,23 @@ void App::tryToUsePreferredLocale () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
QQuickWindow *App::getCallsWindow () { QQuickWindow *App::getCallsWindow () {
if (!m_calls_window) if (!mCallsWindow)
m_calls_window = createSubWindow(this, QML_VIEW_CALLS_WINDOW); mCallsWindow = createSubWindow(this, QML_VIEW_CALLS_WINDOW);
return m_calls_window; return mCallsWindow;
} }
QQuickWindow *App::getMainWindow () const { QQuickWindow *App::getMainWindow () const {
return qobject_cast<QQuickWindow *>( return qobject_cast<QQuickWindow *>(
const_cast<QQmlApplicationEngine *>(&m_engine)->rootObjects().at(0) const_cast<QQmlApplicationEngine *>(&mEngine)->rootObjects().at(0)
); );
} }
QQuickWindow *App::getSettingsWindow () { QQuickWindow *App::getSettingsWindow () {
if (!m_settings_window) { if (!mSettingsWindow) {
m_settings_window = createSubWindow(this, QML_VIEW_SETTINGS_WINDOW); mSettingsWindow = createSubWindow(this, QML_VIEW_SETTINGS_WINDOW);
QObject::connect( QObject::connect(
m_settings_window, &QWindow::visibilityChanged, this, [](QWindow::Visibility visibility) { mSettingsWindow, &QWindow::visibilityChanged, this, [](QWindow::Visibility visibility) {
if (visibility == QWindow::Hidden) { if (visibility == QWindow::Hidden) {
qInfo() << "Update nat policy."; qInfo() << "Update nat policy.";
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore(); shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
...@@ -242,13 +242,13 @@ QQuickWindow *App::getSettingsWindow () { ...@@ -242,13 +242,13 @@ QQuickWindow *App::getSettingsWindow () {
); );
} }
return m_settings_window; return mSettingsWindow;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool App::hasFocus () const { bool App::hasFocus () const {
return getMainWindow()->isActive() || (m_calls_window && m_calls_window->isActive()); return getMainWindow()->isActive() || (mCallsWindow && mCallsWindow->isActive());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -319,19 +319,19 @@ void App::registerTypes () { ...@@ -319,19 +319,19 @@ void App::registerTypes () {
void App::setTrayIcon () { void App::setTrayIcon () {
QQuickWindow *root = getMainWindow(); QQuickWindow *root = getMainWindow();
QSystemTrayIcon *system_tray_icon = new QSystemTrayIcon(root); QSystemTrayIcon *systemTrayIcon = new QSystemTrayIcon(root);
// trayIcon: Right click actions. // trayIcon: Right click actions.
QAction *quit_action = new QAction("Quit", root); QAction *quitAction = new QAction("Quit", root);
root->connect(quit_action, &QAction::triggered, this, &App::quit); root->connect(quitAction, &QAction::triggered, this, &App::quit);
QAction *restore_action = new QAction("Restore", root); QAction *restoreAction = new QAction("Restore", root);
root->connect(restore_action, &QAction::triggered, root, &QQuickWindow::showNormal); root->connect(restoreAction, &QAction::triggered, root, &QQuickWindow::showNormal);
// trayIcon: Left click actions. // trayIcon: Left click actions.
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
root->connect( root->connect(
system_tray_icon, &QSystemTrayIcon::activated, [root]( systemTrayIcon, &QSystemTrayIcon::activated, [root](
QSystemTrayIcon::ActivationReason reason QSystemTrayIcon::ActivationReason reason
) { ) {
if (reason == QSystemTrayIcon::Trigger) { if (reason == QSystemTrayIcon::Trigger) {
...@@ -344,14 +344,14 @@ void App::setTrayIcon () { ...@@ -344,14 +344,14 @@ void App::setTrayIcon () {
); );
// Build trayIcon menu. // Build trayIcon menu.
menu->addAction(restore_action); menu->addAction(restoreAction);
menu->addSeparator(); menu->addSeparator();
menu->addAction(quit_action); menu->addAction(quitAction);
system_tray_icon->setContextMenu(menu); systemTrayIcon->setContextMenu(menu);
system_tray_icon->setIcon(QIcon(WINDOW_ICON_PATH)); systemTrayIcon->setIcon(QIcon(WINDOW_ICON_PATH));
system_tray_icon->setToolTip("Linphone"); systemTrayIcon->setToolTip("Linphone");
system_tray_icon->show(); systemTrayIcon->show();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -373,7 +373,7 @@ void App::setConfigLocale (const QString &locale) { ...@@ -373,7 +373,7 @@ void App::setConfigLocale (const QString &locale) {
} }
QString App::getLocale () const { QString App::getLocale () const {
return m_locale; return mLocale;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -391,7 +391,7 @@ void App::openAppAfterInit () { ...@@ -391,7 +391,7 @@ void App::openAppAfterInit () {
else else
setTrayIcon(); setTrayIcon();
if (!m_parser.isSet("iconified")) if (!mParser.isSet("iconified"))
getMainWindow()->showNormal(); getMainWindow()->showNormal();
#else #else
getMainWindow()->showNormal(); getMainWindow()->showNormal();
...@@ -401,7 +401,7 @@ void App::openAppAfterInit () { ...@@ -401,7 +401,7 @@ void App::openAppAfterInit () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void App::quit () { void App::quit () {
if (m_parser.isSet("selftest")) if (mParser.isSet("selftest"))
cout << tr("selftestResult").toStdString() << endl; cout << tr("selftestResult").toStdString() << endl;
QApplication::quit(); QApplication::quit();
......
...@@ -51,11 +51,11 @@ public: ...@@ -51,11 +51,11 @@ public:
void tryToUsePreferredLocale (); void tryToUsePreferredLocale ();
QQmlEngine *getEngine () { QQmlEngine *getEngine () {
return &m_engine; return &mEngine;
} }
Notifier *getNotifier () const { Notifier *getNotifier () const {
return m_notifier; return mNotifier;
} }
QQuickWindow *getCallsWindow (); QQuickWindow *getCallsWindow ();
...@@ -85,23 +85,23 @@ private: ...@@ -85,23 +85,23 @@ private:
QString getLocale () const; QString getLocale () const;
QVariantList getAvailableLocales () const { QVariantList getAvailableLocales () const {
return m_available_locales; return mAvailableLocales;
} }
void openAppAfterInit (); void openAppAfterInit ();
QCommandLineParser m_parser; QCommandLineParser mParser;
QVariantList m_available_locales; QVariantList mAvailableLocales;
QString m_locale; QString mLocale;
QQmlApplicationEngine m_engine; QQmlApplicationEngine mEngine;
DefaultTranslator *m_translator = nullptr; DefaultTranslator *mTranslator = nullptr;
Notifier *m_notifier = nullptr; Notifier *mNotifier = nullptr;
QQuickWindow *m_calls_window = nullptr; QQuickWindow *mCallsWindow = nullptr;
QQuickWindow *m_settings_window = nullptr; QQuickWindow *mSettingsWindow = nullptr;
}; };
#endif // APP_H_ #endif // APP_H_
...@@ -55,9 +55,9 @@ using namespace std; ...@@ -55,9 +55,9 @@ using namespace std;
// ============================================================================= // =============================================================================
QMutex Logger::m_mutex; QMutex Logger::mMutex;
Logger *Logger::m_instance = nullptr; Logger *Logger::mInstance = nullptr;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -79,10 +79,10 @@ static void linphoneLog (const char *domain, OrtpLogLevel type, const char *fmt, ...@@ -79,10 +79,10 @@ static void linphoneLog (const char *domain, OrtpLogLevel type, const char *fmt,
else else
return; return;
QByteArray date_time = QDateTime::currentDateTime().toString("HH:mm:ss").toLocal8Bit(); QByteArray dateTime = QDateTime::currentDateTime().toString("HH:mm:ss").toLocal8Bit();
char *msg = bctbx_strdup_vprintf(fmt, args); char *msg = bctbx_strdup_vprintf(fmt, args);
fprintf(stderr, format, date_time.constData(), domain, msg); fprintf(stderr, format, dateTime.constData(), domain, msg);
bctbx_free(msg); bctbx_free(msg);
...@@ -133,15 +133,15 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri ...@@ -133,15 +133,15 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
#endif // ifdef QT_MESSAGELOGCONTEXT #endif // ifdef QT_MESSAGELOGCONTEXT
QByteArray local_msg = msg.toLocal8Bit(); QByteArray localMsg = msg.toLocal8Bit();
QByteArray date_time = QDateTime::currentDateTime().toString("HH:mm:ss").toLocal8Bit(); QByteArray dateTime = QDateTime::currentDateTime().toString("HH:mm:ss").toLocal8Bit();
m_mutex.lock(); mMutex.lock();
fprintf(stderr, format, date_time.constData(), context_str, local_msg.constData()); fprintf(stderr, format, dateTime.constData(), context_str, localMsg.constData());
bctbx_log(QT_DOMAIN, level, "QT: %s%s", context_str, local_msg.constData()); bctbx_log(QT_DOMAIN, level, "QT: %s%s", context_str, localMsg.constData());
m_mutex.unlock(); mMutex.unlock();
if (type == QtFatalMsg) if (type == QtFatalMsg)
abort(); abort();
...@@ -150,16 +150,16 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri ...@@ -150,16 +150,16 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Logger::init () { void Logger::init () {
if (m_instance) if (mInstance)
return; return;
m_instance = new Logger(); mInstance = new Logger();
qInstallMessageHandler(Logger::log); qInstallMessageHandler(Logger::log);
linphone_core_set_log_level(ORTP_MESSAGE); linphone_core_set_log_level(ORTP_MESSAGE);
linphone_core_set_log_handler( linphone_core_set_log_handler(
[](const char *domain, OrtpLogLevel type, const char *fmt, va_list args) { [](const char *domain, OrtpLogLevel type, const char *fmt, va_list args) {
if (m_instance->isVerbose()) if (mInstance->isVerbose())
linphoneLog(domain, type, fmt, args); linphoneLog(domain, type, fmt, args);
} }
); );
......
...@@ -32,17 +32,17 @@ public: ...@@ -32,17 +32,17 @@ public:
~Logger () = default; ~Logger () = default;
bool isVerbose () const { bool isVerbose () const {
return m_verbose; return mVerbose;
} }
void setVerbose (bool verbose) { void setVerbose (bool verbose) {
m_verbose = verbose; mVerbose = verbose;
} }
static void init (); static void init ();
static Logger *getInstance () { static Logger *getInstance () {
return m_instance; return mInstance;
} }
private: private:
...@@ -50,10 +50,10 @@ private: ...@@ -50,10 +50,10 @@ private:
static void log (QtMsgType type, const QMessageLogContext &context, const QString &msg); static void log (QtMsgType type, const QMessageLogContext &context, const QString &msg);
bool m_verbose = false; bool mVerbose = false;
static QMutex m_mutex; static QMutex mMutex;
static Logger *m_instance; static Logger *mInstance;
}; };
#endif // LOGGER_H_ #endif // LOGGER_H_
...@@ -168,9 +168,9 @@ string Paths::getCapturesDirpath () { ...@@ -168,9 +168,9 @@ string Paths::getCapturesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
} }
string Paths::getConfigFilepath (const QString &config_path) { string Paths::getConfigFilepath (const QString &configPath) {
if (!config_path.isEmpty()) if (!configPath.isEmpty())
return getWritableFilePath(QFileInfo(config_path).absoluteFilePath()); return getWritableFilePath(QFileInfo(configPath).absoluteFilePath());
return getWritableFilePath(getAppConfigFilepath()); return getWritableFilePath(getAppConfigFilepath());
} }
...@@ -221,61 +221,61 @@ string Paths::getZrtpSecretsFilepath () { ...@@ -221,61 +221,61 @@ string Paths::getZrtpSecretsFilepath () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
static void migrateFile (const QString &old_path, const QString &new_path) { static void migrateFile (const QString &oldPath, const QString &newPath) {
QFileInfo info(new_path); QFileInfo info(newPath);
ensureDirectoryPathExists(info.path()); ensureDirectoryPathExists(info.path());
if (QFile::copy(old_path, new_path)) { if (QFile::copy(oldPath, newPath)) {
QFile::remove(old_path); QFile::remove(oldPath);
qInfo() << "Migrated" << old_path << "to" << new_path; qInfo() << "Migrated" << oldPath << "to" << newPath;
} else { } else {
qWarning() << "Failed migration of" << old_path << "to" << new_path; qWarning() << "Failed migration of" << oldPath << "to" << newPath;
} }
} }
static void migrateConfigurationFile (const QString &old_path, const QString &new_path) { static void migrateConfigurationFile (const QString &oldPath, const QString &newPath) {
QFileInfo info(new_path); QFileInfo info(newPath);
ensureDirectoryPathExists(info.path()); ensureDirectoryPathExists(info.path());
if (QFile::copy(old_path, new_path)) { if (QFile::copy(oldPath, newPath)) {
QFile old_file(old_path); QFile oldFile(oldPath);
if (old_file.open(QIODevice::WriteOnly)) { if (oldFile.open(QIODevice::WriteOnly)) {
QTextStream stream(&old_file); QTextStream stream(&oldFile);
stream << "This file has been migrated to " << new_path; stream << "This file has been migrated to " << newPath;
} }
QFile::setPermissions(old_path, QFileDevice::ReadOwner); QFile::setPermissions(oldPath, QFileDevice::ReadOwner);
qInfo() << "Migrated" << old_path << "to" << new_path; qInfo() << "Migrated" << oldPath << "to" << newPath;
} else { } else {
qWarning() << "Failed migration of" << old_path << "to" << new_path; qWarning() << "Failed migration of" << oldPath << "to" << newPath;
} }
} }
void Paths::migrate () { void Paths::migrate () {
QString new_path = getAppConfigFilepath(); QString newPath = getAppConfigFilepath();
QString old_base_dir = QSysInfo::productType() == "windows" QString oldBaseDir = QSysInfo::productType() == "windows"
? QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) ? QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
: QStandardPaths::writableLocation(QStandardPaths::HomeLocation); : QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
QString old_path = old_base_dir + "/.linphonerc"; QString oldPath = oldBaseDir + "/.linphonerc";
if (!filePathExists(new_path) && filePathExists(old_path)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateConfigurationFile(old_path, new_path); migrateConfigurationFile(oldPath, newPath);
new_path = getAppCallHistoryFilepath(); newPath = getAppCallHistoryFilepath();
old_path = old_base_dir + "/.linphone-call-history.db"; oldPath = oldBaseDir + "/.linphone-call-history.db";
if (!filePathExists(new_path) && filePathExists(old_path)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateFile(old_path, new_path); migrateFile(oldPath, newPath);
new_path = getAppFriendsFilepath(); newPath = getAppFriendsFilepath();
old_path = old_base_dir + "/.linphone-friends.db"; oldPath = oldBaseDir + "/.linphone-friends.db";
if (!filePathExists(new_path) && filePathExists(old_path)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateFile(old_path, new_path); migrateFile(oldPath, newPath);
new_path = getAppMessageHistoryFilepath(); newPath = getAppMessageHistoryFilepath();
old_path = old_base_dir + "/.linphone-history.db"; oldPath = oldBaseDir + "/.linphone-history.db";
if (!filePathExists(new_path) && filePathExists(old_path)) if (!filePathExists(newPath) && filePathExists(oldPath))
migrateFile(old_path, new_path); migrateFile(oldPath, newPath);
} }
...@@ -33,7 +33,7 @@ namespace Paths { ...@@ -33,7 +33,7 @@ namespace Paths {
std::string getAvatarsDirpath (); std::string getAvatarsDirpath ();
std::string getCallHistoryFilepath (); std::string getCallHistoryFilepath ();
std::string getCapturesDirpath (); std::string getCapturesDirpath ();
std::string getConfigFilepath (const QString &config_path = QString()); std::string getConfigFilepath (const QString &configPath = QString());
std::string getFactoryConfigFilepath (); std::string getFactoryConfigFilepath ();
std::string getFriendsListFilepath (); std::string getFriendsListFilepath ();
std::string getLogsDirpath (); std::string getLogsDirpath ();
......
...@@ -33,9 +33,9 @@ AvatarProvider::AvatarProvider () : QQuickImageProvider( ...@@ -33,9 +33,9 @@ AvatarProvider::AvatarProvider () : QQuickImageProvider(
QQmlImageProviderBase::Image, QQmlImageProviderBase::Image,
QQmlImageProviderBase::ForceAsynchronousImageLoading QQmlImageProviderBase::ForceAsynchronousImageLoading
) { ) {
m_avatars_path = Utils::linphoneStringToQString(Paths::getAvatarsDirpath()); mAvatarsPath = Utils::linphoneStringToQString(Paths::getAvatarsDirpath());
} }
QImage AvatarProvider::requestImage (const QString &id, QSize *, const QSize &) { QImage AvatarProvider::requestImage (const QString &id, QSize *, const QSize &) {
return QImage(m_avatars_path + id); return QImage(mAvatarsPath + id);
} }
...@@ -32,12 +32,12 @@ public: ...@@ -32,12 +32,12 @@ public:
AvatarProvider (); AvatarProvider ();
~AvatarProvider () = default; ~AvatarProvider () = default;
QImage requestImage (const QString &id, QSize *size, const QSize &requested_size) override; QImage requestImage (const QString &id, QSize *size, const QSize &requestedSize) override;
static const QString PROVIDER_ID; static const QString PROVIDER_ID;
private: private:
QString m_avatars_path; QString mAvatarsPath;
}; };
#endif // AVATAR_PROVIDER_H_ #endif // AVATAR_PROVIDER_H_
...@@ -33,9 +33,9 @@ ThumbnailProvider::ThumbnailProvider () : QQuickImageProvider( ...@@ -33,9 +33,9 @@ ThumbnailProvider::ThumbnailProvider () : QQuickImageProvider(
QQmlImageProviderBase::Image, QQmlImageProviderBase::Image,
QQmlImageProviderBase::ForceAsynchronousImageLoading QQmlImageProviderBase::ForceAsynchronousImageLoading
) { ) {
m_thumbnails_path = Utils::linphoneStringToQString(Paths::getThumbnailsDirpath()); mThumbnailsPath = Utils::linphoneStringToQString(Paths::getThumbnailsDirpath());
} }
QImage ThumbnailProvider::requestImage (const QString &id, QSize *, const QSize &) { QImage ThumbnailProvider::requestImage (const QString &id, QSize *, const QSize &) {
return QImage(m_thumbnails_path + id); return QImage(mThumbnailsPath + id);
} }
...@@ -32,12 +32,12 @@ public: ...@@ -32,12 +32,12 @@ public:
ThumbnailProvider (); ThumbnailProvider ();
~ThumbnailProvider () = default; ~ThumbnailProvider () = default;
QImage requestImage (const QString &id, QSize *size, const QSize &requested_size) override; QImage requestImage (const QString &id, QSize *size, const QSize &requestedSize) override;
static const QString PROVIDER_ID; static const QString PROVIDER_ID;
private: private:
QString m_thumbnails_path; QString mThumbnailsPath;
}; };
#endif // THUMBNAIL_PROVIDER_H_ #endif // THUMBNAIL_PROVIDER_H_
...@@ -43,28 +43,28 @@ DefaultTranslator::DefaultTranslator (QObject *parent) : QTranslator(parent) { ...@@ -43,28 +43,28 @@ DefaultTranslator::DefaultTranslator (QObject *parent) : QTranslator(parent) {
continue; continue;
QString basename = info.baseName(); QString basename = info.baseName();
if (m_contexts.contains(basename)) if (mContexts.contains(basename))
qWarning() << QStringLiteral("QML context `%1` already exists in contexts list.").arg(basename); qWarning() << QStringLiteral("QML context `%1` already exists in contexts list.").arg(basename);
else else
m_contexts << basename; mContexts << basename;
} }
} }
} }
QString DefaultTranslator::translate ( QString DefaultTranslator::translate (
const char *context, const char *context,
const char *source_text, const char *sourceText,
const char *disambiguation, const char *disambiguation,
int n int n
) const { ) const {
if (!context) if (!context)
return QStringLiteral(""); return QStringLiteral("");
QString translation = QTranslator::translate(context, source_text, disambiguation, n); QString translation = QTranslator::translate(context, sourceText, disambiguation, n);
if (translation.length() == 0 && m_contexts.contains(context)) if (translation.length() == 0 && mContexts.contains(context))
qWarning() << QStringLiteral("Unable to find a translation. (context=%1, label=%2)") qWarning() << QStringLiteral("Unable to find a translation. (context=%1, label=%2)")
.arg(context).arg(source_text); .arg(context).arg(sourceText);
return translation; return translation;
} }
...@@ -35,13 +35,13 @@ public: ...@@ -35,13 +35,13 @@ public:
QString translate ( QString translate (
const char *context, const char *context,
const char *source_text, const char *sourceText,
const char *disambiguation = Q_NULLPTR, const char *disambiguation = Q_NULLPTR,
int n = -1 int n = -1
) const override; ) const override;
private: private:
QSet<QString> m_contexts; QSet<QString> mContexts;
}; };
#endif // DEFAULT_TRANSLATOR_H_ #endif // DEFAULT_TRANSLATOR_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment