Initial stat view attempt
[scorecard] / src / main-window.cpp
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);