From b6aa2f04f114c499f406480feb75fae78cd5ae67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Wed, 31 Aug 2011 18:48:08 +0300 Subject: [PATCH] Removed unused C++ files These were replaced by QML --- chessclock.pro | 20 +- chessclockwindow.cpp | 174 ------------------ chessclockwindow.h | 67 ------- classes/startwidget.cpp | 92 ---------- classes/startwidget.h | 57 ------ classes/timecontrol/basicdialog.cpp | 222 ----------------------- classes/timecontrol/basicdialog.h | 99 ---------- classes/timecontrol/delayaftertimecontrol.cpp | 68 ------- classes/timecontrol/delayaftertimecontrol.h | 38 ---- classes/timecontrol/delaytimecontrol.cpp | 70 ------- classes/timecontrol/delaytimecontrol.h | 38 ---- classes/timecontrol/fischeraftertimecontrol.cpp | 61 ------- classes/timecontrol/fischeraftertimecontrol.h | 40 ---- classes/timecontrol/fischertimecontrol.cpp | 63 ------- classes/timecontrol/fischertimecontrol.h | 39 ---- classes/timecontrol/hourglasstimecontrol.cpp | 70 ------- classes/timecontrol/hourglasstimecontrol.h | 38 ---- classes/timecontrol/notimecontrol.cpp | 67 ------- classes/welcomescreenwidget.cpp | 49 ----- classes/welcomescreenwidget.h | 46 ----- 20 files changed, 1 insertion(+), 1417 deletions(-) delete mode 100644 chessclockwindow.cpp delete mode 100644 chessclockwindow.h delete mode 100644 classes/startwidget.cpp delete mode 100644 classes/startwidget.h delete mode 100644 classes/timecontrol/basicdialog.cpp delete mode 100644 classes/timecontrol/basicdialog.h delete mode 100644 classes/timecontrol/delayaftertimecontrol.cpp delete mode 100644 classes/timecontrol/delayaftertimecontrol.h delete mode 100644 classes/timecontrol/delaytimecontrol.cpp delete mode 100644 classes/timecontrol/delaytimecontrol.h delete mode 100644 classes/timecontrol/fischeraftertimecontrol.cpp delete mode 100644 classes/timecontrol/fischeraftertimecontrol.h delete mode 100644 classes/timecontrol/fischertimecontrol.cpp delete mode 100644 classes/timecontrol/fischertimecontrol.h delete mode 100644 classes/timecontrol/hourglasstimecontrol.cpp delete mode 100644 classes/timecontrol/hourglasstimecontrol.h delete mode 100644 classes/timecontrol/notimecontrol.cpp delete mode 100644 classes/welcomescreenwidget.cpp delete mode 100644 classes/welcomescreenwidget.h diff --git a/chessclock.pro b/chessclock.pro index 8e413a6..45c9718 100644 --- a/chessclock.pro +++ b/chessclock.pro @@ -25,48 +25,30 @@ MOBILITY += systeminfo # The .cpp file which was generated for your project. Feel free to hack it. SOURCES += main.cpp \ - chessclockwindow.cpp \ classes/turninformation.cpp \ classes/chessclock.cpp \ classes/chessclockwidget.cpp \ classes/clockswidget.cpp \ - classes/welcomescreenwidget.cpp \ - classes/timecontrol/basicdialog.cpp \ - classes/timecontrol/notimecontrol.cpp \ - classes/startwidget.cpp \ - classes/timecontrol/fischertimecontrol.cpp \ classes/timecontrol/fischerclock.cpp \ classes/timecontrol/fischerafterclock.cpp \ - classes/timecontrol/fischeraftertimecontrol.cpp \ classes/timecontrol/delayclock.cpp \ - classes/timecontrol/delaytimecontrol.cpp \ classes/timecontrol/delayafterclock.cpp \ - classes/timecontrol/delayaftertimecontrol.cpp \ classes/timecontrol/hourglassclock.cpp \ - classes/timecontrol/hourglasstimecontrol.cpp \ classes/screenlitkeeper.cpp \ classes/wrappedclockswidget.cpp \ chessclockview.cpp -HEADERS += chessclockwindow.h \ +HEADERS += \ classes/turninformation.h \ classes/chessclock.h \ classes/chessclockwidget.h \ classes/clockswidget.h \ - classes/welcomescreenwidget.h \ classes/timecontrol.h \ - classes/timecontrol/basicdialog.h \ classes/timecontrol/notimecontrol.h \ - classes/startwidget.h \ - classes/timecontrol/fischertimecontrol.h \ classes/timecontrol/fischerclock.h \ classes/timecontrol/fischerafterclock.h \ - classes/timecontrol/fischeraftertimecontrol.h \ classes/timecontrol/delayclock.h \ - classes/timecontrol/delaytimecontrol.h \ classes/timecontrol/delayafterclock.h \ - classes/timecontrol/delayaftertimecontrol.h \ - classes/timecontrol/hourglasstimecontrol.h \ classes/timecontrol/hourglassclock.h \ classes/screenlitkeeper.h \ classes/wrappedclockswidget.h \ diff --git a/chessclockwindow.cpp b/chessclockwindow.cpp deleted file mode 100644 index ab903b7..0000000 --- a/chessclockwindow.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "chessclockwindow.h" - -#include "classes/clockswidget.h" -#include "classes/chessclockwidget.h" -#include "classes/startwidget.h" -#include "classes/timecontrol.h" -#include "classes/turninformation.h" - -// Time controls -#include "classes/timecontrol/notimecontrol.h" -#include "classes/timecontrol/fischertimecontrol.h" -#include "classes/timecontrol/fischeraftertimecontrol.h" -#include "classes/timecontrol/delaytimecontrol.h" -#include "classes/timecontrol/delayaftertimecontrol.h" -#include "classes/timecontrol/hourglasstimecontrol.h" - -#include -#include -#include -#include -#include -#include - - -ChessClockWindow::ChessClockWindow(QWidget *parent) - : QMainWindow(parent) -{ - - showFullScreen(); - - setWindowIcon( QIcon(":/rc/pic/chessclock.png")); - setWindowTitle( QString("%1 %2").arg(qApp->applicationName()).arg(qApp->applicationVersion()) ); - - // Start widget to select time control - start_ = new StartWidget; - clocks_ = 0; - - initTimeControls(); - - stack_ = new QStackedWidget; - stack_->addWidget(start_); - - setCentralWidget( stack_ ); - - connect( start_, SIGNAL(selected(TimeControl*)), this, SLOT(startGame(TimeControl*))); - - - // Set up menu -// menuBar()->addAction( tr("Pause"), this, SLOT(pause())); // UNUSED - Pause button - menuBar()->addAction( tr("New game"), this, SLOT(newGame())); - - menuBar()->addAction( tr("Visit web page"), this, SLOT(visitWeb())); - menuBar()->addAction( tr("About"),this, SLOT(about())); - menuBar()->addAction(tr("About Qt"), this, SLOT(aboutQt())); - - //set the event filter to grap window deactivate - - installEventFilter(this); - -} - -void ChessClockWindow::pause() -{ - if( clocks_ ) - clocks_->pause(); -} - -void ChessClockWindow::newGame() -{ - pause(); - if( clocks_ == 0 || !clocks_->isPlayStarted() || QMessageBox::question(this, tr("Start new game"), - tr("Really quit the current game and start a new one?"), - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - { - stack_->setCurrentWidget(start_); - - if( clocks_ ) - { stack_->removeWidget(clocks_); - delete clocks_; - } - clocks_=0; - } -} - -void ChessClockWindow::visitWeb() -{ - pause(); - QProcess* process = new QProcess(this); - process->start(QString("browser --url=chessclock.garage.maemo.org")); -} - -void ChessClockWindow::about() -{ - pause(); - QMessageBox::about(this, tr("About ChessClock"), - tr("

