inc/mpengine.h
changeset 20 82baf59ce8dd
child 22 ecf06a08d4d9
equal deleted inserted replaced
19:4e84c994a771 20:82baf59ce8dd
       
     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: Music Player engine.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MPENGINE_H
       
    19 #define MPENGINE_H
       
    20 
       
    21 #include <QObject>
       
    22 #include "mpmpxcommondefs.h"
       
    23 
       
    24 class QStringList;
       
    25 class QTranslator;
       
    26 class HbNotificationDialog;
       
    27 class MpMpxFrameworkWrapper;
       
    28 class MpSongScanner;
       
    29 class MpMediaKeyHandler;
       
    30 
       
    31 #if defined(BUILD_MPENGINE_LIB)
       
    32 #define MPENGINE_EXPORT Q_DECL_EXPORT
       
    33 #else
       
    34 #define MPENGINE_EXPORT Q_DECL_IMPORT
       
    35 #endif
       
    36 
       
    37 
       
    38 class MPENGINE_EXPORT MpEngine : public QObject
       
    39 {
       
    40     Q_OBJECT
       
    41 
       
    42 private:
       
    43 
       
    44     enum UsbBlockingState {
       
    45         USB_NotConnected,          // Not connected
       
    46         USB_Connected,             // Connected in MTP mode but not synchronizing
       
    47         USB_Synchronizing          // Connected in MassStorage mode or MTP mode and synchronizing
       
    48     };
       
    49 
       
    50 private:
       
    51     explicit MpEngine();
       
    52 
       
    53 public:
       
    54 
       
    55     virtual ~MpEngine();
       
    56     static MpEngine *instance();
       
    57 
       
    58     void refreshLibrary();
       
    59     bool verifyUsbBlocking( bool showMessage = false );
       
    60 
       
    61 signals:
       
    62 
       
    63     void libraryAboutToRefresh();
       
    64     void libraryRefreshed();
       
    65     void usbBlocked( bool blocked );
       
    66     void exitApplication();
       
    67 
       
    68 public slots:
       
    69 
       
    70     void handleScanStarted();
       
    71     void handleScanEnded( int count, int error );
       
    72     void handleDiskEvent( MpxDiskEvents event );
       
    73     void handleUsbEvent( MpxUsbEvents event );
       
    74 
       
    75 private:
       
    76 
       
    77     void handleUsbMassStorageStartEvent();
       
    78     void handleUsbMassStorageEndEvent();
       
    79     void handleUsbMtpStartEvent();
       
    80     void handleUsbMtpEndEvent();
       
    81     void handleUsbMtpNotActive();
       
    82 
       
    83     void changeUsbBlockingState( UsbBlockingState state );
       
    84 
       
    85 private:
       
    86 
       
    87     Q_DISABLE_COPY( MpEngine )
       
    88 
       
    89     MpMpxFrameworkWrapper       *mMpxWrapper;       // Own
       
    90     MpSongScanner               *mSongScanner;      // Own
       
    91     MpMediaKeyHandler           *mMediaKeyHandler;  // Own
       
    92 
       
    93     HbNotificationDialog        *mUsbBlockingNote;  // Own
       
    94     QTranslator                 *mMpTranslator;     // Own
       
    95 
       
    96     UsbBlockingState            mUsbBlockingState;
       
    97     UsbBlockingState            mPreviousUsbState;
       
    98 
       
    99 };
       
   100 
       
   101 #endif // MPENGINE_H