#include "C64SerialAnalyzerSettings.h" #include C64SerialAnalyzerSettings::C64SerialAnalyzerSettings() : mAttentionChannel(UNDEFINED_CHANNEL), mDataChannel(UNDEFINED_CHANNEL), mClockChannel(UNDEFINED_CHANNEL) { mAttentionChannelInterface.reset(new AnalyzerSettingInterfaceChannel()); mAttentionChannelInterface->SetTitleAndTooltip("Attention", "Standard C64 Serial Attention"); mAttentionChannelInterface->SetChannel(mAttentionChannel); AddInterface(mAttentionChannelInterface.get()); mDataChannelInterface.reset(new AnalyzerSettingInterfaceChannel()); mDataChannelInterface->SetTitleAndTooltip("Data", "Standard C64 Serial Data"); mDataChannelInterface->SetChannel(mDataChannel); AddInterface(mDataChannelInterface.get()); mClockChannelInterface.reset(new AnalyzerSettingInterfaceChannel()); mClockChannelInterface->SetTitleAndTooltip("Clock", "Standard C64 Serial Clock"); mClockChannelInterface->SetChannel(mClockChannel); AddInterface(mClockChannelInterface.get()); // AddExportOption(0, "Export as text/csv file"); // AddExportExtension(0, "text", "txt"); // AddExportExtension(0, "csv", "csv"); ClearChannels(); AddChannel(mAttentionChannel, "Attention", false); AddChannel(mDataChannel, "Data", false); AddChannel(mClockChannel, "Clock", false); } C64SerialAnalyzerSettings::~C64SerialAnalyzerSettings() {} bool C64SerialAnalyzerSettings::SetSettingsFromInterfaces() { mAttentionChannel = mAttentionChannelInterface->GetChannel(); mDataChannel = mDataChannelInterface->GetChannel(); mClockChannel = mClockChannelInterface->GetChannel(); ClearChannels(); AddChannel(mAttentionChannel, "Attention", true); AddChannel(mDataChannel, "Data", true); AddChannel(mClockChannel, "Clock", true); return true; } void C64SerialAnalyzerSettings::UpdateInterfacesFromSettings() { mAttentionChannelInterface->SetChannel(mAttentionChannel); mDataChannelInterface->SetChannel(mDataChannel); mClockChannelInterface->SetChannel(mClockChannel); } void C64SerialAnalyzerSettings::LoadSettings(const char *settings) { SimpleArchive text_archive; text_archive.SetString(settings); text_archive >> mAttentionChannel; text_archive >> mDataChannel; text_archive >> mClockChannel; ClearChannels(); AddChannel(mAttentionChannel, "Attention", true); AddChannel(mDataChannel, "Data", true); AddChannel(mClockChannel, "Clock", true); UpdateInterfacesFromSettings(); } const char *C64SerialAnalyzerSettings::SaveSettings() { SimpleArchive text_archive; text_archive << mAttentionChannel; text_archive << mDataChannel; text_archive << mClockChannel; return SetReturnString(text_archive.GetString()); }