Commit 95263431 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

refactor: change lrc interface and calling mechanism

- now only one method needed to get mutable newaccount model and dataTransfer model

Change-Id: I98d1e32010ee8b1c77fc258b1c3b7d147a102fcf
parent e64c7469
...@@ -155,21 +155,21 @@ AdvancedSettingsWidget::setCallsUntrusted(bool state) ...@@ -155,21 +155,21 @@ AdvancedSettingsWidget::setCallsUntrusted(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.allowIncoming = state; confProps.allowIncoming = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setAutoAnswerCalls(bool state) AdvancedSettingsWidget::setAutoAnswerCalls(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.autoAnswer = state; confProps.autoAnswer = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setEnableRingtone(bool state) AdvancedSettingsWidget::setEnableRingtone(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtoneEnabled = state; confProps.Ringtone.ringtoneEnabled = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
...@@ -182,7 +182,7 @@ AdvancedSettingsWidget::openFileCustomRingtone() ...@@ -182,7 +182,7 @@ AdvancedSettingsWidget::openFileCustomRingtone()
if (!fileUrl.isEmpty()) { if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtonePath = fileUrl.toStdString(); confProps.Ringtone.ringtonePath = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
ui->btnRingtone->setText(QFileInfo(fileUrl).fileName()); ui->btnRingtone->setText(QFileInfo(fileUrl).fileName());
} else if (oldPath.isEmpty()) { } else if (oldPath.isEmpty()) {
ui->btnRingtone->setText(tr("Add a custom ringtone")); ui->btnRingtone->setText(tr("Add a custom ringtone"));
...@@ -195,7 +195,7 @@ AdvancedSettingsWidget::setNameServer(const QString& name) ...@@ -195,7 +195,7 @@ AdvancedSettingsWidget::setNameServer(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.RingNS.uri = name.toStdString(); confProps.RingNS.uri = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
// openDHT config // openDHT config
...@@ -204,7 +204,7 @@ AdvancedSettingsWidget::setEnableProxy(bool state) ...@@ -204,7 +204,7 @@ AdvancedSettingsWidget::setEnableProxy(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.proxyEnabled = state; confProps.proxyEnabled = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
state ? ui->lineEditProxy->setEnabled(true) : ui->lineEditProxy->setEnabled(false); state ? ui->lineEditProxy->setEnabled(true) : ui->lineEditProxy->setEnabled(false);
} }
...@@ -213,14 +213,14 @@ AdvancedSettingsWidget::setProxyAddress(const QString& name) ...@@ -213,14 +213,14 @@ AdvancedSettingsWidget::setProxyAddress(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.proxyServer = name.toStdString(); confProps.proxyServer = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setBootstrapAddress(const QString& name) AdvancedSettingsWidget::setBootstrapAddress(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.hostname = name.toStdString(); confProps.hostname = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
// security // security
...@@ -231,21 +231,21 @@ AdvancedSettingsWidget::setUseUPnP(bool state) ...@@ -231,21 +231,21 @@ AdvancedSettingsWidget::setUseUPnP(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.upnpEnabled = state; confProps.upnpEnabled = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setUseTURN(bool state) AdvancedSettingsWidget::setUseTURN(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.enable = state; confProps.TURN.enable = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setUseSTUN(bool state) AdvancedSettingsWidget::setUseSTUN(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.enable = state; confProps.STUN.enable = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
state ? ui->lineEditSTUNAddress->setEnabled(true) : ui->lineEditSTUNAddress->setEnabled(false); state ? ui->lineEditSTUNAddress->setEnabled(true) : ui->lineEditSTUNAddress->setEnabled(false);
} }
...@@ -255,28 +255,28 @@ AdvancedSettingsWidget::setTURNAddress(const QString& name) ...@@ -255,28 +255,28 @@ AdvancedSettingsWidget::setTURNAddress(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.server = name.toStdString(); confProps.TURN.server = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setTURNUsername(const QString& name) AdvancedSettingsWidget::setTURNUsername(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.username = name.toStdString(); confProps.TURN.username = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setTURNPsswd(const QString& name) AdvancedSettingsWidget::setTURNPsswd(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = name.toStdString(); confProps.TURN.password = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
AdvancedSettingsWidget::setSTUNAddress(const QString& name) AdvancedSettingsWidget::setSTUNAddress(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.server = name.toStdString(); confProps.STUN.server = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void void
...@@ -288,7 +288,7 @@ AdvancedSettingsWidget::openFileCACert() ...@@ -288,7 +288,7 @@ AdvancedSettingsWidget::openFileCACert()
if (!fileUrl.isEmpty()) { if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.certificateListFile = fileUrl.toStdString(); confProps.TLS.certificateListFile = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
ui->btnCACert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateListFile)).fileName()); ui->btnCACert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateListFile)).fileName());
} }
...@@ -302,7 +302,7 @@ AdvancedSettingsWidget::openFileUserCert() ...@@ -302,7 +302,7 @@ AdvancedSettingsWidget::openFileUserCert()
if (!fileUrl.isEmpty()) { if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.certificateFile = fileUrl.toStdString(); confProps.TLS.certificateFile = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
ui->btnUserCert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateFile)).fileName()); ui->btnUserCert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateFile)).fileName());
} }
...@@ -316,7 +316,7 @@ AdvancedSettingsWidget::openFilePrivateKey() ...@@ -316,7 +316,7 @@ AdvancedSettingsWidget::openFilePrivateKey()
if (!fileUrl.isEmpty()) { if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.privateKeyFile = fileUrl.toStdString(); confProps.TLS.privateKeyFile = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
ui->btnPrivateKey->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.privateKeyFile)).fileName()); ui->btnPrivateKey->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.privateKeyFile)).fileName());
} }
...@@ -437,5 +437,5 @@ AdvancedSettingsWidget::setVideoState(int state) ...@@ -437,5 +437,5 @@ AdvancedSettingsWidget::setVideoState(int state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Video.videoEnabled = (bool)state; confProps.Video.videoEnabled = (bool)state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
\ No newline at end of file
...@@ -125,13 +125,13 @@ void AdvancedSIPSettingsWidget::setAutoAnswerCalls(bool state) ...@@ -125,13 +125,13 @@ void AdvancedSIPSettingsWidget::setAutoAnswerCalls(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.autoAnswer = state; confProps.autoAnswer = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::setEnableRingtone(bool state) void AdvancedSIPSettingsWidget::setEnableRingtone(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtoneEnabled = state; confProps.Ringtone.ringtoneEnabled = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::openFileCustomRingtone() void AdvancedSIPSettingsWidget::openFileCustomRingtone()
...@@ -144,7 +144,7 @@ void AdvancedSIPSettingsWidget::openFileCustomRingtone() ...@@ -144,7 +144,7 @@ void AdvancedSIPSettingsWidget::openFileCustomRingtone()
if (!fileUrl.isEmpty()) { if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtonePath = fileUrl.toStdString(); confProps.Ringtone.ringtonePath = fileUrl.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
ui->btnRingtoneSIP->setText(QFileInfo(fileUrl).fileName()); ui->btnRingtoneSIP->setText(QFileInfo(fileUrl).fileName());
} else if (oldPath.isEmpty()) { } else if (oldPath.isEmpty()) {
...@@ -157,19 +157,19 @@ void AdvancedSIPSettingsWidget::setUseUPnP(bool state) ...@@ -157,19 +157,19 @@ void AdvancedSIPSettingsWidget::setUseUPnP(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.upnpEnabled = state; confProps.upnpEnabled = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::setUseTURN(bool state) void AdvancedSIPSettingsWidget::setUseTURN(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.enable = state; confProps.TURN.enable = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::setUseSTUN(bool state) void AdvancedSIPSettingsWidget::setUseSTUN(bool state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.enable = state; confProps.STUN.enable = state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
state ? ui->lineEditSTUNAddressSIP->setEnabled(true) : ui->lineEditSTUNAddressSIP->setEnabled(false); state ? ui->lineEditSTUNAddressSIP->setEnabled(true) : ui->lineEditSTUNAddressSIP->setEnabled(false);
} }
...@@ -178,25 +178,25 @@ void AdvancedSIPSettingsWidget::setTURNAddress(const QString& name) ...@@ -178,25 +178,25 @@ void AdvancedSIPSettingsWidget::setTURNAddress(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.server = name.toStdString(); confProps.TURN.server = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::setTURNUsername(const QString& name) void AdvancedSIPSettingsWidget::setTURNUsername(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.username = name.toStdString(); confProps.TURN.username = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::setTURNPsswd(const QString& name) void AdvancedSIPSettingsWidget::setTURNPsswd(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = name.toStdString(); confProps.TURN.password = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::setSTUNAddress(const QString& name) void AdvancedSIPSettingsWidget::setSTUNAddress(const QString& name)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.server = name.toStdString(); confProps.STUN.server = name.toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
void AdvancedSIPSettingsWidget::updateAudioCodecs() void AdvancedSIPSettingsWidget::updateAudioCodecs()
...@@ -310,5 +310,5 @@ void AdvancedSIPSettingsWidget::setVideoState(int state) ...@@ -310,5 +310,5 @@ void AdvancedSIPSettingsWidget::setVideoState(int state)
{ {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Video.videoEnabled = (bool)state; confProps.Video.videoEnabled = (bool)state;
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
...@@ -55,6 +55,6 @@ DeleteAccountDialog::on_deleteCancelBtn_clicked() ...@@ -55,6 +55,6 @@ DeleteAccountDialog::on_deleteCancelBtn_clicked()
void void
DeleteAccountDialog::on_deleteAcceptBtn_clicked() DeleteAccountDialog::on_deleteAcceptBtn_clicked()
{ {
LRCInstance::editableAccountModel()->removeAccount(LRCInstance::getCurrAccId()); LRCInstance::accountModel().removeAccount(LRCInstance::getCurrAccId());
done(DialogCode::Accepted); done(DialogCode::Accepted);
} }
\ No newline at end of file
...@@ -85,7 +85,7 @@ DeviceItemWidget::toggleEditable() ...@@ -85,7 +85,7 @@ DeviceItemWidget::toggleEditable()
ui->btnEditDevice->setToolTip(QObject::tr("Edit Device Name")); ui->btnEditDevice->setToolTip(QObject::tr("Edit Device Name"));
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.deviceName = ui->editDeviceName->text().toStdString(); confProps.deviceName = ui->editDeviceName->text().toStdString();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
} }
editable_ = !editable_; editable_ = !editable_;
} }
...@@ -94,4 +94,4 @@ QSize ...@@ -94,4 +94,4 @@ QSize
DeviceItemWidget::sizeHint() const DeviceItemWidget::sizeHint() const
{ {
return QSize(); return QSize();
} }
\ No newline at end of file
...@@ -66,21 +66,15 @@ public: ...@@ -66,21 +66,15 @@ public:
static void connectivityChanged() { static void connectivityChanged() {
instance().lrc_->connectivityChanged(); instance().lrc_->connectivityChanged();
}; };
static const NewAccountModel& accountModel() { static NewAccountModel& accountModel() {
return instance().lrc_->getAccountModel(); return instance().lrc_->getAccountModel();
}; };
static NewAccountModel* editableAccountModel() { static BehaviorController& behaviorController() {
return const_cast<NewAccountModel*>(&instance().lrc_->getAccountModel());
};
static const BehaviorController& behaviorController() {
return instance().lrc_->getBehaviorController(); return instance().lrc_->getBehaviorController();
}; };
static const DataTransferModel& dataTransferModel() { static DataTransferModel& dataTransferModel() {
return instance().lrc_->getDataTransferModel(); return instance().lrc_->getDataTransferModel();
}; };
static DataTransferModel* editableDataTransferModel() {
return const_cast<DataTransferModel*>(&instance().lrc_->getDataTransferModel());
};
static AVModel& avModel() { static AVModel& avModel() {
return instance().lrc_->getAVModel(); return instance().lrc_->getAVModel();
}; };
...@@ -165,15 +159,15 @@ public: ...@@ -165,15 +159,15 @@ public:
bu.open(QIODevice::WriteOnly); bu.open(QIODevice::WriteOnly);
avatarPixmap.save(&bu, "PNG"); avatarPixmap.save(&bu, "PNG");
auto str = ba.toBase64().toStdString(); auto str = ba.toBase64().toStdString();
instance().editableAccountModel()->setAvatar(getCurrAccId(), str); accountModel().setAvatar(getCurrAccId(), str);
}; };
static void setCurrAccAvatar(const std::string& avatar) { static void setCurrAccAvatar(const std::string& avatar) {
instance().editableAccountModel()->setAvatar(getCurrAccId(), avatar); accountModel().setAvatar(getCurrAccId(), avatar);
}; };
static void setCurrAccDisplayName(const std::string& alias) { static void setCurrAccDisplayName(const std::string& alias) {
instance().editableAccountModel()->setAlias(getCurrAccId(), alias); accountModel().setAlias(getCurrAccId(), alias);
}; };
static const account::ConfProperties_t& getCurrAccConfig() { static const account::ConfProperties_t& getCurrAccConfig() {
......
...@@ -309,7 +309,7 @@ void MainWindow::readSettingsFromRegistry() ...@@ -309,7 +309,7 @@ void MainWindow::readSettingsFromRegistry()
restoreGeometry(settings.value(SettingsKey::geometry).toByteArray()); restoreGeometry(settings.value(SettingsKey::geometry).toByteArray());
restoreState(settings.value(SettingsKey::windowState).toByteArray()); restoreState(settings.value(SettingsKey::windowState).toByteArray());
LRCInstance::editableDataTransferModel()->downloadDirectory = settings.value(SettingsKey::downloadPath, LRCInstance::dataTransferModel().downloadDirectory = settings.value(SettingsKey::downloadPath,
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)) QStandardPaths::writableLocation(QStandardPaths::DownloadLocation))
.toString() .toString()
.toStdString() .toStdString()
......
...@@ -38,7 +38,7 @@ NameRegistrationDialog::NameRegistrationDialog(const QString& nameToRegister, QW ...@@ -38,7 +38,7 @@ NameRegistrationDialog::NameRegistrationDialog(const QString& nameToRegister, QW
connect(ui->btnCancel, &QPushButton::clicked, [this]() { reject(); }); connect(ui->btnCancel, &QPushButton::clicked, [this]() { reject(); });
connect(ui->btnCloseRegisterDialog, &QPushButton::clicked, [this]() { reject(); }); connect(ui->btnCloseRegisterDialog, &QPushButton::clicked, [this]() { reject(); });
connect(LRCInstance::editableAccountModel(), &lrc::api::NewAccountModel::nameRegistrationEnded, connect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::nameRegistrationEnded,
this, &NameRegistrationDialog::slotNameRegistrationResult); this, &NameRegistrationDialog::slotNameRegistrationResult);
spinnerAnimation_ = new QMovie(":/images/jami_eclipse_spinner.gif"); spinnerAnimation_ = new QMovie(":/images/jami_eclipse_spinner.gif");
...@@ -60,7 +60,7 @@ void ...@@ -60,7 +60,7 @@ void
NameRegistrationDialog::slotStartNameRegistration() NameRegistrationDialog::slotStartNameRegistration()
{ {
auto password = ui->passwordEdit->text().toStdString(); auto password = ui->passwordEdit->text().toStdString();
LRCInstance::editableAccountModel()->registerName(LRCInstance::getCurrAccId(), LRCInstance::accountModel().registerName(LRCInstance::getCurrAccId(),
password, nameToRegister_.toStdString()); password, nameToRegister_.toStdString());
startSpinner(); startSpinner();
} }
...@@ -98,4 +98,4 @@ NameRegistrationDialog::startSpinner() ...@@ -98,4 +98,4 @@ NameRegistrationDialog::startSpinner()
ui->spinnerLabel->setMovie(spinnerAnimation_); ui->spinnerLabel->setMovie(spinnerAnimation_);
spinnerAnimation_->start(); spinnerAnimation_->start();
} }
\ No newline at end of file
...@@ -459,7 +459,7 @@ NewWizardWidget::createAccount() ...@@ -459,7 +459,7 @@ NewWizardWidget::createAccount()
LRCInstance::accountModel().setAccountConfig(accountId, confProps); LRCInstance::accountModel().setAccountConfig(accountId, confProps);
if (isRing) { if (isRing) {
if (!confProps.username.empty()) { if (!confProps.username.empty()) {
connect(LRCInstance::editableAccountModel(), connect(&LRCInstance::accountModel(),
&lrc::api::NewAccountModel::nameRegistrationEnded, &lrc::api::NewAccountModel::nameRegistrationEnded,
[this] { [this] {
lrc::api::account::ConfProperties_t accountProperties = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); lrc::api::account::ConfProperties_t accountProperties = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
...@@ -467,7 +467,7 @@ NewWizardWidget::createAccount() ...@@ -467,7 +467,7 @@ NewWizardWidget::createAccount()
emit NavigationRequested(ScreenEnum::CallScreen); emit NavigationRequested(ScreenEnum::CallScreen);
emit LRCInstance::instance().accountOnBoarded(); emit LRCInstance::instance().accountOnBoarded();
}); });
LRCInstance::editableAccountModel()->registerName( LRCInstance::accountModel().registerName(
LRCInstance::getCurrAccId(), LRCInstance::getCurrAccId(),
"", "",
registeredName_.toStdString() registeredName_.toStdString()
......
...@@ -74,16 +74,16 @@ PasswordDialog::validatePassword() ...@@ -74,16 +74,16 @@ PasswordDialog::validatePassword()
void void
PasswordDialog::savePassword() PasswordDialog::savePassword()
{ {
if (LRCInstance::editableAccountModel()->changeAccountPassword(LRCInstance::getCurrAccId(), if (LRCInstance::accountModel().changeAccountPassword(LRCInstance::getCurrAccId(),
ui->currentPasswordEdit->text().toStdString(), ui->passwordEdit->text().toStdString())) { ui->currentPasswordEdit->text().toStdString(), ui->passwordEdit->text().toStdString())) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId()); auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.archiveHasPassword = !ui->passwordEdit->text().isEmpty(); confProps.archiveHasPassword = !ui->passwordEdit->text().isEmpty();
LRCInstance::editableAccountModel()->setAccountConfig(LRCInstance::getCurrAccId(), confProps); LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
accept(); accept();
} else { } else {
ui->wrongPasswordLabel->show(); ui->wrongPasswordLabel->show();
ui->currentPasswordEdit->setText(""); ui->currentPasswordEdit->setText("");
} }
} }
\ No newline at end of file
...@@ -477,7 +477,7 @@ SettingsWidget::slotRegisterName() ...@@ -477,7 +477,7 @@ SettingsWidget::slotRegisterName()
void SettingsWidget::setAccEnableSlot(int state) void SettingsWidget::setAccEnableSlot(int state)
{ {
LRCInstance::editableAccountModel()->setAccountEnabled(LRCInstance::getCurrAccId(), static_cast<bool>(state)); LRCInstance::accountModel().setAccountEnabled(LRCInstance::getCurrAccId(), static_cast<bool>(state));
} }
void SettingsWidget::delAccountSlot() void SettingsWidget::delAccountSlot()
...@@ -863,7 +863,7 @@ void SettingsWidget::openDownloadFolderSlot() ...@@ -863,7 +863,7 @@ void SettingsWidget::openDownloadFolderSlot()
if (!dir.isEmpty()) { if (!dir.isEmpty()) {
Utils::setElidedText(ui->downloadButton, dir); Utils::setElidedText(ui->downloadButton, dir);
settings.setValue(SettingsKey::downloadPath, dir); settings.setValue(SettingsKey::downloadPath, dir);
LRCInstance::editableDataTransferModel()->downloadDirectory = dir.toStdString() + "/"; LRCInstance::dataTransferModel().downloadDirectory = dir.toStdString() + "/";
} }
} }
......
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