-rw-r--r-- | noncore/games/backgammon/aidialog.cpp | 15 | ||||
-rw-r--r-- | noncore/games/backgammon/filedialog.cpp | 129 | ||||
-rw-r--r-- | noncore/games/backgammon/playerdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/games/backgammon/rulesdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/games/backgammon/themedialog.cpp | 2 | ||||
-rw-r--r-- | noncore/games/sfcave/helpwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.cpp | 3 | ||||
-rw-r--r-- | noncore/games/tictac/tictac.cpp | 4 |
8 files changed, 87 insertions, 78 deletions
diff --git a/noncore/games/backgammon/aidialog.cpp b/noncore/games/backgammon/aidialog.cpp index 7dfe403..32e9b52 100644 --- a/noncore/games/backgammon/aidialog.cpp +++ b/noncore/games/backgammon/aidialog.cpp | |||
@@ -1,103 +1,104 @@ | |||
1 | #include "aidialog.h" | 1 | #include "aidialog.h" |
2 | 2 | ||
3 | #include <qgroupbox.h> | 3 | #include <qgroupbox.h> |
4 | 4 | ||
5 | #include <qpe/qpeapplication.h> | ||
5 | 6 | ||
6 | AI_Dialog::AI_Dialog(QWidget* parent,const char* name,bool modal,WFlags f) | 7 | AI_Dialog::AI_Dialog(QWidget* parent,const char* name,bool modal,WFlags f) |
7 | : QDialog(parent,name,modal,f) | 8 | : QDialog(parent,name,modal,f) |
8 | { | 9 | { |
9 | setCaption("AI Configuration"); | 10 | setCaption("AI Configuration"); |
10 | 11 | ||
11 | QGroupBox* settings=new QGroupBox(tr( "Settings" ),this); | 12 | QGroupBox* settings=new QGroupBox(tr( "Settings" ),this); |
12 | settings->setGeometry(10,5,220,170); | 13 | settings->setGeometry(10,5,220,170); |
13 | 14 | ||
14 | QLabel* rescue_label=new QLabel(tr( "<b>Rescue</b>" ),settings); | 15 | QLabel* rescue_label=new QLabel(tr( "<b>Rescue</b>" ),settings); |
15 | rescue_label->setGeometry(50,20,50,20); | 16 | rescue_label->setGeometry(50,20,50,20); |
16 | rescue=new QSpinBox(0,6,1,settings); | 17 | rescue=new QSpinBox(0,6,1,settings); |
17 | rescue->setGeometry(100,20,40,20); | 18 | rescue->setGeometry(100,20,40,20); |
18 | QPushButton* rescuehelp=new QPushButton(tr( "?" ),settings); | 19 | QPushButton* rescuehelp=new QPushButton(tr( "?" ),settings); |
19 | rescuehelp->setGeometry(140,20,20,20); | 20 | rescuehelp->setGeometry(140,20,20,20); |
20 | connect(rescuehelp,SIGNAL(pressed()),this,SLOT(rescuehelp_pressed())); | 21 | connect(rescuehelp,SIGNAL(pressed()),this,SLOT(rescuehelp_pressed())); |
21 | connect(rescuehelp,SIGNAL(released()),this,SLOT(rescuehelp_released())); | 22 | connect(rescuehelp,SIGNAL(released()),this,SLOT(rescuehelp_released())); |
22 | 23 | ||
23 | QLabel* eliminate_label=new QLabel(tr( "<b>Eliminate</b>" ),settings); | 24 | QLabel* eliminate_label=new QLabel(tr( "<b>Eliminate</b>" ),settings); |
24 | eliminate_label->setGeometry(50,40,50,20); | 25 | eliminate_label->setGeometry(50,40,50,20); |
25 | eliminate=new QSpinBox(0,6,1,settings); | 26 | eliminate=new QSpinBox(0,6,1,settings); |
26 | eliminate->setGeometry(100,40,40,20); | 27 | eliminate->setGeometry(100,40,40,20); |
27 | QPushButton* eliminatehelp=new QPushButton(tr( "?" ),settings); | 28 | QPushButton* eliminatehelp=new QPushButton(tr( "?" ),settings); |
28 | eliminatehelp->setGeometry(140,40,20,20); | 29 | eliminatehelp->setGeometry(140,40,20,20); |
29 | connect(eliminatehelp,SIGNAL(pressed()),this,SLOT(eliminatehelp_pressed())); | 30 | connect(eliminatehelp,SIGNAL(pressed()),this,SLOT(eliminatehelp_pressed())); |
30 | connect(eliminatehelp,SIGNAL(released()),this,SLOT(eliminatehelp_released())); | 31 | connect(eliminatehelp,SIGNAL(released()),this,SLOT(eliminatehelp_released())); |
31 | 32 | ||
32 | QLabel* expose_label=new QLabel(tr( "<b>Expose</b>" ),settings); | 33 | QLabel* expose_label=new QLabel(tr( "<b>Expose</b>" ),settings); |
33 | expose_label->setGeometry(50,60,50,20); | 34 | expose_label->setGeometry(50,60,50,20); |
34 | expose=new QSpinBox(0,6,1,settings); | 35 | expose=new QSpinBox(0,6,1,settings); |
35 | expose->setGeometry(100,60,40,20); | 36 | expose->setGeometry(100,60,40,20); |
36 | QPushButton* exposeehelp=new QPushButton(tr( "?" ),settings); | 37 | QPushButton* exposeehelp=new QPushButton(tr( "?" ),settings); |
37 | exposeehelp->setGeometry(140,60,20,20); | 38 | exposeehelp->setGeometry(140,60,20,20); |
38 | connect(exposeehelp,SIGNAL(pressed()),this,SLOT(exposehelp_pressed())); | 39 | connect(exposeehelp,SIGNAL(pressed()),this,SLOT(exposehelp_pressed())); |
39 | connect(exposeehelp,SIGNAL(released()),this,SLOT(exposehelp_released())); | 40 | connect(exposeehelp,SIGNAL(released()),this,SLOT(exposehelp_released())); |
40 | 41 | ||
41 | QLabel* protect_label=new QLabel(tr( "<b>Protect</b>" ),settings); | 42 | QLabel* protect_label=new QLabel(tr( "<b>Protect</b>" ),settings); |
42 | protect_label->setGeometry(50,80,50,20); | 43 | protect_label->setGeometry(50,80,50,20); |
43 | protect=new QSpinBox(0,6,1,settings); | 44 | protect=new QSpinBox(0,6,1,settings); |
44 | protect->setGeometry(100,80,40,20); | 45 | protect->setGeometry(100,80,40,20); |
45 | QPushButton* protecthelp=new QPushButton(tr( "?" ),settings); | 46 | QPushButton* protecthelp=new QPushButton(tr( "?" ),settings); |
46 | protecthelp->setGeometry(140,80,20,20); | 47 | protecthelp->setGeometry(140,80,20,20); |
47 | connect(protecthelp,SIGNAL(pressed()),this,SLOT(protecthelp_pressed())); | 48 | connect(protecthelp,SIGNAL(pressed()),this,SLOT(protecthelp_pressed())); |
48 | connect(protecthelp,SIGNAL(released()),this,SLOT(protecthelp_released())); | 49 | connect(protecthelp,SIGNAL(released()),this,SLOT(protecthelp_released())); |
49 | 50 | ||
50 | QLabel* safe_label=new QLabel(tr( "<b>Safe</b>" ),settings); | 51 | QLabel* safe_label=new QLabel(tr( "<b>Safe</b>" ),settings); |
51 | safe_label->setGeometry(50,100,50,20); | 52 | safe_label->setGeometry(50,100,50,20); |
52 | safe=new QSpinBox(0,6,1,settings); | 53 | safe=new QSpinBox(0,6,1,settings); |
53 | safe->setGeometry(100,100,40,20); | 54 | safe->setGeometry(100,100,40,20); |
54 | QPushButton* safeehelp=new QPushButton(tr( "?" ),settings); | 55 | QPushButton* safeehelp=new QPushButton(tr( "?" ),settings); |
55 | safeehelp->setGeometry(140,100,20,20); | 56 | safeehelp->setGeometry(140,100,20,20); |
56 | connect(safeehelp,SIGNAL(pressed()),this,SLOT(safehelp_pressed())); | 57 | connect(safeehelp,SIGNAL(pressed()),this,SLOT(safehelp_pressed())); |
57 | connect(safeehelp,SIGNAL(released()),this,SLOT(safehelp_released())); | 58 | connect(safeehelp,SIGNAL(released()),this,SLOT(safehelp_released())); |
58 | 59 | ||
59 | QLabel* empty_label=new QLabel(tr( "<b>Empty</b>" ),settings); | 60 | QLabel* empty_label=new QLabel(tr( "<b>Empty</b>" ),settings); |
60 | empty_label->setGeometry(50,120,50,20); | 61 | empty_label->setGeometry(50,120,50,20); |
61 | empty=new QSpinBox(0,6,1,settings); | 62 | empty=new QSpinBox(0,6,1,settings); |
62 | empty->setGeometry(100,120,40,20); | 63 | empty->setGeometry(100,120,40,20); |
63 | QPushButton* emptyhelp=new QPushButton(tr( "?" ),settings); | 64 | QPushButton* emptyhelp=new QPushButton(tr( "?" ),settings); |
64 | emptyhelp->setGeometry(140,120,20,20); | 65 | emptyhelp->setGeometry(140,120,20,20); |
65 | connect(emptyhelp,SIGNAL(pressed()),this,SLOT(emptyhelp_pressed())); | 66 | connect(emptyhelp,SIGNAL(pressed()),this,SLOT(emptyhelp_pressed())); |
66 | connect(emptyhelp,SIGNAL(released()),this,SLOT(emptyhelp_released())); | 67 | connect(emptyhelp,SIGNAL(released()),this,SLOT(emptyhelp_released())); |
67 | 68 | ||
68 | defaultvalues=new QPushButton(tr( "Default Values" ),settings); | 69 | defaultvalues=new QPushButton(tr( "Default Values" ),settings); |
69 | defaultvalues->setGeometry(60,140,90,20); | 70 | defaultvalues->setGeometry(60,140,90,20); |
70 | connect(defaultvalues,SIGNAL(clicked()),this,SLOT(setDefaultValues())); | 71 | connect(defaultvalues,SIGNAL(clicked()),this,SLOT(setDefaultValues())); |
71 | 72 | ||
72 | QGroupBox* helpbox=new QGroupBox(tr( "Help" ),this); | 73 | QGroupBox* helpbox=new QGroupBox(tr( "Help" ),this); |
73 | helpbox->setGeometry(10,185,220,90); | 74 | helpbox->setGeometry(10,185,220,90); |
74 | 75 | ||
75 | help=new QLabel(helpbox); | 76 | help=new QLabel(helpbox); |
76 | help->setGeometry(10,15,200,65); | 77 | help->setGeometry(10,15,200,65); |
77 | 78 | ||
78 | setHelpText(); | 79 | setHelpText(); |
79 | showMaximized(); | 80 | QPEApplication::showDialog( this ); |
80 | } | 81 | } |
81 | 82 | ||
82 | 83 | ||
83 | AI_Dialog::~AI_Dialog() | 84 | AI_Dialog::~AI_Dialog() |
84 | { | 85 | { |
85 | } | 86 | } |
86 | 87 | ||
87 | void AI_Dialog::rescuehelp_pressed() | 88 | void AI_Dialog::rescuehelp_pressed() |
88 | { | 89 | { |
89 | setHelpText("rescue"); | 90 | setHelpText("rescue"); |
90 | } | 91 | } |
91 | 92 | ||
92 | void AI_Dialog::rescuehelp_released() | 93 | void AI_Dialog::rescuehelp_released() |
93 | { | 94 | { |
94 | setHelpText(); | 95 | setHelpText(); |
95 | } | 96 | } |
96 | 97 | ||
97 | void AI_Dialog::eliminatehelp_pressed() | 98 | void AI_Dialog::eliminatehelp_pressed() |
98 | { | 99 | { |
99 | setHelpText("eliminate"); | 100 | setHelpText("eliminate"); |
100 | } | 101 | } |
101 | 102 | ||
102 | void AI_Dialog::eliminatehelp_released() | 103 | void AI_Dialog::eliminatehelp_released() |
103 | { | 104 | { |
diff --git a/noncore/games/backgammon/filedialog.cpp b/noncore/games/backgammon/filedialog.cpp index 6c858a2..a5e71c9 100644 --- a/noncore/games/backgammon/filedialog.cpp +++ b/noncore/games/backgammon/filedialog.cpp | |||
@@ -1,64 +1,65 @@ | |||
1 | #include "filedialog.h" | 1 | #include "filedialog.h" |
2 | 2 | ||
3 | #include <qdir.h> | 3 | #include <qdir.h> |
4 | #include <qfileinfo.h> | 4 | #include <qfileinfo.h> |
5 | #include <qmessagebox.h> | 5 | #include <qmessagebox.h> |
6 | #include <qpixmap.h> | 6 | #include <qpixmap.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | 9 | ||
10 | FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f) | 10 | FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f) |
11 | :QDialog(parent,name,modal,f) | 11 | :QDialog(parent,name,modal,f) |
12 | { | 12 | { |
13 | setCaption(header); | 13 | setCaption(header); |
14 | ext=extension; | 14 | ext=extension; |
15 | dirselector=new QListView(this); | 15 | dirselector=new QListView(this); |
16 | dirselector->setGeometry(1,10,235,200); | 16 | dirselector->setGeometry(1,10,235,200); |
17 | dirselector->addColumn("Files"); | 17 | dirselector->addColumn("Files"); |
18 | connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*))); | 18 | connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*))); |
19 | 19 | ||
20 | getCurrentDir(); | 20 | getCurrentDir(); |
21 | 21 | ||
22 | file_name="user"; | 22 | file_name="user"; |
23 | fileinput=new QLineEdit(file_name,this); | 23 | fileinput=new QLineEdit(file_name,this); |
24 | fileinput->setGeometry(1,220,235,20); | 24 | fileinput->setGeometry(1,220,235,20); |
25 | showMaximized(); | 25 | |
26 | } | 26 | QPEApplication::showDialog( this ); |
27 | 27 | } | |
28 | FileDialog::~FileDialog() | 28 | |
29 | {} | 29 | FileDialog::~FileDialog() |
30 | 30 | {} | |
31 | 31 | ||
32 | void FileDialog::selectorclicked(QListViewItem* entry) | 32 | |
33 | { | 33 | void FileDialog::selectorclicked(QListViewItem* entry) |
34 | if(entry==NULL) | 34 | { |
35 | return; | 35 | if(entry==NULL) |
36 | file_name=entry->text(0); | 36 | return; |
37 | fileinput->setText(file_name); | 37 | file_name=entry->text(0); |
38 | } | 38 | fileinput->setText(file_name); |
39 | 39 | } | |
40 | void FileDialog::getCurrentDir() | 40 | |
41 | { | 41 | void FileDialog::getCurrentDir() |
42 | dirselector->clear(); | 42 | { |
43 | QDir dir(QPEApplication::qpeDir()+"/backgammon"); | 43 | dirselector->clear(); |
44 | dir.setFilter(QDir::Files); | 44 | QDir dir(QPEApplication::qpeDir()+"/backgammon"); |
45 | QFileInfoListIterator it(*(dir.entryInfoList())); | 45 | dir.setFilter(QDir::Files); |
46 | QFileInfo* fi; | 46 | QFileInfoListIterator it(*(dir.entryInfoList())); |
47 | 47 | QFileInfo* fi; | |
48 | int ext_length=ext.length(); | 48 | |
49 | while((fi=it.current())) // go through all file and subdirs | 49 | int ext_length=ext.length(); |
50 | { | 50 | while((fi=it.current())) // go through all file and subdirs |
51 | QString file=fi->fileName(); | 51 | { |
52 | if(file.right(ext_length)==ext && file) | 52 | QString file=fi->fileName(); |
53 | { | 53 | if(file.right(ext_length)==ext && file) |
54 | file=file.left(file.length()-ext_length); | 54 | { |
55 | new QListViewItem(dirselector,file); | 55 | file=file.left(file.length()-ext_length); |
56 | } | 56 | new QListViewItem(dirselector,file); |
57 | ++it; | 57 | } |
58 | } | 58 | ++it; |
59 | } | 59 | } |
60 | 60 | } | |
61 | QString FileDialog::filename() | 61 | |
62 | { | 62 | QString FileDialog::filename() |
63 | return file_name; | 63 | { |
64 | } | 64 | return file_name; |
65 | } | ||
diff --git a/noncore/games/backgammon/playerdialog.cpp b/noncore/games/backgammon/playerdialog.cpp index c16f202..0faf7e2 100644 --- a/noncore/games/backgammon/playerdialog.cpp +++ b/noncore/games/backgammon/playerdialog.cpp | |||
@@ -1,58 +1,60 @@ | |||
1 | #include "playerdialog.h" | 1 | #include "playerdialog.h" |
2 | 2 | ||
3 | #include <qgroupbox.h> | 3 | #include <qgroupbox.h> |
4 | 4 | ||
5 | #include <qpe/qpeapplication.h> | ||
6 | |||
5 | PlayerDialog::PlayerDialog(QWidget* parent,const char* name,bool modal,WFlags f) | 7 | PlayerDialog::PlayerDialog(QWidget* parent,const char* name,bool modal,WFlags f) |
6 | :QDialog(parent,name,modal,f) | 8 | :QDialog(parent,name,modal,f) |
7 | { | 9 | { |
8 | auto2=false; | 10 | auto2=false; |
9 | auto2=true; | 11 | auto2=true; |
10 | setCaption("Player Settings"); | 12 | setCaption("Player Settings"); |
11 | 13 | ||
12 | QGroupBox* player1_box=new QGroupBox("Player 1",this); | 14 | QGroupBox* player1_box=new QGroupBox("Player 1",this); |
13 | player1_box->setGeometry(10,30,220,60); | 15 | player1_box->setGeometry(10,30,220,60); |
14 | 16 | ||
15 | manual_button1=new QRadioButton("Human",player1_box); | 17 | manual_button1=new QRadioButton("Human",player1_box); |
16 | connect(manual_button1,SIGNAL(clicked()),this,SLOT(button_manual1())); | 18 | connect(manual_button1,SIGNAL(clicked()),this,SLOT(button_manual1())); |
17 | manual_button1->setGeometry(10,20,100,20); | 19 | manual_button1->setGeometry(10,20,100,20); |
18 | auto_button1=new QRadioButton("Computer",player1_box); | 20 | auto_button1=new QRadioButton("Computer",player1_box); |
19 | connect(auto_button1,SIGNAL(clicked()),this,SLOT(button_auto1())); | 21 | connect(auto_button1,SIGNAL(clicked()),this,SLOT(button_auto1())); |
20 | auto_button1->setGeometry(110,20,100,20); | 22 | auto_button1->setGeometry(110,20,100,20); |
21 | button1_state(auto1); | 23 | button1_state(auto1); |
22 | 24 | ||
23 | QGroupBox* player2_box=new QGroupBox("Player 2",this); | 25 | QGroupBox* player2_box=new QGroupBox("Player 2",this); |
24 | player2_box->setGeometry(10,150,220,60); | 26 | player2_box->setGeometry(10,150,220,60); |
25 | 27 | ||
26 | manual_button2=new QRadioButton("Human",player2_box); | 28 | manual_button2=new QRadioButton("Human",player2_box); |
27 | connect(manual_button2,SIGNAL(clicked()),this,SLOT(button_manual2())); | 29 | connect(manual_button2,SIGNAL(clicked()),this,SLOT(button_manual2())); |
28 | manual_button2->setGeometry(10,20,100,20); | 30 | manual_button2->setGeometry(10,20,100,20); |
29 | auto_button2=new QRadioButton("Computer",player2_box); | 31 | auto_button2=new QRadioButton("Computer",player2_box); |
30 | connect(auto_button2,SIGNAL(clicked()),this,SLOT(button_auto2())); | 32 | connect(auto_button2,SIGNAL(clicked()),this,SLOT(button_auto2())); |
31 | auto_button2->setGeometry(110,20,100,20); | 33 | auto_button2->setGeometry(110,20,100,20); |
32 | button2_state(auto2); | 34 | button2_state(auto2); |
33 | 35 | ||
34 | showMaximized(); | 36 | QPEApplication::showDialog( this ); |
35 | } | 37 | } |
36 | 38 | ||
37 | PlayerDialog::~PlayerDialog() | 39 | PlayerDialog::~PlayerDialog() |
38 | {} | 40 | {} |
39 | 41 | ||
40 | 42 | ||
41 | void PlayerDialog::button_manual1() | 43 | void PlayerDialog::button_manual1() |
42 | { | 44 | { |
43 | auto1=false; | 45 | auto1=false; |
44 | button1_state(auto1); | 46 | button1_state(auto1); |
45 | } | 47 | } |
46 | 48 | ||
47 | void PlayerDialog::button_auto1() | 49 | void PlayerDialog::button_auto1() |
48 | { | 50 | { |
49 | auto1=true; | 51 | auto1=true; |
50 | button1_state(auto1); | 52 | button1_state(auto1); |
51 | } | 53 | } |
52 | 54 | ||
53 | void PlayerDialog::button_manual2() | 55 | void PlayerDialog::button_manual2() |
54 | { | 56 | { |
55 | auto2=false; | 57 | auto2=false; |
56 | button2_state(auto2); | 58 | button2_state(auto2); |
57 | } | 59 | } |
58 | 60 | ||
diff --git a/noncore/games/backgammon/rulesdialog.cpp b/noncore/games/backgammon/rulesdialog.cpp index 85c3db3..5e17eeb 100644 --- a/noncore/games/backgammon/rulesdialog.cpp +++ b/noncore/games/backgammon/rulesdialog.cpp | |||
@@ -1,59 +1,61 @@ | |||
1 | #include "rulesdialog.h" | 1 | #include "rulesdialog.h" |
2 | 2 | ||
3 | #include <qgroupbox.h> | 3 | #include <qgroupbox.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | 5 | ||
6 | #include <qpe/qpeapplication.h> | ||
7 | |||
6 | RulesDialog::RulesDialog(QWidget* parent,const char* name,bool modal,WFlags f) | 8 | RulesDialog::RulesDialog(QWidget* parent,const char* name,bool modal,WFlags f) |
7 | : QDialog(parent,name,modal,f) | 9 | : QDialog(parent,name,modal,f) |
8 | { | 10 | { |
9 | setCaption("Rules Configuration"); | 11 | setCaption("Rules Configuration"); |
10 | QLabel* header=new QLabel("<b>Change the game rules here</b>",this); | 12 | QLabel* header=new QLabel("<b>Change the game rules here</b>",this); |
11 | header->setGeometry(10,10,200,20); | 13 | header->setGeometry(10,10,200,20); |
12 | 14 | ||
13 | // | 15 | // |
14 | QGroupBox* pieces_out_box=new QGroupBox("Movement",this); | 16 | QGroupBox* pieces_out_box=new QGroupBox("Movement",this); |
15 | pieces_out_box->setGeometry(10,10,220,120); | 17 | pieces_out_box->setGeometry(10,10,220,120); |
16 | 18 | ||
17 | pieces_out=new QCheckBox("Don't care about others",pieces_out_box); | 19 | pieces_out=new QCheckBox("Don't care about others",pieces_out_box); |
18 | pieces_out->setGeometry(10,20,200,20); | 20 | pieces_out->setGeometry(10,20,200,20); |
19 | connect(pieces_out,SIGNAL(clicked()),this,SLOT(pieces_out_clicked())); | 21 | connect(pieces_out,SIGNAL(clicked()),this,SLOT(pieces_out_clicked())); |
20 | 22 | ||
21 | QLabel* pieces_out_help=new QLabel("allow movement of the pieses\neven if there are pieces knocked\nout by the opponent",pieces_out_box); | 23 | QLabel* pieces_out_help=new QLabel("allow movement of the pieses\neven if there are pieces knocked\nout by the opponent",pieces_out_box); |
22 | pieces_out_help->setGeometry(10,40,200,60); | 24 | pieces_out_help->setGeometry(10,40,200,60); |
23 | 25 | ||
24 | // | 26 | // |
25 | QGroupBox* nice_dice_box=new QGroupBox("Dice",this); | 27 | QGroupBox* nice_dice_box=new QGroupBox("Dice",this); |
26 | nice_dice_box->setGeometry(10,140,220,120); | 28 | nice_dice_box->setGeometry(10,140,220,120); |
27 | 29 | ||
28 | nice_dice=new QCheckBox("Big dice for small numbers",nice_dice_box); | 30 | nice_dice=new QCheckBox("Big dice for small numbers",nice_dice_box); |
29 | nice_dice->setGeometry(10,20,200,20); | 31 | nice_dice->setGeometry(10,20,200,20); |
30 | connect(nice_dice,SIGNAL(clicked()),this,SLOT(nice_dice_clicked())); | 32 | connect(nice_dice,SIGNAL(clicked()),this,SLOT(nice_dice_clicked())); |
31 | 33 | ||
32 | QLabel* nice_dice_help=new QLabel("allow to rescue pieces with dice\nvalues graeter than the distance\nto the players endzone.",nice_dice_box); | 34 | QLabel* nice_dice_help=new QLabel("allow to rescue pieces with dice\nvalues graeter than the distance\nto the players endzone.",nice_dice_box); |
33 | nice_dice_help->setGeometry(10,40,200,60); | 35 | nice_dice_help->setGeometry(10,40,200,60); |
34 | 36 | ||
35 | showMaximized(); | 37 | QPEApplication::showDialog( this ); |
36 | } | 38 | } |
37 | 39 | ||
38 | 40 | ||
39 | RulesDialog::~RulesDialog() | 41 | RulesDialog::~RulesDialog() |
40 | { | 42 | { |
41 | } | 43 | } |
42 | 44 | ||
43 | void RulesDialog::pieces_out_clicked() | 45 | void RulesDialog::pieces_out_clicked() |
44 | { | 46 | { |
45 | if(pieces_out->isChecked()) | 47 | if(pieces_out->isChecked()) |
46 | rules.move_with_pieces_out=true; | 48 | rules.move_with_pieces_out=true; |
47 | else | 49 | else |
48 | rules.move_with_pieces_out=false; | 50 | rules.move_with_pieces_out=false; |
49 | } | 51 | } |
50 | 52 | ||
51 | void RulesDialog::nice_dice_clicked() | 53 | void RulesDialog::nice_dice_clicked() |
52 | { | 54 | { |
53 | if(nice_dice->isChecked()) | 55 | if(nice_dice->isChecked()) |
54 | rules.generous_dice=true; | 56 | rules.generous_dice=true; |
55 | else | 57 | else |
56 | rules.generous_dice=false; | 58 | rules.generous_dice=false; |
57 | } | 59 | } |
58 | 60 | ||
59 | void RulesDialog::setRules(const Rules& new_rules) | 61 | void RulesDialog::setRules(const Rules& new_rules) |
diff --git a/noncore/games/backgammon/themedialog.cpp b/noncore/games/backgammon/themedialog.cpp index dcb957c..f342381 100644 --- a/noncore/games/backgammon/themedialog.cpp +++ b/noncore/games/backgammon/themedialog.cpp | |||
@@ -38,49 +38,49 @@ ThemeDialog::ThemeDialog(QWidget* parent,const char* name,bool modal,WFlags f) | |||
38 | labeldiceA->setGeometry(0,135,40,20); | 38 | labeldiceA->setGeometry(0,135,40,20); |
39 | boxdiceA=new QComboBox(this); | 39 | boxdiceA=new QComboBox(this); |
40 | boxdiceA->setGeometry(40,135,195,20); | 40 | boxdiceA->setGeometry(40,135,195,20); |
41 | fillBox("dice",boxdiceA); | 41 | fillBox("dice",boxdiceA); |
42 | 42 | ||
43 | QLabel* labeldiceB=new QLabel("dice2",this); | 43 | QLabel* labeldiceB=new QLabel("dice2",this); |
44 | labeldiceB->setGeometry(0,160,40,20); | 44 | labeldiceB->setGeometry(0,160,40,20); |
45 | boxdiceB=new QComboBox(this); | 45 | boxdiceB=new QComboBox(this); |
46 | boxdiceB->setGeometry(40,160,195,20); | 46 | boxdiceB->setGeometry(40,160,195,20); |
47 | fillBox("dice",boxdiceB); | 47 | fillBox("dice",boxdiceB); |
48 | 48 | ||
49 | QLabel* labelodds=new QLabel("odds",this); | 49 | QLabel* labelodds=new QLabel("odds",this); |
50 | labelodds->setGeometry(0,200,40,20); | 50 | labelodds->setGeometry(0,200,40,20); |
51 | boxodds=new QComboBox(this); | 51 | boxodds=new QComboBox(this); |
52 | boxodds->setGeometry(40,200,195,20); | 52 | boxodds->setGeometry(40,200,195,20); |
53 | fillBox("odds",boxodds); | 53 | fillBox("odds",boxodds); |
54 | boxodds->setEnabled(false); | 54 | boxodds->setEnabled(false); |
55 | 55 | ||
56 | QLabel* labeltable=new QLabel("table",this); | 56 | QLabel* labeltable=new QLabel("table",this); |
57 | labeltable->setGeometry(0,225,40,20); | 57 | labeltable->setGeometry(0,225,40,20); |
58 | boxtable=new QComboBox(this); | 58 | boxtable=new QComboBox(this); |
59 | boxtable->setGeometry(40,225,195,20); | 59 | boxtable->setGeometry(40,225,195,20); |
60 | fillBox("table",boxtable); | 60 | fillBox("table",boxtable); |
61 | 61 | ||
62 | showMaximized(); | 62 | QPEApplication::showDialog( this ); |
63 | } | 63 | } |
64 | 64 | ||
65 | ThemeDialog::~ThemeDialog() | 65 | ThemeDialog::~ThemeDialog() |
66 | {} | 66 | {} |
67 | 67 | ||
68 | 68 | ||
69 | ImageNames ThemeDialog::getNames() | 69 | ImageNames ThemeDialog::getNames() |
70 | { | 70 | { |
71 | ImageNames names; | 71 | ImageNames names; |
72 | names.theme=lineName->text(); | 72 | names.theme=lineName->text(); |
73 | names.board=boxboard->currentText(); | 73 | names.board=boxboard->currentText(); |
74 | names.pieces1=boxpiecesA->currentText(); | 74 | names.pieces1=boxpiecesA->currentText(); |
75 | names.pieces2=boxpiecesB->currentText(); | 75 | names.pieces2=boxpiecesB->currentText(); |
76 | names.dice1=boxdiceA->currentText(); | 76 | names.dice1=boxdiceA->currentText(); |
77 | names.dice2=boxdiceB->currentText(); | 77 | names.dice2=boxdiceB->currentText(); |
78 | names.odds=boxodds->currentText(); | 78 | names.odds=boxodds->currentText(); |
79 | names.table=boxtable->currentText(); | 79 | names.table=boxtable->currentText(); |
80 | return names; | 80 | return names; |
81 | } | 81 | } |
82 | 82 | ||
83 | void ThemeDialog::setCurrent(const ImageNames& current) | 83 | void ThemeDialog::setCurrent(const ImageNames& current) |
84 | { | 84 | { |
85 | int a=0; | 85 | int a=0; |
86 | lineName->setText(current.theme); | 86 | lineName->setText(current.theme); |
diff --git a/noncore/games/sfcave/helpwindow.cpp b/noncore/games/sfcave/helpwindow.cpp index c920312..544e237 100644 --- a/noncore/games/sfcave/helpwindow.cpp +++ b/noncore/games/sfcave/helpwindow.cpp | |||
@@ -1,46 +1,48 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | helpwindow.cpp - description | 2 | helpwindow.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Sun Sep 8 2002 | 4 | begin : Sun Sep 8 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <qwidget.h> | 18 | #include <qwidget.h> |
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | #include <qstring.h> | 20 | #include <qstring.h> |
21 | #include <qtextview.h> | 21 | #include <qtextview.h> |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
23 | #include "helpwindow.h" | 25 | #include "helpwindow.h" |
24 | 26 | ||
25 | 27 | ||
26 | #define HELP_TEXT \ | 28 | #define HELP_TEXT \ |
27 | "<qt><h1>SFCave Help</h1><p> " \ | 29 | "<qt><h1>SFCave Help</h1><p> " \ |
28 | "SFCave is a flying game for the Zaurus.<br><br> " \ | 30 | "SFCave is a flying game for the Zaurus.<br><br> " \ |
29 | "The aim is to stay alive for as long as possible and get the highest score " \ | 31 | "The aim is to stay alive for as long as possible and get the highest score " \ |
30 | "you can.<br><br>" \ | 32 | "you can.<br><br>" \ |
31 | "There are three game types currently - SFCave, Gates, and Fly.<br>" \ | 33 | "There are three game types currently - SFCave, Gates, and Fly.<br>" \ |
32 | "<b>SFCave</b> is a remake of the classic SFCave game - fly through the " \ | 34 | "<b>SFCave</b> is a remake of the classic SFCave game - fly through the " \ |
33 | "cavern avoiding all the blocks that just happen to be hanging in " \ | 35 | "cavern avoiding all the blocks that just happen to be hanging in " \ |
34 | "midair<br><br>" \ | 36 | "midair<br><br>" \ |
35 | "<b>Gates</b> is similar to SFCave but instead you must fly through the " \ | 37 | "<b>Gates</b> is similar to SFCave but instead you must fly through the " \ |
36 | "without crashing.<br><br>" \ | 38 | "without crashing.<br><br>" \ |
37 | "<b>Fly</b> is somewhat different to SFCave and above. Instead, you have " \ | 39 | "<b>Fly</b> is somewhat different to SFCave and above. Instead, you have " \ |
38 | "are flying in the open air above a scrolling landscape, and the aim is to " \ | 40 | "are flying in the open air above a scrolling landscape, and the aim is to " \ |
39 | "hug the ground - the closer to the land you fly the more points " \ | 41 | "hug the ground - the closer to the land you fly the more points " \ |
40 | "scored.<br><br><br>" \ | 42 | "scored.<br><br><br>" \ |
41 | "Basic instruction - Press <b>Up</B> or <b>Down</b> on the circle pad to " \ | 43 | "Basic instruction - Press <b>Up</B> or <b>Down</b> on the circle pad to " \ |
42 | "start a new game, press the middle of the pad to apply thrust (makes you " \ | 44 | "start a new game, press the middle of the pad to apply thrust (makes you " \ |
43 | "go up), and release the pad to remove thrust and drop down.<br><br>" \ | 45 | "go up), and release the pad to remove thrust and drop down.<br><br>" \ |
44 | "Also, if playing the Fly game, you can press z to toggle the display " \ | 46 | "Also, if playing the Fly game, you can press z to toggle the display " \ |
45 | "of the scoring zones. This will display 4 red lines at varying heights " \ | 47 | "of the scoring zones. This will display 4 red lines at varying heights " \ |
46 | "above the landscape - if your ship falls into this zone, point are scored. " \ | 48 | "above the landscape - if your ship falls into this zone, point are scored. " \ |
@@ -50,30 +52,30 @@ | |||
50 | "To use, once you have crashed, press 'r' to replay the last game.<br>" \ | 52 | "To use, once you have crashed, press 'r' to replay the last game.<br>" \ |
51 | "To save the replay press 's'.<br>" \ | 53 | "To save the replay press 's'.<br>" \ |
52 | "To load a saved replay press 'l' (after you've crashed at least once).<br><br>" \ | 54 | "To load a saved replay press 'l' (after you've crashed at least once).<br><br>" \ |
53 | "Replays are currently saved to your home directory in a file called sfcave.replay." \ | 55 | "Replays are currently saved to your home directory in a file called sfcave.replay." \ |
54 | "This file can be copied and given to others as long as it it put in their home directory.<br><br>" \ | 56 | "This file can be copied and given to others as long as it it put in their home directory.<br><br>" \ |
55 | "Have lots of fun.<br>" \ | 57 | "Have lots of fun.<br>" \ |
56 | "Andy" \ | 58 | "Andy" \ |
57 | "</p></qt>" | 59 | "</p></qt>" |
58 | 60 | ||
59 | 61 | ||
60 | HelpWindow::HelpWindow( QWidget *parent, const char *name, bool modal, WFlags flags ) | 62 | HelpWindow::HelpWindow( QWidget *parent, const char *name, bool modal, WFlags flags ) |
61 | : QDialog( parent, name, modal, flags ) | 63 | : QDialog( parent, name, modal, flags ) |
62 | { | 64 | { |
63 | // resize( 230, 280 ); | 65 | // resize( 230, 280 ); |
64 | 66 | ||
65 | setCaption( "Help for SFCave" ); | 67 | setCaption( "Help for SFCave" ); |
66 | 68 | ||
67 | QVBoxLayout *layout = new QVBoxLayout( this ); | 69 | QVBoxLayout *layout = new QVBoxLayout( this ); |
68 | QString text = HELP_TEXT;; | 70 | QString text = HELP_TEXT;; |
69 | QTextView *view = new QTextView( text, 0, this, "view" ); | 71 | QTextView *view = new QTextView( text, 0, this, "view" ); |
70 | layout->insertSpacing( -1, 5 ); | 72 | layout->insertSpacing( -1, 5 ); |
71 | layout->insertWidget( -1, view ); | 73 | layout->insertWidget( -1, view ); |
72 | layout->insertSpacing( -1, 5 ); | 74 | layout->insertSpacing( -1, 5 ); |
73 | 75 | ||
74 | showMaximized(); | 76 | QPEApplication::showDialog( this ); |
75 | } | 77 | } |
76 | 78 | ||
77 | HelpWindow::~HelpWindow() | 79 | HelpWindow::~HelpWindow() |
78 | { | 80 | { |
79 | } | 81 | } |
diff --git a/noncore/games/tetrix/ohighscoredlg.cpp b/noncore/games/tetrix/ohighscoredlg.cpp index cf0dcf7..7581f51 100644 --- a/noncore/games/tetrix/ohighscoredlg.cpp +++ b/noncore/games/tetrix/ohighscoredlg.cpp | |||
@@ -1,43 +1,44 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | begin : January 2003 | 2 | begin : January 2003 |
3 | copyright : ( C ) 2003 by Carsten Niehaus | 3 | copyright : ( C ) 2003 by Carsten Niehaus |
4 | email : cniehaus@handhelds.org | 4 | email : cniehaus@handhelds.org |
5 | **************************************************************************/ | 5 | **************************************************************************/ |
6 | 6 | ||
7 | /*************************************************************************** | 7 | /*************************************************************************** |
8 | * * | 8 | * * |
9 | * This program is free software; you can redistribute it and/or modify * | 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 * | 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 * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * ( at your option ) any later version. * | 12 | * ( at your option ) any later version. * |
13 | * * | 13 | * * |
14 | **************************************************************************/ | 14 | **************************************************************************/ |
15 | 15 | ||
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qlayout.h> | 18 | #include <qlayout.h> |
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/qpeapplication.h> | ||
20 | 21 | ||
21 | #include <qstring.h> | 22 | #include <qstring.h> |
22 | #include <qhbox.h> | 23 | #include <qhbox.h> |
23 | #include <qvbox.h> | 24 | #include <qvbox.h> |
24 | #include <qlabel.h> | 25 | #include <qlabel.h> |
25 | #include <qlistview.h> | 26 | #include <qlistview.h> |
26 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
27 | 28 | ||
28 | #include "ohighscoredlg.h" | 29 | #include "ohighscoredlg.h" |
29 | 30 | ||
30 | OHighscore::OHighscore( int score , int playerLevel ) | 31 | OHighscore::OHighscore( int score , int playerLevel ) |
31 | { | 32 | { |
32 | pLevel = playerLevel; | 33 | pLevel = playerLevel; |
33 | getList(); | 34 | getList(); |
34 | checkIfItIsANewhighscore( score ); | 35 | checkIfItIsANewhighscore( score ); |
35 | } | 36 | } |
36 | 37 | ||
37 | OHighscore::~OHighscore() | 38 | OHighscore::~OHighscore() |
38 | { | 39 | { |
39 | std::list<t_playerData*>::iterator deleteIterator = playerData.begin(); | 40 | std::list<t_playerData*>::iterator deleteIterator = playerData.begin(); |
40 | for ( ; deleteIterator != playerData.end() ; deleteIterator++ ) | 41 | for ( ; deleteIterator != playerData.end() ; deleteIterator++ ) |
41 | { | 42 | { |
42 | delete ( *deleteIterator ); | 43 | delete ( *deleteIterator ); |
43 | } | 44 | } |
@@ -148,49 +149,49 @@ QString OHighscore::getName() | |||
148 | ed->setFocus ( ); | 149 | ed->setFocus ( ); |
149 | 150 | ||
150 | if ( d->exec() == QDialog::Accepted ) { | 151 | if ( d->exec() == QDialog::Accepted ) { |
151 | name = ed->text(); | 152 | name = ed->text(); |
152 | } | 153 | } |
153 | //delete d; | 154 | //delete d; |
154 | return name; | 155 | return name; |
155 | } | 156 | } |
156 | 157 | ||
157 | OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) | 158 | OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) |
158 | { | 159 | { |
159 | hs_ = highscore; | 160 | hs_ = highscore; |
160 | setCaption( tr( "Highscores" ) ); | 161 | setCaption( tr( "Highscores" ) ); |
161 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); | 162 | vbox_layout = new QVBoxLayout( this, 4 , 4 ); |
162 | list = new QListView( this ); | 163 | list = new QListView( this ); |
163 | list->setSorting( -1 ); | 164 | list->setSorting( -1 ); |
164 | list->addColumn( tr( "#" )); | 165 | list->addColumn( tr( "#" )); |
165 | list->addColumn( tr( "Name" )); | 166 | list->addColumn( tr( "Name" )); |
166 | list->addColumn( tr( "Points" )); | 167 | list->addColumn( tr( "Points" )); |
167 | list->addColumn( tr( "Level" )); | 168 | list->addColumn( tr( "Level" )); |
168 | 169 | ||
169 | createHighscoreListView(); | 170 | createHighscoreListView(); |
170 | 171 | ||
171 | vbox_layout->addWidget( list ); | 172 | vbox_layout->addWidget( list ); |
172 | showMaximized(); | 173 | QPEApplication::showDialog( this ); |
173 | } | 174 | } |
174 | 175 | ||
175 | void OHighscoreDialog::createHighscoreListView() | 176 | void OHighscoreDialog::createHighscoreListView() |
176 | { | 177 | { |
177 | int pos = 10; | 178 | int pos = 10; |
178 | int points_ = 0; | 179 | int points_ = 0; |
179 | int level_ = 0; | 180 | int level_ = 0; |
180 | 181 | ||
181 | std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin(); | 182 | std::list<t_playerData*>::reverse_iterator iListe = hs_->playerData.rbegin(); |
182 | 183 | ||
183 | for ( ; iListe != hs_->playerData.rend() ; ++iListe ) | 184 | for ( ; iListe != hs_->playerData.rend() ; ++iListe ) |
184 | { | 185 | { |
185 | QListViewItem *item = new QListViewItem( list ); | 186 | QListViewItem *item = new QListViewItem( list ); |
186 | item->setText( 0 , QString::number( pos ) ); //number | 187 | item->setText( 0 , QString::number( pos ) ); //number |
187 | item->setText( 1 , ( *iListe )->sName ); //name | 188 | item->setText( 1 , ( *iListe )->sName ); //name |
188 | if ( ( *iListe )->points == -1 ) | 189 | if ( ( *iListe )->points == -1 ) |
189 | points_ = 0; | 190 | points_ = 0; |
190 | else points_ = ( *iListe )->points; | 191 | else points_ = ( *iListe )->points; |
191 | if ( ( *iListe )->level == -1 ) | 192 | if ( ( *iListe )->level == -1 ) |
192 | level_ = 0; | 193 | level_ = 0; |
193 | else level_ = ( *iListe )->level; | 194 | else level_ = ( *iListe )->level; |
194 | item->setText( 2 , QString::number( points_ ) ); //points | 195 | item->setText( 2 , QString::number( points_ ) ); //points |
195 | item->setText( 3 , QString::number( level_ ) ); //level | 196 | item->setText( 3 , QString::number( level_ ) ); //level |
196 | pos--; | 197 | pos--; |
diff --git a/noncore/games/tictac/tictac.cpp b/noncore/games/tictac/tictac.cpp index 4954ba4..9de3b58 100644 --- a/noncore/games/tictac/tictac.cpp +++ b/noncore/games/tictac/tictac.cpp | |||
@@ -42,49 +42,49 @@ void TicTacButton::drawButtonLabel( QPainter *p ) | |||
42 | { | 42 | { |
43 | QRect r = rect(); | 43 | QRect r = rect(); |
44 | p->setPen( QPen( white,2 ) ); // set fat pen | 44 | p->setPen( QPen( white,2 ) ); // set fat pen |
45 | if ( t == Circle ) { | 45 | if ( t == Circle ) { |
46 | p->drawEllipse( r.left()+4, r.top()+4, r.width()-8, r.height()-8 ); | 46 | p->drawEllipse( r.left()+4, r.top()+4, r.width()-8, r.height()-8 ); |
47 | } else if ( t == Cross ) { // draw cross | 47 | } else if ( t == Cross ) { // draw cross |
48 | p->drawLine( r.topLeft() +QPoint(4,4), r.bottomRight()-QPoint(4,4)); | 48 | p->drawLine( r.topLeft() +QPoint(4,4), r.bottomRight()-QPoint(4,4)); |
49 | p->drawLine( r.bottomLeft()+QPoint(4,-4),r.topRight() -QPoint(4,-4)); | 49 | p->drawLine( r.bottomLeft()+QPoint(4,-4),r.topRight() -QPoint(4,-4)); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | //*************************************************************************** | 54 | //*************************************************************************** |
55 | //* TicTacGameBoard member functions | 55 | //* TicTacGameBoard member functions |
56 | //*************************************************************************** | 56 | //*************************************************************************** |
57 | 57 | ||
58 | // -------------------------------------------------------------------------- | 58 | // -------------------------------------------------------------------------- |
59 | // Creates a game board with N x N buttons and connects the "clicked()" | 59 | // Creates a game board with N x N buttons and connects the "clicked()" |
60 | // signal of all buttons to the "buttonClicked()" slot. | 60 | // signal of all buttons to the "buttonClicked()" slot. |
61 | // | 61 | // |
62 | 62 | ||
63 | TicTacGameBoard::TicTacGameBoard( int n, QWidget *parent, const char *name ) | 63 | TicTacGameBoard::TicTacGameBoard( int n, QWidget *parent, const char *name ) |
64 | : QWidget( parent, name ) | 64 | : QWidget( parent, name ) |
65 | { | 65 | { |
66 | showMaximized(); | 66 | QPEApplication::showWidget( this ); |
67 | st = Init; // initial state | 67 | st = Init; // initial state |
68 | nBoard = n; | 68 | nBoard = n; |
69 | n *= n; // make square | 69 | n *= n; // make square |
70 | comp_starts = FALSE; // human starts | 70 | comp_starts = FALSE; // human starts |
71 | buttons = new TicTacButtons(n); // create real buttons | 71 | buttons = new TicTacButtons(n); // create real buttons |
72 | btArray = new TicTacArray(n); // create button model | 72 | btArray = new TicTacArray(n); // create button model |
73 | QGridLayout * grid = new QGridLayout( this, 3, 3, 4 ); | 73 | QGridLayout * grid = new QGridLayout( this, 3, 3, 4 ); |
74 | QPalette p( blue ); | 74 | QPalette p( blue ); |
75 | for ( int i=0; i<n; i++ ) { // create and connect buttons | 75 | for ( int i=0; i<n; i++ ) { // create and connect buttons |
76 | TicTacButton *ttb = new TicTacButton( this ); | 76 | TicTacButton *ttb = new TicTacButton( this ); |
77 | ttb->setPalette( p ); | 77 | ttb->setPalette( p ); |
78 | ttb->setEnabled( FALSE ); | 78 | ttb->setEnabled( FALSE ); |
79 | connect( ttb, SIGNAL(clicked()), SLOT(buttonClicked()) ); | 79 | connect( ttb, SIGNAL(clicked()), SLOT(buttonClicked()) ); |
80 | grid->addWidget( ttb, i%3, i/3 ); | 80 | grid->addWidget( ttb, i%3, i/3 ); |
81 | buttons->insert( i, ttb ); | 81 | buttons->insert( i, ttb ); |
82 | btArray->at(i) = TicTacButton::Blank; // initial button type | 82 | btArray->at(i) = TicTacButton::Blank; // initial button type |
83 | } | 83 | } |
84 | QTime t = QTime::currentTime(); // set random seed | 84 | QTime t = QTime::currentTime(); // set random seed |
85 | srand( t.hour()*12+t.minute()*60+t.second()*60 ); | 85 | srand( t.hour()*12+t.minute()*60+t.second()*60 ); |
86 | } | 86 | } |
87 | 87 | ||
88 | TicTacGameBoard::~TicTacGameBoard() | 88 | TicTacGameBoard::~TicTacGameBoard() |
89 | { | 89 | { |
90 | delete buttons; | 90 | delete buttons; |
@@ -312,49 +312,49 @@ TicTacToe::TicTacToe( QWidget *parent, const char *name, WFlags fl ) | |||
312 | 312 | ||
313 | QFrame *line = new QFrame( this ); | 313 | QFrame *line = new QFrame( this ); |
314 | line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 314 | line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
315 | l->addWidget( line ); | 315 | l->addWidget( line ); |
316 | 316 | ||
317 | // Create the combo box for deciding who should start, and | 317 | // Create the combo box for deciding who should start, and |
318 | // connect its clicked() signals to the buttonClicked() slot | 318 | // connect its clicked() signals to the buttonClicked() slot |
319 | 319 | ||
320 | whoStarts = new QComboBox( this ); | 320 | whoStarts = new QComboBox( this ); |
321 | whoStarts->insertItem( tr( "Computer starts" ) ); | 321 | whoStarts->insertItem( tr( "Computer starts" ) ); |
322 | whoStarts->insertItem( tr( "Human starts" ) ); | 322 | whoStarts->insertItem( tr( "Human starts" ) ); |
323 | l->addWidget( whoStarts ); | 323 | l->addWidget( whoStarts ); |
324 | 324 | ||
325 | // Create the push buttons and connect their clicked() signals | 325 | // Create the push buttons and connect their clicked() signals |
326 | // to this right slots. | 326 | // to this right slots. |
327 | 327 | ||
328 | newGame = new QPushButton( tr( "Play!" ), this ); | 328 | newGame = new QPushButton( tr( "Play!" ), this ); |
329 | connect( newGame, SIGNAL(clicked()), SLOT(newGameClicked()) ); | 329 | connect( newGame, SIGNAL(clicked()), SLOT(newGameClicked()) ); |
330 | quit = new QPushButton( tr( "Quit" ), this ); | 330 | quit = new QPushButton( tr( "Quit" ), this ); |
331 | connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) ); | 331 | connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) ); |
332 | QHBoxLayout * b = new QHBoxLayout; | 332 | QHBoxLayout * b = new QHBoxLayout; |
333 | l->addLayout( b ); | 333 | l->addLayout( b ); |
334 | b->addWidget( newGame ); | 334 | b->addWidget( newGame ); |
335 | b->addWidget( quit ); | 335 | b->addWidget( quit ); |
336 | showMaximized(); | 336 | QPEApplication::showWidget( this ); |
337 | newState(); | 337 | newState(); |
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | // -------------------------------------------------------------------------- | 341 | // -------------------------------------------------------------------------- |
342 | // TicTacToe::newGameClicked() - SLOT | 342 | // TicTacToe::newGameClicked() - SLOT |
343 | // | 343 | // |
344 | // This slot is activated when the new game button is clicked. | 344 | // This slot is activated when the new game button is clicked. |
345 | // | 345 | // |
346 | 346 | ||
347 | void TicTacToe::newGameClicked() | 347 | void TicTacToe::newGameClicked() |
348 | { | 348 | { |
349 | board->computerStarts( whoStarts->currentItem() == 0 ); | 349 | board->computerStarts( whoStarts->currentItem() == 0 ); |
350 | board->newGame(); | 350 | board->newGame(); |
351 | newState(); | 351 | newState(); |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | // -------------------------------------------------------------------------- | 355 | // -------------------------------------------------------------------------- |
356 | // TicTacToe::gameOver() - SLOT | 356 | // TicTacToe::gameOver() - SLOT |
357 | // | 357 | // |
358 | // This slot is activated when the TicTacGameBoard emits the signal | 358 | // This slot is activated when the TicTacGameBoard emits the signal |
359 | // "finished()", i.e. when a player has won or when it is a draw. | 359 | // "finished()", i.e. when a player has won or when it is a draw. |
360 | // | 360 | // |