Phase 10~11 전체 구현: 킬러 피처 5종 + 수익화 시스템
Phase 10 킬러 피처: - MemoService: 태그 CRUD + 마크다운 내보내기 (memo_tags DB) - VoiceCommandService: 키워드→명령어 매칭, 프리셋 4종 - ScreenContextService: PowerShell 활성 윈도우 + Ctrl+C 선택 텍스트 - ChainService: LLM 명령어 순차 실행 파이프라인 - CaptionService: 6초 청크 연속 전사 + 시스템 오디오 루프백 VoiceModeService 파이프라인 통합: - 녹음 시작 → 컨텍스트 캡처 → STT → 키워드 매칭 → LLM(체인/컨텍스트 주입) → 삽입 시스템 오디오 캡처: - setDisplayMediaRequestHandler + audio: 'loopback' (IPC 브릿지) - electron-audio-loopback 패키지 contextIsolation 호환 불가 → 직접 구현 Phase 11 수익화: - LicenseService: Free/Pro/Pro+ 3티어, LemonSqueezy API - Feature Gate: requireFeature/checkFeature/consumeFeature - 일일 쿼터: Free dictation 20/일, LLM 10/일 (SQLite daily_usage) - LicenseModal, ProBadge, UpgradePromptModal UI 디자인 보강: - d3roTypo(13종), d3roShadow(10종), d3roRadius(7종) 토큰 시스템 - ScreenPanel, ButtonGroup DS 컴포넌트 신규 - PhosphorText 4→13종 변형, MetalDial conic-gradient 광택 - 공유 컴포넌트: EmptyStateCard, SearchInput, PageHeader, HistoryEntryCard 기타: - 자막 핫키 SSOT 전체 연동 (Config→Hotkey→VoiceMode→Caption→Settings) - StatusBar 자막 LED + 효과음, 자막 로딩 UI - LLM 상태 이벤트 전파 수정 (폴링 제거 → onStatusChanged) - 커맨드 팝업 "선택 해제" 항목 추가
This commit is contained in:
parent
36d77ca224
commit
a31f96bbb8
97 changed files with 11853 additions and 1143 deletions
|
|
@ -8,9 +8,25 @@ import { WINDOW_SIZE } from '@shared/constants'
|
|||
import { getLogger } from '../services/LoggerService'
|
||||
import { getIsQuitting } from '../lifecycle'
|
||||
import { configGet } from '../services/ConfigService'
|
||||
import { buildPopupThemeCss } from '@shared/theme-vars'
|
||||
|
||||
const logger = getLogger('WindowManager')
|
||||
|
||||
// ── 팝업 테마 주입 ────────────────────────────────────────
|
||||
/**
|
||||
* 팝업 BrowserWindow에 현재 설정 테마의 CSS 변수를 insertCSS로 주입.
|
||||
* did-finish-load 이후 호출해야 한다.
|
||||
*/
|
||||
function injectPopupTheme(win: BrowserWindow): void {
|
||||
const theme = configGet('theme') as string
|
||||
// 'system'은 'dark'로 폴백 (팝업은 시스템 다크모드 감지 불가)
|
||||
const resolvedTheme = theme === 'system' ? 'dark' : theme
|
||||
const css = buildPopupThemeCss(resolvedTheme)
|
||||
win.webContents.insertCSS(css).catch((err: unknown) => {
|
||||
logger.warn('팝업 테마 CSS 주입 실패', err)
|
||||
})
|
||||
}
|
||||
|
||||
// ── 윈도우 참조 ───────────────────────────────────────
|
||||
|
||||
let mainWindow: BrowserWindow | null = null
|
||||
|
|
@ -18,6 +34,7 @@ let recordingTipWindow: BrowserWindow | null = null
|
|||
let resultPopupWindow: BrowserWindow | null = null
|
||||
let historyPopupWindow: BrowserWindow | null = null
|
||||
let commandPopupWindow: BrowserWindow | null = null
|
||||
let captionOverlayWindow: BrowserWindow | null = null
|
||||
|
||||
// ── 메인 윈도우 ───────────────────────────────────────
|
||||
|
||||
|
|
@ -97,7 +114,8 @@ function createRecordingTipWindow(): BrowserWindow {
|
|||
preload: join(__dirname, '../preload/popup.js'),
|
||||
sandbox: false,
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false
|
||||
nodeIntegration: false,
|
||||
backgroundThrottling: false
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -107,6 +125,10 @@ function createRecordingTipWindow(): BrowserWindow {
|
|||
win.loadFile(join(__dirname, '../renderer/popups/recording-tip/index.html'))
|
||||
}
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
injectPopupTheme(win)
|
||||
})
|
||||
|
||||
win.on('closed', () => {
|
||||
recordingTipWindow = null
|
||||
})
|
||||
|
|
@ -175,7 +197,7 @@ export function updateRecordingTipState(
|
|||
}
|
||||
|
||||
export function sendAudioLevelToTip(level: number): void {
|
||||
if (recordingTipWindow && !recordingTipWindow.isDestroyed() && recordingTipWindow.isVisible()) {
|
||||
if (recordingTipWindow && !recordingTipWindow.isDestroyed()) {
|
||||
recordingTipWindow.webContents.send('voice:audioLevel', { level })
|
||||
}
|
||||
}
|
||||
|
|
@ -207,6 +229,10 @@ function createResultPopupWindow(): BrowserWindow {
|
|||
win.loadFile(join(__dirname, '../renderer/popups/result-popup/index.html'))
|
||||
}
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
injectPopupTheme(win)
|
||||
})
|
||||
|
||||
win.on('closed', () => {
|
||||
resultPopupWindow = null
|
||||
})
|
||||
|
|
@ -291,6 +317,10 @@ function createHistoryPopupWindow(): BrowserWindow {
|
|||
win.loadFile(join(__dirname, '../renderer/popups/history-popup/index.html'))
|
||||
}
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
injectPopupTheme(win)
|
||||
})
|
||||
|
||||
win.on('closed', () => {
|
||||
historyPopupWindow = null
|
||||
})
|
||||
|
|
@ -383,6 +413,10 @@ function createCommandPopupWindow(): BrowserWindow {
|
|||
win.loadFile(join(__dirname, '../renderer/popups/command-popup/index.html'))
|
||||
}
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
injectPopupTheme(win)
|
||||
})
|
||||
|
||||
win.on('closed', () => { commandPopupWindow = null })
|
||||
return win
|
||||
}
|
||||
|
|
@ -436,6 +470,82 @@ export function isCommandPopupVisible(): boolean {
|
|||
return !!(commandPopupWindow && !commandPopupWindow.isDestroyed() && commandPopupWindow.isVisible())
|
||||
}
|
||||
|
||||
// ── CaptionOverlay 팝업 (Phase 10.1) ─────────────────
|
||||
|
||||
function createCaptionOverlayWindow(): BrowserWindow {
|
||||
const primaryDisplay = screen.getPrimaryDisplay()
|
||||
const { width: screenWidth, height: screenHeight } = primaryDisplay.workAreaSize
|
||||
const overlayWidth = Math.round(screenWidth * 0.8)
|
||||
const overlayHeight = 120
|
||||
|
||||
const win = new BrowserWindow({
|
||||
width: overlayWidth,
|
||||
height: overlayHeight,
|
||||
x: Math.round((screenWidth - overlayWidth) / 2),
|
||||
y: screenHeight - overlayHeight - 40,
|
||||
show: false,
|
||||
frame: false,
|
||||
transparent: true,
|
||||
resizable: false,
|
||||
alwaysOnTop: true,
|
||||
skipTaskbar: true,
|
||||
focusable: false,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '../preload/popup.js'),
|
||||
sandbox: false,
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false
|
||||
}
|
||||
})
|
||||
|
||||
// 클릭 통과: 마우스 이벤트를 무시하되, CSS hover 등을 위해 forward 활성화
|
||||
win.setIgnoreMouseEvents(true, { forward: true })
|
||||
|
||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||
win.loadURL(`${process.env['ELECTRON_RENDERER_URL']}/popups/caption-overlay/index.html`)
|
||||
} else {
|
||||
win.loadFile(join(__dirname, '../renderer/popups/caption-overlay/index.html'))
|
||||
}
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
injectPopupTheme(win)
|
||||
})
|
||||
|
||||
win.on('closed', () => {
|
||||
captionOverlayWindow = null
|
||||
})
|
||||
|
||||
return win
|
||||
}
|
||||
|
||||
export function getCaptionOverlayWindow(): BrowserWindow {
|
||||
if (!captionOverlayWindow || captionOverlayWindow.isDestroyed()) {
|
||||
captionOverlayWindow = createCaptionOverlayWindow()
|
||||
logger.info('CaptionOverlay window created')
|
||||
}
|
||||
return captionOverlayWindow
|
||||
}
|
||||
|
||||
export function showCaptionOverlay(): void {
|
||||
const win = getCaptionOverlayWindow()
|
||||
if (!win.isVisible()) {
|
||||
win.showInactive()
|
||||
}
|
||||
}
|
||||
|
||||
export function hideCaptionOverlay(): void {
|
||||
if (captionOverlayWindow && !captionOverlayWindow.isDestroyed()) {
|
||||
captionOverlayWindow.webContents.send('caption:hide', {})
|
||||
captionOverlayWindow.hide()
|
||||
}
|
||||
}
|
||||
|
||||
export function sendToCaptionOverlay(channel: string, data: unknown): void {
|
||||
if (captionOverlayWindow && !captionOverlayWindow.isDestroyed()) {
|
||||
captionOverlayWindow.webContents.send(channel, data)
|
||||
}
|
||||
}
|
||||
|
||||
// ── 프리로딩 ──────────────────────────────────────────
|
||||
|
||||
export function preloadPopupWindows(): void {
|
||||
|
|
@ -446,6 +556,27 @@ export function preloadPopupWindows(): void {
|
|||
logger.info('Popup windows preloaded')
|
||||
}
|
||||
|
||||
// ── 테마 재주입 (설정에서 테마 변경 시 호출) ──────────
|
||||
|
||||
/**
|
||||
* 현재 살아있는 팝업 윈도우에 테마 CSS를 재주입.
|
||||
* config SET_THEME 핸들러에서 호출한다.
|
||||
*/
|
||||
export function reapplyThemeToAllPopups(): void {
|
||||
const popupWindows = [
|
||||
recordingTipWindow,
|
||||
resultPopupWindow,
|
||||
historyPopupWindow,
|
||||
commandPopupWindow,
|
||||
captionOverlayWindow,
|
||||
]
|
||||
for (const win of popupWindows) {
|
||||
if (win && !win.isDestroyed()) {
|
||||
injectPopupTheme(win)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── clipboard:copy IPC (ResultPopup에서 사용) ─────────
|
||||
|
||||
ipcMain.on('clipboard:copy', (_event, text: string) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue