28
|
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 |
#include "cxutils.h"
|
|
19 |
#include "cxediskmonitor.h"
|
|
20 |
#include "cxediskmonitorprivate.h"
|
|
21 |
|
|
22 |
/*!
|
|
23 |
* Constructor.
|
|
24 |
*/
|
|
25 |
CxeDiskMonitor::CxeDiskMonitor(CxeSettings &settings)
|
|
26 |
{
|
|
27 |
CX_DEBUG_ENTER_FUNCTION();
|
|
28 |
p = new CxeDiskMonitorPrivate(settings);
|
|
29 |
CX_ASSERT_ALWAYS(p);
|
|
30 |
CX_DEBUG_EXIT_FUNCTION();
|
|
31 |
}
|
|
32 |
|
|
33 |
/*!
|
|
34 |
* Destructor.
|
|
35 |
*/
|
|
36 |
CxeDiskMonitor::~CxeDiskMonitor()
|
|
37 |
{
|
|
38 |
delete p;
|
|
39 |
}
|
|
40 |
|
|
41 |
/*!
|
|
42 |
* Set the warning level of free disk space.
|
|
43 |
* When free disk space falls below this limit, diskSpaceLow() signal is emitted.
|
|
44 |
* @param bytes Limit in bytes.
|
|
45 |
*/
|
|
46 |
void CxeDiskMonitor::setLowWarningLevel(qint64 bytes)
|
|
47 |
{
|
|
48 |
if (p) {
|
|
49 |
p->setLowWarningLevel(bytes);
|
|
50 |
}
|
|
51 |
}
|
|
52 |
|
|
53 |
/*!
|
|
54 |
* Slot to start monitoring disk space.
|
|
55 |
*/
|
|
56 |
void CxeDiskMonitor::start()
|
|
57 |
{
|
|
58 |
if (p) {
|
|
59 |
connect(p, SIGNAL(diskSpaceLow()), this, SIGNAL(diskSpaceLow()), Qt::UniqueConnection);
|
|
60 |
connect(p, SIGNAL(diskSpaceChanged()), this, SIGNAL(diskSpaceChanged()), Qt::UniqueConnection);
|
|
61 |
p->start();
|
|
62 |
}
|
|
63 |
}
|
|
64 |
|
|
65 |
/*!
|
|
66 |
* Slot to stop monitoring disk space.
|
|
67 |
*/
|
|
68 |
void CxeDiskMonitor::stop()
|
|
69 |
{
|
|
70 |
if (p) {
|
|
71 |
p->stop();
|
|
72 |
disconnect(p, SIGNAL(diskSpaceChanged()), this, SIGNAL(diskSpaceChanged()));
|
|
73 |
disconnect(p, SIGNAL(diskSpaceLow()), this, SIGNAL(diskSpaceLow()));
|
|
74 |
}
|
|
75 |
}
|
|
76 |
|
|
77 |
/*!
|
|
78 |
* Is monitoring ongoing at the moment.
|
|
79 |
*/
|
|
80 |
bool CxeDiskMonitor::isMonitoring() const
|
|
81 |
{
|
|
82 |
return p ? p->isMonitoring() : false;
|
|
83 |
}
|
|
84 |
|
|
85 |
/*!
|
|
86 |
* Get free disk space for Camera use in bytes.
|
|
87 |
*/
|
|
88 |
qint64 CxeDiskMonitor::free(bool cached) const
|
|
89 |
{
|
|
90 |
return p ? p->free(cached) : 0;
|
|
91 |
}
|
|
92 |
|
|
93 |
// end of file
|