1 /*
2  * File:      QtSystemInfo.h
3  * Author:    Adrian Łubik (adrian5632@gmail.com)
4  * License:   GNU LGPL v2 or newer
5  * Copyright: (c) 2010 Adrian Łubik
6  */
7 
8 #ifndef QTSYSTEMINFO_H
9 #define QTSYSTEMINFO_H
10 
11 #define QTSYSTEMINFO_VERSION 0x009000
12 
13 #include <QObject>
14 #include <QString>
15 
16 class QtSystemInfoPrivate;
17 
18 class QtSystemInfo: public QObject
19 {
20 public:
21     enum SystemType
22     {
23         UnknownType = -1,
24         UnknownUnix,
25         MacOSX,
26         Windows,
27         WindowsCE,
28         Linux,
29         UnknownBSD,
30         FreeBSD,
31         OpenBSD,
32         NetBSD
33     };
34 
35     enum ArchitectureType
36     {
37         UnknownArchitectureType = -1,
38         I386,
39         I486,
40         I586,
41         I686,
42         X86_64,
43         MPPC,
44         MPPC64
45     };
46 
47     QtSystemInfo(QObject *parent = 0);
48     ~QtSystemInfo();
49 
50     /**
51       * @return Name of currently running system's kernel.
52       */
53     QString kernelName() const;
54 
55     /**
56       * @return Version of currently running system's kernel.
57       */
58     QString kernelVersion() const;
59 
60     /**
61       * @return Architecture of the running system.
62       */
63     QString architectureName() const;
64 
65     /**
66       * @return Type of currently running system's architecture.
67       */
68     ArchitectureType architecture() const;
69 
70     /**
71       * @return Type of currently running system.
72       */
73     SystemType systemType() const;
74 
75     /**
76       * @return Name of currently running system.
77       */
78     QString systemName() const;
79 
80     /**
81       * @return Version of currently running system.
82       */
83     QString systemVersion() const;
84 
85     /**
86       * @param format A format of the information to be returned.
87       * The following strings will be replaced:
88       * %SYS_NAME - replaced with system name.
89       * %SYS_VERSION - replaced with system version.
90       * %KERN_NAME - replaced with kernel name.
91       * %KERN_VERSION - replaced with kernel version.
92       * %ARCH - replaced with architecture.
93       * If no format given, the method will default to: %SYS_NAME %SYS_VERSION (%KERN_NAME %KERN_VERSION %ARCH).
94       *
95       * @return Formatted information about the running system.
96       */
97     QString getSystemInformation(QString format = QString());
98 
99 private:
100     QtSystemInfoPrivate *d;
101 };
102 
103 
104 #endif
105