mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-06 20:23:08 +00:00
feat(src/app): add a ConferenceHelperModel component
This commit is contained in:
parent
6b2bd19f9a
commit
28ae7fe700
5 changed files with 93 additions and 0 deletions
|
|
@ -106,6 +106,7 @@ set(SOURCES
|
|||
src/components/codecs/AbstractCodecsModel.cpp
|
||||
src/components/codecs/AudioCodecsModel.cpp
|
||||
src/components/codecs/VideoCodecsModel.cpp
|
||||
src/components/conference/ConferenceHelperModel.cpp
|
||||
src/components/contact/ContactModel.cpp
|
||||
src/components/contact/VcardModel.cpp
|
||||
src/components/contacts/ContactsListModel.cpp
|
||||
|
|
@ -147,6 +148,7 @@ set(HEADERS
|
|||
src/components/codecs/AudioCodecsModel.hpp
|
||||
src/components/codecs/VideoCodecsModel.hpp
|
||||
src/components/Components.hpp
|
||||
src/components/conference/ConferenceHelperModel.hpp
|
||||
src/components/contact/ContactModel.hpp
|
||||
src/components/contact/VcardModel.hpp
|
||||
src/components/contacts/ContactsListModel.hpp
|
||||
|
|
|
|||
|
|
@ -343,6 +343,7 @@ void App::registerTypes () {
|
|||
registerType<CameraPreview>("CameraPreview");
|
||||
registerType<ChatModel>("ChatModel");
|
||||
registerType<ChatProxyModel>("ChatProxyModel");
|
||||
registerType<ConferenceHelperModel>("ConferenceHelperModel");
|
||||
registerType<ContactsListProxyModel>("ContactsListProxyModel");
|
||||
registerType<SmartSearchBarModel>("SmartSearchBarModel");
|
||||
registerType<SoundPlayer>("SoundPlayer");
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "chat/ChatProxyModel.hpp"
|
||||
#include "codecs/AudioCodecsModel.hpp"
|
||||
#include "codecs/VideoCodecsModel.hpp"
|
||||
#include "conference/ConferenceHelperModel.hpp"
|
||||
#include "contacts/ContactsListProxyModel.hpp"
|
||||
#include "core/CoreManager.hpp"
|
||||
#include "presence/OwnPresenceModel.hpp"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* ConferenceHelperModel.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
*
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Created on: May 11, 2017
|
||||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#include "../../Utils.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
#include "ConferenceHelperModel.hpp"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProxyModel(parent) {
|
||||
setSourceModel(CoreManager::getInstance()->getSipAddressesModel());
|
||||
|
||||
for (const auto &participant : CoreManager::getInstance()->getCore()->getConference()->getParticipants())
|
||||
mInConference << ::Utils::linphoneStringToQString(participant->asStringUriOnly());
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ConferenceHelperModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$sipAddress";
|
||||
return roles;
|
||||
}
|
||||
|
||||
bool ConferenceHelperModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const {
|
||||
const QModelIndex &index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
const QVariantMap &data = index.data().toMap();
|
||||
|
||||
return !mInConference.contains(data["sipAddress"].toString());
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* ConferenceHelperModel.hpp
|
||||
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
*
|
||||
* 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 2
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Created on: May 11, 2017
|
||||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
class ConferenceHelperModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
ConferenceHelperModel (QObject *parent = Q_NULLPTR);
|
||||
~ConferenceHelperModel () = default;
|
||||
|
||||
QHash<int, QByteArray> roleNames () const override;
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
||||
private:
|
||||
QStringList mInConference;
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue