1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00

Revert from settings description to searchHints

This commit is contained in:
uramer 2022-02-01 19:20:47 +01:00
parent 7f796d148e
commit ef1e72dc17
5 changed files with 4 additions and 31 deletions

View File

@ -244,7 +244,6 @@ namespace MWGui
getWidget(mScriptView, "ScriptView");
getWidget(mScriptAdapter, "ScriptAdapter");
getWidget(mScriptDisabled, "ScriptDisabled");
getWidget(mScriptDescription, "ScriptDescription");
#ifndef WIN32
// hide gamma controls since it currently does not work under Linux
@ -333,7 +332,6 @@ namespace MWGui
mScriptFilter->eventEditTextChange += MyGUI::newDelegate(this, &SettingsWindow::onScriptFilterChange);
mScriptList->eventListMouseItemActivate += MyGUI::newDelegate(this, &SettingsWindow::onScriptListSelection);
mScriptList->eventListMouseItemFocus += MyGUI::newDelegate(this, &SettingsWindow::onScriptListFocus);
}
void SettingsWindow::onTabChanged(MyGUI::TabControl* /*_sender*/, size_t /*index*/)
@ -780,7 +778,7 @@ namespace MWGui
{
LuaUi::ScriptSettingsPage page = LuaUi::scriptSettingsPageAt(i);
int nameSearch = 2 * weightedSearch(searchRegex, page.mName);
int descriptionSearch = weightedSearch(searchRegex, page.mDescription);
int descriptionSearch = weightedSearch(searchRegex, page.mSearchHints);
int search = nameSearch + descriptionSearch;
if (search > 0)
weightedPages.push_back({ i, page, search });
@ -820,21 +818,6 @@ namespace MWGui
mScriptView->setCanvasSize(canvasSize);
}
void SettingsWindow::onScriptListFocus(MyGUI::ListBox*, size_t index)
{
if (index >= mScriptList->getItemCount())
{
mScriptDescription->setVisible(false);
mScriptView->setVisible(true);
}
else {
size_t page = *mScriptList->getItemDataAt<size_t>(index);
mScriptDescription->setCaption(LuaUi::scriptSettingsPageAt(page).mDescription);
mScriptDescription->setVisible(true);
mScriptView->setVisible(false);
}
}
void SettingsWindow::onRebindAction(MyGUI::Widget* _sender)
{
int actionId = *_sender->getUserData<int>();

View File

@ -52,7 +52,6 @@ namespace MWGui
MyGUI::ScrollView* mScriptView;
LuaUi::LuaAdapter* mScriptAdapter;
MyGUI::EditBox* mScriptDisabled;
MyGUI::EditBox* mScriptDescription;
int mCurrentPage;
void onTabChanged(MyGUI::TabControl* _sender, size_t index);
@ -84,7 +83,6 @@ namespace MWGui
void onScriptFilterChange(MyGUI::EditBox*);
void onScriptListSelection(MyGUI::ListBox*, size_t index);
void onScriptListFocus(MyGUI::ListBox*, size_t index);
void apply();

View File

@ -15,14 +15,14 @@ namespace LuaUi
ScriptSettingsPage parse(const sol::table& options)
{
auto name = options.get_or("name", std::string());
auto description = options.get_or("description", std::string());
auto searchHints = options.get_or("searchHints", std::string());
auto element = options.get_or<std::shared_ptr<LuaUi::Element>>("element", nullptr);
if (name.empty())
Log(Debug::Warning) << "A script settings page has an empty name";
if (!element.get())
Log(Debug::Warning) << "A script settings page has no UI element assigned";
return {
name, description, element
name, searchHints, element
};
}
}

View File

@ -14,7 +14,7 @@ namespace LuaUi
struct ScriptSettingsPage
{
std::string mName;
std::string mDescription;
std::string mSearchHints;
std::shared_ptr<Element> mElement;
};
size_t scriptSettingsPageCount();

View File

@ -666,14 +666,6 @@
<Property key="CanvasSize" value="246 246"/>
<Widget name="ScriptAdapter" type="LuaAdapter" position="0 0 246 246"/>
</Widget>
<Widget name="ScriptDescription" type = "EditBox" skin="SandText" position="2 2 246 246" align="Stretch">
<Property key="Visible" value="false"/>
<Property key="Caption" value="Scripts settings are only available when a game is loaded."/>
<Property key="TextAlign" value="Center" />
<Property key="MultiLine" value="true" />
<Property key="WordWrap" value="true" />
<Property key="Static" value="true"/>
</Widget>
</Widget>
<Widget name="ScriptDisabled" type="EditBox" skin="SandText" position="0 0 360 308" align="Center">
<Property key="Visible" value="false"/>