本文整理汇总了C++中VerboseOperationEnvironment类的典型用法代码示例。如果您正苦于以下问题:C++ VerboseOperationEnvironment类的具体用法?C++ VerboseOperationEnvironment怎么用?C++ VerboseOperationEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VerboseOperationEnvironment类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogFormat
void
Display::LoadOrientation(VerboseOperationEnvironment &env)
{
if (!Display::RotateSupported())
return;
Display::RotateInitialize();
DisplayOrientation orientation =
CommonInterface::GetUISettings().display.orientation;
#ifdef KOBO
/* on the Kobo, the display orientation must be loaded explicitly
(portrait), because the hardware default is landscape */
#else
if (orientation == DisplayOrientation::DEFAULT)
return;
#endif
if (!Display::Rotate(orientation)) {
LogFormat("Display rotation failed");
return;
}
#ifdef KOBO
event_queue->SetMouseRotation(orientation);
#endif
LogFormat("Display rotated");
CommonInterface::main_window->Initialise();
/* force the progress dialog to update its layout */
env.UpdateLayout();
}
示例2: Shutdown
void
Shutdown()
{
VerboseOperationEnvironment operation;
gcc_unused ScopeBusyIndicator busy;
MainWindow *const main_window = CommonInterface::main_window;
auto &live_blackboard = CommonInterface::GetLiveBlackboard();
// Show progress dialog
operation.SetText(_("Shutdown, please wait..."));
// Log shutdown information
LogFormat("Entering shutdown...");
main_window->BeginShutdown();
StartupLogFreeRamAndStorage();
Lua::StopAllBackground();
// Turn off all displays
global_running = false;
#ifdef HAVE_TRACKING
if (tracking != nullptr)
tracking->StopAsync();
#endif
// Stop logger and save igc file
operation.SetText(_("Shutdown, saving logs..."));
if (logger != nullptr)
logger->GUIStopLogger(CommonInterface::Basic(), true);
delete flight_logger;
flight_logger = nullptr;
delete all_monitors;
all_monitors = nullptr;
if (glide_computer_events != nullptr) {
live_blackboard.RemoveListener(*glide_computer_events);
delete glide_computer_events;
glide_computer_events = nullptr;
}
SaveFlarmColors();
// Save settings to profile
operation.SetText(_("Shutdown, saving profile..."));
Profile::Save();
operation.SetText(_("Shutdown, please wait..."));
// Stop threads
LogFormat("Stop threads");
#ifdef HAVE_DOWNLOAD_MANAGER
Net::DownloadManager::BeginDeinitialise();
#endif
#ifndef ENABLE_OPENGL
if (draw_thread != nullptr)
draw_thread->BeginStop();
#endif
if (calculation_thread != nullptr)
calculation_thread->BeginStop();
if (merge_thread != nullptr)
merge_thread->BeginStop();
// Wait for the calculations thread to finish
LogFormat("Waiting for calculation thread");
if (merge_thread != nullptr) {
merge_thread->Join();
delete merge_thread;
merge_thread = nullptr;
}
if (calculation_thread != nullptr) {
calculation_thread->Join();
delete calculation_thread;
calculation_thread = nullptr;
}
// Wait for the drawing thread to finish
#ifndef ENABLE_OPENGL
LogFormat("Waiting for draw thread");
if (draw_thread != nullptr) {
draw_thread->Join();
delete draw_thread;
draw_thread = nullptr;
}
#endif
LogFormat("delete MapWindow");
main_window->Deinitialise();
// Stop sound
//.........这里部分代码省略.........
示例3: Startup
/**
* "Boots" up XCSoar
* @param hInstance Instance handle
* @param lpCmdLine Command line string
* @return True if bootup successful, False otherwise
*/
bool
Startup()
{
VerboseOperationEnvironment operation;
#ifdef HAVE_DOWNLOAD_MANAGER
Net::DownloadManager::Initialise();
#endif
LogFormat("Display dpi=%u,%u", Display::GetXDPI(), Display::GetYDPI());
// Creates the main window
TopWindowStyle style;
if (CommandLine::full_screen)
style.FullScreen();
style.Resizable();
MainWindow *const main_window = CommonInterface::main_window =
new MainWindow();
main_window->Create(SystemWindowSize(), style);
if (!main_window->IsDefined())
return false;
#ifdef ENABLE_OPENGL
LogFormat("OpenGL: "
#ifdef ANDROID
#ifdef USE_EGL
"egl=native "
#else
"egl=no "
#endif
#endif
#ifdef HAVE_OES_DRAW_TEXTURE
"oesdt=%d "
#endif
#ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS
"mda=%d "
#endif
"npot=%d vbo=%d fbo=%d stencil=%#x",
#ifdef HAVE_OES_DRAW_TEXTURE
OpenGL::oes_draw_texture,
#endif
#ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS
GLExt::HaveMultiDrawElements(),
#endif
OpenGL::texture_non_power_of_two,
OpenGL::vertex_buffer_object,
OpenGL::frame_buffer_object,
OpenGL::render_buffer_stencil);
#endif
CommonInterface::SetUISettings().SetDefaults();
main_window->Initialise();
#ifdef SIMULATOR_AVAILABLE
// prompt for simulator if not set by command line argument "-simulator" or "-fly"
if (!sim_set_in_cmd_line_flag) {
SimulatorPromptResult result = dlgSimulatorPromptShowModal();
switch (result) {
case SPR_QUIT:
return false;
case SPR_FLY:
global_simulator_flag = false;
break;
case SPR_SIMULATOR:
global_simulator_flag = true;
break;
}
}
#endif
CommonInterface::SetSystemSettings().SetDefaults();
CommonInterface::SetComputerSettings().SetDefaults();
CommonInterface::SetUIState().Clear();
const auto &computer_settings = CommonInterface::GetComputerSettings();
const auto &ui_settings = CommonInterface::GetUISettings();
auto &live_blackboard = CommonInterface::GetLiveBlackboard();
if (!LoadProfile())
return false;
operation.SetText(_("Initialising"));
/* create XCSoarData on the first start */
CreateDataPath();
Display::LoadOrientation(operation);
main_window->CheckResize();
//.........这里部分代码省略.........
示例4: LogStartUp
void
XCSoarInterface::Shutdown()
{
VerboseOperationEnvironment operation;
gcc_unused ScopeBusyIndicator busy;
// Show progress dialog
operation.SetText(_("Shutdown, please wait..."));
// Log shutdown information
LogStartUp(_T("Entering shutdown..."));
StartupLogFreeRamAndStorage();
// Turn off all displays
globalRunningEvent.Reset();
#ifdef HAVE_TRACKING
if (tracking != NULL)
tracking->StopAsync();
#endif
// Stop logger and save igc file
operation.SetText(_("Shutdown, saving logs..."));
logger.GUIStopLogger(Basic(), true);
delete flight_logger;
flight_logger = NULL;
GetLiveBlackboard().RemoveListener(glide_computer_events);
FlarmFriends::Save();
// Save settings to profile
operation.SetText(_("Shutdown, saving profile..."));
Profile::Save();
// Stop sound
AudioVarioGlue::Deinitialise();
operation.SetText(_("Shutdown, please wait..."));
// Stop threads
LogStartUp(_T("Stop threads"));
#ifndef ENABLE_OPENGL
draw_thread->BeginStop();
#endif
calculation_thread->BeginStop();
merge_thread->BeginStop();
// Wait for the calculations thread to finish
LogStartUp(_T("Waiting for calculation thread"));
merge_thread->Join();
delete merge_thread;
merge_thread = NULL;
calculation_thread->Join();
delete calculation_thread;
calculation_thread = NULL;
// Wait for the drawing thread to finish
#ifndef ENABLE_OPENGL
LogStartUp(_T("Waiting for draw thread"));
draw_thread->Join();
delete draw_thread;
#endif
LogStartUp(_T("delete MapWindow"));
main_window.Deinitialise();
// Save the task for the next time
operation.SetText(_("Shutdown, saving task..."));
LogStartUp(_T("Save default task"));
protected_task_manager->TaskSaveDefault();
// Clear waypoint database
LogStartUp(_T("Close waypoints"));
way_points.Clear();
operation.SetText(_("Shutdown, please wait..."));
// Clear weather database
LogStartUp(_T("CloseRASP"));
RASP.Close();
// Clear terrain database
LogStartUp(_T("CloseTerrain"));
delete terrain;
LogStartUp(_T("CloseTopography"));
delete topography;
delete protected_marks;
delete marks;
// Close any device connections
//.........这里部分代码省略.........
示例5: ProtectedTaskManager
/**
* "Boots" up XCSoar
* @param hInstance Instance handle
* @param lpCmdLine Command line string
* @return True if bootup successful, False otherwise
*/
bool
XCSoarInterface::Startup()
{
VerboseOperationEnvironment operation;
// Set the application title to "XCSoar"
TCHAR szTitle[] = _T("XCSoar");
//If "XCSoar" is already running, stop this instance
if (MainWindow::find(szTitle))
return false;
LogStartUp(_T("Display dpi=%u,%u"), Display::GetXDPI(), Display::GetYDPI());
// Creates the main window
LogStartUp(_T("Create main window"));
TopWindowStyle style;
if (CommandLine::full_screen)
style.FullScreen();
if (CommandLine::resizable)
style.Resizable();
main_window.Set(szTitle, SystemWindowSize(), style);
if (!main_window.IsDefined())
return false;
#ifdef ENABLE_OPENGL
LogStartUp(_T("OpenGL: "
#ifdef HAVE_EGL
"egl=%d "
#endif
"npot=%d vbo=%d fbo=%d"),
#ifdef HAVE_EGL
OpenGL::egl,
#endif
OpenGL::texture_non_power_of_two,
OpenGL::vertex_buffer_object,
OpenGL::frame_buffer_object);
#endif
main_window.Initialise();
#ifdef SIMULATOR_AVAILABLE
// prompt for simulator if not set by command line argument "-simulator" or "-fly"
if (!sim_set_in_cmd_line_flag) {
DialogLook white_look;
white_look.Initialise(Fonts::map_bold, Fonts::map, Fonts::map_label,
Fonts::map_bold, Fonts::map_bold);
white_look.SetBackgroundColor(COLOR_WHITE);
SetXMLDialogLook(white_look);
SimulatorPromptResult result = dlgSimulatorPromptShowModal();
switch (result) {
case SPR_QUIT:
return false;
case SPR_FLY:
global_simulator_flag = false;
break;
case SPR_SIMULATOR:
global_simulator_flag = true;
break;
}
}
#endif
SetXMLDialogLook(main_window.GetLook().dialog);
SetSystemSettings().SetDefaults();
SetComputerSettings().SetDefaults();
SetUISettings().SetDefaults();
SetUIState().Clear();
if (!LoadProfile())
return false;
operation.SetText(_("Initialising"));
/* create XCSoarData on the first start */
CreateDataPath();
Display::LoadOrientation(operation);
main_window.InitialiseConfigured();
TCHAR path[MAX_PATH];
LocalPath(path, _T("cache"));
file_cache = new FileCache(path);
ReadLanguageFile();
status_messages.LoadFile();
//.........这里部分代码省略.........
示例6: SettingsLeave
static void
SettingsLeave(const UISettings &old_ui_settings)
{
if (!global_running)
return;
SuspendAllThreads();
VerboseOperationEnvironment operation;
MainWindow &main_window = *CommonInterface::main_window;
if (LanguageChanged)
ReadLanguageFile();
bool TerrainFileChanged = false, TopographyFileChanged = false;
if (MapFileChanged) {
/* set these flags, because they may be loaded from the map
file */
AirspaceFileChanged = true;
AirfieldFileChanged = true;
WaypointFileChanged = true;
TerrainFileChanged = true;
TopographyFileChanged = true;
}
if (TerrainFileChanged) {
operation.SetText(_("Loading Terrain File..."));
/* just in case the bottom widget uses the old terrain object
(e.g. the cross section) */
main_window.SetBottomWidget(nullptr);
main_window.SetTerrain(NULL);
glide_computer->SetTerrain(NULL);
// re-load terrain
delete terrain;
terrain = RasterTerrain::OpenTerrain(file_cache, operation);
main_window.SetTerrain(terrain);
glide_computer->SetTerrain(terrain);
/* re-create the bottom widget if it was deleted here */
PageActions::Update();
}
if (WaypointFileChanged || AirfieldFileChanged) {
// re-load waypoints
WaypointGlue::LoadWaypoints(way_points, terrain, operation);
WaypointDetails::ReadFileFromProfile(way_points, operation);
}
if (WaypointFileChanged && protected_task_manager != NULL) {
ProtectedTaskManager::ExclusiveLease lease(*protected_task_manager);
OrderedTask *task = lease->Clone(CommonInterface::GetComputerSettings().task);
if (task) {
// this must be done in thread lock because it potentially changes the
// waypoints database
task->CheckDuplicateWaypoints(way_points);
/* XXX shall this task be committed if it has been modified? */
delete task;
way_points.Optimise();
}
}
if (WaypointFileChanged || TerrainFileChanged) {
// re-set home
WaypointGlue::SetHome(way_points, terrain,
CommonInterface::SetComputerSettings().poi,
CommonInterface::SetComputerSettings().team_code,
device_blackboard, WaypointFileChanged);
WaypointGlue::SaveHome(Profile::map,
CommonInterface::GetComputerSettings().poi,
CommonInterface::GetComputerSettings().team_code);
}
if (TopographyFileChanged) {
main_window.SetTopography(NULL);
topography->Reset();
LoadConfiguredTopography(*topography, operation);
main_window.SetTopography(topography);
}
if (AirspaceFileChanged) {
if (glide_computer != NULL)
glide_computer->GetAirspaceWarnings().Clear();
if (glide_computer != NULL)
glide_computer->ClearAirspaces();
airspace_database.Clear();
ReadAirspace(airspace_database, terrain,
CommonInterface::GetComputerSettings().pressure,
operation);
}
if (DevicePortChanged)
//.........这里部分代码省略.........