Skip to content

Commit 598d2c6

Browse files
author
Koen Deforche
committed
avoid include/lib mismatches, and fix WSubMenu error (#944)
1 parent dc494b6 commit 598d2c6

File tree

6 files changed

+57
-5
lines changed

6 files changed

+57
-5
lines changed

WConfig.h.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,22 @@
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+
}
1626

1727
#define RUNDIR "${RUNDIR}"
1828
#define WT_CONFIG_XML "${CONFIGURATION}"
1929
#define WTHTTP_CONFIGURATION "${WTHTTP_CONFIGURATION}"
2030

31+
2132
#cmakedefine WT_STATIC
2233
#cmakedefine WTDBO_STATIC
2334
#cmakedefine WTDBOPOSTGRES_STATIC

doc/tutorial/dbo/tutorial.doc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,7 @@ The minimum level of isolation which is required for the library's
11581158
_optimistic locking_ strategy is _Read Committed_: modifications in a
11591159
transaction are only visible to other sessions as soon as they are
11601160
committed. This is usually the lowest level of isolation supported by
1161-
a database (SQLite3 is currently the only backend and provides this
1162-
isolation level by default).
1161+
a database.
11631162

11641163
The +Transaction+ class is a light-weight proxy that references a
11651164
_logical_ transaction: multiple (usually nested) Transaction objects
@@ -1192,3 +1191,30 @@ least need to
11921191
+{doc}classWt_1_1Dbo_1_1ptr.html#abb1db71ef910748437d69bf11a04eb6e[reread()]+
11931192
the stale database object(s) before being able to commit changes made
11941193
in a new transaction.
1194+
1195+
== Installing +Wt::Dbo+
1196+
1197+
+Wt::Dbo+ is included in Wt, and can thus be installed as part of this
1198+
library for which there may be standard packages availabe for your
1199+
operating system.
1200+
1201+
The library does however in no way depend on Wt, and can also be
1202+
built, installed and used separately from it. Starting from a Wt
1203+
source package (and on in a UNIX-like environment), you would do the
1204+
following to build and install only +Wt::Dbo+:
1205+
1206+
.Installing +Wt::Dbo+ from source (UNIX-like)
1207+
[source,sh]
1208+
----
1209+
$ cd wt-xxx
1210+
$ mkdir build
1211+
$ cd build
1212+
$ cmake ../ # extra options may be needed for locating boost, postgres, install directory, ...
1213+
$ cd src/Wt/Dbo
1214+
$ make
1215+
$ sudo make install
1216+
----
1217+
1218+
See also the
1219+
http://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html[Wt
1220+
installation instructions].

src/Wt/WApplication

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ public:
205205
* The \p environment provides information on the initial request,
206206
* user agent, and deployment-related information.
207207
*/
208+
#if defined(DOXYGEN_ONLY) || defined(WT_TARGET_JAVA)
208209
WApplication(const WEnvironment& environment);
210+
#else
211+
WApplication(const WEnvironment& environment,
212+
WtLibVersion version = WT_INCLUDED_VERSION);
213+
#endif
209214

210215
#ifndef WT_TARGET_JAVA
211216
/*! \brief Destructor.

src/Wt/WApplication.C

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ namespace skeletons {
4040

4141
namespace Wt {
4242

43+
const WtLibVersion WT_INCLUDED_VERSION = WtLibVersion();
44+
4345
const char *WApplication::RESOURCES_URL = "resourcesURL";
4446

4547
WApplication::ScriptLibrary::ScriptLibrary(const std::string& anUri,
@@ -69,7 +71,11 @@ bool WApplication::ScriptLibrary::operator== (const ScriptLibrary& other) const
6971
return uri == other.uri;
7072
}
7173

72-
WApplication::WApplication(const WEnvironment& env)
74+
WApplication::WApplication(const WEnvironment& env
75+
#if !(defined(DOXYGEN_ONLY) || defined(WT_TARGET_JAVA))
76+
, WtLibVersion version
77+
#endif
78+
)
7379
: session_(env.session_),
7480
#ifndef WT_CNOR
7581
weakSession_(session_->shared_from_this()),

src/Wt/WMenu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ public:
288288
*
289289
* Select the menu item \p item.
290290
*
291+
* When \p item is \c 0, the current selection is removed.
292+
*
291293
* \sa select(int), currentItem(), WMenuItem::select()
292294
*/
293295
void select(WMenuItem *item);
@@ -297,6 +299,8 @@ public:
297299
* Menu items in a menu with \p N items are numbered from 0 to
298300
* \p N - 1.
299301
*
302+
* Using a value of -1 removes the current selection.
303+
*
300304
* \sa select(WMenuItem *), currentIndex()
301305
*/
302306
void select(int index);

src/Wt/WMenu.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void WMenu::itemPathChanged(WMenuItem *item)
252252
WApplication *app = wApp;
253253

254254
if (app->internalPathMatches(basePath_ + item->pathComponent()))
255-
select(indexOf(item), false);
255+
item->setFromInternalPath(app->internalPath());
256256
}
257257
}
258258

@@ -466,7 +466,7 @@ void WMenu::internalPathChanged(const std::string& path)
466466
items_[bestI]->setFromInternalPath(path);
467467
else {
468468
if (!subPath.empty())
469-
wApp->log("error") << "WMenu: unknown path: '"<< subPath << "'";
469+
wApp->log("warn") << "WMenu: unknown path: '"<< subPath << "'";
470470
else
471471
select(-1, false);
472472
}

0 commit comments

Comments
 (0)