Changeset 23223 in vbox for trunk/src/VBox/Frontends/VirtualBox/include
- Timestamp:
- Sep 22, 2009 3:50:03 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 52692
- Location:
- trunk/src/VBox/Frontends/VirtualBox/include
- Files:
-
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl
r17808 r23223 224 224 <!-- forward declarations --> 225 225 <xsl:text>// forward declarations

</xsl:text> 226 <xsl:for-each select="interface | collection | enumerator">226 <xsl:for-each select="interface"> 227 227 <xsl:text>class C</xsl:text> 228 228 <xsl:value-of select="substring(@name,2)"/> … … 250 250 <xsl:apply-templates select=" 251 251 if | 252 interface[not(@internal='yes')] | 253 collection[not(@internal='yes')] | 254 enumerator[not(@internal='yes')] 252 interface[not(@internal='yes')] 255 253 " 256 254 mode="declare" … … 260 258 <xsl:apply-templates select=" 261 259 if | 262 interface[not(@internal='yes')] | 263 collection[not(@internal='yes')] | 264 enumerator[not(@internal='yes')] 260 interface[not(@internal='yes')] 265 261 " 266 262 mode="define" … … 272 268 * interface declarations 273 269 --> 274 <xsl:template match="interface | collection | enumerator" mode="declare">270 <xsl:template match="interface" mode="declare"> 275 271 276 272 <xsl:text>// </xsl:text> … … 295 291 <xsl:text>> Base;

</xsl:text> 296 292 297 <xsl:if test="name()='collection'"> 298 <xsl:text> // collection stuff

</xsl:text> 299 <xsl:text> ULONG GetCount () const;
</xsl:text> 300 <xsl:text> </xsl:text> 301 <xsl:apply-templates select="@type"/> 302 <xsl:text> GetItemAt (ULONG index) const;
</xsl:text> 303 <xsl:text> </xsl:text> 304 <xsl:apply-templates select="@enumerator"/> 305 <xsl:text> Enumerate () const;

</xsl:text> 306 </xsl:if> 307 308 <xsl:if test="name()='enumerator'"> 309 <xsl:text> // enumerator stuff

</xsl:text> 310 <xsl:text> BOOL HasMore () const;
</xsl:text> 311 <xsl:text> </xsl:text> 312 <xsl:apply-templates select="@type"/> 313 <xsl:text> GetNext () const;

</xsl:text> 314 <xsl:text> // friend wrappers

</xsl:text> 315 <xsl:text> friend class CUnknown;
</xsl:text> 316 <xsl:variable name="name" select="@name"/> 317 <xsl:variable name="parent" select=".."/> 318 <!-- for definitions inside <if> --> 319 <xsl:if test="name(..)='if'"> 320 <xsl:for-each select=" 321 preceding-sibling::collection | following-sibling::collection | 322 ../preceding-sibling::if[@target=$parent/@target]/collection | 323 ../following-sibling::if[@target=$parent/@target]/collection 324 "> 325 <xsl:if test="@enumerator=$name"> 326 <xsl:text> friend class C</xsl:text> 327 <xsl:value-of select="substring(@name,2)"/> 328 <xsl:text>;
</xsl:text> 329 </xsl:if> 330 </xsl:for-each> 331 </xsl:if> 332 <!-- for definitions outside <if> (i.e. inside <library>) --> 333 <xsl:if test="name(..)!='if'"> 334 <xsl:for-each select=" 335 preceding-sibling::collection | following-sibling::collection 336 "> 337 <xsl:if test="@enumerator=$name"> 338 <xsl:text> friend class C</xsl:text> 339 <xsl:value-of select="substring(@name,2)"/> 340 <xsl:text>;
</xsl:text> 341 </xsl:if> 342 </xsl:for-each> 343 </xsl:if> 344 </xsl:if> 345 346 <xsl:if test="name()='interface' or name()='collection'"> 293 <xsl:if test="name()='interface'"> 347 294 <xsl:call-template name="declareMembers"/> 348 295 </xsl:if> … … 368 315 <xsl:with-param name="iface" select=" 369 316 preceding-sibling:: 370 *[ (self::interface or self::collection)and @name=$iface/@extends] |317 *[self::interface and @name=$iface/@extends] | 371 318 following-sibling:: 372 *[ (self::interface or self::collection)and @name=$iface/@extends] |319 *[self::interface and @name=$iface/@extends] | 373 320 ../preceding-sibling::if[@target=../@target]/ 374 *[ (self::interface or self::collection)and @name=$iface/@extends] |321 *[self::interface and @name=$iface/@extends] | 375 322 ../following-sibling::if[@target=../@target]/ 376 *[ (self::interface or self::collection)and @name=$iface/@extends]323 *[self::interface and @name=$iface/@extends] 377 324 "/> 378 325 </xsl:call-template> … … 383 330 <xsl:with-param name="iface" select=" 384 331 preceding-sibling:: 385 *[ (self::interface or self::collection)and @name=$iface/@extends] |332 *[self::interface and @name=$iface/@extends] | 386 333 following-sibling:: 387 *[ (self::interface or self::collection)and @name=$iface/@extends]334 *[self::interface and @name=$iface/@extends] 388 335 "/> 389 336 </xsl:call-template> … … 410 357 <xsl:with-param name="iface" select=" 411 358 preceding-sibling:: 412 *[ (self::interface or self::collection)and @name=$iface/@extends] |359 *[self::interface and @name=$iface/@extends] | 413 360 following-sibling:: 414 *[ (self::interface or self::collection)and @name=$iface/@extends] |361 *[self::interface and @name=$iface/@extends] | 415 362 ../preceding-sibling::if[@target=../@target]/ 416 *[ (self::interface or self::collection)and @name=$iface/@extends] |363 *[self::interface and @name=$iface/@extends] | 417 364 ../following-sibling::if[@target=../@target]/ 418 *[ (self::interface or self::collection)and @name=$iface/@extends]365 *[self::interface and @name=$iface/@extends] 419 366 "/> 420 367 </xsl:call-template> … … 425 372 <xsl:with-param name="iface" select=" 426 373 preceding-sibling:: 427 *[ (self::interface or self::collection)and @name=$iface/@extends] |374 *[self::interface and @name=$iface/@extends] | 428 375 following-sibling:: 429 *[ (self::interface or self::collection)and @name=$iface/@extends]376 *[self::interface and @name=$iface/@extends] 430 377 "/> 431 378 </xsl:call-template> … … 541 488 <xsl:if test="name(..)='if'"> 542 489 <xsl:for-each select=" 543 preceding-sibling::*[self::interface or self::collection or self::enumerator] |544 following-sibling::*[self::interface or self::collection or self::enumerator] |545 ../preceding-sibling::*[self::interface or self::collection or self::enumerator] |546 ../following-sibling::*[self::interface or self::collection or self::enumerator] |547 ../preceding-sibling::if[@target=$parent/@target]/*[self::interface or self::collection or self::enumerator] |548 ../following-sibling::if[@target=$parent/@target]/*[self::interface or self::collection or self::enumerator]490 preceding-sibling::*[self::interface] | 491 following-sibling::*[self::interface] | 492 ../preceding-sibling::*[self::interface] | 493 ../following-sibling::*[self::interface] | 494 ../preceding-sibling::if[@target=$parent/@target]/*[self::interface] | 495 ../following-sibling::if[@target=$parent/@target]/*[self::interface] 549 496 "> 550 497 <xsl:if test=" 551 ((name()='interface' or name()='collection')498 ((name()='interface') 552 499 and 553 500 ((name(..)!='if' and (if[@target=$parent/@target]/method/param[@type=$name] … … 556 503 or 557 504 (.//method/param[@type=$name] or attribute[@type=$name]))) 558 or559 (name(..)='if' and (name()='collection' or name()='enumerator') and @type=$name)560 505 "> 561 506 <xsl:text> friend class C</xsl:text> … … 568 513 <xsl:if test="name(..)!='if'"> 569 514 <xsl:for-each select=" 570 preceding-sibling::*[self::interface or self::collection or self::enumerator] |571 following-sibling::*[self::interface or self::collection or self::enumerator] |572 preceding-sibling::if/*[self::interface or self::collection or self::enumerator] |573 following-sibling::if/*[self::interface or self::collection or self::enumerator]515 preceding-sibling::*[self::interface] | 516 following-sibling::*[self::interface] | 517 preceding-sibling::if/*[self::interface] | 518 following-sibling::if/*[self::interface] 574 519 "> 575 520 <xsl:if test=" 576 ((name()='interface' or name()='collection') 577 and 578 (.//method/param[@type=$name] or attribute[@type=$name])) 579 or 580 ((name()='collection' or name()='enumerator') and @type=$name) 521 name()='interface' and (.//method/param[@type=$name] or attribute[@type=$name]) 581 522 "> 582 523 <xsl:text> friend class C</xsl:text> … … 590 531 591 532 <!-- attribute declarations --> 592 <xsl:template match="interface//attribute | collection//attribute" mode="declare"> 593 <xsl:if test="@array"> 594 <xsl:message terminate="yes"> 595 <xsl:value-of select="concat(../../@name,'::',../@name,'::',@name,': ')"/> 596 <xsl:text>'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text> 597 </xsl:message> 598 </xsl:if> 533 <xsl:template match="interface//attribute" mode="declare"> 599 534 <xsl:apply-templates select="parent::node()" mode="begin"/> 600 535 <xsl:apply-templates select="@if" mode="begin"/> … … 612 547 613 548 <!-- method declarations --> 614 <xsl:template match="interface//method | collection//method" mode="declare">549 <xsl:template match="interface//method" mode="declare"> 615 550 <xsl:apply-templates select="parent::node()" mode="begin"/> 616 551 <xsl:apply-templates select="@if" mode="begin"/> … … 624 559 * interface definitions 625 560 --> 626 <xsl:template match="interface | collection | enumerator" mode="define">561 <xsl:template match="interface" mode="define"> 627 562 628 563 <xsl:text>// </xsl:text> … … 630 565 <xsl:text> wrapper

