代码拉取完成,页面将自动刷新
#include "settings.h"
#include <QApplication>
#include <QDir>
#include <QHostInfo>
#include <QSettings>
#include <QStandardPaths>
QString Settings::deviceName()
{
QString d = QHostInfo::localHostName();
return QSettings("config.ini", QSettings::IniFormat).value("deviceName", d).toString();
}
QString Settings::downloadPath()
{
QString d = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
d += QDir::separator() + QApplication::applicationName();
return QSettings("config.ini", QSettings::IniFormat).value("downloadPath", d).toString();
}
bool Settings::discoverable()
{
return QSettings("config.ini", QSettings::IniFormat).value("discoverable", true).toBool();
}
quint16 Settings::serverPort()
{
return QSettings("config.ini", QSettings::IniFormat).value("serverPort", TRANSFER_PORT).toUInt();
}
void Settings::setDeviceName(const QString &deviceName)
{
QSettings("config.ini", QSettings::IniFormat).setValue("deviceName", deviceName);
}
void Settings::setDownloadPath(const QString &downloadPath)
{
QSettings("config.ini", QSettings::IniFormat).setValue("downloadPath", downloadPath);
}
void Settings::setDiscoverable(bool discoverable)
{
QSettings("config.ini", QSettings::IniFormat).setValue("discoverable", discoverable);
}
void Settings::setServerPort(quint16 serverPort)
{
QSettings("config.ini", QSettings::IniFormat).setValue("serverPort", serverPort);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。