-rw-r--r-- | noncore/games/backgammon/backgammon.cpp | 3 | ||||
-rw-r--r-- | noncore/games/backgammon/filedialog.cpp | 4 | ||||
-rw-r--r-- | noncore/games/backgammon/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/backgammon/moveengine.cpp | 1 | ||||
-rw-r--r-- | noncore/games/backgammon/themedialog.cpp | 2 |
5 files changed, 0 insertions, 11 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp index e9e5467..51020a0 100644 --- a/noncore/games/backgammon/backgammon.cpp +++ b/noncore/games/backgammon/backgammon.cpp @@ -1,63 +1,60 @@ #include "backgammon.h" #include "aidialog.h" #include "filedialog.h" #include "playerdialog.h" #include "rulesdialog.h" #include "themedialog.h" -#include <qdatetime.h> #include <qfile.h> #include <qlayout.h> #include <qmessagebox.h> -#include <qstring.h> #include <qtimer.h> -#include <qmainwindow.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qmenubar.h> #include <qpe/resource.h> #include <stdlib.h> BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { if (!name) setName("BackGammon"); setCaption(tr( "Backgammon") ); setIcon( Resource::loadPixmap( "backgammon" ) ); //general counter varaible int a=0; //the game engine move=new MoveEngine(); //load the default theme Config conf("backgammon"); if(!conf.isValid()) { qDebug("config file does not exist"); conf.setGroup("general"); conf.writeEntry("theme","default"); conf.setGroup("rules"); conf.writeEntry("move_with_pieces_out",false); conf.writeEntry("nice_dice",false); conf.setGroup("display"); conf.writeEntry("small",false); conf.writeEntry("warning",true); conf.setGroup("ai"); conf.writeEntry("rescue",6); conf.writeEntry("eliminate",4); conf.writeEntry("expose",1); conf.writeEntry("protect",5); conf.writeEntry("safe",3); conf.writeEntry("empty",2); } conf.setGroup("general"); theme_name=conf.readEntry("theme","default"); QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; //the rules conf.setGroup("rules"); rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); diff --git a/noncore/games/backgammon/filedialog.cpp b/noncore/games/backgammon/filedialog.cpp index a5e71c9..e0a2914 100644 --- a/noncore/games/backgammon/filedialog.cpp +++ b/noncore/games/backgammon/filedialog.cpp @@ -1,55 +1,51 @@ #include "filedialog.h"
#include <qdir.h>
-#include <qfileinfo.h>
-#include <qmessagebox.h>
-#include <qpixmap.h>
-#include <qpushbutton.h>
#include <qpe/qpeapplication.h>
FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f)
:QDialog(parent,name,modal,f)
{
setCaption(header);
ext=extension;
dirselector=new QListView(this);
dirselector->setGeometry(1,10,235,200);
dirselector->addColumn("Files");
connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*)));
getCurrentDir();
file_name="user";
fileinput=new QLineEdit(file_name,this);
fileinput->setGeometry(1,220,235,20);
QPEApplication::showDialog( this );
}
FileDialog::~FileDialog()
{}
void FileDialog::selectorclicked(QListViewItem* entry)
{
if(entry==NULL)
return;
file_name=entry->text(0);
fileinput->setText(file_name);
}
void FileDialog::getCurrentDir()
{
dirselector->clear();
QDir dir(QPEApplication::qpeDir()+"/backgammon");
dir.setFilter(QDir::Files);
QFileInfoListIterator it(*(dir.entryInfoList()));
QFileInfo* fi;
int ext_length=ext.length();
while((fi=it.current())) // go through all file and subdirs
{
QString file=fi->fileName();
if(file.right(ext_length)==ext && file)
{
file=file.left(file.length()-ext_length);
diff --git a/noncore/games/backgammon/main.cpp b/noncore/games/backgammon/main.cpp index 58ced10..6316040 100644 --- a/noncore/games/backgammon/main.cpp +++ b/noncore/games/backgammon/main.cpp @@ -1,8 +1,7 @@ -#include <qpe/qpeapplication.h> #include "backgammon.h" #include <opie/oapplicationfactory.h> OPIE_EXPORT_APP( OApplicationFactory<BackGammon> ) diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp index 37b73a6..7de7147 100644 --- a/noncore/games/backgammon/moveengine.cpp +++ b/noncore/games/backgammon/moveengine.cpp @@ -1,51 +1,50 @@ #include "moveengine.h" -#include <qmessagebox.h> #include <qtimer.h> #include <stdlib.h> MoveEngine::MoveEngine() : QObject() { int offset=7; int a=0; //counter variable int xfill[]={210,185,170,155,140,125,110,85,70,55,40,25,10,10,25,40,55,70,85,110,125,140,155,170,185,210}; for(a=0;a<26;a++) { x_coord[a]=xfill[a]; } int yfill[]={10,25,40,55,70,10+offset,25+offset,40+offset,55+offset,25,40,55, 25+offset,40+offset,40}; int zfill[]={1,1,1,1,1,2,2,2,2,3,3,3,4,4,5}; for(a=0;a<15;a++) { yup_coord[a]=yfill[a]; ylow_coord[a]=185-(yfill[a]); z_coord[a]=zfill[a]; } for(a=0;a<5;a++) { if(a<3) { x_fin1[a]=65+a*15; x_fin2[a]=155-a*15; } y_fin[a]=225-a*5; } z_fin=1; reset(); } MoveEngine::~MoveEngine() {} void MoveEngine::position(Pieces& pieces,bool non_qte) { int player1_counter=0; int player2_counter=0; //non qte styles are smaller !! int offset=(non_qte) ? 5 : 0; for(int a=0;a<28;a++) diff --git a/noncore/games/backgammon/themedialog.cpp b/noncore/games/backgammon/themedialog.cpp index f342381..afd6a1b 100644 --- a/noncore/games/backgammon/themedialog.cpp +++ b/noncore/games/backgammon/themedialog.cpp @@ -1,54 +1,52 @@ #include "themedialog.h" #include <qdir.h> -#include <qfileinfo.h> #include <qlabel.h> -#include <qpushbutton.h> #include <qpe/qpeapplication.h> ThemeDialog::ThemeDialog(QWidget* parent,const char* name,bool modal,WFlags f) :QDialog(parent,name,modal,f) { setCaption("Theme Dialog"); QLabel* labelname=new QLabel("name",this); labelname->setGeometry(0,5,40,20); lineName=new QLineEdit("user",this); lineName->setGeometry(40,5,195,20); QLabel* labelboard=new QLabel("board",this); labelboard->setGeometry(0,30,40,20); boxboard=new QComboBox(this,""); boxboard->setGeometry(40,30,195,20); fillBox("boards",boxboard); QLabel* labelpiecesA=new QLabel("pieces1",this); labelpiecesA->setGeometry(0,70,40,20); boxpiecesA=new QComboBox(this); boxpiecesA->setGeometry(40,70,195,20); fillBox("pieces",boxpiecesA); QLabel* labelpiecesB=new QLabel("pieces2",this); labelpiecesB->setGeometry(0,95,40,20); boxpiecesB=new QComboBox(this); boxpiecesB->setGeometry(40,95,195,20); fillBox("pieces",boxpiecesB); QLabel* labeldiceA=new QLabel("dice1",this); labeldiceA->setGeometry(0,135,40,20); boxdiceA=new QComboBox(this); boxdiceA->setGeometry(40,135,195,20); fillBox("dice",boxdiceA); QLabel* labeldiceB=new QLabel("dice2",this); labeldiceB->setGeometry(0,160,40,20); boxdiceB=new QComboBox(this); boxdiceB->setGeometry(40,160,195,20); fillBox("dice",boxdiceB); QLabel* labelodds=new QLabel("odds",this); labelodds->setGeometry(0,200,40,20); boxodds=new QComboBox(this); boxodds->setGeometry(40,200,195,20); fillBox("odds",boxodds); boxodds->setEnabled(false); |