mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Add Sync from Cloud for new athlete
.. when a new athlete is created and opened the blankstate page currently provides options to get data by importing files or downloading from a device. .. this update adds the ability to configure a cloud service and start a sync straight away .. this UX is introduced since cloud services are now much more ubiquitous and v3.5 introduced broad support for a wide range of services.
This commit is contained in:
@@ -148,6 +148,14 @@ BlankStateAnalysisPage::BlankStateAnalysisPage(Context *context) : BlankStatePag
|
||||
img->setIcon(QPixmap(":images/analysis.png"));
|
||||
img->setIconSize(QSize(800,330));
|
||||
|
||||
ShortCut scCloud;
|
||||
scCloud.label = tr("Connect to cloud service and download");
|
||||
scCloud.buttonLabel = tr("Cloud Download");
|
||||
scCloud.buttonIconPath = ":images/mac/download.png";
|
||||
QPushButton *cloudButton = addToShortCuts(scCloud);
|
||||
connect(cloudButton, SIGNAL(clicked()), context->mainWindow, SLOT(importCloud()));
|
||||
|
||||
|
||||
ShortCut scImport;
|
||||
scImport.label = tr("Import files from your disk or usb device");
|
||||
scImport.buttonLabel = tr("Import data");
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
//
|
||||
|
||||
// Main wizard - if passed a service name we are in edit mode, not add mode.
|
||||
AddCloudWizard::AddCloudWizard(Context *context, QString sname) : QWizard(context->mainWindow), context(context), service(sname)
|
||||
AddCloudWizard::AddCloudWizard(Context *context, QString sname, bool sync) : QWizard(context->mainWindow), context(context), service(sname), fsync(sync)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
setWizardStyle(QWizard::ModernStyle);
|
||||
@@ -721,7 +721,15 @@ AddFinish::validatePage()
|
||||
// in the athlete preferences
|
||||
appsettings->setCValue(wizard->context->athlete->cyclist, wizard->cloudService->activeSettingName(), "true");
|
||||
|
||||
// start a sync straight away
|
||||
if (wizard->fsync) {
|
||||
CloudService *db = CloudServiceFactory::instance().newService(wizard->cloudService->id(), wizard->context);
|
||||
CloudServiceSyncDialog *syncnow = new CloudServiceSyncDialog(wizard->context, db);
|
||||
syncnow->open();
|
||||
}
|
||||
|
||||
// delete the instance
|
||||
delete wizard->cloudService;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class AddCloudWizard : public QWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AddCloudWizard(Context *context, QString sname="");
|
||||
AddCloudWizard(Context *context, QString sname="", bool sync=false);
|
||||
QSize sizeHint() const { return QSize(600,650); }
|
||||
|
||||
Context *context;
|
||||
@@ -54,6 +54,9 @@ public:
|
||||
// which service have we selected?
|
||||
QString service;
|
||||
|
||||
// sync straight away, so first timers can download from BlankState
|
||||
bool fsync;
|
||||
|
||||
// this is cloned for our context
|
||||
CloudService *cloudService;
|
||||
|
||||
|
||||
@@ -2096,6 +2096,14 @@ MainWindow::checkCloud()
|
||||
currentTab->context->athlete->importFilesWhenOpeningAthlete();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::importCloud()
|
||||
{
|
||||
// lets get a new cloud service account
|
||||
AddCloudWizard *p = new AddCloudWizard(currentTab->context, "", true);
|
||||
p->show();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::uploadCloud(QAction *action)
|
||||
{
|
||||
|
||||
@@ -172,6 +172,7 @@ class MainWindow : public QMainWindow
|
||||
void setUploadMenu();
|
||||
void setSyncMenu();
|
||||
void checkCloud();
|
||||
void importCloud(); // used to setup and sync in one on first run (see BlankState.cpp)
|
||||
|
||||
void showOptions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user