Commit 36e9b93a authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk
Browse files

client-windows: remove std::string to adapt new lrc

Change-Id: I511c0b7bf3ef4a576303beca1c42d46ad76bc0fb
parent 5404caf6
......@@ -60,9 +60,9 @@ QVariant AccountListModel::data(const QModelIndex &index, int role) const
switch (role) {
case Role::Alias:
case Qt::DisplayRole:
return QVariant(QString::fromStdString(Utils::bestNameForAccount(accountInfo)));
return QVariant(Utils::bestNameForAccount(accountInfo));
case Role::Username:
return QVariant(QString::fromStdString(Utils::secondBestNameForAccount(accountInfo)));
return QVariant(Utils::secondBestNameForAccount(accountInfo));
case Role::Type:
return QVariant(Utils::toUnderlyingValue<lrc::api::profile::Type>(accountInfo.profileInfo.type));
case Role::Status:
......@@ -71,7 +71,7 @@ QVariant AccountListModel::data(const QModelIndex &index, int role) const
case Qt::DecorationRole:
return Utils::accountPhoto(accountInfo);
case Role::ID:
return QVariant(QString::fromStdString(accountInfo.id));
return QVariant(accountInfo.id);
}
return QVariant();
}
......
......@@ -22,7 +22,7 @@
#include <QTimer>
#include <QtConcurrent/QtConcurrent>
AccountMigrationDialog::AccountMigrationDialog(QWidget *parent, const std::string& accountId) :
AccountMigrationDialog::AccountMigrationDialog(QWidget *parent, const QString& accountId) :
QDialog(parent),
ui(new Ui::AccountMigrationDialog),
accountId_(accountId)
......@@ -32,10 +32,10 @@ AccountMigrationDialog::AccountMigrationDialog(QWidget *parent, const std::strin
auto& avatarInfo = LRCInstance::accountModel().getAccountInfo(accountId_);
auto managerUsername = QString::fromStdString(avatarInfo.confProperties.managerUsername);
auto managerUri = QString::fromStdString(avatarInfo.confProperties.managerUri);
auto username = QString::fromStdString(avatarInfo.confProperties.username);
auto alias = QString::fromStdString(LRCInstance::accountModel().getAccountInfo(accountId_).profileInfo.alias);
auto managerUsername = avatarInfo.confProperties.managerUsername;
auto managerUri = avatarInfo.confProperties.managerUri;
auto username = avatarInfo.confProperties.username;
auto alias = LRCInstance::accountModel().getAccountInfo(accountId_).profileInfo.alias;
// manager uri
if (!managerUri.isEmpty()) {
......@@ -51,7 +51,7 @@ AccountMigrationDialog::AccountMigrationDialog(QWidget *parent, const std::strin
if (!username.isEmpty()) {
ui->usernameInputLabel->setText(username);
} else {
if (avatarInfo.confProperties.managerUsername.empty()) {
if (avatarInfo.confProperties.managerUsername.isEmpty()) {
ui->usernameLabel->hide();
ui->usernameInputLabel->hide();
ui->gridLayout->removeWidget(ui->usernameInputLabel);
......@@ -85,7 +85,7 @@ AccountMigrationDialog::AccountMigrationDialog(QWidget *parent, const std::strin
} else {
ui->migrationPushButton->setDisabled(false);
}
password_ = text.toStdString();
password_ = text;
});
ui->migrationPushButton->setDisabled(true);
......@@ -104,7 +104,7 @@ AccountMigrationDialog::~AccountMigrationDialog()
void
AccountMigrationDialog::slotPasswordEditingFinished()
{
password_ = ui->passwordInputLineEdit->text().toStdString();
password_ = ui->passwordInputLineEdit->text();
}
void
......@@ -121,7 +121,7 @@ AccountMigrationDialog::slotMigrationButtonClicked()
migrationSpinnerMovie_->start();
connect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::migrationEnded,
[this](const std::string& accountId, bool ok) {
[this](const QString& accountId, bool ok) {
if (accountId_ != accountId) {
return;
}
......
......@@ -34,14 +34,14 @@ class AccountMigrationDialog : public QDialog
public:
explicit AccountMigrationDialog(QWidget *parent = 0, const std::string& accountId = {});
explicit AccountMigrationDialog(QWidget *parent = 0, const QString& accountId = {});
~AccountMigrationDialog();
private:
Ui::AccountMigrationDialog *ui;
std::string accountId_;
std::string password_;
QString accountId_;
QString password_;
QMovie* migrationSpinnerMovie_;
private slots:
......
......@@ -113,26 +113,26 @@ AdvancedSettingsWidget::updateAdvancedSettings()
ui->checkBoxCustomRingtone->setChecked(config.Ringtone.ringtoneEnabled);
// Name Server
ui->lineEditNameServer->setText(QString::fromStdString(config.RingNS.uri));
ui->lineEditNameServer->setText(config.RingNS.uri);
//OpenDHT Config
ui->checkBoxEnableProxy->setChecked(config.proxyEnabled);
ui->lineEditProxy->setText(QString::fromStdString(config.proxyServer));
ui->lineEditBootstrap->setText(QString::fromStdString(config.hostname));
ui->lineEditProxy->setText(config.proxyServer);
ui->lineEditBootstrap->setText(config.hostname);
// Security
ui->btnCACert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateListFile)).fileName());
ui->btnUserCert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateFile)).fileName());
ui->btnPrivateKey->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.privateKeyFile)).fileName());
ui->btnCACert->setText(QFileInfo(LRCInstance::getCurrAccConfig().TLS.certificateListFile).fileName());
ui->btnUserCert->setText(QFileInfo(LRCInstance::getCurrAccConfig().TLS.certificateFile).fileName());
ui->btnPrivateKey->setText(QFileInfo(LRCInstance::getCurrAccConfig().TLS.privateKeyFile).fileName());
// Connectivity
ui->checkBoxUPnP->setChecked(config.upnpEnabled);
ui->checkBoxTurnEnable->setChecked(config.TURN.enable);
ui->lineEditTurnAddress->setText(QString::fromStdString(config.TURN.server));
ui->lineEditTurnUsername->setText(QString::fromStdString(config.TURN.username));
ui->lineEditTurnPassword->setText(QString::fromStdString(config.TURN.password));
ui->lineEditTurnAddress->setText(config.TURN.server);
ui->lineEditTurnUsername->setText(config.TURN.username);
ui->lineEditTurnPassword->setText(config.TURN.password);
ui->checkBoxSTUNEnable->setChecked(config.STUN.enable);
ui->lineEditSTUNAddress->setText(QString::fromStdString(config.STUN.server));
ui->lineEditSTUNAddress->setText(config.STUN.server);
// codecs
ui->videoCheckBox->setChecked(config.Video.videoEnabled);
......@@ -144,7 +144,7 @@ AdvancedSettingsWidget::updateAdvancedSettings()
connect(ui->videoListWidget, &QListWidget::itemChanged, this, &AdvancedSettingsWidget::videoCodecsStateChange);
ui->btnRingtone->setEnabled(LRCInstance::getCurrAccConfig().Ringtone.ringtoneEnabled);
ui->btnRingtone->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath)).fileName());
ui->btnRingtone->setText(QFileInfo(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath).fileName());
ui->lineEditProxy->setEnabled(LRCInstance::getCurrAccConfig().proxyEnabled);
ui->lineEditSTUNAddress->setEnabled(LRCInstance::getCurrAccConfig().STUN.enable);
}
......@@ -176,12 +176,12 @@ void
AdvancedSettingsWidget::openFileCustomRingtone()
{
QString fileUrl;
auto oldPath = QString::fromStdString(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath);
auto oldPath = LRCInstance::getCurrAccConfig().Ringtone.ringtonePath;
auto openPath = oldPath.isEmpty() ? QDir::currentPath() + QString("/ringtones/") : QFileInfo(oldPath).absolutePath();
fileUrl = QFileDialog::getOpenFileName(this, QString("Select a new ringtone"), openPath, tr("Audio Files") + " (*.wav *.ogg *.opus *.mp3 *.aiff *.wma)");
if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtonePath = fileUrl.toStdString();
confProps.Ringtone.ringtonePath = fileUrl;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
ui->btnRingtone->setText(QFileInfo(fileUrl).fileName());
} else if (oldPath.isEmpty()) {
......@@ -195,7 +195,7 @@ AdvancedSettingsWidget::setNameServer()
{
auto text = ui->lineEditNameServer->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.RingNS.uri = text.toStdString();
confProps.RingNS.uri = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -214,7 +214,7 @@ AdvancedSettingsWidget::setProxyAddress()
{
auto text = ui->lineEditProxy->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.proxyServer = text.toStdString();
confProps.proxyServer = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
......@@ -222,7 +222,7 @@ AdvancedSettingsWidget::setBootstrapAddress()
{
auto text = ui->lineEditBootstrap->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.hostname = text.toStdString();
confProps.hostname = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -258,7 +258,7 @@ AdvancedSettingsWidget::setTURNAddress()
{
auto text = ui->lineEditTurnAddress->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.server = text.toStdString();
confProps.TURN.server = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
......@@ -266,7 +266,7 @@ AdvancedSettingsWidget::setTURNUsername()
{
auto text = ui->lineEditTurnUsername->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.username = text.toStdString();
confProps.TURN.username = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
......@@ -274,7 +274,7 @@ AdvancedSettingsWidget::setTURNPassword()
{
auto text = ui->lineEditTurnPassword->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = text.toStdString();
confProps.TURN.password = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void
......@@ -282,7 +282,7 @@ AdvancedSettingsWidget::setSTUNAddress()
{
auto text = ui->lineEditSTUNAddress->text();
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.server = text.toStdString();
confProps.STUN.server = text;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -291,13 +291,13 @@ AdvancedSettingsWidget::openFileCACert()
{
QString fileUrl;
fileUrl = QFileDialog::getOpenFileName(this, QString("Select a CA certificate"), QDir::homePath()
+ QString("/.local/share/ring/") + QString::fromStdString(LRCInstance::getCurrentAccountInfo().id));
+ QString("/.local/share/ring/") + LRCInstance::getCurrentAccountInfo().id);
if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.certificateListFile = fileUrl.toStdString();
confProps.TLS.certificateListFile = fileUrl;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
ui->btnCACert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateListFile)).fileName());
ui->btnCACert->setText(QFileInfo(LRCInstance::getCurrAccConfig().TLS.certificateListFile).fileName());
}
void
......@@ -305,13 +305,13 @@ AdvancedSettingsWidget::openFileUserCert()
{
QString fileUrl;
fileUrl = QFileDialog::getOpenFileName(this, QString("Select a user certificate"), QDir::homePath()
+ QString("/.local/share/ring/") + QString::fromStdString(LRCInstance::getCurrentAccountInfo().id));
+ QString("/.local/share/ring/") + LRCInstance::getCurrentAccountInfo().id);
if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.certificateFile = fileUrl.toStdString();
confProps.TLS.certificateFile = fileUrl;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
ui->btnUserCert->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.certificateFile)).fileName());
ui->btnUserCert->setText(QFileInfo(LRCInstance::getCurrAccConfig().TLS.certificateFile).fileName());
}
void
......@@ -319,13 +319,13 @@ AdvancedSettingsWidget::openFilePrivateKey()
{
QString fileUrl;
fileUrl = QFileDialog::getOpenFileName(this, QString("Select a private key"), QDir::homePath()
+ QString("/.local/share/ring/") + QString::fromStdString(LRCInstance::getCurrentAccountInfo().id));
+ QString("/.local/share/ring/") + LRCInstance::getCurrentAccountInfo().id);
if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.privateKeyFile = fileUrl.toStdString();
confProps.TLS.privateKeyFile = fileUrl;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
ui->btnPrivateKey->setText(QFileInfo(QString::fromStdString(LRCInstance::getCurrAccConfig().TLS.privateKeyFile)).fileName());
ui->btnPrivateKey->setText(QFileInfo(LRCInstance::getCurrAccConfig().TLS.privateKeyFile).fileName());
}
void
......@@ -339,7 +339,7 @@ AdvancedSettingsWidget::updateAudioCodecs()
QListWidgetItem* audioItem = new QListWidgetItem(ui->audioListWidget);
audioItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
audioItem->setCheckState(it->enabled ? Qt::Checked : Qt::Unchecked);
audioItem->setData(Qt::DisplayRole, QString::fromStdString(it->name) + " " + QString::fromStdString(it->samplerate) + " Hz");
audioItem->setData(Qt::DisplayRole, it->name + " " + it->samplerate + " Hz");
ui->audioListWidget->addItem(audioItem);
}
......@@ -356,7 +356,7 @@ AdvancedSettingsWidget::updateVideoCodecs()
QListWidgetItem* videoItem = new QListWidgetItem(ui->videoListWidget);
videoItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
videoItem->setCheckState(it->enabled ? Qt::Checked : Qt::Unchecked);
videoItem->setData(Qt::DisplayRole, QString::fromStdString(it->name));
videoItem->setData(Qt::DisplayRole, it->name);
ui->audioListWidget->addItem(videoItem);
}
}
......@@ -390,7 +390,7 @@ AdvancedSettingsWidget::decreaseAudioCodecPriority()
auto audioCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getAudioCodecs();
auto it = audioCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->decreasePriority(it->id, false);
// swap current item down
......@@ -404,7 +404,7 @@ AdvancedSettingsWidget::increaseAudioCodecPriority()
auto audioCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getAudioCodecs();
auto it = audioCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->increasePriority(it->id, false);
// swap current item up
......@@ -418,7 +418,7 @@ AdvancedSettingsWidget::decreaseVideoCodecPriority()
auto videoCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getVideoCodecs();
auto it = videoCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->decreasePriority(it->id, true);
// swap current item down
......@@ -432,7 +432,7 @@ AdvancedSettingsWidget::increaseVideoCodecPriority()
auto videoCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getVideoCodecs();
auto it = videoCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->increasePriority(it->id, true);
// swap current item up
......
......@@ -173,10 +173,10 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
ui->enableSDESToggle->setEnabled(config.SRTP.enable);
ui->fallbackRTPToggle->setEnabled(config.SRTP.enable);
ui->btnSIPCACert->setText(QFileInfo(QString::fromStdString(config.TLS.certificateListFile)).fileName());
ui->btnSIPUserCert->setText(QFileInfo(QString::fromStdString(config.TLS.certificateFile)).fileName());
ui->btnSIPPrivateKey->setText(QFileInfo(QString::fromStdString(config.TLS.privateKeyFile)).fileName());
ui->lineEditSIPCertPassword->setText(QString::fromStdString(config.TLS.password));
ui->btnSIPCACert->setText(QFileInfo(config.TLS.certificateListFile).fileName());
ui->btnSIPUserCert->setText(QFileInfo(config.TLS.certificateFile).fileName());
ui->btnSIPPrivateKey->setText(QFileInfo(config.TLS.privateKeyFile).fileName());
ui->lineEditSIPCertPassword->setText(config.TLS.password);
ui->encryptMediaStreamsToggle->setChecked(config.SRTP.enable);
ui->enableSDESToggle->setChecked(config.SRTP.keyExchange == lrc::api::account::KeyExchangeProtocol::SDES);
......@@ -190,7 +190,7 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
ui->tlsProtocolComboBox->setCurrentIndex(static_cast<int>(method));
connect(ui->tlsProtocolComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AdvancedSIPSettingsWidget::tlsProtocolComboBoxIndexChanged);
ui->outgoingTLSServerNameLineEdit->setText(QString::fromStdString(config.TLS.serverName));
ui->outgoingTLSServerNameLineEdit->setText(config.TLS.serverName);
ui->negotiationTimeoutSpinBox->setValue(config.TLS.negotiationTimeoutSec);
connect(ui->negotiationTimeoutSpinBox, &QSpinBox::editingFinished, this, &AdvancedSIPSettingsWidget::negotiationTimeoutSpinBoxValueChanged);
......@@ -198,17 +198,17 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
// Connectivity
ui->checkBoxUPnPSIP->setChecked(config.upnpEnabled);
ui->checkBoxTurnEnableSIP->setChecked(config.TURN.enable);
ui->lineEditTurnAddressSIP->setText(QString::fromStdString(config.TURN.server));
ui->lineEditTurnUsernameSIP->setText(QString::fromStdString(config.TURN.username));
ui->lineEditTurnPsswdSIP->setText(QString::fromStdString(config.TURN.password));
ui->lineEditTurnRealmSIP->setText(QString::fromStdString(config.TURN.realm));
ui->lineEditTurnAddressSIP->setText(config.TURN.server);
ui->lineEditTurnUsernameSIP->setText(config.TURN.username);
ui->lineEditTurnPsswdSIP->setText(config.TURN.password);
ui->lineEditTurnRealmSIP->setText(config.TURN.realm);
ui->lineEditTurnAddressSIP->setEnabled(config.TURN.enable);
ui->lineEditTurnUsernameSIP->setEnabled(config.TURN.enable);
ui->lineEditTurnPsswdSIP->setEnabled(config.TURN.enable);
ui->lineEditTurnRealmSIP->setEnabled(config.TURN.enable);
ui->checkBoxSTUNEnableSIP->setChecked(config.STUN.enable);
ui->lineEditSTUNAddressSIP->setText(QString::fromStdString(config.STUN.server));
ui->lineEditSTUNAddressSIP->setText(config.STUN.server);
ui->lineEditSTUNAddressSIP->setEnabled(config.STUN.enable);
ui->registrationExpireTimeoutSpinBox->setValue(config.Registration.expire);
......@@ -218,7 +218,7 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
// published address
ui->checkBoxCustomAddressPort->setChecked(config.publishedSameAsLocal);
ui->lineEditSIPCustomAddress->setText(QString::fromStdString(config.publishedAddress));
ui->lineEditSIPCustomAddress->setText(config.publishedAddress);
ui->customPortSIPSpinBox->setValue(config.publishedPort);
connect(ui->customPortSIPSpinBox, &QSpinBox::editingFinished, this, &AdvancedSIPSettingsWidget::customPortSIPSpinBoxValueChanged);
......@@ -233,7 +233,7 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
connect(ui->videoListWidgetSIP, &QListWidget::itemChanged, this, &AdvancedSIPSettingsWidget::videoCodecsStateChange);
ui->btnRingtoneSIP->setEnabled(config.Ringtone.ringtoneEnabled);
ui->btnRingtoneSIP->setText(QFileInfo(QString::fromStdString(config.Ringtone.ringtonePath)).fileName());
ui->btnRingtoneSIP->setText(QFileInfo(config.Ringtone.ringtonePath).fileName());
ui->lineEditSTUNAddressSIP->setEnabled(config.STUN.enable);
// SDP session negotiation ports
......@@ -248,7 +248,7 @@ void AdvancedSIPSettingsWidget::updateAdvancedSIPSettings()
connect(ui->videoRTPMaxPortSpinBox, &QSpinBox::editingFinished, this, &AdvancedSIPSettingsWidget::videoRTPMaxPortSpinBoxEditFinished);
// voicemail
ui->lineEditVoiceMailDialCode->setText(QString::fromStdString(config.mailbox));
ui->lineEditVoiceMailDialCode->setText(config.mailbox);
}
// call settings
......@@ -268,13 +268,13 @@ void AdvancedSIPSettingsWidget::setEnableRingtone(bool state)
void AdvancedSIPSettingsWidget::openFileCustomRingtone()
{
QString fileUrl;
auto oldPath = QString::fromStdString(LRCInstance::getCurrAccConfig().Ringtone.ringtonePath);
auto oldPath = LRCInstance::getCurrAccConfig().Ringtone.ringtonePath;
auto openPath = oldPath.isEmpty() ? QDir::currentPath() + QString("/ringtones/") : QFileInfo(oldPath).absolutePath();
fileUrl = QFileDialog::getOpenFileName(this, tr("Select a new ringtone"), openPath, tr("Audio Files") + " (*.wav *.ogg *.opus *.mp3 *.aiff *.wma)");
if (!fileUrl.isEmpty()) {
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.Ringtone.ringtonePath = fileUrl.toStdString();
confProps.Ringtone.ringtonePath = fileUrl;
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
ui->btnRingtoneSIP->setText(QFileInfo(fileUrl).fileName());
......@@ -308,21 +308,21 @@ void AdvancedSIPSettingsWidget::setUseSTUN(bool state)
void AdvancedSIPSettingsWidget::setTURNAddress()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.server = ui->lineEditTurnAddressSIP->text().toStdString();
confProps.TURN.server = ui->lineEditTurnAddressSIP->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setTURNUsername()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.username = ui->lineEditTurnUsernameSIP->text().toStdString();
confProps.TURN.username = ui->lineEditTurnUsernameSIP->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setTURNPassword()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.password = ui->lineEditTurnPsswdSIP->text().toStdString();
confProps.TURN.password = ui->lineEditTurnPsswdSIP->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -330,14 +330,14 @@ void
AdvancedSIPSettingsWidget::setTURNRealm()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TURN.realm = ui->lineEditTurnRealmSIP->text().toStdString();
confProps.TURN.realm = ui->lineEditTurnRealmSIP->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
void AdvancedSIPSettingsWidget::setSTUNAddress()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.STUN.server = ui->lineEditSTUNAddressSIP->text().toStdString();
confProps.STUN.server = ui->lineEditSTUNAddressSIP->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -352,7 +352,7 @@ void AdvancedSIPSettingsWidget::updateAudioCodecs()
QListWidgetItem* audioItem = new QListWidgetItem(ui->audioListWidgetSIP);
audioItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
audioItem->setCheckState(it->enabled ? Qt::Checked : Qt::Unchecked);
audioItem->setData(Qt::DisplayRole, QString::fromStdString(it->name) + " " + QString::fromStdString(it->samplerate) + " Hz");
audioItem->setData(Qt::DisplayRole, it->name + " " + it->samplerate + " Hz");
ui->audioListWidgetSIP->addItem(audioItem);
}
......@@ -370,7 +370,7 @@ void AdvancedSIPSettingsWidget::updateVideoCodecs()
QListWidgetItem* videoItem = new QListWidgetItem(ui->videoListWidgetSIP);
videoItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
videoItem->setCheckState(it->enabled ? Qt::Checked : Qt::Unchecked);
videoItem->setData(Qt::DisplayRole, QString::fromStdString(it->name) + "\n");
videoItem->setData(Qt::DisplayRole, it->name + "\n");
ui->audioListWidgetSIP->addItem(videoItem);
}
}
......@@ -401,7 +401,7 @@ void AdvancedSIPSettingsWidget::decreaseAudioCodecPriority()
auto audioCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getAudioCodecs();
auto it = audioCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->decreasePriority(it->id, false);
// swap current item down
......@@ -414,7 +414,7 @@ void AdvancedSIPSettingsWidget::increaseAudioCodecPriority()
auto audioCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getAudioCodecs();
auto it = audioCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->increasePriority(it->id, false);
updateAudioCodecs();
......@@ -428,7 +428,7 @@ void AdvancedSIPSettingsWidget::decreaseVideoCodecPriority()
auto videoCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getVideoCodecs();
auto it = videoCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->decreasePriority(it->id, true);
// swap current item down
......@@ -441,7 +441,7 @@ void AdvancedSIPSettingsWidget::increaseVideoCodecPriority()
auto videoCodecList = LRCInstance::getCurrentAccountInfo().codecModel->getVideoCodecs();
auto it = videoCodecList.begin();
advance(it, selectedRow);
std::advance(it, selectedRow);
LRCInstance::getCurrentAccountInfo().codecModel->increasePriority(it->id, true);
// swap current item up
......@@ -515,7 +515,7 @@ void
AdvancedSIPSettingsWidget::outgoingTLSServerNameLineEditTextChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.serverName = ui->outgoingTLSServerNameLineEdit->text().toStdString();
confProps.TLS.serverName = ui->outgoingTLSServerNameLineEdit->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -583,19 +583,19 @@ void
AdvancedSIPSettingsWidget::lineEditSIPCertPasswordLineEditTextChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.TLS.password = ui->lineEditSIPCertPassword->text().toStdString();
confProps.TLS.password = ui->lineEditSIPCertPassword->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
std::string
AdvancedSIPSettingsWidget::openButtonFilePath(const std::string& accConfigFilePath,
QString
AdvancedSIPSettingsWidget::openButtonFilePath(const QString& accConfigFilePath,
const char* windowTitle,
const char* fileTypeDesp,
const QString& fileTypeFilter,
QPushButton* button)
{
QString fileUrl;
auto oldPath = QString::fromStdString(accConfigFilePath);
auto oldPath = accConfigFilePath;
auto openPath = oldPath.isEmpty() ? QDir::currentPath() : QFileInfo(oldPath).absolutePath();
fileUrl = QFileDialog::getOpenFileName(this, tr(windowTitle), openPath, tr(fileTypeDesp) + fileTypeFilter);
if (!fileUrl.isEmpty()) {
......@@ -603,7 +603,7 @@ AdvancedSIPSettingsWidget::openButtonFilePath(const std::string& accConfigFilePa
} else {
button->setText("");
}
return fileUrl.toStdString();
return fileUrl;
}
void
......@@ -634,7 +634,7 @@ void
AdvancedSIPSettingsWidget::lineEditSIPCustomAddressLineEditTextChanged()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.publishedAddress = ui->lineEditSIPCustomAddress->text().toStdString();
confProps.publishedAddress = ui->lineEditSIPCustomAddress->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......@@ -698,7 +698,7 @@ void
AdvancedSIPSettingsWidget::lineEditVoiceMailDialCodeEditFinished()
{
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.mailbox = ui->lineEditVoiceMailDialCode->text().toStdString();
confProps.mailbox = ui->lineEditVoiceMailDialCode->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
......
......@@ -37,7 +37,7 @@ public:
~AdvancedSIPSettingsWidget();
void updateAdvancedSIPSettings();
std::string openButtonFilePath(const std::string& accConfigFilePath,
QString openButtonFilePath(const QString& accConfigFilePath,
const char* windowTitle,
const char* fileTypeDesp,
const QString& fileTypeFilter,
......
......@@ -47,11 +47,11 @@ CallAudioOnlyAvatarOverlay::writeAvatarOverlay(const lrc::api::conversation::Inf
ui->avatarLabel->setPixmap(QPixmap::fromImage(Utils::conversationPhoto(convInfo.uid, LRCInstance::getCurrentAccountInfo())));
if (contact.profileInfo.type == lrc::api::profile::Type::SIP) {
ui->nameLabel->setText(QString::fromStdString(contact.profileInfo.uri));
ui->nameLabel->setText(contact.profileInfo.uri);
} else {
std::string name = contact.profileInfo.alias;
std::string id = contact.registeredName;
ui->nameLabel->setText(QString::fromStdString(name + "\n" + id));
QString name = contact.profileInfo.alias;
QString id = contact.registeredName;
ui->nameLabel->setText(name + "\n" + id);
}
}
......