2 Image Puzzle - A set your pieces straight game
3 Copyright (C) 2009 Timo Härkönen
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.
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.
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/>.
19 #include "mainwindow.h"
22 #include "settingsdialog.h"
28 #include "imageimporter.h"
30 MainWindow::MainWindow(QWidget *parent) :
36 setCentralWidget(GameView::instance());
39 void MainWindow::createMenu()
41 menu_ = menuBar()->addMenu("");
42 menu_->addAction(newGameAction_);
43 menu_->addAction(importAction_);
46 void MainWindow::createActions()
48 newGameAction_ = new QAction(tr("New game"), this);
49 connect(newGameAction_, SIGNAL(triggered()), this, SLOT(newGameClicked()));
51 importAction_ = new QAction(tr("Import image"), this);
52 connect(importAction_, SIGNAL(triggered()), this, SLOT(importClicked()));
53 importAction_->setDisabled(true);
55 settingsAction_ = new QAction(tr("Settings"), this);
56 connect(settingsAction_, SIGNAL(triggered()), this, SLOT(settingsClicked()));
59 void MainWindow::importClicked()
64 void MainWindow::newGameClicked()
66 SettingsDialog dialog(this);
69 GameView::instance()->setPieces(ImageImporter::instance()->newPieces(Settings::instance()->image(), Settings::instance()->pieceCount()));
72 void MainWindow::settingsClicked()