mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 04:18:39 +00:00
Fix building transmission with C++23 (#6832)
* fix: operator== should return bool in tr_strbuf Fixes build error with C++20/C++23 error: return type 'auto' of selected 'operator==' function for rewritten '!=' comparison is not 'bool' Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: explicitly specify Blocklist::size() return type as size_t Fixes building with C++20/C++23 error: no matching function for call to 'size' function 'size' with deduced return type cannot be used before it is defined Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: wrap runtime format strings with fmt::runtime in library, daemon and cli fmt::format_string ctor is consteval with C++20 See https://github.com/fmtlib/fmt/issues/2438 Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: wrap runtime format strings with fmt::runtime for GTK client Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: allow to override C and CXX standard via cmdline or env Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: add job to check if transmission compiles with C++23 Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * Address code review by mikedld Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix new found fmt build errors Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * Address code review by tearfur Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> * fix: make tr_net_init_mgr singleton buildable with C++23 Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> --------- Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
committed by
GitHub
parent
24f58f70ee
commit
7e87adcd91
@@ -380,8 +380,9 @@ void MainWindow::Impl::syncAltSpeedButton()
|
||||
bool const b = gtr_pref_flag_get(TR_KEY_alt_speed_enabled);
|
||||
alt_speed_button_->set_active(b);
|
||||
alt_speed_button_->set_tooltip_text(fmt::format(
|
||||
b ? _("Click to disable Alternative Speed Limits\n ({download_speed} down, {upload_speed} up)") :
|
||||
_("Click to enable Alternative Speed Limits\n ({download_speed} down, {upload_speed} up)"),
|
||||
fmt::runtime(
|
||||
b ? _("Click to disable Alternative Speed Limits\n ({download_speed} down, {upload_speed} up)") :
|
||||
_("Click to enable Alternative Speed Limits\n ({download_speed} down, {upload_speed} up)")),
|
||||
fmt::arg("download_speed", Speed{ gtr_pref_int_get(TR_KEY_alt_speed_down), Speed::Units::KByps }.to_string()),
|
||||
fmt::arg("upload_speed", Speed{ gtr_pref_int_get(TR_KEY_alt_speed_up), Speed::Units::KByps }.to_string())));
|
||||
}
|
||||
@@ -579,7 +580,9 @@ void MainWindow::Impl::onOptionsClicked()
|
||||
|
||||
update_menu(
|
||||
ratio_menu_info_,
|
||||
fmt::format(_("Stop at Ratio ({ratio})"), fmt::arg("ratio", tr_strlratio(gtr_pref_double_get(TR_KEY_ratio_limit)))),
|
||||
fmt::format(
|
||||
fmt::runtime(_("Stop at Ratio ({ratio})")),
|
||||
fmt::arg("ratio", tr_strlratio(gtr_pref_double_get(TR_KEY_ratio_limit)))),
|
||||
TR_KEY_ratio_limit_enabled);
|
||||
}
|
||||
|
||||
@@ -760,13 +763,13 @@ void MainWindow::Impl::updateStats()
|
||||
if (auto const pch = gtr_pref_string_get(TR_KEY_statusbar_stats); pch == "session-ratio")
|
||||
{
|
||||
auto const stats = tr_sessionGetStats(session);
|
||||
buf = fmt::format(_("Ratio: {ratio}"), fmt::arg("ratio", tr_strlratio(stats.ratio)));
|
||||
buf = fmt::format(fmt::runtime(_("Ratio: {ratio}")), fmt::arg("ratio", tr_strlratio(stats.ratio)));
|
||||
}
|
||||
else if (pch == "session-transfer")
|
||||
{
|
||||
auto const stats = tr_sessionGetStats(session);
|
||||
buf = fmt::format(
|
||||
C_("current session totals", "Down: {downloaded_size}, Up: {uploaded_size}"),
|
||||
fmt::runtime(C_("current session totals", "Down: {downloaded_size}, Up: {uploaded_size}")),
|
||||
fmt::arg("downloaded_size", tr_strlsize(stats.downloadedBytes)),
|
||||
fmt::arg("uploaded_size", tr_strlsize(stats.uploadedBytes)));
|
||||
}
|
||||
@@ -774,14 +777,14 @@ void MainWindow::Impl::updateStats()
|
||||
{
|
||||
auto const stats = tr_sessionGetCumulativeStats(session);
|
||||
buf = fmt::format(
|
||||
C_("all-time totals", "Down: {downloaded_size}, Up: {uploaded_size}"),
|
||||
fmt::runtime(C_("all-time totals", "Down: {downloaded_size}, Up: {uploaded_size}")),
|
||||
fmt::arg("downloaded_size", tr_strlsize(stats.downloadedBytes)),
|
||||
fmt::arg("uploaded_size", tr_strlsize(stats.uploadedBytes)));
|
||||
}
|
||||
else /* default is total-ratio */
|
||||
{
|
||||
auto const stats = tr_sessionGetCumulativeStats(session);
|
||||
buf = fmt::format(_("Ratio: {ratio}"), fmt::arg("ratio", tr_strlratio(stats.ratio)));
|
||||
buf = fmt::format(fmt::runtime(_("Ratio: {ratio}")), fmt::arg("ratio", tr_strlratio(stats.ratio)));
|
||||
}
|
||||
|
||||
stats_lb_->set_text(buf);
|
||||
|
||||
Reference in New Issue
Block a user