Commit 9ce238b7 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

api: remove the use of std::string

Change-Id: I18bb655e76e1409e752c12878ad65ed16eaf382b
parent 1f3f9c13
......@@ -18,16 +18,14 @@
***************************************************************************/
#pragma once
// Std
#include <string>
#include <memory>
// Data
#include "profile.h"
// old LRC
#include "typedefs.h"
#include <memory>
#include <QString>
namespace lrc
{
......@@ -64,7 +62,7 @@ enum class Status {
};
static inline account::Status
to_status(const std::string& type)
to_status(const QString& type)
{
if (type == "INITIALIZING")
return account::Status::INITIALIZING;
......@@ -95,40 +93,40 @@ enum class TlsMethod {
};
struct ConfProperties_t {
std::string mailbox;
std::string dtmfType;
QString mailbox;
QString dtmfType;
bool autoAnswer;
int activeCallLimit;
std::string hostname;
std::string username;
std::string routeset;
std::string password;
std::string realm;
std::string localInterface;
std::string deviceId;
std::string deviceName;
std::string managerUri;
std::string managerUsername;
QString hostname;
QString username;
QString routeset;
QString password;
QString realm;
QString localInterface;
QString deviceId;
QString deviceName;
QString managerUri;
QString managerUsername;
bool publishedSameAsLocal;
int localPort;
int publishedPort;
std::string publishedAddress;
std::string userAgent;
QString publishedAddress;
QString userAgent;
bool upnpEnabled;
bool hasCustomUserAgent;
bool allowIncoming;
std::string archivePassword;
QString archivePassword;
bool archiveHasPassword;
std::string archivePath;
std::string archivePin;
QString archivePath;
QString archivePin;
bool proxyEnabled;
std::string proxyServer;
std::string proxyPushToken;
QString proxyServer;
QString proxyPushToken;
bool peerDiscovery;
bool accountDiscovery;
bool accountPublish;
int registrationExpire;
std::vector<std::map<std::string, std::string>> credentials;
VectorMapStringString credentials;
struct Audio_t {
int audioPortMax;
int audioPortMin;
......@@ -139,15 +137,15 @@ struct ConfProperties_t {
int videoPortMin;
} Video;
struct STUN_t {
std::string server;
QString server;
bool enable;
} STUN;
struct TURN_t {
std::string server;
QString server;
bool enable;
std::string username;
std::string password;
std::string realm;
QString username;
QString password;
QString realm;
} TURN;
struct Presence_t {
bool presencePublishSupported;
......@@ -155,7 +153,7 @@ struct ConfProperties_t {
bool presenceEnabled;
} Presence;
struct Ringtone_t {
std::string ringtonePath;
QString ringtonePath;
bool ringtoneEnabled;
} Ringtone;
struct SRTP_t {
......@@ -167,13 +165,13 @@ struct ConfProperties_t {
int listenerPort;
bool enable;
int port;
std::string certificateListFile;
std::string certificateFile;
std::string privateKeyFile;
std::string password;
QString certificateListFile;
QString certificateFile;
QString privateKeyFile;
QString password;
TlsMethod method;
std::string ciphers;
std::string serverName;
QString ciphers;
QString serverName;
bool verifyServer;
bool verifyClient;
bool requireClientCertificate;
......@@ -185,8 +183,8 @@ struct ConfProperties_t {
bool AllowFromTrusted;
} DHT;
struct RingNS_t {
std::string uri;
std::string account;
QString uri;
QString account;
} RingNS;
struct Registration_t {
int expire;
......@@ -224,7 +222,7 @@ struct Info
{
bool freeable = false;
bool valid = true;
std::string registeredName;
QString registeredName;
Status status = account::Status::INVALID;
std::unique_ptr<lrc::api::ContactModel> contactModel;
std::unique_ptr<lrc::api::ConversationModel> conversationModel;
......@@ -235,7 +233,7 @@ struct Info
NewAccountModel* accountModel {nullptr};
// daemon config
std::string id;
QString id;
profile::Info profileInfo; // contains: type, alias
bool enabled;
ConfProperties_t confProperties;
......
......@@ -82,23 +82,23 @@ public:
* Get video devices
* @return list of devices
*/
std::vector<std::string> getDevices() const;
VectorString getDevices() const;
/**
* Retrieve current default video device
* @return current default video device id
*/
std::string getDefaultDevice() const;
QString getDefaultDevice() const;
/**
* Set new default video device
* @param id of the device
*/
void setDefaultDevice(const std::string& deviceId);
void setDefaultDevice(const QString& deviceId);
/**
* Retrieve current framerate/resolution/etc of a device
* @param id of the device
* @return settings of the device
*/
video::Settings getDeviceSettings(const std::string& deviceId) const;
video::Settings getDeviceSettings(const QString& deviceId) const;
/**
* Set device settings
* @param video::Settings
......@@ -109,58 +109,58 @@ public:
* @param id of the device
* @return possibilities of the device
*/
video::Capabilities getDeviceCapabilities(const std::string& deviceId) const;
video::Capabilities getDeviceCapabilities(const QString& deviceId) const;
/**
* Get the deviceId corresponding to a given device friendly name
* @return deviceId
*/
std::string getDeviceIdFromName(const std::string& deviceName) const;
QString getDeviceIdFromName(const QString& deviceName) const;
/**
* Get supported audio managers
* @return supported audio managers
*/
std::vector<std::string> getSupportedAudioManagers() const;
VectorString getSupportedAudioManagers() const;
/**
* Get current audio manager
* @return current audio manager
*/
std::string getAudioManager() const;
QString getAudioManager() const;
/**
* Get current audio outputs
* @return audio outputs
*/
std::vector<std::string> getAudioOutputDevices() const;
VectorString getAudioOutputDevices() const;
/**
* Get current audio inputs
* @return audio inputs
*/
std::vector<std::string> getAudioInputDevices() const;
VectorString getAudioInputDevices() const;
/**
* Get current ringtone device
* @return current ringtone device
*/
std::string getRingtoneDevice() const;
QString getRingtoneDevice() const;
/**
* Get current output device
* @return current output device
*/
std::string getOutputDevice() const;
QString getOutputDevice() const;
/**
* Get current input device
* @return current input device
*/
std::string getInputDevice() const;
QString getInputDevice() const;
/**
* Get current state of the audio meter
* @return current state of the audio meter
*/
bool isAudioMeterActive(const std::string& id="") const;
bool isAudioMeterActive(const QString& id="") const;
/**
* Turn on/off the audio metering feature
* @param the new state of the meter
*/
void setAudioMeterState(bool active, const std::string& id="") const;
void setAudioMeterState(bool active, const QString& id="") const;
/**
* Starts audio device. Should only be invoked when outside of a call.
*/
......@@ -174,43 +174,43 @@ public:
* @param name of the new audio manager
* @return if the operation is successful
*/
bool setAudioManager(const std::string& name);
bool setAudioManager(const QString& name);
/**
* Set current ringtone device
* @param name of the new ringtone device
*/
void setRingtoneDevice(const std::string& name);
void setRingtoneDevice(const QString& name);
/**
* Set current output device
* @param name of the new output device
*/
void setOutputDevice(const std::string& name);
void setOutputDevice(const QString& name);
/**
* Set current input device
* @param name of the new input device
*/
void setInputDevice(const std::string& name);
void setInputDevice(const QString& name);
/**
* Stop local record at given path
* @param path
*/
void stopLocalRecorder(const std::string& path) const;
void stopLocalRecorder(const QString& path) const;
/**
* Start a local recorder and return it path.
* @param audioOnly
*/
std::string startLocalRecorder(const bool& audioOnly) const;
QString startLocalRecorder(const bool& audioOnly) const;
/**
* Get the current recording path
* @return recording path
*/
std::string getRecordPath() const;
QString getRecordPath() const;
/**
* Sets the recording path
* @param path recording path
*/
void setRecordPath(const std::string& path) const;
void setRecordPath(const QString& path) const;
/**
* Whether or not to record every call
* @return always recording
......@@ -256,7 +256,7 @@ public:
* @return the linked renderer
* @throw std::out_of_range if not found
*/
const video::Renderer& getRenderer(const std::string& id) const;
const video::Renderer& getRenderer(const QString& id) const;
/**
* Render a file to the call id specified
......@@ -264,7 +264,7 @@ public:
* @param callId
* @note callId can be omitted to switch the input of the local recorder
*/
void setInputFile(const std::string& uri, const std::string& callId = {});
void setInputFile(const QString& uri, const QString& callId = {});
/**
* Change the current device rendered for the call id specified
* @param id of the camera
......@@ -272,7 +272,7 @@ public:
* @note renders a black frame if device not found or empty
* @note callId can be omitted to switch the input of the local recorder
*/
void switchInputTo(const std::string& id, const std::string& callId = {});
void switchInputTo(const QString& id, const QString& callId = {});
/**
* Render the current display to the call id specified
* @param idx of the display
......@@ -283,13 +283,13 @@ public:
* @param callId
* @note callId can be omitted to switch the input of the local recorder
*/
void setDisplay(int idx, int x, int y, int w, int h, const std::string& callId = {});
void setDisplay(int idx, int x, int y, int w, int h, const QString& callId = {});
/**
* Get informations on the rendered device
* @param call_id linked call to the renderer
* @return the device rendered
*/
video::RenderedDevice getCurrentRenderedDevice(const std::string& call_id) const;
video::RenderedDevice getCurrentRenderedDevice(const QString& call_id) const;
/**
* set to true to receive AVFrames from render
......@@ -300,13 +300,13 @@ public:
* set current using device
* @ param device name
*/
void setCurrentVideoCaptureDevice(std::string &currentVideoCaptureDevice);
void setCurrentVideoCaptureDevice(QString &currentVideoCaptureDevice);
/**
* set current using device
* @ return current using device name
*/
std::string getCurrentVideoCaptureDevice() const;
QString getCurrentVideoCaptureDevice() const;
/**
* clear current using device
......@@ -318,17 +318,17 @@ Q_SIGNALS:
* Emitted when a renderer is started
* @param id of the renderer
*/
void rendererStarted(const std::string& id);
void rendererStarted(const QString& id);
/**
* Emitted when a renderer is stopped
* @param id of the renderer
*/
void rendererStopped(const std::string& id);
void rendererStopped(const QString& id);
/**
* Emitted when a new frame is ready
* @param id
*/
void frameUpdated(const std::string& id);
void frameUpdated(const QString& id);
/**
* Emitted when a device is plugged or unplugged
*/
......@@ -338,12 +338,12 @@ Q_SIGNALS:
* @param id Ringbuffer id
* @param level Volume in range [0, 1]
*/
void audioMeter(const std::string& id, float level);
void audioMeter(const QString& id, float level);
/**
* local recorder stopped
* @param filePath
*/
void recordPlaybackStopped(const std::string& filePath);
void recordPlaybackStopped(const QString& filePath);
private:
std::unique_ptr<AVModelPimpl> pimpl_;
......
......@@ -18,14 +18,11 @@
***************************************************************************/
#pragma once
// Std
#include <memory>
#include "typedefs.h"
// Qt
#include <qobject.h>
#include <QObject>
// Lrc
#include "typedefs.h"
#include <memory>
namespace lrc
{
......@@ -61,44 +58,44 @@ Q_SIGNALS:
/**
* Emitted when the client should open the chat view.
*/
void showChatView(const std::string& accountId, const api::conversation::Info& conversationInfo) const;
void showChatView(const QString& accountId, const api::conversation::Info& conversationInfo) const;
/**
* Emitted when the client should ask the user whether it wants to leave a message after a failed call.
*/
void showLeaveMessageView(const std::string& accountId, const api::conversation::Info& conversationInfo) const;
void showLeaveMessageView(const QString& accountId, const api::conversation::Info& conversationInfo) const;
/**
* Emitted when the client should open the call view.
*/
void showCallView(const std::string& accountId, const api::conversation::Info& conversationInfo) const;
void showCallView(const QString& accountId, const api::conversation::Info& conversationInfo) const;
/**
* Emitted when the client should open the incoming call view.
*/
void showIncomingCallView(const std::string& accountId, const api::conversation::Info& conversationInfo) const;
void showIncomingCallView(const QString& accountId, const api::conversation::Info& conversationInfo) const;
/**
* Emitted when the client receives a new trust request
*/
void newTrustRequest(const std::string& accountId, const std::string& contactUri) const;
void newTrustRequest(const QString& accountId, const QString& contactUri) const;
/**
* Emitted when a trust request has been accepted, refused or blocked
*/
void trustRequestTreated(const std::string& accountId, const std::string& contactUri) const;
void trustRequestTreated(const QString& accountId, const QString& contactUri) const;
/**
* Emitted when the client receives an unread message to display (text or file for now)
*/
void newUnreadInteraction(const std::string& accountId, const std::string& conversation,
void newUnreadInteraction(const QString& accountId, const QString& conversation,
uint64_t interactionId, const interaction::Info& interaction) const;
/**
* Emitted when the unread interaction is now read
*/
void newReadInteraction(const std::string& accountId, const std::string& conversation, uint64_t interactionId) const;
void newReadInteraction(const QString& accountId, const QString& conversation, uint64_t interactionId) const;
/**
* Emitted debugMessageReceived
*/
void debugMessageReceived(const std::string& message);
void debugMessageReceived(const QString& message);
/**
* Emitted audioMeter
*/
void audioMeter(const std::string& id, float level);
void audioMeter(const QString& id, float level);
};
......
/****************************************************************************
* Copyright (C) 2017-2020 Savoir-faire Linux Inc. *
* Copyright (C) 2017-2020 Savoir-faire Linux Inc. *
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> *
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> *
* *
......@@ -18,14 +18,14 @@
***************************************************************************/
#pragma once
// Qt
#include <QObject>
// std
#include <string>
#include <ctime>
#include <chrono>
// Qt
#include <QObject>
namespace lrc
{
......@@ -51,37 +51,37 @@ enum class Status {
CONNECTED
};
static inline std::string
static inline QString
to_string(const call::Status& status)
{
switch(status)
{
case call::Status::PAUSED:
return QObject::tr("Hold").toStdString();
return QObject::tr("Hold");
case call::Status::IN_PROGRESS:
return QObject::tr("Talking").toStdString();
return QObject::tr("Talking");
case call::Status::INVALID:
return QObject::tr("ERROR").toStdString();
return QObject::tr("ERROR");
case call::Status::INCOMING_RINGING:
return QObject::tr("Incoming").toStdString();
return QObject::tr("Incoming");
case call::Status::OUTGOING_RINGING:
return QObject::tr("Calling").toStdString();
return QObject::tr("Calling");
case call::Status::CONNECTING:
return QObject::tr("Connecting").toStdString();
return QObject::tr("Connecting");
case call::Status::SEARCHING:
return QObject::tr("Searching").toStdString();
return QObject::tr("Searching");
case call::Status::INACTIVE:
return QObject::tr("Inactive").toStdString();
return QObject::tr("Inactive");
case call::Status::ENDED:
return QObject::tr("Finished").toStdString();
return QObject::tr("Finished");
case call::Status::TIMEOUT:
return QObject::tr("Timeout").toStdString();
return QObject::tr("Timeout");
case call::Status::PEER_BUSY:
return QObject::tr("Peer busy").toStdString();
return QObject::tr("Peer busy");
case call::Status::TERMINATING:
return QObject::tr("Finished").toStdString();
return QObject::tr("Finished");
case call::Status::CONNECTED:
return QObject::tr("Communication established").toStdString();
return QObject::tr("Communication established");
default:
return ""; // to remove a build warning, should not happen
}
......@@ -94,7 +94,7 @@ to_string(const call::Status& status)
* @return
*/
static inline Status
to_status(const std::string& status)
to_status(const QString& status)
{
if (status == "INCOMING")
return Status::INCOMING_RINGING;
......@@ -127,11 +127,11 @@ enum class Type {
struct Info
{
std::string id;
QString id;
std::chrono::steady_clock::time_point startTime;
Status status = Status::INVALID;
Type type = Type::INVALID;
std::string peerUri;
QString peerUri;
bool isOutgoing;
bool audioMuted = false;
bool videoMuted = false;
......
......@@ -18,12 +18,10 @@
***************************************************************************/
#pragma once
// Std
#include <string>
// Data
#include "profile.h"
#include <QString>
namespace lrc
{
......@@ -43,7 +41,7 @@ namespace contact
struct Info
{
profile::Info profileInfo;
std::string registeredName;
QString registeredName;
bool isTrusted = false;
bool isPresent = false;
bool isBanned = false;
......
......@@ -18,18 +18,13 @@
***************************************************************************/
#pragma once
// Std
#include <string>
#include <memory>
#include <map>
// Qt
#include <qobject.h>
// LRC
#include "typedefs.h"
#include "api/behaviorcontroller.h"
#include <QObject>
#include <memory>
namespace lrc
{
......@@ -52,7 +47,7 @@ class ConversationModel;
class LIB_EXPORT ContactModel : public QObject {
Q_OBJECT
public: