~vbursian/research-assistant/intervers

« back to all changes in this revision

Viewing changes to RAGUI/AttrDlg.cpp

  • Committer: Viktor Bursian at blin-Ubuntu
  • Date: 2013-07-31 11:53:30 UTC
  • mto: (4.2.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: vbursian@gmail.com-20130731115330-low3tw5f8clsmq9y
Привёл в порядок sAttrName (инициировано багом из-за неопределённого operator!=)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
////////////////////////////////////////////////////////////////////////////////
2
 
/*! @file AttrDlg.cpp   Редактирование имён атрибутов.
 
2
/*! @file AttrDlg.cpp   Class sAttrDlg.
3
3
- Part of RAGUI - Research Assistant Graphical User Interface.
4
4
- Uses  QtGui v.4.6  -  http://qt.nokia.com/
5
5
- Uses  RANet - Research Assistant Net Library (based on ANSI C++).
23
23
 
24
24
sAttrDlg::~sAttrDlg()
25
25
{
26
 
//    delete ui;
27
26
}
28
27
 
29
28
 
135
134
  connect(btnSymbolic,SIGNAL(clicked()),fldSymbolicName,SLOT(setFocus()));
136
135
 
137
136
  btnAtomic->setEnabled(false);
138
 
  SetAttrName(sAttributeName());
 
137
  SetAttrName(sAttrName());
139
138
}
140
139
 
141
140
 
142
 
void  sAttrDlg::SetAttrName (sAttributeName  name)
 
141
void  sAttrDlg::SetAttrName (sAttrName  name)
143
142
{
144
143
  TheAttrName=name;
145
144
  switch( TheAttrName.Type() ){
146
 
    case sAttributeName::NamelessAttr:
 
145
    case sAttrName::cNameless:
147
146
        btnNameless->setChecked(true);
148
147
        fldAtomId->setVisible(false);
149
148
        fldNumber->setVisible(false);
150
149
        fldSymbolicName->setVisible(false);
151
150
        break;
152
 
    case sAttributeName::AtomicAttr:
153
 
        btnAtomic->setChecked(true);
154
 
        fldAtomId->setVisible(true);
155
 
        fldAtomId->setText(literal(TheAttrName.TextWithoutTypeIndication()));
156
 
        fldNumber->setVisible(false);
157
 
        fldSymbolicName->setVisible(false);
158
 
        break;
159
 
    case sAttributeName::NumericAttr:
 
151
    case sAttrName::cNumeric:
160
152
        btnNumeric->setChecked(true);
161
153
        fldAtomId->setVisible(false);
162
154
        fldNumber->setVisible(true);
163
 
        fldNumber->setValue((unsigned int)TheAttrName);
 
155
        fldNumber->setValue(TheAttrName.ToNumber());
164
156
        fldSymbolicName->setVisible(false);
165
157
        fldNumber->setFocus();
166
158
        break;
167
 
    case sAttributeName::SymbolicAttr:
 
159
    case sAttrName::cSymbolic:
168
160
        btnSymbolic->setChecked(true);
169
161
        fldAtomId->setVisible(false);
170
162
        fldNumber->setVisible(false);
171
163
        fldSymbolicName->setVisible(true);
172
 
        fldSymbolicName->setText(ToQString(TheAttrName
173
 
                                                .TextWithoutTypeIndication()));
 
164
        fldSymbolicName->setText(ToQString(TheAttrName.ToString()));
174
165
        fldSymbolicName->setFocus();
175
166
        break;
176
 
  };
 
167
//    case sAttrName::cAtomic:
 
168
//        btnAtomic->setChecked(true);
 
169
//        fldAtomId->setVisible(true);
 
170
//        fldAtomId->setText(literal(TheAttrName.TextWithoutTypeIndication()));
 
171
//        fldNumber->setVisible(false);
 
172
//        fldSymbolicName->setVisible(false);
 
173
//        break;
 
174
  }
177
175
}
178
176
 
179
177
 
211
209
  if( btnAtomic->isChecked() ){
212
210
    return false;
213
211
  }else if( btnNumeric->isChecked() ){
214
 
    TheAttrName=sAttributeName(fldNumber->value());
 
212
    TheAttrName=sAttrName(fldNumber->value());
215
213
    return true;
216
214
  }else if( btnSymbolic->isChecked() ){
217
215
    if( ! fldSymbolicName->text().isEmpty() ){
218
 
      TheAttrName=sAttributeName(FromQString(fldSymbolicName->text()));
 
216
      TheAttrName=sAttrName(FromQString(fldSymbolicName->text()));
219
217
      return true;
220
218
    }else{
221
219
 
223
221
      return false;
224
222
    };
225
223
  }else{
226
 
    TheAttrName=sAttributeName();
 
224
    TheAttrName=sAttrName();
227
225
    return true;
228
 
  };
 
226
  }
229
227
}
230
228
 
231
229
 
238
236
        break;
239
237
    default:
240
238
        break;
241
 
  };
 
239
  }
242
240
}
243
241
 
244
242
//------------------------------------------------------------------------------