All fonts are now bigger (20pt)
authorSakari Poussa <spoussa@gmail.com>
Thu, 27 May 2010 16:42:57 +0000 (19:42 +0300)
committerSakari Poussa <spoussa@gmail.com>
Thu, 27 May 2010 16:42:57 +0000 (19:42 +0300)
src/course-dialog.cpp
src/main-window.cpp
src/score-common.h
src/score-dialog.cpp
src/stat-model.cpp
src/table-model.cpp

index 9010ef1..d8192ea 100644 (file)
@@ -38,7 +38,7 @@ CourseWindow::CourseWindow(QWidget *parent) : QMainWindow(parent)
     QTableView * table = new QTableView;
     table->showGrid();
     table->setSelectionMode(QAbstractItemView::NoSelection);
-    table->setStyleSheet(ScoreStyle::style());
+    table->setStyleSheet(defaultStyleSheet);
     table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
     table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
     table->horizontalHeader()->hide();
@@ -192,7 +192,7 @@ void CourseDialog::createTable(QWidget *parent)
   table->horizontalHeader()->hide();
   table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
   table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
-  table->setStyleSheet(ScoreStyle::style());
+  table->setStyleSheet(defaultStyleSheet);
 }
 
 void CourseDialog::init(Course *course)
index f028e39..12f774a 100644 (file)
@@ -258,7 +258,7 @@ void MainWindow::createListView(QList<Score *> &scoreList,
     scoreListModel = new ScoreListModel(scoreList, clubList);
     courseListModel = new CourseListModel(clubList);
 
-    list->setStyleSheet(ScoreStyle::style());
+    list->setStyleSheet(defaultStyleSheet);
 
     list->setSelectionMode(QAbstractItemView::SingleSelection);
     list->setProperty("FingerScrolling", true);
@@ -627,7 +627,7 @@ void MainWindow::viewStatistics()
     QTableView *table = new QTableView;
     table->showGrid();
     table->setSelectionMode(QAbstractItemView::NoSelection);
-    table->setStyleSheet(ScoreStyle::style());
+    table->setStyleSheet(statStyleSheet);
     table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
     table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
     table->verticalHeader()->setAutoFillBackground(true);
index 149308d..dca5d09 100644 (file)
@@ -8,26 +8,6 @@
 #ifndef SCORE_COMMON_H
 #define SCORE_COMMON_H
 
-#if 0
-#define SC_BLUE_THEME
-
-QColor colorHoleBg(64, 64, 64);
-QColor colorHoleFg(Qt::yellow);
-QColor colorBirdie(00, 0x99, 00);
-QColor colorPar(Qt::black);
-#ifdef SC_ORANGE_THEME
-QColor colorBogey(0xfc, 0xaf, 0x3e);
-QColor colorDoubleBogey(0xf5, 0x79, 0x00);
-QColor colorBad(0xce, 0x5c, 0x00);
-#endif
-#ifdef SC_BLUE_THEME
-QColor colorBogey(0x20, 0x4a, 0x87);
-QColor colorDoubleBogey(0x34, 0x65, 0xa4);
-QColor colorBad(0x72, 0x9f, 0xcf);
-#endif
-QColor colorSubTotal(Qt::black);
-QColor colorTotal(Qt::black);
-#endif
 #include <QColor>
 
 #ifndef WANT_DEBUG
@@ -37,6 +17,7 @@ QColor colorTotal(Qt::black);
 #define TRACE qDebug()<<QString("[%1] %2(): %3").arg(__FILE__).arg(__func__).arg(__LINE__);
 #endif
 
+static int fontSize = 20;
 
 class AppSettings {
 public:
@@ -59,51 +40,35 @@ class ScoreColor
     static QColor total()       { return Qt::white;                }
 }; 
 
-class ScoreStyle {
-public:
-    static QString style()
-    {
-        return QString("QTableView {"
-                         "background-color: white;"
-                         "color : gray;"
-                         "border: solid green;"
-                         "font-size : 20px;"
-                       "}"
-                       "QHeaderView::section {"
-                         "color : white;"
-                         "border: solid green;"
-                         "font: bold large;"
-                       "}");
-
+static QString statStyleSheet("QTableView {color : white;}");
+static QString defaultStyleSheet("QTableView {"
+                                 "background-color: white;"
+                                 "color : gray;"
+                                 "border: solid green;"
+                                 "}"
+                                 "QHeaderView::section {"
+                                 "color : white;"
+                                 "border: solid green;"
+                                 "}");
 #if 0
-                       "QAbstractItemView::item[role=\"header\"]{"
-                         "background : orange;"
-                         "color : yellow;"
-                         "border: solid green;"
-                         "font-size : 16px;"
-                       "}"
-                       "QAbstractItemView::item"
-                         "background : orange;"
-                         "color : white;"
-                         "border: solid green;"
-                         "font-size : 16px;"
-                       "}"
-                       "QTableView {"
-                         "alternate-background-color: yellow;"
-                         "background-color: red;"
-                         "color : blue;"
-                         "border: solid green;"
-                         "gridline-color: green;"
-                       "}"
-
+"QAbstractItemView::item[role=\"header\"]{"
+"background : orange;"
+"color : yellow;"
+"border: solid green;"
+"font-size : 16px;"
+"}"
+"QAbstractItemView::item"
+"background : orange;"
+"color : white;"
+"border: solid green;"
+"font-size : 16px;"
+"}"
+"QTableView {"
+"alternate-background-color: yellow;"
+"background-color: red;"
+"color : blue;"
+"border: solid green;"
+"gridline-color: green;"
+"}"
 #endif
-    }
-    static QString headerView()
-    {
-        return QString("QHeaderView::section { background-color : #404040 }");
-        //return QString("QHeaderView { background-color : #404040 }");
-        return QString("QTableView { background-color : red }");
-    }
-};
-
 #endif
index a0fd9e8..faa8d82 100644 (file)
@@ -38,7 +38,7 @@ ScoreWindow::ScoreWindow(QWidget *parent) : QMainWindow(parent)
     QTableView * table = new QTableView;
     table->showGrid();
     table->setSelectionMode(QAbstractItemView::NoSelection);
-    table->setStyleSheet(ScoreStyle::style());
+    table->setStyleSheet(defaultStyleSheet);
     table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
     table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
     table->horizontalHeader()->hide();
@@ -196,6 +196,9 @@ ScoreDialog::ScoreDialog(QWidget *parent) : QDialog(parent)
 {
     TRACE;
     resize(800, 400);
+    QFont font;
+    font.setPointSize(fontSize);
+    setFont(font);
 
     QWidget *centralWidget = new QWidget(this);
 
@@ -253,7 +256,7 @@ void ScoreDialog::createTable(QWidget *parent)
     table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
     table->horizontalHeader()->hide();
 
-    table->setStyleSheet(ScoreStyle::style());
+    table->setStyleSheet(defaultStyleSheet);
 
     QStringList headers;
     headers << "" << "Par" << "HCP" << "Score" << "" << "Par" << "HCP" << "Score";
index 605fc8d..9ce9526 100644 (file)
@@ -7,7 +7,9 @@
  */
 
 #include <QVariant>
+#include <QFont>
 
+#include "score-common.h"
 #include "stat-model.h"
 
 StatModel::StatModel(QList<Club *> &cList, QList<Score *> &sList) : clubList(cList), scoreList(sList)
@@ -46,6 +48,14 @@ QVariant StatModel::data(const QModelIndex & index, int role) const
   }
 
   //
+  // FONT
+  //
+  if (role == Qt::FontRole) {
+      QFont font;
+      font.setPointSize(fontSize);
+      return font;
+  }
+  //
   // NUMBERS
   //
   if (role == Qt::DisplayRole) {
index 649949c..24578e6 100644 (file)
@@ -122,8 +122,10 @@ QVariant ScoreTableModel::data(const QModelIndex &index, int role) const
   //
   if (role == Qt::FontRole) {
       QFont font;
-      font.setBold(true);
-      font.setPointSize(26);
+      font.setPointSize(fontSize);
+      if (row == ROW_HOLE || row == ROW_HOLE_2) {
+          font.setBold(true);
+      }
       return font;
   }
 
@@ -199,6 +201,11 @@ QVariant ScoreTableModel::headerData(int section, Qt::Orientation orientation, i
   if (orientation == Qt::Horizontal)
     return QVariant();
 
+  if (role == Qt::FontRole) {
+      QFont font;
+      font.setPointSize(fontSize);
+      return font;
+  }
   if (role == Qt::DisplayRole) {
     switch(section) {
     case ROW_HOLE: 
@@ -263,11 +270,12 @@ QVariant CourseTableModel::data(const QModelIndex &index, int role) const
     // FONT
     //
     if (role == Qt::FontRole) {
+        QFont font;
+        font.setPointSize(fontSize);
         if (row == ROW_HOLE || row == ROW_HOLE_2) {
-            QFont font;
             font.setBold(true);
-            return font;
         }
+        return font;
     }
   //
   // COLORS
@@ -338,6 +346,11 @@ QVariant CourseTableModel::headerData(int section, Qt::Orientation orientation,
   if (orientation == Qt::Horizontal)
     return QVariant();
 
+  if (role == Qt::FontRole) {
+      QFont font;
+      font.setPointSize(fontSize);
+      return font;
+  }
   if (role == Qt::DisplayRole) {
     switch(section) {
     case ROW_HOLE: