void CUIEditWnd::KeyPress(GG::Key key, boost::uint32_t key_code_point, GG::Flags<GG::ModKey> mod_keys) { switch (key) { case GG::GGK_RETURN: if (!m_ok_bn->Disabled()) OkClicked(); break; case GG::GGK_ESCAPE: CloseClicked(); break; default: break; } }
void SaveFileDialog::Cancel() { Logger().debugStream() << "SaveFileDialog::Cancel: Dialog Canceled"; m_name_edit->SetText ( "" ); CloseClicked(); }
void SaveFileDialog::Confirm() { Logger().debugStream() << "SaveFileDialog::Confirm: Confirming"; if(!CheckChoiceValidity()){ Logger().debugStream() << "SaveFileDialog::Confirm: Invalid choice. abort."; return; } /// Check if we chose a directory std::string choice = m_name_edit->Text(); fs::path current_dir ( m_current_dir_edit->Text() ); if ( !choice.empty() ) { fs::path chosen = current_dir / choice; if ( fs::is_directory ( chosen ) ) { Logger().debugStream() << "SaveFileDialog::Confirm: " << chosen << " is a directory. Listing content."; UpdateDirectory ( PathString ( chosen ) ); return; } else { Logger().debugStream() << "SaveFileDialog::Confirm: File " << chosen << " chosen."; } } else { Logger().debugStream() << "SaveFileDialog::Confirm: Returning no file."; } CloseClicked(); }
void SitRepPanel::KeyPress(GG::Key key, boost::uint32_t key_code_point, GG::Flags<GG::ModKey> mod_keys) { switch (key) { case GG::GGK_RETURN: case GG::GGK_KP_ENTER: case GG::GGK_ESCAPE:{ CloseClicked(); break; } default: break; } }
void InGameMenu::Save() { DebugLogger() << "InGameMenu::Save"; HumanClientApp* app = HumanClientApp::GetApp(); if (!app) return; if (!app->CanSaveNow()) { ErrorLogger() << "InGameMenu::Save aborting; Client app can't save now"; return; } const std::string SAVE_GAME_EXTENSION = app->SinglePlayerGame() ? SP_SAVE_FILE_EXTENSION : MP_SAVE_FILE_EXTENSION; try { std::string filename; // When saving in multiplayer, you cannot see the old saves or // browse directories, only give a save file name. if (app->SinglePlayerGame()) { DebugLogger() << "... running save file dialog"; SaveFileDialog dlg(SAVE_GAME_EXTENSION); dlg.Run(); filename = dlg.Result(); } else { /// Multiplayer save. Talk to the server. filename = app->SelectSaveFile(); } if (!filename.empty()) { if (!app->CanSaveNow()) { ErrorLogger() << "InGameMenu::Save aborting; Client app can't save now"; throw std::runtime_error(UserString("UNABLE_TO_SAVE_NOW_TRY_AGAIN")); } DebugLogger() << "... initiating save to " << filename ; app->SaveGame(filename); CloseClicked(); DebugLogger() << "... save done"; } } catch (const std::exception& e) { ErrorLogger() << "Exception thrown attempting save: " << e.what(); ClientUI::MessageBox(e.what(), true); } }
void InGameMenu::Save() { Logger().debugStream() << "InGameMenu::Save"; HumanClientApp* app = HumanClientApp::GetApp(); if (!app) return; if (!app->CanSaveNow()) { Logger().errorStream() << "InGameMenu::Save aborting; Client app can't save now"; return; } const std::string SAVE_GAME_EXTENSION = HumanClientApp::GetApp()->SinglePlayerGame() ? SP_SAVE_FILE_EXTENSION : MP_SAVE_FILE_EXTENSION; std::vector<std::pair<std::string, std::string> > save_file_types; save_file_types.push_back(std::make_pair(UserString("GAME_MENU_SAVE_FILES"), "*" + SAVE_GAME_EXTENSION)); try { Logger().debugStream() << "... getting save path string"; std::string path_string = PathString(GetSaveDir()); Logger().debugStream() << "... got save path string: " << path_string; Logger().debugStream() << "... running file dialog"; FileDlg dlg(path_string, "", true, false, save_file_types); dlg.Run(); if (!dlg.Result().empty()) { if (!app->CanSaveNow()) { Logger().errorStream() << "InGameMenu::Save aborting; Client app can't save now"; throw std::runtime_error(UserString("UNABLE_TO_SAVE_NOW_TRY_AGAIN")); } Logger().debugStream() << "... initiating save"; app->SaveGame(*dlg.Result().begin()); CloseClicked(); Logger().debugStream() << "... save done"; } } catch (const std::exception& e) { Logger().errorStream() << "Exception thrown attempting save: " << e.what(); ClientUI::MessageBox(e.what(), true); } }
void CUIEditWnd::OkClicked() { m_result = m_edit->Text(); CloseClicked(); }
void InGameMenu::Exit() { HumanClientApp::GetApp()->EndGame(); CloseClicked(); }
void InGameMenu::Load() { Hide(); HumanClientApp::GetApp()->LoadSinglePlayerGame(); CloseClicked(); }
void InGameMenu::Exit() { HumanClientApp::GetApp()->ResetToIntro(); CloseClicked(); }
void HUD2::InitWidgets( void ) { QPalette p; QFont f; bOil = false; Oil = InitIcon( 270, 25, ":/images/icons/oil_gray.png" ); bTemp = false; Temp = InitIcon( 350, 25, ":/images/icons/temp_gray.png" ); bBreak = false; Break = InitIcon( 410, 25, ":/images/icons/break_gray.png" ); bFuel = false; Fuel = InitIcon( 280, 88, ":/images/icons/fuel_red.png" ); bBattery = false; Battery = InitIcon( 375, 75, ":/images/icons/battery_red.png" ); FuelLevel = InitLabel( 270, 140, 22, tr("--%"), Qt::white ); BatteryLevel = InitLabel( 375, 140, 22, tr("--.-V"), Qt::white ); bBNAP = false; BNAP = InitLabel( 15, 65, 20, tr("БНАП"), Qt::red ); bMPIOVD = false; MPIOVD = InitLabel( 15, 95, 20, tr("МПИОВД"), Qt::red ); bCC = false; CC = InitLabel( 15, 125, 20, tr("ДЦ"), Qt::red ); Time = InitLabel( 15, 155, 16, tr("--:--:--"), Qt::white ); Date = InitLabel( 15, 185, 16, tr("--------"), Qt::white ); N = InitLabel( 15, 15, 14, tr("N:--,-----"), Qt::white ); E = InitLabel( 15, 35, 14, tr("E:--,-----"), Qt::white ); H = InitLabel ( 145, 15, 14, tr("H :---"), Qt::white ); Vel = InitLabel( 145, 35, 14, tr("Vel:---"), Qt::white ); Cog = InitLabel( 145, 55, 14, tr("Cog:---"), Qt::white ); Fix = InitLabel( 145, 75, 14, tr("Fix:---"), Qt::white ); Sat = InitLabel( 145, 95, 14, tr("Sat:---"), Qt::white ); Eph = InitLabel( 145, 115, 14, tr("Eph:---"), Qt::white ); GSM = InitLabel( 145, 185, 14, tr("GSM:---"), Qt::white ); Message = new Clickable( "", this ); f = QFont( "Arial", 16 ); f.setBold( true ); Message->setAutoFillBackground( true ); p = Message->palette(); //p.setColor( QPalette::Window, Qt::black); p.setColor( QPalette::WindowText, QColor( 255, 0, 0 )); Message->setAlignment( Qt::AlignCenter ); Message->setFont( f ); Message->setPalette( p ); Message->setGeometry( 10, 225, 460, 30 ); Timer = new QTimer(); btnClose = new QPushButton( this ); btnClose->setGeometry( 430, 180, 40, 40 ); btnClose->setText( tr( "X" ) ); connect( Message, SIGNAL( clicked() ), this, SLOT( MessageClicked() ) ); connect( Timer, SIGNAL( timeout() ), this, SLOT( Timeout() ) ); connect( btnClose, SIGNAL( clicked() ), this, SLOT( CloseClicked( ) ) ); Timer->start( 1000 ); }