mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-25 17:11:13 -05:00
Rename CaptureThread message, callback method, handle success.
This commit is contained in:
parent
81d4e59aeb
commit
264c19b312
@ -286,11 +286,11 @@ void RecordView::start() {
|
|||||||
std::move(writer),
|
std::move(writer),
|
||||||
write_size, buffer_count,
|
write_size, buffer_count,
|
||||||
[]() {
|
[]() {
|
||||||
CaptureThreadErrorMessage message { };
|
CaptureThreadDoneMessage message { };
|
||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
},
|
},
|
||||||
[](File::Error error) {
|
[](File::Error error) {
|
||||||
CaptureThreadErrorMessage message { error.code() };
|
CaptureThreadDoneMessage message { error.code() };
|
||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -353,8 +353,14 @@ void RecordView::update_status_display() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordView::handle_error(const File::Error error) {
|
void RecordView::handle_capture_thread_done(const File::Error error) {
|
||||||
stop();
|
stop();
|
||||||
|
if( error.code() ) {
|
||||||
|
handle_error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RecordView::handle_error(const File::Error error) {
|
||||||
if( on_error ) {
|
if( on_error ) {
|
||||||
on_error(error.what());
|
on_error(error.what());
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ private:
|
|||||||
void on_tick_second();
|
void on_tick_second();
|
||||||
void update_status_display();
|
void update_status_display();
|
||||||
|
|
||||||
|
void handle_capture_thread_done(const File::Error error);
|
||||||
void handle_error(const File::Error error);
|
void handle_error(const File::Error error);
|
||||||
|
|
||||||
const std::string filename_stem_pattern;
|
const std::string filename_stem_pattern;
|
||||||
@ -107,10 +108,10 @@ private:
|
|||||||
std::unique_ptr<CaptureThread> capture_thread;
|
std::unique_ptr<CaptureThread> capture_thread;
|
||||||
|
|
||||||
MessageHandlerRegistration message_handler_capture_thread_error {
|
MessageHandlerRegistration message_handler_capture_thread_error {
|
||||||
Message::ID::CaptureThreadError,
|
Message::ID::CaptureThreadDone,
|
||||||
[this](const Message* const p) {
|
[this](const Message* const p) {
|
||||||
const auto message = *reinterpret_cast<const CaptureThreadErrorMessage*>(p);
|
const auto message = *reinterpret_cast<const CaptureThreadDoneMessage*>(p);
|
||||||
this->handle_error(message.error);
|
this->handle_capture_thread_done(message.error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
SpectrumStreamingConfig = 15,
|
SpectrumStreamingConfig = 15,
|
||||||
DisplaySleep = 16,
|
DisplaySleep = 16,
|
||||||
CaptureConfig = 17,
|
CaptureConfig = 17,
|
||||||
CaptureThreadError = 18,
|
CaptureThreadDone = 18,
|
||||||
MAX
|
MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -495,11 +495,11 @@ public:
|
|||||||
CaptureConfig* const config;
|
CaptureConfig* const config;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CaptureThreadErrorMessage : public Message {
|
class CaptureThreadDoneMessage : public Message {
|
||||||
public:
|
public:
|
||||||
constexpr CaptureThreadErrorMessage(
|
constexpr CaptureThreadDoneMessage(
|
||||||
uint32_t error = 0
|
uint32_t error = 0
|
||||||
) : Message { ID::CaptureThreadError },
|
) : Message { ID::CaptureThreadDone },
|
||||||
error { error }
|
error { error }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user