10 #include "QuoteForm.h"
11 #endif // WT_EMWEB_BUILD
14 #include <Wt/WEnvironment>
16 #include <Wt/WMenuItem>
17 #include <Wt/WStackedWidget>
19 #include <Wt/WTabWidget>
21 #include <Wt/WTreeNode>
22 #include <Wt/WViewWidget>
28 :
Home(env,
"Wt, C++ Web Toolkit",
"wt-home",
"css/wt")
34 char* wtExamplePath = getenv(
"WT_EXAMPLE_PATH");
47 w->setInternalPathEncoding(
true);
54 return example(
"home.examples.hello",
"hello");
59 return example(
"home.examples.chart",
"charts");
64 return example(
"home.examples.wt",
"wt-homepage");
69 return example(
"home.examples.treeview",
"treeview-dragdrop");
74 return example(
"home.examples.git",
"gitmodel");
79 return example(
"home.examples.chat",
"simplechat");
84 return example(
"home.examples.composer",
"composer");
89 return example(
"home.examples.widgetgallery",
"widgetgallery");
94 return example(
"home.examples.hangman",
"hangman");
102 intro->setInternalPathEncoding(
true);
103 result->addWidget(intro);
107 WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn);
138 tr(
"mail-composer"));
142 tr(
"widget-gallery"));
153 #ifdef WT_EMWEB_BUILD
154 return new QuoteForm(QuoteForm::Wt);
167 return makeStaticModel(boost::bind(createWidget,
this));
175 const std::string *historyKey = env.
getParameter(
"historyKey");
178 const char *mainStr[]
181 "main:2",
"/features",
182 "main:4",
"/examples",
183 "main:3",
"/documentation",
184 "main:5",
"/download",
185 "main:6",
"/community" };
187 const char *exampleStr[]
188 = {
"example:0",
"/examples",
189 "example:1",
"/examples/charts",
190 "example:2",
"/examples/wt-homepage",
191 "example:3",
"/examples/treelist",
192 "example:4",
"/examples/hangman",
193 "example:5",
"/examples/chat",
194 "example:6",
"/examples/mail-composer",
195 "example:7",
"/examples/drag-and-drop",
196 "example:8",
"/examples/file-explorer",
197 "example:9",
"/examples/calendar" };
199 if (historyKey->find(
"main:4") != std::string::npos) {
200 for (
unsigned i = 0; i < 10; ++i)
201 if (historyKey->find(exampleStr[i*2]) != std::string::npos) {
203 app->
log(
"notice") <<
"redirecting old style URL '"
204 << *historyKey <<
"' to internal path: '"
205 << exampleStr[i*2+1] <<
"'";
211 for (
unsigned i = 0; i < 6; ++i)
212 if (historyKey->find(mainStr[i*2]) != std::string::npos) {
215 app->
log(
"notice") <<
"redirecting old style URL '"
216 << *historyKey <<
"' to internal path: '"
217 << mainStr[i*2+1] <<
"'";
virtual WWidget * examples()
A simple widget to visualise a set of example source files.
WLogEntry log(const std::string &type) const
void redirect(const std::string &url)
WWidget * helloWorldExample()
const std::string * getParameter(const std::string &name) const
WWidget * linkSourceBrowser(const std::string &examplePath)
virtual WWidget * sourceViewer(const std::string &internalPath)
WWidget * homepageExample()
WWidget * widgetGalleryExample()
WWidget * composerExample()
WString tr(const char *key)
virtual WWidget * createQuoteForm()
WWidget * example(const char *textKey, const std::string &sourceDir)
WWidget * treeviewExample()
WtHome(const WEnvironment &env)
virtual boost::signals::connection connect(WObject *target, WObject::Method method)
WTabWidget * examplesMenu_
WWidget * hangmanExample()
WApplication * createWidget(const WEnvironment &env, SimpleChatServer &server)
std::string wtExamplePath_
WApplication * createWtHomeApplication(const WEnvironment &env)
std::string bookmarkUrl() const
void addLanguage(const Lang &l)
WWidget * wrapView(WWidget *(WtHome::*createFunction)())
void googleAnalyticsLogger()