Skip to content

Commit 9d8792d

Browse files
author
Koen Deforche
committed
a batch of bug fixes, see Changelog
1 parent 286e456 commit 9d8792d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+827
-479
lines changed

Changelog

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
13-09-2011
2+
* WConfig: added a check to detect header/library version mismatches
3+
4+
* Chart/WAxis.C: a fix from Joe Garcia, crash with log scaling
5+
6+
* WItemDelegate: set target new window for WLink data when it references
7+
a resource
8+
9+
* WMenu: fix hiding of a menu item to hide the entire item, not just
10+
the contents (label)
11+
12+
05-09-2011
13+
* WResource, Http/ResponseContinuation: added API to suspend a response
14+
while waiting for more data, and resuming later
15+
116
31-08-2011:
217
* WResource: use suggestedFilename() also when set during
318
handleRequest() (#920)

WConfig.h.in

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
#define WT_VERSION (((WT_SERIES & 0xff) << 24) | ((WT_MAJOR & 0xff) << 16) | ((WT_MINOR & 0xff) << 8))
1414
#define WT_VERSION_STR "${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}"
1515
#define WT_CLASS "Wt${VERSION_SERIES}_${VERSION_MAJOR}_${VERSION_MINOR}"
16-
#define WT_INCLUDED_VERSION Wt##WT_VERSION
17-
18-
namespace Wt {
19-
/*
20-
* Symbols used to check that included version matches library version
21-
* against which you link.
22-
*/
23-
struct WtLibVersion { };
24-
extern const WtLibVersion WT_INCLUDED_VERSION;
25-
}
2616

2717
#define RUNDIR "${RUNDIR}"
2818
#define WT_CONFIG_XML "${CONFIGURATION}"

doc/main

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ namespace Wt {
186186
WRun() to start the %Wt application server. This method will return
187187
only when shutdown is signaled by the environment, and after the
188188
application server (and all remaining active sessions) has been
189-
properly shutd down. One parameter to the WRun() function is a \em
189+
properly shut down. One parameter to the WRun() function is a \em
190190
createApplication function object. Alternatively, if you wish to
191191
have more control over the application server, you may also
192192
instantiate and configure a WServer instance directly.
@@ -395,7 +395,7 @@ namespace Wt {
395395
These key values will be lookup up in so-called message resource
396396
bundles (see WMessageResourceBundle). These are a set of xml files
397397
that translate the keys to a localized string. The name of the xml
398-
file determines the language contained therin (e.g. foo.xml, foo-nl.xml,
398+
file determines the language contained therein (e.g. foo.xml, foo-nl.xml,
399399
foo-cn.xml)
400400

401401
The strings that are used by classes within the %Wt library use the

doc/tutorial/wt/wt-sdj.odt

-82.6 KB
Binary file not shown.

examples/feature/broadcast/BroadCast.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
#include <Wt/WApplication>
77
#include <Wt/WText>
8+
#include <Wt/WMessageBox>
89
#include <Wt/WServer>
910

1011
#include <boost/thread.hpp>
@@ -131,7 +132,7 @@ void Server::run()
131132
* thread.
132133
*/
133134
for (;;) {
134-
boost::this_thread::sleep(boost::posix_time::seconds(1));
135+
boost::this_thread::sleep(boost::posix_time::seconds(10));
135136

136137
if (stop_)
137138
return;

examples/hangman/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
WT_ADD_EXAMPLE(hangman.wt
22
hangman.C
3-
HangmanApplication.C
43
User.C
4+
Session.C
55
HangmanGame.C
66
HangmanWidget.C
7+
WordWidget.C
8+
LettersWidget.C
9+
ImagesWidget.C
710
HighScoresWidget.C
811
LoginWidget.C
912
Dictionary.C

examples/hangman/Dictionary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ enum Dictionary {
1717

1818
extern std::wstring RandomWord(Dictionary dictionary);
1919

20-
#endif
20+
#endif //DICTIONARY_H_

examples/hangman/HangmanApplication.C

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/hangman/HangmanApplication.h

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/hangman/HangmanGame.C

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2005 Wim Dumon
2+
* Copyright (C) 2011 Emweb bvba, Heverlee, Belgium
33
*
44
* See the LICENSE file for terms of use.
55
*/
@@ -9,12 +9,12 @@
99
#include <Wt/WStackedWidget>
1010
#include <Wt/WVBoxLayout>
1111
#include <Wt/WHBoxLayout>
12+
#include <Wt/WApplication>
1213

1314
#include "HangmanGame.h"
1415
#include "LoginWidget.h"
1516
#include "HangmanWidget.h"
1617
#include "HighScoresWidget.h"
17-
#include "HangmanApplication.h"
1818

1919
using namespace Wt;
2020

@@ -23,55 +23,52 @@ HangmanGame::HangmanGame(WContainerWidget *parent):
2323
game_(0),
2424
scores_(0)
2525
{
26-
WVBoxLayout *layout = new WVBoxLayout();
27-
layout->setContentsMargins(0, 0, 0, 0);
28-
this->setLayout(layout);
29-
30-
WText *title = new WText("<h1>A Witty game: Hangman</h1>");
31-
layout->addWidget(title);
26+
WVBoxLayout *layout = new WVBoxLayout();
27+
layout->setContentsMargins(0, 0, 0, 0);
28+
this->setLayout(layout);
29+
30+
WText *title = new WText("<h1>A Witty game: Hangman</h1>");
31+
layout->addWidget(title);
3232

33-
mainStack_ = new WStackedWidget(this);
34-
mainStack_->setPadding(20);
35-
layout->addWidget(mainStack_, 1, AlignCenter | AlignMiddle);
36-
37-
mainStack_->addWidget(login_ = new LoginWidget());
33+
mainStack_ = new WStackedWidget(this);
34+
mainStack_->setPadding(20);
35+
layout->addWidget(mainStack_, 1, AlignCenter | AlignMiddle);
36+
37+
mainStack_->addWidget(login_ = new LoginWidget(&session_));
38+
login_->loggedIn().connect(this, &HangmanGame::showGame);
3839

39-
WHBoxLayout *linksLayout = new WHBoxLayout();
40-
linksLayout->setContentsMargins(0, 0, 0, 0);
41-
layout->addLayout(linksLayout, 0, AlignCenter | AlignMiddle);
40+
WHBoxLayout *linksLayout = new WHBoxLayout();
41+
linksLayout->setContentsMargins(0, 0, 0, 0);
42+
layout->addLayout(linksLayout, 0, AlignCenter | AlignMiddle);
4243

43-
backToGameAnchor_ = new WAnchor("/play", "Gaming Grounds");
44-
linksLayout->addWidget(backToGameAnchor_, 0, AlignCenter | AlignMiddle);
45-
backToGameAnchor_->setRefInternalPath("/play");
46-
backToGameAnchor_->addStyleClass("link");
44+
backToGameAnchor_ = new WAnchor("/play", "Gaming Grounds");
45+
linksLayout->addWidget(backToGameAnchor_, 0, AlignCenter | AlignMiddle);
46+
backToGameAnchor_->setRefInternalPath("/play");
47+
backToGameAnchor_->addStyleClass("link");
4748

48-
scoresAnchor_ = new WAnchor("/highscores", "Highscores");
49-
linksLayout->addWidget(scoresAnchor_, 0, AlignCenter | AlignMiddle);
50-
scoresAnchor_->setRefInternalPath("/highscores");
51-
scoresAnchor_->addStyleClass("link");
49+
scoresAnchor_ = new WAnchor("/highscores", "Highscores");
50+
linksLayout->addWidget(scoresAnchor_, 0, AlignCenter | AlignMiddle);
51+
scoresAnchor_->setRefInternalPath("/highscores");
52+
scoresAnchor_->addStyleClass("link");
5253

53-
HangmanApplication::instance()
54-
->internalPathChanged().connect(this, &HangmanGame::handleInternalPath);
54+
WApplication::instance()->internalPathChanged()
55+
.connect(this, &HangmanGame::handleInternalPath);
5556

56-
handleInternalPath();
57+
showLogin();
5758
}
5859

59-
void HangmanGame::handleInternalPath()
60+
void HangmanGame::handleInternalPath(const std::string &internalPath)
6061
{
61-
HangmanApplication *app = HangmanApplication::instance();
62-
63-
if (app->internalPath() == "/play" && app->user)
62+
if (internalPath == "/play" && session_.user())
6463
showGame();
65-
else if (app->internalPath() == "/highscores")
64+
else if (internalPath == "/highscores")
6665
showHighScores();
6766
else
6867
showLogin();
6968
}
7069

7170
void HangmanGame::showLogin()
7271
{
73-
HangmanApplication::instance()->setInternalPath("/");
74-
7572
mainStack_->setCurrentWidget(login_);
7673
backToGameAnchor_->hide();
7774
scoresAnchor_->hide();
@@ -80,7 +77,7 @@ void HangmanGame::showLogin()
8077
void HangmanGame::showHighScores()
8178
{
8279
if (!scores_)
83-
scores_ = new HighScoresWidget(mainStack_);
80+
scores_ = new HighScoresWidget(&session_, mainStack_);
8481

8582
mainStack_->setCurrentWidget(scores_);
8683
scores_->update();
@@ -94,8 +91,12 @@ void HangmanGame::showHighScores()
9491

9592
void HangmanGame::showGame()
9693
{
97-
if (!game_)
98-
game_ = new HangmanWidget(mainStack_);
94+
if (!game_) {
95+
game_ = new HangmanWidget(session_.user()->name,
96+
session_.dictionary(),
97+
mainStack_);
98+
game_->updateScore().connect(&session_, &Session::addToScore);
99+
}
99100

100101
mainStack_->setCurrentWidget(game_);
101102

@@ -105,4 +106,3 @@ void HangmanGame::showGame()
105106
backToGameAnchor_->addStyleClass("selected-link");
106107
scoresAnchor_->removeStyleClass("selected-link");
107108
}
108-

0 commit comments

Comments
 (0)