X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=src%2Flatitude.cpp;h=5f6038a01bee3c3ca287ff13df52c20d5e9d7fe8;hp=b1b89c1681c8ce4b7bedf7d05f7219b81ee6d17a;hb=f66076c2991b0519cde383b2d09167333d55f5d6;hpb=b80c04a8938fa73c45b5d8a17a1c2b2aab5eab3b diff --git a/src/latitude.cpp b/src/latitude.cpp index b1b89c1..5f6038a 100644 --- a/src/latitude.cpp +++ b/src/latitude.cpp @@ -55,7 +55,7 @@ void LatitudeGUI::set_config() { gps->config(setting->value("interval",1800).toInt(), setting->value("wait",30).toInt(), - setting->value("usegps",false).toBool()); + setting->value("method","cell").toString()); } void LatitudeGUI::latitude_ok() { @@ -102,8 +102,8 @@ void LatitudeGUI::mode_demonio() { demonio->setText(tr("&Start Daemon")); } else { QProcess *cli = new QProcess(this); - cli->start(QCoreApplication::applicationDirPath()+QDir::separator()+"GoogleLatitudeDaemon"); - qDebug() << "LatitudeGUI: demonio" << QCoreApplication::applicationDirPath()+"/GoogleLatitudeDaemon"; + cli->startDetached(QCoreApplication::applicationDirPath()+QDir::separator()+"GoogleLatitudeDaemon"); + qDebug() << "LatitudeGUI: demonio" << QCoreApplication::applicationDirPath()+QDir::separator()+"GoogleLatitudeDaemon"; if ( ! system("killall -0 GoogleLatitudeDaemon 2> /dev/null" ) ) { demonio->setText(tr("&Stop Daemon")); } @@ -121,12 +121,6 @@ void LatitudeGUI::config() { QLineEdit *gps_interval = new QLineEdit(setting->value("interval",1800).toString()); QLineEdit *gps_wait = new QLineEdit(setting->value("wait",30).toString()); - QCheckBox *gps_use = new QCheckBox(); - if ( setting->value("usegps",false).toBool() ) { - gps_use->setCheckState(Qt::Checked); - } else { - gps_use->setCheckState(Qt::Unchecked); - } QCheckBox *daemon_use = new QCheckBox(); if ( setting->value("daemon",false).toBool() ) { @@ -135,25 +129,47 @@ void LatitudeGUI::config() { daemon_use->setCheckState(Qt::Unchecked); } - QFormLayout *layout_config = new QFormLayout(); - layout_config->addRow(tr("&Username"), login_user); - layout_config->addRow(tr("&Password"), login_pass); - layout_config->addRow(tr("&Interval for Updates"), gps_interval); - layout_config->addRow(tr("&Wait for a Fix"), gps_wait); - layout_config->addRow(tr("&Use Gps"), gps_use); - layout_config->addRow(tr("&Daemon at Boot"), daemon_use); + QRadioButton *gps_cell = new QRadioButton(tr("&Cell Tower")); + QRadioButton *gps_both = new QRadioButton(tr("&Both")); + QRadioButton *gps_agps = new QRadioButton(tr("Only &Gps")); + + QString gps_setting = setting->value("method","cell").toString(); + if ( gps_setting == QString("cell") ) { + gps_cell->setChecked(true); + } else if ( gps_setting == QString("both") ) { + gps_both->setChecked(true); + } else if ( gps_setting == QString("agps") ) { + gps_agps->setChecked(true); + } else { + gps_cell->setChecked(true); + } + + QFormLayout *layout_form = new QFormLayout(); + layout_form->addRow(tr("&Username"), login_user); + layout_form->addRow(tr("&Password"), login_pass); connect(login_user, SIGNAL(textEdited(QString)), this, SLOT(save_user(QString))); connect(login_user, SIGNAL(returnPressed()), login_pass, SLOT(setFocus())); connect(login_pass, SIGNAL(textEdited(QString)), this, SLOT(save_pass(QString))); connect(login_pass, SIGNAL(returnPressed()), dialoglogin, SLOT(accept())); + layout_form->addRow(tr("&Interval for Updates"), gps_interval); + layout_form->addRow(tr("&Wait for a Fix"), gps_wait); + layout_form->addRow(tr("&Daemon at Boot"), daemon_use); connect(gps_interval, SIGNAL(textEdited(QString)), this, SLOT(save_interval(QString))); connect(gps_wait, SIGNAL(textEdited(QString)), this, SLOT(save_wait(QString))); - connect(gps_use, SIGNAL(stateChanged(int)), this, SLOT(save_gps(int))); connect(daemon_use, SIGNAL(stateChanged(int)), this, SLOT(save_daemon(int))); - dialoglogin->setLayout(layout_config); + QHBoxLayout *layout_gps = new QHBoxLayout; + layout_gps->addWidget(gps_cell); + layout_gps->addWidget(gps_both); + layout_gps->addWidget(gps_agps); + layout_form->addRow(layout_gps); + connect(gps_cell, SIGNAL(clicked()), this, SLOT(save_gps_cell())); + connect(gps_both, SIGNAL(clicked()), this, SLOT(save_gps_both())); + connect(gps_agps, SIGNAL(clicked()), this, SLOT(save_gps_agps())); + + dialoglogin->setLayout(layout_form); dialoglogin->exec(); if ( setting->value("interval",1800).toInt() < 300 ) @@ -161,7 +177,7 @@ void LatitudeGUI::config() { if ( setting->value("interval",1800).toInt() > 3600 ) setting->setValue("interval", 3600); - if ( setting->value("usegps",false).toBool() ) { + if ( QString("agps") == setting->value("method","cell").toString() ) { if ( setting->value("wait",30).toInt() < 15 ) setting->setValue("wait", 15); } else {