Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

TOPPASToolVertex.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Johannes Junker $
00032 // $Authors: Johannes Junker, Chris Bielow $
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     // documented in base class
00141     virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
00142     // documented in base class
00143     virtual QRectF boundingRect() const;
00144     // documented in base class
00145     virtual QPainterPath shape() const;
00146     // documented in base class
00147     virtual void setTopoNr(UInt nr);
00148     // documented in base class
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

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:45 using doxygen 1.7.1