Commit graph

28 commits

Author SHA1 Message Date
Vadim Zeitlin
4f4c5fcfdf Use nullptr instead of NULL in the code and documentation
This is a combination of running clang-tidy with modernize-use-nullptr
check for some ports (GTK, X11, OSX) and manual changes to the ports for
which it couldn't be used easily (MSW, DFB) and also manually updating
the docs.

Also replace NULL with null or nullptr in the comments as this is more
consistent with the use of nullptr in the code and makes it simpler to
grep for the remaining occurrences of NULL itself.

And also use null in the assert messages.

Only a few occurrences of "NULL" are still left in non-C files, mostly
corresponding to unclear comments or string output which it might not be
safe to change.
2022-10-18 01:25:25 +02:00
PB
88d526660f Replace wxOVERRIDE and wxNOEXCEPT with override and noexcept
Don't use deprecated macros in wxWidgets itself.
2022-10-15 18:10:45 +02:00
Maarten Bent
5bdd5e1432 Check if wxUSE_WEBREQUEST is defined 2021-03-18 20:49:57 +01:00
Vadim Zeitlin
970ab0a1ae Make sure wxEVT_WEBREQUEST_DATA is processed in the main thread
This event was processed in a worker thread, which was different from
all the other events and also almost surely not thread-safe, so change
this and queue it for processing in the main thread instead.

Use wxMemoryBuffer instead of non-owning pointer in wxWebRequestEvent
and reset the buffer used internally every time to ensure the data is
still available by the time the event is processed.

Also increase the amount of data downloaded in the "advanced" page of
the sample as it has to be greater than wxWEBREQUEST_BUFFER_SIZE, which
is currently 64KiB, to have a chance of seeing the value actually
change, otherwise all the data arrives in a single event. As it is,
using the maximal size supported by the httpbin service, we only get 2
events.
2021-01-16 23:53:15 +01:00
Vadim Zeitlin
20a3317839 Rename wxWebRequestEvent::GetResponseFileName() to GetDataFile()
This is shorter and doesn't imply that just the name (and not the full
path) is being returned.

Also rename wxWebResponse::GetFileName() to GetDataFile() for the same
reasons and for consistency. And document this previously undocumented
method.
2021-01-12 03:34:40 +01:00
Catalin Raceanu
76167e271b Insert comma for clarity in a message in the sample
No real changes.
2021-01-11 02:57:15 +01:00
Vadim Zeitlin
e530016723 Remove unnecessary trailing backslashes from the sample
Multiline strings don't need backslashes for continuation.
2021-01-11 02:55:51 +01:00
Vadim Zeitlin
abcc31c6b2 Update wxCredentialEntryDialog to use wxWebCredentials
As a side effect, make wxWebCredentials default-constructible.

Also demonstrate using wxCredentialEntryDialog in the sample.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
ec2ea5c7fa Handle request still in progress gracefully on shut down
Cancel the request and wait until it actually is cancelled when exiting
the sample.

This is a bit ugly, especially the busy-waiting part, but still better
than potentially crashing.
2021-01-06 23:54:51 +01:00
Vadim Zeitlin
d2dc11da4f Allow starting request by pressing "Enter" in the sample
Just a small ergonomic improvement.
2021-01-04 23:16:52 +01:00
Vadim Zeitlin
f89781bfdd Simplify status bar updates in the webrequest sample
Use wxLogStatus() to update the status bar, this is shorter and simpler
than using GetStatusBar()->SetStatusText(wxString::Format(...)).

Also use wxFrame::SetStatusText() which forwards to wxStatusBar method
with the same name when we want to just clear the status bar.

No real changes.
2021-01-04 02:13:53 +01:00
Vadim Zeitlin
50424cba2c Change wxWebRequest and related objects to hide ref counting
Don't force the application code to deal with wxObjectDataPtr<> or,
worse, calling {Inc,Dec}Ref() manually by hiding it inside the wx
objects themselves and giving the value-like semantics to them.

There should be no real changes in the behaviour, but the API does
change significantly. Notably, wxWebRequest is not a wxEvtHandler itself
any longer, as this would be incompatible with the value semantics, and
an event handler needs to be specified when creating it, so that it
could be notified about the request state changes.
2020-12-30 02:02:20 +01:00
Vadim Zeitlin
fd040b702d Remove trailing spaces from webrequest sample
No real changes.
2020-12-13 01:07:55 +01:00
Tobias Taschner
5077eaee6c
Expand button sizer in webrequest sample 2018-12-10 19:38:16 +01:00
Tobias Taschner
45f006d752
Add wxWebSession::GetLibraryVersionInfo() 2018-12-10 19:38:12 +01:00
Tobias Taschner
4af4dd6cbf
Init image handlers webrequest sample 2018-12-10 19:38:11 +01:00
Cătălin Răceanu
58ad18adf3
Update samples/webrequest/webrequest.cpp
Co-Authored-By: TcT2k <TcT2k@users.noreply.github.com>
2018-12-10 19:38:01 +01:00
Maarten Bent
17d77fe8ce
Fix various small issues in webrequest sample 2018-12-10 19:37:52 +01:00
Tobias Taschner
6bafed4ceb
Add Cancel button to webrequest sample 2018-12-10 19:37:48 +01:00
Tobias Taschner
d32e27191d
Implement advanced page in webrequest sample 2018-12-10 19:37:47 +01:00
Tobias Taschner
e9618ce657
Implement Download page in webrequest sample 2018-12-10 19:37:43 +01:00
Tobias Taschner
701f697fa4
Change wxWebRequest API to use STATE event 2018-12-10 19:37:30 +01:00
Tobias Taschner
d7dee7019e
Implement sending request data with wxWebRequest 2018-12-10 19:37:25 +01:00
Tobias Taschner
3971a9ef7f
Expand webrequest sample 2018-12-10 19:37:24 +01:00
Tobias Taschner
a4279752f8
Start wxWebRequestWinHTTP implementation
Can already run the GET request in the sample app
2018-12-10 19:37:23 +01:00
Tobias Taschner
e07c1bf40c
Prepared wxWebRequest implementation 2018-12-10 19:37:21 +01:00
Cătălin Răceanu
bd73551f1f
Fix various typos and style in wxWebRequest documentation 2018-12-10 19:37:15 +01:00
Tobias Taschner
1090e8f6e9
Add webrequest sample application 2018-12-10 19:37:14 +01:00