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_MA_EDITOR_STATUS_BAR_H_ 23 #define _U2_MA_EDITOR_STATUS_BAR_H_ 24 25 #include <QLabel> 26 #include <QVariant> 27 28 class QHBoxLayout; 29 30 namespace U2 { 31 32 class MaEditor; 33 class MaEditorSelection; 34 35 class MaEditorStatusBar : public QFrame { 36 Q_OBJECT 37 protected: 38 class TwoArgPatternLabel : public QLabel { 39 public: 40 TwoArgPatternLabel(const QString &textPattern, const QString &tooltipPattern, const QString &objectName, QWidget *parent = nullptr); 41 void setPatterns(const QString &textPattern, const QString &tooltipPattern); 42 43 void update(const QString& firstArg, int minWidth); 44 void update(const QString& firstArg, const QString& secondArg); 45 46 void updateMinWidth(QString maxLenArg); 47 48 private: 49 QString textPattern; 50 QString tooltipPattern; 51 QFontMetrics fm; 52 }; 53 54 public: 55 MaEditorStatusBar(MaEditor *editor); 56 57 private slots: 58 void sl_update(); 59 void sl_lockStateChanged(); 60 61 protected: 62 virtual void updateLabels() = 0; 63 64 /** Return a pair of <column, alignment-len> text labels to display for the current top-left position of the selection. */ 65 QPair<QString, QString> getGappedPositionInfo() const; 66 67 void updateLock(); 68 virtual void updateLineLabel(); 69 virtual void updatePositionLabel(); 70 void updateColumnLabel(); 71 void updateSelectionLabel(); 72 void setStatusBarStyle(); 73 74 protected: 75 MaEditor *editor; 76 QPixmap lockedIcon; 77 QPixmap unlockedIcon; 78 79 QHBoxLayout *layout; 80 81 /** Sequence line number. As visible on the screen. */ 82 TwoArgPatternLabel *lineLabel; 83 84 TwoArgPatternLabel *columnLabel; 85 TwoArgPatternLabel *positionLabel; 86 TwoArgPatternLabel *selectionLabel; 87 QLabel *lockLabel; 88 89 static const QString NONE_MARK; 90 static const QString GAP_MARK; 91 92 private: 93 QString selectionPattern; 94 }; 95 96 } // namespace U2 97 98 #endif // _U2_MA_EDITOR_STATUS_BAR_H_ 99