1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 8 #ifndef SMFONTFEATURES_H 9 #define SMFONTFEATURES_H 10 11 #include "ui_smfontfeaturesbase.h" 12 #include <QMenu> 13 14 class StylisticSetsMenu : public QMenu 15 { 16 Q_OBJECT 17 public: StylisticSetsMenu(QWidget * parent)18 StylisticSetsMenu(QWidget *parent): QMenu(parent){} ~StylisticSetsMenu()19 ~StylisticSetsMenu(){} 20 mouseReleaseEvent(QMouseEvent * e)21 void mouseReleaseEvent(QMouseEvent *e) 22 { 23 QAction *action = activeAction(); 24 if (action && action->isEnabled()) { 25 action->setEnabled(false); 26 QMenu::mouseReleaseEvent(e); 27 action->setEnabled(true); 28 action->trigger(); 29 } 30 else 31 QMenu::mouseReleaseEvent(e); 32 } 33 }; 34 35 class SMFontFeatures : public QWidget, public Ui::smFontFeaturesBase 36 { 37 Q_OBJECT 38 public: 39 SMFontFeatures(QWidget *parent); ~SMFontFeatures()40 ~SMFontFeatures(){} 41 42 void languageChange(); 43 44 void setFontFeatures(const QString& s, QStringList fontFeaturesList); 45 void setFontFeatures(const QString& val, QStringList fontFeatures, bool isParentVal); 46 QString fontFeatures(); 47 void enableFontFeatures(const QStringList& fontFeatures); 48 void resetFontFeatures(); 49 50 void setParentValue(const QString& val); 51 bool useParentValue(); 52 53 protected: 54 void connectSignals(); 55 void disconnectSignals(); 56 57 void changeEvent(QEvent *e) override; 58 59 private: 60 void hideAllFontFeatures(); 61 void setupCapitalCombo(quint64 featureFlags); 62 void setupPositionCombo(quint64 featureFlags); 63 void setupNumeralStyleCombo(quint64 featureFlags); 64 void setupNumeralWidthCombo(quint64 featureFlags); 65 void setupNumeralFractionCombo(quint64 featureFlags); 66 67 QStringList comboboxFeatures(QComboBox* combo); 68 69 bool m_hasParent = false; 70 bool m_useParentValue = false; 71 QString m_pValue; 72 73 StylisticSetsMenu *styleSetsMenu = nullptr; 74 75 private slots: 76 void slotChange(); 77 void slotContextualCheck(); 78 void slotCommonCheck(); 79 void slotDiscretionaryCheck(); 80 void slotHistoricalCheck(); 81 void slotCapitalsComboBox(); 82 void slotPositionComboBox(); 83 void slotNumeralComboBox(); 84 void slotWidthComboBox(); 85 void slotFractionComboBox(); 86 void slotSlashedZeroCheck(); 87 void slotSetMenu(); 88 89 90 signals: 91 void changed(); 92 }; 93 94 #endif // SMFONTFEATURES_H 95