Use QListWidget instead of comboboxes
authorSakari Poussa <sakari.poussa@nokia.com>
Tue, 13 Oct 2009 20:36:09 +0000 (23:36 +0300)
committerSakari Poussa <sakari.poussa@nokia.com>
Tue, 13 Oct 2009 20:36:09 +0000 (23:36 +0300)
Cleanup a bit

Makefile
data/score.xml
src/course-dialog.cpp
src/course-dialog.h
src/main-window.cpp
src/score-dialog.cpp
src/score-dialog.h

index 3728e4a..90c9878 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 #############################################################################
 # Makefile for building: bin/scorecard
-# Generated by qmake (2.01a) (Qt 4.5.0) on: Mon Oct 12 22:55:01 2009
+# Generated by qmake (2.01a) (Qt 4.5.3) on: Tue Oct 13 22:10:00 2009
 # Project:  scorecard.pro
 # Template: app
-# Command: /opt/qtsdk-2009.01/qt/bin/qmake -unix -o Makefile scorecard.pro
+# Command: /usr/bin/qmake -unix -o Makefile scorecard.pro
 #############################################################################
 
 ####### Compiler, tools and options
 CC            = gcc
 CXX           = g++
 DEFINES       = -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
-CFLAGS        = -pipe -g -D_REENTRANT -Wall -W $(DEFINES)
-CXXFLAGS      = -pipe -Wno-return-type -g -D_REENTRANT -Wall -W $(DEFINES)
-INCPATH       = -I/opt/qtsdk-2009.01/qt/mkspecs/linux-g++ -I. -I/opt/qtsdk-2009.01/qt/include/QtCore -I/opt/qtsdk-2009.01/qt/include/QtGui -I/opt/qtsdk-2009.01/qt/include/QtXml -I/opt/qtsdk-2009.01/qt/include -Imoc -Iobj
+CFLAGS        = -pipe -g -O0 -D_REENTRANT -Wall -W $(DEFINES)
+CXXFLAGS      = -pipe -Wno-return-type -g -g -O0 -D_REENTRANT -Wall -W $(DEFINES)
+INCPATH       = -I/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++-opengl -I. -I/targets/FREMANTLE_X86/usr/include/qt4/QtCore -I/targets/FREMANTLE_X86/usr/include/qt4/QtGui -I/targets/FREMANTLE_X86/usr/include/qt4/QtXml -I/targets/FREMANTLE_X86/usr/include/qt4 -Imoc
 LINK          = g++
-LFLAGS        = -Wl,-rpath,/opt/qtsdk-2009.01/qt/lib
-LIBS          = $(SUBLIBS)  -L/opt/qtsdk-2009.01/qt/lib -lQtXml -L/opt/qtsdk-2009.01/qt/lib -pthread -pthread -lQtGui -L/usr/X11R6/lib -pthread -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
+LFLAGS        = 
+LIBS          = $(SUBLIBS)  -L/usr/lib -Wl,-rpath-link=/usr/lib -lQtXml -lQtGui -lQtCore -lpthread
 AR            = ar cqs
 RANLIB        = 
-QMAKE         = /opt/qtsdk-2009.01/qt/bin/qmake
+QMAKE         = /usr/bin/qmake
 TAR           = tar -cf
 COMPRESS      = gzip -9f
 COPY          = cp -f
@@ -79,24 +79,24 @@ OBJECTS       = obj/main.o \
                obj/moc_table-model.o \
                obj/moc_tree-model.o \
                obj/moc_tree-widget.o
-DIST          = /opt/qtsdk-2009.01/qt/mkspecs/common/g++.conf \
-               /opt/qtsdk-2009.01/qt/mkspecs/common/unix.conf \
-               /opt/qtsdk-2009.01/qt/mkspecs/common/linux.conf \
-               /opt/qtsdk-2009.01/qt/mkspecs/qconfig.pri \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_functions.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_config.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/exclusive_builds.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/default_pre.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/debug.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/default_post.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/qt.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/unix/thread.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/moc.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/warn_on.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/resources.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/uic.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/yacc.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/lex.prf \
+DIST          = /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/debug.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
                scorecard.pro
 QMAKE_TARGET  = scorecard
 DESTDIR       = bin/