</xsl:text> 631 566 632 <xsl:if test="name()='collection'"> 633 <!-- GetCount --> 634 <xsl:text>inline ULONG C</xsl:text> 635 <xsl:value-of select="substring(@name,2)"/> 636 <xsl:text>::GetCount () const
{
</xsl:text> 637 <xsl:text> ULONG count = 0;
</xsl:text> 638 <xsl:text> Assert (mIface);
</xsl:text> 639 <xsl:text> if (!mIface)
 return count;
</xsl:text> 640 <xsl:text> mRC = mIface->COMGETTER(Count) (&count);
</xsl:text> 641 <xsl:call-template name="tryComposeFetchErrorInfo"/> 642 <xsl:text> return count;
</xsl:text> 643 <xsl:text>}

</xsl:text> 644 <!-- GetItemAt --> 645 <xsl:text>inline </xsl:text> 646 <xsl:apply-templates select="@type"/> 647 <xsl:text> C</xsl:text> 648 <xsl:value-of select="substring(@name,2)"/> 649 <xsl:text>::GetItemAt (ULONG index) const
{
</xsl:text> 650 <xsl:text> </xsl:text><xsl:apply-templates select="@type"/> 651 <xsl:text> item;
</xsl:text> 652 <xsl:text> Assert (mIface);
</xsl:text> 653 <xsl:text> if (!mIface)
 return item;
</xsl:text> 654 <xsl:text> mRC = mIface->GetItemAt (index, &item.mIface);
</xsl:text> 655 <xsl:call-template name="tryComposeFetchErrorInfo"/> 656 <xsl:text> return item;
</xsl:text> 657 <xsl:text>}

</xsl:text> 658 <!-- Enumerate --> 659 <xsl:text>inline </xsl:text> 660 <xsl:apply-templates select="@enumerator"/> 661 <xsl:text> C</xsl:text> 662 <xsl:value-of select="substring(@name,2)"/> 663 <xsl:text>::Enumerate () const
{
</xsl:text> 664 <xsl:text> </xsl:text><xsl:apply-templates select="@enumerator"/> 665 <xsl:text> enumerator;
</xsl:text> 666 <xsl:text> Assert (mIface);
</xsl:text> 667 <xsl:text> if (!mIface)
 return enumerator;
</xsl:text> 668 <xsl:text> mRC = mIface->Enumerate (&enumerator.mIface);
</xsl:text> 669 <xsl:call-template name="tryComposeFetchErrorInfo"/> 670 <xsl:text> return enumerator;
</xsl:text> 671 <xsl:text>}

</xsl:text> 672 </xsl:if> 673 674 <xsl:if test="name()='enumerator'"> 675 <!-- HasMore --> 676 <xsl:text>inline BOOL C</xsl:text> 677 <xsl:value-of select="substring(@name,2)"/> 678 <xsl:text>::HasMore () const
{
</xsl:text> 679 <xsl:text> BOOL more = FALSE;
</xsl:text> 680 <xsl:text> Assert (mIface);
</xsl:text> 681 <xsl:text> if (!mIface)
 return more;
</xsl:text> 682 <xsl:text> mRC = mIface->HasMore (&more);
</xsl:text> 683 <xsl:call-template name="tryComposeFetchErrorInfo"/> 684 <xsl:text> return more;
</xsl:text> 685 <xsl:text>}

</xsl:text> 686 <!-- GetNext --> 687 <xsl:text>inline </xsl:text> 688 <xsl:apply-templates select="@type"/> 689 <xsl:text> C</xsl:text> 690 <xsl:value-of select="substring(@name,2)"/> 691 <xsl:text>::GetNext () const
{
</xsl:text> 692 <xsl:text> </xsl:text><xsl:apply-templates select="@type"/> 693 <xsl:text> next;
</xsl:text> 694 <xsl:text> Assert (mIface);
</xsl:text> 695 <xsl:text> if (!mIface)
 return next;
</xsl:text> 696 <xsl:text> mRC = mIface->GetNext (&next.mIface);
</xsl:text> 697 <xsl:call-template name="tryComposeFetchErrorInfo"/> 698 <xsl:text> return next;
</xsl:text> 699 <xsl:text>}

