From ee2b485238302c6a7dab52bfbc128a50d1a5d2f9 Mon Sep 17 00:00:00 2001 From: Sakari Poussa Date: Wed, 11 Nov 2009 14:55:50 +0200 Subject: [PATCH] Deleted extra files, removed unused .cpp files for build Debian post-install does chown to data files so app can write them Color and compiler tunings --- TODO | 4 +- data/save/club.xml | 364 ------------------ data/save/score.xml | 1062 --------------------------------------------------- debian/control | 6 +- debian/postinst | 3 +- scorecard.pro | 12 +- src/main-window.cpp | 48 +-- src/main-window.h | 4 - src/table-model.cpp | 40 +- 9 files changed, 35 insertions(+), 1508 deletions(-) delete mode 100644 data/save/club.xml delete mode 100644 data/save/score.xml diff --git a/TODO b/TODO index d9cbae0..858deab 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,9 @@ TOP Items - Course edit does not store the changes TODO General: - +- edit course table is selectable (chk others) +- yeallow color is bad, black is good +- split club/course DB in master and user - If course is in the score but not in course, navogating away from the score not possible. Editing the score core dumps. - Statistics view (BIG) diff --git a/data/save/club.xml b/data/save/club.xml deleted file mode 100644 index 50e8be9..0000000 --- a/data/save/club.xml +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/save/score.xml b/data/save/score.xml deleted file mode 100644 index 4dfe26a..0000000 --- a/data/save/score.xml +++ /dev/null @@ -1,1062 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/debian/control b/debian/control index b6445fb..9b095b1 100644 --- a/debian/control +++ b/debian/control @@ -7,10 +7,10 @@ Standards-Version: 3.7.2 Package: scorecard Architecture: any -Depends: libqt4-gui (>= 4.5.3~git20090723-0maemo4.1) -Description: A simple golf score card application for N900 +Depends: libqt4-gui (>= 4.5.3~git20090723-0maemo4.2) +Description: Simple golf score card application for N900 to keep track of your golf scores. . - Further Information: qt4.garage.maemo.org + Further Information: http://scorecard.garage.maemo.org XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A /wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gIDg0MI+QcpT0AAAAZdEVYdENv diff --git a/debian/postinst b/debian/postinst index b67010c..8698482 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,5 +1,6 @@ #!/bin/sh -e gtk-update-icon-cache -f /usr/share/icons/hicolor -chmod 777 /opt/scorecard/data +chown user.users /opt/scorecard/data +chown user.users /opt/scorecard/data/club.xml exit 0 diff --git a/scorecard.pro b/scorecard.pro index e45a65f..f3dd8da 100644 --- a/scorecard.pro +++ b/scorecard.pro @@ -16,26 +16,18 @@ HEADERS = \ src/main-window.h \ src/score-dialog.h \ src/course-dialog.h \ -src/cell-delegate.h \ src/table-model.h \ src/xml-dom-parser.h \ -src/data.h \ -src/tree-model.h \ -src/tree-item.h \ -src/tree-widget.h +src/data.h SOURCES = \ src/main.cpp \ src/main-window.cpp \ src/score-dialog.cpp \ src/course-dialog.cpp \ -src/cell-delegate.cpp \ src/table-model.cpp \ src/xml-dom-parser.cpp \ -src/data.cpp \ -src/tree-model.cpp \ -src/tree-item.cpp \ -src/tree-widget.cpp +src/data.cpp unix { #VARIABLES diff --git a/src/main-window.cpp b/src/main-window.cpp index 98351e2..e81997a 100644 --- a/src/main-window.cpp +++ b/src/main-window.cpp @@ -1,13 +1,11 @@ #include #include -#include #include #include #include "main-window.h" #include "score-dialog.h" #include "course-dialog.h" -#include "tree-widget.h" #include "xml-parser.h" #include "xml-dom-parser.h" @@ -48,7 +46,6 @@ MainWindow::MainWindow(QMainWindow *parent): QMainWindow(parent) createMenus(); createTableView(scoreList, clubList); - //createTreeView(scoreList, parent); createStatusBar(); createLayout(centralWidget); @@ -139,45 +136,6 @@ void MainWindow::createTableView(QList &scoreList, QList &club table->horizontalHeader()->hide(); } -// When selection down in 'stat' view, this is called. -void MainWindow::updateTreeView(const QModelIndex & index) -{ - QString scope("Scope"); - QString count("Rounds"); - QString scoreAvg("Score (avg.)"); - QString scoreBest("Score (best)"); - QString score("Total"); - QString scoreIn("Total in"); - QString scoreOut("Total out"); - - QVariant str = scoreTreeModel->data(index, Qt::DisplayRole); - QVariant type = scoreTreeModel->data(index, ScoreTreeModel::Type); - - qDebug() << "update(" << index.row() << "/" << index.column() << "):" << str << type; - - tableModel->setData(tableModel->index(0, 0, QModelIndex()), scope); - tableModel->setData(tableModel->index(0, 1, QModelIndex()), str); - - if (type == TreeItem::TypeDate) { - tableModel->setData(tableModel->index(1, 0, QModelIndex()), count); - tableModel->setData(tableModel->index(2, 0, QModelIndex()), scoreAvg); - tableModel->setData(tableModel->index(3, 0, QModelIndex()), scoreBest); - } - else if (type == TreeItem::TypeScore) { - QVariant value = scoreTreeModel->data(index, ScoreTreeModel::Total); - tableModel->setData(tableModel->index(1, 0, QModelIndex()), score); - tableModel->setData(tableModel->index(1, 1, QModelIndex()), value); - - value = scoreTreeModel->data(index, ScoreTreeModel::TotalOut); - tableModel->setData(tableModel->index(2, 0, QModelIndex()), scoreOut); - tableModel->setData(tableModel->index(2, 1, QModelIndex()), value); - - value = scoreTreeModel->data(index, ScoreTreeModel::TotalIn); - tableModel->setData(tableModel->index(3, 0, QModelIndex()), scoreIn); - tableModel->setData(tableModel->index(3, 1, QModelIndex()), value); - } -} - void MainWindow::createStatusBar() { #if 0 @@ -246,7 +204,11 @@ void MainWindow::createMenus() void MainWindow::updateStatusBar() { - setWindowTitle(scoreTableModel->getInfoText()); + QString title = scoreTableModel->getInfoText(); + if (title.isEmpty()) + title = "ScoreCard - No Scores"; + + setWindowTitle(title); } void MainWindow::firstButtonClicked() diff --git a/src/main-window.h b/src/main-window.h index 7ba48c3..abcaef7 100644 --- a/src/main-window.h +++ b/src/main-window.h @@ -10,7 +10,6 @@ #include "data.h" #include "table-model.h" -#include "tree-model.h" class MainWindow : public QMainWindow { @@ -21,7 +20,6 @@ public: void createLayout(QWidget *parent = 0); void createStatusBar(); void createTableView(QList &, QList &); - void createTreeView(QList &, QObject *parent = 0); void updateStatusBar(); void loadScoreFile(QString &fileName, QList &scoreList); void loadClubFile(QString &fileName, QList &clubList); @@ -37,7 +35,6 @@ private slots: void nextButtonClicked(); void prevButtonClicked(); - void updateTreeView(const QModelIndex & index); void newScore(); void editScore(); void newCourse(); @@ -52,7 +49,6 @@ private: QList clubList; ScoreTableModel *scoreTableModel; - ScoreTreeModel *scoreTreeModel; QAbstractItemModel *tableModel; QItemSelectionModel *selectionModel; diff --git a/src/table-model.cpp b/src/table-model.cpp index 6ef8bc8..529b43d 100644 --- a/src/table-model.cpp +++ b/src/table-model.cpp @@ -4,7 +4,19 @@ #include #include "table-model.h" -Qt::ItemFlags ScoreTableModel::flags ( const QModelIndex & index ) +QString empty(""); + +QColor colorHoleBg(Qt::darkGray); +QColor colorHoleFg(Qt::yellow); +QColor colorBirdie(102, 102, 255); +QColor colorPar(Qt::green); +QColor colorBogey(Qt::darkGreen); +QColor colorDoubleBogey(Qt::red); +QColor colorBad(Qt::red); +QColor colorSubTotal(Qt::black); +QColor colorTotal(Qt::black); + +Qt::ItemFlags ScoreTableModel::flags (const QModelIndex & index) { return 0; } @@ -63,22 +75,18 @@ QString ScoreTableModel::getCountText() QString& ScoreTableModel::clubName(void) { - QString str(""); - if (club) - str = club->getName(); + return club->getName(); - return str; + return empty; } QString& ScoreTableModel::courseName(void) { - QString str(""); - if (course) - str = course->getName(); + return course->getName(); - return str; + return empty; } Course *ScoreTableModel::findCourse(const QString &clubName, @@ -179,15 +187,6 @@ QModelIndex ScoreTableModel::index(int row, int column, const QModelIndex &paren QVariant ScoreTableModel::data(const QModelIndex &index, int role) const { // TODO: move away from the stack - QColor colorHoleBg(Qt::darkGray); - QColor colorHoleFg(Qt::yellow); - QColor colorBirdie(Qt::yellow); - QColor colorPar(Qt::green); - QColor colorBogey(Qt::darkGreen); - QColor colorDoubleBogey(Qt::red); - QColor colorBad(Qt::red); - QColor colorSubTotal(Qt::black); - QColor colorTotal(Qt::black); if (!index.isValid()) return QVariant(); @@ -209,8 +208,9 @@ QVariant ScoreTableModel::data(const QModelIndex &index, int role) const // COLORS // if (role == Qt::BackgroundRole) { - // Hole numbers 1-18 - if (row == ROW_HOLE || row == ROW_HOLE_2) { + // Hole numbers 1-18. All hole nums, in, out and tot cell but not + // the empty cell. + if ((row == ROW_HOLE && col != 10) || row == ROW_HOLE_2) { QBrush brush(colorHoleBg); return brush; } -- 1.7.9.5