@@ -130,49 +130,49 @@ $(TARGET):  $(OBJECTS)
        @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ 
        $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
-Makefile: scorecard.pro  /opt/qtsdk-2009.01/qt/mkspecs/linux-g++/qmake.conf /opt/qtsdk-2009.01/qt/mkspecs/common/g++.conf \
-               /opt/qtsdk-2009.01/qt/mkspecs/common/unix.conf \
-               /opt/qtsdk-2009.01/qt/mkspecs/common/linux.conf \
-               /opt/qtsdk-2009.01/qt/mkspecs/qconfig.pri \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_functions.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_config.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/exclusive_builds.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/default_pre.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/debug.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/default_post.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/qt.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/unix/thread.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/moc.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/warn_on.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/resources.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/uic.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/yacc.prf \
-               /opt/qtsdk-2009.01/qt/mkspecs/features/lex.prf \
-               /opt/qtsdk-2009.01/qt/lib/libQtXml.prl \
-               /opt/qtsdk-2009.01/qt/lib/libQtCore.prl \
-               /opt/qtsdk-2009.01/qt/lib/libQtGui.prl
+Makefile: scorecard.pro  /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++-opengl/qmake.conf /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/debug.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf \
+               /targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf \
+               /usr/lib/libQtXml.prl \
+               /usr/lib/libQtGui.prl \
+               /usr/lib/libQtCore.prl
        $(QMAKE) -unix -o Makefile scorecard.pro
-/opt/qtsdk-2009.01/qt/mkspecs/common/g++.conf:
-/opt/qtsdk-2009.01/qt/mkspecs/common/unix.conf:
-/opt/qtsdk-2009.01/qt/mkspecs/common/linux.conf:
-/opt/qtsdk-2009.01/qt/mkspecs/qconfig.pri:
-/opt/qtsdk-2009.01/qt/mkspecs/features/qt_functions.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/qt_config.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/exclusive_builds.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/default_pre.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/debug.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/default_post.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/qt.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/unix/thread.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/moc.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/warn_on.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/resources.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/uic.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/yacc.prf:
-/opt/qtsdk-2009.01/qt/mkspecs/features/lex.prf:
-/opt/qtsdk-2009.01/qt/lib/libQtXml.prl:
-/opt/qtsdk-2009.01/qt/lib/libQtCore.prl:
-/opt/qtsdk-2009.01/qt/lib/libQtGui.prl:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/g++.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/unix.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/common/linux.conf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/qconfig.pri:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt_config.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_pre.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/debug.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/default_post.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/qt.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/moc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/warn_on.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/resources.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/uic.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/yacc.prf:
+/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/lib/libQtXml.prl:
+/usr/lib/libQtGui.prl:
+/usr/lib/libQtCore.prl:
 qmake:  FORCE
        @$(QMAKE) -unix -o Makefile scorecard.pro
 
@@ -205,29 +205,29 @@ moc/moc_main-window.cpp: src/data.h \
                src/tree-model.h \
                src/tree-item.h \
                src/main-window.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/main-window.h -o moc/moc_main-window.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/main-window.h -o moc/moc_main-window.cpp
 
 moc/moc_score-dialog.cpp: src/data.h \
                src/score-dialog.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/score-dialog.h -o moc/moc_score-dialog.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/score-dialog.h -o moc/moc_score-dialog.cpp
 
 moc/moc_course-dialog.cpp: src/course-dialog.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/course-dialog.h -o moc/moc_course-dialog.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/course-dialog.h -o moc/moc_course-dialog.cpp
 
 moc/moc_cell-delegate.cpp: src/cell-delegate.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/cell-delegate.h -o moc/moc_cell-delegate.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/cell-delegate.h -o moc/moc_cell-delegate.cpp
 
 moc/moc_table-model.cpp: src/data.h \
                src/table-model.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/table-model.h -o moc/moc_table-model.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/table-model.h -o moc/moc_table-model.cpp
 
 moc/moc_tree-model.cpp: src/tree-item.h \
                src/data.h \
                src/tree-model.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/tree-model.h -o moc/moc_tree-model.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/tree-model.h -o moc/moc_tree-model.cpp
 
 moc/moc_tree-widget.cpp: src/tree-widget.h
