Changeset 80353 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 20, 2019 9:48:48 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationConfiguration.cpp
r80352 r80353 102 102 103 103 int iMaxColumn1Length = 0; 104 int iTableRow = 0;105 104 106 105 /* General section: */ 107 insertTitleRow( iTableRow++,m_strGeneralTitle, UIIconPool::iconSet(":/machine_16px.png"), fontMetrics);106 insertTitleRow(m_strGeneralTitle, UIIconPool::iconSet(":/machine_16px.png"), fontMetrics); 108 107 insertInfoRows(UIDetailsGenerator::generateMachineInformationGeneral(m_machine, 109 108 UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default), 110 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);109 fontMetrics, textDocument, iMaxColumn1Length); 111 110 112 111 /* System section: */ 113 insertTitleRow( iTableRow++,m_strSystemTitle, UIIconPool::iconSet(":/chipset_16px.png"), fontMetrics);112 insertTitleRow(m_strSystemTitle, UIIconPool::iconSet(":/chipset_16px.png"), fontMetrics); 114 113 insertInfoRows(UIDetailsGenerator::generateMachineInformationSystem(m_machine, 115 114 UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default), 116 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);115 fontMetrics, textDocument, iMaxColumn1Length); 117 116 118 117 /* Display section: */ 119 insertTitleRow( iTableRow++,m_strDisplayTitle, UIIconPool::iconSet(":/vrdp_16px.png"), fontMetrics);118 insertTitleRow(m_strDisplayTitle, UIIconPool::iconSet(":/vrdp_16px.png"), fontMetrics); 120 119 insertInfoRows(UIDetailsGenerator::generateMachineInformationDisplay(m_machine, 121 120 UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default), 122 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);121 fontMetrics, textDocument, iMaxColumn1Length); 123 122 124 123 /* Storage section: */ 125 insertTitleRow( iTableRow++,m_strStorageTitle, UIIconPool::iconSet(":/hd_16px.png"), fontMetrics);124 insertTitleRow(m_strStorageTitle, UIIconPool::iconSet(":/hd_16px.png"), fontMetrics); 126 125 insertInfoRows(UIDetailsGenerator::generateMachineInformationStorage(m_machine, 127 126 UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default), 128 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);127 fontMetrics, textDocument, iMaxColumn1Length); 129 128 130 129 /* Audio section: */ 131 insertTitleRow( iTableRow++,m_strAudioTitle, UIIconPool::iconSet(":/sound_16px.png"), fontMetrics);130 insertTitleRow(m_strAudioTitle, UIIconPool::iconSet(":/sound_16px.png"), fontMetrics); 132 131 insertInfoRows(UIDetailsGenerator::generateMachineInformationAudio(m_machine, 133 132 UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default), 134 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);133 fontMetrics, textDocument, iMaxColumn1Length); 135 134 136 135 /* Network section: */ 137 insertTitleRow( iTableRow++,m_strNetworkTitle, UIIconPool::iconSet(":/nw_16px.png"), fontMetrics);136 insertTitleRow(m_strNetworkTitle, UIIconPool::iconSet(":/nw_16px.png"), fontMetrics); 138 137 insertInfoRows(UIDetailsGenerator::generateMachineInformationNetwork(m_machine, 139 138 UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default), 140 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);139 fontMetrics, textDocument, iMaxColumn1Length); 141 140 142 141 /* Serial port section: */ 143 insertTitleRow( iTableRow++,m_strSerialPortsTitle, UIIconPool::iconSet(":/serial_port_16px.png"), fontMetrics);142 insertTitleRow(m_strSerialPortsTitle, UIIconPool::iconSet(":/serial_port_16px.png"), fontMetrics); 144 143 insertInfoRows(UIDetailsGenerator::generateMachineInformationSerial(m_machine, 145 144 UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default), 146 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);145 fontMetrics, textDocument, iMaxColumn1Length); 147 146 148 147 /* USB section: */ 149 insertTitleRow( iTableRow++,m_strUSBTitle, UIIconPool::iconSet(":/usb_16px.png"), fontMetrics);148 insertTitleRow(m_strUSBTitle, UIIconPool::iconSet(":/usb_16px.png"), fontMetrics); 150 149 insertInfoRows(UIDetailsGenerator::generateMachineInformationUSB(m_machine, 151 150 UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default), 152 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);151 fontMetrics, textDocument, iMaxColumn1Length); 153 152 154 153 /* Share folders section: */ 155 insertTitleRow( iTableRow++,m_strSharedFoldersTitle, UIIconPool::iconSet(":/sf_16px.png"), fontMetrics);154 insertTitleRow(m_strSharedFoldersTitle, UIIconPool::iconSet(":/sf_16px.png"), fontMetrics); 156 155 insertInfoRows(UIDetailsGenerator::generateMachineInformationSharedFolders(m_machine, 157 156 UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default), 158 fontMetrics, textDocument, i TableRow, iMaxColumn1Length);157 fontMetrics, textDocument, iMaxColumn1Length); 159 158 160 159 m_pTableWidget->resizeColumnToContents(0); 160 /* Resize the column 1 a bit larger than the max string if contains: */ 161 161 m_pTableWidget->setColumnWidth(1, 1.5 * iMaxColumn1Length); 162 162 m_pTableWidget->resizeColumnToContents(2); … … 164 164 165 165 void UIInformationConfiguration::insertInfoRows(const UITextTable &table, const QFontMetrics &fontMetrics, 166 QTextDocument &textDocument, int &i Row, int &iMaxColumn1Length)166 QTextDocument &textDocument, int &iMaxColumn1Length) 167 167 { 168 168 foreach (const UITextTableLine &line, table) 169 169 { 170 170 textDocument.setHtml(line.string2()); 171 insertInfoRow( iRow++,line.string1(), textDocument.toPlainText(), fontMetrics, iMaxColumn1Length);171 insertInfoRow(line.string1(), textDocument.toPlainText(), fontMetrics, iMaxColumn1Length); 172 172 } 173 173 } 174 174 175 void UIInformationConfiguration::insertTitleRow(int iRow, const QString &strTitle, const QIcon &icon, const QFontMetrics &fontMetrics) 176 { 177 m_pTableWidget->insertRow(m_pTableWidget->rowCount()); 175 void UIInformationConfiguration::insertTitleRow(const QString &strTitle, const QIcon &icon, const QFontMetrics &fontMetrics) 176 { 177 int iRow = m_pTableWidget->rowCount(); 178 m_pTableWidget->insertRow(iRow); 178 179 QSize iconSize; 179 180 icon.actualSize(iconSize); 180 m_pTableWidget->setRowHeight( m_pTableWidget->rowCount() -1,181 m_pTableWidget->setRowHeight(iRow, 181 182 qMax(fontMetrics.height() + m_iRowTopMargin + m_iRowBottomMargin, iconSize.height())); 182 183 QTableWidgetItem *pIconItem = new QTableWidgetItem(icon, ""); … … 186 187 font.setBold(true); 187 188 pTitleItem->setFont(font); 189 188 190 m_pTableWidget->setItem(iRow, 1, pTitleItem); 189 191 m_tableItems << pIconItem; … … 191 193 } 192 194 193 void UIInformationConfiguration::insertInfoRow( int iRow,const QString strText1, const QString &strText2,195 void UIInformationConfiguration::insertInfoRow(const QString strText1, const QString &strText2, 194 196 const QFontMetrics &fontMetrics, int &iMaxColumn1Length) 195 197 { 196 m_pTableWidget->insertRow(m_pTableWidget->rowCount()); 197 m_pTableWidget->setRowHeight(m_pTableWidget->rowCount() -1, fontMetrics.height() + m_iRowTopMargin + m_iRowBottomMargin); 198 int iRow = m_pTableWidget->rowCount(); 199 m_pTableWidget->insertRow(iRow); 200 m_pTableWidget->setRowHeight(iRow, fontMetrics.height() + m_iRowTopMargin + m_iRowBottomMargin); 198 201 iMaxColumn1Length = qMax(iMaxColumn1Length, fontMetrics.width(strText1)); 199 202 QTableWidgetItem *pCol1 = new QTableWidgetItem(strText1); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationConfiguration.h
r80352 r80353 67 67 68 68 void updateTable(); 69 void insertTitleRow( int iRow,const QString &strTitle, const QIcon &icon, const QFontMetrics &fontMetrics);69 void insertTitleRow(const QString &strTitle, const QIcon &icon, const QFontMetrics &fontMetrics); 70 70 void insertInfoRows(const UITextTable &table, const QFontMetrics &fontMetrics, 71 QTextDocument &textDocument, int &i Row, int &iMaxColumn1Length);72 void insertInfoRow( int iRow,const QString strText1, const QString &strText2,71 QTextDocument &textDocument, int &iMaxColumn1Length); 72 void insertInfoRow(const QString strText1, const QString &strText2, 73 73 const QFontMetrics &fontMetrics, int &iMaxColumn1Length); 74 74
Note:
See TracChangeset
for help on using the changeset viewer.