VirtualBox

Changeset 63767 in vbox


Ignore:
Timestamp:
Sep 8, 2016 1:57:48 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110581
Message:

FE/Qt: bugref:6899: Accessibility support (step 18): Selector UI: Rework the UITextTableLine to be an accessible class, pass it through the details elements.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp

    r63764 r63767  
    119119}
    120120
     121UITextTable &UIGDetailsElement::text() const
     122{
     123    /* Retrieve text from text-pane: */
     124    return m_pTextPane->text();
     125}
     126
     127void UIGDetailsElement::setText(const UITextTable &text)
     128{
     129    /* Pass text to text-pane: */
     130    m_pTextPane->setText(text);
     131}
     132
    121133void UIGDetailsElement::sltToggleButtonClicked()
    122134{
     
    265277    updateMinimumHeaderWidth();
    266278    updateMinimumHeaderHeight();
    267 }
    268 
    269 const UITextTable& UIGDetailsElement::text() const
    270 {
    271     /* Retrieve text from text-pane: */
    272     return m_pTextPane->text();
    273 }
    274 
    275 void UIGDetailsElement::setText(const UITextTable &text)
    276 {
    277     /* Pass text to text-pane: */
    278     m_pTextPane->setText(text);
    279279}
    280280
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h

    r63764 r63767  
    3434class QStateMachine;
    3535class QPropertyAnimation;
     36class UITextTableLine;
    3637
    3738/* Typedefs: */
    38 typedef QPair<QString, QString> UITextTableLine;
    3939typedef QList<UITextTableLine> UITextTable;
     40
    4041
    4142/* Details element
     
    8485    /* API: Animation stuff: */
    8586    void markAnimationFinished();
     87
     88    /** Returns the reference to the text table. */
     89    UITextTable &text() const;
     90    /** Defines the @a text table as the passed one. */
     91    void setText(const UITextTable &text);
    8692
    8793protected slots:
     
    130136    /* API: Name stuff: */
    131137    void setName(const QString &strName);
    132 
    133     /* API: Text stuff: */
    134     const UITextTable& text() const;
    135     void setText(const UITextTable &text);
    136138
    137139    /* API: Machine stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp

    r62493 r63767  
    6464    {
    6565        /* Lines: */
    66         QString strLeftLine = line.first;
    67         QString strRightLine = line.second;
     66        QString strLeftLine = line.string1();
     67        QString strRightLine = line.string2();
    6868
    6969        /* If 2nd line is NOT empty: */
     
    7171        {
    7272            /* Take both lines 'as is': */
    73             m_text << UITextTableLine(strLeftLine, strRightLine);
     73            m_text << UITextTableLine(strLeftLine, strRightLine, parent());
    7474        }
    7575        /* If 2nd line is empty: */
     
    7979            QStringList subLines = strLeftLine.split(QRegExp("\\n"));
    8080            foreach (const QString &strSubLine, subLines)
    81                 m_text << UITextTableLine(strSubLine, QString());
     81                m_text << UITextTableLine(strSubLine, QString(), parent());
    8282        }
    8383    }
     
    120120    foreach (const UITextTableLine &line, m_text)
    121121    {
    122         bool fRightColumnPresent = !line.second.isEmpty();
     122        bool fRightColumnPresent = !line.string2().isEmpty();
    123123        if (fRightColumnPresent)
    124124            fSingleColumnText = false;
    125         QString strLeftLine = fRightColumnPresent ? line.first + ":" : line.first;
    126         QString strRightLine = line.second;
     125        QString strLeftLine = fRightColumnPresent ? line.string1() + ":" : line.string1();
     126        QString strRightLine = line.string2();
    127127        iMaximumLeftColumnWidth = qMax(iMaximumLeftColumnWidth, fm.width(strLeftLine));
    128128        iMaximumRightColumnWidth = qMax(iMaximumRightColumnWidth, fm.width(strRightLine));
     
    182182        /* Left layout: */
    183183        int iLeftColumnHeight = 0;
    184         if (!line.first.isEmpty())
    185         {
    186             bool fRightColumnPresent = !line.second.isEmpty();
     184        if (!line.string1().isEmpty())
     185        {
     186            bool fRightColumnPresent = !line.string2().isEmpty();
    187187            m_leftList << buildTextLayout(font(), m_pPaintDevice,
    188                                           fRightColumnPresent ? line.first + ":" : line.first,
     188                                          fRightColumnPresent ? line.string1() + ":" : line.string1(),
    189189                                          iLeftColumnWidth, iLeftColumnHeight,
    190190                                          m_strHoveredAnchor);
     
    194194        /* Right layout: */
    195195        int iRightColumnHeight = 0;
    196         if (!line.second.isEmpty())
     196        if (!line.string2().isEmpty())
    197197        {
    198198            m_rightList << buildTextLayout(font(), m_pPaintDevice,
    199                                            line.second,
     199                                           line.string2(),
    200200                                           iRightColumnWidth, iRightColumnHeight,
    201201                                           m_strHoveredAnchor);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.h

    r62493 r63767  
    2525class QTextLayout;
    2626
    27 /* Typedefs: */
    28 typedef QPair<QString, QString> UITextTableLine;
     27
     28/** QObject extension used as an
     29  * accessible wrapper for QString pairs. */
     30class UITextTableLine : public QObject
     31{
     32    Q_OBJECT;
     33
     34public:
     35
     36    /** Constructs text-table line passing @a pParent to the base-class.
     37      * @param  str1  Brings the 1st table string.
     38      * @param  str2  Brings the 2nd table string. */
     39    UITextTableLine(const QString &str1, const QString &str2, QObject *pParent = 0)
     40        : QObject(pParent)
     41        , m_str1(str1)
     42        , m_str2(str2)
     43    {}
     44
     45    /** Constructs text-table line on the basis of passed @a other. */
     46    UITextTableLine(const UITextTableLine &other)
     47        : QObject(other.parent())
     48        , m_str1(other.string1())
     49        , m_str2(other.string2())
     50    {}
     51
     52    /** Assigns @a other to this. */
     53    UITextTableLine &operator=(const UITextTableLine &other)
     54    {
     55        setParent(other.parent());
     56        set1(other.string1());
     57        set2(other.string2());
     58        return *this;
     59    }
     60
     61    /** Compares @a other to this. */
     62    bool operator==(const UITextTableLine &other) const
     63    {
     64        return string1() == other.string1()
     65            && string2() == other.string2();
     66    }
     67
     68    /** Defines 1st table @a strString. */
     69    void set1(const QString &strString) { m_str1 = strString; }
     70    /** Returns 1st table string. */
     71    const QString &string1() const { return m_str1; }
     72
     73    /** Defines 2nd table @a strString. */
     74    void set2(const QString &strString) { m_str2 = strString; }
     75    /** Returns 2nd table string. */
     76    const QString &string2() const { return m_str2; }
     77
     78private:
     79
     80    /** Holds the 1st table string. */
     81    QString m_str1;
     82    /** Holds the 2nd table string. */
     83    QString m_str2;
     84};
     85
     86/** Defines the list of UITextTableLine instances. */
    2987typedef QList<UITextTableLine> UITextTable;
    3088Q_DECLARE_METATYPE(UITextTable);
     89
    3190
    3291/** QIGraphicsWidget reimplementation to draw QTextLayout content. */
     
    53112    bool isEmpty() const { return m_text.isEmpty(); }
    54113    /** Returns contained text. */
    55     const UITextTable& text() const { return m_text; }
     114    UITextTable &text() { return m_text; }
    56115    /** Defines contained text. */
    57116    void setText(const UITextTable &text);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette