DtkCore
DTK Core module
载入中...
搜索中...
未找到
Dtk::Core::DSysInfo类 参考

dsysinfo 是一组用于查询系统信息的静态类 更多...

Public 类型

enum  ProductType {
  UnknownType = 0 , Deepin , ArchLinux , CentOS ,
  Debian , Fedora , LinuxMint , Manjaro ,
  openSUSE , SailfishOS , Ubuntu , Uos ,
  Gentoo , NixOS
}
 产品信息 更多...
 
enum  DeepinType {
  UnknownDeepin = 0 , DeepinDesktop , DeepinProfessional , DeepinServer ,
  DeepinPersonal , DeepinMilitary
}
 深度操作系统版本 更多...
 
enum  LogoType { Normal = 0 , Light , Symbolic , Transparent }
 系统的logo类型 更多...
 
enum  OrgType { Distribution , Distributor , Manufacturer }
 组织类型 更多...
 
enum  UosType {
  UosTypeUnknown , UosDesktop , UosServer , UosDevice ,
  UosSmart , UosTypeCount
}
 UOS版本类型 更多...
 
enum  UosEdition {
  UosEditionUnknown , UosProfessional , UosHome , UosCommunity ,
  UosMilitary , UosEnterprise , UosEnterpriseC , UosEuler ,
  UosMilitaryS , UosDeviceEdition , UosEducation , UosEditionCount
}
 详细uos版本 更多...
 
enum  UosArch {
  UosArchUnknown , UosAMD64 = 1 << 0 , UosARM64 = 1 << 1 , UosMIPS64 = 1 << 2 ,
  UosSW64 = 1 << 3
}
 UOS使用的架构 更多...
 
enum  Arch {
  ARM64 , ARM64_BE , ARM , ARM_BE ,
  ALPHA , SW_64 , ARC , ARC_BE ,
  CRIS , X86_64 , X86 , IA64 ,
  LOONGARCH64 , M68K , MIPS64_LE , MIPS64 ,
  MIPS_LE , MIPS , NIOS2 , PARISC64 ,
  PARISC , PPC64_LE , PPC64 , PPC ,
  PPC_LE , RISCV32 , RISCV64 , S390X ,
  S390 , SH64 , SH , SPARC64 ,
  SPARC , TILEGX , NUM_ARCHES
}
 

静态 Public 成员函数

static bool isDeepin ()
 是否为 deepin 或 uos 系统
 
static bool isDDE ()
 是否使用 dde 桌面环境
 
static DeepinType deepinType ()
 deepin 系统类型
 
static QString deepinTypeDisplayName (const QLocale &locale=QLocale::system())
 显示的 deepin 发行版类型名称
 
static QString deepinVersion ()
 deepin 版本
 
static QString deepinEdition ()
 
static QString deepinCopyright ()
 deepin 开源许可协议
 
static UosType uosType ()
 
static UosEdition uosEditionType ()
 DSysInfo::osEditionType 版本类型 显示版本类型 专业版/个人版/社区版..
 
static QString uosProductTypeName (const QLocale &locale=QLocale::system())
 
static QString uosSystemName (const QLocale &locale=QLocale::system())
 SystemName[xx] 项对应的值
 
static QString uosEditionName (const QLocale &locale=QLocale::system())
 
static QString spVersion ()
 阶段版本名称
 
static QString udpateVersion ()
 更新版本名称 小版本号 A-BC-D 中 D、A.B.C 模式中的 C 返回 update1… update9, 如果正式版返回空 X.Y.Z 模式下暂不支持返回此版本号
 
static QString majorVersion ()
 主版本号 主版本号 【20】【23】【25】【26】【29】【30】
 
static QString minorVersion ()
 小版本号 【ABCD】 ·[0-9]{4} 【A.B.C】 或者【X.Y.Z】
 
static QString buildVersion ()
 小版本号 系统镜像批次号, 按时间顺序(不可回退)从100-999递增
 
static QString distributionInfoPath ()
 返回 distribution 文件地址 一般在/usr/share/deepin/目录下
 
static QString distributionInfoSectionName (OrgType type)
 返回 distribution.info 文件中 SectionName 字段的值
 
static QString distributionOrgName (OrgType type=Distribution, const QLocale &locale=QLocale::system())
 返回组织名称
 
static QPair< QString, QString > distributionOrgWebsite (OrgType type=Distribution)
 发行版组织的网站名称和网址。使用 type 作为 Distribution 获取当前 deepin 发行版本身的名称。
 
static QString distributionOrgLogo (OrgType orgType=Distribution, LogoType type=Normal, const QString &fallback=QString())
 获得的组织logo路径, 如果不存在, 则返回给定的其他路径
 
