1 /* massXpert - the true massist's program.
2    --------------------------------------
3    Copyright(C) 2006,2007 Filippo Rusconi
4 
5    http://www.massxpert.org/massXpert
6 
7    This file is part of the massXpert project.
8 
9    The massxpert project is the successor to the "GNU polyxmass"
10    project that is an official GNU project package(see
11    www.gnu.org). The massXpert project is not endorsed by the GNU
12    project, although it is released ---in its entirety--- under the
13    GNU General Public License. A huge part of the code in massXpert
14    is actually a C++ rewrite of code in GNU polyxmass. As such
15    massXpert was started at the Centre National de la Recherche
16    Scientifique(FRANCE), that granted me the formal authorization to
17    publish it under this Free Software License.
18 
19    This software is free software; you can redistribute it and/or
20    modify it under the terms of the GNU  General Public
21    License version 3, as published by the Free Software Foundation.
22 
23 
24    This software is distributed in the hope that it will be useful,
25    but WITHOUT ANY WARRANTY; without even the implied warranty of
26    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27    General Public License for more details.
28 
29    You should have received a copy of the GNU General Public License
30    along with this software; if not, write to the
31 
32    Free Software Foundation, Inc.,
33 
34    51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
35 */
36 
37 #ifndef FRAGMENTATION_DLG_HPP
38 #define FRAGMENTATION_DLG_HPP
39 
40 
41 /////////////////////// Qt includes
42 #include <QMainWindow>
43 #include <QSortFilterProxyModel>
44 
45 
46 /////////////////////// Local includes
47 #include "ui_fragmentationDlg.h"
48 #include "fragmenter.hpp"
49 #include "sequenceEditorWnd.hpp"
50 #include "fragmentOligomerTableViewModel.hpp"
51 #include "fragmentOligomerTableViewSortProxyModel.hpp"
52 #include "fragOptions.hpp"
53 
54 
55 namespace massXpert
56 {
57 
58   class FragmentOligomerTableViewModel;
59   class FragmentOligomerTableViewSortProxyModel;
60 
61   class FragmentationDlg : public QDialog
62   {
63     Q_OBJECT
64 
65     private:
66     Ui::FragmentationDlg m_ui;
67     SequenceEditorWnd *mp_editorWnd;
68 
69     // The results-exporting strings. ////////////////////////////////
70     QString *mpa_resultsString;
71     QString m_resultsFilePath;
72     //////////////////////////////////// The results-exporting strings.
73 
74     OligomerList m_oligomerList;
75 
76     const QPointer<Polymer> mp_polymer;
77     const PolChemDef *mp_polChemDef;
78     CalcOptions m_calcOptions;
79     const IonizeRule *mp_ionizeRule;
80 
81     Fragmenter *mpa_fragmenter;
82 
83     FragmentOligomerTableViewModel *mpa_oligomerTableViewModel;
84     FragmentOligomerTableViewSortProxyModel *mpa_proxyModel;
85 
86     void closeEvent(QCloseEvent *event);
87 
88     // For the filtering of the data in the treeview.
89     QAction *filterAct;
90     double m_tolerance;
91     QWidget *mp_focusWidget;
92 
93     void setupTableView();
94 
95   public:
96     FragmentationDlg(QWidget *,
97 		      Polymer *, const PolChemDef *,
98 		      const CalcOptions &, const IonizeRule *);
99 
100     ~FragmentationDlg();
101 
102     bool populateSelectedOligomerData();
103     void populateFragSpecList();
104 
105     SequenceEditorWnd *editorWnd();
106 
107     void updateFragmentationDetails(const CalcOptions &);
108     void updateOligomerSequence(QString *);
109 
110     bool calculateTolerance(double);
111 
112     // The results-exporting functions. ////////////////////////////////
113     void prepareResultsTxtString();
114     bool exportResultsClipboard();
115     bool exportResultsFile();
116     bool selectResultsFile();
117     //////////////////////////////////// The results-exporting functions.
118 
119   public slots:
120     void fragment();
121     void exportResults(int);
122     void filterOptions(bool);
123     void filterOptionsToggled();
124     void filterPattern();
125     void filterMonoMass();
126     void filterAvgMass();
127     void filterCharge();
128   };
129 
130 } // namespace massXpert
131 
132 
133 #endif // FRAGMENTATION_DLG_HPP
134 
135