digiKam
kmemoryinfo.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Pino Toscano <pino at kde dot org>
3  * Copyright 2011 Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License (LGPL) as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef DIGIKAM_KMEMORY_INFO_H
22 #define DIGIKAM_KMEMORY_INFO_H
23 
24 // Qt includes
25 
26 #include <QSharedDataPointer>
27 
28 // Local includes
29 
30 #include "digikam_export.h"
31 
32 class QDateTime;
33 
34 namespace Digikam
35 {
36 
37 class DIGIKAM_EXPORT KMemoryInfo
38 {
39 
40 public:
41 
46  {
47  TotalRam = 1 << 0,
48  AvailableRam = 1 << 1,
49  TotalSwap = 1 << 10,
50  AvailableSwap = 1 << 11,
51  AvailableMemory = AvailableRam | AvailableSwap
52  };
53  Q_DECLARE_FLAGS(MemoryDetails, MemoryDetail)
54 
55 
59  explicit KMemoryInfo();
60 
64  KMemoryInfo(const KMemoryInfo& info);
65 
69  ~KMemoryInfo();
70 
71  KMemoryInfo& operator=(const KMemoryInfo& info);
72 
79  int isValid() const;
80 
84  static KMemoryInfo currentInfo();
85 
93  int update();
94 
103  qint64 bytes(MemoryDetails detail) const;
104  double kilobytes(MemoryDetails detail) const;
105  double megabytes(MemoryDetails detail) const;
106 
111  QDateTime lastUpdate() const;
112 
113 public:
114 
115  // Defined as public due to use by external parts
116  class KMemoryInfoData;
117 
118 private:
119 
120  QSharedDataPointer<KMemoryInfoData> d;
121 };
122 
123 } // namespace Digikam
124 
125 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::KMemoryInfo::MemoryDetails)
126 
127 #endif // DIGIKAM_KMEMORY_INFO_H
Definition: kmemoryinfo.h:38
MemoryDetail
Definition: kmemoryinfo.h:46
Definition: datefolderview.cpp:43