- * Initializes internal variables, such as:
- * - scalingSteps
- * - scalingFrequencies
- * - minFreq
- */
-void MainWindow::init()
-{
- this->minFreq = 0;
- QString freqs = readSysFile( "devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies" );
- QStringList freqList = freqs.split( " " );
- //change the order of the QStringList - last element becomes first
- for (int i=freqList.size() - 1; i>=0; --i) {
- if (freqList.at(i) != "")
- this->scalingFrequencies << freqList.at(i);
- }
- this->scalingSteps = (this->scalingFrequencies.size());
-
- //set minFreq and check avoid_frequencies
- QString min = readSysFile( "devices/system/cpu/cpu0/cpufreq/scaling_min_freq" );
- //check if avoid file exists (only on power kernel)
- QFile file( "/sys/devices/system/cpu/cpu0/cpufreq/ondemand/avoid_frequencies" );
- if (file.exists()) {
- QString avoid = readSysFile( "devices/system/cpu/cpu0/cpufreq/ondemand/avoid_frequencies" );
- QStringList avoidList = avoid.split( " " );
-
- //check if min is in avoid_frequencies
- for (int i = getScalingStep( min.toInt() ); i <= this->scalingSteps; ++i) {
- min.setNum( getScalingFreq(i) );
- if (!avoidList.contains(min)) {
- this->minFreq = min.toInt();
- break;
- }
- }
- } else {
- this->minFreq = min.toInt();
- }
- file.close();
-
- //enable save and load option on power kernels
- if (settings->usePowerKernel() && settings->isKernelConfigInstalled()) {
- ui->actionSave->setEnabled(true);
- //loading presets may cause overclocking - only enable it if overclokcing is enabled
- if (settings->useOverclocking()) {
- ui->actionLoad->setEnabled(true);
- }
- }
-}
-
-
-/**