Fix NewUI bug involving the debug console on Win32. Also change the behaviour of WM_USER_LOG_STATUS_CHANGED to open and close the log window when enabled/disabled as appropriate.

This commit is contained in:
The Dax 2013-08-04 03:39:49 -04:00
parent 0b502f107f
commit f94ae2f10c
3 changed files with 17 additions and 3 deletions

View file

@ -33,6 +33,13 @@
#include "base/timeutil.h"
#include "math/curves.h"
#ifdef _WIN32
namespace MainWindow {
enum { WM_USER_LOG_STATUS_CHANGED = WM_USER + 200 };
extern HWND hwndMain;
}
#endif
namespace UI {
@ -319,6 +326,7 @@ void GlobalSettingsScreen::CreateViews() {
root_ = new ScrollView(ORIENT_VERTICAL);
enableReports_ = g_Config.sReportHost != "";
enableLogging_ = g_Config.bEnableLogging;
I18NCategory *g = GetI18NCategory("General");
I18NCategory *gs = GetI18NCategory("Graphics");
@ -326,7 +334,7 @@ void GlobalSettingsScreen::CreateViews() {
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->Add(new ItemHeader("General"));
list->Add(new CheckBox(&g_Config.bNewUI, gs->T("Enable New UI")));
list->Add(new CheckBox(&g_Config.bEnableLogging, gs->T("Enable Debug Logging")));
list->Add(new CheckBox(&enableLogging_, gs->T("Enable Debug Logging")));
list->Add(new CheckBox(&enableReports_, gs->T("Enable Errors Reporting")));
list->Add(new CheckBox(&g_Config.bEnableCheats, gs->T("Enable Cheats")));
list->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, gs->T("Screenshots as PNG")));
@ -358,6 +366,10 @@ UI::EventReturn GameSettingsScreen::OnControlMapping(UI::EventParams &e) {
UI::EventReturn GlobalSettingsScreen::OnBack(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_OK);
g_Config.sReportHost = enableReports_ ? "report.ppsspp.org" : "";
g_Config.bEnableLogging = enableLogging_;
#ifdef _WIN32
PostMessage(MainWindow::hwndMain, MainWindow::WM_USER_LOG_STATUS_CHANGED, 0, 0);
#endif
g_Config.Save();
return UI::EVENT_DONE;
}

View file

@ -64,6 +64,7 @@ private:
// Temporaries to convert bools to other kinds of settings
bool enableReports_;
bool enableLogging_;
};
class DeveloperToolsScreen : public UIScreenWithBackground {

View file

@ -1146,9 +1146,10 @@ namespace MainWindow
if(!g_Config.bEnableLogging) {
LogManager::GetInstance()->GetConsoleListener()->Show(false);
EnableMenuItem(menu, ID_DEBUG_LOG, MF_GRAYED);
}
else
} else {
LogManager::GetInstance()->GetConsoleListener()->Show(true);
EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED);
}
break;
case WM_MENUSELECT: