VirtualBox

Changeset 78812 in vbox


Ignore:
Timestamp:
May 28, 2019 11:32:39 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130908
Message:

FE/Qt: bugref:6143. Changing the way we draw th button to be able to draw some strange looking archaic keys

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox_xml.qrc

    r78567 r78812  
    22    <qresource suffix="/">
    33        <file alias="us_layout.xml">xml/us_layout.xml</file>
     4        <file alias="102_iso.xml">xml/102_iso.xml</file>
    45    </qresource>
    56</RCC>
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r78635 r78812  
    6464#include "UIFileManagerDialog.h"
    6565#include "UIGuestProcessControlDialog.h"
    66 #include "UISoftKeyboardDialog.h"
     66#include "UISoftKeyboard.h"
    6767#ifdef VBOX_WS_MAC
    6868# include "DockIconPreview.h"
     
    16071607        return;
    16081608
    1609     QIManagerDialog *pSoftKeyboardDialog;
    1610     UISoftKeyboardDialogFactory dialogFactory(uisession(), actionPool(), machine().GetName());
    1611     dialogFactory.prepare(pSoftKeyboardDialog, activeMachineWindow());
    1612     if (pSoftKeyboardDialog)
    1613     {
    1614         m_pSoftKeyboardDialog = pSoftKeyboardDialog;
     1609    UISoftKeyboard *pSoftKeyboard = new UISoftKeyboard(0, uisession(), machine().GetName());
     1610    // UISoftKeyboardDialogFactory dialogFactory(uisession(), actionPool(), machine().GetName());
     1611    // dialogFactory.prepare(pSoftKeyboardDialog, activeMachineWindow());
     1612    if (pSoftKeyboard)
     1613    {
     1614        //m_pSoftKeyboardDialog = pSoftKeyboardDialog;
    16151615
    16161616        /* Show instance: */
    1617         pSoftKeyboardDialog->show();
    1618         pSoftKeyboardDialog->setWindowState(pSoftKeyboardDialog->windowState() & ~Qt::WindowMinimized);
    1619         pSoftKeyboardDialog->activateWindow();
    1620         connect(pSoftKeyboardDialog, &QIManagerDialog::sigClose,
    1621                 this, &UIMachineLogic::sltCloseSoftKeyboard);
     1617        pSoftKeyboard->show();
     1618        // pSoftKeyboardDialog->setWindowState(pSoftKeyboardDialog->windowState() & ~Qt::WindowMinimized);
     1619        // pSoftKeyboardDialog->activateWindow();
     1620        // connect(pSoftKeyboardDialog, &QIManagerDialog::sigClose,
     1621        //         this, &UIMachineLogic::sltCloseSoftKeyboard);
    16221622    }
    16231623}
     
    16251625void UIMachineLogic::sltCloseSoftKeyboard()
    16261626{
    1627     QIManagerDialog* pDialog = qobject_cast<QIManagerDialog*>(sender());
    1628     if (m_pSoftKeyboardDialog != pDialog || !pDialog)
    1629         return;
    1630 
    1631     /* Set the m_pSoftKeyboardDialog to NULL before closing the dialog. or we will have redundant deletes*/
    1632     m_pSoftKeyboardDialog = 0;
    1633     pDialog->close();
    1634     UISoftKeyboardDialogFactory().cleanup(pDialog);
     1627    // QIManagerDialog* pDialog = qobject_cast<QIManagerDialog*>(sender());
     1628    // if (m_pSoftKeyboardDialog != pDialog || !pDialog)
     1629    //     return;
     1630
     1631    // /* Set the m_pSoftKeyboardDialog to NULL before closing the dialog. or we will have redundant deletes*/
     1632    // m_pSoftKeyboardDialog = 0;
     1633    // pDialog->close();
     1634    // UISoftKeyboardDialogFactory().cleanup(pDialog);
    16351635}
    16361636
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r78685 r78812  
    3636#include "CEventSource.h"
    3737
     38class UISoftKeyboardWidget : public QWidget
     39{
     40    Q_OBJECT;
     41 public:
     42
     43    virtual QSize minimumSizeHint() const
     44    {
     45        return m_minimumSize;
     46    }
     47
     48    virtual QSize sizeHint() const
     49    {
     50        return m_minimumSize;
     51    }
     52
     53    void setNewMinimumSize(const QSize &size)
     54    {
     55        m_minimumSize = size;
     56        updateGeometry();
     57    }
     58
     59private:
     60
     61    QSize m_minimumSize;
     62};
    3863enum UIKeyState
    3964{
     
    5681struct SoftKeyboardKey
    5782{
     83    /** Width and height might be inherited from the row and/or overwritten in row settings. */
    5884    int       m_iWidth;
    59     QString   m_strLabel;
    60     LONG      m_scanCode;
    61     LONG      m_scanCodePrefix;
    62     int       m_iSpaceAfter;
     85    int       m_iHeight;
     86    LONG      m_strScanCode;
     87    LONG      m_strScanCodePrefix;
    6388    UIKeyType m_enmType;
     89    QString   m_strKeyCap;
     90    int       m_iSpaceWidthAfter;
     91    int       m_iCutoutWidth;
     92    int       m_iCutoutHeight;
     93    /** -1 is no cutout. 0 is the topleft corner. we go clockwise. */
     94    int       m_iCutoutCorner;
    6495};
    6596
    6697struct SoftKeyboardRow
    6798{
    68     int m_iHeight;
     99    /** Default width and height might be inherited from the layout and overwritten in row settings. */
     100    int m_iDefaultWidth;
     101    int m_iDefaultHeight;
    69102    int m_iStartingSpace;
    70103    QList<SoftKeyboardKey> m_keys;
     
    73106struct SoftKeyboardLayout
    74107{
     108    int m_iDefaultWidth;
     109    int m_iDefaultHeight;
    75110    QList<SoftKeyboardRow> m_rows;
    76 };
    77 
    78 /*********************************************************************************************************************************
    79 *   UIKeyboardLayoutReader definition.                                                                                  *
    80 *********************************************************************************************************************************/
    81 
    82 class UIKeyboardLayoutReader
    83 {
    84 
    85 public:
    86 
    87     bool parseXMLFile(const QString &strFileName, SoftKeyboardLayout &layout);
    88 
    89 private:
    90 
    91     bool parseRow(SoftKeyboardLayout &layout);
    92     bool parseSpace(SoftKeyboardRow &row);
    93     bool parseKey(SoftKeyboardRow &row);
    94     QXmlStreamReader m_xmlReader;
    95111};
    96112
     
    134150
    135151    void release();
     152    void setVertices(const QVector<QPoint> &vertices);
    136153
    137154protected:
     
    154171    UIKeyState m_enmState;
    155172    QPalette     m_defaultPalette;
    156     float     m_fScaleMultiplier;
     173    float        m_fScaleMultiplier;
     174    QVector<QPoint> m_vertices;
    157175};
    158176
    159177/*********************************************************************************************************************************
    160 *   UISoftKeyboardRow definition.                                                                                  *
     178*   UIKeyboardLayoutReader definition.                                                                                  *
    161179*********************************************************************************************************************************/
    162180
    163 class UISoftKeyboardRow : public QWidget
    164 {
    165     Q_OBJECT;
     181class UIKeyboardLayoutReader
     182{
    166183
    167184public:
    168185
    169     UISoftKeyboardRow(QWidget *pParent = 0);
    170     void updateLayout();
    171     void setKeepAspectRatio(bool fKeepAspectRatio);
    172 
    173     void setUnscaledWidth(int iWidth);
    174     int unscaledWidth() const;
    175 
    176     void setUnscaledHeight(int iWidth);
    177     int unscaledHeight() const;
    178 
    179     void addKey(UISoftKeyboardKey *pKey);
    180 
     186    bool parseXMLFile(const QString &strFileName, SoftKeyboardLayout &layout);
     187    static QVector<QPoint> computeKeyVertices(const SoftKeyboardKey &key);
    181188private:
    182189
    183     int m_iWidth;
    184     int m_iHeight;
    185     QVector<UISoftKeyboardKey*> m_keys;
    186     bool m_fKeepAspectRatio;
     190    void  parseKey(SoftKeyboardRow &row);
     191    void  parseRow(SoftKeyboardLayout &layout);
     192    void  parseSpace(SoftKeyboardRow &row);
     193    void  parseCutout(SoftKeyboardKey &key);
     194
     195    QXmlStreamReader m_xmlReader;
    187196};
    188197
     
    205214        return false;
    206215
     216    QXmlStreamAttributes attributes = m_xmlReader.attributes();
     217    layout.m_iDefaultWidth = attributes.value("defaultWidth").toInt();
     218    layout.m_iDefaultHeight = attributes.value("defaultHeight").toInt();
     219
    207220    while (m_xmlReader.readNextStartElement())
    208221    {
    209222        if (m_xmlReader.name() == "row")
     223        {
    210224            parseRow(layout);
     225        }
    211226        else
    212227            m_xmlReader.skipCurrentElement();
     
    216231}
    217232
    218 bool UIKeyboardLayoutReader::parseRow(SoftKeyboardLayout &layout)
    219 {
    220     layout.m_rows.append(SoftKeyboardRow());
    221     SoftKeyboardRow &row = layout.m_rows.last();
    222     row.m_iHeight = 0;
    223     row.m_iStartingSpace = 0;
     233void UIKeyboardLayoutReader::parseRow(SoftKeyboardLayout &layout)
     234{
     235    SoftKeyboardRow row;
     236
     237    row.m_iDefaultWidth = layout.m_iDefaultWidth;
     238    row.m_iDefaultHeight = layout.m_iDefaultHeight;
     239
     240    /* Override the layout attributes if the row also has them: */
     241    QXmlStreamAttributes attributes = m_xmlReader.attributes();
     242    if (attributes.hasAttribute("defaultWidth"))
     243        row.m_iDefaultWidth = attributes.value("defaultWidth").toInt();
     244    if (attributes.hasAttribute("defaultHeight"))
     245        row.m_iDefaultHeight = attributes.value("defaultHeight").toInt();
    224246    while (m_xmlReader.readNextStartElement())
    225247    {
     
    228250        else if (m_xmlReader.name() == "space")
    229251            parseSpace(row);
    230         else if (m_xmlReader.name() == "height")
    231             row.m_iHeight = m_xmlReader.readElementText().toInt();
    232252        else
    233253            m_xmlReader.skipCurrentElement();
    234254    }
    235     return true;
    236 }
    237 
    238 bool UIKeyboardLayoutReader::parseSpace(SoftKeyboardRow &row)
    239 {
    240     while (m_xmlReader.readNextStartElement())
    241     {
    242         if (m_xmlReader.name() == "width")
    243         {
    244             int iSpace = m_xmlReader.readElementText().toInt();
    245             /* Find the key that comes before this space (if any): */
    246             if (!row.m_keys.isEmpty())
    247                 row.m_keys.back().m_iSpaceAfter = iSpace;
    248             /* If there are no keys yet, start the row with a space: */
    249             else
    250                 row.m_iStartingSpace = iSpace;
    251         }
    252         else
    253             m_xmlReader.skipCurrentElement();
    254     }
    255     return true;
    256 }
    257 
    258 bool UIKeyboardLayoutReader::parseKey(SoftKeyboardRow &row)
    259 {
    260     row.m_keys.append(SoftKeyboardKey());
    261     SoftKeyboardKey &key = row.m_keys.last();
    262     key.m_scanCode = 0;
    263     key.m_scanCodePrefix = 0;
    264     key.m_iSpaceAfter = 0;
    265     key.m_enmType = UIKeyType_Ordinary;
    266 
     255    layout.m_rows.append(row);
     256}
     257
     258void UIKeyboardLayoutReader::parseKey(SoftKeyboardRow &row)
     259{
     260    SoftKeyboardKey key;
     261    key.m_iWidth = row.m_iDefaultWidth;
     262    key.m_iHeight = row.m_iDefaultHeight;
     263    key.m_iSpaceWidthAfter = 0;
     264    key.m_iCutoutCorner = -1;
    267265    while (m_xmlReader.readNextStartElement())
    268266    {
    269267        if (m_xmlReader.name() == "width")
    270268            key.m_iWidth = m_xmlReader.readElementText().toInt();
    271         else if (m_xmlReader.name() == "label")
    272         {
    273             if (key.m_strLabel.isEmpty())
    274                 key.m_strLabel = m_xmlReader.readElementText();
    275             else
    276                 key.m_strLabel = QString("%1%2%3").arg(key.m_strLabel).arg("\n").arg(m_xmlReader.readElementText());
    277         }
     269        else if (m_xmlReader.name() == "height")
     270            key.m_iHeight = m_xmlReader.readElementText().toInt();
    278271        else if (m_xmlReader.name() == "scancode")
    279272        {
    280273            QString strCode = m_xmlReader.readElementText();
    281274            bool fOk = false;
    282             key.m_scanCode = strCode.toInt(&fOk, 16);
    283             if (!fOk)
    284                 key.m_scanCode = 0;
     275            key.m_strScanCode = strCode.toInt(&fOk, 16);
    285276        }
    286277        else if (m_xmlReader.name() == "scancodeprefix")
     
    288279            QString strCode = m_xmlReader.readElementText();
    289280            bool fOk = false;
    290             key.m_scanCodePrefix = strCode.toInt(&fOk, 16);
    291             if (!fOk)
    292                 key.m_scanCodePrefix = 0;
     281            key.m_strScanCodePrefix = strCode.toInt(&fOk, 16);
    293282        }
    294         else if (m_xmlReader.name() == "type")
     283        else if (m_xmlReader.name() == "keycap")
    295284        {
    296             QString strType = m_xmlReader.readElementText();
    297             if (strType == "modifier")
    298                 key.m_enmType = UIKeyType_Modifier;
    299             else if (strType == "toggleable")
    300                 key.m_enmType = UIKeyType_Toggleable;
     285            if (key.m_strKeyCap.isEmpty())
     286                key.m_strKeyCap = m_xmlReader.readElementText();
     287            else
     288                key.m_strKeyCap += "\n" + m_xmlReader.readElementText();
     289        }
     290        else if (m_xmlReader.name() == "cutout")
     291            parseCutout(key);
     292
     293
     294        // else if (m_xmlReader.name() == "type")
     295        // {
     296        //     QString strType = m_xmlReader.readElementText();
     297        //     if (strType == "modifier")
     298        //         pKey->setType(UIKeyType_Modifier);
     299        //     else if (strType == "toggleable")
     300        //         pKey->setType(UIKeyType_Toggleable);
     301        // }
     302        else
     303            m_xmlReader.skipCurrentElement();
     304    }
     305    row.m_keys.append(key);
     306}
     307
     308void UIKeyboardLayoutReader::parseSpace(SoftKeyboardRow &row)
     309{
     310    int iWidth = row.m_iDefaultWidth;
     311    while (m_xmlReader.readNextStartElement())
     312    {
     313        if (m_xmlReader.name() == "width")
     314            iWidth = m_xmlReader.readElementText().toInt();
     315        else
     316            m_xmlReader.skipCurrentElement();
     317    }
     318    if (row.m_keys.size() <= 0)
     319        return;
     320    row.m_keys.back().m_iSpaceWidthAfter = iWidth;
     321}
     322
     323void UIKeyboardLayoutReader::parseCutout(SoftKeyboardKey &key)
     324{
     325    while (m_xmlReader.readNextStartElement())
     326    {
     327        if (m_xmlReader.name() == "width")
     328            key.m_iCutoutWidth = m_xmlReader.readElementText().toInt();
     329        else if (m_xmlReader.name() == "height")
     330            key.m_iCutoutHeight = m_xmlReader.readElementText().toInt();
     331        else if (m_xmlReader.name() == "corner")
     332        {
     333            QString strCorner = m_xmlReader.readElementText();
     334            if (strCorner == "topLeft")
     335                    key.m_iCutoutCorner = 0;
     336            else if(strCorner == "topRight")
     337                    key.m_iCutoutCorner = 1;
     338            else if(strCorner == "bottomRight")
     339                    key.m_iCutoutCorner = 2;
     340            else if(strCorner == "bottomLeft")
     341                    key.m_iCutoutCorner = 3;
    301342        }
    302343        else
    303344            m_xmlReader.skipCurrentElement();
    304345    }
    305     return true;
    306 }
     346}
     347
     348QVector<QPoint> UIKeyboardLayoutReader::computeKeyVertices(const SoftKeyboardKey &key)
     349{
     350    QVector<QPoint> vertices;
     351
     352    if (key.m_iCutoutCorner == -1 || key.m_iWidth <= key.m_iCutoutWidth || key.m_iHeight <= key.m_iCutoutHeight)
     353    {
     354        vertices.append(QPoint(0, 0));
     355        vertices.append(QPoint(key.m_iWidth, 0));
     356        vertices.append(QPoint(key.m_iWidth, key.m_iHeight));
     357        vertices.append(QPoint(0, key.m_iHeight));
     358        return vertices;
     359    }
     360    if (key.m_iCutoutCorner == 0)
     361    {
     362        vertices.append(QPoint(key.m_iCutoutWidth, 0));
     363        vertices.append(QPoint(key.m_iWidth, 0));
     364        vertices.append(QPoint(key.m_iWidth, key.m_iHeight));
     365        vertices.append(QPoint(0, key.m_iHeight));
     366        vertices.append(QPoint(0, key.m_iCutoutHeight));
     367        vertices.append(QPoint(key.m_iCutoutWidth, key.m_iCutoutHeight));
     368    }
     369    else if (key.m_iCutoutCorner == 1)
     370    {
     371        vertices.append(QPoint(0, 0));
     372        vertices.append(QPoint(key.m_iWidth - key.m_iCutoutWidth, 0));
     373        vertices.append(QPoint(key.m_iWidth - key.m_iCutoutWidth, key.m_iCutoutHeight));
     374        vertices.append(QPoint(key.m_iWidth, key.m_iCutoutHeight));
     375        vertices.append(QPoint(key.m_iWidth, key.m_iHeight));
     376        vertices.append(QPoint(0, key.m_iHeight));
     377    }
     378    else if (key.m_iCutoutCorner == 2)
     379    {
     380        vertices.append(QPoint(0, 0));
     381        vertices.append(QPoint(key.m_iWidth, 0));
     382        vertices.append(QPoint(key.m_iWidth, key.m_iCutoutHeight));
     383        vertices.append(QPoint(key.m_iWidth - key.m_iCutoutWidth, key.m_iCutoutHeight));
     384        vertices.append(QPoint(key.m_iWidth - key.m_iCutoutWidth, key.m_iHeight));
     385        vertices.append(QPoint(0, key.m_iHeight));
     386    }
     387    else if (key.m_iCutoutCorner == 3)
     388    {
     389        vertices.append(QPoint(0, 0));
     390        vertices.append(QPoint(key.m_iWidth, 0));
     391        vertices.append(QPoint(key.m_iWidth, key.m_iHeight));
     392        vertices.append(QPoint(key.m_iCutoutWidth, key.m_iHeight));
     393        vertices.append(QPoint(key.m_iCutoutWidth, key.m_iHeight - key.m_iCutoutHeight));
     394        vertices.append(QPoint(0, key.m_iHeight - key.m_iCutoutHeight));
     395    }
     396    return vertices;
     397}
     398
    307399
    308400/*********************************************************************************************************************************
     
    387479void UISoftKeyboardKey::updateFontSize()
    388480{
     481    QFont newFont = font();
    389482    if (m_iDefaultPointSize != -1)
    390     {
    391         QFont newFont = font();
    392483        newFont.setPointSize(m_fScaleMultiplier * m_iDefaultPointSize);
    393         setFont(newFont);
    394     }
    395484    else
    396     {
    397         QFont newFont = font();
    398485        newFont.setPixelSize(m_fScaleMultiplier * m_iDefaultPixelSize);
    399         setFont(newFont);
    400     }
     486    setFont(newFont);
    401487}
    402488
     
    404490{
    405491    updateState(false);
     492}
     493
     494void UISoftKeyboardKey::setVertices(const QVector<QPoint> &vertices)
     495{
     496    m_vertices = vertices;
    406497}
    407498
     
    414505void UISoftKeyboardKey::paintEvent(QPaintEvent *pEvent)
    415506{
    416     QToolButton::paintEvent(pEvent);
    417 
    418     if (m_enmType == UIKeyType_Ordinary)
    419         return;
    420 
     507    Q_UNUSED(pEvent);
     508    // QToolButton::paintEvent(pEvent);
     509    // return;
    421510    QPainter painter(this);
    422     painter.setRenderHint(QPainter::Antialiasing, true);
    423 
    424     painter.setPen(QPen(QColor(50, 50, 50), 0.2f));
    425     if (m_enmState == UIKeyState_NotPressed)
    426         painter.setBrush(QColor(100, 100, 100));
    427     else if (m_enmState == UIKeyState_Pressed)
    428         painter.setBrush(QColor(20, 255, 42));
    429     else
    430         painter.setBrush(QColor(255, 7, 58));
    431 
    432     int unitSize = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
    433 
    434     float fRadius = m_fScaleMultiplier * 1.1 * unitSize;
    435     float fSpace = m_fScaleMultiplier * unitSize;
    436     QRectF rectangle(fSpace, fSpace, fRadius, fRadius);
    437 
    438     painter.drawEllipse(rectangle);
     511    QFont painterFont(font());
     512    painterFont.setPixelSize(16);
     513    painter.setFont(painterFont);
     514
     515    painter.setRenderHint(QPainter::Antialiasing);
     516    painter.setPen(QPen(QColor(0, 0,0), 2));
     517    painter.setBrush(QBrush(QColor(255, 0,0)));
     518    painter.drawPolygon(&(m_vertices[0]), m_vertices.size());
     519    QRect textRect(0, 0, width(), height());
     520    painter.drawText(textRect, Qt::TextWordWrap, text());
    439521}
    440522
     
    496578 }
    497579
    498  /*********************************************************************************************************************************
    499   *   UISoftKeyboardRow implementation.                                                                                  *
    500 *********************************************************************************************************************************/
    501 
    502 UISoftKeyboardRow::UISoftKeyboardRow(QWidget *pParent /* = 0 */)
    503     :QWidget(pParent)
    504     , m_iWidth(0)
    505     , m_iHeight(0)
    506     , m_fKeepAspectRatio(false)
    507 {
    508 }
    509 
    510 void UISoftKeyboardRow::setKeepAspectRatio(bool fKeepAspectRatio)
    511 {
    512     m_fKeepAspectRatio = fKeepAspectRatio;
    513 }
    514 
    515 void UISoftKeyboardRow::setUnscaledWidth(int iWidth)
    516 {
    517     m_iWidth = iWidth;
    518 }
    519 
    520 int UISoftKeyboardRow::unscaledWidth() const
    521 {
    522     return m_iWidth;
    523 }
    524 
    525 void UISoftKeyboardRow::setUnscaledHeight(int iHeight)
    526 {
    527     m_iHeight = iHeight;
    528 }
    529 
    530 int UISoftKeyboardRow::unscaledHeight() const
    531 {
    532     return m_iHeight;
    533 }
    534 
    535 void UISoftKeyboardRow::addKey(UISoftKeyboardKey *pKey)
    536 {
    537     m_keys.append(pKey);
    538 }
    539 
    540 void UISoftKeyboardRow::updateLayout()
    541 {
    542     if (m_iHeight == 0)
    543         return;
    544 
    545 
    546     float fMultiplier = 1;
    547     if (m_fKeepAspectRatio)
    548         fMultiplier = height() / (float)m_iHeight;
    549     else
    550         fMultiplier = width() / (float)m_iWidth;
    551     int iX = 0;
    552     for (int i = 0; i < m_keys.size(); ++i)
    553     {
    554         UISoftKeyboardKey *pKey = m_keys[i];
    555         if (!pKey)
    556             continue;
    557         pKey->setVisible(true);
    558         pKey->setScaleMultiplier(fMultiplier);
    559         pKey->updateFontSize();
    560         int iKeyWidth = fMultiplier * pKey->width();
    561         if (i != m_keys.size() - 1)
    562             pKey->setGeometry(iX, 0, iKeyWidth, height());
    563         else
    564         {
    565             pKey->setGeometry(iX, 0, width() - iX - 1, height());
    566         }
    567         iX += fMultiplier * pKey->width();
    568         iX += fMultiplier * pKey->spaceAfter();
    569     }
    570 }
    571 
    572580/*********************************************************************************************************************************
    573581*   UISoftKeyboard implementation.                                                                                  *
    574582*********************************************************************************************************************************/
    575583
    576 UISoftKeyboard::UISoftKeyboard(EmbedTo /* enmEmbedding */, QWidget *pParent,
    577                                UISession *pSession, QString strMachineName /* = QString()*/,
    578                                bool fShowToolbar /* = false */)
    579     :QIWithRetranslateUI<QWidget>(pParent)
     584UISoftKeyboard::UISoftKeyboard(QWidget *pParent,
     585                               UISession *pSession, QString strMachineName /* = QString()*/)
     586    :QIWithRetranslateUI<QMainWindow>(pParent)
    580587    , m_pSession(pSession)
    581588    , m_pMainLayout(0)
    582589    , m_pContainerWidget(0)
    583     , m_pToolBar(0)
    584     , m_fShowToolbar(fShowToolbar)
    585590    , m_strMachineName(strMachineName)
    586591    , m_iTotalRowHeight(0)
    587592    , m_iMaxRowWidth(0)
    588593    , m_fKeepAspectRatio(false)
    589 {
     594    , m_iXSpacing(5)
     595    , m_iYSpacing(5)
     596    , m_iLeftMargin(5)
     597    , m_iTopMargin(5)
     598    , m_iRightMargin(5)
     599    , m_iBottomMargin(5)
     600{
     601    setAttribute(Qt::WA_DeleteOnClose);
    590602    prepareObjects();
    591603    parseLayout();
     
    607619void UISoftKeyboard::resizeEvent(QResizeEvent *pEvent)
    608620{
    609     QIWithRetranslateUI<QWidget>::resizeEvent(pEvent);
    610     updateLayout();
     621    QIWithRetranslateUI<QMainWindow>::resizeEvent(pEvent);
     622    //updateLayout();
    611623}
    612624
     
    683695void UISoftKeyboard::prepareObjects()
    684696{
    685     setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
     697
    686698    /* Create layout: */
    687     m_pMainLayout = new QHBoxLayout(this);
    688     if (!m_pMainLayout)
    689         return;
    690     m_pContainerWidget = new QWidget;
     699    // m_pMainLayout = new QHBoxLayout(this);
     700    // if (!m_pMainLayout)
     701    //     return;
     702    m_pContainerWidget = new UISoftKeyboardWidget;
    691703    if (!m_pContainerWidget)
    692704        return;
    693     //m_pContainerWidget->setStyleSheet("background-color:red;");
    694     m_pMainLayout->addWidget(m_pContainerWidget);
     705    m_pContainerWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
     706
     707    m_pContainerWidget->setStyleSheet("background-color:red;");
     708    //m_pMainLayout->addWidget(m_pContainerWidget);
     709    setCentralWidget(m_pContainerWidget);
     710
     711    m_pContainerWidget->updateGeometry();
    695712}
    696713
     
    715732    UIKeyboardLayoutReader reader;
    716733    SoftKeyboardLayout layout;
    717     if (!reader.parseXMLFile(":/us_layout.xml", layout))
    718         return;
    719 
    720     m_iTotalRowHeight = 0;
    721     m_iMaxRowWidth = 0;
    722     qDeleteAll(m_rows);
    723     m_rows.clear();
     734    layout.m_iDefaultWidth = 0;
     735    layout.m_iDefaultHeight = 0;
     736    if (!reader.parseXMLFile(":/102_iso.xml", layout))
     737        return;
     738    int iY = m_iTopMargin;
     739    int iMaxWidth = 0;
    724740    for (int i = 0; i < layout.m_rows.size(); ++i)
    725741    {
    726         UISoftKeyboardRow *pNewRow = new UISoftKeyboardRow(m_pContainerWidget);
    727         m_rows.push_back(pNewRow);
    728         pNewRow->setUnscaledHeight(layout.m_rows[i].m_iHeight);
    729         pNewRow->setKeepAspectRatio(m_fKeepAspectRatio);
    730         m_iTotalRowHeight += layout.m_rows[i].m_iHeight;
    731         int iRowWidth = 0;
    732         for (int j = 0; j < layout.m_rows[i].m_keys.size(); ++j)
     742        m_keys.append(QVector<UISoftKeyboardKey*>());
     743        const SoftKeyboardRow &row = layout.m_rows[i];
     744        int iX = m_iLeftMargin;
     745        QVector<UISoftKeyboardKey*> &rowKeyVector = m_keys.back();
     746        int iRowHeight = row.m_iDefaultHeight;
     747        for (int j = 0; j < row.m_keys.size(); ++j)
    733748        {
    734             const SoftKeyboardKey &key = layout.m_rows[i].m_keys[j];
    735             iRowWidth += key.m_iWidth;
    736             iRowWidth += key.m_iSpaceAfter;
    737             UISoftKeyboardKey *pKey = new UISoftKeyboardKey(pNewRow);
    738             if (!pKey)
    739                 continue;
    740             connect(pKey, &UISoftKeyboardKey::pressed, this, &UISoftKeyboard::sltHandleKeyPress);
    741             connect(pKey, &UISoftKeyboardKey::released, this, &UISoftKeyboard::sltHandleKeyRelease);
    742             connect(pKey, &UISoftKeyboardKey::sigStateChanged, this, &UISoftKeyboard::sltHandleModifierStateChange);
    743             pNewRow->addKey(pKey);
    744             pKey->setText(key.m_strLabel);
     749            const SoftKeyboardKey &key = row.m_keys[j];
     750            UISoftKeyboardKey *pKey = new UISoftKeyboardKey(m_pContainerWidget);
     751            rowKeyVector.append(pKey);
     752            pKey->setText(key.m_strKeyCap);
     753            pKey->setGeometry(iX, iY, key.m_iWidth, key.m_iHeight);
    745754            pKey->setWidth(key.m_iWidth);
    746             pKey->setScanCode(key.m_scanCode);
    747             pKey->setScanCodePrefix(key.m_scanCodePrefix);
    748             pKey->setSpaceAfter(key.m_iSpaceAfter);
    749             pKey->setType(key.m_enmType);
    750             pKey->hide();
     755            // printf("key.m_iWidth %d\n", pKey->width());
     756            pKey->setVertices(UIKeyboardLayoutReader::computeKeyVertices(key));
     757            iX += key.m_iWidth;
     758            if (j < row.m_keys.size() - 1)
     759                iX += m_iXSpacing;
     760            if (key.m_iSpaceWidthAfter != 0)
     761                iX += (m_iXSpacing + key.m_iSpaceWidthAfter);
     762            iRowHeight = qMax(iRowHeight, key.m_iHeight);
    751763        }
    752         pNewRow->setUnscaledWidth(iRowWidth);
    753         m_iMaxRowWidth = qMax(m_iMaxRowWidth, pNewRow->unscaledWidth());
    754     }
     764        iMaxWidth = qMax(iMaxWidth, iX);
     765        iY += iRowHeight;
     766        if (i < layout.m_rows.size() - 1)
     767            iY += m_iYSpacing;
     768    }
     769    m_pContainerWidget->setNewMinimumSize(QSize(iMaxWidth + m_iRightMargin, iY + m_iBottomMargin));
    755770}
    756771
     
    771786        fMultiplier = fMultiplierY;
    772787
    773     int y = 0;
    774     int totalHeight = 0;
    775     int totalWidth = 0;
    776     for (int i = 0; i < m_rows.size(); ++i)
    777     {
    778         UISoftKeyboardRow *pRow = m_rows[i];
    779         if (!pRow)
    780             continue;
    781         if(m_fKeepAspectRatio)
    782         {
    783             pRow->setGeometry(0, y, fMultiplier * pRow->unscaledWidth(), fMultiplier * pRow->unscaledHeight());
    784             pRow->setVisible(true);
    785             y += fMultiplier * pRow->unscaledHeight();
    786             totalWidth += fMultiplier * pRow->unscaledWidth();
    787             totalHeight += fMultiplier * pRow->unscaledHeight();
    788         }
    789         else
    790         {
    791             pRow->setGeometry(0, y, fMultiplierX * pRow->unscaledWidth(), fMultiplierY * pRow->unscaledHeight());
    792             pRow->setVisible(true);
    793             y += fMultiplierY * pRow->unscaledHeight();
    794             totalWidth += fMultiplierX * pRow->unscaledWidth();
    795             totalHeight += fMultiplierY * pRow->unscaledHeight();
    796         }
    797         pRow->updateLayout();
     788    // int y = 0;
     789    // int totalHeight = 0;
     790    // int totalWidth = 0;
     791    //for (int i = 0; i < layout.m_rows.size(); ++i)
     792    {
     793    //     UISoftKeyboardRow *pRow = m_rows[i];
     794    //     if (!pRow)
     795    //         continue;
     796    //     if(m_fKeepAspectRatio)
     797    //     {
     798    //         pRow->setGeometry(0, y, fMultiplier * pRow->unscaledWidth(), fMultiplier * pRow->unscaledHeight());
     799    //         pRow->setVisible(true);
     800    //         y += fMultiplier * pRow->unscaledHeight();
     801    //         totalWidth += fMultiplier * pRow->unscaledWidth();
     802    //         totalHeight += fMultiplier * pRow->unscaledHeight();
     803    //     }
     804    //     else
     805    //     {
     806    //         pRow->setGeometry(0, y, fMultiplierX * pRow->unscaledWidth(), fMultiplierY * pRow->unscaledHeight());
     807    //         pRow->setVisible(true);
     808    //         y += fMultiplierY * pRow->unscaledHeight();
     809    //         totalWidth += fMultiplierX * pRow->unscaledWidth();
     810    //         totalHeight += fMultiplierY * pRow->unscaledHeight();
     811    //     }
     812    //     pRow->updateLayout();
    798813    }
    799814}
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h

    r78682 r78812  
    3737class UISession;
    3838class UISoftKeyboardKey;
    39 class UISoftKeyboardRow;
    4039class QHBoxLayout;
    4140class QVBoxLayout;
     41class UISoftKeyboardWidget;
    4242class UIToolBar;
    4343
    4444
    45 class UISoftKeyboard : public QIWithRetranslateUI<QWidget>
     45class UISoftKeyboard : public QIWithRetranslateUI<QMainWindow>
    4646{
    4747    Q_OBJECT;
     
    4949public:
    5050
    51     UISoftKeyboard(EmbedTo enmEmbedding, QWidget *pParent, UISession *pSession,
    52                                 QString strMachineName = QString(), bool fShowToolbar = false);
     51    UISoftKeyboard(QWidget *pParent, UISession *pSession,
     52                   QString strMachineName = QString());
    5353    ~UISoftKeyboard();
    5454
     
    7777    UISession     *m_pSession;
    7878    QHBoxLayout   *m_pMainLayout;
    79     QWidget       *m_pContainerWidget;
    80     UIToolBar     *m_pToolBar;
    81     const bool    m_fShowToolbar;
     79    UISoftKeyboardWidget       *m_pContainerWidget;
    8280    QString       m_strMachineName;
    83     QVector<UISoftKeyboardRow*> m_rows;
    8481    int           m_iTotalRowHeight;
    8582    int           m_iMaxRowWidth;
    8683    QVector<UISoftKeyboardKey*> m_pressedModifiers;
     84    QVector<QVector<UISoftKeyboardKey*> > m_keys;
    8785    bool          m_fKeepAspectRatio;
     86
     87    int m_iXSpacing;
     88    int m_iYSpacing;
     89    int m_iLeftMargin;
     90    int m_iTopMargin;
     91    int m_iRightMargin;
     92    int m_iBottomMargin;
    8893};
    8994
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboardDialog.cpp

    r78680 r78812  
    3535
    3636/*********************************************************************************************************************************
    37 *   Class UISoftKeyboardDialogFactory implementation.                                                                     *
    38 *********************************************************************************************************************************/
    39 
    40 UISoftKeyboardDialogFactory::UISoftKeyboardDialogFactory(UISession *pSession /* = 0 */, UIActionPool *pActionPool /* = 0 */,
    41                                                          const QString &strMachineName /* = QString() */)
    42     : m_pSession(pSession)
    43     , m_pActionPool(pActionPool)
    44     , m_strMachineName(strMachineName)
    45 {
    46 }
    47 
    48 void UISoftKeyboardDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget)
    49 {
    50     pDialog = new UISoftKeyboardDialog(pCenterWidget, m_pSession, m_pActionPool, m_strMachineName);
    51 }
    52 
    53 
    54 /*********************************************************************************************************************************
    5537*   Class UISoftKeyboardDialog implementation.                                                                            *
    5638*********************************************************************************************************************************/
    5739
    58 UISoftKeyboardDialog::UISoftKeyboardDialog(QWidget *pCenterWidget,
     40UISoftKeyboardDialog::UISoftKeyboardDialog(QWidget *pParent,
    5941                                           UISession *pSession,
    60                                            UIActionPool *pActionPool,
    6142                                           const QString &strMachineName /* = QString() */)
    62     : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget)
     43    : QMainWindow(pParent)
    6344    , m_pSession(pSession)
    64     , m_pActionPool(pActionPool)
    6545    , m_strMachineName(strMachineName)
    6646{
     
    7252    setWindowTitle(tr("%1 - Guest Control").arg(m_strMachineName));
    7353    /* Translate buttons: */
    74     button(ButtonType_Close)->setText(tr("Close"));
     54    //button(ButtonType_Close)->setText(tr("Close"));
    7555}
    7656
     
    8464{
    8565    /* Create widget: */
    86     UISoftKeyboard  *pSoftKeyboard = new UISoftKeyboard(EmbedTo_Dialog, 0, m_pSession, "");
     66    //UISoftKeyboard  *pSoftKeyboard = new UISoftKeyboard(EmbedTo_Dialog, 0, m_pSession, "");
    8767
    88     if (pSoftKeyboard)
     68    //if (pSoftKeyboard)
    8969    {
    9070        /* Configure widget: */
    91         setWidget(pSoftKeyboard);
     71        //setWidget(pSoftKeyboard);
    9272        //setWidgetMenu(pWidget->menu());
    9373#ifdef VBOX_WS_MAC
     
    9575#endif
    9676        /* Add into layout: */
    97         centralWidget()->layout()->addWidget(pSoftKeyboard);
     77        //centralWidget()->layout()->addWidget(pSoftKeyboard);
    9878    }
    9979}
     
    10787void UISoftKeyboardDialog::loadSettings()
    10888{
    109     const QRect desktopRect = gpDesktop->availableGeometry(this);
    110     int iDefaultWidth = desktopRect.width() / 2;
    111     int iDefaultHeight = 0.5 * iDefaultWidth;
     89    // const QRect desktopRect = gpDesktop->availableGeometry(this);
     90    // int iDefaultWidth = desktopRect.width() / 2;
     91    // int iDefaultHeight = 0.5 * iDefaultWidth;
    11292
    113     QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight);
    114     if (centerWidget())
    115         defaultGeometry.moveCenter(centerWidget()->geometry().center());
     93    // QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight);
     94    // if (centerWidget())
     95    //     defaultGeometry.moveCenter(centerWidget()->geometry().center());
    11696
    117     /* Load geometry from extradata: */
    118     QRect geometry = gEDataManager->softKeyboardDialogGeometry(this, defaultGeometry);
     97    // /* Load geometry from extradata: */
     98    // QRect geometry = gEDataManager->softKeyboardDialogGeometry(this, defaultGeometry);
    11999
    120     /* Restore geometry: */
    121     LogRel2(("GUI: UISoftKeyboardDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
    122              geometry.x(), geometry.y(), geometry.width(), geometry.height()));
    123     setDialogGeometry(geometry);
     100    // /* Restore geometry: */
     101    // LogRel2(("GUI: UISoftKeyboardDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
     102    //          geometry.x(), geometry.y(), geometry.width(), geometry.height()));
     103    // setDialogGeometry(geometry);
    124104}
    125105
    126106void UISoftKeyboardDialog::saveSettings() const
    127107{
    128     /* Save window geometry to extradata: */
    129     const QRect saveGeometry = geometry();
    130 #ifdef VBOX_WS_MAC
    131     /* darwinIsWindowMaximized expects a non-const QWidget*. thus const_cast: */
    132     QWidget *pw = const_cast<QWidget*>(qobject_cast<const QWidget*>(this));
    133     gEDataManager->setSoftKeyboardDialogGeometry(saveGeometry, ::darwinIsWindowMaximized(pw));
    134 #else /* !VBOX_WS_MAC */
    135     gEDataManager->setSoftKeyboardDialogGeometry(saveGeometry, isMaximized());
    136 #endif /* !VBOX_WS_MAC */
    137     LogRel2(("GUI: Soft Keyboard Dialog: Geometry saved as: Origin=%dx%d, Size=%dx%d\n",
    138              saveGeometry.x(), saveGeometry.y(), saveGeometry.width(), saveGeometry.height()));
     108//     /* Save window geometry to extradata: */
     109//     const QRect saveGeometry = geometry();
     110// #ifdef VBOX_WS_MAC
     111//     /* darwinIsWindowMaximized expects a non-const QWidget*. thus const_cast: */
     112//     QWidget *pw = const_cast<QWidget*>(qobject_cast<const QWidget*>(this));
     113//     gEDataManager->setSoftKeyboardDialogGeometry(saveGeometry, ::darwinIsWindowMaximized(pw));
     114// #else /* !VBOX_WS_MAC */
     115//     gEDataManager->setSoftKeyboardDialogGeometry(saveGeometry, isMaximized());
     116// #endif /* !VBOX_WS_MAC */
     117//     LogRel2(("GUI: Soft Keyboard Dialog: Geometry saved as: Origin=%dx%d, Size=%dx%d\n",
     118//              saveGeometry.x(), saveGeometry.y(), saveGeometry.width(), saveGeometry.height()));
    139119}
    140120
     
    144124}
    145125
    146 void UISoftKeyboardDialog::sltSetCloseButtonShortCut(QKeySequence shortcut)
     126void UISoftKeyboardDialog::sltSetCloseButtonShortCut(QKeySequence )
    147127{
    148     if (button(ButtonType_Close))
    149         button(ButtonType_Close)->setShortcut(shortcut);
     128    // if (button(ButtonType_Close))
     129    //     button(ButtonType_Close)->setShortcut(shortcut);
    150130}
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboardDialog.h

    r78635 r78812  
    2323
    2424/* Qt includes: */
     25#include <QMainWindow>
    2526#include <QString>
    26 
    27 /* GUI includes: */
    28 #include "QIManagerDialog.h"
    29 #include "QIWithRetranslateUI.h"
    3027
    3128/* COM includes: */
     
    3936class CGuest;
    4037
    41 /** QIManagerDialogFactory extension used as a factory for the Guest Control dialog. */
    42 class UISoftKeyboardDialogFactory : public QIManagerDialogFactory
    43 {
    44 public:
    4538
    46     UISoftKeyboardDialogFactory(UISession *pSession = 0,UIActionPool *pActionPool = 0, const QString &strMachineName = QString());
    47 
    48 protected:
    49 
    50     /** Creates derived @a pDialog instance.
    51       * @param  pCenterWidget  Passes the widget to center wrt. pCenterWidget. */
    52     virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) /* override */;
    53 
    54     UISession    *m_pSession;
    55     UIActionPool *m_pActionPool;
    56     QString       m_strMachineName;
    57 };
    58 
    59 
    60 /** QIManagerDialog extension providing GUI with the dialog displaying guest control releated logs. */
    61 class UISoftKeyboardDialog : public QIWithRetranslateUI<QIManagerDialog>
     39class UISoftKeyboardDialog : public QMainWindow
    6240{
    6341    Q_OBJECT;
     
    6846      * @param  pCenterWidget  Passes the widget reference to center according to.
    6947      * @param  pActionPool    Passes the action-pool reference. */
    70     UISoftKeyboardDialog(QWidget *pCenterWidget, UISession *pSession, UIActionPool *pActionPool, const QString &strMachineName = QString());
     48    UISoftKeyboardDialog(QWidget *pParent, UISession *pSession, const QString &strMachineName = QString());
    7149
    7250protected:
  • trunk/src/VBox/Frontends/VirtualBox/xml/102_iso.xml

    r78682 r78812  
    11<?xml version="1.0"?>
    2 <layout>
     2
     3<layout defaultHeight="50" defaultWidth="50">
    34    <row>
    4         <height>40</height>
    5         <key>
    6             <width>50</width>
    7             <label>Esc</label>
     5        <key>
     6            <keycap>Esc</keycap>
    87            <position>110</position>
    98            <scancode>0x01</scancode>
    109        </key>
    11         <space>
    12             <width>20</width>
    13         </space>
    14         <key>
    15             <width>50</width>
    16             <label>F1</label>
     10        <space></space>
     11        <key>
     12            <keycap>F1</keycap>
    1713            <position>112</position>
    1814            <scancode>0x3b</scancode>
    1915        </key>
    2016        <key>
    21             <width>50</width>
    22             <label>F2</label>
     17            <keycap>F2</keycap>
    2318            <position>113</position>
    2419            <scancode>0x3c</scancode>
    2520        </key>
    2621        <key>
    27             <width>50</width>
    28             <label>F3</label>
     22            <keycap>F3</keycap>
    2923            <position>114</position>
    3024            <scancode>0x3d</scancode>
    3125        </key>
    32         <space>
    33             <width>20</width>
    34         </space>
    35         <key>
    36             <width>50</width>
    37             <label>F4</label>
     26        <key>
     27            <keycap>F4</keycap>
    3828            <position>115</position>
    3929            <scancode>0x3e</scancode>
    4030        </key>
    41         <key>
    42             <width>50</width>
    43             <label>F5</label>
     31        <space>
     32            <width>25</width>
     33        </space>
     34        <key>
     35            <keycap>F5</keycap>
    4436            <position>116</position>
    4537            <scancode>0x3f</scancode>
    4638        </key>
    4739        <key>
    48             <width>50</width>
    49             <label>F6</label>
     40            <keycap>F6</keycap>
    5041            <position>117</position>
    5142            <scancode>0x40</scancode>
    5243        </key>
    53         <space>
    54             <width>20</width>
    55         </space>
    56         <key>
    57             <width>50</width>
    58             <label>F7</label>
     44        <key>
     45            <keycap>F7</keycap>
    5946            <position>188</position>
    6047            <scancode>0x41</scancode>
    6148        </key>
    6249        <key>
    63             <width>50</width>
    64             <label>F8</label>
     50            <keycap>F8</keycap>
    6551            <position>119</position>
    6652            <scancode>0x42</scancode>
    6753        </key>
    68         <key>
    69             <width>50</width>
    70             <label>F9</label>
     54        <space>
     55            <width>25</width>
     56        </space>
     57        <key>
     58            <keycap>F9</keycap>
    7159            <position>120</position>
    7260            <scancode>0x43</scancode>
    7361        </key>
    74         <space>
    75             <width>20</width>
    76         </space>
    77         <key>
    78             <width>50</width>
    79             <label>F10</label>
     62        <key>
     63            <keycap>F10</keycap>
    8064            <position>121</position>
    8165            <scancode>0x44</scancode>
    8266        </key>
    8367        <key>
    84             <width>50</width>
    85             <label>F11</label>
     68            <keycap>F11</keycap>
    8669            <position>122</position>
    8770            <scancode>0x57</scancode>
    8871        </key>
    8972        <key>
    90             <width>50</width>
    91             <label>F12</label>
     73            <keycap>F12</keycap>
    9274            <position>123</position>
    9375            <scancode>0x58</scancode>
    9476        </key>
     77        <space>
     78            <width>25</width>
     79        </space>
     80        <key>
     81            <keycap>PrtScn</keycap>
     82            <position>121</position>
     83            <scancode></scancode>
     84        </key>
     85        <key>
     86            <keycap>ScrollLock</keycap>
     87            <position>122</position>
     88            <scancode>0x46</scancode>
     89        </key>
     90        <key>
     91            <keycap>Pause</keycap>
     92            <position>123</position>
     93            <scancode></scancode>
     94        </key>
    9595    </row>
    9696    <row>
    97         <height>40</height>
    98         <key>
    99             <width>50</width>
    100             <label>~</label>
    101             <label>`</label>
     97        <key>
     98            <keycap>~</keycap>
     99            <keycap>`</keycap>
    102100            <position>1</position>
    103101            <scancode>0x29</scancode>
    104102        </key>
    105103        <key>
    106             <width>50</width>
    107             <label>!</label>
    108             <label>1</label>
     104            <keycap>!</keycap>
     105            <keycap>1</keycap>
    109106            <position>2</position>
    110107            <scancode>0x02</scancode>
    111108        </key>
    112109        <key>
    113             <width>50</width>
    114             <label>@</label>
    115             <label>2</label>
     110            <keycap>@</keycap>
     111            <keycap>2</keycap>
    116112            <position>3</position>
    117113            <scancode>0x03</scancode>
    118114        </key>
    119115        <key>
    120             <width>50</width>
    121             <label>#</label>
    122             <label>3</label>
     116            <keycap>#</keycap>
     117            <keycap>3</keycap>
    123118            <position>4</position>
    124119            <scancode>0x04</scancode>
    125120        </key>
    126121        <key>
    127             <width>50</width>
    128             <label>$</label>
    129             <label>4</label>
     122            <keycap>$</keycap>
     123            <keycap>4</keycap>
    130124            <position>5</position>
    131125            <scancode>0x05</scancode>
    132126        </key>
    133127        <key>
    134             <width>50</width>
    135             <label>%</label>
    136             <label>5</label>
     128            <keycap>%</keycap>
     129            <keycap>5</keycap>
    137130            <position>6</position>
    138131            <scancode>0x06</scancode>
    139132        </key>
    140133        <key>
    141             <width>50</width>
    142             <label>^</label>
    143             <label>6</label>
     134            <keycap>^</keycap>
     135            <keycap>6</keycap>
    144136            <position>7</position>
    145137            <scancode>0x07</scancode>
    146138        </key>
    147139        <key>
    148             <width>50</width>
    149             <label>&amp;</label>
    150             <label>7</label>
     140            <keycap>&amp;</keycap>
     141            <keycap>7</keycap>
    151142            <position>8</position>
    152143            <scancode>0x08</scancode>
    153144        </key>
    154145        <key>
    155             <width>50</width>
    156             <label>*</label>
    157             <label>8</label>
     146            <keycap>*</keycap>
     147            <keycap>8</keycap>
    158148            <position>9</position>
    159149            <scancode>0x09</scancode>
    160150        </key>
    161151        <key>
    162             <width>50</width>
    163             <label>(</label>
    164             <label>9</label>
     152            <keycap>(</keycap>
     153            <keycap>9</keycap>
    165154            <position>10</position>
    166155            <scancode>0x0a</scancode>
    167156        </key>
    168157        <key>
    169             <width>50</width>
    170             <label>)</label>
    171             <label>0</label>
     158            <keycap>)</keycap>
     159            <keycap>0</keycap>
    172160            <position>11</position>
    173161            <scancode>0x0b</scancode>
    174162        </key>
    175163        <key>
    176             <width>50</width>
    177             <label>_</label>
    178             <label>-</label>
     164            <keycap>_</keycap>
     165            <keycap>-</keycap>
    179166            <position>12</position>
    180167            <scancode>0x0c</scancode>
    181168        </key>
    182169        <key>
    183             <width>50</width>
    184             <label>+</label>
    185             <label>=</label>
     170            <keycap>+</keycap>
     171            <keycap>=</keycap>
    186172            <position>13</position>
    187173            <scancode>0x0d</scancode>
    188174        </key>
    189175        <key>
    190             <width>80</width>
    191             <label>Backspace</label>
     176            <width>110</width>
     177            <keycap>Backspace</keycap>
    192178            <position>14</position>
    193179            <scancode>0x0e</scancode>
    194         </key>
    195     </row>
    196     <row>
    197         <height>40</height>
    198         <key>
    199             <width>70</width>
    200             <label>Tab</label>
    201             <position>16</position>
    202             <scancode>0x0f</scancode>
    203         </key>
    204         <key>
    205             <width>50</width>
    206             <label>Q</label>
    207             <position>17</position>
    208             <scancode>0x10</scancode>
    209         </key>
    210         <key>
    211             <width>50</width>
    212             <label>W</label>
    213             <position>18</position>
    214             <scancode>0x11</scancode>
    215         </key>
    216         <key>
    217             <width>50</width>
    218             <label>E</label>
    219             <position>19</position>
    220             <scancode>0x12</scancode>
    221         </key>
    222         <key>
    223             <width>50</width>
    224             <label>R</label>
    225             <position>20</position>
    226             <scancode>0x13</scancode>
    227         </key>
    228         <key>
    229             <width>50</width>
    230             <label>T</label>
    231             <position>21</position>
    232             <scancode>0x14</scancode>
    233         </key>
    234         <key>
    235             <width>50</width>
    236             <label>Y</label>
    237             <position>22</position>
    238             <scancode>0x15</scancode>
    239         </key>
    240         <key>
    241             <width>50</width>
    242             <label>U</label>
    243             <position>23</position>
    244             <scancode>0x16</scancode>
    245         </key>
    246         <key>
    247             <width>50</width>
    248             <label>I</label>
    249             <position>24</position>
    250             <scancode>0x17</scancode>
    251         </key>
    252         <key>
    253             <width>50</width>
    254             <label>O</label>
    255             <position>25</position>
    256             <scancode>0x18</scancode>
    257         </key>
    258         <key>
    259             <width>50</width>
    260             <label>P</label>
    261             <position>26</position>
    262             <scancode>0x19</scancode>
    263         </key>
    264         <key>
    265             <width>50</width>
    266             <label>{</label>
    267             <label>[</label>
    268             <position>27</position>
    269             <scancode>0x1a</scancode>
    270         </key>
    271         <key>
    272             <width>50</width>
    273             <label>}</label>
    274             <label>]</label>
    275             <position>28</position>
    276             <scancode>0x1b</scancode>
    277         </key>
    278         <key>
    279             <width>60</width>
    280             <label>|</label>
    281             <label>\</label>
    282             <position>29</position>
    283             <scancode>0x2b</scancode>
    284180        </key>
    285181    </row>
    286182
    287183    <row>
    288         <height>40</height>
    289         <key>
    290             <width>70</width>
    291             <label>CapsLock</label>
    292             <type>toggleable</type>
    293             <position>30</position>
    294             <scancode>0x3a</scancode>
    295         </key>
    296         <key>
    297             <width>50</width>
    298             <label>A</label>
    299             <position>31</position>
    300             <scancode>0x1e</scancode>
    301         </key>
    302         <key>
    303             <width>50</width>
    304             <label>S</label>
    305             <position>32</position>
    306             <scancode>0x1f</scancode>
    307         </key>
    308         <key>
    309             <width>50</width>
    310             <label>D</label>
    311             <position>33</position>
    312             <scancode>0x20</scancode>
    313         </key>
    314         <key>
    315             <width>50</width>
    316             <label>F</label>
    317             <position>34</position>
    318             <scancode>0x21</scancode>
    319         </key>
    320         <key>
    321             <width>50</width>
    322             <label>G</label>
    323             <position>35</position>
    324             <scancode>0x22</scancode>
    325         </key>
    326         <key>
    327             <width>50</width>
    328             <label>H</label>
    329             <position>36</position>
    330             <scancode>0x23</scancode>
    331         </key>
    332         <key>
    333             <width>50</width>
    334             <label>J</label>
    335             <position>37</position>
    336             <scancode>0x24</scancode>
    337         </key>
    338         <key>
    339             <width>50</width>
    340             <label>K</label>
    341             <position>38</position>
    342             <scancode>0x25</scancode>
    343         </key>
    344         <key>
    345             <width>50</width>
    346             <label>L</label>
    347             <position>39</position>
    348             <scancode>0x26</scancode>
    349         </key>
    350         <key>
    351             <width>50</width>
    352             <label>:</label>
    353             <label>;</label>
    354             <position>40</position>
    355             <scancode>0x27</scancode>
    356         </key>
    357         <key>
    358             <width>50</width>
    359             <label>&quot;</label>
    360             <label>'</label>
    361             <position>41</position>
    362             <scancode>0x28</scancode>
    363         </key>
    364         <key>
    365             <width>110</width>
    366             <label>Enter</label>
    367             <position>43</position>
    368             <scancode>0x1c</scancode>
     184        <key>
     185            <width>75</width>
     186            <keycap>Tab</keycap>
     187            <position>16</position>
     188            <scancode>0x0f</scancode>
     189        </key>
     190        <key>
     191            <keycap>Q</keycap>
     192            <position>17</position>
     193            <scancode>0x10</scancode>
     194        </key>
     195        <key>
     196            <keycap>W</keycap>
     197            <position>18</position>
     198            <scancode>0x11</scancode>
     199        </key>
     200        <key>
     201            <keycap>E</keycap>
     202            <position>19</position>
     203            <scancode>0x12</scancode>
     204        </key>
     205        <key>
     206            <keycap>R</keycap>
     207            <position>20</position>
     208            <scancode>0x13</scancode>
     209        </key>
     210        <key>
     211            <keycap>T</keycap>
     212            <position>21</position>
     213            <scancode>0x14</scancode>
     214        </key>
     215        <key>
     216            <keycap>Y</keycap>
     217            <position>22</position>
     218            <scancode>0x15</scancode>
     219        </key>
     220        <key>
     221            <keycap>U</keycap>
     222            <position>23</position>
     223            <scancode>0x16</scancode>
     224        </key>
     225        <key>
     226            <keycap>I</keycap>
     227            <position>24</position>
     228            <scancode>0x17</scancode>
     229        </key>
     230        <key>
     231            <keycap>O</keycap>
     232            <position>25</position>
     233            <scancode>0x18</scancode>
     234        </key>
     235        <key>
     236            <keycap>P</keycap>
     237            <position>26</position>
     238            <scancode>0x19</scancode>
     239        </key>
     240        <key>
     241            <keycap>{</keycap>
     242            <keycap>[</keycap>
     243            <position>27</position>
     244            <scancode>0x1a</scancode>
     245        </key>
     246        <key>
     247            <keycap>}</keycap>
     248            <keycap>]</keycap>
     249            <position>28</position>
     250            <scancode>0x1b</scancode>
     251        </key>
     252        <key>
     253            <width>85</width>
     254            <height>100</height>
     255            <keycap>Enter</keycap>
     256            <position>29</position>
     257            <scancode>0x2b</scancode>
     258            <cutout>
     259                <width>25</width>
     260                <height>50</height>
     261                <corner>bottomLeft</corner>
     262            </cutout>
    369263        </key>
    370264    </row>
    371     <row>
    372         <height>40</height>
    373         <key>
    374             <width>115</width>
    375             <label>Shift</label>
    376             <type>modifier</type>
    377             <position>44</position>
    378             <scancode>0x2a</scancode>
    379         </key>
    380         <key>
    381             <width>50</width>
    382             <label>Z</label>
    383             <position>46</position>
    384             <scancode>0x2c</scancode>
    385         </key>
    386         <key>
    387             <width>50</width>
    388             <label>X</label>
    389             <position>47</position>
    390             <scancode>0x2d</scancode>
    391         </key>
    392         <key>
    393             <width>50</width>
    394             <label>C</label>
    395             <position>48</position>
    396             <scancode>0x2e</scancode>
    397         </key>
    398         <key>
    399             <width>50</width>
    400             <label>V</label>
    401             <position>49</position>
    402             <scancode>0x2f</scancode>
    403         </key>
    404         <key>
    405             <width>50</width>
    406             <label>B</label>
    407             <position>50</position>
    408             <scancode>0x30</scancode>
    409         </key>
    410         <key>
    411             <width>50</width>
    412             <label>N</label>
    413             <position>51</position>
    414             <scancode>0x31</scancode>
    415         </key>
    416         <key>
    417             <width>50</width>
    418             <label>M</label>
    419             <position>52</position>
    420             <scancode>0x32</scancode>
    421         </key>
    422         <key>
    423             <width>50</width>
    424             <label>&lt;</label>
    425             <label>,</label>
    426             <position>53</position>
    427             <scancode>0x33</scancode>
    428         </key>
    429         <key>
    430             <width>50</width>
    431             <label>&gt;</label>
    432             <label>.</label>
    433             <position>54</position>
    434             <scancode>0x34</scancode>
    435         </key>
    436         <key>
    437             <width>50</width>
    438             <label>?</label>
    439             <label>/</label>
    440             <position>55</position>
    441             <scancode>0x35</scancode>
    442         </key>
    443         <key>
    444             <width>115</width>
    445             <label>Shift</label>
    446             <type>modifier</type>
    447             <position>57</position>
    448             <scancode>0x36</scancode>
    449         </key>
    450     </row>
    451 
    452     <row>
    453         <height>40</height>
    454         <key>
    455             <width>90</width>
    456             <label>Ctrl</label>
    457             <type>modifier</type>
    458             <position>58</position>
    459             <scancode>0x1d</scancode>
    460         </key>
    461         <key>
    462             <width>50</width>
    463             <label>Win</label>
    464             <type>modifier</type>
    465             <scancodeprefix>0xe0</scancodeprefix>
    466             <scancode>0x5b</scancode>
    467         </key>
    468         <key>
    469             <width>70</width>
    470             <position>60</position>
    471             <label>Alt</label>
    472             <type>modifier</type>
    473             <scancode>0x38</scancode>
    474         </key>
    475         <key>
    476             <width>240</width>
    477             <position>61</position>
    478             <scancode>0x39</scancode>
    479         </key>
    480         <key>
    481             <width>70</width>
    482             <label>AltGr</label>
    483             <type>modifier</type>
    484             <scancodeprefix>0xe0</scancodeprefix>
    485             <scancode>0x38</scancode>
    486         </key>
    487         <key>
    488             <width>50</width>
    489             <label>Win</label>
    490             <type>modifier</type>
    491             <scancodeprefix>0xe0</scancodeprefix>
    492             <scancode>0x5c</scancode>
    493         </key>
    494         <key>
    495             <width>70</width>
    496             <label>Menu</label>
    497             <scancodeprefix>0xe0</scancodeprefix>
    498             <scancode>0x5d</scancode>
    499         </key>
    500         <key>
    501             <width>90</width>
    502             <label>Ctrl</label>
    503             <type>modifier</type>
    504             <scancodeprefix>0xe0</scancodeprefix>
    505             <scancode>0x1d</scancode>
    506         </key>
    507 
    508     </row>
    509 
    510265</layout>
  • trunk/src/VBox/Frontends/VirtualBox/xml/us_layout.xml

    r78680 r78812  
    284284        </key>
    285285    </row>
    286 
    287286    <row>
    288287        <height>40</height>
Note: See TracChangeset for help on using the changeset viewer.

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