Beispiel #1
0
void NeoHardware::shutdownRequested()
{
    qLog(PowerManagement)<< __PRETTY_FUNCTION__;

    QFile powerFile("/sys/devices/platform/s3c2440-i2c/i2c-0/0-0073/pcf50633-gpio.0/reg-fixed-voltage.1/gta02-pm-gsm.0/power_on");
    QFile btPower("/sys/devices/platform/gta02-pm-bt.0/power_on");

    if( !powerFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
        qWarning()<<"File not opened";
    } else {
        QTextStream out(&powerFile);
        out << "0";
        powerFile.close();
    }

        if( !btPower.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
        qWarning()<<"File not opened";
    } else {
        QTextStream out(&btPower);
        out <<  "0";
        powerFile.close();
    }


    QtopiaServerApplication::instance()->shutdown(QtopiaServerApplication::ShutdownSystem);
}
  powerupLoaderClass() {
    int chance=-1;
    powerups=0;
    powerupsGiven=0;
    string line;

    //Which powerups are evil?
    evilPowerups = "2H37"; //P

    ifstream powerFile(useTheme("/powerups.txt",setting.lvlTheme).data());
    if(!powerFile.is_open())
    {
      cout << " Could not open 'powerups.txt'"<<endl;
      var.quit=1;
      return;
    }

    while(!powerFile.eof())
    {
      getline(powerFile, line);
      if(line.compare("Most:")==0)
      {
        chance=0;
      } else if(line.compare("More:")==0)
      {
        chance=1;
      } else if(line.compare("Less:")==0)
      {
        chance=2;
      } else if(line.compare("Least:")==0)
      {
        chance=3;
      } else {
        //No matches, either its a comment or a powerup.
        if(!line.compare(0,2,"//")==0 && line.compare("")!=0)
        {
          chances[chance] += line[0];
          powerups++;
        }
      }

    }
  }