Resolved nerworkrequest.hpp merge conflict

This commit is contained in:
apa420 2018-05-14 15:47:25 +02:00
commit 1f21f1c379
2 changed files with 50 additions and 25 deletions

View file

@ -85,9 +85,26 @@ install [chatterino2-git](https://aur.archlinux.org/packages/chatterino2-git/) f
### Mac OSX
1. install Xcode and Xcode Command Line Utilites
2. install Qt Creator
3. install brew https://brew.sh/
4. `brew install boost openssl rapidjson`
5. build the project using Qt Creator
2. start Xcode, settings -> Locations, activate your Command Line Tools
3. install Qt Creator
4. install brew https://brew.sh/
5. `brew install boost openssl rapidjson`
6. build the project using Qt Creator
If the Project does not build at this point, you might need to add additional Paths/Libs, because brew does not install openssl and boost in the common path. You can get their path using
`brew info openssl`
`brew info boost`
The lines which you need to add to your project file should look similar to this
```
INCLUDEPATH += /usr/local/opt/openssl/include
LIBS += -L/usr/local/opt/openssl/lib
INCLUDEPATH += "/usr/local/Cellar/boost/1.67.0_1/include"
LIBS += -L"/usr/local/Cellar/boost/1.67.0_1/lib"
```
Test 1

View file

@ -253,9 +253,9 @@ public:
data.onReplyCreated(reply);
}
QObject::connect(reply, &QNetworkReply::finished, worker,
[data = std::move(data), worker, reply,
onFinished = std::move(onFinished)]() mutable {
QObject::connect(reply, &QNetworkReply::finished, worker, [
data = std::move(data), worker, reply, onFinished = std::move(onFinished)
]() mutable {
if (data.caller == nullptr) {
QByteArray bytes = reply->readAll();
data.writeToCache(bytes);
@ -369,10 +369,18 @@ private:
worker->moveToThread(&NetworkManager::workerThread);
if (this->data.caller != nullptr) {
QObject::connect(worker, &NetworkWorker::doneUrl, this->data.caller,
[data = this->data](auto reply) mutable {
QObject::connect(worker, &NetworkWorker::doneUrl,
this->data.caller, [data = this->data](auto reply) mutable {
auto &dat = data;
if (reply->error() != QNetworkReply::NetworkError::NoError) {
// TODO: We might want to call an onError callback here
if (data.onError) {
data.onError(reply->error());
}
return;
}