1 /**************************************************************************
5 This file is part of Chess Clock software.
7 (This file) Copyright (c) Heli Hyvättinen 2011
9 Chess Clock is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Chess Clock is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
20 **************************************************************************/
23 #include "wrappedclockswidget.h"
24 #include "classes/timecontrol/hourglassclock.h"
25 #include "classes/timecontrol/delayclock.h"
29 WrappedClocksWidget::WrappedClocksWidget(QObject *parent) :
30 QGraphicsProxyWidget()
32 pClocksWidget_ = NULL;
37 void WrappedClocksWidget::startGame(QString timeControl, int whiteInitialTime, int whiteAdditionalTime, int whiteTurnsPerAddition, int blackInitialTime, int blackAdditionalTime, int blackTurnsPerAddition)
40 qDebug() << whiteInitialTime << "white initial time";
44 pWhiteClock_ = new DelayClock (true,whiteAdditionalTime);
45 pWhiteClock_->setTimeAvailable(whiteInitialTime);
47 pBlackClock_ = new DelayClock (false,blackAdditionalTime);
48 pBlackClock_->setTimeAvailable(blackInitialTime);
50 pClocksWidget_ = new ClocksWidget(pWhiteClock_, pBlackClock_);
53 pClocksWidget_->setAttribute(Qt::WA_NoSystemBackground);
54 setWidget(pClocksWidget_);
59 WrappedClocksWidget::~WrappedClocksWidget()
64 bool WrappedClocksWidget::isPlayStarted()
69 return pClocksWidget_->isPlayStarted();
72 void WrappedClocksWidget::deleteOldWidgets()
76 delete pClocksWidget_;
77 pClocksWidget_ = NULL;
93 void WrappedClocksWidget::pause()
96 pClocksWidget_->pause();
99 void WrappedClocksWidget::stopPlay()
102 pClocksWidget_->stopPlay();
105 void WrappedClocksWidget::saveScreen()
108 pClocksWidget_->saveScreen();