From 8d34286b1d6c1b9f4e7dbb34e9d7ab18ce56b1b5 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 6 Aug 2015 19:37:18 +0200 Subject: [PATCH] Added "No userlevels installed" message --- po/colobot.pot | 6 ++++++ po/de.po | 6 ++++++ po/fr.po | 6 ++++++ po/pl.po | 6 ++++++ po/ru.po | 6 ++++++ src/common/restext.cpp | 2 ++ src/common/restext.h | 2 ++ src/ui/maindialog.cpp | 4 +++- src/ui/mainui.cpp | 2 +- src/ui/screen/screen_level_list.cpp | 19 +++++++++++++++++-- src/ui/screen/screen_level_list.h | 5 ++++- 11 files changed, 59 insertions(+), 5 deletions(-) diff --git a/po/colobot.pot b/po/colobot.pot index 387e8266..64c28706 100644 --- a/po/colobot.pot +++ b/po/colobot.pot @@ -162,6 +162,12 @@ msgstr "" msgid "OK" msgstr "" +msgid "No userlevels installed!" +msgstr "" + +msgid "This menu is for userlevels from mods, but you didn't install any" +msgstr "" + msgid "Keyword help(\\key cbot;)" msgstr "" diff --git a/po/de.po b/po/de.po index f873b254..78beb092 100644 --- a/po/de.po +++ b/po/de.po @@ -937,6 +937,9 @@ msgstr "Kein konvertierbares Titanerz vorhanden" msgid "No uranium to transform" msgstr "Kein konvertierbares Platin" +msgid "No userlevels installed!" +msgstr "" + msgid "Normal size" msgstr "Normale Größe" @@ -1508,6 +1511,9 @@ msgstr "Dieses Element gibt es nicht in dieser Klasse" msgid "This label does not exist" msgstr "Dieses Label existiert nicht" +msgid "This menu is for userlevels from mods, but you didn't install any" +msgstr "" + msgid "This object is not a member of a class" msgstr "Das Objekt ist nicht eine Instanz einer Klasse" diff --git a/po/fr.po b/po/fr.po index 20512978..a2e94b09 100644 --- a/po/fr.po +++ b/po/fr.po @@ -933,6 +933,9 @@ msgstr "Pas de titanium à transformer" msgid "No uranium to transform" msgstr "Pas d'uranium à transformer" +msgid "No userlevels installed!" +msgstr "" + msgid "Normal size" msgstr "Taille normale" @@ -1503,6 +1506,9 @@ msgstr "Cet élément n'existe pas dans cette classe" msgid "This label does not exist" msgstr "Cette étiquette n'existe pas" +msgid "This menu is for userlevels from mods, but you didn't install any" +msgstr "" + msgid "This object is not a member of a class" msgstr "L'objet n'est pas une instance d'une classe" diff --git a/po/pl.po b/po/pl.po index dd494947..def821d2 100644 --- a/po/pl.po +++ b/po/pl.po @@ -938,6 +938,9 @@ msgstr "Brak tytanu do przetworzenia" msgid "No uranium to transform" msgstr "Brak uranu do przetworzenia" +msgid "No userlevels installed!" +msgstr "" + msgid "Normal size" msgstr "Normalna wielkość" @@ -1505,6 +1508,9 @@ msgstr "To nie jest obiekt tej klasy" msgid "This label does not exist" msgstr "Taka etykieta nie istnieje" +msgid "This menu is for userlevels from mods, but you didn't install any" +msgstr "" + msgid "This object is not a member of a class" msgstr "Ten obiekt nie jest członkiem klasy" diff --git a/po/ru.po b/po/ru.po index e1a091b9..f03358a3 100644 --- a/po/ru.po +++ b/po/ru.po @@ -930,6 +930,9 @@ msgstr "" msgid "No uranium to transform" msgstr "Нет урана для преобразования" +msgid "No userlevels installed!" +msgstr "" + msgid "Normal size" msgstr "Нормальный размер" @@ -1500,6 +1503,9 @@ msgstr "Это не член этого класса" msgid "This label does not exist" msgstr "Эта метка не существует" +msgid "This menu is for userlevels from mods, but you didn't install any" +msgstr "" + msgid "This object is not a member of a class" msgstr "Этот объект не член класса" diff --git a/src/common/restext.cpp b/src/common/restext.cpp index cb664fe9..2e072167 100644 --- a/src/common/restext.cpp +++ b/src/common/restext.cpp @@ -111,6 +111,8 @@ void InitializeRestext() stringsText[RT_DIALOG_NO] = TR("No"); stringsText[RT_DIALOG_LOADING] = TR("LOADING"); stringsText[RT_DIALOG_OK] = TR("OK"); + 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_STUDIO_LISTTT] = TR("Keyword help(\\key cbot;)"); stringsText[RT_STUDIO_COMPOK] = TR("Compilation ok (0 errors)"); diff --git a/src/common/restext.h b/src/common/restext.h index ea7ec1b9..2628f864 100644 --- a/src/common/restext.h +++ b/src/common/restext.h @@ -107,6 +107,8 @@ enum ResTextType RT_DIALOG_NO = 108, RT_DIALOG_LOADING = 109, RT_DIALOG_OK = 110, + RT_DIALOG_NOUSRLVL_TITLE = 111, + RT_DIALOG_NOUSRLVL_TEXT = 112, RT_STUDIO_LISTTT = 120, RT_STUDIO_COMPOK = 121, diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index f814b199..e79ba571 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -312,7 +312,9 @@ void CMainDialog::StartInformation(const std::string& title, const std::string& pw = static_cast(m_interface->SearchControl(EVENT_WINDOW9)); if ( pw == 0 ) return; - pw->SetName(title); + + if(!title.empty()) + pw->SetName(title); pos.x = 0.00f; pos.y = 0.50f; diff --git a/src/ui/mainui.cpp b/src/ui/mainui.cpp index 5dce5812..0ad91862 100644 --- a/src/ui/mainui.cpp +++ b/src/ui/mainui.cpp @@ -73,7 +73,7 @@ CMainUserInterface::CMainUserInterface() m_dialog = MakeUnique(); m_screenAppearance = MakeUnique(); - m_screenLevelList = MakeUnique(); + m_screenLevelList = MakeUnique(m_dialog.get()); m_screenIORead = MakeUnique(m_screenLevelList.get()); m_screenIOWrite = MakeUnique(m_screenLevelList.get()); m_screenLoading = MakeUnique(); diff --git a/src/ui/screen/screen_level_list.cpp b/src/ui/screen/screen_level_list.cpp index f2f0502f..8ba8d73d 100644 --- a/src/ui/screen/screen_level_list.cpp +++ b/src/ui/screen/screen_level_list.cpp @@ -29,6 +29,8 @@ #include "object/level/parser.h" +#include "ui/maindialog.h" + #include "ui/controls/button.h" #include "ui/controls/check.h" #include "ui/controls/edit.h" @@ -40,8 +42,9 @@ namespace Ui { -CScreenLevelList::CScreenLevelList() - : m_category{}, +CScreenLevelList::CScreenLevelList(CMainDialog* mainDialog) + : m_dialog(mainDialog), + m_category{}, m_listCategory{}, m_sceneSoluce{false}, m_maxList{0}, @@ -232,6 +235,18 @@ void CScreenLevelList::CreateInterface() pb->SetState(STATE_SHADOW); SetBackground("textures/interface/interface.png"); + + if (m_category == LevelCategory::CustomLevels) + { + if(m_customLevelList.size() == 0) + { + m_main->ChangePhase(PHASE_MAIN_MENU); + std::string title, text; + GetResource(RES_TEXT, RT_DIALOG_NOUSRLVL_TITLE, title); + GetResource(RES_TEXT, RT_DIALOG_NOUSRLVL_TEXT, text); + m_dialog->StartInformation(title, title, text); + } + } } bool CScreenLevelList::EventProcess(const Event &event) diff --git a/src/ui/screen/screen_level_list.h b/src/ui/screen/screen_level_list.h index dbbbf607..964da37a 100644 --- a/src/ui/screen/screen_level_list.h +++ b/src/ui/screen/screen_level_list.h @@ -28,11 +28,12 @@ namespace Ui { +class CMainDialog; class CScreenLevelList : public CScreen { public: - CScreenLevelList(); + CScreenLevelList(Ui::CMainDialog* mainDialog); void SetLevelCategory(LevelCategory category); @@ -59,6 +60,8 @@ protected: void UpdateSceneResume(int chap, int rank); protected: + Ui::CMainDialog* m_dialog; + LevelCategory m_category; LevelCategory m_listCategory;