mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(ui/views/App/Settings/SettingsUi): supports videos/screenshots paths
This commit is contained in:
parent
c30c3d1652
commit
c71f1590dd
7 changed files with 77 additions and 13 deletions
|
|
@ -26,7 +26,6 @@
|
|||
#include "../components/contacts/ContactsListProxyModel.hpp"
|
||||
#include "../components/core/CoreManager.hpp"
|
||||
#include "../components/settings/AccountSettingsModel.hpp"
|
||||
#include "../components/settings/SettingsModel.hpp"
|
||||
#include "../components/smart-search-bar/SmartSearchBarModel.hpp"
|
||||
#include "../components/timeline/TimelineModel.hpp"
|
||||
#include "../utils.hpp"
|
||||
|
|
@ -265,7 +264,7 @@ void App::registerTypes () {
|
|||
qmlRegisterSingletonType<SettingsModel>(
|
||||
"Linphone", 1, 0, "SettingsModel",
|
||||
[](QQmlEngine *, QJSEngine *) -> QObject *{
|
||||
return new SettingsModel();
|
||||
return CoreManager::getInstance()->getSettingsModel();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "../../app/App.hpp"
|
||||
#include "../../app/Paths.hpp"
|
||||
#include "../../utils.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
|
|
@ -87,8 +86,8 @@ CallModel::CallModel (shared_ptr<linphone::Call> linphone_call) {
|
|||
|
||||
void CallModel::setRecordFile (shared_ptr<linphone::CallParams> &call_params) {
|
||||
call_params->setRecordFile(
|
||||
Paths::getCapturesDirPath() +
|
||||
::Utils::qStringToLinphoneString(
|
||||
CoreManager::getInstance()->getSettingsModel()->getSavedVideosFolder() +
|
||||
QDateTime::currentDateTime().toString("yyyy-MM-dd_hh:mm:ss")
|
||||
) + ".mkv"
|
||||
);
|
||||
|
|
@ -150,7 +149,9 @@ void CallModel::takeSnapshot () {
|
|||
qInfo() << "Take snapshot of call:" << &m_linphone_call;
|
||||
|
||||
m_linphone_call->takeVideoSnapshot(
|
||||
Paths::getCapturesDirPath() + ::Utils::qStringToLinphoneString(new_name)
|
||||
::Utils::qStringToLinphoneString(
|
||||
CoreManager::getInstance()->getSettingsModel()->getSavedScreenshotsFolder() + new_name
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ void CoreManager::init (const QString &configPath) {
|
|||
m_instance->m_calls_list_model = new CallsListModel(m_instance);
|
||||
m_instance->m_contacts_list_model = new ContactsListModel(m_instance);
|
||||
m_instance->m_sip_addresses_model = new SipAddressesModel(m_instance);
|
||||
m_instance->m_settings_model = new SettingsModel(m_instance);
|
||||
|
||||
QTimer *timer = m_instance->m_cbs_timer = new QTimer(m_instance);
|
||||
timer->setInterval(20);
|
||||
|
|
@ -88,7 +89,9 @@ void CoreManager::setResourcesPaths () {
|
|||
mspluginsdir.cd("lib/mediastreamer/plugins");
|
||||
QDir datadir(dir);
|
||||
datadir.cd("share");
|
||||
linphone::Factory::get()->setMspluginsDir(::Utils::qStringToLinphoneString(mspluginsdir.absolutePath()));
|
||||
linphone::Factory::get()->setTopResourcesDir(::Utils::qStringToLinphoneString(datadir.absolutePath()));
|
||||
|
||||
shared_ptr<linphone::Factory> factory = linphone::Factory::get();
|
||||
factory->setMspluginsDir(::Utils::qStringToLinphoneString(mspluginsdir.absolutePath()));
|
||||
factory->setTopResourcesDir(::Utils::qStringToLinphoneString(datadir.absolutePath()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "../calls/CallsListModel.hpp"
|
||||
#include "../contacts/ContactsListModel.hpp"
|
||||
#include "../settings/SettingsModel.hpp"
|
||||
#include "../sip-addresses/SipAddressesModel.hpp"
|
||||
#include "CoreHandlers.hpp"
|
||||
|
||||
|
|
@ -64,6 +65,10 @@ public:
|
|||
return m_sip_addresses_model;
|
||||
}
|
||||
|
||||
SettingsModel *getSettingsModel () const {
|
||||
return m_settings_model;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Initialization.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -92,6 +97,7 @@ private:
|
|||
CallsListModel *m_calls_list_model;
|
||||
ContactsListModel *m_contacts_list_model;
|
||||
SipAddressesModel *m_sip_addresses_model;
|
||||
SettingsModel *m_settings_model;
|
||||
|
||||
QTimer *m_cbs_timer;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,12 @@
|
|||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#include "../../app/Paths.hpp"
|
||||
#include "../../utils.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include "SettingsModel.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -59,3 +62,37 @@ void SettingsModel::setFileTransferUrl (const QString &url) {
|
|||
::Utils::qStringToLinphoneString(url)
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString SettingsModel::getSavedScreenshotsFolder () const {
|
||||
return QDir::cleanPath(
|
||||
::Utils::linphoneStringToQString(
|
||||
m_config->getString(UI_SECTION, "saved_screenshots_folder", Paths::getCapturesDirPath())
|
||||
)
|
||||
) + QDir::separator();
|
||||
}
|
||||
|
||||
void SettingsModel::setSavedScreenshotsFolder (const QString &folder) {
|
||||
QString _folder = QDir::cleanPath(folder) + QDir::separator();
|
||||
|
||||
m_config->setString(UI_SECTION, "saved_screenshots_folder", ::Utils::qStringToLinphoneString(_folder));
|
||||
emit savedScreenshotsFolderChanged(_folder);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString SettingsModel::getSavedVideosFolder () const {
|
||||
return QDir::cleanPath(
|
||||
::Utils::linphoneStringToQString(
|
||||
m_config->getString(UI_SECTION, "saved_videos_folder", Paths::getCapturesDirPath())
|
||||
)
|
||||
) + QDir::separator();
|
||||
}
|
||||
|
||||
void SettingsModel::setSavedVideosFolder (const QString &folder) {
|
||||
QString _folder = QDir::cleanPath(folder) + QDir::separator();
|
||||
|
||||
m_config->setString(UI_SECTION, "saved_videos_folder", ::Utils::qStringToLinphoneString(_folder));
|
||||
emit savedVideosFolderChanged(_folder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,22 +34,34 @@ class SettingsModel : public QObject {
|
|||
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 savedVideosFolder READ getSavedVideosFolder WRITE setSavedVideosFolder NOTIFY savedVideosFolderChanged);
|
||||
|
||||
public:
|
||||
SettingsModel (QObject *parent = Q_NULLPTR);
|
||||
|
||||
bool getAutoAnswerStatus () const;
|
||||
void setAutoAnswerStatus (bool status);
|
||||
|
||||
QString getFileTransferUrl () const;
|
||||
void setFileTransferUrl (const QString &url);
|
||||
|
||||
QString getSavedScreenshotsFolder () const;
|
||||
void setSavedScreenshotsFolder (const QString &folder);
|
||||
|
||||
QString getSavedVideosFolder () const;
|
||||
void setSavedVideosFolder (const QString &folder);
|
||||
|
||||
static const std::string UI_SECTION;
|
||||
|
||||
signals:
|
||||
void autoAnswerStatusChanged (bool status);
|
||||
void fileTransferUrlChanged (const QString &url);
|
||||
|
||||
void savedScreenshotsFolderChanged (const QString &folder);
|
||||
void savedVideosFolderChanged (const QString &folder);
|
||||
|
||||
private:
|
||||
bool getAutoAnswerStatus () const;
|
||||
void setAutoAnswerStatus (bool status);
|
||||
|
||||
QString getFileTransferUrl () const;
|
||||
void setFileTransferUrl (const QString &url);
|
||||
|
||||
std::shared_ptr<linphone::Config> m_config;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,10 @@ TabContainer {
|
|||
FileChooserButton {
|
||||
id: savedScreenshotsFolder
|
||||
|
||||
selectedFile: SettingsModel.savedScreenshotsFolder
|
||||
selectFolder: true
|
||||
|
||||
onAccepted: SettingsModel.savedScreenshotsFolder = selectedFile
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +102,10 @@ TabContainer {
|
|||
FileChooserButton {
|
||||
id: savedVideosFolder
|
||||
|
||||
selectedFile: SettingsModel.savedVideosFolder
|
||||
selectFolder: true
|
||||
|
||||
onAccepted: SettingsModel.savedVideosFolder = selectedFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue