mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Added Start with last opened Athlete option to config
Default is checked to preserve current behavior, when cleared the choose athlete dialog will be presented at start. Workout library setting was moved to Train preferences page to reduce clutter in General settings page. [publish binaries]
This commit is contained in:
@@ -149,6 +149,7 @@
|
||||
#define GC_BIKESCOREMODE "<global-general>bikeScoreMode"
|
||||
#define GC_WARNCONVERT "<global-general>warnconvert"
|
||||
#define GC_WARNEXIT "<global-general>warnexit"
|
||||
#define GC_OPENLASTATHLETE "<global-general>openlastathlete"
|
||||
#define GC_HIST_BIN_WIDTH "<global-general>histogamWindow/binWidth"
|
||||
#define GC_WORKOUTDIR "<global-general>workoutDir" // used for Workouts and Videosyn files
|
||||
#define GC_LINEWIDTH "<global-general>linewidth"
|
||||
|
||||
@@ -583,7 +583,7 @@ main(int argc, char *argv[])
|
||||
// folder and athlete
|
||||
lastOpened = args.at(2);
|
||||
|
||||
} else {
|
||||
} else if (appsettings->value(NULL, GC_OPENLASTATHLETE, true).toBool()) {
|
||||
|
||||
// no parameters passed lets open the last athlete we worked with
|
||||
lastOpened = appsettings->value(NULL, GC_SETTINGS_LAST);
|
||||
|
||||
@@ -184,15 +184,21 @@ GeneralPage::GeneralPage(Context *context) : context(context)
|
||||
warnOnExit->setChecked(appsettings->value(NULL, GC_WARNEXIT, true).toBool());
|
||||
configLayout->addWidget(warnOnExit, 8,1, Qt::AlignLeft);
|
||||
|
||||
//
|
||||
// Open last Athlete
|
||||
openLastAthlete = new QCheckBox(tr("Start with last opened Athlete"), this);
|
||||
openLastAthlete->setChecked(appsettings->value(NULL, GC_OPENLASTATHLETE, true).toBool());
|
||||
configLayout->addWidget(openLastAthlete, 9,1, Qt::AlignLeft);
|
||||
|
||||
//
|
||||
// Run API web services when running
|
||||
//
|
||||
int offset=0;
|
||||
int offset=1;
|
||||
#ifdef GC_WANT_HTTP
|
||||
offset += 1;
|
||||
startHttp = new QCheckBox(tr("Enable API Web Services"), this);
|
||||
startHttp->setChecked(appsettings->value(NULL, GC_START_HTTP, false).toBool());
|
||||
configLayout->addWidget(startHttp, 9,1, Qt::AlignLeft);
|
||||
configLayout->addWidget(startHttp, 9+offset,1, Qt::AlignLeft);
|
||||
offset += 1;
|
||||
#endif
|
||||
#ifdef GC_WANT_R
|
||||
embedR = new QCheckBox(tr("Enable R"), this);
|
||||
@@ -234,25 +240,6 @@ GeneralPage::GeneralPage(Context *context) : context(context)
|
||||
|
||||
connect(athleteBrowseButton, SIGNAL(clicked()), this, SLOT(browseAthleteDir()));
|
||||
|
||||
//
|
||||
// Workout directory (train view)
|
||||
//
|
||||
QVariant workoutDir = appsettings->value(this, GC_WORKOUTDIR, "");
|
||||
// fix old bug..
|
||||
if (workoutDir == "0") workoutDir = "";
|
||||
workoutLabel = new QLabel(tr("Workout and VideoSync Library"));
|
||||
workoutDirectory = new QLineEdit;
|
||||
workoutDirectory->setText(workoutDir.toString());
|
||||
workoutBrowseButton = new QPushButton(tr("Browse"));
|
||||
//XXworkoutBrowseButton->setFixedWidth(120);
|
||||
|
||||
configLayout->addWidget(workoutLabel, 10 + offset,0, Qt::AlignRight);
|
||||
configLayout->addWidget(workoutDirectory, 10 + offset,1);
|
||||
configLayout->addWidget(workoutBrowseButton, 10 + offset,2);
|
||||
|
||||
connect(workoutBrowseButton, SIGNAL(clicked()), this, SLOT(browseWorkoutDir()));
|
||||
offset++;
|
||||
|
||||
#ifdef GC_WANT_R
|
||||
//
|
||||
// R Home directory
|
||||
@@ -301,7 +288,6 @@ GeneralPage::GeneralPage(Context *context) : context(context)
|
||||
b4.metricSwimPace = metricSwimPace->isChecked();
|
||||
b4.hyst = elevationHysteresis.toFloat();
|
||||
b4.wbal = wbalForm->currentIndex();
|
||||
b4.warn = warnOnExit->isChecked();
|
||||
#ifdef GC_WANT_HTTP
|
||||
b4.starthttp = startHttp->isChecked();
|
||||
#endif
|
||||
@@ -342,8 +328,10 @@ GeneralPage::saveClicked()
|
||||
// save on exit
|
||||
appsettings->setValue(GC_WARNEXIT, warnOnExit->isChecked());
|
||||
|
||||
// open last athlete on start
|
||||
appsettings->setValue(GC_OPENLASTATHLETE, openLastAthlete->isChecked());
|
||||
|
||||
// Directories
|
||||
appsettings->setValue(GC_WORKOUTDIR, workoutDirectory->text());
|
||||
appsettings->setValue(GC_HOMEDIR, athleteDirectory->text());
|
||||
#ifdef GC_WANT_R
|
||||
appsettings->setValue(GC_R_HOME, rDirectory->text());
|
||||
@@ -442,17 +430,6 @@ GeneralPage::browsePythonDir()
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
GeneralPage::browseWorkoutDir()
|
||||
{
|
||||
QString currentDir = workoutDirectory->text();
|
||||
if (!QDir(currentDir).exists()) currentDir = "";
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Workout Library"),
|
||||
currentDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
if (dir != "") workoutDirectory->setText(dir); //only overwrite current dir, if a new was selected
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GeneralPage::browseAthleteDir()
|
||||
{
|
||||
@@ -735,6 +712,18 @@ bool deviceModel::setData(const QModelIndex &index, const QVariant &value, int r
|
||||
//
|
||||
TrainOptionsPage::TrainOptionsPage(QWidget *parent, Context *context) : QWidget(parent), context(context)
|
||||
{
|
||||
//
|
||||
// Workout directory (train view)
|
||||
//
|
||||
QVariant workoutDir = appsettings->value(this, GC_WORKOUTDIR, "");
|
||||
// fix old bug..
|
||||
if (workoutDir == "0") workoutDir = "";
|
||||
workoutLabel = new QLabel(tr("Workout and VideoSync Library"));
|
||||
workoutDirectory = new QLineEdit;
|
||||
workoutDirectory->setText(workoutDir.toString());
|
||||
workoutBrowseButton = new QPushButton(tr("Browse"));
|
||||
connect(workoutBrowseButton, SIGNAL(clicked()), this, SLOT(browseWorkoutDir()));
|
||||
|
||||
useSimulatedSpeed = new QCheckBox(tr("Simulate Speed From Power"), this);
|
||||
useSimulatedSpeed->setChecked(appsettings->value(this, TRAIN_USESIMULATEDSPEED, false).toBool());
|
||||
useSimulatedSpeed->setToolTip(tr("Simulation physics uses current athlete parameters and settings\n"
|
||||
@@ -763,6 +752,13 @@ TrainOptionsPage::TrainOptionsPage(QWidget *parent, Context *context) : QWidget(
|
||||
lapAlert->setChecked(appsettings->value(this, TRAIN_LAPALERT, false).toBool());
|
||||
|
||||
QVBoxLayout *all = new QVBoxLayout(this);
|
||||
|
||||
QGridLayout *wdLayout = new QGridLayout;
|
||||
wdLayout->addWidget(workoutLabel, 0,0, Qt::AlignRight);
|
||||
wdLayout->addWidget(workoutDirectory, 0,1);
|
||||
wdLayout->addWidget(workoutBrowseButton, 0,2);
|
||||
all->addLayout(wdLayout);
|
||||
|
||||
all->addWidget(useSimulatedSpeed);
|
||||
all->addWidget(useSimulatedHypoxia);
|
||||
all->addWidget(multiCheck);
|
||||
@@ -777,6 +773,7 @@ qint32
|
||||
TrainOptionsPage::saveClicked()
|
||||
{
|
||||
// Save the train view settings...
|
||||
appsettings->setValue(GC_WORKOUTDIR, workoutDirectory->text());
|
||||
appsettings->setValue(TRAIN_USESIMULATEDSPEED, useSimulatedSpeed->isChecked());
|
||||
appsettings->setValue(TRAIN_USESIMULATEDHYPOXIA, useSimulatedHypoxia->isChecked());
|
||||
appsettings->setValue(TRAIN_MULTI, multiCheck->isChecked());
|
||||
@@ -787,6 +784,16 @@ TrainOptionsPage::saveClicked()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
TrainOptionsPage::browseWorkoutDir()
|
||||
{
|
||||
QString currentDir = workoutDirectory->text();
|
||||
if (!QDir(currentDir).exists()) currentDir = "";
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Workout Library"),
|
||||
currentDir, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
if (dir != "") workoutDirectory->setText(dir); //only overwrite current dir, if a new was selected
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Remote control page
|
||||
|
||||
@@ -87,7 +87,6 @@ class GeneralPage : public QWidget
|
||||
QCheckBox *metricRunPace, *metricSwimPace;
|
||||
|
||||
public slots:
|
||||
void browseWorkoutDir();
|
||||
void browseAthleteDir();
|
||||
#ifdef GC_WANT_PYTHON
|
||||
void browsePythonDir();
|
||||
@@ -105,6 +104,7 @@ class GeneralPage : public QWidget
|
||||
QComboBox *wbalForm;
|
||||
QCheckBox *garminSmartRecord;
|
||||
QCheckBox *warnOnExit;
|
||||
QCheckBox *openLastAthlete;
|
||||
#ifdef GC_WANT_HTTP
|
||||
QCheckBox *startHttp;
|
||||
#endif
|
||||
@@ -118,8 +118,6 @@ class GeneralPage : public QWidget
|
||||
QLineEdit *garminHWMarkedit;
|
||||
QLineEdit *hystedit;
|
||||
QLineEdit *athleteDirectory;
|
||||
QLineEdit *workoutDirectory;
|
||||
QPushButton *workoutBrowseButton;
|
||||
QPushButton *athleteBrowseButton;
|
||||
|
||||
#ifdef GC_WANT_PYTHON
|
||||
@@ -134,7 +132,6 @@ class GeneralPage : public QWidget
|
||||
#endif
|
||||
QLabel *langLabel;
|
||||
QLabel *warningLabel;
|
||||
QLabel *workoutLabel;
|
||||
QLabel *athleteLabel;
|
||||
|
||||
struct {
|
||||
@@ -227,8 +224,14 @@ class TrainOptionsPage : public QWidget
|
||||
TrainOptionsPage(QWidget *parent, Context *context);
|
||||
qint32 saveClicked();
|
||||
|
||||
public slots:
|
||||
void browseWorkoutDir();
|
||||
|
||||
private:
|
||||
Context *context;
|
||||
QLabel *workoutLabel;
|
||||
QLineEdit *workoutDirectory;
|
||||
QPushButton *workoutBrowseButton;
|
||||
QCheckBox *useSimulatedSpeed;
|
||||
QCheckBox *useSimulatedHypoxia;
|
||||
QCheckBox *multiCheck;
|
||||
|
||||
Reference in New Issue
Block a user