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 "delayaftertimecontrol.h" 00023 #include "delayafterclock.h" 00024 #include "../clockswidget.h" 00025 #include "basicdialog.h" 00026 00027 #include <QApplication> 00028 00029 DelayAfterTimeControl::DelayAfterTimeControl() 00030 { 00031 } 00032 00033 QString DelayAfterTimeControl::getName() 00034 { 00035 return qApp->translate("Delay after","Delay after"); 00036 } 00037 00038 QString DelayAfterTimeControl::getDescription() 00039 { 00040 return qApp->translate("Delay","Time up to special increment is added after turn"); 00041 } 00042 00043 ClocksWidget* DelayAfterTimeControl::initGame(bool useLastSettings) 00044 { 00045 BasicDialog dialog(getName()); 00046 dialog.disablePerTurns(); 00047 dialog.init(); 00048 00049 if( useLastSettings || dialog.exec() == QDialog::Accepted) 00050 { 00051 dialog.store(); 00052 DelayAfterClock* white = new DelayAfterClock( true, dialog.getWhiteAddition()); 00053 white->setTimeAvailable(dialog.getWhiteInitial()); 00054 00055 DelayAfterClock* black = new DelayAfterClock( false, dialog.getBlackAddition()); 00056 black->setTimeAvailable( dialog.getBlackInitial()); 00057 00058 return( new ClocksWidget(white,black)); 00059 00060 } 00061 else 00062 return 0; 00063 }