mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Advanced settings
This commit is contained in:
parent
dc28c4e5cf
commit
666b94e277
21 changed files with 774 additions and 5 deletions
|
|
@ -64,6 +64,9 @@
|
|||
#include "core/participant/ParticipantDeviceProxy.hpp"
|
||||
#include "core/participant/ParticipantGui.hpp"
|
||||
#include "core/participant/ParticipantProxy.hpp"
|
||||
#include "core/payload-type/PayloadTypeCore.hpp"
|
||||
#include "core/payload-type/PayloadTypeGui.hpp"
|
||||
#include "core/payload-type/PayloadTypeProxy.hpp"
|
||||
#include "core/phone-number/PhoneNumber.hpp"
|
||||
#include "core/phone-number/PhoneNumberProxy.hpp"
|
||||
#include "core/register/RegisterPage.hpp"
|
||||
|
|
@ -598,6 +601,9 @@ void App::initCppInterfaces() {
|
|||
qmlRegisterType<LdapProxy>(Constants::MainQmlUri, 1, 0, "LdapProxy");
|
||||
qmlRegisterType<CarddavGui>(Constants::MainQmlUri, 1, 0, "CarddavGui");
|
||||
qmlRegisterType<CarddavProxy>(Constants::MainQmlUri, 1, 0, "CarddavProxy");
|
||||
qmlRegisterType<PayloadTypeGui>(Constants::MainQmlUri, 1, 0, "PayloadTypeGui");
|
||||
qmlRegisterType<PayloadTypeProxy>(Constants::MainQmlUri, 1, 0, "PayloadTypeProxy");
|
||||
qmlRegisterType<PayloadTypeCore>(Constants::MainQmlUri, 1, 0, "PayloadTypeCore");
|
||||
|
||||
LinphoneEnums::registerMetaTypes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,11 @@ list(APPEND _LINPHONEAPP_SOURCES
|
|||
core/address-books/carddav/CarddavProxy.cpp
|
||||
core/address-books/carddav/CarddavList.cpp
|
||||
|
||||
core/payload-type/PayloadTypeCore.cpp
|
||||
core/payload-type/PayloadTypeGui.cpp
|
||||
core/payload-type/PayloadTypeProxy.cpp
|
||||
core/payload-type/PayloadTypeList.cpp
|
||||
|
||||
)
|
||||
|
||||
## Single Application
|
||||
|
|
|
|||
64
Linphone/core/payload-type/PayloadTypeCore.cpp
Normal file
64
Linphone/core/payload-type/PayloadTypeCore.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PayloadTypeCore.hpp"
|
||||
#include "core/App.hpp"
|
||||
|
||||
DEFINE_ABSTRACT_OBJECT(PayloadTypeCore)
|
||||
|
||||
QSharedPointer<PayloadTypeCore> PayloadTypeCore::create(const std::shared_ptr<linphone::PayloadType> &payloadType,
|
||||
Family family) {
|
||||
auto sharedPointer =
|
||||
QSharedPointer<PayloadTypeCore>(new PayloadTypeCore(payloadType, family), &QObject::deleteLater);
|
||||
sharedPointer->setSelf(sharedPointer);
|
||||
sharedPointer->moveToThread(App::getInstance()->thread());
|
||||
return sharedPointer;
|
||||
}
|
||||
|
||||
PayloadTypeCore::PayloadTypeCore(const std::shared_ptr<linphone::PayloadType> &payloadType, Family family)
|
||||
: QObject(nullptr) {
|
||||
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
mPayloadTypeModel = Utils::makeQObject_ptr<PayloadTypeModel>(payloadType);
|
||||
mFamily = family;
|
||||
INIT_CORE_MEMBER(Enabled, mPayloadTypeModel)
|
||||
INIT_CORE_MEMBER(ClockRate, mPayloadTypeModel)
|
||||
INIT_CORE_MEMBER(MimeType, mPayloadTypeModel)
|
||||
INIT_CORE_MEMBER(RecvFmtp, mPayloadTypeModel)
|
||||
}
|
||||
|
||||
PayloadTypeCore::~PayloadTypeCore() {
|
||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||
}
|
||||
|
||||
void PayloadTypeCore::setSelf(QSharedPointer<PayloadTypeCore> me) {
|
||||
mPayloadTypeModelConnection = QSharedPointer<SafeConnection<PayloadTypeCore, PayloadTypeModel>>(
|
||||
new SafeConnection<PayloadTypeCore, PayloadTypeModel>(me, mPayloadTypeModel), &QObject::deleteLater);
|
||||
DEFINE_CORE_GETSET_CONNECT(mPayloadTypeModelConnection, PayloadTypeCore, PayloadTypeModel, mPayloadTypeModel, bool,
|
||||
enabled, Enabled)
|
||||
}
|
||||
|
||||
PayloadTypeCore::Family PayloadTypeCore::getFamily() {
|
||||
return mFamily;
|
||||
}
|
||||
|
||||
QString PayloadTypeCore::getMimeType() {
|
||||
return mMimeType;
|
||||
}
|
||||
61
Linphone/core/payload-type/PayloadTypeCore.hpp
Normal file
61
Linphone/core/payload-type/PayloadTypeCore.hpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PAYLOAD_TYPE_CORE_H_
|
||||
#define PAYLOAD_TYPE_CORE_H_
|
||||
|
||||
#include "model/payload-type/PayloadTypeModel.hpp"
|
||||
#include "tool/AbstractObject.hpp"
|
||||
#include "tool/thread/SafeConnection.hpp"
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
class PayloadTypeCore : public QObject, public AbstractObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_ENUMS(Family)
|
||||
Q_PROPERTY(Family family MEMBER mFamily CONSTANT)
|
||||
DECLARE_CORE_GETSET_MEMBER(bool, enabled, Enabled)
|
||||
DECLARE_CORE_MEMBER(int, clockRate, ClockRate)
|
||||
DECLARE_CORE_MEMBER(QString, mimeType, MimeType)
|
||||
DECLARE_CORE_MEMBER(QString, recvFmtp, RecvFmtp)
|
||||
|
||||
public:
|
||||
|
||||
enum Family { None, Audio, Video, Text };
|
||||
|
||||
static QSharedPointer<PayloadTypeCore> create(const std::shared_ptr<linphone::PayloadType> &payloadType,
|
||||
Family family);
|
||||
PayloadTypeCore(const std::shared_ptr<linphone::PayloadType> &payloadType, Family family);
|
||||
~PayloadTypeCore();
|
||||
void setSelf(QSharedPointer<PayloadTypeCore> me);
|
||||
Family getFamily();
|
||||
QString getMimeType();
|
||||
|
||||
private:
|
||||
Family mFamily;
|
||||
std::shared_ptr<PayloadTypeModel> mPayloadTypeModel;
|
||||
QSharedPointer<SafeConnection<PayloadTypeCore, PayloadTypeModel>> mPayloadTypeModelConnection;
|
||||
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
Q_DECLARE_METATYPE(PayloadTypeCore *)
|
||||
#endif
|
||||
38
Linphone/core/payload-type/PayloadTypeGui.cpp
Normal file
38
Linphone/core/payload-type/PayloadTypeGui.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PayloadTypeGui.hpp"
|
||||
#include "core/App.hpp"
|
||||
|
||||
DEFINE_ABSTRACT_OBJECT(PayloadTypeGui)
|
||||
|
||||
PayloadTypeGui::PayloadTypeGui(QSharedPointer<PayloadTypeCore> core) {
|
||||
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::JavaScriptOwnership);
|
||||
mCore = core;
|
||||
if (isInLinphoneThread()) moveToThread(App::getInstance()->thread());
|
||||
}
|
||||
|
||||
PayloadTypeGui::~PayloadTypeGui() {
|
||||
mustBeInMainThread("~" + getClassName());
|
||||
}
|
||||
|
||||
PayloadTypeCore *PayloadTypeGui::getCore() const {
|
||||
return mCore.get();
|
||||
}
|
||||
41
Linphone/core/payload-type/PayloadTypeGui.hpp
Normal file
41
Linphone/core/payload-type/PayloadTypeGui.hpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PAYLOAD_TYPE_GUI_H_
|
||||
#define PAYLOAD_TYPE_GUI_H_
|
||||
|
||||
#include "PayloadTypeCore.hpp"
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
class PayloadTypeGui : public QObject, public AbstractObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(PayloadTypeCore *core READ getCore CONSTANT)
|
||||
|
||||
public:
|
||||
PayloadTypeGui(QSharedPointer<PayloadTypeCore> core);
|
||||
~PayloadTypeGui();
|
||||
PayloadTypeCore *getCore() const;
|
||||
QSharedPointer<PayloadTypeCore> mCore;
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
|
||||
#endif
|
||||
92
Linphone/core/payload-type/PayloadTypeList.cpp
Normal file
92
Linphone/core/payload-type/PayloadTypeList.cpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PayloadTypeList.hpp"
|
||||
#include "PayloadTypeGui.hpp"
|
||||
#include "core/App.hpp"
|
||||
#include "model/object/VariantObject.hpp"
|
||||
#include <QSharedPointer>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
DEFINE_ABSTRACT_OBJECT(PayloadTypeList)
|
||||
|
||||
QSharedPointer<PayloadTypeList> PayloadTypeList::create() {
|
||||
auto model = QSharedPointer<PayloadTypeList>(new PayloadTypeList(), &QObject::deleteLater);
|
||||
model->moveToThread(App::getInstance()->thread());
|
||||
model->setSelf(model);
|
||||
return model;
|
||||
}
|
||||
|
||||
PayloadTypeList::PayloadTypeList(QObject *parent) : ListProxy(parent) {
|
||||
mustBeInMainThread(getClassName());
|
||||
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||
}
|
||||
|
||||
PayloadTypeList::~PayloadTypeList() {
|
||||
mustBeInMainThread("~" + getClassName());
|
||||
mModelConnection = nullptr;
|
||||
}
|
||||
|
||||
void PayloadTypeList::setSelf(QSharedPointer<PayloadTypeList> me) {
|
||||
mModelConnection = QSharedPointer<SafeConnection<PayloadTypeList, CoreModel>>(
|
||||
new SafeConnection<PayloadTypeList, CoreModel>(me, CoreModel::getInstance()), &QObject::deleteLater);
|
||||
mModelConnection->makeConnectToCore(&PayloadTypeList::lUpdate, [this]() {
|
||||
mModelConnection->invokeToModel([this]() {
|
||||
QList<QSharedPointer<PayloadTypeCore>> *payloadTypes = new QList<QSharedPointer<PayloadTypeCore>>();
|
||||
mustBeInLinphoneThread(getClassName());
|
||||
for (auto payloadType : CoreModel::getInstance()->getCore()->getAudioPayloadTypes()) {
|
||||
auto model = PayloadTypeCore::create(payloadType, PayloadTypeCore::Family::Audio);
|
||||
payloadTypes->push_back(model);
|
||||
}
|
||||
for (auto payloadType : CoreModel::getInstance()->getCore()->getVideoPayloadTypes()) {
|
||||
auto model = PayloadTypeCore::create(payloadType, PayloadTypeCore::Family::Video);
|
||||
payloadTypes->push_back(model);
|
||||
}
|
||||
for (auto payloadType : CoreModel::getInstance()->getCore()->getTextPayloadTypes()) {
|
||||
auto model = PayloadTypeCore::create(payloadType, PayloadTypeCore::Family::Text);
|
||||
payloadTypes->push_back(model);
|
||||
}
|
||||
mModelConnection->invokeToCore([this, payloadTypes]() {
|
||||
mustBeInMainThread(getClassName());
|
||||
resetData();
|
||||
add(*payloadTypes);
|
||||
delete payloadTypes;
|
||||
});
|
||||
});
|
||||
});
|
||||
QObject::connect(CoreModel::getInstance().get(), &CoreModel::configuringStatus, this,
|
||||
[this](const std::shared_ptr<linphone::Core> &core, linphone::ConfiguringState status,
|
||||
const std::string &message) {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
if (status == linphone::ConfiguringState::Successful) emit lUpdate();
|
||||
});
|
||||
emit lUpdate();
|
||||
}
|
||||
|
||||
QVariant PayloadTypeList::data(const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
if (!index.isValid() || row < 0 || row >= mList.count()) return QVariant();
|
||||
if (role == Qt::DisplayRole) {
|
||||
return QVariant::fromValue(new PayloadTypeGui(mList[row].objectCast<PayloadTypeCore>()));
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
55
Linphone/core/payload-type/PayloadTypeList.hpp
Normal file
55
Linphone/core/payload-type/PayloadTypeList.hpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PAYLOAD_TYPE_LIST_H_
|
||||
#define PAYLOAD_TYPE_LIST_H_
|
||||
|
||||
#include "../proxy/ListProxy.hpp"
|
||||
#include "PayloadTypeCore.hpp"
|
||||
#include "tool/AbstractObject.hpp"
|
||||
#include "tool/thread/SafeConnection.hpp"
|
||||
#include <QLocale>
|
||||
|
||||
class CoreModel;
|
||||
|
||||
// =============================================================================
|
||||
|
||||
class PayloadTypeList : public ListProxy, public AbstractObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QSharedPointer<PayloadTypeList> create();
|
||||
|
||||
PayloadTypeList(QObject *parent = Q_NULLPTR);
|
||||
~PayloadTypeList();
|
||||
|
||||
void setSelf(QSharedPointer<PayloadTypeList> me);
|
||||
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
signals:
|
||||
void lUpdate();
|
||||
|
||||
private:
|
||||
QSharedPointer<SafeConnection<PayloadTypeList, CoreModel>> mModelConnection;
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
|
||||
#endif
|
||||
46
Linphone/core/payload-type/PayloadTypeProxy.cpp
Normal file
46
Linphone/core/payload-type/PayloadTypeProxy.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PayloadTypeProxy.hpp"
|
||||
#include "PayloadTypeGui.hpp"
|
||||
#include "PayloadTypeList.hpp"
|
||||
|
||||
DEFINE_ABSTRACT_OBJECT(PayloadTypeProxy)
|
||||
|
||||
PayloadTypeProxy::PayloadTypeProxy(QObject *parent) : SortFilterProxy(parent) {
|
||||
mPayloadTypeList = PayloadTypeList::create();
|
||||
setSourceModel(mPayloadTypeList.get());
|
||||
}
|
||||
|
||||
PayloadTypeProxy::~PayloadTypeProxy() {
|
||||
setSourceModel(nullptr);
|
||||
}
|
||||
|
||||
bool PayloadTypeProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
||||
auto data = sourceModel()->data(sourceModel()->index(sourceRow, 0, sourceParent)).value<PayloadTypeGui *>();
|
||||
return data->getCore()->getFamily() == mFamily;
|
||||
}
|
||||
|
||||
bool PayloadTypeProxy::lessThan(const QModelIndex &left, const QModelIndex &right) const {
|
||||
auto l = getItemAt<PayloadTypeList, PayloadTypeCore>(left.row());
|
||||
auto r = getItemAt<PayloadTypeList, PayloadTypeCore>(right.row());
|
||||
|
||||
return l->getMimeType() < r->getMimeType();
|
||||
}
|
||||
50
Linphone/core/payload-type/PayloadTypeProxy.hpp
Normal file
50
Linphone/core/payload-type/PayloadTypeProxy.hpp
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PAYLOAD_TYPE_PROXY_H_
|
||||
#define PAYLOAD_TYPE_PROXY_H_
|
||||
|
||||
#include "../proxy/SortFilterProxy.hpp"
|
||||
#include "PayloadTypeGui.hpp"
|
||||
#include "PayloadTypeList.hpp"
|
||||
#include "tool/AbstractObject.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
class PayloadTypeProxy : public SortFilterProxy, public AbstractObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(PayloadTypeCore::Family family MEMBER mFamily)
|
||||
|
||||
public:
|
||||
PayloadTypeProxy(QObject *parent = Q_NULLPTR);
|
||||
~PayloadTypeProxy();
|
||||
|
||||
protected:
|
||||
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
||||
PayloadTypeCore::Family mFamily;
|
||||
QSharedPointer<PayloadTypeList> mPayloadTypeList;
|
||||
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -164,6 +164,8 @@ public:
|
|||
DECLARE_CORE_GETSET(bool, exitOnClose, ExitOnClose)
|
||||
DECLARE_CORE_GETSET(bool, syncLdapContacts, SyncLdapContacts)
|
||||
DECLARE_CORE_GETSET_MEMBER(bool, ipv6Enabled, Ipv6Enabled)
|
||||
DECLARE_CORE_GETSET_MEMBER(QVariantList, audioCodecs, AudioCodecs)
|
||||
DECLARE_CORE_GETSET_MEMBER(QVariantList, videoCodecs, VideoCodecs)
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ list(APPEND _LINPHONEAPP_SOURCES
|
|||
|
||||
model/address-books/ldap/LdapModel.cpp
|
||||
model/address-books/carddav/CarddavModel.cpp
|
||||
model/payload-type/PayloadTypeModel.cpp
|
||||
|
||||
)
|
||||
|
||||
|
|
|
|||
38
Linphone/model/payload-type/PayloadTypeModel.cpp
Normal file
38
Linphone/model/payload-type/PayloadTypeModel.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PayloadTypeModel.hpp"
|
||||
#include "tool/Utils.hpp"
|
||||
|
||||
DEFINE_ABSTRACT_OBJECT(PayloadTypeModel)
|
||||
|
||||
PayloadTypeModel::PayloadTypeModel(const std::shared_ptr<linphone::PayloadType> &payloadType, QObject *parent) {
|
||||
mustBeInLinphoneThread(getClassName());
|
||||
mPayloadType = payloadType;
|
||||
}
|
||||
|
||||
PayloadTypeModel::~PayloadTypeModel() {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
}
|
||||
|
||||
DEFINE_GETSET_ENABLE(PayloadTypeModel, enabled, Enabled, mPayloadType)
|
||||
DEFINE_GET(PayloadTypeModel, int, ClockRate, mPayloadType)
|
||||
DEFINE_GET_STRING(PayloadTypeModel, MimeType, mPayloadType)
|
||||
DEFINE_GET_STRING(PayloadTypeModel, RecvFmtp, mPayloadType)
|
||||
47
Linphone/model/payload-type/PayloadTypeModel.hpp
Normal file
47
Linphone/model/payload-type/PayloadTypeModel.hpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-desktop
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PAYLOAD_TYPE_MODEL_H_
|
||||
#define PAYLOAD_TYPE_MODEL_H_
|
||||
|
||||
#include "tool/AbstractObject.hpp"
|
||||
#include <QObject>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
class PayloadTypeModel : public QObject, public AbstractObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PayloadTypeModel(const std::shared_ptr<linphone::PayloadType> &payloadType, QObject *parent = nullptr);
|
||||
~PayloadTypeModel();
|
||||
|
||||
int getClockRate() const;
|
||||
QString getMimeType() const;
|
||||
QString getRecvFmtp() const;
|
||||
|
||||
DECLARE_GETSET(bool, enabled, Enabled)
|
||||
|
||||
private:
|
||||
std::shared_ptr<linphone::PayloadType> mPayloadType;
|
||||
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -38,7 +38,8 @@
|
|||
}
|
||||
|
||||
#define DECLARE_GUI_OBJECT \
|
||||
Q_SIGNALS : void qmlNameChanged(); \
|
||||
Q_SIGNALS: \
|
||||
void qmlNameChanged(); \
|
||||
\
|
||||
public: \
|
||||
Q_PROPERTY(QString qmlName READ getQmlName WRITE setQmlName NOTIFY qmlNameChanged) \
|
||||
|
|
@ -154,6 +155,18 @@ public:
|
|||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_GET(Class, type, X, ownerNotNull) \
|
||||
type Class::get##X() const { \
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); \
|
||||
return ownerNotNull->get##X(); \
|
||||
}
|
||||
|
||||
#define DEFINE_GET_STRING(Class, X, ownerNotNull) \
|
||||
QString Class::get##X() const { \
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); \
|
||||
return Utils::coreStringToAppString(ownerNotNull->get##X()); \
|
||||
}
|
||||
|
||||
#define DEFINE_GETSET_MODEL_STRING(Class, x, X, ownerNotNull) \
|
||||
QString Class::get##X() const { \
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); \
|
||||
|
|
@ -180,6 +193,19 @@ public:
|
|||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_GETSET_ENABLE(Class, x, X, ownerNotNull) \
|
||||
bool Class::get##X() const { \
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); \
|
||||
return ownerNotNull->enabled(); \
|
||||
} \
|
||||
void Class::set##X(bool data) { \
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); \
|
||||
if (get##X() != data) { \
|
||||
ownerNotNull->enable(data); \
|
||||
emit x##Changed(data); \
|
||||
} \
|
||||
}
|
||||
|
||||
class AbstractObject {
|
||||
public:
|
||||
virtual QString getClassName() const = 0;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ list(APPEND _LINPHONEAPP_QML_FILES
|
|||
view/Control/Button/HelpIconLabelButton.qml
|
||||
view/Control/Button/IconLabelButton.qml
|
||||
view/Control/Button/MediumButton.qml
|
||||
view/Control/Button/SmallButton.qml
|
||||
view/Control/Button/CountryIndicatorCombobox.qml
|
||||
view/Control/Button/PopupButton.qml
|
||||
view/Control/Button/RadioButton.qml
|
||||
|
|
@ -110,6 +111,7 @@ list(APPEND _LINPHONEAPP_QML_FILES
|
|||
view/Page/Layout/Settings/CarddavSettingsLayout.qml
|
||||
view/Page/Layout/Settings/SecuritySettingsLayout.qml
|
||||
view/Page/Layout/Settings/NetworkSettingsLayout.qml
|
||||
view/Page/Layout/Settings/AdvancedSettingsLayout.qml
|
||||
|
||||
view/Page/Main/AbstractMainPage.qml
|
||||
view/Page/Main/Account/AccountListView.qml
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import Linphone
|
|||
|
||||
Button {
|
||||
id: mainItem
|
||||
textSize: Typography.b2.pixelSize
|
||||
textWeight: Typography.b2.weight
|
||||
textSize: Typography.b3.pixelSize
|
||||
textWeight: Typography.b3.weight
|
||||
color: DefaultStyle.main1_100
|
||||
textColor: DefaultStyle.main1_500_main
|
||||
leftPadding: 16 * DefaultStyle.dp
|
||||
|
|
|
|||
17
Linphone/view/Control/Button/SmallButton.qml
Normal file
17
Linphone/view/Control/Button/SmallButton.qml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls.Basic 2.2 as Control
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import Linphone
|
||||
|
||||
Button {
|
||||
id: mainItem
|
||||
textSize: Typography.b2.pixelSize
|
||||
textWeight: Typography.b2.weight
|
||||
color: DefaultStyle.main1_100
|
||||
textColor: DefaultStyle.main1_500_main
|
||||
leftPadding: 12 * DefaultStyle.dp
|
||||
rightPadding: 12 * DefaultStyle.dp
|
||||
topPadding: 6 * DefaultStyle.dp
|
||||
bottomPadding: 6 * DefaultStyle.dp
|
||||
}
|
||||
|
|
@ -10,14 +10,18 @@ FormItemLayout {
|
|||
label: title
|
||||
mandatory: false
|
||||
enableErrorText: true
|
||||
property string propertyName
|
||||
property var propertyOwner
|
||||
property string propertyName: "value"
|
||||
property var propertyOwner: new Array
|
||||
property var title
|
||||
property var placeHolder
|
||||
property bool useTitleAsPlaceHolder: true
|
||||
property bool canBeEmpty: true
|
||||
property bool toValidate: false
|
||||
|
||||
function value() {
|
||||
return propertyOwner[propertyName]
|
||||
}
|
||||
|
||||
property alias hidden: textField.hidden
|
||||
property alias validator: textField.validator
|
||||
|
||||
|
|
|
|||
167
Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml
Normal file
167
Linphone/view/Page/Layout/Settings/AdvancedSettingsLayout.qml
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls.Basic as Control
|
||||
import SettingsCpp 1.0
|
||||
import UtilsCpp 1.0
|
||||
import Linphone
|
||||
import 'qrc:/Linphone/view/Control/Tool/Helper/utils.js' as Utils
|
||||
|
||||
AbstractSettingsLayout {
|
||||
contentComponent: content
|
||||
Component {
|
||||
id: content
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
RowLayout {
|
||||
Layout.topMargin: 16 * DefaultStyle.dp
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
ColumnLayout {
|
||||
Layout.preferredWidth: 341 * DefaultStyle.dp
|
||||
Layout.maximumWidth: 341 * DefaultStyle.dp
|
||||
Layout.minimumWidth: 341 * DefaultStyle.dp
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Configuration distante")
|
||||
font: Typography.h4
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 20 * DefaultStyle.dp
|
||||
Layout.rightMargin: 44 * DefaultStyle.dp
|
||||
Layout.topMargin: 20 * DefaultStyle.dp
|
||||
Layout.leftMargin: 64 * DefaultStyle.dp
|
||||
DecoratedTextField {
|
||||
Layout.fillWidth: true
|
||||
id: configUri
|
||||
title: qsTr("URL de configuration distante")
|
||||
toValidate: true
|
||||
}
|
||||
SmallButton {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: qsTr("Télécharger et appliquer")
|
||||
onClicked: {
|
||||
var url = configUri.value()
|
||||
if (UtilsCpp.isValidURL(url))
|
||||
UtilsCpp.useFetchConfig(configUri.value())
|
||||
else
|
||||
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Format d'url invalide"), false, UtilsCpp.getMainWindow())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 35 * DefaultStyle.dp
|
||||
Layout.bottomMargin: 9 * DefaultStyle.dp
|
||||
height: 1 * DefaultStyle.dp
|
||||
color: DefaultStyle.main2_500main
|
||||
}
|
||||
RowLayout {
|
||||
Layout.topMargin: 16 * DefaultStyle.dp
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
ColumnLayout {
|
||||
Layout.preferredWidth: 341 * DefaultStyle.dp
|
||||
Layout.maximumWidth: 341 * DefaultStyle.dp
|
||||
Layout.minimumWidth: 341 * DefaultStyle.dp
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Codecs Audio")
|
||||
font: Typography.h4
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 20 * DefaultStyle.dp
|
||||
Layout.rightMargin: 44 * DefaultStyle.dp
|
||||
Layout.topMargin: 20 * DefaultStyle.dp
|
||||
Layout.leftMargin: 64 * DefaultStyle.dp
|
||||
Repeater {
|
||||
model: PayloadTypeProxy {
|
||||
family: PayloadTypeCore.Audio
|
||||
}
|
||||
SwitchSetting {
|
||||
Layout.fillWidth: true
|
||||
titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType)
|
||||
subTitleText: modelData.core.clockRate + " Hz"
|
||||
propertyName: "enabled"
|
||||
propertyOwner: modelData.core
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 35 * DefaultStyle.dp
|
||||
Layout.bottomMargin: 9 * DefaultStyle.dp
|
||||
height: 1 * DefaultStyle.dp
|
||||
color: DefaultStyle.main2_500main
|
||||
}
|
||||
RowLayout {
|
||||
Layout.topMargin: 16 * DefaultStyle.dp
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
ColumnLayout {
|
||||
Layout.preferredWidth: 341 * DefaultStyle.dp
|
||||
Layout.maximumWidth: 341 * DefaultStyle.dp
|
||||
Layout.minimumWidth: 341 * DefaultStyle.dp
|
||||
spacing: 5 * DefaultStyle.dp
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Codecs Vidéo")
|
||||
font: Typography.h4
|
||||
wrapMode: Text.WordWrap
|
||||
color: DefaultStyle.main2_600
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 20 * DefaultStyle.dp
|
||||
Layout.rightMargin: 44 * DefaultStyle.dp
|
||||
Layout.topMargin: 20 * DefaultStyle.dp
|
||||
Layout.leftMargin: 64 * DefaultStyle.dp
|
||||
Repeater {
|
||||
model: PayloadTypeProxy {
|
||||
family: PayloadTypeCore.Video
|
||||
}
|
||||
SwitchSetting {
|
||||
Layout.fillWidth: true
|
||||
titleText: Utils.capitalizeFirstLetter(modelData.core.mimeType)
|
||||
subTitleText: modelData.core.recvFmtp
|
||||
propertyName: "enabled"
|
||||
propertyOwner: modelData.core
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,4 +66,11 @@ QtObject {
|
|||
weight: 600 * DefaultStyle.dp
|
||||
})
|
||||
|
||||
// Button/B3 - Small Button
|
||||
property font b3: Qt.font( {
|
||||
family: DefaultStyle.defaultFont,
|
||||
pixelSize: 13 * DefaultStyle.dp,
|
||||
weight: 600 * DefaultStyle.dp
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue