From d892f7077d8ea6773e43cad89846034c41e25a24 Mon Sep 17 00:00:00 2001 From: Sacha Date: Fri, 22 Nov 2013 14:05:36 +1000 Subject: [PATCH] Qt: Cleanup the menu creation even more. Use classes instead of defines. Now automatically translates and sets state. Update translations. --- Qt/languages/ppsspp_de.ts | 94 +++++------ Qt/languages/ppsspp_en.ts | 94 +++++------ Qt/languages/ppsspp_fr.ts | 94 +++++------ Qt/languages/ppsspp_gr.ts | 94 +++++------ Qt/languages/ppsspp_hu.ts | 94 +++++------ Qt/languages/ppsspp_id.ts | 94 +++++------ Qt/languages/ppsspp_pl.ts | 94 +++++------ Qt/languages/ppsspp_pt-br.ts | 94 +++++------ Qt/languages/ppsspp_ru.ts | 94 +++++------ Qt/languages/ppsspp_zh-cn.ts | 94 +++++------ Qt/languages/ppsspp_zh-tw.ts | 94 +++++------ Qt/mainwindow.cpp | 316 +++++++++++++++-------------------- Qt/mainwindow.h | 199 ++++++++++++++-------- 13 files changed, 781 insertions(+), 768 deletions(-) diff --git a/Qt/languages/ppsspp_de.ts b/Qt/languages/ppsspp_de.ts index 331a13149d..d9d66d8685 100644 --- a/Qt/languages/ppsspp_de.ts +++ b/Qt/languages/ppsspp_de.ts @@ -663,97 +663,97 @@ PPSSPP - + &File &Datei - + Quickload State Schnellladen - + Quicksave State Schnellspeichern - + &Emulation &Emulation - + Re&set Z&urücksetzen - + Run on &load - + Load Map File... Lade Map Dateien... - + Save Map File... &Speichere Map Dateien... - + Reset Symbol Table &Setze Symboltabelle zurück - + Dump next frame to log Dump nächsten Frame - + Disassembly Demontage - + Display List... Anzeige Liste... - + Log Console &Log Konsole - + Memory View Speicher Anzeigen - + Memory View Texture Speicher Anzeigen Texture - + &Options &Optionen - + &CPU Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) Schnellen Speicher (instabil) @@ -762,37 +762,37 @@ &Ignorier Illegal lese/schreibt - + &Stretch to Display S&trecke auf Bildschirm - + &Vertex Cache &Vertex Cache - + &Frameskip V&ollbildübersprung - + &Audio &Audio - + &Fullscreen Vollbild - + &Show debug statistics Zeige &debug statistiken - + &Show FPS Zeige &FPS @@ -805,7 +805,7 @@ HLE - + &Go to official website &Sehen Sie die offizielle Website @@ -814,12 +814,12 @@ Standard - + &Language &Sprache - + &Video &Video @@ -836,22 +836,22 @@ Ta&stenbelegung - + &Core &Kern - + &Help &Hilfe - + &Open... &Öffnen... - + &Close &Schließen @@ -872,22 +872,22 @@ F2 - + &Load State File... &Lade Spielstand... - + &Save State File... &Speichere Spielstand... - + E&xit B&ende - + &Run &Starte @@ -896,7 +896,7 @@ F7 - + &Pause &Pause @@ -985,7 +985,7 @@ F11 - + &Buffered Rendering &Gepuffert Rendering @@ -994,7 +994,7 @@ F5 - + &Hardware Transform &Hardware Transformation @@ -1003,7 +1003,7 @@ F6 - + &Linear Filtering &Lineare Filterung @@ -1048,7 +1048,7 @@ &Besuche http://www.ppsspp.org - + &About PPSSPP... &Über PPSSPP... @@ -1057,27 +1057,27 @@ &Nutze VBO - + De&bug De&bug - + &Ignore Illegal reads/writes - + &Anisotropic Filtering &Anisotrope Filterung - + &Screen Size &Bildschirmgröße - + Lo&g levels Anmelden &Ebenen diff --git a/Qt/languages/ppsspp_en.ts b/Qt/languages/ppsspp_en.ts index 38db4aa451..67c70e576d 100644 --- a/Qt/languages/ppsspp_en.ts +++ b/Qt/languages/ppsspp_en.ts @@ -651,237 +651,237 @@ MainWindow - + &File - + &Emulation - + Run on &load - + &Options - + &CPU Dynarec - + &Vertex Decoder Dynarec - + &Language - + &Video - + &Core - + &Ignore Illegal reads/writes - + &Help - + De&bug - + &Open... - + &Close - + Quickload State - + Quicksave State - + &Load State File... - + &Save State File... - + E&xit - + &Run - + &Pause - + Re&set - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + Fast &Memory (unstable) - + &Anisotropic Filtering - + &Buffered Rendering - + &Linear Filtering - + &Screen Size - + &Stretch to Display - + &Hardware Transform - + &Vertex Cache - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + Lo&g levels - + &Go to official website - + &About PPSSPP... diff --git a/Qt/languages/ppsspp_fr.ts b/Qt/languages/ppsspp_fr.ts index 8b9f889f88..e258fb8074 100644 --- a/Qt/languages/ppsspp_fr.ts +++ b/Qt/languages/ppsspp_fr.ts @@ -663,22 +663,22 @@ PPSSPP - + &File &Fichier - + Quickload State - + Quicksave State - + &Emulation &Emulation @@ -687,7 +687,7 @@ Debu&g - + &Options &Options @@ -708,12 +708,12 @@ Op&tions du journal - + &Language &Langue - + &Video &Video @@ -730,27 +730,27 @@ Co&ntrôles - + &Core &Emulation - + &Ignore Illegal reads/writes - + &Help &Aide - + &Open... &Ouvrir... - + &Close &Fermer @@ -775,22 +775,22 @@ F2 - + &Load State File... &Charger... - + &Save State File... &Sauvegarder... - + E&xit &Quitter - + &Run &Démarrer @@ -799,7 +799,7 @@ F7 - + &Pause &Pause @@ -881,7 +881,7 @@ F11 - + &Buffered Rendering &Rendu Tampon @@ -890,7 +890,7 @@ F5 - + &Hardware Transform &Hardware Transform @@ -899,7 +899,7 @@ F6 - + &Linear Filtering &Filtrage Linéaire @@ -948,7 +948,7 @@ &Aller à http://www.ppsspp.org/ - + &About PPSSPP... &A propos de PPSSPP... @@ -957,127 +957,127 @@ &Utiliser les VBO - + Re&set - + Run on &load - + De&bug - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + &CPU Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) - + &Anisotropic Filtering - + &Screen Size - + &Stretch to Display - + &Vertex Cache &Cache du Vertex - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + Lo&g levels @@ -1098,7 +1098,7 @@ Informations - + &Go to official website diff --git a/Qt/languages/ppsspp_gr.ts b/Qt/languages/ppsspp_gr.ts index 1109a59c42..d9ba911d12 100644 --- a/Qt/languages/ppsspp_gr.ts +++ b/Qt/languages/ppsspp_gr.ts @@ -659,22 +659,22 @@ MainWindow - + &File &Αρχείο - + Quickload State - + Quicksave State - + &Emulation &Εξομοίωση @@ -683,7 +683,7 @@ Αποσφαλμάτωσ&η - + &Options &Επιλογές @@ -700,12 +700,12 @@ Επ&ίπεδα Καταγραφικού - + &Language &Γλώσσα - + &Video &Βίντεο @@ -722,37 +722,37 @@ Χε&ιριστήρια - + &Core &Πυρήνας - + &CPU Dynarec - + &Vertex Decoder Dynarec - + &Ignore Illegal reads/writes - + &Help &Βοήθεια - + &Open... &’νοιγμα... - + &Close &Κλείσιμο @@ -765,27 +765,27 @@ Γρήγορη Αποθήκευση - + &Load State File... &Φόρτωση Σημείου Αποθήκευσης... - + &Save State File... &Αποθήκευση Σημείου Αποθήκευσης... - + E&xit Έ&ξοδος - + &Run &Εκκίνηση - + &Pause &Παύση @@ -854,17 +854,17 @@ &Εξομοίωση ήχου - + &Buffered Rendering &Buffered Απεικόνιση - + &Hardware Transform Hardware Μετασχηματισμός - + &Linear Filtering Γραμμικό φιλτράρισμα @@ -901,7 +901,7 @@ &Μετάβαση σε http://www.ppsspp.org/ - + &About PPSSPP... &Περί του PPSSPP... @@ -910,117 +910,117 @@ &Χρήση VBO - + Re&set - + Run on &load - + De&bug - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + Fast &Memory (unstable) - + &Anisotropic Filtering - + &Screen Size - + &Stretch to Display - + &Vertex Cache &Προσορηνή Μνήμη Κορυφών - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + Lo&g levels @@ -1041,7 +1041,7 @@ Πληροφορίες - + &Go to official website diff --git a/Qt/languages/ppsspp_hu.ts b/Qt/languages/ppsspp_hu.ts index 3e7166dd14..e6c8b0a260 100644 --- a/Qt/languages/ppsspp_hu.ts +++ b/Qt/languages/ppsspp_hu.ts @@ -663,137 +663,137 @@ PPSSPP - + &File Fájl - + Quickload State - + Quicksave State - + &Emulation Emuláció - + Re&set - + Run on &load - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + &Options Beállítások - + &CPU Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) - + &Stretch to Display - + &Vertex Cache - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + &Go to official website @@ -806,12 +806,12 @@ Log szint - + &Language Nyelv - + &Video Videó @@ -828,22 +828,22 @@ Irányítás - + &Core Központi - + &Help Segítség - + &Open... Megnyitás... - + &Close Bezárás @@ -868,22 +868,22 @@ F2 - + &Load State File... Állás betöltése... - + &Save State File... Állás mentése... - + E&xit Kilépés - + &Run Futtatás @@ -892,7 +892,7 @@ F7 - + &Pause Szüneteltetés @@ -969,12 +969,12 @@ Hang emuláció - + &Buffered Rendering Pufferelt Renderelés - + &Hardware Transform Hardveres Átváltoztatás @@ -983,7 +983,7 @@ F6 - + &Linear Filtering Lineáris Szűrés @@ -996,7 +996,7 @@ Ugrás a honlapra http//www.ppsspp.org/ - + &About PPSSPP... PPSSPP Névjegye @@ -1005,27 +1005,27 @@ VBO Használata - + De&bug - + &Ignore Illegal reads/writes - + &Anisotropic Filtering - + &Screen Size - + Lo&g levels diff --git a/Qt/languages/ppsspp_id.ts b/Qt/languages/ppsspp_id.ts index aab53ffde9..b0ed6fe1ef 100644 --- a/Qt/languages/ppsspp_id.ts +++ b/Qt/languages/ppsspp_id.ts @@ -651,227 +651,227 @@ MainWindow - + &File - + &Emulation - + Run on &load - + &Options - + &CPU Dynarec - + &Vertex Decoder Dynarec - + &Language - + &Video - + &Core - + &Ignore Illegal reads/writes - + &Help - + De&bug - + &Open... - + &Close - + Quickload State - + Quicksave State - + &Load State File... - + &Save State File... - + E&xit - + &Run - + &Pause - + Re&set - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + Fast &Memory (unstable) - + &Anisotropic Filtering - + &Buffered Rendering - + &Linear Filtering - + &Screen Size - + &Stretch to Display - + &Hardware Transform - + &Vertex Cache - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + Lo&g levels @@ -888,12 +888,12 @@ Informasi - + &Go to official website - + &About PPSSPP... diff --git a/Qt/languages/ppsspp_pl.ts b/Qt/languages/ppsspp_pl.ts index 8537fa7378..dc10e59518 100644 --- a/Qt/languages/ppsspp_pl.ts +++ b/Qt/languages/ppsspp_pl.ts @@ -675,22 +675,22 @@ PPSSPP - + &File &Plik - + Quickload State - + Quicksave State - + &Emulation &Emulacja @@ -699,7 +699,7 @@ &Debugger - + &Options &Opcje @@ -720,12 +720,12 @@ &Poziomy logowania - + &Language &Język - + &Video &Wideo @@ -742,27 +742,27 @@ S&terowanie - + &Core Jądr&o - + &Ignore Illegal reads/writes - + &Help Pomo&c - + &Open... &Otwórz... - + &Close &Zamknij @@ -783,22 +783,22 @@ F2 - + &Load State File... &Wczytaj plik stanu... - + &Save State File... &Zapisz plik stanu... - + E&xit Wyj&dź - + &Run &Uruchom @@ -807,7 +807,7 @@ F7 - + &Pause &Pauza @@ -908,7 +908,7 @@ F11 - + &Buffered Rendering &Buforowane renderowanie @@ -917,7 +917,7 @@ F5 - + &Hardware Transform Sprzętowa &transformacja @@ -926,7 +926,7 @@ F6 - + &Linear Filtering Filtrowanie &liniowe @@ -979,7 +979,7 @@ &Idź do http://www.ppsspp.org - + &About PPSSPP... &O PPSSPP... @@ -988,127 +988,127 @@ Użyj &VBO - + Re&set - + Run on &load - + De&bug - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + &CPU Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) - + &Anisotropic Filtering - + &Screen Size - + &Stretch to Display - + &Vertex Cache &Cache wierzchołków - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + Lo&g levels @@ -1129,7 +1129,7 @@ Info - + &Go to official website diff --git a/Qt/languages/ppsspp_pt-br.ts b/Qt/languages/ppsspp_pt-br.ts index 20843550e2..39dd5b7451 100644 --- a/Qt/languages/ppsspp_pt-br.ts +++ b/Qt/languages/ppsspp_pt-br.ts @@ -671,137 +671,137 @@ MainWindow - + &File &Arquivo - + Quickload State - + Quicksave State - + &Emulation &Emulação - + Re&set - + Run on &load - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + &Options &Opções - + &CPU Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) - + &Stretch to Display - + &Vertex Cache Cache de &Vértices - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + &Go to official website @@ -814,12 +814,12 @@ Nível de Lo&g - + &Language &Linguagem - + &Video &Vídeo @@ -832,22 +832,22 @@ Co&ntroles - + &Core &Núcleo - + &Help Aj&uda - + &Open... &Abrir... - + &Close &Fechar @@ -860,27 +860,27 @@ Salvar estado rápido - + &Load State File... &Carregar estado do arquivo... - + &Save State File... &Salvar estado no arquivo... - + E&xit Sai&r - + &Run &Rodar - + &Pause &Pausar @@ -961,17 +961,17 @@ Emular &som - + &Buffered Rendering Renderização com &buffer - + &Hardware Transform Transformação em &Hardware - + &Linear Filtering Filtragem &Linear @@ -1008,7 +1008,7 @@ &Ir para http://www.ppsspp.org/ - + &About PPSSPP... &Sobre o PPSSPP... @@ -1017,27 +1017,27 @@ &Usar VBO - + De&bug - + &Ignore Illegal reads/writes - + &Anisotropic Filtering - + &Screen Size - + Lo&g levels diff --git a/Qt/languages/ppsspp_ru.ts b/Qt/languages/ppsspp_ru.ts index 55fb32958f..66eda9c6e3 100644 --- a/Qt/languages/ppsspp_ru.ts +++ b/Qt/languages/ppsspp_ru.ts @@ -663,22 +663,22 @@ PPSSPP - + &File &Файл - + Quickload State Быстро загрузить состояние - + Quicksave State Быстро сохранить состояние - + &Emulation &Эмуляция @@ -687,7 +687,7 @@ &Отладка - + &Options &Настройки @@ -708,12 +708,12 @@ Уровень ло&гирования - + &Language &Язык - + &Video &Видео @@ -730,27 +730,27 @@ У&правление - + &Core &Ядро - + &Ignore Illegal reads/writes &Игнорировать неправильные чтения/запись - + &Help &Помощь - + &Open... &Открыть... - + &Close &Закрыть @@ -771,27 +771,27 @@ F2 - + &Load State File... &Открыть файл состояния... - + &Save State File... &Сохранить файл состояния... - + E&xit В&ыход - + &Run &Запустить - + &Pause &Пауза @@ -864,7 +864,7 @@ Эмуляция &звука - + &Buffered Rendering &Буферированный рендеринг @@ -873,7 +873,7 @@ F5 - + &Hardware Transform &Аппаратное преобразование @@ -882,7 +882,7 @@ F6 - + &Linear Filtering &Линейная фильтрация @@ -903,7 +903,7 @@ &Быстрая память (dynarec, нестабильно) - + &About PPSSPP... &О PPSSPP... @@ -912,127 +912,127 @@ &Использовать VBO - + Re&set Пере&загрузить - + Run on &load Запускать при &загрузке - + De&bug &Отладка - + Load Map File... Загрузить файл &карты... - + Save Map File... &Сохранить файл карты... - + Reset Symbol Table &Сбросить таблицу символов - + Dump next frame to log С&бросить следующий кадр в лог - + Disassembly &Деасэмблинг - + Display List... Список экранов... - + Log Console &Консоль логов - + Memory View &Отображение памяти - + Memory View Texture Память отображаемых текстур - + &CPU Dynarec &Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) &Быстрая память (нестабильно) - + &Anisotropic Filtering &Анизотропная фильтрация - + &Screen Size (&S)Размер экрана - + &Stretch to Display За&стягивать под экран - + &Vertex Cache &Vertex кэш - + &Frameskip Пропуск кадров - + &Audio &Aудио - + &Fullscreen &Полный экран - + &Show debug statistics Показывать &отладочную информацию - + &Show FPS Показывать &FPS - + Lo&g levels Уровень ло&гирования @@ -1053,7 +1053,7 @@ Информация - + &Go to official website (&G)Зайдите на официальный сайт diff --git a/Qt/languages/ppsspp_zh-cn.ts b/Qt/languages/ppsspp_zh-cn.ts index 8e0a460cad..46e5101474 100644 --- a/Qt/languages/ppsspp_zh-cn.ts +++ b/Qt/languages/ppsspp_zh-cn.ts @@ -675,22 +675,22 @@ PPSSPP - + &File (&F)文件 - + Quickload State 快速负载态 - + Quicksave State 快速保存态 - + &Emulation (&E)模拟 @@ -699,7 +699,7 @@ (&G)调试 - + &Options (&O)选项 @@ -712,12 +712,12 @@ (&G)日志级别 - + &Language (&L)语言选择 - + &Video (&V)视频 @@ -734,27 +734,27 @@ (&N)控制 - + &Core (&C)核心 - + &Ignore Illegal reads/writes 忽略非法读取/写入 - + &Help (&H)帮助 - + &Open... (&O)打开... - + &Close (&C)关闭 @@ -779,22 +779,22 @@ F2 - + &Load State File... (&L)读取存档... - + &Save State File... (&S)保存存档... - + E&xit (&X)退出 - + &Run (&R)运行 @@ -803,7 +803,7 @@ F7 - + &Pause (&P)暂停 @@ -904,7 +904,7 @@ F11 - + &Buffered Rendering (&B)渲染缓冲 @@ -913,7 +913,7 @@ F5 - + &Hardware Transform (&H)硬件加速 @@ -922,7 +922,7 @@ F6 - + &Linear Filtering (&L)线性过滤 @@ -975,7 +975,7 @@ (&G)转到 http://www.ppsspp.org/ - + &About PPSSPP... (&A)关于 PPSSPP... @@ -984,127 +984,127 @@ (&U)使用 VBO - + Re&set (&R)复位 - + Run on &load 加载时执行 - + De&bug 调试 - + Load Map File... 载入地图文件 - + Save Map File... 保存地图文件 - + Reset Symbol Table 重置符号表 - + Dump next frame to log 将下一帧转储至日志 - + Disassembly 汇编视图 - + Display List... 显示列表... - + Log Console 查看控制台日志 - + Memory View 内存视图 - + Memory View Texture 内存纹理视图 - + &CPU Dynarec (&D)动态重编译 - + &Vertex Decoder Dynarec 顶点解码器动态重编译 - + Fast &Memory (unstable) (&F)高速闪存 (动态重编译,不稳定) - + &Anisotropic Filtering (&A)各向异性过滤 - + &Screen Size 屏幕尺寸 - + &Stretch to Display (&T)拉伸显示 - + &Vertex Cache (&V)顶点缓存 - + &Frameskip (&F)跳帧 - + &Audio (&S)声响 - + &Fullscreen (&F)全屏 - + &Show debug statistics (&D)显示调试信息 - + &Show FPS (&F)显示帧率计数器 - + Lo&g levels (&G)日志级别 @@ -1125,7 +1125,7 @@ 信息 - + &Go to official website (&G)进入官方网站 diff --git a/Qt/languages/ppsspp_zh-tw.ts b/Qt/languages/ppsspp_zh-tw.ts index 21de41440f..3cbe6185dd 100644 --- a/Qt/languages/ppsspp_zh-tw.ts +++ b/Qt/languages/ppsspp_zh-tw.ts @@ -675,22 +675,22 @@ PPSSPP - + &File (&F)文件 - + Quickload State - + Quicksave State - + &Emulation (&E)模擬 @@ -699,7 +699,7 @@ (&G)調試 - + &Options (&O)選項 @@ -712,12 +712,12 @@ (&G)日誌級別 - + &Language (&L)語言選擇 - + &Video (&V)視頻 @@ -734,27 +734,27 @@ (&N)控制 - + &Core (&C)核心 - + &Ignore Illegal reads/writes - + &Help (&H)幫助 - + &Open... (&O)打開... - + &Close (&C)關閉 @@ -779,22 +779,22 @@ F2 - + &Load State File... (&L)讀取存檔... - + &Save State File... (&S)保存存檔... - + E&xit (&X)退出 - + &Run (&R)運行 @@ -803,7 +803,7 @@ F7 - + &Pause (&P)暫停 @@ -904,7 +904,7 @@ F11 - + &Buffered Rendering (&B)渲染緩衝 @@ -913,7 +913,7 @@ F5 - + &Hardware Transform (&H)硬件加速 @@ -922,7 +922,7 @@ F6 - + &Linear Filtering (&L)線性過濾 @@ -975,7 +975,7 @@ (&G)轉到 http://www.ppsspp.org/ - + &About PPSSPP... (&A)關於 PPSSPP... @@ -984,127 +984,127 @@ (&U)使用 VBO - + Re&set - + Run on &load - + De&bug - + Load Map File... - + Save Map File... - + Reset Symbol Table - + Dump next frame to log - + Disassembly - + Display List... - + Log Console - + Memory View - + Memory View Texture - + &CPU Dynarec - + &Vertex Decoder Dynarec - + Fast &Memory (unstable) - + &Anisotropic Filtering - + &Screen Size - + &Stretch to Display - + &Vertex Cache (&V)頂點緩存 - + &Frameskip - + &Audio - + &Fullscreen - + &Show debug statistics - + &Show FPS - + Lo&g levels @@ -1125,7 +1125,7 @@ 信息 - + &Go to official website diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index adf873948b..058a4a0706 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -47,13 +47,7 @@ MainWindow::MainWindow(QWidget *parent) : startTimer(16); -// if (!fileToStart.isNull()) -// { -// if (stateToLoad != NULL) -// SaveState::Load(stateToLoad); -// } - - QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscreenAct_triggered()) ); + QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscrAct()) ); } void MainWindow::ShowMemory(u32 addr) @@ -85,37 +79,6 @@ void MainWindow::timerEvent(QTimerEvent *) void MainWindow::updateMenus() { - bool enable = globalUIState == UISTATE_MENU; - // File - openAct->setEnabled(enable); - closeAct->setEnabled(!enable); - qlstateAct->setEnabled(!enable); - qsstateAct->setEnabled(!enable); - lstateAct->setEnabled(!enable); - sstateAct->setEnabled(!enable); - // Emulation - runAct->setEnabled(Core_IsStepping() || globalUIState == UISTATE_PAUSEMENU); - pauseAct->setEnabled(globalUIState == UISTATE_INGAME); - resetAct->setEnabled(globalUIState == UISTATE_INGAME); - runonloadAct->setChecked(g_Config.bAutoRun); - // Debug - lmapAct->setEnabled(!enable); - smapAct->setEnabled(!enable); - resetTableAct->setEnabled(!enable); - dumpNextAct->setEnabled(!enable); - disasmAct->setEnabled(!enable); - dpyListAct->setEnabled(!enable); - consoleAct->setEnabled(!enable); - memviewAct->setEnabled(!enable); - memviewTexAct->setEnabled(!enable); - // Options - dynarecAct->setChecked(g_Config.bJit); - vertexDynarecAct->setChecked(g_Config.bVertexDecoderJit); - fastmemAct->setChecked(g_Config.bFastMemory); - ignoreIllegalAct->setChecked(g_Config.bIgnoreBadMemAccess); - - audioAct->setChecked(g_Config.bEnableSound); - foreach(QAction * action, anisotropicGroup->actions()) { if (g_Config.iAnisotropyLevel == action->data().toInt()) { action->setChecked(true); @@ -123,9 +86,6 @@ void MainWindow::updateMenus() } } - bufferRenderAct->setChecked(g_Config.iRenderingMode == 1); - linearAct->setChecked(g_Config.iTexFiltering > 0); - foreach(QAction * action, screenGroup->actions()) { if (g_Config.iInternalResolution == action->data().toInt()) { action->setChecked(true); @@ -133,14 +93,6 @@ void MainWindow::updateMenus() } } - stretchAct->setChecked(g_Config.bStretchToDisplay); - transformAct->setChecked(g_Config.bHardwareTransform); - vertexCacheAct->setChecked(g_Config.bVertexCache); - frameskipAct->setChecked(g_Config.iFrameSkip > 0); - - statsAct->setChecked(g_Config.bShowDebugStats); - showFPSAct->setChecked(g_Config.iShowFPSCounter); - int defaultLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::COMMON); foreach(QAction * action, defaultLogGroup->actions()) { if (defaultLevel == action->data().toInt()) { @@ -164,11 +116,12 @@ void MainWindow::updateMenus() break; } } + emit updateMenu(); } void MainWindow::closeEvent(QCloseEvent *) { - exitAct_triggered(); + exitAct(); } void MainWindow::keyPressEvent(QKeyEvent *e) @@ -189,7 +142,7 @@ void MainWindow::Boot() dialogDisasm->show(); if(g_Config.bFullScreen != isFullScreen()) - fullscreenAct_triggered(); + fullscrAct(); memoryWindow = new Debugger_Memory(currentDebugMIPS, this, this); memoryTexWindow = new Debugger_MemoryTex(this); @@ -198,11 +151,11 @@ void MainWindow::Boot() notifyMapsLoaded(); if (nextState == CORE_RUNNING) - runAct_triggered(); + runAct(); updateMenus(); } -void MainWindow::openAct_triggered() +void MainWindow::openAct() { QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)"); if (QFile::exists(filename)) @@ -213,7 +166,7 @@ void MainWindow::openAct_triggered() } } -void MainWindow::closeAct_triggered() +void MainWindow::closeAct() { if(dialogDisasm) dialogDisasm->Stop(); @@ -244,17 +197,17 @@ void SaveStateActionFinished(bool result, void *userdata) } } -void MainWindow::qlstateAct_triggered() +void MainWindow::qlstateAct() { SaveState::LoadSlot(0, SaveStateActionFinished, this); } -void MainWindow::qsstateAct_triggered() +void MainWindow::qsstateAct() { SaveState::SaveSlot(0, SaveStateActionFinished, this); } -void MainWindow::lstateAct_triggered() +void MainWindow::lstateAct() { QFileDialog dialog(0,"Load state"); dialog.setFileMode(QFileDialog::ExistingFile); @@ -269,7 +222,7 @@ void MainWindow::lstateAct_triggered() } } -void MainWindow::sstateAct_triggered() +void MainWindow::sstateAct() { QFileDialog dialog(0,"Save state"); dialog.setFileMode(QFileDialog::AnyFile); @@ -284,23 +237,23 @@ void MainWindow::sstateAct_triggered() } } -void MainWindow::exitAct_triggered() +void MainWindow::exitAct() { - closeAct_triggered(); + closeAct(); QApplication::exit(0); } -void MainWindow::runAct_triggered() +void MainWindow::runAct() { NativeMessageReceived("run", ""); } -void MainWindow::pauseAct_triggered() +void MainWindow::pauseAct() { NativeMessageReceived("pause", ""); } -void MainWindow::resetAct_triggered() +void MainWindow::resetAct() { if(dialogDisasm) dialogDisasm->Stop(); @@ -317,12 +270,12 @@ void MainWindow::resetAct_triggered() NativeMessageReceived("reset", ""); } -void MainWindow::runonloadAct_triggered() +void MainWindow::runonloadAct() { - runonloadAct->setChecked(g_Config.bAutoRun = !g_Config.bAutoRun); + g_Config.bAutoRun = !g_Config.bAutoRun; } -void MainWindow::lmapAct_triggered() +void MainWindow::lmapAct() { QFileDialog dialog(0,"Load .MAP"); dialog.setFileMode(QFileDialog::ExistingFile); @@ -339,7 +292,7 @@ void MainWindow::lmapAct_triggered() } } -void MainWindow::smapAct_triggered() +void MainWindow::smapAct() { QFileDialog dialog(0,"Save .MAP"); dialog.setFileMode(QFileDialog::AnyFile); @@ -355,58 +308,59 @@ void MainWindow::smapAct_triggered() } } -void MainWindow::resetTableAct_triggered() +void MainWindow::resetTableAct() { symbolMap.Clear(); notifyMapsLoaded(); } -void MainWindow::dumpNextAct_triggered() +void MainWindow::dumpNextAct() { gpu->DumpNextFrame(); } -void MainWindow::disasmAct_triggered() +void MainWindow::disasmAct() { if(dialogDisasm) dialogDisasm->show(); } -void MainWindow::dpyListAct_triggered() +void MainWindow::dpyListAct() { if(displaylistWindow) displaylistWindow->show(); } -void MainWindow::consoleAct_triggered() +void MainWindow::consoleAct() { LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); } -void MainWindow::memviewAct_triggered() +void MainWindow::memviewAct() { if (memoryWindow) memoryWindow->show(); } -void MainWindow::memviewTexAct_triggered() +void MainWindow::memviewTexAct() { if(memoryTexWindow) memoryTexWindow->show(); } -void MainWindow::stretchAct_triggered() +void MainWindow::stretchAct() { g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay; if (gpu) gpu->Resized(); } -void MainWindow::fullscreenAct_triggered() +void MainWindow::fullscrAct() { if(isFullScreen()) { g_Config.bFullScreen = false; menuBar()->show(); + updateMenus(); showNormal(); SetZoom(g_Config.iInternalResolution); @@ -441,15 +395,14 @@ void MainWindow::fullscreenAct_triggered() QApplication::setOverrideCursor(QCursor(Qt::BlankCursor)); } - fullscreenAct->setChecked(g_Config.bFullScreen); } -void MainWindow::websiteAct_triggered() +void MainWindow::websiteAct() { QDesktopServices::openUrl(QUrl("http://www.ppsspp.org/")); } -void MainWindow::aboutAct_triggered() +void MainWindow::aboutAct() { QMessageBox::about(this, "PPSSPP Qt", QString::fromUtf8("Created by Henrik Rydg\xc3\xa5rd")); } @@ -457,7 +410,7 @@ void MainWindow::aboutAct_triggered() /* Private functions */ void MainWindow::SetZoom(int zoom) { if (isFullScreen()) - fullscreenAct_triggered(); + fullscrAct(); g_Config.iInternalResolution = zoom; pixel_xres = 480 * zoom; @@ -486,7 +439,7 @@ void MainWindow::SetGameTitle(QString text) setWindowTitle(title); } -void MainWindow::loadLanguage(const QString& language, bool retranslate) +void MainWindow::loadLanguage(const QString& language, bool translate) { if (currentLanguage != language) { @@ -495,134 +448,136 @@ void MainWindow::loadLanguage(const QString& language, bool retranslate) QApplication::removeTranslator(&translator); if (translator.load(QString(":/languages/ppsspp_%1.qm").arg(language))) { QApplication::installTranslator(&translator); - if (retranslate) - retranslateUi(); + if (translate) + emit retranslate(); } } } -void MainWindow::retranslateUi() { - fileMenu->setTitle(tr("&File")); - emuMenu->setTitle(tr("&Emulation")); - debugMenu->setTitle(tr("De&bug")); - optionsMenu->setTitle(tr("&Options")); - coreMenu->setTitle(tr("&Core")); - videoMenu->setTitle(tr("&Video")); - anisotropicMenu->setTitle(tr("&Anisotropic Filtering")); - screenMenu->setTitle(tr("&Screen Size")); - levelsMenu->setTitle(tr("Lo&g levels")); - langMenu->setTitle(tr("&Language")); - helpMenu->setTitle(tr("&Help")); - emit retranslate(); -} - void MainWindow::createMenus() { - -#define NEW_GROUP(menu, group, stringlist, valuelist) \ -{ \ - group = new QActionGroup(this); \ - QListIterator i(valuelist); \ - foreach(QString name, stringlist) { \ - QAction *action = new MenuAction(this, group, i.next(), name); \ - } \ - connect(group, SIGNAL(triggered(QAction *)), this, SLOT(group ## _triggered(QAction *))); \ - menu->addActions(group->actions()); \ -} - -#define NEW_GROUP_KEYS(menu, group, stringlist, valuelist, keylist) \ -{ \ - group = new QActionGroup(this); \ - QListIterator i(valuelist); \ - QListIterator k(keylist); \ - foreach(QString name, stringlist) { \ - QAction *action = new MenuAction(this, group, i.next(), name, k.next()); \ - } \ - connect(group, SIGNAL(triggered(QAction *)), this, SLOT(group ## _triggered(QAction *))); \ - menu->addActions(group->actions()); \ -} - // File - fileMenu = menuBar()->addMenu(""); - openAct = new MenuAction(this, fileMenu, SLOT(openAct_triggered()), QT_TR_NOOP("&Open..."), false, QKeySequence::Open); - closeAct = new MenuAction(this, fileMenu, SLOT(closeAct_triggered()), QT_TR_NOOP("&Close"), false, QKeySequence::Close); + MenuTree* fileMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&File")); + fileMenu->add(new MenuAction(this, SLOT(openAct()), QT_TR_NOOP("&Open..."), QKeySequence::Open)) + ->addEnableState(UISTATE_MENU); + fileMenu->add(new MenuAction(this, SLOT(closeAct()), QT_TR_NOOP("&Close"), QKeySequence::Close)) + ->addDisableState(UISTATE_MENU); fileMenu->addSeparator(); - qlstateAct = new MenuAction(this, fileMenu, SLOT(qlstateAct_triggered()), QT_TR_NOOP("Quickload State"), false, Qt::Key_F4); - qsstateAct = new MenuAction(this, fileMenu, SLOT(qsstateAct_triggered()), QT_TR_NOOP("Quicksave State"), false, Qt::Key_F2); - lstateAct = new MenuAction(this, fileMenu, SLOT(lstateAct_triggered()), QT_TR_NOOP("&Load State File..."), false); - sstateAct = new MenuAction(this, fileMenu, SLOT(sstateAct_triggered()), QT_TR_NOOP("&Save State File..."), false); + fileMenu->add(new MenuAction(this, SLOT(qlstateAct()), QT_TR_NOOP("Quickload State"), Qt::Key_F4)) + ->addDisableState(UISTATE_MENU); + fileMenu->add(new MenuAction(this, SLOT(qsstateAct()), QT_TR_NOOP("Quicksave State"), Qt::Key_F2)) + ->addDisableState(UISTATE_MENU); + fileMenu->add(new MenuAction(this, SLOT(lstateAct()), QT_TR_NOOP("&Load State File..."))) + ->addDisableState(UISTATE_MENU); + fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save State File..."))) + ->addDisableState(UISTATE_MENU); fileMenu->addSeparator(); - exitAct = new MenuAction(this, fileMenu, SLOT(exitAct_triggered()), QT_TR_NOOP("E&xit"), false); + fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), QKeySequence::Quit)); // Emulation - emuMenu = menuBar()->addMenu(""); - runAct = new MenuAction(this, emuMenu, SLOT(runAct_triggered()), QT_TR_NOOP("&Run"), false, Qt::Key_F7); - pauseAct = new MenuAction(this, emuMenu, SLOT(pauseAct_triggered()), QT_TR_NOOP("&Pause"), false, Qt::Key_F8); - resetAct = new MenuAction(this, emuMenu, SLOT(resetAct_triggered()), QT_TR_NOOP("Re&set"), false); + MenuTree* emuMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Emulation")); + emuMenu->add(new MenuAction(this, SLOT(runAct()), QT_TR_NOOP("&Run"), Qt::Key_F7)) + ->addEnableStepping()->addEnableState(UISTATE_PAUSEMENU); + emuMenu->add(new MenuAction(this, SLOT(pauseAct()), QT_TR_NOOP("&Pause"), Qt::Key_F8)) + ->addEnableState(UISTATE_INGAME); + emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("Re&set"))) + ->addEnableState(UISTATE_INGAME); emuMenu->addSeparator(); - runonloadAct = new MenuAction(this, emuMenu, SLOT(runonloadAct_triggered()), QT_TR_NOOP("Run on &load"), true); + emuMenu->add(new MenuAction(this, SLOT(runonloadAct()), QT_TR_NOOP("Run on &load"))) + ->addEventChecked(&g_Config.bAutoRun); // Debug - debugMenu = menuBar()->addMenu(""); - lmapAct = new MenuAction(this, debugMenu, SLOT(lmapAct_triggered()), QT_TR_NOOP("Load Map File..."), false); - smapAct = new MenuAction(this, debugMenu, SLOT(smapAct_triggered()), QT_TR_NOOP("Save Map File..."), false); - resetTableAct = new MenuAction(this, debugMenu, SLOT(resetTableAct_triggered()), QT_TR_NOOP("Reset Symbol Table"), false); + MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("De&bug")); + debugMenu->add(new MenuAction(this, SLOT(lmapAct()), QT_TR_NOOP("Load Map File..."))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(smapAct()), QT_TR_NOOP("Save Map File..."))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(resetTableAct()),QT_TR_NOOP("Reset Symbol Table"))) + ->addDisableState(UISTATE_MENU); debugMenu->addSeparator(); - dumpNextAct = new MenuAction(this, debugMenu, SLOT(dumpNextAct_triggered()), QT_TR_NOOP("Dump next frame to log"), false); + debugMenu->add(new MenuAction(this, SLOT(dumpNextAct()), QT_TR_NOOP("Dump next frame to log"))) + ->addDisableState(UISTATE_MENU); debugMenu->addSeparator(); - disasmAct = new MenuAction(this, debugMenu, SLOT(disasmAct_triggered()), QT_TR_NOOP("Disassembly"), false, Qt::CTRL + Qt::Key_D); - dpyListAct = new MenuAction(this, debugMenu, SLOT(dpyListAct_triggered()), QT_TR_NOOP("Display List..."), false); - consoleAct = new MenuAction(this, debugMenu, SLOT(consoleAct_triggered()), QT_TR_NOOP("Log Console"), false); - memviewAct = new MenuAction(this, debugMenu, SLOT(memviewAct_triggered()), QT_TR_NOOP("Memory View"), false); - memviewTexAct = new MenuAction(this, debugMenu, SLOT(memviewTexAct_triggered()), QT_TR_NOOP("Memory View Texture"), false); + debugMenu->add(new MenuAction(this, SLOT(disasmAct()), QT_TR_NOOP("Disassembly"), Qt::CTRL + Qt::Key_D)) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(dpyListAct()), QT_TR_NOOP("Display List..."))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("Log Console"))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(memviewAct()), QT_TR_NOOP("Memory View"))) + ->addDisableState(UISTATE_MENU); + debugMenu->add(new MenuAction(this, SLOT(memviewTexAct()),QT_TR_NOOP("Memory View Texture"))) + ->addDisableState(UISTATE_MENU); // Options - optionsMenu = menuBar()->addMenu(""); + MenuTree* optionsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Options")); // - Core - coreMenu = optionsMenu->addMenu(""); - dynarecAct = new MenuAction(this, coreMenu, SLOT(dynarecAct_triggered()), QT_TR_NOOP("&CPU Dynarec"), true); - vertexDynarecAct = new MenuAction(this, coreMenu, SLOT(vertexDynarecAct_triggered()), QT_TR_NOOP("&Vertex Decoder Dynarec"), true); - fastmemAct = new MenuAction(this, coreMenu, SLOT(fastmemAct_triggered()), QT_TR_NOOP("Fast &Memory (unstable)"), true); - ignoreIllegalAct = new MenuAction(this, coreMenu, SLOT(ignoreIllegalAct_triggered()), QT_TR_NOOP("&Ignore Illegal reads/writes"), true); + MenuTree* coreMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Core")); + coreMenu->add(new MenuAction(this, SLOT(dynarecAct()), QT_TR_NOOP("&CPU Dynarec"))) + ->addEventChecked(&g_Config.bJit); + coreMenu->add(new MenuAction(this, SLOT(vertexDynarecAct()), QT_TR_NOOP("&Vertex Decoder Dynarec"))) + ->addEventChecked(&g_Config.bVertexDecoderJit); + coreMenu->add(new MenuAction(this, SLOT(fastmemAct()), QT_TR_NOOP("Fast &Memory (unstable)"))) + ->addEventChecked(&g_Config.bFastMemory); + coreMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore Illegal reads/writes"))) + ->addEventChecked(&g_Config.bIgnoreBadMemAccess); // - Video - videoMenu = optionsMenu->addMenu(""); + MenuTree* videoMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Video")); // - Anisotropic Filtering - anisotropicMenu = videoMenu->addMenu(""); - NEW_GROUP(anisotropicMenu, anisotropicGroup, QStringList() << "Off" << "2x" << "4x" << "8x" << "16x", - QList() << 0 << 1 << 2 << 3 << 4); - bufferRenderAct = new MenuAction(this, videoMenu, SLOT(bufferRenderAct_triggered()), QT_TR_NOOP("&Buffered Rendering"), false, Qt::Key_F5); - linearAct = new MenuAction(this, videoMenu, SLOT(linearAct_triggered()), QT_TR_NOOP("&Linear Filtering"), true); + MenuTree* anisotropicMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Anisotropic Filtering")); + anisotropicGroup = new MenuActionGroup(this, anisotropicMenu, SLOT(anisotropicGroup_triggered(QAction *)), + QStringList() << "Off" << "2x" << "4x" << "8x" << "16x", + QList() << 0 << 1 << 2 << 3 << 4); + // TODO: Check for newer buffer render options + videoMenu->add(new MenuAction(this, SLOT(bufferRenderAct()), QT_TR_NOOP("&Buffered Rendering"), Qt::Key_F5)) + ->addEventChecked(&g_Config.iRenderingMode); + videoMenu->add(new MenuAction(this, SLOT(linearAct()), QT_TR_NOOP("&Linear Filtering"))) + ->addEventChecked(&g_Config.iTexFiltering); videoMenu->addSeparator(); // - Screen Size - screenMenu = videoMenu->addMenu(""); - NEW_GROUP_KEYS(screenMenu, screenGroup, QStringList() << "1x" << "2x" << "3x" << "4x", QList() << 1 << 2 << 3 << 4, + MenuTree* screenMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Screen Size")); + screenGroup = new MenuActionGroup(this, screenMenu, SLOT(screenGroup_triggered(QAction *)), + QStringList() << "1x" << "2x" << "3x" << "4x", + QList() << 1 << 2 << 3 << 4, QList() << Qt::CTRL + Qt::Key_1 << Qt::CTRL + Qt::Key_2 << Qt::CTRL + Qt::Key_3 << Qt::CTRL + Qt::Key_4); - stretchAct = new MenuAction(this, videoMenu, SLOT(stretchAct_triggered()), QT_TR_NOOP("&Stretch to Display"), true); + + videoMenu->add(new MenuAction(this, SLOT(stretchAct()), QT_TR_NOOP("&Stretch to Display"))) + ->addEventChecked(&g_Config.bStretchToDisplay); videoMenu->addSeparator(); - transformAct = new MenuAction(this, videoMenu, SLOT(transformAct_triggered()), QT_TR_NOOP("&Hardware Transform"), true, Qt::Key_F6); - vertexCacheAct = new MenuAction(this, videoMenu, SLOT(vertexCacheAct_triggered()), QT_TR_NOOP("&Vertex Cache"), true); - frameskipAct = new MenuAction(this, videoMenu, SLOT(frameskipAct_triggered()), QT_TR_NOOP("&Frameskip"), true); - audioAct = new MenuAction(this, videoMenu, SLOT(audioAct_triggered()), QT_TR_NOOP("&Audio"), true); + videoMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware Transform"), Qt::Key_F6)) + ->addEventChecked(&g_Config.bHardwareTransform); + videoMenu->add(new MenuAction(this, SLOT(vertexCacheAct()), QT_TR_NOOP("&Vertex Cache"))) + ->addEventChecked(&g_Config.bVertexCache); + videoMenu->add(new MenuAction(this, SLOT(frameskipAct()), QT_TR_NOOP("&Frameskip"))) + ->addEventChecked(&g_Config.iFrameSkip); + optionsMenu->add(new MenuAction(this, SLOT(audioAct()), QT_TR_NOOP("&Audio"))) + ->addEventChecked(&g_Config.bEnableSound); optionsMenu->addSeparator(); - fullscreenAct = new MenuAction(this, optionsMenu, SLOT(fullscreenAct_triggered()), QT_TR_NOOP("&Fullscreen"), true, Qt::Key_F11); - statsAct = new MenuAction(this, optionsMenu, SLOT(statsAct_triggered()), QT_TR_NOOP("&Show debug statistics"), true); - showFPSAct = new MenuAction(this, optionsMenu, SLOT(showFPSAct_triggered()), QT_TR_NOOP("&Show FPS"), true); + optionsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), Qt::Key_F11)) + ->addEventChecked(&g_Config.bFullScreen); + optionsMenu->add(new MenuAction(this, SLOT(statsAct()), QT_TR_NOOP("&Show debug statistics"))) + ->addEventChecked(&g_Config.bShowDebugStats); + optionsMenu->add(new MenuAction(this, SLOT(showFPSAct()), QT_TR_NOOP("&Show FPS"))) + ->addEventChecked(&g_Config.iShowFPSCounter); optionsMenu->addSeparator(); // - Log Levels - levelsMenu = optionsMenu->addMenu(""); + MenuTree* levelsMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("Lo&g levels")); QMenu* defaultLogMenu = levelsMenu->addMenu("Default"); - NEW_GROUP(defaultLogMenu, defaultLogGroup, QStringList() << "Debug" << "Warning" << "Info" << "Error", - QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); + defaultLogGroup = new MenuActionGroup(this, defaultLogMenu, SLOT(defaultLogGroup_triggered(QAction *)), + QStringList() << "Debug" << "Warning" << "Info" << "Error", + QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); QMenu* g3dLogMenu = levelsMenu->addMenu("G3D"); - NEW_GROUP(g3dLogMenu, g3dLogGroup, QStringList() << "Debug" << "Warning" << "Info" << "Error", - QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); + g3dLogGroup = new MenuActionGroup(this, g3dLogMenu, SLOT(g3dLogGroup_triggered(QAction *)), + QStringList() << "Debug" << "Warning" << "Info" << "Error", + QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); QMenu* hleLogMenu = levelsMenu->addMenu("HLE"); - NEW_GROUP(hleLogMenu, hleLogGroup, QStringList() << "Debug" << "Warning" << "Info" << "Error", - QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); + hleLogGroup = new MenuActionGroup(this, hleLogMenu, SLOT(hleLogGroup_triggered(QAction *)), + QStringList() << "Debug" << "Warning" << "Info" << "Error", + QList() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR); optionsMenu->addSeparator(); // - Language - langMenu = optionsMenu->addMenu(""); - langGroup = new QActionGroup(this); + MenuTree* langMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Language")); + QActionGroup* langGroup = new QActionGroup(this); QStringList fileNames = QDir(":/languages").entryList(QStringList("ppsspp_*.qm")); if (fileNames.size() == 0) @@ -650,7 +605,6 @@ void MainWindow::createMenus() std::string testLang = g_Config.sLanguageIni; if (currentLocale == locale || currentLang == locale) { action->setChecked(true); - currentLanguage = locale; loadLanguage(locale, false); found = true; } @@ -663,11 +617,11 @@ void MainWindow::createMenus() langMenu->addActions(langGroup->actions()); // Help - helpMenu = menuBar()->addMenu(""); - websiteAct = new MenuAction(this, helpMenu, SLOT(websiteAct_triggered()), QT_TR_NOOP("&Go to official website"), false); - aboutAct = new MenuAction(this, helpMenu, SLOT(aboutAct_triggered()), QT_TR_NOOP("&About PPSSPP..."), false); + MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help")); + helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("&Go to official website"))); + helpMenu->add(new MenuAction(this, SLOT(aboutAct()), QT_TR_NOOP("&About PPSSPP..."))); - retranslateUi(); + retranslate(); } void MainWindow::notifyMapsLoaded() diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 43f47f9e17..7c105f8b76 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -16,6 +16,8 @@ #include "debugger_displaylist.h" class QtEmuGL; +class MenuAction; +class MenuTree; class MainWindow : public QMainWindow { @@ -42,63 +44,64 @@ protected: signals: void retranslate(); + void updateMenu(); public slots: void Boot(); private slots: // File - void openAct_triggered(); - void closeAct_triggered(); - void qlstateAct_triggered(); - void qsstateAct_triggered(); - void lstateAct_triggered(); - void sstateAct_triggered(); - void exitAct_triggered(); + void openAct(); + void closeAct(); + void qlstateAct(); + void qsstateAct(); + void lstateAct(); + void sstateAct(); + void exitAct(); // Emulation - void runAct_triggered(); - void pauseAct_triggered(); - void resetAct_triggered(); - void runonloadAct_triggered(); + void runAct(); + void pauseAct(); + void resetAct(); + void runonloadAct(); // Debug - void lmapAct_triggered(); - void smapAct_triggered(); - void resetTableAct_triggered(); - void dumpNextAct_triggered(); - void disasmAct_triggered(); - void dpyListAct_triggered(); - void consoleAct_triggered(); - void memviewAct_triggered(); - void memviewTexAct_triggered(); + void lmapAct(); + void smapAct(); + void resetTableAct(); + void dumpNextAct(); + void disasmAct(); + void dpyListAct(); + void consoleAct(); + void memviewAct(); + void memviewTexAct(); // Options // Core - void dynarecAct_triggered() { g_Config.bJit = !g_Config.bJit; } - void vertexDynarecAct_triggered() { g_Config.bVertexDecoderJit = !g_Config.bVertexDecoderJit; } - void fastmemAct_triggered() { g_Config.bFastMemory = !g_Config.bFastMemory; } - void ignoreIllegalAct_triggered() { g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; } + void dynarecAct() { g_Config.bJit = !g_Config.bJit; } + void vertexDynarecAct() { g_Config.bVertexDecoderJit = !g_Config.bVertexDecoderJit; } + void fastmemAct() { g_Config.bFastMemory = !g_Config.bFastMemory; } + void ignoreIllegalAct() { g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; } // Video void anisotropicGroup_triggered(QAction *action) { g_Config.iAnisotropyLevel = action->data().toInt(); } - void bufferRenderAct_triggered() { g_Config.iRenderingMode = !g_Config.iRenderingMode; } - void linearAct_triggered() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; } + void bufferRenderAct() { g_Config.iRenderingMode = !g_Config.iRenderingMode; } + void linearAct() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; } void screenGroup_triggered(QAction *action) { SetZoom(action->data().toInt()); } - void stretchAct_triggered(); - void transformAct_triggered() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; } - void vertexCacheAct_triggered() { g_Config.bVertexCache = !g_Config.bVertexCache; } - void frameskipAct_triggered() { g_Config.iFrameSkip = !g_Config.iFrameSkip; } + void stretchAct(); + void transformAct() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; } + void vertexCacheAct() { g_Config.bVertexCache = !g_Config.bVertexCache; } + void frameskipAct() { g_Config.iFrameSkip = !g_Config.iFrameSkip; } // Sound - void audioAct_triggered() { g_Config.bEnableSound = !g_Config.bEnableSound; } + void audioAct() { g_Config.bEnableSound = !g_Config.bEnableSound; } - void fullscreenAct_triggered(); - void statsAct_triggered() { g_Config.bShowDebugStats = !g_Config.bShowDebugStats; } - void showFPSAct_triggered() { g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; } + void fullscrAct(); + void statsAct() { g_Config.bShowDebugStats = !g_Config.bShowDebugStats; } + void showFPSAct() { g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; } // Logs void defaultLogGroup_triggered(QAction * action) { @@ -115,12 +118,11 @@ private slots: void hleLogGroup_triggered(QAction * action) { LogManager::GetInstance()->SetLogLevel(LogTypes::HLE, (LogTypes::LOG_LEVELS)action->data().toInt()); } // Help - void websiteAct_triggered(); - void aboutAct_triggered(); + void websiteAct(); + void aboutAct(); // Others void langChanged(QAction *action) { loadLanguage(action->data().toString(), true); } - void retranslateUi(); private: void SetZoom(int zoom); @@ -142,33 +144,8 @@ private: Debugger_MemoryTex *memoryTexWindow; Debugger_DisplayList *displaylistWindow; - // Menus - // File - QMenu *fileMenu; - QAction *openAct, *closeAct, *qlstateAct, *qsstateAct, - *lstateAct, *sstateAct, *exitAct; - // Emulation - QMenu *emuMenu; - QAction *runAct, *pauseAct, *resetAct, *runonloadAct; - // Debug - QMenu *debugMenu; - QAction *lmapAct, *smapAct, *resetTableAct, *dumpNextAct, - *disasmAct, *dpyListAct, *consoleAct, *memviewAct, - *memviewTexAct; - // Options - QMenu *optionsMenu, *coreMenu, *videoMenu, *anisotropicMenu, - *screenMenu, *levelsMenu, *langMenu; - QAction *dynarecAct, *vertexDynarecAct, *fastmemAct, - *ignoreIllegalAct, *bufferRenderAct, - *linearAct, *stretchAct, *transformAct, *vertexCacheAct, - *frameskipAct, *audioAct, *fullscreenAct, *statsAct, - *showFPSAct; - QActionGroup *anisotropicGroup, *screenGroup, *langGroup, + QActionGroup *anisotropicGroup, *screenGroup, *defaultLogGroup, *g3dLogGroup, *hleLogGroup; - // Help - QMenu *helpMenu; - QAction *websiteAct, *aboutAct; - }; class MenuAction : public QAction @@ -176,34 +153,116 @@ class MenuAction : public QAction Q_OBJECT public: - MenuAction(QWidget* parent, QMenu* menu, const char* callback, char* text, bool isCheckable = false, QKeySequence key = 0) : - QAction(parent), _text(text) + // Add to QMenu + MenuAction(QWidget* parent, const char* callback, char* text, QKeySequence key = 0) : + QAction(parent), _text(text), _eventCheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false) { - this->setCheckable(isCheckable); - menu->addAction(this); - if (key != 0) { + if (key != (QKeySequence)0) { this->setShortcut(key); parent->addAction(this); // So we don't lose the shortcut when menubar is hidden } connect(this, SIGNAL(triggered()), parent, callback); connect(parent, SIGNAL(retranslate()), this, SLOT(retranslate())); + connect(parent, SIGNAL(updateMenu()), this, SLOT(update())); } + // Add to QActionGroup MenuAction(QWidget* parent, QActionGroup* group, QVariant data, QString text, QKeySequence key = 0) : - QAction(parent) + QAction(parent), _eventCheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false) { this->setCheckable(true); this->setData(data); this->setText(text); // Not translatable, yet - if (key != 0) { + if (key != (QKeySequence)0) { this->setShortcut(key); parent->addAction(this); // So we don't lose the shortcut when menubar is hidden } group->addAction(this); } + // Event which causes it to be checked + void addEventChecked(bool* event) { + this->setCheckable(true); + _eventCheck = event; + } + // TODO: Possibly handle compares + void addEventChecked(int* event) { + this->setCheckable(true); + _eventCheck = (bool*)event; + } + // UI State which causes it to be enabled + void addEnableState(int state) { + _stateEnable = state; + } + void addDisableState(int state) { + _stateDisable = state; + } + MenuAction* addEnableStepping() { + _enableStepping = true; + return this; + } public slots: void retranslate() { setText(qApp->translate("MainWindow", _text)); } + void update() { + if (_eventCheck) + setChecked(*_eventCheck); + if (_stateEnable >= 0) + setEnabled(globalUIState == _stateEnable); + if (_stateDisable >= 0) + setEnabled(globalUIState != _stateDisable); + if (_enableStepping && Core_IsStepping()) + setEnabled(true); + } +private: + char* _text; + bool* _eventCheck; + int _stateEnable, _stateDisable; + bool _enableStepping; +}; + +class MenuActionGroup : public QActionGroup +{ + Q_OBJECT +public: + MenuActionGroup(QWidget* parent, QMenu* menu, const char* callback, QStringList nameList, + QList valueList, QList keyList = QList()) : + QActionGroup(parent) + { + QListIterator i(valueList); + QListIterator k(keyList); + foreach(QString name, nameList) { + new MenuAction(parent, this, i.next(), name, k.next()); + } + connect(this, SIGNAL(triggered(QAction *)), parent, callback); + menu->addActions(this->actions()); + } +}; + +class MenuTree : public QMenu +{ + Q_OBJECT +public: + MenuTree(QWidget* parent, QMenuBar* menu, char* text) : + QMenu(parent), _text(text) + { + menu->addMenu(this); + connect(parent, SIGNAL(retranslate()), this, SLOT(retranslate())); + } + MenuTree(QWidget* parent, QMenu* menu, char* text) : + QMenu(parent), _text(text) + { + menu->addMenu(this); + connect(parent, SIGNAL(retranslate()), this, SLOT(retranslate())); + } + MenuAction* add(MenuAction* action) + { + addAction(action); + return action; + } +public slots: + void retranslate() { + setTitle(qApp->translate("MainWindow", _text)); + } private: char* _text; };