IntroItem, improved movement rules and move counting.
[impuzzle] / src / mainwindow.cpp
1 /*
2   Image Puzzle - A set your pieces straight game
3   Copyright (C) 2009  Timo Härkönen
4
5   This program is free software: you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation, either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #include "mainwindow.h"
20 #include "gameview.h"
21
22 #include <QAction>
23 #include <QMenu>
24 #include <QMenuBar>
25
26 #include "imageimporter.h"
27
28 MainWindow::MainWindow(QWidget *parent) :
29         QMainWindow(parent)
30 {
31     createActions();
32     createMenu();
33
34     setCentralWidget(GameView::instance());
35 }
36
37 void MainWindow::createMenu()
38 {
39     menu_ = menuBar()->addMenu("");
40     menu_->addAction(newGameAction_);
41     menu_->addAction(importAction_);
42 }
43
44 void MainWindow::createActions()
45 {
46     newGameAction_ = new QAction(tr("New game"), this);
47     connect(newGameAction_, SIGNAL(triggered()), this, SLOT(newGameClicked()));
48
49     importAction_ = new QAction(tr("Import image"), this);
50     connect(importAction_, SIGNAL(triggered()), this, SLOT(importClicked()));
51     importAction_->setDisabled(true);
52 }
53
54 void MainWindow::importClicked()
55 {
56
57 }
58
59 void MainWindow::newGameClicked()
60 {
61     GameView::instance()->setPieces(ImageImporter::instance()->newPieces(0, 20));
62 }