Skip to content

Commit

Permalink
Sixcycle Fixes
Browse files Browse the repository at this point in the history
.. SixCycle should be spelt as Sixcycle, this has
   been fixed across the user visible strings

.. Upload of PWX works, but not TCX, so switching
   to using PWX for now.
  • Loading branch information
liversedge committed Jan 16, 2017
1 parent bb70624 commit 542c26e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/Cloud/FileStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ FileStore::compressRide(RideFile*ride, QByteArray &data, QString name)
default:
case JSON: spec="json"; break;
case TCX: spec="tcx"; break;
case PWX: spec="pwx"; break;
}

QFile jsonFile(tempfile.fileName());
Expand Down Expand Up @@ -277,6 +278,7 @@ FileStore::uploadExtension() {
default:
case JSON: spec = ".json"; break;
case TCX: spec = ".tcx"; break;
case PWX: spec = ".pwx"; break;
}

switch (uploadCompression) {
Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/FileStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class FileStore : public QObject {

CompressionType uploadCompression;
CompressionType downloadCompression;
enum uploadType { JSON, TCX } filetype;
enum uploadType { JSON, TCX, PWX } filetype;

bool useMetric; // FileStore know distance or duration metadata (eg Today's Plan)
bool useEndDate; // Dates for file entries use end date time not start (weird, I know, but thats how SixCycle work)
Expand Down
28 changes: 14 additions & 14 deletions src/Cloud/SixCycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ SixCycle::SixCycle(Context *context) : FileStore(context), context(context), roo
// how is data uploaded and downloaded?
uploadCompression = none;
downloadCompression = none;
filetype = FileStore::uploadType::TCX;
filetype = FileStore::uploadType::PWX;

session_token = ""; // not authenticated yet

Expand All @@ -78,14 +78,14 @@ SixCycle::onSslErrors(QNetworkReply *reply, const QList<QSslError>&)
bool
SixCycle::open(QStringList &errors)
{
printd("SixCycle::open\n");
printd("Sixcycle::open\n");

// do we have a token
QString user = appsettings->cvalue(context->athlete->cyclist, GC_SIXCYCLE_USER, "").toString();
QString pass = appsettings->cvalue(context->athlete->cyclist, GC_SIXCYCLE_PASS, "").toString();

if (user == "") {
errors << "You must setup SixCylce login details first";
errors << "You must setup Sixcycle login details first";
return false;
}

Expand Down Expand Up @@ -113,7 +113,7 @@ SixCycle::open(QStringList &errors)

if (reply->error() != QNetworkReply::NoError) {
qDebug() << "error" << reply->errorString();
errors << tr("Network Problem authenticating with the SixCycle service");
errors << tr("Network Problem authenticating with the Sixcycle service");
return false;
}

Expand Down Expand Up @@ -150,7 +150,7 @@ SixCycle::open(QStringList &errors)
if (root_->isDir != true) errors << tr("root is not a directory.");

} else {
errors << tr("Problem with SixCycle authentication.");
errors << tr("Problem with Sixcycle authentication.");
printd("timed out, empty or invalid response.\n");
}

Expand All @@ -162,7 +162,7 @@ SixCycle::open(QStringList &errors)
bool
SixCycle::close()
{
printd("SixCycle::close\n");
printd("Sixcycle::close\n");
// nothing to do for now
return true;
}
Expand All @@ -177,19 +177,19 @@ SixCycle::home()
bool
SixCycle::createFolder(QString)
{
printd("SixCycle::createFolder\n");
printd("Sixcycle::createFolder\n");

return false;
}

QList<FileStoreEntry*>
SixCycle::readdir(QString path, QStringList &errors, QDateTime from, QDateTime to)
{
printd("SixCycle::readdir(%s)\n", path.toStdString().c_str());
printd("Sixcycle::readdir(%s)\n", path.toStdString().c_str());

QList<FileStoreEntry*> returning;
if (session_token == "") {
errors << tr("You must authenticate with SixCycle first");
errors << tr("You must authenticate with Sixcycle first");
return returning;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ SixCycle::readdir(QString path, QStringList &errors, QDateTime from, QDateTime t
bool
SixCycle::readFile(QByteArray *data, QString remotename, QString remoteid)
{
printd("SixCycle::readFile(%s)\n", remotename.toStdString().c_str());
printd("Sixcycle::readFile(%s)\n", remotename.toStdString().c_str());

if (session_token == "") {
return false;
Expand Down Expand Up @@ -328,7 +328,7 @@ SixCycle::readFile(QByteArray *data, QString remotename, QString remoteid)
bool
SixCycle::writeFile(QByteArray &data, QString remotename)
{
printd("SixCycle::writeFile(%s)\n", remotename.toStdString().c_str());
printd("Sixcycle::writeFile(%s)\n", remotename.toStdString().c_str());

// if we are called to upload a single ride we will not have been
// authenticated yet, so lets try and do that now. When called via
Expand Down Expand Up @@ -417,11 +417,11 @@ SixCycle::writeFile(QByteArray &data, QString remotename)
void
SixCycle::writeFileCompleted()
{
printd("SixCycle::writeFileCompleted()\n");
printd("Sixcycle::writeFileCompleted()\n");

QString writestatus = reply->readAll();

printd("reply:%s\n", writestatus.toStdString().c_str());
printd("reply begins: %s ...\n", writestatus.toStdString().substr(0,80).c_str());

if (reply->error() == QNetworkReply::NoError) {
notifyWriteComplete(
Expand All @@ -444,7 +444,7 @@ SixCycle::readyRead()
void
SixCycle::readFileCompleted()
{
printd("SixCycle::readFileCompleted\n");
printd("Sixcycle::readFileCompleted\n");

QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());

Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/SixCycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SixCycle : public FileStore {
SixCycle(Context *context);
~SixCycle();

QString name() { return (tr("SixCycle")); }
QString name() { return (tr("Sixcycle")); }

// open/connect and close/disconnect
bool open(QStringList &errors);
Expand Down
4 changes: 2 additions & 2 deletions src/Gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ MainWindow::MainWindow(const QDir &home)
shareMenu->addAction(tr("Synchronise Today's Plan..."), this,
SLOT(syncTodaysPlan()), tr(""));
shareMenu->addSeparator ();
shareMenu->addAction(tr("Upload to SixCycle"), this,
shareMenu->addAction(tr("Upload to Sixcycle"), this,
SLOT(uploadSixCycle()), tr(""));
shareMenu->addAction(tr("Synchronise SixCycle..."), this,
shareMenu->addAction(tr("Synchronise Sixcycle..."), this,
SLOT(syncSixCycle()), tr(""));
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/Gui/Pages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,14 @@ CredentialsPage::CredentialsPage(QWidget *parent, Context *context) : QScrollAre
connect(tdpAuthorise, SIGNAL(clicked()), this, SLOT(authoriseTodaysPlan()));

//////////////////////////////////////////////////
// SixCycle
// Sixcycle

#if QT_VERSION > 0x050000 // only supported on QT5 or higher
QLabel *sc = new QLabel(tr("SixCycle"));
QLabel *sc = new QLabel(tr("Sixcycle"));
sc->setFont(current);

// SixCycle can be on a staging or private tenant
QLabel *scurllabel = new QLabel("API URL"); // don't translate a technical term
QLabel *scurllabel = new QLabel("URL"); // don't translate a technical term
scURL = new QLineEdit(this);
scURL->setText(appsettings->cvalue(context->athlete->cyclist, GC_SIXCYCLE_URL, "https://live.sixcycle.com").toString());

Expand Down

0 comments on commit 542c26e

Please sign in to comment.