Skip to content

Commit

Permalink
Simulation Experiment view: now allow the editing and saving of a SED…
Browse files Browse the repository at this point in the history
…-ML file / COMBINE archive (closes #1366).
  • Loading branch information
agarny committed Dec 21, 2017
2 parents 9582435 + c1770c8 commit e2b282e
Show file tree
Hide file tree
Showing 8 changed files with 537 additions and 147 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Expand Up @@ -40,7 +40,7 @@ var jsonData = { "versions": [
{ "change": "<strong>General:</strong> addressed a problem with quickly changing files potentially resulting in the wrong view being shown (see issue <a href=\"https://github.com/opencor/opencor/issues/1481\">#1481</a>). Reworked our approach to the saving/reloading of a file (see issue <a href=\"https://github.com/opencor/opencor/issues/1491\">#1491</a>). Now pass `make[test].bat` arguments to `scripts/genericmake.bat` (see issue <a href=\"https://github.com/opencor/opencor/issues/1498\">#1498</a>)." },
{ "change": "<strong>CellML API:</strong> fixed a small problem that made OpenCOR crash if a metadata id contained \":\" (see issue <a href=\"https://github.com/opencor/opencor/issues/1487\">#1487</a>)." },
{ "change": "<strong>Graph panel widget:</strong> have the legend buttons use the same background as the plot area (see issue <a href=\"https://github.com/opencor/opencor/issues/1477\">#1477</a>). Got the legend context menu to work again (see issue <a href=\"https://github.com/opencor/opencor/issues/1478\">#1478</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> to reload a CellML file when in development mode now actually reloads it (see issue <a href=\"https://github.com/opencor/opencor/issues/1488\">#1488</a>). Made the (re)loading of remote files and SED-ML files / COMBINE archives much smoother (see issue <a href=\"https://github.com/opencor/opencor/issues/1492\">#1492</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> now allow the editing and saving of a SED-ML file / COMBINE archive (see issue <a href=\"https://github.com/opencor/opencor/issues/1366\">#1366</a>). To reload a CellML file when in development mode now actually reloads it (see issue <a href=\"https://github.com/opencor/opencor/issues/1488\">#1488</a>). Made the (re)loading of remote files and SED-ML files / COMBINE archives much smoother (see issue <a href=\"https://github.com/opencor/opencor/issues/1492\">#1492</a>)." },
{ "change": "<strong>Third-party libraries:</strong> upgraded <a href=\"https://www.openssl.org/\">OpenSSL</a> to version 1.0.2n (see issue <a href=\"https://github.com/opencor/opencor/issues/1483\">#1483</a>). Upgraded <a href=\"http://sbml.org/Software/libSBML/\">libSBML</a> to version 5.16.0 (see issue <a href=\"https://github.com/opencor/opencor/issues/1494\">#1494</a>)." }
]
},
Expand Down
4 changes: 0 additions & 4 deletions src/plugins/miscellaneous/Core/i18n/Core_fr.ts
Expand Up @@ -107,10 +107,6 @@
<source>The &lt;strong&gt;%1&lt;/strong&gt; view could not save &lt;strong&gt;%2&lt;/strong&gt;.</source>
<translation>La vue &lt;strong&gt;%1&lt;/strong&gt; n&apos;a pas pu sauvegarder &lt;strong&gt;%2&lt;/strong&gt;.</translation>
</message>
<message>
<source>&lt;strong&gt;%1&lt;/strong&gt; could not be saved.</source>
<translation>&lt;strong&gt;%1&lt;/strong&gt; n&apos;a pas pu être sauvegardé.</translation>
</message>
<message>
<source>New File</source>
<translation>Nouveau Fichier</translation>
Expand Down
32 changes: 6 additions & 26 deletions src/plugins/miscellaneous/Core/src/centralwidget.cpp
Expand Up @@ -1126,35 +1126,15 @@ bool CentralWidget::saveFile(const int &pIndex, const bool &pNeedNewFileName)
bool fileIsModified = fileManagerInstance->isModified(oldFileName);

if (fileIsModified || hasNewFileName) {
if (fileIsNew || fileIsModified) {
// The file is or has been modified, so ask the current view to save
// it
bool needFeedback = true;

bool needFeedback = true;

if (!fileHandlingInterface->saveFile(oldFileName, newFileName, needFeedback)) {
if (needFeedback) {
warningMessageBox(tr("Save File"),
tr("The <strong>%1</strong> view could not save <strong>%2</strong>.").arg(viewInterface->viewName(), newFileName));
}

return false;
}
} else {
// The file hasn't been modified, so we just make a physical copy of
// it
// Note: there may already be a file, which name is that of the one
// we want to use, so remove it (if no such file exists, then
// nothing will happen, so we are fine)...

QFile::remove(newFileName);

if (!QFile::copy(oldFileName, newFileName)) {
if (!fileHandlingInterface->saveFile(oldFileName, newFileName, needFeedback)) {
if (needFeedback) {
warningMessageBox(tr("Save File"),
tr("<strong>%1</strong> could not be saved.").arg(newFileName));

return false;
tr("The <strong>%1</strong> view could not save <strong>%2</strong>.").arg(viewInterface->viewName(), newFileName));
}

return false;
}

// Delete the 'old' file, if it was a new one that got saved
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/miscellaneous/Core/src/coreguiutils.cpp.inl
Expand Up @@ -351,22 +351,22 @@ QMessageBox::StandardButton showMessageBox(QWidget *pParent,
uint mask = QMessageBox::FirstButton;

while (mask <= QMessageBox::LastButton) {
uint sb = pButtons & mask;
uint standardButton = pButtons & mask;

mask <<= 1;

if (!sb)
if (!standardButton)
continue;

QPushButton *button = messageBox.addButton((QMessageBox::StandardButton)sb);
QPushButton *button = messageBox.addButton((QMessageBox::StandardButton) standardButton);

if (messageBox.defaultButton())
continue;

if ( ( (pDefaultButton == QMessageBox::NoButton)
&& (buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole))
|| ( (pDefaultButton != QMessageBox::NoButton) &&
(sb == uint(pDefaultButton)))) {
(standardButton == uint(pDefaultButton)))) {
messageBox.setDefaultButton(button);
}
}
Expand Down

0 comments on commit e2b282e

Please sign in to comment.