Diff of /gui/oprof_start.cpp [ecfbcc] .. [74abfb] Maximize Restore

  Switch to unified view

a/gui/oprof_start.cpp b/gui/oprof_start.cpp
...
...
105
"    .......     ",
105
"    .......     ",
106
"                " };
106
"                " };
107
107
108
static QPixmap * green_pixmap;
108
static QPixmap * green_pixmap;
109
static QPixmap * red_pixmap;
109
static QPixmap * red_pixmap;
110
static op_event_descr null_evt;
111
110
112
111
113
112
op_event_descr::op_event_descr()
114
op_event_descr::op_event_descr()
113
    :
115
    :
114
    counter_mask(0),
116
    counter_mask(0),
...
...
778
}
780
}
779
781
780
782
781
void oprof_start::setup_unit_masks(op_event_descr const & descr)
783
void oprof_start::setup_unit_masks(op_event_descr const & descr)
782
{
784
{
785
#define OP_MAX_HANDLED_UMS 16
783
    op_unit_mask const * um = descr.unit;
786
    op_unit_mask const * um = descr.unit;
784
787
785
    hide_masks();
788
    hide_masks();
786
789
787
    if (!um || um->unit_type_mask == utm_mandatory)
790
    if (!um || um->unit_type_mask == utm_mandatory)
788
        return;
791
        return;
789
792
793
  if (um->num > OP_MAX_HANDLED_UMS) {
794
      ostringstream error;
795
796
      error << "Number of unit masks (" << um->num << ") is greater than max allowed ("
797
            << OP_MAX_HANDLED_UMS << ").";
798
      QMessageBox::warning(this, 0, error.str().c_str());
799
      return;
800
  }
801
802
790
    event_setting & cfg = event_cfgs[descr.name];
803
    event_setting & cfg = event_cfgs[descr.name];
791
804
792
    unit_mask_group->setExclusive(um->unit_type_mask == utm_exclusive);
805
    unit_mask_group->setExclusive(um->unit_type_mask == utm_exclusive);
793
806
794
  for (size_t i = 0; i < um->num ; ++i) {
807
  for (size_t i = 0; i < OP_MAX_HANDLED_UMS; ++i) {
795
        QCheckBox * check = 0;
808
        QCheckBox * check = 0;
796
        switch (i) {
809
        switch (i) {
797
            case 0: check = check0; break;
810
            case 0: check = check0; break;
798
            case 1: check = check1; break;
811
            case 1: check = check1; break;
799
            case 2: check = check2; break;
812
            case 2: check = check2; break;
...
...
1066
1079
1067
1080
1068
// helper to retrieve an event descr through its name.
1081
// helper to retrieve an event descr through its name.
1069
op_event_descr const & oprof_start::locate_event(string const & name) const
1082
op_event_descr const & oprof_start::locate_event(string const & name) const
1070
{
1083
{
1071
  return *(find_if(v_events.begin(), v_events.end(), event_name_eq(name)));
1084
  vector<op_event_descr>::const_iterator it = find_if(v_events.begin(), v_events.end(),
1085
                                                      event_name_eq(name));
1086
1087
  // Failure to find the event should NEVER happen; I had to put this here to silence Coverity.
1088
  if (it != v_events.end())
1089
      return *it;
1090
1091
  QMessageBox::warning((oprof_start *)this, 0, "Could not locate event. Returning null event.");
1092
  null_evt.help_str = "";
1093
  null_evt.name = "";
1094
  return null_evt;
1072
}
1095
}