Add error dialogs for open path/url buttons
parent
4905abe30b
commit
5f76722ecb
|
@ -172,6 +172,20 @@ msgstr ""
|
||||||
msgid "This menu is for userlevels from mods, but you didn't install any"
|
msgid "This menu is for userlevels from mods, but you didn't install any"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Keyword help(\\key cbot;)"
|
msgid "Keyword help(\\key cbot;)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
14
po/cs.po
14
po/cs.po
|
@ -440,6 +440,12 @@ msgstr "Kopírovat"
|
||||||
msgid "Copy (Ctrl+C)"
|
msgid "Copy (Ctrl+C)"
|
||||||
msgstr "Kopírovat (Ctrl+C)"
|
msgstr "Kopírovat (Ctrl+C)"
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Current mission saved"
|
msgid "Current mission saved"
|
||||||
msgstr "Současná mise uložena"
|
msgstr "Současná mise uložena"
|
||||||
|
|
||||||
|
@ -1555,6 +1561,10 @@ msgstr "Filtrování textur\\Filtrování textur"
|
||||||
msgid "Textures"
|
msgid "Textures"
|
||||||
msgstr "Textury"
|
msgstr "Textury"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The battle has ended"
|
msgid "The battle has ended"
|
||||||
msgstr "Souboj skončil"
|
msgstr "Souboj skončil"
|
||||||
|
|
||||||
|
@ -1567,6 +1577,10 @@ msgstr "Funkce nevrátila žádnou hodnotu"
|
||||||
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
||||||
msgstr "Mise ještě nebyla splněna (pro podrobnosti stiskněte \\key help;)"
|
msgstr "Mise ještě nebyla splněna (pro podrobnosti stiskněte \\key help;)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The types of the two operands are incompatible"
|
msgid "The types of the two operands are incompatible"
|
||||||
msgstr "Operaci nelze provést s operandy těchto dvou typů"
|
msgstr "Operaci nelze provést s operandy těchto dvou typů"
|
||||||
|
|
||||||
|
|
14
po/de.po
14
po/de.po
|
@ -441,6 +441,12 @@ msgstr "Kopieren"
|
||||||
msgid "Copy (Ctrl+C)"
|
msgid "Copy (Ctrl+C)"
|
||||||
msgstr "Kopieren (Ctrl+C)"
|
msgstr "Kopieren (Ctrl+C)"
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Current mission saved"
|
msgid "Current mission saved"
|
||||||
msgstr "Mission gespeichert"
|
msgstr "Mission gespeichert"
|
||||||
|
|
||||||
|
@ -1572,6 +1578,10 @@ msgstr "Texturfilterung\\Texturfilterung"
|
||||||
msgid "Textures"
|
msgid "Textures"
|
||||||
msgstr "Texturen"
|
msgstr "Texturen"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The battle has ended"
|
msgid "The battle has ended"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1584,6 +1594,10 @@ msgstr "Die Funktion hat kein Ergebnis zurückgegeben"
|
||||||
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
||||||
msgstr "Mission noch nicht beendet (Drücken Sie auf \\key help; für weitere Informationen)"
|
msgstr "Mission noch nicht beendet (Drücken Sie auf \\key help; für weitere Informationen)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The types of the two operands are incompatible"
|
msgid "The types of the two operands are incompatible"
|
||||||
msgstr "Die zwei Operanden sind nicht kompatibel"
|
msgstr "Die zwei Operanden sind nicht kompatibel"
|
||||||
|
|
||||||
|
|
14
po/fr.po
14
po/fr.po
|
@ -443,6 +443,12 @@ msgstr "Copier"
|
||||||
msgid "Copy (Ctrl+C)"
|
msgid "Copy (Ctrl+C)"
|
||||||
msgstr "Copier (Ctrl+C)"
|
msgstr "Copier (Ctrl+C)"
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Current mission saved"
|
msgid "Current mission saved"
|
||||||
msgstr "Enregistrement effectué"
|
msgstr "Enregistrement effectué"
|
||||||
|
|
||||||
|
@ -1574,6 +1580,10 @@ msgstr "Filtrage de textures\\Filtrage de textures"
|
||||||
msgid "Textures"
|
msgid "Textures"
|
||||||
msgstr "Textures"
|
msgstr "Textures"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The battle has ended"
|
msgid "The battle has ended"
|
||||||
msgstr "La bataille est terminée"
|
msgstr "La bataille est terminée"
|
||||||
|
|
||||||
|
@ -1586,6 +1596,10 @@ msgstr "La fonction n'a pas retourné de résultat"
|
||||||
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
||||||
msgstr "La mission n'est pas terminée (appuyez sur \\key help; pour plus de détails)"
|
msgstr "La mission n'est pas terminée (appuyez sur \\key help; pour plus de détails)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The types of the two operands are incompatible"
|
msgid "The types of the two operands are incompatible"
|
||||||
msgstr "Les deux opérandes ne sont pas de types compatibles"
|
msgstr "Les deux opérandes ne sont pas de types compatibles"
|
||||||
|
|
||||||
|
|
14
po/pl.po
14
po/pl.po
|
@ -439,6 +439,12 @@ msgstr "Kopiuj"
|
||||||
msgid "Copy (Ctrl+C)"
|
msgid "Copy (Ctrl+C)"
|
||||||
msgstr "Kopiuj (Ctrl+C)"
|
msgstr "Kopiuj (Ctrl+C)"
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr "Nie udało się otworzyć przeglądarki plików!"
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr "Nie udało się otworzyć przeglądarki internetowej!"
|
||||||
|
|
||||||
msgid "Current mission saved"
|
msgid "Current mission saved"
|
||||||
msgstr "Bieżąca misja zapisana"
|
msgstr "Bieżąca misja zapisana"
|
||||||
|
|
||||||
|
@ -1554,6 +1560,10 @@ msgstr "Filtrowanie tekstur\\Filtrowanie tekstur"
|
||||||
msgid "Textures"
|
msgid "Textures"
|
||||||
msgstr "Tekstury"
|
msgstr "Tekstury"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr "Nie udało się otworzyć adresu %s w przeglądarce internetowej."
|
||||||
|
|
||||||
msgid "The battle has ended"
|
msgid "The battle has ended"
|
||||||
msgstr "Bitwa zakończyła się"
|
msgstr "Bitwa zakończyła się"
|
||||||
|
|
||||||
|
@ -1566,6 +1576,10 @@ msgstr "Funkcja nie zwróciła żadnej wartości"
|
||||||
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
||||||
msgstr "Misja nie jest wypełniona (naciśnij \\key help; aby uzyskać szczegóły)"
|
msgstr "Misja nie jest wypełniona (naciśnij \\key help; aby uzyskać szczegóły)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr "Nie udało się otworzyć ścieżki %s w przeglądarce plików."
|
||||||
|
|
||||||
msgid "The types of the two operands are incompatible"
|
msgid "The types of the two operands are incompatible"
|
||||||
msgstr "Niezgodne typy operatorów"
|
msgstr "Niezgodne typy operatorów"
|
||||||
|
|
||||||
|
|
35
po/pt.po
35
po/pt.po
|
@ -438,6 +438,12 @@ msgstr "Copiar"
|
||||||
msgid "Copy (Ctrl+C)"
|
msgid "Copy (Ctrl+C)"
|
||||||
msgstr "Copiar (Ctrl+C)"
|
msgstr "Copiar (Ctrl+C)"
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Current mission saved"
|
msgid "Current mission saved"
|
||||||
msgstr "Missão atual salva"
|
msgstr "Missão atual salva"
|
||||||
|
|
||||||
|
@ -843,12 +849,18 @@ msgstr "Lista das missões salvas"
|
||||||
msgid "Load a saved mission"
|
msgid "Load a saved mission"
|
||||||
msgstr "Carregar uma missão salva"
|
msgstr "Carregar uma missão salva"
|
||||||
|
|
||||||
|
msgid "Load\\Load Mod"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Load\\Load a saved mission"
|
msgid "Load\\Load a saved mission"
|
||||||
msgstr "Carregar\\Carregar uma missão salva"
|
msgstr "Carregar\\Carregar uma missão salva"
|
||||||
|
|
||||||
msgid "Load\\Loads the selected mission"
|
msgid "Load\\Loads the selected mission"
|
||||||
msgstr "Carregar\\Carrega a missão selecionada"
|
msgstr "Carregar\\Carrega a missão selecionada"
|
||||||
|
|
||||||
|
msgid "Loaded Mods:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Loading basic level settings"
|
msgid "Loading basic level settings"
|
||||||
msgstr "Carregando configurações de nível básico"
|
msgstr "Carregando configurações de nível básico"
|
||||||
|
|
||||||
|
@ -917,6 +929,9 @@ msgstr "Lista de missões neste planeta:"
|
||||||
msgid "Missions\\Select mission"
|
msgid "Missions\\Select mission"
|
||||||
msgstr "Missões\\Selecione uma missão"
|
msgstr "Missões\\Selecione uma missão"
|
||||||
|
|
||||||
|
msgid "Mods\\Manage installed mods"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
|
msgid "Mouse inversion X\\Inversion of the scrolling direction on the X axis"
|
||||||
msgstr "Inversão de mouse X\\Inverte a direção da rolagem no eixo X"
|
msgstr "Inversão de mouse X\\Inverte a direção da rolagem no eixo X"
|
||||||
|
|
||||||
|
@ -1085,6 +1100,9 @@ msgstr "Abrir"
|
||||||
msgid "Open (Ctrl+O)"
|
msgid "Open (Ctrl+O)"
|
||||||
msgstr "Abrir (Ctrl+O)"
|
msgstr "Abrir (Ctrl+O)"
|
||||||
|
|
||||||
|
msgid "Open Directory\\Open Mods directory"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Opening brace missing"
|
msgid "Opening brace missing"
|
||||||
msgstr "Chave de abertura ausente"
|
msgstr "Chave de abertura ausente"
|
||||||
|
|
||||||
|
@ -1557,6 +1575,10 @@ msgstr "Filtragem de textura\\Filtragem de textura"
|
||||||
msgid "Textures"
|
msgid "Textures"
|
||||||
msgstr "Texturas"
|
msgstr "Texturas"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The battle has ended"
|
msgid "The battle has ended"
|
||||||
msgstr "A batalha acabou"
|
msgstr "A batalha acabou"
|
||||||
|
|
||||||
|
@ -1569,6 +1591,10 @@ msgstr "A função não retornou nenhum valor"
|
||||||
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
||||||
msgstr "A missão não foi completada ainda (pressione \\key help; para mais detalhes)"
|
msgstr "A missão não foi completada ainda (pressione \\key help; para mais detalhes)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The types of the two operands are incompatible"
|
msgid "The types of the two operands are incompatible"
|
||||||
msgstr "Os tipos dos dois operandos são incompativeis"
|
msgstr "Os tipos dos dois operandos são incompativeis"
|
||||||
|
|
||||||
|
@ -1705,6 +1731,12 @@ msgstr "Sequência de escape desconhecidade"
|
||||||
msgid "Unknown function"
|
msgid "Unknown function"
|
||||||
msgstr "Função desconhecida"
|
msgstr "Função desconhecida"
|
||||||
|
|
||||||
|
msgid "Unload\\Unload Mod"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Unloaded Mods:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Up (\\key gup;)"
|
msgid "Up (\\key gup;)"
|
||||||
msgstr "Cima (\\key gup;)"
|
msgstr "Cima (\\key gup;)"
|
||||||
|
|
||||||
|
@ -1780,6 +1812,9 @@ msgstr "Farejador alado"
|
||||||
msgid "Withdraw shield (\\key action;)"
|
msgid "Withdraw shield (\\key action;)"
|
||||||
msgstr "Retirar escudo (\\key action;)"
|
msgstr "Retirar escudo (\\key action;)"
|
||||||
|
|
||||||
|
msgid "Workshop\\Open Workshop to search Mods"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Worm"
|
msgid "Worm"
|
||||||
msgstr "Verme"
|
msgstr "Verme"
|
||||||
|
|
||||||
|
|
14
po/ru.po
14
po/ru.po
|
@ -446,6 +446,12 @@ msgstr "Копировать"
|
||||||
msgid "Copy (Ctrl+C)"
|
msgid "Copy (Ctrl+C)"
|
||||||
msgstr "Копировать (Ctrl+C)"
|
msgstr "Копировать (Ctrl+C)"
|
||||||
|
|
||||||
|
msgid "Could not open the file explorer!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Could not open the web browser!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Current mission saved"
|
msgid "Current mission saved"
|
||||||
msgstr "Текущая миссия сохранена"
|
msgstr "Текущая миссия сохранена"
|
||||||
|
|
||||||
|
@ -1585,6 +1591,10 @@ msgstr "Фильтрация текстур\\Фильтрация текстур
|
||||||
msgid "Textures"
|
msgid "Textures"
|
||||||
msgstr "Текстуры"
|
msgstr "Текстуры"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The address %s could not be opened in a web browser."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The battle has ended"
|
msgid "The battle has ended"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1597,6 +1607,10 @@ msgstr "Функция не возвратила значения"
|
||||||
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
msgid "The mission is not accomplished yet (press \\key help; for more details)"
|
||||||
msgstr "Миссия еще не выполнена (нажмите \\key help; для более подробной информации)"
|
msgstr "Миссия еще не выполнена (нажмите \\key help; для более подробной информации)"
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "The path %s could not be opened in a file explorer."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "The types of the two operands are incompatible"
|
msgid "The types of the two operands are incompatible"
|
||||||
msgstr "Типы операндов несовместимы"
|
msgstr "Типы операндов несовместимы"
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,10 @@ void InitializeRestext()
|
||||||
stringsText[RT_DIALOG_OK] = TR("OK");
|
stringsText[RT_DIALOG_OK] = TR("OK");
|
||||||
stringsText[RT_DIALOG_NOUSRLVL_TITLE] = TR("No userlevels installed!");
|
stringsText[RT_DIALOG_NOUSRLVL_TITLE] = TR("No userlevels installed!");
|
||||||
stringsText[RT_DIALOG_NOUSRLVL_TEXT] = TR("This menu is for userlevels from mods, but you didn't install any");
|
stringsText[RT_DIALOG_NOUSRLVL_TEXT] = TR("This menu is for userlevels from mods, but you didn't install any");
|
||||||
|
stringsText[RT_DIALOG_OPEN_PATH_FAILED_TITLE] = TR("Could not open the file explorer!");
|
||||||
|
stringsText[RT_DIALOG_OPEN_PATH_FAILED_TEXT] = TR("The path %s could not be opened in a file explorer.");
|
||||||
|
stringsText[RT_DIALOG_OPEN_WEBSITE_FAILED_TITLE] = TR("Could not open the web browser!");
|
||||||
|
stringsText[RT_DIALOG_OPEN_WEBSITE_FAILED_TEXT] = TR("The address %s could not be opened in a web browser.");
|
||||||
|
|
||||||
stringsText[RT_STUDIO_LISTTT] = TR("Keyword help(\\key cbot;)");
|
stringsText[RT_STUDIO_LISTTT] = TR("Keyword help(\\key cbot;)");
|
||||||
stringsText[RT_STUDIO_COMPOK] = TR("Compilation ok (0 errors)");
|
stringsText[RT_STUDIO_COMPOK] = TR("Compilation ok (0 errors)");
|
||||||
|
|
|
@ -105,6 +105,10 @@ enum ResTextType
|
||||||
RT_DIALOG_OK = 110,
|
RT_DIALOG_OK = 110,
|
||||||
RT_DIALOG_NOUSRLVL_TITLE = 111,
|
RT_DIALOG_NOUSRLVL_TITLE = 111,
|
||||||
RT_DIALOG_NOUSRLVL_TEXT = 112,
|
RT_DIALOG_NOUSRLVL_TEXT = 112,
|
||||||
|
RT_DIALOG_OPEN_PATH_FAILED_TITLE = 113,
|
||||||
|
RT_DIALOG_OPEN_PATH_FAILED_TEXT = 114,
|
||||||
|
RT_DIALOG_OPEN_WEBSITE_FAILED_TITLE = 115,
|
||||||
|
RT_DIALOG_OPEN_WEBSITE_FAILED_TEXT = 116,
|
||||||
|
|
||||||
RT_STUDIO_LISTTT = 120,
|
RT_STUDIO_LISTTT = 120,
|
||||||
RT_STUDIO_COMPOK = 121,
|
RT_STUDIO_COMPOK = 121,
|
||||||
|
|
|
@ -216,12 +216,12 @@ std::string CSystemUtils::GetEnvVar(const std::string& name)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtils::OpenPath(std::string path)
|
bool CSystemUtils::OpenPath(const std::string& path)
|
||||||
{
|
{
|
||||||
assert(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtils::OpenWebsite(std::string website)
|
bool CSystemUtils::OpenWebsite(const std::string& url)
|
||||||
{
|
{
|
||||||
assert(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,10 +146,12 @@ public:
|
||||||
virtual std::string GetEnvVar(const std::string &name);
|
virtual std::string GetEnvVar(const std::string &name);
|
||||||
|
|
||||||
//! Opens a path with default file browser
|
//! Opens a path with default file browser
|
||||||
virtual void OpenPath(std::string path);
|
/** \returns true if successful */
|
||||||
|
virtual bool OpenPath(const std::string& path);
|
||||||
|
|
||||||
//! Opens a website with default web browser
|
//! Opens a website with default web browser
|
||||||
virtual void OpenWebsite(std::string website);
|
/** \returns true if successful */
|
||||||
|
virtual bool OpenWebsite(const std::string& url);
|
||||||
|
|
||||||
//! Sleep for given amount of microseconds
|
//! Sleep for given amount of microseconds
|
||||||
virtual void Usleep(int usecs) = 0;
|
virtual void Usleep(int usecs) = 0;
|
||||||
|
|
|
@ -150,26 +150,26 @@ std::string CSystemUtilsLinux::GetEnvVar(const std::string& name)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsLinux::OpenPath(std::string path)
|
bool CSystemUtilsLinux::OpenPath(const std::string& path)
|
||||||
{
|
{
|
||||||
int result;
|
int result = system(("xdg-open \"" + path + "\"").c_str());
|
||||||
|
if (result != 0)
|
||||||
result = system(("xdg-open \""+path+"\"").c_str());
|
|
||||||
if (result == -1)
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open path: %s\n", path.c_str());
|
GetLogger()->Error("Failed to open path: %s, error code: %i\n", path.c_str(), result);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsLinux::OpenWebsite(std::string website)
|
bool CSystemUtilsLinux::OpenWebsite(const std::string& url)
|
||||||
{
|
{
|
||||||
int result;
|
int result = system(("xdg-open \"" + url + "\"").c_str());
|
||||||
|
if (result != 0)
|
||||||
result = system(("xdg-open \""+website+"\"").c_str());
|
|
||||||
if (result == -1)
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open website: %s\n", website.c_str());
|
GetLogger()->Error("Failed to open website: %s, error code: %i\n", url.c_str(), result);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsLinux::Usleep(int usec)
|
void CSystemUtilsLinux::Usleep(int usec)
|
||||||
|
|
|
@ -48,8 +48,8 @@ public:
|
||||||
|
|
||||||
std::string GetEnvVar(const std::string& name) override;
|
std::string GetEnvVar(const std::string& name) override;
|
||||||
|
|
||||||
void OpenPath(std::string path) override;
|
bool OpenPath(const std::string& path) override;
|
||||||
void OpenWebsite(std::string website) override;
|
bool OpenWebsite(const std::string& url) override;
|
||||||
|
|
||||||
void Usleep(int usec) override;
|
void Usleep(int usec) override;
|
||||||
|
|
||||||
|
|
|
@ -119,26 +119,26 @@ std::string CSystemUtilsMacOSX::GetEnvVar(const std::string& str)
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsLinux::OpenPath(std::string path)
|
bool CSystemUtilsMacOSX::OpenPath(const std::string& path)
|
||||||
{
|
{
|
||||||
int result;
|
int result = system(("open \"" + path + "\"").c_str()); // TODO: Test on macOS
|
||||||
|
if (result != 0)
|
||||||
result = system(("open \""+path+"\"").c_str()); // TODO: Test on macOS
|
|
||||||
if (result == -1)
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open path: %s\n", path.c_str());
|
GetLogger()->Error("Failed to open path: %s, error code: %i\n", path.c_str(), result);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsLinux::OpenWebsite(std::string website)
|
bool CSystemUtilsMacOSX::OpenWebsite(const std::string& url)
|
||||||
{
|
{
|
||||||
int result;
|
int result = system(("open \"" + url + "\"").c_str()); // TODO: Test on macOS
|
||||||
|
if (result != 0)
|
||||||
result = system(("open \""+website+"\"").c_str()); // TODO: Test on macOS
|
|
||||||
if (result == -1)
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open website: %s\n", website.c_str());
|
GetLogger()->Error("Failed to open website: %s, error code: %i\n", website.c_str(), result);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsMacOSX::Usleep(int usec)
|
void CSystemUtilsMacOSX::Usleep(int usec)
|
||||||
|
|
|
@ -38,8 +38,8 @@ public:
|
||||||
|
|
||||||
std::string GetEnvVar(const std::string& name) override;
|
std::string GetEnvVar(const std::string& name) override;
|
||||||
|
|
||||||
void OpenPath(std::string path) override;
|
bool OpenPath(const std::string& path) override;
|
||||||
void OpenWebsite(std::string website) override;
|
bool OpenWebsite(const std::string& url) override;
|
||||||
|
|
||||||
void Usleep(int usec) override;
|
void Usleep(int usec) override;
|
||||||
|
|
||||||
|
|
|
@ -44,16 +44,6 @@ long long int CSystemUtilsOther::TimeStampExactDiff(SystemTimeStamp* before, Sys
|
||||||
return (after->sdlTicks - before->sdlTicks) * 1000000ll;
|
return (after->sdlTicks - before->sdlTicks) * 1000000ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsOther::OpenPath(std::string path)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemUtilsOther::OpenWebsite(std::string website)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSystemUtilsOther::Usleep(int usec)
|
void CSystemUtilsOther::Usleep(int usec)
|
||||||
{
|
{
|
||||||
SDL_Delay(usec / 1000); // close enough
|
SDL_Delay(usec / 1000); // close enough
|
||||||
|
|
|
@ -50,9 +50,6 @@ public:
|
||||||
void GetCurrentTimeStamp(SystemTimeStamp *stamp) override;
|
void GetCurrentTimeStamp(SystemTimeStamp *stamp) override;
|
||||||
long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
|
long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
|
||||||
|
|
||||||
void OpenPath(std::string path) override;
|
|
||||||
void OpenWebsite(std::string website) override;
|
|
||||||
|
|
||||||
void Usleep(int usec) override;
|
void Usleep(int usec) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,26 +153,26 @@ std::string CSystemUtilsWindows::GetEnvVar(const std::string& name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsWindows::OpenPath(std::string path)
|
bool CSystemUtilsWindows::OpenPath(const std::string& path)
|
||||||
{
|
{
|
||||||
int result;
|
int result = system(("start explorer \"" + boost::filesystem::path(path).make_preferred().string() + "\"").c_str());
|
||||||
|
if (result != 0)
|
||||||
result = system(("explorer \""+path+"\"").c_str()); // TODO: Test on macOS
|
|
||||||
if (result == -1)
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open path: %s\n", path.c_str());
|
GetLogger()->Error("Failed to open path: %s, error code: %i\n", path.c_str(), result);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsWindows::OpenWebsite(std::string website)
|
bool CSystemUtilsWindows::OpenWebsite(const std::string& url)
|
||||||
{
|
{
|
||||||
int result;
|
int result = system(("rundll32 url.dll,FileProtocolHandler \"" + url + "\"").c_str());
|
||||||
|
if (result != 0)
|
||||||
result = system(("rundll32 url.dll,FileProtocolHandler \""+website+"\"").c_str()); // TODO: Test on macOS
|
|
||||||
if (result == -1)
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open website: %s\n", website.c_str());
|
GetLogger()->Error("Failed to open website: %s, error code: %i\n", url.c_str(), result);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemUtilsWindows::Usleep(int usec)
|
void CSystemUtilsWindows::Usleep(int usec)
|
||||||
|
|
|
@ -46,8 +46,8 @@ public:
|
||||||
|
|
||||||
std::string GetEnvVar(const std::string& name) override;
|
std::string GetEnvVar(const std::string& name) override;
|
||||||
|
|
||||||
void OpenPath(std::string path) override;
|
bool OpenPath(const std::string& path) override;
|
||||||
void OpenWebsite(std::string website) override;
|
bool OpenWebsite(const std::string& url) override;
|
||||||
|
|
||||||
void Usleep(int usec) override;
|
void Usleep(int usec) override;
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ CMainUserInterface::CMainUserInterface()
|
||||||
m_screenSetupDisplay = MakeUnique<CScreenSetupDisplay>();
|
m_screenSetupDisplay = MakeUnique<CScreenSetupDisplay>();
|
||||||
m_screenSetupGame = MakeUnique<CScreenSetupGame>();
|
m_screenSetupGame = MakeUnique<CScreenSetupGame>();
|
||||||
m_screenSetupGraphics = MakeUnique<CScreenSetupGraphics>();
|
m_screenSetupGraphics = MakeUnique<CScreenSetupGraphics>();
|
||||||
m_screenSetupMods = MakeUnique<CScreenSetupMods>();
|
m_screenSetupMods = MakeUnique<CScreenSetupMods>(m_dialog.get());
|
||||||
m_screenSetupSound = MakeUnique<CScreenSetupSound>();
|
m_screenSetupSound = MakeUnique<CScreenSetupSound>();
|
||||||
m_screenMainMenu = MakeUnique<CScreenMainMenu>();
|
m_screenMainMenu = MakeUnique<CScreenMainMenu>();
|
||||||
m_screenPlayerSelect = MakeUnique<CScreenPlayerSelect>(m_dialog.get());
|
m_screenPlayerSelect = MakeUnique<CScreenPlayerSelect>(m_dialog.get());
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
#include "common/stringutils.h"
|
||||||
|
|
||||||
#include "common/resources/resourcemanager.h"
|
#include "common/resources/resourcemanager.h"
|
||||||
#include "level/parser/parser.h"
|
#include "level/parser/parser.h"
|
||||||
|
@ -48,7 +49,8 @@ using namespace boost::filesystem;
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
|
||||||
CScreenSetupMods::CScreenSetupMods()
|
CScreenSetupMods::CScreenSetupMods(CMainDialog* mainDialog)
|
||||||
|
: m_dialog(mainDialog)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +133,9 @@ bool CScreenSetupMods::EventProcess(const Event &event)
|
||||||
CWindow* pw;
|
CWindow* pw;
|
||||||
CButton* pb;
|
CButton* pb;
|
||||||
CList* pl;
|
CList* pl;
|
||||||
std::string modName, modPath, website = "https://www.moddb.com/games/colobot-gold-edition";
|
std::string modName;
|
||||||
|
const std::string website = "https://www.moddb.com/games/colobot-gold-edition";
|
||||||
|
const std::string modDir = CResourceManager::GetSaveLocation() + "/" + "mods";
|
||||||
auto systemUtils = CSystemUtils::Create(); // platform-specific utils
|
auto systemUtils = CSystemUtils::Create(); // platform-specific utils
|
||||||
|
|
||||||
if (!CScreenSetup::EventProcess(event)) return false;
|
if (!CScreenSetup::EventProcess(event)) return false;
|
||||||
|
@ -139,8 +143,9 @@ bool CScreenSetupMods::EventProcess(const Event &event)
|
||||||
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
||||||
if ( pw == nullptr ) return false;
|
if ( pw == nullptr ) return false;
|
||||||
|
|
||||||
if (event.type == EVENT_INTERFACE_LOAD)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
|
case EVENT_INTERFACE_LOAD:
|
||||||
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_MODS_UNLOADED));
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_MODS_UNLOADED));
|
||||||
if (pl == nullptr) return false;
|
if (pl == nullptr) return false;
|
||||||
modName = pl->GetItemName(pl->GetSelect());
|
modName = pl->GetItemName(pl->GetSelect());
|
||||||
|
@ -148,9 +153,9 @@ bool CScreenSetupMods::EventProcess(const Event &event)
|
||||||
|
|
||||||
m_app->Reload();
|
m_app->Reload();
|
||||||
m_main->ChangePhase(PHASE_SETUPm);
|
m_main->ChangePhase(PHASE_SETUPm);
|
||||||
}
|
break;
|
||||||
if (event.type == EVENT_INTERFACE_UNLOAD)
|
|
||||||
{
|
case EVENT_INTERFACE_UNLOAD:
|
||||||
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_MODS_LOADED));
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_MODS_LOADED));
|
||||||
if (pl == nullptr) return false;
|
if (pl == nullptr) return false;
|
||||||
modName = pl->GetItemName(pl->GetSelect());
|
modName = pl->GetItemName(pl->GetSelect());
|
||||||
|
@ -158,14 +163,8 @@ bool CScreenSetupMods::EventProcess(const Event &event)
|
||||||
|
|
||||||
m_app->Reload();
|
m_app->Reload();
|
||||||
m_main->ChangePhase(PHASE_SETUPm);
|
m_main->ChangePhase(PHASE_SETUPm);
|
||||||
}
|
break;
|
||||||
if (event.type == EVENT_INTERFACE_MODS_DIR)
|
|
||||||
{
|
|
||||||
modPath = CResourceManager::GetSaveLocation() + "/" + "mods";
|
|
||||||
systemUtils->OpenPath(modPath);
|
|
||||||
}
|
|
||||||
switch (event.type)
|
|
||||||
{
|
|
||||||
case EVENT_INTERFACE_MODS_UNLOADED:
|
case EVENT_INTERFACE_MODS_UNLOADED:
|
||||||
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_MODS_LOADED));
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_MODS_LOADED));
|
||||||
if ( pl == nullptr ) break;
|
if ( pl == nullptr ) break;
|
||||||
|
@ -194,9 +193,31 @@ bool CScreenSetupMods::EventProcess(const Event &event)
|
||||||
pb->SetState(STATE_ENABLE);
|
pb->SetState(STATE_ENABLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_INTERFACE_WORKSHOP:
|
case EVENT_INTERFACE_MODS_DIR:
|
||||||
systemUtils->OpenWebsite(website);
|
if (!systemUtils->OpenPath(modDir))
|
||||||
|
{
|
||||||
|
std::string title, text;
|
||||||
|
GetResource(RES_TEXT, RT_DIALOG_OPEN_PATH_FAILED_TITLE, title);
|
||||||
|
GetResource(RES_TEXT, RT_DIALOG_OPEN_PATH_FAILED_TEXT, text);
|
||||||
|
|
||||||
|
// Workaround for how labels treat the \\ character on Windows
|
||||||
|
std::string modDirWithoutBackSlashes = modDir;
|
||||||
|
std::replace(modDirWithoutBackSlashes.begin(), modDirWithoutBackSlashes.end(), '\\', '/');
|
||||||
|
|
||||||
|
m_dialog->StartInformation(title, title, StrUtils::Format(text.c_str(), modDirWithoutBackSlashes.c_str()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_INTERFACE_WORKSHOP:
|
||||||
|
if (!systemUtils->OpenWebsite(website))
|
||||||
|
{
|
||||||
|
std::string title, text;
|
||||||
|
GetResource(RES_TEXT, RT_DIALOG_OPEN_WEBSITE_FAILED_TITLE, title);
|
||||||
|
GetResource(RES_TEXT, RT_DIALOG_OPEN_WEBSITE_FAILED_TEXT, text);
|
||||||
|
m_dialog->StartInformation(title, title, StrUtils::Format(text.c_str(), website.c_str()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/maindialog.h"
|
||||||
#include "ui/screen/screen_setup.h"
|
#include "ui/screen/screen_setup.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -31,7 +32,7 @@ namespace Ui
|
||||||
class CScreenSetupMods : public CScreenSetup
|
class CScreenSetupMods : public CScreenSetup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CScreenSetupMods();
|
CScreenSetupMods(CMainDialog* mainDialog);
|
||||||
void SetActive() override;
|
void SetActive() override;
|
||||||
|
|
||||||
void CreateInterface() override;
|
void CreateInterface() override;
|
||||||
|
@ -44,6 +45,8 @@ protected:
|
||||||
void UpdateLoadedModList();
|
void UpdateLoadedModList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CMainDialog* m_dialog;
|
||||||
|
|
||||||
CPathManager* m_pathManager;
|
CPathManager* m_pathManager;
|
||||||
std::vector<std::string> m_unloadedModList;
|
std::vector<std::string> m_unloadedModList;
|
||||||
std::vector<std::string> m_loadedModList;
|
std::vector<std::string> m_loadedModList;
|
||||||
|
|
Loading…
Reference in New Issue