Changeset 72626 in vbox
- Timestamp:
- Jun 20, 2018 1:28:15 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123128
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r72435 r72626 185 185 186 186 /** Constructs translator passing @a pParent to the base-class. */ 187 VBoxTranslator (QObject * aParent = 0)188 : QTranslator ( aParent) {}187 VBoxTranslator (QObject *pParent = 0) 188 : QTranslator (pParent) {} 189 189 190 190 /** Loads language file with gained @a strFileName. */ 191 bool loadFile (const QString & aFileName)192 { 193 QFile file ( aFileName);191 bool loadFile (const QString &strFileName) 192 { 193 QFile file (strFileName); 194 194 if (!file.open (QIODevice::ReadOnly)) 195 195 return false; 196 m Data = file.readAll();197 return load ((uchar*) mData.data(), mData.size());196 m_data = file.readAll(); 197 return load ((uchar*)m_data.data(), m_data.size()); 198 198 } 199 199 … … 201 201 202 202 /** Holds the loaded data. */ 203 QByteArray m Data;203 QByteArray m_data; 204 204 }; 205 205 … … 240 240 /* static */ 241 241 VBoxGlobal *VBoxGlobal::s_pInstance = 0; 242 bool VBoxGlobal::s_fClean upInProgress= false;242 bool VBoxGlobal::s_fCleaningUp = false; 243 243 QString VBoxGlobal::s_strLoadedLanguageId = vboxBuiltInLanguageName(); 244 244 … … 290 290 #ifndef VBOX_GUI_WITH_SHARED_LIBRARY 291 291 VBoxGlobal::VBoxGlobal() 292 : m Valid(false)292 : m_fValid(false) 293 293 #else 294 294 VBoxGlobal::VBoxGlobal(UIType enmType) 295 295 : m_enmType(enmType) 296 , m Valid(false)296 , m_fValid(false) 297 297 #endif 298 298 #ifdef VBOX_WS_MAC 299 , m_ osRelease(MacOSXRelease_Old)299 , m_enmMacOSVersion(MacOSXRelease_Old) 300 300 #endif 301 301 #ifdef VBOX_WS_X11 … … 304 304 #endif 305 305 , m_fSeparateProcess(false) 306 , m ShowStartVMErrors(true)306 , m_fShowStartVMErrors(true) 307 307 #if defined(DEBUG_bird) 308 , m AgressiveCaching(false)308 , m_fAgressiveCaching(false) 309 309 #else 310 , m AgressiveCaching(true)310 , m_fAgressiveCaching(true) 311 311 #endif 312 , m RestoreCurrentSnapshot(false)313 , m DisablePatm(false)314 , m DisableCsam(false)315 , m RecompileSupervisor(false)316 , m RecompileUser(false)317 , m ExecuteAllInIem(false)318 , m WarpPct(100)312 , m_fRestoreCurrentSnapshot(false) 313 , m_fDisablePatm(false) 314 , m_fDisableCsam(false) 315 , m_fRecompileSupervisor(false) 316 , m_fRecompileUser(false) 317 , m_fExecuteAllInIem(false) 318 , m_uWarpPct(100) 319 319 #ifdef VBOX_WITH_DEBUGGER_GUI 320 320 , m_fDbgEnabled(0) … … 323 323 , m_fDbgAutoShowStatistics(0) 324 324 , m_hVBoxDbg(NIL_RTLDRMOD) 325 , m_enm StartRunning(StartRunning_Default)325 , m_enmLaunchRunning(LaunchRunning_Default) 326 326 #endif 327 , m SettingsPwSet(false)327 , m_fSettingsPwSet(false) 328 328 , m_fWrappersValid(false) 329 329 , m_fVBoxSVCAvailable(true) 330 , m 3DAvailable(-1)330 , m_i3DAvailable(-1) 331 331 , m_pThreadPool(0) 332 332 , m_pIconPool(0) … … 352 352 uint VBoxGlobal::qtRTVersion() 353 353 { 354 QString rt_ver_str= VBoxGlobal::qtRTVersionString();355 return ( rt_ver_str.section ('.', 0, 0).toInt() << 16) +356 ( rt_ver_str.section ('.', 1, 1).toInt() << 8) +357 rt_ver_str.section ('.', 2, 2).toInt();354 QString strVersionRT = VBoxGlobal::qtRTVersionString(); 355 return (strVersionRT.section ('.', 0, 0).toInt() << 16) + 356 (strVersionRT.section ('.', 1, 1).toInt() << 8) + 357 strVersionRT.section ('.', 2, 2).toInt(); 358 358 } 359 359 … … 367 367 uint VBoxGlobal::qtCTVersion() 368 368 { 369 QString ct_ver_str= VBoxGlobal::qtCTVersionString();370 return ( ct_ver_str.section('.', 0, 0).toInt() << 16) +371 ( ct_ver_str.section('.', 1, 1).toInt() << 8) +372 ct_ver_str.section('.', 2, 2).toInt();369 QString strVersionCompiled = VBoxGlobal::qtCTVersionString(); 370 return (strVersionCompiled.section('.', 0, 0).toInt() << 16) + 371 (strVersionCompiled.section('.', 1, 1).toInt() << 8) + 372 strVersionCompiled.section('.', 2, 2).toInt(); 373 373 } 374 374 375 375 QString VBoxGlobal::vboxVersionString() const 376 376 { 377 return m_ vbox.GetVersion();377 return m_comVBox.GetVersion(); 378 378 } 379 379 380 380 QString VBoxGlobal::vboxVersionStringNormalized() const 381 381 { 382 return m_ vbox.GetVersionNormalized();382 return m_comVBox.GetVersionNormalized(); 383 383 } 384 384 385 385 bool VBoxGlobal::isBeta() const 386 386 { 387 return m_vbox.GetVersion().contains("BETA", Qt::CaseInsensitive);387 return vboxVersionString().contains("BETA", Qt::CaseInsensitive); 388 388 } 389 389 … … 416 416 #endif /* VBOX_WS_MAC */ 417 417 418 bool VBoxGlobal::brandingIsActive (bool aForce /* = false */)419 { 420 if ( aForce)418 bool VBoxGlobal::brandingIsActive (bool fForce /* = false */) 419 { 420 if (fForce) 421 421 return true; 422 422 423 if (m BrandingConfig.isEmpty())424 { 425 m BrandingConfig= QDir(QApplication::applicationDirPath()).absolutePath();426 m BrandingConfig+= "/custom/custom.ini";427 } 428 return QFile::exists (m BrandingConfig);429 } 430 431 QString VBoxGlobal::brandingGetKey (QString aKey)432 { 433 QSettings s (mBrandingConfig, QSettings::IniFormat);434 return s .value(QString("%1").arg(aKey)).toString();423 if (m_strBrandingConfigFilePath.isEmpty()) 424 { 425 m_strBrandingConfigFilePath = QDir(QApplication::applicationDirPath()).absolutePath(); 426 m_strBrandingConfigFilePath += "/custom/custom.ini"; 427 } 428 return QFile::exists (m_strBrandingConfigFilePath); 429 } 430 431 QString VBoxGlobal::brandingGetKey (QString strKey) 432 { 433 QSettings settings(m_strBrandingConfigFilePath, QSettings::IniFormat); 434 return settings.value(QString("%1").arg(strKey)).toString(); 435 435 } 436 436 … … 450 450 QStringList args = qApp->arguments(); 451 451 /* We are looking for a list of file URLs passed to the executable: */ 452 QList<QUrl> list ;452 QList<QUrl> listArgUrls; 453 453 for (int i = 1; i < args.size(); ++i) 454 454 { … … 465 465 if ( !strArg.isEmpty() 466 466 && QFile::exists(strArg)) 467 list << QUrl::fromLocalFile(strArg);467 listArgUrls << QUrl::fromLocalFile(strArg); 468 468 } 469 469 /* If there are file URLs: */ 470 if (!list .isEmpty())470 if (!listArgUrls.isEmpty()) 471 471 { 472 472 /* We enumerate them and: */ 473 for (int i = 0; i < list .size(); ++i)473 for (int i = 0; i < listArgUrls.size(); ++i) 474 474 { 475 475 /* Check which of them has allowed VM extensions: */ 476 const QString& strFile = list .at(i).toLocalFile();476 const QString& strFile = listArgUrls.at(i).toLocalFile(); 477 477 if (VBoxGlobal::hasAllowedExtension(strFile, VBoxFileExts)) 478 478 { 479 479 /* So that we could run existing VMs: */ 480 CVirtualBox vbox = virtualBox();481 CMachine machine = vbox.FindMachine(strFile);482 if (! machine.isNull())480 CVirtualBox comVBox = virtualBox(); 481 CMachine comMachine = comVBox.FindMachine(strFile); 482 if (!comMachine.isNull()) 483 483 { 484 484 fResult = true; 485 launchMachine( machine);485 launchMachine(comMachine); 486 486 /* And remove their URLs from the ULR list: */ 487 list .removeAll(strFile);487 listArgUrls.removeAll(strFile); 488 488 } 489 489 } … … 491 491 } 492 492 /* And if there are *still* URLs: */ 493 if (!list .isEmpty())493 if (!listArgUrls.isEmpty()) 494 494 { 495 495 /* We store them: */ 496 m_ ArgUrlList = list;496 m_listArgUrls = listArgUrls; 497 497 /* And ask UIStarter to open them: */ 498 498 emit sigAskToOpenURLs(); … … 528 528 { 529 529 #ifdef VBOX_WITH_DEBUGGER_GUI 530 return m_enm StartRunning == StartRunning_Default ? isDebuggerAutoShowEnabled() : m_enmStartRunning == StartRunning_No;530 return m_enmLaunchRunning == LaunchRunning_Default ? isDebuggerAutoShowEnabled() : m_enmLaunchRunning == LaunchRunning_No; 531 531 #else 532 532 return false; … … 538 538 void VBoxGlobal::createPidfile() 539 539 { 540 if (!m_strPid file.isEmpty())541 { 542 qint64 pid = qApp->applicationPid();543 QFile file(m_strPid file);540 if (!m_strPidFile.isEmpty()) 541 { 542 qint64 iPid = qApp->applicationPid(); 543 QFile file(m_strPidFile); 544 544 if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) 545 545 { 546 546 QTextStream out(&file); 547 out << pid << endl;547 out << iPid << endl; 548 548 } 549 549 else 550 LogRel(("Failed to create pid file %s\n", m_strPid file.toUtf8().constData()));550 LogRel(("Failed to create pid file %s\n", m_strPidFile.toUtf8().constData())); 551 551 } 552 552 } … … 554 554 void VBoxGlobal::deletePidfile() 555 555 { 556 if ( !m_strPid file.isEmpty()557 && QFile::exists(m_strPid file))558 QFile::remove(m_strPid file);556 if ( !m_strPidFile.isEmpty() 557 && QFile::exists(m_strPidFile)) 558 QFile::remove(m_strPidFile); 559 559 } 560 560 … … 665 665 return ::darwinSystemLanguage(); 666 666 #elif defined (Q_OS_UNIX) 667 const char * s= RTEnvGet ("LC_ALL");668 if ( s== 0)669 s= RTEnvGet ("LC_MESSAGES");670 if ( s== 0)671 s= RTEnvGet ("LANG");672 if ( s!= 0)673 return QLocale ( s).name();667 const char *pszValue = RTEnvGet ("LC_ALL"); 668 if (pszValue == 0) 669 pszValue = RTEnvGet ("LC_MESSAGES"); 670 if (pszValue == 0) 671 pszValue = RTEnvGet ("LANG"); 672 if (pszValue != 0) 673 return QLocale (pszValue).name(); 674 674 #endif 675 675 return QLocale::system().name(); … … 677 677 678 678 /* static */ 679 void VBoxGlobal::loadLanguage (const QString & aLangId)680 { 681 QString langId = aLangId.isEmpty() ?682 VBoxGlobal::systemLanguageId() : aLangId;683 QString languageFileName;684 QString s electedLangId = vboxBuiltInLanguageName();679 void VBoxGlobal::loadLanguage (const QString &strLangId) 680 { 681 QString strEffectiveLangId = strLangId.isEmpty() ? 682 VBoxGlobal::systemLanguageId() : strLangId; 683 QString strLanguageFileName; 684 QString strSelectedLangId = vboxBuiltInLanguageName(); 685 685 686 686 /* If C is selected we change it temporary to en. This makes sure any extra … … 688 688 * plural forms of some of our translations. */ 689 689 bool fResetToC = false; 690 if ( langId == "C")691 { 692 langId = "en";690 if (strEffectiveLangId == "C") 691 { 692 strEffectiveLangId = "en"; 693 693 fResetToC = true; 694 694 } … … 700 700 AssertRC (rc); 701 701 702 QString nlsPath = QString(szNlsPath) + vboxLanguageSubDirectory();703 QDir nlsDir ( nlsPath);704 705 Assert (! langId.isEmpty());706 if (! langId.isEmpty() && langId != vboxBuiltInLanguageName())702 QString strNlsPath = QString(szNlsPath) + vboxLanguageSubDirectory(); 703 QDir nlsDir (strNlsPath); 704 705 Assert (!strEffectiveLangId.isEmpty()); 706 if (!strEffectiveLangId.isEmpty() && strEffectiveLangId != vboxBuiltInLanguageName()) 707 707 { 708 708 QRegExp regExp (vboxLanguageIdRegExp()); 709 int pos = regExp.indexIn (langId);709 int iPos = regExp.indexIn (strEffectiveLangId); 710 710 /* the language ID should match the regexp completely */ 711 AssertReturnVoid ( pos == 0);712 713 QString lang= regExp.cap (2);714 715 if (nlsDir.exists (vboxLanguageFileBase() + langId + vboxLanguageFileExtension()))716 { 717 languageFileName = nlsDir.absoluteFilePath (vboxLanguageFileBase() + langId +718 vboxLanguageFileExtension());719 s electedLangId = langId;720 } 721 else if (nlsDir.exists (vboxLanguageFileBase() + lang+ vboxLanguageFileExtension()))722 { 723 languageFileName = nlsDir.absoluteFilePath (vboxLanguageFileBase() + lang+724 vboxLanguageFileExtension());725 s electedLangId = lang;711 AssertReturnVoid (iPos == 0); 712 713 QString strStrippedLangId = regExp.cap (2); 714 715 if (nlsDir.exists (vboxLanguageFileBase() + strEffectiveLangId + vboxLanguageFileExtension())) 716 { 717 strLanguageFileName = nlsDir.absoluteFilePath (vboxLanguageFileBase() + strEffectiveLangId + 718 vboxLanguageFileExtension()); 719 strSelectedLangId = strEffectiveLangId; 720 } 721 else if (nlsDir.exists (vboxLanguageFileBase() + strStrippedLangId + vboxLanguageFileExtension())) 722 { 723 strLanguageFileName = nlsDir.absoluteFilePath (vboxLanguageFileBase() + strStrippedLangId + 724 vboxLanguageFileExtension()); 725 strSelectedLangId = strStrippedLangId; 726 726 } 727 727 else … … 730 730 * case, if no explicit language file exists, we will simply 731 731 * fall-back to English (built-in). */ 732 if (! aLangId.isNull() && langId != "en")733 msgCenter().cannotFindLanguage ( langId, nlsPath);734 /* s electedLangId remains built-in here*/735 AssertReturnVoid (s electedLangId == vboxBuiltInLanguageName());732 if (!strLangId.isNull() && strEffectiveLangId != "en") 733 msgCenter().cannotFindLanguage (strEffectiveLangId, strNlsPath); 734 /* strSelectedLangId remains built-in here: */ 735 AssertReturnVoid (strSelectedLangId == vboxBuiltInLanguageName()); 736 736 } 737 737 } … … 749 749 sTranslator = new VBoxTranslator (qApp); 750 750 Assert (sTranslator); 751 bool loadOk = true;751 bool fLoadOk = true; 752 752 if (sTranslator) 753 753 { 754 if (s electedLangId != vboxBuiltInLanguageName())755 { 756 Assert (! languageFileName.isNull());757 loadOk = sTranslator->loadFile (languageFileName);754 if (strSelectedLangId != vboxBuiltInLanguageName()) 755 { 756 Assert (!strLanguageFileName.isNull()); 757 fLoadOk = sTranslator->loadFile (strLanguageFileName); 758 758 } 759 759 /* We install the translator in any case: on failure, this will … … 762 762 } 763 763 else 764 loadOk = false;765 766 if ( loadOk)767 s_strLoadedLanguageId = s electedLangId;764 fLoadOk = false; 765 766 if (fLoadOk) 767 s_strLoadedLanguageId = strSelectedLangId; 768 768 else 769 769 { 770 msgCenter().cannotLoadLanguage ( languageFileName);770 msgCenter().cannotLoadLanguage (strLanguageFileName); 771 771 s_strLoadedLanguageId = vboxBuiltInLanguageName(); 772 772 } … … 778 778 /* We use system installations of Qt on Linux systems, so first, try 779 779 * to load the Qt translation from the system location. */ 780 languageFileName = QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" +781 languageId() + vboxLanguageFileExtension();782 QTranslator * qtSysTr = new QTranslator (sTranslator);783 Assert ( qtSysTr);784 if ( qtSysTr && qtSysTr->load (languageFileName))785 qApp->installTranslator ( qtSysTr);780 strLanguageFileName = QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + 781 languageId() + vboxLanguageFileExtension(); 782 QTranslator *pQtSysTr = new QTranslator (sTranslator); 783 Assert (pQtSysTr); 784 if (pQtSysTr && pQtSysTr->load (strLanguageFileName)) 785 qApp->installTranslator (pQtSysTr); 786 786 /* Note that the Qt translation supplied by Oracle is always loaded 787 787 * afterwards to make sure it will take precedence over the system … … 793 793 * Oracle translation is always the best one. */ 794 794 #endif 795 languageFileName = nlsDir.absoluteFilePath (QString ("qt_") +796 languageId() +797 vboxLanguageFileExtension());798 QTranslator * qtTr = new QTranslator (sTranslator);799 Assert ( qtTr);800 if ( qtTr && (loadOk = qtTr->load (languageFileName)))801 qApp->installTranslator ( qtTr);795 strLanguageFileName = nlsDir.absoluteFilePath (QString ("qt_") + 796 languageId() + 797 vboxLanguageFileExtension()); 798 QTranslator *pQtTr = new QTranslator (sTranslator); 799 Assert (pQtTr); 800 if (pQtTr && (fLoadOk = pQtTr->load (strLanguageFileName))) 801 qApp->installTranslator (pQtTr); 802 802 /* The below message doesn't fit 100% (because it's an additional 803 803 * language and the main one won't be reset to built-in on failure) 804 804 * but the load failure is so rare here that it's not worth a separate 805 805 * message (but still, having something is better than having none) */ 806 if (! loadOk && !aLangId.isNull())807 msgCenter().cannotLoadLanguage ( languageFileName);806 if (!fLoadOk && !strLangId.isNull()) 807 msgCenter().cannotLoadLanguage (strLanguageFileName); 808 808 } 809 809 if (fResetToC) … … 870 870 * B cannot appear there). */ 871 871 872 QString regexp =872 QString strRegexp = 873 873 QString ("^(?:(?:(\\d+)(?:\\s?(%2|%3|%4|%5|%6|%7))?)|(?:(\\d*)%1(\\d{1,2})(?:\\s?(%3|%4|%5|%6|%7))))$") 874 874 .arg (decimalSep()) … … 879 879 .arg (tr ("TB", "size suffix TBytes=1024 GBytes")) 880 880 .arg (tr ("PB", "size suffix PBytes=1024 TBytes")); 881 return regexp;882 } 883 884 /* static */ 885 quint64 VBoxGlobal::parseSize (const QString & aText)881 return strRegexp; 882 } 883 884 /* static */ 885 quint64 VBoxGlobal::parseSize (const QString &strText) 886 886 { 887 887 /* Text should be in form of B|KB|MB|GB|TB|PB. */ 888 888 QRegExp regexp (sizeRegexp()); 889 int pos = regexp.indexIn (aText);890 if ( pos != -1)891 { 892 QString intgS= regexp.cap (1);893 QString hundS;894 QString s uff = regexp.cap (2);895 if ( intgS.isEmpty())896 { 897 intgS= regexp.cap (3);898 hundS= regexp.cap (4);899 s uff = regexp.cap (5);900 } 901 902 quint64 denom= 0;903 if (s uff.isEmpty() || suff == tr ("B", "size suffix Bytes"))904 denom= 1;905 else if (s uff == tr ("KB", "size suffix KBytes=1024 Bytes"))906 denom= _1K;907 else if (s uff == tr ("MB", "size suffix MBytes=1024 KBytes"))908 denom= _1M;909 else if (s uff == tr ("GB", "size suffix GBytes=1024 MBytes"))910 denom= _1G;911 else if (s uff == tr ("TB", "size suffix TBytes=1024 GBytes"))912 denom= _1T;913 else if (s uff == tr ("PB", "size suffix PBytes=1024 TBytes"))914 denom= _1P;915 916 quint64 i ntg = intgS.toULongLong();917 if ( denom== 1)918 return i ntg;919 920 quint64 hund = hundS.leftJustified (2, '0').toULongLong();921 hund = hund * denom/ 100;922 i ntg = intg * denom + hund;923 return i ntg;889 int iPos = regexp.indexIn (strText); 890 if (iPos != -1) 891 { 892 QString strInteger = regexp.cap (1); 893 QString strHundred; 894 QString strSuff = regexp.cap (2); 895 if (strInteger.isEmpty()) 896 { 897 strInteger = regexp.cap (3); 898 strHundred = regexp.cap (4); 899 strSuff = regexp.cap (5); 900 } 901 902 quint64 uDenominator = 0; 903 if (strSuff.isEmpty() || strSuff == tr ("B", "size suffix Bytes")) 904 uDenominator = 1; 905 else if (strSuff == tr ("KB", "size suffix KBytes=1024 Bytes")) 906 uDenominator = _1K; 907 else if (strSuff == tr ("MB", "size suffix MBytes=1024 KBytes")) 908 uDenominator = _1M; 909 else if (strSuff == tr ("GB", "size suffix GBytes=1024 MBytes")) 910 uDenominator = _1G; 911 else if (strSuff == tr ("TB", "size suffix TBytes=1024 GBytes")) 912 uDenominator = _1T; 913 else if (strSuff == tr ("PB", "size suffix PBytes=1024 TBytes")) 914 uDenominator = _1P; 915 916 quint64 iInteger = strInteger.toULongLong(); 917 if (uDenominator == 1) 918 return iInteger; 919 920 quint64 iHundred = strHundred.leftJustified (2, '0').toULongLong(); 921 iHundred = iHundred * uDenominator / 100; 922 iInteger = iInteger * uDenominator + iHundred; 923 return iInteger; 924 924 } 925 925 else … … 928 928 929 929 /* static */ 930 QString VBoxGlobal::formatSize (quint64 aSize, uint aDecimal /* = 2 */,931 FormatSize aMode /* = FormatSize_Round */)930 QString VBoxGlobal::formatSize (quint64 uSize, uint cDecimal /* = 2 */, 931 FormatSize enmMode /* = FormatSize_Round */) 932 932 { 933 933 /* Text will be in form of B|KB|MB|GB|TB|PB. … … 946 946 * size parameter. */ 947 947 948 quint64 denom= 0;949 int suffix = 0;950 951 if ( aSize < _1K)952 { 953 denom= 1;954 suffix = 0;955 } 956 else if ( aSize < _1M)957 { 958 denom= _1K;959 suffix = 1;960 } 961 else if ( aSize < _1G)962 { 963 denom= _1M;964 suffix = 2;965 } 966 else if ( aSize < _1T)967 { 968 denom= _1G;969 suffix = 3;970 } 971 else if ( aSize < _1P)972 { 973 denom= _1T;974 suffix = 4;948 quint64 uDenominator = 0; 949 int iSuffix = 0; 950 951 if (uSize < _1K) 952 { 953 uDenominator = 1; 954 iSuffix = 0; 955 } 956 else if (uSize < _1M) 957 { 958 uDenominator = _1K; 959 iSuffix = 1; 960 } 961 else if (uSize < _1G) 962 { 963 uDenominator = _1M; 964 iSuffix = 2; 965 } 966 else if (uSize < _1T) 967 { 968 uDenominator = _1G; 969 iSuffix = 3; 970 } 971 else if (uSize < _1P) 972 { 973 uDenominator = _1T; 974 iSuffix = 4; 975 975 } 976 976 else 977 977 { 978 denom= _1P;979 suffix = 5;980 } 981 982 quint64 intg = aSize / denom;983 quint64 decm = aSize % denom;984 quint64 mult = 1;985 for (uint i = 0; i < aDecimal; ++ i) mult *= 10;986 987 QString number;988 if ( denom> 1)989 { 990 if ( decm)991 { 992 decm *= mult;978 uDenominator = _1P; 979 iSuffix = 5; 980 } 981 982 quint64 uInteger = uSize / uDenominator; 983 quint64 uDecimal = uSize % uDenominator; 984 quint64 uMult = 1; 985 for (uint i = 0; i < cDecimal; ++ i) uMult *= 10; 986 987 QString strNumber; 988 if (uDenominator > 1) 989 { 990 if (uDecimal) 991 { 992 uDecimal *= uMult; 993 993 /* not greater */ 994 if ( aMode == FormatSize_RoundDown)995 decm = decm / denom;994 if (enmMode == FormatSize_RoundDown) 995 uDecimal = uDecimal / uDenominator; 996 996 /* not less */ 997 else if ( aMode == FormatSize_RoundUp)998 decm = (decm + denom - 1) / denom;997 else if (enmMode == FormatSize_RoundUp) 998 uDecimal = (uDecimal + uDenominator - 1) / uDenominator; 999 999 /* nearest */ 1000 else decm = (decm + denom / 2) / denom;1000 else uDecimal = (uDecimal + uDenominator / 2) / uDenominator; 1001 1001 } 1002 1002 /* Check for the fractional part overflow due to rounding: */ 1003 if ( decm == mult)1004 { 1005 decm= 0;1006 ++ intg;1003 if (uDecimal == uMult) 1004 { 1005 uDecimal = 0; 1006 ++ uInteger; 1007 1007 /* Check if we've got 1024 XB after rounding and scale down if so: */ 1008 if ( intg == 1024 && suffix + 1 < (int)SizeSuffix_Max)1008 if (uInteger == 1024 && iSuffix + 1 < (int)SizeSuffix_Max) 1009 1009 { 1010 intg/= 1024;1011 ++ suffix;1010 uInteger /= 1024; 1011 ++ iSuffix; 1012 1012 } 1013 1013 } 1014 number = QString::number (intg);1015 if ( aDecimal) number += QString ("%1%2").arg (decimalSep())1016 .arg (QString::number ( decm).rightJustified (aDecimal, '0'));1014 strNumber = QString::number (uInteger); 1015 if (cDecimal) strNumber += QString ("%1%2").arg (decimalSep()) 1016 .arg (QString::number (uDecimal).rightJustified (cDecimal, '0')); 1017 1017 } 1018 1018 else 1019 1019 { 1020 number = QString::number (intg);1021 } 1022 1023 return QString ("%1 %2").arg ( number).arg (gpConverter->toString(static_cast<SizeSuffix>(suffix)));1020 strNumber = QString::number (uInteger); 1021 } 1022 1023 return QString ("%1 %2").arg (strNumber).arg (gpConverter->toString(static_cast<SizeSuffix>(iSuffix))); 1024 1024 } 1025 1025 … … 1051 1051 } 1052 1052 1053 QString VBoxGlobal::toCOMPortName (ulong aIRQ, ulong aIOBase) const1053 QString VBoxGlobal::toCOMPortName (ulong uIRQ, ulong uIOBase) const 1054 1054 { 1055 1055 for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i) 1056 if (kComKnownPorts [i].IRQ == aIRQ &&1057 kComKnownPorts [i].IOBase == aIOBase)1056 if (kComKnownPorts [i].IRQ == uIRQ && 1057 kComKnownPorts [i].IOBase == uIOBase) 1058 1058 return kComKnownPorts [i].name; 1059 1059 1060 return m UserDefinedPortName;1061 } 1062 1063 bool VBoxGlobal::toCOMPortNumbers (const QString & aName, ulong &aIRQ,1064 ulong & aIOBase) const1060 return m_strUserDefinedPortName; 1061 } 1062 1063 bool VBoxGlobal::toCOMPortNumbers (const QString &strName, ulong &uIRQ, 1064 ulong &uIOBase) const 1065 1065 { 1066 1066 for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i) 1067 if (strcmp (kComKnownPorts [i].name, aName.toUtf8().data()) == 0)1068 { 1069 aIRQ = kComKnownPorts [i].IRQ;1070 aIOBase = kComKnownPorts [i].IOBase;1067 if (strcmp (kComKnownPorts [i].name, strName.toUtf8().data()) == 0) 1068 { 1069 uIRQ = kComKnownPorts [i].IRQ; 1070 uIOBase = kComKnownPorts [i].IOBase; 1071 1071 return true; 1072 1072 } … … 1084 1084 } 1085 1085 1086 QString VBoxGlobal::toLPTPortName (ulong aIRQ, ulong aIOBase) const1086 QString VBoxGlobal::toLPTPortName (ulong uIRQ, ulong uIOBase) const 1087 1087 { 1088 1088 for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i) 1089 if (kLptKnownPorts [i].IRQ == aIRQ &&1090 kLptKnownPorts [i].IOBase == aIOBase)1089 if (kLptKnownPorts [i].IRQ == uIRQ && 1090 kLptKnownPorts [i].IOBase == uIOBase) 1091 1091 return kLptKnownPorts [i].name; 1092 1092 1093 return m UserDefinedPortName;1094 } 1095 1096 bool VBoxGlobal::toLPTPortNumbers (const QString & aName, ulong &aIRQ,1097 ulong & aIOBase) const1093 return m_strUserDefinedPortName; 1094 } 1095 1096 bool VBoxGlobal::toLPTPortNumbers (const QString &strName, ulong &uIRQ, 1097 ulong &uIOBase) const 1098 1098 { 1099 1099 for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i) 1100 if (strcmp (kLptKnownPorts [i].name, aName.toUtf8().data()) == 0)1101 { 1102 aIRQ = kLptKnownPorts [i].IRQ;1103 aIOBase = kLptKnownPorts [i].IOBase;1100 if (strcmp (kLptKnownPorts [i].name, strName.toUtf8().data()) == 0) 1101 { 1102 uIRQ = kLptKnownPorts [i].IRQ; 1103 uIOBase = kLptKnownPorts [i].IOBase; 1104 1104 return true; 1105 1105 } … … 1109 1109 1110 1110 /* static */ 1111 QString VBoxGlobal::highlight (const QString & aStr, bool aToolTip /* = false */)1111 QString VBoxGlobal::highlight (const QString &strTextArg, bool fToolTip /* = false */) 1112 1112 { 1113 1113 /* We should reformat the input strText so that: … … 1127 1127 QString uuidFont; 1128 1128 QString endFont; 1129 if (! aToolTip)1129 if (!fToolTip) 1130 1130 { 1131 1131 strFont = "<font color=#0000CC>"; … … 1134 1134 } 1135 1135 1136 QString text = aStr;1136 QString strText = strTextArg; 1137 1137 1138 1138 /* Replace special entities, '&' -- first! */ 1139 text.replace ('&', "&");1140 text.replace ('<', "<");1141 text.replace ('>', ">");1142 text.replace ('\"', """);1139 strText.replace ('&', "&"); 1140 strText.replace ('<', "<"); 1141 strText.replace ('>', ">"); 1142 strText.replace ('\"', """); 1143 1143 1144 1144 /* Mark strings in single quotes with color: */ 1145 1145 QRegExp rx = QRegExp ("((?:^|\\s)[(]?)'([^']*)'(?=[:.-!);]?(?:\\s|$))"); 1146 1146 rx.setMinimal (true); 1147 text.replace (rx,1147 strText.replace (rx, 1148 1148 QString ("\\1%1<nobr>'\\2'</nobr>%2").arg (strFont).arg (endFont)); 1149 1149 1150 1150 /* Mark UUIDs with color: */ 1151 text.replace (QRegExp (1151 strText.replace (QRegExp ( 1152 1152 "((?:^|\\s)[(]?)" 1153 1153 "(\\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\})" … … 1156 1156 1157 1157 /* Split to paragraphs at \n chars: */ 1158 if (! aToolTip)1159 text.replace ('\n', "</p><p>");1158 if (!fToolTip) 1159 strText.replace ('\n', "</p><p>"); 1160 1160 else 1161 text.replace ('\n', "<br>");1162 1163 return text;1164 } 1165 1166 /* static */ 1167 QString VBoxGlobal::emphasize (const QString & aStr)1161 strText.replace ('\n', "<br>"); 1162 1163 return strText; 1164 } 1165 1166 /* static */ 1167 QString VBoxGlobal::emphasize (const QString &strTextArg) 1168 1168 { 1169 1169 /* We should reformat the input string @a strText so that: … … 1182 1182 QString uuidEmphEnd ("</i>"); 1183 1183 1184 QString text = aStr;1184 QString strText = strTextArg; 1185 1185 1186 1186 /* Replace special entities, '&' -- first! */ 1187 text.replace ('&', "&");1188 text.replace ('<', "<");1189 text.replace ('>', ">");1190 text.replace ('\"', """);1187 strText.replace ('&', "&"); 1188 strText.replace ('<', "<"); 1189 strText.replace ('>', ">"); 1190 strText.replace ('\"', """); 1191 1191 1192 1192 /* Mark strings in single quotes with bold style: */ 1193 1193 QRegExp rx = QRegExp ("((?:^|\\s)[(]?)'([^']*)'(?=[:.-!);]?(?:\\s|$))"); 1194 1194 rx.setMinimal (true); 1195 text.replace(rx,1195 strText.replace(rx, 1196 1196 QString ("\\1%1<nobr>'\\2'</nobr>%2").arg (strEmphStart).arg (strEmphEnd)); 1197 1197 1198 1198 /* Mark UUIDs with italic style: */ 1199 text.replace (QRegExp (1199 strText.replace (QRegExp ( 1200 1200 "((?:^|\\s)[(]?)" 1201 1201 "(\\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\})" … … 1204 1204 1205 1205 /* Split to paragraphs at \n chars: */ 1206 text.replace ('\n', "</p><p>");1207 1208 return text;1209 } 1210 1211 /* static */ 1212 QString VBoxGlobal::removeAccelMark (const QString & aText)1206 strText.replace ('\n', "</p><p>"); 1207 1208 return strText; 1209 } 1210 1211 /* static */ 1212 QString VBoxGlobal::removeAccelMark (const QString &strTextArg) 1213 1213 { 1214 1214 /* In order to support accelerators used in non-alphabet languages … … 1218 1218 * removed from the string. */ 1219 1219 1220 QString result = aText;1220 QString strText = strTextArg; 1221 1221 1222 1222 QRegExp accel ("\\(&[a-zA-Z]\\)"); 1223 int pos = accel.indexIn (result);1224 if ( pos >= 0)1225 result.remove (pos, accel.cap().length());1223 int iPos = accel.indexIn (strText); 1224 if (iPos >= 0) 1225 strText.remove (iPos, accel.cap().length()); 1226 1226 else 1227 1227 { 1228 pos = result.indexOf ('&');1229 if ( pos >= 0)1230 result.remove (pos, 1);1231 } 1232 1233 return result;1228 iPos = strText.indexOf ('&'); 1229 if (iPos >= 0) 1230 strText.remove (iPos, 1); 1231 } 1232 1233 return strText; 1234 1234 } 1235 1235 … … 1238 1238 { 1239 1239 #ifdef VBOX_WS_MAC 1240 QString pattern("%1 (Host+%2)");1240 QString strPattern("%1 (Host+%2)"); 1241 1241 #else 1242 QString pattern("%1 \tHost+%2");1242 QString strPattern("%1 \tHost+%2"); 1243 1243 #endif 1244 1244 if ( strKey.isEmpty() … … 1246 1246 return strText; 1247 1247 else 1248 return pattern.arg(strText).arg(QKeySequence(strKey).toString(QKeySequence::NativeText));1248 return strPattern.arg(strText).arg(QKeySequence(strKey).toString(QKeySequence::NativeText)); 1249 1249 } 1250 1250 … … 1252 1252 { 1253 1253 #if defined (VBOX_WS_WIN) 1254 const QString name = "VirtualBox";1255 const QString s uffix = "chm";1254 const QString strName = "VirtualBox"; 1255 const QString strSuffix = "chm"; 1256 1256 #elif defined (VBOX_WS_MAC) 1257 const QString name = "UserManual";1258 const QString s uffix = "pdf";1257 const QString strName = "UserManual"; 1258 const QString strSuffix = "pdf"; 1259 1259 #elif defined (VBOX_WS_X11) 1260 1260 # if defined VBOX_OSE 1261 const QString name = "UserManual";1262 const QString s uffix = "pdf";1261 const QString strName = "UserManual"; 1262 const QString strSuffix = "pdf"; 1263 1263 # else 1264 const QString name = "VirtualBox";1265 const QString s uffix = "chm";1264 const QString strName = "VirtualBox"; 1265 const QString strSuffix = "chm"; 1266 1266 # endif 1267 1267 #endif … … 1276 1276 1277 1277 /* Construct the path and the filename: */ 1278 QString manual = QString ("%1/%2_%3.%4").arg (szDocsPath)1279 .arg (name)1280 .arg (lang.name())1281 .arg (suffix);1278 QString strManual = QString ("%1/%2_%3.%4").arg (szDocsPath) 1279 .arg (strName) 1280 .arg (lang.name()) 1281 .arg (strSuffix); 1282 1282 /* Check if a help file with that name exists: */ 1283 QFileInfo fi ( manual);1283 QFileInfo fi (strManual); 1284 1284 if (fi.exists()) 1285 return manual;1285 return strManual; 1286 1286 1287 1287 /* Fall back to the standard: */ 1288 manual = QString ("%1/%2.%4").arg (szDocsPath)1289 .arg (name)1290 .arg (suffix);1291 return manual;1288 strManual = QString ("%1/%2.%4").arg (szDocsPath) 1289 .arg (strName) 1290 .arg (strSuffix); 1291 return strManual; 1292 1292 } 1293 1293 … … 1295 1295 QString VBoxGlobal::documentsPath() 1296 1296 { 1297 QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);1298 QDir dir( path);1297 QString strPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); 1298 QDir dir(strPath); 1299 1299 if (dir.exists()) 1300 1300 return QDir::cleanPath(dir.canonicalPath()); … … 1310 1310 1311 1311 /* static */ 1312 QRect VBoxGlobal::normalizeGeometry (const QRect & aRectangle, const QRegion &aBoundRegion,1313 bool aCanResize /* = true */)1312 QRect VBoxGlobal::normalizeGeometry (const QRect &rectangle, const QRegion &boundRegion, 1313 bool fCanResize /* = true */) 1314 1314 { 1315 1315 /* Perform direct and flipped search of position for @a rectangle to make sure it is fully contained … … 1318 1318 1319 1319 /* Direct search for normalized rectangle */ 1320 QRect var1 (getNormalized ( aRectangle, aBoundRegion, aCanResize));1320 QRect var1 (getNormalized (rectangle, boundRegion, fCanResize)); 1321 1321 1322 1322 /* Flipped search for normalized rectangle: */ 1323 QRect var2 (flip (getNormalized (flip ( aRectangle).boundingRect(),1324 flip ( aBoundRegion), aCanResize)).boundingRect());1323 QRect var2 (flip (getNormalized (flip (rectangle).boundingRect(), 1324 flip (boundRegion), fCanResize)).boundingRect()); 1325 1325 1326 1326 /* Calculate shift from starting position for both variants: */ 1327 double length1 = sqrt (pow ((double) (var1.x() - aRectangle.x()), (double) 2) +1328 pow ((double) (var1.y() - aRectangle.y()), (double) 2));1329 double length2 = sqrt (pow ((double) (var2.x() - aRectangle.x()), (double) 2) +1330 pow ((double) (var2.y() - aRectangle.y()), (double) 2));1327 double dLength1 = sqrt (pow ((double) (var1.x() - rectangle.x()), (double) 2) + 1328 pow ((double) (var1.y() - rectangle.y()), (double) 2)); 1329 double dLength2 = sqrt (pow ((double) (var2.x() - rectangle.x()), (double) 2) + 1330 pow ((double) (var2.y() - rectangle.y()), (double) 2)); 1331 1331 1332 1332 /* Return minimum shifted variant: */ 1333 return length1 > length2 ? var2 : var1;1334 } 1335 1336 /* static */ 1337 QRect VBoxGlobal::getNormalized (const QRect & aRectangle, const QRegion &aBoundRegion,1338 bool /* aCanResize = true */)1333 return dLength1 > dLength2 ? var2 : var1; 1334 } 1335 1336 /* static */ 1337 QRect VBoxGlobal::getNormalized (const QRect &rectangle, const QRegion &boundRegion, 1338 bool /* fCanResize = true */) 1339 1339 { 1340 1340 /* Ensures that the given rectangle @a rectangle is fully contained within the region @a boundRegion … … 1344 1344 1345 1345 /* Storing available horizontal sub-rectangles & vertical shifts: */ 1346 int windowVertical = aRectangle.center().y();1347 QVector <QRect> rectanglesVector ( aBoundRegion.rects());1346 int iWindowVertical = rectangle.center().y(); 1347 QVector <QRect> rectanglesVector (boundRegion.rects()); 1348 1348 QList <QRect> rectanglesList; 1349 1349 QList <int> shiftsList; 1350 1350 foreach (QRect currentItem, rectanglesVector) 1351 1351 { 1352 int currentDelta = qAbs (windowVertical - currentItem.center().y());1353 int shift2Top = currentItem.top() - aRectangle.top();1354 int shift2Bot = currentItem.bottom() - aRectangle.bottom();1355 1356 int i temPosition = 0;1352 int iCurrentDelta = qAbs (iWindowVertical - currentItem.center().y()); 1353 int iShift2Top = currentItem.top() - rectangle.top(); 1354 int iShift2Bot = currentItem.bottom() - rectangle.bottom(); 1355 1356 int iTtemPosition = 0; 1357 1357 foreach (QRect item, rectanglesList) 1358 1358 { 1359 int delta = qAbs (windowVertical - item.center().y());1360 if ( delta > currentDelta) break; else ++ itemPosition;1361 } 1362 rectanglesList.insert (i temPosition, currentItem);1363 1364 int shift2TopPos = 0;1365 foreach (int shift, shiftsList)1366 if (qAbs ( shift) > qAbs (shift2Top)) break; else ++ shift2TopPos;1367 shiftsList.insert ( shift2TopPos, shift2Top);1368 1369 int shift2BotPos = 0;1370 foreach (int shift, shiftsList)1371 if (qAbs (shift) > qAbs (shift2Bot)) break; else ++ shift2BotPos;1372 shiftsList.insert ( shift2BotPos, shift2Bot);1359 int iDelta = qAbs (iWindowVertical - item.center().y()); 1360 if (iDelta > iCurrentDelta) break; else ++ iTtemPosition; 1361 } 1362 rectanglesList.insert (iTtemPosition, currentItem); 1363 1364 int iShift2TopPos = 0; 1365 foreach (int iShift, shiftsList) 1366 if (qAbs (iShift) > qAbs (iShift2Top)) break; else ++ iShift2TopPos; 1367 shiftsList.insert (iShift2TopPos, iShift2Top); 1368 1369 int iShift2BotPos = 0; 1370 foreach (int iShift, shiftsList) 1371 if (qAbs(iShift) > qAbs(iShift2Bot)) break; else ++ iShift2BotPos; 1372 shiftsList.insert (iShift2BotPos, iShift2Bot); 1373 1373 } 1374 1374 … … 1378 1378 { 1379 1379 /* Move to appropriate vertical: */ 1380 QRect rectangle (aRectangle);1381 if (i >= 0) rectangle.translate (0, shiftsList [i]);1380 QRect newRectangle (rectangle); 1381 if (i >= 0) newRectangle.translate (0, shiftsList [i]); 1382 1382 1383 1383 /* Search horizontal shift: */ 1384 int maxShift = 0;1384 int iMaxShift = 0; 1385 1385 foreach (QRect item, rectanglesList) 1386 1386 { 1387 QRect trectangle ( rectangle.translated (item.left() - rectangle.left(), 0));1387 QRect trectangle (newRectangle.translated (item.left() - newRectangle.left(), 0)); 1388 1388 if (!item.intersects (trectangle)) 1389 1389 continue; 1390 1390 1391 if ( rectangle.left() < item.left())1391 if (newRectangle.left() < item.left()) 1392 1392 { 1393 int shift = item.left() - rectangle.left();1394 maxShift = qAbs (shift) > qAbs (maxShift) ? shift : maxShift;1393 int iShift = item.left() - newRectangle.left(); 1394 iMaxShift = qAbs (iShift) > qAbs (iMaxShift) ? iShift : iMaxShift; 1395 1395 } 1396 else if ( rectangle.right() > item.right())1396 else if (newRectangle.right() > item.right()) 1397 1397 { 1398 int shift = item.right() - rectangle.right();1399 maxShift = qAbs (shift) > qAbs (maxShift) ? shift : maxShift;1398 int iShift = item.right() - newRectangle.right(); 1399 iMaxShift = qAbs (iShift) > qAbs (iMaxShift) ? iShift : iMaxShift; 1400 1400 } 1401 1401 } 1402 1402 1403 1403 /* Shift across the horizontal direction: */ 1404 rectangle.translate (maxShift, 0);1404 newRectangle.translate (iMaxShift, 0); 1405 1405 1406 1406 /* Check the translated rectangle to feat the rules: */ 1407 if ( aBoundRegion.united (rectangle) == aBoundRegion)1408 result = rectangle;1407 if (boundRegion.united (newRectangle) == boundRegion) 1408 result = newRectangle; 1409 1409 1410 1410 if (!result.isNull()) break; … … 1416 1416 * using max of available rectangles: */ 1417 1417 QRect maxRectangle; 1418 quint64 maxSquare = 0;1418 quint64 uMaxSquare = 0; 1419 1419 foreach (QRect item, rectanglesList) 1420 1420 { 1421 quint64 square = item.width() * item.height();1422 if ( square > maxSquare)1421 quint64 uSquare = item.width() * item.height(); 1422 if (uSquare > uMaxSquare) 1423 1423 { 1424 maxSquare = square;1424 uMaxSquare = uSquare; 1425 1425 maxRectangle = item; 1426 1426 } 1427 1427 } 1428 1428 1429 result = aRectangle;1429 result = rectangle; 1430 1430 result.moveTo (maxRectangle.x(), maxRectangle.y()); 1431 1431 if (maxRectangle.right() < result.right()) … … 1439 1439 1440 1440 /* static */ 1441 QRegion VBoxGlobal::flip (const QRegion & aRegion)1441 QRegion VBoxGlobal::flip (const QRegion ®ion) 1442 1442 { 1443 1443 QRegion result; 1444 QVector <QRect> rectangles ( aRegion.rects());1444 QVector <QRect> rectangles (region.rects()); 1445 1445 foreach (QRect rectangle, rectangles) 1446 1446 result += QRect (rectangle.y(), rectangle.x(), … … 1450 1450 1451 1451 /* static */ 1452 void VBoxGlobal::centerWidget (QWidget * aWidget, QWidget *aRelative,1453 bool aCanResize /* = true */)1452 void VBoxGlobal::centerWidget (QWidget *pWidget, QWidget *pRelative, 1453 bool fCanResize /* = true */) 1454 1454 { 1455 1455 /* If necessary, pWidget's position is adjusted to make it fully visible within … … 1462 1462 * pWidget will be centered relative to the available desktop area. */ 1463 1463 1464 AssertReturnVoid ( aWidget);1465 AssertReturnVoid ( aWidget->isTopLevel());1464 AssertReturnVoid (pWidget); 1465 AssertReturnVoid (pWidget->isTopLevel()); 1466 1466 1467 1467 QRect deskGeo, parentGeo; 1468 QWidget *w = aRelative;1468 QWidget *w = pRelative; 1469 1469 if (w) 1470 1470 { … … 1492 1492 // is based on the idea taken from QDialog::adjustPositionInternal(). 1493 1493 1494 int extraw = 0, extrah= 0;1494 int iExtraW = 0, iExtraH = 0; 1495 1495 1496 1496 QWidgetList list = QApplication::topLevelWidgets(); 1497 1497 QListIterator<QWidget*> it (list); 1498 while (( extraw == 0 || extrah== 0) && it.hasNext())1499 { 1500 int framew, frameh;1501 QWidget * current = it.next();1502 if (! current->isVisible())1498 while ((iExtraW == 0 || iExtraH == 0) && it.hasNext()) 1499 { 1500 int iFrameW, iFrameH; 1501 QWidget *pCurrent = it.next(); 1502 if (!pCurrent->isVisible()) 1503 1503 continue; 1504 1504 1505 framew = current->frameGeometry().width() - current->width();1506 frameh = current->frameGeometry().height() - current->height();1507 1508 extraw = qMax (extraw, framew);1509 extrah = qMax (extrah, frameh);1505 iFrameW = pCurrent->frameGeometry().width() - pCurrent->width(); 1506 iFrameH = pCurrent->frameGeometry().height() - pCurrent->height(); 1507 1508 iExtraW = qMax (iExtraW, iFrameW); 1509 iExtraH = qMax (iExtraH, iFrameH); 1510 1510 } 1511 1511 … … 1513 1513 * above workaround: */ 1514 1514 // QRect geo = frameGeometry(); 1515 QRect geo = QRect (0, 0, aWidget->width() + extraw,1516 aWidget->height() + extrah);1515 QRect geo = QRect (0, 0, pWidget->width() + iExtraW, 1516 pWidget->height() + iExtraH); 1517 1517 1518 1518 geo.moveCenter (QPoint (parentGeo.x() + (parentGeo.width() - 1) / 2, … … 1520 1520 1521 1521 /* Ensure the widget is within the available desktop area: */ 1522 QRect newGeo = normalizeGeometry (geo, deskGeo, aCanResize);1522 QRect newGeo = normalizeGeometry (geo, deskGeo, fCanResize); 1523 1523 #ifdef VBOX_WS_MAC 1524 1524 // WORKAROUND: … … 1527 1527 // the position. 1528 1528 if (w) 1529 newGeo.translate (0, ::darwinWindowToolBarHeight ( aWidget));1529 newGeo.translate (0, ::darwinWindowToolBarHeight (pWidget)); 1530 1530 #endif /* VBOX_WS_MAC */ 1531 1531 1532 aWidget->move (newGeo.topLeft());1533 1534 if ( aCanResize &&1532 pWidget->move (newGeo.topLeft()); 1533 1534 if (fCanResize && 1535 1535 (geo.width() != newGeo.width() || geo.height() != newGeo.height())) 1536 aWidget->resize (newGeo.width() - extraw, newGeo.height() - extrah);1536 pWidget->resize(newGeo.width() - iExtraW, newGeo.height() - iExtraH); 1537 1537 } 1538 1538 … … 1631 1631 #if defined (VBOX_WS_X11) 1632 1632 1633 static char *XXGetProperty (Display * aDpy, Window aWnd,1634 Atom aPropType, const char *aPropName)1635 { 1636 Atom propNameAtom = XInternAtom ( aDpy, aPropName,1633 static char *XXGetProperty (Display *pDpy, Window windowHandle, 1634 Atom propType, const char *pszPropName) 1635 { 1636 Atom propNameAtom = XInternAtom (pDpy, pszPropName, 1637 1637 True /* only_if_exists */); 1638 1638 if (propNameAtom == None) … … 1644 1644 unsigned long nBytesAfter = 0; 1645 1645 unsigned char *propVal = NULL; 1646 int rc = XGetWindowProperty ( aDpy, aWnd, propNameAtom,1646 int rc = XGetWindowProperty (pDpy, windowHandle, propNameAtom, 1647 1647 0, LONG_MAX, False /* delete */, 1648 aPropType, &actTypeAtom, &actFmt,1648 propType, &actTypeAtom, &actFmt, 1649 1649 &nItems, &nBytesAfter, &propVal); 1650 1650 if (rc != Success) … … 1654 1654 } 1655 1655 1656 static Bool XXSendClientMessage (Display * aDpy, Window aWnd, const char *aMsg,1656 static Bool XXSendClientMessage (Display *pDpy, Window windowHandle, const char *pszMsg, 1657 1657 unsigned long aData0 = 0, unsigned long aData1 = 0, 1658 1658 unsigned long aData2 = 0, unsigned long aData3 = 0, 1659 1659 unsigned long aData4 = 0) 1660 1660 { 1661 Atom msgAtom = XInternAtom ( aDpy, aMsg, True /* only_if_exists */);1661 Atom msgAtom = XInternAtom (pDpy, pszMsg, True /* only_if_exists */); 1662 1662 if (msgAtom == None) 1663 1663 return False; … … 1668 1668 ev.xclient.serial = 0; 1669 1669 ev.xclient.send_event = True; 1670 ev.xclient.display = aDpy;1671 ev.xclient.window = aWnd;1670 ev.xclient.display = pDpy; 1671 ev.xclient.window = windowHandle; 1672 1672 ev.xclient.message_type = msgAtom; 1673 1673 … … 1680 1680 ev.xclient.data.l [4] = aData4; 1681 1681 1682 return XSendEvent ( aDpy, DefaultRootWindow (aDpy), False,1682 return XSendEvent (pDpy, DefaultRootWindow (pDpy), False, 1683 1683 SubstructureRedirectMask, &ev) != 0; 1684 1684 } … … 1687 1687 1688 1688 /* static */ 1689 bool VBoxGlobal::activateWindow (WId aWId, bool aSwitchDesktop /* = true */)1690 { 1691 RT_NOREF( aSwitchDesktop);1692 bool result = true;1689 bool VBoxGlobal::activateWindow (WId wId, bool fSwitchDesktop /* = true */) 1690 { 1691 RT_NOREF(fSwitchDesktop); 1692 bool fResult = true; 1693 1693 1694 1694 #if defined (VBOX_WS_WIN) 1695 1695 1696 HWND handle = (HWND) aWId;1696 HWND handle = (HWND)wId; 1697 1697 1698 1698 if (IsIconic (handle)) 1699 result &= !!ShowWindow (handle, SW_RESTORE);1699 fResult &= !!ShowWindow (handle, SW_RESTORE); 1700 1700 else if (!IsWindowVisible (handle)) 1701 result &= !!ShowWindow (handle, SW_SHOW);1702 1703 result &= !!SetForegroundWindow (handle);1701 fResult &= !!ShowWindow (handle, SW_SHOW); 1702 1703 fResult &= !!SetForegroundWindow (handle); 1704 1704 1705 1705 #elif defined (VBOX_WS_X11) 1706 1706 1707 Display * dpy = QX11Info::display();1708 1709 if ( aSwitchDesktop)1707 Display *pDisplay = QX11Info::display(); 1708 1709 if (fSwitchDesktop) 1710 1710 { 1711 1711 /* try to find the desktop ID using the NetWM property */ 1712 CARD32 * desktop = (CARD32 *) XXGetProperty (dpy, aWId, XA_CARDINAL,1713 "_NET_WM_DESKTOP");1714 if ( desktop == NULL)1712 CARD32 *pDesktop = (CARD32 *) XXGetProperty (pDisplay, wId, XA_CARDINAL, 1713 "_NET_WM_DESKTOP"); 1714 if (pDesktop == NULL) 1715 1715 // WORKAROUND: 1716 1716 // if the NetWM properly is not supported try to find 1717 1717 // the desktop ID using the GNOME WM property. 1718 desktop = (CARD32 *) XXGetProperty (dpy, aWId, XA_CARDINAL,1719 "_WIN_WORKSPACE");1720 1721 if ( desktop != NULL)1722 { 1723 Bool ok = XXSendClientMessage ( dpy, DefaultRootWindow (dpy),1718 pDesktop = (CARD32 *) XXGetProperty (pDisplay, wId, XA_CARDINAL, 1719 "_WIN_WORKSPACE"); 1720 1721 if (pDesktop != NULL) 1722 { 1723 Bool ok = XXSendClientMessage (pDisplay, DefaultRootWindow (pDisplay), 1724 1724 "_NET_CURRENT_DESKTOP", 1725 * desktop);1725 *pDesktop); 1726 1726 if (!ok) 1727 1727 { 1728 Log1WarningFunc(("Couldn't switch to desktop=%08X\n", desktop));1729 result = false;1728 Log1WarningFunc(("Couldn't switch to pDesktop=%08X\n", pDesktop)); 1729 fResult = false; 1730 1730 } 1731 XFree ( desktop);1731 XFree (pDesktop); 1732 1732 } 1733 1733 else 1734 1734 { 1735 Log1WarningFunc(("Couldn't find a desktop ID for aWId=%08X\n", aWId));1736 result = false;1737 } 1738 } 1739 1740 Bool ok = XXSendClientMessage ( dpy, aWId, "_NET_ACTIVE_WINDOW");1741 result &= !!ok;1742 1743 XRaiseWindow ( dpy, aWId);1735 Log1WarningFunc(("Couldn't find a pDesktop ID for wId=%08X\n", wId)); 1736 fResult = false; 1737 } 1738 } 1739 1740 Bool ok = XXSendClientMessage (pDisplay, wId, "_NET_ACTIVE_WINDOW"); 1741 fResult &= !!ok; 1742 1743 XRaiseWindow (pDisplay, wId); 1744 1744 1745 1745 #else 1746 1746 1747 NOREF ( aWId);1748 NOREF ( aSwitchDesktop);1747 NOREF (wId); 1748 NOREF (fSwitchDesktop); 1749 1749 AssertFailed(); 1750 result = false;1750 fResult = false; 1751 1751 1752 1752 #endif 1753 1753 1754 if (! result)1755 Log1WarningFunc(("Couldn't activate aWId=%08X\n", aWId));1756 1757 return result;1754 if (!fResult) 1755 Log1WarningFunc(("Couldn't activate wId=%08X\n", wId)); 1756 1757 return fResult; 1758 1758 } 1759 1759 … … 2021 2021 } 2022 2022 2023 QList<CGuestOSType> VBoxGlobal::vmGuestOSTypeList(const QString & aFamilyId) const2024 { 2025 AssertMsg(m_guestOSFamilyIDs.contains( aFamilyId), ("Family ID incorrect: '%s'.", aFamilyId.toLatin1().constData()));2026 return m_guestOSFamilyIDs.contains( aFamilyId) ?2027 m_guestOSTypes[m_guestOSFamilyIDs.indexOf( aFamilyId)] : QList<CGuestOSType>();2028 } 2029 2030 CGuestOSType VBoxGlobal::vmGuestOSType(const QString & aTypeId,2031 const QString & aFamilyId /* = QString::null*/) const2023 QList<CGuestOSType> VBoxGlobal::vmGuestOSTypeList(const QString &strFamilyId) const 2024 { 2025 AssertMsg(m_guestOSFamilyIDs.contains(strFamilyId), ("Family ID incorrect: '%s'.", strFamilyId.toLatin1().constData())); 2026 return m_guestOSFamilyIDs.contains(strFamilyId) ? 2027 m_guestOSTypes[m_guestOSFamilyIDs.indexOf(strFamilyId)] : QList<CGuestOSType>(); 2028 } 2029 2030 CGuestOSType VBoxGlobal::vmGuestOSType(const QString &strTypeId, 2031 const QString &strFamilyId /* = QString() */) const 2032 2032 { 2033 2033 QList <CGuestOSType> list; 2034 if (m_guestOSFamilyIDs.contains ( aFamilyId))2035 { 2036 list = m_guestOSTypes [m_guestOSFamilyIDs.indexOf ( aFamilyId)];2034 if (m_guestOSFamilyIDs.contains (strFamilyId)) 2035 { 2036 list = m_guestOSTypes [m_guestOSFamilyIDs.indexOf (strFamilyId)]; 2037 2037 } 2038 2038 else … … 2042 2042 } 2043 2043 for (int j = 0; j < list.size(); ++ j) 2044 if (!list [j].GetId().compare ( aTypeId))2044 if (!list [j].GetId().compare (strTypeId)) 2045 2045 return list [j]; 2046 AssertMsgFailed (("Type ID incorrect: '%s'.", aTypeId.toLatin1().constData()));2046 AssertMsgFailed (("Type ID incorrect: '%s'.", strTypeId.toLatin1().constData())); 2047 2047 return CGuestOSType(); 2048 2048 } 2049 2049 2050 QString VBoxGlobal::vmGuestOSTypeDescription (const QString & aTypeId) const2050 QString VBoxGlobal::vmGuestOSTypeDescription (const QString &strTypeId) const 2051 2051 { 2052 2052 for (int i = 0; i < m_guestOSFamilyIDs.size(); ++ i) … … 2054 2054 QList <CGuestOSType> list (m_guestOSTypes [i]); 2055 2055 for ( int j = 0; j < list.size(); ++ j) 2056 if (!list [j].GetId().compare ( aTypeId))2056 if (!list [j].GetId().compare (strTypeId)) 2057 2057 return list [j].GetDescription(); 2058 2058 } 2059 return QString ::null;2060 } 2061 2062 /* static */ 2063 bool VBoxGlobal::isDOSType (const QString & aOSTypeId)2064 { 2065 if ( aOSTypeId.left (3) == "dos" ||2066 aOSTypeId.left (3) == "win" ||2067 aOSTypeId.left (3) == "os2")2059 return QString(); 2060 } 2061 2062 /* static */ 2063 bool VBoxGlobal::isDOSType (const QString &strOSTypeId) 2064 { 2065 if (strOSTypeId.left (3) == "dos" || 2066 strOSTypeId.left (3) == "win" || 2067 strOSTypeId.left (3) == "os2") 2068 2068 return true; 2069 2069 … … 2071 2071 } 2072 2072 2073 bool VBoxGlobal::switchToMachine(CMachine & machine)2073 bool VBoxGlobal::switchToMachine(CMachine &comMachine) 2074 2074 { 2075 2075 #ifdef VBOX_WS_MAC 2076 ULONG64 id = machine.ShowConsoleWindow();2076 ULONG64 id = comMachine.ShowConsoleWindow(); 2077 2077 #else 2078 WId id = (WId) machine.ShowConsoleWindow();2078 WId id = (WId) comMachine.ShowConsoleWindow(); 2079 2079 #endif 2080 AssertWrapperOk( machine);2081 if (! machine.isOk())2080 AssertWrapperOk(comMachine); 2081 if (!comMachine.isOk()) 2082 2082 return false; 2083 2083 … … 2120 2120 } 2121 2121 2122 bool VBoxGlobal::launchMachine(CMachine & machine, LaunchMode enmLaunchMode /* = LaunchMode_Default */)2122 bool VBoxGlobal::launchMachine(CMachine &comMachine, LaunchMode enmLaunchMode /* = LaunchMode_Default */) 2123 2123 { 2124 2124 /* Switch to machine window(s) if possible: */ 2125 if ( machine.GetSessionState() == KSessionState_Locked /* precondition for CanShowConsoleWindow() */2126 && machine.CanShowConsoleWindow())2125 if ( comMachine.GetSessionState() == KSessionState_Locked /* precondition for CanShowConsoleWindow() */ 2126 && comMachine.CanShowConsoleWindow()) 2127 2127 { 2128 2128 /* For the Selector UI: */ … … 2130 2130 { 2131 2131 /* Just switch to existing VM window: */ 2132 return VBoxGlobal::switchToMachine( machine);2132 return VBoxGlobal::switchToMachine(comMachine); 2133 2133 } 2134 2134 /* For the Runtime UI: */ … … 2137 2137 /* Only separate UI process can reach that place, 2138 2138 * switch to existing VM window and exit. */ 2139 VBoxGlobal::switchToMachine( machine);2139 VBoxGlobal::switchToMachine(comMachine); 2140 2140 return false; 2141 2141 } … … 2145 2145 { 2146 2146 /* Make sure machine-state is one of required: */ 2147 KMachineState state = machine.GetState(); NOREF(state);2148 AssertMsg( state == KMachineState_PoweredOff2149 || state == KMachineState_Saved2150 || state == KMachineState_Teleported2151 || state == KMachineState_Aborted2152 , ("Machine must be PoweredOff/Saved/Teleported/Aborted (%d)", state));2147 KMachineState enmState = comMachine.GetState(); NOREF(enmState); 2148 AssertMsg( enmState == KMachineState_PoweredOff 2149 || enmState == KMachineState_Saved 2150 || enmState == KMachineState_Teleported 2151 || enmState == KMachineState_Aborted 2152 , ("Machine must be PoweredOff/Saved/Teleported/Aborted (%d)", enmState)); 2153 2153 } 2154 2154 2155 2155 /* Create empty session instance: */ 2156 CSession session;2157 session.createInstance(CLSID_Session);2158 if ( session.isNull())2159 { 2160 msgCenter().cannotOpenSession( session);2156 CSession comSession; 2157 comSession.createInstance(CLSID_Session); 2158 if (comSession.isNull()) 2159 { 2160 msgCenter().cannotOpenSession(comSession); 2161 2161 return false; 2162 2162 } … … 2187 2187 2188 2188 /* Prepare "VM spawning" progress: */ 2189 CProgress progress = machine.LaunchVMProcess(session, strType, strEnv);2190 if (! machine.isOk())2189 CProgress comProgress = comMachine.LaunchVMProcess(comSession, strType, strEnv); 2190 if (!comMachine.isOk()) 2191 2191 { 2192 2192 /* If the VM is started separately and the VM process is already running, then it is OK. */ 2193 2193 if (enmLaunchMode == LaunchMode_Separate) 2194 2194 { 2195 KMachineState state = machine.GetState();2196 if ( state >= KMachineState_FirstOnline2197 && state <= KMachineState_LastOnline)2195 KMachineState enmState = comMachine.GetState(); 2196 if ( enmState >= KMachineState_FirstOnline 2197 && enmState <= KMachineState_LastOnline) 2198 2198 { 2199 2199 /* Already running. */ … … 2202 2202 } 2203 2203 2204 msgCenter().cannotOpenSession( machine);2204 msgCenter().cannotOpenSession(comMachine); 2205 2205 return false; 2206 2206 } … … 2211 2211 * If starting separately, then show the progress now. */ 2212 2212 int iSpawningDuration = enmLaunchMode == LaunchMode_Separate ? 0 : 60000; 2213 msgCenter().showModalProgressDialog( progress, machine.GetName(),2213 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), 2214 2214 ":/progress_start_90px.png", 0, iSpawningDuration); 2215 if (! progress.isOk() || progress.GetResultCode() != 0)2216 msgCenter().cannotOpenSession( progress, machine.GetName());2215 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 2216 msgCenter().cannotOpenSession(comProgress, comMachine.GetName()); 2217 2217 2218 2218 /* Unlock machine, close session: */ 2219 session.UnlockMachine();2219 comSession.UnlockMachine(); 2220 2220 2221 2221 /* True finally: */ … … 2226 2226 { 2227 2227 /* Prepare session: */ 2228 CSession session;2228 CSession comSession; 2229 2229 2230 2230 /* Simulate try-catch block: */ … … 2233 2233 { 2234 2234 /* Create empty session instance: */ 2235 session.createInstance(CLSID_Session);2236 if ( session.isNull())2237 { 2238 msgCenter().cannotOpenSession( session);2235 comSession.createInstance(CLSID_Session); 2236 if (comSession.isNull()) 2237 { 2238 msgCenter().cannotOpenSession(comSession); 2239 2239 break; 2240 2240 } 2241 2241 2242 2242 /* Search for the corresponding machine: */ 2243 CMachine machine = m_vbox.FindMachine(strId);2244 if ( machine.isNull())2245 { 2246 msgCenter().cannotFindMachineById(m_ vbox, strId);2243 CMachine comMachine = m_comVBox.FindMachine(strId); 2244 if (comMachine.isNull()) 2245 { 2246 msgCenter().cannotFindMachineById(m_comVBox, strId); 2247 2247 break; 2248 2248 } 2249 2249 2250 2250 if (lockType == KLockType_VM) 2251 session.SetName("GUI/Qt");2251 comSession.SetName("GUI/Qt"); 2252 2252 2253 2253 /* Lock found machine to session: */ 2254 machine.LockMachine(session, lockType);2255 if (! machine.isOk())2256 { 2257 msgCenter().cannotOpenSession( machine);2254 comMachine.LockMachine(comSession, lockType); 2255 if (!comMachine.isOk()) 2256 { 2257 msgCenter().cannotOpenSession(comMachine); 2258 2258 break; 2259 2259 } 2260 2260 2261 2261 /* Pass the language ID as the property to the guest: */ 2262 if ( session.GetType() == KSessionType_Shared)2263 { 2264 CMachine startedMachine = session.GetMachine();2262 if (comSession.GetType() == KSessionType_Shared) 2263 { 2264 CMachine comStartedMachine = comSession.GetMachine(); 2265 2265 /* Make sure that the language is in two letter code. 2266 2266 * Note: if languageId() returns an empty string lang.name() will 2267 2267 * return "C" which is an valid language code. */ 2268 2268 QLocale lang(VBoxGlobal::languageId()); 2269 startedMachine.SetGuestPropertyValue("/VirtualBox/HostInfo/GUI/LanguageID", lang.name());2269 comStartedMachine.SetGuestPropertyValue("/VirtualBox/HostInfo/GUI/LanguageID", lang.name()); 2270 2270 } 2271 2271 … … 2276 2276 /* Cleanup try-catch block: */ 2277 2277 if (!fSuccess) 2278 session.detach();2278 comSession.detach(); 2279 2279 2280 2280 /* Return session: */ 2281 return session;2281 return comSession; 2282 2282 } 2283 2283 … … 2286 2286 { 2287 2287 /* Prepare a list of pairs with the form <tt>{"Backend Name", "*.suffix1 .suffix2 ..."}</tt>. */ 2288 CSystemProperties systemProperties = vboxGlobal().virtualBox().GetSystemProperties();2289 QVector<CMediumFormat> mediumFormats = systemProperties.GetMediumFormats();2288 CSystemProperties comSystemProperties = vboxGlobal().virtualBox().GetSystemProperties(); 2289 QVector<CMediumFormat> mediumFormats = comSystemProperties.GetMediumFormats(); 2290 2290 QList< QPair<QString, QString> > backendPropList; 2291 2291 for (int i = 0; i < mediumFormats.size(); ++ i) … … 2329 2329 { 2330 2330 /* Make sure VBoxGlobal is already valid: */ 2331 AssertReturnVoid(m Valid);2331 AssertReturnVoid(m_fValid); 2332 2332 2333 2333 /* Make sure medium-enumerator is already created: */ … … 2340 2340 2341 2341 /* Ignore the request during VBoxGlobal cleanup: */ 2342 if (s_fClean upInProgress)2342 if (s_fCleaningUp) 2343 2343 return; 2344 2344 … … 2348 2348 return; 2349 2349 2350 if (m_me diumEnumeratorDtorRwLock.tryLockForRead())2350 if (m_meCleanupProtectionToken.tryLockForRead()) 2351 2351 { 2352 2352 /* Redirect request to medium-enumerator: */ 2353 2353 if (m_pMediumEnumerator) 2354 2354 m_pMediumEnumerator->enumerateMediums(); 2355 m_me diumEnumeratorDtorRwLock.unlock();2355 m_meCleanupProtectionToken.unlock(); 2356 2356 } 2357 2357 } … … 2366 2366 UIMedium VBoxGlobal::medium(const QString &strMediumID) const 2367 2367 { 2368 if (m_me diumEnumeratorDtorRwLock.tryLockForRead())2368 if (m_meCleanupProtectionToken.tryLockForRead()) 2369 2369 { 2370 2370 /* Redirect call to medium-enumerator: */ 2371 UIMedium result;2371 UIMedium guiMedium; 2372 2372 if (m_pMediumEnumerator) 2373 result= m_pMediumEnumerator->medium(strMediumID);2374 m_me diumEnumeratorDtorRwLock.unlock();2375 return result;2373 guiMedium = m_pMediumEnumerator->medium(strMediumID); 2374 m_meCleanupProtectionToken.unlock(); 2375 return guiMedium; 2376 2376 } 2377 2377 return UIMedium(); … … 2380 2380 QList<QString> VBoxGlobal::mediumIDs() const 2381 2381 { 2382 if (m_me diumEnumeratorDtorRwLock.tryLockForRead())2382 if (m_meCleanupProtectionToken.tryLockForRead()) 2383 2383 { 2384 2384 /* Redirect call to medium-enumerator: */ 2385 QList<QString> result;2385 QList<QString> listOfMediums; 2386 2386 if (m_pMediumEnumerator) 2387 result= m_pMediumEnumerator->mediumIDs();2388 m_me diumEnumeratorDtorRwLock.unlock();2389 return result;2387 listOfMediums = m_pMediumEnumerator->mediumIDs(); 2388 m_meCleanupProtectionToken.unlock(); 2389 return listOfMediums; 2390 2390 } 2391 2391 return QList<QString>(); 2392 2392 } 2393 2393 2394 void VBoxGlobal::createMedium(const UIMedium & medium)2395 { 2396 if (m_me diumEnumeratorDtorRwLock.tryLockForRead())2394 void VBoxGlobal::createMedium(const UIMedium &guiMedium) 2395 { 2396 if (m_meCleanupProtectionToken.tryLockForRead()) 2397 2397 { 2398 2398 /* Create medium in medium-enumerator: */ 2399 2399 if (m_pMediumEnumerator) 2400 m_pMediumEnumerator->createMedium( medium);2401 m_me diumEnumeratorDtorRwLock.unlock();2400 m_pMediumEnumerator->createMedium(guiMedium); 2401 m_meCleanupProtectionToken.unlock(); 2402 2402 } 2403 2403 } … … 2405 2405 void VBoxGlobal::deleteMedium(const QString &strMediumID) 2406 2406 { 2407 if (m_me diumEnumeratorDtorRwLock.tryLockForRead())2407 if (m_meCleanupProtectionToken.tryLockForRead()) 2408 2408 { 2409 2409 /* Delete medium from medium-enumerator: */ 2410 2410 if (m_pMediumEnumerator) 2411 2411 m_pMediumEnumerator->deleteMedium(strMediumID); 2412 m_me diumEnumeratorDtorRwLock.unlock();2413 } 2414 } 2415 2416 QString VBoxGlobal::openMedium(UIMediumType mediumType, QString strMediumLocation, QWidget *pParent /* = 0 */)2412 m_meCleanupProtectionToken.unlock(); 2413 } 2414 } 2415 2416 QString VBoxGlobal::openMedium(UIMediumType enmMediumType, QString strMediumLocation, QWidget *pParent /* = 0 */) 2417 2417 { 2418 2418 /* Convert to native separators: */ … … 2420 2420 2421 2421 /* Initialize variables: */ 2422 CVirtualBox vbox = virtualBox();2422 CVirtualBox comVBox = virtualBox(); 2423 2423 2424 2424 /* Remember the path of the last chosen medium: */ 2425 switch ( mediumType)2425 switch (enmMediumType) 2426 2426 { 2427 2427 case UIMediumType_HardDisk: gEDataManager->setRecentFolderForHardDrives(QFileInfo(strMediumLocation).absolutePath()); break; … … 2433 2433 /* Update recently used list: */ 2434 2434 QStringList recentMediumList; 2435 switch ( mediumType)2435 switch (enmMediumType) 2436 2436 { 2437 2437 case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break; … … 2444 2444 recentMediumList.prepend(strMediumLocation); 2445 2445 while(recentMediumList.size() > 5) recentMediumList.removeLast(); 2446 switch ( mediumType)2446 switch (enmMediumType) 2447 2447 { 2448 2448 case UIMediumType_HardDisk: gEDataManager->setRecentListOfHardDrives(recentMediumList); break; … … 2453 2453 2454 2454 /* Open corresponding medium: */ 2455 CMedium c medium = vbox.OpenMedium(strMediumLocation, mediumTypeToGlobal(mediumType), KAccessMode_ReadWrite, false);2456 2457 if ( vbox.isOk())2455 CMedium comMedium = comVBox.OpenMedium(strMediumLocation, mediumTypeToGlobal(enmMediumType), KAccessMode_ReadWrite, false); 2456 2457 if (comVBox.isOk()) 2458 2458 { 2459 2459 /* Prepare vbox medium wrapper: */ 2460 UIMedium uimedium = medium(cmedium.GetId());2460 UIMedium guiMedium = medium(comMedium.GetId()); 2461 2461 2462 2462 /* First of all we should test if that medium already opened: */ 2463 if ( uimedium.isNull())2463 if (guiMedium.isNull()) 2464 2464 { 2465 2465 /* And create new otherwise: */ 2466 uimedium = UIMedium(cmedium, mediumType, KMediumState_Created);2467 vboxGlobal().createMedium(uimedium);2468 } 2469 2470 /* Return uimedium id: */2471 return uimedium.id();2466 guiMedium = UIMedium(comMedium, enmMediumType, KMediumState_Created); 2467 createMedium(guiMedium); 2468 } 2469 2470 /* Return guiMedium id: */ 2471 return guiMedium.id(); 2472 2472 } 2473 2473 else 2474 msgCenter().cannotOpenMedium( vbox, mediumType, strMediumLocation, pParent);2474 msgCenter().cannotOpenMedium(comVBox, enmMediumType, strMediumLocation, pParent); 2475 2475 2476 2476 return QString(); 2477 2477 } 2478 2478 2479 QString VBoxGlobal::openMediumWithFileOpenDialog(UIMediumType mediumType, QWidget *pParent,2479 QString VBoxGlobal::openMediumWithFileOpenDialog(UIMediumType enmMediumType, QWidget *pParent, 2480 2480 const QString &strDefaultFolder /* = QString() */, 2481 2481 bool fUseLastFolder /* = false */) … … 2489 2489 QString allType; 2490 2490 QString strLastFolder; 2491 switch ( mediumType)2491 switch (enmMediumType) 2492 2492 { 2493 2493 case UIMediumType_HardDisk: … … 2553 2553 /* If dialog has some result: */ 2554 2554 if (!files.empty() && !files[0].isEmpty()) 2555 return openMedium( mediumType, files[0], pParent);2555 return openMedium(enmMediumType, files[0], pParent); 2556 2556 2557 2557 return QString(); 2558 2558 } 2559 2559 2560 QString VBoxGlobal::createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &str MachineFolder)2561 { 2562 AssertReturn(!str MachineFolder.isEmpty(), QString());2560 QString VBoxGlobal::createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &strFolder) 2561 { 2562 AssertReturn(!strFolder.isEmpty(), QString()); 2563 2563 2564 2564 /* Figure out where to start browsing for content. */ … … 2585 2585 /* Produce the VISO. */ 2586 2586 char szVisoPath[RTPATH_MAX]; 2587 int vrc = RTPathJoin(szVisoPath, sizeof(szVisoPath), str MachineFolder.toUtf8().constData(), "ad-hoc.viso");2587 int vrc = RTPathJoin(szVisoPath, sizeof(szVisoPath), strFolder.toUtf8().constData(), "ad-hoc.viso"); 2588 2588 if (RT_SUCCESS(vrc)) 2589 2589 { … … 2632 2632 void VBoxGlobal::prepareStorageMenu(QMenu &menu, 2633 2633 QObject *pListener, const char *pszSlotName, 2634 const CMachine & machine, const QString &strControllerName, const StorageSlot &storageSlot)2634 const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot) 2635 2635 { 2636 2636 /* Current attachment attributes: */ 2637 const CMediumAttachment c urrentAttachment = machine.GetMediumAttachment(strControllerName, storageSlot.port, storageSlot.device);2638 const CMedium c urrentMedium = currentAttachment.GetMedium();2639 const QString strCurrentID = c urrentMedium.isNull() ? QString() : currentMedium.GetId();2640 const QString strCurrentLocation = c urrentMedium.isNull() ? QString() : currentMedium.GetLocation();2637 const CMediumAttachment comCurrentAttachment = comMachine.GetMediumAttachment(strControllerName, storageSlot.port, storageSlot.device); 2638 const CMedium comCurrentMedium = comCurrentAttachment.GetMedium(); 2639 const QString strCurrentID = comCurrentMedium.isNull() ? QString() : comCurrentMedium.GetId(); 2640 const QString strCurrentLocation = comCurrentMedium.isNull() ? QString() : comCurrentMedium.GetLocation(); 2641 2641 2642 2642 /* Other medium-attachments of same machine: */ 2643 const CMediumAttachmentVector attachments = machine.GetMediumAttachments();2643 const CMediumAttachmentVector comAttachments = comMachine.GetMediumAttachments(); 2644 2644 2645 2645 /* Determine device & medium types: */ 2646 const UIMediumType mediumType = mediumTypeToLocal(currentAttachment.GetType());2647 AssertMsgReturnVoid( mediumType != UIMediumType_Invalid, ("Incorrect storage medium type!\n"));2646 const UIMediumType enmMediumType = mediumTypeToLocal(comCurrentAttachment.GetType()); 2647 AssertMsgReturnVoid(enmMediumType != UIMediumType_Invalid, ("Incorrect storage medium type!\n")); 2648 2648 2649 2649 2650 2650 /* Prepare open-existing-medium action: */ 2651 2651 QAction *pActionOpenExistingMedium = menu.addAction(UIIconPool::iconSet(":/select_file_16px.png"), QString(), pListener, pszSlotName); 2652 pActionOpenExistingMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, c urrentAttachment.GetPort(), currentAttachment.GetDevice(),2653 mediumType)));2652 pActionOpenExistingMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(), comCurrentAttachment.GetDevice(), 2653 enmMediumType))); 2654 2654 pActionOpenExistingMedium->setText(QApplication::translate("UIMachineSettingsStorage", "Choose disk image...", "This is used for hard disks, optical media and floppies")); 2655 2655 2656 2656 /* Prepare ad-hoc-viso action for DVD-ROMs: */ 2657 if ( mediumType == UIMediumType_DVD)2657 if (enmMediumType == UIMediumType_DVD) 2658 2658 { 2659 2659 QAction *pActionAdHocViso = menu.addAction(UIIconPool::iconSet(":/select_file_16px.png"), QString(), 2660 2660 pListener, pszSlotName); 2661 pActionAdHocViso->setData(QVariant::fromValue(UIMediumTarget(strControllerName, c urrentAttachment.GetPort(),2662 c urrentAttachment.GetDevice(), mediumType,2661 pActionAdHocViso->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(), 2662 comCurrentAttachment.GetDevice(), enmMediumType, 2663 2663 UIMediumTarget::UIMediumTargetType_CreateAdHocVISO))); 2664 2664 pActionAdHocViso->setText(QApplication::translate("UIMachineSettingsStorage", "Create ad hoc VISO...", "This is used for optical media")); … … 2670 2670 2671 2671 /* Get existing-host-drive vector: */ 2672 CMediumVector mediums;2673 switch ( mediumType)2674 { 2675 case UIMediumType_DVD: mediums = vboxGlobal().host().GetDVDDrives(); break;2676 case UIMediumType_Floppy: mediums = vboxGlobal().host().GetFloppyDrives(); break;2672 CMediumVector comMediums; 2673 switch (enmMediumType) 2674 { 2675 case UIMediumType_DVD: comMediums = host().GetDVDDrives(); break; 2676 case UIMediumType_Floppy: comMediums = host().GetFloppyDrives(); break; 2677 2677 default: break; 2678 2678 } 2679 2679 /* Prepare choose-existing-host-drive actions: */ 2680 foreach (const CMedium & medium, mediums)2680 foreach (const CMedium &comMedium, comMediums) 2681 2681 { 2682 2682 /* Make sure host-drive usage is unique: */ 2683 2683 bool fIsHostDriveUsed = false; 2684 foreach (const CMediumAttachment & otherAttachment, attachments)2685 { 2686 if ( otherAttachment != currentAttachment)2684 foreach (const CMediumAttachment &comOtherAttachment, comAttachments) 2685 { 2686 if (comOtherAttachment != comCurrentAttachment) 2687 2687 { 2688 const CMedium & otherMedium = otherAttachment.GetMedium();2689 if (! otherMedium.isNull() && otherMedium.GetId() == medium.GetId())2688 const CMedium &comOtherMedium = comOtherAttachment.GetMedium(); 2689 if (!comOtherMedium.isNull() && comOtherMedium.GetId() == comMedium.GetId()) 2690 2690 { 2691 2691 fIsHostDriveUsed = true; … … 2697 2697 if (!fIsHostDriveUsed) 2698 2698 { 2699 QAction *pActionChooseHostDrive = menu.addAction(UIMedium( medium, mediumType).name(), pListener, pszSlotName);2699 QAction *pActionChooseHostDrive = menu.addAction(UIMedium(comMedium, enmMediumType).name(), pListener, pszSlotName); 2700 2700 pActionChooseHostDrive->setCheckable(true); 2701 pActionChooseHostDrive->setChecked(!c urrentMedium.isNull() && medium.GetId() == strCurrentID);2702 pActionChooseHostDrive->setData(QVariant::fromValue(UIMediumTarget(strControllerName, c urrentAttachment.GetPort(), currentAttachment.GetDevice(),2703 mediumType, UIMediumTarget::UIMediumTargetType_WithID, medium.GetId())));2701 pActionChooseHostDrive->setChecked(!comCurrentMedium.isNull() && comMedium.GetId() == strCurrentID); 2702 pActionChooseHostDrive->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(), comCurrentAttachment.GetDevice(), 2703 enmMediumType, UIMediumTarget::UIMediumTargetType_WithID, comMedium.GetId()))); 2704 2704 } 2705 2705 } … … 2709 2709 QStringList recentMediumList; 2710 2710 QStringList recentMediumListUsed; 2711 switch ( mediumType)2711 switch (enmMediumType) 2712 2712 { 2713 2713 case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break; … … 2731 2731 /* Make sure recent-medium usage is unique: */ 2732 2732 bool fIsRecentMediumUsed = false; 2733 foreach (const CMediumAttachment &otherAttachment, attachments)2734 { 2735 if (otherAttachment != c urrentAttachment)2733 foreach (const CMediumAttachment &otherAttachment, comAttachments) 2734 { 2735 if (otherAttachment != comCurrentAttachment) 2736 2736 { 2737 const CMedium & otherMedium = otherAttachment.GetMedium();2738 if (! otherMedium.isNull() && otherMedium.GetLocation() == strRecentMediumLocation)2737 const CMedium &comOtherMedium = otherAttachment.GetMedium(); 2738 if (!comOtherMedium.isNull() && comOtherMedium.GetLocation() == strRecentMediumLocation) 2739 2739 { 2740 2740 fIsRecentMediumUsed = true; … … 2748 2748 QAction *pActionChooseRecentMedium = menu.addAction(QFileInfo(strRecentMediumLocation).fileName(), pListener, pszSlotName); 2749 2749 pActionChooseRecentMedium->setCheckable(true); 2750 pActionChooseRecentMedium->setChecked(!c urrentMedium.isNull() && strRecentMediumLocation == strCurrentLocation);2751 pActionChooseRecentMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, c urrentAttachment.GetPort(), currentAttachment.GetDevice(),2752 mediumType, UIMediumTarget::UIMediumTargetType_WithLocation, strRecentMediumLocation)));2750 pActionChooseRecentMedium->setChecked(!comCurrentMedium.isNull() && strRecentMediumLocation == strCurrentLocation); 2751 pActionChooseRecentMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(), comCurrentAttachment.GetDevice(), 2752 enmMediumType, UIMediumTarget::UIMediumTargetType_WithLocation, strRecentMediumLocation))); 2753 2753 pActionChooseRecentMedium->setToolTip(strRecentMediumLocation); 2754 2754 } … … 2757 2757 2758 2758 /* Last action for optical/floppy attachments only: */ 2759 if ( mediumType == UIMediumType_DVD || mediumType == UIMediumType_Floppy)2759 if (enmMediumType == UIMediumType_DVD || enmMediumType == UIMediumType_Floppy) 2760 2760 { 2761 2761 /* Insert separator: */ … … 2764 2764 /* Prepare unmount-current-medium action: */ 2765 2765 QAction *pActionUnmountMedium = menu.addAction(QString(), pListener, pszSlotName); 2766 pActionUnmountMedium->setEnabled(!c urrentMedium.isNull());2767 pActionUnmountMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, c urrentAttachment.GetPort(), currentAttachment.GetDevice())));2766 pActionUnmountMedium->setEnabled(!comCurrentMedium.isNull()); 2767 pActionUnmountMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(), comCurrentAttachment.GetDevice()))); 2768 2768 pActionUnmountMedium->setText(QApplication::translate("UIMachineSettingsStorage", "Remove disk from virtual drive")); 2769 if ( mediumType == UIMediumType_DVD)2769 if (enmMediumType == UIMediumType_DVD) 2770 2770 pActionUnmountMedium->setIcon(UIIconPool::iconSet(":/cd_unmount_16px.png", ":/cd_unmount_disabled_16px.png")); 2771 else if ( mediumType == UIMediumType_Floppy)2771 else if (enmMediumType == UIMediumType_Floppy) 2772 2772 pActionUnmountMedium->setIcon(UIIconPool::iconSet(":/fd_unmount_16px.png", ":/fd_unmount_disabled_16px.png")); 2773 2773 } 2774 2774 } 2775 2775 2776 void VBoxGlobal::updateMachineStorage(const CMachine &co nstMachine, const UIMediumTarget &target)2776 void VBoxGlobal::updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target) 2777 2777 { 2778 2778 /* Mount (by default): */ 2779 2779 bool fMount = true; 2780 2780 /* Null medium (by default): */ 2781 CMedium c medium;2781 CMedium comMedium; 2782 2782 /* With null ID (by default): */ 2783 2783 QString strActualID; 2784 2784 2785 2785 /* Current mount-target attributes: */ 2786 const CStorageController c urrentController = constMachine.GetStorageControllerByName(target.name);2787 const KStorageBus currentStorageBus = currentController.GetBus();2788 const CMediumAttachment c urrentAttachment = constMachine.GetMediumAttachment(target.name, target.port, target.device);2789 const CMedium c urrentMedium = currentAttachment.GetMedium();2790 const QString strCurrentID = c urrentMedium.isNull() ? QString() : currentMedium.GetId();2791 const QString strCurrentLocation = c urrentMedium.isNull() ? QString() : currentMedium.GetLocation();2786 const CStorageController comCurrentController = comConstMachine.GetStorageControllerByName(target.name); 2787 const KStorageBus enmCurrentStorageBus = comCurrentController.GetBus(); 2788 const CMediumAttachment comCurrentAttachment = comConstMachine.GetMediumAttachment(target.name, target.port, target.device); 2789 const CMedium comCurrentMedium = comCurrentAttachment.GetMedium(); 2790 const QString strCurrentID = comCurrentMedium.isNull() ? QString() : comCurrentMedium.GetId(); 2791 const QString strCurrentLocation = comCurrentMedium.isNull() ? QString() : comCurrentMedium.GetLocation(); 2792 2792 2793 2793 /* Which additional info do we have? */ … … 2814 2814 } 2815 2815 /* Call for file-open dialog: */ 2816 const QString strMachineFolder(QFileInfo(co nstMachine.GetSettingsFilePath()).absolutePath());2816 const QString strMachineFolder(QFileInfo(comConstMachine.GetSettingsFilePath()).absolutePath()); 2817 2817 const QString strMediumID = target.type != UIMediumTarget::UIMediumTargetType_CreateAdHocVISO 2818 2818 ? vboxGlobal().openMediumWithFileOpenDialog(target.mediumType, … … 2838 2838 2839 2839 /* Prepare target medium: */ 2840 const UIMedium uimedium = vboxGlobal().medium(strNewID);2841 c medium = uimedium.medium();2840 const UIMedium guiMedium = vboxGlobal().medium(strNewID); 2841 comMedium = guiMedium.medium(); 2842 2842 strActualID = fMount ? strNewID : strCurrentID; 2843 2843 break; … … 2856 2856 2857 2857 /* Prepare target medium: */ 2858 const UIMedium uimedium = fMount ? vboxGlobal().medium(strNewID) : UIMedium();2859 c medium = fMount ? uimedium.medium() : CMedium();2858 const UIMedium guiMedium = fMount ? vboxGlobal().medium(strNewID) : UIMedium(); 2859 comMedium = fMount ? guiMedium.medium() : CMedium(); 2860 2860 strActualID = fMount ? strNewID : strCurrentID; 2861 2861 break; … … 2868 2868 2869 2869 /* Get editable machine: */ 2870 CSession session;2871 CMachine machine = constMachine;2872 KSessionState sessionState = machine.GetSessionState();2870 CSession comSession; 2871 CMachine comMachine = comConstMachine; 2872 KSessionState enmSessionState = comMachine.GetSessionState(); 2873 2873 /* Session state unlocked? */ 2874 if ( sessionState == KSessionState_Unlocked)2874 if (enmSessionState == KSessionState_Unlocked) 2875 2875 { 2876 2876 /* Open own 'write' session: */ 2877 session = openSession(machine.GetId());2878 AssertReturnVoid(! session.isNull());2879 machine = session.GetMachine();2877 comSession = openSession(comMachine.GetId()); 2878 AssertReturnVoid(!comSession.isNull()); 2879 comMachine = comSession.GetMachine(); 2880 2880 } 2881 2881 /* Is it Selector UI call? */ … … 2883 2883 { 2884 2884 /* Open existing 'shared' session: */ 2885 session = openExistingSession(machine.GetId());2886 AssertReturnVoid(! session.isNull());2887 machine = session.GetMachine();2885 comSession = openExistingSession(comMachine.GetId()); 2886 AssertReturnVoid(!comSession.isNull()); 2887 comMachine = comSession.GetMachine(); 2888 2888 } 2889 2889 /* Else this is Runtime UI call … … 2896 2896 { 2897 2897 /* Detaching: */ 2898 machine.DetachDevice(target.name, target.port, target.device);2899 fWasMounted = machine.isOk();2898 comMachine.DetachDevice(target.name, target.port, target.device); 2899 fWasMounted = comMachine.isOk(); 2900 2900 if (!fWasMounted) 2901 msgCenter().cannotDetachDevice( machine, UIMediumType_HardDisk, strCurrentLocation,2902 StorageSlot( currentStorageBus, target.port, target.device));2901 msgCenter().cannotDetachDevice(comMachine, UIMediumType_HardDisk, strCurrentLocation, 2902 StorageSlot(enmCurrentStorageBus, target.port, target.device)); 2903 2903 else 2904 2904 { 2905 2905 /* Attaching: */ 2906 machine.AttachDevice(target.name, target.port, target.device, KDeviceType_HardDisk, cmedium);2907 fWasMounted = machine.isOk();2906 comMachine.AttachDevice(target.name, target.port, target.device, KDeviceType_HardDisk, comMedium); 2907 fWasMounted = comMachine.isOk(); 2908 2908 if (!fWasMounted) 2909 msgCenter().cannotAttachDevice( machine, UIMediumType_HardDisk, strCurrentLocation,2910 StorageSlot( currentStorageBus, target.port, target.device));2909 msgCenter().cannotAttachDevice(comMachine, UIMediumType_HardDisk, strCurrentLocation, 2910 StorageSlot(enmCurrentStorageBus, target.port, target.device)); 2911 2911 } 2912 2912 } … … 2915 2915 { 2916 2916 /* Remounting: */ 2917 machine.MountMedium(target.name, target.port, target.device, cmedium, false /* force? */);2918 fWasMounted = machine.isOk();2917 comMachine.MountMedium(target.name, target.port, target.device, comMedium, false /* force? */); 2918 fWasMounted = comMachine.isOk(); 2919 2919 if (!fWasMounted) 2920 2920 { 2921 2921 /* Ask for force remounting: */ 2922 if (msgCenter().cannotRemountMedium( machine, vboxGlobal().medium(strActualID),2922 if (msgCenter().cannotRemountMedium(comMachine, vboxGlobal().medium(strActualID), 2923 2923 fMount, true /* retry? */)) 2924 2924 { 2925 2925 /* Force remounting: */ 2926 machine.MountMedium(target.name, target.port, target.device, cmedium, true /* force? */);2927 fWasMounted = machine.isOk();2926 comMachine.MountMedium(target.name, target.port, target.device, comMedium, true /* force? */); 2927 fWasMounted = comMachine.isOk(); 2928 2928 if (!fWasMounted) 2929 msgCenter().cannotRemountMedium( machine, vboxGlobal().medium(strActualID),2929 msgCenter().cannotRemountMedium(comMachine, vboxGlobal().medium(strActualID), 2930 2930 fMount, false /* retry? */); 2931 2931 } … … 2935 2935 { 2936 2936 /* Disable First RUN Wizard: */ 2937 if (gEDataManager->machineFirstTimeStarted( machine.GetId()))2938 gEDataManager->setMachineFirstTimeStarted(false, machine.GetId());2937 if (gEDataManager->machineFirstTimeStarted(comMachine.GetId())) 2938 gEDataManager->setMachineFirstTimeStarted(false, comMachine.GetId()); 2939 2939 } 2940 2940 } … … 2943 2943 if (fWasMounted) 2944 2944 { 2945 machine.SaveSettings();2946 if (! machine.isOk())2947 msgCenter().cannotSaveMachineSettings( machine, windowManager().mainWindowShown());2948 } 2949 2950 /* Close session to editable machine if necessary: */2951 if (! session.isNull())2952 session.UnlockMachine();2953 } 2954 2955 QString VBoxGlobal::details(const CMedium &c medium, bool fPredictDiff, bool fUseHtml /* = true */)2945 comMachine.SaveSettings(); 2946 if (!comMachine.isOk()) 2947 msgCenter().cannotSaveMachineSettings(comMachine, windowManager().mainWindowShown()); 2948 } 2949 2950 /* Close session to editable comMachine if necessary: */ 2951 if (!comSession.isNull()) 2952 comSession.UnlockMachine(); 2953 } 2954 2955 QString VBoxGlobal::details(const CMedium &comMedium, bool fPredictDiff, bool fUseHtml /* = true */) 2956 2956 { 2957 2957 /* Search for corresponding UI medium: */ 2958 const QString strMediumID = c medium.isNull() ? UIMedium::nullID() : cmedium.GetId();2959 UIMedium uimedium = medium(strMediumID);2960 if (!c medium.isNull() && uimedium.isNull())2958 const QString strMediumID = comMedium.isNull() ? UIMedium::nullID() : comMedium.GetId(); 2959 UIMedium guiMedium = medium(strMediumID); 2960 if (!comMedium.isNull() && guiMedium.isNull()) 2961 2961 { 2962 2962 /* UI medium may be new and not among our mediums, request enumeration: */ … … 2965 2965 /* Search for corresponding UI medium again: */ 2966 2966 2967 uimedium = medium(strMediumID);2968 if ( uimedium.isNull())2967 guiMedium = medium(strMediumID); 2968 if (guiMedium.isNull()) 2969 2969 { 2970 2970 /* Medium might be deleted already, return null string: */ … … 2974 2974 2975 2975 /* Return UI medium details: */ 2976 return fUseHtml ? uimedium.detailsHTML(true /* aNoDiffs*/, fPredictDiff) :2977 uimedium.details(true /* aNoDiffs*/, fPredictDiff);2976 return fUseHtml ? guiMedium.detailsHTML(true /* no diffs? */, fPredictDiff) : 2977 guiMedium.details(true /* no diffs? */, fPredictDiff); 2978 2978 } 2979 2979 … … 3007 3007 #endif /* RT_OS_LINUX */ 3008 3008 3009 QString VBoxGlobal::details (const CUSBDevice & aDevice) const3010 { 3011 QString s Details;3012 if ( aDevice.isNull())3013 s Details = tr("Unknown device", "USB device details");3009 QString VBoxGlobal::details (const CUSBDevice &comDevice) const 3010 { 3011 QString strDetails; 3012 if (comDevice.isNull()) 3013 strDetails = tr("Unknown device", "USB device details"); 3014 3014 else 3015 3015 { 3016 QVector<QString> devInfoVector = aDevice.GetDeviceInfo();3017 QString m;3018 QString p;3016 QVector<QString> devInfoVector = comDevice.GetDeviceInfo(); 3017 QString strManufacturer; 3018 QString strProduct; 3019 3019 3020 3020 if (devInfoVector.size() >= 1) 3021 m= devInfoVector[0].trimmed();3021 strManufacturer = devInfoVector[0].trimmed(); 3022 3022 if (devInfoVector.size() >= 2) 3023 p= devInfoVector[1].trimmed();3024 3025 if ( m.isEmpty() && p.isEmpty())3026 { 3027 s Details =3023 strProduct = devInfoVector[1].trimmed(); 3024 3025 if (strManufacturer.isEmpty() && strProduct.isEmpty()) 3026 { 3027 strDetails = 3028 3028 tr ("Unknown device %1:%2", "USB device details") 3029 .arg (QString().sprintf ("%04hX", aDevice.GetVendorId()))3030 .arg (QString().sprintf ("%04hX", aDevice.GetProductId()));3029 .arg (QString().sprintf ("%04hX", comDevice.GetVendorId())) 3030 .arg (QString().sprintf ("%04hX", comDevice.GetProductId())); 3031 3031 } 3032 3032 else 3033 3033 { 3034 if ( p.toUpper().startsWith (m.toUpper()))3035 s Details = p;3034 if (strProduct.toUpper().startsWith (strManufacturer.toUpper())) 3035 strDetails = strProduct; 3036 3036 else 3037 s Details = m + " " + p;3038 } 3039 ushort r = aDevice.GetRevision();3040 if ( r!= 0)3041 s Details += QString().sprintf (" [%04hX]", r);3042 } 3043 3044 return s Details.trimmed();3045 } 3046 3047 QString VBoxGlobal::toolTip (const CUSBDevice & aDevice) const3048 { 3049 QString tip =3037 strDetails = strManufacturer + " " + strProduct; 3038 } 3039 ushort iRev = comDevice.GetRevision(); 3040 if (iRev != 0) 3041 strDetails += QString().sprintf (" [%04hX]", iRev); 3042 } 3043 3044 return strDetails.trimmed(); 3045 } 3046 3047 QString VBoxGlobal::toolTip (const CUSBDevice &comDevice) const 3048 { 3049 QString strTip = 3050 3050 tr ("<nobr>Vendor ID: %1</nobr><br>" 3051 3051 "<nobr>Product ID: %2</nobr><br>" 3052 3052 "<nobr>Revision: %3</nobr>", "USB device tooltip") 3053 .arg (QString().sprintf ("%04hX", aDevice.GetVendorId()))3054 .arg (QString().sprintf ("%04hX", aDevice.GetProductId()))3055 .arg (QString().sprintf ("%04hX", aDevice.GetRevision()));3056 3057 QString s er = aDevice.GetSerialNumber();3058 if (!s er.isEmpty())3059 tip += QString (tr ("<br><nobr>Serial No. %1</nobr>", "USB device tooltip"))3060 .arg (ser);3053 .arg (QString().sprintf ("%04hX", comDevice.GetVendorId())) 3054 .arg (QString().sprintf ("%04hX", comDevice.GetProductId())) 3055 .arg (QString().sprintf ("%04hX", comDevice.GetRevision())); 3056 3057 QString strSerial = comDevice.GetSerialNumber(); 3058 if (!strSerial.isEmpty()) 3059 strTip += QString (tr ("<br><nobr>Serial No. %1</nobr>", "USB device tooltip")) 3060 .arg (strSerial); 3061 3061 3062 3062 /* add the state field if it's a host USB device */ 3063 CHostUSBDevice hostDev ( aDevice);3063 CHostUSBDevice hostDev (comDevice); 3064 3064 if (!hostDev.isNull()) 3065 3065 { 3066 tip += QString (tr ("<br><nobr>State: %1</nobr>", "USB device tooltip"))3067 .arg (gpConverter->toString (hostDev.GetState()));3068 } 3069 3070 return tip;3071 } 3072 3073 QString VBoxGlobal::toolTip (const CUSBDeviceFilter & aFilter) const3074 { 3075 QString tip;3076 3077 QString vendorId = aFilter.GetVendorId();3078 if (! vendorId.isEmpty())3079 tip += tr ("<nobr>Vendor ID: %1</nobr>", "USB filter tooltip")3080 .arg (vendorId);3081 3082 QString productId = aFilter.GetProductId();3083 if (! productId.isEmpty())3084 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Product ID: %2</nobr>", "USB filter tooltip")3085 .arg (productId);3086 3087 QString revision = aFilter.GetRevision();3088 if (! revision.isEmpty())3089 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Revision: %3</nobr>", "USB filter tooltip")3090 .arg (revision);3091 3092 QString product = aFilter.GetProduct();3093 if (! product.isEmpty())3094 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Product: %4</nobr>", "USB filter tooltip")3095 .arg (product);3096 3097 QString manufacturer = aFilter.GetManufacturer();3098 if (! manufacturer.isEmpty())3099 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Manufacturer: %5</nobr>", "USB filter tooltip")3100 .arg (manufacturer);3101 3102 QString s erial = aFilter.GetSerialNumber();3103 if (!s erial.isEmpty())3104 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Serial No.: %1</nobr>", "USB filter tooltip")3105 .arg (serial);3106 3107 QString port = aFilter.GetPort();3108 if (! port.isEmpty())3109 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Port: %1</nobr>", "USB filter tooltip")3110 .arg (port);3066 strTip += QString (tr ("<br><nobr>State: %1</nobr>", "USB device tooltip")) 3067 .arg (gpConverter->toString (hostDev.GetState())); 3068 } 3069 3070 return strTip; 3071 } 3072 3073 QString VBoxGlobal::toolTip (const CUSBDeviceFilter &comFilter) const 3074 { 3075 QString strTip; 3076 3077 QString strVendorId = comFilter.GetVendorId(); 3078 if (!strVendorId.isEmpty()) 3079 strTip += tr ("<nobr>Vendor ID: %1</nobr>", "USB filter tooltip") 3080 .arg (strVendorId); 3081 3082 QString strProductId = comFilter.GetProductId(); 3083 if (!strProductId.isEmpty()) 3084 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>Product ID: %2</nobr>", "USB filter tooltip") 3085 .arg (strProductId); 3086 3087 QString strRevision = comFilter.GetRevision(); 3088 if (!strRevision.isEmpty()) 3089 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>Revision: %3</nobr>", "USB filter tooltip") 3090 .arg (strRevision); 3091 3092 QString strProduct = comFilter.GetProduct(); 3093 if (!strProduct.isEmpty()) 3094 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>Product: %4</nobr>", "USB filter tooltip") 3095 .arg (strProduct); 3096 3097 QString strManufacturer = comFilter.GetManufacturer(); 3098 if (!strManufacturer.isEmpty()) 3099 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>Manufacturer: %5</nobr>", "USB filter tooltip") 3100 .arg (strManufacturer); 3101 3102 QString strSerial = comFilter.GetSerialNumber(); 3103 if (!strSerial.isEmpty()) 3104 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>Serial No.: %1</nobr>", "USB filter tooltip") 3105 .arg (strSerial); 3106 3107 QString strPort = comFilter.GetPort(); 3108 if (!strPort.isEmpty()) 3109 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>Port: %1</nobr>", "USB filter tooltip") 3110 .arg (strPort); 3111 3111 3112 3112 /* add the state field if it's a host USB device */ 3113 CHostUSBDevice hostDev ( aFilter);3113 CHostUSBDevice hostDev (comFilter); 3114 3114 if (!hostDev.isNull()) 3115 3115 { 3116 tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>State: %1</nobr>", "USB filter tooltip")3117 .arg (gpConverter->toString (hostDev.GetState()));3118 } 3119 3120 return tip;3121 } 3122 3123 QString VBoxGlobal::toolTip(const CHostVideoInputDevice & webcam) const3116 strTip += strTip.isEmpty() ? "":"<br/>" + tr ("<nobr>State: %1</nobr>", "USB filter tooltip") 3117 .arg (gpConverter->toString (hostDev.GetState())); 3118 } 3119 3120 return strTip; 3121 } 3122 3123 QString VBoxGlobal::toolTip(const CHostVideoInputDevice &comWebcam) const 3124 3124 { 3125 3125 QStringList records; 3126 3126 3127 QString strName = webcam.GetName();3127 const QString strName = comWebcam.GetName(); 3128 3128 if (!strName.isEmpty()) 3129 3129 records << strName; 3130 3130 3131 QString strPath = webcam.GetPath();3131 const QString strPath = comWebcam.GetPath(); 3132 3132 if (!strPath.isEmpty()) 3133 3133 records << strPath; … … 3238 3238 bool fSupported = false; 3239 3239 #endif 3240 unconst(this)->m 3DAvailable = fSupported;3240 unconst(this)->m_i3DAvailable = fSupported; 3241 3241 return fSupported; 3242 3242 } … … 3244 3244 bool VBoxGlobal::is3DAvailable() const 3245 3245 { 3246 if (m 3DAvailable < 0)3246 if (m_i3DAvailable < 0) 3247 3247 return is3DAvailableWorker(); 3248 return m 3DAvailable != 0;3248 return m_i3DAvailable != 0; 3249 3249 } 3250 3250 … … 3288 3288 screenSize.replace(i, screenSize.at(0)); 3289 3289 3290 quint64 needBits = 0;3290 quint64 uNeedBits = 0; 3291 3291 for (int i = 0; i < cMonitors; ++i) 3292 3292 { 3293 3293 /* Calculate summary required memory amount in bits: */ 3294 needBits += (screenSize.at(i) * /* with x height */3294 uNeedBits += (screenSize.at(i) * /* with x height */ 3295 3295 32 + /* we will take the maximum possible bpp for now */ 3296 3296 8 * _1M) + /* current cache per screen - may be changed in future */ 3297 8 * 4096; /* adapter info */3297 8 * 4096; /* adapter info */ 3298 3298 } 3299 3299 /* Translate value into megabytes with rounding to highest side: */ 3300 quint64 needMBytes = needBits % (8 * _1M) ? needBits / (8 * _1M) + 1 :3301 needBits / (8 * _1M) /* convert to megabytes */;3300 quint64 uNeedMBytes = uNeedBits % (8 * _1M) ? uNeedBits / (8 * _1M) + 1 : 3301 uNeedBits / (8 * _1M) /* convert to megabytes */; 3302 3302 3303 3303 if (strGuestOSTypeId.startsWith("Windows")) … … 3308 3308 { 3309 3309 /* WDDM mode, there are two surfaces for each screen: shadow & primary: */ 3310 needMBytes *= 3;3310 uNeedMBytes *= 3; 3311 3311 } 3312 3312 else 3313 3313 #endif /* VBOX_WITH_CRHGSMI */ 3314 3314 { 3315 needMBytes *= 2;3315 uNeedMBytes *= 2; 3316 3316 } 3317 3317 } 3318 3318 3319 return needMBytes * _1M;3319 return uNeedMBytes * _1M; 3320 3320 } 3321 3321 … … 3393 3393 3394 3394 /* static */ 3395 QPixmap VBoxGlobal::joinPixmaps (const QPixmap & aPM1, const QPixmap &aPM2)3396 { 3397 if ( aPM1.isNull())3398 return aPM2;3399 if ( aPM2.isNull())3400 return aPM1;3401 3402 QPixmap result ( aPM1.width() + aPM2.width() + 2,3403 qMax ( aPM1.height(), aPM2.height()));3395 QPixmap VBoxGlobal::joinPixmaps (const QPixmap &pixmap1, const QPixmap &pixmap2) 3396 { 3397 if (pixmap1.isNull()) 3398 return pixmap2; 3399 if (pixmap2.isNull()) 3400 return pixmap1; 3401 3402 QPixmap result (pixmap1.width() + pixmap2.width() + 2, 3403 qMax (pixmap1.height(), pixmap2.height())); 3404 3404 result.fill (Qt::transparent); 3405 3405 3406 3406 QPainter painter (&result); 3407 painter.drawPixmap (0, 0, aPM1);3408 painter.drawPixmap ( aPM1.width() + 2, result.height() - aPM2.height(), aPM2);3407 painter.drawPixmap (0, 0, pixmap1); 3408 painter.drawPixmap (pixmap1.width() + 2, result.height() - pixmap2.height(), pixmap2); 3409 3409 painter.end(); 3410 3410 … … 3412 3412 } 3413 3413 3414 bool VBoxGlobal::openURL (const QString & aURL)3414 bool VBoxGlobal::openURL (const QString &strUrl) 3415 3415 { 3416 3416 /** Service event. */ … … 3420 3420 3421 3421 /** Constructs service event on th basis of passed @a fResult. */ 3422 ServiceEvent (bool aResult) : QEvent (QEvent::User), mResult (aResult) {}3422 ServiceEvent (bool fResult) : QEvent (QEvent::User), m_fResult (fResult) {} 3423 3423 3424 3424 /** Returns the result which event brings. */ 3425 bool result() const { return m Result; }3425 bool result() const { return m_fResult; } 3426 3426 3427 3427 private: 3428 3428 3429 3429 /** Holds the result which event brings. */ 3430 bool m Result;3430 bool m_fResult; 3431 3431 }; 3432 3432 … … 3437 3437 3438 3438 /** Constructs service client on the basis of passed @a fResult. */ 3439 ServiceClient() : m Result (false) {}3439 ServiceClient() : m_fResult (false) {} 3440 3440 3441 3441 /** Returns the result which event brings. */ 3442 bool result() const { return m Result; }3442 bool result() const { return m_fResult; } 3443 3443 3444 3444 private: 3445 3445 3446 3446 /** Handles any Qt @a pEvent. */ 3447 bool event (QEvent * aEvent)3447 bool event (QEvent *pEvent) 3448 3448 { 3449 3449 /* Handle service event: */ 3450 if ( aEvent->type() == QEvent::User)3450 if (pEvent->type() == QEvent::User) 3451 3451 { 3452 ServiceEvent *p Event = static_cast <ServiceEvent*> (aEvent);3453 m Result = pEvent->result();3454 p Event->accept();3452 ServiceEvent *pServiceEvent = static_cast <ServiceEvent*> (pEvent); 3453 m_fResult = pServiceEvent->result(); 3454 pServiceEvent->accept(); 3455 3455 quit(); 3456 3456 return true; … … 3459 3459 } 3460 3460 3461 bool m Result;3461 bool m_fResult; 3462 3462 }; 3463 3463 … … 3468 3468 3469 3469 /** Constructs service server on the basis of passed @a client and @a strUrl. */ 3470 ServiceServer (ServiceClient & aClient, const QString &sURL)3471 : m Client (aClient), mURL (sURL) {}3470 ServiceServer (ServiceClient &client, const QString &strUrl) 3471 : m_client (client), m_strUrl (strUrl) {} 3472 3472 3473 3473 private: … … 3476 3476 void run() 3477 3477 { 3478 QApplication::postEvent (&m Client, new ServiceEvent (QDesktopServices::openUrl (mURL)));3478 QApplication::postEvent (&m_client, new ServiceEvent (QDesktopServices::openUrl (m_strUrl))); 3479 3479 } 3480 3480 3481 3481 /** Holds the client reference. */ 3482 ServiceClient &m Client;3482 ServiceClient &m_client; 3483 3483 /** Holds the URL to be processed. */ 3484 const QString &m URL;3484 const QString &m_strUrl; 3485 3485 }; 3486 3486 3487 3487 /* Create/start client & server: */ 3488 3488 ServiceClient client; 3489 ServiceServer server (client, aURL);3489 ServiceServer server (client, strUrl); 3490 3490 server.start(); 3491 3491 client.exec(); … … 3493 3493 3494 3494 /* Acquire client result: */ 3495 bool result = client.result();3496 3497 if (! result)3498 msgCenter().cannotOpenURL ( aURL);3499 3500 return result;3501 } 3502 3503 void VBoxGlobal::sltGUILanguageChange(QString strLang )3495 bool fResult = client.result(); 3496 3497 if (!fResult) 3498 msgCenter().cannotOpenURL (strUrl); 3499 3500 return fResult; 3501 } 3502 3503 void VBoxGlobal::sltGUILanguageChange(QString strLanguage) 3504 3504 { 3505 3505 /* Make sure medium-enumeration is not in progress! */ 3506 3506 AssertReturnVoid(!isMediumEnumerationInProgress()); 3507 3507 /* Load passed language: */ 3508 loadLanguage(strLang );3509 } 3510 3511 bool VBoxGlobal::eventFilter (QObject * aObject, QEvent *aEvent)3508 loadLanguage(strLanguage); 3509 } 3510 3511 bool VBoxGlobal::eventFilter (QObject *pObject, QEvent *pEvent) 3512 3512 { 3513 3513 /** @todo Just use the QIWithRetranslateUI3 template wrapper. */ 3514 3514 3515 if ( aEvent->type() == QEvent::LanguageChange &&3516 aObject->isWidgetType() &&3517 static_cast <QWidget *> ( aObject)->isTopLevel())3515 if (pEvent->type() == QEvent::LanguageChange && 3516 pObject->isWidgetType() && 3517 static_cast <QWidget *> (pObject)->isTopLevel()) 3518 3518 { 3519 3519 /* Catch the language change event before any other widget gets it in … … 3521 3521 * templates) that may be used by other widgets. */ 3522 3522 QWidgetList list = QApplication::topLevelWidgets(); 3523 if (list.first() == aObject)3523 if (list.first() == pObject) 3524 3524 { 3525 3525 /* Call this only once per every language change (see … … 3530 3530 3531 3531 /* Call to base-class: */ 3532 return QObject::eventFilter ( aObject, aEvent);3532 return QObject::eventFilter (pObject, pEvent); 3533 3533 } 3534 3534 3535 3535 void VBoxGlobal::retranslateUi() 3536 3536 { 3537 m UserDefinedPortName = tr ("User-defined", "serial port");3538 3539 m WarningIcon= UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning).pixmap (16, 16);3540 Assert (!m WarningIcon.isNull());3541 3542 m ErrorIcon= UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxCritical).pixmap (16, 16);3543 Assert (!m ErrorIcon.isNull());3537 m_strUserDefinedPortName = tr ("User-defined", "serial port"); 3538 3539 m_pixWarning = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning).pixmap (16, 16); 3540 Assert (!m_pixWarning.isNull()); 3541 3542 m_pixError = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxCritical).pixmap (16, 16); 3543 Assert (!m_pixError.isNull()); 3544 3544 3545 3545 /* Re-enumerate uimedium since they contain some translations too: */ 3546 if (m Valid)3546 if (m_fValid) 3547 3547 startMediumEnumeration(); 3548 3548 … … 3565 3565 #ifdef VBOX_WS_MAC 3566 3566 /* Determine OS release early: */ 3567 m_ osRelease= determineOsRelease();3567 m_enmMacOSVersion = determineOsRelease(); 3568 3568 #endif /* VBOX_WS_MAC */ 3569 3569 … … 3618 3618 3619 3619 /* Make sure VirtualBoxClient instance created: */ 3620 m_c lient.createInstance(CLSID_VirtualBoxClient);3621 if (!m_c lient.isOk())3622 { 3623 msgCenter().cannotCreateVirtualBoxClient(m_c lient);3620 m_comVBoxClient.createInstance(CLSID_VirtualBoxClient); 3621 if (!m_comVBoxClient.isOk()) 3622 { 3623 msgCenter().cannotCreateVirtualBoxClient(m_comVBoxClient); 3624 3624 return; 3625 3625 } 3626 3626 /* Make sure VirtualBox instance acquired: */ 3627 m_ vbox = m_client.GetVirtualBox();3628 if (!m_c lient.isOk())3629 { 3630 msgCenter().cannotAcquireVirtualBox(m_c lient);3627 m_comVBox = m_comVBoxClient.GetVirtualBox(); 3628 if (!m_comVBoxClient.isOk()) 3629 { 3630 msgCenter().cannotAcquireVirtualBox(m_comVBoxClient); 3631 3631 return; 3632 3632 } … … 3673 3673 initDebuggerVar(&m_fDbgAutoShow, "VBOX_GUI_DBG_AUTO_SHOW", GUI_Dbg_AutoShow, false); 3674 3674 m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = m_fDbgAutoShow; 3675 m_enm StartRunning = StartRunning_Default;3675 m_enmLaunchRunning = LaunchRunning_Default; 3676 3676 #endif 3677 3677 3678 m ShowStartVMErrors = true;3678 m_fShowStartVMErrors = true; 3679 3679 bool startVM = false; 3680 3680 bool fSeparateProcess = false; … … 3708 3708 { 3709 3709 if (++i < argc) 3710 m_strPid file = arguments.at(i);3710 m_strPidFile = arguments.at(i); 3711 3711 } 3712 3712 #endif /* VBOX_GUI_WITH_PIDFILE */ … … 3725 3725 if (++i < argc) 3726 3726 { 3727 RTStrCopy(m SettingsPw, sizeof(mSettingsPw), arguments.at(i).toLocal8Bit().constData());3728 m SettingsPwSet = true;3727 RTStrCopy(m_astrSettingsPw, sizeof(m_astrSettingsPw), arguments.at(i).toLocal8Bit().constData()); 3728 m_fSettingsPwSet = true; 3729 3729 } 3730 3730 } … … 3745 3745 if (RT_SUCCESS(vrc)) 3746 3746 { 3747 vrc = RTStrmReadEx(pStrm, m SettingsPw, sizeof(mSettingsPw)-1, &cbFile);3747 vrc = RTStrmReadEx(pStrm, m_astrSettingsPw, sizeof(m_astrSettingsPw)-1, &cbFile); 3748 3748 if (RT_SUCCESS(vrc)) 3749 3749 { 3750 if (cbFile >= sizeof(m SettingsPw)-1)3750 if (cbFile >= sizeof(m_astrSettingsPw)-1) 3751 3751 continue; 3752 3752 else 3753 3753 { 3754 3754 unsigned i; 3755 for (i = 0; i < cbFile && !RT_C_IS_CNTRL(m SettingsPw[i]); i++)3755 for (i = 0; i < cbFile && !RT_C_IS_CNTRL(m_astrSettingsPw[i]); i++) 3756 3756 ; 3757 m SettingsPw[i] = '\0';3758 m SettingsPwSet = true;3757 m_astrSettingsPw[i] = '\0'; 3758 m_fSettingsPwSet = true; 3759 3759 } 3760 3760 } … … 3768 3768 ++i; 3769 3769 else if (!::strcmp(arg, "--no-startvm-errormsgbox")) 3770 m ShowStartVMErrors = false;3770 m_fShowStartVMErrors = false; 3771 3771 else if (!::strcmp(arg, "--aggressive-caching")) 3772 m AgressiveCaching = true;3772 m_fAgressiveCaching = true; 3773 3773 else if (!::strcmp(arg, "--no-aggressive-caching")) 3774 m AgressiveCaching = false;3774 m_fAgressiveCaching = false; 3775 3775 else if (!::strcmp(arg, "--restore-current")) 3776 m RestoreCurrentSnapshot = true;3776 m_fRestoreCurrentSnapshot = true; 3777 3777 /* Ad hoc VM reconfig options: */ 3778 3778 else if (!::strcmp(arg, "--fda")) … … 3788 3788 /* VMM Options: */ 3789 3789 else if (!::strcmp(arg, "--disable-patm")) 3790 m DisablePatm = true;3790 m_fDisablePatm = true; 3791 3791 else if (!::strcmp(arg, "--disable-csam")) 3792 m DisableCsam = true;3792 m_fDisableCsam = true; 3793 3793 else if (!::strcmp(arg, "--recompile-supervisor")) 3794 m RecompileSupervisor = true;3794 m_fRecompileSupervisor = true; 3795 3795 else if (!::strcmp(arg, "--recompile-user")) 3796 m RecompileUser = true;3796 m_fRecompileUser = true; 3797 3797 else if (!::strcmp(arg, "--recompile-all")) 3798 m DisablePatm = mDisableCsam = mRecompileSupervisor = mRecompileUser = true;3798 m_fDisablePatm = m_fDisableCsam = m_fRecompileSupervisor = m_fRecompileUser = true; 3799 3799 else if (!::strcmp(arg, "--execute-all-in-iem")) 3800 m DisablePatm = mDisableCsam = mExecuteAllInIem = true;3800 m_fDisablePatm = m_fDisableCsam = m_fExecuteAllInIem = true; 3801 3801 else if (!::strcmp(arg, "--warp-pct")) 3802 3802 { 3803 3803 if (++i < argc) 3804 m WarpPct = RTStrToUInt32(arguments.at(i).toLocal8Bit().constData());3804 m_uWarpPct = RTStrToUInt32(arguments.at(i).toLocal8Bit().constData()); 3805 3805 } 3806 3806 #ifdef VBOX_WITH_DEBUGGER_GUI … … 3836 3836 /* Not quite debug options, but they're only useful with the debugger bits. */ 3837 3837 else if (!::strcmp(arg, "--start-paused")) 3838 m_enm StartRunning = StartRunning_No;3838 m_enmLaunchRunning = LaunchRunning_No; 3839 3839 else if (!::strcmp(arg, "--start-running")) 3840 m_enm StartRunning = StartRunning_Yes;3840 m_enmLaunchRunning = LaunchRunning_Yes; 3841 3841 #endif 3842 3842 /** @todo add an else { msgbox(syntax error); exit(1); } here, pretty please... */ … … 3855 3855 /* Search for corresponding VM: */ 3856 3856 QUuid uuid = QUuid(vmNameOrUuid); 3857 const CMachine machine = m_ vbox.FindMachine(vmNameOrUuid);3857 const CMachine machine = m_comVBox.FindMachine(vmNameOrUuid); 3858 3858 if (!uuid.isNull()) 3859 3859 { 3860 3860 if (machine.isNull() && showStartVMErrors()) 3861 return msgCenter().cannotFindMachineById(m_ vbox, vmNameOrUuid);3861 return msgCenter().cannotFindMachineById(m_comVBox, vmNameOrUuid); 3862 3862 } 3863 3863 else 3864 3864 { 3865 3865 if (machine.isNull() && showStartVMErrors()) 3866 return msgCenter().cannotFindMachineByName(m_ vbox, vmNameOrUuid);3867 } 3868 vmUuid = machine.GetId();3866 return msgCenter().cannotFindMachineByName(m_comVBox, vmNameOrUuid); 3867 } 3868 m_strManagedVMId = machine.GetId(); 3869 3869 } 3870 3870 … … 3894 3894 } 3895 3895 3896 if (m SettingsPwSet)3897 m_ vbox.SetSettingsSecret(mSettingsPw);3898 3899 if (visualStateType != UIVisualStateType_Invalid && ! vmUuid.isEmpty())3900 gEDataManager->setRequestedVisualState(visualStateType, vmUuid);3896 if (m_fSettingsPwSet) 3897 m_comVBox.SetSettingsSecret(m_astrSettingsPw); 3898 3899 if (visualStateType != UIVisualStateType_Invalid && !m_strManagedVMId.isEmpty()) 3900 gEDataManager->setRequestedVisualState(visualStateType, m_strManagedVMId); 3901 3901 3902 3902 #ifdef VBOX_WITH_DEBUGGER_GUI … … 3918 3918 #endif 3919 3919 3920 m Valid = true;3920 m_fValid = true; 3921 3921 3922 3922 /* Create medium-enumerator but don't do any immediate caching: */ … … 3958 3958 /* Remember that the cleanup is in progress preventing any unwanted 3959 3959 * stuff which could be called from the other threads: */ 3960 s_fClean upInProgress= true;3960 s_fCleaningUp = true; 3961 3961 3962 3962 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER … … 3976 3976 3977 3977 /* Starting medium-enumerator cleanup: */ 3978 m_me diumEnumeratorDtorRwLock.lockForWrite();3978 m_meCleanupProtectionToken.lockForWrite(); 3979 3979 { 3980 3980 /* Destroy medium-enumerator: */ … … 3983 3983 } 3984 3984 /* Finishing medium-enumerator cleanup: */ 3985 m_me diumEnumeratorDtorRwLock.unlock();3985 m_meCleanupProtectionToken.unlock(); 3986 3986 3987 3987 /* Destroy the global (VirtualBox) Main event handler … … 4011 4011 { 4012 4012 /* First, make sure we don't use COM any more: */ 4013 m_ host.detach();4014 m_ vbox.detach();4015 m_c lient.detach();4013 m_comHost.detach(); 4014 m_comVBox.detach(); 4015 m_comVBoxClient.detach(); 4016 4016 4017 4017 /* There may be UIMedium(s)EnumeratedEvent instances still in the message … … 4034 4034 UIDesktopWidgetWatchdog::destroy(); 4035 4035 4036 m Valid = false;4036 m_fValid = false; 4037 4037 } 4038 4038 … … 4072 4072 m_fWrappersValid = false; 4073 4073 /* Re-fetch corresponding CVirtualBox to restart VBoxSVC: */ 4074 m_ vbox = m_client.GetVirtualBox();4075 if (!m_c lient.isOk())4074 m_comVBox = m_comVBoxClient.GetVirtualBox(); 4075 if (!m_comVBoxClient.isOk()) 4076 4076 { 4077 4077 // The proper behavior would be to show the message and to exit the app, e.g.: 4078 // msgCenter().cannotAcquireVirtualBox(m_c lient);4078 // msgCenter().cannotAcquireVirtualBox(m_comVBoxClient); 4079 4079 // return QApplication::quit(); 4080 4080 // But CVirtualBox is still NULL in current Main implementation, … … 4089 4089 { 4090 4090 /* Re-fetch corresponding CVirtualBox: */ 4091 m_ vbox = m_client.GetVirtualBox();4092 if (!m_c lient.isOk())4091 m_comVBox = m_comVBoxClient.GetVirtualBox(); 4092 if (!m_comVBoxClient.isOk()) 4093 4093 { 4094 msgCenter().cannotAcquireVirtualBox(m_c lient);4094 msgCenter().cannotAcquireVirtualBox(m_comVBoxClient); 4095 4095 return QApplication::quit(); 4096 4096 } … … 4154 4154 strEnvValue = "veto"; 4155 4155 4156 QString strExtraValue = m_ vbox.GetExtraData(pszExtraDataName).toLower().trimmed();4156 QString strExtraValue = m_comVBox.GetExtraData(pszExtraDataName).toLower().trimmed(); 4157 4157 if (strExtraValue.isEmpty()) 4158 4158 strExtraValue = QString(); … … 4225 4225 { 4226 4226 /* Re-fetch corresponding objects/values: */ 4227 m_ host = virtualBox().GetHost();4227 m_comHost = virtualBox().GetHost(); 4228 4228 m_strHomeFolder = virtualBox().GetHomeFolder(); 4229 4229 … … 4231 4231 m_guestOSFamilyIDs.clear(); 4232 4232 m_guestOSTypes.clear(); 4233 const CGuestOSTypeVector guestOSTypes = m_ vbox.GetGuestOSTypes();4233 const CGuestOSTypeVector guestOSTypes = m_comVBox.GetGuestOSTypes(); 4234 4234 const int cGuestOSTypeCount = guestOSTypes.size(); 4235 4235 AssertMsg(cGuestOSTypeCount > 0, ("Number of OS types must not be zero")); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r72435 r72626 122 122 123 123 /** VM launch running options. */ 124 enum StartRunning124 enum LaunchRunning 125 125 { 126 StartRunning_Default, /**< Default (depends on debug settings). */127 StartRunning_No, /**< Start the VM paused. */128 StartRunning_Yes /**< Start the VM running. */126 LaunchRunning_Default, /**< Default (depends on debug settings). */ 127 LaunchRunning_No, /**< Start the VM paused. */ 128 LaunchRunning_Yes /**< Start the VM running. */ 129 129 }; 130 130 … … 144 144 * @{ */ 145 145 /** Returns whether VBoxGlobal cleanup is in progress. */ 146 bool isCleaningUp() { return s_fClean upInProgress; }146 bool isCleaningUp() { return s_fCleaningUp; } 147 147 148 148 /** Returns Qt runtime version string. */ … … 156 156 157 157 /** Returns whether VBoxGlobal instance is properly initialized. */ 158 bool isValid() { return m Valid; }158 bool isValid() { return m_fValid; } 159 159 160 160 /** Returns VBox version string. */ … … 169 169 static MacOSXRelease determineOsRelease(); 170 170 /** Mac OS X: Returns #MacOSXRelease determined during VBoxGlobal prepare routine. */ 171 MacOSXRelease osRelease() const { return m_ osRelease; }171 MacOSXRelease osRelease() const { return m_enmMacOSVersion; } 172 172 #endif /* VBOX_WS_MAC */ 173 173 … … 180 180 181 181 /** Returns whether branding is active. */ 182 bool brandingIsActive (bool aForce = false);182 bool brandingIsActive (bool fForce = false); 183 183 /** Returns value for certain branding @a strKey from custom.ini file. */ 184 QString brandingGetKey (QString aKey);184 QString brandingGetKey (QString strKey); 185 185 /** @} */ 186 186 … … 194 194 195 195 /** Returns the URL arguments list. */ 196 QList<QUrl> &argUrlList() { return m_ ArgUrlList; }196 QList<QUrl> &argUrlList() { return m_listArgUrls; } 197 197 198 198 /** Returns the --startvm option value (managed VM id). */ 199 QString managedVMUuid() const { return vmUuid; }199 QString managedVMUuid() const { return m_strManagedVMId; } 200 200 /** Returns whether this is VM console process. */ 201 bool isVMConsoleProcess() const { return ! vmUuid.isNull(); }201 bool isVMConsoleProcess() const { return !m_strManagedVMId.isNull(); } 202 202 /** Returns the --separate option value (whether GUI process is separate from VM process). */ 203 203 bool isSeparateProcess() const { return m_fSeparateProcess; } 204 204 /** Returns the --no-startvm-errormsgbox option value (whether startup VM errors are disabled). */ 205 bool showStartVMErrors() const { return m ShowStartVMErrors; }205 bool showStartVMErrors() const { return m_fShowStartVMErrors; } 206 206 207 207 /** Returns the --aggressive-caching / --no-aggressive-caching option value (whether medium-enumeration is required). */ 208 bool agressiveCaching() const { return m AgressiveCaching; }208 bool agressiveCaching() const { return m_fAgressiveCaching; } 209 209 210 210 /** Returns the --restore-current option value (whether we should restore current snapshot before VM started). */ 211 bool shouldRestoreCurrentSnapshot() const { return m RestoreCurrentSnapshot; }211 bool shouldRestoreCurrentSnapshot() const { return m_fRestoreCurrentSnapshot; } 212 212 /** Defines whether we should fRestore current snapshot before VM started. */ 213 void setShouldRestoreCurrentSnapshot(bool fRestore) { m RestoreCurrentSnapshot = fRestore; }213 void setShouldRestoreCurrentSnapshot(bool fRestore) { m_fRestoreCurrentSnapshot = fRestore; } 214 214 215 215 /** Returns the --fda option value (whether we have floppy image). */ … … 223 223 224 224 /** Returns the --disable-patm option value. */ 225 bool isPatmDisabled() const { return m DisablePatm; }225 bool isPatmDisabled() const { return m_fDisablePatm; } 226 226 /** Returns the --disable-csam option value. */ 227 bool isCsamDisabled() const { return m DisableCsam; }227 bool isCsamDisabled() const { return m_fDisableCsam; } 228 228 /** Returns the --recompile-supervisor option value. */ 229 bool isSupervisorCodeExecedRecompiled() const { return m RecompileSupervisor; }229 bool isSupervisorCodeExecedRecompiled() const { return m_fRecompileSupervisor; } 230 230 /** Returns the --recompile-user option value. */ 231 bool isUserCodeExecedRecompiled() const { return m RecompileUser; }231 bool isUserCodeExecedRecompiled() const { return m_fRecompileUser; } 232 232 /** Returns the --execute-all-in-iem option value. */ 233 bool areWeToExecuteAllInIem() const { return m ExecuteAllInIem; }233 bool areWeToExecuteAllInIem() const { return m_fExecuteAllInIem; } 234 234 /** Returns whether --warp-factor option value is equal to 100. */ 235 bool isDefaultWarpPct() const { return m WarpPct == 100; }235 bool isDefaultWarpPct() const { return m_uWarpPct == 100; } 236 236 /** Returns the --warp-factor option value. */ 237 uint32_t getWarpPct() const { return m WarpPct; }237 uint32_t getWarpPct() const { return m_uWarpPct; } 238 238 239 239 #ifdef VBOX_WITH_DEBUGGER_GUI … … 294 294 * @param strLangId Brings the language ID in in form of xx_YY. 295 295 * QString() means the system default language. */ 296 static void loadLanguage (const QString & aLangId = QString::null);296 static void loadLanguage (const QString &strLangId = QString()); 297 297 298 298 /** Returns tr("%n year(s)"). */ … … 314 314 static QString sizeRegexp(); 315 315 /** Parses the given size strText and returns the size value in bytes. */ 316 static quint64 parseSize (const QString & );316 static quint64 parseSize (const QString &strText); 317 317 /** Formats the given @a uSize value in bytes to a human readable string. 318 318 * @param uSize Brings the size value in bytes. 319 319 * @param enmMode Brings the conversion mode. 320 320 * @param cDecimal Brings the number of decimal digits in result. */ 321 static QString formatSize (quint64 aSize, uint aDecimal = 2, FormatSize aMode = FormatSize_Round);321 static QString formatSize (quint64 uSize, uint cDecimal = 2, FormatSize enmMode = FormatSize_Round); 322 322 323 323 /** Returns full medium-format name for the given @a strBaseMediumFormatName. */ … … 328 328 /** Returns the name of the standard COM port corresponding to the given parameters, 329 329 * or "User-defined" (which is also returned when both @a uIRQ and @a uIOBase are 0). */ 330 QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;330 QString toCOMPortName (ulong uIRQ, ulong uIOBase) const; 331 331 /** Returns port parameters corresponding to the given standard COM name. 332 332 * Returns @c true on success, or @c false if the given port name is not one of the standard names (i.e. "COMx"). */ 333 bool toCOMPortNumbers (const QString & aName, ulong &aIRQ, ulong &aIOBase) const;333 bool toCOMPortNumbers (const QString &strName, ulong &uIRQ, ulong &uIOBase) const; 334 334 /** Returns the list of the standard LPT port names (i.e. "LPTx"). */ 335 335 QStringList LPTPortNames() const; 336 336 /** Returns the name of the standard LPT port corresponding to the given parameters, 337 337 * or "User-defined" (which is also returned when both @a uIRQ and @a uIOBase are 0). */ 338 QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;338 QString toLPTPortName (ulong uIRQ, ulong uIOBase) const; 339 339 /** Returns port parameters corresponding to the given standard LPT name. 340 340 * Returns @c true on success, or @c false if the given port name is not one of the standard names (i.e. "LPTx"). */ 341 bool toLPTPortNumbers (const QString & aName, ulong &aIRQ, ulong &aIOBase) const;341 bool toLPTPortNumbers (const QString &strName, ulong &uIRQ, ulong &uIOBase) const; 342 342 343 343 /** Reformats the input @a strText to highlight it. */ 344 static QString highlight (const QString & aStr, bool aToolTip = false);344 static QString highlight (const QString &strText, bool fToolTip = false); 345 345 /** Reformats the input @a strText to emphasize it. */ 346 static QString emphasize (const QString & aStr);346 static QString emphasize (const QString &strText); 347 347 /** Removes the first occurrence of the accelerator mark (the ampersand symbol) from the given @a strText. */ 348 static QString removeAccelMark (const QString & aText);348 static QString removeAccelMark (const QString &strText); 349 349 /** Inserts a passed @a strKey into action @a strText. */ 350 static QString insertKeyToActionText (const QString & aText, const QString &aKey);350 static QString insertKeyToActionText (const QString &strText, const QString &strKey); 351 351 /** @} */ 352 352 … … 363 363 * @{ */ 364 364 /** Search position for @a rectangle to make sure it is fully contained @a boundRegion. */ 365 static QRect normalizeGeometry (const QRect & aRectangle, const QRegion &aBoundRegion,366 bool aCanResize = true);365 static QRect normalizeGeometry (const QRect &rectangle, const QRegion &boundRegion, 366 bool fCanResize = true); 367 367 /** Ensures that the given rectangle @a rectangle is fully contained within the region @a boundRegion. */ 368 static QRect getNormalized (const QRect & aRectangle, const QRegion &aBoundRegion,369 bool aCanResize = true);368 static QRect getNormalized (const QRect &rectangle, const QRegion &boundRegion, 369 bool fCanResize = true); 370 370 /** Returns the flipped (transposed) @a region. */ 371 static QRegion flip (const QRegion & aRegion);371 static QRegion flip (const QRegion ®ion); 372 372 373 373 /** Aligns the center of @a pWidget with the center of @a pRelative. */ 374 static void centerWidget (QWidget * aWidget, QWidget *aRelative,375 bool aCanResize = true);374 static void centerWidget (QWidget *pWidget, QWidget *pRelative, 375 bool fCanResize = true); 376 376 377 377 /** Assigns top-level @a pWidget geometry passed as QRect coordinates. … … 383 383 384 384 /** Activates the specified window with given @a wId. Can @a fSwitchDesktop if requested. */ 385 static bool activateWindow (WId aWId, bool aSwitchDesktop = true);385 static bool activateWindow (WId wId, bool fSwitchDesktop = true); 386 386 387 387 #ifdef VBOX_WS_X11 … … 418 418 419 419 /** Returns the copy of VirtualBox client wrapper. */ 420 CVirtualBoxClient virtualBoxClient() const { return m_c lient; }420 CVirtualBoxClient virtualBoxClient() const { return m_comVBoxClient; } 421 421 /** Returns the copy of VirtualBox object wrapper. */ 422 CVirtualBox virtualBox() const { return m_ vbox; }422 CVirtualBox virtualBox() const { return m_comVBox; } 423 423 /** Returns the copy of VirtualBox host-object wrapper. */ 424 CHost host() const { return m_ host; }424 CHost host() const { return m_comHost; } 425 425 /** Returns the symbolic VirtualBox home-folder representation. */ 426 426 QString homeFolder() const { return m_strHomeFolder; } … … 437 437 /** Returns the list of all guest OS types, queried from 438 438 * IVirtualBox corresponding to passed family id. */ 439 QList <CGuestOSType> vmGuestOSTypeList (const QString & aFamilyId) const;439 QList <CGuestOSType> vmGuestOSTypeList (const QString &strFamilyId) const; 440 440 441 441 /** Returns the guest OS type object corresponding to the given type id of list 442 442 * containing OS types related to OS family determined by family id attribute. 443 443 * If the index is invalid a null object is returned. */ 444 CGuestOSType vmGuestOSType (const QString & aTypeId,445 const QString & aFamilyId = QString::null) const;444 CGuestOSType vmGuestOSType (const QString &strTypeId, 445 const QString &strFamilyId = QString()) const; 446 446 /** Returns the description corresponding to the given guest OS type id. */ 447 QString vmGuestOSTypeDescription (const QString & aTypeId) const;447 QString vmGuestOSTypeDescription (const QString &strTypeId) const; 448 448 449 449 /** Returns whether guest type with passed @a strOSTypeId is one of DOS types. */ 450 static bool isDOSType (const QString & aOSTypeId);450 static bool isDOSType (const QString &strOSTypeId); 451 451 /** @} */ 452 452 … … 454 454 * @{ */ 455 455 /** Switches to certain @a comMachine. */ 456 bool switchToMachine(CMachine & machine);456 bool switchToMachine(CMachine &comMachine); 457 457 /** Launches certain @a comMachine in specified @a enmLaunchMode. */ 458 bool launchMachine(CMachine & machine, LaunchMode enmLaunchMode = LaunchMode_Default);458 bool launchMachine(CMachine &comMachine, LaunchMode enmLaunchMode = LaunchMode_Default); 459 459 460 460 /** Opens session of certain @a enmLockType for VM with certain @a strId. */ 461 CSession openSession(const QString & aId, KLockType aLockType = KLockType_Write);461 CSession openSession(const QString &strId, KLockType enmLockType = KLockType_Write); 462 462 /** Opens session of KLockType_Shared type for VM with certain @a strId. */ 463 CSession openExistingSession(const QString & aId) { return openSession(aId, KLockType_Shared); }463 CSession openExistingSession(const QString &strId) { return openSession(strId, KLockType_Shared); } 464 464 /** @} */ 465 465 … … 484 484 QList<QString> mediumIDs() const; 485 485 /** Creates medium on the basis of passed @a guiMedium description. */ 486 void createMedium(const UIMedium & medium);486 void createMedium(const UIMedium &guiMedium); 487 487 /** Deletes medium with certain @a strMediumID. */ 488 488 void deleteMedium(const QString &strMediumID); … … 493 493 * @param strMediumLocation Brings the file path to load medium from. 494 494 * @param pParent Brings the dialog parent. */ 495 QString openMedium(UIMediumType mediumType, QString strMediumLocation, QWidget *pParent = 0);495 QString openMedium(UIMediumType enmMediumType, QString strMediumLocation, QWidget *pParent = 0); 496 496 497 497 /** Opens external medium using file-open dialog. … … 500 500 * @param strDefaultFolder Brings the folder to browse for medium. 501 501 * @param fUseLastFolder Brings whether we should propose to use last used folder. */ 502 QString openMediumWithFileOpenDialog(UIMediumType mediumType, QWidget *pParent = 0,502 QString openMediumWithFileOpenDialog(UIMediumType enmMediumType, QWidget *pParent = 0, 503 503 const QString &strDefaultFolder = QString(), bool fUseLastFolder = true); 504 504 … … 506 506 * @param pParent Brings the dialog parent. 507 507 * @param strFolder Brings the folder to browse for VISO file contents. */ 508 QString createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &str MachineFolder);508 QString createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &strFolder); 509 509 510 510 /** Prepares storage menu according passed parameters. … … 512 512 * @param pListener Brings the listener #QObject, this @a menu being prepared for. 513 513 * @param pszSlotName Brings the name of the SLOT in the @a pListener above, this menu will be handled with. 514 * @param machineBrings the #CMachine object, this @a menu being prepared for.514 * @param comMachine Brings the #CMachine object, this @a menu being prepared for. 515 515 * @param strControllerName Brings the name of the #CStorageController in the @a machine above. 516 516 * @param storageSlot Brings the #StorageSlot of the storage controller with @a strControllerName above. */ 517 517 void prepareStorageMenu(QMenu &menu, 518 518 QObject *pListener, const char *pszSlotName, 519 const CMachine & machine, const QString &strControllerName, const StorageSlot &storageSlot);519 const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot); 520 520 /** Updates @a comConstMachine storage with data described by @a target. */ 521 void updateMachineStorage(const CMachine &co nstMachine, const UIMediumTarget &target);521 void updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target); 522 522 523 523 /** Generates details for passed @a comMedium. 524 524 * @param fPredictDiff Brings whether medium will be marked differencing on attaching. 525 525 * @param fUseHtml Brings whether HTML subsets should be used in the generated output. */ 526 QString details(const CMedium & medium, bool fPredictDiff, bool fUseHtml = true);526 QString details(const CMedium &comMedium, bool fPredictDiff, bool fUseHtml = true); 527 527 /** @} */ 528 528 … … 535 535 536 536 /** Generates details for passed USB @a comDevice. */ 537 QString details (const CUSBDevice &aDevice) const;537 QString details(const CUSBDevice &comDevice) const; 538 538 /** Generates tool-tip for passed USB @a comDevice. */ 539 QString toolTip (const CUSBDevice &aDevice) const;539 QString toolTip(const CUSBDevice &comDevice) const; 540 540 /** Generates tool-tip for passed USB @a comFilter. */ 541 QString toolTip (const CUSBDeviceFilter &aFilter) const;541 QString toolTip(const CUSBDeviceFilter &comFilter) const; 542 542 /** Generates tool-tip for passed USB @a comWebcam. */ 543 QString toolTip(const CHostVideoInputDevice & webcam) const;543 QString toolTip(const CHostVideoInputDevice &comWebcam) const; 544 544 /** @} */ 545 545 … … 598 598 599 599 /** Returns default icon of certain @a enmType. */ 600 QIcon icon(QFileIconProvider::IconType type) { return m_globalIconProvider.icon(type); }600 QIcon icon(QFileIconProvider::IconType enmType) { return m_fileIconProvider.icon(enmType); } 601 601 /** Returns file icon fetched from passed file @a info. */ 602 QIcon icon(const QFileInfo &info) { return m_ globalIconProvider.icon(info); }602 QIcon icon(const QFileInfo &info) { return m_fileIconProvider.icon(info); } 603 603 604 604 /** Returns cached default warning pixmap. */ 605 QPixmap warningIcon() const { return m WarningIcon; }605 QPixmap warningIcon() const { return m_pixWarning; } 606 606 /** Returns cached default error pixmap. */ 607 QPixmap errorIcon() const { return m ErrorIcon; }607 QPixmap errorIcon() const { return m_pixError; } 608 608 609 609 /** Joins two pixmaps horizontally with 2px space between them and returns the result. */ 610 static QPixmap joinPixmaps (const QPixmap & aPM1, const QPixmap &aPM2);610 static QPixmap joinPixmaps (const QPixmap &pixmap1, const QPixmap &pixmap2); 611 611 /** @} */ 612 612 … … 616 616 * @{ */ 617 617 /** Opens the specified URL using OS/Desktop capabilities. */ 618 bool openURL (const QString & aURL);618 bool openURL (const QString &strURL); 619 619 /** @} */ 620 620 … … 622 622 * @{ */ 623 623 /** Handles language change to new @a strLanguage. */ 624 void sltGUILanguageChange(QString strLang );624 void sltGUILanguageChange(QString strLanguage); 625 625 /** @} */ 626 626 … … 628 628 629 629 /** Preprocesses any Qt @a pEvent for passed @a pObject. */ 630 bool eventFilter (QObject * , QEvent *);630 bool eventFilter (QObject *pObject, QEvent *pEvent); 631 631 632 632 /** Handles translation event. */ … … 705 705 * @{ */ 706 706 /** Holds whether VBoxGlobal cleanup is in progress. */ 707 static bool s_fClean upInProgress;707 static bool s_fCleaningUp; 708 708 709 709 /** Holds the currently loaded language ID. */ … … 716 716 717 717 /** Holds whether VBoxGlobal instance is properly initialized. */ 718 bool m Valid;718 bool m_fValid; 719 719 720 720 #ifdef VBOX_WS_MAC 721 721 /** Mac OS X: Holds the #MacOSXRelease determined using <i>uname</i> call. */ 722 MacOSXRelease m_ osRelease;722 MacOSXRelease m_enmMacOSVersion; 723 723 #endif /* VBOX_WS_MAC */ 724 724 … … 731 731 732 732 /** Holds the VBox branding config file path. */ 733 QString m BrandingConfig;733 QString m_strBrandingConfigFilePath; 734 734 /** @} */ 735 735 … … 737 737 * @{ */ 738 738 /** Holds the URL arguments list. */ 739 QList<QUrl> m_ ArgUrlList;739 QList<QUrl> m_listArgUrls; 740 740 741 741 /** Holds the --startvm option value (managed VM id). */ 742 QString vmUuid;742 QString m_strManagedVMId; 743 743 /** Holds the --separate option value (whether GUI process is separate from VM process). */ 744 744 bool m_fSeparateProcess; 745 745 /** Holds the --no-startvm-errormsgbox option value (whether startup VM errors are disabled). */ 746 bool m ShowStartVMErrors;746 bool m_fShowStartVMErrors; 747 747 748 748 /** Holds the --aggressive-caching / --no-aggressive-caching option value (whether medium-enumeration is required). */ 749 bool m AgressiveCaching;749 bool m_fAgressiveCaching; 750 750 751 751 /** Holds the --restore-current option value. */ 752 bool m RestoreCurrentSnapshot;752 bool m_fRestoreCurrentSnapshot; 753 753 754 754 /** Holds the --fda option value (floppy image). */ … … 758 758 759 759 /** Holds the --disable-patm option value. */ 760 bool m DisablePatm;760 bool m_fDisablePatm; 761 761 /** Holds the --disable-csam option value. */ 762 bool m DisableCsam;762 bool m_fDisableCsam; 763 763 /** Holds the --recompile-supervisor option value. */ 764 bool m RecompileSupervisor;764 bool m_fRecompileSupervisor; 765 765 /** Holds the --recompile-user option value. */ 766 bool m RecompileUser;766 bool m_fRecompileUser; 767 767 /** Holds the --execute-all-in-iem option value. */ 768 bool m ExecuteAllInIem;768 bool m_fExecuteAllInIem; 769 769 /** Holds the --warp-factor option value. */ 770 uint32_t m WarpPct;770 uint32_t m_uWarpPct; 771 771 772 772 #ifdef VBOX_WITH_DEBUGGER_GUI … … 783 783 784 784 /** Holds whether --start-running, --start-paused or nothing was given. */ 785 enum StartRunning m_enmStartRunning;785 enum LaunchRunning m_enmLaunchRunning; 786 786 #endif 787 787 788 788 /** Holds the --settingspw option value. */ 789 char m SettingsPw[256];789 char m_astrSettingsPw[256]; 790 790 /** Holds the --settingspwfile option value. */ 791 bool m SettingsPwSet;791 bool m_fSettingsPwSet; 792 792 793 793 #ifdef VBOX_GUI_WITH_PIDFILE 794 794 /** Holds the --pidfile option value (application PID file path). */ 795 QString m_strPid file;795 QString m_strPidFile; 796 796 #endif 797 797 798 798 /** @todo remove */ 799 QString m UserDefinedPortName;799 QString m_strUserDefinedPortName; 800 800 /** @} */ 801 801 … … 806 806 807 807 /** Holds the instance of VirtualBox client wrapper. */ 808 CVirtualBoxClient m_c lient;808 CVirtualBoxClient m_comVBoxClient; 809 809 /** Holds the copy of VirtualBox object wrapper. */ 810 CVirtualBox m_ vbox;810 CVirtualBox m_comVBox; 811 811 /** Holds the copy of VirtualBox host-object wrapper. */ 812 CHost m_ host;812 CHost m_comHost; 813 813 /** Holds the symbolic VirtualBox home-folder representation. */ 814 814 QString m_strHomeFolder; … … 828 828 * @{ */ 829 829 /** Holds whether 3D is available. */ 830 int m 3DAvailable;830 int m_i3DAvailable; 831 831 /** @} */ 832 832 … … 843 843 844 844 /** Holds the global file icon provider instance. */ 845 QFileIconProvider m_ globalIconProvider;845 QFileIconProvider m_fileIconProvider; 846 846 847 847 /** Holds the warning pixmap. */ 848 QPixmap m WarningIcon;848 QPixmap m_pixWarning; 849 849 /** Holds the error pixmap. */ 850 QPixmap m ErrorIcon;850 QPixmap m_pixError; 851 851 /** @} */ 852 852 … … 854 854 * @{ */ 855 855 /** Holds the medium enumerator cleanup protection token. */ 856 mutable QReadWriteLock m_me diumEnumeratorDtorRwLock;856 mutable QReadWriteLock m_meCleanupProtectionToken; 857 857 858 858 /** Holds the medium enumerator. */
Note:
See TracChangeset
for help on using the changeset viewer.