void StravaUploadDialog::uploadToStrava() { show(); overwrite = true; if(activityId.length()>0) { overwrite = false; dialog = new QDialog(); QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layoutLabel = new QVBoxLayout(); QLabel *label = new QLabel(); label->setText(tr("This Ride is marked as already on Strava. Are you sure you want to upload it?")); layoutLabel->addWidget(label); QPushButton *ok = new QPushButton(tr("OK"), this); QPushButton *cancel = new QPushButton(tr("Cancel"), this); QHBoxLayout *buttons = new QHBoxLayout(); buttons->addStretch(); buttons->addWidget(cancel); buttons->addWidget(ok); connect(ok, SIGNAL(clicked()), this, SLOT(okClicked())); connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked())); layout->addLayout(layoutLabel); layout->addLayout(buttons); dialog->setLayout(layout); if (!dialog->exec()) return; } requestLogin(); if(!loggedIn) { /*QMessageBox aMsgBox; aMsgBox.setText(tr("Cannot login to Strava. Check username/password")); aMsgBox.exec();*/ reject(); } requestUpload(); if(!uploadSuccessful) { progressLabel->setText("Error uploading to Strava"); } else { //requestVerifyUpload(); progressLabel->setText(tr("Successfully uploaded to Strava\n")+uploadStatus); } uploadButton->setVisible(false); cancelButton->setText("OK"); QApplication::processEvents(); }
void TtbDialog::finishSettings(QNetworkReply *reply) { progressBar->setValue(4); TtbSettingsParser handler; QXmlInputSource source( reply ); QXmlSimpleReader reader; reader.setContentHandler( &handler ); if( ! reader.parse( source ) ){ progressLabel->setText(tr("failed to parse Settings response: ") +handler.errorString()); closeButton->setText(tr("&Close")); return; } if( handler.error.length() > 0 ){ progressLabel->setText(tr("failed to get settings: ") +handler.error ); closeButton->setText(tr("&Close")); return; } sessionId = handler.session; proMember = handler.pro; if( sessionId.length() == 0 ){ requestSession(); } else { requestUpload(); } }
void TtbDialog::finishSession(QNetworkReply *reply) { progressBar->setValue(8); TtbSessionParser handler; QXmlInputSource source( reply ); QXmlSimpleReader reader; reader.setContentHandler( &handler ); if( ! reader.parse( source ) ){ progressLabel->setText(tr("failed to parse Session response: ") +handler.errorString()); closeButton->setText(tr("&Close")); return; } if( handler.error.length() > 0 ){ progressLabel->setText(tr("failed to get new session: ") +handler.error ); closeButton->setText(tr("&Close")); return; } sessionId = handler.session; if( sessionId.length() == 0 ){ progressLabel->setText(tr("got empty session")); closeButton->setText(tr("&Close")); return; } requestUpload(); }
void TrainingstagebuchUploader::finishSession(QNetworkReply *reply) { parent->progressBar->setValue(parent->progressBar->value()+5/parent->shareSiteCount); TtbSessionParser handler; QXmlInputSource source( reply ); QXmlSimpleReader reader; reader.setContentHandler( &handler ); if( ! reader.parse( source ) ){ parent->errorLabel->setText(tr("failed to parse Session response: ") +handler.errorString()); eventLoop.quit(); return; } if( handler.error.length() > 0 ){ parent->errorLabel->setText(tr("failed to get new session: ") +handler.error ); eventLoop.quit(); return; } sessionId = handler.session; if( sessionId.length() == 0 ){ parent->errorLabel->setText(tr("got empty session")); eventLoop.quit(); return; } requestUpload(); }
void SportPlusHealthUploader::upload() { requestUpload(); }