mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Add Starting LTS to Season
.. so we can seed 'CTL' for the PMC charts
This commit is contained in:
@@ -39,6 +39,7 @@ Season::Season()
|
||||
{
|
||||
type = season; // by default seasons are of type season
|
||||
_id = QUuid::createUuid(); // in case it isn't set yet
|
||||
_seed = 0;
|
||||
}
|
||||
|
||||
QString Season::getName() {
|
||||
@@ -96,6 +97,7 @@ EditSeasonDialog::EditSeasonDialog(MainWindow *mainWindow, Season *season) :
|
||||
QLabel *type = new QLabel("Type");
|
||||
QLabel *from = new QLabel("From");
|
||||
QLabel *to = new QLabel("To");
|
||||
QLabel *seed = new QLabel(tr("Starting LTS"));
|
||||
|
||||
nameEdit = new QLineEdit(this);
|
||||
nameEdit->setText(season->getName());
|
||||
@@ -112,6 +114,15 @@ EditSeasonDialog::EditSeasonDialog(MainWindow *mainWindow, Season *season) :
|
||||
toEdit = new QDateEdit(this);
|
||||
toEdit->setDate(season->getEnd());
|
||||
|
||||
seedEdit = new QDoubleSpinBox(this);
|
||||
seedEdit->setDecimals(0);
|
||||
seedEdit->setRange(0.0, 100.0);
|
||||
seedEdit->setSingleStep(1.0);
|
||||
seedEdit->setWrapping(true);
|
||||
seedEdit->setAlignment(Qt::AlignLeft);
|
||||
seedEdit->setValue(season->getSeed());
|
||||
|
||||
|
||||
grid->addWidget(name, 0,0);
|
||||
grid->addWidget(nameEdit, 0,1);
|
||||
grid->addWidget(type, 1,0);
|
||||
@@ -120,6 +131,8 @@ EditSeasonDialog::EditSeasonDialog(MainWindow *mainWindow, Season *season) :
|
||||
grid->addWidget(fromEdit, 2,1);
|
||||
grid->addWidget(to, 3,0);
|
||||
grid->addWidget(toEdit, 3,1);
|
||||
grid->addWidget(seed, 4,0);
|
||||
grid->addWidget(seedEdit, 4,1);
|
||||
|
||||
mainLayout->addLayout(grid);
|
||||
|
||||
@@ -145,6 +158,7 @@ EditSeasonDialog::applyClicked()
|
||||
season->setType(typeEdit->itemData(typeEdit->currentIndex()).toInt());
|
||||
season->setStart(fromEdit->date());
|
||||
season->setEnd(toEdit->date());
|
||||
season->setSeed(seedEdit->value());
|
||||
accept();
|
||||
}
|
||||
void
|
||||
|
||||
@@ -48,6 +48,7 @@ class Season
|
||||
Season();
|
||||
QDate getStart();
|
||||
QDate getEnd();
|
||||
int getSeed() { return _seed; }
|
||||
QString getName();
|
||||
int days() { return _days; } // how many days in the season, -1 if never ending
|
||||
int getType();
|
||||
@@ -57,6 +58,7 @@ class Season
|
||||
void setEnd(QDate _end);
|
||||
void setName(QString _name);
|
||||
void setType(int _type);
|
||||
void setSeed(int x) { _seed = x; }
|
||||
QUuid id() const { return _id; }
|
||||
void setId(QUuid x) { _id = x; }
|
||||
QVector<int> &load() { return _load; }
|
||||
@@ -64,6 +66,7 @@ class Season
|
||||
QDate start; // first day of the season
|
||||
QDate end; // last day of the season
|
||||
int _days; // how many days in this season?
|
||||
int _seed;
|
||||
QUuid _id; // unique id
|
||||
|
||||
QString name; // name, typically users name them by year e.g. "2011 Season"
|
||||
@@ -94,6 +97,7 @@ class EditSeasonDialog : public QDialog
|
||||
QLineEdit *nameEdit;
|
||||
QComboBox *typeEdit;
|
||||
QDateEdit *fromEdit, *toEdit;
|
||||
QDoubleSpinBox *seedEdit;
|
||||
};
|
||||
|
||||
class EditSeasonEventDialog : public QDialog
|
||||
|
||||
@@ -48,6 +48,8 @@ bool SeasonParser::endElement( const QString&, const QString&, const QString &qN
|
||||
season.load().resize(loadcount+1);
|
||||
season.load()[loadcount] = buffer.trimmed().toInt();
|
||||
loadcount++;
|
||||
} else if (qName == "seed") {
|
||||
season.setSeed(buffer.trimmed().toInt());
|
||||
} else if (qName == "event") {
|
||||
|
||||
season.events.append(SeasonEvent(unquote(buffer.trimmed()), seasonDateToDate(dateString)));
|
||||
@@ -147,11 +149,13 @@ SeasonParser::serialize(QString filename, QList<Season>Seasons)
|
||||
"\t\t<startdate>%2</startdate>\n"
|
||||
"\t\t<enddate>%3</enddate>\n"
|
||||
"\t\t<type>%4</type>\n"
|
||||
"\t\t<id>%5</id>\n") .arg(season.getName())
|
||||
"\t\t<id>%5</id>\n"
|
||||
"\t\t<seed>%6</seed>\n") .arg(season.getName())
|
||||
.arg(season.getStart().toString("yyyy-MM-dd"))
|
||||
.arg(season.getEnd().toString("yyyy-MM-dd"))
|
||||
.arg(season.getType())
|
||||
.arg(season.id().toString());
|
||||
.arg(season.id().toString())
|
||||
.arg(season.getSeed());
|
||||
|
||||
|
||||
// load profile
|
||||
|
||||
Reference in New Issue
Block a user