0004-Connect-with-Strava.patch 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. From dc3ce7e365dcfbf8089b643e1fa4e4cd88dc9d6d Mon Sep 17 00:00:00 2001
  2. From: Mark Liversedge <liversedge@gmail.com>
  3. Date: Fri, 17 Jan 2020 16:04:27 +0000
  4. Subject: Connect with Strava
  5. .. the authorise button on the add cloud wizard now
  6. shows a 'Connect with Strava' icon
  7. .. all other services continue to have a button that
  8. is labelled 'Authorise'
  9. .. this is needed to comply with the Strava API application
  10. guidelines.
  11. diff --git a/src/Cloud/AddCloudWizard.cpp b/src/Cloud/AddCloudWizard.cpp
  12. index db1aea7f1..6deb107bd 100644
  13. --- a/src/Cloud/AddCloudWizard.cpp
  14. +++ b/src/Cloud/AddCloudWizard.cpp
  15. @@ -27,6 +27,7 @@
  16. #include "OAuthDialog.h"
  17. #include <QMessageBox>
  18. +#include <QPixmap>
  19. #include <QRegExp>
  20. // WIZARD FLOW
  21. @@ -271,13 +272,15 @@ AddAuth::AddAuth(AddCloudWizard *parent) : QWizardPage(parent), wizard(parent)
  22. pass = new QLineEdit(this);
  23. pass->setEchoMode(QLineEdit::Password);
  24. pass->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  25. - auth = new QPushButton(tr("Authorise"), this);
  26. - auth->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  27. token = new QLabel(this);
  28. token->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  29. message = new QLabel(this);
  30. message->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  31. + // is there an icon for the authorise button?
  32. + auth = new QPushButton(tr("Authorise"), this);
  33. + auth->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  34. +
  35. // labels
  36. comboLabel = new QLabel("");
  37. urlLabel = new QLabel(tr("URL"));
  38. @@ -367,6 +370,24 @@ AddAuth::initializePage()
  39. // clone to do next few steps!
  40. setSubTitle(QString(tr("%1 Credentials and authorisation")).arg(wizard->cloudService->uiName()));
  41. + // icon on the authorize button
  42. + if (wizard->cloudService && wizard->cloudService->authiconpath() != "") {
  43. +
  44. + // scaling icon hack (193x48 is strava icon size)
  45. + QPixmap pix(wizard->cloudService->authiconpath());
  46. + QIcon authicon(pix.scaled(193*dpiXFactor, 48*dpiXFactor));
  47. + auth->setIconSize(QSize(193*dpiXFactor, 48*dpiYFactor));
  48. +
  49. + // set the pushbutton
  50. + auth->setText("");
  51. + auth->setIcon(authicon);
  52. + } else {
  53. +
  54. + // standard pushbutton (reset after used by strava)
  55. + auth->setText(tr("Authorise"));
  56. + auth->setIcon(QIcon());
  57. + }
  58. +
  59. // show all the widgets relevant for this service and update the value from the
  60. // settings we have collected (which will have been defaulted).
  61. QString cname;
  62. diff --git a/src/Cloud/CloudService.h b/src/Cloud/CloudService.h
  63. index b9c14c90c..95ebcc5ec 100644
  64. --- a/src/Cloud/CloudService.h
  65. +++ b/src/Cloud/CloudService.h
  66. @@ -95,6 +95,9 @@ class CloudService : public QObject {
  67. // need a logo, we may resize but will keep aspect ratio
  68. virtual QImage logo() const = 0;
  69. + // an icon to put on the authorize button (mandated by strava guidelines)
  70. + virtual QString authiconpath() const { return QString(""); }
  71. +
  72. // register with capabilities of the service - emerging standard
  73. // is a service that allows oauth, query and upload as well as download
  74. enum { OAuth=0x01, UserPass=0x02, Upload=0x04, Download=0x08, Query=0x10} capa_;
  75. diff --git a/src/Cloud/Strava.h b/src/Cloud/Strava.h
  76. index 1c51a5da4..45ee2f57c 100644
  77. --- a/src/Cloud/Strava.h
  78. +++ b/src/Cloud/Strava.h
  79. @@ -45,6 +45,8 @@ class Strava : public CloudService {
  80. //virtual int capabilities() const { return OAuth | Upload | Download | Query ; } // Default
  81. + QString authiconpath() const { return QString(":images/services/strava_connect.png"); }
  82. +
  83. // write a file
  84. bool writeFile(QByteArray &data, QString remotename, RideFile *ride);
  85. diff --git a/src/Resources/application.qrc b/src/Resources/application.qrc
  86. index 3fae9b8da..86fbdf032 100644
  87. --- a/src/Resources/application.qrc
  88. +++ b/src/Resources/application.qrc
  89. @@ -167,6 +167,7 @@
  90. <file>web/googlemap/dark.css</file>
  91. <file>images/toolbar/cloud.png</file>
  92. <file>images/services/strava_compatible.png</file>
  93. + <file>images/services/strava_connect.png</file>
  94. <file>images/services/cyclinganalytics.png</file>
  95. <file>images/services/dropbox.png</file>
  96. <file>images/services/googledrive.png</file>
  97. diff --git a/src/Resources/images/services/strava_connect.png b/src/Resources/images/services/strava_connect.png
  98. new file mode 100644
  99. index 000000000..868c433da
  100. --- /dev/null
  101. +++ b/src/Resources/images/services/strava_connect.png
  102. @@ -0,0 +1,15 @@
  103. +‰PNG
  104. +
  105. + IHDRÁ0¨Œ sRGB®Îé IDATxí\w�UÕÿ�G]H‘ªK�’¡
  106. +d�" # %H� þa21[âÄh2š0ÎDM4ÑŒè$CÆ1F:„DIè½÷Þé½/{O¾ß÷ö\î»»”Çîf²/ç›y{O»çžóÝï÷µ{ïž<<<<<<<þ¯9`b»g=ú‹uûªç@‰æ€•ÕGº™Ò±-™}ûö ¨S§ÎïJ•*U'Öç«ž%š¹¹¹_ =•��=Q6B0(Å-A™œœœ½¥K—®íø£ç@&qàÊ•+Ë”)SOö”ãöA–µö¼ëôGÏ�Lä€1¦‚ìë‚Û[ÂòŽqPĺ}Õs #8�"çqdÄý&<Òá€A:Üòc3’y[ý¦Òá€A:Üòc3’y[ý¦Òá€A:Üòc3’y[ý¦Òá€A:Üòc3’y[ý¦Òá€A:Üòc3’ñ·H3r“ÿK›:}ú4.^¼ˆš5k^sYAàèÑ£¨X±"*Tàk.7I;VÁîÝœ: Ô¨S§1�Ý(Søjppç�'ʪdUŽ•lù¯5ëÕïÈßçZä<»b&̃�É€=²G;!sËüŽdŸXó…«µ\óª«Mî»ÚWŒ¥bÁñãDZxñb9ròV*êÕ«‡öíÛ£\9¹!%ˆ>ŒòåË£råÊE²ê•+WbëÖ­xâ‰'�H$pùòe�WÕªUCÙ²eõçÎ�äI“СC´nÝúÆ×=²Á[�Á®™�o¬©VfèËÀá=þúZ¾þxƒ©×¦Q[ÿú0ÞÖÍÝí‘øÞ»@£{Â6W°Ÿ½»àS˜FjSðjØœKZN y føÏÝPØ9!xstX/õ«
  107. +‚à/¯*/O ûŠ³P,îÐÁƒ1qâDÕfwÝujÕª…Í›7cúôé –+I4cÆ ¬_¿¾È–ܼystïÞ]ÀI©ñ§L™‚cÇŽÝÚ5‚\¯ .œÐR3¿ÿ4ì�m·6gÙ­K<'Z}÷ÚÔÞ“‡aÿþìÑ/a?ÿ#P­nÒ"ä�²SßÎ�JÖ¬…ýdlx¾iÓhÖQ,ÃlØM a—MIJý7¨X@0þ|ÈG98p :w={¢mÛ¶z÷oßîKÞíÆÆ�±`Á4Ö�?^ûNž<‰ 6è˜è¹·k×.ìÞ½‡R«³|ùrP‹FI^ W.\¸k×®UW$ÚÏòÎ�;Áþ+VàìÙ³ÚíÖFÐRSs�<ÆI>ÒÀ¦M›Âæ3gÎèØè:ØOÅ@â|Ôþ$ÎÇõ“xä5¢<àÚ·mÛ¦{g_�
  108. +„.�¥#“Ý qEL‹N0rHfôX˜lÑðbyôgR^¢„¼ZöIÁMM¹,˜²åÃ: öJ‚�‘Ú6ñ ØKÉ7”-­Nî˜A?†)]FÇY€�çÏ›ûå–ðüÄЗ´|,V �‚ ©ó»ö¢>–.ê O�:¥7·eË–êÓºù›6m
  109. +ö9wˆ‚@“O™¾/…Â>`ÀÃv‚‰ãå‹ P ØÏ9Úµk§ÓR¨Oœ8¡‚#JàÒ¥K*ðƒVׂB3mÚ4Ð¥©R¥Š
  110. +øºuëпÿpm³gÏÁÅ5xœ“k  ´dÉ�›L·Žî Ý–(Q“/Z´õë×Wÿ�kä.\ÐuróæÍC—.]P»vm½÷Ú¢E /-$‰mÆ h�Ö¬Y£×g;ÁqàÀU(á)ØC»¢Uu#Ìýƒ`šwNˆ˜û1L¿ê˜ÐÐä>+š<�Ì£?R ¸º}c”+ê11n«jul_�àùN
  111. +íر�§�ÁÎø}xž÷ËÎþ“ZÓã;°³Þ×>;ù-]��ðËp¬iÙ hq?°~.¬üBZ<Y´Ã: AË°©8
  112. +ùa_È«PHIU«VM™‰BF7€ÂB¢o̱}ûöÅ�!CЯ_?P‹²=J·ß~;F�…áÇ«�mÙrU{P8¦>}ú`ôèÑjm(Èò‰¨Ná40-Ñ Aƒô:òåh1H{÷îU¡d¬2lØ0í'ØV­Z…¬¬,Œ3FÝ–fÍši™‚'ºz$‚„D«R©R%µR¬ÓJ‘ä“U=FÿÐ5êÑ£‡6=üðÃz�h Lž�9#FŒP—’s;+âæ¡%»irÖÁÐj^T‘õ]IZžpœðíºt­þš €ÒɸEÏ/›Nc'½ {1f…i Ä]3ßzA¬RRßÚ³'¼ÒWø�ṡˆi~Þ‹¸µ O*ÂB‘ƒ€ 'Q@¯GÔj 'DÌ–PS²=J�7ÖÀšš¹nݺª­£ý·Ýv[(`Œ?H‰s1('¸è×SãS@é¸~®³U«VZ§ÐõîÝ;´4Úxƒ?)]?‚€ƒnP×®]ÕÒ
  113. +°�€â:Ó¥† ªEcÀÜ ÏBФ�dk#^IibÅÒzn[Žà�ï"x¡Ð|'\§�ÁmðlG�ÕOts_ŸäY"Øvú;ùf°’‘bð‹Z $P@æ‘Ý0ßÕm-ÁæE°«#™"7báßD[]Œk.Êc‘ƒ€BF¢D‰iAÆÌŒ�X§`G‰u¶G‰æˆ.Oœ¢ýø(Ñ="1v å�sPØI¼ëÌÒ8"ÓXž[½zuç'Pù£%äui 8ç­PA{sJ&:Ÿùö‹`f%Ñe S‹1²[–hÀk¾éªÝ¾RâŽe¡¿Ï݆Á ù©ÎAÇž?£e#éXs÷}Zæ;A‚_QŒfðOÂ%ì”3F$ÍiIh�F0U“<ã~£®SÞ�"=\½ûE4-ˆ&�]4Ècà·ÿþ0peÊ1h2C’N*² �ˆnƒs1.x衇ÔÝ¢ËÕ©S'<òÈ#:Œýt/h)1SÃXÄ…<º×=ÒšÑ�5Ò.jqž1KA®�;ßYLºi·JvÞ'¢‰ßU¿>ñÑ”z{%}ŸJ�nÇêÔúõjyÖÜ q�mX¯‘ óôø¤ktþt첟Ï�¿î†Âîߪq (Ø]††í:¶iàž�m°•³Â>ÌÀçº�ÿ ó9¨½¸2ËB�bà·zõjÍÞÐ- Mâ‘ÖbÎœ9êÃÏ�;Wc×_Іo$ôñsèsófŸè1Ã2yòdõù9¶I“&ê.18Þ³g�fˆè¾¸|=ÇвÀ†³,l�A@«Â~ç’¯=Kà@¿lÙ2 ¨£óÞTy×Ø·Gðï?#x²Y2p¥fþ2p‡sÔmoXˆ¹²‰vÀ´ìžf幄�ük­3Ûì‰`a6ˆA®»ÚJk A°ðA…;buÃX ’e2òÀÌt ÓëI˜*5u+Š,šNÍ›¶ÈE®ŒÂÇÔ(5,…{éÒ¥ê‚ôêÕKýcŽ¡¯ï½÷ªÅ˜9s¦jM¦Q)˜×"§5]¼îÚݱF�èÖ­›‚lêÔ©a§M›6:„ÎÀ”ú¬Y³4n`àî²OÔ±cGuÛd_ îé¯ü?›@t‘(àË×"f­¸Æ1´žéRð‡çÅOOÆ@6ç2èú_Œ‡]õÏp*S¡L×T-vÞLA@‘xj\JšÔ~(à$[d'ý&œÁô-Oª³µîœ»o,}û;›ÂÜ?XûMãv@»^ú,À.�¦müà  q�™–ýæ3a»Æ|ê] �^+ˆæJ ñ yQj{úêѬGtJ¦? 
  114. +dÔŽŽ)l™Ú˜ë`,p­kXZ«EðZѤvÖ8س'ó-ÝÔm’|ºÛºûÕ>q?rŸéÖ¢½ù,Á‘•§¸Ñ'Æ¥ÆïÓ©ýô5ã_tÃ`ä5
  115. +—bö'ñžXŸZ Ãþà…®pA°‘4gâ·â’I�|¿/~tè‡`죰‹&é9F”'Š ﹃ùàñ†°’~%%óƒ´\˜?¢<åý$5‡Š…Y¬?7 ÈÃ+l_ËܽdkP©: ] �Ezb_üxˆÅɽ³ã8GôÝ!ºBL�Jº“Ot ¤
  116. +•úøQ:²ˆ<Ã×e-òÐ�îƒy¥ÕŸ««¤eZ‘;“îr8 Ÿœ8˜¬Ì$’<
  117. +É@zÉç@1Qò7èwà9�.<Ò嘟qð ȸ[ê7”.<Ò嘟qð ȸ[ê7”.<Ò嘟qð ȸ[ê7”.<Ò嘟qð ȸ[ê7”.<Ò嘟qˆƒÀÊ—KG3n—~CžyÈ“ïäç�ymqò¾ýX/3™Èʵüsù¸)ÿ÷'þ)¿eäËïwÈ�ß>Æû¥É“ç@‰äµÿEùí—ßÍ–Wb“rÖi†x_ò ÿ×s är€@ ðÓ¤¸D%wK~åžžžž…çÀX¡ cäIEND®B`‚
  118. \ No newline at end of file