-TOP Items
-- Bug: New club/score with more than one comma (e.g xxx, yyy, zzz) does not work
+Updated: 10-Aug-2010
-TODO General:
-- New score dialog should be the same as main view (f.ex showing
- subtotals, totals, and score colors).
-- Use syslog
-- Year filters and maybe more, must be easy to apply
+This file contains to todo items for the N900 scorecard application.
+
+New Features and Enhancements:
+------------------------------
+
+ - Exact HCP not just a integer (not 10 but 10.1)
+
+ - Use the HCP (must be stored to the score since HCP keeps chaning)
+
+ - To be able to score for 1-4 person
+
+ - Stablefort point system (also during the play)
+
+ - Sync golf courses and scores to a server, share with
+ others. Online course repository: Ability to upload courses online
+ for others to download and use.
+
+ - Able to add putts, fairway hits, green in regulation, penalties
+ per hole
+
+ - 9th hole tally: A tally of your score after 9 holes.
+
+ - Autosave: no matter how many holes you have entered, your score is
+ still saved. I have had a couple time where I have been on the
+ 10th or 11th hole and I accidentally click the top of the screen,
+ this then cancels the score-entry window. This could also be a
+ prompt for save.
+
+ - Virtual 'HCP' adjustment based on scores entered. eg. You set to
+ like 20, then after 5/10 rounds entered, it calculates your
+ virtual-handicap or similar.
+
+ - HCP Colouring based on actual/entered HCP. eg, if you are a 18 hcp
+ golfer it colours your hole score based on this, not par.
+
+
+Usability:
+----------
+
+ - Bigger input screen for adding the score, perhaps only the first
+ nine on the first screen or only one hole per screen. It was very
+ hard to see the score when the sun is shining
+
+ - Year filters and maybe more, must be easy to apply
+
+Refactoring:
+------------
+
+ - New score dialog should be the same as main view (f.ex showing
+ subtotals, totals, and score colors).
+
+ - Use syslog
+
+
+Settings:
+---------
-Settings
- Play/view mode: shots or points
+
- Data store: internal or external MMC
-TODO Debian packaging
-- install data to SD card if present
+Installation:
+-------------
+
+ - install data to SD card if present
// ScoreDialogSingle based on QDialog
// Usage: edit scorecard data for single hole
////////////////////////////////////////////////////////////////////////////////
-ScoreDialogSingle::ScoreDialogSingle(QWidget *parent) : QDialog(parent)
+ScoreDialogSingle::ScoreDialogSingle(QWidget *parent) : ScoreDialog(parent)
{
TRACE;
resize(800, 400);
void ScoreDialogSingle::createTable(QWidget *parent)
{
TRACE;
- table = new QTableWidget(5, 5, parent);
+ table = new QTableWidget(ROWS, COLS, parent);
+ QFont font;
+ font.setPointSize(32);
+ table->setFont(font);
table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->setStyleSheet(defaultStyleSheet);
QStringList headers;
- headers << "" << "Par" << "HCP" << "Score" << "" << "Par" << "HCP" << "Score";
+ headers << "Hole" << "Par" << "HCP" << "Score" << "Putts" << "Fairway" << "Green";
table->setVerticalHeaderLabels(headers);
}
pushButtonFinish = new QPushButton(tr("Finish"));
connect(pushButtonFinish, SIGNAL(clicked()), this, SLOT(finish()));
}
+
+void ScoreDialogSingle::init(Course *course, Score *score)
+{
+ TRACE;
+ QTableWidgetItem *holeNum, *par, *hcp, *scoreItem, *putts, *fairway, *green;
+
+ for (int i = 0; i < 3; i++) {
+ par = new QTableWidgetItem(course->getPar(i));
+ hcp = new QTableWidgetItem(course->getHcp(i));
+
+ if (score)
+ scoreItem = new QTableWidgetItem(score->getScore(i));
+ else
+ scoreItem = new QTableWidgetItem("");
+
+ putts = new QTableWidgetItem("2");
+ fairway = new QTableWidgetItem("Yes");
+ green = new QTableWidgetItem("Yes");
+
+ holeNum = new QTableWidgetItem(QString::number(i+1));
+
+ holeNum->setTextAlignment(Qt::AlignCenter);
+ holeNum->setFlags(Qt::NoItemFlags);
+ holeNum->setForeground(ScoreColor::holeBg());
+
+ par->setTextAlignment(Qt::AlignCenter);
+ par->setFlags(Qt::NoItemFlags);
+
+ hcp->setTextAlignment(Qt::AlignCenter);
+ hcp->setFlags(Qt::NoItemFlags);
+
+ scoreItem->setTextAlignment(Qt::AlignCenter);
+ putts->setTextAlignment(Qt::AlignCenter);
+ fairway->setTextAlignment(Qt::AlignCenter);
+ green->setTextAlignment(Qt::AlignCenter);
+
+ table->setItem(ROW_HOLE, i, holeNum);
+ table->setItem(ROW_PAR, i, par);
+ table->setItem(ROW_HCP, i, hcp);
+ table->setItem(ROW_SCORE, i, scoreItem);
+ table->setItem(ROW_PUTTS, i, putts);
+ table->setItem(ROW_FAIRWAY, i, fairway);
+ table->setItem(ROW_GREEN, i, green);
+ }
+ // Set focus to 1st cell
+ table->setCurrentCell(ROW_SCORE, 0);
+ if (!score)
+ setDefaultScore(table);
+}
+
+// Set default score to par if not set
+// TODO: merge the two methods since they are the same
+void ScoreDialogSingle::setDefaultScore(QTableWidget *table)
+{
+ int row = table->currentRow();
+ int col = table->currentColumn();
+
+ if (row == ROW_SCORE)
+ row = ROW_PAR;
+ else {
+ qDebug() << "ERROR: unknown row in default score";
+ return;
+ }
+ QTableWidgetItem *par = table->item(row, col);
+ QTableWidgetItem *score = table->item(row + 2, col);
+
+ if (par && score && score->text() == "") {
+ QVariant value(par->text());
+ score->setData(Qt::DisplayRole, value);
+ }
+}
+
+void ScoreDialogSingle::up(void)
+{
+ QTableWidgetItem *item = table->currentItem();
+
+ if (!item) {
+ qWarning() << "ERROR: no current item";
+ return;
+ }
+
+ int i = (item->text()).toInt();
+ QVariant value(i+1);
+ item->setData(Qt::DisplayRole, value);
+}
+
+void ScoreDialogSingle::down(void)
+{
+ QTableWidgetItem *item = table->currentItem();
+
+ if (!item)
+ return;
+
+ int i = (item->text()).toInt();
+ QVariant value(i-1);
+ item->setData(Qt::DisplayRole, value);
+}
+
+void ScoreDialogSingle::next(void)
+{
+ if (table) {
+ QTableWidgetItem *item = table->currentItem();
+ moveToNextCell(item);
+ setDefaultScore(table);
+ }
+}
+
+void ScoreDialogSingle::moveToNextCell(QTableWidgetItem *item)
+{
+ if (!item)
+ return;
+
+ QTableWidget *table = item->tableWidget();
+
+ if (!table)
+ return;
+
+ int row = table->currentRow();
+ int col = table->currentColumn();
+
+ qDebug() << row << col;
+ if (row < (ROWS - 1)) {
+ row++;
+ }
+ else if (row == (ROWS - 1)) {
+ row = ROW_SCORE;
+ col = (col == COLS-1) ? 0 : col + 1;
+ }
+ qDebug() << row << col;
+ table->setCurrentCell(row, col);
+}
+
+void ScoreDialogSingle::results(QVector<QString> &scores)
+{
+ TRACE;
+}