mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 05:23:06 +00:00
Qml calls and conference crashfix
* Core creation in main thread but still async with timers * For conference : no filter on items model. * Remove conference storage and use directly the one that is in Core * Fix calls model updates when a call become empty * Fix missing functions * Set Max Participants to 20
This commit is contained in:
parent
0ca74fdea0
commit
345432b8fd
20 changed files with 73 additions and 70 deletions
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "AssistantModel.hpp"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/sip-addresses/SipAddressesModel.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
|
@ -139,8 +141,10 @@ void ConferenceHelperModel::ConferenceAddModel::update () {
|
|||
linphoneAddresses.push_back(linphoneAddress);
|
||||
}
|
||||
|
||||
shared_ptr<linphone::Conference> conference = mConferenceHelperModel->mConference;
|
||||
|
||||
shared_ptr<linphone::Conference> conference = mConferenceHelperModel->mCore->getConference();
|
||||
if(!conference)
|
||||
conference = mConferenceHelperModel->mCore->createConferenceWithParams(mConferenceHelperModel->mCore->createConferenceParams());
|
||||
|
||||
// Remove sip addresses if necessary.
|
||||
for (const auto &call : CoreManager::getInstance()->getCore()->getCalls()) {
|
||||
if (!call->getParams()->getLocalConferenceMode())
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@ using namespace std;
|
|||
|
||||
ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProxyModel(parent) {
|
||||
mCore = CoreManager::getInstance()->getCore();
|
||||
mConference = mCore->getConference();
|
||||
if (!mConference)
|
||||
mConference = mCore->createConferenceWithParams(mCore->createConferenceParams());
|
||||
|
||||
mConferenceAddModel = new ConferenceAddModel(this);
|
||||
App::getInstance()->getEngine()->setObjectOwnership(mConferenceAddModel, QQmlEngine::CppOwnership);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ private:
|
|||
ConferenceAddModel *mConferenceAddModel = nullptr;
|
||||
|
||||
std::shared_ptr<linphone::Core> mCore;
|
||||
std::shared_ptr<linphone::Conference> mConference;
|
||||
};
|
||||
|
||||
#endif // CONFERENCE_HELPER_MODEL_H_
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "components/call/CallModel.hpp"
|
||||
#include "components/calls/CallsListModel.hpp"
|
||||
|
|
@ -36,13 +37,12 @@
|
|||
using namespace std;
|
||||
|
||||
ConferenceModel::ConferenceModel (QObject *parent) : QSortFilterProxyModel(parent) {
|
||||
QObject::connect(this, &ConferenceModel::rowsRemoved, [this] {
|
||||
QObject::connect(this, &ConferenceModel::rowsRemoved, [this] { // Warning : called before model remove its items
|
||||
emit countChanged(rowCount());
|
||||
});
|
||||
QObject::connect(this, &ConferenceModel::rowsInserted, [this] {
|
||||
emit countChanged(rowCount());
|
||||
});
|
||||
|
||||
setSourceModel(CoreManager::getInstance()->getCallsListModel());
|
||||
emit conferenceChanged();
|
||||
|
||||
|
|
@ -52,12 +52,10 @@ ConferenceModel::ConferenceModel (QObject *parent) : QSortFilterProxyModel(paren
|
|||
}
|
||||
|
||||
bool ConferenceModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const {
|
||||
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
const CallModel *callModel = index.data().value<CallModel *>();
|
||||
|
||||
return callModel->getCall()->getParams()->getLocalConferenceMode();
|
||||
Q_UNUSED(sourceRow)
|
||||
Q_UNUSED(sourceParent)
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ConferenceModel::terminate () {
|
||||
|
|
|
|||
|
|
@ -67,48 +67,39 @@ namespace {
|
|||
CoreManager *CoreManager::mInstance;
|
||||
|
||||
CoreManager::CoreManager (QObject *parent, const QString &configPath) :
|
||||
QObject(parent), mHandlers(make_shared<CoreHandlers>(this)) {
|
||||
mPromiseBuild = QtConcurrent::run(this, &CoreManager::createLinphoneCore, configPath);
|
||||
QObject(parent), mHandlers(make_shared<CoreHandlers>(this)) {
|
||||
QTimer * delayedCreationTimer = new QTimer();
|
||||
delayedCreationTimer->setSingleShot(true);
|
||||
QObject::connect(delayedCreationTimer, &QTimer::timeout, this , [configPath, this, delayedCreationTimer]{
|
||||
delayedCreationTimer->deleteLater();
|
||||
createLinphoneCore(configPath);
|
||||
qInfo() << QStringLiteral("Core created. Enable iterate.");
|
||||
mInstance->mCbsTimer->start();
|
||||
emit mInstance->coreCreated();
|
||||
});
|
||||
|
||||
QObject::connect(&mPromiseWatcher, &QFutureWatcher<void>::finished, this, [] {
|
||||
qInfo() << QStringLiteral("Core created. Enable iterate.");
|
||||
mInstance->mCbsTimer->start();
|
||||
CoreHandlers *coreHandlers = mHandlers.get();
|
||||
|
||||
emit mInstance->coreCreated();
|
||||
});
|
||||
|
||||
CoreHandlers *coreHandlers = mHandlers.get();
|
||||
|
||||
QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] {
|
||||
QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] {
|
||||
// Do not change this order. :) (Or pray.)
|
||||
mInstance->mCallsListModel = new CallsListModel(mInstance);
|
||||
mInstance->mContactsListModel = new ContactsListModel(mInstance);
|
||||
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
|
||||
mInstance->mSettingsModel = new SettingsModel(mInstance);
|
||||
mInstance->mSipAddressesModel = new SipAddressesModel(mInstance);
|
||||
mInstance->mCallsListModel = new CallsListModel(mInstance);
|
||||
mInstance->mContactsListModel = new ContactsListModel(mInstance);
|
||||
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
|
||||
mInstance->mSettingsModel = new SettingsModel(mInstance);
|
||||
mInstance->mSipAddressesModel = new SipAddressesModel(mInstance);
|
||||
EventCountNotifier *eventCountNotifier = new EventCountNotifier(mInstance);
|
||||
eventCountNotifier->updateUnreadMessageCount();
|
||||
QObject::connect(eventCountNotifier, &EventCountNotifier::eventCountChanged,
|
||||
mInstance, &CoreManager::eventCountChanged
|
||||
);
|
||||
mInstance->mEventCountNotifier = eventCountNotifier;
|
||||
mInstance->migrate();
|
||||
mInstance->mStarted = true;
|
||||
emit mInstance->coreStarted();
|
||||
});
|
||||
|
||||
{
|
||||
EventCountNotifier *eventCountNotifier = new EventCountNotifier(mInstance);
|
||||
eventCountNotifier->updateUnreadMessageCount();
|
||||
QObject::connect(
|
||||
eventCountNotifier, &EventCountNotifier::eventCountChanged,
|
||||
mInstance, &CoreManager::eventCountChanged
|
||||
);
|
||||
mInstance->mEventCountNotifier = eventCountNotifier;
|
||||
}
|
||||
|
||||
mInstance->migrate();
|
||||
|
||||
mInstance->mStarted = true;
|
||||
emit mInstance->coreStarted();
|
||||
});
|
||||
|
||||
QObject::connect(
|
||||
coreHandlers, &CoreHandlers::logsUploadStateChanged,
|
||||
this, &CoreManager::handleLogsUploadStateChanged
|
||||
);
|
||||
|
||||
mPromiseWatcher.setFuture(mPromiseBuild);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::logsUploadStateChanged, this, &CoreManager::handleLogsUploadStateChanged);
|
||||
delayedCreationTimer->start(CbsCallInterval);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@
|
|||
#define CORE_MANAGER_H_
|
||||
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QFutureWatcher>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
#include <QMutex>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -174,9 +177,6 @@ private:
|
|||
|
||||
QTimer *mCbsTimer = nullptr;
|
||||
|
||||
QFuture<void> mPromiseBuild;
|
||||
QFutureWatcher<void> mPromiseWatcher;
|
||||
|
||||
QMutex mMutexVideoRender;
|
||||
|
||||
static CoreManager *mInstance;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "components/call/CallModel.hpp"
|
||||
#include "components/calls/CallsListModel.hpp"
|
||||
#include "components/chat/ChatModel.hpp"
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "components/core/CoreManager.hpp"
|
||||
|
||||
#include "OwnPresenceModel.hpp"
|
||||
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "app/paths/Paths.hpp"
|
||||
|
|
@ -28,6 +30,7 @@
|
|||
#include "AccountSettingsModel.hpp"
|
||||
#include "SettingsModel.hpp"
|
||||
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariantMap>
|
||||
#include <QVariantList>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include <QDir>
|
||||
#include <QtDebug>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <linphone++/linphone.hh>
|
||||
#include <utils/MediastreamerUtils.hpp>
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "components/core/CoreHandlers.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <QDateTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "components/call/CallModel.hpp"
|
||||
#include "components/chat/ChatModel.hpp"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include <QTimer>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "components/core/CoreManager.hpp"
|
||||
#include "components/settings/SettingsModel.hpp"
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ ListView {
|
|||
|
||||
SequentialAnimation on color {
|
||||
loops: CallsStyle.entry.endCallAnimation.loops
|
||||
running: $call && $call.status === CallModel.CallStatusEnded
|
||||
running: !$call || $call.status === CallModel.CallStatusEnded
|
||||
|
||||
ColorAnimation {
|
||||
duration: CallsStyle.entry.endCallAnimation.duration
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Window {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
// `{}` is a workaround to avoid `TypeError: Cannot read property...` when calls list is empty
|
||||
readonly property var call: calls.selectedCall || ({
|
||||
readonly property var call: (calls.selectedCall?calls.selectedCall:{
|
||||
callError: '',
|
||||
isOutgoing: true,
|
||||
recording: false,
|
||||
|
|
@ -197,8 +197,8 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
peerAddress: call.peerAddress
|
||||
localAddress: call.localAddress
|
||||
peerAddress: (call?call.peerAddress:'')
|
||||
localAddress: (call?call.localAddress:'')
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
@ -225,7 +225,7 @@ Window {
|
|||
|
||||
childB: Loader {
|
||||
anchors.fill: parent
|
||||
sourceComponent: call.peerAddress && call.localAddress ? chat : null
|
||||
sourceComponent: window.call && window.call.peerAddress && window.call.localAddress ? chat : null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ Rectangle {
|
|||
width: grid.cellWidth
|
||||
|
||||
Column {
|
||||
readonly property string sipAddress: $call.sipAddress
|
||||
readonly property var sipAddressObserver: SipAddressesModel.getSipAddressObserver(sipAddress)
|
||||
readonly property string sipAddress: $call.peerAddress
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
|
|
@ -133,19 +132,19 @@ Rectangle {
|
|||
width: parent.width
|
||||
|
||||
horizontalTextAlignment: Text.AlignHCenter
|
||||
sipAddress: parent.sipAddressObserver.sipAddress
|
||||
username: LinphoneUtils.getContactUsername(parent.sipAddressObserver)
|
||||
}
|
||||
|
||||
sipAddress: parent.sipAddress
|
||||
username: LinphoneUtils.getContactUsername(parent.sipAddress)
|
||||
}
|
||||
IncallAvatar {
|
||||
|
||||
readonly property int size: Math.min(
|
||||
parent.width,
|
||||
parent.height - contactDescription.height - parent.spacing
|
||||
)
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
call: $call
|
||||
onCallChanged: if(!call) conference.conferenceModel.invalidate()
|
||||
|
||||
height: size
|
||||
width: size
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import App.Styles 1.0
|
|||
DialogPlus {
|
||||
id: conferenceManager
|
||||
|
||||
readonly property int maxParticipants: 10
|
||||
readonly property int maxParticipants: 20
|
||||
readonly property int minParticipants: 1
|
||||
|
||||
buttons: [
|
||||
|
|
|
|||
|
|
@ -224,7 +224,6 @@ Rectangle {
|
|||
|
||||
IncallAvatar {
|
||||
call: incall.call
|
||||
|
||||
height: Logic.computeAvatarSize(CallStyle.container.avatar.maxSize)
|
||||
width: height
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue