phoneuis/bubblemanager2/bubblecore/src/bubbleparticipantlistmodel.h
changeset 37 ba76fc04e6c2
child 50 377c906a8701
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Model for conference participant list.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef BUBBLEPARTICIPANTLISTMODEL_H
       
    19 #define BUBBLEPARTICIPANTLISTMODEL_H
       
    20 
       
    21 #include <QAbstractListModel>
       
    22 #include <QObject>
       
    23 
       
    24 class Participant; // helper class
       
    25 
       
    26 class BubbleParticipantListModel : public QAbstractListModel
       
    27 {
       
    28     Q_OBJECT
       
    29 
       
    30 public:
       
    31     BubbleParticipantListModel();
       
    32     ~BubbleParticipantListModel();
       
    33 
       
    34     void addParticipant(
       
    35         int bubbleId,
       
    36         const QString &name,
       
    37         int state,
       
    38         bool ciphering);
       
    39 
       
    40     void removeParticipant(
       
    41         int bubbleId);
       
    42 
       
    43     int bubbleId(int row);
       
    44 
       
    45     void reset();
       
    46 
       
    47     int rowCount(const QModelIndex &parent=QModelIndex()) const;
       
    48 
       
    49     QVariant data( const QModelIndex &index,
       
    50                    int role = Qt::DisplayRole ) const;
       
    51 
       
    52 private:
       
    53     inline bool isDataChanged(
       
    54         const Participant& participant,
       
    55         const QString &name,
       
    56         int state,
       
    57         bool ciphering) const;
       
    58 
       
    59     inline void updateData(
       
    60         Participant& participant,
       
    61         const QString &name,
       
    62         int state,
       
    63         bool ciphering) const;
       
    64 
       
    65 private:
       
    66     QList<Participant*> mParticipants;
       
    67 };
       
    68 
       
    69 
       
    70 #endif // BUBBLEPARTICIPANTLISTMODEL_H