bump up
[mancala] / src / settingswidget.cpp
1 /***************************************************************************
2
3 Copyright 2010 Reto Zingg <g.d0b3rm4n@gmail.com>
4
5 ***************************************************************************/
6
7 /***************************************************************************
8 *                                                                         *
9 *   This program is free software; you can redistribute it and/or modify  *
10 *   it under the terms of the GNU General Public License as published by  *
11 *   the Free Software Foundation; either version 2 of the License, or     *
12 *   (at your option) any later version.                                   *
13 *                                                                         *
14 ***************************************************************************/
15
16
17 #include "settingswidget.h"
18
19 #include <QVBoxLayout>
20 #include <QHBoxLayout>
21 #include <QComboBox>
22 #include <QLabel>
23 #include <QPushButton>
24
25
26 SettingsWidget::SettingsWidget(QWidget *parent) :
27     QWidget(parent)
28 {
29
30     QVBoxLayout *vbox = new QVBoxLayout();
31
32     QHBoxLayout *hbox_level = new QHBoxLayout();
33     QHBoxLayout *hbox_game = new QHBoxLayout();
34     QHBoxLayout *hbox_bottom = new QHBoxLayout();
35
36     m_ComboLevel = new QComboBox();
37     m_ComboLevel->addItem("Easy");
38     m_ComboLevel->addItem("Medium");
39     m_ComboLevel->addItem("Hard");
40
41     connect(m_ComboLevel,
42             SIGNAL(currentIndexChanged(int)),
43             this,
44             SIGNAL(levelChanged(int)));
45
46     m_ComboGame = new QComboBox();
47
48     connect(m_ComboGame,
49             SIGNAL(currentIndexChanged(int)),
50             this,
51             SIGNAL(gameChanged(int)));
52
53     QLabel *label_level = new QLabel(tr("Level:"));
54     hbox_level->addWidget(label_level);
55     hbox_level->addWidget(m_ComboLevel);
56
57     QLabel *label_game = new QLabel(tr("Game:"));
58     hbox_game->addWidget(label_game);
59     hbox_game->addWidget(m_ComboGame);
60
61     QPushButton *m_button = new QPushButton();
62     m_button->setText(tr("Start"));
63     hbox_bottom->addWidget(m_button);
64
65     connect(m_button,
66             SIGNAL(clicked()),
67             this,
68             SIGNAL(start()));
69
70     vbox->addLayout(hbox_level);
71     vbox->addLayout(hbox_game);
72     vbox->addLayout(hbox_bottom);
73
74     setLayout(vbox);
75
76 }
77
78 void SettingsWidget::setGameNames(QStringList gameNames){
79     m_ComboGame->addItems(gameNames);
80 }