131 static_assert(std::tuple_size<T_result>::value > 2,
132 "Result tuple too small");
133 static_assert(std::is_same <
134 typename std::tuple_element <
135 std::tuple_size<T_result>::value - 2,
140 "Second to last result type not a QString");
141 static_assert(std::is_same <
142 typename std::tuple_element <
143 std::tuple_size<T_result>::value - 1,
148 "Last result type not a GpgME::Error");
151 : T_base(
nullptr), m_ctx(
ctx), m_thread(), m_auditLog(), m_auditLogError()
155 void lateInitialization()
158 QObject::connect(&m_thread, &QThread::finished,
this,
159 &mixin_type::slotFinished);
160 m_ctx->setProgressProvider(
this);
161 QGpgME::g_context_map.insert(
this, m_ctx.get());
166 QGpgME::g_context_map.remove(
this);
169 template <
typename T_binder>
172 m_thread.setFunction(std::bind(
func, this->context()));
175 template <
typename T_binder>
176 void run(
const T_binder &
func,
const std::shared_ptr<QIODevice> &
io)
179 io->moveToThread(&m_thread);
185 m_thread.setFunction(std::bind(
func, this->context(), this->
thread(), std::weak_ptr<QIODevice>(
io)));
188 template <
typename T_binder>
189 void run(
const T_binder &
func,
const std::shared_ptr<QIODevice> &
io1,
const std::shared_ptr<QIODevice> &
io2)
192 io1->moveToThread(&m_thread);
195 io2->moveToThread(&m_thread);
201 m_thread.setFunction(std::bind(
func, this->context(), this->
thread(), std::weak_ptr<QIODevice>(
io1), std::weak_ptr<QIODevice>(
io2)));
204 GpgME::Context *context()
const
214 m_auditLog = std::get < std::tuple_size<T_result>::value - 2 > (
r);
215 m_auditLogError = std::get < std::tuple_size<T_result>::value - 1 > (
r);
224 m_ctx->cancelPendingOperation();
233 return m_auditLogError;
235 void showProgress(
const char * ,
241 QMetaObject::invokeMethod(
this,
"progress", Qt::QueuedConnection,
248 template <
typename T1,
typename T2>
249 void doEmitResult(
const std::tuple<T1, T2> &
tuple)
254 template <
typename T1,
typename T2,
typename T3>
255 void doEmitResult(
const std::tuple<T1, T2, T3> &
tuple)
260 template <
typename T1,
typename T2,
typename T3,
typename T4>
261 void doEmitResult(
const std::tuple<T1, T2, T3, T4> &
tuple)
266 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
267 void doEmitResult(
const std::tuple<T1, T2, T3, T4, T5> &
tuple)
273 std::shared_ptr<GpgME::Context> m_ctx;
276 GpgME::Error m_auditLogError;