projects
/
scorecard
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b6a369e
)
Use common colors and style sheets for all windows and dialogs
author
Sakari Poussa
<spoussa@gmail.com>
Sat, 26 Dec 2009 11:00:29 +0000
(13:00 +0200)
committer
Sakari Poussa
<spoussa@gmail.com>
Sat, 26 Dec 2009 11:00:29 +0000
(13:00 +0200)
TODO
patch
|
blob
|
history
src/course-dialog.cpp
patch
|
blob
|
history
src/main-window.cpp
patch
|
blob
|
history
src/score-dialog.cpp
patch
|
blob
|
history
src/table-model.cpp
patch
|
blob
|
history
diff --git
a/TODO
b/TODO
index
3bd8e45
..
0d02784
100644
(file)
--- a/
TODO
+++ b/
TODO
@@
-1,6
+1,11
@@
TOP Items
TODO General:
TOP Items
TODO General:
+- Always: when enterin ultiple scores, course does not update on
+ mainwiew. Window title is correct, but par/hcp info is not from the
+ same course. Next/prev few times corrects the problem.
+- New score dialog should be the same as main view (f.ex showing
+ subtotals, totals, and score colors).
- edit course table is selectable (chk others)
- split club/course DB in master and user
- If course is in the score but not in course, navogating away from
- edit course table is selectable (chk others)
- split club/course DB in master and user
- If course is in the score but not in course, navogating away from
@@
-12,6
+17,8
@@
TODO General:
- Seems to be bug in the Qt/Maemo
- Date picker button (widget is missing)
- Use syslog
- Seems to be bug in the Qt/Maemo
- Date picker button (widget is missing)
- Use syslog
+- Year filters and maybe more, must be easy to apply
+
TODO Hildon 2.2
- Replace LineEdit w/ HildonEntry
TODO Hildon 2.2
- Replace LineEdit w/ HildonEntry
diff --git
a/src/course-dialog.cpp
b/src/course-dialog.cpp
index
9b6273b
..
fff235e
100644
(file)
--- a/
src/course-dialog.cpp
+++ b/
src/course-dialog.cpp
@@
-13,8
+13,7
@@
#include <QtGui/QTableWidget>
#include "course-dialog.h"
#include <QtGui/QTableWidget>
#include "course-dialog.h"
-#include "cell-delegate.h"
-
+#include "score-common.h"
CourseSelectDialog::CourseSelectDialog(QWidget *parent) : QDialog(parent)
{
CourseSelectDialog::CourseSelectDialog(QWidget *parent) : QDialog(parent)
{
@@
-135,13
+134,12
@@
void CourseDialog::createTable(QWidget *parent)
table->horizontalHeader()->hide();
table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->hide();
table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
+ table->setStyleSheet(ScoreColor::styleSheet());
}
void CourseDialog::init(Course *course)
{
QTableWidgetItem *par, *hcp;
}
void CourseDialog::init(Course *course)
{
QTableWidgetItem *par, *hcp;
- QColor fgColor(Qt::white);
- QColor bgColor(Qt::darkGray);
for (int i=0; i<18; i++) {
if (course) {
for (int i=0; i<18; i++) {
if (course) {
@@
-155,8
+153,7
@@
void CourseDialog::init(Course *course)
QTableWidgetItem *len = new QTableWidgetItem("");
QTableWidgetItem *holeNum = new QTableWidgetItem(QString::number(i+1));
QTableWidgetItem *len = new QTableWidgetItem("");
QTableWidgetItem *holeNum = new QTableWidgetItem(QString::number(i+1));
- holeNum->setTextColor(fgColor);
- holeNum->setBackgroundColor(bgColor);
+ holeNum->setBackgroundColor(ScoreColor::holeBg());
holeNum->setTextAlignment(Qt::AlignCenter);
par->setTextAlignment(Qt::AlignCenter);
holeNum->setTextAlignment(Qt::AlignCenter);
par->setTextAlignment(Qt::AlignCenter);
diff --git
a/src/main-window.cpp
b/src/main-window.cpp
index
2296b9e
..
a7b1a88
100644
(file)
--- a/
src/main-window.cpp
+++ b/
src/main-window.cpp
@@
-8,6
+8,7
@@
#include <QtGui>
#include <QtGui>
+#include "score-common.h"
#include "main-window.h"
#include "score-dialog.h"
#include "course-dialog.h"
#include "main-window.h"
#include "score-dialog.h"
#include "course-dialog.h"
@@
-126,6
+127,8
@@
void MainWindow::createTableView(QList<Score *> &scoreList, QList <Club *> &club
table->showGrid();
table->showGrid();
+ table->setStyleSheet(ScoreColor::styleSheet());
+
table->setModel(scoreTableModel);
table->setSelectionMode(QAbstractItemView::NoSelection);
table->setModel(scoreTableModel);
table->setSelectionMode(QAbstractItemView::NoSelection);
@@
-136,7
+139,7
@@
void MainWindow::createTableView(QList<Score *> &scoreList, QList <Club *> &club
table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->hide();
table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->hide();
- table->verticalHeader()->setStyleSheet("background-color: yellow; color : gray }");
+ //table->verticalHeader()->setStyleSheet("color : gray }");
}
void MainWindow::createActions()
}
void MainWindow::createActions()
diff --git
a/src/score-dialog.cpp
b/src/score-dialog.cpp
index
443bfd2
..
4b42593
100644
(file)
--- a/
src/score-dialog.cpp
+++ b/
src/score-dialog.cpp
@@
-10,6
+10,7
@@
#include <QInputContext>
#include "score-dialog.h"
#include <QInputContext>
#include "score-dialog.h"
+#include "score-common.h"
SelectDialog::SelectDialog(QWidget *parent) : QDialog(parent)
{
SelectDialog::SelectDialog(QWidget *parent) : QDialog(parent)
{
@@
-152,6
+153,8
@@
void ScoreDialog::createTable(QWidget *parent)
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->hide();
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->hide();
+ table->setStyleSheet(ScoreColor::styleSheet());
+
QStringList headers;
headers << "" << "Par" << "HCP" << "Score" << "" << "Par" << "HCP" << "Score";
table->setVerticalHeaderLabels(headers);
QStringList headers;
headers << "" << "Par" << "HCP" << "Score" << "" << "Par" << "HCP" << "Score";
table->setVerticalHeaderLabels(headers);
@@
-175,8
+178,6
@@
void ScoreDialog::createButton(QWidget *parent)
void ScoreDialog::init(Course *course, Score *score)
{
QTableWidgetItem *par, *hcp, *scoreItem, *holeNum;
void ScoreDialog::init(Course *course, Score *score)
{
QTableWidgetItem *par, *hcp, *scoreItem, *holeNum;
- QColor fgColor(Qt::white);
- QColor bgColor(Qt::darkGray);
for (int i = 0; i < 18; i++) {
par = new QTableWidgetItem(course->getPar(i));
for (int i = 0; i < 18; i++) {
par = new QTableWidgetItem(course->getPar(i));
@@
-187,8
+188,7
@@
void ScoreDialog::init(Course *course, Score *score)
scoreItem = new QTableWidgetItem("");
holeNum = new QTableWidgetItem(QString::number(i+1));
scoreItem = new QTableWidgetItem("");
holeNum = new QTableWidgetItem(QString::number(i+1));
- holeNum->setTextColor(fgColor);
- holeNum->setBackgroundColor(bgColor);
+ holeNum->setBackgroundColor(ScoreColor::holeBg());
par->setTextAlignment(Qt::AlignCenter);
hcp->setTextAlignment(Qt::AlignCenter);
par->setTextAlignment(Qt::AlignCenter);
hcp->setTextAlignment(Qt::AlignCenter);
diff --git
a/src/table-model.cpp
b/src/table-model.cpp
index
2a8e3c0
..
6c490ed
100644
(file)
--- a/
src/table-model.cpp
+++ b/
src/table-model.cpp
@@
-12,6
+12,8
@@
#include "table-model.h"
#include "score-common.h"
#include "table-model.h"
#include "score-common.h"
+QString empty("");
+
Qt::ItemFlags ScoreTableModel::flags (const QModelIndex &)
{
return 0;
Qt::ItemFlags ScoreTableModel::flags (const QModelIndex &)
{
return 0;
@@
-207,8
+209,8
@@
QVariant ScoreTableModel::data(const QModelIndex &index, int role) const
// 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) {
// 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;
+ QBrush brush(ScoreColor::holeBg());
+ return brush;
}
if (score && course && (row == ROW_SCORE || row == ROW_SCORE_2)) {
int par;
}
if (score && course && (row == ROW_SCORE || row == ROW_SCORE_2)) {
int par;
@@
-224,38
+226,38
@@
QVariant ScoreTableModel::data(const QModelIndex &index, int role) const
if (col == (COLS+1) && row == ROW_SCORE_2) {
// Total score
if (col == (COLS+1) && row == ROW_SCORE_2) {
// Total score
- QBrush brush(colorTotal);
+ QBrush brush(ScoreColor::total());
return brush;
}
if (col == COLS) {
// In and Out scores
return brush;
}
if (col == COLS) {
// In and Out scores
- QBrush brush(colorSubTotal);
+ QBrush brush(ScoreColor::subTotal());
return brush;
}
if (col < COLS) {
if (shots == par) {
// Par
return brush;
}
if (col < COLS) {
if (shots == par) {
// Par
- QBrush brush(colorPar);
+ QBrush brush(ScoreColor::par());
return brush;
}
if (shots == (par-1)) {
// Birdie
return brush;
}
if (shots == (par-1)) {
// Birdie
- QBrush brush(colorBirdie);
+ QBrush brush(ScoreColor::birdie());
return brush;
}
if (shots == (par+1)) {
// Bogey
return brush;
}
if (shots == (par+1)) {
// Bogey
- QBrush brush(colorBogey);
+ QBrush brush(ScoreColor::bogey());
return brush;
}
if (shots == (par+2)) {
// Double Bogey
return brush;
}
if (shots == (par+2)) {
// Double Bogey
- QBrush brush(colorDoubleBogey);
+ QBrush brush(ScoreColor::doubleBogey());
return brush;
}
if (shots > (par+2)) {
// Very bad
return brush;
}
if (shots > (par+2)) {
// Very bad
- QBrush brush(colorBad);
+ QBrush brush(ScoreColor::bad());
return brush;
}
}
return brush;
}
}