Added toolbar but not in use yet since widget seems to be not ready
authorSakari Poussa <sakari.poussa@nokia.com>
Tue, 27 Oct 2009 21:27:01 +0000 (23:27 +0200)
committerSakari Poussa <sakari.poussa@nokia.com>
Tue, 27 Oct 2009 21:27:01 +0000 (23:27 +0200)
TODO
scorecard.pro
src/main-window.cpp
src/main-window.h

diff --git a/TODO b/TODO
index dd34367..6ab9d04 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,7 @@
+TOP
+- If no data files, the hole numbers are missing from main-window
+- Disable selection from the main-window
+
 TODO General:
 - Statistics view (BIG)
 - Delete score
@@ -7,7 +11,6 @@ TODO General:
   - Seems to be bug in the Qt/Maemo
 - Date picker button (widget is missing)
 - Use syslog
-- If no data files, the hole numbers are missing from main-window
 
 TODO Hildon 2.2
 - Replace LineEdit w/ HildonEntry
index ee9ab08..93d67df 100644 (file)
@@ -10,6 +10,8 @@ CONFIG  += qt debug
 TEMPLATE = app
 QT      += xml
 
+#RESOURCES = scorecard.qrc
+
 HEADERS  = \
 src/main-window.h \
 src/score-dialog.h \
index e54f1fd..750b600 100644 (file)
@@ -44,14 +44,15 @@ MainWindow::MainWindow(QMainWindow *parent): QMainWindow(parent)
   // Sort the scores based on dates
   qSort(scoreList.begin(), scoreList.end(), dateLessThan); 
 
+  createActions();
+  createMenus();
+
   createTableView(scoreList, clubList);
   //createTreeView(scoreList, parent);
   createStatusBar();
 
   createLayout(centralWidget);
 
-  createActions();
-  createMenus();
 }
 
 void MainWindow::loadSettings(void)
@@ -86,6 +87,7 @@ void MainWindow::loadSettings(void)
 
 void MainWindow::createLayout(QWidget *parent)
 {
+
   buttonLayout = new QVBoxLayout;
   //labelLayout->addStretch();
   buttonLayout->addWidget(nextButton);
@@ -172,6 +174,15 @@ void MainWindow::updateTreeView(const QModelIndex & index)
 
 void MainWindow::createStatusBar()
 {
+#if 0
+  // TODO: use toolbar or buttons. Toolbar seems not to be ready and
+  // requires more work.
+  toolbar = addToolBar(tr("foo"));
+  toolbar->addAction(firstAct);
+  toolbar->addAction(lastAct);
+  toolbar->addAction(prevAct);
+  toolbar->addAction(nextAct);
+#endif
   updateStatusBar();
 }
 
@@ -199,6 +210,18 @@ void MainWindow::createActions()
   viewStatisticAct = new QAction(tr("&View Statistics"), this);
   connect(viewStatisticAct, SIGNAL(triggered()), this, SLOT(viewStatistic()));
 #endif
+
+  nextAct = new QAction(tr( "   Next   "), this);
+  connect(nextAct, SIGNAL(triggered()), this, SLOT(nextButtonClicked()));
+
+  prevAct = new QAction("   Prev   ", this);
+  connect(prevAct, SIGNAL(triggered()), this, SLOT(prevButtonClicked()));
+
+  firstAct = new QAction(tr("   First  "), this);
+  connect(firstAct, SIGNAL(triggered()), this, SLOT(firstButtonClicked()));
+
+  lastAct = new QAction(tr( "   Last   "), this);
+  connect(lastAct, SIGNAL(triggered()), this, SLOT(lastButtonClicked()));
 }
 
 void MainWindow::createMenus()
index 3013222..7ba48c3 100644 (file)
@@ -1,6 +1,7 @@
 #include <QMainWindow>
 #include <QTableView>
 #include <QPushButton>
+#include <QToolBar>
 #include <QVBoxLayout>
 #include <QItemSelectionModel>
 #include <QList>
@@ -71,11 +72,18 @@ private:
   QPushButton *firstButton;
   QPushButton *lastButton;
 
+  // Toolbar
+  QToolBar *toolbar;
+
   // Actions
   QAction *newScoreAct;
   QAction *editScoreAct;
   QAction *newCourseAct;
   QAction *editCourseAct;
+  QAction *firstAct;
+  QAction *lastAct;
+  QAction *nextAct;
+  QAction *prevAct;
 
   QAction *viewScoreAct;
   QAction *viewCourseAct;