Low Power Mode detection

Change low to reduced

Low Power Mode detection

Fix namespace space

Low Power Mode detection

Fix namespace space

Low Power Mode detection
This commit is contained in:
nastys 2022-03-05 17:32:35 +01:00 committed by Megamouse
parent 686d2759f4
commit ce7b1576e0
4 changed files with 35 additions and 0 deletions

View file

@ -513,14 +513,18 @@ int main(int argc, char** argv)
rlim.rlim_max = 4096;
#ifdef RLIMIT_NOFILE
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
{
std::cerr << "Failed to set max open file limit (4096).\n";
}
#endif
rlim.rlim_cur = 0x80000000;
rlim.rlim_max = 0x80000000;
#ifdef RLIMIT_MEMLOCK
if (::setrlimit(RLIMIT_MEMLOCK, &rlim) != 0)
{
std::cerr << "Failed to set RLIMIT_MEMLOCK size to 2 GiB. Try to update your system configuration.\n";
}
#endif
// Work around crash on startup on KDE: https://bugs.kde.org/show_bug.cgi?id=401637
setenv( "KDE_DEBUG", "1", 0 );
@ -531,7 +535,9 @@ int main(int argc, char** argv)
::getrlimit(RLIMIT_NOFILE, &rlim);
rlim.rlim_cur = OPEN_MAX;
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
{
std::cerr << "Failed to set max open file limit (" << OPEN_MAX << ").\n";
}
#endif
#ifndef _WIN32
@ -539,6 +545,11 @@ int main(int argc, char** argv)
sys_log.notice("Maximum open file descriptors: %i", utils::get_maxfiles());
#endif
if (utils::get_low_power_mode())
{
sys_log.error("Low Power Mode is enabled, performance may be reduced.");
}
std::lock_guard qt_init(s_qt_init);
// The constructor of QApplication eats the --style and --stylesheet arguments.