File indexing completed on 2024-04-28 04:03:11

0001 /*
0002     This file is part of Knights, a chess board for KDE SC 4.
0003     SPDX-FileCopyrightText: 2009, 2010, 2011 Miha Čančula <miha@noughmad.eu>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef KNIGHTS_CLOCKWIDGET_H
0009 #define KNIGHTS_CLOCKWIDGET_H
0010 
0011 #include "core/piece.h"
0012 
0013 #include <QWidget>
0014 
0015 class QTime;
0016 
0017 namespace Ui {
0018 class ClockWidget;
0019 }
0020 
0021 namespace Knights {
0022 class ClockWidget : public QWidget {
0023     Q_OBJECT
0024 public:
0025     explicit ClockWidget ( QWidget* parent = nullptr, Qt::WindowFlags f = {} );
0026     ~ClockWidget () override;
0027 
0028 public Q_SLOTS:
0029     void setTimeLimit ( Color color, const QTime& time );
0030     void setDisplayedPlayer ( Color color );
0031     void setPlayerName ( Color color, const QString& name );
0032     void setCurrentTime ( Color color, const QTime& time );
0033 
0034 private:
0035     Ui::ClockWidget* ui;
0036     Color m_activePlayer;
0037     QMap<Color, QTime> m_timeLimit;
0038     QMap<Color, QTime> m_currentTime;
0039 
0040     void updateTimeFormat();
0041     QString m_timeFormat;
0042 };
0043 }
0044 
0045 #endif // KNIGHTS_CLOCKWIDGET_H