khanat-opennel-code/code/ryzom/tools/client/client_config_qt/system.h

114 lines
2.3 KiB
C
Raw Normal View History

2013-06-08 12:56:58 +00:00
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SYSTEM_H
#define SYSTEM_H
#include <nel/misc/system_info.h>
#include "config.h"
namespace NL3D
{
class IDriver;
}
struct CVideoMode
{
uint16 width;
uint16 height;
uint8 depth;
uint8 frequency;
2013-06-08 12:56:58 +00:00
CVideoMode()
{
width = 0;
2013-06-08 12:56:58 +00:00
height = 0;
depth = 0;
frequency = 0;
}
bool operator== (const CVideoMode &o)
2013-06-08 12:56:58 +00:00
{
if ((o.width == width) && (o.height == height) && (o.depth == depth) && (o.frequency == frequency))
2013-06-08 12:56:58 +00:00
return true;
else
return false;
}
};
/**
@brief Singleton class that holds the system information, configs, etc
*/
class CSystem
{
public:
CSystem();
~CSystem();
static CSystem &GetInstance()
{
static CSystem sInstance;
return sInstance;
2013-06-08 12:56:58 +00:00
}
struct CSysInfo
{
std::string videoDevice;
std::string videoDriverVersion;
std::string osName;
std::string cpuName;
uint64 totalRAM;
}
sysInfo;
2013-06-08 12:56:58 +00:00
#ifdef Q_OS_WIN32
2013-06-08 12:56:58 +00:00
struct CD3DInfo
{
std::string device;
std::string driver;
std::string driverVersion;
std::vector< CVideoMode > modes;
}
d3dInfo;
2013-06-08 12:56:58 +00:00
#endif
struct COpenGLInfo
{
std::string vendor;
std::string renderer;
std::string driverVersion;
std::string extensions;
std::vector< CVideoMode > modes;
}
openglInfo;
2013-06-08 12:56:58 +00:00
CConfig config;
private:
void GatherSysInfo();
#ifdef Q_OS_WIN32
2013-06-08 12:56:58 +00:00
void GatherD3DInfo();
#endif
void GatherOpenGLInfo();
void GetVideoModes(std::vector<CVideoMode> &dst, NL3D::IDriver *driver) const;
2013-06-08 12:56:58 +00:00
static bool parseDriverVersion(const std::string &device, uint64 driver, std::string &version);
2013-06-08 12:56:58 +00:00
};
#endif // SYSTEM_H