Changeset 67581 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 23, 2017 10:36:22 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116336
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIManagerDialog.cpp
r67573 r67581 140 140 { 141 141 /* Configure button-box: */ 142 #ifdef VBOX_WS_MAC 143 m_pButtonBox->setStandardButtons(QDialogButtonBox::Reset | QDialogButtonBox::Apply | QDialogButtonBox::Close); 144 #else 142 145 m_pButtonBox->setStandardButtons(QDialogButtonBox::Reset | QDialogButtonBox::Save | QDialogButtonBox::Close); 143 m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape); 144 m_pButtonBox->button(QDialogButtonBox::Reset)->hide(); 145 m_pButtonBox->button(QDialogButtonBox::Save)->hide(); 146 m_pButtonBox->button(QDialogButtonBox::Reset)->setEnabled(false); 147 m_pButtonBox->button(QDialogButtonBox::Save)->setEnabled(false); 146 #endif 147 m_buttons[ButtonType_Reset] = m_pButtonBox->button(QDialogButtonBox::Reset); 148 #ifdef VBOX_WS_MAC 149 m_buttons[ButtonType_Apply] = m_pButtonBox->button(QDialogButtonBox::Apply); 150 #else 151 m_buttons[ButtonType_Apply] = m_pButtonBox->button(QDialogButtonBox::Save); 152 #endif 153 m_buttons[ButtonType_Close] = m_pButtonBox->button(QDialogButtonBox::Close); 154 /* Assign shortcuts: */ 155 button(ButtonType_Close)->setShortcut(Qt::Key_Escape); 156 /* Hide 'Reset' and 'Apply' initially: */ 157 button(ButtonType_Reset)->hide(); 158 button(ButtonType_Apply)->hide(); 159 /* Disable 'Reset' and 'Apply' initially: */ 160 button(ButtonType_Reset)->setEnabled(false); 161 button(ButtonType_Apply)->setEnabled(false); 148 162 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &QIManagerDialog::sigClose); 149 163 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIManagerDialog.h
r67573 r67581 21 21 /* Qt includes: */ 22 22 #include <QMainWindow> 23 #include <QMap> 24 25 /* Other VBox includes: */ 26 #include <iprt/cdefs.h> 23 27 24 28 /* Forward declarations: */ 29 class QPushButton; 25 30 class QIDialogButtonBox; 26 31 class QIManagerDialog; … … 35 40 EmbedTo_Dialog, 36 41 EmbedTo_Stack 42 }; 43 44 45 /** Dialog button types. */ 46 enum ButtonType 47 { 48 ButtonType_Invalid = 0, 49 ButtonType_Reset = RT_BIT(0), 50 ButtonType_Apply = RT_BIT(1), 51 ButtonType_Close = RT_BIT(2), 37 52 }; 38 53 … … 133 148 /** Returns the button-box instance. */ 134 149 QIDialogButtonBox *buttonBox() { return m_pButtonBox; } 150 /** Returns button of passed @a enmType. */ 151 QPushButton *button(ButtonType enmType) { return m_buttons.value(enmType); } 135 152 /** @} */ 136 153 … … 166 183 /** Holds the dialog button-box instance. */ 167 184 QIDialogButtonBox *m_pButtonBox; 185 186 /** Holds the button-box button references. */ 187 QMap<ButtonType, QPushButton*> m_buttons; 168 188 /** @} */ 169 189 -
trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.cpp
r67575 r67581 1022 1022 { 1023 1023 /* Disable buttons first of all: */ 1024 button Box()->button(QDialogButtonBox::Reset)->setEnabled(false);1025 button Box()->button(QDialogButtonBox::Save)->setEnabled(false);1024 button(ButtonType_Reset)->setEnabled(false); 1025 button(ButtonType_Apply)->setEnabled(false); 1026 1026 1027 1027 /* Compare with known buttons: */ 1028 if (pButton == button Box()->button(QDialogButtonBox::Reset))1028 if (pButton == button(ButtonType_Reset)) 1029 1029 emit sigDataChangeRejected(); 1030 1030 1031 1031 else 1032 1032 1033 if (pButton == button Box()->button(QDialogButtonBox::Save))1033 if (pButton == button(ButtonType_Apply)) 1034 1034 emit sigDataChangeAccepted(); 1035 1035 } … … 1041 1041 1042 1042 /* Translate buttons: */ 1043 buttonBox()->button(QDialogButtonBox::Reset)->setText(tr("Reset")); 1044 buttonBox()->button(QDialogButtonBox::Save)->setText(tr("Apply")); 1045 buttonBox()->button(QDialogButtonBox::Close)->setText(tr("Close")); 1046 buttonBox()->button(QDialogButtonBox::Reset)->setStatusTip(tr("Reset changes in current host network details")); 1047 buttonBox()->button(QDialogButtonBox::Save)->setStatusTip(tr("Apply changes in current host network details")); 1048 buttonBox()->button(QDialogButtonBox::Close)->setStatusTip(tr("Close dialog without saving")); 1049 buttonBox()->button(QDialogButtonBox::Reset)->setShortcut(QString("Ctrl+Backspace")); 1050 buttonBox()->button(QDialogButtonBox::Save)->setShortcut(QString("Ctrl+Return")); 1051 //buttonBox()->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape); /* done in base-class */ 1052 buttonBox()->button(QDialogButtonBox::Reset)-> 1053 setToolTip(tr("Reset Changes (%1)").arg(buttonBox()->button(QDialogButtonBox::Reset)->shortcut().toString())); 1054 buttonBox()->button(QDialogButtonBox::Save)-> 1055 setToolTip(tr("Apply Changes (%1)").arg(buttonBox()->button(QDialogButtonBox::Save)->shortcut().toString())); 1056 buttonBox()->button(QDialogButtonBox::Close)-> 1057 setToolTip(tr("Close Window (%1)").arg(buttonBox()->button(QDialogButtonBox::Close)->shortcut().toString())); 1043 button(ButtonType_Reset)->setText(tr("Reset")); 1044 button(ButtonType_Apply)->setText(tr("Apply")); 1045 button(ButtonType_Close)->setText(tr("Close")); 1046 button(ButtonType_Reset)->setStatusTip(tr("Reset changes in current host network details")); 1047 button(ButtonType_Apply)->setStatusTip(tr("Apply changes in current host network details")); 1048 button(ButtonType_Close)->setStatusTip(tr("Close dialog without saving")); 1049 button(ButtonType_Reset)->setShortcut(QString("Ctrl+Backspace")); 1050 button(ButtonType_Apply)->setShortcut(QString("Ctrl+Return")); 1051 //button(ButtonType_Close)->setShortcut(Qt::Key_Escape); /* done in base-class */ 1052 button(ButtonType_Reset)->setToolTip(tr("Reset Changes (%1)").arg(button(ButtonType_Reset)->shortcut().toString())); 1053 button(ButtonType_Apply)->setToolTip(tr("Apply Changes (%1)").arg(button(ButtonType_Apply)->shortcut().toString())); 1054 button(ButtonType_Close)->setToolTip(tr("Close Window (%1)").arg(button(ButtonType_Close)->shortcut().toString())); 1058 1055 } 1059 1056 … … 1090 1087 /* Configure button-box: */ 1091 1088 connect(widget(), &UIHostNetworkManagerWidget::sigHostNetworkDetailsVisibilityChanged, 1092 button Box()->button(QDialogButtonBox::Save), &QPushButton::setVisible);1089 button(ButtonType_Apply), &QPushButton::setVisible); 1093 1090 connect(widget(), &UIHostNetworkManagerWidget::sigHostNetworkDetailsVisibilityChanged, 1094 button Box()->button(QDialogButtonBox::Reset), &QPushButton::setVisible);1091 button(ButtonType_Reset), &QPushButton::setVisible); 1095 1092 connect(widget(), &UIHostNetworkManagerWidget::sigHostNetworkDetailsDataChanged, 1096 button Box()->button(QDialogButtonBox::Save), &QPushButton::setEnabled);1093 button(ButtonType_Apply), &QPushButton::setEnabled); 1097 1094 connect(widget(), &UIHostNetworkManagerWidget::sigHostNetworkDetailsDataChanged, 1098 button Box()->button(QDialogButtonBox::Reset), &QPushButton::setEnabled);1095 button(ButtonType_Reset), &QPushButton::setEnabled); 1099 1096 connect(buttonBox(), &QIDialogButtonBox::clicked, 1100 1097 this, &UIHostNetworkManager::sltHandleButtonBoxClick);
Note:
See TracChangeset
for help on using the changeset viewer.