mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04: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),
|
||||
write_size, buffer_count,
|
||||
[]() {
|
||||
CaptureThreadErrorMessage message { };
|
||||
CaptureThreadDoneMessage message { };
|
||||
EventDispatcher::send_message(message);
|
||||
},
|
||||
[](File::Error error) {
|
||||
CaptureThreadErrorMessage message { error.code() };
|
||||
CaptureThreadDoneMessage message { error.code() };
|
||||
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();
|
||||
if( error.code() ) {
|
||||
handle_error(error);
|
||||
}
|
||||
}
|
||||
|
||||
void RecordView::handle_error(const File::Error error) {
|
||||
if( on_error ) {
|
||||
on_error(error.what());
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ private:
|
||||
void on_tick_second();
|
||||
void update_status_display();
|
||||
|
||||
void handle_capture_thread_done(const File::Error error);
|
||||
void handle_error(const File::Error error);
|
||||
|
||||
const std::string filename_stem_pattern;
|
||||
@ -107,10 +108,10 @@ private:
|
||||
std::unique_ptr<CaptureThread> capture_thread;
|
||||
|
||||
MessageHandlerRegistration message_handler_capture_thread_error {
|
||||
Message::ID::CaptureThreadError,
|
||||
Message::ID::CaptureThreadDone,
|
||||
[this](const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const CaptureThreadErrorMessage*>(p);
|
||||
this->handle_error(message.error);
|
||||
const auto message = *reinterpret_cast<const CaptureThreadDoneMessage*>(p);
|
||||
this->handle_capture_thread_done(message.error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
SpectrumStreamingConfig = 15,
|
||||
DisplaySleep = 16,
|
||||
CaptureConfig = 17,
|
||||
CaptureThreadError = 18,
|
||||
CaptureThreadDone = 18,
|
||||
MAX
|
||||
};
|
||||
|
||||
@ -495,11 +495,11 @@ public:
|
||||
CaptureConfig* const config;
|
||||
};
|
||||
|
||||
class CaptureThreadErrorMessage : public Message {
|
||||
class CaptureThreadDoneMessage : public Message {
|
||||
public:
|
||||
constexpr CaptureThreadErrorMessage(
|
||||
constexpr CaptureThreadDoneMessage(
|
||||
uint32_t error = 0
|
||||
) : Message { ID::CaptureThreadError },
|
||||
) : Message { ID::CaptureThreadDone },
|
||||
error { error }
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user