Chess Clock %1

" - "©Arto Hyvättinen 2010" - "

Chess Clock is free software under the terms of GNU General Public License 3" - "

Bugtracker and instructions at http://chessclock.garage.maemo.org" - ).arg(qApp->applicationVersion())) ; -} - -void ChessClockWindow::aboutQt() -{ - pause(); - qApp->aboutQt(); -} - - -void ChessClockWindow::initTimeControls() -{ - start_->addTimeControl( new NoTimeControl ); - start_->addTimeControl( new FischerTimeControl); - start_->addTimeControl( new FischerAfterTimeControl); - start_->addTimeControl( new DelayTimeControl ); - start_->addTimeControl( new DelayAfterTimeControl); - start_->addTimeControl( new HourGlassTimeControl); -} - -void ChessClockWindow::startGame(TimeControl *timecontrol) -{ - ClocksWidget* newWidget = timecontrol->initGame(false); - if( newWidget ) - { - - clocks_ = newWidget; - stack_->addWidget(clocks_); - stack_->setCurrentWidget(clocks_); - connect( clocks_, SIGNAL(TurnFinished(TurnInformation*)), this, SLOT(dontEatMemory(TurnInformation*))); - } -} - - -ChessClockWindow::~ChessClockWindow() -{ - -} - -bool ChessClockWindow::eventFilter(QObject *obj, QEvent *event) -{ - if (event->type() == QEvent::WindowDeactivate) { - pause(); - return QObject::eventFilter(obj,event); - } else { - // standard event processing - return QObject::eventFilter(obj, event); - } -} - -void ChessClockWindow::dontEatMemory(TurnInformation *turnInformation) -{ - delete turnInformation; // hopefully don't cause Segematation Fault -} diff --git a/chessclockwindow.h b/chessclockwindow.h deleted file mode 100644 index 752f909..0000000 --- a/chessclockwindow.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef CHESSCLOCKWINDOW_H -#define CHESSCLOCKWINDOW_H - -#include - -class ClocksWidget; -class StartWidget; -class TimeControl; -class QStackedWidget; -class TurnInformation; - -class ChessClockWindow : public QMainWindow -{ - Q_OBJECT - -public: - ChessClockWindow(QWidget *parent = 0); - ~ChessClockWindow(); - -public slots: - void startGame( TimeControl* timecontrol); - void pause(); - void newGame(); - /*! Visit ChessClock web page */ - void visitWeb(); - void about(); - void aboutQt(); - /*! Delete turn information to avoid memory leaks - - @todo Save turn log and function to show it. - @since 1.1.2 */ - void dontEatMemory(TurnInformation* turnInformation); - - -protected: - void initTimeControls(); - /*! Pauses the game if the application main window is not active e.g. the app is minimized*/ - bool eventFilter(QObject *obj, QEvent *event); - -protected: - ClocksWidget* clocks_; - StartWidget* start_; - QStackedWidget* stack_; -}; - -#endif // CHESSCLOCKWINDOW_H diff --git a/classes/startwidget.cpp b/classes/startwidget.cpp deleted file mode 100644 index 3c4b258..0000000 --- a/classes/startwidget.cpp +++ /dev/null @@ -1,92 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "startwidget.h" -#include "timecontrol.h" - -#include -#include -#include -#include -#include -#include - -StartWidget::StartWidget(QWidget *parent) : - QWidget(parent) -{ - QLabel* titleLabel = new QLabel( qApp->applicationName() ); - titleLabel->setFont(QFont("Helvetica",32,QFont::Bold)); - - QLabel* copyLabel = new QLabel( tr("© Arto Hyvättinen 2010
Free software GPL3")); - copyLabel->setTextFormat(Qt::RichText); - copyLabel->setWordWrap(true); - - QLabel* logoLabel = new QLabel; - logoLabel->setPixmap( QPixmap(":/rc/pic/logo.png")); - - QLabel* introLabel = new QLabel( tr("Select game mode →")); - introLabel->setWordWrap(true); - - QVBoxLayout* leftLayout = new QVBoxLayout; - leftLayout->addWidget(titleLabel); - leftLayout->addWidget(introLabel); - leftLayout->addWidget(logoLabel); - leftLayout->addWidget(copyLabel); - - modeSelect_ = new QListWidget(); - modeSelect_->setViewMode(QListView::ListMode); - modeSelect_->setMovement(QListView::Static); - modeSelect_->setSelectionMode(QAbstractItemView::NoSelection); - modeSelect_->setIconSize(QSize(40,40 )); - - connect( modeSelect_, SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(selectControl(QListWidgetItem*))); - -// QVBoxLayout* rightLayout = new QVBoxLayout; -// rightLayout->addWidget(introLabel); -// rightLayout->addWidget(modeSelect_); - - QHBoxLayout* layout = new QHBoxLayout; - layout->addLayout(leftLayout); - layout->addWidget(modeSelect_); - - - setLayout( layout ); -} - -void StartWidget::addTimeControl(TimeControl *tc) -{ - timeControls_.append(tc); - QListWidgetItem* item = new QListWidgetItem(modeSelect_); - item->setText( tc->getName()); - item->setIcon( tc->getIcon()); - // Store index to UserRole - item->setData(Qt::UserRole, timeControls_.size()-1); - -} - -void StartWidget::selectControl(QListWidgetItem *item) -{ - int index=item->data(Qt::UserRole).toInt(); - TimeControl* tc=timeControls_.at(index); - emit selected(tc); - -} - diff --git a/classes/startwidget.h b/classes/startwidget.h deleted file mode 100644 index f3660f3..0000000 --- a/classes/startwidget.h +++ /dev/null @@ -1,57 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef STARTWIDGET_H -#define STARTWIDGET_H - -#include -#include - - -class QListWidget; -class TimeControl; - -/*! Start widget to ask for Time control - - @author Arto Hyvättinen - @date 2010-08-16 - - Time Controls are stored inside Start Widget */ -class StartWidget : public QWidget -{ - Q_OBJECT -public: - StartWidget(QWidget *parent = 0); - void addTimeControl( TimeControl* tc); - -signals: - void selected(TimeControl* timeControl); - -public slots: - void selectControl(QListWidgetItem* item); - -protected: - QListWidget* modeSelect_; - QList timeControls_; - -}; - -#endif // STARTWIDGET_H diff --git a/classes/timecontrol/basicdialog.cpp b/classes/timecontrol/basicdialog.cpp deleted file mode 100644 index 01914dc..0000000 --- a/classes/timecontrol/basicdialog.cpp +++ /dev/null @@ -1,222 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "basicdialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -BasicDialog::BasicDialog(QString timeControlName, QWidget *parent) : - QDialog(parent) -{ - timeControlName_ = timeControlName; - - // Initial times - initialLabel_ = new QLabel( tr("Initial time")); - whiteInitial_ = initTimeEdit(); - blackInitial_ = initTimeEdit(); - // Additional times - additionLabel_ = new QLabel( tr("Additional time")); - whiteAddition_ = initTimeEdit(); - blackAddition_ = initTimeEdit(); - // Turns per addition - perTurnLabel_ = new QLabel( tr("Turns per addition")); - whiteTurns_=new QSpinBox; - whiteTurns_->setRange(1,99); - - blackTurns_=new QSpinBox; - blackTurns_->setRange(1,99); - - // Equal times - equals_ = new QCheckBox( tr("Equal times")); - - connect( equals_, SIGNAL(stateChanged(int)),this,SLOT(setEquals())); - - equals_->setChecked(true); - setEquals(); - - whiteLabel_ = new QLabel; - whiteLabel_->setPixmap(QPixmap(":/rc/pic/white_small.png")); - blackLabel_ = new QLabel; - blackLabel_->setPixmap(QPixmap(":/rc/pic/black_small.png")); - - // Lay out - QGridLayout* layout = new QGridLayout; - layout->addWidget(equals_,0,0); - layout->addWidget(whiteLabel_,0,1,1,1,Qt::AlignCenter); - layout->addWidget(blackLabel_,0,2,1,1,Qt::AlignCenter); - - layout->addWidget(initialLabel_,1,0); - layout->addWidget(whiteInitial_,1,1); - layout->addWidget(blackInitial_,1,2); - - layout->addWidget(additionLabel_,2,0); - layout->addWidget(whiteAddition_,2,1); - layout->addWidget(blackAddition_,2,2); - - layout->addWidget(perTurnLabel_,3,0); - layout->addWidget(whiteTurns_,3,1); - layout->addWidget(blackTurns_,3,2); - - QPushButton* button = new QPushButton( tr("Start game")); - connect( button, SIGNAL(clicked()), this, SLOT(accept())); - layout->addWidget(button,4,2); - - setLayout( layout ); - setWindowTitle( timeControlName_); - -} - -void BasicDialog::setEquals() -{ - blackInitial_->setDisabled( equals_->isChecked()); - blackAddition_->setDisabled( equals_->isChecked()); - blackTurns_->setDisabled( equals_->isChecked()); - -} - - -void BasicDialog::disablePerTurns() -{ - perTurnLabel_->setVisible(false); - whiteTurns_->setVisible(false); - blackTurns_->setVisible(false); -} - -void BasicDialog::disableAddition() -{ - disablePerTurns(); - whiteAddition_->setVisible(false); - blackAddition_->setVisible(false); - additionLabel_->setVisible(false); -} - -void BasicDialog::disableUnEquals() -{ - equals_->setChecked(true); - equals_->setVisible(false); - whiteLabel_->setVisible(false); - blackLabel_->setVisible(false); - blackInitial_->setVisible(false); - blackAddition_->setVisible(false); - blackTurns_->setVisible(false); -} - -void BasicDialog::store() -{ - // Store into QSettings - QSettings s; - s.beginGroup(timeControlName_); - s.setValue("Equals",equals_->isChecked()); - s.setValue("WhiteInitial",whiteInitial_->time()); - s.setValue("WhiteAddition",whiteAddition_->time()); - s.setValue("WhitePerTurns",whiteTurns_->value()); - - s.setValue("BlackInitial",blackInitial_->time()); - s.setValue("BlackAddition",blackAddition_->time()); - s.setValue("BlackPerTurns",blackTurns_->value()); -} - -void BasicDialog::init(QTime whiteInitial, QTime blackInitial, QTime whiteAddition, QTime blackAddition, int whitePerTurns, int blackPerTurns) -{ - // Load from QSettings - // first time use defaults - QSettings s; - s.beginGroup(timeControlName_); - - equals_->setChecked(s.value("Equals",true).toBool() ); - setEquals(); - whiteInitial_->setTime( s.value("WhiteInitial",whiteInitial).toTime()); - blackInitial_->setTime(s.value("BlackInitial",blackInitial).toTime()); - whiteAddition_->setTime(s.value("WhiteAddition",whiteAddition).toTime()); - blackAddition_->setTime(s.value("BlackAddition",blackAddition).toTime()); - whiteTurns_->setValue(s.value("WhitePerTurns",whitePerTurns).toInt()); - blackTurns_->setValue(s.value("BlackPerTurns",blackPerTurns).toInt()); - -} - -int BasicDialog::getWhiteInitial() -{ - return toMsecs( whiteInitial_); -} - -int BasicDialog::getWhiteAddition() -{ - return toMsecs( whiteAddition_); -} - -int BasicDialog::getWhitePerTurns() -{ - return whiteTurns_->value(); -} - -int BasicDialog::getBlackInitial() -{ - // if Equals is checked, black values are disabled - // and white values returned. - if( equals_->isChecked()) - return toMsecs( whiteInitial_); - else - return toMsecs( blackInitial_); -} - -int BasicDialog::getBlackAddition() -{ - if( equals_->isChecked()) - return toMsecs( whiteAddition_); - else - return toMsecs( blackAddition_ ); - -} - -int BasicDialog::getBlackPerTurns() -{ - if( equals_->isChecked()) - return whiteTurns_->value(); - else - return blackTurns_->value(); -} - - -int BasicDialog::toMsecs(QTimeEdit *timeEdit) -{ - QTime qtime=timeEdit->time(); - int msecs=qtime.msecsTo(QTime(0,0,0));; - return 0-msecs; -} - - -QTimeEdit* BasicDialog::initTimeEdit() -{ - // Make QTimeEdit and set up range and display format - QTimeEdit* timeEdit = new QTimeEdit; - timeEdit->setMinimumTime( QTime(0,0,0)); - timeEdit->setMaximumTime( QTime(12,0,0)); - timeEdit->setDisplayFormat( tr("hh:mm:ss","Time Edit display format")); - return timeEdit; -} diff --git a/classes/timecontrol/basicdialog.h b/classes/timecontrol/basicdialog.h deleted file mode 100644 index 8343a71..0000000 --- a/classes/timecontrol/basicdialog.h +++ /dev/null @@ -1,99 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef BASICDIALOG_H -#define BASICDIALOG_H - -#include -#include -#include - -class QTimeEdit; -class QSpinBox; -class QCheckBox; -class QLabel; - -/*! Basic dialog for Time Control settings - - @author Arto Hyvättinen - @date 2010-08-16 - - Basic dialog setting up clock. - Time control can use this dialog. - Using disableAddition(), disablePerTurns() or disableUnEquals() - it is possible to customize dialog. - - All the widgets are public for customization. - */ - -class BasicDialog : public QDialog -{ - Q_OBJECT -public: - /*! Constructor - - @param timeControlName Name of time controller, will be window title */ - BasicDialog(QString timeContolName, QWidget *parent = 0); - - void disableAddition(); - void disablePerTurns(); - void disableUnEquals(); - - int getWhiteInitial(); - int getBlackInitial(); - int getWhiteAddition(); - int getBlackAddition(); - int getWhitePerTurns(); - int getBlackPerTurns(); - /*! Store values to settings */ - void store(); - /*! Load values from settings, or init to initial values */ - void init(QTime whiteInitial=QTime(1,30), - QTime blackInitial=QTime(1,30), - QTime whiteAddition=QTime(0,0,30), - QTime blackAddition=QTime(0,0,30), - int whitePerTurns = 1, - int blackPerTurns = 1); -signals: - -public slots: - void setEquals(); - -protected: - static QTimeEdit* initTimeEdit(); - static int toMsecs(QTimeEdit* timeEdit); - -public: - QTimeEdit *whiteInitial_, *blackInitial_; - QTimeEdit *whiteAddition_, *blackAddition_; - QSpinBox *whiteTurns_, *blackTurns_; - QCheckBox *equals_; - - QLabel *initialLabel_, *additionLabel_, *perTurnLabel_, *equalsLabel_; - QLabel *whiteLabel_, *blackLabel_; - -protected: - QString timeControlName_; - - -}; - -#endif // BASICDIALOG_H diff --git a/classes/timecontrol/delayaftertimecontrol.cpp b/classes/timecontrol/delayaftertimecontrol.cpp deleted file mode 100644 index 599db43..0000000 --- a/classes/timecontrol/delayaftertimecontrol.cpp +++ /dev/null @@ -1,68 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "delayaftertimecontrol.h" -#include "delayafterclock.h" -#include "../clockswidget.h" -#include "basicdialog.h" - -#include - -DelayAfterTimeControl::DelayAfterTimeControl() -{ -} - -QString DelayAfterTimeControl::getName() -{ - return qApp->translate("Delay after","Delay after"); -} - -QString DelayAfterTimeControl::getDescription() -{ - return qApp->translate("Delay","Time up to special increment is added after turn"); -} - -QIcon DelayAfterTimeControl::getIcon() -{ - return QIcon(":/rc/pic/pauseafter.png"); -} - -ClocksWidget* DelayAfterTimeControl::initGame(bool useLastSettings) -{ - BasicDialog dialog(getName()); - dialog.disablePerTurns(); - dialog.init(); - - if( useLastSettings || dialog.exec() == QDialog::Accepted) - { - dialog.store(); - DelayAfterClock* white = new DelayAfterClock( true, dialog.getWhiteAddition()); - white->setTimeAvailable(dialog.getWhiteInitial()); - - DelayAfterClock* black = new DelayAfterClock( false, dialog.getBlackAddition()); - black->setTimeAvailable( dialog.getBlackInitial()); - - return( new ClocksWidget(white,black)); - - } - else - return 0; -} diff --git a/classes/timecontrol/delayaftertimecontrol.h b/classes/timecontrol/delayaftertimecontrol.h deleted file mode 100644 index 623c745..0000000 --- a/classes/timecontrol/delayaftertimecontrol.h +++ /dev/null @@ -1,38 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef DELAYAFTERTIMECONTROL_H -#define DELAYAFTERTIMECONTROL_H - -#include "../timecontrol.h" - -class DelayAfterTimeControl : public TimeControl -{ -public: - DelayAfterTimeControl(); - - QString getName(); - QIcon getIcon(); - QString getDescription(); - ClocksWidget* initGame(bool useLastSettings); -}; - -#endif // DELAYAFTERTIMECONTROL_H diff --git a/classes/timecontrol/delaytimecontrol.cpp b/classes/timecontrol/delaytimecontrol.cpp deleted file mode 100644 index dfe085f..0000000 --- a/classes/timecontrol/delaytimecontrol.cpp +++ /dev/null @@ -1,70 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "delaytimecontrol.h" -#include "delayclock.h" -#include "../clockswidget.h" -#include "basicdialog.h" - -#include -#include - -DelayTimeControl::DelayTimeControl() -{ -} - -QString DelayTimeControl::getName() -{ - return qApp->translate("Delay","Delay"); -} - -QIcon DelayTimeControl::getIcon() -{ - return QIcon(":/rc/pic/pausebefore.png"); -} - -QString DelayTimeControl::getDescription() -{ - return qApp->translate("Delay","The clock waits for the delay period before starting"); -} - -ClocksWidget* DelayTimeControl::initGame(bool useLastSettings) -{ - BasicDialog dialog(getName()); - dialog.disablePerTurns(); - dialog.additionLabel_->setText(qApp->translate("Delay","Delay time")); - dialog.init(); - - if( useLastSettings || dialog.exec() == QDialog::Accepted) - { - dialog.store(); - DelayClock* white = new DelayClock( true, dialog.getWhiteAddition()); - white->setTimeAvailable(dialog.getWhiteInitial()); - - DelayClock* black = new DelayClock( false, dialog.getBlackAddition()); - black->setTimeAvailable( dialog.getBlackInitial()); - - return( new ClocksWidget(white,black)); - - } - else - return 0; -} diff --git a/classes/timecontrol/delaytimecontrol.h b/classes/timecontrol/delaytimecontrol.h deleted file mode 100644 index 36d9f30..0000000 --- a/classes/timecontrol/delaytimecontrol.h +++ /dev/null @@ -1,38 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef DELAYTIMECONTROL_H -#define DELAYTIMECONTROL_H - -#include "../timecontrol.h" - -class DelayTimeControl : public TimeControl -{ -public: - DelayTimeControl(); - - QString getName(); - QIcon getIcon(); - QString getDescription(); - ClocksWidget* initGame(bool useLastSettings); -}; - -#endif // DELAYTIMECONTROL_H diff --git a/classes/timecontrol/fischeraftertimecontrol.cpp b/classes/timecontrol/fischeraftertimecontrol.cpp deleted file mode 100644 index 832fa5d..0000000 --- a/classes/timecontrol/fischeraftertimecontrol.cpp +++ /dev/null @@ -1,61 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "fischeraftertimecontrol.h" -#include "fischerafterclock.h" -#include "../clockswidget.h" -#include "basicdialog.h" - - -FischerAfterTimeControl::FischerAfterTimeControl() -{ -} - -QString FischerAfterTimeControl::getDescription() -{ - return qApp->translate("FischerAfter","Specified time increment is added to clock after turn."); -} - -QIcon FischerAfterTimeControl::getIcon() -{ - return QIcon(":/rc/pic/addafter.png"); -} - -ClocksWidget* FischerAfterTimeControl::initGame(bool useLastSettings) -{ - BasicDialog dialog(getName()); - dialog.init(); - - if( useLastSettings || dialog.exec() == QDialog::Accepted) - { - dialog.store(); - FischerAfterClock* white = new FischerAfterClock( true, dialog.getWhiteAddition(), dialog.getWhitePerTurns()); - white->setTimeAvailable(dialog.getWhiteInitial()); - - FischerAfterClock* black = new FischerAfterClock( false, dialog.getBlackAddition(), dialog.getBlackPerTurns()); - black->setTimeAvailable( dialog.getBlackInitial()); - - return( new ClocksWidget(white,black)); - - } - else - return 0; -} diff --git a/classes/timecontrol/fischeraftertimecontrol.h b/classes/timecontrol/fischeraftertimecontrol.h deleted file mode 100644 index a040fcc..0000000 --- a/classes/timecontrol/fischeraftertimecontrol.h +++ /dev/null @@ -1,40 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef FISCHERAFTERTIMECONTROL_H -#define FISCHERAFTERTIMECONTROL_H - -#include "../timecontrol.h" -#include - -class FischerAfterTimeControl : public TimeControl -{ -public: - FischerAfterTimeControl(); - - QString getName() { return qApp->translate("FischerAfter","Addition after"); } - QString getDescription(); - QIcon getIcon(); - ClocksWidget* initGame( bool useLastSettings); - -}; - -#endif // FISCHERAFTERTIMECONTROL_H diff --git a/classes/timecontrol/fischertimecontrol.cpp b/classes/timecontrol/fischertimecontrol.cpp deleted file mode 100644 index c085116..0000000 --- a/classes/timecontrol/fischertimecontrol.cpp +++ /dev/null @@ -1,63 +0,0 @@ - /**************************************************************************; - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "fischertimecontrol.h" -#include "fischerclock.h" -#include "../clockswidget.h" -#include "basicdialog.h" - -#include - - -FischerTimeControl::FischerTimeControl() -{ -} - -QString FischerTimeControl::getDescription() -{ - return qApp->translate("Fischer","Specified time increment is added to clock before turn."); -} - -QIcon FischerTimeControl::getIcon() -{ - return QIcon(":/rc/pic/addbefore.png"); -} - -ClocksWidget* FischerTimeControl::initGame(bool useLastSettings) -{ - BasicDialog dialog(getName()); - dialog.init(); - - if( useLastSettings || dialog.exec() == QDialog::Accepted) - { - dialog.store(); - FischerClock* white = new FischerClock( true, dialog.getWhiteAddition(), dialog.getWhitePerTurns()); - white->setTimeAvailable(dialog.getWhiteInitial()); - - FischerClock* black = new FischerClock( false, dialog.getBlackAddition(), dialog.getBlackPerTurns()); - black->setTimeAvailable( dialog.getBlackInitial()); - - return( new ClocksWidget(white,black)); - - } - else - return 0; -} diff --git a/classes/timecontrol/fischertimecontrol.h b/classes/timecontrol/fischertimecontrol.h deleted file mode 100644 index 9c467cc..0000000 --- a/classes/timecontrol/fischertimecontrol.h +++ /dev/null @@ -1,39 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef FISCHERTIMECONTROL_H -#define FISCHERTIMECONTROL_H - -#include "../timecontrol.h" -#include - -class FischerTimeControl : public TimeControl -{ -public: - FischerTimeControl(); - - QString getName() { return qApp->translate("Fischer","Addition before"); } - QString getDescription(); - QIcon getIcon(); - ClocksWidget* initGame(bool useLastSettings); -}; - -#endif // FISCHERTIMECONTROL_H diff --git a/classes/timecontrol/hourglasstimecontrol.cpp b/classes/timecontrol/hourglasstimecontrol.cpp deleted file mode 100644 index d352558..0000000 --- a/classes/timecontrol/hourglasstimecontrol.cpp +++ /dev/null @@ -1,70 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "hourglasstimecontrol.h" -#include "hourglassclock.h" -#include "../clockswidget.h" -#include "basicdialog.h" - -#include -#include - -HourGlassTimeControl::HourGlassTimeControl() -{ -} - - -QString HourGlassTimeControl::getName() -{ - return qApp->translate("Hour Glass","Hour Glass"); -} - -QIcon HourGlassTimeControl::getIcon() -{ - return QIcon(":/rc/pic/hourglass.png"); -} - -QString HourGlassTimeControl::getDescription() -{ - return qApp->translate("Hour Glass","Time added to clock is substracted to another"); -} - -ClocksWidget* HourGlassTimeControl::initGame(bool useLastSettings) -{ - BasicDialog dialog(getName()); - dialog.disableAddition(); - dialog.init(QTime(0,0,30),QTime(0,0,30)); - - if( useLastSettings || dialog.exec() == QDialog::Accepted) - { - dialog.store(); - HourGlassClock* white = new HourGlassClock( true); - white->setTimeAvailable(dialog.getWhiteInitial()); - - HourGlassClock* black = new HourGlassClock( false); - black->setTimeAvailable( dialog.getBlackInitial()); - - return( new ClocksWidget(white,black)); - - } - else - return 0; -} diff --git a/classes/timecontrol/hourglasstimecontrol.h b/classes/timecontrol/hourglasstimecontrol.h deleted file mode 100644 index 268cc3f..0000000 --- a/classes/timecontrol/hourglasstimecontrol.h +++ /dev/null @@ -1,38 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef HOURGLASSTIMECONTROL_H -#define HOURGLASSTIMECONTROL_H - -#include "../timecontrol.h" - -class HourGlassTimeControl : public TimeControl -{ -public: - HourGlassTimeControl(); - - QString getName(); - QString getDescription(); - QIcon getIcon(); - ClocksWidget* initGame(bool useLastSettings); -}; - -#endif // HOURGLASSTIMECONTROL_H diff --git a/classes/timecontrol/notimecontrol.cpp b/classes/timecontrol/notimecontrol.cpp deleted file mode 100644 index b946065..0000000 --- a/classes/timecontrol/notimecontrol.cpp +++ /dev/null @@ -1,67 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include "notimecontrol.h" - -#include "../chessclock.h" -#include "basicdialog.h" -#include "../chessclockwidget.h" -#include "../clockswidget.h" - -#include - -NoTimeControl::NoTimeControl() -{ -} - - -QString NoTimeControl::getDescription() -{ - return qApp->translate("NoneTimeControl","Never add time."); -} - -QIcon NoTimeControl::getIcon() -{ - return QIcon(":/rc/pic/oldclock.png"); -} - -ClocksWidget* NoTimeControl::initGame(bool useLastSettings) -{ - BasicDialog dialog(getName()); - - dialog.disableAddition(); - dialog.init(); - - if( useLastSettings || dialog.exec() == QDialog::Accepted) - { - dialog.store(); - ChessClockWidget* white = new ChessClockWidget(true); - white->setTimeAvailable(dialog.getWhiteInitial()); - - ChessClockWidget* black = new ChessClockWidget(false); - black->setTimeAvailable( dialog.getBlackInitial()); - - return( new ClocksWidget(white,black)); - - } - else - return 0; -} diff --git a/classes/welcomescreenwidget.cpp b/classes/welcomescreenwidget.cpp deleted file mode 100644 index 29c9409..0000000 --- a/classes/welcomescreenwidget.cpp +++ /dev/null @@ -1,49 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#include -#include -#include -#include - -#include "welcomescreenwidget.h" - -WelcomeScreenWidget::WelcomeScreenWidget(QWidget *parent) : - QWidget(parent) -{ - QLabel* logoLabel = new QLabel; - logoLabel->setPixmap( QPixmap(":/rc/pic/logo.png")); - QLabel* introLabel = new QLabel( - tr("

Chess Clock


" - "Version %1
" - "© Arto Hyvättinen 2010
" - "Chess Clock is free software in terms of GNU General Public Licence v3" - "

Welcome to Chess Clock!
" - "Please touch to set up game clock.

" - ).arg(qApp->applicationVersion()) - - ); - introLabel->setWordWrap(true); - QHBoxLayout* layout = new QHBoxLayout; - layout->addWidget(logoLabel); - layout->addWidget(introLabel); - setLayout( layout ); -} diff --git a/classes/welcomescreenwidget.h b/classes/welcomescreenwidget.h deleted file mode 100644 index 434845b..0000000 --- a/classes/welcomescreenwidget.h +++ /dev/null @@ -1,46 +0,0 @@ - /************************************************************************** - - Chess Clock - - Copyright (c) Arto Hyvättinen 2010 - - This file is part of Chess Clock software. - - Chess Clock is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Chess Clock is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - -**************************************************************************/ - -#ifndef WELCOMESCREENWIDGET_H -#define WELCOMESCREENWIDGET_H - -#include - -/*! Welcome screen - - @author Arto Hyvättinen - @date 2010-08-14 - - */ - -class WelcomeScreenWidget : public QWidget -{ - Q_OBJECT -public: - WelcomeScreenWidget(QWidget *parent = 0); - -signals: - -public slots: - -}; - -#endif // WELCOMESCREENWIDGET_H -- 1.7.9.5