Changeset 66290 in vbox
- Timestamp:
- Mar 28, 2017 11:19:04 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114215
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/global
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
r66225 r66290 58 58 59 59 UIGlobalSettingsDisplay::UIGlobalSettingsDisplay() 60 : m_pCache(new UISettingsCacheGlobalDisplay) 61 { 62 /* Apply UI decorations: */ 63 Ui::UIGlobalSettingsDisplay::setupUi(this); 64 65 /* Setup widgets: */ 66 int iMinWidth = 640; 67 int iMinHeight = 480; 68 int iMaxSize = 16 * _1K; 69 m_pResolutionWidthSpin->setMinimum(iMinWidth); 70 m_pResolutionHeightSpin->setMinimum(iMinHeight); 71 m_pResolutionWidthSpin->setMaximum(iMaxSize); 72 m_pResolutionHeightSpin->setMaximum(iMaxSize); 73 74 /* Setup connections: */ 75 connect(m_pMaxResolutionCombo, SIGNAL(currentIndexChanged(int)), 76 this, SLOT(sltHandleMaximumGuestScreenSizePolicyChange())); 77 78 /* Apply language settings: */ 79 retranslateUi(); 60 : m_pCache(0) 61 { 62 /* Prepare: */ 63 prepare(); 80 64 } 81 65 82 66 UIGlobalSettingsDisplay::~UIGlobalSettingsDisplay() 83 67 { 84 /* Cleanup cache: */ 85 delete m_pCache; 86 m_pCache = 0; 68 /* Cleanup: */ 69 cleanup(); 87 70 } 88 71 … … 213 196 m_pResolutionHeightLabel->setEnabled(fComboLevelWidgetsEnabled); 214 197 m_pResolutionHeightSpin->setEnabled(fComboLevelWidgetsEnabled); 198 } 199 200 void UIGlobalSettingsDisplay::prepare() 201 { 202 /* Apply UI decorations: */ 203 Ui::UIGlobalSettingsDisplay::setupUi(this); 204 205 /* Prepare cache: */ 206 m_pCache = new UISettingsCacheGlobalDisplay; 207 AssertPtrReturnVoid(m_pCache); 208 209 /* Layout/widgets created in the .ui file. */ 210 { 211 /* Prepare widgets: */ 212 const int iMinWidth = 640; 213 const int iMinHeight = 480; 214 const int iMaxSize = 16 * _1K; 215 m_pResolutionWidthSpin->setMinimum(iMinWidth); 216 m_pResolutionHeightSpin->setMinimum(iMinHeight); 217 m_pResolutionWidthSpin->setMaximum(iMaxSize); 218 m_pResolutionHeightSpin->setMaximum(iMaxSize); 219 connect(m_pMaxResolutionCombo, SIGNAL(currentIndexChanged(int)), 220 this, SLOT(sltHandleMaximumGuestScreenSizePolicyChange())); 221 } 222 223 /* Apply language settings: */ 224 retranslateUi(); 225 } 226 227 void UIGlobalSettingsDisplay::cleanup() 228 { 229 /* Cleanup cache: */ 230 delete m_pCache; 231 m_pCache = 0; 215 232 } 216 233 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
r66225 r66290 67 67 private: 68 68 69 /** Prepares all. */ 70 void prepare(); 71 /** Cleanups all. */ 72 void cleanup(); 73 69 74 /** Reloads maximum guest-screen size policy combo-box. */ 70 75 void reloadMaximumGuestScreenSizePolicyComboBox(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r66225 r66290 172 172 UIGlobalSettingsExtension::UIGlobalSettingsExtension() 173 173 : m_pActionAdd(0), m_pActionRemove(0) 174 , m_pCache(new UISettingsCacheGlobalExtension) 175 { 176 /* Apply UI decorations: */ 177 Ui::UIGlobalSettingsExtension::setupUi(this); 178 179 /* Setup tree-widget: */ 180 //m_pPackagesTree->header()->hide(); 181 m_pPackagesTree->header()->setStretchLastSection(false); 182 #if QT_VERSION >= 0x050000 183 m_pPackagesTree->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); 184 m_pPackagesTree->header()->setSectionResizeMode(1, QHeaderView::Stretch); 185 m_pPackagesTree->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); 186 #else /* QT_VERSION < 0x050000 */ 187 m_pPackagesTree->header()->setResizeMode(0, QHeaderView::ResizeToContents); 188 m_pPackagesTree->header()->setResizeMode(1, QHeaderView::Stretch); 189 m_pPackagesTree->header()->setResizeMode(2, QHeaderView::ResizeToContents); 190 #endif /* QT_VERSION < 0x050000 */ 191 m_pPackagesTree->setContextMenuPolicy(Qt::CustomContextMenu); 192 connect(m_pPackagesTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), 193 this, SLOT(sltHandleCurrentItemChange(QTreeWidgetItem*))); 194 connect(m_pPackagesTree, SIGNAL(customContextMenuRequested(const QPoint&)), 195 this, SLOT(sltHandleContextMenuRequest(const QPoint&))); 196 197 /* Determine icon metric: */ 198 const QStyle *pStyle = QApplication::style(); 199 const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize); 200 201 /* Setup tool-bar: */ 202 m_pPackagesToolbar->setIconSize(QSize(iIconMetric, iIconMetric)); 203 m_pPackagesToolbar->setOrientation(Qt::Vertical); 204 m_pActionAdd = m_pPackagesToolbar->addAction(UIIconPool::iconSet(":/extension_pack_install_16px.png", 205 ":/extension_pack_install_disabled_16px.png"), 206 QString(), this, SLOT(sltAddPackage())); 207 m_pActionRemove = m_pPackagesToolbar->addAction(UIIconPool::iconSet(":/extension_pack_uninstall_16px.png", 208 ":/extension_pack_uninstall_disabled_16px.png"), 209 QString(), this, SLOT(sltRemovePackage())); 210 211 /* Apply language settings: */ 212 retranslateUi(); 174 , m_pCache(0) 175 { 176 /* Prepare: */ 177 prepare(); 213 178 } 214 179 215 180 UIGlobalSettingsExtension::~UIGlobalSettingsExtension() 216 181 { 217 /* Cleanup cache: */ 218 delete m_pCache; 219 m_pCache = 0; 182 /* Cleanup: */ 183 cleanup(); 220 184 } 221 185 … … 525 489 } 526 490 491 void UIGlobalSettingsExtension::prepare() 492 { 493 /* Apply UI decorations: */ 494 Ui::UIGlobalSettingsExtension::setupUi(this); 495 496 /* Prepare cache: */ 497 m_pCache = new UISettingsCacheGlobalExtension; 498 AssertPtrReturnVoid(m_pCache); 499 500 /* Layout created in the .ui file. */ 501 { 502 /* Tree-widget created in the .ui file. */ 503 { 504 /* Prepare tree-widget: */ 505 m_pPackagesTree->header()->setStretchLastSection(false); 506 m_pPackagesTree->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); 507 m_pPackagesTree->header()->setSectionResizeMode(1, QHeaderView::Stretch); 508 m_pPackagesTree->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); 509 m_pPackagesTree->setContextMenuPolicy(Qt::CustomContextMenu); 510 connect(m_pPackagesTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), 511 this, SLOT(sltHandleCurrentItemChange(QTreeWidgetItem *))); 512 connect(m_pPackagesTree, SIGNAL(customContextMenuRequested(const QPoint &)), 513 this, SLOT(sltHandleContextMenuRequest(const QPoint &))); 514 } 515 516 /* Tool-bar created in the .ui file. */ 517 { 518 /* Prepare tool-bar: */ 519 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 520 m_pPackagesToolbar->setOrientation(Qt::Vertical); 521 m_pPackagesToolbar->setIconSize(QSize(iIconMetric, iIconMetric)); 522 m_pActionAdd = m_pPackagesToolbar->addAction(UIIconPool::iconSet(":/extension_pack_install_16px.png", 523 ":/extension_pack_install_disabled_16px.png"), 524 QString(), this, SLOT(sltAddPackage())); 525 m_pActionRemove = m_pPackagesToolbar->addAction(UIIconPool::iconSet(":/extension_pack_uninstall_16px.png", 526 ":/extension_pack_uninstall_disabled_16px.png"), 527 QString(), this, SLOT(sltRemovePackage())); 528 } 529 } 530 531 /* Apply language settings: */ 532 retranslateUi(); 533 } 534 535 void UIGlobalSettingsExtension::cleanup() 536 { 537 /* Cleanup cache: */ 538 delete m_pCache; 539 m_pCache = 0; 540 } 541 527 542 void UIGlobalSettingsExtension::loadData(const CExtPack &package, UIDataSettingsGlobalExtensionItem &item) const 528 543 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h
r66225 r66290 82 82 private: 83 83 84 /** Prepares all. */ 85 void prepare(); 86 /** Cleanups all. */ 87 void cleanup(); 88 84 89 /** Uploads @a package data into passed @a item. */ 85 90 void loadData(const CExtPack &package, UIDataSettingsGlobalExtensionItem &item) const; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r66219 r66290 65 65 66 66 UIGlobalSettingsGeneral::UIGlobalSettingsGeneral() 67 : m_pCache( new UISettingsCacheGlobalGeneral)67 : m_pCache(0) 68 68 { 69 /* Apply UI decorations: */ 70 Ui::UIGlobalSettingsGeneral::setupUi(this); 71 72 /* Hide checkbox for now: */ 73 m_pLabelHostScreenSaver->hide(); 74 m_pCheckBoxHostScreenSaver->hide(); 75 76 /* Setup widgets: */ 77 m_pSelectorMachineFolder->setHomeDir(vboxGlobal().homeFolder()); 78 m_pSelectorVRDPLibName->setHomeDir(vboxGlobal().homeFolder()); 79 m_pSelectorVRDPLibName->setMode(UIFilePathSelector::Mode_File_Open); 80 81 /* Apply language settings: */ 82 retranslateUi(); 69 /* Prepare: */ 70 prepare(); 83 71 } 84 72 85 73 UIGlobalSettingsGeneral::~UIGlobalSettingsGeneral() 86 74 { 87 /* Cleanup cache: */ 88 delete m_pCache; 89 m_pCache = 0; 75 /* Cleanup: */ 76 cleanup(); 90 77 } 91 78 … … 166 153 } 167 154 155 void UIGlobalSettingsGeneral::prepare() 156 { 157 /* Apply UI decorations: */ 158 Ui::UIGlobalSettingsGeneral::setupUi(this); 159 160 /* Prepare cache: */ 161 m_pCache = new UISettingsCacheGlobalGeneral; 162 AssertPtrReturnVoid(m_pCache); 163 164 /* Layout/widgets created in the .ui file. */ 165 { 166 /* Prepare host screen-saver check-box: */ 167 // Hide checkbox for now. 168 m_pLabelHostScreenSaver->hide(); 169 m_pCheckBoxHostScreenSaver->hide(); 170 171 /* Prepare other widgets: */ 172 m_pSelectorMachineFolder->setHomeDir(vboxGlobal().homeFolder()); 173 m_pSelectorVRDPLibName->setHomeDir(vboxGlobal().homeFolder()); 174 m_pSelectorVRDPLibName->setMode(UIFilePathSelector::Mode_File_Open); 175 } 176 177 /* Apply language settings: */ 178 retranslateUi(); 179 } 180 181 void UIGlobalSettingsGeneral::cleanup() 182 { 183 /* Cleanup cache: */ 184 delete m_pCache; 185 m_pCache = 0; 186 } 187 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
r66219 r66290 62 62 private: 63 63 64 /** Prepares all. */ 65 void prepare(); 66 /** Cleanups all. */ 67 void cleanup(); 68 64 69 /** Holds the page data cache instance. */ 65 70 UISettingsCacheGlobalGeneral *m_pCache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r66225 r66290 868 868 , m_pSelectorFilterEditor(0), m_pSelectorModel(0), m_pSelectorTable(0) 869 869 , m_pMachineFilterEditor(0), m_pMachineModel(0), m_pMachineTable(0) 870 , m_pCache(new UISettingsCacheGlobalInput) 871 { 872 /* Apply UI decorations: */ 873 Ui::UIGlobalSettingsInput::setupUi(this); 874 875 /* Create tab widget: */ 876 m_pTabWidget = new QTabWidget(this); 877 m_pTabWidget->setMinimumWidth(400); 878 m_pMainLayout->addWidget(m_pTabWidget, 0, 0, 1, 2); 879 880 /* Create selector tab: */ 881 QWidget *pSelectorTab = new QWidget; 882 m_pTabWidget->insertTab(UIHotKeyTableIndex_Selector, pSelectorTab, QString()); 883 m_pSelectorFilterEditor = new QLineEdit(pSelectorTab); 884 m_pSelectorModel = new UIHotKeyTableModel(this, UIActionPoolType_Selector); 885 m_pSelectorTable = new UIHotKeyTable(pSelectorTab, m_pSelectorModel, "m_pSelectorTable"); 886 connect(m_pSelectorFilterEditor, SIGNAL(textChanged(const QString &)), 887 m_pSelectorModel, SLOT(sltHandleFilterTextChange(const QString &))); 888 QVBoxLayout *pSelectorLayout = new QVBoxLayout(pSelectorTab); 889 #ifndef VBOX_WS_WIN 890 /* On Mac OS X and X11 we can do a bit of smoothness. */ 891 pSelectorLayout->setContentsMargins(0, 0, 0, 0); 892 #endif 893 pSelectorLayout->setSpacing(1); 894 pSelectorLayout->addWidget(m_pSelectorFilterEditor); 895 pSelectorLayout->addWidget(m_pSelectorTable); 896 setTabOrder(m_pTabWidget, m_pSelectorFilterEditor); 897 setTabOrder(m_pSelectorFilterEditor, m_pSelectorTable); 898 899 /* Create machine tab: */ 900 QWidget *pMachineTab = new QWidget; 901 m_pTabWidget->insertTab(UIHotKeyTableIndex_Machine, pMachineTab, QString()); 902 m_pMachineFilterEditor = new QLineEdit(pMachineTab); 903 m_pMachineModel = new UIHotKeyTableModel(this, UIActionPoolType_Runtime); 904 m_pMachineTable = new UIHotKeyTable(pMachineTab, m_pMachineModel, "m_pMachineTable"); 905 connect(m_pMachineFilterEditor, SIGNAL(textChanged(const QString &)), 906 m_pMachineModel, SLOT(sltHandleFilterTextChange(const QString &))); 907 QVBoxLayout *pMachineLayout = new QVBoxLayout(pMachineTab); 908 #ifndef VBOX_WS_WIN 909 /* On Mac OS X and X11 we can do a bit of smoothness. */ 910 pMachineLayout->setContentsMargins(0, 0, 0, 0); 911 #endif 912 pMachineLayout->setSpacing(1); 913 pMachineLayout->addWidget(m_pMachineFilterEditor); 914 pMachineLayout->addWidget(m_pMachineTable); 915 setTabOrder(m_pSelectorTable, m_pMachineFilterEditor); 916 setTabOrder(m_pMachineFilterEditor, m_pMachineTable); 917 918 /* In the VM process we start by displaying the machine tab: */ 919 if (VBoxGlobal::instance()->isVMConsoleProcess()) 920 m_pTabWidget->setCurrentWidget(pMachineTab); 921 922 /* Prepare validation: */ 923 connect(m_pSelectorModel, SIGNAL(sigRevalidationRequired()), this, SLOT(revalidate())); 924 connect(m_pMachineModel, SIGNAL(sigRevalidationRequired()), this, SLOT(revalidate())); 925 926 /* Apply language settings: */ 927 retranslateUi(); 870 , m_pCache(0) 871 { 872 /* Prepare: */ 873 prepare(); 928 874 } 929 875 930 876 UIGlobalSettingsInput::~UIGlobalSettingsInput() 931 877 { 932 /* Cleanup cache: */ 933 delete m_pCache; 934 m_pCache = 0; 878 /* Cleanup: */ 879 cleanup(); 935 880 } 936 881 … … 1065 1010 { 1066 1011 setTabOrder(pWidget, m_pTabWidget); 1012 setTabOrder(m_pTabWidget, m_pSelectorFilterEditor); 1013 setTabOrder(m_pSelectorFilterEditor, m_pSelectorTable); 1014 setTabOrder(m_pSelectorTable, m_pMachineFilterEditor); 1015 setTabOrder(m_pMachineFilterEditor, m_pMachineTable); 1067 1016 setTabOrder(m_pMachineTable, m_pEnableAutoGrabCheckbox); 1068 1017 } … … 1082 1031 } 1083 1032 1033 void UIGlobalSettingsInput::prepare() 1034 { 1035 /* Apply UI decorations: */ 1036 Ui::UIGlobalSettingsInput::setupUi(this); 1037 1038 /* Prepare cache: */ 1039 m_pCache = new UISettingsCacheGlobalInput; 1040 AssertPtrReturnVoid(m_pCache); 1041 1042 /* Create tab-widget: */ 1043 m_pTabWidget = new QTabWidget(this); 1044 AssertPtrReturnVoid(m_pTabWidget); 1045 { 1046 /* Prepare tab-widget: */ 1047 m_pTabWidget->setMinimumWidth(400); 1048 1049 /* Create Selector UI tab: */ 1050 prepareTabSelector(); 1051 /* Create Runtime UI tab: */ 1052 prepareTabMachine(); 1053 1054 /* Add tab-widget into layout: */ 1055 m_pMainLayout->addWidget(m_pTabWidget, 0, 0, 1, 2); 1056 } 1057 1058 /* Apply language settings: */ 1059 retranslateUi(); 1060 } 1061 1062 void UIGlobalSettingsInput::prepareTabSelector() 1063 { 1064 /* Create Selector UI tab: */ 1065 QWidget *pSelectorTab = new QWidget; 1066 AssertPtrReturnVoid(pSelectorTab); 1067 { 1068 /* Create Selector UI layout: */ 1069 QVBoxLayout *pSelectorLayout = new QVBoxLayout(pSelectorTab); 1070 AssertPtrReturnVoid(pSelectorLayout); 1071 { 1072 /* Prepare Selector UI layout: */ 1073 pSelectorLayout->setSpacing(1); 1074 #ifdef VBOX_WS_MAC 1075 /* On Mac OS X and X11 we can do a bit of smoothness. */ 1076 pSelectorLayout->setContentsMargins(0, 0, 0, 0); 1077 #endif 1078 1079 /* Create Selector UI filter editor: */ 1080 m_pSelectorFilterEditor = new QLineEdit(pSelectorTab); 1081 AssertPtrReturnVoid(m_pSelectorFilterEditor); 1082 /* Create Selector UI model: */ 1083 m_pSelectorModel = new UIHotKeyTableModel(this, UIActionPoolType_Selector); 1084 AssertPtrReturnVoid(m_pSelectorModel); 1085 /* Create Selector UI table: */ 1086 m_pSelectorTable = new UIHotKeyTable(pSelectorTab, m_pSelectorModel, "m_pSelectorTable"); 1087 AssertPtrReturnVoid(m_pSelectorTable); 1088 1089 /* Prepare Selector UI filter editor: */ 1090 connect(m_pSelectorFilterEditor, SIGNAL(textChanged(const QString &)), 1091 m_pSelectorModel, SLOT(sltHandleFilterTextChange(const QString &))); 1092 /* Prepare Selector UI model: */ 1093 connect(m_pSelectorModel, SIGNAL(sigRevalidationRequired()), this, SLOT(revalidate())); 1094 1095 /* Add widgets into layout: */ 1096 pSelectorLayout->addWidget(m_pSelectorFilterEditor); 1097 pSelectorLayout->addWidget(m_pSelectorTable); 1098 } 1099 1100 /* Add tab into tab-widget: */ 1101 m_pTabWidget->insertTab(UIHotKeyTableIndex_Selector, pSelectorTab, QString()); 1102 } 1103 } 1104 1105 void UIGlobalSettingsInput::prepareTabMachine() 1106 { 1107 /* Create Runtime UI tab: */ 1108 QWidget *pMachineTab = new QWidget; 1109 AssertPtrReturnVoid(pMachineTab); 1110 { 1111 /* Create Runtime UI layout: */ 1112 QVBoxLayout *pMachineLayout = new QVBoxLayout(pMachineTab); 1113 AssertPtrReturnVoid(pMachineLayout); 1114 { 1115 /* Prepare Runtime UI layout: */ 1116 pMachineLayout->setSpacing(1); 1117 #ifdef VBOX_WS_MAC 1118 /* On Mac OS X and X11 we can do a bit of smoothness. */ 1119 pMachineLayout->setContentsMargins(0, 0, 0, 0); 1120 #endif 1121 1122 /* Create Runtime UI filter editor: */ 1123 m_pMachineFilterEditor = new QLineEdit(pMachineTab); 1124 AssertPtrReturnVoid(m_pMachineFilterEditor); 1125 /* Create Runtime UI model: */ 1126 m_pMachineModel = new UIHotKeyTableModel(this, UIActionPoolType_Runtime); 1127 AssertPtrReturnVoid(m_pMachineModel); 1128 /* Create Runtime UI table: */ 1129 m_pMachineTable = new UIHotKeyTable(pMachineTab, m_pMachineModel, "m_pMachineTable"); 1130 AssertPtrReturnVoid(m_pMachineTable); 1131 1132 /* Prepare Runtime UI filter editor: */ 1133 connect(m_pMachineFilterEditor, SIGNAL(textChanged(const QString &)), 1134 m_pMachineModel, SLOT(sltHandleFilterTextChange(const QString &))); 1135 /* Prepare Runtime UI model: */ 1136 connect(m_pMachineModel, SIGNAL(sigRevalidationRequired()), this, SLOT(revalidate())); 1137 1138 /* Add widgets into layout: */ 1139 pMachineLayout->addWidget(m_pMachineFilterEditor); 1140 pMachineLayout->addWidget(m_pMachineTable); 1141 } 1142 1143 /* Add tab into tab-widget: */ 1144 m_pTabWidget->insertTab(UIHotKeyTableIndex_Machine, pMachineTab, QString()); 1145 1146 /* In the VM process we start by displaying the Runtime UI tab: */ 1147 if (VBoxGlobal::instance()->isVMConsoleProcess()) 1148 m_pTabWidget->setCurrentWidget(pMachineTab); 1149 } 1150 } 1151 1152 void UIGlobalSettingsInput::cleanup() 1153 { 1154 /* Cleanup cache: */ 1155 delete m_pCache; 1156 m_pCache = 0; 1157 } 1158 1084 1159 # include "UIGlobalSettingsInput.moc" 1085 1160 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r66225 r66290 75 75 private: 76 76 77 /** Prepares all. */ 78 void prepare(); 79 /** Prepares Selector UI tab. */ 80 void prepareTabSelector(); 81 /** Prepares Runtime UI tab. */ 82 void prepareTabMachine(); 83 /** Cleanups all. */ 84 void cleanup(); 85 77 86 /** Holds the tab-widget instance. */ 78 87 QTabWidget *m_pTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
r66225 r66290 207 207 UIGlobalSettingsLanguage::UIGlobalSettingsLanguage() 208 208 : m_fPolished(false) 209 , m_pCache(new UISettingsCacheGlobalLanguage) 210 { 211 /* Apply UI decorations: */ 212 Ui::UIGlobalSettingsLanguage::setupUi(this); 213 214 /* Setup widgets: */ 215 m_pLanguageTree->header()->hide(); 216 m_pLanguageTree->hideColumn(1); 217 m_pLanguageTree->hideColumn(2); 218 m_pLanguageTree->hideColumn(3); 219 m_pLanguageTree->setMinimumHeight(150); 220 m_pLanguageInfo->setWordWrapMode(QTextOption::WordWrap); 221 m_pLanguageInfo->setMinimumHeight(QFontMetrics(m_pLanguageInfo->font(), m_pLanguageInfo).height() * 5); 222 223 /* Setup connections: */ 224 connect(m_pLanguageTree, SIGNAL(painted(QTreeWidgetItem*, QPainter*)), 225 this, SLOT(sltHandleItemPainting(QTreeWidgetItem*, QPainter*))); 226 connect(m_pLanguageTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), 227 this, SLOT(sltHandleCurrentItemChange(QTreeWidgetItem*))); 228 229 /* Apply language settings: */ 230 retranslateUi(); 209 , m_pCache(0) 210 { 211 /* Prepare: */ 212 prepare(); 231 213 } 232 214 233 215 UIGlobalSettingsLanguage::~UIGlobalSettingsLanguage() 234 216 { 235 /* Cleanup cache: */ 236 delete m_pCache; 237 m_pCache = 0; 217 /* Cleanup: */ 218 cleanup(); 238 219 } 239 220 … … 363 344 } 364 345 346 void UIGlobalSettingsLanguage::prepare() 347 { 348 /* Apply UI decorations: */ 349 Ui::UIGlobalSettingsLanguage::setupUi(this); 350 351 /* Prepare cache: */ 352 m_pCache = new UISettingsCacheGlobalLanguage; 353 354 /* Layout created in the .ui file. */ 355 { 356 /* Tree-widget created in the .ui file. */ 357 { 358 /* Prepare tree-widget: */ 359 m_pLanguageTree->header()->hide(); 360 m_pLanguageTree->hideColumn(1); 361 m_pLanguageTree->hideColumn(2); 362 m_pLanguageTree->hideColumn(3); 363 m_pLanguageTree->setMinimumHeight(150); 364 connect(m_pLanguageTree, SIGNAL(painted(QTreeWidgetItem *, QPainter *)), 365 this, SLOT(sltHandleItemPainting(QTreeWidgetItem *, QPainter *))); 366 connect(m_pLanguageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), 367 this, SLOT(sltHandleCurrentItemChange(QTreeWidgetItem *))); 368 } 369 370 /* Rich-text label created in the .ui file. */ 371 { 372 /* Prepare rich-text label: */ 373 m_pLanguageInfo->setWordWrapMode(QTextOption::WordWrap); 374 m_pLanguageInfo->setMinimumHeight(QFontMetrics(m_pLanguageInfo->font(), m_pLanguageInfo).height() * 5); 375 } 376 } 377 378 /* Apply language settings: */ 379 retranslateUi(); 380 } 381 382 void UIGlobalSettingsLanguage::cleanup() 383 { 384 /* Cleanup cache: */ 385 delete m_pCache; 386 m_pCache = 0; 387 } 388 365 389 void UIGlobalSettingsLanguage::reloadLanguageTree(const QString &strLanguageId) 366 390 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h
r66225 r66290 75 75 private: 76 76 77 /** Prepares all. */ 78 void prepare(); 79 /** Cleanups all. */ 80 void cleanup(); 81 77 82 /** Reloads language list, choosing item with @a strLanguageId as current. */ 78 83 void reloadLanguageTree(const QString &strLanguageId); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r66223 r66290 423 423 : m_pActionAddNetworkNAT(0), m_pActionEditNetworkNAT(0), m_pActionRemoveNetworkNAT(0) 424 424 , m_pActionAddNetworkHost(0), m_pActionEditNetworkHost(0), m_pActionRemoveNetworkHost(0) 425 , m_pCache(new UISettingsCacheGlobalNetwork) 426 { 427 /* Apply UI decorations: */ 428 Ui::UIGlobalSettingsNetwork::setupUi(this); 429 430 /* Prepare NAT network tree-widget: */ 431 { 432 m_pTreeNetworkNAT->setColumnCount(2); 433 m_pTreeNetworkNAT->header()->setStretchLastSection(false); 434 #if QT_VERSION >= 0x050000 435 m_pTreeNetworkNAT->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); 436 m_pTreeNetworkNAT->header()->setSectionResizeMode(1, QHeaderView::Stretch); 437 #else /* QT_VERSION < 0x050000 */ 438 m_pTreeNetworkNAT->header()->setResizeMode(0, QHeaderView::ResizeToContents); 439 m_pTreeNetworkNAT->header()->setResizeMode(1, QHeaderView::Stretch); 440 #endif /* QT_VERSION < 0x050000 */ 441 m_pTreeNetworkNAT->setContextMenuPolicy(Qt::CustomContextMenu); 442 connect(m_pTreeNetworkNAT, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), 443 this, SLOT(sltHandleCurrentItemChangeNetworkNAT())); 444 connect(m_pTreeNetworkNAT, SIGNAL(customContextMenuRequested(const QPoint&)), 445 this, SLOT(sltHandleContextMenuRequestNetworkNAT(const QPoint&))); 446 connect(m_pTreeNetworkNAT, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), 447 this, SLOT(sltEditNetworkNAT())); 448 connect(m_pTreeNetworkNAT, SIGNAL(itemChanged(QTreeWidgetItem*, int)), 449 this, SLOT(sltHandleItemChangeNetworkNAT(QTreeWidgetItem*))); 450 } 451 /* Prepare Host network tree-widget: */ 452 { 453 m_pTreeNetworkHost->header()->hide(); 454 m_pTreeNetworkHost->setContextMenuPolicy(Qt::CustomContextMenu); 455 connect(m_pTreeNetworkHost, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), 456 this, SLOT(sltHandleCurrentItemChangeNetworkHost())); 457 connect(m_pTreeNetworkHost, SIGNAL(customContextMenuRequested(const QPoint&)), 458 this, SLOT(sltHandleContextMenuRequestNetworkHost(const QPoint&))); 459 connect(m_pTreeNetworkHost, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), 460 this, SLOT(sltEditNetworkHost())); 461 } 462 463 /* Prepare actions: */ 464 m_pActionAddNetworkNAT = new QAction(m_pTreeNetworkNAT); 465 { 466 m_pActionAddNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut); 467 m_pActionAddNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N")); 468 m_pActionAddNetworkNAT->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png", 469 ":/add_host_iface_disabled_16px.png")); 470 connect(m_pActionAddNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltAddNetworkNAT())); 471 } 472 m_pActionRemoveNetworkNAT = new QAction(m_pTreeNetworkNAT); 473 { 474 m_pActionRemoveNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut); 475 m_pActionRemoveNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R")); 476 m_pActionRemoveNetworkNAT->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png", 477 ":/remove_host_iface_disabled_16px.png")); 478 connect(m_pActionRemoveNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltRemoveNetworkNAT())); 479 } 480 m_pActionEditNetworkNAT = new QAction(m_pTreeNetworkNAT); 481 { 482 m_pActionEditNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut); 483 m_pActionEditNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2")); 484 m_pActionEditNetworkNAT->setIcon(UIIconPool::iconSet(":/guesttools_16px.png", 485 ":/guesttools_disabled_16px.png")); 486 connect(m_pActionEditNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltEditNetworkNAT())); 487 } 488 m_pActionAddNetworkHost = new QAction(m_pTreeNetworkHost); 489 { 490 m_pActionAddNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut); 491 m_pActionAddNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N")); 492 m_pActionAddNetworkHost->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png", 493 ":/add_host_iface_disabled_16px.png")); 494 connect(m_pActionAddNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltAddNetworkHost())); 495 } 496 m_pActionRemoveNetworkHost = new QAction(m_pTreeNetworkHost); 497 { 498 m_pActionRemoveNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut); 499 m_pActionRemoveNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R")); 500 m_pActionRemoveNetworkHost->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png", 501 ":/remove_host_iface_disabled_16px.png")); 502 connect(m_pActionRemoveNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltRemoveNetworkHost())); 503 } 504 m_pActionEditNetworkHost = new QAction(m_pTreeNetworkHost); 505 { 506 m_pActionEditNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut); 507 m_pActionEditNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2")); 508 m_pActionEditNetworkHost->setIcon(UIIconPool::iconSet(":/guesttools_16px.png", 509 ":/guesttools_disabled_16px.png")); 510 connect(m_pActionEditNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltEditNetworkHost())); 511 } 512 513 /* Determine icon metric: */ 514 const QStyle *pStyle = QApplication::style(); 515 const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize); 516 517 /* Prepare NAT network toolbar: */ 518 { 519 m_pToolbarNetworkNAT->setIconSize(QSize(iIconMetric, iIconMetric)); 520 m_pToolbarNetworkNAT->setOrientation(Qt::Vertical); 521 m_pToolbarNetworkNAT->addAction(m_pActionAddNetworkNAT); 522 m_pToolbarNetworkNAT->addAction(m_pActionRemoveNetworkNAT); 523 m_pToolbarNetworkNAT->addAction(m_pActionEditNetworkNAT); 524 } 525 /* Prepare Host network toolbar: */ 526 { 527 m_pToolbarNetworkHost->setIconSize(QSize(iIconMetric, iIconMetric)); 528 m_pToolbarNetworkHost->setOrientation(Qt::Vertical); 529 m_pToolbarNetworkHost->addAction(m_pActionAddNetworkHost); 530 m_pToolbarNetworkHost->addAction(m_pActionRemoveNetworkHost); 531 m_pToolbarNetworkHost->addAction(m_pActionEditNetworkHost); 532 } 533 534 #ifdef VBOX_WS_MAC 535 /* On macOS we can do a bit of smoothness: */ 536 m_pLayoutNAT->setContentsMargins(0, 0, 0, 0); 537 m_pLayoutHostOnly->setContentsMargins(0, 0, 0, 0); 538 #endif 539 540 /* Apply language settings: */ 541 retranslateUi(); 425 , m_pCache(0) 426 { 427 /* Prepare: */ 428 prepare(); 542 429 } 543 430 544 431 UIGlobalSettingsNetwork::~UIGlobalSettingsNetwork() 545 432 { 546 /* Cleanup cache: */ 547 delete m_pCache; 548 m_pCache = 0; 433 /* Cleanup: */ 434 cleanup(); 549 435 } 550 436 … … 1004 890 /* And show it: */ 1005 891 menu.exec(m_pTreeNetworkHost->mapToGlobal(pos)); 892 } 893 894 void UIGlobalSettingsNetwork::prepare() 895 { 896 /* Apply UI decorations: */ 897 Ui::UIGlobalSettingsNetwork::setupUi(this); 898 899 /* Prepare cache: */ 900 m_pCache = new UISettingsCacheGlobalNetwork; 901 AssertPtrReturnVoid(m_pCache); 902 903 /* Tree-widget created in the .ui file. */ 904 { 905 /* Prepare NAT Network tab: */ 906 prepareTabNAT(); 907 /* Prepare Host-only Network tab: */ 908 prepareTabHost(); 909 } 910 911 /* Apply language settings: */ 912 retranslateUi(); 913 } 914 915 void UIGlobalSettingsNetwork::prepareTabNAT() 916 { 917 /* Tab and it's layout created in the .ui file. */ 918 { 919 #ifdef VBOX_WS_MAC 920 /* On macOS we can do a bit of smoothness: */ 921 m_pLayoutNAT->setContentsMargins(0, 0, 0, 0); 922 #endif 923 924 /* NAT Network tree-widget created in the .ui file. */ 925 { 926 /* Prepare tree-widget: */ 927 m_pTreeNetworkNAT->setColumnCount(2); 928 m_pTreeNetworkNAT->header()->setStretchLastSection(false); 929 m_pTreeNetworkNAT->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); 930 m_pTreeNetworkNAT->header()->setSectionResizeMode(1, QHeaderView::Stretch); 931 m_pTreeNetworkNAT->setContextMenuPolicy(Qt::CustomContextMenu); 932 connect(m_pTreeNetworkNAT, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), 933 this, SLOT(sltHandleCurrentItemChangeNetworkNAT())); 934 connect(m_pTreeNetworkNAT, SIGNAL(customContextMenuRequested(const QPoint &)), 935 this, SLOT(sltHandleContextMenuRequestNetworkNAT(const QPoint &))); 936 connect(m_pTreeNetworkNAT, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), 937 this, SLOT(sltEditNetworkNAT())); 938 connect(m_pTreeNetworkNAT, SIGNAL(itemChanged(QTreeWidgetItem *, int)), 939 this, SLOT(sltHandleItemChangeNetworkNAT(QTreeWidgetItem *))); 940 } 941 942 /* NAT Network toolbar created in the .ui file. */ 943 { 944 /* Determine icon metric: */ 945 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 946 947 /* Prepare toolbar: */ 948 m_pToolbarNetworkNAT->setIconSize(QSize(iIconMetric, iIconMetric)); 949 m_pToolbarNetworkNAT->setOrientation(Qt::Vertical); 950 951 /* Create Add NAT Network action: */ 952 m_pActionAddNetworkNAT = new QAction(m_pTreeNetworkNAT); 953 AssertPtrReturnVoid(m_pActionAddNetworkNAT); 954 { 955 /* Prepare action: */ 956 m_pActionAddNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut); 957 m_pActionAddNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N")); 958 m_pActionAddNetworkNAT->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png", 959 ":/add_host_iface_disabled_16px.png")); 960 connect(m_pActionAddNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltAddNetworkNAT())); 961 962 /* Add action to toolbar: */ 963 m_pToolbarNetworkNAT->addAction(m_pActionAddNetworkNAT); 964 } 965 966 /* Create Edit NAT Network action: */ 967 m_pActionEditNetworkNAT = new QAction(m_pTreeNetworkNAT); 968 AssertPtrReturnVoid(m_pActionEditNetworkNAT); 969 { 970 /* Prepare action: */ 971 m_pActionEditNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut); 972 m_pActionEditNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2")); 973 m_pActionEditNetworkNAT->setIcon(UIIconPool::iconSet(":/guesttools_16px.png", 974 ":/guesttools_disabled_16px.png")); 975 connect(m_pActionEditNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltEditNetworkNAT())); 976 977 /* Add action to toolbar: */ 978 m_pToolbarNetworkNAT->addAction(m_pActionEditNetworkNAT); 979 } 980 981 /* Create Remove NAT Network action: */ 982 m_pActionRemoveNetworkNAT = new QAction(m_pTreeNetworkNAT); 983 AssertPtrReturnVoid(m_pActionRemoveNetworkNAT); 984 { 985 /* Prepare action: */ 986 m_pActionRemoveNetworkNAT->setShortcutContext(Qt::WidgetWithChildrenShortcut); 987 m_pActionRemoveNetworkNAT->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R")); 988 m_pActionRemoveNetworkNAT->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png", 989 ":/remove_host_iface_disabled_16px.png")); 990 connect(m_pActionRemoveNetworkNAT, SIGNAL(triggered(bool)), this, SLOT(sltRemoveNetworkNAT())); 991 992 /* Add action to toolbar: */ 993 m_pToolbarNetworkNAT->addAction(m_pActionRemoveNetworkNAT); 994 } 995 } 996 } 997 } 998 999 void UIGlobalSettingsNetwork::prepareTabHost() 1000 { 1001 /* Tab and it's layout created in the .ui file. */ 1002 { 1003 #ifdef VBOX_WS_MAC 1004 /* On macOS we can do a bit of smoothness: */ 1005 m_pLayoutHostOnly->setContentsMargins(0, 0, 0, 0); 1006 #endif 1007 1008 /* Host-only Network tree-widget created in the .ui file. */ 1009 { 1010 /* Prepare tree-widget: */ 1011 m_pTreeNetworkHost->header()->hide(); 1012 m_pTreeNetworkHost->setContextMenuPolicy(Qt::CustomContextMenu); 1013 connect(m_pTreeNetworkHost, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), 1014 this, SLOT(sltHandleCurrentItemChangeNetworkHost())); 1015 connect(m_pTreeNetworkHost, SIGNAL(customContextMenuRequested(const QPoint &)), 1016 this, SLOT(sltHandleContextMenuRequestNetworkHost(const QPoint &))); 1017 connect(m_pTreeNetworkHost, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), 1018 this, SLOT(sltEditNetworkHost())); 1019 } 1020 1021 /* Host-only Network toolbar created in the .ui file. */ 1022 { 1023 /* Determine icon metric: */ 1024 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 1025 1026 /* Prepare toolbar: */ 1027 m_pToolbarNetworkHost->setIconSize(QSize(iIconMetric, iIconMetric)); 1028 m_pToolbarNetworkHost->setOrientation(Qt::Vertical); 1029 1030 /* Create Add Host-only Network action: */ 1031 m_pActionAddNetworkHost = new QAction(m_pTreeNetworkHost); 1032 AssertPtrReturnVoid(m_pActionAddNetworkHost); 1033 { 1034 /* Prepare action: */ 1035 m_pActionAddNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut); 1036 m_pActionAddNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N")); 1037 m_pActionAddNetworkHost->setIcon(UIIconPool::iconSet(":/add_host_iface_16px.png", 1038 ":/add_host_iface_disabled_16px.png")); 1039 connect(m_pActionAddNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltAddNetworkHost())); 1040 1041 /* Add action to toolbar: */ 1042 m_pToolbarNetworkHost->addAction(m_pActionAddNetworkHost); 1043 } 1044 1045 /* Create Edit Host-only Network action: */ 1046 m_pActionEditNetworkHost = new QAction(m_pTreeNetworkHost); 1047 AssertPtrReturnVoid(m_pActionEditNetworkHost); 1048 { 1049 /* Prepare action: */ 1050 m_pActionEditNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut); 1051 m_pActionEditNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2")); 1052 m_pActionEditNetworkHost->setIcon(UIIconPool::iconSet(":/guesttools_16px.png", 1053 ":/guesttools_disabled_16px.png")); 1054 connect(m_pActionEditNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltEditNetworkHost())); 1055 1056 /* Add action to toolbar: */ 1057 m_pToolbarNetworkHost->addAction(m_pActionEditNetworkHost); 1058 } 1059 1060 /* Create Remove Host-only Network action: */ 1061 m_pActionRemoveNetworkHost = new QAction(m_pTreeNetworkHost); 1062 AssertPtrReturnVoid(m_pActionRemoveNetworkHost); 1063 { 1064 /* Prepare action: */ 1065 m_pActionRemoveNetworkHost->setShortcutContext(Qt::WidgetWithChildrenShortcut); 1066 m_pActionRemoveNetworkHost->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R")); 1067 m_pActionRemoveNetworkHost->setIcon(UIIconPool::iconSet(":/remove_host_iface_16px.png", 1068 ":/remove_host_iface_disabled_16px.png")); 1069 connect(m_pActionRemoveNetworkHost, SIGNAL(triggered(bool)), this, SLOT(sltRemoveNetworkHost())); 1070 1071 /* Add action to toolbar: */ 1072 m_pToolbarNetworkHost->addAction(m_pActionRemoveNetworkHost); 1073 } 1074 } 1075 } 1076 } 1077 1078 void UIGlobalSettingsNetwork::cleanup() 1079 { 1080 /* Cleanup cache: */ 1081 delete m_pCache; 1082 m_pCache = 0; 1006 1083 } 1007 1084 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
r66225 r66290 98 98 private: 99 99 100 /** Prepares all. */ 101 void prepare(); 102 /** Prepares NAT Network tab. */ 103 void prepareTabNAT(); 104 /** Prepares Host Network tab. */ 105 void prepareTabHost(); 106 /** Cleanups all. */ 107 void cleanup(); 108 100 109 /** Uploads NAT @a network data into passed @a data storage unit. */ 101 110 void loadDataNetworkNAT(const CNATNetwork &network, UIDataSettingsGlobalNetworkNAT &data); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r66223 r66290 66 66 67 67 UIGlobalSettingsProxy::UIGlobalSettingsProxy() 68 : m_pCache(new UISettingsCacheGlobalProxy) 69 { 70 /* Apply UI decorations: */ 71 Ui::UIGlobalSettingsProxy::setupUi(this); 72 73 /* Setup widgets: */ 74 QButtonGroup *pButtonGroup = new QButtonGroup(this); 75 pButtonGroup->addButton(m_pRadioProxyAuto); 76 pButtonGroup->addButton(m_pRadioProxyDisabled); 77 pButtonGroup->addButton(m_pRadioProxyEnabled); 78 m_pPortEditor->setFixedWidthByText(QString().fill('0', 6)); 79 m_pHostEditor->setValidator(new QRegExpValidator(QRegExp("\\S+"), m_pHostEditor)); 80 m_pPortEditor->setValidator(new QRegExpValidator(QRegExp("\\d+"), m_pPortEditor)); 81 82 /* Setup connections: */ 83 connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(sltHandleProxyToggle())); 84 connect(m_pHostEditor, SIGNAL(textEdited(const QString&)), this, SLOT(revalidate())); 85 connect(m_pPortEditor, SIGNAL(textEdited(const QString&)), this, SLOT(revalidate())); 86 87 /* Apply language settings: */ 88 retranslateUi(); 68 : m_pCache(0) 69 { 70 /* Prepare: */ 71 prepare(); 89 72 } 90 73 91 74 UIGlobalSettingsProxy::~UIGlobalSettingsProxy() 92 75 { 93 /* Cleanup cache: */ 94 delete m_pCache; 95 m_pCache = 0; 76 /* Cleanup: */ 77 cleanup(); 96 78 } 97 79 … … 224 206 } 225 207 208 void UIGlobalSettingsProxy::prepare() 209 { 210 /* Apply UI decorations: */ 211 Ui::UIGlobalSettingsProxy::setupUi(this); 212 213 /* Prepare cache: */ 214 m_pCache = new UISettingsCacheGlobalProxy; 215 AssertPtrReturnVoid(m_pCache); 216 217 /* Layout created in the .ui file. */ 218 { 219 /* Create button-group: */ 220 QButtonGroup *pButtonGroup = new QButtonGroup(this); 221 AssertPtrReturnVoid(pButtonGroup); 222 { 223 /* Prepare button-group: */ 224 pButtonGroup->addButton(m_pRadioProxyAuto); 225 pButtonGroup->addButton(m_pRadioProxyDisabled); 226 pButtonGroup->addButton(m_pRadioProxyEnabled); 227 connect(pButtonGroup, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(sltHandleProxyToggle())); 228 } 229 230 /* Host editor created in the .ui file. */ 231 { 232 /* Prepare editor: */ 233 m_pHostEditor->setValidator(new QRegExpValidator(QRegExp("\\S+"), m_pHostEditor)); 234 connect(m_pHostEditor, SIGNAL(textEdited(const QString &)), this, SLOT(revalidate())); 235 } 236 237 /* Port editor created in the .ui file. */ 238 { 239 /* Prepare editor: */ 240 m_pPortEditor->setFixedWidthByText(QString().fill('0', 6)); 241 m_pPortEditor->setValidator(new QRegExpValidator(QRegExp("\\d+"), m_pPortEditor)); 242 connect(m_pPortEditor, SIGNAL(textEdited(const QString &)), this, SLOT(revalidate())); 243 } 244 } 245 246 /* Apply language settings: */ 247 retranslateUi(); 248 } 249 250 void UIGlobalSettingsProxy::cleanup() 251 { 252 /* Cleanup cache: */ 253 delete m_pCache; 254 m_pCache = 0; 255 } 256 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
r66225 r66290 71 71 private: 72 72 73 /** Prepares all. */ 74 void prepare(); 75 /** Cleanups all. */ 76 void cleanup(); 77 73 78 /** Holds the page data cache instance. */ 74 79 UISettingsCacheGlobalProxy *m_pCache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
r66223 r66290 68 68 UIGlobalSettingsUpdate::UIGlobalSettingsUpdate() 69 69 : m_pLastChosenRadio(0) 70 , m_pCache(new UISettingsCacheGlobalUpdate) 71 { 72 /* Apply UI decorations: */ 73 Ui::UIGlobalSettingsUpdate::setupUi(this); 74 75 /* Setup connections: */ 76 connect(m_pCheckBoxUpdate, SIGNAL(toggled(bool)), this, SLOT(sltHandleUpdateToggle(bool))); 77 connect(m_pComboBoxUpdatePeriod, SIGNAL(activated(int)), this, SLOT(sltHandleUpdatePeriodChange())); 78 79 /* Apply language settings: */ 80 retranslateUi(); 70 , m_pCache(0) 71 { 72 /* Prepare: */ 73 prepare(); 81 74 } 82 75 83 76 UIGlobalSettingsUpdate::~UIGlobalSettingsUpdate() 84 77 { 85 /* Cleanup cache: */ 86 delete m_pCache; 87 m_pCache = 0; 78 /* Cleanup: */ 79 cleanup(); 88 80 } 89 81 … … 213 205 } 214 206 207 void UIGlobalSettingsUpdate::prepare() 208 { 209 /* Apply UI decorations: */ 210 Ui::UIGlobalSettingsUpdate::setupUi(this); 211 212 /* Prepare cache: */ 213 m_pCache = new UISettingsCacheGlobalUpdate; 214 AssertPtrReturnVoid(m_pCache); 215 216 /* Layout/widgets created in the .ui file. */ 217 { 218 /* Prepare widgets: */ 219 connect(m_pCheckBoxUpdate, SIGNAL(toggled(bool)), this, SLOT(sltHandleUpdateToggle(bool))); 220 connect(m_pComboBoxUpdatePeriod, SIGNAL(activated(int)), this, SLOT(sltHandleUpdatePeriodChange())); 221 } 222 223 /* Apply language settings: */ 224 retranslateUi(); 225 } 226 227 void UIGlobalSettingsUpdate::cleanup() 228 { 229 /* Cleanup cache: */ 230 delete m_pCache; 231 m_pCache = 0; 232 } 233 215 234 VBoxUpdateData::PeriodType UIGlobalSettingsUpdate::periodType() const 216 235 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
r66225 r66290 73 73 private: 74 74 75 /** Prepares all. */ 76 void prepare(); 77 /** Cleanups all. */ 78 void cleanup(); 79 75 80 /** Returns period type. */ 76 81 VBoxUpdateData::PeriodType periodType() const;
Note:
See TracChangeset
for help on using the changeset viewer.