Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,6 @@ Device File ="toml_Device File" #10 : 设备文件
#4-3-2.双匹配key需要两个值同时匹配:key2:"Vendor_ID 和 Product_ID"("物理ID"中VID和PID值); key3:"Vendor 和 Name"(制造商和名称); 。
#4-4.匹配生效后表头下面每行key名与对应设备管理器中显示每条信息名一致,其值则会被显示到对应界面。
#4-3.若匹配key匹配上某一设备且值尾包括有"_NOUSE"则该个设备所有信息将被删除显示。
#4-4.增加一个设备信息则不需要匹配;没有写入该文件的表头所代表设备将不会被修改;没有写入该文件的key值所代表设备信息将不会被修改。
#4-4.增加一个设备信息则不需要匹配;没有写入该文件的表头所代表设备将不会被修改;没有写入该文件的key值所代表设备信息将不会被修改。
#4-5.1 增加 tomlmatchkey = { Size = "512", Name = "xname" } # 内联表 "{Size:512G}{Name:xx1}{Vendor:xx2}" # 匹配键名
#4-5.2 增加 tomlconfigdemanding ="adjust" # 配置需求 “adjust delete add”
18 changes: 14 additions & 4 deletions deepin-devicemanager/assets/org.deepin.devicemanager.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"permissions": "readwrite",
"visibility": "public"
},
"specialComType": {
"specialComType": {
"value": -1,
"serial": 0,
"flags": ["global"],
Expand All @@ -24,6 +24,16 @@
"description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5)",
"permissions": "readwrite",
"visibility": "private"
}
}
}
},
"TomlFilesName": {
"value": "tomlFilesName",
"serial": 0,
"flags": ["global"],
"name": "config the toml name",
"name[zh_CN]": "设置toml文件名",
"description": "此配置项默认为无效的。如需让toml文件内容显示生效,请配置对应文件名。需保证操作者具备读取权限。",
"permissions": "readwrite",
"visibility": "private"
}
}
}
4 changes: 2 additions & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ void DeviceAudio::loadTableData()
QString tName = m_Name;

if (!available()) {
tName = "(" + tr("Unavailable") + ") " + m_Name;
tName = "(" + translateStr("Unavailable") + ") " + m_Name;
}

if (!enable()) {
tName = "(" + tr("Disable") + ") " + m_Name;
tName = "(" + translateStr("Disable") + ") " + m_Name;
}

m_TableData.append(tName);
Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/src/DeviceManager/DeviceBios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool DeviceBios::isBoard()const

QString DeviceBios::subTitle()
{
return QObject::tr(m_Name.toLatin1());
return translateStr(m_Name);
}

const QString DeviceBios::getOverviewInfo()
Expand Down
22 changes: 2 additions & 20 deletions deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,6 @@ TomlFixMethod DeviceBluetooth::setInfoFromTomlOneByOne(const QMap<QString, QStri
return ret;
}

bool DeviceBluetooth::setInfoFromWifiInfo(const QMap<QString, QString> &mapInfo)
{
// 机器自身蓝牙
const QList<QPair<QString, QString> > &otherAttribs = getOtherAttribs();
QMap<QString, QString> tmpMaps;
for (QPair<QString, QString> attrib : otherAttribs) {
tmpMaps[attrib.first] = attrib.second;
}

if ("UART" == tmpMaps[QObject::tr("Bus")]) {//内置:UART 外接USB:USB
setAttribute(mapInfo, "Chip Type", m_Name);
setAttribute(mapInfo, "Vendor", m_Vendor);
return true;
} else {
return false;
}
}

