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

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:
......
This diff is collapsed.
This diff is collapsed.
......@@ -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);
}
}
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ private slots:
void on_ringContactLineEdit_returnPressed();
void settingsButtonClicked();
void showChatView(const QModelIndex& nodeIdx);
void showChatView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void showChatView(const QString& accountId, const lrc::api::conversation::Info & convInfo);
void setConversationProfileData(const lrc::api::conversation::Info & convInfo);
void setupChatView(const lrc::api::conversation::Info& convInfo);
void slotAcceptInviteClicked(const QModelIndex& index);
......@@ -77,10 +77,10 @@ private slots:
void slotIgnoreInviteClicked(const QModelIndex& index);
void slotCustomContextMenuRequested(const QPoint & pos);
void slotAccountChanged(int index);
void slotShowCallView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void slotShowIncomingCallView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void slotShowChatView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void slotNewTrustRequest(const std::string& accountId, const std::string& contactUri);
void slotShowCallView(const QString & accountId, const lrc::api::conversation::Info & convInfo);
void slotShowIncomingCallView(const QString & accountId, const lrc::api::conversation::Info & convInfo);
void slotShowChatView(const QString & accountId, const lrc::api::conversation::Info & convInfo);
void slotNewTrustRequest(const QString& accountId, const QString& contactUri);
void slotToggleFullScreenClicked();
void update();
void ShowContextMenu(const QPoint& pos);
......@@ -104,8 +104,8 @@ private slots:
void slotVideoDeviceListChanged();
private:
void callTerminating(const std::string& callid);
void onNewInteraction(const std::string& accountId, const std::string& convUid,
void callTerminating(const QString& callid);
void onNewInteraction(const QString& accountId, const QString& convUid,
uint64_t interactionId, const lrc::api::interaction::Info& interaction);
void conversationsButtonClicked();
void invitationsButtonClicked();
......@@ -116,20 +116,20 @@ private:
bool selectConversation(const lrc::api::conversation::Info& item);
void deselectConversation();
bool connectConversationModel();
void updateConversationView(const std::string& convUid);
void updateConversationView(const QString& convUid);
void showConversationView();
bool selectSmartlistItem(const std::string& convUid);
QImage imageForConv(const std::string & convUid);
bool selectSmartlistItem(const QString& convUid);
QImage imageForConv(const QString & convUid);
void processContactLineEdit();
void hideMiniSpinner();
void updateConversationForNewContact(const std::string& convUid);
void updateConversationForNewContact(const QString& convUid);
void updateSmartList();
void setSelectedAccount(const std::string & accountId);
void setSelectedAccount(const QString & accountId);
void setConversationFilter(const QString& filter);
void setConversationFilter(lrc::api::profile::Type filter);
void updateConversationsFilterWidget();
void updateComboBox();
void connectAccount(const std::string& accId);
void connectAccount(const QString& accId);
void setCallPanelVisibility(bool visible);
void updateChatviewFrame();
void registerShortCuts();
......@@ -142,7 +142,7 @@ private:
constexpr static int qrSize_ = 200;
std::string lastConvUid_ {};
QString lastConvUid_ {};
lrc::api::profile::Type currentTypeFilter_{};
std::unique_ptr<SmartListModel> smartListModel_;
......
......@@ -66,20 +66,20 @@ ContactPicker::accept()
smartListModel_->toggleSection(sectionName);
return;
}
auto convUid = index.data(SmartListModel::Role::UID).value<QString>().toStdString();
auto accId = index.data(SmartListModel::Role::AccountId).value<QString>().toStdString();
auto convUid = index.data(SmartListModel::Role::UID).value<QString>();
auto accId = index.data(SmartListModel::Role::AccountId).value<QString>();
auto callId = LRCInstance::getCallIdForConversationUid(convUid, accId);
if (!callId.empty()) {
if (!callId.isEmpty()) {
emit callWillJoinConference(callId);
} else {
auto contactUri = index.data(SmartListModel::Role::URI).value<QString>().toStdString();
auto contactUri = index.data(SmartListModel::Role::URI).value<QString>();
emit contactWillJoinConference(contactUri);
}
}
break;
case SmartListModel::Type::TRANSFER:
{
auto contactUri = index.data(SmartListModel::Role::URI).value<QString>().toStdString();
auto contactUri = index.data(SmartListModel::Role::URI).value<QString>();
emit contactWillDoTransfer(contactUri);
}
break;
......@@ -95,7 +95,7 @@ void
ContactPicker::on_ringContactLineEdit_textChanged(const QString &arg1)
{
if (listModeltype_ == SmartListModel::Type::CONFERENCE) {
smartListModel_->setConferenceableFilter(arg1.toStdString());
smartListModel_->setConferenceableFilter(arg1);
}
selectableProxyModel_->setFilterRegExp(QRegExp(arg1, Qt::CaseInsensitive, QRegExp::FixedString));
}
......
......@@ -70,9 +70,9 @@ public:
void setCurrentCalleeDisplayName(const QString& CalleeDisplayName);
signals:
void contactWillJoinConference(const std::string& contactUri);
void callWillJoinConference(const std::string& callId);
void contactWillDoTransfer(const std::string& contactUri);
void contactWillJoinConference(const QString& contactUri);
void callWillJoinConference(const QString& callId);
void contactWillDoTransfer(const QString& contactUri);
protected slots:
void accept();
......
......@@ -80,9 +80,9 @@ ConversationItemDelegate::paint(QPainter* painter
} else if (rowHighlight != highlightMap_.end() && (*rowHighlight).second) {
painter->fillRect(option.rect, RingTheme::smartlistHighlight_);
}
auto convUid = index.data(static_cast<int>(SmartListModel::Role::UID)).value<QString>().toStdString();
auto convUid = index.data(static_cast<int>(SmartListModel::Role::UID)).value<QString>();
auto conversation = LRCInstance::getConversationFromConvUid(convUid);
if (conversation.uid.empty()) return;
if (conversation.uid.isEmpty()) return;
if (LRCInstance::getCurrentCallModel()->hasCall(conversation.callId)) {
auto color = QColor(RingTheme::blue_.lighter(180));
color.setAlpha(128);
......
......@@ -55,7 +55,7 @@ CurrentAccountComboBox::CurrentAccountComboBox(QWidget* parent)
// account added to combobox
connect(&LRCInstance::accountModel(),
&lrc::api::NewAccountModel::accountAdded,
[this](const std::string& accountId) {
[this](const QString& accountId) {
auto accountList = LRCInstance::accountModel().getAccountList();
auto it = std::find(accountList.begin(), accountList.end(), accountId);
if (it != accountList.end()) {
......@@ -81,8 +81,8 @@ CurrentAccountComboBox::CurrentAccountComboBox(QWidget* parent)
auto confProps = LRCInstance::accountModel().getAccountConfig(currentAccountId);
auto possibleConv = LRCInstance::getConversationFromPeerUri(confProps.mailbox);
if (possibleConv.uid.empty()) {
if (confProps.mailbox.empty()) {
if (possibleConv.uid.isEmpty()) {
if (confProps.mailbox.isEmpty()) {
QMessageBox::information(0, "Voicemail", "Voicemail dial code is empty");
}
// construct new contact
......@@ -90,7 +90,7 @@ CurrentAccountComboBox::CurrentAccountComboBox(QWidget* parent)
lrc::api::contact::Info contactInfo{ {{confProps.mailbox}, {} , {"Voicemail"}, type }, {} };
Utils::oneShotConnect(this, &CurrentAccountComboBox::placeAudioOnlyCall,
[this, conversationModel] (const std::string& convUid) {
[this, conversationModel] (const QString& convUid) {
conversationModel->placeAudioOnlyCall(convUid);
});
accInfo.contactModel->addContact(contactInfo);
......@@ -165,14 +165,14 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
avatarSize_ - 10); // [screen awareness]
// write primary and secondary account identifiers to combobox label
QString primaryAccountID = QString::fromStdString(Utils::bestNameForAccount(accInfo));
QString primaryAccountID = Utils::bestNameForAccount(accInfo);
painter.setFont(fontPrimary);
painter.setPen(RingTheme::lightBlack_);
primaryAccountID = fontMetricPrimary.elidedText(primaryAccountID, Qt::ElideRight,
comboBoxRect.width() - elidConst - (popupPresent ? 0 : 2 * gearSize_ + 2 * voicemailSize_));
painter.drawText(comboBoxRect, Qt::AlignLeft, primaryAccountID);
QString secondaryAccountID = QString::fromStdString(Utils::secondBestNameForAccount(accInfo));
QString secondaryAccountID = Utils::secondBestNameForAccount(accInfo);
secondaryAccountID = fontMetricSecondary.elidedText(secondaryAccountID, Qt::ElideRight,
comboBoxRect.width() - elidConst - 2 - (popupPresent ? 0 : 2 * gearSize_ + 2 * voicemailSize_)); // [screen awareness]
......@@ -221,7 +221,7 @@ void
CurrentAccountComboBox::connectVoiceMail()
{
connect(LRCInstance::getCurrentCallModel(), &lrc::api::NewCallModel::voiceMailNotify,
[this](const std::string& accountId, int newCount, int oldCount, int urgentCount) {
[this](const QString& accountId, int newCount, int oldCount, int urgentCount) {
Q_UNUSED(urgentCount);
voicemailMap_[accountId] = std::make_pair(newCount, oldCount);
if (LRCInstance::accountModel().getAccountList()[currentIndex()] == accountId) {
......
......@@ -42,14 +42,14 @@ public:
void accountListUpdate();
void setCurrentIndex(int index);
void updateComboBoxDisplay();
void canPlaceAudioOnlyCall(const std::string& convUid) { emit placeAudioOnlyCall(convUid); }
void canPlaceAudioOnlyCall(const QString& convUid) { emit placeAudioOnlyCall(convUid); }
void activateComboBox() { showPopup(); }
void deactivateComboBox() { hidePopup(); }
signals:
void settingsButtonClicked();
void newAccountClicked();
void placeAudioOnlyCall(const std::string& convUid);
void placeAudioOnlyCall(const QString& convUid);
protected:
void paintEvent(QPaintEvent* e);
......@@ -85,5 +85,5 @@ private:
const int voicemailBorder_ = 4;
const int voicemailSize_ = 24;
std::map<std::string,std::pair<int,int>> voicemailMap_;
std::map<QString, std::pair<int,int>> voicemailMap_;
};
......@@ -29,8 +29,8 @@ DeleteAccountDialog::DeleteAccountDialog(QWidget *parent) :
{
ui->setupUi(this);
if (LRCInstance::getCurrentAccountInfo().profileInfo.type == lrc::api::profile::Type::RING){
ui->labelBestId->setText(QString::fromStdString(Utils::bestNameForAccount(LRCInstance::getCurrentAccountInfo())));
ui->labelAccountHash->setText(QString::fromStdString(LRCInstance::getCurrentAccountInfo().profileInfo.uri));
ui->labelBestId->setText(Utils::bestNameForAccount(LRCInstance::getCurrentAccountInfo()));
ui->labelAccountHash->setText(LRCInstance::getCurrentAccountInfo().profileInfo.uri);
} else {
ui->labelWarning->hide();
}
......
......@@ -84,7 +84,7 @@ DeviceItemWidget::toggleEditable()
ui->btnEditDevice->setIcon(QIcon(":/images/icons/round-edit-24px.svg"));
ui->btnEditDevice->setToolTip(QObject::tr("Edit Device Name"));
auto confProps = LRCInstance::accountModel().getAccountConfig(LRCInstance::getCurrAccId());
confProps.deviceName = ui->editDeviceName->text().toStdString();
confProps.deviceName = ui->editDeviceName->text();
LRCInstance::accountModel().setAccountConfig(LRCInstance::getCurrAccId(), confProps);
}
editable_ = !editable_;
......
......@@ -25,11 +25,11 @@ DistantWidget::DistantWidget(QWidget* parent)
: VideoWidgetBase(Qt::black, parent)
{
connect(LRCInstance::renderer(), &RenderManager::distantFrameUpdated,
[this](const std::string& id) {
[this](const QString& id) {
if (id_ == id) repaint();
});
connect(LRCInstance::renderer(), &RenderManager::distantRenderingStopped,
[this](const std::string& id) {
[this](const QString& id) {
if (id_ == id) repaint();
});
}
......@@ -68,7 +68,7 @@ DistantWidget::paintBackground(QPainter* painter)
}
void
DistantWidget::setRendererId(const std::string& id)
DistantWidget::setRendererId(const QString& id)
{
id_ = id;
update();
......
......@@ -30,7 +30,7 @@ public:
explicit DistantWidget(QWidget* parent = 0);
~DistantWidget();
void setRendererId(const std::string& id);
void setRendererId(const QString& id);
protected:
void paintEvent(QPaintEvent* e);
......@@ -38,6 +38,5 @@ protected:
void paintBackground(QPainter* painter) override;
private:
std::string id_;
QString id_;
};
......@@ -57,9 +57,9 @@ void
LinkDeviceDialog::setGeneratingPage()
{
if (ui->passwordEdit->text().isEmpty() && LRCInstance::getCurrAccConfig().archiveHasPassword) {
setExportPage(std::string(),
setExportPage(QString(),
lrc::api::account::ExportOnRingStatus::WRONG_PASSWORD,
std::string());
QString());
return;
}
......@@ -75,17 +75,17 @@ LinkDeviceDialog::setGeneratingPage()
timeout_->setSingleShot(true);
connect(timeout_, &QTimer::timeout, this,
[this]() {
setExportPage(std::string(),
setExportPage(QString(),
lrc::api::account::ExportOnRingStatus::NETWORK_ERROR,
std::string());
QString());
});
timeout_->start();
LRCInstance::accountModel().exportOnRing(LRCInstance::getCurrAccId(), ui->passwordEdit->text().toStdString());
LRCInstance::accountModel().exportOnRing(LRCInstance::getCurrAccId(), ui->passwordEdit->text());
}
void
LinkDeviceDialog::setExportPage(const std::string& accountId, lrc::api::account::ExportOnRingStatus status, const std::string& pin)
LinkDeviceDialog::setExportPage(const QString& accountId, lrc::api::account::ExportOnRingStatus status, const QString& pin)
{
Q_UNUSED(accountId);
timeout_->stop();
......@@ -100,7 +100,7 @@ LinkDeviceDialog::setExportPage(const std::string& accountId, lrc::api::account:
case lrc::api::account::ExportOnRingStatus::SUCCESS:
ui->infoLabel->setStyleSheet("color: #2b5084;border: 1px solid lightgray;background-color: whitesmoke;padding: 8px;border-radius: 15px;");
ui->exportedPIN->setText(QString::fromStdString(pin));
ui->exportedPIN->setText(pin);
break;
case lrc::api::account::ExportOnRingStatus::NETWORK_ERROR:
......
......@@ -41,7 +41,7 @@ private:
private slots:
void setGeneratingPage();
void setExportPage(const std::string& accountId,
void setExportPage(const QString& accountId,
lrc::api::account::ExportOnRingStatus status,
const std::string& pin);
const QString& pin);
};
......@@ -97,11 +97,11 @@ public:
static bool isConnected() {
return instance().lrc_->isConnected();
};
static std::vector<std::string> getActiveCalls() {
static VectorString getActiveCalls() {
return instance().lrc_->activeCalls();
};
static const account::Info&
getAccountInfo(const std::string& accountId) {
getAccountInfo(const QString& accountId) {
return accountModel().getAccountInfo(accountId);
};
static const account::Info&
......@@ -123,17 +123,17 @@ public:
}
return result;
};
static std::string
getCallIdForConversationUid(const std::string& convUid, const std::string& accountId)
static QString
getCallIdForConversationUid(const QString& convUid, const QString& accountId)
{
auto convInfo = LRCInstance::getConversationFromConvUid(convUid, accountId);
if (convInfo.uid.empty()) {
if (convInfo.uid.isEmpty()) {
return {};
}
return convInfo.confId.empty() ? convInfo.callId : convInfo.confId;
return convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
}
static const call::Info*
getCallInfo(const std::string& callId, const std::string& accountId) {
getCallInfo(const QString& callId, const QString& accountId) {
try {
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId);
if (!accInfo.callModel->hasCall(callId)) {
......@@ -152,7 +152,7 @@ public:
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId);
auto callId = forceCallOnly ?
convInfo.callId :
(convInfo.confId.empty() ? convInfo.callId : convInfo.confId);
(convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId);
if (!accInfo.callModel->hasCall(callId)) {
return nullptr;
}
......@@ -162,7 +162,7 @@ public:
}
}
static const conversation::Info&
getConversation(const std::string& accountId,
getConversation(const QString& accountId,
getConvPredicate pred = {},
bool filtered=false) {
using namespace lrc::api;
......@@ -192,28 +192,28 @@ public:
return invalid;
}
static const conversation::Info&
getConversationFromCallId(const std::string& callId,
const std::string& accountId = {},
getConversationFromCallId(const QString& callId,
const QString& accountId = {},
bool filtered = false) {
return getConversation(!accountId.empty() ? accountId : getCurrAccId(),
return getConversation(!accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info& conv) -> bool {
return callId == conv.callId;
}, filtered);
}
static const conversation::Info&
getConversationFromConvUid(const std::string& convUid,
const std::string& accountId = {},
getConversationFromConvUid(const QString& convUid,
const QString& accountId = {},
bool filtered = false) {
return getConversation(!accountId.empty() ? accountId : getCurrAccId(),
return getConversation(!accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info& conv) -> bool {
return convUid == conv.uid;
}, filtered);
}
static const conversation::Info&
getConversationFromPeerUri(const std::string& peerUri,
const std::string& accountId = {},
getConversationFromPeerUri(const QString& peerUri,
const QString& accountId = {},
bool filtered = false) {
return getConversation(!accountId.empty() ? accountId : getCurrAccId(),
return getConversation(!accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info& conv) -> bool {
return peerUri == conv.participants[0];
}, filtered);
......@@ -233,25 +233,25 @@ public:
return getCurrentAccountInfo().callModel.get();
};
static const std::string& getCurrAccId() {
static const QString& getCurrAccId() {
auto accountList = accountModel().getAccountList();
if (instance().selectedAccountId_.empty() && accountList.size()) {
if (instance().selectedAccountId_.isEmpty() && accountList.size()) {
instance().selectedAccountId_ = accountList.at(0);
}
return instance().selectedAccountId_;
};
static void setSelectedAccountId(const std::string& accountId = {}) {
static void setSelectedAccountId(const QString& accountId = {}) {
instance().selectedAccountId_ = accountId;
QSettings settings("jami.net", "Jami");
settings.setValue(SettingsKey::selectedAccount, QString::fromStdString(accountId));
settings.setValue(SettingsKey::selectedAccount, accountId);
};
static const std::string& getCurrentConvUid() {
static const QString& getCurrentConvUid() {
return instance().selectedConvUid_;
};
static void setSelectedConvId(const std::string& convUid = {}) {
static void setSelectedConvId(const QString& convUid = {}) {
instance().selectedConvUid_ = convUid;
};
......@@ -284,15 +284,15 @@ public:
QBuffer bu(&ba);
bu.open(QIODevice::WriteOnly);
avatarPixmap.save(&bu, "PNG");
auto str = ba.toBase64().toStdString();
auto str = QString::fromLocal8Bit(ba.toBase64());
accountModel().setAvatar(getCurrAccId(), str);
};
static void setCurrAccAvatar(const std::string& avatar) {
static void setCurrAccAvatar(const QString& avatar) {
accountModel().setAvatar(getCurrAccId(), avatar);
};
static void setCurrAccDisplayName(const std::string& displayName) {
static void setCurrAccDisplayName(const QString& displayName) {
auto accountId = LRCInstance::getCurrAccId();
accountModel().setAlias(accountId, displayName);
// force save to .yml
......@@ -357,18 +357,18 @@ public:
instance().contentDrafts_[draftKey] = content;
}
static void pushLastConferencee(const std::string& confId,
const std::string& callId)
static void pushLastConferencee(const QString& confId,
const QString& callId)
{
instance().lastConferencees_[confId] = callId;
}
static std::string popLastConferencee(const std::string& confId)
static QString popLastConferencee(const QString& confId)
{
std::string callId = {};
QString callId = {};
auto iter = instance().lastConferencees_.find(confId);
if (iter != instance().lastConferencees_.end()) {
callId = iter->second;
callId = iter.value();
instance().lastConferencees_.erase(iter);
}
return callId;
......@@ -389,8 +389,8 @@ private:
std::unique_ptr<RenderManager> renderer_;
std::unique_ptr<NetWorkManager> netWorkManager_;
AccountListModel accountListModel_;
std::string selectedAccountId_;
std::string selectedConvUid_;
QString selectedAccountId_;
QString selectedConvUid_;
MapStringString contentDrafts_;
std::map<std::string, std::string> lastConferencees_;
MapStringString lastConferencees_;
};
......@@ -80,8 +80,8 @@ MainApplication::vsConsoleDebug()
QObject::connect(
&LRCInstance::behaviorController(),
&lrc::api::BehaviorController::debugMessageReceived,
[](const std::string& message) {
OutputDebugStringA((message + "\n").c_str());
[](const QString& message) {
OutputDebugStringA((message + "\n").toStdString().c_str());
});
#endif
}
......@@ -92,9 +92,9 @@ MainApplication::fileDebug(QFile* debugFile)
QObject::connect(
&LRCInstance::behaviorController(),
&lrc::api::BehaviorController::debugMessageReceived,
[debugFile](const std::string& message) {
[debugFile](const QString& message) {
if (debugFile->open(QIODevice::WriteOnly | QIODevice::Append)) {
auto msg = (message + "\n").c_str();
auto msg = (message + "\n").toStdString().c_str();
debugFile->write(msg, qstrlen(msg));
debugFile->close();
}
......@@ -253,7 +253,7 @@ MainApplication::startAccountMigration()
{
auto accountList = LRCInstance::accountModel().getAccountList();
for (const std::string& i : accountList) {
for (const QString& i : accountList) {
auto accountStatus = LRCInstance::accountModel().getAccountInfo(i).status;
if (accountStatus == lrc::api::account::Status::ERROR_NEED_MIGRATION) {
std::unique_ptr<AccountMigrationDialog> dialog = std::make_unique<AccountMigrationDialog>(nullptr, i);
......
......@@ -200,7 +200,7 @@ MainWindow::MainWindow(QWidget* parent)
#endif
connect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::accountRemoved,
[this](const std::string& accountId) {
[this](const QString& accountId) {
Q_UNUSED(accountId);
emit LRCInstance::instance().accountListChanged();
});
......@@ -345,7 +345,6 @@ void MainWindow::readSettingsFromRegistry()
LRCInstance::dataTransferModel().downloadDirectory = settings.value(SettingsKey::downloadPath,
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation))
.toString()
.toStdString()
+ "/";
if (not settings.contains(SettingsKey::enableNotifications)) {
......