radioapp/radiouiengine/inc/radiocarouselmodel.h
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 26 6bcf277166c1
parent 33 11b6825f0862
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef RADIOCAROUSELMODEL_H
       
    19 #define RADIOCAROUSELMODEL_H
       
    20 
       
    21 // System includes
       
    22 #include <QAbstractListModel>
       
    23 
       
    24 // User includes
       
    25 #include "radiouiengineexport.h"
       
    26 #include "radio_global.h"
       
    27 
       
    28 // Forward declarations
       
    29 class RadioCarouselModelPrivate;
       
    30 class RadioUiEngine;
       
    31 class RadioStation;
       
    32 class RadioStationModel;
       
    33 
       
    34 class UI_ENGINE_DLL_EXPORT RadioCarouselModel : public QAbstractListModel
       
    35 {
       
    36     Q_OBJECT
       
    37     Q_DECLARE_PRIVATE_D( d_ptr, RadioCarouselModel )
       
    38     Q_DISABLE_COPY( RadioCarouselModel )
       
    39 
       
    40     friend class RadioUiEngine;
       
    41     friend class RadioStationModelPrivate;
       
    42     
       
    43 public:
       
    44 
       
    45     ~RadioCarouselModel();
       
    46 
       
    47 // from base class QAbstractListModel
       
    48 
       
    49     int rowCount( const QModelIndex& parent = QModelIndex() ) const;
       
    50     QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
       
    51 
       
    52 // New functions
       
    53 
       
    54     /*!
       
    55      * Finds the closest station from the given frequency
       
    56      */
       
    57     RadioStation findClosest( const uint frequency, StationSkip::Mode mode );
       
    58 
       
    59     /*!
       
    60      * Returns the model index corresponding to the given frequency
       
    61      */
       
    62     QModelIndex modelIndexFromFrequency( uint frequency );
       
    63 
       
    64 private slots:
       
    65 
       
    66     void removeFrequency( const QModelIndex& parent, int first, int last );
       
    67 
       
    68 private:
       
    69 
       
    70     explicit RadioCarouselModel( RadioUiEngine& uiEngine, RadioStationModel& stationModel );
       
    71 
       
    72 private: // data
       
    73 
       
    74     /**
       
    75      * Unmodifiable pointer to the private implementation
       
    76      */
       
    77     RadioCarouselModelPrivate* const d_ptr;
       
    78 
       
    79 };
       
    80 
       
    81 #endif // RADIOCAROUSELMODEL_H