summaryrefslogtreecommitdiff
path: root/noncore/games/wordgame
authorkergoth <kergoth>2002-06-07 18:53:14 (UTC)
committer kergoth <kergoth>2002-06-07 18:53:14 (UTC)
commit640d964cfdc7467f6cacb513087cd3acda2c04f0 (patch) (side-by-side diff)
tree9a784686c1795f8b1f81eb344598f3b549d43467 /noncore/games/wordgame
parentdfb9c76738bb68e235114c5ad43dbd26a59b98ab (diff)
downloadopie-640d964cfdc7467f6cacb513087cd3acda2c04f0.zip
opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.gz
opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.bz2
Backing out unintentional merge from TT branch.
Diffstat (limited to 'noncore/games/wordgame') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/wordgame/wordgame.cpp71
-rw-r--r--noncore/games/wordgame/wordgame.h6
2 files changed, 62 insertions, 15 deletions
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index ca4352d..16d37b3 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -61,2 +61,9 @@ enum RuleEffects {
+static int tile_smallw = 16;
+static int tile_smallh = 16;
+static int tile_bigw = 22;
+static int tile_bigh = 22;
+static int tile_stweak = -2;
+static int tile_btweak = -1;
+
static const int rack_tiles=7;
@@ -113,2 +120,11 @@ WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) :
{
+ if ( qApp->desktop()->width() < 240 ) {
+ tile_smallw = 10;
+ tile_smallh = 10;
+ tile_bigw = 16;
+ tile_bigh = 16;
+ tile_stweak = 0;
+ tile_btweak = 0;
+ }
+
setIcon( Resource::loadPixmap( "wordgame" ) );
@@ -249,2 +265,3 @@ void WordGame::startGame(const QStringList& playerlist)
racks = new QWidgetStack(vbox);
+ racks->setFixedHeight(TileItem::bigHeight()+2);
namelist.clear();
@@ -285,3 +302,2 @@ bool WordGame::loadRules(const QString &name)
- QPixmap bgshapes = Resource::loadPixmap(shapepixmap);
QString rule_shapes;
@@ -299,2 +315,8 @@ bool WordGame::loadRules(const QString &name)
}
+
+ QImage shim = Resource::loadImage(shapepixmap);
+ shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight());
+ QPixmap bgshapes;
+ bgshapes.convertFromImage(shim);
+
rule_effects[re++] = 100; // default bonus
@@ -683,3 +705,3 @@ int TileItem::smallWidth()
{
- return 16;
+ return tile_smallw;
}
@@ -688,3 +710,3 @@ int TileItem::smallHeight()
{
- return 16;
+ return tile_smallh;
}
@@ -693,3 +715,3 @@ int TileItem::bigWidth()
{
- return 22;
+ return tile_bigw;
}
@@ -698,3 +720,3 @@ int TileItem::bigHeight()
{
- return 22;
+ return tile_bigh;
}
@@ -722,5 +744,15 @@ void TileItem::drawShape(QPainter& p)
{
- static QFont value_font("heletica",8);
- static QFont big_font("smoothtimes",17);
- static QFont small_font("smoothtimes",10);
+ static QFont *value_font=0;
+ static QFont *big_font=0;
+ static QFont *small_font=0;
+ if ( !value_font ) {
+ value_font = new QFont("helvetica",8);
+ if ( TileItem::bigWidth() < 20 ) {
+ big_font = new QFont("helvetica",12);
+ small_font = new QFont("helvetica",8);
+ } else {
+ big_font = new QFont("smoothtimes",17);
+ small_font = new QFont("smoothtimes",10);
+ }
+ }
@@ -730,3 +762,3 @@ void TileItem::drawShape(QPainter& p)
if ( big ) {
- p.setFont(value_font);
+ p.setFont(*value_font);
QString n = QString::number(t.value());
@@ -735,9 +767,9 @@ void TileItem::drawShape(QPainter& p)
w *= n.length();
- QRect valuearea(x()+width()-w-2,y()+height()-h+1,w,h);
+ QRect valuearea(x()+width()-w-1,y()+height()-h,w,h);
p.drawText(valuearea,AlignCenter,n);
- p.setFont(big_font);
- area = QRect(x(),y(),width()-2,height()-1);
+ p.setFont(*big_font);
+ area = QRect(x(),y()+tile_btweak,width()-4,height()-1);
} else {
- p.setFont(small_font);
- area = QRect(x(),y()+2,width(),height()-2);
+ p.setFont(*small_font);
+ area = QRect(x()+1+tile_stweak,y()+1,width(),height()-3);
}
@@ -752,2 +784,3 @@ Board::Board(QPixmap bgshapes, int w, int h, QWidget* parent) :
{
+ setFixedSize(w*TileItem::smallWidth(),h*TileItem::smallHeight());
grid = new TileItem*[w*h];
@@ -766,2 +799,7 @@ Board::~Board()
+QSize Board::sizeHint() const
+{
+ return QSize(canvas()->width(),canvas()->height());
+}
+
void Board::writeConfig(Config& cfg)
@@ -1183,2 +1221,7 @@ Rack::~Rack()
+QSize Rack::sizeHint() const
+{
+ return QSize(-1,TileItem::bigHeight()+2);
+}
+
void Rack::clear()
diff --git a/noncore/games/wordgame/wordgame.h b/noncore/games/wordgame/wordgame.h
index 0ffa56a..f73c85a 100644
--- a/noncore/games/wordgame/wordgame.h
+++ b/noncore/games/wordgame/wordgame.h
@@ -150,2 +150,4 @@ public:
+ QSize sizeHint() const;
+
protected:
@@ -213,2 +215,4 @@ public:
+ QSize sizeHint() const;
+
signals:
@@ -333,3 +337,3 @@ private:
QToolBar* toolbar;
- QVBox *vbox;
+ QWidget *vbox;
Board *board;