void muFrame::OnUpdateDownload(UpdaterEvent& event) { wxString changelog = event.GetString(); wxLogVerbose(wxT("Displaying changelog: %s"), changelog.c_str()); wxLaunchDefaultBrowser(changelog); RequestUserAttention(); }
void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event)) { wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window")); wxSleep(3); RequestUserAttention(wxUSER_ATTENTION_ERROR); }
// }}} // {{{ void MainFrame::OnConnection(DBGp::ConnectionEvent &event) void MainFrame::OnConnection(DBGp::ConnectionEvent &event) { wxString expectedKey(config->Read(wxT("Network/IDEKey"), wxEmptyString)); if (expectedKey.Len() == 0 || expectedKey == event.GetIDEKey()) { wxFileName name(wxURI::Unescape(wxURI(event.GetFileURI()).GetPath())); notebook->AddPage(new ConnectionPage(notebook, event.GetConnection(), event.GetFileURI(), event.GetLanguage()), name.GetFullName(), true); if (!IsActive()) { RequestUserAttention(wxUSER_ATTENTION_INFO); } } else { // TODO: Ponder how we want to notify the user of this. Indeed, // ponder if we want to notify the user of this. wxLogDebug(wxT("Connection refused due to IDE key mismatch: expected %s; got %s."), expectedKey.c_str(), event.GetIDEKey().c_str()); event.GetConnection()->Close(); } }
void MainFrame::OnEscalationsShow(wxCommandEvent& event) { Show(event.GetInt()); if (event.GetInt()) { Raise(); RequestUserAttention(wxUSER_ATTENTION_ERROR); } Module *module = MainUtils::instance()->getModule(ANOUBIS); int id = module->getToolbarId(); /* * Select the corresponding Modul Tab in the Toolbar */ tb_LeftToolbarModule->ToggleTool(MODANOUBIS_ID_TOOLBAR, true); wxCommandEvent selectEvent(wxEVT_COMMAND_MENU_SELECTED, id); selectEvent.SetInt(id); this->AddPendingEvent(selectEvent); event.Skip(); }
// update gui void NetPlayDialog::OnThread(wxThreadEvent& event) { if (m_is_hosting && m_host_label && g_TraversalClient) { UpdateHostLabel(); } // player list m_playerids.clear(); std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); wxString selection; if (m_player_lbox->GetSelection() != wxNOT_FOUND) selection = m_player_lbox->GetString(m_player_lbox->GetSelection()); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); // remove ping from selection string, in case it has changed selection.erase(selection.rfind('|') + 1); if (!selection.empty()) { for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) { if (selection == m_player_lbox->GetString(i).substr(0, selection.length())) { m_player_lbox->SetSelection(i); break; } } } // flash window in taskbar when someone joins if window isn't active static u8 numPlayers = 1; if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus()) { RequestUserAttention(); } numPlayers = m_playerids.size(); switch (event.GetId()) { case NP_GUI_EVT_CHANGE_GAME: // update selected game :/ { m_selected_game = WxStrToStr(event.GetString()); wxString button_label = event.GetString(); m_game_btn->SetLabel(button_label.Prepend(_(" Game : "))); } break; case NP_GUI_EVT_START_GAME: // client start game :/ { netplay_client->StartGame(FindGame()); } break; case NP_GUI_EVT_STOP_GAME: // client stop game { netplay_client->StopGame(); } break; } // chat messages while (chat_msgs.Size()) { std::string s; chat_msgs.Pop(s); // PanicAlert("message: %s", s.c_str()); m_chat_text->AppendText(StrToWxStr(s).Append('\n')); } }
// update gui void NetPlayDialog::OnThread(wxThreadEvent& event) { if (m_is_hosting && m_host_label && g_TraversalClient) { UpdateHostLabel(); } // player list m_playerids.clear(); std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); wxString selection; if (m_player_lbox->GetSelection() != wxNOT_FOUND) selection = m_player_lbox->GetString(m_player_lbox->GetSelection()); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); // remove ping from selection string, in case it has changed selection.erase(selection.rfind('|') + 1); if (!selection.empty()) { for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) { if (selection == m_player_lbox->GetString(i).substr(0, selection.length())) { m_player_lbox->SetSelection(i); break; } } } // flash window in taskbar when someone joins if window isn't active static u8 numPlayers = 1; if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus()) { RequestUserAttention(); } numPlayers = m_playerids.size(); switch (event.GetId()) { case NP_GUI_EVT_CHANGE_GAME: // update selected game :/ { m_selected_game = WxStrToStr(event.GetString()); wxString button_label = event.GetString(); m_game_btn->SetLabel(button_label.Prepend(_(" Game : "))); } break; case NP_GUI_EVT_START_GAME: // client start game :/ { netplay_client->StartGame(FindCurrentGame()); std::string msg = "Starting game"; AddChatMessage(ChatMessageType::Info, msg); } break; case NP_GUI_EVT_STOP_GAME: // client stop game { std::string msg = "Stopping game"; AddChatMessage(ChatMessageType::Info, msg); } break; case NP_GUI_EVT_DISPLAY_MD5_DIALOG: { m_MD5_dialog = new MD5Dialog(this, netplay_server, netplay_client->GetPlayers(), event.GetString().ToStdString()); m_MD5_dialog->Show(); } break; case NP_GUI_EVT_MD5_PROGRESS: { if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted()) break; std::pair<int, int> payload = event.GetPayload<std::pair<int, int>>(); m_MD5_dialog->SetProgress(payload.first, payload.second); } break; case NP_GUI_EVT_MD5_RESULT: { if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted()) break; std::pair<int, std::string> payload = event.GetPayload<std::pair<int, std::string>>(); m_MD5_dialog->SetResult(payload.first, payload.second); } break; case NP_GUI_EVT_PAD_BUFFER_CHANGE: { std::string msg = StringFromFormat("Buffer size: %d", m_pad_buffer); if (g_ActiveConfig.bShowNetPlayMessages) { OSD::AddTypedMessage(OSD::MessageType::NetPlayBuffer, msg, OSD::Duration::NORMAL); } AddChatMessage(ChatMessageType::Info, msg); } break; case NP_GUI_EVT_DESYNC: { std::string msg = "Possible desync detected from player " + m_desync_player + " on frame " + std::to_string(m_desync_frame); AddChatMessage(ChatMessageType::Error, msg); if (g_ActiveConfig.bShowNetPlayMessages) { OSD::AddMessage(msg, OSD::Duration::VERY_LONG, OSD::Color::RED); } } break; case NP_GUI_EVT_CONNECTION_LOST: { std::string msg = "Lost connection to server"; AddChatMessage(ChatMessageType::Error, msg); } break; case NP_GUI_EVT_TRAVERSAL_CONNECTION_ERROR: { std::string msg = "Traversal server connection error"; AddChatMessage(ChatMessageType::Error, msg); } } // chat messages while (m_chat_msgs.Size()) { std::string s; m_chat_msgs.Pop(s); AddChatMessage(ChatMessageType::UserIn, s); if (g_ActiveConfig.bShowNetPlayMessages) { OSD::AddMessage(s, OSD::Duration::NORMAL, OSD::Color::GREEN); } } }
void wxSettlersFrame::OnRequestUserAttention(wxInt32) { RequestUserAttention(); }