From: Rodrigo Linfati Date: Tue, 29 Dec 2009 22:24:17 +0000 (+0100) Subject: minor change in gui X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=commitdiff_plain;h=016de1e3a5f9819bf2662e9a9e89868472149a56;hp=0ae9d0114e9b8bec69bbdb3c8a3c9c9c6862c169;ds=sidebyside minor change in gui --- diff --git a/debian/changelog b/debian/changelog index 6733697..a11e395 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +googlelatitude (0.2-2) unstable; urgency=low + + * minor change in gui + + -- Rodrigo Linfati Tue, 29 Dec 2009 23:23:46 +0100 + googlelatitude (0.2-1) unstable; urgency=low * more fix... diff --git a/src/latitude.cpp b/src/latitude.cpp index be096f3..c782c2f 100644 --- a/src/latitude.cpp +++ b/src/latitude.cpp @@ -50,32 +50,81 @@ void LatitudeGUI::save() { } void LatitudeGUI::show_map() { + // webkit magic maps = new QWebView(); connect(maps, SIGNAL(loadFinished(bool)), this, SLOT(maps_login())); maps->load(urllogin); + // set widget setCentralWidget(maps); setWindowTitle(tr("Google Maps")); + // menu menuBar()->clear(); menuBar()->addAction(tr("&Latitude") ,this, SLOT(show_lat())); + setStatusBar(0); } void LatitudeGUI::show_lat() { + // login input + login_user = new QLineEdit(setting->value("user","my_username").toString()); + login_pass = new QLineEdit(setting->value("pass","my_password").toString()); + login_pass->setEchoMode(QLineEdit::Password); + QPushButton *button_update = new QPushButton(tr("&Update Location")); + // login layout + QFormLayout *layout_login = new QFormLayout(); + layout_login->addRow(tr("&Username"), login_user); + layout_login->addRow(tr("&Password"), login_pass); + layout_login->addRow(button_update); + // login connect + connect(login_user, SIGNAL(editingFinished()), this, SLOT(save())); + connect(login_pass, SIGNAL(editingFinished()), this, SLOT(save())); + connect(login_user, SIGNAL(returnPressed()), login_pass, SLOT(setFocus())); + connect(login_pass, SIGNAL(returnPressed()), this, SLOT(set())); + connect(button_update, SIGNAL(clicked()), this, SLOT(set())); + + // location input + location_lat = new QLineEdit(QString::number(0)); + location_lon = new QLineEdit(QString::number(0)); + location_acc = new QLineEdit(QString::number(0)); + // location layout + QFormLayout *layout_location = new QFormLayout(); + layout_location->addRow(tr("lat :"), location_lat); + layout_location->addRow(tr("lon :"), location_lon); + layout_location->addRow(tr("acc :"), location_acc); + + // source button + QPushButton *source_loc = new QPushButton(tr("&loc")); + QPushButton *source_cell = new QPushButton(tr("&cell")); + QPushButton *source_gps = new QPushButton(tr("&gps")); + // source layout + QHBoxLayout *layout_source = new QHBoxLayout(); + layout_source->addWidget(source_loc); + layout_source->addWidget(source_cell); + layout_source->addWidget(source_gps); + // source connect + connect(source_loc, SIGNAL(clicked()), glatitude, SLOT(get())); + connect(source_cell, SIGNAL(clicked()), this, SLOT(get_cell())); + connect(source_gps, SIGNAL(clicked()), this, SLOT(get_gps())); + + // main layout location = new QWidget(); - QHBoxLayout *layout = new QHBoxLayout(); - layout->addLayout(do_login()); - layout->addLayout(do_location()); + QHBoxLayout *layout_form = new QHBoxLayout(); + layout_form->addLayout(layout_login); + layout_form->addLayout(layout_location); + QVBoxLayout *layout = new QVBoxLayout(); + layout->addLayout(layout_form); + layout->addLayout(layout_source); location->setLayout(layout); + // set widget setCentralWidget(location); setWindowTitle(tr("Google Latitude Updater")); + // menu menuBar()->clear(); menuBar()->addAction(tr("&Maps") ,this, SLOT(show_map())); - menuBar()->addAction(tr("&loc"), glatitude, SLOT(get())); - menuBar()->addAction(tr("&cell"), this, SLOT(get_cell())); - menuBar()->addAction(tr("&gps"), this, SLOT(get_gps())); + statusBar()->showMessage(tr("Ready")); } void LatitudeGUI::maps_login() { @@ -89,36 +138,3 @@ void LatitudeGUI::maps_login() { maps->page()->mainFrame()->evaluateJavaScript("document.getElementById('gaia_loginform').submit();"); } } - -QFormLayout *LatitudeGUI::do_login() { - login_user = new QLineEdit(setting->value("user","my_username").toString()); - login_pass = new QLineEdit(setting->value("pass","my_password").toString()); - login_pass->setEchoMode(QLineEdit::Password); - QPushButton *login_up = new QPushButton(tr("Update Location")); - - QFormLayout *layout = new QFormLayout(); - layout->addRow(tr("&Username"), login_user); - layout->addRow(tr("&Password"), login_pass); - layout->addRow(login_up); - - connect(login_user, SIGNAL(editingFinished()), this, SLOT(save())); - connect(login_pass, SIGNAL(editingFinished()), this, SLOT(save())); - connect(login_user, SIGNAL(returnPressed()), login_pass, SLOT(setFocus())); - connect(login_pass, SIGNAL(returnPressed()), this, SLOT(set())); - connect(login_up, SIGNAL(clicked()), this, SLOT(set())); - - return layout; -} - -QFormLayout *LatitudeGUI::do_location() { - location_lat = new QLineEdit(QString::number(0)); - location_lon = new QLineEdit(QString::number(0)); - location_acc = new QLineEdit(QString::number(0)); - - QFormLayout *layout = new QFormLayout(); - layout->addRow(tr("lat :"), location_lat); - layout->addRow(tr("lon :"), location_lon); - layout->addRow(tr("acc :"), location_acc); - - return layout; -} diff --git a/src/latitude.h b/src/latitude.h index 449ce1e..68094f1 100644 --- a/src/latitude.h +++ b/src/latitude.h @@ -37,9 +37,6 @@ private: QLineEdit *location_lat; QLineEdit *location_lon; QLineEdit *location_acc; - - QFormLayout *do_login(); - QFormLayout *do_location(); }; #endif // LATITUDE_H