1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-07 17:15:26 +02:00

accountadapter: do not set incorrect ringtone on creation

On GNU/Linux, the ringtone is managed by the deamon. No need to
manage it (incorrectly) in the client

Change-Id: I38fe783d6bd0778f702ee6da333468c54d59d678
GitLab: #351
This commit is contained in:
Sébastien Blin 2021-04-06 15:37:34 -04:00
parent 2eac155b0c
commit 12daccb51f
No known key found for this signature in database
GPG key ID: C894BB01EEB2A9A9
2 changed files with 33 additions and 22 deletions

View file

@ -99,7 +99,9 @@ AccountAdapter::createJamiAccount(QString registeredName,
&lrc::api::NewAccountModel::accountAdded, &lrc::api::NewAccountModel::accountAdded,
[this, registeredName, settings, isCreating](const QString& accountId) { [this, registeredName, settings, isCreating](const QString& accountId) {
auto confProps = lrcInstance_->accountModel().getAccountConfig(accountId); auto confProps = lrcInstance_->accountModel().getAccountConfig(accountId);
#ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath(); confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif
confProps.isRendezVous = settings["isRendezVous"].toBool(); confProps.isRendezVous = settings["isRendezVous"].toBool();
lrcInstance_->accountModel().setAccountConfig(accountId, confProps); lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
@ -108,19 +110,21 @@ AccountAdapter::createJamiAccount(QString registeredName,
.toBool(); .toBool();
if (!registeredName.isEmpty()) { if (!registeredName.isEmpty()) {
QObject::disconnect(registeredNameSavedConnection_); QObject::disconnect(registeredNameSavedConnection_);
registeredNameSavedConnection_ = connect( registeredNameSavedConnection_
&lrcInstance_->accountModel(), = connect(&lrcInstance_->accountModel(),
&lrc::api::NewAccountModel::profileUpdated, &lrc::api::NewAccountModel::profileUpdated,
[this, showBackup, addedAccountId = accountId](const QString& accountId) { [this, showBackup, addedAccountId = accountId](
if (addedAccountId == accountId) { const QString& accountId) {
Q_EMIT lrcInstance_->accountListChanged(); if (addedAccountId == accountId) {
Q_EMIT accountAdded(accountId, Q_EMIT lrcInstance_->accountListChanged();
showBackup, Q_EMIT accountAdded(accountId,
lrcInstance_->accountModel().getAccountList().indexOf( showBackup,
accountId)); lrcInstance_->accountModel()
QObject::disconnect(registeredNameSavedConnection_); .getAccountList()
} .indexOf(accountId));
}); QObject::disconnect(registeredNameSavedConnection_);
}
});
lrcInstance_->accountModel().registerName(accountId, lrcInstance_->accountModel().registerName(accountId,
settings["password"].toString(), settings["password"].toString(),
@ -128,8 +132,9 @@ AccountAdapter::createJamiAccount(QString registeredName,
} else { } else {
Q_EMIT lrcInstance_->accountListChanged(); Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId, Q_EMIT accountAdded(accountId,
showBackup, showBackup,
lrcInstance_->accountModel().getAccountList().indexOf(accountId)); lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
} }
}); });
@ -158,14 +163,17 @@ AccountAdapter::createSIPAccount(const QVariantMap& settings)
confProps.username = settings["username"].toString(); confProps.username = settings["username"].toString();
confProps.password = settings["password"].toString(); confProps.password = settings["password"].toString();
confProps.routeset = settings["proxy"].toString(); confProps.routeset = settings["proxy"].toString();
#ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath(); confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif
lrcInstance_->accountModel().setAccountConfig(accountId, confProps); lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
Q_EMIT lrcInstance_->accountListChanged(); Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId, Q_EMIT accountAdded(accountId,
false, false,
lrcInstance_->accountModel().getAccountList().indexOf( lrcInstance_->accountModel()
accountId)); .getAccountList()
.indexOf(accountId));
}); });
connectFailure(); connectFailure();
@ -192,13 +200,16 @@ AccountAdapter::createJAMSAccount(const QVariantMap& settings)
auto confProps = lrcInstance_->accountModel().getAccountConfig( auto confProps = lrcInstance_->accountModel().getAccountConfig(
accountId); accountId);
#ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath(); confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif
lrcInstance_->accountModel().setAccountConfig(accountId, confProps); lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
Q_EMIT accountAdded(accountId, Q_EMIT accountAdded(accountId,
false, false,
lrcInstance_->accountModel().getAccountList().indexOf( lrcInstance_->accountModel()
accountId)); .getAccountList()
.indexOf(accountId));
Q_EMIT lrcInstance_->accountListChanged(); Q_EMIT lrcInstance_->accountListChanged();
}); });

View file

@ -280,7 +280,7 @@ Utils::GetRingtonePath()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
return QCoreApplication::applicationDirPath() + "\\ringtones\\default.opus"; return QCoreApplication::applicationDirPath() + "\\ringtones\\default.opus";
#else #else
return QString("/usr/local"); return QString("/usr/share/ring/ringtones/default.opus");
#endif #endif
} }