Promoted to 1.0.0
[chessclock] / chessclockwindow.cpp
index c1715f1..45a21b4 100644 (file)
@@ -39,6 +39,7 @@
 #include <QMenuBar>
 #include <QMessageBox>
 #include <QStackedWidget>
+#include <QProcess>
 
 ChessClockWindow::ChessClockWindow(QWidget *parent)
     : QMainWindow(parent)
@@ -63,6 +64,9 @@ ChessClockWindow::ChessClockWindow(QWidget *parent)
     // Set up menu
     menuBar()->addAction( tr("Pause"), this, SLOT(pause()));
     menuBar()->addAction( tr("New game"), this, SLOT(newGame()));
+    menuBar()->addAction( tr("Visit web page"), this, SLOT(visitWeb()));
+    menuBar()->addAction( tr("About"),this, SLOT(about()));
+    menuBar()->addAction(tr("About Qt"), this, SLOT(aboutQt()));
 
 }
 
@@ -89,6 +93,30 @@ void ChessClockWindow::newGame()
     }
 }
 
+void ChessClockWindow::visitWeb()
+{
+    QProcess* process = new QProcess(this);
+    process->start(QString("browser --url=chessclock.garage.maemo.org"));
+}
+
+void ChessClockWindow::about()
+{
+    pause();
+    QMessageBox::about(this, tr("About ChessClock"),
+                       tr("<h1>Chess Clock %1</h1>"
+                          "&copy;Arto Hyv&auml;ttinen 2010"
+                          "<p>Chess Clock is free software under the terms of GNU General Public License 3"
+                          "<p>Bugtracker and instructions at <a>checkclock.garage.maemo.org</a>"
+                          ).arg(qApp->applicationVersion())) ;
+}
+
+void ChessClockWindow::aboutQt()
+{
+    pause();
+    qApp->aboutQt();
+}
+
+
 void ChessClockWindow::initTimeControls()
 {
     start_->addTimeControl( new NoTimeControl );
@@ -104,11 +132,7 @@ void ChessClockWindow::startGame(TimeControl *timecontrol)
     ClocksWidget* newWidget = timecontrol->initGame(false);
     if( newWidget )
     {
-        if( clocks_ )
-        {
-            stack_->removeWidget(clocks_);
-            delete clocks_;
-        }
+
         clocks_ = newWidget;
         stack_->addWidget(clocks_);
         stack_->setCurrentWidget(clocks_);