Newer
Older
/********************************************************************************************
* *
* Copyright (C) 2017 Armin Felder, Dennis Beier *
* This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. *
* *
* RocketChatMobileEngine 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. *
* *
* RocketChatMobileEngine 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 RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************************/
#ifndef USERMODEL_H
#define USERMODEL_H
#include <QAbstractListModel>
#include <QSharedPointer>
#include <QMultiMap>
#include <QSet>
#include <QDebug>
#include <QMap>
#include <QList>
Q_PROPERTY( QString currentChannel READ getCurrent WRITE setCurrent NOTIFY currentChannelChanged )
UserName = Qt::UserRole + 1,
public slots:
bool insertUser( const QString &, const QSharedPointer<RocketChatUser> & );
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
QString getCurrent() const;
void setCurrent( const QString &value );
void onCurrentChannelChanged( const QString &newText );
QSharedPointer<RocketChatUser> getUserById( const QString &pId );
QHash<int, QByteArray> roleNames() const;
QSet<QString> duplicateCheck;
QMultiMap<QString, QSharedPointer<RocketChatUser>> userMap;
QMap<QString, QSharedPointer<RocketChatUser>> userOfCurrentChannel;
signals:
void currentChannelChanged( const QString &newText );