Initial stat view attempt
authorSakari Poussa <spoussa@gmail.com>
Tue, 3 Nov 2009 23:35:32 +0000 (01:35 +0200)
committerSakari Poussa <spoussa@gmail.com>
Fri, 13 Nov 2009 21:05:16 +0000 (23:05 +0200)
src/main-window.cpp
src/main-window.h

index e81997a..1fa5527 100644 (file)
@@ -32,7 +32,7 @@ MainWindow::MainWindow(QMainWindow *parent): QMainWindow(parent)
 
   loadSettings();
 
-  QWidget *centralWidget = new QWidget(this);
+  centralWidget = new QWidget(this);
 
   setCentralWidget(centralWidget);
 
@@ -170,11 +170,11 @@ void MainWindow::createActions()
 
   viewCourseAct = new QAction(tr("&View Courses"), this);
   connect(viewCourseAct, SIGNAL(triggered()), this, SLOT(viewCourse()));
-
-  viewStatisticAct = new QAction(tr("&View Statistics"), this);
-  connect(viewStatisticAct, SIGNAL(triggered()), this, SLOT(viewStatistic()));
 #endif
 
+  statAct = new QAction(tr("Statistics"), this);
+  connect(statAct, SIGNAL(triggered()), this, SLOT(viewStatistics()));
+
   nextAct = new QAction(tr( "   Next   "), this);
   connect(nextAct, SIGNAL(triggered()), this, SLOT(nextButtonClicked()));
 
@@ -200,6 +200,7 @@ void MainWindow::createMenus()
   menu->addAction(newCourseAct);
   menu->addAction(editScoreAct);
   menu->addAction(editCourseAct);
+  menu->addAction(statAct);
 }
 
 void MainWindow::updateStatusBar()
@@ -413,6 +414,41 @@ void MainWindow::editScore()
   }
 }
 
+void MainWindow::viewStatistics()
+{
+  QMainWindow *statWindow = new QMainWindow(this);
+
+  //QWidget *centralWidget = new QWidget(statWindow);
+
+  //setCentralWidget(centralWidget);
+
+
+  QString foo = "some longer text is needed here : 17";
+  QTextEdit *textEdit = new QTextEdit(foo);
+  
+  QLabel *label = new QLabel;
+  label->setScaledContents(true);
+
+  QString text = "foo : bar";
+
+  text.append("Scores: 17");
+
+  label->setAlignment(Qt::AlignCenter);
+  label->setText(text);
+
+  QString title = "Statistics";
+  statWindow->setWindowTitle(title);
+
+  QVBoxLayout *layout = new QVBoxLayout;
+  //layout->addWidget(label);
+  layout->addWidget(textEdit);
+
+  //statWindow->setLayout(layout);
+
+  //setCentralWidget(statWindow);
+  statWindow->show();
+}
+
 void MainWindow::loadScoreFile(QString &fileName, QList<Score *> &list)
 {
   ScoreXmlHandler handler(list);
index abcaef7..753a131 100644 (file)
@@ -39,6 +39,7 @@ private slots:
   void editScore();
   void newCourse();
   void editCourse();
+  void viewStatistics();
 
 private:
 
@@ -58,6 +59,7 @@ private:
   // Layouts
   QVBoxLayout *tableLayout;
   QVBoxLayout *buttonLayout;
+  QWidget *centralWidget;
 
   // Menus
   QMenu *menu;
@@ -76,6 +78,7 @@ private:
   QAction *editScoreAct;
   QAction *newCourseAct;
   QAction *editCourseAct;
+  QAction *statAct;
   QAction *firstAct;
   QAction *lastAct;
   QAction *nextAct;
@@ -83,7 +86,6 @@ private:
 
   QAction *viewScoreAct;
   QAction *viewCourseAct;
-  QAction *viewStatisticAct;
 
   void createMenus();
   void createActions();