OpenMS  2.8.0
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-2021.
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 
68  class OPENMS_GUI_DLLAPI ToolsDialog :
69  public QDialog
70  {
71  Q_OBJECT
72 
73 public:
84  ToolsDialog(QWidget * parent, const Param& params, String ini_file, String default_dir, LayerDataBase::DataType layer_type, String layer_name);
86  ~ToolsDialog() override;
87 
94 
95 private:
99  QLabel * tool_desc_;
101  QComboBox * tools_combo_;
103  QComboBox * input_combo_;
105  QComboBox * output_combo_;
111  QPushButton * ok_button_;
113  std::map<String, String> arg_map_;
119  QString filename_;
121  std::map<String, LayerDataBase::DataType> tool_map_;
124 
126  void disable_();
128  void enable_();
130  std::vector<LayerDataBase::DataType> getTypesFromParam_(const Param& p) const;
131  // Fill input_combo_ and output_combo_ box with the appropriate entries from the specified param object.
132  void setInputOutputCombo_(const Param& p);
133 
134 protected slots:
135 
137  void ok_();
139  void setTool_(int i);
141  void createINI_();
143  void loadINI_();
145  void storeINI_();
146  };
147 
148 }
DataType
Definition: LayerDataBase.h:106
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
TOPP tool selection dialog.
Definition: ToolsDialog.h:70
Param arg_param_
Param for loading the ini-file.
Definition: ToolsDialog.h:107
ToolsDialog(QWidget *parent, const Param &params, String ini_file, String default_dir, LayerDataBase::DataType layer_type, String layer_name)
Constructor.
Param params_
Param object containing all TOPP tool/util params.
Definition: ToolsDialog.h:123
std::map< String, String > arg_map_
map for getting the parameter name from the full path in arg_param
Definition: ToolsDialog.h:113
Param vis_param_
Param for loading configuration information in the ParamEditor.
Definition: ToolsDialog.h:109
QComboBox * output_combo_
for choosing an output parameter
Definition: ToolsDialog.h:105
void disable_()
Disables the ok button and input/output comboboxes.
void setInputOutputCombo_(const Param &p)
void storeINI_()
stores an ini-file from the editor_
QString filename_
name of ini-file
Definition: ToolsDialog.h:119
void ok_()
if ok button pressed show the tool output in a new layer, a new window or standard output as messageb...
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.
QComboBox * input_combo_
for choosing an input parameter
Definition: ToolsDialog.h:103
String ini_file_
Location of the temporary INI file this dialog works on.
Definition: ToolsDialog.h:115
std::map< String, LayerDataBase::DataType > tool_map_
Mapping of file extension to layer type to determine the type of a tool.
Definition: ToolsDialog.h:121
QLabel * tool_desc_
tools description label
Definition: ToolsDialog.h:99
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_
String default_dir_
default-dir of ini-file to open
Definition: ToolsDialog.h:117
~ToolsDialog() override
Destructor.
QPushButton * ok_button_
ok-button connected with slot ok_()
Definition: ToolsDialog.h:111
String getInput()
to get the parameter name for input
void setTool_(int i)
Slot that handles changing of the tool.
ParamEditor * editor_
ParamEditor for reading ini-files.
Definition: ToolsDialog.h:97
String getOutput()
to get the parameter name for output. Empty if no output was selected.
QComboBox * tools_combo_
ComboBox for choosing a TOPP-tool.
Definition: ToolsDialog.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47