From dc3ce7e365dcfbf8089b643e1fa4e4cd88dc9d6d Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 17 Jan 2020 16:04:27 +0000 Subject: Connect with Strava .. the authorise button on the add cloud wizard now shows a 'Connect with Strava' icon .. all other services continue to have a button that is labelled 'Authorise' .. this is needed to comply with the Strava API application guidelines. diff --git a/src/Cloud/AddCloudWizard.cpp b/src/Cloud/AddCloudWizard.cpp index db1aea7f1..6deb107bd 100644 --- a/src/Cloud/AddCloudWizard.cpp +++ b/src/Cloud/AddCloudWizard.cpp @@ -27,6 +27,7 @@ #include "OAuthDialog.h" #include +#include #include // WIZARD FLOW @@ -271,13 +272,15 @@ AddAuth::AddAuth(AddCloudWizard *parent) : QWizardPage(parent), wizard(parent) pass = new QLineEdit(this); pass->setEchoMode(QLineEdit::Password); pass->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - auth = new QPushButton(tr("Authorise"), this); - auth->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); token = new QLabel(this); token->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); message = new QLabel(this); message->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + // is there an icon for the authorise button? + auth = new QPushButton(tr("Authorise"), this); + auth->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + // labels comboLabel = new QLabel(""); urlLabel = new QLabel(tr("URL")); @@ -367,6 +370,24 @@ AddAuth::initializePage() // clone to do next few steps! setSubTitle(QString(tr("%1 Credentials and authorisation")).arg(wizard->cloudService->uiName())); + // icon on the authorize button + if (wizard->cloudService && wizard->cloudService->authiconpath() != "") { + + // scaling icon hack (193x48 is strava icon size) + QPixmap pix(wizard->cloudService->authiconpath()); + QIcon authicon(pix.scaled(193*dpiXFactor, 48*dpiXFactor)); + auth->setIconSize(QSize(193*dpiXFactor, 48*dpiYFactor)); + + // set the pushbutton + auth->setText(""); + auth->setIcon(authicon); + } else { + + // standard pushbutton (reset after used by strava) + auth->setText(tr("Authorise")); + auth->setIcon(QIcon()); + } + // show all the widgets relevant for this service and update the value from the // settings we have collected (which will have been defaulted). QString cname; diff --git a/src/Cloud/CloudService.h b/src/Cloud/CloudService.h index b9c14c90c..95ebcc5ec 100644 --- a/src/Cloud/CloudService.h +++ b/src/Cloud/CloudService.h @@ -95,6 +95,9 @@ class CloudService : public QObject { // need a logo, we may resize but will keep aspect ratio virtual QImage logo() const = 0; + // an icon to put on the authorize button (mandated by strava guidelines) + virtual QString authiconpath() const { return QString(""); } + // register with capabilities of the service - emerging standard // is a service that allows oauth, query and upload as well as download enum { OAuth=0x01, UserPass=0x02, Upload=0x04, Download=0x08, Query=0x10} capa_; diff --git a/src/Cloud/Strava.h b/src/Cloud/Strava.h index 1c51a5da4..45ee2f57c 100644 --- a/src/Cloud/Strava.h +++ b/src/Cloud/Strava.h @@ -45,6 +45,8 @@ class Strava : public CloudService { //virtual int capabilities() const { return OAuth | Upload | Download | Query ; } // Default + QString authiconpath() const { return QString(":images/services/strava_connect.png"); } + // write a file bool writeFile(QByteArray &data, QString remotename, RideFile *ride); diff --git a/src/Resources/application.qrc b/src/Resources/application.qrc index 3fae9b8da..86fbdf032 100644 --- a/src/Resources/application.qrc +++ b/src/Resources/application.qrc @@ -167,6 +167,7 @@ web/googlemap/dark.css images/toolbar/cloud.png images/services/strava_compatible.png + images/services/strava_connect.png images/services/cyclinganalytics.png images/services/dropbox.png images/services/googledrive.png diff --git a/src/Resources/images/services/strava_connect.png b/src/Resources/images/services/strava_connect.png new file mode 100644 index 000000000..868c433da --- /dev/null +++ b/src/Resources/images/services/strava_connect.png @@ -0,0 +1,15 @@ +PNG + + IHDR0 sRGB IDATx\wUG]HK +d"# %Ha21[h20DM4ь$C1F:DI/{O\f/y{O{<<<<<<<9`bg=u@怕Gұ-} SJ*U'竞%_ ==Q6B0(-AK@&qʕ+˔)SOAGρL1[qPĺ}s #8"qd&<A:c3y[A:c3y[A:c3y[A:c3y[A:c3H3rK:}4.^5k^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