1 /**************************************************************************
5 Copyright (c) Arto Hyvättinen 2010
7 This file is part of Chess Clock software.
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 **************************************************************************/
22 #include "clockswidget.h"
23 #include "chessclock.h"
24 #include "welcomescreenwidget.h"
28 #include <QApplication>
29 #include <QHBoxLayout>
30 #include <QVBoxLayout>
34 ClocksWidget::ClocksWidget(QWidget *parent) :
41 // Make layout for clocks
42 QHBoxLayout* clockLayout_ = new QHBoxLayout;
44 // Pause information label
45 pauseLabel_ = new QLabel( tr("<font color=yellow>Paused. Touch to continue.</font>"));
46 pauseLabel_->setFont( QFont("Helvetica",25));
47 pauseLabel_->setAlignment( Qt::AlignCenter);
48 pauseLabel_->setVisible( false );
50 // Welcome label for first touch
51 welcomeLabel_ = new QLabel( tr("<font color=yellow>Welcome! Please touch to start game.<br>"
52 "Then touch to end turn.</font>"));
53 welcomeLabel_->setFont( QFont("Helvetica",25));
54 welcomeLabel_->setAlignment( Qt::AlignCenter);
55 welcomeLabel_->setVisible( false );
57 // Welcome screen if no clocks set
58 welcomeScreen_ = new WelcomeScreenWidget(this);
61 QVBoxLayout* mainLayout = new QVBoxLayout;
62 mainLayout->addLayout(clockLayout_);
63 mainLayout->addWidget(pauseLabel_);
64 mainLayout->addWidget(welcomeLabel_);
65 mainLayout->addWidget(welcomeScreen_);
67 setLayout( mainLayout);
73 void ClocksWidget::setClocks(ChessClock *white, ChessClock *black)
78 clockLayout_->removeWidget( white_ );
83 clockLayout_->removeWidget( black_ );
91 clockLayout_->addWidget(white_);
92 clockLayout_->addWidget( black_ );
95 white_->repaintClock();
96 black_->repaintClock();
98 // Welcome status for first touch
99 welcomeLabel_->setVisible(true);
105 int const ClocksWidget::CLICKDELAY;