00001 00005 #ifndef __SYSINFO_H__ 00006 #define __SYSINFO_H__ 00007 00008 #include<string> 00009 #include<vector> 00010 00011 #include<sys/utsname.h> 00012 #include <glib.h> 00013 #include <glib/gi18n.h> 00014 00015 #include <glibtop/fsusage.h> 00016 #include <glibtop/mountlist.h> 00017 #include <glibtop/mem.h> 00018 #include <glibtop/sysinfo.h> 00019 00020 #include<QtGui> 00021 #include <QtXml/QDomDocument> 00022 #include<QtXmlPatterns/QXmlQuery> 00023 00024 using std::string; 00025 using std::vector; 00026 00027 class SysInfo 00028 { 00029 public: 00030 string hostname; 00031 string distro_name; 00032 string distro_release; 00033 string kernel; 00034 guint64 memory_bytes; 00035 guint64 free_space_bytes; 00036 guint n_processors; 00037 vector<string> processors; 00038 00039 QString gnome_version; 00040 00041 SysInfo(); 00042 virtual ~SysInfo(); 00043 00044 private: 00045 void load_memory_info(); 00046 void load_processors_info(); 00047 void load_disk_info(); 00048 void load_uname_info(); 00049 void load_gnome_version(); 00050 00051 static const struct utsname & uname() 00052 { 00053 static struct utsname name; 00054 00055 if (!name.sysname[0]) 00056 { 00057 ::uname(&name); 00058 } 00059 00060 return name; 00061 } 00062 public: 00063 QString getHostName(); 00064 QString getKernel(); 00065 QString getGnome(); 00066 QString getFreeSpace(); 00067 QString getProcessor(); 00068 QString getMemory(); 00069 QString getRelease(); 00070 00071 std::string exec(char* cmd) ; 00072 QString convertGuintToQString(guint64 size, guint64 max_size = 0, bool want_bits = false); 00073 00074 }; 00075 #endif // __SYSINFO_H__