OpenMS
ToolsDialog.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
42 
43 class QLabel;
44 class QComboBox;
45 class QPushButton;
46 class QString;
47 
48 #include <QtWidgets/QDialog>
49 
50 namespace OpenMS
51 {
52  class ParamEditor;
53  class TVToolDiscovery;
54 
69  class OPENMS_GUI_DLLAPI ToolsDialog :
70  public QDialog
71  {
72  Q_OBJECT
73 
74 public:
85  ToolsDialog(QWidget * parent, const Param& params, String ini_file, String default_dir, LayerDataBase::DataType layer_type, const String& layer_name, TVToolDiscovery* tool_scanner);
87  ~ToolsDialog() override;
88 
95 
96 private:
100  QLabel * tool_desc_;
102  QComboBox * tools_combo_;
106  QComboBox * input_combo_;
108  QComboBox * output_combo_;
114  QPushButton * ok_button_;
120  QString filename_;
122  std::map<String, LayerDataBase::DataType> tool_map_;
131 
133  void disable_();
135  void enable_();
137  std::vector<LayerDataBase::DataType> getTypesFromParam_(const Param& p) const;
139  void setInputOutputCombo_(const Param& p);
141  QStringList createToolsList_();
142 
143 protected slots:
144 
146  void ok_();
148  void setTool_(int i);
150  void createINI_();
152  void loadINI_();
154  void storeINI_();
157  };
158 
159 }
A GUI for editing or viewing a Param object.
Definition: ParamEditor.h:180
Management and storage of parameters / INI files.
Definition: Param.h:70
A more convenient string class.
Definition: String.h:60
Scans for tools/utils and generates a param for each asynchronously.
Definition: TVToolDiscovery.h:63
TOPP tool selection dialog.
Definition: ToolsDialog.h:71
Param arg_param_
Param for loading the ini-file.
Definition: ToolsDialog.h:110
QPushButton * reload_plugins_button_
Button to rerun the automatic plugin detection.
Definition: ToolsDialog.h:104
Param vis_param_
Param for loading configuration information in the ParamEditor.
Definition: ToolsDialog.h:112
Param plugin_params_
Param object containing all plugin params.
Definition: ToolsDialog.h:126
QStringList createToolsList_()
Create a list of all TOPP tool/util/plugins that are compatible with the active layer type.
QComboBox * output_combo_
for choosing an output parameter
Definition: ToolsDialog.h:108
void disable_()
Disables the ok button and input/output comboboxes.
void setInputOutputCombo_(const Param &p)
Fill input_combo_ and output_combo_ box with the appropriate entries from the specified param object.
void storeINI_()
stores an ini-file from the editor
QString filename_
name of ini-file
Definition: ToolsDialog.h:120
void ok_()
if ok button pressed show the tool output in a new layer, a new window or standard output as messageb...
LayerDataBase::DataType layer_type_
The layer type of the current layer to determine all usable plugins.
Definition: ToolsDialog.h:130
std::vector< LayerDataBase::DataType > getTypesFromParam_(const Param &p) const
Determine all types a tool is compatible with by mapping each file extensions in a tools param.
void enable_()
Enables the ok button and input/output comboboxes.
TVToolDiscovery * tool_scanner_
Pointer to the tool scanner for access to the plugins and to rerun the plugins detection.
Definition: ToolsDialog.h:128
QComboBox * input_combo_
for choosing an input parameter
Definition: ToolsDialog.h:106
String ini_file_
Location of the temporary INI file this dialog works on.
Definition: ToolsDialog.h:116
std::map< String, LayerDataBase::DataType > tool_map_
Mapping of file extension to layer type to determine the type of a tool.
Definition: ToolsDialog.h:122
QLabel * tool_desc_
tools description label
Definition: ToolsDialog.h:100
void createINI_()
Slot that retrieves and displays the defaults.
String getTool()
to get the currently selected tool-name
void loadINI_()
loads an ini-file into the editor
ToolsDialog(QWidget *parent, const Param &params, String ini_file, String default_dir, LayerDataBase::DataType layer_type, const String &layer_name, TVToolDiscovery *tool_scanner)
Constructor.
String default_dir_
default-dir of ini-file to open
Definition: ToolsDialog.h:118
~ToolsDialog() override
Destructor.
QPushButton * ok_button_
ok-button connected with slot ok_()
Definition: ToolsDialog.h:114
String getInput()
to get the parameter name for input
void setTool_(int i)
Slot that handles changing of the tool.
Param tool_params_
Param object containing all TOPP tool/util params.
Definition: ToolsDialog.h:124
ParamEditor * editor_
ParamEditor for reading ini-files.
Definition: ToolsDialog.h:98
String getOutput()
to get the parameter name for output. Empty if no output was selected.
void reloadPlugins_()
rerun the automatic plugin detection
QComboBox * tools_combo_
ComboBox for choosing a TOPP-tool.
Definition: ToolsDialog.h:102
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
DataType
Definition: LayerDataBase.h:99