DolphinWX: show simple message about scanning in statusbar.

This commit is contained in:
Shawn Hoffman 2017-06-22 00:53:02 -07:00
parent c5fa470ad8
commit a66b747366
6 changed files with 22 additions and 13 deletions

View File

@ -337,7 +337,8 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
wxFrame::CreateToolBar(wxTB_DEFAULT_STYLE | wxTB_TEXT | wxTB_FLAT)->Realize(); wxFrame::CreateToolBar(wxTB_DEFAULT_STYLE | wxTB_TEXT | wxTB_FLAT)->Realize();
// Give it a status bar // Give it a status bar
SetStatusBar(CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR)); SetStatusBar(
CreateStatusBar(2, wxSTB_SIZEGRIP | wxSTB_ELLIPSIZE_END | wxSTB_SHOW_TIPS, ID_STATUSBAR));
if (!SConfig::GetInstance().m_InterfaceStatusbar) if (!SConfig::GetInstance().m_InterfaceStatusbar)
GetStatusBar()->Hide(); GetStatusBar()->Hide();

View File

@ -102,7 +102,7 @@ public:
void GameListRescan(); void GameListRescan();
void ToggleLogWindow(bool bShow); void ToggleLogWindow(bool bShow);
void ToggleLogConfigWindow(bool bShow); void ToggleLogConfigWindow(bool bShow);
void StatusBarMessage(const char* Text, ...); void StatusBarMessage(const char* format, ...);
void ClearStatusBar(); void ClearStatusBar();
void BootGame(const std::string& filename); void BootGame(const std::string& filename);
bool RendererHasFocus(); bool RendererHasFocus();

View File

@ -511,8 +511,7 @@ void CFrame::OnPerspectiveMenu(wxCommandEvent& event)
return; return;
} }
SaveIniPerspectives(); SaveIniPerspectives();
GetStatusBar()->SetStatusText( StatusBarMessage("Saved %s", m_perspectives[m_active_perspective].name.c_str());
StrToWxStr(std::string("Saved " + m_perspectives[m_active_perspective].name)), 0);
break; break;
case IDM_PERSPECTIVES_ADD_PANE_TOP: case IDM_PERSPECTIVES_ADD_PANE_TOP:
AddPane(ADD_PANE_TOP); AddPane(ADD_PANE_TOP);

View File

@ -1133,18 +1133,16 @@ void CFrame::ClearStatusBar()
} }
} }
void CFrame::StatusBarMessage(const char* Text, ...) void CFrame::StatusBarMessage(const char* format, ...)
{ {
const int MAX_BYTES = 1024 * 10; va_list args;
char Str[MAX_BYTES]; va_start(args, format);
va_list ArgPtr; std::string msg = StringFromFormatV(format, args);
va_start(ArgPtr, Text); va_end(args);
vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
va_end(ArgPtr);
if (this->GetStatusBar()->IsEnabled()) if (this->GetStatusBar()->IsEnabled())
{ {
this->GetStatusBar()->SetStatusText(StrToWxStr(Str), 0); this->GetStatusBar()->SetStatusText(StrToWxStr(msg), 0);
} }
} }

View File

@ -740,6 +740,15 @@ bool GameListCtrl::SyncCacheFile(bool write)
void GameListCtrl::RescanList() void GameListCtrl::RescanList()
{ {
auto post_status = [&](const wxString& status) {
auto event = new wxCommandEvent(wxEVT_HOST_COMMAND, IDM_UPDATE_STATUS_BAR);
event->SetInt(0);
event->SetString(status);
QueueEvent(event);
};
post_status(_("Scanning..."));
const std::vector<std::string> search_extensions = {".gcm", ".tgc", ".iso", ".ciso", ".gcz", const std::vector<std::string> search_extensions = {".gcm", ".tgc", ".iso", ".ciso", ".gcz",
".wbfs", ".wad", ".dol", ".elf"}; ".wbfs", ".wad", ".dol", ".elf"};
// TODO This could process paths iteratively as they are found // TODO This could process paths iteratively as they are found
@ -783,6 +792,8 @@ void GameListCtrl::RescanList()
// Post UI event to update the displayed list // Post UI event to update the displayed list
QueueEvent(new wxCommandEvent(DOLPHIN_EVT_REFRESH_GAMELIST)); QueueEvent(new wxCommandEvent(DOLPHIN_EVT_REFRESH_GAMELIST));
post_status(_("Scan complete!"));
SyncCacheFile(true); SyncCacheFile(true);
} }

View File

@ -478,7 +478,7 @@ void Host_SetWiiMoteConnectionState(int _State)
event.SetString(_("Wii Remote Connected")); event.SetString(_("Wii Remote Connected"));
break; break;
} }
// Update field 1 or 2 // The second field is used for auxiliary info such as this
event.SetInt(1); event.SetInt(1);
NOTICE_LOG(WIIMOTE, "%s", static_cast<const char*>(event.GetString().c_str())); NOTICE_LOG(WIIMOTE, "%s", static_cast<const char*>(event.GetString().c_str()));