mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
refactor: use snake_case field naming in qt client (#1262)
* refactor: use snake_case field naming in qt client * fix: some missed symbols * chore: make uncrustify happy * fixup! refactor: use snake_case field naming in qt client
This commit is contained in:
+19
-20
@@ -11,39 +11,38 @@
|
||||
#include "RpcQueue.h"
|
||||
|
||||
RpcQueue::RpcQueue(QObject* parent) :
|
||||
QObject(parent),
|
||||
myTolerateErrors(false)
|
||||
QObject(parent)
|
||||
{
|
||||
connect(&myFutureWatcher, SIGNAL(finished()), SLOT(stepFinished()));
|
||||
connect(&future_watcher_, SIGNAL(finished()), SLOT(stepFinished()));
|
||||
}
|
||||
|
||||
void RpcQueue::stepFinished()
|
||||
{
|
||||
RpcResponse result;
|
||||
|
||||
if (myFutureWatcher.future().isResultReadyAt(0))
|
||||
if (future_watcher_.future().isResultReadyAt(0))
|
||||
{
|
||||
result = myFutureWatcher.result();
|
||||
RpcResponseFuture future = myFutureWatcher.future();
|
||||
result = future_watcher_.result();
|
||||
RpcResponseFuture future = future_watcher_.future();
|
||||
|
||||
// we can't handle network errors, abort queue and pass the error upwards
|
||||
if (result.networkError != QNetworkReply::NoError)
|
||||
{
|
||||
assert(!result.success);
|
||||
|
||||
myPromise.reportFinished(&result);
|
||||
promise_.reportFinished(&result);
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
// call user-handler for ordinary errors
|
||||
if (!result.success && myNextErrorHandler)
|
||||
if (!result.success && next_error_handler_)
|
||||
{
|
||||
myNextErrorHandler(future);
|
||||
next_error_handler_(future);
|
||||
}
|
||||
|
||||
// run next request, if we have one to run and there was no error (or if we tolerate errors)
|
||||
if ((result.success || myTolerateErrors) && !myQueue.isEmpty())
|
||||
if ((result.success || tolerate_errors_) && !queue_.isEmpty())
|
||||
{
|
||||
runNext(future);
|
||||
return;
|
||||
@@ -51,36 +50,36 @@ void RpcQueue::stepFinished()
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(!myNextErrorHandler);
|
||||
assert(myQueue.isEmpty());
|
||||
assert(!next_error_handler_);
|
||||
assert(queue_.isEmpty());
|
||||
|
||||
// one way or another, the last step returned nothing.
|
||||
// assume it is OK and ensure that we're not going to give an empty response object to any of the next steps.
|
||||
result.success = true;
|
||||
}
|
||||
|
||||
myPromise.reportFinished(&result);
|
||||
promise_.reportFinished(&result);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void RpcQueue::runNext(RpcResponseFuture const& response)
|
||||
{
|
||||
assert(!myQueue.isEmpty());
|
||||
assert(!queue_.isEmpty());
|
||||
|
||||
RpcResponseFuture const oldFuture = myFutureWatcher.future();
|
||||
RpcResponseFuture const oldFuture = future_watcher_.future();
|
||||
|
||||
while (true)
|
||||
{
|
||||
auto next = myQueue.dequeue();
|
||||
myNextErrorHandler = next.second;
|
||||
myFutureWatcher.setFuture((next.first)(response));
|
||||
auto next = queue_.dequeue();
|
||||
next_error_handler_ = next.second;
|
||||
future_watcher_.setFuture((next.first)(response));
|
||||
|
||||
if (oldFuture != myFutureWatcher.future())
|
||||
if (oldFuture != future_watcher_.future())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (myQueue.isEmpty())
|
||||
if (queue_.isEmpty())
|
||||
{
|
||||
deleteLater();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user