Commit 326bfdf4 authored by Stephan Kulow's avatar Stephan Kulow
Browse files

merging kde4 back in trunk

svn path=/trunk/KDE/kdegames/lskat/; revision=439536
parents 1fdbd073 61f6de9a
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "KChildConnect.h" #include "KChildConnect.h"
#include "KChildConnect.moc" #include "KChildConnect.moc"
//Added by qt3to4:
#include <Q3CString>
KChildConnect::KChildConnect() KChildConnect::KChildConnect()
: QObject(0,0) : QObject(0,0)
...@@ -40,12 +42,12 @@ bool KChildConnect::SendMsg(KEMessage *msg) ...@@ -40,12 +42,12 @@ bool KChildConnect::SendMsg(KEMessage *msg)
{ {
QString sendstring=msg->ToString(); QString sendstring=msg->ToString();
// Debug only // Debug only
if (msg->HasKey(QCString("KLogSendMsg"))) if (msg->HasKey(Q3CString("KLogSendMsg")))
{ {
char *p; char *p;
int size; int size;
FILE *fp; FILE *fp;
msg->GetData(QCString("KLogSendMsg"),p,size); msg->GetData(Q3CString("KLogSendMsg"),p,size);
if (p && (fp=fopen(p,"a")) ) if (p && (fp=fopen(p,"a")) )
{ {
fprintf(fp,"------------------------------------\n"); fprintf(fp,"------------------------------------\n");
...@@ -60,7 +62,7 @@ bool KChildConnect::SendMsg(KEMessage *msg) ...@@ -60,7 +62,7 @@ bool KChildConnect::SendMsg(KEMessage *msg)
// Send string to parent // Send string to parent
bool KChildConnect::Send(QString str) bool KChildConnect::Send(QString str)
{ {
if (!str || str.length()<1) return true; // no need to send crap if (!str.isNull() || str.length()<1) return true; // no need to send crap
printf("%s",str.latin1()); printf("%s",str.latin1());
fflush(stdout); fflush(stdout);
return true; return true;
...@@ -104,7 +106,7 @@ void KChildConnect::Receive(QString input) ...@@ -104,7 +106,7 @@ void KChildConnect::Receive(QString input)
char *it; char *it;
for (it=inputcache.first();it!=0;it=inputcache.next()) for (it=inputcache.first();it!=0;it=inputcache.next())
{ {
msg->AddString(QCString(it)); msg->AddString(Q3CString(it));
} }
// printf("+- CHILDprocess:: GOT MESSAGE::Emmiting slotReceiveMsg\n"); // printf("+- CHILDprocess:: GOT MESSAGE::Emmiting slotReceiveMsg\n");
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#define _KCHILDCONNECT_H_ #define _KCHILDCONNECT_H_
#include <qobject.h> #include <qobject.h>
#include <qstrlist.h> #include <q3strlist.h>
#include "KEMessage.h" #include "KEMessage.h"
...@@ -19,7 +19,7 @@ class KChildConnect: public QObject ...@@ -19,7 +19,7 @@ class KChildConnect: public QObject
Q_OBJECT Q_OBJECT
protected: protected:
QStrList inputcache; Q3StrList inputcache;
bool input_pending; bool input_pending;
QString inputbuffer; QString inputbuffer;
int ID; int ID;
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "KEMessage.h" #include "KEMessage.h"
//Added by qt3to4:
#include <Q3StrList>
#include <Q3CString>
void KEMessage::AddEntry(QString key,KMessageEntry *entry) void KEMessage::AddEntry(QString key,KMessageEntry *entry)
{ {
...@@ -129,7 +132,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry) ...@@ -129,7 +132,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry)
int size,i; int size,i;
KGM_TYPE type; KGM_TYPE type;
char *data; char *data;
s=QCString(""); s=Q3CString("");
if (!entry) return s; if (!entry) return s;
size=entry->QuerySize(); size=entry->QuerySize();
type=entry->QueryType(); type=entry->QueryType();
...@@ -142,7 +145,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry) ...@@ -142,7 +145,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry)
size,KEMESSAGE_SEP, size,KEMESSAGE_SEP,
(int)type,KEMESSAGE_SEP); (int)type,KEMESSAGE_SEP);
*/ */
tmp=QCString(key); tmp=Q3CString(key);
s+=tmp; s+=tmp;
s+=KEMESSAGE_SEP; s+=KEMESSAGE_SEP;
tmp.sprintf("%d",size); tmp.sprintf("%d",size);
...@@ -226,7 +229,7 @@ QString KEMessage::ToString() ...@@ -226,7 +229,7 @@ QString KEMessage::ToString()
s=KEMESSAGE_HEAD+KEMESSAGE_CR; s=KEMESSAGE_HEAD+KEMESSAGE_CR;
for (it=keys.first();it!=0;it=keys.next()) for (it=keys.first();it!=0;it=keys.next())
{ {
entry=dict.find(QCString(it)); entry=dict.find(Q3CString(it));
s+=EntryToString(it,entry); s+=EntryToString(it,entry);
} }
s+=KEMESSAGE_TAIL+KEMESSAGE_CR; s+=KEMESSAGE_TAIL+KEMESSAGE_CR;
...@@ -239,7 +242,7 @@ bool KEMessage::AddString(QString s) ...@@ -239,7 +242,7 @@ bool KEMessage::AddString(QString s)
QString key; QString key;
KMessageEntry *entry=new KMessageEntry; KMessageEntry *entry=new KMessageEntry;
key=StringToEntry(s,entry); key=StringToEntry(s,entry);
if (!key) return false; if (!key.isNull()) return false;
AddEntry(key,entry); AddEntry(key,entry);
return true; return true;
} }
...@@ -287,7 +290,7 @@ uint KEMessage::QueryNumberOfKeys() ...@@ -287,7 +290,7 @@ uint KEMessage::QueryNumberOfKeys()
{ {
return keys.count(); return keys.count();
} }
QStrList *KEMessage::QueryKeys() Q3StrList *KEMessage::QueryKeys()
{ {
return &keys; return &keys;
} }
...@@ -315,10 +318,10 @@ KEMessage &KEMessage::operator=(KEMessage &msg) ...@@ -315,10 +318,10 @@ KEMessage &KEMessage::operator=(KEMessage &msg)
// printf("Assigning = KEMessage from %p to %p\n",&msg,this); // printf("Assigning = KEMessage from %p to %p\n",&msg,this);
for (it=msg.keys.first();it!=0;it=msg.keys.next()) for (it=msg.keys.first();it!=0;it=msg.keys.next())
{ {
entry=msg.dict.find(QCString(it)); entry=msg.dict.find(Q3CString(it));
newentry=new KMessageEntry; newentry=new KMessageEntry;
*newentry=*entry; *newentry=*entry;
AddEntry(QCString(it),newentry); AddEntry(Q3CString(it),newentry);
} }
// return *newmsg; // return *newmsg;
......
...@@ -19,25 +19,25 @@ ...@@ -19,25 +19,25 @@
#include <string.h> #include <string.h>
#include <qstring.h> #include <qstring.h>
#include <qstrlist.h> #include <q3strlist.h>
#include <qdict.h> #include <q3dict.h>
#include "KMessageEntry.h" #include "KMessageEntry.h"
#define KEMESSAGE_HEAD QString(QCString("BEGIN_V1000")) #define KEMESSAGE_HEAD QString(Q3CString("BEGIN_V1000"))
#define KEMESSAGE_TAIL QString(QCString("END_V1000")) #define KEMESSAGE_TAIL QString(Q3CString("END_V1000"))
#define KEMESSAGE_CR QString(QCString("\n")) #define KEMESSAGE_CR QString(Q3CString("\n"))
#define KEMESSAGE_SEP QString(QCString(":::")) #define KEMESSAGE_SEP QString(Q3CString(":::"))
class KEMessage class KEMessage
{ {
private: private:
QStrList keys; Q3StrList keys;
QDict<KMessageEntry> dict; Q3Dict<KMessageEntry> dict;
protected: protected:
void AddEntry(QString key,KMessageEntry *entry); void AddEntry(QString key,KMessageEntry *entry);
public: public:
QStrList *QueryKeys(); Q3StrList *QueryKeys();
uint QueryNumberOfKeys(); uint QueryNumberOfKeys();
void AddDataType(QString key,int size,const char *data,KGM_TYPE type); void AddDataType(QString key,int size,const char *data,KGM_TYPE type);
void AddData(QString key,short data); void AddData(QString key,short data);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <qstring.h> #include <qstring.h>
#include <Q3CString>
#include "KInputChildProcess.h" #include "KInputChildProcess.h"
#include "KInputChildProcess.moc" #include "KInputChildProcess.moc"
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "lskatproc.h" #include "lskatproc.h"
//Added by qt3to4:
#include <Q3CString>
#define MIN_TIME 1000 // usec #define MIN_TIME 1000 // usec
...@@ -379,17 +381,17 @@ short x,y; ...@@ -379,17 +381,17 @@ short x,y;
SendDebug("Receiv Msg"); SendDebug("Receiv Msg");
// end of process // end of process
if (msg->HasKey(QCString("Terminate"))) if (msg->HasKey(Q3CString("Terminate")))
{ {
Terminate(); Terminate();
} }
// Init of process // Init of process
if (msg->HasKey(QCString("Init"))) if (msg->HasKey(Q3CString("Init")))
{ {
// No init necessary // No init necessary
} }
// Make a move // Make a move
if (msg->HasKey(QCString("Cards"))) if (msg->HasKey(Q3CString("Cards")))
{ {
SendDebug("Process HasKey(Cards)"); SendDebug("Process HasKey(Cards)");
// new game object // new game object
...@@ -422,9 +424,9 @@ short x,y; ...@@ -422,9 +424,9 @@ short x,y;
// report move // report move
msg->RemoveAll(); msg->RemoveAll();
msg->AddData(QCString("Move"),game.currentplayer); msg->AddData(Q3CString("Move"),game.currentplayer);
msg->AddData(QCString("MoveX"),x); msg->AddData(Q3CString("MoveX"),x);
msg->AddData(QCString("MoveY"),y); msg->AddData(Q3CString("MoveY"),y);
//timee=time(0); //timee=time(0);
// Sleep a minimum amount to slow down moves // Sleep a minimum amount to slow down moves
...@@ -451,29 +453,29 @@ int lgame::ExtractGame(KEMessage *msg) ...@@ -451,29 +453,29 @@ int lgame::ExtractGame(KEMessage *msg)
char *p; char *p;
int size; int size;
msg->GetData(QCString("Startplayer"),startplayer); msg->GetData(Q3CString("Startplayer"),startplayer);
msg->GetData(QCString("CurrentPlayer"),currentplayer); msg->GetData(Q3CString("CurrentPlayer"),currentplayer);
msg->GetData(QCString("Cards"),p,size); msg->GetData(Q3CString("Cards"),p,size);
msg->GetData(QCString("Level"),level); msg->GetData(Q3CString("Level"),level);
level--; // start with level 0 level--; // start with level 0
for (i=0;i<NO_OF_CARDS;i++) for (i=0;i<NO_OF_CARDS;i++)
{ {
card[i]=((int *)p)[i]; card[i]=((int *)p)[i];
} }
msg->GetData(QCString("Height"),p,size); msg->GetData(Q3CString("Height"),p,size);
for (i=0;i<NO_OF_TILES;i++) for (i=0;i<NO_OF_TILES;i++)
{ {
cardheight[i]=((int *)p)[i]; cardheight[i]=((int *)p)[i];
} }
msg->GetData(QCString("Trump"),tmp); msg->GetData(Q3CString("Trump"),tmp);
trump=(CCOLOUR)tmp; trump=(CCOLOUR)tmp;
short mm; short mm;
msg->GetData(QCString("CurrentMove"),mm); msg->GetData(Q3CString("CurrentMove"),mm);
curmove[1-currentplayer]=(int)mm; curmove[1-currentplayer]=(int)mm;
curmove[currentplayer]=-1; curmove[currentplayer]=-1;
msg->GetData(QCString("No"),movenumber); msg->GetData(Q3CString("No"),movenumber);
msg->GetData(QCString("Sc1"),score[0]); msg->GetData(Q3CString("Sc1"),score[0]);
msg->GetData(QCString("Sc2"),score[1]); msg->GetData(Q3CString("Sc2"),score[1]);
return 1; return 1;
} }
...@@ -586,7 +588,7 @@ int lskatproc::GetComputerMove(lgame game,short &x,short &y,int rek) ...@@ -586,7 +588,7 @@ int lskatproc::GetComputerMove(lgame game,short &x,short &y,int rek)
void lskatproc::SendDebug(const char *s) void lskatproc::SendDebug(const char *s)
{ {
KEMessage *msg=new KEMessage; KEMessage *msg=new KEMessage;
msg->AddData(QCString("Debug"),s); msg->AddData(Q3CString("Debug"),s);
// msg->AddData("KLogSendMsg","debug.log"); // msg->AddData("KLogSendMsg","debug.log");
// DEBUG // DEBUG
// SendMsg(msg); // SendMsg(msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment