bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogutils.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     1 /*
       
     2  * Copyright (c) 2010 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:  
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef BTDEVICESDIALOGUTILS_H
       
    19 #define BTDEVICESDIALOGUTILS_H
       
    20 
       
    21 #include <QMap>
       
    22 #include <QList>
       
    23 #include <QVariant>
       
    24 
       
    25 // A data item in this model DLL. For example, power state item consists 
       
    26 // of the information regarding the current Bluetooth power state.
       
    27 typedef QMap< int, QVariant > BtSendDataItem;
       
    28 
       
    29 // A category of the model data for specific group
       
    30 typedef QList< BtSendDataItem > BtSendDataSource;
       
    31 
       
    32 
       
    33 Q_DECLARE_METATYPE(BtSendDataItem)
       
    34 Q_DECLARE_METATYPE(BtSendDataSource)
       
    35 
       
    36 enum DevDataRole {
       
    37     NameAliasRole = Qt::DisplayRole, // QVariant::String, the name showing in UI
       
    38     ReadableBdaddrRole = Qt::UserRole, // QString, the readable format of a BD_ADDR (BT Device address)
       
    39     MajorPropertyRole,  // QVariant::Int, bits of DevMajorProperty
       
    40     MinorPropertyRole,  // QVariant::Int, bits of DevMinorProperty
       
    41     CoDRole,  // QVariant::Int, the value of Class of Device
       
    42     DeviceTypeRole //QVairant::Int, the value of Device Type
       
    43 };
       
    44 
       
    45 
       
    46 inline void setMajorProperty(
       
    47         BtSendDataItem& qtdev, int prop, bool addto)
       
    48 {
       
    49     if ( addto ) {
       
    50          qtdev[MajorPropertyRole] = 
       
    51             QVariant( qtdev[MajorPropertyRole].toInt() | prop);
       
    52     }
       
    53     else {
       
    54          qtdev[MajorPropertyRole] = 
       
    55             QVariant( qtdev[MajorPropertyRole].toInt() & ~prop);
       
    56     }
       
    57 }
       
    58 
       
    59 
       
    60 #endif /*BTDEVICESDIALOGUTILS_H*/