const QString &DeviceBluetooth::name()const
{
return m_Model;
Expand Down Expand Up @@ -268,11 +250,11 @@ void DeviceBluetooth::loadTableData()
QString tName = m_Name;

if (!available()) {
tName = "(" + tr("Unavailable") + ") " + m_Name;
tName = "(" + translateStr("Unavailable") + ") " + m_Name;
}

if (!enable()) {
tName = "(" + tr("Disable") + ") " + m_Name;
tName = "(" + translateStr("Disable") + ") " + m_Name;
}

m_TableData.append(tName);
Expand Down
7 changes: 0 additions & 7 deletions deepin-devicemanager/src/DeviceManager/DeviceBluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ class DeviceBluetooth : public DeviceBaseInfo
*/
TomlFixMethod setInfoFromTomlOneByOne(const QMap<QString, QString> &mapInfo);

/**
* @brief setInfoFromWifiInfo:设置从cat /sys/hisys/wal/wifi_devices_info里面获取的信息
* @param mapInfo: 由cat /sys/hisys/wal/wifi_devices_info获取的信息map
* @return 布尔值,true:信息设置成功;false:信息设置失败
*/
bool setInfoFromWifiInfo(const QMap<QString, QString> &mapInfo);

/**
* @brief name:获取名称属性值
* @return QString:名称属性值
Expand Down
4 changes: 2 additions & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceCdrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ void DeviceCdrom::loadTableData()
QString tName = m_Name;

if (!available()) {
tName = "(" + tr("Unavailable") + ") " + m_Name;
tName = "(" + translateStr("Unavailable") + ") " + m_Name;
}

if (!enable()) {
tName = "(" + tr("Disable") + ") " + m_Name;
tName = "(" + translateStr("Disable") + ") " + m_Name;
}

m_TableData.append(tName);
Expand Down
164 changes: 82 additions & 82 deletions deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool DeviceCpu::frequencyIsRange()const

QString DeviceCpu::subTitle()
{
return QString("%1 %2").arg(QObject::tr("Processor")).arg(m_PhysicalID);
return QString("%1 %2").arg(translateStr("Processor")).arg(m_PhysicalID);
}

const QString DeviceCpu::getOverviewInfo()
Expand All @@ -115,9 +115,9 @@ const QString DeviceCpu::getOverviewInfo()
QString ov = QString("%1 (%2%3 / %4%5)") \
.arg(m_Name) \
.arg(m_trNumber[m_CPUCoreNum]) \
.arg(QObject::tr("Core(s)")) \
.arg(translateStr("Core(s)")) \
.arg(m_trNumber[m_LogicalCPUNum]) \
.arg(QObject::tr("Processor"));
.arg(translateStr("Processor"));

return ov;
}
Expand Down Expand Up @@ -302,85 +302,85 @@ void DeviceCpu::loadTableData()
void DeviceCpu::getTrNumber()
{
// 将数字转换为英文翻译
m_trNumber.insert(1, QObject::tr("One"));
m_trNumber.insert(2, QObject::tr("Two"));
m_trNumber.insert(4, QObject::tr("Four"));
m_trNumber.insert(6, QObject::tr("Six"));
m_trNumber.insert(8, QObject::tr("Eight"));
m_trNumber.insert(9, QObject::tr("Nine"));
m_trNumber.insert(10, QObject::tr("Ten"));
m_trNumber.insert(12, QObject::tr("Twelve"));
m_trNumber.insert(14, QObject::tr("Fourteen"));
m_trNumber.insert(16, QObject::tr("Sixteen"));
m_trNumber.insert(18, QObject::tr("Eighteen"));

m_trNumber.insert(20, QObject::tr("Twenty"));
m_trNumber.insert(22, QObject::tr("Twenty-two"));
m_trNumber.insert(24, QObject::tr("Twenty-four"));
m_trNumber.insert(26, QObject::tr("Twenty-six"));
m_trNumber.insert(28, QObject::tr("Twenty-eight"));

m_trNumber.insert(30, QObject::tr("Thirty"));
m_trNumber.insert(32, QObject::tr("Thirty-two"));
m_trNumber.insert(34, QObject::tr("Thirty-four"));
m_trNumber.insert(36, QObject::tr("Thirty-six"));
m_trNumber.insert(38, QObject::tr("Thirty-eight"));

m_trNumber.insert(40, QObject::tr("Forty"));
m_trNumber.insert(42, QObject::tr("Forty-two"));
m_trNumber.insert(44, QObject::tr("Forty-four"));
m_trNumber.insert(46, QObject::tr("Forty-six"));
m_trNumber.insert(48, QObject::tr("Forty-eight"));

m_trNumber.insert(50, QObject::tr("Fifty"));
m_trNumber.insert(52, QObject::tr("Fifty-two"));
m_trNumber.insert(54, QObject::tr("Fifty-four"));
m_trNumber.insert(56, QObject::tr("Fifty-six"));
m_trNumber.insert(58, QObject::tr("Fifty-eight"));

m_trNumber.insert(60, QObject::tr("Sixty"));
m_trNumber.insert(62, QObject::tr("Sixty-two"));
m_trNumber.insert(64, QObject::tr("Sixty-four"));
m_trNumber.insert(66, QObject::tr("Sixty-six"));
m_trNumber.insert(68, QObject::tr("Sixty-eight"));

m_trNumber.insert(70, QObject::tr("Seventy"));
m_trNumber.insert(72, QObject::tr("Seventy-two"));
m_trNumber.insert(74, QObject::tr("Seventy-four"));
m_trNumber.insert(76, QObject::tr("Seventy-six"));
m_trNumber.insert(78, QObject::tr("Seventy-eight"));

m_trNumber.insert(80, QObject::tr("Eighty"));
m_trNumber.insert(82, QObject::tr("Eighty-two"));
m_trNumber.insert(84, QObject::tr("Eighty-four"));
m_trNumber.insert(86, QObject::tr("Eighty-six"));
m_trNumber.insert(88, QObject::tr("Eighty-eight"));

m_trNumber.insert(90, QObject::tr("Ninety"));
m_trNumber.insert(92, QObject::tr("Ninety-two"));
m_trNumber.insert(94, QObject::tr("Ninety-four"));
m_trNumber.insert(96, QObject::tr("Ninety-six"));
m_trNumber.insert(98, QObject::tr("Ninety-eight"));

m_trNumber.insert(100, QObject::tr("One hundred"));
m_trNumber.insert(102, QObject::tr("One hundred and Two"));
m_trNumber.insert(104, QObject::tr("One hundred and four"));
m_trNumber.insert(106, QObject::tr("One hundred and Six"));
m_trNumber.insert(108, QObject::tr("One hundred and Eight"));

m_trNumber.insert(110, QObject::tr("One hundred and Ten"));
m_trNumber.insert(112, QObject::tr("One hundred and Twelve"));
m_trNumber.insert(114, QObject::tr("One hundred and Fourteen"));
m_trNumber.insert(116, QObject::tr("One hundred and Sixteen"));
m_trNumber.insert(118, QObject::tr("One hundred and Eighteen"));

m_trNumber.insert(120, QObject::tr("One hundred and Twenty"));
m_trNumber.insert(122, QObject::tr("One hundred and Twenty-two"));
m_trNumber.insert(124, QObject::tr("One hundred and Twenty-four"));
m_trNumber.insert(126, QObject::tr("One hundred and Twenty-six"));
m_trNumber.insert(128, QObject::tr("One hundred and Twenty-eight"));
m_trNumber.insert(192, QObject::tr("One hundred and Ninety-two"));
m_trNumber.insert(256, QObject::tr("Two hundred and fifty-six"));
m_trNumber.insert(1, translateStr("One"));
m_trNumber.insert(2, translateStr("Two"));
m_trNumber.insert(4, translateStr("Four"));
m_trNumber.insert(6, translateStr("Six"));
m_trNumber.insert(8, translateStr("Eight"));
m_trNumber.insert(9, translateStr("Nine"));
m_trNumber.insert(10, translateStr("Ten"));
m_trNumber.insert(12, translateStr("Twelve"));
m_trNumber.insert(14, translateStr("Fourteen"));
m_trNumber.insert(16, translateStr("Sixteen"));
m_trNumber.insert(18, translateStr("Eighteen"));

m_trNumber.insert(20, translateStr("Twenty"));
m_trNumber.insert(22, translateStr("Twenty-two"));
m_trNumber.insert(24, translateStr("Twenty-four"));
m_trNumber.insert(26, translateStr("Twenty-six"));
m_trNumber.insert(28, translateStr("Twenty-eight"));

m_trNumber.insert(30, translateStr("Thirty"));
m_trNumber.insert(32, translateStr("Thirty-two"));
m_trNumber.insert(34, translateStr("Thirty-four"));
m_trNumber.insert(36, translateStr("Thirty-six"));
m_trNumber.insert(38, translateStr("Thirty-eight"));

m_trNumber.insert(40, translateStr("Forty"));
m_trNumber.insert(42, translateStr("Forty-two"));
m_trNumber.insert(44, translateStr("Forty-four"));
m_trNumber.insert(46, translateStr("Forty-six"));
m_trNumber.insert(48, translateStr("Forty-eight"));

m_trNumber.insert(50, translateStr("Fifty"));
m_trNumber.insert(52, translateStr("Fifty-two"));
m_trNumber.insert(54, translateStr("Fifty-four"));
m_trNumber.insert(56, translateStr("Fifty-six"));
m_trNumber.insert(58, translateStr("Fifty-eight"));

m_trNumber.insert(60, translateStr("Sixty"));
m_trNumber.insert(62, translateStr("Sixty-two"));
m_trNumber.insert(64, translateStr("Sixty-four"));
m_trNumber.insert(66, translateStr("Sixty-six"));
m_trNumber.insert(68, translateStr("Sixty-eight"));

m_trNumber.insert(70, translateStr("Seventy"));
m_trNumber.insert(72, translateStr("Seventy-two"));
m_trNumber.insert(74, translateStr("Seventy-four"));
m_trNumber.insert(76, translateStr("Seventy-six"));
m_trNumber.insert(78, translateStr("Seventy-eight"));

m_trNumber.insert(80, translateStr("Eighty"));
m_trNumber.insert(82, translateStr("Eighty-two"));
m_trNumber.insert(84, translateStr("Eighty-four"));
m_trNumber.insert(86, translateStr("Eighty-six"));
m_trNumber.insert(88, translateStr("Eighty-eight"));

m_trNumber.insert(90, translateStr("Ninety"));
m_trNumber.insert(92, translateStr("Ninety-two"));
m_trNumber.insert(94, translateStr("Ninety-four"));
m_trNumber.insert(96, translateStr("Ninety-six"));
m_trNumber.insert(98, translateStr("Ninety-eight"));

m_trNumber.insert(100, translateStr("One hundred"));
m_trNumber.insert(102, translateStr("One hundred and Two"));
m_trNumber.insert(104, translateStr("One hundred and four"));
m_trNumber.insert(106, translateStr("One hundred and Six"));
m_trNumber.insert(108, translateStr("One hundred and Eight"));

m_trNumber.insert(110, translateStr("One hundred and Ten"));
m_trNumber.insert(112, translateStr("One hundred and Twelve"));
m_trNumber.insert(114, translateStr("One hundred and Fourteen"));
m_trNumber.insert(116, translateStr("One hundred and Sixteen"));
m_trNumber.insert(118, translateStr("One hundred and Eighteen"));

m_trNumber.insert(120, translateStr("One hundred and Twenty"));
m_trNumber.insert(122, translateStr("One hundred and Twenty-two"));
m_trNumber.insert(124, translateStr("One hundred and Twenty-four"));
m_trNumber.insert(126, translateStr("One hundred and Twenty-six"));
m_trNumber.insert(128, translateStr("One hundred and Twenty-eight"));
m_trNumber.insert(192, translateStr("One hundred and Ninety-two"));
m_trNumber.insert(256, translateStr("Two hundred and fifty-six"));
}


2 changes: 1 addition & 1 deletion deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void DeviceGpu::loadTableData()
// 加载表格内容
QString tName = m_Name;
if (!available()) {
tName = "(" + tr("Unavailable") + ") " + m_Name;
tName = "(" + translateStr("Unavailable") + ") " + m_Name;
}
m_TableData.append(tName);
m_TableData.append(m_Vendor);
Expand Down
4 changes: 2 additions & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ void DeviceImage::loadTableData()
QString tName = m_Name;

if (!available()) {
tName = "(" + tr("Unavailable") + ") " + m_Name;
tName = "(" + translateStr("Unavailable") + ") " + m_Name;
}

if (!enable()) {
tName = "(" + tr("Disable") + ") " + m_Name;
tName = "(" + translateStr("Disable") + ") " + m_Name;
}

m_TableData.append(tName);
Expand Down
10 changes: 5 additions & 5 deletions deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@
loadTableData();
m_TableDataTr.clear();
for (const auto &item : m_TableData) {
QString trKey = translateStr(item);
if(trKey.isEmpty())
QString trKey = (item);
if (trKey.isEmpty())
m_TableDataTr.append(item);
else
m_TableDataTr.append(trKey);
Expand All @@ -147,7 +147,7 @@
if (value.isEmpty())
return false;

if (value == QObject::tr("Unknown"))
if (value == translateStr("Unknown"))
return false;

if (value == QString("Unknown"))
Expand Down Expand Up @@ -633,7 +633,7 @@
const QString DeviceBaseInfo::getDriverVersion()
{
QString outInfo = Common::executeClientCmd("modinfo", QStringList() << driver(), QString(), -1);
if(outInfo.isEmpty())
if (outInfo.isEmpty())
return QString("");

foreach (QString out, outInfo.split("\n")) {
Expand Down Expand Up @@ -728,7 +728,7 @@
}
QList<QPair<QString, QString> > allOtherAttribs = getOtherAttribs();
for (const QPair<QString, QString>& pair : allOtherAttribs) {
if (key == key)
if (key == pair.first)

Check warning on line 731 in deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Consider using std::find_if algorithm instead of a raw loop.
return pair.second;
}
return QString("");
Expand Down
4 changes: 2 additions & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,11 @@ void DeviceInput::loadTableData()
QString tName = m_Name;

if (!available()) {
tName = "(" + tr("Unavailable") + ") " + m_Name;
tName = "(" + translateStr("Unavailable") + ") " + m_Name;
}

if (!enable()) {
tName = "(" + tr("Disable") + ") " + m_Name;
tName = "(" + translateStr("Disable") + ") " + m_Name;
}

m_TableData.append(tName);
Expand Down
Loading