From 1211acd59c42107c03c6a9cb3e3d60340c481353 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 15 Nov 2024 01:55:01 +0100 Subject: [PATCH] Qt: Add std::string GetSettingOptions This has the potential for some minor optimizations --- rpcs3/rpcs3qt/config_adapter.cpp | 9 +-- rpcs3/rpcs3qt/config_adapter.h | 4 +- rpcs3/rpcs3qt/emu_settings.cpp | 102 +++++++++++++++----------- rpcs3/rpcs3qt/emu_settings.h | 7 +- rpcs3/rpcs3qt/gs_frame.cpp | 8 +- rpcs3/rpcs3qt/gui_application.cpp | 20 ++--- rpcs3/rpcs3qt/gui_settings.cpp | 2 +- rpcs3/rpcs3qt/persistent_settings.cpp | 2 +- 8 files changed, 82 insertions(+), 72 deletions(-) diff --git a/rpcs3/rpcs3qt/config_adapter.cpp b/rpcs3/rpcs3qt/config_adapter.cpp index ea137f5fa3..bc6effef3d 100644 --- a/rpcs3/rpcs3qt/config_adapter.cpp +++ b/rpcs3/rpcs3qt/config_adapter.cpp @@ -48,14 +48,9 @@ namespace cfg_adapter return get_node(node, location.cbegin(), location.cend()); } - QStringList get_options(const cfg_location& location) + std::vector get_options(const cfg_location& location) { - QStringList values; - for (const std::string& value : cfg_adapter::get_cfg(g_cfg, location.cbegin(), location.cend()).to_list()) - { - values.append(QString::fromStdString(value)); - } - return values; + return cfg_adapter::get_cfg(g_cfg, location.cbegin(), location.cend()).to_list(); } static bool get_is_dynamic(const cfg_location& location) diff --git a/rpcs3/rpcs3qt/config_adapter.h b/rpcs3/rpcs3qt/config_adapter.h index f808b58f97..66bf71aa38 100644 --- a/rpcs3/rpcs3qt/config_adapter.h +++ b/rpcs3/rpcs3qt/config_adapter.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "emu_settings_type.h" #include "util/yaml.hpp" @@ -14,7 +12,7 @@ namespace cfg_adapter YAML::Node get_node(const YAML::Node& node, const cfg_location& location); /** Returns possible options for values for some particular setting.*/ - QStringList get_options(const cfg_location& location); + std::vector get_options(const cfg_location& location); /** Returns dynamic property for some particular setting.*/ bool get_is_dynamic(emu_settings_type type); diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 5d3f9bbaa7..8df69eea33 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -21,9 +21,6 @@ LOG_CHANNEL(cfg_log, "CFG"); extern std::string g_cfg_defaults; //! Default settings grabbed from Utilities/Config.h -inline std::string sstr(const QString& _in) { return _in.toStdString(); } -inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } - // Emit sorted YAML namespace { @@ -82,7 +79,7 @@ bool emu_settings::Init() // Make Vulkan default setting if it is supported if (m_render_creator->Vulkan.supported && !m_render_creator->Vulkan.adapters.empty()) { - const std::string adapter = sstr(::at32(m_render_creator->Vulkan.adapters, 0)); + const std::string adapter = ::at32(m_render_creator->Vulkan.adapters, 0).toStdString(); cfg_log.notice("Setting the default renderer to Vulkan. Default GPU: '%s'", adapter); Emu.SetDefaultRenderer(video_renderer::vulkan); Emu.SetDefaultGraphicsAdapter(adapter); @@ -297,7 +294,8 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, cfg_log.warning("EnhanceCombobox '%s': ignoring sorting request on ranged combo box", cfg_adapter::get_setting_name(type)); } - const QStringList range = GetSettingOptions(type); + const QStringList range = GetQStringSettingOptions(type); + ensure(!range.empty()); const int max_item = use_max ? max : range.last().toInt(); @@ -308,7 +306,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, } else { - const QStringList settings = GetSettingOptions(type); + const QStringList settings = GetQStringSettingOptions(type); for (int i = 0; i < settings.count(); i++) { @@ -348,7 +346,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, const std::string def = GetSettingDefault(type); const std::string selected = GetSetting(type); - const QString selected_q = qstr(selected); + const QString selected_q = QString::fromStdString(selected); int index; if (is_ranged) @@ -366,11 +364,11 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, if (is_ranged) { - index = combobox->findData(qstr(def)); + index = combobox->findData(QString::fromStdString(def)); } else { - index = find_index(combobox, qstr(def)); + index = find_index(combobox, QString::fromStdString(def)); } m_broken_types.insert(type); @@ -384,7 +382,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, if (is_ranged) { - SetSetting(type, sstr(combobox->itemData(index))); + SetSetting(type, combobox->itemData(index).toString().toStdString()); } else { @@ -393,7 +391,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, { fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", index, combobox->itemText(index), var_list.size(), combobox->count()); } - SetSetting(type, sstr(var_list[0])); + SetSetting(type, var_list[0].toString().toStdString()); } }); @@ -401,11 +399,11 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type, { if (is_ranged) { - combobox->setCurrentIndex(combobox->findData(qstr(def))); + combobox->setCurrentIndex(combobox->findData(QString::fromStdString(def))); } else { - combobox->setCurrentIndex(find_index(combobox, qstr(def))); + combobox->setCurrentIndex(find_index(combobox, QString::fromStdString(def))); } }); } @@ -469,9 +467,11 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin // If using offset from now, then we disable the keyboard tracking to reduce the numebr of events that occur (since for each event we will lose focus) date_time_edit->setKeyboardTracking(false); + const QStringList range = GetQStringSettingOptions(type); + ensure(!range.empty()); + bool ok_def = false, ok_min = false, ok_max = false; - const QStringList range = GetSettingOptions(type); - const s64 def = qstr(GetSettingDefault(type)).toLongLong(&ok_def); + const s64 def = QString::fromStdString(GetSettingDefault(type)).toLongLong(&ok_def); const s64 min = range.first().toLongLong(&ok_min); const s64 max = range.last().toLongLong(&ok_max); if (!ok_def || !ok_min || !ok_max) @@ -481,7 +481,7 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin } bool ok_sel = false; - s64 val = qstr(GetSetting(type)).toLongLong(&ok_sel); + s64 val = QString::fromStdString(GetSetting(type)).toLongLong(&ok_sel); if (!ok_sel || val < min || val > max) { cfg_log.error("EnhanceDateTimeEdit '%s' tried to set an invalid value: %d. Setting to default: %d. Allowed range: [%d, %d]", cfg_adapter::get_setting_name(type), val, def, min, max); @@ -509,7 +509,7 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin if (!date_time_edit->hasFocus() && (!date_time_edit->calendarPopup() || !date_time_edit->calendarWidget()->hasFocus())) { const QDateTime now = QDateTime::currentDateTime(); - const s64 offset = qstr(GetSetting(emu_settings_type::ConsoleTimeOffset)).toLongLong(); + const s64 offset = QString::fromStdString(GetSetting(emu_settings_type::ConsoleTimeOffset)).toLongLong(); date_time_edit->setDateTime(now.addSecs(offset)); date_time_edit->setDateTimeRange(now.addSecs(min), now.addSecs(max)); } @@ -525,8 +525,10 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin } else { - QString str = qstr(GetSettingDefault(type)); - const QStringList range = GetSettingOptions(type); + const QStringList range = GetQStringSettingOptions(type); + ensure(!range.empty()); + + QString str = QString::fromStdString(GetSettingDefault(type)); const QDateTime def = QDateTime::fromString(str, Qt::ISODate); const QDateTime min = QDateTime::fromString(range.first(), Qt::ISODate); const QDateTime max = QDateTime::fromString(range.last(), Qt::ISODate); @@ -536,7 +538,7 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin return; } - str = qstr(GetSetting(type)); + str = QString::fromStdString(GetSetting(type)); QDateTime val = QDateTime::fromString(str, Qt::ISODate); if (!val.isValid() || val < min || val > max) { @@ -544,7 +546,7 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin cfg_adapter::get_setting_name(type), val.toString(Qt::ISODate), def.toString(Qt::ISODate), min.toString(Qt::ISODate), max.toString(Qt::ISODate)); val = def; m_broken_types.insert(type); - SetSetting(type, sstr(def.toString(Qt::ISODate))); + SetSetting(type, def.toString(Qt::ISODate).toStdString()); } // we set the allowed limits @@ -577,7 +579,7 @@ void emu_settings::EnhanceDateTimeEdit(QDateTimeEdit* date_time_edit, emu_settin else { // date time will be written straight into settings - SetSetting(type, sstr(datetime.toString(Qt::ISODate))); + SetSetting(type, datetime.toString(Qt::ISODate).toStdString()); } }); } @@ -590,10 +592,12 @@ void emu_settings::EnhanceSlider(QSlider* slider, emu_settings_type type) return; } - const QStringList range = GetSettingOptions(type); + const QStringList range = GetQStringSettingOptions(type); + ensure(!range.empty()); + bool ok_def, ok_sel, ok_min, ok_max; - const int def = qstr(GetSettingDefault(type)).toInt(&ok_def); + const int def = QString::fromStdString(GetSettingDefault(type)).toInt(&ok_def); const int min = range.first().toInt(&ok_min); const int max = range.last().toInt(&ok_max); @@ -603,7 +607,7 @@ void emu_settings::EnhanceSlider(QSlider* slider, emu_settings_type type) return; } - const QString selected = qstr(GetSetting(type)); + const QString selected = QString::fromStdString(GetSetting(type)); int val = selected.toInt(&ok_sel); if (!ok_sel || val < min || val > max) @@ -618,7 +622,7 @@ void emu_settings::EnhanceSlider(QSlider* slider, emu_settings_type type) connect(slider, &QSlider::valueChanged, this, [type, this](int value) { - SetSetting(type, sstr(value)); + SetSetting(type, QString::number(value).toStdString()); }); connect(this, &emu_settings::RestoreDefaultsSignal, slider, [def, slider]() @@ -635,10 +639,12 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, emu_settings_type type, con return; } - const QStringList range = GetSettingOptions(type); + const QStringList range = GetQStringSettingOptions(type); + ensure(!range.empty()); + bool ok_def, ok_sel, ok_min, ok_max; - const int def = qstr(GetSettingDefault(type)).toInt(&ok_def); + const int def = QString::fromStdString(GetSettingDefault(type)).toInt(&ok_def); const int min = range.first().toInt(&ok_min); const int max = range.last().toInt(&ok_max); @@ -649,7 +655,7 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, emu_settings_type type, con } const std::string selected = GetSetting(type); - int val = qstr(selected).toInt(&ok_sel); + int val = QString::fromStdString(selected).toInt(&ok_sel); if (!ok_sel || val < min || val > max) { @@ -666,7 +672,7 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, emu_settings_type type, con connect(spinbox, &QSpinBox::textChanged, this, [type, spinbox, this](const QString& /* text*/) { if (!spinbox) return; - SetSetting(type, sstr(spinbox->cleanText())); + SetSetting(type, spinbox->cleanText().toStdString()); }); connect(this, &emu_settings::RestoreDefaultsSignal, spinbox, [def, spinbox]() @@ -683,11 +689,13 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, emu_settings_ty return; } - const QStringList range = GetSettingOptions(type); + const std::vector range = GetSettingOptions(type); + ensure(!range.empty()); + const std::string def_s = GetSettingDefault(type); const std::string val_s = GetSetting(type); - const std::string min_s = sstr(range.first()); - const std::string max_s = sstr(range.last()); + const std::string& min_s = range.front(); + const std::string& max_s = range.back(); // cfg::_float range is in s32 constexpr s32 min_value = ::std::numeric_limits::min(); @@ -720,7 +728,7 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, emu_settings_ty connect(spinbox, &QDoubleSpinBox::textChanged, this, [type, spinbox, this](const QString& /* text*/) { if (!spinbox) return; - SetSetting(type, sstr(spinbox->cleanText())); + SetSetting(type, spinbox->cleanText().toStdString()); }); connect(this, &emu_settings::RestoreDefaultsSignal, spinbox, [def, spinbox]() @@ -738,7 +746,7 @@ void emu_settings::EnhanceLineEdit(QLineEdit* edit, emu_settings_type type) } const std::string set_text = GetSetting(type); - edit->setText(qstr(set_text)); + edit->setText(QString::fromStdString(set_text)); connect(edit, &QLineEdit::textChanged, this, [type, this](const QString &text) { @@ -747,12 +755,12 @@ void emu_settings::EnhanceLineEdit(QLineEdit* edit, emu_settings_type type) { cfg_log.warning("EnhanceLineEdit '%s' input was trimmed", cfg_adapter::get_setting_name(type)); } - SetSetting(type, sstr(trimmed)); + SetSetting(type, trimmed.toStdString()); }); connect(this, &emu_settings::RestoreDefaultsSignal, edit, [this, edit, type]() { - edit->setText(qstr(GetSettingDefault(type))); + edit->setText(QString::fromStdString(GetSettingDefault(type))); }); } @@ -764,9 +772,9 @@ void emu_settings::EnhanceRadioButton(QButtonGroup* button_group, emu_settings_t return; } - const QString selected = qstr(GetSetting(type)); - const QString def = qstr(GetSettingDefault(type)); - const QStringList options = GetSettingOptions(type); + const QString selected = QString::fromStdString(GetSetting(type)); + const QString def = QString::fromStdString(GetSettingDefault(type)); + const QStringList options = GetQStringSettingOptions(type); if (button_group->buttons().count() < options.size()) { @@ -796,7 +804,7 @@ void emu_settings::EnhanceRadioButton(QButtonGroup* button_group, emu_settings_t def_pos = i; } - connect(button, &QAbstractButton::toggled, this, [this, type, val = sstr(option)](bool checked) + connect(button, &QAbstractButton::toggled, this, [this, type, val = option.toStdString()](bool checked) { if (checked) { @@ -835,11 +843,21 @@ void emu_settings::SaveSelectedLibraries(const std::vector& libs) m_current_settings["Core"]["Libraries Control"] = libs; } -QStringList emu_settings::GetSettingOptions(emu_settings_type type) +std::vector emu_settings::GetSettingOptions(emu_settings_type type) { return cfg_adapter::get_options(::at32(settings_location, type)); } +QStringList emu_settings::GetQStringSettingOptions(emu_settings_type type) +{ + QStringList values; + for (const std::string& value : cfg_adapter::get_options(::at32(settings_location, type))) + { + values.append(QString::fromStdString(value)); + } + return values; +} + std::string emu_settings::GetSettingDefault(emu_settings_type type) const { if (const auto node = cfg_adapter::get_node(m_default_settings, ::at32(settings_location, type)); node && node.IsScalar()) diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index c533d35e96..73e369245f 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -18,8 +18,6 @@ #include #include -constexpr auto qstr = QString::fromStdString; - class emu_settings : public QObject { /** A settings class for Emulator specific settings. This class is a refactored version of the wx version. It is much nicer @@ -64,7 +62,10 @@ public: void SaveSelectedLibraries(const std::vector& libs); /** Returns the valid options for a given setting.*/ - static QStringList GetSettingOptions(emu_settings_type type); + static std::vector GetSettingOptions(emu_settings_type type); + + /** Returns the valid options for a given setting.*/ + static QStringList GetQStringSettingOptions(emu_settings_type type); /** Returns the default value of the setting type.*/ std::string GetSettingDefault(emu_settings_type type) const; diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index 4239ca63f5..b86fd5f457 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -67,8 +67,6 @@ bool is_input_allowed() return g_game_window_focused || g_cfg.io.background_input_enabled; } -constexpr auto qstr = QString::fromStdString; - gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon, std::shared_ptr gui_settings, bool force_fullscreen) : QWindow() , m_initial_geometry(geometry) @@ -118,7 +116,7 @@ gs_frame::gs_frame(QScreen* screen, const QRect& geometry, const QIcon& appIcon, setMinimumHeight(90); setScreen(screen); setGeometry(geometry); - setTitle(qstr(m_window_title)); + setTitle(QString::fromStdString(m_window_title)); if (g_cfg.video.renderer != video_renderer::opengl) { @@ -752,7 +750,7 @@ void gs_frame::flip(draw_context_t, bool /*skip_frame*/) Emu.CallFromMainThread([this, title = std::move(new_title)]() { - setTitle(qstr(title)); + setTitle(QString::fromStdString(title)); }); } @@ -941,7 +939,7 @@ void gs_frame::take_screenshot(std::vector data, u32 sshot_width, u32 sshot_ QImage overlay_img; - if (!overlay_img.load(qstr(cell_sshot_overlay_path))) + if (!overlay_img.load(QString::fromStdString(cell_sshot_overlay_path))) { screenshot_log.error("Failed to read cell screenshot overlay '%s' : %s", cell_sshot_overlay_path, fs::g_tls_error); return; diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 673872c2e6..831ec24686 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -111,9 +111,9 @@ bool gui_application::Init() } } - m_emu_settings.reset(new emu_settings()); - m_gui_settings.reset(new gui_settings()); - m_persistent_settings.reset(new persistent_settings()); + m_emu_settings = std::make_shared(); + m_gui_settings = std::make_shared(); + m_persistent_settings = std::make_shared(); if (!m_emu_settings->Init()) { @@ -620,7 +620,7 @@ void gui_application::InitializeCallbacks() // Create a new sound effect. Re-using the same object seems to be broken for some users starting with Qt 6.6.3. std::unique_ptr sound_effect = std::make_unique(); - sound_effect->setSource(QUrl::fromLocalFile(qstr(path))); + sound_effect->setSource(QUrl::fromLocalFile(QString::fromStdString(path))); sound_effect->setVolume(g_cfg.audio.volume * 0.01f); sound_effect->play(); @@ -783,7 +783,7 @@ void gui_application::InitializeCallbacks() old_written = bytes_written; - pdlg->setLabelText(text_base.arg(gui::utils::format_byte_size(bytes_written)).arg(*half_seconds / 2).arg(qstr(verbose_message))); + pdlg->setLabelText(text_base.arg(gui::utils::format_byte_size(bytes_written)).arg(*half_seconds / 2).arg(QString::fromStdString(verbose_message))); // 300MB -> 50%, 600MB -> 75%, 1200MB -> 87.5% etc const int percent = std::clamp(static_cast(100. - 100. / std::pow(2., std::fmax(0.01, bytes_written * 1. / (300 * 1024 * 1024)))), 2, 100); @@ -820,7 +820,7 @@ void gui_application::StartPlaytime(bool start_playtime = true) return; } - const QString serial = qstr(Emu.GetTitleID()); + const QString serial = QString::fromStdString(Emu.GetTitleID()); if (serial.isEmpty()) { return; @@ -839,7 +839,7 @@ void gui_application::UpdatePlaytime() return; } - const QString serial = qstr(Emu.GetTitleID()); + const QString serial = QString::fromStdString(Emu.GetTitleID()); if (serial.isEmpty()) { m_timer_playtime.invalidate(); @@ -858,7 +858,7 @@ void gui_application::StopPlaytime() if (!m_timer_playtime.isValid()) return; - const QString serial = qstr(Emu.GetTitleID()); + const QString serial = QString::fromStdString(Emu.GetTitleID()); if (serial.isEmpty()) { m_timer_playtime.invalidate(); @@ -1004,10 +1004,10 @@ void gui_application::OnChangeStyleSheetRequest() if (QFile file(stylesheet_path); !stylesheet_path.isEmpty() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { - const QString config_dir = qstr(fs::get_config_dir()); + const QString config_dir = QString::fromStdString(fs::get_config_dir()); // Add PS3 fonts - QDirIterator ps3_font_it(qstr(g_cfg_vfs.get_dev_flash() + "data/font/"), QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories); + QDirIterator ps3_font_it(QString::fromStdString(g_cfg_vfs.get_dev_flash() + "data/font/"), QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories); while (ps3_font_it.hasNext()) QFontDatabase::addApplicationFont(ps3_font_it.next()); diff --git a/rpcs3/rpcs3qt/gui_settings.cpp b/rpcs3/rpcs3qt/gui_settings.cpp index 040c0a948a..ecbee10aff 100644 --- a/rpcs3/rpcs3qt/gui_settings.cpp +++ b/rpcs3/rpcs3qt/gui_settings.cpp @@ -108,7 +108,7 @@ namespace gui gui_settings::gui_settings(QObject* parent) : settings(parent) { - m_settings.reset(new QSettings(ComputeSettingsDir() + gui::Settings + ".ini", QSettings::Format::IniFormat, parent)); + m_settings = std::make_unique(ComputeSettingsDir() + gui::Settings + ".ini", QSettings::Format::IniFormat, parent); } QStringList gui_settings::GetGameListCategoryFilters(bool is_list_mode) const diff --git a/rpcs3/rpcs3qt/persistent_settings.cpp b/rpcs3/rpcs3qt/persistent_settings.cpp index e8ea9152f0..c18f8a1a1d 100644 --- a/rpcs3/rpcs3qt/persistent_settings.cpp +++ b/rpcs3/rpcs3qt/persistent_settings.cpp @@ -8,7 +8,7 @@ LOG_CHANNEL(cfg_log, "CFG"); persistent_settings::persistent_settings(QObject* parent) : settings(parent) { // Don't use the .ini file ending for now, as it will be confused for a regular gui_settings file. - m_settings.reset(new QSettings(ComputeSettingsDir() + gui::persistent::persistent_file_name + ".dat", QSettings::Format::IniFormat, parent)); + m_settings = std::make_unique(ComputeSettingsDir() + gui::persistent::persistent_file_name + ".dat", QSettings::Format::IniFormat, parent); } void persistent_settings::SetPlaytime(const QString& serial, quint64 playtime, bool sync)