#include <Home.h>
List of all members.
Detailed Description
Definition at line 67 of file Home.h.
Constructor & Destructor Documentation
Home::Home |
( |
const WEnvironment & |
env, |
|
|
const std::string & |
title, |
|
|
const std::string & |
resourceBundle, |
|
|
const std::string & |
cssPath |
|
) |
| |
Home::~Home |
( |
) |
[virtual] |
Member Function Documentation
void Home::addLanguage |
( |
const Lang & |
l ) |
[inline, protected] |
void Home::chatSetUser |
( |
const WString & |
name ) |
[private] |
Definition at line 251 of file Home.C.
{
WApplication::instance()->doJavaScript
("if (window.chat) "
"""window.chat.emit(window.chat, 'login', "
"" "" + userName.jsStringLiteral() + "); "
"else "
"""window.chatUser = " + userName.jsStringLiteral() + ";");
}
WWidget * Home::community |
( |
) |
[private] |
Definition at line 291 of file Home.C.
{
return new WText(tr("home.community"));
}
WWidget * Home::documentation |
( |
) |
[private] |
Definition at line 271 of file Home.C.
{
return new WText(tr("home.documentation"));
}
virtual WWidget* Home::download |
( |
) |
[protected, pure virtual] |
virtual WWidget* Home::examples |
( |
) |
[protected, pure virtual] |
WWidget * Home::features |
( |
) |
[private] |
Definition at line 266 of file Home.C.
{
return new WText(tr("home.features"));
}
virtual std::string Home::filePrefix |
( |
) |
const [protected, pure virtual] |
void Home::googleAnalyticsLogger |
( |
) |
|
std::string Home::href |
( |
const std::string & |
url, |
|
|
const std::string & |
description |
|
) |
| [protected] |
Definition at line 286 of file Home.C.
{
return "<a href=\"" + url + "\" target=\"_blank\">" + description + "</a>";
}
void Home::init |
( |
) |
[protected] |
WWidget * Home::initHome |
( |
) |
[private] |
Definition at line 102 of file Home.C.
{
WTemplate *result = new WTemplate(tr("template"), root());
WContainerWidget *languagesDiv = new WContainerWidget();
languagesDiv->setId("top_languages");
for (unsigned i = 0; i < languages.size(); ++i) {
if (i != 0)
new WText("- ", languagesDiv);
const Lang& l = languages[i];
WAnchor *a = new WAnchor("", WString::fromUTF8(l.longDescription_),
languagesDiv);
a->setRefInternalPath(l.path_);
}
WStackedWidget *contents = new WStackedWidget();
contents->setId("main_page");
mainMenu_ = new WMenu(contents, Vertical);
mainMenu_->setRenderAsList(true);
mainMenu_->addItem
(tr("introduction"), introduction())->setPathComponent("");
mainMenu_->addItem
(tr("blog"), deferCreate(boost::bind(&Home::blog, this)));
mainMenu_->addItem
(tr("features"), wrapView(&Home::features), WMenuItem::PreLoading);
mainMenu_->addItem
(tr("documentation"), wrapView(&Home::documentation),
WMenuItem::PreLoading);
mainMenu_->addItem
(tr("examples"), examples(),
WMenuItem::PreLoading)->setPathComponent("examples/");
mainMenu_->addItem
(tr("download"), deferCreate(boost::bind(&Home::download, this)),
WMenuItem::PreLoading);
mainMenu_->addItem
(tr("community"), wrapView(&Home::community), WMenuItem::PreLoading);
mainMenu_->addItem
(tr("other-language"), wrapView(&Home::otherLanguage),
WMenuItem::PreLoading);
mainMenu_->itemSelectRendered().connect(this, &Home::updateTitle);
mainMenu_->itemSelected().connect(this, &Home::googleAnalyticsLogger);
mainMenu_->setInternalPathEnabled("/");
sideBarContent_ = new WContainerWidget();
result->bindWidget("languages", languagesDiv);
result->bindWidget("menu", mainMenu_);
result->bindWidget("contents", contents);
result->bindWidget("sidebar", sideBarContent_);
return result;
}
WWidget * Home::introduction |
( |
) |
[private] |
WWidget * Home::linkSourceBrowser |
( |
const std::string & |
examplePath ) |
[protected] |
void Home::logInternalPath |
( |
const std::string & |
path ) |
[private] |
WWidget * Home::otherLanguage |
( |
) |
[private] |
Definition at line 276 of file Home.C.
{
return new WText(tr("home.other-language"));
}
void Home::readNews |
( |
WTable * |
newsTable, |
|
|
const std::string & |
newsfile |
|
) |
| [private] |
void Home::readReleases |
( |
WTable * |
releaseTable ) |
[protected] |
Definition at line 296 of file Home.C.
{
std::ifstream f((filePrefix() + "releases.txt").c_str());
releaseTable->clear();
releaseTable->elementAt(0, 0)
->addWidget(new WText(tr("home.download.version")));
releaseTable->elementAt(0, 1)
->addWidget(new WText(tr("home.download.date")));
releaseTable->elementAt(0, 2)
->addWidget(new WText(tr("home.download.description")));
releaseTable->elementAt(0, 0)->resize(WLength(15, WLength::FontEx),
WLength::Auto);
releaseTable->elementAt(0, 1)->resize(WLength(15, WLength::FontEx),
WLength::Auto);
int row = 1;
while (f) {
std::string line;
getline(f, line);
if (f) {
typedef boost::tokenizer<boost::escaped_list_separator<char> >
CsvTokenizer;
CsvTokenizer tok(line);
CsvTokenizer::iterator i=tok.begin();
std::string fileName = *i;
std::string description = *(++i);
releaseTable->elementAt(row, 0)->addWidget
(new WText(href("http://prdownloads.sourceforge.net/witty/"
+ fileName + "?download", description)));
releaseTable->elementAt(row, 1)->addWidget(new WText(*(++i)));
releaseTable->elementAt(row, 2)->addWidget(new WText(*(++i)));
++row;
}
}
}
void Home::setLanguage |
( |
int |
language ) |
[private] |
void Home::setLanguageFromPath |
( |
) |
[private] |
Definition at line 194 of file Home.C.
{
std::string langPath = internalPathNextPart("/");
if (langPath.empty())
langPath = '/';
else
langPath = '/' + langPath + '/';
int newLanguage = 0;
for (unsigned i = 0; i < languages.size(); ++i) {
if (languages[i].path_ == langPath) {
newLanguage = i;
break;
}
}
if (newLanguage != language_)
setLanguage(newLanguage);
}
void Home::setup |
( |
) |
[private] |
virtual WWidget* Home::sourceViewer |
( |
const std::string & |
deployPath ) |
[protected, pure virtual] |
WWidget * Home::status |
( |
) |
[private] |
WString Home::tr |
( |
const char * |
key ) |
[protected] |
void Home::updateTitle |
( |
) |
[private] |
WWidget * Home::wrapView |
( |
WWidget *(Home::*)() |
createFunction ) |
[private] |
Member Data Documentation
The documentation for this class was generated from the following files:
- /home/koen/project/wt/public-git/wt/examples/wt-homepage/Home.h
- /home/koen/project/wt/public-git/wt/examples/wt-homepage/Home.C