Changeset 96545 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Aug 29, 2022 5:41:05 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 153411
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/RecordingScreenSettingsImpl.cpp
r96407 r96545 458 458 if (m->bd->File.strName != aFilename) 459 459 { 460 m->bd.backup(); 461 m->bd->File.strName = aFilename; 462 463 alock.release(); 464 465 m->pParent->i_onSettingsChanged(); 460 Utf8Str strName; 461 int vrc = m->pParent->i_getFilename(strName, m->uScreenId, aFilename); 462 if (RT_SUCCESS(vrc)) 463 { 464 m->bd.backup(); 465 m->bd->File.strName = strName; 466 467 alock.release(); 468 469 m->pParent->i_onSettingsChanged(); 470 } 471 else 472 return setErrorBoth(E_ACCESSDENIED, vrc, tr("Could not set file name for recording screen")); 466 473 } 467 474 -
trunk/src/VBox/Main/src-server/RecordingSettingsImpl.cpp
r96407 r96545 723 723 /** 724 724 * Returns the full path to the default recording file. 725 * 726 * @returns VBox status code. 727 * @param strFile Where to return the final file name on success. 728 * @param idScreen Screen ID the file is associated to. 729 * @param fWithFileExtension Whether to include the default file extension ('.webm') or not. 725 730 */ 726 731 int RecordingSettings::i_getDefaultFilename(Utf8Str &strFile, uint32_t idScreen, bool fWithFileExtension) … … 738 743 739 744 /** 745 * Gets a standardized file name from a given template file name. 746 * 747 * @returns VBox status code. 748 * @param strFile Where to return the final file name on success. 749 * @param idScreen Screen ID the file is associated to. 750 * @param strTemplate Template file name to use. 751 * A default file name will be used when empty. 752 */ 753 int RecordingSettings::i_getFilename(Utf8Str &strFile, uint32_t idScreen, const Utf8Str &strTemplate) 754 { 755 strFile = strTemplate; 756 757 if (strFile.isEmpty()) 758 return i_getDefaultFilename(strFile, idScreen, true /* fWithFileExtension */); 759 760 /* We force adding a .webm suffix to (hopefully) not let the user overwrite other important stuff. */ 761 strFile.stripSuffix(); 762 763 Utf8Str strDotExt = ".webm"; 764 765 /* We also force adding the screen id suffix, at least for the moment, as FE/Qt only offers settings a single file name 766 * for *all* enabled screens. */ 767 char szSuffScreen[] = "-screen"; 768 Utf8Str strSuff = Utf8StrFmt("%s%RU32", szSuffScreen, idScreen); 769 if (!strFile.endsWith(strSuff, Utf8Str::CaseInsensitive)) 770 { 771 /** @todo The following line checks whether there already is a screen suffix, as FE/Qt currently always works with 772 * screen 0 as the file name. Remove the following if block when FE/Qt supports this properly. */ 773 Utf8Str strSuffScreen0 = Utf8StrFmt("%s%RU32", szSuffScreen, 0); 774 if (strFile.endsWith(strSuffScreen0, Utf8Str::CaseInsensitive)) 775 strFile.truncate(strFile.length() - strSuffScreen0.length()); 776 777 strFile += strSuff; /* Add the suffix with the correct screen ID. */ 778 } 779 780 strFile += strDotExt; 781 782 LogRel2(("Recording: File name '%s' -> '%s'\n", strTemplate.c_str(), strFile.c_str())); 783 784 return VINF_SUCCESS; 785 } 786 787 /** 740 788 * Determines whether the recording settings currently can be changed or not. 741 789 *
Note:
See TracChangeset
for help on using the changeset viewer.