static QString operatingSystemName ()
 操作系统名
 
static ProductType productType ()
 产品类型
 
static QString productTypeString ()
 
static QString productVersion ()
 产品版本
 
static bool isCommunityEdition ()
 检查当前版本是否是社区版 开发者可以使用这种方式来检查我们是否需要启用或禁用社区版或企业版的功能。
 
static QString computerName ()
 电脑名
 
static QString cpuModelName ()
 cpu模式名
 
static qint64 memoryInstalledSize ()
 内存安装大小
 
static qint64 memoryTotalSize ()
 实际内存大小
 
static qint64 systemDiskSize ()
 系统磁盘大小
 
static QDateTime bootTime ()
 系统启动时间点
 
static QDateTime shutdownTime ()
 上一次正常关机时间点(重启也会被记录在内)
 
static qint64 uptime ()
 系统启动到现在时长
 
static Arch arch ()
 cpu架构信息
 

详细描述

dsysinfo 是一组用于查询系统信息的静态类

概述

dsysinfo是一组用于查询系统信息的静态类

项目目录结构如下:

├── CMakeLists.txt
└── main.cpp

CMakeLists.txt

cmake_minimum_required(VERSION 3.13) # cmake版本要求
set (VERSION "1.0.0" CACHE STRING "define project version") # 定义项目版本
set(BIN_NAME test) # 定义项目名称
project(test) # 定义项目名称
file(GLOB_RECURSE SRCS "*.h" "*.cpp") # 定义项目源文件
find_package(Qt5 REQUIRED COMPONENTS Core) # 寻找Qt5
find_package(DtkCore REQUIRED) # 寻找DtkCore
add_executable(test
main.cpp # 源文件
)
target_link_libraries(test PRIVATE
${DtkCore_LIBRARIES} # 链接DtkCore
Qt5::Core # 链接Qt5
)

main.cpp

#include <DSysInfo> // 引入DSysInfo
#include <qdebug.h> // 引入qdebug.h
DCORE_USE_NAMESPACE // 使用dtkcore命名空间
int main(int argc, char **argv) {
qDebug() << DSysInfo::deepinType(); // 打印deepin类型
qDebug() << DSysInfo::ProductType(); // 打印产品类型
return 0;
}
static DeepinType deepinType()
deepin 系统类型
ProductType
产品信息
Definition dsysinfo.h:19

成员枚举类型说明

◆ DeepinType

深度操作系统版本

枚举值
UnknownDeepin 

未知版本

DeepinDesktop 

桌面版

DeepinProfessional 

deepin专业版, 现为uos专业版

DeepinServer 

deepin服务器版本, 现为uos服务器版

DeepinPersonal 

deepin个人版, 现为uos家庭版

◆ LogoType

系统的logo类型

枚举值
Normal 

正常

Light 

亮色

Symbolic 

符号

Transparent 

水印

◆ OrgType

组织类型

枚举值
Distribution 

当前版本

Distributor 

当前发行版

Manufacturer 

当前发行版或设备的制造商

◆ ProductType

产品信息

枚举值
Deepin 

深度操作系统

ArchLinux 

ArchLinux

CentOS 

CentOS

Debian 

Debian

Fedora 

Fedora

LinuxMint 

LinuxMint

Manjaro 

Manjaro

openSUSE 

openSUSE

SailfishOS 

SailfishOS

Ubuntu 

Ubuntu

Uos 

UOS

Gentoo 

Gentoo

NixOS 

NixOS

◆ UosArch

UOS使用的架构

枚举值
UosArchUnknown 

未知架构

UosAMD64 

x86_64

UosARM64 

arm64

UosMIPS64 

mips64

UosSW64 

sw_64

◆ UosEdition

详细uos版本

枚举值
UosEditionUnknown 

未知版本

UosProfessional 

UOS专业版

UosHome 

UOS家庭版

UosCommunity 

社区版

UosMilitary 
UosEnterprise 

UOS企业版

UosEnterpriseC 

UOS行业版

UosEuler 

UOS服务器欧拉版

UosMilitaryS 
UosDeviceEdition 

UOS专用设备版

UosEducation 

UOS教育版

UosEditionCount 

记录枚举数量

◆ UosType

UOS版本类型

枚举值
UosTypeUnknown 

未知版本

UosDesktop 

UOS桌面版

UosServer 

UOS服务器版

UosDevice 

UOS设备版

UosTypeCount 

记录枚举数量

成员函数说明

◆ arch()

static Arch Dtk::Core::DSysInfo::arch ( )
static

cpu架构信息

注解
此处架构是从gcc编译器获取的

