mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 03:46:42 +01:00
ControllerInterface: Add IsHidden function to Control interface.
This commit is contained in:
parent
0538366326
commit
ee43c9508c
@ -587,28 +587,25 @@ void IOWindow::UpdateOptionList()
|
|||||||
if (m_selected_device == nullptr)
|
if (m_selected_device == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const auto add_rows = [this](auto& container) {
|
||||||
|
int row = 0;
|
||||||
|
for (ciface::Core::Device::Control* control : container)
|
||||||
|
{
|
||||||
|
m_option_list->insertRow(row);
|
||||||
|
|
||||||
|
if (control->IsHidden())
|
||||||
|
m_option_list->hideRow(row);
|
||||||
|
|
||||||
|
m_option_list->setItem(row, 0,
|
||||||
|
new QTableWidgetItem(QString::fromStdString(control->GetName())));
|
||||||
|
++row;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (m_reference->IsInput())
|
if (m_reference->IsInput())
|
||||||
{
|
add_rows(m_selected_device->Inputs());
|
||||||
int row = 0;
|
|
||||||
for (const auto* input : m_selected_device->Inputs())
|
|
||||||
{
|
|
||||||
m_option_list->insertRow(row);
|
|
||||||
m_option_list->setItem(row, 0,
|
|
||||||
new QTableWidgetItem(QString::fromStdString(input->GetName())));
|
|
||||||
++row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
add_rows(m_selected_device->Outputs());
|
||||||
int row = 0;
|
|
||||||
for (const auto* output : m_selected_device->Outputs())
|
|
||||||
{
|
|
||||||
m_option_list->insertRow(row);
|
|
||||||
m_option_list->setItem(row, 0,
|
|
||||||
new QTableWidgetItem(QString::fromStdString(output->GetName())));
|
|
||||||
++row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOWindow::UpdateDeviceList()
|
void IOWindow::UpdateDeviceList()
|
||||||
|
@ -125,6 +125,11 @@ bool Device::Control::IsMatchingName(std::string_view name) const
|
|||||||
return GetName() == name;
|
return GetName() == name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::Control::IsHidden() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ControlState Device::FullAnalogSurface::GetState() const
|
ControlState Device::FullAnalogSurface::GetState() const
|
||||||
{
|
{
|
||||||
return (1 + std::max(0.0, m_high.GetState()) - std::max(0.0, m_low.GetState())) / 2;
|
return (1 + std::max(0.0, m_high.GetState()) - std::max(0.0, m_low.GetState())) / 2;
|
||||||
@ -141,6 +146,11 @@ bool Device::FullAnalogSurface::IsDetectable() const
|
|||||||
return m_low.IsDetectable() && m_high.IsDetectable();
|
return m_low.IsDetectable() && m_high.IsDetectable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::FullAnalogSurface::IsHidden() const
|
||||||
|
{
|
||||||
|
return m_low.IsHidden() && m_high.IsHidden();
|
||||||
|
}
|
||||||
|
|
||||||
bool Device::FullAnalogSurface::IsMatchingName(std::string_view name) const
|
bool Device::FullAnalogSurface::IsMatchingName(std::string_view name) const
|
||||||
{
|
{
|
||||||
if (Control::IsMatchingName(name))
|
if (Control::IsMatchingName(name))
|
||||||
|
@ -64,6 +64,10 @@ public:
|
|||||||
// May be overridden to allow multiple valid names.
|
// May be overridden to allow multiple valid names.
|
||||||
// Useful for backwards-compatible configurations when names change.
|
// Useful for backwards-compatible configurations when names change.
|
||||||
virtual bool IsMatchingName(std::string_view name) const;
|
virtual bool IsMatchingName(std::string_view name) const;
|
||||||
|
|
||||||
|
// May be overridden to hide in UI.
|
||||||
|
// Useful for backwards-compatible configurations when names change.
|
||||||
|
virtual bool IsHidden() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -164,6 +168,7 @@ protected:
|
|||||||
ControlState GetState() const override;
|
ControlState GetState() const override;
|
||||||
std::string GetName() const override;
|
std::string GetName() const override;
|
||||||
bool IsDetectable() const override;
|
bool IsDetectable() const override;
|
||||||
|
bool IsHidden() const override;
|
||||||
bool IsMatchingName(std::string_view name) const override;
|
bool IsMatchingName(std::string_view name) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user