Skip to content

Commit

Permalink
Merge pull request #780 from fredzo/stream-browser-psu-support
Browse files Browse the repository at this point in the history
Stream browser psu support
  • Loading branch information
azonenberg authored Oct 14, 2024
2 parents 75717cc + 2949b65 commit a74b988
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 70 deletions.
80 changes: 80 additions & 0 deletions src/ngscopeclient/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,86 @@ void MainWindow::ShowChannelProperties(OscilloscopeChannel* channel)
}
}


void MainWindow::ShowInstrumentProperties(std::shared_ptr<Instrument> instrument)
{
LogTrace("Show properties for %s\n", instrument->GetName().c_str());
LogIndenter li;
// PSU
auto psu = dynamic_pointer_cast<SCPIPowerSupply>(instrument);
if(psu)
{
if(m_psuDialogs.find(psu) != m_psuDialogs.end())
{
LogTrace("PSU properties dialog is already open, no action required\n");
return;
}
AddDialog(make_shared<PowerSupplyDialog>(psu, m_session.GetPSUState(psu), &m_session));
return;
}
// Meter
auto dmm = dynamic_pointer_cast<SCPIMultimeter>(instrument);
if(dmm)
{
if(m_meterDialogs.find(dmm) != m_meterDialogs.end())
{
LogTrace("Multimeter properties dialog is already open, no action required\n");
return;
}
m_session.AddMultimeterDialog(dmm);
return;
}
// AWG
auto awg = dynamic_pointer_cast<SCPIFunctionGenerator>(instrument);
if(awg)
{
if(m_generatorDialogs.find(awg) != m_generatorDialogs.end())
{
LogTrace("Generator properties dialog is already open, no action required\n");
return;
}
AddDialog(make_shared<FunctionGeneratorDialog>(awg, &m_session));
return;
}
// Bert
auto bert = dynamic_pointer_cast<SCPIBERT>(instrument);
if(bert)
{
if(m_bertDialogs.find(bert) != m_bertDialogs.end())
{
LogTrace("BERT properties dialog is already open, no action required\n");
return;
}
AddDialog(make_shared<BERTDialog>(bert, m_session.GetBERTState(bert), &m_session));
return;
}
// Rf Gen
auto rfgen = dynamic_pointer_cast<SCPIRFSignalGenerator>(instrument);
if(rfgen)
{
if(m_rfgeneratorDialogs.find(rfgen) != m_rfgeneratorDialogs.end())
{
LogTrace("RF generator properties dialog is already open, no action required\n");
return;
}
AddDialog(make_shared<RFGeneratorDialog>(rfgen, &m_session));
return;
}
// Load
auto load = dynamic_pointer_cast<SCPILoad>(instrument);
if(load)
{
if(m_loadDialogs.find(load) != m_loadDialogs.end())
{
LogTrace("Load properties dialog is already open, no action required\n");
return;
}
AddDialog(make_shared<LoadDialog>(load, m_session.GetLoadState(load), &m_session));
return;
}
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Recent instruments

Expand Down
1 change: 1 addition & 0 deletions src/ngscopeclient/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class MainWindow : public VulkanWindow
{ m_splitRequests.push_back(SplitGroupRequest(group, direction, stream)); }

void ShowChannelProperties(OscilloscopeChannel* channel);
void ShowInstrumentProperties(std::shared_ptr<Instrument> instrumet);
void ShowTimebaseProperties();
void ShowTriggerProperties();
void ShowManageInstruments();
Expand Down
74 changes: 74 additions & 0 deletions src/ngscopeclient/PreferenceSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,80 @@ void PreferenceManager::InitializeDefaults()
.Label("Icon color")
.Description("Color for icon captions"));

auto& stream = appearance.AddCategory("Stream Browser");
stream.AddPreference(
Preference::Color("download_wait_badge_color", ColorFromString("#CC4C4C"))
.Label("Download wait badge color")
.Description("Color for download 'wait' badge"));
stream.AddPreference(
Preference::Color("download_progress_badge_color", ColorFromString("#B3B44D"))
.Label("Download progress badge color")
.Description("Color for download 'progress' badge"));
stream.AddPreference(
Preference::Color("download_finished_badge_color", ColorFromString("#4CCC4C"))
.Label("Download finished badge color")
.Description("Color for download 'finished' badge"));
stream.AddPreference(
Preference::Color("download_active_badge_color", ColorFromString("#4CCC4C"))
.Label("Download active badge color")
.Description("Color for download 'active' badge"));
stream.AddPreference(
Preference::Color("trigger_armed_badge_color", ColorFromString("#4CCC4C"))
.Label("Trigger armed badge color")
.Description("Color for trigger 'armed' badge"));
stream.AddPreference(
Preference::Color("trigger_stopped_badge_color", ColorFromString("#CC4C4C"))
.Label("Trigger stopped badge color")
.Description("Color for trigger 'stopped' badge"));
stream.AddPreference(
Preference::Color("trigger_triggered_badge_color", ColorFromString("#B3B44D"))
.Label("Trigger triggered badge color")
.Description("Color for trigger 'triggered' badge"));
stream.AddPreference(
Preference::Color("trigger_busy_badge_color", ColorFromString("#CC4C4C"))
.Label("Trigger buwy badge color")
.Description("Color for trigger 'busy' badge"));
stream.AddPreference(
Preference::Color("trigger_auto_badge_color", ColorFromString("#4CCC4C"))
.Label("Trigger auto badge color")
.Description("Color for trigger 'auto' badge"));
stream.AddPreference(
Preference::Color("intrument_disabled_badge_color", ColorFromString("#666666"))
.Label("Instrument disabled badge color")
.Description("Color for instrument 'disabled' badge"));
stream.AddPreference(
Preference::Color("intrument_offline_badge_color", ColorFromString("#CC4C4C"))
.Label("Instrument offline badge color")
.Description("Color for instrument 'offline' badge"));
stream.AddPreference(
Preference::Color("instrument_on_badge_color", ColorFromString("#4CCC4C"))
.Label("Instrument on badge color")
.Description("Color for instrument 'on' badge"));
stream.AddPreference(
Preference::Color("instrument_partial_badge_color", ColorFromString("#E2CD23FF"))
.Label("Instrument partial on badge color")
.Description("Color for intrument partial 'on' badge"));
stream.AddPreference(
Preference::Color("instrument_off_badge_color", ColorFromString("#CC4C4C"))
.Label("Instrument off badge color")
.Description("Color for instrument 'off' badge"));
stream.AddPreference(
Preference::Color("psu_cv_badge_color", ColorFromString("#4CCC4C"))
.Label("PSU cv badge color")
.Description("Color for PSU 'cv' badge"));
stream.AddPreference(
Preference::Color("psu_cc_badge_color", ColorFromString("#CC4C4C"))
.Label("PCU CC badge color")
.Description("Color for psu 'c' badge"));
stream.AddPreference(
Preference::Color("psu_set_badge_color", ColorFromString("#FFFF00"))
.Label("PSU set badge color")
.Description("Color for PSU 'set' badge"));
stream.AddPreference(
Preference::Color("psu_meas_badge_color", ColorFromString("#00C100"))
.Label("PSU measured badge color")
.Description("Color for PSU 'meas.' badge"));

auto& general = appearance.AddCategory("General");
general.AddPreference(
Preference::Enum("theme", THEME_DARK)
Expand Down
Loading

0 comments on commit a74b988

Please sign in to comment.