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