Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_VISUAL_TOPPASTOOLVERTEX_H
00036 #define OPENMS_VISUAL_TOPPASTOOLVERTEX_H
00037
00038 #include <OpenMS/VISUAL/TOPPASVertex.h>
00039 #include <OpenMS/DATASTRUCTURES/Param.h>
00040
00041 #include <QtCore/QVector>
00042
00043 namespace OpenMS
00044 {
00055 class OPENMS_GUI_DLLAPI TOPPASToolVertex :
00056 public TOPPASVertex
00057 {
00058 Q_OBJECT
00059
00060 public:
00062 enum TOOLSTATUS {TOOL_READY, TOOL_SCHEDULED, TOOL_RUNNING, TOOL_SUCCESS, TOOL_CRASH, TOOLSTATUS_SIZE};
00063
00065 struct IOInfo
00066 {
00068 IOInfo() :
00069 type(IOT_FILE),
00070 param_name(),
00071 valid_types()
00072 {
00073 }
00074
00076 IOInfo(const IOInfo & rhs) :
00077 type(rhs.type),
00078 param_name(rhs.param_name),
00079 valid_types(rhs.valid_types)
00080 {
00081 }
00082
00084 enum IOType
00085 {
00086 IOT_FILE,
00087 IOT_LIST
00088 };
00089
00091 bool operator<(const IOInfo & rhs) const
00092 {
00093 if (type != rhs.type)
00094 {
00095 return type == IOT_FILE;
00096 }
00097 else
00098 {
00099 return param_name.compare(rhs.param_name) < 0;
00100 }
00101 }
00102
00104 IOInfo & operator=(const IOInfo & rhs)
00105 {
00106 type = rhs.type;
00107 param_name = rhs.param_name;
00108 valid_types = rhs.valid_types;
00109
00110 return *this;
00111 }
00112
00114 IOType type;
00116 String param_name;
00118 StringList valid_types;
00119 };
00120
00122 TOPPASToolVertex();
00124 TOPPASToolVertex(const String & name, const String & type = "");
00126 TOPPASToolVertex(const TOPPASToolVertex & rhs);
00128 virtual ~TOPPASToolVertex();
00130 TOPPASToolVertex & operator=(const TOPPASToolVertex & rhs);
00131
00133 virtual String getName() const;
00135 const String & getType() const;
00137 void getInputParameters(QVector<IOInfo> & input_infos);
00139 void getOutputParameters(QVector<IOInfo> & output_infos);
00140
00141 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
00142
00143 virtual QRectF boundingRect() const;
00144
00145 virtual QPainterPath shape() const;
00146
00147 virtual void setTopoNr(UInt nr);
00148
00149 virtual void reset(bool reset_all_files = false);
00151 void setParam(const Param & param);
00153 const Param & getParam();
00155 void run();
00159 bool updateCurrentOutputFileNames(const RoundPackages & pkg, String & error_message);
00161 TOOLSTATUS getStatus() const;
00163 void editParam();
00165 int numIterations();
00167 String getFullOutputDirectory() const;
00169 String getOutputDir() const;
00171 void createDirs();
00173 void openContainingFolder();
00175 void openInTOPPView();
00177 bool refreshParameters();
00179 bool isToolReady() const;
00181 void toggleBreakpoint();
00183 virtual void emitToolStarted();
00185 virtual bool invertRecylingMode();
00186
00187 public slots:
00188
00190 void executionFinished(int ec, QProcess::ExitStatus es);
00192 void forwardTOPPOutput();
00194 void toolStartedSlot();
00196 void toolFinishedSlot();
00198 void toolCrashedSlot();
00200 void toolFailedSlot();
00202 virtual void toolScheduledSlot();
00204 virtual void inEdgeHasChanged();
00206 virtual void outEdgeHasChanged();
00207
00208 signals:
00209
00211 void toolStarted();
00213 void toolFinished();
00215 void toolCrashed();
00217 void toolFailed(const QString & message = "");
00219 void toppOutputReady(const QString & out);
00220
00221 protected:
00222
00224
00225 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e);
00227
00229 bool doesParamChangeInvalidate_();
00231 bool renameOutput_();
00233 bool initParam_(const QString & old_ini_file = "");
00235 void getParameters_(QVector<IOInfo> & io_infos, bool input_params);
00237 void writeParam_(const Param & param, const QString & ini_file);
00239 QString toolnameWithWhitespacesForFancyWordWrapping_(QPainter * painter, const QString & str);
00240
00242 String name_;
00244 String type_;
00246 String tmp_path_;
00248 Param param_;
00250 TOOLSTATUS status_;
00252 bool tool_ready_;
00253
00255 static UInt uid_;
00256
00258 bool breakpoint_set_;
00259
00262 void smartFileNames_(std::vector< QStringList >& filenames);
00263
00264 };
00265 }
00266
00267 #endif