Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F111929
qt-job-handler.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
qt-job-handler.cpp
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2022 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<unordered_map>
#include
<QNetworkAccessManager>
#include
<QByteArray>
#include
<QThreadPool>
#include
<QTimer>
#include
<zug/transducer/filter.hpp>
#include
<zug/into.hpp>
#include
"qt-job-handler.hpp"
#include
"qt-job.hpp"
#include
"kazv-log.hpp"
struct
QtJobHandler
::
Private
{
QNetworkAccessManager
*
manager
;
};
QtJobHandler
::
QtJobHandler
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_d
(
new
Private
)
{
m_d
->
manager
=
new
QNetworkAccessManager
(
this
);
}
QtJobHandler
::~
QtJobHandler
()
=
default
;
void
QtJobHandler::async
(
std
::
function
<
void
()
>
func
)
{
QThreadPool
::
globalInstance
()
->
start
(
func
);
}
void
QtJobHandler::setTimeout
(
std
::
function
<
void
()
>
func
,
int
ms
,
std
::
optional
<
std
::
string
>
timerId
)
{
Q_UNUSED
(
timerId
);
QTimer
::
singleShot
(
ms
,
this
,
func
);
}
void
QtJobHandler::setInterval
(
std
::
function
<
void
()
>
func
,
int
ms
,
std
::
optional
<
std
::
string
>
timerId
)
{
Q_UNUSED
(
func
);
Q_UNUSED
(
ms
);
Q_UNUSED
(
timerId
);
qCCritical
(
kazvLog
)
<<
"QtJobHandler::setInterval: unimplemented"
;
}
void
QtJobHandler::cancel
(
std
::
string
timerId
)
{
Q_UNUSED
(
timerId
);
qCCritical
(
kazvLog
)
<<
"QtJobHandler::cancel: unimplemented"
;
}
void
QtJobHandler::submit
(
BaseJob
job
,
std
::
function
<
void
(
Response
)
>
callback
)
{
new
QtJob
(
this
,
m_d
->
manager
,
std
::
move
(
job
),
std
::
move
(
callback
));
}
void
QtJobHandler::stop
()
{
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Fri, Nov 22, 4:57 AM (7 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38664
Default Alt Text
qt-job-handler.cpp (1 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment