1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_GT_UTILS_OPTION_PANEL_MSA_H_
23 #define _U2_GT_UTILS_OPTION_PANEL_MSA_H_
24 
25 #include <GTGlobals.h>
26 
27 class QLineEdit;
28 class QPushButton;
29 class QToolButton;
30 
31 namespace U2 {
32 
33 class GTUtilsOptionPanelMsa {
34 public:
35     enum Tabs {
36         General,
37         Highlighting,
38         PairwiseAlignment,
39         TreeSettings,
40         ExportConsensus,
41         Statistics,
42         Search
43     };
44 
45     enum AddRefMethod {
46         Button,
47         Completer
48     };
49 
50     enum ThresholdComparison {
51         LessOrEqual,
52         GreaterOrEqual
53     };
54 
55     enum class CopyFormat {
56         Fasta,
57         CLUSTALW,
58         Stocholm,
59         MSF,
60         NEXUS,
61         Mega,
62         PHYLIP_Interleaved,
63         PHYLIP_Sequential,
64         Rich_text
65     };
66 
67     static const QMap<Tabs, QString> tabsNames;
68     static const QMap<Tabs, QString> innerWidgetNames;
69 
70     static void toggleTab(HI::GUITestOpStatus &os, Tabs tab);
71     static QWidget *openTab(HI::GUITestOpStatus &os, Tabs tab);
72     static void closeTab(HI::GUITestOpStatus &os, Tabs tab);
73     static bool isTabOpened(HI::GUITestOpStatus &os, Tabs tab);
74     static void checkTabIsOpened(HI::GUITestOpStatus &os, Tabs tab);
75 
76     static void addReference(HI::GUITestOpStatus &os, QString seqName, AddRefMethod method = Button);
77     static void addFirstSeqToPA(HI::GUITestOpStatus &os, QString seqName, AddRefMethod method = Button);
78     static void addSecondSeqToPA(HI::GUITestOpStatus &os, QString seqName, AddRefMethod method = Button);
79     static QString getSeqFromPAlineEdit(HI::GUITestOpStatus &os, int num);
80     static void removeReference(HI::GUITestOpStatus &os);
81     static QString getReference(HI::GUITestOpStatus &os);
82     static int getLength(HI::GUITestOpStatus &os);
83     static int getHeight(HI::GUITestOpStatus &os);
84     static void copySelection(HI::GUITestOpStatus &os, const CopyFormat format = CopyFormat::CLUSTALW);
85 
86     static void setColorScheme(HI::GUITestOpStatus &os, const QString &colorSchemeName, GTGlobals::UseMethod method = GTGlobals::UseKeyBoard);
87     static QString getColorScheme(HI::GUITestOpStatus &os);
88 
89     static void setHighlightingScheme(HI::GUITestOpStatus &os, const QString &highlightingSchemeName);
90 
91     // functions for accessing PA gui elements
92     static QToolButton *getAddButton(HI::GUITestOpStatus &os, int number);
93     static QLineEdit *getSeqLineEdit(HI::GUITestOpStatus &os, int number);
94     static QToolButton *getDeleteButton(HI::GUITestOpStatus &os, int number);
95     static QPushButton *getAlignButton(HI::GUITestOpStatus &os);
96     static void setPairwiseAlignmentAlgorithm(HI::GUITestOpStatus &os, const QString &algorithm);
97 
98     // functions for accessing Highlighting schemes options elements
99     static void setThreshold(HI::GUITestOpStatus &os, int threshold);
100     static int getThreshold(HI::GUITestOpStatus &os);
101 
102     static void setThresholdComparison(HI::GUITestOpStatus &os, ThresholdComparison comparison);
103     static ThresholdComparison getThresholdComparison(HI::GUITestOpStatus &os);
104 
105     static void setUseDotsOption(HI::GUITestOpStatus &os, bool useDots);
106     static bool isUseDotsOptionSet(HI::GUITestOpStatus &os);
107 
108     // functions for accessing "Export consensus" options elements
109     static void setExportConsensusOutputPath(HI::GUITestOpStatus &os, const QString &filePath);
110     static QString getExportConsensusOutputPath(HI::GUITestOpStatus &os);
111 
112     static QString getExportConsensusOutputFormat(HI::GUITestOpStatus &os);
113 
114     // functions for accessing "Find pattern" options elements
115     static void enterPattern(HI::GUITestOpStatus &os, QString pattern, bool useCopyPaste = false);
116     static QString getPattern(HI::GUITestOpStatus &os);
117     static void setAlgorithm(HI::GUITestOpStatus &os, QString algorithm);
118     static void setMatchPercentage(HI::GUITestOpStatus &os, int percentage);
119     static void setCheckedRemoveOverlappedResults(HI::GUITestOpStatus &os, bool checkedState = true);
120     static void checkResultsText(HI::GUITestOpStatus &os, QString expectedText);
121     static void setRegionType(HI::GUITestOpStatus &os, const QString &regionType);
122     static void setRegion(HI::GUITestOpStatus &os, int from, int to);
123     static void setSearchContext(HI::GUITestOpStatus &os, const QString &context);
124 
125     static void clickNext(HI::GUITestOpStatus &os);
126     static void clickPrev(HI::GUITestOpStatus &os);
127 
128     static bool isSearchInShowHideWidgetOpened(HI::GUITestOpStatus &os);
129     static void openSearchInShowHideWidget(HI::GUITestOpStatus &os, bool open = true);
130 
131     /** Returns text of the label that shows alignment alphabet. Requies "General" options panel to be opened. */
132     static QString getAlphabetLabelText(HI::GUITestOpStatus &os);
133 
134 private:
135     static QWidget *getWidget(HI::GUITestOpStatus &os, const QString &widgetName, int number);
136 
137     static void addSeqToPA(HI::GUITestOpStatus &os, QString seqName, AddRefMethod method, int number);
138 
139     static QMap<Tabs, QString> initNames();
140     static QMap<Tabs, QString> initInnerWidgetNames();
141 };
142 
143 }  // namespace U2
144 
145 #endif  // _U2_GT_UTILS_OPTION_PANEL_MSA_H_
146