slAboutBox::slAboutBox() { info = new wxAboutDialogInfo(); info->SetName( TowxString(getSpringlobbyName()) ); info->SetVersion (TowxString(getSpringlobbyVersion())); info->SetDescription( TowxString(getSpringlobbyName()) + _("is a cross-plattform lobby client for the Spring RTS engine")); //info.SetCopyright(wxEmptyString; info->SetLicence(_T("GPL v2 or later")); info->AddDeveloper(_T("abma")); info->AddDeveloper(_T("BrainDamage")); info->AddDeveloper(_T("dizekat")); info->AddDeveloper(_T("insaneinside")); info->AddDeveloper(_T("Kaot")); info->AddDeveloper(_T("koshi")); info->AddDeveloper(_T("semi_")); info->AddDeveloper(_T("tc-")); info->AddTranslator(_T("chaosch (simplified chinese)")); info->AddTranslator(_T("lejocelyn (french)")); info->AddTranslator(_T("Suprano (german)")); info->AddTranslator(_T("tc- (swedish)")); info->AddTranslator(_("The numerous contributors from launchpad.net")); }
SpringDebugReport::SpringDebugReport() : NetDebugReport( "http://infologs.springrts.com/upload" ) { wxString tmp_filename = wxPathOnly( wxFileName::CreateTempFileName(_T("dummy")) ) + wxFileName::GetPathSeparator() + _T("settings.txt"); wxCopyFile(TowxString(SlPaths::GetSpringConfigFilePath()), tmp_filename ); AddFile( tmp_filename, _T("Settings") ); AddVFSFile( _T("infolog.txt"), _T("Infolog") ); AddVFSFile( _T("script.txt"), _T("Script") ); AddVFSFile( _T("ext.txt"), _T("Extensions") ); AddVFSFile( _T("unitsync.log"), _T("unitsync") ); wxString info; info << wxGetOsDescription() << ( wxIsPlatform64Bit() ? _T(" 64bit\n") : _T(" 32bit\n") ); AddText( _T("platform.txt"), info, _T("Platform") ); AddText( _T("client.txt"), _T( "SpringLobby " ) + TowxString(GetSpringLobbyVersion()), _T("Client") ); AddText( _T("appname.txt"), TowxString(getSpringlobbyName()), _T("Application Name")); }
void settings_frame::switchToExpertMode() { sett().setMode(SET_MODE_EXPERT); menuMode->Check(ID_MENUITEM_EXPERT, true); qualityTab = new tab_quality_video(notebook, ID_QUALITY_VIDEO); detailTab = new tab_render_detail(notebook, ID_RENDER_DETAIL); audioTab = new audio_panel(notebook, ID_AUDIO); // hotkeyTab = new hotkey_panel(notebook,ID_HOTKEY); notebook->AddPage(qualityTab, qualityTabCap); notebook->AddPage(detailTab, detailTabCap); notebook->AddPage(audioTab, audioTabCap); // notebook->AddPage(hotkeyTab,hotkeyTabCap); notebook->DeletePage(0); simpleTab = 0; SetTitle(TowxString(getSpringlobbyName()) + _("(expert mode)")); /*uiTab->updateControls(UPDATE_ALL); detailTab->updateControls(UPDATE_ALL); qualityTab->updateControls(UPDATE_ALL); audioTab->updateControls(UPDATE_ALL); hotkeyTab->UpdateControls(UPDATE_ALL);*/ }
const std::string getSpringlobbyAgent() { std::string agent = getSpringlobbyName() + " "; agent += getSpringlobbyVersion(); agent += " ("; #if WIN32 agent += "win"; #elif __APPLE__ agent += "osx"; #else agent += "unix"; #endif agent += " "; #if __WORDSIZE == 64 agent += "x64"; #else agent += "x32"; #endif agent += ")"; return agent; }
MainWindow::MainWindow() : wxFrame(NULL, -1, TowxString(getSpringlobbyName())) , WindowAttributesPickle(_T("MAINWINDOW"), this, wxSize(720, 576)) , m_opts_dialog(NULL) , m_autojoin_dialog(NULL) , se_frame(NULL) , m_channel_chooser(NULL) , m_log_win(NULL) , m_has_focus(true) { SetMinSize(wxSize(720, 576)); m_tab_names.Add(_("Chat")); m_tab_names.Add(_("Battlelist")); m_tab_names.Add(_("Battleroom")); m_tab_names.Add(_("Singleplayer")); // m_tab_names.Add( _("Savegames") ); m_tab_names.Add(_("Replays")); m_tab_names.Add(_("Downloads")); SetIcon(icons().GetIcon(icons().ICON_SPRINGLOBBY)); GetAui().manager = new wxAuiManager(this); wxMenu* menuServer = new wxMenu; menuServer->Append(MENU_CONNECT, _("&Connect...")); menuServer->Append(MENU_DISCONNECT, _("&Disconnect")); menuServer->Append(MENU_SERVER_TAB, _("&Reopen server panel")); menuServer->AppendSeparator(); #ifndef NDEBUG //this is a prime spot to add experimental stuff, or stubs used to test things not really meant to be in mainwindow menuServer->Append(MENU_SAVE_OPTIONS, _("&Save options")); menuServer->AppendSeparator(); #endif menuServer->Append(MENU_QUIT, _("&Quit")); m_menuEdit = new wxMenu; m_menuEdit->Append(MENU_AUTOJOIN_CHANNELS, _("&Autojoin channels")); m_menuEdit->Append(MENU_PREFERENCES, _("&Preferences")); m_menuEdit->Append(MENU_SELECT_LOCALE, _("&Change language")); m_settings_menu = new wxMenuItem(m_menuEdit, MENU_SETTINGSPP, _("&Spring settings"), wxEmptyString, wxITEM_NORMAL); m_menuEdit->Append(MENU_RESET_LAYOUT, _("&Reset layout")); m_menuEdit->Append(m_settings_menu); m_menuEdit->Enable(MENU_SETTINGSPP, LSL::usync().IsLoaded()); //unitsync isn't loaded yet, disable menu entry m_menuTools = new wxMenu; m_menuTools->Append(MENU_JOIN, _("&Join channel...")); m_menuTools->Append(MENU_CHANNELCHOOSER, _("Channel &list")); m_menuTools->Append(MENU_CHAT, _("Open private &chat...")); m_menuTools->Append(MENU_SHOWWRITEABLEDIR, _("&Open Spring DataDir")); m_menuTools->AppendSeparator(); m_menuTools->Append(MENU_DOWNLOAD, _("&Download Archives")); m_menuTools->AppendSeparator(); m_menuTools->Append(MENU_USYNC, _("&Reload maps/games")); m_menuTools->AppendSeparator(); m_menuTools->Append(MENU_VERSION, _("Check for new Version")); wxMenu* menuHelp = new wxMenu; menuHelp->Append(MENU_GENERAL_HELP, _("&Help, tutorial and FAQ")); menuHelp->Append(MENU_ABOUT, _("&About")); menuHelp->Append(MENU_PATHINFO, _("&System Info")); menuHelp->Append(MENU_TRAC, _("&Report a bug...")); menuHelp->Append(MENU_DOC, _("&Documentation")); m_menubar = new wxMenuBar; m_menubar->Append(menuServer, _("&Server")); m_menubar->Append(m_menuEdit, _("&Edit")); m_menubar->Append(m_menuTools, _("&Tools")); m_menubar->Append(menuHelp, _("&Help")); SetMenuBar(m_menubar); m_main_sizer = new wxBoxSizer(wxHORIZONTAL); m_func_tabs = new SLNotebook(this, _T("mainfunctabs"), MAIN_TABS, wxDefaultPosition, wxDefaultSize, wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_LEFT); m_func_tabs->SetArtProvider(new wxAuiDefaultTabArt); //IMPORTANT: event handling needs to be disabled while constructing, otherwise deadlock occurs SetEvtHandlerEnabled(false); m_chat_tab = new MainChatTab(m_func_tabs); m_list_tab = new BattleListTab(m_func_tabs); m_join_tab = new MainJoinBattleTab(m_func_tabs); m_sp_tab = new MainSinglePlayerTab(m_func_tabs); // m_savegame_tab = new SavegameTab( m_func_tabs ); m_replay_tab = new PlaybackTab(m_func_tabs, true); m_torrent_tab = new MainDownloadTab(m_func_tabs); //use Insert so no Changepage events are triggered m_func_tabs->InsertPage(PAGE_CHAT, m_chat_tab, m_tab_names[PAGE_CHAT], true); m_func_tabs->InsertPage(PAGE_LIST, m_list_tab, m_tab_names[PAGE_LIST], false); m_func_tabs->InsertPage(PAGE_JOIN, m_join_tab, m_tab_names[PAGE_JOIN], false); m_func_tabs->InsertPage(PAGE_SINGLE, m_sp_tab, m_tab_names[PAGE_SINGLE], false); // m_func_tabs->InsertPage( PAGE_SAVEGAME, m_savegame_tab, m_tab_names[PAGE_SAVEGAME], false ); m_func_tabs->InsertPage(PAGE_REPLAY, m_replay_tab, m_tab_names[PAGE_REPLAY], false); m_func_tabs->InsertPage(PAGE_TORRENT, m_torrent_tab, m_tab_names[PAGE_TORRENT], false); LoadPerspectives(); SetTabIcons(); m_main_sizer->Add(m_func_tabs, 1, wxEXPAND | wxALL, 0); SetSizer(m_main_sizer); Layout(); se_frame_active = false; wxToolTip::Enable(sett().GetShowTooltips()); m_channel_chooser = new ChannelChooserDialog(this, -1, _("Choose channels to join")); m_statusbar = new Statusbar(this); SetStatusBar(m_statusbar); // re-enable eventhandling SetEvtHandlerEnabled(true); UpdateMainAppHasFocus(m_has_focus); Connect(MainwindowMessageEvent, wxCommandEventHandler(MainWindow::OnMessage), NULL, this); //this should take off the firstload time considerably *ie nil it :P ) mapSelectDialog(true, this); Logger::ShowDebugWindow(true); // Logger::ShowDebugWindow(cfg().ReadBool(_T("/debug"))); }
void settings_frame::OnMenuChoice(wxCommandEvent& event) { switch (event.GetId()) { case ID_MENUITEM_SAVE: if (saveSettingsAbstract()) (abstract_panel::settingsChanged) = false; if (simpleTab != 0) simpleTab->saveCbxChoices(); break; case ID_MENUITEM_QUIT: handleExit(); break; case ID_MENUITEM_RESET: if ((customMessageBox(SS_MAIN_ICON, _("Reset ALL settings to default values?"), _("Confirmation needed"), wxYES_NO | wxCANCEL)) == wxYES) { resetSettings(); } break; case ID_MENUITEM_SIMPLE: if (sett().getMode() == SET_MODE_EXPERT) { sett().setMode(SET_MODE_SIMPLE); simpleTab = new tab_simple(this, notebook, ID_SIMPLE); notebook->InsertPage(0, simpleTab, simpleTabCap); simpleTab->updateControls(UPDATE_ALL); //if not on ui page goto simple if (notebook->GetSelection() != 1) { notebook->SetSelection(0); } for (int i = notebook->GetPageCount() - 1; i > 1; i--) { //delete all pages expect page 0 + 1 notebook->DeletePage(i); } qualityTab = 0; detailTab = 0; audioTab = 0; // hotkeyTab = 0; SetTitle(TowxString(getSpringlobbyName()) + _("(simple mode)")); if (!sett().getDisableWarning()) { customMessageBox(SS_MAIN_ICON, expertModeWarning, _("Hint"), wxOK); } } break; case ID_MENUITEM_EXPERT: if (sett().getMode() == SET_MODE_SIMPLE) { switchToExpertMode(); } break; case ID_MENUITEM_DISABLE_WARN: sett().setDisableWarning(menuFile->IsChecked(ID_MENUITEM_DISABLE_WARN)); break; case ID_MENUITEM_ABOUT: aboutbox().Show(); break; case ID_MENUITEM_CONTACT: aboutbox().openContactPage(); break; case ID_MENUITEM_BUGREPORT: aboutbox().openNewTicket(); break; } }
wxString IdentityString(const wxString& format, bool lowerCase ) { return wxFormat( format ) % TowxString(getSpringlobbyName(lowerCase)); }
wxString GetAppName( const bool lowerCase ) { return TowxString(getSpringlobbyName(lowerCase)); }
void SpringOptionsTab::SwitchUnitsync(const std::string& newIndex, const std::string& oldIndex /* can be empty */) { UiEvents::ScopedStatusMessage(_("Reloading unitsync"), 0); SlPaths::SetUsedSpringIndex(newIndex); if (!LSL::usync().LoadUnitSyncLib(SlPaths::GetUnitSync(newIndex))) { //FIXME: make LoadUnitSyncLib() async (partly done) wxLogWarning(_T( "Cannot load UnitSync" )); customMessageBox(SL_MAIN_ICON, wxString::Format(_T("%s is unable to load your UnitSync library into the process.\n\nYou might want to take another look at your unitsync setting."), getSpringlobbyName().c_str()), _("Spring error"), wxOK); SlPaths::SetUsedSpringIndex(oldIndex); DoRestore(); } }
void SpringOptionsTab::OnAddBundle(wxCommandEvent& /*event*/) { wxFileDialog pick(this, _("Choose UnitSync library"), wxPathOnly(TowxString(SlPaths::GetUnitSync())), wxFileName::FileName(TowxString(SlPaths::GetUnitSync())).GetFullName(), GetUnitsyncFilter()); if (pick.ShowModal() == wxID_OK) { //get unitsync version & add to list bool failed = false; wxString failMessage; LSL::SpringBundle bundle; #ifdef __APPLE__ wxString path = pick.GetPath(); bundle.unitsync = STD_STRING(path + (path.EndsWith("libunitsync.dylib") ? "" : "/Contents/MacOS/libunitsync.dylib")); #else bundle.unitsync = STD_STRING(pick.GetPath()); #endif wxString version; try { bundle.AutoComplete(); version = TowxString(bundle.version); if (!bundle.IsValid() || version.IsEmpty()) { // couldn't detect paths automaticly, allow user to select spring executable wxFileDialog pick(this, _("Choose a Spring executable"), wxPathOnly(TowxString(bundle.unitsync)), wxFileName::FileName(TowxString(SlPaths::GetSpringBinary())).GetFullName(), GetSpringFilter()); if (pick.ShowModal() == wxID_OK) { bundle.spring = STD_STRING(pick.GetPath()); } } if (!bundle.IsValid() || version.IsEmpty()) { failed = true; failMessage = wxString::Format(_T("%s did not find engine and unitsync executables at %s\n\nPlease ensure that both exist and that you have appropriate access privileges."), getSpringlobbyName().c_str(), bundle.path.c_str()); } } catch (const LSL::Exceptions::unitsync& e) { failed = true; failMessage = wxString::Format(_T("%s could not obtain the version string from the shared library file %s\n\nPlease provide a valid unitsync file."), getSpringlobbyName().c_str(), bundle.unitsync.c_str()); } if (failed) { customMessageBox(SL_MAIN_ICON, failMessage, _("Configuration error"), wxOK); return; } m_spring_list->Append(version); m_spring_list->SetStringSelection(version); m_sync_edit->SetValue(TowxString(bundle.unitsync)); m_exec_edit->SetValue(TowxString(bundle.spring)); SlPaths::RefreshSpringVersionList(false, &bundle); DoRestore(); } }