Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7889236
kazv-io-job.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
kazv-io-job.hpp
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2022 nannanko <nannanko@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include
<QObject>
#include
<QPointer>
#include
<QSharedPointer>
#include
<QSaveFile>
#include
<QFile>
#include
<QString>
#include
<QByteArray>
#include
<KIO/TransferJob>
#include
<memory>
#include
<optional>
struct
KazvIOBaseJobPrivate
;
class
KazvIOBaseJob
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QPointer
<
KIO
::
TransferJob
>
job
READ
job
WRITE
setJob
NOTIFY
jobChanged
)
std
::
unique_ptr
<
KazvIOBaseJobPrivate
>
m_d
;
public
:
KazvIOBaseJob
(
QObject
*
parent
=
0
);
~
KazvIOBaseJob
();
QPointer
<
KIO
::
TransferJob
>
job
();
void
setJob
(
QPointer
<
KIO
::
TransferJob
>
job
);
/**
* return std::nullopt when job is not completed
*/
std
::
optional
<
bool
>
success
();
/**
* return std::nullopt when job is not completed
*/
std
::
optional
<
bool
>
error
();
Q_SIGNALS
:
void
jobChanged
();
void
result
();
protected
Q_SLOTS
:
virtual
void
connectJob
();
};
struct
KazvIODownloadJobPrivate
;
class
KazvIODownloadJob
:
public
KazvIOBaseJob
{
Q_OBJECT
Q_PROPERTY
(
QSharedPointer
<
QSaveFile
>
file
READ
file
WRITE
setFile
NOTIFY
fileChanged
)
std
::
unique_ptr
<
KazvIODownloadJobPrivate
>
m_d
;
public
:
KazvIODownloadJob
(
QObject
*
parent
=
0
);
~
KazvIODownloadJob
();
QSharedPointer
<
QSaveFile
>
file
();
void
setFile
(
QSharedPointer
<
QSaveFile
>
file
);
Q_SIGNALS
:
void
fileChanged
();
protected
Q_SLOTS
:
void
connectJob
()
override
;
};
struct
KazvIOUploadJobPrivate
;
class
KazvIOUploadJob
:
public
KazvIOBaseJob
{
Q_OBJECT
Q_PROPERTY
(
QSharedPointer
<
QFile
>
file
READ
file
WRITE
setFile
NOTIFY
fileChanged
)
Q_PROPERTY
(
QString
response
READ
response
NOTIFY
responseChanged
)
std
::
unique_ptr
<
KazvIOUploadJobPrivate
>
m_d
;
public
:
KazvIOUploadJob
(
QObject
*
parent
=
0
);
~
KazvIOUploadJob
();
QSharedPointer
<
QFile
>
file
();
void
setFile
(
QSharedPointer
<
QFile
>
file
);
QString
response
();
Q_SIGNALS
:
void
fileChanged
();
void
responseChanged
();
protected
Q_SLOTS
:
void
connectJob
()
override
;
};
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Oct 2, 2:25 AM (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
480969
Default Alt Text
kazv-io-job.hpp (2 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment