qtinternetradio/irqdiskspacewatcher/inc/irqdiskspacewatcher.h
changeset 3 ee64f059b8e1
parent 2 2e1adbfc62af
child 4 3f2d53f144fe
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
     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:  Disk space watcher, information about low disk space.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IRQDISKSPACEWATCHER_H_
       
    20 #define IRQDISKSPACEWATCHER_H_
       
    21 
       
    22 #include <QObject>
       
    23 #include <QtGlobal>
       
    24 
       
    25 #include "irqdiskspaceobserverinterface.h"  // MIRQDiskSpaceObserver
       
    26 
       
    27 class IRQDiskSpaceObserver;
       
    28 
       
    29 class IRQDiskSpaceWatcher : public QObject, 
       
    30                             public MIRQDiskSpaceObserver
       
    31 {
       
    32     Q_OBJECT
       
    33     
       
    34 public:
       
    35     /*!
       
    36      * Constructor.
       
    37      */
       
    38     IMPORT_C IRQDiskSpaceWatcher();
       
    39     
       
    40     /*!
       
    41      * Destructor.
       
    42      */    
       
    43     IMPORT_C ~IRQDiskSpaceWatcher();
       
    44 
       
    45 public:   
       
    46     /*!
       
    47      *  start monitoring disk space change
       
    48      *  @param aCriticalLevel critical level which is been observed.
       
    49      *                        can NOT less than 0
       
    50      */
       
    51     IMPORT_C bool startMonitorDrive(const qint64 aCriticalLevel);
       
    52                                     
       
    53     IMPORT_C bool startMonitorDrive();
       
    54                                     
       
    55     /*!
       
    56      *  stop monitoring disk space change
       
    57      */    
       
    58     IMPORT_C void stopMonitorDrive();
       
    59 
       
    60     /**
       
    61      * @return critical level which is been observed.
       
    62      *         if -1 is returned, indicates watcher can NOT work
       
    63      */
       
    64     IMPORT_C qint64 criticalLevel() const;
       
    65     
       
    66                                            
       
    67     /**
       
    68      * Returns whether or disk defined by parameter 
       
    69      * contains less than the critical level free disk space.
       
    70      *
       
    71      * @param aCriticalLevel critical level which is been observed.
       
    72      * @return true if there is less free disk space than the critical 
       
    73      * level, otherwise false.
       
    74      */
       
    75     IMPORT_C bool isBelowCriticalLevel(const qint64 aCriticalLevel );
       
    76     IMPORT_C bool isBelowCriticalLevel();    
       
    77 public:      
       
    78     /*!
       
    79      * From MIRQDiskSpaceObserver.
       
    80      */  
       
    81     void notifyLowDiskSpace(const qint64 aCriticalLevel);
       
    82 
       
    83 signals:
       
    84     void diskSpaceLow(qint64 aCriticalLevel); 
       
    85 
       
    86 private:
       
    87     IRQDiskSpaceObserver*  iDiskSpaceObserver;
       
    88     qint64  iDefaultLevel;
       
    89 };
       
    90 
       
    91 #endif // IRQDISKSPACEWATCHER_H_