void ChatPanel::OutputError(const wxString& message) { OutputLine(wxString::Format(_("Error: %s"), message.c_str()), sett().GetChatColorError()); }
void BattleRoomTab::SetBattle( Battle* battle ) { m_battle = battle; m_team_sel->Enable(m_battle); m_ally_sel->Enable(m_battle); m_color_sel->Enable(m_battle); m_side_sel->Enable(m_battle); m_options_preset_sel->Enable(m_battle); m_minimap->Enable(m_battle); m_player_panel->Enable(m_battle); m_map_combo->Enable(m_battle); m_players->Enable(m_battle); m_leave_btn->Enable(m_battle); m_start_btn->Enable(m_battle); m_addbot_btn->Enable(m_battle); m_manage_players_btn->Enable(m_battle); m_save_btn->Enable(m_battle); m_delete_btn->Enable(m_battle); m_default_btn->Enable(m_battle); m_browse_map_btn->Enable(m_battle); m_ready_chk->Enable(m_battle); m_spec_chk->Enable(m_battle); m_lock_chk->Enable(m_battle); m_autolock_chk->Enable(m_battle); m_opts_list->Enable(m_battle); m_minimap->SetBattle( m_battle ); m_players->SetBattle( m_battle ); m_chat->SetBattle( m_battle ); m_players->Clear(); m_side_sel->Clear(); if ( m_battle ) { m_options_preset_sel->SetStringSelection( sett().GetModDefaultPresetName( m_battle->GetHostModName() ) ); m_color_sel->SetColor( m_battle->GetMe().BattleStatus().colour ); try { wxArrayString sides = usync().GetSides( m_battle->GetHostModName() ); for ( unsigned int i = 0; i < sides.GetCount(); i++ ) { m_side_sel->Append( sides[i], icons().GetBitmap( icons().GetSideIcon( m_battle->GetHostModName(), i ) ) ); } } catch ( ... ) {} for ( UserList::user_map_t::size_type i = 0; i < m_battle->GetNumUsers(); i++ ) { m_players->AddUser( m_battle->GetUser( i ) ); #ifdef __WXMAC__ UpdateUser( m_battle->GetUser( i ) ); #endif } if ( !m_battle->IsFounderMe() ) { m_options_preset_sel->Disable(); m_save_btn->Disable(); m_delete_btn->Disable(); m_default_btn->Disable(); m_manage_players_btn->Disable(); m_lock_chk->Disable(); m_autolock_chk->Disable(); } m_host_new_btn->Show( false ); RegenerateOptionsList(); ReloadMaplist(); UpdateBattleInfo( wxString::Format( _T( "%d_mapname" ), OptionsWrapper::PrivateOptions ) ); UpdateBattleInfo(); UpdateStatsLabels(); } else { m_host_new_btn->Show( true ); } }
void BattleRoomTab::OnAutoControl( wxCommandEvent& /*unused*/ ) { if ( !m_battle ) return; sett().SetBattleLastAutoControlState( m_autocontrol_mnu->IsChecked() ); }
bool ChatLog::LogEnabled() { return sett().GetChatLogEnable(); }
MapSelectDialog::MapSelectDialog( wxWindow* parent ) : // WindowHintsPickle( m_dialog_name, this, wxSize( DEFSETT_MW_WIDTH, DEFSETT_MW_HEIGHT ) ), m_horizontal_direction( sett().GetHorizontalSortorder() ), m_vertical_direction( sett().GetVerticalSortorder() ) { //(*Initialize(MapSelectDialog) wxStaticBoxSizer* StaticBoxSizer2; wxStaticText* StaticText2; wxStaticText* StaticText1; wxBoxSizer* BoxSizer2; wxBoxSizer* boxSizerHorizontal; wxBoxSizer* BoxSizer1; wxStaticBoxSizer* StaticBoxSizer1; wxBoxSizer* boxSizerVertical; wxStdDialogButtonSizer* StdDialogButtonSizer1; Create(parent, wxID_ANY, _("Select map (click and drag to scroll)"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX, _T("wxID_ANY")); BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); BoxSizer2 = new wxBoxSizer(wxVERTICAL); StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Vertical sort key"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); BoxSizer2->Add(StaticText2, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); boxSizerVertical = new wxBoxSizer(wxHORIZONTAL); m_vertical_choice = new wxChoice(this, ID_VERTICAL_CHOICE, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_VERTICAL_CHOICE")); boxSizerVertical->Add(m_vertical_choice, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2->Add(boxSizerVertical, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Horizontal sort key"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); BoxSizer2->Add(StaticText1, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); boxSizerHorizontal = new wxBoxSizer(wxHORIZONTAL); m_horizontal_choice = new wxChoice(this, ID_HORIZONTAL_CHOICE, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_HORIZONTAL_CHOICE")); boxSizerHorizontal->Add(m_horizontal_choice, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2->Add(boxSizerHorizontal, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Show")); m_filter_all = new wxRadioButton(this, ID_FILTER_ALL, _("All maps"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_ALL")); m_filter_all->SetToolTip(_("Shows all available maps")); StaticBoxSizer1->Add(m_filter_all, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); m_filter_popular = new wxRadioButton(this, ID_FILTER_POPULAR, _("Popular maps"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_POPULAR")); m_filter_popular->SetToolTip(_("Shows only maps which are currently being player on the server. You must be online to use this.")); StaticBoxSizer1->Add(m_filter_popular, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); m_filter_recent = new wxRadioButton(this, ID_FILTER_RECENT, _("Recently played maps"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_RECENT")); m_filter_recent->SetValue(true); m_filter_recent->SetToolTip(_("Shows only maps you played recently. (Based on your replays.)")); StaticBoxSizer1->Add(m_filter_recent, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); BoxSizer2->Add(StaticBoxSizer1, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Filter")); m_filter_text = new wxTextCtrl(this, ID_FILTER_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_TEXT")); m_filter_text->SetToolTip(_("Shows only maps which contain this text in their name or description.")); StaticBoxSizer2->Add(m_filter_text, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); BoxSizer2->Add(StaticBoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); m_map_details = new wxStaticBoxSizer(wxVERTICAL, this, _("Map details")); m_map_name = new wxStaticText(this, ID_MAP_NAME, wxEmptyString, wxDefaultPosition, wxSize(170,90), wxST_NO_AUTORESIZE, _T("ID_MAP_NAME")); m_map_name->SetLabel( wxEmptyString ); m_map_details->Add(m_map_name, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); m_map_opts_list = new wxListCtrl(this, ID_MAP_OPTS_LIST, wxDefaultPosition, wxSize(170,120), wxLC_REPORT|wxLC_NO_HEADER|wxNO_BORDER, wxDefaultValidator, _T("ID_MAP_OPTS_LIST")); m_map_details->Add(m_map_opts_list, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2->Add(m_map_details, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StdDialogButtonSizer1 = new wxStdDialogButtonSizer(); StdDialogButtonSizer1->AddButton(new wxButton(this, wxID_OK, wxEmptyString)); StdDialogButtonSizer1->AddButton(new wxButton(this, wxID_CANCEL, wxEmptyString)); StdDialogButtonSizer1->Realize(); BoxSizer2->Add(StdDialogButtonSizer1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); m_mapgrid = new MapGridCtrl(this, wxSize(600,400), ID_MAPGRID); BoxSizer1->Add(m_mapgrid, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(BoxSizer1); BoxSizer1->Fit(this); BoxSizer1->SetSizeHints(this); Center(); Connect(ID_VERTICAL_CHOICE,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnSortKeySelect); Connect(ID_HORIZONTAL_CHOICE,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnSortKeySelect); Connect(ID_FILTER_ALL,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnFilterAllSelect); Connect(ID_FILTER_POPULAR,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnFilterPopularSelect); Connect(ID_FILTER_RECENT,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnFilterRecentSelect); Connect(ID_FILTER_TEXT,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&MapSelectDialog::OnFilterTextChanged); m_mapgrid->Connect(ID_MAPGRID,wxEVT_LEFT_DCLICK,(wxObjectEventFunction)&MapSelectDialog::OnMapGridLeftDClick,0,this); Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&MapSelectDialog::OnInit); //*) Connect(ID_MAPGRID,MapGridCtrl::MapSelectedEvt,(wxObjectEventFunction)&MapSelectDialog::OnMapSelected,0,this); Connect(ID_MAPGRID,MapGridCtrl::LoadingCompletedEvt,(wxObjectEventFunction)&MapSelectDialog::OnMapLoadingCompleted,0,this); // Ugh.. Can not have these created by generated code because wxSmith doesn't accept a symbolic size, // (ie. wxSize(CONTROL_HEIGHT,CONTROL_HEIGHT)) and all Set*Size() methods don't seem to have any effect. m_vertical_direction_button = new wxButton(this, ID_VERTICAL_DIRECTION, _T("ᴠ"), wxDefaultPosition, wxSize(CONTROL_HEIGHT,CONTROL_HEIGHT), 0, wxDefaultValidator, _T("ID_VERTICAL_DIRECTION")); boxSizerVertical->Add(m_vertical_direction_button, 0, wxALL|wxEXPAND|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); m_horizontal_direction_button = new wxButton(this, ID_HORIZONTAL_DIRECTION, _T(">"), wxDefaultPosition, wxSize(CONTROL_HEIGHT,CONTROL_HEIGHT), 0, wxDefaultValidator, _T("ID_HORIZONTAL_DIRECTION")); boxSizerHorizontal->Add(m_horizontal_direction_button, 0, wxALL|wxEXPAND|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); //<>ᴠᴧ Connect(ID_VERTICAL_DIRECTION, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&MapSelectDialog::OnVerticalDirectionClicked); Connect(ID_HORIZONTAL_DIRECTION, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&MapSelectDialog::OnHorizontalDirectionClicked); // TODO: refactor, this is copied from battlemaptab.cpp m_map_opts_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); m_map_opts_list->SetFont( wxFont( 8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT ) ); wxListItem col; col.SetText( _("Option") ); m_map_opts_list->InsertColumn( 0, col ); col.SetText( _("Value") ); m_map_opts_list->InsertColumn( 1, col ); m_map_opts_list->SetColumnWidth( 0, 90 ); m_map_opts_list->SetColumnWidth( 1, 80 ); m_map_opts_list->InsertItem( 0, _("Size") ); m_map_opts_list->InsertItem( 1, _("Windspeed") ); m_map_opts_list->InsertItem( 2, _("Tidal strength") ); m_map_opts_list->InsertItem( 3, _("Gravity") ); m_map_opts_list->InsertItem( 4, _("Extractor radius") ); m_map_opts_list->InsertItem( 5, _("Max metal") ); m_map_opts_list->InsertItem( 6, _("Start positions") ); Layout(); ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&MapSelectDialog::OnUnitsyncReloaded)); }
SinglePlayerTab::SinglePlayerTab(wxWindow* parent, MainSinglePlayerTab& msptab) : wxPanel(parent, -1) , m_battle(msptab) { GetAui().manager->AddPane(this, wxLEFT, _T("singleplayertab")); m_main_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* m_mapabour_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* m_map_sizer = new wxBoxSizer(wxHORIZONTAL); // m_map_sizer->SetMinSize( wxSize( 352, -1 ) ); // empty panel to replace minimap m_nominimap = new wxWindow(this, -1, wxDefaultPosition, wxSize(100, 100), wxSIMPLE_BORDER | wxFULL_REPAINT_ON_RESIZE); m_nominimap->SetToolTip(_("No Unitsync configured.")); m_nominimap->SetBackgroundStyle(wxBG_STYLE_CUSTOM); m_nominimap->SetBackgroundColour(*wxLIGHT_GREY); m_nominimap->Hide(); m_map_sizer->Add(m_nominimap, 1, wxALL | wxEXPAND, 2); // Regular minimap m_minimap = new MapCtrl(this, 100, &m_battle, false, true, true); m_minimap->SetToolTip(_("You can drag the sun/bot icon around to define start position.\n " "Hover over the icon for a popup that lets you change side, ally and bonus.")); m_map_sizer->Add(m_minimap, 1, wxALL | wxEXPAND, 2); m_mapabour_sizer->Add(m_map_sizer, 1, wxEXPAND, 2); //map description and parametrs like in battletab wxBoxSizer* m_opts_sizer = new wxBoxSizer(wxVERTICAL); m_map_opts_list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(150, 160), wxLC_NO_HEADER | wxLC_REPORT); m_map_opts_list->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); m_map_opts_list->SetFont(wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT)); wxListItem col; col.SetText(_("Option")); m_map_opts_list->InsertColumn(0, col); col.SetText(_("Value")); m_map_opts_list->InsertColumn(1, col); m_map_opts_list->SetColumnWidth(0, 90); m_map_opts_list->SetColumnWidth(1, 50); m_map_opts_list->InsertItem(0, _("Size")); m_map_opts_list->InsertItem(1, _("Windspeed")); m_map_opts_list->InsertItem(2, _("Tidal strength")); m_map_opts_list->InsertItem(3, _("Gravity")); m_map_opts_list->InsertItem(4, _("Extractor radius")); m_map_opts_list->InsertItem(5, _("Max metal")); m_opts_sizer->Add(m_map_opts_list, 0, wxALL, 2); m_map_desc = new wxStaticText(this, -1, wxEmptyString); m_map_desc->Wrap(160); m_opts_sizer->Add(m_map_desc, 0, wxALL, 2); m_mapabour_sizer->Add(m_opts_sizer, 0, wxALL | wxEXPAND, 2); m_main_sizer->Add(m_mapabour_sizer, 1, wxEXPAND, 5); wxBoxSizer* m_ctrl_sizer = new wxBoxSizer(wxHORIZONTAL); m_map_lbl = new wxStaticText(this, -1, _("Map:")); m_ctrl_sizer->Add(m_map_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_map_pick = new wxChoice(this, SP_MAP_PICK); m_ctrl_sizer->Add(m_map_pick, 1, wxALL, 5); m_select_btn = new wxButton(this, SP_BROWSE_MAP, _T("..."), wxDefaultPosition, wxSize(CONTROL_HEIGHT, CONTROL_HEIGHT), wxBU_EXACTFIT); m_ctrl_sizer->Add(m_select_btn, 0, wxBOTTOM | wxRIGHT | wxTOP, 5); m_mod_lbl = new wxStaticText(this, -1, _("Game:")); m_ctrl_sizer->Add(m_mod_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_mod_pick = new wxChoice(this, SP_MOD_PICK); m_ctrl_sizer->Add(m_mod_pick, 1, wxALL, 5); m_mod_lbl = new wxStaticText(this, -1, _("Engine:")); m_ctrl_sizer->Add(m_mod_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_engine_pick = new wxChoice(this, SP_ENGINE_PICK); m_engine_pick->SetToolTip(_("Select the engine version to play.")); m_ctrl_sizer->Add(m_engine_pick, 1, wxALL, 5); // m_ctrl_sizer->Add( 0, 0, 1, wxEXPAND, 0 ); m_addbot_btn = new wxButton(this, SP_ADD_BOT, _("Add bot..."), wxDefaultPosition, wxSize(80, CONTROL_HEIGHT), 0); m_ctrl_sizer->Add(m_addbot_btn, 0, wxALL, 5); m_main_sizer->Add(m_ctrl_sizer, 0, wxEXPAND, 5); m_buttons_sep = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL); m_main_sizer->Add(m_buttons_sep, 0, wxLEFT | wxRIGHT | wxEXPAND, 5); wxBoxSizer* m_buttons_sizer = new wxBoxSizer(wxHORIZONTAL); m_buttons_sizer->Add(0, 0, 1, wxEXPAND, 0); m_color_btn = new ColorButton(this, SP_COLOUR, sett().GetBattleLastColour(), wxDefaultPosition, wxSize(30, CONTROL_HEIGHT)); m_buttons_sizer->Add(m_color_btn, 0, wxALIGN_CENTER_VERTICAL | wxALL, 0); m_spectator_check = new wxCheckBox(this, SP_SPECTATE, _("Spectate only")); m_buttons_sizer->Add(m_spectator_check, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_random_check = new wxCheckBox(this, SP_RANDOM, _("Random start positions")); m_buttons_sizer->Add(m_random_check, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_start_btn = new wxButton(this, SP_START, _("Start"), wxDefaultPosition, wxSize(80, CONTROL_HEIGHT), 0); m_buttons_sizer->Add(m_start_btn, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); m_main_sizer->Add(m_buttons_sizer, 0, wxEXPAND, 5); m_battle.SetEngineName("spring"); m_battle.SetEngineVersion(SlPaths::GetCurrentUsedSpringIndex()); ReloadMaplist(); // ReloadModlist(); //Called from ReloadEngineList() too ReloadEngineList(); GlobalEventManager::Instance()->Subscribe(this, GlobalEventManager::OnUnitsyncReloaded, wxObjectEventFunction(&SinglePlayerTab::OnUnitsyncReloaded)); this->SetSizer(m_main_sizer); this->Layout(); }
void SpringLobbyApp::CacheAndSettingsSetup() { SetSettingsStandAlone( false ); const wxString userConfigDir = GetConfigfileDir(); if ( sett().IsFirstRun() && !wxDirExists( userConfigDir ) ) { wxMkdir( userConfigDir ); } if ( (sett().GetCacheVersion() < CACHE_VERSION) && !sett().IsFirstRun() ) { sett().SetMapCachingThreadProgress( 0 ); // reset map cache thread sett().SetModCachingThreadProgress( 0 ); // reset mod cache thread if ( wxDirExists( sett().GetCachePath() ) ) { wxLogWarning( _T("erasing old cache ver %d (app cache ver %d)"), sett().GetCacheVersion(), CACHE_VERSION ); wxString file = wxFindFirstFile( sett().GetCachePath() + wxFILE_SEP_PATH + _T("*") ); while ( !file.empty() ) { wxRemoveFile( file ); file = wxFindNextFile(); } } } if ( !sett().IsFirstRun() ) { int settversion = sett().GetSettingsVersion(); if ( settversion < 3 ) { sett().ConvertOldSpringDirsOptions(); } if ( settversion < 4 ) { if ( sett().GetTorrentPort() == DEFSETT_SPRING_PORT ) sett().SetTorrentPort( DEFSETT_SPRING_PORT + 1 ); } if ( settversion < 5 ) { wxArrayString list = sett().GetServers(); int count = list.GetCount(); wxArrayString wordlist = sett().GetHighlightedWords(); for ( int i= 0; i < count; i++ ) { wxString nick = sett().GetServerAccountNick( list[i] ); if ( wordlist.Index( nick ) == -1 ) { wordlist.Add( nick ); } } sett().SetHighlightedWords( wordlist ); } if ( settversion < 6 ) { sett().ConvertOldServerSettings(); } if ( settversion < 7 ) { sett().AddChannelJoin( _T("springlobby"), _T("") ); } if ( settversion < 8 ) { sett().DeleteServer( _T("Backup server") ); sett().SetServer( _T("Backup server 1"), _T("springbackup1.servegame.com"), 8200 ); sett().SetServer( _T("Backup server 2"), _T("springbackup2.servegame.org"), 8200 ); sett().SetServer( _T("Test server"), _T("taspringmaster.servegame.com"), 8300 ); } if ( settversion < 10 ) { sett().ConvertOldColorSettings(); } if ( settversion < 11 ) { if( IsUACenabled() ) { usync().ReloadUnitSyncLib(); if ( usync().IsLoaded() ) usync().SetSpringDataPath(_T("")); // UAC is on, fix the spring data path } } if ( settversion < 12 ) { sett().ConvertOldChannelSettings(); } if ( settversion < 13 ) { sett().ConvertOldHiglightSettings(); } if ( settversion < 15 ) { sett().TranslateSavedColumWidths(); } if ( settversion < 21 ) { sett().RemoveLayouts(); } if ( settversion < 18 ) { //new downloader was introduced sett().ClearTorrentListToResume(); } if( settversion < 19 ) { //the dummy column hack was removed on win sett().NukeColumnWidths(); } if ( settversion < 22 ) { if ( m_translationhelper ) { // add locale's language code to autojoin if ( m_translationhelper->GetLocale() ) { wxString localecode = m_translationhelper->GetLocale()->GetCanonicalName(); if ( localecode.Find(_T("_")) != -1 ) localecode = localecode.BeforeFirst(_T('_')); if ( localecode == _T("en") ) // we'll skip en for now, maybe in the future we'll reactivate it sett().AddChannelJoin( localecode, _T("") ); } } } if ( settversion < 23 ) { sett().ConvertLists(); sett().AddKnownMatchmakerCPU(6667); } } if ( sett().ShouldAddDefaultServerSettings() || ( sett().GetSettingsVersion() < 14 && sett().GetServers().Count() < 2 ) ) sett().SetDefaultServerSettings(); if ( sett().ShouldAddDefaultChannelSettings() ) { sett().AddChannelJoin( _T("main"), _T("") ); sett().AddChannelJoin( _T("newbies"), _T("") ); if ( m_translationhelper ) { if ( m_translationhelper->GetLocale() ) { wxString localecode = m_translationhelper->GetLocale()->GetCanonicalName(); if ( localecode.Find(_T("_")) != -1 ) localecode = localecode.BeforeFirst(_T('_')); sett().AddChannelJoin( localecode, _T("") ); // add locale's language code to autojoin } } } if ( sett().ShouldAddDefaultGroupSettings() ) { sett().AddGroup( _("Default") ); sett().AddGroup( _("Ignore PM") ); useractions().ChangeAction( _("Ignore PM"), UserActions::ActIgnorePM ); sett().AddGroup( _("Ignore chat") ); useractions().ChangeAction( _("Ignore chat"), UserActions::ActIgnoreChat ); sett().AddGroup( _("Battle Autokick") ); useractions().ChangeAction( _("Battle Autokick"), UserActions::ActAutokick ); sett().AddGroup( _("Friends") ); useractions().ChangeAction( _("Friends"), UserActions::ActNotifBattle ); useractions().ChangeAction( _("Friends"), UserActions::ActHighlight ); useractions().ChangeAction( _("Friends"), UserActions::ActNotifLogin ); useractions().SetGroupColor( _("Friends"), wxColour( 0, 0, 255 ) ); } }
void ChatOptionsTab::DoRestore() { m_normal_color->SetColor( sett().GetChatColorNormal() ); m_bg_color->SetColor( sett().GetChatColorBackground() ); m_action_color->SetColor( sett().GetChatColorAction() ); m_highlight_color->SetColor( sett().GetChatColorHighlight() ); m_joinleave_color->SetColor( sett().GetChatColorJoinPart() ); m_note_color->SetColor( sett().GetChatColorNotification() ); m_my_color->SetColor( sett().GetChatColorMine() ); m_server_color->SetColor( sett().GetChatColorServer() ); m_client_color->SetColor( sett().GetChatColorClient() ); m_error_color->SetColor( sett().GetChatColorError() ); m_ts_color->SetColor( sett().GetChatColorTime() ); m_chat_font = sett().GetChatFont(); m_fontname->SetLabel( m_chat_font.GetFaceName() ); m_save_logs->SetValue( sett().GetChatLogEnable() ); m_irc_colors->SetValue( sett().GetUseIrcColors() ); wxString highlightstring; wxArrayString highlights = sett().GetHighlightedWords(); for ( unsigned int i = 0; i < highlights.GetCount(); i++ ) highlightstring << highlights[i] << _T( ";" ); m_highlight_words->SetValue( highlightstring ); m_highlight_req->SetValue( sett().GetRequestAttOnHighlight() ); #ifndef DISABLE_SOUND m_play_sounds->SetValue( sett().GetChatPMSoundNotificationEnabled() ); #endif m_num_lines->SetValue( sett().GetAutoloadedChatlogLinesCount() ); m_broadcast_check->SetValue(sett().GetBroadcastEverywhere() ); }
void ChatOptionsTab::OnApply( wxCommandEvent& /*unused*/ ) { sett().SetChatColorNormal ( m_normal_color->GetColor() ); sett().SetChatColorBackground( m_bg_color->GetColor() ); sett().SetChatColorAction( m_action_color->GetColor() ); sett().SetChatColorHighlight( m_highlight_color->GetColor() ); sett().SetChatColorJoinPart( m_joinleave_color->GetColor() ); sett().SetChatColorNotification( m_note_color->GetColor() ); sett().SetChatColorMine( m_my_color->GetColor() ); sett().SetChatColorServer( m_server_color->GetColor() ); sett().SetChatColorClient( m_client_color->GetColor() ); sett().SetChatColorError( m_error_color->GetColor() ); sett().SetChatColorTime( m_ts_color->GetColor() ); sett().SetChatFont( m_chat_font ); sett().SetUseIrcColors( m_irc_colors->IsChecked() ); //m_ui.mw().GetChatTab().ChangeUnreadChannelColour( m_note_color->GetBackgroundColour() ); //m_ui.mw().GetChatTab().ChangeUnreadPMColour( m_note_color->GetBackgroundColour() ); sett().SetHighlightedWords( wxStringTokenize( m_highlight_words->GetValue(), _T( ";" ) ) ); sett().SetRequestAttOnHighlight( m_highlight_req->IsChecked() ); //Chat Log sett().SetChatLogEnable( m_save_logs->GetValue() ); sett().SetBroadcastEverywhere( m_broadcast_check->GetValue() ); // Behavior #ifndef DISABLE_SOUND sett().SetChatPMSoundNotificationEnabled( m_play_sounds->IsChecked() ); #endif sett().SetAutoloadedChatlogLinesCount( m_num_lines->GetValue() ); }
bool ChatPanel::Say(const wxString& message) //FIXME: remove all parsing / tokenizing / ... to dedicated file { static const unsigned int flood_threshold = 5; slLogDebugFunc(""); wxStringTokenizer lines(message, _T('\n')); if (lines.CountTokens() > flood_threshold) { PasteDialog dl(this, wxString::Format(_("Are you sure you want to paste %d lines?"), lines.CountTokens())); switch (dl.ShowModal()) { case wxID_NO: return true; case PasteDialog::pasteButtonReturnCode: { wxString url = Paste2Pastebin(message); if (url != wxEmptyString && wxStringTokenizer(url, _T('\n')).CountTokens() <= flood_threshold) { Say(url); return true; } else { customMessageBoxModal(SL_MAIN_ICON, wxString::Format(_("Failed to post to %s"), _T("paste.springfiles.com"))); return false; } } default: break; } } while (lines.HasMoreTokens()) { wxString line = lines.GetNextToken(); wxLogDebug(_T( "line: %s" ), line.c_str()); if (line == "/help") { ui().ConsoleHelp(); return true; } if (line == "/channels") { ui().mw().ShowChannelChooser(); return true; } if (line == _T( "/ver" )) { //!this instance is not replaced with GetAppname for sake of help/debug online OutputLine(wxString::Format(_("You have %s."), GetSpringlobbyAgent()), sett().GetChatColorNormal()); return true; } if (line == _T( "/clear" )) { m_chatlog_text->SetValue(wxEmptyString); return true; } if (m_type == CPT_Channel) { if (m_channel == 0) { OutputError(_("You are not in channel or channel does not exist.")); return true; } if (line.StartsWith(_T( "/" ))) { if (m_channel->ExecuteSayCommand(STD_STRING(line))) return true; if (m_channel->GetServer().ExecuteSayCommand(STD_STRING(line))) return true; OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str())); return true; } m_channel->Say(STD_STRING(line)); } else if (m_type == CPT_Battle) { if (m_battle == 0) { OutputError(_("You are not in battle or battle does not exist, use /help for a list of available commands.")); return true; } if (line.StartsWith(_T( "/" ))) { if (m_battle->ExecuteSayCommand(STD_STRING(line))) return true; if (m_battle->GetServer().ExecuteSayCommand(STD_STRING(line))) return true; OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str())); return true; } m_battle->Say(STD_STRING(line)); } else if (m_type == CPT_User) { if (m_user == 0) { OutputError(_("User is offline.")); return true; } if (line.StartsWith(_T( "/" ))) { if (m_user->ExecuteSayCommand(STD_STRING(line))) return true; if (m_user->GetServer().ExecuteSayCommand(STD_STRING(line))) return true; OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str())); return true; } m_user->Say(STD_STRING(line)); } else if (m_type == CPT_Server) { if (m_server == 0) { OutputError(_("Not connected to server")); return true; } if (line.StartsWith(_T( "/" ))) { if (m_server->ExecuteSayCommand(STD_STRING(line))) return true; OutputError(wxString::Format(_("Command (%s) does not exist, use /help for a list of available commands."), line.c_str())); return true; } m_server->SendCmd(STD_STRING(line), ""); OutputLine(_("Sent: \"") + line + _T("\""), sett().GetChatColorNormal()); } } return true; }
void AddBotDialog::OnAddBot( wxCommandEvent& /*event*/ ) { sett().SetLastAI( m_ai->GetStringSelection() ); EndModal( wxID_OK ); }
void ChatPanel::Parted(User& who, const wxString& message) { // assert( m_type == CPT_Channel || m_type == CPT_Server || m_type == CPT_Battle || m_type == CPT_User ); const bool me_parted = m_channel && &who == &m_channel->GetMe(); const wxString nick = TowxString(who.GetNick()); const bool wasactive = m_active_users.erase(nick) > 0; if (m_display_joinitem || (wasactive && !who.IsBot())) { OutputLine(_T( "** " ) + wxString::Format(_("%s left %s (%s)."), nick.c_str(), GetChatTypeStr().c_str(), message.c_str()), sett().GetChatColorJoinPart()); } if (m_type == CPT_Channel) { if (m_channel == 0) return; if (me_parted) { m_channel->panel = nullptr; SetChannel(0); return; } if (m_display_joinitem) { // change the image of the tab to show new events SetIconHighlight(highlight_join_leave); } } else if (m_type == CPT_Server && me_parted) return; if (m_show_nick_list && (m_nicklist != nullptr)) { m_nicklist->RemoveUser(who); UpdateUserCountLabel(); } // Also remove the User from the TextCompletionDatabase textcompletiondatabase.Delete_Mapping(TowxString(who.GetNick())); }
void ChatPanel::OnChannelJoin(User& who) { // assert( m_type == CPT_Channel || m_type == CPT_Server || m_type == CPT_Battle || m_type == CPT_User ); if (m_show_nick_list && (m_nicklist != nullptr)) { m_nicklist->AddUser(who); UpdateUserCountLabel(); } if (m_display_joinitem) { OutputLine(_T( "** " ) + wxString::Format(_("%s joined %s."), TowxString(who.GetNick()).c_str(), GetChatTypeStr().c_str()), sett().GetChatColorJoinPart()); } // Also add the User to the TextCompletionDatabase textcompletiondatabase.Insert_Mapping(TowxString(who.GetNick()), TowxString(who.GetNick())); }
void ChatPanel::Joined(User& who) { if (m_display_joinitem) { // change the image of the tab to show new events if (m_type == CPT_Channel) { SetIconHighlight(highlight_join_leave); } OutputLine(_T( "** " ) + wxString::Format(_("%s joined %s."), TowxString(who.GetNick()).c_str(), GetChatTypeStr().c_str()), sett().GetChatColorJoinPart()); } if (m_show_nick_list && (m_nicklist != nullptr)) { m_nicklist->AddUser(who); UpdateUserCountLabel(); } // Also add the User to the TextCompletionDatabase textcompletiondatabase.Insert_Mapping(TowxString(who.GetNick()), TowxString(who.GetNick())); }
void HostBattleDialog::Run( wxWindow* parent ) { HostBattleDialog dlg( parent ); if ( dlg.ShowModal() == wxID_OK ) { BattleOptions bo; bo.description = sett().GetLastHostDescription(); bo.port = sett().GetLastHostPort(); bo.nattype = NatType( sett().GetLastHostNATSetting() ); if ( bo.nattype == NAT_None && sett().GetTestHostPort() ) { switch ( ui().TestHostPort( bo.port ) ) { case Server::porttest_pass : break; // success case Server::porttest_pass_WX26 : wxLogWarning( _T( "hosting port %d: test aborted (wx26)" ), bo.port ); customMessageBoxNoModal( SL_MAIN_ICON, wxString::Format( _( "Your using wxWidgets prior to version 2.8,\n " "port testing is not supported.\n Hosting may or may not work." ), bo.port ) ); sett().SetTestHostPort( false ); // no need to have it checked anymore break; case Server::porttest_unreachable : wxLogWarning( _T( "hosting port %d: test undetermined" ), bo.port ); customMessageBoxNoModal( SL_MAIN_ICON, wxString::Format( _( "The server used for testing your port %d " "is unreachable. \nHosting may or may not work with this setting." ), bo.port ) ); break; //inconclusive test shouldn't hinder hosting imo (koshi) case Server::porttest_timeout : case Server::porttest_socketNotOk : case Server::porttest_socketError : wxLogWarning( _T( "hosting port %d: test unsuccessful, closing battle" ), bo.port ); customMessageBoxNoModal( SL_MAIN_ICON, wxString::Format( _( "Battle not started because the port you selected (%d) " "is unable to-f /home/kosh/.springlobby/testing.conf recieve incoming packets\n checks your router & firewall configuration again or change port " "in the dialog.\n\nIf everything else fails, enable the Hole Punching NAT Traversal\n " "option in the hosting settings." ), bo.port ) ); return; default: wxLogWarning( _T( "unknonw port forward test result" ) ); break; } if ( !ui().TestHostPort( bo.port ) ) { wxLogWarning( _T( "hosting port %d: test unsuccessful, closing battle" ), bo.port ); customMessageBoxNoModal( SL_MAIN_ICON, wxString::Format( _( "Battle not started because the port you selected (%d) is unable to recieve incoming packets\n checks your router & firewall configuration again or change port in the dialog.\n\nIf everything else fails, enable the Hole Punching NAT Traversal\n option in the hosting settings." ), bo.port ) ); return; } } // Get selected mod from unitsync. UnitSyncMod mod; try { mod = usync().GetMod( sett().GetLastHostMod() ); bo.modhash = mod.hash; bo.modname = mod.name; } catch ( ... ) { wxLogWarning( _T( "can't host: mod not found" ) ); customMessageBoxNoModal( SL_MAIN_ICON, _( "Battle not started beacuse the mod you selected could not be found. " ), _( "Error starting battle." ), wxOK ); return; } UnitSyncMap map; wxString mname = sett().GetLastHostMap(); try { if ( usync().MapExists( mname ) ) map = usync().GetMap( mname ); else if ( usync().GetNumMaps() <= 0 ) { wxLogWarning( _T( "no maps found" ) ); customMessageBoxNoModal( SL_MAIN_ICON, _( "Couldn't find any maps in your spring installation. This could happen when you set the Spring settings incorrectly." ), _( "No maps found" ), wxOK ); return; } else { map = usync().GetMap( 0 ); } } catch ( ... ) { wxLogWarning( _T( "no maps found" ) ); customMessageBoxNoModal( SL_MAIN_ICON, _( "Couldn't find any maps in your spring installation. This could happen when you set the Spring settings incorrectly." ), _( "No maps found" ), wxOK ); return; } bo.maphash = map.hash; bo.mapname = map.name; bo.rankneeded = sett().GetLastRankLimit(); bo.maxplayers = sett().GetLastHostPlayerNum(); bo.userelayhost = sett().GetLastHostRelayedMode(); if ( bo.userelayhost ) bo.nattype = NAT_None; bo.relayhost = sett().GetLastRelayedHost(); serverSelector().GetServer().HostBattle( bo, sett().GetLastHostPassword() ); } }
ChatOptionsTab::ChatOptionsTab( wxWindow* parent ) : wxScrolledWindow( parent, -1 ) { GetAui().manager->AddPane( this, wxLEFT, _T( "chatoptionstab" ) ); wxBoxSizer* bMainSizerV; bMainSizerV = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbColorsSizer; sbColorsSizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, _( "Colors and font" ) ), wxHORIZONTAL ); wxBoxSizer* bColorsVSizer; bColorsVSizer = new wxBoxSizer( wxVERTICAL ); m_use_sys_colors = new wxCheckBox( this, ID_SYSCOLS, _( "Use system colors" ), wxDefaultPosition, wxDefaultSize, 0 ); m_use_sys_colors->Enable( false ); bColorsVSizer->Add( m_use_sys_colors, 0, wxALL, 5 ); m_custom_colors = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); m_custom_colors->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) ); wxBoxSizer* bCustomColorsSizer; bCustomColorsSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bColorSizer; bColorSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bColorsSizer1; bColorsSizer1 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bNormlColorSizer; bNormlColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_normal_color = new ColorButton( m_custom_colors, ID_NORMAL, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_normal_color->SetColor( wxColour( 0, 0, 0 ) ); bNormlColorSizer->Add( m_normal_color, 0, wxALL, 5 ); m_normal_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Normal" ), wxDefaultPosition, wxDefaultSize, 0 ); m_normal_label->Wrap( -1 ); bNormlColorSizer->Add( m_normal_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorsSizer1->Add( bNormlColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bBGColorSizer; bBGColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_bg_color = new ColorButton( m_custom_colors, ID_BG, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_bg_color->SetColor( wxColour( 255, 255, 255 ) ); bBGColorSizer->Add( m_bg_color, 0, wxALL, 5 ); m_bg_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Background" ), wxDefaultPosition, wxDefaultSize, 0 ); m_bg_label->Wrap( -1 ); bBGColorSizer->Add( m_bg_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorsSizer1->Add( bBGColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bActionColorSizer; bActionColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_action_color = new ColorButton( m_custom_colors, ID_ACTION, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_action_color->SetColor( wxColour( 255, 0, 249 ) ); bActionColorSizer->Add( m_action_color, 0, wxALL, 5 ); m_action_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Action" ), wxDefaultPosition, wxDefaultSize, 0 ); m_action_label->Wrap( -1 ); bActionColorSizer->Add( m_action_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorsSizer1->Add( bActionColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bHighlightColorSizer; bHighlightColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_highlight_color = new ColorButton( m_custom_colors, ID_HIGHLIGHT, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_highlight_color->SetColor( wxColour( 255, 0, 44 ) ); bHighlightColorSizer->Add( m_highlight_color, 0, wxALL, 5 ); m_highlight_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Highlight" ), wxDefaultPosition, wxDefaultSize, 0 ); m_highlight_label->Wrap( -1 ); bHighlightColorSizer->Add( m_highlight_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorsSizer1->Add( bHighlightColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bJoinLeaveColorSizer; bJoinLeaveColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_joinleave_color = new ColorButton( m_custom_colors, ID_JOINLEAVE, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_joinleave_color->SetColor( wxColour( 24, 255, 0 ) ); bJoinLeaveColorSizer->Add( m_joinleave_color, 0, wxALL, 5 ); m_joinleave_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Join/Leave" ), wxDefaultPosition, wxDefaultSize, 0 ); m_joinleave_label->Wrap( -1 ); bJoinLeaveColorSizer->Add( m_joinleave_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorsSizer1->Add( bJoinLeaveColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bMyColorSizer; bMyColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_my_color = new ColorButton( m_custom_colors, ID_MYMESS, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_my_color->SetColor( wxColour( 160, 160, 160 ) ); bMyColorSizer->Add( m_my_color, 0, wxALL, 5 ); m_my_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "My messages" ), wxDefaultPosition, wxDefaultSize, 0 ); m_my_label->Wrap( -1 ); bMyColorSizer->Add( m_my_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorsSizer1->Add( bMyColorSizer, 1, wxEXPAND, 5 ); bColorSizer->Add( bColorsSizer1, 1, wxEXPAND, 5 ); wxBoxSizer* bColorSizer2; bColorSizer2 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bServerColorSizer; bServerColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_server_color = new ColorButton( m_custom_colors, ID_SERVER, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_server_color->SetColor( wxColour( 255, 189, 0 ) ); bServerColorSizer->Add( m_server_color, 0, wxALL, 5 ); m_server_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Server" ), wxDefaultPosition, wxDefaultSize, 0 ); m_server_label->Wrap( -1 ); bServerColorSizer->Add( m_server_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorSizer2->Add( bServerColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bClientolorSizer; bClientolorSizer = new wxBoxSizer( wxHORIZONTAL ); m_client_color = new ColorButton( m_custom_colors, ID_CLIENT, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_client_color->SetColor( wxColour( 255, 189, 0 ) ); bClientolorSizer->Add( m_client_color, 0, wxALL, 5 ); m_client_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Client" ), wxDefaultPosition, wxDefaultSize, 0 ); m_client_label->Wrap( -1 ); bClientolorSizer->Add( m_client_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorSizer2->Add( bClientolorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bErrorColorSizer; bErrorColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_error_color = new ColorButton( m_custom_colors, ID_ERROR, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_error_color->SetColor( wxColour( 255, 0, 0 ) ); bErrorColorSizer->Add( m_error_color, 0, wxALL, 5 ); m_error_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Error" ), wxDefaultPosition, wxDefaultSize, 0 ); m_error_label->Wrap( -1 ); bErrorColorSizer->Add( m_error_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorSizer2->Add( bErrorColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bTSColorSizer; bTSColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_ts_color = new ColorButton( m_custom_colors, ID_TIMESTAMP, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_ts_color->SetColor( wxColour( 160, 160, 160 ) ); bTSColorSizer->Add( m_ts_color, 0, wxALL, 5 ); m_ts_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Timestamp" ), wxDefaultPosition, wxDefaultSize, 0 ); m_ts_label->Wrap( -1 ); bTSColorSizer->Add( m_ts_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorSizer2->Add( bTSColorSizer, 0, wxEXPAND, 5 ); wxBoxSizer* bNoteColorSizer; bNoteColorSizer = new wxBoxSizer( wxHORIZONTAL ); m_note_color = new ColorButton( m_custom_colors, ID_NOTIFICATION, wxBitmap(), wxDefaultPosition, wxSize( 20, 20 ), 0 ); m_note_color->SetColor( wxColour( 255, 191, 0 ) ); bNoteColorSizer->Add( m_note_color, 0, wxALL, 5 ); m_note_label = new wxStaticText( m_custom_colors, wxID_ANY, _( "Notification" ), wxDefaultPosition, wxDefaultSize, 0 ); m_note_label->Wrap( -1 ); bNoteColorSizer->Add( m_note_label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); bColorSizer2->Add( bNoteColorSizer, 0, wxEXPAND, 5 ); bColorSizer->Add( bColorSizer2, 1, wxEXPAND, 5 ); bCustomColorsSizer->Add( bColorSizer, 1, wxEXPAND, 5 ); m_test_text = new wxTextCtrl( m_custom_colors, wxID_ANY, _( "[19:35] ** Server ** Connected to Server.\n[22:30] <Dude> hi everyone\n[22:30] ** Dude2 joined the channel.\n[22:30] * Dude2 thinks his colors looks nice\n[22:45] <Dude> Dude2: orl?\n[22:46] <Dude2> But could be better, should tweak them some more...\n" ), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH ); bCustomColorsSizer->Add( m_test_text, 1, wxALL | wxEXPAND, 5 ); m_custom_colors->SetSizer( bCustomColorsSizer ); m_custom_colors->Layout(); bCustomColorsSizer->Fit( m_custom_colors ); bColorsVSizer->Add( m_custom_colors, 1, wxEXPAND | wxALL, 0 ); wxBoxSizer* bFontNameSizer; bFontNameSizer = new wxBoxSizer( wxHORIZONTAL ); m_font_label = new wxStaticText( this, wxID_ANY, _( "Font:" ), wxDefaultPosition, wxDefaultSize, 0 ); m_font_label->Wrap( -1 ); bFontNameSizer->Add( m_font_label, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_fontname = new wxStaticText( this, wxID_ANY, _( "default" ), wxDefaultPosition, wxDefaultSize, 0 ); m_fontname->Wrap( -1 ); bFontNameSizer->Add( m_fontname, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_select_font = new wxButton( this, ID_SELFONT, _( "Select..." ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); bFontNameSizer->Add( m_select_font, 0, wxALL, 5 ); bColorsVSizer->Add( bFontNameSizer, 0, wxEXPAND, 5 ); sbColorsSizer->Add( bColorsVSizer, 1, wxEXPAND, 5 ); bMainSizerV->Add( sbColorsSizer, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT | wxTOP, 5 ); wxStaticBoxSizer* sbBehaviorSizer; sbBehaviorSizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, _( "Behavior" ) ), wxHORIZONTAL ); m_irc_colors = new wxCheckBox( this, wxID_ANY, _( "Enable Irc colors in chat messages" ), wxDefaultPosition, wxDefaultSize, 0 ); m_irc_colors->SetValue( sett().GetUseIrcColors() ); sbBehaviorSizer->Add( m_irc_colors, 0, wxALL, 5 ); #ifndef DISABLE_SOUND m_play_sounds = new wxCheckBox( this, ID_PLAY_SOUNDS, _( "Play notification sounds" ), wxDefaultPosition, wxDefaultSize, 0 ); m_play_sounds->SetValue( sett().GetChatPMSoundNotificationEnabled() ); sbBehaviorSizer->Add( m_play_sounds, 0, wxALL, 5 ); #endif m_broadcast_check = new wxCheckBox( this, wxID_ANY, _( "Copy server messages in current channel" ), wxDefaultPosition, wxDefaultSize, 0 ); m_broadcast_check->SetValue( sett().GetBroadcastEverywhere() ); sbBehaviorSizer->Add( m_broadcast_check, 0, wxALL, 5 ); bMainSizerV->Add( sbBehaviorSizer, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5 ); wxBoxSizer* bBotomSizer; bBotomSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticBoxSizer* sbChatLogSizer; wxStaticBox* sbChatLog = new wxStaticBox( this, -1, _( "Chat logs" ) ); sbChatLogSizer = new wxStaticBoxSizer( sbChatLog, wxVERTICAL ); m_save_logs = new wxCheckBox( this, wxID_ANY, _( "Save chat logs" ), wxDefaultPosition, wxDefaultSize, 0 ); m_save_logs->SetValue( sett().GetChatLogEnable() ); sbChatLogSizer->Add( m_save_logs, 0, wxALL, 5 ); wxBoxSizer* m_num_lines_sizer = new wxBoxSizer( wxHORIZONTAL ); m_num_lines = new wxSpinCtrl( this, wxID_ANY ); m_num_lines_lbl = new wxStaticText( this, wxID_ANY, _( "approx. number of lines loaded from log into chat" ), wxDefaultPosition, wxDefaultSize, 0 ); m_num_lines_sizer->Add( m_num_lines ); m_num_lines_sizer->Add( m_num_lines_lbl, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5 ); sbChatLogSizer->Add( m_num_lines_sizer, 0, wxALL, 5 ); bBotomSizer->Add( sbChatLogSizer, 1, wxEXPAND | wxRIGHT, 5 ); wxStaticBoxSizer* sbHighlightSizer; sbHighlightSizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, _( "Highlight words" ) ), wxVERTICAL ); m_hilight_words_label = new wxStaticText( this, wxID_ANY, _( "Words to highlight in chat:" ), wxDefaultPosition, wxDefaultSize, 0 ); m_hilight_words_label->Wrap( -1 ); sbHighlightSizer->Add( m_hilight_words_label, 0, wxALL, 5 ); sbHighlightSizer->Add( 0, 0, 1, wxEXPAND, 5 ); m_highlight_words = new wxTextCtrl( this, ID_HIWORDS, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_highlight_words->SetToolTip ( TE( _( "enter a ; seperated list" ) ) ); sbHighlightSizer->Add( m_highlight_words, 0, wxALL | wxEXPAND, 5 ); m_highlight_req = new wxCheckBox( this, ID_HL_REQ, _( "Additionally play sound/flash titlebar " ), wxDefaultPosition, wxDefaultSize, 0 ); sbHighlightSizer->Add( m_highlight_req , 0, wxALL | wxEXPAND, 5 ); bBotomSizer->Add( sbHighlightSizer, 1, wxEXPAND, 5 ); bMainSizerV->Add( bBotomSizer, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5 ); bMainSizerV->Add( 0, 0, 1, wxEXPAND | wxALL, 5 ); SetScrollRate( SCROLL_RATE, SCROLL_RATE ); SetSizer( bMainSizerV ); Layout(); if ( sett().IsPortableMode() ) sbChatLog->Disable(); DoRestore(); UpdateTextSample(); }
HostBattleDialog::HostBattleDialog( wxWindow* parent ) : wxDialog( parent, -1, _( "Host new battle" ), wxDefaultPosition, wxSize( 410, 441 ), wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE ), WindowAttributesPickle( _T("hostbattledialog"), this, wxSize( 410, 441 ) ), m_last_relayhost( sett().GetLastRelayedHost() ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxFlexGridSizer* topsizer = new wxFlexGridSizer( 2, 0, 10); // topsizer->AddGrowableCol( 1, 1 ); SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* m_main_sizer; m_main_sizer = new wxBoxSizer( wxVERTICAL ); m_desc_lbl = new wxStaticText( this, wxID_ANY, _( "Description" ), wxDefaultPosition, wxDefaultSize, 0 ); m_desc_lbl->Wrap( -1 ); topsizer->Add( m_desc_lbl, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); // wxBoxSizer* desc_sizer = new wxBoxSizer( wxVERTICAL ); m_desc_text = new wxTextCtrl( this, wxID_ANY, sett().GetLastHostDescription(), wxDefaultPosition, wxDefaultSize, 0 ); m_desc_text->SetToolTip( TE( _( "A short description of the game, this will show up in the battle list." ) ) ); topsizer ->Add( m_desc_text, 1, wxALL | wxEXPAND, 5 ); m_desc_check = new wxCheckBox( this, wxID_ANY, _( "Autopaste description" ) ); m_desc_check->SetValue( sett().GetBattleLastAutoAnnounceDescription() ); m_desc_check->SetToolTip( TE( _( "Automatically write the battle description when a user joins." ) ) ); topsizer->AddStretchSpacer(); topsizer->Add( m_desc_check, 0, wxLEFT, 5 ); // topsizer->Add( desc_sizer , 0, wxEXPAND | wxALL, 0 ); m_mod_lbl = new wxStaticText( this, wxID_ANY, _( "Mod" ), wxDefaultPosition, wxDefaultSize, 0 ); m_mod_lbl->Wrap( -1 ); topsizer->Add( m_mod_lbl, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_mod_picChoices; wxBoxSizer* mod_choice_button_sizer = new wxBoxSizer( wxHORIZONTAL ); m_mod_pic = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_mod_picChoices, 0 ); m_mod_pic->SetToolTip( TE( _( "Select the mod to play with." ) ) ); mod_choice_button_sizer->Add( m_mod_pic, 0, wxALL , 5 ); wxBitmap mp = charArr2wxBitmap( arrow_refresh_png, sizeof( arrow_refresh_png ) ); m_refresh_btn = new wxBitmapButton( this, BTN_REFRESH, mp ); mod_choice_button_sizer->Add( m_refresh_btn, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); topsizer->Add( mod_choice_button_sizer, 0, wxEXPAND|wxALL ,1 ); m_pwd_lbl = new wxStaticText( this, wxID_ANY, _( "Password\n(no spaces)" ), wxDefaultPosition, wxDefaultSize, 0 ); m_pwd_lbl->Wrap( -1 ); topsizer->Add( m_pwd_lbl, 1, wxALL| wxALIGN_CENTER_VERTICAL, 5 ); m_pwd_text = new wxTextCtrl( this, wxID_ANY, sett().GetLastHostPassword(), wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); m_pwd_text->SetToolTip( TE( _( "Password needed to join game. Keep empty for no password" ) ) ); topsizer->Add( m_pwd_text, 1, wxALL| wxEXPAND, 5 ); m_port_lbl = new wxStaticText( this, wxID_ANY, _( "Port" ), wxDefaultPosition, wxDefaultSize, 0 ); m_port_lbl->Wrap( -1 ); topsizer->Add( m_port_lbl, 1, wxALL| wxALIGN_CENTER_VERTICAL, 5 ); m_port_text = new wxTextCtrl( this, wxID_ANY, wxString::Format( _T( "%d" ), sett().GetLastHostPort() ), wxDefaultPosition, wxDefaultSize, 0 ); m_port_text->SetToolTip( TE( _( "UDP port to host game on. Default is 8452." ) ) ); topsizer->Add( m_port_text, 1, wxALL| wxEXPAND, 5 ); // m_port_test_check = new wxCheckBox( this, wxID_ANY, _("Test firewall"), wxDefaultPosition, wxDefaultSize, 0 ); // m_port_test_check->SetValue( sett().GetTestHostPort() ); // m_port_sizer->Add( m_port_test_check, 1, wxALL|wxEXPAND, 5 ); m_relayed_host_check = new wxCheckBox( this, CHK_USE_RELAY, _( "Use relayhost" ), wxDefaultPosition, wxDefaultSize, 0 ); m_relayed_host_check->SetToolTip( TE( _( "host and control game on remote server, helps if you have trouble hosting" ) ) ); m_relayed_host_pick = new wxButton( this, PICK_RELAYHOST, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); m_relayed_host_pick->SetLabel( m_last_relayhost.IsEmpty() ? _T("automatic") : m_last_relayhost ); m_relayhost_list = new wxMenu(); wxMenuItem* automatic_pick = new wxMenuItem( m_relayhost_list, AUTO_PICK_HOST, _("Chose automatically"), _("Randomly picks an available one"), wxITEM_RADIO ); m_relayhost_list->Append( automatic_pick ); automatic_pick->Check( m_last_relayhost.IsEmpty() ); m_relayhost_list->AppendSeparator(); wxMenuItem* manual_pick_relay = new wxMenuItem( m_relayhost_list, MANUAL_PICK_HOST, _("Manually enter the manager name"), _("You'll get prompted for the exact manager name"), wxITEM_RADIO ); m_relayhost_list->Append( manual_pick_relay ); m_relayhost_list->AppendSeparator(); m_relayhost_array_list = serverSelector().GetServer().GetRelayHostList(); for ( unsigned int i = 0; i < m_relayhost_array_list.GetCount(); i++ ) { wxMenuItem* newitem = new wxMenuItem( m_relayhost_list, MANUAL_PICK_HOST + 1 + i, m_relayhost_array_list[i], _T("") , wxITEM_RADIO ); m_relayhost_list->Append( newitem ); newitem->Check( m_last_relayhost == m_relayhost_array_list[i] ); } m_relayed_host_check->SetValue( sett().GetLastHostRelayedMode() ); m_relayed_host_pick->Show( m_relayed_host_check->IsChecked() ); topsizer->Add( m_relayed_host_check, 1, wxALL | wxEXPAND, 5 ); topsizer->Add( m_relayed_host_pick, 0, wxALL | wxEXPAND, 5); m_main_sizer->Add( topsizer, 0, wxEXPAND, 0 ); wxStaticBoxSizer* m_players_box; m_players_box = new wxStaticBoxSizer( new wxStaticBox( this, -1, _( "Number of players" ) ), wxVERTICAL ); m_players_box->SetMinSize( wxSize( -1, 60 ) ); m_players_slide = new wxSlider( this, wxID_ANY, sett().GetLastHostPlayerNum(), 2, SPRING_MAX_USERS, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS | wxSL_BOTH | wxSL_HORIZONTAL | wxSL_LABELS ); m_players_slide->SetToolTip( TE( _( "The maximum number of players to allow in the battle." ) ) ); m_players_box->Add( m_players_slide, 0, wxALL | wxEXPAND, 5 ); m_main_sizer->Add( m_players_box, 0, wxALL | wxEXPAND, 5 ); wxBoxSizer* m_pl_nat_sizer; m_pl_nat_sizer = new wxBoxSizer( wxHORIZONTAL ); wxString m_nat_radiosChoices[] = { _( "None" ), _( "Hole punching" )/*, _("Fixed source ports")*/ }; int m_nat_radiosNChoices = sizeof( m_nat_radiosChoices ) / sizeof( wxString ); m_nat_radios = new wxRadioBox( this, CHOSE_NAT, _( "NAT traversal" ), wxDefaultPosition, wxDefaultSize, m_nat_radiosNChoices, m_nat_radiosChoices, 1, wxRA_SPECIFY_COLS ); m_nat_radios->SetSelection( sett().GetLastHostNATSetting() ); //m_nat_radios->Enable( false ); m_nat_radios->Enable( true ); m_nat_radios->SetToolTip( TE( _( "NAT traversal to use." ) ) ); m_pl_nat_sizer->Add( m_nat_radios, 1, wxALL | wxEXPAND, 5 ); wxStaticBoxSizer* m_rank_box; m_rank_box = new wxStaticBoxSizer( new wxStaticBox( this, -1, _( "Rank requirement" ) ), wxVERTICAL ); wxArrayString rankFilterChoices; rankFilterChoices.Add(_("At least")); rankFilterChoices.Add(_("No greater than")); m_rank_direction = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, rankFilterChoices, 0 ); m_rank_direction->SetToolTip( TE( _( "Select the type of rank enforcement." ) ) ); m_rank_box->Add(m_rank_direction); wxFlexGridSizer* m_rank_sizer; m_rank_sizer = new wxFlexGridSizer( 2, 6, 0, 0 ); m_rank_sizer->SetFlexibleDirection( wxBOTH ); m_rank0_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_rank_sizer->Add( m_rank0_radio, 0, wxALL, 5 ); m_rank0_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank0_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank0_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_rank1_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank1_radio, 0, wxALL, 5 ); m_rank1_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank1_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank1_img, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL | wxALL, 2 ); m_rank2_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank2_radio, 0, wxALL, 5 ); m_rank2_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank2_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank2_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_rank3_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank3_radio, 0, wxALL, 5 ); m_rank3_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank3_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank3_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_rank4_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank4_radio, 0, wxALL, 5 ); m_rank4_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank4_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank4_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_rank5_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank5_radio, 0, wxALL, 5 ); m_rank5_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank5_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank5_img, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL, 5 ); m_rank6_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank6_radio, 0, wxALL, 5 ); m_rank6_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank6_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank6_img, 0, wxALL, 5 ); m_rank7_radio = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_rank_sizer->Add( m_rank7_radio, 0, wxALL, 5 ); m_rank7_img = new wxStaticBitmap( this, wxID_ANY, wxBitmap( rank7_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 ); m_rank_sizer->Add( m_rank7_img, 0, wxALL, 5 ); m_rank_box->Add( m_rank_sizer, 1, wxEXPAND, 5 ); m_pl_nat_sizer->Add( m_rank_box, 1, wxALL | wxEXPAND, 5 ); m_main_sizer->Add( m_pl_nat_sizer, 0, wxEXPAND, 5 ); m_main_sizer->Add( 0, 0, 1, wxEXPAND, 0 ); m_buttons_sep = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_main_sizer->Add( m_buttons_sep, 0, wxALL | wxEXPAND, 2 ); wxBoxSizer* m_buttons_sizer; m_buttons_sizer = new wxBoxSizer( wxHORIZONTAL ); m_cancel_btn = new wxButton( this, HOST_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttons_sizer->Add( 0, 0, 1, wxEXPAND, 0 ); m_buttons_sizer->Add( m_cancel_btn, 0, wxALL, 5 ); m_host_btn = new wxButton( this, HOST_OK, _( "Host" ), wxDefaultPosition, wxDefaultSize, 0 ); m_host_btn->SetToolTip( TE( _( "Start hosting the battle." ) ) ); m_buttons_sizer->Add( m_host_btn, 0, wxALL, 5 ); m_main_sizer->Add( m_buttons_sizer, 0, wxEXPAND, 5 ); this->SetSizer( m_main_sizer ); this->Layout(); m_host_btn->SetFocus(); ReloadModList(); }
void ImageComparator::Compare( QString const&filepath, QImage const &img ) { QSettings sett(SettingsValues::filename(),QSettings::IniFormat); sett.beginGroup(SettingsValues::comparatorGroupName()); QString goldenPath = sett.value(SettingsValues::goldenPathValueName(), SettingsValues::goldenPathDefault()).toString() + "/"; QString diffPath = sett.value(SettingsValues::diffPathValueName(), SettingsValues::diffPathDefault()).toString() + "/"; sett.endGroup(); QFileInfo info(filepath); QString const samplePath = goldenPath + info.fileName(); if(!QFile::exists(samplePath)) { QMessageBox::critical(NULL, "Error!", QString("Golden image \"%1\" does not exist!").arg(samplePath)); return; } QImage sample(samplePath); sample = sample.convertToFormat(QImage::Format_ARGB32_Premultiplied); if(sample.isNull()) { QMessageBox::critical(NULL, "Error!", QString("Could not open file \"%1\"!").arg(samplePath)); return; } if(sample.size() != img.size()) { QMessageBox::critical(NULL, "Error!", QString("Sample and current images have different sizes!")); return; } unsigned long long accum = 0; int sx = sample.width(); int sy = sample.height(); int bpl = sample.bytesPerLine(); QImage diffImg(sample.size(), QImage::Format_ARGB32); for (int y = 0; y < sy; ++y) { for (int x = 0; x < sx; ++x) { for (int c = 0; c < 3; ++c) { unsigned idx = y * bpl + (x << 2) + c; uchar diff = abs((int)sample.constBits()[idx] - (int)img.constBits()[idx]); diffImg.bits()[idx] = diff; accum += diff; } diffImg.bits()[y * bpl + (x << 2) + 3] = sample.bits()[y * bpl + (x << 2) + 3]; } } QString const diffName = diffPath + info.fileName(); QDir diffDir(diffPath); if(!diffDir.exists(diffPath)) { if(!QDir(diffPath + "/..").mkpath(diffDir.dirName())) { QMessageBox::critical(NULL, "Error!", QString("Could not create diff folder \"%1\"!").arg(diffPath)); return; } } if(!diffImg.save(diffName, info.suffix().toAscii().data())) { QMessageBox::critical(NULL, "Error!", QString("Could not save the difference image \"%1\"!").arg(diffName)); return; } double diff = ((double)accum / (img.size().width() * img.size().height() * 3) * 100.0 / 255.0); QDialog dlg; Ui::ImgDifferenceDialog ui; ui.setupUi(&dlg); dlg.setModal(true); dlg.setSizeGripEnabled(false); dlg.layout()->setSizeConstraint( QLayout::SetFixedSize ); ui.label->setText(QString("The difference is: %1").arg(diff, 0, 'f', 2)); QPixmap pxmp = QPixmap::fromImage(diffImg); QRect r = ui.frame->frameRect(); if(r.width() < pxmp.width()) pxmp = pxmp.scaledToWidth(r.width(), Qt::SmoothTransformation); if(r.height() < pxmp.height()) pxmp = pxmp.scaledToHeight(r.height(), Qt::SmoothTransformation); //ui.differenceLabel->resize(pxmp.size()); ui.differenceLabel->setPixmap(pxmp); dlg.exec(); }
//! @brief Initializes the application. //! //! It will open the main window and connect default to server or open the connect window. bool SpringLobbyApp::OnInit() { wxSetEnv( _T("UBUNTU_MENUPROXY"), _T("0") ); //this triggers the Cli Parser amongst other stuff if (!wxApp::OnInit()) return false; SetAppName( m_appname ); if (!m_crash_handle_disable) { #if wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions( true ); #endif #if defined(__WXMSW__) && defined(ENABLE_DEBUG_REPORT) //this undocumented function acts as a workaround for the dysfunctional // wxUSE_ON_FATAL_EXCEPTION on msw when mingw is used (or any other non SEH-capable compiler ) SetUnhandledExceptionFilter(filter); #endif } //initialize all loggers, we'll use the returned pointer to set correct parent window later wxLogChain* logchain = 0; wxLogWindow *loggerwin = InitializeLoggingTargets( 0, m_log_console, m_log_file_path, m_log_window_show, !m_crash_handle_disable, m_log_verbosity, logchain ); //this needs to called _before_ mainwindow instance is created wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); wxSocketBase::Initialize(); #ifdef __WXMSW__ wxString path = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + wxFileName::GetPathSeparator() + _T("locale"); #else #if defined(LOCALE_INSTALL_DIR) wxString path ( _T(LOCALE_INSTALL_DIR) ); #else // use a dummy name here, we're only interested in the base path wxString path = wxStandardPaths::Get().GetLocalizedResourcesDir(_T("noneWH"),wxStandardPaths::ResourceCat_Messages); path = path.Left( path.First(_T("noneWH") ) ); #endif #endif m_translationhelper = new wxTranslationHelper( *( (wxApp*)this ), path ); m_translationhelper->Load(); if ( !wxDirExists( GetConfigfileDir() ) ) wxMkdir( GetConfigfileDir() ); #ifdef __WXMSW__ sett().SetSearchSpringOnlyInSLPath( sett().GetSearchSpringOnlyInSLPath() ); #endif sett().SetSpringBinary( sett().GetCurrentUsedSpringIndex(), sett().GetCurrentUsedSpringBinary() ); sett().SetUnitSync( sett().GetCurrentUsedSpringIndex(), sett().GetCurrentUsedUnitSync() ); if ( sett().DoResetPerspectives() ) { //we do this early on and reset the config var a little later so we can save a def. perps once mw is created sett().RemoveLayouts(); sett().SetDoResetPerspectives( false ); ui().mw().SavePerspectives( _T("SpringLobby-default") ); } sett().RefreshSpringVersionList(); //this should take off the firstload time considerably *ie nil it :P ) mapSelectDialog(); if ( !m_customizer_archive_name.IsEmpty() ) {//this needsto happen before usync load sett().SetForcedSpringConfigFilePath( GetCustomizedEngineConfigFilePath() ); } //unitsync first load, NEEDS to be blocking const bool usync_loaded = usync().ReloadUnitSyncLib(); if ( !sett().IsFirstRun() && !usync_loaded ) { customMessageBox( SL_MAIN_ICON, _("Please check that the file given in Preferences->Spring is a proper, readable unitsync library"), _("Coulnd't load required unitsync library"), wxOK ); } #ifndef DISABLE_SOUND //sound sources/buffer init sound(); #endif CacheAndSettingsSetup(); if ( !m_customizer_archive_name.IsEmpty() ) { if ( SLcustomizations().Init( m_customizer_archive_name ) ) { ui().mw().SetIcons( SLcustomizations().GetAppIconBundle() ); } else { customMessageBox( SL_MAIN_ICON, _("Couldn't load customizations for ") + m_customizer_archive_name + _("\nPlease check that that is the correct name, passed in qoutation"), _("Fatal error"), wxOK ); // wxLogError( _("Couldn't load customizations for ") + m_customizer_archive_name + _("\nPlease check that that is the correct name, passed in qoutation"), _("Fatal error") ); exit( OnExit() );//for some twisted reason returning false here does not terminate the app } } notificationManager(); //needs to be initialized too ui().ShowMainWindow(); SetTopWindow( &ui().mw() ); if ( sett().DoResetPerspectives() ) { //now that mainwindow is shown, we can save what is the default layout and remove the flag to reset sett().SetDoResetPerspectives( false ); ui().mw().SavePerspectives( _T("SpringLobby-default") ); } //interim fix for resize crashes on metacity and kwin #ifdef __WXMSW__ mapSelectDialog().Reparent( &ui().mw() ); #endif ui().FirstRunWelcome(); m_timer->Start( TIMER_INTERVAL ); ui().mw().SetLogWin( loggerwin, logchain ); #ifndef NO_TORRENT_SYSTEM plasmaInterface(); // plasmaInterface().InitResourceList(); // plasmaInterface().FetchResourceList(); #endif return true; }
int main(int argc, char **argv) { QApplication a(argc, argv); a.setApplicationName("QFaktury"); a.setOrganizationName("www.e-linux.pl"); DatabaseManager test; if (test.openDB()) qDebug() << "openned"; else qDebug() << "failed to open"; qDebug() << test.getTables(); test.createTables(); // multilangage a.installTranslator(sett().getTranslation()); QResource::registerResource("qfaktury.rcc"); // using the rcc file so it's more portable // Q_INIT_RESOURCE(qfaktury); QRect screen = QApplication::desktop()->screenGeometry(); QSplashScreen splash(QPixmap(":/res/icons/splash.png")); MainWindow w(0); w.move(screen.center() - QPoint(w.width() / 2, w.height() / 2)); w.show(); #if 1 old_MainWindow old_w(0); old_w.move(screen.center() - QPoint(old_w.width() / 2, old_w.height() / 2)); old_w.show(); #endif a.connect(&w, SIGNAL(closingWindow), &old_w, SLOT(close)); //if (a.arguments().contains("--nosplash")) { /*} else { splash.show(); a.processEvents(); QTimer::singleShot(5000, &w, SLOT(show())); QTimer::singleShot(4960, &splash, SLOT(close())); }*/ a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); QIcon icon; icon.addPixmap(QPixmap(":/res/icons/qfaktury_48.png"), QIcon::Normal, QIcon::Off); a.setWindowIcon(icon); return a.exec(); }
wxString ChatLog::GetCurrentLogfilePath() const { return sett().GetChatLogLoc() + wxFileName::GetPathSeparator() + m_server + wxFileName::GetPathSeparator() + m_room + _T( ".txt" ); }
void SettingsManager::ReloadFromPath(const std::string& path, bool merge) { if (path.empty()) { return; } if (!merge) { clusters_.clear(); connections_.clear(); recent_connections_.clear(); } QString inip; common::ConvertFromString(common::file_system::prepare_path(path), &inip); QSettings settings(inip, QSettings::IniFormat); DCHECK(settings.status() == QSettings::NoError); cur_style_ = settings.value(STYLE, common::qt::gui::defStyle).toString(); send_statistic_ = settings.value(SEND_STATISTIC, true).toBool(); accepted_eula_ = settings.value(ACCEPTED_EULA, false).toBool(); QFont font = default_font(); cur_font_ = settings.value(FONT, font).value<QFont>(); cur_language_ = settings.value(LANGUAGE, common::qt::translations::defLanguage).toString(); int view = settings.value(VIEW, kText).toInt(); views_ = static_cast<supportedViews>(view); QList<QVariant> clusters = settings.value(CLUSTERS).toList(); for (const auto& cluster : clusters) { QString string = cluster.toString(); std::string encoded = common::ConvertToString(string); std::string raw = common::utils::base64::decode64(encoded); IClusterSettingsBaseSPtr sett(ClusterConnectionSettingsFactory::GetInstance().CreateFromString(raw)); if (sett) { clusters_.push_back(sett); } } QList<QVariant> sentinels = settings.value(SENTINELS).toList(); for (const auto& sentinel : sentinels) { QString string = sentinel.toString(); std::string encoded = common::ConvertToString(string); std::string raw = common::utils::base64::decode64(encoded); ISentinelSettingsBaseSPtr sett(SentinelConnectionSettingsFactory::GetInstance().CreateFromString(raw)); if (sett) { sentinels_.push_back(sett); } } QList<QVariant> connections = settings.value(CONNECTIONS).toList(); for (const auto& connection : connections) { QString string = connection.toString(); std::string encoded = common::ConvertToString(string); std::string raw = common::utils::base64::decode64(encoded); IConnectionSettingsBaseSPtr sett(ConnectionSettingsFactory::GetInstance().CreateFromString(raw)); if (sett) { connections_.push_back(sett); } } QStringList rconnections = settings.value(RCONNECTIONS).toStringList(); for (const auto& rconnection : rconnections) { std::string encoded = common::ConvertToString(rconnection); std::string raw = common::utils::base64::decode64(encoded); QString qdata; if (common::ConvertFromString(raw, &qdata) && !qdata.isEmpty()) { recent_connections_.push_back(qdata); } } std::string dir_path = GetSettingsDirPath(); QString qdir; common::ConvertFromString(dir_path, &qdir); logging_dir_ = settings.value(LOGGINGDIR, qdir).toString(); auto_check_updates_ = settings.value(CHECKUPDATES, true).toBool(); auto_completion_ = settings.value(AUTOCOMPLETION, true).toBool(); auto_open_console_ = settings.value(AUTOOPENCONSOLE, true).toBool(); auto_connect_db_ = settings.value(AUTOCONNECTDB, true).toBool(); fast_view_keys_ = settings.value(FASTVIEWKEYS, true).toBool(); window_settings_ = settings.value(WINDOW_SETTINGS, QByteArray()).toByteArray(); QString qpython_path; std::string python_path; if (common::file_system::find_file_in_path(PYTHON_FILE_NAME, &python_path) && common::ConvertFromString(python_path, &qpython_path)) { } python_path_ = settings.value(PYTHON_PATH, qpython_path).toString(); config_version_ = settings.value(CONFIG_VERSION, PROJECT_VERSION_NUMBER).toUInt(); }
BattleListFilter::BattleListFilter( wxWindow* parent, wxWindowID id, BattleListTab* parentBattleListTab, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ), m_parent_battlelisttab( parentBattleListTab ), m_filter_host_edit( 0 ), m_filter_host_expression( 0 ), m_filter_description_edit( 0 ), m_filter_description_expression( 0 ), m_filter_map_edit( 0 ), m_filter_map_expression( 0 ), m_filter_mod_edit( 0 ), m_filter_mod_expression( 0 ), m_filter_highlighted( 0 ) { GetAui().manager->AddPane( this, wxLEFT, _T( "battlelistfilter" ) ); BattleListFilterValues f_values = sett().GetBattleFilterValues( sett().GetLastBattleFilterProfileName() ); wxBoxSizer* m_filter_sizer; m_filter_sizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* m_filter_body_sizer; m_filter_body_sizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, wxEmptyString ), wxVERTICAL ); wxBoxSizer* m_filter_body_row1_sizer; m_filter_body_row1_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* m_filter_column_1; m_filter_column_1 = new wxBoxSizer( wxHORIZONTAL ); m_filter_host_text = new wxStaticText( this, wxID_ANY, _( "Host:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_host_text->Wrap( -1 ); m_filter_host_text->SetMinSize( wxSize( 90, -1 ) ); m_filter_column_1->Add( m_filter_host_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_host_edit = new wxTextCtrl( this, BATTLE_FILTER_HOST_EDIT, f_values.host, wxDefaultPosition, wxSize( -1, -1 ), 0 | wxSIMPLE_BORDER ); m_filter_host_edit->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); m_filter_host_edit->SetMinSize( wxSize( 220, -1 ) ); m_filter_host_expression = new wxRegEx( m_filter_host_edit->GetValue(), wxRE_ICASE ); m_filter_column_1->Add( m_filter_host_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row1_sizer->Add( m_filter_column_1, 0, wxEXPAND, 5 ); wxBoxSizer* m_filter_status_sizer1; m_filter_status_sizer1 = new wxBoxSizer( wxHORIZONTAL ); m_filter_status_text = new wxStaticText( this, wxID_ANY, _( "Status:" ), wxPoint( -1, -1 ), wxDefaultSize, 0 ); m_filter_status_text->Wrap( -1 ); m_filter_status_sizer1->Add( m_filter_status_text, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_status_locked = new wxCheckBox( this, BATTLE_FILTER_LOCKED, _( "Locked" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_status_locked->SetValue( f_values.status_locked ); m_filter_status_sizer1->Add( m_filter_status_locked, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 ); m_filter_status_pass = new wxCheckBox( this, BATTLE_FILTER_PASSWORDED, _( "Passworded" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_status_pass->SetValue( f_values.status_passworded ); m_filter_status_sizer1->Add( m_filter_status_pass, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 ); m_filter_highlighted = new wxCheckBox( this, BATTLE_FILTER_HIGHLIGHTED , _( "Highlighted only" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_highlighted->SetValue( f_values.highlighted_only ); m_filter_status_sizer1->Add( m_filter_highlighted, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 ); m_filter_body_row1_sizer->Add( m_filter_status_sizer1, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_rank_sizer; m_filter_rank_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_rank_text = new wxStaticText( this, wxID_ANY, _( "Rank Limit:" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_rank_text->Wrap( -1 ); m_filter_rank_sizer->Add( m_filter_rank_text, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_rank_button = new wxButton( this, BATTLE_FILTER_RANK_BUTTON, f_values.rank_mode, wxDefaultPosition, wxSize( 25, 25 ), 0 ); m_filter_rank_sizer->Add( m_filter_rank_button, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_filter_rank_choiceChoices; m_filter_rank_choiceChoices.Add( _T( "All" ) ); m_filter_rank_choiceChoices.Add( _T( "1" ) ); m_filter_rank_choiceChoices.Add( _T( "2" ) ); m_filter_rank_choiceChoices.Add( _T( "3" ) ); m_filter_rank_choiceChoices.Add( _T( "4" ) ); m_filter_rank_choiceChoices.Add( _T( "5" ) ); m_filter_rank_choiceChoices.Add( _T( "6" ) ); m_filter_rank_choiceChoices.Add( _T( "7" ) ); m_filter_rank_choice = new wxChoice( this, BATTLE_FILTER_RANK_CHOICE, wxDefaultPosition, wxSize( -1, -1 ), m_filter_rank_choiceChoices, wxSIMPLE_BORDER ); m_filter_rank_choice->SetSelection( GetIntParam( f_values.rank ) ); m_filter_rank_choice->SetMinSize( wxSize( 40, -1 ) ); m_filter_rank_sizer->Add( m_filter_rank_choice, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row1_sizer->Add( m_filter_rank_sizer, 0, wxEXPAND, 5 ); m_filter_body_sizer->Add( m_filter_body_row1_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_body_row2_sizer; m_filter_body_row2_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* m_filter_description_sizer; m_filter_description_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_description_text = new wxStaticText( this, wxID_ANY, _( "Description:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_description_text->Wrap( -1 ); m_filter_description_text->SetMinSize( wxSize( 90, -1 ) ); m_filter_description_sizer->Add( m_filter_description_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_description_edit = new wxTextCtrl( this, BATTLE_FILTER_DESCRIPTION_EDIT, f_values.description, wxDefaultPosition, wxSize( -1, -1 ), 0 | wxSIMPLE_BORDER ); m_filter_description_edit->SetMinSize( wxSize( 220, -1 ) ); m_filter_description_expression = new wxRegEx( m_filter_description_edit->GetValue(), wxRE_ICASE ); m_filter_description_sizer->Add( m_filter_description_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row2_sizer->Add( m_filter_description_sizer, 0, wxEXPAND, 5 ); wxBoxSizer* m_filter_sizer2; m_filter_sizer2 = new wxBoxSizer( wxHORIZONTAL ); m_filter_status_text1 = new wxStaticText( this, wxID_ANY, _( "Status:" ), wxPoint( -1, -1 ), wxDefaultSize, 0 ); m_filter_status_text1->Wrap( -1 ); m_filter_sizer2->Add( m_filter_status_text1, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_status_start = new wxCheckBox( this, BATTLE_FILTER_STARTED, _( "Started" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_status_start->SetValue( f_values.status_start ); m_filter_sizer2->Add( m_filter_status_start, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 ); m_filter_status_full = new wxCheckBox( this, BATTLE_FILTER_FULL, _( "Full" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_status_full->SetValue( f_values.status_full ); m_filter_sizer2->Add( m_filter_status_full, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 ); m_filter_status_open = new wxCheckBox( this, BATTLE_FILTER_OPEN, _( "Open" ), wxDefaultPosition, wxDefaultSize, 0 ); m_filter_status_open->SetValue( f_values.status_open ); m_filter_sizer2->Add( m_filter_status_open, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 ); m_filter_body_row2_sizer->Add( m_filter_sizer2, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_player_sizer; m_filter_player_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_player_text = new wxStaticText( this, wxID_ANY, _( "Player:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_player_text->Wrap( -1 ); m_filter_player_sizer->Add( m_filter_player_text, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_player_button = new wxButton( this, BATTLE_FILTER_PLAYER_BUTTON, f_values.player_mode, wxDefaultPosition, wxSize( 25, 25 ), 0 ); m_filter_player_sizer->Add( m_filter_player_button, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_filter_player_choiceChoices; m_filter_player_choiceChoices.Add( _( "All" ) ); for ( wxLongLong i = 0;i <= 32;i++ ) m_filter_player_choiceChoices.Add( i.ToString() ); m_filter_player_choice = new wxChoice( this, BATTLE_FILTER_PLAYER_CHOICE, wxDefaultPosition, wxSize( -1, -1 ), m_filter_player_choiceChoices, 0 ); m_filter_player_choice->SetSelection( GetIntParam( f_values.player_num ) ); m_filter_player_choice->SetMinSize( wxSize( 40, -1 ) ); m_filter_player_sizer->Add( m_filter_player_choice, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row2_sizer->Add( m_filter_player_sizer, 0, wxEXPAND | wxLEFT, 5 ); m_filter_body_sizer->Add( m_filter_body_row2_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_body_row3_sizer; m_filter_body_row3_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* m_filter_map_sizer; m_filter_map_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_map_text = new wxStaticText( this, wxID_ANY, _( "Map:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_map_text->Wrap( -1 ); m_filter_map_text->SetMinSize( wxSize( 90, -1 ) ); m_filter_map_sizer->Add( m_filter_map_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_map_edit = new wxTextCtrl( this, BATTLE_FILTER_MAP_EDIT, f_values.map, wxDefaultPosition, wxSize( -1, -1 ), 0 | wxSIMPLE_BORDER ); m_filter_map_edit->SetMinSize( wxSize( 140, -1 ) ); m_filter_map_expression = new wxRegEx( m_filter_map_edit->GetValue(), wxRE_ICASE ); m_filter_map_sizer->Add( m_filter_map_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row3_sizer->Add( m_filter_map_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_only_map_sizer; m_filter_only_map_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_map_show = new wxCheckBox( this, BATTLE_FILTER_MAP_SHOW, _( "Only maps i have" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_map_show->SetValue( f_values.map_show ); m_filter_map_show->SetMinSize( wxSize( 140, -1 ) ); m_filter_only_map_sizer->Add( m_filter_map_show, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row3_sizer->Add( m_filter_only_map_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_maxplayer_sizer; m_filter_maxplayer_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_maxplayer_text = new wxStaticText( this, wxID_ANY, _( "Max.Player:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_maxplayer_text->Wrap( -1 ); m_filter_maxplayer_sizer->Add( m_filter_maxplayer_text, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_maxplayer_button = new wxButton( this, BATTLE_FILTER_MAXPLAYER_BUTTON, f_values.maxplayer_mode, wxDefaultPosition, wxSize( 25, 25 ), 0 ); m_filter_maxplayer_sizer->Add( m_filter_maxplayer_button, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_filter_maxplayer_choiceChoices; m_filter_maxplayer_choiceChoices.Add( _T( "All" ) ); for ( wxLongLong i = 0;i <= 32;i++ ) m_filter_maxplayer_choiceChoices.Add( i.ToString() ); m_filter_maxplayer_choice = new wxChoice( this, BATTLE_FILTER_MAXPLAYER_CHOICE, wxDefaultPosition, wxSize( -1, -1 ), m_filter_maxplayer_choiceChoices, 0 ); m_filter_maxplayer_choice->SetSelection( GetIntParam( f_values.maxplayer ) ); m_filter_maxplayer_choice->SetMinSize( wxSize( 40, -1 ) ); m_filter_maxplayer_sizer->Add( m_filter_maxplayer_choice, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row3_sizer->Add( m_filter_maxplayer_sizer, 0, wxEXPAND, 5 ); m_filter_body_sizer->Add( m_filter_body_row3_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_body_row4_sizer; m_filter_body_row4_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* m_filter_mod_sizer; m_filter_mod_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_mod_text = new wxStaticText( this, wxID_ANY, _( "Game:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_mod_text->Wrap( -1 ); m_filter_mod_text->SetMinSize( wxSize( 90, -1 ) ); m_filter_mod_sizer->Add( m_filter_mod_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_mod_edit = new wxTextCtrl( this, BATTLE_FILTER_MOD_EDIT, f_values.mod, wxDefaultPosition, wxSize( -1, -1 ), 0 | wxSIMPLE_BORDER ); m_filter_mod_edit->SetMinSize( wxSize( 140, -1 ) ); m_filter_mod_expression = new wxRegEx( m_filter_mod_edit->GetValue(), wxRE_ICASE ); m_filter_mod_sizer->Add( m_filter_mod_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row4_sizer->Add( m_filter_mod_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_only_mod_sizer; m_filter_only_mod_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_mod_show = new wxCheckBox( this, BATTLE_FILTER_MOD_SHOW, _( "Only games I have" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_mod_show->SetValue( f_values.mod_show ); m_filter_mod_show->SetMinSize( wxSize( 140, -1 ) ); m_filter_only_mod_sizer->Add( m_filter_mod_show, 1, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL | wxEXPAND, 5 ); m_filter_body_row4_sizer->Add( m_filter_only_mod_sizer, 1, wxEXPAND, 5 ); wxBoxSizer* m_filter_spectator_sizer; m_filter_spectator_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_spectator_text = new wxStaticText( this, wxID_ANY, _( " Spectator:" ), wxDefaultPosition, wxSize( -1, -1 ), 0 ); m_filter_spectator_text->Wrap( -1 ); m_filter_spectator_sizer->Add( m_filter_spectator_text, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_filter_spectator_button = new wxButton( this, BATTLE_FILTER_SPECTATOR_BUTTON, f_values.spectator_mode, wxDefaultPosition, wxSize( 25, 25 ), 0 ); m_filter_spectator_sizer->Add( m_filter_spectator_button, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_filter_spectator_choiceChoices; m_filter_spectator_choiceChoices.Add( _T( "All" ) ); for ( wxLongLong i = 0;i <= 32;i++ ) m_filter_spectator_choiceChoices.Add( i.ToString() ); m_filter_spectator_choice = new wxChoice( this, BATTLE_FILTER_SPECTATOR_CHOICE, wxDefaultPosition, wxSize( -1, -1 ), m_filter_spectator_choiceChoices, 0 ); m_filter_spectator_choice->SetSelection( GetIntParam( f_values.spectator ) ); m_filter_spectator_choice->SetMinSize( wxSize( 40, -1 ) ); m_filter_spectator_sizer->Add( m_filter_spectator_choice, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5 ); m_filter_body_row4_sizer->Add( m_filter_spectator_sizer, 0, wxEXPAND, 5 ); m_filter_body_sizer->Add( m_filter_body_row4_sizer, 1, wxEXPAND, 5 ); m_filter_sizer->Add( m_filter_body_sizer, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL, 5 ); m_activ = false; m_filter_rank_mode = _GetButtonMode( f_values.rank_mode ); m_filter_player_mode = _GetButtonMode( f_values.player_mode ); m_filter_maxplayer_mode = _GetButtonMode( f_values.maxplayer_mode ); m_filter_spectator_mode = _GetButtonMode( f_values.spectator_mode ); m_filter_rank_choice_value = m_filter_rank_choice->GetSelection() - 1; m_filter_player_choice_value = m_filter_player_choice->GetSelection() - 1; m_filter_maxplayer_choice_value = m_filter_maxplayer_choice->GetSelection() - 1; m_filter_spectator_choice_value = m_filter_spectator_choice->GetSelection() - 1 ; this->SetSizer( m_filter_sizer ); this->Layout(); m_filter_sizer->Fit( this ); delete m_filter_map_expression; m_filter_map_expression = new wxRegEx( m_filter_map_edit->GetValue(), wxRE_ICASE ); delete m_filter_mod_expression; m_filter_mod_expression = new wxRegEx( m_filter_mod_edit->GetValue(), wxRE_ICASE ); delete m_filter_description_expression; m_filter_description_expression = new wxRegEx( m_filter_description_edit->GetValue(), wxRE_ICASE ); delete m_filter_host_expression; m_filter_host_expression = new wxRegEx( m_filter_host_edit->GetValue(), wxRE_ICASE ); wxCommandEvent dummy; OnChange( dummy ); }
void DownloadOptionsPanel::OnApply(wxCommandEvent& /*unused*/) { sett().SetHTTPMaxParallelDownloads(m_parallel_http->GetValue()); SlPaths::SetDownloadDir(STD_STRING(m_DownloadDirectoryTextCtrl->GetValue())); prDownloader().UpdateSettings(); }
PlaybackListFilter::PlaybackListFilter(wxWindow* parent, wxWindowID id, PlaybackTab* parentTab, const wxPoint& pos, const wxSize& size, long style) : wxPanel(parent, id, pos, size, style) , m_parent_tab(parentTab) , m_duration_value(0) , m_filter_map_edit(0) , m_filter_map_expression(0) , m_filter_mod_edit(0) , m_filter_mod_expression(0) { PlaybackListFilterValues f_values = sett().GetReplayFilterValues(sett().GetLastReplayFilterProfileName()); wxBoxSizer* m_filter_sizer; m_filter_sizer = new wxBoxSizer(wxHORIZONTAL); wxStaticBoxSizer* m_filter_body_sizer; m_filter_body_sizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, _("Filter settings")), wxVERTICAL); wxBoxSizer* m_filter_body_row2_sizer; m_filter_body_row2_sizer = new wxBoxSizer(wxHORIZONTAL); // wxBoxSizer* m_filter_player_sizer; // m_filter_player_sizer = new wxBoxSizer( wxHORIZONTAL ); m_filter_player_text = new wxStaticText(this, wxID_ANY, _("Player:"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_player_text->Wrap(-1); m_filter_player_text->SetMinSize(wxSize(90, -1)); m_filter_body_row2_sizer->Add(m_filter_player_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); wxArrayString m_filter_player_choiceChoices; m_filter_player_choiceChoices.Add(_("All")); for (wxLongLong i = 0; i <= 32; i++) m_filter_player_choiceChoices.Add(i.ToString()); m_filter_player_choice = new wxChoice(this, PLAYBACK_FILTER_PLAYER_CHOICE, wxDefaultPosition, wxSize(-1, -1), m_filter_player_choiceChoices, 0); m_filter_player_choice->SetSelection(GetIntParam(f_values.player_num)); if (m_filter_player_choice->GetSelection() == -1) m_filter_player_choice->SetSelection(0); m_filter_player_choice->SetMinSize(wxSize(140, -1)); m_filter_body_row2_sizer->Add(m_filter_player_choice, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_player_button = new wxButton(this, PLAYBACK_FILTER_PLAYER_BUTTON, f_values.player_mode, wxDefaultPosition, wxSize(25, 25), 0); m_filter_body_row2_sizer->Add(m_filter_player_button, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); ////map wxBoxSizer* m_filter_body_row3_sizer; m_filter_body_row3_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* m_filter_map_sizer; m_filter_map_sizer = new wxBoxSizer(wxHORIZONTAL); m_filter_map_text = new wxStaticText(this, wxID_ANY, _("Map:"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_map_text->Wrap(-1); m_filter_map_text->SetMinSize(wxSize(90, -1)); m_filter_map_sizer->Add(m_filter_map_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_map_edit = new wxTextCtrl(this, PLAYBACK_FILTER_MAP_EDIT, f_values.map, wxDefaultPosition, wxSize(-1, -1), 0 | wxSIMPLE_BORDER); m_filter_map_edit->SetMinSize(wxSize(140, -1)); m_filter_map_expression = new wxRegEx(m_filter_map_edit->GetValue(), wxRE_ICASE); m_filter_map_sizer->Add(m_filter_map_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_body_row3_sizer->Add(m_filter_map_sizer, 0, wxEXPAND, 5); wxBoxSizer* m_filter_only_map_sizer; m_filter_only_map_sizer = new wxBoxSizer(wxHORIZONTAL); m_filter_map_show = new wxCheckBox(this, PLAYBACK_FILTER_MAP_SHOW, _("Only maps I have"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_map_show->SetValue(f_values.map_show); m_filter_map_show->SetMinSize(wxSize(140, -1)); m_filter_only_map_sizer->Add(m_filter_map_show, 0, wxEXPAND | wxALIGN_LEFT | wxALL, 5); m_filter_body_row3_sizer->Add(m_filter_only_map_sizer, 0, wxEXPAND, 5); //// mod wxBoxSizer* m_filter_body_row4_sizer; m_filter_body_row4_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* m_filter_mod_sizer; m_filter_mod_sizer = new wxBoxSizer(wxHORIZONTAL); m_filter_mod_text = new wxStaticText(this, wxID_ANY, _("Game:"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_mod_text->Wrap(-1); m_filter_mod_text->SetMinSize(wxSize(90, -1)); m_filter_mod_sizer->Add(m_filter_mod_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_mod_edit = new wxTextCtrl(this, PLAYBACK_FILTER_MOD_EDIT, f_values.mod, wxDefaultPosition, wxSize(-1, -1), 0 | wxSIMPLE_BORDER); m_filter_mod_edit->SetMinSize(wxSize(140, -1)); m_filter_mod_expression = new wxRegEx(m_filter_mod_edit->GetValue(), wxRE_ICASE); m_filter_mod_sizer->Add(m_filter_mod_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_body_row4_sizer->Add(m_filter_mod_sizer, 0, wxEXPAND, 5); wxBoxSizer* m_filter_only_mod_sizer; m_filter_only_mod_sizer = new wxBoxSizer(wxHORIZONTAL); m_filter_mod_show = new wxCheckBox(this, PLAYBACK_FILTER_MOD_SHOW, _("Only games I have"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_mod_show->SetValue(f_values.mod_show); m_filter_mod_show->SetMinSize(wxSize(140, -1)); m_filter_only_mod_sizer->Add(m_filter_mod_show, 0, wxALIGN_LEFT | wxALL | wxEXPAND, 5); m_filter_body_row4_sizer->Add(m_filter_only_mod_sizer, 0, wxALIGN_LEFT | wxEXPAND, 5); ///// ///// filesize wxBoxSizer* m_filter_body_row5_sizer; m_filter_body_row5_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* m_filter_filesize_sizer; m_filter_filesize_sizer = new wxBoxSizer(wxHORIZONTAL); m_filter_filesize_text = new wxStaticText(this, wxID_ANY, _("Filesize in KB:"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_filesize_text->Wrap(-1); m_filter_filesize_text->SetMinSize(wxSize(90, -1)); m_filter_filesize_sizer->Add(m_filter_filesize_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_filesize_edit = new wxTextCtrl(this, PLAYBACK_FILTER_FILESIZE_EDIT, f_values.filesize, wxDefaultPosition, wxSize(-1, -1), 0 | wxSIMPLE_BORDER); m_filter_filesize_edit->SetMinSize(wxSize(140, -1)); m_filter_filesize_sizer->Add(m_filter_filesize_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_body_row5_sizer->Add(m_filter_filesize_sizer, 0, wxEXPAND, 5); //button here m_filter_filesize_button = new wxButton(this, PLAYBACK_FILTER_FILESIZE_BUTTON, f_values.filesize_mode, wxDefaultPosition, wxSize(25, 25), 0); m_filter_body_row5_sizer->Add(m_filter_filesize_button, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); ///// ///// duration wxBoxSizer* m_filter_body_row6_sizer; m_filter_body_row6_sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* m_filter_duration_sizer; m_filter_duration_sizer = new wxBoxSizer(wxHORIZONTAL); m_filter_duration_text = new wxStaticText(this, wxID_ANY, _("Duration (hh:mm:ss):"), wxDefaultPosition, wxSize(-1, -1), 0); m_filter_duration_text->Wrap(-1); m_filter_duration_text->SetMinSize(wxSize(90, -1)); m_filter_duration_sizer->Add(m_filter_duration_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_duration_edit = new wxTextCtrl(this, PLAYBACK_FILTER_DURATION_EDIT, f_values.duration, wxDefaultPosition, wxSize(-1, -1), 0 | wxSIMPLE_BORDER); m_filter_duration_edit->SetMinSize(wxSize(140, -1)); m_filter_duration_sizer->Add(m_filter_duration_edit, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); m_filter_body_row6_sizer->Add(m_filter_duration_sizer, 0, wxEXPAND, 5); m_filter_duration_button = new wxButton(this, PLAYBACK_FILTER_DURATION_BUTTON, f_values.duration_mode, wxDefaultPosition, wxSize(25, 25), 0); m_filter_body_row6_sizer->Add(m_filter_duration_button, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); ///// //bring all sizers together wxBoxSizer* m_col1_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* m_col2_sizer = new wxBoxSizer(wxVERTICAL); m_col1_sizer->Add(m_filter_body_row2_sizer, 1, wxEXPAND, 5); m_col1_sizer->Add(m_filter_body_row3_sizer, 1, wxEXPAND, 5); m_col1_sizer->Add(m_filter_body_row4_sizer, 1, wxEXPAND, 5); m_col2_sizer->Add(m_filter_body_row5_sizer, 1, wxEXPAND, 5); m_col2_sizer->Add(m_filter_body_row6_sizer, 1, wxEXPAND, 5); m_filter_sizer->Add(m_col1_sizer, 1, wxEXPAND, 5); m_filter_sizer->Add(m_col2_sizer, 1, wxEXPAND, 5); m_activ = false; m_filter_player_mode = _GetButtonMode(f_values.player_mode); m_filter_duration_mode = _GetButtonMode(f_values.duration_mode); m_filter_filesize_mode = _GetButtonMode(f_values.filesize_mode); m_filter_player_choice_value = m_filter_player_choice->GetSelection() - 1; m_filter_body_sizer->Add(m_filter_sizer); this->SetSizer(m_filter_body_sizer); this->Layout(); m_filter_sizer->Fit(this); delete m_filter_map_expression; m_filter_map_expression = new wxRegEx(m_filter_map_edit->GetValue(), wxRE_ICASE); delete m_filter_mod_expression; m_filter_mod_expression = new wxRegEx(m_filter_mod_edit->GetValue(), wxRE_ICASE); wxCommandEvent dummy; OnChange(dummy); }
void DownloadOptionsPanel::OnRestore(wxCommandEvent& /*unused*/) { m_parallel_http->SetValue(sett().GetHTTPMaxParallelDownloads()); m_DownloadDirectoryTextCtrl->SetValue(TowxString(SlPaths::GetDownloadDir())); }
BattleRoomTab::BattleRoomTab( wxWindow* parent, Battle* battle ) : wxScrolledWindow( parent, -1 ), m_battle( battle ), m_BattleActionSink( this, &UiEvents::GetUiEventSender( UiEvents::OnBattleActionEvent )) { GetAui().manager->AddPane( this, wxLEFT, _T( "battleroomtab" ) ); // Create all widgets m_splitter = new wxSplitterWindow( this, -1, wxDefaultPosition, wxSize( 100, 60 ) ); m_player_panel = new wxScrolledWindow( m_splitter , -1 ); m_player_panel->SetScrollRate( SCROLL_RATE, SCROLL_RATE ); m_team_sel = new wxComboBox( m_player_panel, BROOM_TEAMSEL, _T( "1" ), wxDefaultPosition, wxSize( 50, CONTROL_HEIGHT ), team_choices ); m_team_sel->SetToolTip( TE( _( "Players with the same team number share control of their units." ) ) ); m_ally_sel = new wxComboBox( m_player_panel, BROOM_ALLYSEL, _T( "1" ), wxDefaultPosition, wxSize( 50, CONTROL_HEIGHT ), ally_choices ); m_ally_sel->SetToolTip( TE( _( "Players with the same ally number work together to achieve victory." ) ) ); m_color_sel = new ColorButton( m_player_panel, BROOM_COLOURSEL, wxColour (0,0,0), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_color_sel->SetToolTip( TE( _( "Select a color to identify your units in-game" ) ) ); m_side_sel = new wxBitmapComboBox( m_player_panel, BROOM_SIDESEL, _T( "" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_side_sel->SetToolTip( TE( _( "Select your faction" ) ) ); m_spec_chk = new wxCheckBox( m_player_panel, BROOM_SPEC, _( "Spectator" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_spec_chk->SetToolTip( TE( _( "Spectate (watch) the battle instead of playing" ) ) ); m_ready_chk = new wxCheckBox( m_player_panel, BROOM_IMREADY, _( "I'm ready" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_ready_chk->SetToolTip( TE( _( "Click this if you are content with the battle settings." ) ) ); m_team_lbl = new wxStaticText( m_player_panel, -1, _( "Team" ) ); m_ally_lbl = new wxStaticText( m_player_panel, -1, _( "Ally" ) ); m_color_lbl = new wxStaticText( m_player_panel, -1, _( "Color" ) ); m_side_lbl = new wxStaticText( m_player_panel, -1, _( "Side" ) ); m_ally_setup_lbl = new wxStaticText( m_player_panel, -1, wxString::Format( _( "Setup: %s" ), _T("") ) ); m_ok_count_lbl = new wxStaticText( m_player_panel, -1, wxString::Format( _( "Unready: %d" ), 0 ) ); //XXX not needed ? // m_size_lbl = new wxStaticText( this, -1, _T( "" ) ); // m_wind_lbl = new wxStaticText( this, -1, _T( "" ) ); // m_tidal_lbl = new wxStaticText( this, -1, _T( "" ) ); m_map_combo = new wxComboBox( this, BROOM_MAP_SEL, _T( "" ), wxDefaultPosition, wxDefaultSize ); m_minimap = new MapCtrl( this, 162, m_battle, true, true, true, false ); m_minimap->SetToolTip( TE( _( "A preview of the selected map. You can see the starting positions, or (if set) starting boxes." ) ) ); m_browse_map_btn = new wxButton( this, BROOM_MAP_BROWSE, _( "Map" ), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); m_browse_map_btn->SetSize( m_browse_map_btn->GetSize().GetWidth() * 2 , m_browse_map_btn->GetSize().GetHeight() ) ; // has 0 effect m_players = new BattleroomListCtrl( m_player_panel, m_battle, false, true ); m_chat = new ChatPanel( m_splitter, m_battle ); m_command_line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_host_new_btn = new wxButton( this, BROOM_HOST_NEW, _( "Host new" ), wxDefaultPosition, wxDefaultSize ); m_host_new_btn->SetToolTip( TE( _( "Host a new battle" ) ) ); m_leave_btn = new wxButton( this, BROOM_LEAVE, _( "Leave" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_leave_btn->SetToolTip( TE( _( "Leave the battle and return to the battle list" ) ) ); m_start_btn = new wxButton( this, BROOM_START, _( "Start" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_start_btn->SetToolTip( TE( _( "Start the battle" ) ) ); m_manage_players_btn = new wxButton( this, BROOM_MANAGE_MENU, _( "Player Management" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_manage_players_btn->SetToolTip( TE( _( "Various functions to make team games simplers to setup" ) ) ); m_addbot_btn = new wxButton( this, BROOM_ADDBOT, _( "Add Bot..." ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_addbot_btn->SetToolTip( TE( _( "Add a computer-controlled player to the game" ) ) ); m_autolock_chk = new wxCheckBox( this, BROOM_AUTOLOCK, _( "Autolock on start" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_autolock_chk->SetToolTip( TE( _( "Automatically locks the battle when the game starts and unlock when it's finished." ) ) ); m_autolock_chk->SetValue( sett().GetLastAutolockStatus() ); m_lock_chk = new wxCheckBox( this, BROOM_LOCK, _( "Locked" ), wxDefaultPosition, wxSize( -1, CONTROL_HEIGHT ) ); m_lock_chk->SetToolTip( TE( _( "Prevent additional players from joining the battle" ) ) ); m_manage_users_mnu = new wxMenu(); m_autohost_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_AUTOHOST, _( "Autohost" ), _( "Toggle autohost mode. This allows players to control your battle using commands like '!balance' and '!start'." ), wxITEM_CHECK ); m_manage_users_mnu->Append( m_autohost_mnu ); m_autohost_mnu->Check( false ); m_autopaste_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_AUTOPASTE, _( "AutoPaste Description" ), _( "Automatically paste battle's descriptoin when a new user joins" ), wxITEM_CHECK ); m_manage_users_mnu->Append( m_autopaste_mnu ); m_autopaste_mnu->Check( sett().GetBattleLastAutoAnnounceDescription() ); m_autospec_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_AUTOSPECT, _( "AutoSpect" ), _( "Automatically spectate players that don't ready up or become synced within x seconds." ), wxITEM_CHECK ); m_manage_users_mnu->Append( m_autospec_mnu ); m_autospec_mnu->Check( sett().GetBattleLastAutoSpectTime() > 0 ); m_autocontrol_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_AUTOCONTROL, _( "AutoControlBalance" ), _( "Automatically balance teams and allies and fix colors when all players are ready and synced" ), wxITEM_CHECK ); m_manage_users_mnu->Append( m_autocontrol_mnu ); m_autocontrol_mnu->Check( sett().GetBattleLastAutoControlState() ); m_autostart_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_AUTOSTART, _( "AutoStart" ), _( "Automatically start the battle when all players are ready and synced" ), wxITEM_CHECK ); m_manage_users_mnu->Append( m_autostart_mnu ); m_autostart_mnu->Check( sett().GetBattleLastAutoStartState() ); m_lock_balance_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_LOCK_BALANCE, _( "Lock Balance" ), _( "When activated, prevents anyone but the host to change team and ally" ), wxITEM_CHECK ); m_manage_users_mnu->Append( m_lock_balance_mnu ); m_lock_balance_mnu->Check( false ); wxMenu* ring_menu = new wxMenu; wxMenuItem* ring_unready = new wxMenuItem( ring_menu, BROOM_RING_UNREADY, _( "Ring unready" ), _( "Rings all players that don't have ready status and aren't spectators" ) ); ring_menu->Append( ring_unready ); wxMenuItem* ring_unsynced = new wxMenuItem( ring_menu, BROOM_RING_UNSYNC, _( "Ring unsynced" ), _( "Rings all players that don't have sync status and aren't spectators" ) ); ring_menu->Append( ring_unsynced ); wxMenuItem* ring_unready_unsynced = new wxMenuItem( ring_menu, BROOM_RING_UNREADY_UNSYNC, _( "Ring unready and unsynced" ), _( "Rings all players that don't have sync status or don't have ready status and aren't spectators" ) ); ring_menu->Append( ring_unready_unsynced ); m_manage_users_mnu->Append( wxID_ANY, _( "Ring ..." ), ring_menu ); wxMenu* spect_menu = new wxMenu; wxMenuItem* spect_unready = new wxMenuItem( spect_menu, BROOM_SPECT_UNREADY, _( "Spect unready" ), _( "Force to spectate all players that don't have ready status" ) ); spect_menu->Append( spect_unready ); wxMenuItem* spect_unsynced = new wxMenuItem( spect_menu, BROOM_SPECT_UNSYNC, _( "Spect unsynced" ), _( "Force to spectate all players that don't have sync status" ) ); spect_menu->Append( spect_unsynced ); wxMenuItem* spect_unready_unsynced = new wxMenuItem( spect_menu, BROOM_SPECT_UNREADY_UNSYNC, _( "Force to spectate unready and unsynced" ), _( "Rings all players that don't have sync status or don't have ready status" ) ); spect_menu->Append( spect_unready_unsynced ); m_manage_users_mnu->Append( wxID_ANY, _( "Force spectate ..." ), spect_menu ); wxMenuItem* m_balance_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_BALANCE, _( "Balance alliances" ), _( "Automatically balance players into two or more alliances" ) ); m_manage_users_mnu->Append( m_balance_mnu ); wxMenuItem* m_fix_colours_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_FIXCOLOURS, _( "Fix colours" ), _( "Make player colors unique" ) ); m_manage_users_mnu->Append( m_fix_colours_mnu ); wxMenuItem* m_fix_team_mnu = new wxMenuItem( m_manage_users_mnu, BROOM_FIXID, _( "Balance teams" ), _( "Automatically balance players into control teams, by default none shares control" ) ); m_manage_users_mnu->Append( m_fix_team_mnu ); wxStaticBoxSizer* m_preset_sizer; m_preset_sizer = new wxStaticBoxSizer( new wxStaticBox( this, 0, _( "Manage Presets" ) ), wxVERTICAL ); wxBoxSizer* m_preset_btns_sizer; m_preset_btns_sizer = new wxBoxSizer( wxHORIZONTAL ); m_options_preset_sel = new wxComboBox( this, BROOM_PRESETSEL, _T(""), wxDefaultPosition, wxDefaultSize, sett().GetPresetList(), wxCB_READONLY ); m_options_preset_sel->SetToolTip( TE( _( "Load battle preset" ) ) ); m_preset_sizer->Add( m_options_preset_sel, 0, wxEXPAND | wxALL ); m_save_btn = new wxButton( this, BROOM_SAVEPRES, _( "Save" ), wxDefaultPosition, wxDefaultSize ); m_save_btn->SetToolTip( TE( _( "Save a set of options." ) ) ); m_preset_btns_sizer->Add( m_save_btn, 0, wxEXPAND ); m_delete_btn = new wxButton( this, BROOM_DELETEPRES, _( "Delete" ), wxDefaultPosition, wxDefaultSize ); m_delete_btn->SetToolTip( TE( _( "Delete a set of options." ) ) ); m_preset_btns_sizer->Add( m_delete_btn, 0, wxEXPAND ); m_default_btn = new wxButton( this, BROOM_SETDEFAULTPRES, _( "Set default" ), wxDefaultPosition, wxDefaultSize ); m_default_btn->SetToolTip( TE( _( "Use the current set of options as game's default." ) ) ); m_preset_btns_sizer->Add( m_default_btn, 0, wxEXPAND ); m_preset_sizer->Add( m_preset_btns_sizer, 0, wxEXPAND ); m_opts_list = new wxListCtrl( this, BROOM_OPTIONLIST, wxDefaultPosition, wxDefaultSize, wxLC_NO_HEADER | wxLC_REPORT ); //m_opts_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); m_opts_list->SetFont( wxFont( 8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT ) ); m_opts_list->SetToolTip( TE( _( "Activate an element to quickly change it" ) ) ); wxListItem col; col.SetText( _( "Option" ) ); m_opts_list->InsertColumn( 0, col ); col.SetText( _( "Value" ) ); m_opts_list->InsertColumn( 1, col ); // Create Sizers m_players_sizer = new wxBoxSizer( wxVERTICAL ); m_player_sett_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* m_map_select_sizer = new wxBoxSizer( wxHORIZONTAL ); m_info_sizer = new wxBoxSizer( wxVERTICAL ); m_top_sizer = new wxBoxSizer( wxHORIZONTAL ); m_buttons_sizer = new wxBoxSizer( wxHORIZONTAL ); //m_info1_sizer = new wxBoxSizer( wxHORIZONTAL ); m_main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* m_side_sel_sizer = new wxBoxSizer( wxHORIZONTAL ); #ifndef HAVE_WX29 int side_sel_width = m_side_sel->GetWidestItemWidth(); m_side_sel_sizer->SetMinSize( side_sel_width, CONTROL_HEIGHT ); #endif m_side_sel_sizer->Add( m_side_sel, 1, wxEXPAND ); // Put widgets in place m_player_sett_sizer->Add( m_team_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_player_sett_sizer->Add( m_team_sel, 0, wxEXPAND | wxALL, 2 ); m_player_sett_sizer->Add( m_ally_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_player_sett_sizer->Add( m_ally_sel, 0, wxEXPAND | wxALL, 2 ); m_player_sett_sizer->Add( m_color_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_player_sett_sizer->Add( m_color_sel, 0, wxEXPAND | wxALL, 2 ); m_player_sett_sizer->Add( m_side_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_player_sett_sizer->Add( m_side_sel_sizer, 0, wxEXPAND | wxALL, 2 ); m_player_sett_sizer->Add( m_spec_chk, 0, wxEXPAND | wxALL, 2 ); m_player_sett_sizer->Add( m_ready_chk, 0, wxEXPAND | wxALL, 2 ); m_player_sett_sizer->AddStretchSpacer(); m_player_sett_sizer->Add( m_ally_setup_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 2 ); m_player_sett_sizer->Add( m_ok_count_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 2 ); m_players_sizer->Add( m_players, 1, wxEXPAND ); m_players_sizer->Add( m_player_sett_sizer, 0, wxEXPAND ); m_player_panel->SetSizer( m_players_sizer ); SplitSizerHorizontally( sett().GetSplitBRoomHorizontally() ); //m_info1_sizer->Add( m_wind_lbl, 1, wxEXPAND ); //m_info1_sizer->Add( m_size_lbl, 1, wxEXPAND ); m_info_sizer->Add( m_minimap, 0, wxEXPAND ); m_map_select_sizer->Add( m_map_combo, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL ); m_map_select_sizer->Add( m_browse_map_btn, 0, wxALIGN_RIGHT ); m_info_sizer->Add( m_map_select_sizer, 0, wxALL ); //m_info_sizer->Add( m_info1_sizer, 0, wxEXPAND ); //m_info_sizer->Add( m_tidal_lbl, 0, wxEXPAND ); m_info_sizer->Add( m_opts_list, 1, wxEXPAND | wxTOP, 4 ); m_info_sizer->Add( m_preset_sizer, 0, wxEXPAND, 4 ); m_top_sizer->Add( m_splitter, 1, wxEXPAND | wxALL, 2 ); m_top_sizer->Add( m_info_sizer, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->AddStretchSpacer(); m_buttons_sizer->Add( m_host_new_btn, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->AddStretchSpacer(); m_buttons_sizer->Add( m_leave_btn, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->Add( m_addbot_btn, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->Add( m_autolock_chk, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->Add( m_lock_chk, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->Add( m_manage_players_btn, 0, wxEXPAND | wxALL, 2 ); m_buttons_sizer->Add( m_start_btn, 0, wxEXPAND | wxALL, 2 ); m_main_sizer->Add( m_top_sizer, 1, wxEXPAND ); m_main_sizer->Add( m_command_line, 0, wxEXPAND ); m_main_sizer->Add( m_buttons_sizer, 0, wxEXPAND ); m_splitter->SetMinimumPaneSize( 240 ); SetBattle( battle ); SetScrollRate( SCROLL_RATE, SCROLL_RATE ); SetSizer( m_main_sizer ); Layout(); unsigned int widthfraction = m_opts_list->GetClientSize().GetWidth() / 3; m_opts_list->SetColumnWidth( 0, widthfraction * 1.95 ); m_opts_list->SetColumnWidth( 1, widthfraction * 0.95 ); }
void HostBattleDialog::OnOk( wxCommandEvent& /*unused*/ ) { if ( m_mod_pic->GetSelection() == wxNOT_FOUND ) { wxLogWarning( _T( "no mod selected" ) ); customMessageBox( SL_MAIN_ICON, _( "You have to select a mod first." ), _( "No mod selected." ), wxOK ); return; } if ( m_desc_text->GetValue().IsEmpty() ) m_desc_text->SetValue( _T( "(none)" ) ); sett().SetLastHostDescription( m_desc_text->GetValue() ); sett().SetLastHostMod( m_mod_pic->GetString( m_mod_pic->GetSelection() ) ); wxString password = m_pwd_text->GetValue(); password.Replace(_T(" "), _T("")); sett().SetLastHostPassword( password ); long tmp = DEFSETT_SPRING_PORT; m_port_text->GetValue().ToLong( &tmp ); sett().SetLastHostPort( tmp ); // sett().SetTestHostPort( m_port_test_check->GetValue() ); sett().SetTestHostPort( false ); sett().SetLastHostPlayerNum( m_players_slide->GetValue() ); sett().SetLastHostNATSetting( m_nat_radios->GetSelection() ); sett().SetLastRankLimit( GetSelectedRank() ); sett().SetLastHostRelayedMode( m_relayed_host_check->GetValue() ); sett().SetBattleLastAutoAnnounceDescription( m_desc_check->GetValue() ); sett().SetLastRelayedHost( m_last_relayhost ); sett().SaveSettings(); EndModal( wxID_OK ); }
void BattleRoomTab::OnAutoStart( wxCommandEvent& /*unused*/ ) { if ( !m_battle ) return; sett().SetBattleLastAutoStartState( m_autostart_mnu->IsChecked() ); }
void ChatPanel::UnknownCommand(const wxString& command, const wxString& params) { // change the image of the tab to show new events SetIconHighlight(highlight_important); OutputLine(_("!! Command: \"") + command + _("\" params: \"") + params + _T( "\"." ), sett().GetChatColorError()); }