-       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) src/tree-widget.h -o moc/moc_tree-widget.cpp
+       /usr/bin/moc $(DEFINES) $(INCPATH) src/tree-widget.h -o moc/moc_tree-widget.cpp
 
 compiler_rcc_make_all:
 compiler_rcc_clean:
index 12a6cfd..8403b89 100644 (file)
   <hole num="17" shots="5" />
   <hole num="18" shots="5" />
  </score>
+ <score club="x" course="hcp-values" date="2009-10-13" >
+  <hole num="1" shots="6" />
+  <hole num="2" shots="6" />
+  <hole num="3" shots="6" />
+  <hole num="4" shots="6" />
+  <hole num="5" shots="6" />
+  <hole num="6" shots="6" />
+  <hole num="7" shots="6" />
+  <hole num="8" shots="6" />
+  <hole num="9" shots="6" />
+  <hole num="10" shots="5" />
+  <hole num="11" shots="5" />
+  <hole num="12" shots="5" />
+  <hole num="13" shots="5" />
+  <hole num="14" shots="5" />
+  <hole num="15" shots="5" />
+  <hole num="16" shots="5" />
+  <hole num="17" shots="5" />
+  <hole num="18" shots="5" />
+ </score>
+ <score club="x" course="z" date="2009-10-13" >
+  <hole num="1" shots="3" />
+  <hole num="2" shots="3" />
+  <hole num="3" shots="3" />
+  <hole num="4" shots="3" />
+  <hole num="5" shots="3" />
+  <hole num="6" shots="3" />
+  <hole num="7" shots="3" />
+  <hole num="8" shots="3" />
+  <hole num="9" shots="3" />
+  <hole num="10" shots="4" />
+  <hole num="11" shots="4" />
+  <hole num="12" shots="4" />
+  <hole num="13" shots="4" />
+  <hole num="14" shots="4" />
+  <hole num="15" shots="4" />
+  <hole num="16" shots="4" />
+  <hole num="17" shots="4" />
+  <hole num="18" shots="4" />
+ </score>
 </data>
index 463718c..2ea1d05 100644 (file)
@@ -13,7 +13,7 @@ CourseSelectDialog::CourseSelectDialog(QWidget *parent) : QDialog(parent)
   QWidget *centralWidget = new QWidget(this);
   createLayout(centralWidget);
 
-  setWindowTitle(tr("ScoreCard: New Club and/or Course"));
+  setWindowTitle(tr("ScoreCard: New Club and Course"));
 }
 
 void CourseSelectDialog::createLayout(QWidget *parent)
@@ -48,9 +48,24 @@ void CourseSelectDialog::results(QString &club,
   course = lineEditCourse->text();
 }
 
+bool CourseSelectDialog::validate(void)
+{
+  QString str1 = lineEditClub->text();
+  QString str2 = lineEditCourse->text();
+
+  if (str1.isEmpty() || str2.isEmpty())
+    return false;
+  
+  return true;
+}
+
 void CourseSelectDialog::next(void)
 {
-  done(1);
+  if (validate())
+    done(1);
+  else {
+    qDebug() << "CourseDialog: invalid data, cancel or correct";
+  }
 }
 
 CourseDialog::CourseDialog(QWidget *parent) : QDialog(parent)
