Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
KsirK
Commits
d8c37969
Commit
d8c37969
authored
Mar 31, 2007
by
Albert Astals Cid
Browse files
give the new game dialog proper layouting
svn path=/trunk/playground/games/ksirk/; revision=648461
parent
a095e7c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
ksirk/Dialogs/newGameDialog.ui
View file @
d8c37969
...
...
@@ -7,305 +7,199 @@
<rect>
<x>0</x>
<y>0</y>
<width>5
1
2</width>
<height>
537
</height>
<width>52
6
</width>
<height>
424
</height>
</rect>
</property>
<property name="windowTitle" >
<string>Ksirk - New game properties</string>
</property>
<property name="windowIcon" >
<iconset/>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<widget class="QWidget" name="" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>491</width>
<height>501</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" colspan="5" >
<widget class="Line" name="line1" >
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3" >
<widget class="QSpinBox" name="playersNumberEntry" >
<property name="toolTip" >
<string>Spin this to choose the number of players.</string>
</property>
<property name="whatsThis" >
<string>A spin box to choose the number of players</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>Skin:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<widget class="QGroupBox" name="goalGroup" >
<property name="title" >
<string>Goal Type</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="radioGoal" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Choose this to have a goal assigned to each player.</string>
</property>
<property name="whatsThis" >
<string>In this mode, a goal will be assigned to each player, which he will have to reach in order to win.</string>
</property>
<property name="text" >
<string>Reach a goal</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioWorld" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Choose this for players to have to conquer all the world to win.</string>
</property>
<property name="whatsThis" >
<string>In this mode, a player will have to conquer all the world to win.</string>
</property>
<property name="text" >
<string>Wor&ld conquest</string>
</property>
<property name="shortcut" >
<string>Alt+L</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="5" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<string>Number of players:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item rowspan="2" row="4" column="2" colspan="3" >
<widget class="QLabel" name="skinSnapshotPixmap" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap" >
<pixmap/>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<widget class="QLabel" name="skinDescLabel" >
<property name="text" >
<string>textLabel1</string>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3" >
<widget class="QComboBox" name="skinCombo" >
<property name="toolTip" >
<string>Choose the skin (map, nationalities, etc.) to use for this game.</string>
</property>
<property name="whatsThis" >
<string>A combo listing all the available skins.</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="5" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="4" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<string>Number of players:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3" >
<widget class="QSpinBox" name="playersNumberEntry" >
<property name="toolTip" >
<string>Spin this to choose the number of players.</string>
</property>
<property name="whatsThis" >
<string>A spin box to choose the number of players</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QCheckBox" name="networkGameCheckBox" >
<property name="toolTip" >
<string>Check this to create a network game</string>
</property>
<property name="whatsThis" >
<string>A network game will be created if checked</string>
</property>
<property name="text" >
<string>Ne&twork game</string>
</property>
<property name="shortcut" >
<string>Alt+T</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4" >
<widget class="Line" name="line1" >
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>Skin:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3" >
<widget class="QComboBox" name="skinCombo" >
<property name="toolTip" >
<string>Choose the skin (map, nationalities, etc.) to use for this game.</string>
</property>
<property name="whatsThis" >
<string>A combo listing all the available skins.</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4" >
<widget class="QLabel" name="skinDescLabel" >
<property name="text" >
<string>textLabel1</string>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="2" colspan="2" >
<widget class="QLabel" name="skinSnapshotPixmap" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap" >
<pixmap/>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<widget class="QGroupBox" name="goalGroup" >
<property name="title" >
<string>Goal Type</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QPushButton" name="buttonHelp" >
<widget class="QRadioButton" name="radioWorld" >
<property name="toolTip" >
<string>Choose this for players to have to conquer all the world to win.</string>
</property>
<property name="whatsThis" >
<string>In this mode, a player will have to conquer all the world to win.</string>
</property>
<property name="text" >
<string>&
Help
</string>
<string>
Wor
&
ld conquest
</string>
</property>
<property name="shortcut" >
<string>F1</string>
</property>
<property name="autoDefault" >
<bool>true</bool>
<string>Alt+L</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
<widget class="QRadioButton" name="radioGoal" >
<property name="toolTip" >
<string>Choose this to have a goal assigned to each player.</string>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
<property name="whatsThis" >
<string>In this mode, a goal will be assigned to each player, which he will have to reach in order to win.</string>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonCancel" >
<property name="text" >
<string>
&Cance
l</string>
<string>
Reach a goa
l</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
<property name="default" >
<bool>false</bool>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonOk" >
<property name="text" >
<string>&OK</string>
</property>
<property name="shortcut" >
<string/>
</property>
<property name="autoDefault" >
<bool>true</bool>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="default" >
<bool>true</bool>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</
widget
>
</
spacer
>
</item>
</layout>
</item>
<item row="1" column="3" colspan="2" >
<widget class="QCheckBox" name="networkGameCheckBox" >
<property name="toolTip" >
<string>Check this to create a network game</string>
</property>
<property name="whatsThis" >
<string>A network game will be created if checked</string>
</property>
<property name="text" >
<string>Ne&twork game</string>
</property>
<property name="shortcut" >
<string>Alt+T</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="6" column="0" colspan="4" >
<widget class="KDialogButtonBox" name="buttonbox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<customwidget>
<class>KDialogButtonBox</class>
<extends>QDialogButtonBox</extends>
<header>kdialogbuttonbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>skinCombo</tabstop>
<tabstop>playersNumberEntry</tabstop>
<tabstop>radioWorld</tabstop>
<tabstop>radioGoal</tabstop>
<tabstop>networkGameCheckBox</tabstop>
<tabstop>buttonOk</tabstop>
<tabstop>buttonHelp</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonOk</sender>
<signal>clicked()</signal>
<receiver>NewGameDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel" >
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
ksirk/Dialogs/newGameDialogImpl.cpp
View file @
d8c37969
...
...
@@ -26,13 +26,9 @@
#include
<kstandarddirs.h>
#include
<kmessagebox.h>
#include
<qspinbox.h>
#include
<qcheckbox.h>
#include
<qcombobox.h>
#include
<qdir.h>
#include
<qstringlist.h>
#include
<qradiobutton.h>
#include
<qlabel.h>
#include
<qpushbutton.h>
namespace
Ksirk
{
...
...
@@ -55,10 +51,10 @@ NewGameDialogImpl::NewGameDialogImpl(
playersNumberEntry
->
setMinimum
(
2
);
playersNumberEntry
->
setMaximum
(
maxPlayers
);
fillSkinsCombo
();
QObject
::
connect
(
(
const
QObject
*
)
button
Cancel
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotCancel
())
);
QObject
::
connect
(
(
const
QObject
*
)
button
Ok
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotOK
())
);
QObject
::
connect
(
(
const
QObject
*
)
button
Help
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotHelp
())
);
QObject
::
connect
(
(
const
QObject
*
)
skinCombo
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
slotSkinChanged
(
int
))
);
QObject
::
connect
(
buttonbox
->
button
(
QDialogButtonBox
::
Cancel
)
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotCancel
())
);
QObject
::
connect
(
buttonbox
->
button
(
QDialogButtonBox
::
Ok
)
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotOK
())
);
QObject
::
connect
(
buttonbox
->
button
(
QDialogButtonBox
::
Help
)
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotHelp
())
);
QObject
::
connect
(
skinCombo
,
SIGNAL
(
activated
(
int
)),
this
,
SLOT
(
slotSkinChanged
(
int
))
);
}
NewGameDialogImpl
::~
NewGameDialogImpl
()
...
...
@@ -80,14 +76,14 @@ void NewGameDialogImpl::slotOK()
m_networkGame
=
networkGameCheckBox
->
isChecked
();
m_useGoals
=
(
radioGoal
->
isChecked
());
m_ok
=
true
;
close
();
accept
();
}
void
NewGameDialogImpl
::
slotCancel
()
{
kDebug
()
<<
"KPlayerSetupDialog slotCancel"
<<
endl
;
m_ok
=
false
;
close
();
reject
();
}
/** @todo implements a help */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment