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_SEQUENCE_VIEW_H_
23 #define _U2_GT_UTILS_OPTION_PANEL_SEQUENCE_VIEW_H_
24 
25 #include <QLineEdit>
26 #include <QToolButton>
27 
28 #include "GTGlobals.h"
29 
30 namespace U2 {
31 
32 class GTUtilsOptionPanelSequenceView {
33 public:
34     enum Tabs {
35         Search,
36         AnnotationsHighlighting,
37         Statistics,
38         InSilicoPcr,
39         CircularView
40     };
41 
42     enum AddRefMethod {
43         Button,
44         Completer
45     };
46 
47     static const QMap<Tabs, QString> tabsNames;
48     static const QMap<Tabs, QString> innerWidgetNames;
49 
50     static void toggleTab(HI::GUITestOpStatus &os, Tabs tab);
51     static void openTab(HI::GUITestOpStatus &os, Tabs tab);
52     static void closeTab(HI::GUITestOpStatus &os, Tabs tab);
53     static bool isTabOpened(HI::GUITestOpStatus &os, Tabs tab);
54     static void checkTabIsOpened(HI::GUITestOpStatus &os, Tabs tab);
55 
56     // Find pattern options panel tab
57     static void enterPattern(HI::GUITestOpStatus &os, QString pattern, bool useCopyPaste = false);
58     static void enterPatternFromFile(HI::GUITestOpStatus &os, QString filepath, QString filename);
59 
60     static bool checkResultsText(HI::GUITestOpStatus &os, QString expectedText);
61 
62     static void setSearchWithAmbiguousBases(HI::GUITestOpStatus &os, bool searchWithAmbiguousBases = true);
63     static void setStrand(HI::GUITestOpStatus &os, QString strandStr);
64     static void setRegionType(HI::GUITestOpStatus &os, const QString &regionType);
65     static void setRegion(HI::GUITestOpStatus &os, int from, int to);
66     static void setSearchInTranslation(HI::GUITestOpStatus &os, bool inTranslation = true);
67     static void setSearchInLocation(HI::GUITestOpStatus &os, QString strandStr);
68     static void setSetMaxResults(HI::GUITestOpStatus &os, int maxResults);
69     static void setAlgorithm(HI::GUITestOpStatus &os, QString algorithm);
70     static void setMatchPercentage(HI::GUITestOpStatus &os, int percentage);
71     static void setUsePatternName(HI::GUITestOpStatus &os, bool setChecked = true);
72 
73     static int getMatchPercentage(HI::GUITestOpStatus &os);
74     static QString getRegionType(HI::GUITestOpStatus &os);
75     static QPair<int, int> getRegion(HI::GUITestOpStatus &os);
76     static const QString getHintText(HI::GUITestOpStatus &os);
77 
78     static void enterFilepathForSavingAnnotations(HI::GUITestOpStatus &os, QString filepath);
79 
80     static void toggleInputFromFilePattern(HI::GUITestOpStatus &os);
81 
82     static void toggleSaveAnnotationsTo(HI::GUITestOpStatus &os);
83 
84     static void clickNext(HI::GUITestOpStatus &os);
85     static void clickPrev(HI::GUITestOpStatus &os);
86     static void clickGetAnnotation(HI::GUITestOpStatus &os);
87     static bool isPrevNextEnabled(HI::GUITestOpStatus &os);
88     static bool isGetAnnotationsEnabled(HI::GUITestOpStatus &os);
89 
90     // Circular view options panel tab
91     static void toggleCircularView(HI::GUITestOpStatus &os);
92     static void setTitleFontSize(HI::GUITestOpStatus &os, int fontSize);
93     static int getTitleFontSize(HI::GUITestOpStatus &os);
94 
95     // In Silico PCR tab
96     static void setForwardPrimer(HI::GUITestOpStatus &os, const QString &primer);
97     static void setForwardPrimerMismatches(HI::GUITestOpStatus &os, const int mismatches);
98     static void setReversePrimer(HI::GUITestOpStatus &os, const QString &primer);
99     static void setReversePrimerMismatches(HI::GUITestOpStatus &os, const int mismatches);
100     static void showPrimersDetails(HI::GUITestOpStatus &os);
101     static int productsCount(HI::GUITestOpStatus &os);
102     static void pressFindProducts(HI::GUITestOpStatus &os);
103     static void pressExtractProduct(HI::GUITestOpStatus &os);
104 
105     // Utility
106     static bool isSearchAlgorithmShowHideWidgetOpened(HI::GUITestOpStatus &os);
107     static bool isSearchInShowHideWidgetOpened(HI::GUITestOpStatus &os);
108     static bool isOtherSettingsShowHideWidgetOpened(HI::GUITestOpStatus &os);
109     static bool isSaveAnnotationToShowHideWidgetOpened(HI::GUITestOpStatus &os);
110     static bool isAnnotationParametersShowHideWidgetOpened(HI::GUITestOpStatus &os);
111 
112     static void openSearchAlgorithmShowHideWidget(HI::GUITestOpStatus &os, bool open = true);
113     static void openSearchInShowHideWidget(HI::GUITestOpStatus &os, bool open = true);
114     static void openOtherSettingsShowHideWidget(HI::GUITestOpStatus &os, bool open = true);
115     static void openSaveAnnotationToShowHideWidget(HI::GUITestOpStatus &os, bool open = true);
116     static void openAnnotationParametersShowHideWidget(HI::GUITestOpStatus &os, bool open = true);
117 
118 private:
119     static QMap<Tabs, QString> initNames();
120     static QMap<Tabs, QString> initInnerWidgetNames();
121 };
122 
123 }  // namespace U2
124 
125 #endif  // _U2_GT_UTILS_OPTION_PANEL_SEQUENCE_VIEW_H_
126