Skip to content

Commit c2df8d6

Browse files
committed
Several changes:
- Wt 4 specific: - objectName() no longer present in id(): The data-object-name attribute is used instead - Changed interface of WAbstractItemDelegate to reflect ownership The old interface got a non-owning pointer as argument, and returned a maybe-owning pointer. Now it gets non-owning pointer (which can be made owning with removeFromParent()), and returns an owning pointer (which may be nullptr). - Added script to add .h to includes - Documentation: - Documented Wt::Dbo::Session::addNew and Wt::Dbo::make_ptr - Documented LayoutImplementation, renamed Classic to JavaScript - Removed some extra "CharEncoding::" substitutions - timeTo: use std::chrono::seconds - Removed unused fontRegistryMutex_ - Wt::utf8 and Wt::WString::fromUTF8 have become unnecessary Updating the examples to clarify that it's not necessary, the default encoding is UTF-8 now (unless changed with WString::setDefaultEncoding)
1 parent d57b685 commit c2df8d6

Some content is hidden

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

67 files changed

+643
-260
lines changed

doc/tutorial/wt.doc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,9 @@ adjustments. It is for this purpose that layout managers have been
464464
added to Wt. These layout managers use JavaScript to compute the width
465465
and/or height of widgets based on dimensions of other widgets.
466466

467-
TODO(Roel): what about flexbox?
467+
Since Wt 4, some layouts use CSS and flexbox by default, which works
468+
in many cases, but in some situations, you may want to opt for the
469+
JavaScript implementation instead.
468470
****
469471

470472
The +LetterWidget+ exposes a signal that indicates that the user chose

examples/blog/asciidoc/asciidoc.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ Wt::WString asciidoc(const Wt::WString& src)
8383
Wt::WString result;
8484

8585
if (ok) {
86-
result = Wt::utf8(readFileToString(htmlFileName));
86+
result = Wt::WString(readFileToString(htmlFileName));
8787
} else
88-
result = Wt::utf8("<i>Could not execute asciidoc</i>");
88+
result = Wt::WString("<i>Could not execute asciidoc</i>");
8989

9090
unlink(srcFileName.c_str());
9191
unlink(htmlFileName.c_str());

examples/blog/model/BlogUserDatabase.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Wt::WString BlogUserDatabase::identity(const Wt::Auth::User& user,
127127
if (provider == Wt::Auth::Identity::LoginName)
128128
return user_->name;
129129
else if (provider == user_->oAuthProvider)
130-
return Wt::utf8(user_->oAuthId);
130+
return Wt::WString(user_->oAuthId);
131131
else
132132
return Wt::WString::Empty;
133133
}

examples/blog/model/Comment.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void Comment::setText(const Wt::WString& src)
8181
// <div class="vspace"></div>
8282
replace(html, "<br /><br />", "<div class=\"vspace\"></div>");
8383

84-
textHtml_ = Wt::utf8(html);
84+
textHtml_ = Wt::WString(html);
8585
}
8686

8787
void Comment::setDeleted()

examples/chart3D/CsvUtil.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void readFromCsv(std::istream& f, Wt::WAbstractItemModel *model,
3535
col + 1 - model->columnCount());
3636

3737
if (firstLineIsHeaders && csvRow == 0)
38-
model->setHeaderData(col, Wt::cpp17::any(Wt::utf8(*i)));
38+
model->setHeaderData(col, Wt::cpp17::any(Wt::WString(*i)));
3939
else {
4040
int dataRow = firstLineIsHeaders ? csvRow - 1 : csvRow;
4141

@@ -58,7 +58,7 @@ void readFromCsv(std::istream& f, Wt::WAbstractItemModel *model,
5858
if (*endptr == 0)
5959
data = Wt::cpp17::any(d);
6060
else
61-
data = Wt::cpp17::any(Wt::utf8(s));
61+
data = Wt::cpp17::any(Wt::WString(s));
6262
}
6363

6464
model->setData(dataRow, col, data);

examples/charts/CsvUtil.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void readFromCsv(std::istream& f, Wt::WAbstractItemModel *model,
3535
col + 1 - model->columnCount());
3636

3737
if (firstLineIsHeaders && csvRow == 0)
38-
model->setHeaderData(col, Wt::cpp17::any(Wt::utf8(*i)));
38+
model->setHeaderData(col, Wt::cpp17::any(Wt::WString(*i)));
3939
else {
4040
int dataRow = firstLineIsHeaders ? csvRow - 1 : csvRow;
4141

@@ -58,7 +58,7 @@ void readFromCsv(std::istream& f, Wt::WAbstractItemModel *model,
5858
if (*endptr == 0)
5959
data = Wt::cpp17::any(d);
6060
else
61-
data = Wt::cpp17::any(Wt::utf8(s));
61+
data = Wt::cpp17::any(Wt::WString(s));
6262
}
6363

6464
model->setData(dataRow, col, data);

examples/composer/AttachmentEdit.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ AttachmentEdit::UploadInfo::UploadInfo(const Http::UploadedFile& f)
5454
+ U"kb";
5555

5656
std::u32string fn = static_cast<std::u32string>
57-
(escapeText(WString::fromUTF8(info_.clientFileName())));
57+
(escapeText(WString(info_.clientFileName())));
5858

5959
downloadLink_
60-
= this->addWidget(cpp14::make_unique<WAnchor>("", fn + U" (<i>" + WString::fromUTF8(info_.contentType())
60+
= this->addWidget(cpp14::make_unique<WAnchor>("", fn + U" (<i>" + WString(info_.contentType())
6161
+ U"</i>) " + size));
6262

6363
auto res = std::make_shared<WFileResource>(info_.contentType(),info_.spoolFileName());
@@ -195,8 +195,8 @@ std::vector<Attachment> AttachmentEdit::attachments()
195195
Http::UploadedFile& f = uploadInfo_[i]->info_;
196196
f.stealSpoolFile();
197197
result.push_back(Attachment
198-
(WString::fromUTF8(f.clientFileName()),
199-
WString::fromUTF8(f.contentType()),
198+
(WString(f.clientFileName()),
199+
WString(f.contentType()),
200200
f.spoolFileName()));
201201
}
202202
}

examples/feature/oidc/OAuthAuthorizationEndpoint.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ OAuthAuthorizationEndpoint::OAuthAuthorizationEndpoint(const Wt::WEnvironment& e
3434
if (process_->validRequest()) {
3535
root()->addWidget(std::move(authwidget));
3636
} else
37-
root()->addWidget(Wt::cpp14::make_unique<Wt::WText>(Wt::utf8("The request was invalid.")));
37+
root()->addWidget(Wt::cpp14::make_unique<Wt::WText>(Wt::WString("The request was invalid.")));
3838
}

examples/feature/oidc/Oidc.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private:
6565
{
6666
root()->clear();
6767
root()->addWidget(Wt::cpp14::make_unique<Wt::WText>(
68-
Wt::utf8("Welcome, {1}").arg(id.name()), Wt::TextFormat::Plain));
68+
Wt::WString("Welcome, {1}").arg(id.name()), Wt::TextFormat::Plain));
6969
}
7070
};
7171

examples/feature/socketnotifier/SocketNotifier.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private:
261261
startButton_->setText("Again");
262262
startButton_->enable();
263263
rssText_->setText("<pre>" +
264-
escapeText(WString::fromUTF8(inStream_.str())) + "</pre>");
264+
escapeText(inStream_.str()) + "</pre>");
265265
addText("Finished!<br/>Run again?<br/>");
266266
inStream_.str("");
267267
wApp->enableUpdates(false);

0 commit comments

Comments
 (0)