00001 /************************************************************************** 00002 00003 Chess Clock 00004 00005 Copyright (c) Arto Hyvättinen 2010 00006 00007 This file is part of Chess Clock software. 00008 00009 Chess Clock is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 Chess Clock is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 00020 **************************************************************************/ 00021 00022 #include "fischeraftertimecontrol.h" 00023 #include "fischerafterclock.h" 00024 #include "../clockswidget.h" 00025 #include "basicdialog.h" 00026 00027 00028 FischerAfterTimeControl::FischerAfterTimeControl() 00029 { 00030 } 00031 00032 QString FischerAfterTimeControl::getDescription() 00033 { 00034 return qApp->translate("FischerAfter","Specified time increment is added to clock after turn."); 00035 } 00036 00037 QIcon FischerAfterTimeControl::getIcon() 00038 { 00039 return QIcon(":/rc/pic/addafter.png"); 00040 } 00041 00042 ClocksWidget* FischerAfterTimeControl::initGame(bool useLastSettings) 00043 { 00044 BasicDialog dialog(getName()); 00045 dialog.init(); 00046 00047 if( useLastSettings || dialog.exec() == QDialog::Accepted) 00048 { 00049 dialog.store(); 00050 FischerAfterClock* white = new FischerAfterClock( true, dialog.getWhiteAddition(), dialog.getWhitePerTurns()); 00051 white->setTimeAvailable(dialog.getWhiteInitial()); 00052 00053 FischerAfterClock* black = new FischerAfterClock( false, dialog.getBlackAddition(), dialog.getBlackPerTurns()); 00054 black->setTimeAvailable( dialog.getBlackInitial()); 00055 00056 return( new ClocksWidget(white,black)); 00057 00058 } 00059 else 00060 return 0; 00061 }