mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-15 02:44:41 +00:00
Qt: Prefer eliding source over the middle of the binding
Makes arrows more readable.
This commit is contained in:
@@ -594,8 +594,17 @@ bool Achievements::CreateClient(rc_client_t** client, std::unique_ptr<HTTPDownlo
|
||||
rc_client_set_userdata(new_client, http->get());
|
||||
|
||||
// Allow custom host to be overridden through config.
|
||||
if (const std::string host = Host::GetBaseStringSettingValue("Cheevos", "Host"); !host.empty())
|
||||
rc_client_set_host(new_client, host.c_str());
|
||||
if (std::string host = Host::GetBaseStringSettingValue("Cheevos", "Host"); !host.empty())
|
||||
{
|
||||
// drop trailing hash, rc_client appends its own
|
||||
while (!host.empty() && host.back() == '/')
|
||||
host.pop_back();
|
||||
if (!host.empty())
|
||||
{
|
||||
INFO_COLOR_LOG(StrongOrange, "Using alternative host for achievements: {}", host);
|
||||
rc_client_set_host(new_client, host.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
*client = new_client;
|
||||
return true;
|
||||
|
||||
@@ -66,7 +66,15 @@ void InputBindingWidget::updateElidedText()
|
||||
const int button_margin = style()->pixelMetric(QStyle::PM_ButtonMargin, nullptr, this);
|
||||
const int frame_width = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, this);
|
||||
const int text_width = std::max(1, width() - button_margin - frame_width * 2);
|
||||
QString elided = fontMetrics().elidedText(m_full_text, Qt::ElideMiddle, text_width);
|
||||
const QFontMetrics fm = fontMetrics();
|
||||
QString elided = fm.elidedText(m_full_text, Qt::ElideMiddle, text_width);
|
||||
|
||||
// prefer removing the source part first
|
||||
if (elided != m_full_text)
|
||||
{
|
||||
if (const qsizetype pos = m_full_text.indexOf('/'); pos >= 0)
|
||||
elided = fm.elidedText(m_full_text.mid(pos + 1), Qt::ElideMiddle, text_width);
|
||||
}
|
||||
|
||||
// fix up accelerators
|
||||
if (elided.contains('&'))
|
||||
|
||||
Reference in New Issue
Block a user