VirtualBox

Changeset 27690 in vbox


Ignore:
Timestamp:
Mar 25, 2010 10:14:17 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59285
Message:

FE/Qt4: native reset button on Mac OS X

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaSpecialControls.h

    r27401 r27690  
    4343    {
    4444        HelpButton,
    45         CancelButton
     45        CancelButton,
     46        ResetButton
    4647    };
    4748
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaSpecialControls.mm

    r27401 r27690  
    232232            break;
    233233        }
     234        case ResetButton:
     235        {
     236            mNativeRef = [[NSButton alloc] initWithFrame: NSMakeRect(0, 0, 13, 13)];
     237            [mNativeRef setTitle: @""];
     238            [mNativeRef setBezelStyle:NSShadowlessSquareBezelStyle];
     239            [mNativeRef setButtonType:NSMomentaryChangeButton];
     240            [mNativeRef setImage: [NSImage imageNamed: NSImageNameRefreshFreestandingTemplate]];
     241            [mNativeRef setBordered: NO];
     242            [[mNativeRef cell] setImageScaling: NSImageScaleProportionallyDown];
     243            break;
     244        }
    234245    }
    235246
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsInput.ui

    r27632 r27690  
    1 <ui version="4.0" >
     1<?xml version="1.0" encoding="UTF-8"?>
     2<ui version="4.0">
    23 <comment>
    3  VBox frontends: Qt4 GUI ("VirtualBox"):
     4 VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
    45
    56     Copyright (C) 2008 Sun Microsystems, Inc.
     
    910     you can redistribute it and/or modify it under the terms of the GNU
    1011     General Public License (GPL) as published by the Free Software
    11      Foundation, in version 2 as it comes in the "COPYING" file of the
     12     Foundation, in version 2 as it comes in the &quot;COPYING&quot; file of the
    1213     VirtualBox OSE distribution. VirtualBox OSE is distributed in the
    1314     hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
     
    1819 </comment>
    1920 <class>VBoxGLSettingsInput</class>
    20  <widget class="QWidget" name="VBoxGLSettingsInput" >
    21   <property name="geometry" >
     21 <widget class="QWidget" name="VBoxGLSettingsInput">
     22  <property name="geometry">
    2223   <rect>
    2324    <x>0</x>
     
    2728   </rect>
    2829  </property>
    29   <layout class="QGridLayout" >
    30    <property name="leftMargin" >
     30  <layout class="QGridLayout">
     31   <property name="margin">
    3132    <number>0</number>
    3233   </property>
    33    <property name="topMargin" >
    34     <number>0</number>
    35    </property>
    36    <property name="rightMargin" >
    37     <number>0</number>
    38    </property>
    39    <property name="bottomMargin" >
    40     <number>0</number>
    41    </property>
    42    <item rowspan="2" row="0" column="0" >
     34   <item row="0" column="0" rowspan="2">
    4335    <spacer>
    44      <property name="orientation" >
     36     <property name="orientation">
    4537      <enum>Qt::Horizontal</enum>
    4638     </property>
    47      <property name="sizeType" >
     39     <property name="sizeType">
    4840      <enum>QSizePolicy::Fixed</enum>
    4941     </property>
    50      <property name="sizeHint" >
     42     <property name="sizeHint" stdset="0">
    5143      <size>
    5244       <width>40</width>
     
    5648    </spacer>
    5749   </item>
    58    <item row="0" column="1" >
    59     <widget class="QLabel" name="mLbHostKey" >
    60      <property name="text" >
     50   <item row="0" column="1">
     51    <widget class="QLabel" name="mLbHostKey">
     52     <property name="text">
    6153      <string>Host &amp;Key:</string>
    6254     </property>
    63      <property name="buddy" >
     55     <property name="buddy">
    6456      <cstring>mHeHostKey</cstring>
    6557     </property>
    6658    </widget>
    6759   </item>
    68    <item row="0" column="2" >
    69     <widget class="QIHotKeyEdit" name="mHeHostKey" >
    70      <property name="whatsThis" >
     60   <item row="0" column="2">
     61    <widget class="QIHotKeyEdit" name="mHeHostKey">
     62     <property name="whatsThis">
    7163      <string>Displays the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</string>
    7264     </property>
    7365    </widget>
    7466   </item>
    75    <item row="0" column="3" >
    76     <widget class="QIToolButton" name="mTbResetHostKey" >
     67   <item row="0" column="3">
     68    <widget class="UIResetButton" name="mTbResetHostKey">
    7769     <property name="focusPolicy">
    7870      <enum>Qt::StrongFocus</enum>
     
    8173      <string>Reset Host Key</string>
    8274     </property>
    83      <property name="whatsThis" >
     75     <property name="whatsThis">
    8476      <string>Resets the key used as a Host Key in the VM window.</string>
    8577     </property>
    8678     <property name="icon">
    87       <iconset resource="../VirtualBox1.qrc" >:/delete_16px.png</iconset>
    88      </property>
    89      <property name="autoRaise">
    90       <bool>true</bool>
     79      <iconset><normaloff>:/delete_16px.png</normaloff>:/delete_16px.png</iconset>
    9180     </property>
    9281    </widget>
    9382   </item>
    94    <item row="0" column="4" >
     83   <item row="0" column="4">
    9584    <spacer>
    96      <property name="orientation" >
     85     <property name="orientation">
    9786      <enum>Qt::Horizontal</enum>
    9887     </property>
    99      <property name="sizeHint" >
     88     <property name="sizeHint" stdset="0">
    10089      <size>
    10190       <width>0</width>
     
    10594    </spacer>
    10695   </item>
    107    <item row="1" column="2" colspan="3" >
    108     <widget class="QCheckBox" name="mCbAutoGrab" >
    109      <property name="whatsThis" >
     96   <item row="1" column="2" colspan="3">
     97    <widget class="QCheckBox" name="mCbAutoGrab">
     98     <property name="whatsThis">
    11099      <string>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</string>
    111100     </property>
    112      <property name="text" >
     101     <property name="text">
    113102      <string>&amp;Auto Capture Keyboard</string>
    114103     </property>
    115104    </widget>
    116105   </item>
    117    <item row="2" column="3" >
     106   <item row="2" column="3">
    118107    <spacer>
    119      <property name="orientation" >
     108     <property name="orientation">
    120109      <enum>Qt::Vertical</enum>
    121110     </property>
    122      <property name="sizeHint" >
     111     <property name="sizeHint" stdset="0">
    123112      <size>
    124113       <width>121</width>
     
    137126  </customwidget>
    138127  <customwidget>
    139    <class>QIToolButton</class>
    140    <extends>QToolButton</extends>
    141    <header>QIToolButton.h</header>
     128   <class>UIResetButton</class>
     129   <extends>QAbstractButton</extends>
     130   <header>VBoxSpecialControls.h</header>
    142131  </customwidget>
    143132 </customwidgets>
    144  <resources/>
     133 <resources>
     134  <include location="../VirtualBox1.qrc"/>
     135 </resources>
    145136 <connections>
    146137  <connection>
     
    150141   <slot>clear()</slot>
    151142   <hints>
    152     <hint type="sourcelabel" >
     143    <hint type="sourcelabel">
    153144     <x>111</x>
    154145     <y>19</y>
    155146    </hint>
    156     <hint type="destinationlabel" >
     147    <hint type="destinationlabel">
    157148     <x>124</x>
    158149     <y>61</y>
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxSpecialControls.cpp

    r27401 r27690  
    4848{
    4949    mButton->resize(size());
     50}
     51
     52/********************************************************************************
     53 *
     54 * A rest button in the native Cocoa version.
     55 *
     56 ********************************************************************************/
     57UIResetButton::UIResetButton(QWidget *pParent /* = 0 */)
     58  : QAbstractButton(pParent)
     59{
     60    m_pButton = new VBoxCocoaButton(VBoxCocoaButton::ResetButton, this);
     61    connect(m_pButton, SIGNAL(clicked()),
     62            this, SIGNAL(clicked()));
     63    setFixedSize(m_pButton->size());
     64}
     65
     66void UIResetButton::resizeEvent(QResizeEvent * /* pEvent */)
     67{
     68    m_pButton->resize(size());
    5069}
    5170
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxSpecialControls.h

    r27401 r27690  
    6161/********************************************************************************
    6262 *
     63 * A reset button in the native Cocoa version.
     64 *
     65 ********************************************************************************/
     66class UIResetButton: public QAbstractButton
     67{
     68    Q_OBJECT;
     69
     70public:
     71    UIResetButton(QWidget *pParent = 0);
     72
     73    void setText(const QString &strText) { m_pButton->setText(strText); }
     74    void setToolTip(const QString &strTip) { m_pButton->setToolTip(strTip); }
     75    void removeBorder() {}
     76
     77protected:
     78    void paintEvent(QPaintEvent * /* pEvent */) {}
     79    void resizeEvent(QResizeEvent *pEvent);
     80
     81private:
     82    VBoxCocoaButton *m_pButton;
     83};
     84
     85/********************************************************************************
     86 *
    6387 * A help button in the native Cocoa version.
    6488 *
     
    136160protected:
    137161    void retranslateUi() {};
     162};
     163
     164/********************************************************************************
     165 *
     166 * A reset button for the other OS's (same as the cancel button for now)
     167 *
     168 ********************************************************************************/
     169class UIResetButton: public VBoxMiniCancelButton
     170{
     171    Q_OBJECT;
     172
     173public:
     174    UIResetButton(QWidget *pParent = 0)
     175      : VBoxMiniCancelButton(pParent) {}
    138176};
    139177
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