File indexing completed on 2024-12-01 03:49:03

0001 /***************************************************************************
0002  *   Copyright 2007      Johannes Bergmeier <johannes.bergmeier@gmx.net>   *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 
0020 #ifndef _KSUDOKUWELCOMESCREEN_H_
0021 #define _KSUDOKUWELCOMESCREEN_H_
0022 
0023 #include <QWidget>
0024 
0025 #include "ui_welcomescreen.h"
0026 #include "gamevariants.h"
0027 
0028 namespace ksudoku {
0029 
0030 class WelcomeScreen : public QFrame, private Ui::WelcomeScreen {
0031 Q_OBJECT
0032 
0033 public:
0034     WelcomeScreen(QWidget* parent, GameVariantCollection* collection);
0035     
0036 public:
0037     GameVariant* selectedVariant() const;
0038 
0039     int difficulty() const;
0040     void setDifficulty(int difficulty);
0041     int symmetry() const;
0042     void setSymmetry(int symmetry);
0043 
0044 private Q_SLOTS:
0045     void onCurrentVariantChange();
0046     
0047     void getNewVariant();
0048     void configureVariant();
0049     void startEmptyGame();
0050     void playVariant();
0051 
0052     void generatePuzzle();
0053 
0054     // This slot is used to restore the user's previous selection of puzzle
0055     // type and size when KSudoku starts up.  It has to be a slot because it
0056     // needs a queued call, which executes after all the setup has finished,
0057     // otherwise selection fails and no selection is shown.
0058     void setSelectedVariant(int row);
0059 
0060 Q_SIGNALS:
0061     void newGameStarted(const ::ksudoku::Game& game, GameVariant* variant);
0062     
0063 private:
0064     GameVariantCollection* m_collection;
0065     int m_selectedPuzzle;
0066     int m_difficulty;
0067     int m_symmetry;
0068 };
0069 
0070 }
0071 
0072 #endif