X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;ds=inline;f=www%2Fhtml%2Fchessclockwindow_8cpp_source.html;fp=www%2Fhtml%2Fchessclockwindow_8cpp_source.html;h=e47d27de417be0f96d2049ffd9e46d946148c1f3;hb=152fa893f072373a21c125340ce9072a73503a54;hp=6f5344e8f57cd14028515b2fff93c217ce70d7d4;hpb=8e60d556e00dbb7e86f2425605cf1b0a688a69e9;p=chessclock diff --git a/www/html/chessclockwindow_8cpp_source.html b/www/html/chessclockwindow_8cpp_source.html index 6f5344e..e47d27d 100644 --- a/www/html/chessclockwindow_8cpp_source.html +++ b/www/html/chessclockwindow_8cpp_source.html @@ -83,87 +83,115 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 00039 #include <QMenuBar> 00040 #include <QMessageBox> 00041 #include <QStackedWidget> -00042 -00043 ChessClockWindow::ChessClockWindow(QWidget *parent) -00044 : QMainWindow(parent) -00045 { -00046 -00047 setWindowIcon( QIcon(":/rc/pic/chessclock.png")); -00048 setWindowTitle( QString("%1 %2").arg(qApp->applicationName()).arg(qApp->applicationVersion()) ); -00049 -00050 // Start widget to select time control -00051 start_ = new StartWidget; -00052 clocks_ = 0; -00053 -00054 initTimeControls(); +00042 #include <QProcess> +00043 +00044 +00045 ChessClockWindow::ChessClockWindow(QWidget *parent) +00046 : QMainWindow(parent) +00047 { +00048 +00049 setWindowIcon( QIcon(":/rc/pic/chessclock.png")); +00050 setWindowTitle( QString("%1 %2").arg(qApp->applicationName()).arg(qApp->applicationVersion()) ); +00051 +00052 // Start widget to select time control +00053 start_ = new StartWidget; +00054 clocks_ = 0; 00055 -00056 stack_ = new QStackedWidget; -00057 stack_->addWidget(start_); -00058 -00059 setCentralWidget( stack_ ); +00056 initTimeControls(); +00057 +00058 stack_ = new QStackedWidget; +00059 stack_->addWidget(start_); 00060 -00061 connect( start_, SIGNAL(selected(TimeControl*)), this, SLOT(startGame(TimeControl*))); +00061 setCentralWidget( stack_ ); 00062 -00063 // Set up menu -00064 menuBar()->addAction( tr("Pause"), this, SLOT(pause())); -00065 menuBar()->addAction( tr("New game"), this, SLOT(newGame())); -00066 -00067 } -00068 -00069 void ChessClockWindow::pause() -00070 { -00071 if( clocks_ ) -00072 clocks_->pause(); -00073 } -00074 -00075 void ChessClockWindow::newGame() -00076 { -00077 pause(); -00078 if( clocks_ == 0 || !clocks_->isPlayStarted() || QMessageBox::question(this, tr("Start new game"), -00079 tr("Really quit current game and start new one with current settings?"), -00080 QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) -00081 { -00082 stack_->setCurrentWidget(start_); -00083 -00084 if( clocks_ ) -00085 { stack_->removeWidget(clocks_); -00086 delete clocks_; -00087 } -00088 clocks_=0; -00089 } -00090 } -00091 -00092 void ChessClockWindow::initTimeControls() -00093 { -00094 start_->addTimeControl( new NoTimeControl ); -00095 start_->addTimeControl( new FischerTimeControl); -00096 start_->addTimeControl( new FischerAfterTimeControl); -00097 start_->addTimeControl( new DelayTimeControl ); -00098 start_->addTimeControl( new DelayAfterTimeControl); -00099 start_->addTimeControl( new HourGlassTimeControl); -00100 } -00101 -00102 void ChessClockWindow::startGame(TimeControl *timecontrol) -00103 { -00104 ClocksWidget* newWidget = timecontrol->initGame(false); -00105 if( newWidget ) -00106 { -00107 if( clocks_ ) -00108 { -00109 stack_->removeWidget(clocks_); -00110 delete clocks_; -00111 } -00112 clocks_ = newWidget; -00113 stack_->addWidget(clocks_); -00114 stack_->setCurrentWidget(clocks_); -00115 } -00116 } -00117 -00118 -00119 ChessClockWindow::~ChessClockWindow() -00120 { -00121 -00122 } +00063 connect( start_, SIGNAL(selected(TimeControl*)), this, SLOT(startGame(TimeControl*))); +00064 +00065 +00066 // Set up menu +00067 // menuBar()->addAction( tr("Pause"), this, SLOT(pause())); // UNUSED - Pause button +00068 menuBar()->addAction( tr("New game"), this, SLOT(newGame())); +00069 +00070 menuBar()->addAction( tr("Visit web page"), this, SLOT(visitWeb())); +00071 menuBar()->addAction( tr("About"),this, SLOT(about())); +00072 menuBar()->addAction(tr("About Qt"), this, SLOT(aboutQt())); +00073 +00074 } +00075 +00076 void ChessClockWindow::pause() +00077 { +00078 if( clocks_ ) +00079 clocks_->pause(); +00080 } +00081 +00082 void ChessClockWindow::newGame() +00083 { +00084 pause(); +00085 if( clocks_ == 0 || !clocks_->isPlayStarted() || QMessageBox::question(this, tr("Start new game"), +00086 tr("Really quit the current game and start a new one?"), +00087 QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) +00088 { +00089 stack_->setCurrentWidget(start_); +00090 +00091 if( clocks_ ) +00092 { stack_->removeWidget(clocks_); +00093 delete clocks_; +00094 } +00095 clocks_=0; +00096 } +00097 } +00098 +00099 void ChessClockWindow::visitWeb() +00100 { +00101 pause(); +00102 QProcess* process = new QProcess(this); +00103 process->start(QString("browser --url=chessclock.garage.maemo.org")); +00104 } +00105 +00106 void ChessClockWindow::about() +00107 { +00108 pause(); +00109 QMessageBox::about(this, tr("About ChessClock"), +00110 tr("<h1>Chess Clock %1</h1>" +00111 "&copy;Arto Hyv&auml;ttinen 2010" +00112 "<p>Chess Clock is free software under the terms of GNU General Public License 3" +00113 "<p>Bugtracker and instructions at <a>http://chessclock.garage.maemo.org</a>" +00114 ).arg(qApp->applicationVersion())) ; +00115 } +00116 +00117 void ChessClockWindow::aboutQt() +00118 { +00119 pause(); +00120 qApp->aboutQt(); +00121 } +00122 +00123 +00124 void ChessClockWindow::initTimeControls() +00125 { +00126 start_->addTimeControl( new NoTimeControl ); +00127 start_->addTimeControl( new FischerTimeControl); +00128 start_->addTimeControl( new FischerAfterTimeControl); +00129 start_->addTimeControl( new DelayTimeControl ); +00130 start_->addTimeControl( new DelayAfterTimeControl); +00131 start_->addTimeControl( new HourGlassTimeControl); +00132 } +00133 +00134 void ChessClockWindow::startGame(TimeControl *timecontrol) +00135 { +00136 ClocksWidget* newWidget = timecontrol->initGame(false); +00137 if( newWidget ) +00138 { +00139 +00140 clocks_ = newWidget; +00141 stack_->addWidget(clocks_); +00142 stack_->setCurrentWidget(clocks_); +00143 } +00144 } +00145 +00146 +00147 ChessClockWindow::~ChessClockWindow() +00148 { +00149 +00150 }
-
Generated on Thu Aug 19 21:04:20 2010 for Chess Clock by  +
Generated on Mon Sep 27 18:30:33 2010 for Chess Clock by  doxygen 1.6.3