1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Add a visible notification for missing KDialog/Zenity

This commit is contained in:
Krutonium
2017-10-14 16:16:51 -04:00
committed by Michael Steenbeek
parent 0313183d13
commit fd459f0791
4 changed files with 36 additions and 20 deletions

View File

@@ -4462,6 +4462,9 @@ STR_6150 :Invalid response from master server (no JSON number)
STR_6151 :Master server failed to return servers
STR_6152 :Invalid response from master server (no JSON array)
STR_6153 :Pay to enter park / Pay per ride
STR_6154 :It is not recommended to run OpenRCT2 with elevated permissions.
STR_6155 :Neither KDialog nor Zenity are installed. Please install one, or configure from the command line.
#############
# Scenarios #

View File

@@ -21,9 +21,11 @@
#include <stdexcept>
#include <openrct2/common.h>
#include <openrct2/core/String.hpp>
#include <openrct2/localisation/localisation.h>
#include <openrct2/ui/UiContext.h>
#include "UiContext.h"
#include <SDL.h>
namespace OpenRCT2 { namespace Ui
@@ -371,7 +373,10 @@ namespace OpenRCT2 { namespace Ui
static void ThrowMissingDialogApp()
{
throw std::runtime_error("KDialog or Zenity not installed.");
IUiContext * uiContext = GetContext()->GetUiContext();
std::string dialogMissingWarning = language_get_string(STR_MISSING_DIALOG_APPLICATION_ERROR);
uiContext->ShowMessageBox(dialogMissingWarning);
throw std::runtime_error(dialogMissingWarning);
}
};

View File

@@ -280,9 +280,30 @@ namespace OpenRCT2
config_save_default();
}
// TODO add configuration option to allow multiple instances
// if (!gOpenRCT2Headless && !platform_lock_single_instance()) {
// log_fatal("OpenRCT2 is already running.");
// return false;
// } //This comment was relocated so it would stay where it was in relation to the following lines of code.
_objectRepository = CreateObjectRepository(_env);
_objectManager = CreateObjectManager(_objectRepository);
_trackDesignRepository = CreateTrackDesignRepository(_env);
_scenarioRepository = CreateScenarioRepository(_env);
if (!language_open(gConfigGeneral.language))
{
log_error("Failed to open configured language...");
if (!language_open(LANGUAGE_ENGLISH_UK))
{
log_fatal("Failed to open fallback language...");
return false;
}
}
if (platform_process_is_elevated())
{
std::string elevationWarning = "For security reasons, it is strongly recommended not to run OpenRCT2 with elevated permissions.";
std::string elevationWarning = language_get_string(STR_ADMIN_NOT_RECOMMENDED);
if (gOpenRCT2Headless)
{
Console::Error::WriteLine(elevationWarning.c_str());
@@ -305,26 +326,10 @@ namespace OpenRCT2
_uiContext->CreateWindow();
}
// TODO add configuration option to allow multiple instances
// if (!gOpenRCT2Headless && !platform_lock_single_instance()) {
// log_fatal("OpenRCT2 is already running.");
// return false;
// }
_objectRepository = CreateObjectRepository(_env);
_objectManager = CreateObjectManager(_objectRepository);
_trackDesignRepository = CreateTrackDesignRepository(_env);
_scenarioRepository = CreateScenarioRepository(_env);
if (!language_open(gConfigGeneral.language))
{
log_error("Failed to open configured language...");
if (!language_open(LANGUAGE_ENGLISH_UK))
{
log_fatal("Failed to open fallback language...");
return false;
}
}
// TODO Ideally we want to delay this until we show the title so that we can
// still open the game window and draw a progress screen for the creation

View File

@@ -3806,6 +3806,9 @@ enum {
STR_PAID_ENTRY_PAID_RIDES = 6153,
STR_ADMIN_NOT_RECOMMENDED = 6154,
STR_MISSING_DIALOG_APPLICATION_ERROR = 6155,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};