minor fixes

This commit is contained in:
fourtf 2018-05-16 15:42:45 +02:00
parent c2c3b67f6b
commit 7b192897da
2 changed files with 48 additions and 51 deletions

View file

@ -321,7 +321,7 @@ public:
debug::Log("Unhandled request type {}", (int)this->data.requestType); debug::Log("Unhandled request type {}", (int)this->data.requestType);
} break; } break;
} }
} // namespace util }
private: private:
void useCache() void useCache()
@ -372,8 +372,6 @@ private:
if (this->data.caller != nullptr) { if (this->data.caller != nullptr) {
QObject::connect(worker, &NetworkWorker::doneUrl, QObject::connect(worker, &NetworkWorker::doneUrl,
this->data.caller, [data = this->data](auto reply) mutable { this->data.caller, [data = this->data](auto reply) mutable {
auto &dat = data;
if (reply->error() != QNetworkReply::NetworkError::NoError) { if (reply->error() != QNetworkReply::NetworkError::NoError) {
if (data.onError) { if (data.onError) {
data.onError(reply->error()); data.onError(reply->error());
@ -389,16 +387,15 @@ private:
reply->deleteLater(); reply->deleteLater();
}); });
} // namespace chatterino }
if (timer != nullptr) { if (timer != nullptr) {
timer->start(this->data.timeoutMS); timer->start(this->data.timeoutMS);
} }
QObject::connect( QObject::connect(&requester, &NetworkRequester::requestUrl, worker,
&requester, &NetworkRequester::requestUrl, worker,
[ timer, data = std::move(this->data), worker ]() { [ timer, data = std::move(this->data), worker ]() {
QNetworkReply *reply; QNetworkReply *reply = nullptr;
switch (data.requestType) { switch (data.requestType) {
case GetRequest: { case GetRequest: {
reply = NetworkManager::NaM.get(data.request); reply = NetworkManager::NaM.get(data.request);
@ -411,7 +408,7 @@ private:
case DeleteRequest: { case DeleteRequest: {
reply = NetworkManager::NaM.deleteResource(data.request); reply = NetworkManager::NaM.deleteResource(data.request);
} break; } break;
} // namespace chatterino }
if (reply == nullptr) { if (reply == nullptr) {
debug::Log("Unhandled request type {}", (int)data.requestType); debug::Log("Unhandled request type {}", (int)data.requestType);
@ -419,7 +416,8 @@ private:
} }
if (timer != nullptr) { if (timer != nullptr) {
QObject::connect(timer, &QTimer::timeout, worker, [reply, timer, data]() { QObject::connect(timer, &QTimer::timeout, worker,
[reply, timer, data]() {
debug::Log("Aborted!"); debug::Log("Aborted!");
reply->abort(); reply->abort();
timer->deleteLater(); timer->deleteLater();
@ -445,11 +443,10 @@ private:
delete worker; delete worker;
}); });
} // namespace util });
);
emit requester.requestUrl(); emit requester.requestUrl();
} // namespace chatterino }
void executeGet() void executeGet()
{ {
@ -467,7 +464,7 @@ private:
{ {
this->doRequest(); this->doRequest();
} }
}; // namespace util };
} // namespace util } // namespace util
} // namespace chatterino } // namespace chatterino

View file

@ -137,7 +137,7 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched, QEvent *even
dynamic_cast<QGraphicsOpacityEffect *>(((QWidget *)watched)->graphicsEffect()); dynamic_cast<QGraphicsOpacityEffect *>(((QWidget *)watched)->graphicsEffect());
if (effect != nullptr) { if (effect != nullptr) {
effect->setOpacity(1); effect->setOpacity(0.99);
} }
this->parent->hoveredElement = this->hoveredElement; this->parent->hoveredElement = this->hoveredElement;