◆ buildVersion()

static QString Dtk::Core::DSysInfo::buildVersion ( )
static

小版本号 系统镜像批次号, 按时间顺序(不可回退)从100-999递增

注解
此方法仅在 linux 平台下可用

◆ deepinCopyright()

static QString Dtk::Core::DSysInfo::deepinCopyright ( )
static

deepin 开源许可协议

注解
此方法仅在 linux 平台下可用

◆ deepinType()

static DeepinType Dtk::Core::DSysInfo::deepinType ( )
static

deepin 系统类型

注解
此方法仅在 linux 平台下可用

◆ deepinTypeDisplayName()

static QString Dtk::Core::DSysInfo::deepinTypeDisplayName ( const QLocale &  locale = QLocale::system())
static

显示的 deepin 发行版类型名称

注解
此方法仅在 linux 平台下可用

◆ deepinVersion()

static QString Dtk::Core::DSysInfo::deepinVersion ( )
static

deepin 版本

注解
此方法仅在 linux 平台下可用

◆ distributionOrgLogo()

static QString Dtk::Core::DSysInfo::distributionOrgLogo ( OrgType  orgType = Distribution,
LogoType  type = Normal,
const QString &  fallback = QString() 
)
static

获得的组织logo路径, 如果不存在, 则返回给定的其他路径

使用 type 作为 Distribution 获取当前 deepin 发行版本身的logo。

◆ distributionOrgName()

static Dtk::Core::DSysInfo::distributionOrgName ( OrgType  type = Distribution,
const QLocale &  locale = QLocale::system() 
)
static

返回组织名称

使用类型为Distribution来获取当前deepin distribution本身的名称

◆ isCommunityEdition()

static bool Dtk::Core::DSysInfo::isCommunityEdition ( )
static

检查当前版本是否是社区版 开发者可以使用这种方式来检查我们是否需要启用或禁用社区版或企业版的功能。

目前的规则: 专业版、服务器版、个人版(DeepinType)将被视为企业版。
Uos(ProductType)将被视为企业版。

◆ isDDE()

static bool Dtk::Core::DSysInfo::isDDE ( )
static

是否使用 dde 桌面环境

注解
此方法仅在 linux 平台下可用

◆ isDeepin()

static bool Dtk::Core::DSysInfo::isDeepin ( )
static

是否为 deepin 或 uos 系统

返回
0 不是 deepin 或 uos 系统
1 是 deepin 或 uos 系统

◆ majorVersion()

static QString Dtk::Core::DSysInfo::majorVersion ( )
static

主版本号 主版本号 【20】【23】【25】【26】【29】【30】

注解
此方法仅在 linux 平台下可用

◆ minorVersion()

static QString Dtk::Core::DSysInfo::minorVersion ( )
static

小版本号 【ABCD】 ·[0-9]{4} 【A.B.C】 或者【X.Y.Z】

注解
此方法仅在 linux 平台下可用

◆ spVersion()

static QString Dtk::Core::DSysInfo::spVersion ( )
static

阶段版本名称

小版本号 A-BC-D 中 BC、 A.B.C 中的 B 返回 SP1-SPxx, 如果正式版返回空 X.Y.Z模式下暂不支持返回此版本号

注解
minVersion.BC == 00 正式版本, minVersion.BC | minVersion.B == 01-99 SP1….SP99
此方法仅在 linux 平台下可用

◆ udpateVersion()

static QString Dtk::Core::DSysInfo::udpateVersion ( )
static

更新版本名称 小版本号 A-BC-D 中 D、A.B.C 模式中的 C 返回 update1… update9, 如果正式版返回空 X.Y.Z 模式下暂不支持返回此版本号

注解
minVersion.D == 0;正式版本 minVersion.D | minVersion.C == 1-9;update1… update9, updateA...updateZ
此方法仅在 linux 平台下可用

◆ uosEditionType()

static UosEdition Dtk::Core::DSysInfo::uosEditionType ( )
static

DSysInfo::osEditionType 版本类型 显示版本类型 专业版/个人版/社区版..

注解
根据 osBuild.B && osBuild.D
此方法仅在 linux 平台下可用

◆ uosSystemName()

static QString Dtk::Core::DSysInfo::uosSystemName ( const QLocale &  locale = QLocale::system())
static

SystemName[xx] 项对应的值

如果找不到对应语言的默认使用 SystemName 的值 Uniontech OS locale 当前系统语言

注解
此方法仅在 linux 平台下可用

◆ uptime()

static qint64 Dtk::Core::DSysInfo::uptime ( )
static

系统启动到现在时长

注解
参见cat /proc/uptime命令

该类的文档由以下文件生成: