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_TREE_OPTIONS_WIDGET_H_ 23 #define _U2_TREE_OPTIONS_WIDGET_H_ 24 25 #include <U2Gui/U2SavableWidget.h> 26 27 #include "ov_phyltree/TreeSettings.h" 28 #include "ui_TreeOptionsWidget.h" 29 30 namespace U2 { 31 32 class MSAEditor; 33 class SimilarityStatisticsSettings; 34 class ShowHideSubgroupWidget; 35 class TreeViewer; 36 class TreeViewerUI; 37 class MultipleAlignment; 38 class MaModificationInfo; 39 40 struct TreeOpWidgetViewSettings { TreeOpWidgetViewSettingsTreeOpWidgetViewSettings41 TreeOpWidgetViewSettings() 42 : showFontSettings(false), showPenSettings(false) { 43 } 44 45 bool showFontSettings; 46 bool showPenSettings; 47 }; 48 49 class TreeOptionsSavableWidget : public U2SavableWidget { 50 public: 51 TreeOptionsSavableWidget(QWidget *wrappedWidget, MWMDIWindow *contextWindow = nullptr); 52 ~TreeOptionsSavableWidget(); 53 54 void disableSavingForWidgets(const QStringList &s); 55 56 protected: 57 bool childCanBeSaved(QWidget *child) const override; 58 59 private: 60 QStringList widgetsNotToSave; 61 }; 62 63 class U2VIEW_EXPORT TreeOptionsWidget : public QWidget, private Ui_TreeOptionWidget { 64 Q_OBJECT 65 public: 66 TreeOptionsWidget(TreeViewer *tree, const TreeOpWidgetViewSettings &viewSettings); 67 TreeOptionsWidget(MSAEditor *msaEditor, const TreeOpWidgetViewSettings &viewSettings); 68 ~TreeOptionsWidget(); 69 70 const TreeOpWidgetViewSettings &getViewSettings(); 71 72 signals: 73 void saveViewSettings(const TreeOpWidgetViewSettings &); 74 75 private slots: 76 void sl_labelsColorButton(); 77 void sl_branchesColorButton(); 78 void sl_fontTypeChanged(); 79 void sl_fontSizeChanged(); 80 void sl_fontBoldChanged(); 81 void sl_fontItalicChanged(); 82 void sl_fontUnderlineChanged(); 83 84 void sl_onLblLinkActivated(const QString &link); 85 void sl_valueChanged(); 86 87 void sl_onOptionChanged(TreeViewOption option, const QVariant &value); 88 /* Slot for handling scene selection changes */ 89 void sl_selectionChanged(); 90 91 private: 92 QStringList getSaveDisabledWidgets() const; 93 void initializeOptionsMap(); 94 void initColorButtonsStyle(); 95 void createGroups(); 96 void createGeneralSettingsWidgets(); 97 void updateFormatSettings(); 98 void updateAllWidgets(); 99 void connectSlots(); 100 101 void updateButtonColor(QPushButton *button, const QColor &newColor); 102 void updateShowFontOpLabel(QString newText); 103 void updateShowPenOpLabel(QString newText); 104 105 void updateRelations(TreeViewOption option, QVariant newValue); 106 107 TreeViewerUI *getTreeViewer() const; 108 109 MSAEditor *editor; 110 TreeViewerUI *treeViewer; 111 112 TreeOpWidgetViewSettings viewSettings; 113 114 bool showFontSettings; 115 bool showPenSettings; 116 117 QWidget *contentWidget; 118 119 TreeOptionsSavableWidget savableTab; 120 121 QMap<QString, TreeViewOption> optionsMap; 122 123 bool isUpdating; 124 }; 125 126 class U2VIEW_EXPORT AddTreeWidget : public QWidget { 127 Q_OBJECT 128 public: 129 AddTreeWidget(MSAEditor *msaEditor); 130 131 private slots: 132 void sl_onOpenTreeTriggered(); 133 void sl_onBuildTreeTriggered(); 134 void sl_updateBuildTreeButtonState(); 135 136 private: 137 MSAEditor *editor; 138 QPushButton *openTreeButton; 139 QPushButton *buildTreeButton; 140 QLabel *addTreeHint; 141 }; 142 143 } // namespace U2 144 145 #endif 146