@@ -61,17 +76,16 @@ CourseDialog::CourseDialog(QWidget *parent) : QDialog(parent)
   createLabel();
 
   createLayout(this);
-
 }
 
 void CourseDialog::createLayout(QWidget *parent)
 {
-  leftLayout = new QVBoxLayout;
+  leftLayout = new QVBoxLayout(parent);
   leftLayout->addWidget(table);
 
-  rightLayout = new QVBoxLayout;
+  rightLayout = new QVBoxLayout(parent);
   rightLayout->addStretch();
-  rightLayout->addWidget(pushButtonFinnish);
+  rightLayout->addWidget(pushButtonFinish);
 
   QHBoxLayout *mainLayout = new QHBoxLayout(parent);
   mainLayout->addLayout(leftLayout);
@@ -87,16 +101,16 @@ void CourseDialog::createLabel(QWidget *parent)
   clubEdit = new QLineEdit;
   courseEdit = new QLineEdit;
 
-  pushButtonFinnish = new QPushButton(tr("Finnish"));
-  connect(pushButtonFinnish, SIGNAL(clicked()), this, SLOT(finnish()));
+  pushButtonFinish = new QPushButton(tr("Finish"));
+  connect(pushButtonFinish, SIGNAL(clicked()), this, SLOT(finish()));
 }
 
 void CourseDialog::createTable(QWidget *parent)
 {
-  table = new QTableWidget(rows, cols);
+  table = new QTableWidget(rows, cols, parent);
 
   QStringList headers;
-  headers << "Hole" << "Par" << "HCP" << "Len" << "Hole" << "Par" << "HCP" << "Len";
+  headers << "" << "Par" << "HCP" << "Len" << "" << "Par" << "HCP" << "Len";
   table->setVerticalHeaderLabels(headers);
   table->horizontalHeader()->hide();
 
@@ -133,44 +147,6 @@ void CourseDialog::createTable(QWidget *parent)
       table->setItem(7, i-9, len);
     }
   }
-
-  //connect(table, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(itemChanged(QTableWidgetItem *)));
-
-}
-
-void CourseDialog::itemChanged(QTableWidgetItem *item)
-{
-  qDebug() << "itemChanged";
-
-  int row = table->currentRow();
-  int col = table->currentColumn();
-
-  col++;
-  if (col == cols) {
-    col = 0;
-    row++;
-    if (row == separator_row)
-      row++;
-  }
-  table->setCurrentCell(row, col);
-}
-
-void CourseDialog::nextCell(QObject *obj)
-{
-#if 0
-  int row = table->currentRow();
-  int col = table->currentColumn();
-  QTableWidgetItem *item = table->item(row, col);
-
-  qDebug() << "next Cell " << obj;
-  qDebug() << "item " << item << "row=" << row << " col=" << col;
-
-  table->setItem(row, col, item);
-
-
-  table->currentIndex();
-  table->setCurrentCell(2,2);
-#endif
 }
 
 void CourseDialog::results(QVector<QString> &par,
@@ -219,7 +195,7 @@ bool CourseDialog::validate(void)
   return true;
 }
 
