Skip to content

Commit

Permalink
Merge 94041d9 into e9733f6
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jul 12, 2018
2 parents e9733f6 + 94041d9 commit adaee73
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cellmltextviewwidget.h"
#include "corecliutils.h"
#include "coreguiutils.h"
#include "filemanager.h"

//==============================================================================

Expand Down Expand Up @@ -374,12 +375,14 @@ QString CellMLTextViewPlugin::viewDefaultFileExtension() const

QWidget * CellMLTextViewPlugin::viewWidget(const QString &pFileName)
{
// Make sure that we are dealing with a CellML 1.0/1.1 file
// Make sure that we are dealing with either a new file or a CellML 1.0/1.1
// file

CellMLSupport::CellmlFile::Version cellmlVersion = CellMLSupport::CellmlFile::fileVersion(pFileName);

if ( (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_0)
&& (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_1)) {
if ( !Core::FileManager::instance()->isNew(pFileName)
&& (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_0)
&& (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_1)) {
return 0;
}

Expand Down
8 changes: 5 additions & 3 deletions src/plugins/editing/RawCellMLView/src/rawcellmlviewplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,14 @@ QString RawCellMLViewPlugin::viewDefaultFileExtension() const

QWidget * RawCellMLViewPlugin::viewWidget(const QString &pFileName)
{
// Make sure that we are dealing with a CellML 1.0/1.1 file
// Make sure that we are dealing with either a new file or a CellML 1.0/1.1
// file

CellMLSupport::CellmlFile::Version cellmlVersion = CellMLSupport::CellmlFile::fileVersion(pFileName);

if ( (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_0)
&& (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_1)) {
if ( !Core::FileManager::instance()->isNew(pFileName)
&& (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_0)
&& (cellmlVersion != CellMLSupport::CellmlFile::Cellml_1_1)) {
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ QString RawSEDMLViewPlugin::viewDefaultFileExtension() const

QWidget * RawSEDMLViewPlugin::viewWidget(const QString &pFileName)
{
// Make sure that we are dealing with a SED-ML file
// Make sure that we are dealing with a SED-ML file (be it new or not)

if (!SEDMLSupport::SedmlFileManager::instance()->sedmlFile(pFileName))
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/editing/RawTextView/src/rawtextviewplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ QString RawTextViewPlugin::viewDefaultFileExtension() const

QWidget * RawTextViewPlugin::viewWidget(const QString &pFileName)
{
// Make sure that we are dealing with a text file
// Make sure that we are dealing with a text file (be it new or not)

if (!Core::isTextFile(pFileName))
return 0;
Expand Down

0 comments on commit adaee73

Please sign in to comment.