mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(ui/views/App/Calls/ConferenceManager): in progress
This commit is contained in:
parent
b943d4233e
commit
13c74be26e
7 changed files with 54 additions and 6 deletions
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "../../app/App.hpp"
|
||||
#include "../../Utils.hpp"
|
||||
#include "../conference/ConferenceHelperModel.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
#include "CallsListModel.hpp"
|
||||
|
|
@ -195,7 +196,7 @@ void CallsListModel::removeCall (const shared_ptr<linphone::Call> &call) {
|
|||
try {
|
||||
callModel = &call->getData<CallModel>("call-model");
|
||||
} catch (const out_of_range &) {
|
||||
// Can be a bug. Or the call model not exists because the linphone call state
|
||||
// The call model not exists because the linphone call state
|
||||
// `CallStateIncomingReceived`/`CallStateOutgoingInit` was not notified.
|
||||
qWarning() << QStringLiteral("Unable to found linphone call:") << call.get();
|
||||
return;
|
||||
|
|
@ -209,8 +210,10 @@ void CallsListModel::removeCall (const shared_ptr<linphone::Call> &call) {
|
|||
if (index == -1 || !removeRow(index))
|
||||
qWarning() << QStringLiteral("Unable to remove call:") << callModel;
|
||||
|
||||
if (mList.empty())
|
||||
if (mList.empty() && ConferenceHelperModel::getInstancesNumber() == 0) {
|
||||
qInfo() << QStringLiteral("Last call terminated, close calls window.");
|
||||
App::getInstance()->getCallsWindow()->close();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,11 @@ bool ConferenceHelperModel::ConferenceAddModel::removeFromConference (const QStr
|
|||
|
||||
void ConferenceHelperModel::ConferenceAddModel::update () {
|
||||
list<shared_ptr<linphone::Address> > linphoneAddresses;
|
||||
for (const auto &map : mRefs)
|
||||
linphoneAddresses.push_back(map->value("__linphoneAddress").value<shared_ptr<linphone::Address> > ());
|
||||
for (const auto &map : mRefs) {
|
||||
shared_ptr<linphone::Address> linphoneAddress = map->value("__linphoneAddress").value<shared_ptr<linphone::Address> >();
|
||||
Q_ASSERT(linphoneAddress != nullptr);
|
||||
linphoneAddresses.push_back(linphoneAddress);
|
||||
}
|
||||
|
||||
mConferenceHelperModel->mConference->inviteParticipants(
|
||||
linphoneAddresses,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ using namespace std;
|
|||
|
||||
// =============================================================================
|
||||
|
||||
int ConferenceHelperModel::mInstancesNumber = 0;
|
||||
|
||||
ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProxyModel(parent) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
|
||||
|
|
@ -42,6 +44,18 @@ ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProx
|
|||
App::getInstance()->getEngine()->setObjectOwnership(mConferenceAddModel, QQmlEngine::CppOwnership);
|
||||
|
||||
setSourceModel(new SipAddressesProxyModel(this));
|
||||
|
||||
mInstancesNumber++;
|
||||
}
|
||||
|
||||
ConferenceHelperModel::~ConferenceHelperModel () {
|
||||
mInstancesNumber--;
|
||||
Q_ASSERT(mInstancesNumber >= 0);
|
||||
|
||||
if (mInstancesNumber == 0 && CoreManager::getInstance()->getCallsListModel()->rowCount() == 0) {
|
||||
qInfo() << QStringLiteral("Conference terminated and no calls, close calls window.");
|
||||
App::getInstance()->getCallsWindow()->close();
|
||||
}
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ConferenceHelperModel::roleNames () const {
|
||||
|
|
|
|||
|
|
@ -45,10 +45,14 @@ public:
|
|||
class ConferenceAddModel;
|
||||
|
||||
ConferenceHelperModel (QObject *parent = Q_NULLPTR);
|
||||
~ConferenceHelperModel () = default;
|
||||
~ConferenceHelperModel ();
|
||||
|
||||
QHash<int, QByteArray> roleNames () const override;
|
||||
|
||||
static int getInstancesNumber () {
|
||||
return mInstancesNumber;
|
||||
}
|
||||
|
||||
Q_INVOKABLE void setFilter (const QString &pattern);
|
||||
|
||||
protected:
|
||||
|
|
@ -62,6 +66,8 @@ private:
|
|||
ConferenceAddModel *mConferenceAddModel;
|
||||
|
||||
std::shared_ptr<linphone::Conference> mConference;
|
||||
|
||||
static int mInstancesNumber;
|
||||
};
|
||||
|
||||
#endif // CONFERENCE_HELPER_MODEL_H_
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import Common.Styles 1.0
|
|||
Rectangle {
|
||||
id: field
|
||||
|
||||
property bool readOnly: false
|
||||
|
||||
default property alias _content: content.data
|
||||
|
||||
color: TextFieldStyle.background.color.normal
|
||||
|
|
@ -30,4 +32,12 @@ Rectangle {
|
|||
color: 'transparent'
|
||||
radius: field.radius
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
visible: field.readOnly
|
||||
|
||||
onWheel: wheel.accepted = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ import App.Styles 1.0
|
|||
// =============================================================================
|
||||
|
||||
DialogPlus {
|
||||
id: conferenceManager
|
||||
|
||||
readonly property int maxParticipants: 10
|
||||
readonly property int minParticipants: 2
|
||||
|
||||
buttons: [
|
||||
TextButtonA {
|
||||
text: qsTr('cancel')
|
||||
|
|
@ -16,6 +21,7 @@ DialogPlus {
|
|||
onClicked: exit(0)
|
||||
},
|
||||
TextButtonB {
|
||||
enabled: toAddView.count >= conferenceManager.minParticipants
|
||||
text: qsTr('confirm')
|
||||
|
||||
onClicked: {
|
||||
|
|
@ -68,6 +74,8 @@ DialogPlus {
|
|||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
readOnly: toAddView.count >= conferenceManager.maxParticipants
|
||||
|
||||
SipAddressesView {
|
||||
anchors.fill: parent
|
||||
|
||||
|
|
@ -113,6 +121,8 @@ DialogPlus {
|
|||
Layout.topMargin: filter.height + ConferenceManagerStyle.columns.selector.spacing
|
||||
|
||||
SipAddressesView {
|
||||
id: toAddView
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
actions: [{
|
||||
|
|
@ -123,6 +133,8 @@ DialogPlus {
|
|||
}]
|
||||
|
||||
model: conferenceHelperModel.toAdd
|
||||
|
||||
onEntryClicked: actions[0].handler(entry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2b6bcbc7f46423d17c18f2e2eafe52ac245e337f
|
||||
Subproject commit 38638e543d1641ff637f32c4424f61684c861cea
|
||||
Loading…
Add table
Reference in a new issue