Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 718c524b6629
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8153a67cce06
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Sep 10, 2020

  1. Copy the full SHA
    8153a67 View commit details
Showing with 55 additions and 7 deletions.
  1. +1 −1 lib
  2. +39 −0 src/glscopeclient/FilterDialog.cpp
  3. +15 −6 src/glscopeclient/FilterDialog.h
2 changes: 1 addition & 1 deletion lib
Submodule lib updated from dae836 to 2e7d70
39 changes: 39 additions & 0 deletions src/glscopeclient/FilterDialog.cpp
Original file line number Diff line number Diff line change
@@ -63,6 +63,19 @@ ParameterRowString::~ParameterRowString()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ParameterRowEnum

ParameterRowEnum::ParameterRowEnum(FilterDialog* parent)
: ParameterRowBase(parent)
{
m_box.set_size_request(500, 1);
}

ParameterRowEnum::~ParameterRowEnum()
{
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ParameterRowFilename

@@ -284,6 +297,27 @@ FilterDialog::FilterDialog(
}
break;

case FilterParameter::TYPE_ENUM:
{
auto row = new ParameterRowEnum(this);
m_grid.attach_next_to(row->m_label, *last_label, Gtk::POS_BOTTOM, 1, 1);
m_grid.attach_next_to(row->m_box, row->m_label, Gtk::POS_RIGHT, 1, 1);
last_label = &row->m_label;
m_prows.push_back(row);

row->m_label.set_label(it->first);

//Populate box
vector<string> names;
it->second.GetEnumValues(names);
for(auto name : names)
row->m_box.append(name);

//Set initial value
row->m_box.set_active_text(it->second.ToString());
}
break;

default:
{
auto row = new ParameterRowString(this);
@@ -332,13 +366,18 @@ void FilterDialog::ConfigureDecoder()
{
auto row = m_prows[i];
auto srow = dynamic_cast<ParameterRowString*>(row);
auto erow = dynamic_cast<ParameterRowEnum*>(row);
auto frow = dynamic_cast<ParameterRowFilenames*>(row);
auto name = row->m_label.get_label();

//Strings are easy
if(srow)
m_filter->GetParameter(name).ParseString(srow->m_entry.get_text());

//Enums
else if(erow)
m_filter->GetParameter(name).ParseString(erow->m_box.get_active_text());

//List of file names
else if(frow)
{
21 changes: 15 additions & 6 deletions src/glscopeclient/FilterDialog.h
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@ class ParameterRowBase
ParameterRowBase(FilterDialog* parent);
virtual ~ParameterRowBase();

FilterDialog* m_parent;
Gtk::Label m_label;
FilterDialog* m_parent;
Gtk::Label m_label;
};

class ParameterRowString : public ParameterRowBase
@@ -67,7 +67,16 @@ class ParameterRowString : public ParameterRowBase
ParameterRowString(FilterDialog* parent);
virtual ~ParameterRowString();

Gtk::Entry m_entry;
Gtk::Entry m_entry;
};

class ParameterRowEnum : public ParameterRowBase
{
public:
ParameterRowEnum(FilterDialog* parent);
virtual ~ParameterRowEnum();

Gtk::ComboBoxText m_box;
};

class ParameterRowFilename : public ParameterRowString
@@ -88,9 +97,9 @@ class ParameterRowFilenames : public ParameterRowBase
ParameterRowFilenames(FilterDialog* parent, FilterParameter& param);
virtual ~ParameterRowFilenames();

Gtk::ListViewText m_list;
Gtk::Button m_buttonAdd;
Gtk::Button m_buttonRemove;
Gtk::ListViewText m_list;
Gtk::Button m_buttonAdd;
Gtk::Button m_buttonRemove;

void OnAdd();
void OnRemove();