Changeset 2671 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 16, 2007 2:15:41 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/COMDefs.h
r933 r2671 32 32 #include <quuid.h> 33 33 34 #include <iprt/memory> // for auto_copy_ptr 35 34 36 /* 35 37 * common COM / XPCOM includes and defines … … 171 173 QString text() const { return mText; } 172 174 175 const COMErrorInfo *next() const { return mNext.get(); } 176 173 177 QString interfaceName() const { return mInterfaceName; } 174 178 QUuid calleeIID() const { return mCalleeIID; } … … 190 194 QString mComponent; 191 195 QString mText; 196 197 cppx::auto_copy_ptr <COMErrorInfo> mNext; 192 198 193 199 QString mInterfaceName; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r2044 r2671 216 216 const QString &errorMsg); 217 217 218 static QString formatErrorInfo (const COMErrorInfo &info, 219 HRESULT wrapperRC = S_OK); 220 static QString formatErrorInfo (const CVirtualBoxErrorInfo &info) { 221 return formatErrorInfo (COMErrorInfo (info)); 222 } 223 static QString formatErrorInfo (const COMBase &wrapper) { 224 Assert (FAILED (wrapper.lastRC())); 225 return formatErrorInfo (wrapper.errorInfo(), wrapper.lastRC()); 226 } 227 static QString formatErrorInfo (const COMResult &rc) { 228 Assert (FAILED (rc.rc())); 229 return formatErrorInfo (rc.errorInfo(), rc.rc()); 218 static QString formatErrorInfo (const COMErrorInfo &aInfo, 219 HRESULT aWrapperRC = S_OK); 220 221 static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo) 222 { 223 return formatErrorInfo (COMErrorInfo (aInfo)); 224 } 225 226 static QString formatErrorInfo (const COMBase &aWrapper) 227 { 228 Assert (FAILED (aWrapper.lastRC())); 229 return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC()); 230 } 231 232 static QString formatErrorInfo (const COMResult &aRC) 233 { 234 Assert (FAILED (aRC.rc())); 235 return formatErrorInfo (aRC.errorInfo(), aRC.rc()); 230 236 } 231 237 … … 239 245 240 246 friend VBoxProblemReporter &vboxProblem(); 247 248 static QString doFormatErrorInfo (const COMErrorInfo &aInfo, 249 HRESULT aWrapperRC = S_OK); 241 250 }; 242 251 -
trunk/src/VBox/Frontends/VirtualBox/src/COMDefs.cpp
r1959 r2671 320 320 gotAll &= info.isOk(); 321 321 322 CVirtualBoxErrorInfo next = info.GetNext(); 323 if (info.isOk() && !next.isNull()) 324 { 325 mNext.reset (new COMErrorInfo (next)); 326 Assert (mNext.get()); 327 } 328 else 329 mNext.reset(); 330 gotSomething |= info.isOk(); 331 gotAll &= info.isOk(); 332 322 333 mIsBasicAvailable = gotSomething; 323 334 mIsFullAvailable = gotAll; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r2425 r2671 1503 1503 1504 1504 /* static */ 1505 QString VBoxProblemReporter::formatErrorInfo (const COMErrorInfo &info, 1506 HRESULT wrapperRC) 1507 { 1508 QString formatted = "<qt>"; 1509 1510 if (info.text()) 1505 QString VBoxProblemReporter::formatErrorInfo (const COMErrorInfo &aInfo, 1506 HRESULT aWrapperRC /* = S_OK */) 1507 { 1508 QString formatted = doFormatErrorInfo (aInfo, aWrapperRC); 1509 return QString ("<qt>%1</qt>").arg (formatted); 1510 } 1511 1512 /* static */ 1513 QString VBoxProblemReporter::doFormatErrorInfo (const COMErrorInfo &aInfo, 1514 HRESULT aWrapperRC /* = S_OK */) 1515 { 1516 QString formatted; 1517 1518 if (aInfo.text()) 1511 1519 formatted += QString ("<table bgcolor=#FFFFFF border=0 cellspacing=0 " 1512 1520 "cellpadding=0 width=100%>" 1513 1521 "<tr><td><p>%1.</p></td></tr>" 1514 1522 "</table><p></p>") 1515 .arg (VBoxGlobal::highlight ( info.text()));1523 .arg (VBoxGlobal::highlight (aInfo.text())); 1516 1524 1517 1525 formatted += "<table bgcolor=#EEEEEE border=0 cellspacing=0 " … … 1520 1528 bool haveResultCode = false; 1521 1529 1522 if ( info.isBasicAvailable())1530 if (aInfo.isBasicAvailable()) 1523 1531 { 1524 1532 #if defined (Q_WS_WIN) 1525 haveResultCode = info.isFullAvailable();1533 haveResultCode = aInfo.isFullAvailable(); 1526 1534 bool haveComponent = true; 1527 1535 bool haveInterfaceID = true; 1528 1536 #else // !Q_WS_WIN 1529 1537 haveResultCode = true; 1530 bool haveComponent = info.isFullAvailable();1531 bool haveInterfaceID = info.isFullAvailable();1538 bool haveComponent = aInfo.isFullAvailable(); 1539 bool haveInterfaceID = aInfo.isFullAvailable(); 1532 1540 #endif 1533 1541 … … 1537 1545 /* format the error code, masking off the top 16 bits */ 1538 1546 PCRTWINERRMSG msg; 1539 msg = RTErrWinGet( info.resultCode());1547 msg = RTErrWinGet(aInfo.resultCode()); 1540 1548 /* try again with masked off top 16bit if not found */ 1541 1549 if (!msg->iCode) 1542 msg = RTErrWinGet( info.resultCode() & 0xFFFF);1550 msg = RTErrWinGet(aInfo.resultCode() & 0xFFFF); 1543 1551 formatted += QString ("<tr><td>%1</td><td><tt>%2 (0x%3)</tt></td></tr>") 1544 1552 .arg (tr ("Result Code: ", "error info")) 1545 1553 .arg (msg->pszDefine) 1546 .arg (uint ( info.resultCode()), 8, 16);1554 .arg (uint (aInfo.resultCode()), 8, 16); 1547 1555 #else 1548 1556 formatted += QString ("<tr><td>%1</td><td><tt>0x%2</tt></td></tr>") 1549 1557 .arg (tr ("Result Code: ", "error info")) 1550 .arg (uint ( info.resultCode()), 8, 16);1558 .arg (uint (aInfo.resultCode()), 8, 16); 1551 1559 #endif 1552 1560 } … … 1554 1562 if (haveComponent) 1555 1563 formatted += QString ("<tr><td>%1</td><td>%2</td></tr>") 1556 .arg (tr ("Component: ", "error info"), info.component());1564 .arg (tr ("Component: ", "error info"), aInfo.component()); 1557 1565 1558 1566 if (haveInterfaceID) 1559 1567 { 1560 QString s = info.interfaceID();1561 if ( info.interfaceName())1562 s = info.interfaceName() + ' ' + s;1568 QString s = aInfo.interfaceID(); 1569 if (aInfo.interfaceName()) 1570 s = aInfo.interfaceName() + ' ' + s; 1563 1571 formatted += QString ("<tr><td>%1</td><td>%2</td></tr>") 1564 1572 .arg (tr ("Interface: ", "error info"), s); 1565 1573 } 1566 1574 1567 if (! info.calleeIID().isNull() && info.calleeIID() != info.interfaceID())1575 if (!aInfo.calleeIID().isNull() && aInfo.calleeIID() != aInfo.interfaceID()) 1568 1576 { 1569 QString s = info.calleeIID();1570 if ( info.calleeName())1571 s = info.calleeName() + ' ' + s;1577 QString s = aInfo.calleeIID(); 1578 if (aInfo.calleeName()) 1579 s = aInfo.calleeName() + ' ' + s; 1572 1580 formatted += QString ("<tr><td>%1</td><td>%2</td></tr>") 1573 1581 .arg (tr ("Callee: ", "error info"), s); … … 1575 1583 } 1576 1584 1577 if (FAILED ( wrapperRC) &&1578 (!haveResultCode || wrapperRC != info.resultCode()))1585 if (FAILED (aWrapperRC) && 1586 (!haveResultCode || aWrapperRC != aInfo.resultCode())) 1579 1587 { 1580 1588 #if defined (Q_WS_WIN) 1581 1589 /* format the error code */ 1582 1590 PCRTWINERRMSG msg; 1583 msg = RTErrWinGet( wrapperRC);1591 msg = RTErrWinGet(aWrapperRC); 1584 1592 /* try again with masked off top 16bit if not found */ 1585 1593 if (!msg->iCode) 1586 msg = RTErrWinGet( wrapperRC & 0xFFFF);1594 msg = RTErrWinGet(aWrapperRC & 0xFFFF); 1587 1595 formatted += QString ("<tr><td>%1</td><td><tt>%2 (0x%3)</tt></td></tr>") 1588 1596 .arg (tr ("Callee RC: ", "error info")) 1589 1597 .arg (msg->pszDefine) 1590 .arg (uint ( wrapperRC), 8, 16);1598 .arg (uint (aWrapperRC), 8, 16); 1591 1599 #else 1592 1600 formatted += QString ("<tr><td>%1</td><td><tt>0x%2</tt></td></tr>") 1593 1601 .arg (tr ("Callee RC: ", "error info")) 1594 .arg (uint ( wrapperRC), 8, 16);1602 .arg (uint (aWrapperRC), 8, 16); 1595 1603 #endif 1596 1604 } 1597 formatted += "</table></qt>"; 1605 formatted += "</table>"; 1606 1607 if (aInfo.next()) 1608 formatted = doFormatErrorInfo (*aInfo.next()) + "<p></p>" + 1609 formatted; 1598 1610 1599 1611 return formatted;
Note:
See TracChangeset
for help on using the changeset viewer.