[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: patch for ksirtet
From: Nicolas HADACEK <azhyd () free ! fr>
Date: 2000-08-31 21:16:27
[Download RAW message or body]
Hi,
a (big) patch for ksirtet : it includes the previous patch I sent to the
list (which was not applied) and some more bug fix.
eventually review and apply ...
cu,
Nicolas
["ksirtet_diff_2.0_b" (TEXT/PLAIN)]
Index: CHANGELOG
===================================================================
RCS file: /home/kde/kdegames/ksirtet/CHANGELOG,v
retrieving revision 1.29
diff -u -r1.29 CHANGELOG
--- CHANGELOG 2000/06/19 19:32:07 1.29
+++ CHANGELOG 2000/08/31 21:10:57
@@ -1,3 +1,14 @@
+2.0.4
+ * fixed behaviour of button in highscores dialog when entering the winne name
+ [proposed by Lotta Inkovaara]
+ * fixed repaint problems of piece shadow [some flicker added though]
+ * keys bindings should be now saved [due to some obscure bug in
+ kdelibs/kaccel ; thanks to Chris ?]
+
+2.0.3
+ * use of KMainWindow + interception of LayoutHint events to fix the resize
+ problems ...
+
2.0.2
* versioning the XMLGUI files
* removed (unstandard) title in dialogs
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdegames/ksirtet/Makefile.am,v
retrieving revision 1.44
diff -u -r1.44 Makefile.am
--- Makefile.am 2000/08/14 10:36:58 1.44
+++ Makefile.am 2000/08/31 21:10:57
@@ -28,4 +28,3 @@
messages: rc.cpp
$(EXTRACTRC) */*.rc >> rc.cpp
$(XGETTEXT) *.cpp *.h -o $(podir)/ksirtet.pot
-
Index: README
===================================================================
RCS file: /home/kde/kdegames/ksirtet/README,v
retrieving revision 1.16
diff -u -r1.16 README
--- README 2000/05/10 18:54:29 1.16
+++ README 2000/08/31 21:10:57
@@ -1,4 +1,4 @@
-KSIRTET : the KDE tetris clone
+KSIRTET : the KDE tetris clone
KFOULEGGS : the KDE puyopuyo clone
----------------------------------
Copyright (c) 1995 Eirik ENG
Index: TODO
===================================================================
RCS file: /home/kde/kdegames/ksirtet/TODO,v
retrieving revision 1.23
diff -u -r1.23 TODO
--- TODO 2000/06/19 19:32:07 1.23
+++ TODO 2000/08/31 21:10:57
@@ -4,8 +4,8 @@
* better game board - additionnal infos
* background image + more animations
* multiplayers highscore (increment scores for multiple plays)
- * global highscore (for a computer + for the world ?)
- * solve the double ui.rc file hack
+ * global highscore (for a computer ?)
+ * solve the double ui.rc files hack
* pause when highscores dialog is asked
* key profiles (?)
* ai configuration dialog is not cute when resized (...)
@@ -23,6 +23,6 @@
KNOWN BUGS:
* standard (ie menu) actions keybindings are not configurable with dialog
- * repaint bug in shadow (if the window is hidden then reshown)
- * occasional segfault in multiplayer wizard
-
+ * flicker in shadow
+ * occasional segfault in multiplayer wizard / with keybinding changes
+ * a strange bar under the menu ...
Index: board.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/board.h,v
retrieving revision 1.26
diff -u -r1.26 board.h
--- board.h 2000/06/15 18:04:08 1.26
+++ board.h 2000/08/31 21:10:58
@@ -108,7 +108,7 @@
void _afterRemove(bool first);
void startTimer();
void showNextPiece(bool show) { emit showNextPieceSignal(!show); }
- void showPieceConfig(bool show) { emit showPieceConfigSignal(!show); }
+ void showPieceConfig(bool show) { emit showPieceConfigSignal(show); }
void showBoard(bool show);
void showCanvas(QCanvas *c, bool show);
Index: dialogs.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/dialogs.cpp,v
retrieving revision 1.24
diff -u -r1.24 dialogs.cpp
--- dialogs.cpp 2000/06/19 19:32:07 1.24
+++ dialogs.cpp 2000/08/31 21:10:59
@@ -129,7 +129,6 @@
qle->setMinimumSize(qle->fontMetrics().maxWidth()*10,
qle->sizeHint().height());
qle->setFocus();
- connect(qle, SIGNAL(returnPressed()), SLOT(writeName()));
gl->addWidget(qle, j+1, 1);
}
@@ -149,28 +148,25 @@
/* button */
enableButtonSeparator(TRUE);
- if (goi) enableButton(Close, FALSE);
+ if (goi) setButtonText(Close, i18n("Set name"));
+ _close = !goi;
}
-void HighScores::writeName()
-{
- KConfig *conf = kapp->config();
- conf->setGroup(HS_GRP);
- QString str = qle->text();
- if ( str.length() ) conf->writeEntry(HSName(bEntry), str);
- conf->sync();
- str = conf->readEntry(HSName(bEntry));
- qle->setText(str);
- enableButton(Close, TRUE);
-}
-
void HighScores::reject()
{
- if ( qle && qle->isEnabled() ) {
- qle->setEnabled(FALSE);
- focusNextPrevChild(TRUE); // sort of hack (wonder why its call in
- // setEnabled(FALSE) does nothing ...)
- } else KDialogBase::reject();
+ if (_close) KDialogBase::reject();
+ else {
+ KConfig *conf = kapp->config();
+ conf->setGroup(HS_GRP);
+ QString str = qle->text();
+ if ( str.length() ) conf->writeEntry(HSName(bEntry), str);
+ conf->sync();
+ str = conf->readEntry(HSName(bEntry));
+ qle->setText(str);
+ qle->setEnabled(false);
+ setButtonText(Close, i18n("Close"));
+ _close = true;
+ }
}
//-----------------------------------------------------------------------------
Index: dialogs.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/dialogs.h,v
retrieving revision 1.14
diff -u -r1.14 dialogs.h
--- dialogs.h 2000/06/15 18:04:08 1.14
+++ dialogs.h 2000/08/31 21:10:59
@@ -23,11 +23,11 @@
private slots:
void reject();
- void writeName();
private:
int bEntry;
QLineEdit *qle;
+ bool _close;
static uint nbEntries();
};
Index: fe_main.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/fe_main.cpp,v
retrieving revision 1.3
diff -u -r1.3 fe_main.cpp
--- fe_main.cpp 2000/04/03 22:06:49 1.3
+++ fe_main.cpp 2000/08/31 21:10:59
@@ -41,5 +41,5 @@
int main(int argc, char **argv)
{
return generic_main(argc, argv, "kfouleggs", I18N_NOOP("KFoulEggs"),
- FE_DESCRIPTION, TRUE);
+ FE_DESCRIPTION);
}
Index: field.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/field.cpp,v
retrieving revision 1.30
diff -u -r1.30 field.cpp
--- field.cpp 2000/06/15 18:04:08 1.30
+++ field.cpp 2000/08/31 21:10:59
@@ -98,7 +98,7 @@
shadow = new Shadow(board, board->frameWidth(), this);
QWhatsThis::add(shadow, i18n("Shadow of the current piece"));
connect(board, SIGNAL(showPieceConfigSignal(bool)),
- shadow, SLOT(redraw(bool)));
+ shadow, SLOT(reveal(bool)));
connect(board, SIGNAL(blockSizeChanged()),
shadow, SLOT(blockSizeChanged()));
top->addWidget(shadow, 2, 2);
Index: main.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/main.cpp,v
retrieving revision 1.47
diff -u -r1.47 main.cpp
--- main.cpp 2000/08/14 18:56:21 1.47
+++ main.cpp 2000/08/31 21:11:00
@@ -15,6 +15,7 @@
#include "dialogs.h"
MainWidget::MainWidget()
+: KMainWindow(0)
{
installEventFilter(this);
KAccel *kacc = new KAccel(this);
@@ -56,8 +57,7 @@
createGUI();
readSettings();
- setView(inter);
- updateRects(); // #### should be in KTMainWindow::setView
+ setCentralWidget(inter);
}
MainWidget::~MainWidget()
@@ -73,8 +73,13 @@
if ( ((QMouseEvent *)e)->button()!=RightButton ) return FALSE;
popup = (QPopupMenu*)factory()->container("popup", this);
popup->popup(QCursor::pos());
- return TRUE;
- default : return FALSE;
+ return true;
+ case QEvent::LayoutHint:
+ setFixedSize(minimumSize()); // because QMainWindow and KMainWindow
+ // do not manage fixed central widget and
+ // hidden menubar ...
+ return false;
+ default : return false;
}
}
@@ -94,15 +99,8 @@
{
bool b = MENUBAR_ACTION->isChecked();
if (b) menuBar()->show();
- else {
- menuBar()->hide();
+ else menuBar()->hide();
- // #### sort of hack : because KTMainWindow does not manage correctly
- // main widget with a fixed layout
- updateRects();
- adjustSize();
- }
-
OptionDialog::writeMenuVisible(b);
}
@@ -119,13 +117,13 @@
//-----------------------------------------------------------------------------
int generic_main(int argc, char **argv, const char *name,
- const char *trName, const char *description, bool catalog)
+ const char *trName, const char *description)
{
KLocale::setMainCatalogue("ksirtet");
KAboutData aboutData(name, trName, LONG_VERSION, description,
KAboutData::License_GPL, COPYLEFT, 0, HOMEPAGE);
aboutData.addAuthor("Eirik Eng", I18N_NOOP("Core engine"));
- aboutData.addAuthor("Nicolas Hadacek", 0, "hadacek@kde.org");
+ aboutData.addAuthor("Nicolas Hadacek", 0, EMAIL);
KCmdLineArgs::init(argc, argv, &aboutData);
KApplication a;
Index: main.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/main.h,v
retrieving revision 1.21
diff -u -r1.21 main.h
--- main.h 2000/04/11 21:55:30 1.21
+++ main.h 2000/08/31 21:11:00
@@ -1,12 +1,12 @@
#ifndef MAIN_H
#define MAIN_H
-#include <ktmainwindow.h>
+#include <kmainwindow.h>
class Interface;
class GPieceInfo;
-class MainWidget : public KTMainWindow
+class MainWidget : public KMainWindow
{
Q_OBJECT
@@ -30,7 +30,7 @@
};
int generic_main(int argc, char **argv, const char *name,
- const char *trName, const char *description, bool catalog);
+ const char *trName, const char *description);
GPieceInfo *createPieceInfo();
#endif // MAIN_H
Index: misc_ui.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/misc_ui.cpp,v
retrieving revision 1.11
diff -u -r1.11 misc_ui.cpp
--- misc_ui.cpp 2000/06/15 18:04:08 1.11
+++ misc_ui.cpp 2000/08/31 21:11:00
@@ -37,10 +37,7 @@
QWidget *parent, const char *name)
: QWidget(parent, name), _shown(FALSE), _p(this),
_xOffset(xOffset), _board(board)
-{
- _state.resize(_board->matrix().width());
- _state.fill(FALSE);
-}
+{}
QSize Shadow::sizeHint() const
{
@@ -55,49 +52,25 @@
void Shadow::reveal(bool reveal)
{
- if ( _shown==reveal ) return;
_shown = reveal;
- draw(!_shown, FALSE);
-}
-
-void Shadow::redraw(bool clear)
-{
- if (clear) return; // the state is saved so no clearing needed
- if (_shown) draw(FALSE, TRUE);
+ update();
}
void Shadow::paintEvent(QPaintEvent *)
{
- if (_shown) draw(FALSE, FALSE);
-}
+ if ( !_shown ) return;
-void Shadow::draw(bool erase, bool smart)
-{
const Piece *piece = _board->currentPiece();
uint pf = piece->minX() + _board->currentCol();
uint pl = pf + piece->width() - 1;
-
- for (uint i=0; i<_board->matrix().width(); i++) {
- if ( (i<pf || i>pl) || erase ) {
- if (_state[i]) { // need deletion
- _state[i] = FALSE;
- drawBlock(i, TRUE);
- }
- } else if ( !_state[i] || !smart ) { // need drawing
- _state[i] = TRUE;
- drawBlock(i, FALSE);
- }
+
+ for (uint i=pf; i<=pl; i++) {
+ QRect r(_xOffset + i * _board->blockWidth() + 1 , 0,
+ _board->blockWidth() - 2, SHADOW_HEIGHT);
+ _p.setBrush(black);
+ _p.setPen(black);
+ _p.drawRect(r);
}
-}
-
-void Shadow::drawBlock(uint i, bool erase)
-{
- QRect r(_xOffset + i * _board->blockWidth() + 1 , 0,
- _board->blockWidth() - 2, SHADOW_HEIGHT);
- QColor col = (erase ? backgroundColor() : black);
- _p.setBrush(col);
- _p.setPen(col);
- _p.drawRect(r);
}
/*****************************************************************************/
Index: misc_ui.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/misc_ui.h,v
retrieving revision 1.10
diff -u -r1.10 misc_ui.h
--- misc_ui.h 2000/06/15 18:04:08 1.10
+++ misc_ui.h 2000/08/31 21:11:00
@@ -43,25 +43,19 @@
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
-
- void reveal(bool reveal = TRUE);
public slots:
- void redraw(bool clear);
void blockSizeChanged() { updateGeometry(); }
+ void reveal(bool hide);
protected:
- void paintEvent(QPaintEvent *e);
+ void paintEvent(QPaintEvent *);
private:
bool _shown;
QPainter _p;
int _xOffset;
const Board *_board;
- QArray<bool> _state;
-
- void draw(bool hide, bool smart);
- void drawBlock(uint i, bool erase);
};
/****************************************************************************/
Index: tl_main.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/tl_main.cpp,v
retrieving revision 1.2
diff -u -r1.2 tl_main.cpp
--- tl_main.cpp 2000/04/02 15:45:29 1.2
+++ tl_main.cpp 2000/08/31 21:11:00
@@ -40,5 +40,5 @@
int main(int argc, char **argv)
{
return generic_main(argc, argv, "ksirtet", I18N_NOOP("KSirtet"),
- TL_DESCRIPTION, FALSE);
+ TL_DESCRIPTION);
}
Index: version.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/version.h,v
retrieving revision 1.30
diff -u -r1.30 version.h
--- version.h 2000/06/19 19:32:07 1.30
+++ version.h 2000/08/31 21:11:00
@@ -1,6 +1,7 @@
-#define VERSION "2.0.2"
-#define LONG_VERSION "2.0.2 (19 June 2000)"
+#define VERSION "2.0.4"
+#define LONG_VERSION "2.0.4 (31 August 2000)"
#define COPYLEFT "(c) 1995, Eirik End\n(c) 1996-2000, Nicolas Hadacek"
+#define EMAIL "hadacek@kde.org"
#define HOMEPAGE "http://azhyd.free.fr/KDE/ksirtet.php3"
#define TL_MULTIPLAYER_ID "003"
Index: lib/CHANGELOG
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/CHANGELOG,v
retrieving revision 1.7
diff -u -r1.7 CHANGELOG
--- lib/CHANGELOG 1999/12/14 18:35:49 1.7
+++ lib/CHANGELOG 2000/08/31 21:11:00
@@ -1,3 +1,6 @@
+0.1.7
+ * resize handle removed from statusbar of netmmeting dialog
+
0.1.6
* fixed a bug in key configuration
* players name access improved
@@ -17,13 +20,13 @@
* big cleaning : the library restricts itself to data transport between
boards and to game configuration. The library doesn't want to and doesn't
have to manage things like game pause or gameover of a specific player ...
- all those things must be done by the game programmer.
+ all those things must be done by the game programmer.
0.1.3
* ported to QT 2.0 (hard way : now we send QString over the network :)
0.1.2
- * finally THE bug has been found (eight months later) !
+ * finally THE bug has been found (eight months later) !
so network game seems stable.
* lots of bug fixes
Index: lib/README
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/README,v
retrieving revision 1.5
diff -u -r1.5 README
--- lib/README 1999/08/15 16:43:21 1.5
+++ lib/README 2000/08/31 21:11:01
@@ -1,6 +1,6 @@
kdemultiplayers library
-----------------------
-Copyright (c) 1998-1999 Nicolas HADACEK (hadacek@kde.org)
+Copyright (c) 1998-2000 Nicolas HADACEK (hadacek@kde.org)
Distributed under the GNU Library General Public License
Introduction
Index: lib/TODO
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/TODO,v
retrieving revision 1.8
diff -u -r1.8 TODO
--- lib/TODO 2000/04/14 20:31:48 1.8
+++ lib/TODO 2000/08/31 21:11:01
@@ -1,12 +1,15 @@
* change to an event-driven data exchange framework (it currently uses a timer
on the server side) -> we probably need a way to ensure clients are not
dead (?)
+* use of QSocket and QSocketServer (?)
* grid/row layout of boards
* better dialogs ...
-* statusbar handle in NetMeeting does not look good ...
+* remove the netmeeting title
+* check the 64bit fix in "types.h"
-* user help
+* user help (add help button to wizard)
+* tooltips !!
* API documentation
* heavy test of network game
Index: lib/keys.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/keys.cpp,v
retrieving revision 1.3
diff -u -r1.3 keys.cpp
--- lib/keys.cpp 1999/12/14 18:35:49 1.3
+++ lib/keys.cpp 2000/08/31 21:11:01
@@ -1,6 +1,7 @@
#include "keys.h"
#include <kkeydialog.h>
+#include <kdebug.h>
KeyConnection::~KeyConnection()
{
@@ -56,7 +57,8 @@
kn.kacc->setConfigGroup(QString("Keys (%1 humans)").arg(nbHumans));
for (uint h=0; h<nbHumans; h++)
for (uint i=0; i<kn.size(); i++)
- kn.kacc->insertItem(kn.description(h, i), kn.action(h, i), code(h, i));
+ kn.kacc->insertItem(kn.description(h, i), kn.action(h, i),
+ code(h, i));
kn.kacc->readSettings();
}
Index: lib/meeting.cpp
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/meeting.cpp,v
retrieving revision 1.11
diff -u -r1.11 meeting.cpp
--- lib/meeting.cpp 1999/12/14 18:35:49 1.11
+++ lib/meeting.cpp 2000/08/31 21:11:02
@@ -54,6 +54,7 @@
// status bar
status = new QStatusBar(plainPage());
+ status->setSizeGripEnabled(false);
top->addWidget(status);
// buttons
@@ -130,7 +131,7 @@
void NetMeeting::cleanReject(const QString &str)
{
sm.clean(); // remove the sockets immediatly to avoid possible further mess
- if ( !str.isEmpty() )
+ if ( !str.isEmpty() )
KMessageBox::information(this, str, caption());
KDialogBase::reject();
}
@@ -363,7 +364,7 @@
// send it to all other clients (Mod_Type flag + TypeInfo struct)
sm.commonWritingStream() << Mod_Type << ti;
writeToAll(i);
-}
+}
void ServerNetMeeting::textChanged(const QString &text)
{
Index: lib/mp_interface.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/mp_interface.h,v
retrieving revision 1.6
diff -u -r1.6 mp_interface.h
--- lib/mp_interface.h 2000/02/17 12:26:42 1.6
+++ lib/mp_interface.h 2000/08/31 21:11:03
@@ -47,11 +47,11 @@
const char *humanSettingSlot, *AISettingSlot;
} MPGameInfo;
-/**
+/**
* The MPInterface class is useful for multiplayers game
* management. Each game is represented by a class you have inherited
* from the @ref MPBoard class.
- *
+ *
* Multiplayers games can take place with several (humans or eventually
* AIs) players on the same computer (they use the same keyboard and have
* each a @ref MPBoard widget on the screen) or/and network players.
@@ -60,7 +60,7 @@
* between the players and to send the keyboard events to the right
* @ref MPBoard. So multiplayers game should be completely transparent
* from your point of view.
- *
+ *
* Note : The data exchange is done in background with a timer calling at given
* intervals the read/write methods. Obviously this kind of things can be done
* easily with threads but I have no experience with thread programming
@@ -130,7 +130,7 @@
*/
QString playerName(uint i) const;
- /**
+ /**
* Create a new @ref MPBoard.
*
* @param i is the game index that goes from 0 to the number of
@@ -138,7 +138,7 @@
*/
virtual MPBoard *newBoard(uint i) = 0;
- /**
+ /**
* This method must read data from each client with method
* @ref readingStream, do the needed treatement
* (for instance which players has lost, which data to be resent, ...) and
@@ -161,7 +161,7 @@
QDataStream &writingStream(uint i) const;
/**
- * Read data sent from server to clients "MultiplayersInterface"
+ * Read data sent from server to clients "MultiplayersInterface"
* (this data is not adressed to boards).
* These are meta data that are not directly used in game.
* It can be used to display "game over" infos for all
@@ -183,13 +183,13 @@
*/
void immediateWrite();
- /**
+ /**
* This method should be overload if an option widget is used in the
* the "netmeeting" dialog). By default a
* null pointer is returned and so no option widget is shown.
* The option widget must be inherited from the @ref MPOptionWidget class.
*/
- virtual MPOptionWidget *newOptionWidget(bool /*server*/) const
+ virtual MPOptionWidget *newOptionWidget(bool /*server*/) const
{ return 0; };
/** Called when a network error occured or when a host gets disconnected.
Index: lib/version.h
===================================================================
RCS file: /home/kde/kdegames/ksirtet/lib/version.h,v
retrieving revision 1.5
diff -u -r1.5 version.h
--- lib/version.h 1999/12/14 18:35:51 1.5
+++ lib/version.h 2000/08/31 21:11:03
@@ -1,7 +1,7 @@
-#define VERSION "0.1.6"
-#define YEAR 1999
-#define MONTH 11
-#define DAY 14
-#define AUTHOR "Nicolas Hadacek (hadacek@kde.org)"
+#define VERSION "0.1.7"
+#define LONG_VERSION "0.1.7 (23 August 2000)"
+#define COPYLEFT "(c) 1998-2000, Nicolas Hadacek"
+#define EMAIL "hadacek@kde.org"
+
#define LIB_ID "003" // should be increased when incompatible
// changes are made.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic