MCPcopy
hub / github.com/mifi/lossless-cut / App

Function App

src/renderer/src/App.tsx:139–2840  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137}
138
139function App() {
140 const { t } = useTranslation();
141
142 // Per project state
143 const [ffmpegCommandLog, setFfmpegCommandLog] = useState<FfmpegCommandLog>([]);
144 const [rotation, setRotation] = useState(360);
145 const [progress, setProgress] = useState<number>();
146 const [startTimeOffset, setStartTimeOffset] = useState(0);
147 const [filePath, setFilePath] = useState<string>();
148 const [fileDuration, setFileDuration] = useState<number>();
149 const [externalFilesMeta, setExternalFilesMeta] = useState<FilesMeta>({});
150 const [paramsByFile, setParamsByFile] = useState<ParamsByFile>(new Map());
151 const [detectedFps, setDetectedFps] = useState<number>();
152 const [mainFileMeta, setMainFileMeta] = useState<{ ffprobeMeta: FileFfprobeMeta, stats: FileStats }>();
153 const [streamsSelectorShown, setStreamsSelectorShown] = useState(false);
154 const [concatDialogOpen, setConcatDialogOpen] = useState(false);
155 const [zoomUnrounded, setZoom] = useState(1);
156 const [shortestFlag, setShortestFlag] = useState(false);
157 const [zoomWindowStartTime, setZoomWindowStartTime] = useState(0);
158 const [activeVideoStreamIndex, setActiveVideoStreamIndex] = useState<number>();
159 const [activeAudioStreamIndexes, setActiveAudioStreamIndexes] = useState<Set<number>>(new Set());
160 const [activeSubtitleStreamIndex, setActiveSubtitleStreamIndex] = useState<number>();
161 const [hideCompatPlayer, setHideCompatPlayer] = useState(false);
162 const [exportConfirmOpen, setExportConfirmOpen] = useState(false);
163 const [cacheBuster, setCacheBuster] = useState(0);
164 const [currentFileExportCount, setCurrentFileExportCount] = useState(0);
165
166 const { fileFormat, setFileFormat, detectedFileFormat, setDetectedFileFormat, isCustomFormatSelected } = useFileFormatState();
167
168 // State per application launch
169 const [ffmpegInfo, setFfmpegInfo] = useState<Awaited<ReturnType<typeof runStartupCheck>>>();
170 const lastOpenedPathRef = useRef<string>(undefined);
171 const [showRightBar, setShowRightBar] = useState(true);
172 const [lastCommandsVisible, setLastCommandsVisible] = useState(false);
173 const [settingsVisible, setSettingsVisible] = useState(false);
174 const [tunerVisible, setTunerVisible] = useState<TunerType>();
175 const [keyboardShortcutsVisible, setKeyboardShortcutsVisible] = useState(false);
176 const [mifiLink, setMifiLink] = useState<unknown>();
177 const [alwaysConcatMultipleFiles, setAlwaysConcatMultipleFiles] = useState(false);
178 const [editingSegmentTagsSegmentIndex, setEditingSegmentTagsSegmentIndex] = useState<number>();
179 const [editingSegmentTags, setEditingSegmentTags] = useState<SegmentTags>();
180 const [mediaSourceQuality, setMediaSourceQuality] = useState(0);
181 const [encBitrate, setEncBitrate] = useState<number | undefined>();
182 const [exportCount, setExportCount] = useState(0);
183 const [maxKeyframes, setMaxKeyframes] = useState(10000);
184
185 const incrementMediaSourceQuality = useCallback(() => setMediaSourceQuality((v) => (v + 1) % mediaSourceQualities.length), []);
186
187 // Batch state / concat files
188 const [batchFiles, setBatchFiles] = useState<BatchFile[]>([]);
189 const [selectedBatchFiles, setSelectedBatchFiles] = useState<string[]>([]);
190
191 const allUserSettings = useUserSettingsRoot();
192 const { captureFormat, keyframeCut, preserveMetadata, preserveMetadataOnMerge, preserveMovData, preserveChapters, movFastStart, avoidNegativeTs, autoMerge, timecodeFormat, invertCutSegments, autoExportExtraStreams, askBeforeClose, enableImportChapters, enableAskForFileOpenAction, playbackVolume, autoSaveProjectFile, wheelSensitivity, waveformHeight, invertTimelineScroll, language, ffmpegExperimental, hideNotifications, hideOsNotifications, autoLoadTimecode, autoDeleteMergedSegments, exportConfirmEnabled, segmentsToChapters, simpleMode, cutFileTemplate, cutMergedFileTemplate, mergedFileTemplate, keyboardSeekAccFactor, keyboardNormalSeekSpeed, keyboardSeekSpeed2, keyboardSeekSpeed3, treatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart, outFormatLocked, safeOutputFileName, enableAutoHtml5ify, segmentsToChaptersOnly, keyBindings, enableSmartCut, customFfPath, storeProjectInWorkingDir, enableOverwriteOutput, mouseWheelZoomModifierKey, mouseWheelFrameSeekModifierKey, mouseWheelKeyframeSeekModifierKey, captureFrameMethod, captureFrameQuality, captureFrameFileNameFormat, enableNativeHevc, cleanupChoices, darkMode, preferStrongColors, outputFileNameMinZeroPadding, cutFromAdjustmentFrames, cutToAdjustmentFrames, waveformMode: waveformModePreference, thumbnailsEnabled, keyframesEnabled, reducedMotion, ffmpegHwaccel } = allUserSettings.settings;
193 const { setCaptureFormat, setCustomOutDir, setKeyframeCut, setPlaybackVolume, setExportConfirmEnabled, setSimpleMode, setOutFormatLocked, setSafeOutputFileName, setKeyBindings, resetKeyBindings, setStoreProjectInWorkingDir, setCleanupChoices, toggleDarkMode, setWaveformMode, setThumbnailsEnabled, setKeyframesEnabled, prefersReducedMotion, customOutDir } = allUserSettings;
194
195 const [showAdvancedSettings, setShowAdvancedSettings] = useState(!simpleMode);
196

Callers

nothing calls this directly

Calls 15

useDialogFunction · 0.90
isDurationValidFunction · 0.90
setDocumentTitleFunction · 0.90
calcShouldShowKeyframesFunction · 0.90
getFfCommandLineFunction · 0.90
getSubtitleStreamsFunction · 0.90
getRealVideoStreamsFunction · 0.90
getAudioStreamsFunction · 0.90
getFrameCountRawFunction · 0.90
getOutDirFunction · 0.90
isMatroskaFunction · 0.90
askForOutDirFunction · 0.90

Tested by

no test coverage detected