</xsl:text> 700 </xsl:if> 701 702 <xsl:if test="name()='interface' or name()='collection'"> 567 <xsl:if test="name()='interface'"> 703 568 <xsl:call-template name="defineMembers"/> 704 569 </xsl:if> … … 722 587 <xsl:with-param name="iface" select=" 723 588 preceding-sibling:: 724 *[ (self::interface or self::collection)and @name=$iface/@extends] |589 *[self::interface and @name=$iface/@extends] | 725 590 following-sibling:: 726 *[ (self::interface or self::collection)and @name=$iface/@extends] |591 *[self::interface and @name=$iface/@extends] | 727 592 ../preceding-sibling::if[@target=../@target]/ 728 *[ (self::interface or self::collection)and @name=$iface/@extends] |593 *[self::interface and @name=$iface/@extends] | 729 594 ../following-sibling::if[@target=../@target]/ 730 *[ (self::interface or self::collection)and @name=$iface/@extends]595 *[self::interface and @name=$iface/@extends] 731 596 "/> 732 597 </xsl:call-template> … … 737 602 <xsl:with-param name="iface" select=" 738 603 preceding-sibling:: 739 *[ (self::interface or self::collection)and @name=$iface/@extends] |604 *[self::interface and @name=$iface/@extends] | 740 605 following-sibling:: 741 *[ (self::interface or self::collection)and @name=$iface/@extends]606 *[self::interface and @name=$iface/@extends] 742 607 "/> 743 608 </xsl:call-template> … … 764 629 <xsl:with-param name="iface" select=" 765 630 preceding-sibling:: 766 *[ (self::interface or self::collection)and @name=$iface/@extends] |631 *[self::interface and @name=$iface/@extends] | 767 632 following-sibling:: 768 *[ (self::interface or self::collection)and @name=$iface/@extends] |633 *[self::interface and @name=$iface/@extends] | 769 634 ../preceding-sibling::if[@target=../@target]/ 770 *[ (self::interface or self::collection)and @name=$iface/@extends] |635 *[self::interface and @name=$iface/@extends] | 771 636 ../following-sibling::if[@target=../@target]/ 772 *[ (self::interface or self::collection)and @name=$iface/@extends]637 *[self::interface and @name=$iface/@extends] 773 638 "/> 774 639 </xsl:call-template> … … 779 644 <xsl:with-param name="iface" select=" 780 645 preceding-sibling:: 781 *[ (self::interface or self::collection)and @name=$iface/@extends] |646 *[self::interface and @name=$iface/@extends] | 782 647 following-sibling:: 783 *[ (self::interface or self::collection)and @name=$iface/@extends]648 *[self::interface and @name=$iface/@extends] 784 649 "/> 785 650 </xsl:call-template> … … 800 665 801 666 <!-- attribute definitions --> 802 <xsl:template match="interface//attribute | collection//attribute" mode="define">803 804 <xsl:param name="namespace" select=" (ancestor::interface | ancestor::collection)[1]"/>667 <xsl:template match="interface//attribute" mode="define"> 668 669 <xsl:param name="namespace" select="ancestor::interface[1]"/> 805 670 806 671 <xsl:apply-templates select="parent::node()" mode="begin"/> … … 825 690 826 691 <!-- method definitions --> 827 <xsl:template match="interface//method | collection//method" mode="define">828 829 <xsl:param name="namespace" select=" (ancestor::interface | ancestor::collection)[1]"/>692 <xsl:template match="interface//method" mode="define"> 693 694 <xsl:param name="namespace" select="ancestor::interface[1]"/> 830 695 831 696 <xsl:apply-templates select="parent::node()" mode="begin"/> … … 869 734 * actual interface node for which this method is being defined 870 735 * (necessary to properly set a class name for inherited methods). 871 * If not specified, will default to the parent interface /collection736 * If not specified, will default to the parent interface 872 737 * node of the method being defined. 873 738 --> … … 875 740 <xsl:param name="return" select="param[@dir='return']"/> 876 741 <xsl:param name="define" select="''"/> 877 <xsl:param name="namespace" select=" (ancestor::interface | ancestor::collection)[1]"/>742 <xsl:param name="namespace" select="ancestor::interface[1]"/> 878 743 <xsl:choose> 879 744 <!-- no return value --> … … 1111 976 * appropriate base class name that provides error info functionality 1112 977 * (depending on the mode parameter). Does nothing if the current 1113 * entity (interface, collection or enumerator)does not support error info.978 * interface does not support error info. 1114 979 * 1115 980 * @param mode … … 1120 985 <xsl:param name="mode" select="''"/> 1121 986 <xsl:variable name="ifaceSupportsErrorInfo" select=" 1122 (ancestor-or-self::interface | 1123 ancestor-or-self::collection | 1124 ancestor-or-self::enumerator)[1]/@supportsErrorInfo 987 ancestor-or-self::interface[1]/@supportsErrorInfo 1125 988 "/> 1126 989 <xsl:variable name="librarySupportsErrorInfo" select="ancestor::library/@supportsErrorInfo"/> … … 1188 1051 </xsl:when> 1189 1052 <!-- string types --> 1190 <xsl:when test="@type = 'wstring' ">1053 <xsl:when test="@type = 'wstring' or @type = 'uuid'"> 1191 1054 <xsl:choose> 1192 1055 <xsl:when test="$isIn"> … … 1199 1062 <xsl:when test="$isOut"> 1200 1063 <xsl:text>BSTROut (a</xsl:text> 1201 <xsl:call-template name="capitalize">1202 <xsl:with-param name="str" select="@name"/>1203 </xsl:call-template>1204 <xsl:text>)</xsl:text>1205 </xsl:when>1206 </xsl:choose>1207 </xsl:when>1208 <!-- uuid type -->1209 <xsl:when test="@type = 'uuid'">1210 <xsl:choose>1211 <xsl:when test="$isIn">1212 <xsl:text>GUIDIn (a</xsl:text>1213 <xsl:call-template name="capitalize">1214 <xsl:with-param name="str" select="@name"/>1215 </xsl:call-template>1216 <xsl:text>)</xsl:text>1217 </xsl:when>1218 <xsl:when test="$isOut">1219 <xsl:text>GUIDOut (a</xsl:text>1220 1064 <xsl:call-template name="capitalize"> 1221 1065 <xsl:with-param name="str" select="@name"/> … … 1255 1099 <xsl:when test=" 1256 1100 @type='$unknown' or 1257 ((ancestor::library/enumerator[@name=current()/@type]) or1258 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()/@type])1259 ) or1260 1101 ((ancestor::library/interface[@name=current()/@type]) or 1261 1102 (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type]) 1262 ) or1263 ((ancestor::library/collection[@name=current()/@type]) or1264 (ancestor::library/if[@target=$self_target]/collection[@name=current()/@type])1265 1103 ) 1266 1104 "> … … 1328 1166 * attribute/parameter type conversion (returns plain Qt type name) 1329 1167 --> 1330 <xsl:template match=" 1331 attribute/@type | param/@type | 1332 enumerator/@type | collection/@type | collection/@enumerator 1333 "> 1168 <xsl:template match="attribute/@type | param/@type"> 1334 1169 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 1335 1170 1336 <xsl:if test="../@array and ../@safearray='yes'">1337 <xsl:message terminate="yes">1338 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>1339 <xsl:text>either 'array' or 'safearray="yes"' attribute is allowed, but not both!</xsl:text>1340 </xsl:message>1341 </xsl:if>1342 1343 <xsl:if test="../@array and ((name(..)='param' and ../@dir='return') or (name(..)='attribute'))">1344 <xsl:message terminate="yes">1345 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>1346 <xsl:text>return 'array' parameters and 'array' attributes are not supported, use 'safearray="yes"' instead.</xsl:text>1347 </xsl:message>1348 </xsl:if>1349 1350 1171 <xsl:choose> 1351 <!-- modifiers (ignored for 'enumeration' attributes)-->1172 <!-- modifiers --> 1352 1173 <xsl:when test="name(current())='type' and ../@mod"> 1353 <xsl:if test="../@safearray ">1174 <xsl:if test="../@safearray and ../@mod='ptr'"> 1354 1175 <xsl:message terminate="yes"> 1355 1176 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 1356 1177 <xsl:text>either 'safearray' or 'mod' attribute is allowed, but not both!</xsl:text> 1357 </xsl:message>1358 </xsl:if>1359 <xsl:if test="../@array">1360 <xsl:message terminate="yes">1361 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>1362 <xsl:text>either 'array' or 'mod' attribute is allowed, but not both!</xsl:text>1363 1178 </xsl:message> 1364 1179 </xsl:if> … … 1376 1191 <xsl:when test=".='unsigned long'">ULONG *</xsl:when> 1377 1192 <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when> 1378 <xsl:when test=".='char'">CHAR *</xsl:when>1379 <!--<xsl:when test=".='string'">??</xsl:when-->1380 <xsl:when test=".='wchar'">OLECHAR *</xsl:when>1381 <!--<xsl:when test=".='wstring'">??</xsl:when-->1382 1193 <xsl:otherwise> 1383 1194 <xsl:message terminate="yes"> … … 1390 1201 </xsl:otherwise> 1391 1202 </xsl:choose> 1203 </xsl:when> 1204 <xsl:when test="../@mod='string'"> 1205 <xsl:if test="../@safearray"> 1206 <xsl:text>QVector <</xsl:text> 1207 </xsl:if> 1208 <xsl:choose> 1209 <!-- standard types --> 1210 <!--xsl:when test=".='result'">??</xsl:when--> 1211 <xsl:when test=".='uuid'">QString</xsl:when> 1212 <xsl:otherwise> 1213 <xsl:message terminate="yes"> 1214 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 1215 <xsl:text>attribute 'mod=</xsl:text> 1216 <xsl:value-of select="concat('"',../@mod,'"')"/> 1217 <xsl:text>' cannot be used with type </xsl:text> 1218 <xsl:value-of select="concat('"',current(),'"!')"/> 1219 </xsl:message> 1220 </xsl:otherwise> 1221 </xsl:choose> 1222 <xsl:if test="../@safearray"> 1223 <xsl:text>></xsl:text> 1224 </xsl:if> 1392 1225 </xsl:when> 1393 1226 <xsl:otherwise> … … 1435 1268 <!-- custom interface types --> 1436 1269 <xsl:when test=" 1437 (name(current())='enumerator' and1438 ((ancestor::library/enumerator[@name=current()]) or1439 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))1440 ) or1441 1270 ((ancestor::library/interface[@name=current()]) or 1442 1271 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 1443 ) or1444 ((ancestor::library/collection[@name=current()]) or1445 (ancestor::library/if[@target=$self_target]/collection[@name=current()])1446 1272 ) 1447 1273 "> … … 1471 1297 * types. 1472 1298 --> 1473 <xsl:template match=" 1474 attribute/@type | param/@type | 1475 enumerator/@type | collection/@type | collection/@enumerator 1476 " mode="initializer"> 1299 <xsl:template match="attribute/@type | param/@type" mode="initializer"> 1477 1300 1478 1301 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> … … 1482 1305 <xsl:when test="../@safearray"> 1483 1306 </xsl:when> 1484 <!-- modifiers (ignored for 'enumeration' attributes)-->1307 <!-- modifiers --> 1485 1308 <xsl:when test="name(current())='type' and ../@mod"> 1486 1309 <xsl:choose> … … 1497 1320 <xsl:when test=".='unsigned long'"> = NULL</xsl:when> 1498 1321 <xsl:when test=".='unsigned long long'"> = NULL</xsl:when> 1499 <xsl:when test=".='char'"> = NULL</xsl:when> 1500 <!--<xsl:when test=".='string'">??</xsl:when--> 1501 <xsl:when test=".='wchar'"> = NULL</xsl:when> 1502 <!--<xsl:when test=".='wstring'">??</xsl:when--> 1322 <xsl:otherwise> 1323 <xsl:message terminate="yes"> 1324 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 1325 <xsl:text>attribute 'mod=</xsl:text> 1326 <xsl:value-of select="concat('"',../@mod,'"')"/> 1327 <xsl:text>' cannot be used with type </xsl:text> 1328 <xsl:value-of select="concat('"',current(),'"!')"/> 1329 </xsl:message> 1330 </xsl:otherwise> 1331 </xsl:choose> 1332 </xsl:when> 1333 <xsl:when test="../@mod='string'"> 1334 <xsl:choose> 1335 <!-- standard types --> 1336 <!--xsl:when test=".='result'">??</xsl:when--> 1337 <xsl:when test=".='uuid'"></xsl:when> 1503 1338 <xsl:otherwise> 1504 1339 <xsl:message terminate="yes"> … … 1571 1406 ) or 1572 1407 .='$unknown' or 1573 ((ancestor::library/enumerator[@name=current()]) or1574 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()])1575 ) or1576 1408 ((ancestor::library/interface[@name=current()]) or 1577 1409 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 1578 ) or1579 ((ancestor::library/collection[@name=current()]) or1580 (ancestor::library/if[@target=$self_target]/collection[@name=current()])1581 1410 ) 1582 1411 "> … … 1616 1445 <!-- <param> context --> 1617 1446 <xsl:when test="name(..)='param'"> 1618 <xsl:choose> 1619 <xsl:when test="../@array"> 1620 <xsl:apply-templates select="."/> 1621 <xsl:text> *</xsl:text> 1622 <xsl:if test="../@dir='out'"> 1623 <xsl:text> &</xsl:text> 1624 </xsl:if> 1625 </xsl:when> 1626 <xsl:otherwise> 1627 <xsl:apply-templates select="."/> 1628 <xsl:if test="../@dir='out'"> 1629 <xsl:text> &</xsl:text> 1630 </xsl:if> 1631 </xsl:otherwise> 1632 </xsl:choose> 1447 <xsl:apply-templates select="."/> 1448 <xsl:if test="../@dir='out'"> 1449 <xsl:text> &</xsl:text> 1450 </xsl:if> 1633 1451 </xsl:when> 1634 1452 </xsl:choose> … … 1642 1460 * (basically, copied from midl.xsl) 1643 1461 --> 1644 <xsl:template match=" 1645 attribute/@type | param/@type | 1646 enumerator/@type | collection/@type | collection/@enumerator 1647 " mode="com"> 1462 <xsl:template match="attribute/@type | param/@type" mode="com"> 1648 1463 1649 1464 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 1650 1465 1651 1466 <xsl:choose> 1652 <!-- modifiers (ignored for 'enumeration' attributes)-->1467 <!-- modifiers --> 1653 1468 <xsl:when test="name(current())='type' and ../@mod"> 1654 1469 <xsl:choose> … … 1665 1480 <xsl:when test=".='unsigned long'">ULONG *</xsl:when> 1666 1481 <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when> 1667 <xsl:when test=".='char'">CHAR *</xsl:when> 1668 <!--xsl:when test=".='string'">??</xsl:when--> 1669 <xsl:when test=".='wchar'">OLECHAR *</xsl:when> 1670 <!--xsl:when test=".='wstring'">??</xsl:when--> 1482 <xsl:otherwise> 1483 <xsl:message terminate="yes"> 1484 <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/> 1485 <xsl:text>attribute 'mod=</xsl:text> 1486 <xsl:value-of select="concat('"',../@mod,'"')"/> 1487 <xsl:text>' cannot be used with type </xsl:text> 1488 <xsl:value-of select="concat('"',current(),'"!')"/> 1489 </xsl:message> 1490 </xsl:otherwise> 1491 </xsl:choose> 1492 </xsl:when> 1493 <xsl:when test="../@mod='string'"> 1494 <xsl:choose> 1495 <!-- standard types --> 1496 <!--xsl:when test=".='result'">??</xsl:when--> 1497 <xsl:when test=".='uuid'">BSTR</xsl:when> 1671 1498 <xsl:otherwise> 1672 1499 <xsl:message terminate="yes"> … … 1721 1548 <!-- custom interface types --> 1722 1549 <xsl:when test=" 1723 (name(current())='enumerator' and1724 ((ancestor::library/enumerator[@name=current()]) or1725 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()]))1726 ) or1727 1550 ((ancestor::library/interface[@name=current()]) or 1728 1551 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 1729 ) or1730 ((ancestor::library/collection[@name=current()]) or1731 (ancestor::library/if[@target=$self_target]/collection[@name=current()])1732 1552 ) 1733 1553 "> … … 1768 1588 1769 1589 <xsl:variable name="is_iface" select="( 1770 ((ancestor::library/enumerator[@name=current()/@type]) or1771 (ancestor::library/if[@target=$self_target]/enumerator[@name=current()/@type])1772 ) or1773 1590 ((ancestor::library/interface[@name=current()/@type]) or 1774 1591 (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type]) 1775 ) or1776 ((ancestor::library/collection[@name=current()/@type]) or1777 (ancestor::library/if[@target=$self_target]/collection[@name=current()/@type])1778 1592 ) 1779 1593 )"/> … … 1806 1620 </xsl:when> 1807 1621 <!-- GUID is special too --> 1808 <xsl:when test="@type='uuid' ">1622 <xsl:when test="@type='uuid' and @mod!='string'"> 1809 1623 <xsl:text> com::SafeGUIDArray </xsl:text> 1810 1624 </xsl:when> -
trunk/src/VBox/Frontends/VirtualBox/include/QILabelSeparator.h
r14398 r23223 24 24 #define __QILabelSeparator_h__ 25 25 26 /* Qtincludes */26 /* Global includes */ 27 27 #include <QWidget> 28 28 29 /* Global forwards */ 29 30 class QLabel; 30 31 … … 35 36 public: 36 37 37 QILabelSeparator (QWidget *aParent = NULL, Qt::WindowFlags aFlags = 0);38 QILabelSeparator (const QString &aText, QWidget *aParent = NULL, Qt::WindowFlags aFlags = 0);38 QILabelSeparator (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0); 39 QILabelSeparator (const QString &aText, QWidget *aParent = 0, Qt::WindowFlags aFlags = 0); 39 40 41 QString text() const; 40 42 void setBuddy (QWidget *aBuddy); 41 43 … … 44 46 void clear(); 45 47 void setText (const QString &aText); 46 QString text() const;47 48 48 49 protected: … … 50 51 virtual void init(); 51 52 52 /* Protected member vars */53 53 QLabel *mLabel; 54 54 }; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r22834 r23223 155 155 void machineStateChanged (KMachineState state); 156 156 void additionsStateChanged (const QString &, bool, bool, bool); 157 void mediaDriveChanged (VBoxDefs::Medi aType aType);157 void mediaDriveChanged (VBoxDefs::MediumType aType); 158 158 void networkStateChange(); 159 159 void usbStateChange(); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r23142 r23223 240 240 void updateNetworkAdaptersState(); 241 241 void updateUsbState(); 242 void updateMediaDriveState (VBoxDefs::Medi aType aType);242 void updateMediaDriveState (VBoxDefs::MediumType aType); 243 243 void updateSharedFoldersState(); 244 244 … … 358 358 bool no_auto_close : 1; 359 359 360 QMap <QAction *, C HostDVDDrive> hostDVDMap;361 QMap <QAction *, C HostFloppyDrive> hostFloppyMap;360 QMap <QAction *, CMedium> hostDVDMap; 361 QMap <QAction *, CMedium> hostFloppyMap; 362 362 363 363 QRect mNormalGeo; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r22816 r23223 69 69 struct VBoxDefs 70 70 { 71 /** Medi atype. */72 enum Medi aType71 /** Medium type. */ 72 enum MediumType 73 73 { 74 Medi aType_Invalid,75 Medi aType_HardDisk,76 Medi aType_DVD,77 Medi aType_Floppy,78 Medi aType_All74 MediumType_Invalid, 75 MediumType_HardDisk, 76 MediumType_DVD, 77 MediumType_Floppy, 78 MediumType_All 79 79 }; 80 80 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r22816 r23223 245 245 }; 246 246 247 struct StorageSlot 248 { 249 StorageSlot() : bus (KStorageBus_Null), port (0), device (0) {} 250 StorageSlot (const StorageSlot &aOther) : bus (aOther.bus), port (aOther.port), device (aOther.device) {} 251 StorageSlot (KStorageBus aBus, LONG aPort, LONG aDevice) : bus (aBus), port (aPort), device (aDevice) {} 252 StorageSlot& operator= (const StorageSlot &aOther) { bus = aOther.bus; port = aOther.port; device = aOther.device; return *this; } 253 bool operator== (const StorageSlot &aOther) const { return bus == aOther.bus && port == aOther.port && device == aOther.device; } 254 bool operator!= (const StorageSlot &aOther) const { return bus != aOther.bus || port != aOther.port || device != aOther.device; } 255 bool isNull() { return bus == KStorageBus_Null; } 256 KStorageBus bus; LONG port; LONG device; 257 }; 258 Q_DECLARE_METATYPE (StorageSlot); 259 247 260 // VBoxGlobal class 248 261 //////////////////////////////////////////////////////////////////////////////// … … 383 396 case KStorageControllerType_LsiLogic: 384 397 case KStorageControllerType_BusLogic: sb = KStorageBus_SCSI; break; 398 case KStorageControllerType_I82078: sb = KStorageBus_Floppy; break; 385 399 default: 386 400 AssertMsgFailed (("toStorageBusType: %d not handled\n", aControllerType)); break; … … 395 409 LONG toStorageDevice (KStorageBus aBus, LONG aChannel, const QString &aDevice) const; 396 410 397 QString toFullString (KStorageBus aBus, LONG aChannel, LONG aDevice) const; 398 399 QString toString (KHardDiskType t) const 411 QString toFullString (StorageSlot aSlot) const; 412 StorageSlot toStorageSlot (const QString &aSlot) const; 413 414 QString toString (KMediumType t) const 400 415 { 401 416 AssertMsg (!mDiskTypes.value (t).isNull(), ("No text for %d", t)); … … 404 419 405 420 /** 406 * Similar to toString (K HardDiskType), but returns 'Differencing' for421 * Similar to toString (KMediumType), but returns 'Differencing' for 407 422 * normal hard disks that have a parent. 408 423 */ 409 QString hardDiskTypeString (const CHardDisk&aHD) const424 QString mediumTypeString (const CMedium &aHD) const 410 425 { 411 426 if (!aHD.GetParent().isNull()) 412 427 { 413 Assert (aHD.GetType() == K HardDiskType_Normal);428 Assert (aHD.GetType() == KMediumType_Normal); 414 429 return mDiskTypes_Differencing; 415 430 } … … 456 471 } 457 472 458 KStorageControllerType to IDEControllerType (const QString &s) const473 KStorageControllerType toControllerType (const QString &s) const 459 474 { 460 475 QULongStringHash::const_iterator it = … … 593 608 /* details generators */ 594 609 595 QString details (const C HardDisk&aHD, bool aPredictDiff);610 QString details (const CMedium &aHD, bool aPredictDiff); 596 611 597 612 QString details (const CUSBDevice &aDevice) const; … … 635 650 void addMedium (const VBoxMedium &); 636 651 void updateMedium (const VBoxMedium &); 637 void removeMedium (VBoxDefs::Medi aType, const QString &);652 void removeMedium (VBoxDefs::MediumType, const QString &); 638 653 639 654 bool findMedium (const CMedium &, VBoxMedium &) const; 655 VBoxMedium findMedium (const QString &aMediumId) const; 640 656 641 657 /** Compact version of #findMediumTo(). Asserts if not found. */ … … 674 690 QString helpFile() const; 675 691 692 static QIcon iconSet (const QPixmap &aNormal, 693 const QPixmap &aDisabled = QPixmap(), 694 const QPixmap &aActive = QPixmap()); 676 695 static QIcon iconSet (const char *aNormal, 677 696 const char *aDisabled = NULL, … … 787 806 788 807 /** Emitted when the media is removed using #removeMedia(). */ 789 void mediumRemoved (VBoxDefs::Medi aType, const QString &);808 void mediumRemoved (VBoxDefs::MediumType, const QString &); 790 809 791 810 /* signals emitted when the VirtualBox callback is called by the server -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h
r19239 r23223 46 46 47 47 void setCurrentItem (const QString &aItemId); 48 void setType (VBoxDefs::Medi aType aMediaType);48 void setType (VBoxDefs::MediumType aMediumType); 49 49 void setMachineId (const QString &aMachineId = QString::null); 50 void setNullItemPresent (bool aNullItemPresent); 50 51 51 52 void setShowDiffs (bool aShowDiffs); … … 59 60 void mediumAdded (const VBoxMedium &); 60 61 void mediumUpdated (const VBoxMedium &); 61 void mediumRemoved (VBoxDefs::Medi aType, const QString &);62 void mediumRemoved (VBoxDefs::MediumType, const QString &); 62 63 63 64 void processActivated (int aIndex); … … 77 78 bool findMediaIndex (const QString &aId, int &aIndex); 78 79 79 VBoxDefs::Medi aType mType;80 VBoxDefs::MediumType mType; 80 81 81 82 /** Obtruncated VBoxMedium structure. */ … … 98 99 99 100 bool mShowDiffs : 1; 101 bool mNullItemPresent : 1; 100 102 101 103 QString mMachineId; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h
r22999 r23223 50 50 ~VBoxMediaManagerDlg(); 51 51 52 void setup (VBoxDefs::Medi aType aType, bool aDoSelect,52 void setup (VBoxDefs::MediumType aType, bool aDoSelect, 53 53 bool aRefresh = true, 54 54 const CMachine &aSessionMachine = CMachine(), … … 78 78 void mediumAdded (const VBoxMedium &aMedium); 79 79 void mediumUpdated (const VBoxMedium &aMedium); 80 void mediumRemoved (VBoxDefs::Medi aType aType, const QString &aId);80 void mediumRemoved (VBoxDefs::MediumType aType, const QString &aId); 81 81 82 82 void mediumEnumStarted(); … … 103 103 private: 104 104 105 QTreeWidget* treeWidget (VBoxDefs::Medi aType aType) const;106 VBoxDefs::Medi aType currentTreeWidgetType() const;105 QTreeWidget* treeWidget (VBoxDefs::MediumType aType) const; 106 VBoxDefs::MediumType currentTreeWidgetType() const; 107 107 QTreeWidget* currentTreeWidget() const; 108 108 … … 112 112 void setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem); 113 113 114 void addMediumToList (const QString &aLocation, VBoxDefs::Medi aType aType);114 void addMediumToList (const QString &aLocation, VBoxDefs::MediumType aType); 115 115 116 116 MediaItem* createHardDiskItem (QTreeWidget *aTree, const VBoxMedium &aMedium) const; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMedium.h
r19239 r23223 24 24 #define __VBoxMedium_h__ 25 25 26 #include "COMDefs.h" 27 28 /* Qt includes */ 26 /* Global includes */ 29 27 #include <QPixmap> 30 28 #include <QLinkedList> 29 30 /* Local includes */ 31 #include "COMDefs.h" 31 32 32 33 /** … … 45 46 * the medium itself. 46 47 * 47 * Note that this class "abuses" the KMedi aState_NotCreated state value to48 * Note that this class "abuses" the KMediumState_NotCreated state value to 48 49 * indicate that the accessibility check of the given medium (see 49 50 * #blockAndQueryState()) has not been done yet and therefore some parameters 50 51 * such as #size() are meaningless because they can be read only from the 51 * accessible medium. The real KMedi aState_NotCreated state is not necessary52 * accessible medium. The real KMediumState_NotCreated state is not necessary 52 53 * because this class is only used with created (existing) media. 53 54 */ … … 58 59 /** 59 60 * Creates a null medium descriptor which is not associated with any medium. 60 * The state field is set to KMedi aState_NotCreated.61 * The state field is set to KMediumState_NotCreated. 61 62 */ 62 63 VBoxMedium() 63 : mType (VBoxDefs::MediaType_Invalid) 64 , mState (KMediaState_NotCreated) 65 , mIsReadOnly (false), mIsUsedInSnapshots (false) 66 , mParent (NULL) {} 64 : mType (VBoxDefs::MediumType_Invalid) 65 , mState (KMediumState_NotCreated) 66 , mIsReadOnly (false) 67 , mIsUsedInSnapshots (false) 68 , mParent (0) { refresh(); } 67 69 68 70 /** 69 71 * Creates a media descriptor associated with the given medium. 70 72 * 71 * The state field remain KMedi aState_NotCreated until #blockAndQueryState()73 * The state field remain KMediumState_NotCreated until #blockAndQueryState() 72 74 * is called. All precomposed strings are filled up by implicitly calling 73 75 * #refresh(), see the #refresh() details for more info. … … 77 79 * disk media. 78 80 */ 79 VBoxMedium (const CMedium &aMedium, VBoxDefs::MediaType aType, 80 VBoxMedium *aParent = NULL) 81 : mMedium (aMedium), mType (aType) 82 , mState (KMediaState_NotCreated) 83 , mIsReadOnly (false), mIsUsedInSnapshots (false) 84 , mParent (aParent) { init(); } 81 VBoxMedium (const CMedium &aMedium, VBoxDefs::MediumType aType, VBoxMedium *aParent = 0) 82 : mMedium (aMedium) 83 , mType (aType) 84 , mState (KMediumState_NotCreated) 85 , mIsReadOnly (false) 86 , mIsUsedInSnapshots (false) 87 , mParent (aParent) { refresh(); } 85 88 86 89 /** … … 89 92 * creation. 90 93 */ 91 VBoxMedium (const CMedium &aMedium, VBoxDefs::Medi aType aType,92 KMediaState aState)93 : mMedium (aMedium), mType (aType)94 VBoxMedium (const CMedium &aMedium, VBoxDefs::MediumType aType, KMediumState aState) 95 : mMedium (aMedium) 96 , mType (aType) 94 97 , mState (aState) 95 , mIsReadOnly (false), mIsUsedInSnapshots (false) 96 , mParent (NULL) { init(); } 98 , mIsReadOnly (false) 99 , mIsUsedInSnapshots (false) 100 , mParent (0) { refresh(); } 97 101 98 102 void blockAndQueryState(); 99 103 void refresh(); 100 104 101 const CMedium &medium() const { return mMedium; } ;102 103 VBoxDefs::Medi aType type() const { return mType; }105 const CMedium &medium() const { return mMedium; } 106 107 VBoxDefs::MediumType type() const { return mType; } 104 108 105 109 /** … … 109 113 * @param aNoDiffs @c true to enable user-friendly "don't show diffs" mode. 110 114 */ 111 KMedi aState state (bool aNoDiffs = false) const115 KMediumState state (bool aNoDiffs = false) const 112 116 { 113 117 unconst (this)->checkNoDiffs (aNoDiffs); … … 131 135 } 132 136 133 const CHardDisk &hardDisk() const { return mHardDisk; }134 const CDVDImage &dvdImage() const { return mDVDImage; }135 const CFloppyImage &floppyImage() const { return mFloppyImage; }136 137 137 QString id() const { return mId; } 138 139 QString location (bool aNoDiffs = false) const 140 { return aNoDiffs ? root().mLocation : mLocation; } 141 QString name (bool aNoDiffs = false) const 142 { return aNoDiffs ? root().mName : mName; } 143 144 QString size (bool aNoDiffs = false) const 145 { return aNoDiffs ? root().mSize : mSize; } 146 147 QString hardDiskFormat (bool aNoDiffs = false) const 148 { return aNoDiffs ? root().mHardDiskFormat : mHardDiskFormat; } 149 QString hardDiskType (bool aNoDiffs = false) const 150 { return aNoDiffs ? root().mHardDiskType : mHardDiskType; } 151 QString logicalSize (bool aNoDiffs = false) const 152 { return aNoDiffs ? root().mLogicalSize : mLogicalSize; } 153 154 QString usage (bool aNoDiffs = false) const 155 { return aNoDiffs ? root().mUsage : mUsage; } 138 QString name (bool aNoDiffs = false) const { return aNoDiffs ? root().mName : mName; } 139 QString location (bool aNoDiffs = false) const { return aNoDiffs ? root().mLocation : mLocation; } 140 QString size (bool aNoDiffs = false) const { return aNoDiffs ? root().mSize : mSize; } 141 QString logicalSize (bool aNoDiffs = false) const { return aNoDiffs ? root().mLogicalSize : mLogicalSize; } 142 QString hardDiskFormat (bool aNoDiffs = false) const { return aNoDiffs ? root().mHardDiskFormat : mHardDiskFormat; } 143 QString hardDiskType (bool aNoDiffs = false) const { return aNoDiffs ? root().mHardDiskType : mHardDiskType; } 144 QString usage (bool aNoDiffs = false) const { return aNoDiffs ? root().mUsage : mUsage; } 156 145 157 146 /** … … 171 160 /** 172 161 * Returns @c true if this medium is attached to any VM in any snapshot. 173 * which case #usage() will contain a string with comma-sparated VM names.174 162 */ 175 163 bool isUsedInSnapshots() const { return mIsUsedInSnapshots; } 176 164 177 165 /** 178 * Returns @c true if this medium is attached to the given machine in the 179 * current state. 180 */ 181 bool isAttachedInCurStateTo (const QString &aMachineId) const 182 { return mCurStateMachineIds.indexOf (aMachineId) >= 0; } 166 * Returns @c true if this medium corresponds to real host drive. 167 */ 168 bool isHostDrive() const { return mIsHostDrive; } 169 170 /** 171 * Returns @c true if this medium is attached to the given machine in the current state. 172 */ 173 bool isAttachedInCurStateTo (const QString &aMachineId) const { return mCurStateMachineIds.indexOf (aMachineId) >= 0; } 183 174 184 175 /** … … 186 177 * to in their current state (i.e. excluding snapshots). 187 178 */ 188 const QList <QString> &curStateMachineIds() const 189 { return mCurStateMachineIds; } 179 const QList <QString> &curStateMachineIds() const { return mCurStateMachineIds; } 190 180 191 181 /** … … 196 186 VBoxMedium &root() const; 197 187 198 QString toolTip (bool aNoDiffs = false, bool aCheckRO = false) const;188 QString toolTip (bool aNoDiffs = false, bool aCheckRO = false) const; 199 189 QPixmap icon (bool aNoDiffs = false, bool aCheckRO = false) const; 200 190 201 191 /** Shortcut to <tt>#toolTip (aNoDiffs, true)</tt>. */ 202 QString toolTipCheckRO (bool aNoDiffs = false) const 203 { return toolTip (aNoDiffs, true); } 192 QString toolTipCheckRO (bool aNoDiffs = false) const { return toolTip (aNoDiffs, true); } 204 193 205 194 /** Shortcut to <tt>#icon (aNoDiffs, true)</tt>. */ 206 QPixmap iconCheckRO (bool aNoDiffs = false) const 207 { return icon (aNoDiffs, true); } 208 209 QString details (bool aNoDiffs = false, bool aPredictDiff = false, 210 bool aUseHTML = false) const; 195 QPixmap iconCheckRO (bool aNoDiffs = false) const { return icon (aNoDiffs, true); } 196 197 QString details (bool aNoDiffs = false, bool aPredictDiff = false, bool aUseHTML = false) const; 211 198 212 199 /** Shortcut to <tt>#details (aNoDiffs, aPredictDiff, true)</tt>. */ 213 QString detailsHTML (bool aNoDiffs = false, bool aPredictDiff = false) const 214 { return details (aNoDiffs, aPredictDiff, true); } 200 QString detailsHTML (bool aNoDiffs = false, bool aPredictDiff = false) const { return details (aNoDiffs, aPredictDiff, true); } 215 201 216 202 /** Returns @c true if this media descriptor is a null object. */ … … 219 205 private: 220 206 221 void init();222 223 207 void checkNoDiffs (bool aNoDiffs); 224 208 225 209 CMedium mMedium; 226 210 227 VBoxDefs::Medi aType mType;228 229 KMedi aState mState;211 VBoxDefs::MediumType mType; 212 213 KMediumState mState; 230 214 QString mLastAccessError; 231 215 COMResult mResult; 232 233 CHardDisk mHardDisk;234 CDVDImage mDVDImage;235 CFloppyImage mFloppyImage;236 216 237 217 QString mId; … … 249 229 bool mIsReadOnly : 1; 250 230 bool mIsUsedInSnapshots : 1; 231 bool mIsHostDrive : 1; 251 232 252 233 QList <QString> mCurStateMachineIds; … … 260 241 struct NoDiffs 261 242 { 262 NoDiffs() : isSet (false), state (KMedi aState_NotCreated) {}243 NoDiffs() : isSet (false), state (KMediumState_NotCreated) {} 263 244 264 245 bool isSet : 1; 265 246 266 KMedi aState state;247 KMediumState state; 267 248 COMResult result; 268 249 QString toolTip; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewHDWzd.h
r16867 r23223 39 39 VBoxNewHDWzd (QWidget *aParent = 0); 40 40 41 C HardDiskhardDisk() { return mHD; }41 CMedium hardDisk() { return mHD; } 42 42 void setRecommendedFileName (const QString &aName); 43 43 void setRecommendedSize (quint64 aSize); … … 66 66 67 67 QIWidgetValidator *mWValNameAndSize; 68 C HardDiskmHD;68 CMedium mHD; 69 69 int mSliderScale; 70 70 quint64 mMaxVDISize; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewVMWzd.h
r18080 r23223 69 69 QIWidgetValidator *mWvalMemory; 70 70 QIWidgetValidator *mWvalHDD; 71 C HardDiskmHardDisk;71 CMedium mHardDisk; 72 72 CMachine mMachine; 73 73 }; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r22434 r23223 239 239 int confirmDeleteHardDiskStorage (QWidget *aParent, 240 240 const QString &aLocation); 241 void cannotDeleteHardDiskStorage (QWidget *aParent, const C HardDisk&aHD,241 void cannotDeleteHardDiskStorage (QWidget *aParent, const CMedium &aHD, 242 242 const CProgress &aProgress); 243 243 244 244 int confirmDetachAddControllerSlots (QWidget *aParent) const; 245 245 int confirmChangeAddControllerSlots (QWidget *aParent) const; 246 int confirmRunNewHDWzdOrVDM ( QWidget* aParent);246 int confirmRunNewHDWzdOrVDM (KDeviceType aDeviceType); 247 247 248 248 void cannotCreateHardDiskStorage (QWidget *aParent, const CVirtualBox &aVBox, 249 249 const QString &aLocaiton, 250 const C HardDisk&aHD,250 const CMedium &aHD, 251 251 const CProgress &aProgress); 252 252 void cannotAttachHardDisk (QWidget *aParent, const CMachine &aMachine, … … 262 262 const VBoxMedium &aMedium, const COMResult &aResult); 263 263 void cannotOpenMedium (QWidget *aParent, const CVirtualBox &aVBox, 264 VBoxDefs::Medi aType aType, const QString &aLocation);264 VBoxDefs::MediumType aType, const QString &aLocation); 265 265 void cannotCloseMedium (QWidget *aParent, const VBoxMedium &aMedium, 266 266 const COMResult &aResult); … … 358 358 const QString &errorMsg) const; 359 359 360 static QString toAccusative (VBoxDefs::Medi aType aType);360 static QString toAccusative (VBoxDefs::MediumType aType); 361 361 362 362 static QString formatRC (HRESULT aRC); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h
r20052 r23223 26 26 #include <QGlobalStatic> /* for Q_WS_MAC */ 27 27 #ifdef Q_WS_MAC 28 # 28 #include "VBoxUtils.h" 29 29 #endif 30 30 … … 49 49 VBoxToolBar (QWidget *aParent) 50 50 : QToolBar (aParent) 51 , mMainWindow (qobject_cast <QMainWindow*> (aParent))51 , mMainWindow (qobject_cast <QMainWindow*> (aParent)) 52 52 { 53 53 setFloatable (false); 54 54 setMovable (false); 55 56 /* Remove that ugly frame panel around the toolbar. 57 * Doing that currently for Cleanlooks & Windows styles. */ 58 if (qobject_cast <QCleanlooksStyle*> (QToolBar::style()) || 59 qobject_cast <QWindowsStyle*> (QToolBar::style())) 60 setStyleSheet ("QToolBar { border: 0px none black; }"); 61 55 62 if (layout()) 56 63 layout()->setContentsMargins (0, 0, 0, 0);; 57 64 58 65 setContextMenuPolicy (Qt::NoContextMenu); 59 60 /* Remove that ugly frame panel around the toolbar. */61 /* I'm not sure if we should do this generally on linux for that mass62 * of KDE styles. But maybe some of them are based on CleanLooks so63 * they are looking ok also. */64 QStyle *style = NULL;65 if (!style)66 /* Check for cleanlooks style */67 style = qobject_cast<QCleanlooksStyle*> (QToolBar::style());68 if (!style)69 /* Check for windows style */70 style = qobject_cast<QWindowsStyle*> (QToolBar::style());71 if (style)72 setStyleSheet ("QToolBar { border: 0px none black; }");73 66 } 74 67 75 void setMacToolbar () 68 #ifdef Q_WS_MAC 69 void setMacToolbar() 76 70 { 77 #ifdef Q_WS_MAC78 71 if (mMainWindow) 79 72 { 80 73 mMainWindow->setUnifiedTitleAndToolBarOnMac (true); 81 # 74 #ifndef QT_MAC_USE_COCOA 82 75 WindowRef window = ::darwinToNativeWindow (this); 83 76 EventHandlerUPP eventHandler = ::NewEventHandlerUPP (VBoxToolBar::macEventFilter); … … 90 83 RT_ELEMENTS (eventTypes), eventTypes, 91 84 NULL, NULL); 92 # 85 #endif /* !QT_MAC_USE_COCOA */ 93 86 } 94 #endif /* Q_WS_MAC */95 87 } 96 88 97 #if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)89 #ifndef QT_MAC_USE_COCOA 98 90 static pascal OSStatus macEventFilter (EventHandlerCallRef aNextHandler, 99 91 EventRef aEvent, void * /* aUserData */) … … 117 109 return CallNextEventHandler (aNextHandler, aEvent); 118 110 } 119 #endif /* Q_WS_MAC &&!QT_MAC_USE_COCOA */111 #endif /* !QT_MAC_USE_COCOA */ 120 112 121 113 void setShowToolBarButton (bool aShow) 122 114 { 123 #ifdef Q_WS_MAC124 115 ::darwinSetShowsToolbarButton (this, aShow); 125 #else /* Q_WS_MAC */126 Q_UNUSED (aShow);127 #endif /* !Q_WS_MAC */128 116 } 117 #endif /* Q_WS_MAC */ 129 118 130 void setUsesTextLabel (bool enable)119 void setUsesTextLabel (bool aEnable) 131 120 { 132 121 Qt::ToolButtonStyle tbs = Qt::ToolButtonTextUnderIcon; 133 if (! enable)122 if (!aEnable) 134 123 tbs = Qt::ToolButtonIconOnly; 135 124 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMFirstRunWzd.h
r13580 r23223 57 57 QIWidgetValidator *mWvalType; 58 58 CMachine mMachine; 59 QVector <C HostDVDDrive>mHostDVDs;60 QVector <C HostFloppyDrive>mHostFloppys;59 QVector <CMedium> mHostDVDs; 60 QVector <CMedium> mHostFloppys; 61 61 }; 62 62 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
r19837 r23223 6 6 7 7 /* 8 * Copyright (C) 2006-200 8Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #define __VBoxVMSettingsHD_h__ 25 25 26 /* Global includes */ 27 #include <QItemDelegate> 28 #include <QPointer> 29 30 /* Local includes */ 26 31 #include "VBoxSettingsPage.h" 27 32 #include "VBoxVMSettingsHD.gen.h" 28 33 #include "COMDefs.h" 29 #include "VBoxMediaComboBox.h" 30 31 /* Qt includes */ 32 #include <QComboBox> 33 34 /** Register type to store slot data */ 35 class SlotValue 36 { 37 public: 38 SlotValue() 39 : bus (KStorageBus_Null), channel (0), device (0) 40 , name (QString::null) {} 41 SlotValue (KStorageBus aBus, LONG aChannel, LONG aDevice) 42 : bus (aBus), channel (aChannel), device (aDevice) 43 , name (vboxGlobal().toFullString (aBus, aChannel, aDevice)) {} 44 SlotValue (const SlotValue &aOther) 45 : bus (aOther.bus), channel (aOther.channel), device (aOther.device) 46 , name (aOther.name) {} 47 48 SlotValue& operator= (const SlotValue &aOther) 34 35 /* Local forwardes */ 36 class AttachmentItem; 37 class ControllerItem; 38 39 /* Internal Types */ 40 typedef QList <StorageSlot> SlotsList; 41 typedef QList <KDeviceType> DeviceTypeList; 42 typedef QList <KStorageControllerType> ControllerTypeList; 43 Q_DECLARE_METATYPE (SlotsList); 44 Q_DECLARE_METATYPE (DeviceTypeList); 45 Q_DECLARE_METATYPE (ControllerTypeList); 46 47 /* Pixmap Storage Pool */ 48 class PixmapPool : public QObject 49 { 50 Q_OBJECT; 51 52 public: 53 54 enum PixmapType 49 55 { 50 bus = aOther.bus; 51 channel = aOther.channel; 52 device = aOther.device; 53 name = aOther.name; 54 return *this; 55 } 56 57 bool operator== (const SlotValue &aOther) 56 InvalidPixmap = -1, 57 58 AddControllerEn = 0, 59 AddControllerDis = 1, 60 DelControllerEn = 2, 61 DelControllerDis = 3, 62 63 AddAttachmentEn = 4, 64 AddAttachmentDis = 5, 65 DelAttachmentEn = 6, 66 DelAttachmentDis = 7, 67 68 IDEController = 8, 69 SATAController = 9, 70 SCSIController = 10, 71 FloppyController = 11, 72 73 HDAttachmentEn = 12, 74 HDAttachmentDis = 13, 75 CDAttachmentEn = 14, 76 CDAttachmentDis = 15, 77 FDAttachmentEn = 16, 78 FDAttachmentDis = 17, 79 80 PlusEn = 18, 81 PlusDis = 19, 82 MinusEn = 20, 83 MinusDis = 21, 84 85 UnknownEn = 22, 86 87 VMMEn = 23, 88 VMMDis = 24, 89 90 MaxIndex 91 }; 92 93 static PixmapPool* pool (QObject *aParent = 0); 94 95 QPixmap pixmap (PixmapType aType) const; 96 97 protected: 98 99 PixmapPool (QObject *aParent); 100 101 static QPointer <PixmapPool> mThis; 102 103 private: 104 105 QVector <QPixmap> mPool; 106 }; 107 108 /* Abstract Controller Type */ 109 class AbstractControllerType 110 { 111 public: 112 113 AbstractControllerType (KStorageBus aBusType, KStorageControllerType aCtrType); 114 virtual ~AbstractControllerType() {} 115 116 KStorageBus busType() const; 117 KStorageControllerType ctrType() const; 118 ControllerTypeList ctrTypes() const; 119 PixmapPool::PixmapType pixmap() const; 120 121 void setCtrType (KStorageControllerType aCtrType); 122 123 virtual DeviceTypeList deviceTypeList() const = 0; 124 125 protected: 126 127 virtual KStorageControllerType first() const = 0; 128 virtual uint size() const = 0; 129 130 KStorageBus mBusType; 131 KStorageControllerType mCtrType; 132 PixmapPool::PixmapType mPixmap; 133 }; 134 135 /* IDE Controller Type */ 136 class IDEControllerType : public AbstractControllerType 137 { 138 public: 139 140 IDEControllerType (KStorageControllerType aSubType); 141 142 private: 143 144 DeviceTypeList deviceTypeList() const; 145 146 KStorageControllerType first() const; 147 uint size() const; 148 }; 149 150 /* SATA Controller Type */ 151 class SATAControllerType : public AbstractControllerType 152 { 153 public: 154 155 SATAControllerType (KStorageControllerType aSubType); 156 157 private: 158 159 DeviceTypeList deviceTypeList() const; 160 161 KStorageControllerType first() const; 162 uint size() const; 163 }; 164 165 /* SCSI Controller Type */ 166 class SCSIControllerType : public AbstractControllerType 167 { 168 public: 169 170 SCSIControllerType (KStorageControllerType aSubType); 171 172 private: 173 174 DeviceTypeList deviceTypeList() const; 175 176 KStorageControllerType first() const; 177 uint size() const; 178 }; 179 180 /* Floppy Controller Type */ 181 class FloppyControllerType : public AbstractControllerType 182 { 183 public: 184 185 FloppyControllerType (KStorageControllerType aSubType); 186 187 private: 188 189 DeviceTypeList deviceTypeList() const; 190 191 KStorageControllerType first() const; 192 uint size() const; 193 }; 194 195 /* Abstract Item */ 196 class AbstractItem 197 { 198 public: 199 200 enum ItemType 58 201 { 59 return bus == aOther.bus && 60 channel == aOther.channel && 61 device == aOther.device; 62 } 63 64 bool operator!= (const SlotValue &aOther) 202 Type_InvalidItem = 0, 203 Type_RootItem = 1, 204 Type_ControllerItem = 2, 205 Type_AttachmentItem = 3 206 }; 207 208 AbstractItem (AbstractItem *aParent = 0); 209 virtual ~AbstractItem(); 210 211 AbstractItem* parent(); 212 QUuid id(); 213 214 virtual ItemType rtti() const = 0; 215 virtual AbstractItem* childByPos (int aIndex) = 0; 216 virtual AbstractItem* childById (const QUuid &aId) = 0; 217 virtual int posOfChild (AbstractItem *aItem) const = 0; 218 virtual int childCount() const = 0; 219 virtual QString text() const = 0; 220 virtual QString tip() const = 0; 221 virtual QPixmap pixmap() = 0; 222 223 protected: 224 225 virtual void addChild (AbstractItem *aItem) = 0; 226 virtual void delChild (AbstractItem *aItem) = 0; 227 228 AbstractItem *mParent; 229 QUuid mId; 230 }; 231 Q_DECLARE_METATYPE (AbstractItem::ItemType); 232 233 /* Root Item */ 234 class RootItem : public AbstractItem 235 { 236 public: 237 238 RootItem(); 239 ~RootItem(); 240 241 ItemType rtti() const; 242 AbstractItem* childByPos (int aIndex); 243 AbstractItem* childById (const QUuid &aId); 244 int posOfChild (AbstractItem *aItem) const; 245 int childCount() const; 246 QString text() const; 247 QString tip() const; 248 QPixmap pixmap(); 249 250 private: 251 252 void addChild (AbstractItem *aItem); 253 void delChild (AbstractItem *aItem); 254 255 QList <AbstractItem*> mControllers; 256 }; 257 258 /* Controller Item */ 259 class ControllerItem : public AbstractItem 260 { 261 public: 262 263 ControllerItem (AbstractItem *aParent, const QString &aName, KStorageBus aBusType, 264 KStorageControllerType aControllerType); 265 ~ControllerItem(); 266 267 ItemType rtti() const; 268 AbstractItem* childByPos (int aIndex); 269 AbstractItem* childById (const QUuid &aId); 270 int posOfChild (AbstractItem *aItem) const; 271 int childCount() const; 272 QString text() const; 273 QString tip() const; 274 QPixmap pixmap(); 275 276 KStorageBus ctrBusType() const; 277 QString ctrName() const; 278 KStorageControllerType ctrType() const; 279 ControllerTypeList ctrTypes() const; 280 281 void setCtrName (const QString &aCtrName); 282 void setCtrType (KStorageControllerType aCtrType); 283 284 SlotsList ctrAllSlots() const; 285 SlotsList ctrUsedSlots() const; 286 DeviceTypeList ctrDeviceTypeList() const; 287 QStringList ctrAllMediumIds() const; 288 QStringList ctrUsedMediumIds() const; 289 290 private: 291 292 void addChild (AbstractItem *aItem); 293 void delChild (AbstractItem *aItem); 294 295 QString mCtrName; 296 AbstractControllerType *mCtrType; 297 QList <AbstractItem*> mAttachments; 298 }; 299 300 /* Attachment Item */ 301 class AttachmentItem : public AbstractItem 302 { 303 public: 304 305 AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType); 306 307 ItemType rtti() const; 308 AbstractItem* childByPos (int aIndex); 309 AbstractItem* childById (const QUuid &aId); 310 int posOfChild (AbstractItem *aItem) const; 311 int childCount() const; 312 QString text() const; 313 QString tip() const; 314 QPixmap pixmap(); 315 316 StorageSlot attSlot() const; 317 SlotsList attSlots() const; 318 KDeviceType attDeviceType() const; 319 DeviceTypeList attDeviceTypes() const; 320 QString attMediumId() const; 321 QStringList attMediumIds (bool aFilter = true) const; 322 bool attIsHostDrive() const; 323 bool attIsPassthrough() const; 324 325 void setAttSlot (const StorageSlot &aAttSlot); 326 void setAttDevice (KDeviceType aAttDeviceType); 327 void setAttMediumId (const QString &aAttMediumId); 328 void setAttIsPassthrough (bool aPassthrough); 329 330 QString attSize() const; 331 QString attLogicalSize() const; 332 QString attLocation() const; 333 QString attFormat() const; 334 QString attUsage() const; 335 336 private: 337 338 void cache (const VBoxMedium &aMedium); 339 340 void addChild (AbstractItem *aItem); 341 void delChild (AbstractItem *aItem); 342 343 KDeviceType mAttDeviceType; 344 345 StorageSlot mAttSlot; 346 QString mAttMediumId; 347 bool mAttIsHostDrive; 348 bool mAttIsPassthrough; 349 350 QString mAttName; 351 QString mAttTip; 352 QPixmap mAttPixmap; 353 354 QString mAttSize; 355 QString mAttLogicalSize; 356 QString mAttLocation; 357 QString mAttFormat; 358 QString mAttUsage; 359 }; 360 361 /* Storage Model */ 362 class StorageModel : public QAbstractItemModel 363 { 364 Q_OBJECT; 365 366 public: 367 368 enum DataRole 65 369 { 66 return ! (*this == aOther); 67 } 68 69 KStorageBus bus; 70 LONG channel; 71 LONG device; 72 QString name; 73 }; 74 Q_DECLARE_METATYPE (SlotValue); 75 76 /** Register type to store disk data */ 77 class DiskValue 78 { 79 public: 80 DiskValue() 81 : id (QString::null) 82 , name (QString::null), tip (QString::null), pix (QPixmap()) {} 83 DiskValue (const QString &aId); 84 DiskValue (const DiskValue &aOther) 85 : id (aOther.id) 86 , name (aOther.name), tip (aOther.tip), pix (aOther.pix) {} 87 88 DiskValue& operator= (const DiskValue &aOther) 89 { 90 id = aOther.id; 91 name = aOther.name; 92 tip = aOther.tip; 93 pix = aOther.pix; 94 return *this; 95 } 96 97 bool operator== (const DiskValue &aOther) 98 { 99 return id == aOther.id; 100 } 101 102 bool operator!= (const DiskValue &aOther) 103 { 104 return ! (*this == aOther); 105 } 106 107 QString id; 108 QString name; 109 QString tip; 110 QPixmap pix; 111 }; 112 Q_DECLARE_METATYPE (DiskValue); 113 114 /** Declare type to store both slot&disk data */ 115 class Attachment 116 { 117 public: 118 Attachment (SlotValue aSlot, DiskValue aDisk) 119 : slot (aSlot), disk (aDisk) {} 120 121 /* Define sorting rules */ 122 bool operator< (const Attachment &aOther) const 123 { 124 return (slot.bus < aOther.slot.bus) || 125 (slot.bus == aOther.slot.bus && slot.channel < aOther.slot.channel) || 126 (slot.bus == aOther.slot.bus && slot.channel == aOther.slot.channel && slot.device < aOther.slot.device); 127 } 128 129 SlotValue slot; 130 DiskValue disk; 131 }; 132 133 /** 134 * QAbstractTableModel class reimplementation. 135 * Used to feat slot/disk selection mechanism. 136 */ 137 class AttachmentsModel : public QAbstractTableModel 370 R_ItemId = Qt::UserRole + 1, 371 R_ItemPixmap, 372 R_ItemPixmapRect, 373 R_ItemName, 374 R_ItemNamePoint, 375 R_ItemType, 376 R_IsController, 377 R_IsAttachment, 378 379 R_IsMoreControllersPossible, 380 R_IsMoreAttachmentsPossible, 381 382 R_CtrName, 383 R_CtrType, 384 R_CtrTypes, 385 R_CtrDevices, 386 R_CtrBusType, 387 388 R_AttSlot, 389 R_AttSlots, 390 R_AttDevice, 391 R_AttDevices, 392 R_AttMediumId, 393 R_AttIsHostDrive, 394 R_AttIsPassthrough, 395 R_AttSize, 396 R_AttLogicalSize, 397 R_AttLocation, 398 R_AttFormat, 399 R_AttUsage, 400 401 R_Margin, 402 R_Spacing, 403 R_IconSize, 404 405 R_HDPixmapEn, 406 R_HDPixmapDis, 407 R_CDPixmapEn, 408 R_CDPixmapDis, 409 R_FDPixmapEn, 410 R_FDPixmapDis, 411 R_HDPixmapRect, 412 R_CDPixmapRect, 413 R_FDPixmapRect, 414 415 R_PlusPixmapEn, 416 R_PlusPixmapDis, 417 R_MinusPixmapEn, 418 R_MinusPixmapDis, 419 R_AdderPoint 420 }; 421 422 StorageModel (QObject *aParent); 423 ~StorageModel(); 424 425 int rowCount (const QModelIndex &aParent = QModelIndex()) const; 426 int columnCount (const QModelIndex &aParent = QModelIndex()) const; 427 428 QModelIndex root() const; 429 QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const; 430 QModelIndex parent (const QModelIndex &aIndex) const; 431 432 QVariant data (const QModelIndex &aIndex, int aRole) const; 433 bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole); 434 435 QModelIndex addController (const QString &aCtrName, KStorageBus aBusType, KStorageControllerType aCtrType); 436 void delController (const QUuid &aCtrId); 437 438 QModelIndex addAttachment (const QUuid &aCtrId, KDeviceType aDeviceType); 439 void delAttachment (const QUuid &aCtrId, const QUuid &aAttId); 440 441 private: 442 443 Qt::ItemFlags flags (const QModelIndex &aIndex) const; 444 445 AbstractItem *mRootItem; 446 447 QPixmap mPlusPixmapEn; 448 QPixmap mPlusPixmapDis; 449 450 QPixmap mMinusPixmapEn; 451 QPixmap mMinusPixmapDis; 452 }; 453 454 /* Storage Delegate */ 455 class StorageDelegate : public QItemDelegate 138 456 { 139 457 Q_OBJECT; … … 141 459 public: 142 460 143 AttachmentsModel (QITableView *aParent, int aSlotId, int aDiskId) 144 : QAbstractTableModel (aParent), mParent (aParent) 145 , mSlotId (aSlotId), mDiskId (aDiskId) {} 146 147 Qt::ItemFlags flags (const QModelIndex &aIndex) const; 148 149 int columnCount (const QModelIndex &aParent = QModelIndex()) const 150 { NOREF (aParent); return 2; } 151 int rowCount (const QModelIndex &aParent = QModelIndex()) const 152 { NOREF (aParent); return mUsedSlotsList.count() + 1; } 153 154 QVariant data (const QModelIndex &aIndex, 155 int aRole = Qt::DisplayRole) const; 156 bool setData (const QModelIndex &aIndex, 157 const QVariant &aValue, 158 int aRole = Qt::EditRole); 159 QVariant headerData (int aSection, 160 Qt::Orientation aOrientation, 161 int aRole = Qt::DisplayRole) const; 162 163 void addItem (const SlotValue &aSlot = SlotValue(), 164 const DiskValue &aDisk = DiskValue()); 165 void delItem (int aIndex); 166 167 const QList<SlotValue>& usedSlotsList() { return mUsedSlotsList; } 168 const QList<DiskValue>& usedDisksList() { return mUsedDisksList; } 169 QList<Attachment> fullUsedList(); 170 171 void removeAddController(); 172 void updateDisks(); 173 174 private: 175 176 QITableView *mParent; 177 QList<SlotValue> mUsedSlotsList; 178 QList<DiskValue> mUsedDisksList; 179 int mSlotId; 180 int mDiskId; 181 }; 182 183 /** 184 * QComboBox class reimplementation. 185 * Used as editor for HD Attachment SLOT field. 186 */ 187 class SlotEditor : public QComboBox 188 { 189 Q_OBJECT; 190 Q_PROPERTY (QVariant slot READ slot WRITE setSlot USER true); 191 192 public: 193 194 SlotEditor (QWidget *aParent); 195 196 QVariant slot() const; 197 void setSlot (QVariant aSlot); 198 199 signals: 200 201 void readyToCommit (QWidget *aThis); 202 203 private slots: 204 205 void onActivate(); 206 207 private: 208 209 #if 0 /* F2 key binding left for future releases... */ 210 void keyPressEvent (QKeyEvent *aEvent); 211 #endif 212 213 void populate (const SlotValue &aIncluding); 214 215 QList<SlotValue> mList; 216 }; 217 218 /** 219 * VBoxMediaComboBox class reimplementation. 220 * Used as editor for HD Attachment DISK field. 221 */ 222 class DiskEditor : public VBoxMediaComboBox 223 { 224 Q_OBJECT; 225 Q_PROPERTY (QVariant disk READ disk WRITE setDisk USER true); 226 227 public: 228 229 static DiskEditor* activeEditor(); 230 231 DiskEditor (QWidget *aParent); 232 ~DiskEditor(); 233 234 QVariant disk() const; 235 void setDisk (QVariant aDisk); 236 237 signals: 238 239 void readyToCommit (QWidget *aThis); 240 241 protected: 242 243 void paintEvent (QPaintEvent *aEvent); 244 void initStyleOption (QStyleOptionComboBox *aOption) const; 245 246 private slots: 247 248 void onActivate(); 249 250 private: 251 252 #if 0 /* F2 key binding left for future releases... */ 253 void keyPressEvent (QKeyEvent *aEvent); 254 #endif 255 256 static DiskEditor *mInstance; 257 }; 258 259 /** 260 * Singleton QObject class reimplementation. 261 * Used to make selected HD Attachments slots unique & 262 * stores some specific data used for HD Settings. 263 */ 264 class HDSettings : public QObject 265 { 266 Q_OBJECT; 267 268 public: 269 270 static HDSettings* instance (QWidget *aParent = 0, 271 AttachmentsModel *aWatched = 0); 272 273 QList<SlotValue> slotsList (const SlotValue &aIncluding = SlotValue(), 274 bool aFilter = false) const; 275 QList<DiskValue> disksList() const; 276 277 bool tryToChooseUniqueDisk (DiskValue &aResult) const; 278 279 const CMachine& machine() const { return mMachine; } 280 void setMachine (const CMachine &aMachine) { mMachine = aMachine; } 281 282 int addCount() const { return mAddCount; } 283 void setAddCount (int aAddCount, KStorageBus aAddBus) 284 { 285 if (mAddCount != aAddCount || 286 aAddBus != mAddBus) 287 { 288 mAddCount = aAddCount; 289 mAddBus = aAddBus; 290 makeAddControllerList(); 291 } 292 } 293 294 bool showDiffs() const { return mShowDiffs; } 295 void setShowDiffs (bool aShowDiffs) 296 { 297 mShowDiffs = aShowDiffs; 298 update(); 299 } 300 301 protected: 302 303 HDSettings (QWidget *aParent, AttachmentsModel *aWatched); 304 virtual ~HDSettings(); 305 306 private slots: 307 308 void update() 309 { 310 makeMediumList(); 311 mModel->updateDisks(); 312 } 313 314 private: 315 316 void makeIDEList(); 317 void makeAddControllerList(); 318 void makeMediumList(); 319 320 321 static HDSettings *mInstance; 322 323 AttachmentsModel *mModel; 324 CMachine mMachine; 325 326 QList<SlotValue> mIDEList; 327 QList<SlotValue> mAddControllerList; 328 QList<DiskValue> mDisksList; 329 330 int mAddCount; 331 KStorageBus mAddBus; 332 bool mShowDiffs; 461 StorageDelegate (QObject *aParent); 462 463 private: 464 465 void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const; 333 466 }; 334 467 … … 348 481 signals: 349 482 350 void hdChanged();483 void mediumChanged(); 351 484 352 485 protected: … … 358 491 bool revalidate (QString &aWarning, QString &aTitle); 359 492 360 void setOrderAfter (QWidget *aWidget);361 362 493 void retranslateUi(); 363 494 495 void showEvent (QShowEvent *aEvent); 496 364 497 private slots: 365 498 366 void addAttachment(); 499 void addController(); 500 void addIDEController(); 501 void addSATAController(); 502 void addSCSIController(); 503 void addFloppyController(); 504 void delController(); 505 506 void addAttachment (KDeviceType aDeviceType = KDeviceType_Null); 367 507 void delAttachment(); 368 void showMediaManager(); 369 370 void onAddControllerCheckToggled (int); 371 void onAddControllerTypeChanged (int aIndex); 372 bool checkAddControllers (int aWhat); 373 void onShowDiffsCheckToggled (int); 374 375 void updateActions (const QModelIndex &aIndex); 376 377 private: 378 379 /* events */ 380 bool eventFilter (QObject *aObj, QEvent *aEvent); 381 void showEvent (QShowEvent *aEvent); 382 383 /* private functions */ 384 QString getWithMediaManager (const QString &aInitialId = QString::null); 508 509 void getInformation(); 510 void setInformation(); 511 512 void onVmmInvoked(); 513 514 void updateActionsState(); 515 516 void onRowInserted (const QModelIndex &aParent, int aIndex); 517 void onRowRemoved(); 518 519 void onCurrentItemChanged(); 520 521 void onContextMenuRequested (const QPoint &aPosition); 522 523 void onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex); 524 525 void onMouseClicked (QMouseEvent *aEvent); 526 527 private: 528 385 529 QString getWithNewHDWizard(); 386 int maxNameLength() const; 387 void removeFocus(); 388 KStorageControllerType currentControllerType() const 389 { 390 return static_cast<KStorageControllerType> (mCbControllerType->itemData (mCbControllerType->currentIndex()).toInt()); 391 } 392 KStorageBus currentBusType() const 393 { 394 return vboxGlobal().toStorageBusType (currentControllerType()); 395 } 396 int currentMaxPortCount() const 397 { 398 int c = 0; 399 switch (currentBusType()) 400 { 401 case KStorageBus_IDE: c = 2; break; 402 case KStorageBus_SATA: c = 30; break; 403 case KStorageBus_SCSI: c = 16; break; 404 default: break; 405 } 406 return c; 407 } 408 409 /* variables */ 530 QString getWithMediaManager (VBoxDefs::MediumType aMediumType); 531 532 void updateAdditionalObjects (KDeviceType aType); 533 410 534 CMachine mMachine; 411 AttachmentsModel *mModel;412 535 QIWidgetValidator *mValidator; 413 536 414 QAction *mNewAction; 415 QAction *mDelAction; 416 QAction *mVdmAction; 417 418 bool mWasTableSelected; 419 bool mPolished; 420 421 int mLastSelAddControllerIndex; 537 StorageModel *mStorageModel; 538 539 QAction *mAddCtrAction; 540 QAction *mAddIDECtrAction; 541 QAction *mAddSATACtrAction; 542 QAction *mAddSCSICtrAction; 543 QAction *mAddFloppyCtrAction; 544 QAction *mDelCtrAction; 545 QAction *mAddAttAction; 546 QAction *mDelAttAction; 547 548 bool mIsLoadingInProgress; 549 bool mIsPolished; 422 550 }; 423 551
Note:
See TracChangeset
for help on using the changeset viewer.