Commit d0619b87 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsCallsChat): supports file transfer

parent 5ac95dec
...@@ -56,11 +56,15 @@ void CoreHandlers::onMessageReceived ( ...@@ -56,11 +56,15 @@ void CoreHandlers::onMessageReceived (
const shared_ptr<linphone::ChatRoom> &, const shared_ptr<linphone::ChatRoom> &,
const shared_ptr<linphone::ChatMessage> &message const shared_ptr<linphone::ChatMessage> &message
) { ) {
emit messageReceived(message); const string content_type = message->getContentType();
const App *app = App::getInstance(); if (content_type == "text/plain" || content_type == "application/vnd.gsma.rcs-ft-http+xml") {
if (!app->hasFocus()) emit messageReceived(message);
app->getNotifier()->notifyReceivedMessage(message);
const App *app = App::getInstance();
if (!app->hasFocus())
app->getNotifier()->notifyReceivedMessage(message);
}
} }
void CoreHandlers::onRegistrationStateChanged ( void CoreHandlers::onRegistrationStateChanged (
......
...@@ -42,6 +42,32 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { ...@@ -42,6 +42,32 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
// Chat & calls. // Chat & calls.
// ============================================================================= // =============================================================================
bool SettingsModel::getAutoAnswerStatus () const {
return !!m_config->getInt(UI_SECTION, "auto_answer", 0);
}
void SettingsModel::setAutoAnswerStatus (bool status) {
m_config->setInt(UI_SECTION, "auto_answer", status);
emit autoAnswerStatusChanged(status);
}
// -----------------------------------------------------------------------------
QString SettingsModel::getFileTransferUrl () const {
return ::Utils::linphoneStringToQString(
CoreManager::getInstance()->getCore()->getFileTransferServer()
);
}
void SettingsModel::setFileTransferUrl (const QString &url) {
CoreManager::getInstance()->getCore()->setFileTransferServer(
::Utils::qStringToLinphoneString(url)
);
emit fileTransferUrlChanged(url);
}
// -----------------------------------------------------------------------------
bool SettingsModel::getLimeIsSupported () const { bool SettingsModel::getLimeIsSupported () const {
return CoreManager::getInstance()->getCore()->limeAvailable(); return CoreManager::getInstance()->getCore()->limeAvailable();
} }
...@@ -367,32 +393,6 @@ void SettingsModel::setDscpVideo (int dscp) { ...@@ -367,32 +393,6 @@ void SettingsModel::setDscpVideo (int dscp) {
// Misc. // Misc.
// ============================================================================= // =============================================================================
bool SettingsModel::getAutoAnswerStatus () const {
return !!m_config->getInt(UI_SECTION, "auto_answer", 0);
}
void SettingsModel::setAutoAnswerStatus (bool status) {
m_config->setInt(UI_SECTION, "auto_answer", status);
emit autoAnswerStatusChanged(status);
}
// -----------------------------------------------------------------------------
QString SettingsModel::getFileTransferUrl () const {
return ::Utils::linphoneStringToQString(
CoreManager::getInstance()->getCore()->getFileTransferServer()
);
}
void SettingsModel::setFileTransferUrl (const QString &url) {
CoreManager::getInstance()->getCore()->setFileTransferServer(
::Utils::qStringToLinphoneString(url)
);
emit fileTransferUrlChanged(url);
}
// -----------------------------------------------------------------------------
QString SettingsModel::getSavedScreenshotsFolder () const { QString SettingsModel::getSavedScreenshotsFolder () const {
return QDir::cleanPath( return QDir::cleanPath(
::Utils::linphoneStringToQString( ::Utils::linphoneStringToQString(
......
...@@ -37,6 +37,9 @@ class SettingsModel : public QObject { ...@@ -37,6 +37,9 @@ class SettingsModel : public QObject {
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged);
Q_PROPERTY(bool limeIsSupported READ getLimeIsSupported CONSTANT); Q_PROPERTY(bool limeIsSupported READ getLimeIsSupported CONSTANT);
Q_PROPERTY(QVariantList supportedMediaEncryptions READ getSupportedMediaEncryptions CONSTANT); Q_PROPERTY(QVariantList supportedMediaEncryptions READ getSupportedMediaEncryptions CONSTANT);
...@@ -79,9 +82,6 @@ class SettingsModel : public QObject { ...@@ -79,9 +82,6 @@ class SettingsModel : public QObject {
// Misc. --------------------------------------------------------------------- // Misc. ---------------------------------------------------------------------
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged);
Q_PROPERTY(QString savedScreenshotsFolder READ getSavedScreenshotsFolder WRITE setSavedScreenshotsFolder NOTIFY savedScreenshotsFolderChanged); Q_PROPERTY(QString savedScreenshotsFolder READ getSavedScreenshotsFolder WRITE setSavedScreenshotsFolder NOTIFY savedScreenshotsFolderChanged);
Q_PROPERTY(QString savedVideosFolder READ getSavedVideosFolder WRITE setSavedVideosFolder NOTIFY savedVideosFolderChanged); Q_PROPERTY(QString savedVideosFolder READ getSavedVideosFolder WRITE setSavedVideosFolder NOTIFY savedVideosFolderChanged);
...@@ -111,6 +111,12 @@ public: ...@@ -111,6 +111,12 @@ public:
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
bool getAutoAnswerStatus () const;
void setAutoAnswerStatus (bool status);
QString getFileTransferUrl () const;
void setFileTransferUrl (const QString &url);
bool getLimeIsSupported () const; bool getLimeIsSupported () const;
QVariantList getSupportedMediaEncryptions () const; QVariantList getSupportedMediaEncryptions () const;
...@@ -175,12 +181,6 @@ public: ...@@ -175,12 +181,6 @@ public:
// Misc. --------------------------------------------------------------------- // Misc. ---------------------------------------------------------------------
bool getAutoAnswerStatus () const;
void setAutoAnswerStatus (bool status);
QString getFileTransferUrl () const;
void setFileTransferUrl (const QString &url);
QString getSavedScreenshotsFolder () const; QString getSavedScreenshotsFolder () const;
void setSavedScreenshotsFolder (const QString &folder); void setSavedScreenshotsFolder (const QString &folder);
...@@ -198,6 +198,9 @@ public: ...@@ -198,6 +198,9 @@ public:
signals: signals:
// Chat & calls. ------------------------------------------------------------- // Chat & calls. -------------------------------------------------------------
void autoAnswerStatusChanged (bool status);
void fileTransferUrlChanged (const QString &url);
void mediaEncryptionChanged (MediaEncryption encryption); void mediaEncryptionChanged (MediaEncryption encryption);
void limeStateChanged (LimeState state); void limeStateChanged (LimeState state);
...@@ -231,9 +234,6 @@ signals: ...@@ -231,9 +234,6 @@ signals:
// Misc. --------------------------------------------------------------------- // Misc. ---------------------------------------------------------------------
void autoAnswerStatusChanged (bool status);
void fileTransferUrlChanged (const QString &url);
void savedScreenshotsFolderChanged (const QString &folder); void savedScreenshotsFolderChanged (const QString &folder);
void savedVideosFolderChanged (const QString &folder); void savedVideosFolderChanged (const QString &folder);
......
...@@ -77,7 +77,11 @@ TabContainer { ...@@ -77,7 +77,11 @@ TabContainer {
FormGroup { FormGroup {
label: qsTr('fileServerLabel') label: qsTr('fileServerLabel')
TextField {} TextField {
text: SettingsModel.fileTransferUrl
onEditingFinished: SettingsModel.fileTransferUrl = text
}
} }
} }
......
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