Init
This commit is contained in:
437
.gitignore
vendored
Normal file
437
.gitignore
vendored
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,c++
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,c++
|
||||||
|
|
||||||
|
### C++ ###
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
### VisualStudio ###
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.iobj
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.tlog
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||||
|
*.vbp
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||||
|
*.dsw
|
||||||
|
*.dsp
|
||||||
|
|
||||||
|
# Visual Studio 6 technical files
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# Visual Studio History (VSHistory) files
|
||||||
|
.vshistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# VS Code files for those working on multiple tools
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Windows Installer files from build outputs
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
### VisualStudio Patch ###
|
||||||
|
# Additional files built by Visual Studio
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/visualstudio,c++
|
||||||
93
AwSystem.cpp
Normal file
93
AwSystem.cpp
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#include "AwSystem.h"
|
||||||
|
#include <windows.h>
|
||||||
|
#include <powerbase.h>
|
||||||
|
#include <powersetting.h>
|
||||||
|
|
||||||
|
|
||||||
|
#pragma comment(lib, "PowrProf.lib")
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _PROCESSOR_POWER_INFORMATION {
|
||||||
|
ULONG Number;
|
||||||
|
ULONG MaxMhz;
|
||||||
|
ULONG CurrentMhz;
|
||||||
|
ULONG MhzLimit;
|
||||||
|
ULONG MaxIdleState;
|
||||||
|
ULONG CurrentIdleState;
|
||||||
|
} PROCESSOR_POWER_INFORMATION, * PPROCESSOR_POWER_INFORMATION;
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t AwSystem::getCpuFrequency() {
|
||||||
|
uint64_t cpuFreq = 0;
|
||||||
|
SYSTEM_INFO systemInfo;
|
||||||
|
GetSystemInfo(&systemInfo);
|
||||||
|
|
||||||
|
uint32_t cpuPowerInfoArraySize = sizeof(PROCESSOR_POWER_INFORMATION) * systemInfo.dwNumberOfProcessors;
|
||||||
|
PROCESSOR_POWER_INFORMATION* cpuPowerInfoArray = new PROCESSOR_POWER_INFORMATION[systemInfo.dwNumberOfProcessors];
|
||||||
|
|
||||||
|
if (cpuPowerInfoArray == nullptr) {
|
||||||
|
return cpuFreq;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto status = CallNtPowerInformation(ProcessorInformation, NULL, 0, (void*)cpuPowerInfoArray, cpuPowerInfoArraySize);
|
||||||
|
/*
|
||||||
|
if (status == 0) {
|
||||||
|
for (size_t i = 0; i < systemInfo.dwNumberOfProcessors; i++)
|
||||||
|
{
|
||||||
|
std::cout << "Power levels for Processor #" << cpuPowerInfoArray[i].Number << "\n"
|
||||||
|
"MaxMhz: " << cpuPowerInfoArray[i].MaxMhz << "\n"
|
||||||
|
"CurrentMhz: " << cpuPowerInfoArray[i].CurrentMhz << "\n"
|
||||||
|
"MhzLimit: " << cpuPowerInfoArray[i].MhzLimit << "\n"
|
||||||
|
"MaxIdleState: " << cpuPowerInfoArray[i].MaxIdleState << "\n"
|
||||||
|
"CurrentIdleState: " << cpuPowerInfoArray[i].CurrentIdleState << "\n"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
cpuFreq = cpuPowerInfoArray[0].CurrentMhz;
|
||||||
|
delete[] cpuPowerInfoArray;
|
||||||
|
return cpuFreq;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AwSystem::isUsingPowerAdapter() {
|
||||||
|
SYSTEM_POWER_STATUS powerStatus;
|
||||||
|
|
||||||
|
GetSystemPowerStatus(&powerStatus);
|
||||||
|
|
||||||
|
return powerStatus.ACLineStatus == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AwSystem::setCpuPowerIndex(uint64_t percentage, uint32_t sleepInMs) {
|
||||||
|
GUID guid, * scheme = &guid;
|
||||||
|
|
||||||
|
PowerGetActiveScheme(NULL, &scheme);
|
||||||
|
if (isUsingPowerAdapter()) {
|
||||||
|
PowerWriteACValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_THROTTLE_MAXIMUM, percentage);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PowerWriteDCValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_THROTTLE_MAXIMUM, percentage);
|
||||||
|
}
|
||||||
|
PowerSetActiveScheme(NULL, scheme);
|
||||||
|
|
||||||
|
if (sleepInMs > 0) {
|
||||||
|
Sleep(sleepInMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t AwSystem::getCpuPowerIndex() {
|
||||||
|
GUID guid, * scheme = &guid;
|
||||||
|
uint64_t value = 0;
|
||||||
|
uint64_t valueSize = sizeof(value);
|
||||||
|
PUCHAR a;
|
||||||
|
|
||||||
|
PowerGetActiveScheme(NULL, &scheme);
|
||||||
|
if (isUsingPowerAdapter()) {
|
||||||
|
PowerReadACValue(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_THROTTLE_MAXIMUM, NULL, (PUCHAR)&value, (LPDWORD)&valueSize);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PowerReadDCValue(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_THROTTLE_MAXIMUM, NULL, (PUCHAR)&value, (LPDWORD)&valueSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
12
AwSystem.h
Normal file
12
AwSystem.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
class AwSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static uint64_t getCpuFrequency();
|
||||||
|
static bool isUsingPowerAdapter();
|
||||||
|
static void setCpuPowerIndex(uint64_t percentage, uint32_t sleepInMs = 0);
|
||||||
|
static uint64_t getCpuPowerIndex();
|
||||||
|
};
|
||||||
46
AwSystemCpuLoading.cpp
Normal file
46
AwSystemCpuLoading.cpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#include "AwSystemCpuLoading.h"
|
||||||
|
|
||||||
|
|
||||||
|
#pragma comment(lib, "Pdh.lib")
|
||||||
|
|
||||||
|
|
||||||
|
AwSystemCpuLoading::AwSystemCpuLoading() {
|
||||||
|
init();
|
||||||
|
|
||||||
|
pollingThread = std::thread([this]() {
|
||||||
|
while (1) {
|
||||||
|
if (pollingThreadStop) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->loadingValue = this->getLoading();
|
||||||
|
Sleep(1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
AwSystemCpuLoading::~AwSystemCpuLoading() {
|
||||||
|
pollingThreadStop = true;
|
||||||
|
pollingThread.join();
|
||||||
|
PdhCloseQuery(cpuQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
double AwSystemCpuLoading::getValue() {
|
||||||
|
return this->loadingValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
double AwSystemCpuLoading::getLoading() {
|
||||||
|
PDH_FMT_COUNTERVALUE counterVal;
|
||||||
|
|
||||||
|
PdhCollectQueryData(cpuQuery);
|
||||||
|
PdhGetFormattedCounterValue(cpuTotal, PDH_FMT_DOUBLE, NULL, &counterVal);
|
||||||
|
return counterVal.doubleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AwSystemCpuLoading::init() {
|
||||||
|
PdhOpenQuery(NULL, NULL, &cpuQuery);
|
||||||
|
// You can also use L"\\Processor(*)\\% Processor Time" and get individual CPU values with PdhGetFormattedCounterArray()
|
||||||
|
PdhAddCounter(cpuQuery, L"\\Processor(*)\\% Processor Time", NULL, &cpuTotal);
|
||||||
|
//PdhAddCounter(cpuQuery, L"\\Processor Information(_Total)\\% Processor Time", NULL, &cpuTotal);
|
||||||
|
PdhCollectQueryData(cpuQuery);
|
||||||
|
}
|
||||||
24
AwSystemCpuLoading.h
Normal file
24
AwSystemCpuLoading.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <pdh.h>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
|
||||||
|
class AwSystemCpuLoading
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AwSystemCpuLoading();
|
||||||
|
~AwSystemCpuLoading();
|
||||||
|
double getValue();
|
||||||
|
|
||||||
|
private:
|
||||||
|
double getLoading();
|
||||||
|
void init();
|
||||||
|
|
||||||
|
private:
|
||||||
|
PDH_HQUERY cpuQuery;
|
||||||
|
PDH_HCOUNTER cpuTotal;
|
||||||
|
std::atomic<double> loadingValue = 0.0f;
|
||||||
|
std::atomic_bool pollingThreadStop = false;
|
||||||
|
std::thread pollingThread;
|
||||||
|
};
|
||||||
207
CpuPowerRegulator.cpp
Normal file
207
CpuPowerRegulator.cpp
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
#include "CpuPowerRegulator.h"
|
||||||
|
#include <windows.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <format>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
#include "json.hpp"
|
||||||
|
#include "AwSystem.h"
|
||||||
|
|
||||||
|
|
||||||
|
CpuPowerRegulator::CpuPowerRegulator(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
cpuLoading()
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
this->loadPreference();
|
||||||
|
this->pollingTimer.start(1000);
|
||||||
|
this->checkBox_autoAdjustPowerIndex_stateChanged(this->ui.checkBox_autoAdjustPowerIndex->checkState());
|
||||||
|
|
||||||
|
connect(&this->pollingTimer, SIGNAL(timeout()), this, SLOT(cpuPolling()));
|
||||||
|
connect(this->ui.checkBox_autoAdjustPowerIndex, SIGNAL(stateChanged(int)), this, SLOT(checkBox_autoAdjustPowerIndex_stateChanged(int)));
|
||||||
|
connect(this->ui.horizontalSlider_manualPowerIndex, SIGNAL(valueChanged(int)), this, SLOT(horizontalSlider_manualPowerIndex_valueChanged(int)));
|
||||||
|
connect(this->ui.pushButton_information, SIGNAL(clicked()), this, SLOT(showInfoDialog()));
|
||||||
|
}
|
||||||
|
|
||||||
|
CpuPowerRegulator::~CpuPowerRegulator()
|
||||||
|
{
|
||||||
|
this->pollingTimer.stop();
|
||||||
|
this->savePerference();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::cpuPolling() {
|
||||||
|
auto powerIndex = AwSystem::getCpuPowerIndex();
|
||||||
|
auto cpuLoadingValue = cpuLoading.getValue();
|
||||||
|
auto cpuFrequency = AwSystem::getCpuFrequency();
|
||||||
|
|
||||||
|
this->ui.lcdNumber_currentPowerIndex->display(int(powerIndex));
|
||||||
|
this->ui.lcdNumber_currentCpuFrequency->display(int(cpuFrequency));
|
||||||
|
this->ui.lcdNumber_currentCpuLoading->display(int(cpuLoadingValue));
|
||||||
|
|
||||||
|
auto cpuLoadingThreshold = this->ui.spinBox_cpuLoadingThreshold->value();
|
||||||
|
auto cpuLoadingUpStep = this->ui.spinBox_cpuLoadingUpStep->value();
|
||||||
|
auto cpuLoadingDownStep = this->ui.spinBox_cpuLoadingDownStep->value();
|
||||||
|
auto powerIndexMin = ui.spinBox_cpuPowerIndexMin->value();
|
||||||
|
auto powerIndexMax = ui.spinBox_cpuPowerIndexMax->value();
|
||||||
|
|
||||||
|
if (cpuLoadingValue > cpuLoadingThreshold) {
|
||||||
|
powerIndex = min(powerIndex + cpuLoadingUpStep, 100);
|
||||||
|
} else {
|
||||||
|
powerIndex = max(powerIndex - cpuLoadingDownStep, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (powerIndex > powerIndexMax) {
|
||||||
|
powerIndex = powerIndexMax;
|
||||||
|
}
|
||||||
|
if (powerIndex < powerIndexMin) {
|
||||||
|
powerIndex = powerIndexMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->ui.checkBox_autoAdjustPowerIndex->checkState() == Qt::Checked) {
|
||||||
|
AwSystem::setCpuPowerIndex(powerIndex);
|
||||||
|
this->ui.horizontalSlider_manualPowerIndex->setSliderPosition(powerIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::checkBox_autoAdjustPowerIndex_stateChanged(int state) {
|
||||||
|
switch (state) {
|
||||||
|
case Qt::Checked:
|
||||||
|
this->ui.horizontalSlider_manualPowerIndex->setEnabled(false);
|
||||||
|
this->ui.label_manualPowerIndexValue->setEnabled(false);
|
||||||
|
|
||||||
|
this->ui.spinBox_cpuLoadingThreshold->setEnabled(true);
|
||||||
|
this->ui.spinBox_cpuLoadingUpStep->setEnabled(true);
|
||||||
|
this->ui.spinBox_cpuLoadingDownStep->setEnabled(true);
|
||||||
|
this->ui.spinBox_cpuPowerIndexMin->setEnabled(true);
|
||||||
|
this->ui.spinBox_cpuPowerIndexMax->setEnabled(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::Unchecked:
|
||||||
|
this->ui.horizontalSlider_manualPowerIndex->setEnabled(true);
|
||||||
|
this->ui.label_manualPowerIndexValue->setEnabled(true);
|
||||||
|
|
||||||
|
this->ui.spinBox_cpuLoadingThreshold->setEnabled(false);
|
||||||
|
this->ui.spinBox_cpuLoadingUpStep->setEnabled(false);
|
||||||
|
this->ui.spinBox_cpuLoadingDownStep->setEnabled(false);
|
||||||
|
this->ui.spinBox_cpuPowerIndexMin->setEnabled(false);
|
||||||
|
this->ui.spinBox_cpuPowerIndexMax->setEnabled(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::horizontalSlider_manualPowerIndex_valueChanged(int value) {
|
||||||
|
if (value < 1 || value > 100) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->ui.lcdNumber_currentPowerIndex->display(value);
|
||||||
|
AwSystem::setCpuPowerIndex(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::showDialog() {
|
||||||
|
this->hideTrayIcon();
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::exitApp() {
|
||||||
|
this->exitAppFlag = true;
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::showInfoDialog() {
|
||||||
|
if (infoDlg == nullptr) {
|
||||||
|
infoDlg = new infoDialog(this);
|
||||||
|
}
|
||||||
|
if (infoDlg) {
|
||||||
|
infoDlg->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::closeEvent(QCloseEvent* event) {
|
||||||
|
if (this->exitAppFlag) {
|
||||||
|
event->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->showTrayIcon();
|
||||||
|
this->hide();
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::loadPreference() {
|
||||||
|
nlohmann::json data;
|
||||||
|
|
||||||
|
if (!std::filesystem::exists("pref.json")) {
|
||||||
|
data = nlohmann::json::object();
|
||||||
|
} else {
|
||||||
|
std::ifstream f("pref.json");
|
||||||
|
data = nlohmann::json::parse(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool autoAdjust = data.contains("autoAdjust") ? data["autoAdjust"].get<bool>() : true;
|
||||||
|
Qt::CheckState checkState = autoAdjust ? Qt::Checked : Qt::Unchecked;
|
||||||
|
this->ui.checkBox_autoAdjustPowerIndex->setCheckState(checkState);
|
||||||
|
this->checkBox_autoAdjustPowerIndex_stateChanged(checkState);
|
||||||
|
|
||||||
|
int cpuLoadingThreshold = data.contains("cpuLoadingThreshold") ? data["cpuLoadingThreshold"].get<int>() : 10;
|
||||||
|
this->ui.spinBox_cpuLoadingThreshold->setValue(cpuLoadingThreshold);
|
||||||
|
|
||||||
|
int cpuLoadingUpStep = data.contains("cpuLoadingUpStep") ? data["cpuLoadingUpStep"].get<int>() : 10;
|
||||||
|
this->ui.spinBox_cpuLoadingUpStep->setValue(cpuLoadingUpStep);
|
||||||
|
|
||||||
|
int cpuLoadingDownStep = data.contains("cpuLoadingDownStep") ? data["cpuLoadingDownStep"].get<int>() : 20;
|
||||||
|
this->ui.spinBox_cpuLoadingDownStep->setValue(cpuLoadingDownStep);
|
||||||
|
|
||||||
|
int cpuPowerIndexMin = data.contains("cpuPowerIndexMin") ? data["cpuPowerIndexMin"].get<int>() : 50;
|
||||||
|
this->ui.spinBox_cpuPowerIndexMin->setValue(cpuPowerIndexMin);
|
||||||
|
|
||||||
|
int cpuPowerIndexMax = data.contains("cpuPowerIndexMax") ? data["cpuPowerIndexMax"].get<int>() : 100;
|
||||||
|
this->ui.spinBox_cpuPowerIndexMax->setValue(cpuPowerIndexMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::savePerference() {
|
||||||
|
nlohmann::json j;
|
||||||
|
|
||||||
|
j["autoAdjust"] = this->ui.checkBox_autoAdjustPowerIndex->checkState() == Qt::Checked ? true : false;
|
||||||
|
j["cpuLoadingThreshold"] = this->ui.spinBox_cpuLoadingThreshold->value();
|
||||||
|
j["cpuLoadingUpStep"] = this->ui.spinBox_cpuLoadingUpStep->value();
|
||||||
|
j["cpuLoadingDownStep"] = this->ui.spinBox_cpuLoadingDownStep->value();
|
||||||
|
j["cpuPowerIndexMin"] = this->ui.spinBox_cpuPowerIndexMin->value();
|
||||||
|
j["cpuPowerIndexMax"] = this->ui.spinBox_cpuPowerIndexMax->value();
|
||||||
|
|
||||||
|
std::ofstream out("pref.json");
|
||||||
|
out << j.dump();;
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::showTrayIcon() {
|
||||||
|
if (trayIcon == nullptr) {
|
||||||
|
trayIcon = new QSystemTrayIcon(QIcon(":/CpuPowerRegulator/icon/frequency-64x64.png"), this);
|
||||||
|
}
|
||||||
|
if (trayIconMenu == nullptr) {
|
||||||
|
trayIconMenu = new QMenu("PowerRegulator", this);
|
||||||
|
}
|
||||||
|
if (actionShowDialog == nullptr) {
|
||||||
|
actionShowDialog = new QAction("Show Dialog", this);
|
||||||
|
connect(actionShowDialog, SIGNAL(triggered()), this, SLOT(showDialog()));
|
||||||
|
}
|
||||||
|
if (actionExit == nullptr) {
|
||||||
|
actionExit = new QAction("Exit", this);
|
||||||
|
connect(actionExit, SIGNAL(triggered()), this, SLOT(exitApp()));
|
||||||
|
}
|
||||||
|
|
||||||
|
trayIconMenu->addAction(actionShowDialog);
|
||||||
|
trayIconMenu->addAction(actionExit);
|
||||||
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
|
trayIcon->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CpuPowerRegulator::hideTrayIcon() {
|
||||||
|
if (trayIcon == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
trayIcon->hide();
|
||||||
|
}
|
||||||
46
CpuPowerRegulator.h
Normal file
46
CpuPowerRegulator.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QtWidgets/QDialog>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
|
#include "AwSystemCpuLoading.h"
|
||||||
|
#include "ui_CpuPowerRegulator.h"
|
||||||
|
#include "infoDialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CpuPowerRegulator : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CpuPowerRegulator(QWidget *parent = nullptr);
|
||||||
|
~CpuPowerRegulator();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void cpuPolling();
|
||||||
|
void checkBox_autoAdjustPowerIndex_stateChanged(int state);
|
||||||
|
void horizontalSlider_manualPowerIndex_valueChanged(int value);
|
||||||
|
void showDialog();
|
||||||
|
void exitApp();
|
||||||
|
void showInfoDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loadPreference();
|
||||||
|
void savePerference();
|
||||||
|
void showTrayIcon();
|
||||||
|
void hideTrayIcon();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CpuPowerRegulatorClass ui;
|
||||||
|
QTimer pollingTimer;
|
||||||
|
AwSystemCpuLoading cpuLoading;
|
||||||
|
QSystemTrayIcon* trayIcon = nullptr;
|
||||||
|
QMenu* trayIconMenu = nullptr;
|
||||||
|
QAction* actionShowDialog = nullptr;
|
||||||
|
QAction* actionExit = nullptr;
|
||||||
|
bool exitAppFlag = false;
|
||||||
|
infoDialog* infoDlg = nullptr;
|
||||||
|
};
|
||||||
7
CpuPowerRegulator.qrc
Normal file
7
CpuPowerRegulator.qrc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="CpuPowerRegulator">
|
||||||
|
<file>icon/gafield.png</file>
|
||||||
|
<file>icon/information-512x512.png</file>
|
||||||
|
<file>icon/frequency-64x64.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
25
CpuPowerRegulator.sln
Normal file
25
CpuPowerRegulator.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.8.34511.84
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CpuPowerRegulator", "CpuPowerRegulator.vcxproj", "{52F9918F-688E-4917-8E77-DCF55DB81122}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{52F9918F-688E-4917-8E77-DCF55DB81122}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{52F9918F-688E-4917-8E77-DCF55DB81122}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{52F9918F-688E-4917-8E77-DCF55DB81122}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{52F9918F-688E-4917-8E77-DCF55DB81122}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7A04EFFB-FC78-4468-8107-27BEEEF18BFD}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
398
CpuPowerRegulator.ui
Normal file
398
CpuPowerRegulator.ui
Normal file
@@ -0,0 +1,398 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CpuPowerRegulatorClass</class>
|
||||||
|
<widget class="QDialog" name="CpuPowerRegulatorClass">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>607</width>
|
||||||
|
<height>284</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>CpuPowerRegulator</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0" colspan="4">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Current</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,1,0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>CPU loading</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLCDNumber" name="lcdNumber_currentCpuLoading">
|
||||||
|
<property name="smallDecimalPoint">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="segmentStyle">
|
||||||
|
<enum>QLCDNumber::Flat</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Power Index</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLCDNumber" name="lcdNumber_currentPowerIndex">
|
||||||
|
<property name="segmentStyle">
|
||||||
|
<enum>QLCDNumber::Flat</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>CPU Frequency
|
||||||
|
(MHz)</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLCDNumber" name="lcdNumber_currentCpuFrequency">
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="smallDecimalPoint">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="digitCount">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="segmentStyle">
|
||||||
|
<enum>QLCDNumber::Flat</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="4">
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Setting</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>If CPU loading over</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QSpinBox" name="spinBox_cpuLoadingUpStep">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Consolas</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkBox_autoAdjustPowerIndex">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto adjust</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="3">
|
||||||
|
<widget class="QSpinBox" name="spinBox_cpuPowerIndexMax">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Consolas</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>decrease power index by</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QSpinBox" name="spinBox_cpuLoadingDownStep">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Consolas</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBox_cpuLoadingThreshold">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Consolas</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Power Index Min:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Power Index Max:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>increase power index by</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBox_cpuPowerIndexMin">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Consolas</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0" colspan="4">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="horizontalSlider_manualPowerIndex">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="sliderPosition">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="tickPosition">
|
||||||
|
<enum>QSlider::NoTicks</enum>
|
||||||
|
</property>
|
||||||
|
<property name="tickInterval">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_manualPowerIndexValue">
|
||||||
|
<property name="text">
|
||||||
|
<string>100</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0" colspan="4">
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>else</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QPushButton" name="pushButton_information">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton#pushButton_information
|
||||||
|
{
|
||||||
|
qproperty-icon: url(:/CpuPowerRegulator/icon/information-512x512.png);
|
||||||
|
qproperty-iconSzie: 50px 50px;
|
||||||
|
max-width: 35px;
|
||||||
|
max-height: 35px;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources>
|
||||||
|
<include location="CpuPowerRegulator.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
119
CpuPowerRegulator.vcxproj
Normal file
119
CpuPowerRegulator.vcxproj
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
***************************************************************************************************
|
||||||
|
Copyright (C) 2023 The Qt Company Ltd.
|
||||||
|
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
***************************************************************************************************
|
||||||
|
-->
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{52F9918F-688E-4917-8E77-DCF55DB81122}</ProjectGuid>
|
||||||
|
<Keyword>QtVS_v304</Keyword>
|
||||||
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">10.0.22621.0</WindowsTargetPlatformVersion>
|
||||||
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0.22621.0</WindowsTargetPlatformVersion>
|
||||||
|
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
||||||
|
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||||
|
<QtInstall>5.15.2_msvc2019_64</QtInstall>
|
||||||
|
<QtModules>core;gui;widgets</QtModules>
|
||||||
|
<QtBuildConfig>debug</QtBuildConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||||
|
<QtInstall>5.15.2_msvc2019_64</QtInstall>
|
||||||
|
<QtModules>core;gui;widgets</QtModules>
|
||||||
|
<QtBuildConfig>release</QtBuildConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||||
|
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
||||||
|
</Target>
|
||||||
|
<ImportGroup Label="ExtensionSettings" />
|
||||||
|
<ImportGroup Label="Shared" />
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(QtMsBuild)\Qt.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||||
|
<ClCompile>
|
||||||
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||||
|
<ClCompile>
|
||||||
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtRcc Include="CpuPowerRegulator.qrc" />
|
||||||
|
<QtUic Include="CpuPowerRegulator.ui" />
|
||||||
|
<QtMoc Include="CpuPowerRegulator.h" />
|
||||||
|
<ClCompile Include="AwSystem.cpp" />
|
||||||
|
<ClCompile Include="AwSystemCpuLoading.cpp" />
|
||||||
|
<ClCompile Include="CpuPowerRegulator.cpp" />
|
||||||
|
<ClCompile Include="infoDialog.cpp" />
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
<QtUic Include="infoDialog.ui" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="AwSystem.h" />
|
||||||
|
<ClInclude Include="AwSystemCpuLoading.h" />
|
||||||
|
<QtMoc Include="infoDialog.h" />
|
||||||
|
<ClInclude Include="json.hpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||||
|
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
74
CpuPowerRegulator.vcxproj.filters
Normal file
74
CpuPowerRegulator.vcxproj.filters
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Form Files">
|
||||||
|
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||||
|
<Extensions>ui</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Translation Files">
|
||||||
|
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||||
|
<Extensions>ts</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtRcc Include="CpuPowerRegulator.qrc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</QtRcc>
|
||||||
|
<QtUic Include="CpuPowerRegulator.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
<QtMoc Include="CpuPowerRegulator.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<ClCompile Include="CpuPowerRegulator.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="AwSystemCpuLoading.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="infoDialog.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="AwSystem.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="AwSystemCpuLoading.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="json.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="AwSystem.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtUic Include="infoDialog.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<QtMoc Include="infoDialog.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
BIN
icon/frequency-64x64.png
Normal file
BIN
icon/frequency-64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
icon/gafield.png
Normal file
BIN
icon/gafield.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 918 KiB |
BIN
icon/information-512x512.png
Normal file
BIN
icon/information-512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
10
infoDialog.cpp
Normal file
10
infoDialog.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "infoDialog.h"
|
||||||
|
|
||||||
|
infoDialog::infoDialog(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
infoDialog::~infoDialog()
|
||||||
|
{}
|
||||||
16
infoDialog.h
Normal file
16
infoDialog.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "ui_infoDialog.h"
|
||||||
|
|
||||||
|
class infoDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
infoDialog(QWidget *parent = nullptr);
|
||||||
|
~infoDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::infoDialogClass ui;
|
||||||
|
};
|
||||||
110
infoDialog.ui
Normal file
110
infoDialog.ui
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>infoDialogClass</class>
|
||||||
|
<widget class="QDialog" name="infoDialogClass">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>472</width>
|
||||||
|
<height>279</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>infoDialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0,1" columnstretch="1,0,0,1">
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Calibri</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>awinhaung@gmail.com</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">min-width: 64px;
|
||||||
|
max-width: 64px;
|
||||||
|
min-height: 64px;
|
||||||
|
max-height: 64px;
|
||||||
|
|
||||||
|
border-radius: 32px;
|
||||||
|
border-width: 0 0 0 0;
|
||||||
|
border-image: url(:/CpuPowerRegulator/icon/gafield.png) 0 0 0 0 stretch strectch;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources>
|
||||||
|
<include location="CpuPowerRegulator.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
10
main.cpp
Normal file
10
main.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "CpuPowerRegulator.h"
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
CpuPowerRegulator w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user