-void CourseDialog::finnish(void)
+void CourseDialog::finish(void)
 {
   if (validate())
     done(1);
index 343e34b..92e3980 100644 (file)
@@ -29,6 +29,7 @@ private slots:
  private:
 
   void createLayout(QWidget *parent);
+  bool validate(void);
 
   QLineEdit    *lineEditClub;
   QLineEdit    *lineEditCourse;
@@ -51,9 +52,7 @@ class CourseDialog: public QDialog
   bool validate();
 
  public slots:
-  void itemChanged(QTableWidgetItem *item);
-  void nextCell(QObject *);
-  void finnish(void);
+  void finish(void);
 
  private:
   enum { ROW_HOLE = 0, ROW_PAR = 1, ROW_HCP = 2, ROW_LEN = 3, 
@@ -65,13 +64,12 @@ class CourseDialog: public QDialog
   void createLayout(QWidget *parent = 0);
 
   // Widgets
-  //ScoreTable *table;
   QTableWidget *table;
   QLabel *clubLabel;
   QLabel *courseLabel;
   QLineEdit *clubEdit;
   QLineEdit *courseEdit;
-  QPushButton *pushButtonFinnish;
+  QPushButton *pushButtonFinish;
 
   // Layouts
   QVBoxLayout *rightLayout;
index a9f7cf3..3f59c10 100644 (file)
@@ -282,11 +282,10 @@ void MainWindow::newScore()
     QString date;
 
     selectDialog->results(clubName, courseName, date);
-    qDebug() << "club=" << clubName;
-    qDebug() << "course=" << courseName;
-    qDebug() << "date=" << date;
 
     ScoreDialog *scoreDialog = new ScoreDialog(this);
+    QString title = "New Score : " + courseName + ", " + date;
+    scoreDialog->setWindowTitle(title);
 
     Club *club = findClub(clubName);
     if (!club) {
index 589f61a..64eb517 100644 (file)
@@ -8,15 +8,14 @@ SelectDialog::SelectDialog(QWidget *parent) : QDialog(parent)
   QWidget *centralWidget = new QWidget(this);
   createLayout(centralWidget);
 
-  setWindowTitle(tr("ScoreCard: Select Club, Course and Date"));
+  setWindowTitle(tr("ScoreCard: Select Course and Date"));
 }
 
 void SelectDialog::createLayout(QWidget *parent)
 {
   labelClub = new QLabel(tr("Club"));
   labelCourse = new QLabel(tr("Course"));
-  comboBoxClub = new QComboBox;
-  comboBoxCourse = new QComboBox;
+  listClub = new QListWidget(parent);
   lineEditDate = new QLineEdit;
   pushButtonNext = new QPushButton(tr("Next"));
 
@@ -24,12 +23,9 @@ void SelectDialog::createLayout(QWidget *parent)
   lineEditDate->setText(today.toString("yyyy-MM-dd"));
 
   connect(pushButtonNext, SIGNAL(clicked()), this, SLOT(next()));
-  connect(comboBoxClub, SIGNAL(activated(int)), this, SLOT(comboBoxClubChanged()));
-  connect(comboBoxCourse, SIGNAL(activated(int)), this, SLOT(comboBoxCourseChanged()));
 
   leftLayout = new QVBoxLayout;
-  leftLayout->addWidget(comboBoxClub);
-  leftLayout->addWidget(comboBoxCourse);
+  leftLayout->addWidget(listClub);
   leftLayout->addWidget(lineEditDate);
 
   rightLayout = new QVBoxLayout;
@@ -52,47 +48,41 @@ void SelectDialog::init(QList<Club *> &list)
 
   while (i.hasNext()) {
     Club *club = i.next();
-    comboBoxClub->insertItem(index, club->getName());
-    index++;
+
+    QList<Course *> courseList = club->getCourseList();
+
+    QListIterator<Course *> j(courseList);
+    while (j.hasNext()) {
+      Course *course = j.next();
+
+      QListWidgetItem *newItem = new QListWidgetItem;
+
+      QString entry = club->getName() + "," + course->getName();
+
+      newItem->setText(entry);
+      listClub->insertItem(index, newItem);
+
+      index++;
+    }
   }
-  comboBoxCourseUpdate();
 }
 
 void SelectDialog::results(QString &club, 
                           QString &course, 
                           QString &date)
 {  
-  club   = comboBoxClub->currentText();
-  course = comboBoxCourse->currentText();
-  date   = lineEditDate->text();
-}
-
-void SelectDialog::comboBoxCourseUpdate()
-{
-  int index = comboBoxClub->currentIndex();
+  QListWidgetItem *current = listClub->currentItem();
 
-  Club *club = clubList[index];
-  QList<Course *> courseList = club->getCourseList();
+  if (current) {
+    QString tmp = current->text();
 
-  comboBoxCourse->clear();
-  QListIterator<Course *> i(courseList);
-  index = 0;
-  while (i.hasNext()) {
-    Course *course = i.next();
-    comboBoxCourse->insertItem(index, course->getName());
-    index++;
+    QStringList stringList = tmp.split(",");
+    club = stringList[0];
+    course = stringList[1];
+    date   = lineEditDate->text();
   }
 }
 
-void SelectDialog::comboBoxClubChanged()
-{
-  comboBoxCourseUpdate();
-}
-
-void SelectDialog::comboBoxCourseChanged()
-{
-}
-
 bool SelectDialog::validate(void)
 {
   return true;
@@ -126,8 +116,6 @@ ScoreDialog::ScoreDialog(QWidget *parent) : QDialog(parent)
   createButton();
 
   createLayout(centralWidget);
-
-  setWindowTitle(tr("ScoreCard: New Score"));
 }
 
 void ScoreDialog::createLayout(QWidget *parent)
@@ -140,7 +128,7 @@ void ScoreDialog::createLayout(QWidget *parent)
   rightLayout->addWidget(pushButtonDown);
   rightLayout->addWidget(pushButtonNext);
   rightLayout->addStretch();
-  rightLayout->addWidget(pushButtonFinnish);
+  rightLayout->addWidget(pushButtonFinish);
 
   QHBoxLayout *mainLayout = new QHBoxLayout(parent);
   mainLayout->addLayout(leftLayout);
@@ -167,8 +155,8 @@ void ScoreDialog::createTable(QWidget *parent)
 
 void ScoreDialog::createButton(QWidget *parent)
 {
-  pushButtonFinnish = new QPushButton(tr("Finnish"));
-  connect(pushButtonFinnish, SIGNAL(clicked()), this, SLOT(finnish()));
+  pushButtonFinish = new QPushButton(tr("Finish"));
+  connect(pushButtonFinish, SIGNAL(clicked()), this, SLOT(finish()));
 
   pushButtonUp = new QPushButton(tr("+"));
   connect(pushButtonUp, SIGNAL(clicked()), this, SLOT(up()));
@@ -335,7 +323,7 @@ bool ScoreDialog::validate(void)
   return true;
 }
 
-void ScoreDialog::finnish(void)
+void ScoreDialog::finish(void)
 {
   if (validate())
     done(1);
index 0b9b748..3d7a2eb 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <QDialog>
 #include <QTableWidget>
+#include <QListWidget>
 #include <QComboBox>
 #include <QLabel>
 #include <QPushButton>
@@ -21,8 +22,6 @@ class SelectDialog: public QDialog
   void init(QList<Club *> &list);
 
 private slots:
-  void comboBoxClubChanged();
-  void comboBoxCourseChanged();
   void next(void);
 
  private:
@@ -33,14 +32,11 @@ private slots:
   void comboBoxCourseUpdate(void);
   void createLayout(QWidget *parent = 0);
 
-  QComboBox    *comboBoxClub;
-  QComboBox    *comboBoxCourse;
-
+  // Widgets
+  QListWidget  *listClub;
   QLineEdit    *lineEditDate;
-
   QLabel       *labelClub;
   QLabel       *labelCourse;
-
   QPushButton  *pushButtonNext;
 
   // Layouts
@@ -63,7 +59,7 @@ public:
 private slots:
   void itemChanged(QTableWidgetItem *item);
   void moveToNextCell(QTableWidgetItem *item);
-  void finnish(void);
+  void finish(void);
   void up(void);
   void down(void);
   void next(void);
@@ -84,7 +80,7 @@ private:
   // Widgets
   QTableWidget *table;
 
-  QPushButton  *pushButtonFinnish;
+  QPushButton  *pushButtonFinish;
   QPushButton  *pushButtonUp;
   QPushButton  *pushButtonDown;
   QPushButton  *pushButtonNext;