Skip to content

Commit

Permalink
Forcefields list on Forcefields panel now displays original filename …
Browse files Browse the repository at this point in the history
…as tooltip. Made Forcefield plugin-aware. Updated forcefield editor so that it doesn't allow overwriting of Forcefields in anything other than Aten's own format. Fixed - forcefield editor did not edit type elements correctly.
  • Loading branch information
trisyoungs committed Dec 4, 2016
1 parent c501d03 commit 3a341fc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/gui/ffeditor_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ AtenForcefieldEditor::AtenForcefieldEditor(QWidget* parent) : QDialog(parent)

// Set item delegates for columns
int n;
ui.FFEditorTypesTable->setItemDelegateForColumn(TypeColumn::Id, new TIntegerSpinDelegate(this, 1, ElementMap::nElements(), 1));
ui.FFEditorTypesTable->setItemDelegateForColumn(TypeColumn::Id, new TIntegerSpinDelegate(this));
ui.FFEditorAtomsTable->setItemDelegateForColumn(AtomColumn::Charge, new TDoubleSpinDelegate(this));
for (n=AtomColumn::Data1; n<=AtomColumn::Data10; ++n) ui.FFEditorAtomsTable->setItemDelegateForColumn(n, new TDoubleSpinDelegate(this));
for (n=BondColumn::Data1; n<=BondColumn::Data10; ++n) ui.FFEditorBondsTable->setItemDelegateForColumn(n, new TDoubleSpinDelegate(this));
Expand Down Expand Up @@ -119,7 +119,7 @@ void AtenForcefieldEditor::populate(Forcefield* ff)
{
item = new QTableWidgetItem(QString::number(ffa->typeId()));
ui.FFEditorTypesTable->setItem(count, TypeColumn::Id, item);
item = new QTableWidgetItem(ElementMap::symbol(ffa->neta()->characterElement()));
item = new QTableWidgetItem(ElementMap::symbol(ffa->element()));
ui.FFEditorTypesTable->setItem(count, TypeColumn::Element, item);
item = new QTableWidgetItem(ffa->name());
ui.FFEditorTypesTable->setItem(count, TypeColumn::Name, item);
Expand Down Expand Up @@ -420,7 +420,7 @@ void AtenForcefieldEditor::on_FFEditorTypesTable_itemChanged(QTableWidgetItem *w
// Set new data based on the column edited
QString text;
ForcefieldAtom* old;
int n, returnvalue;
int n, returnvalue, z;
switch (column)
{
// Forcefield TypeId
Expand All @@ -440,7 +440,12 @@ void AtenForcefieldEditor::on_FFEditorTypesTable_itemChanged(QTableWidgetItem *w
break;
// Character element
case (TypeColumn::Element):
// ffa->setName(qPrintable(w->text()));
z = ElementMap::alphaToZ(w->text());
ffa->setElement(z);
ffa->neta()->setCharacterElement(z);

// Set widget text back to reflect conversion
w->setText(ElementMap::symbol(ffa->element()));
break;
// Type name
case (TypeColumn::Name):
Expand All @@ -452,7 +457,7 @@ void AtenForcefieldEditor::on_FFEditorTypesTable_itemChanged(QTableWidgetItem *w
break;
// NETA description
case (TypeColumn::NETAString):
// ffa->setName(qPrintable(w->text())); //TODO
printf("EDITING NETA STRING IN THIS WAY IS NOT IMPLEMENTED YET.\n");
break;
// Type (text) description
case (TypeColumn::Description):
Expand All @@ -461,6 +466,7 @@ void AtenForcefieldEditor::on_FFEditorTypesTable_itemChanged(QTableWidgetItem *w
default:
break;
}

updating_ = false;
}

Expand Down

0 comments on commit 3a341fc

Please sign in to comment.