mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 22:55:11 +00:00
Moved file click handlers to separated file.
This commit is contained in:
@@ -327,104 +327,6 @@ private:
|
||||
VoiceWaveform documentWaveformDecode(const QByteArray &encoded5bit);
|
||||
QByteArray documentWaveformEncode5bit(const VoiceWaveform &waveform);
|
||||
|
||||
class DocumentClickHandler : public FileClickHandler {
|
||||
public:
|
||||
DocumentClickHandler(
|
||||
not_null<DocumentData*> document,
|
||||
FullMsgId context = FullMsgId());
|
||||
|
||||
[[nodiscard]] not_null<DocumentData*> document() const {
|
||||
return _document;
|
||||
}
|
||||
|
||||
private:
|
||||
const not_null<DocumentData*> _document;
|
||||
|
||||
};
|
||||
|
||||
class DocumentSaveClickHandler : public DocumentClickHandler {
|
||||
public:
|
||||
enum class Mode {
|
||||
ToCacheOrFile,
|
||||
ToFile,
|
||||
ToNewFile,
|
||||
};
|
||||
using DocumentClickHandler::DocumentClickHandler;
|
||||
static void Save(
|
||||
Data::FileOrigin origin,
|
||||
not_null<DocumentData*> document,
|
||||
Mode mode = Mode::ToCacheOrFile);
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override;
|
||||
|
||||
};
|
||||
|
||||
class DocumentOpenClickHandler : public DocumentClickHandler {
|
||||
public:
|
||||
DocumentOpenClickHandler(
|
||||
not_null<DocumentData*> document,
|
||||
Fn<void()> &&callback);
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override;
|
||||
|
||||
private:
|
||||
Fn<void()> _handler;
|
||||
|
||||
};
|
||||
|
||||
class DocumentCancelClickHandler : public DocumentClickHandler {
|
||||
public:
|
||||
using DocumentClickHandler::DocumentClickHandler;
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override;
|
||||
|
||||
};
|
||||
|
||||
class DocumentOpenWithClickHandler : public DocumentClickHandler {
|
||||
public:
|
||||
using DocumentClickHandler::DocumentClickHandler;
|
||||
static void Open(
|
||||
Data::FileOrigin origin,
|
||||
not_null<DocumentData*> document);
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override;
|
||||
|
||||
};
|
||||
|
||||
class VoiceSeekClickHandler : public DocumentOpenClickHandler {
|
||||
public:
|
||||
using DocumentOpenClickHandler::DocumentOpenClickHandler;
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class DocumentWrappedClickHandler : public DocumentClickHandler {
|
||||
public:
|
||||
DocumentWrappedClickHandler(
|
||||
ClickHandlerPtr wrapped,
|
||||
not_null<DocumentData*> document,
|
||||
FullMsgId context = FullMsgId())
|
||||
: DocumentClickHandler(document, context)
|
||||
, _wrapped(wrapped) {
|
||||
}
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override {
|
||||
_wrapped->onClick({ Qt::LeftButton });
|
||||
}
|
||||
|
||||
private:
|
||||
ClickHandlerPtr _wrapped;
|
||||
|
||||
};
|
||||
|
||||
QString FileNameForSave(
|
||||
not_null<Main::Session*> session,
|
||||
const QString &title,
|
||||
|
Reference in New Issue
Block a user