MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / load

Method load

src/openms_gui/source/VISUAL/TOPPASScene.cpp:820–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

818 }
819
820 void TOPPASScene::load(const String& file)
821 {
822 file_name_ = file;
823
824 if (File::empty(file)) // allow opening of 0-byte files as pretend they are empty, new TOPPAS files
825 {
826 return;
827 }
828
829 Param load_param;
830 ParamXMLFile paramFile;
831 paramFile.load(file, load_param);
832
833 // check for TOPPAS file version. Deny loading if too old or too new
834 // get version of TOPPAS file
835 String file_version = "1.8.0"; // default (were we did not have the tag)
836 if (load_param.exists("info:version"))
837 {
838 file_version = load_param.getValue("info:version").toString();
839 }
840 VersionInfo::VersionDetails v_file = VersionInfo::VersionDetails::create(file_version);
841 VersionInfo::VersionDetails v_this_low = VersionInfo::VersionDetails::create("1.9.0"); // last compatible TOPPAS file version
842 VersionInfo::VersionDetails v_this_high = VersionInfo::VersionDetails::create(VersionInfo::getVersion()); // last compatible TOPPAS file version
843 if (v_file < v_this_low)
844 {
845 if (!this->gui_)
846 {
847 std::cerr << "The TOPPAS file is too old! Please update the file using TOPPAS or INIUpdater!" << std::endl;
848 }
849 else if (this->gui_)
850 {
851 if (QMessageBox::warning(nullptr, tr("Old TOPPAS file -- convert and override?"), tr("The TOPPAS file you downloaded was created with an old incompatible version of TOPPAS.\nShall we try to convert the file?! The original file will be overridden, but a backup file will be saved in the same directory.\n"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
852 {
853 return;
854 }
855 // only update in GUI mode, as in non-GUI mode, we'd create infinite recursive calls when instantiating TOPPASScene in INIUpdater
856#ifdef OPENMS_WINDOWSPLATFORM
857 String extra_quotes = "\""; // note: double quoting required for Windows, as outer quotes are required by cmd.exe (arghh)...
858#else
859 String extra_quotes = "";
860#endif
861
862 String cmd = extra_quotes + "\"" + File::findSiblingTOPPExecutable("INIUpdater") + "\" -in \"" + file + "\" -i " + extra_quotes;
863 std::cerr << cmd << "\n\n";
864 if (std::system(cmd.c_str()))
865 {
866 QMessageBox::warning(nullptr, tr("INIUpdater failed"), tr("Updating using the INIUpdater tool failed. Please submit a bug report!\n"), QMessageBox::Ok);
867 return;
868 }
869 // reload updated file
870 ParamXMLFile paramFile;
871 paramFile.load(file, load_param);
872 }
873 }
874 else if (v_file > v_this_high)
875 {
876 if (this->gui_ && QMessageBox::warning(nullptr, tr("TOPPAS file too new"), tr("The TOPPAS file you downloaded was created with a more recent version of TOPPAS. Shall we will try to open it?\nIf this fails, update to the new TOPPAS version.\n"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
877 {

Callers

nothing calls this directly

Calls 15

backMethod · 0.80
toIntMethod · 0.80
setOutputFolderNameMethod · 0.80
setRecyclingMethod · 0.80
setSourceVertexMethod · 0.80
setTargetVertexMethod · 0.80
addOutEdgeMethod · 0.80
addInEdgeMethod · 0.80
setSourceOutParamMethod · 0.80
setTargetInParamMethod · 0.80
getOutputParametersMethod · 0.80
getInputParametersMethod · 0.80

Tested by

no test coverage detected