diff --git a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp index 3da5cc1f..76057b34 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceComputer.cpp @@ -29,10 +29,10 @@ TomlFixMethod DeviceComputer::setInfoFromTomlOneByOne(const QMap &mapInfo) // 名称(Name) 厂商(Vendor) 型号(Model) 版本(Version) 显存(Graphics Memory) void DeviceGpu::setGpuInfoByCustom(const QMap &mapInfo) { + m_extraInfo.clear(); QMap::const_iterator it = mapInfo.constBegin(); for (; it != mapInfo.constEnd(); ++it) { if (it.key() == "Name") { diff --git a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp index 861a518b..66725b3e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceImage.cpp @@ -56,13 +56,13 @@ TomlFixMethod DeviceImage::setInfoFromTomlOneByOne(const QMap TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); - ret = setTomlAttribute(mapInfo, "Version", m_Version); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Version", m_Version); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); - ret = setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); - ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); + setTomlAttribute(mapInfo, "Speed", m_Speed); + setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); + setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialID); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index b68edbaa..41b74765 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -922,7 +922,6 @@ const QString DeviceBaseInfo::readDeviceInfoKeyValue(const QString &key) { if (key.isEmpty()) return QString(""); - // qCInfo(appLog) << __FILE__ << __LINE__ << key << "after translation:"<< kk; QList > allBaseAttribs = getBaseAttribs(); for (const QPair& pair : allBaseAttribs) { if (key == pair.first) @@ -1029,9 +1028,9 @@ void DeviceBaseInfo::mapInfoToList() qCDebug(appLog) << "DeviceBaseInfo::mapInfoToList called"; // m_MapOtherInfo --> m_LstOtherInfo // QMap内容转为QList存储 - auto iter = m_MapOtherInfo.begin(); + QMap::const_iterator iter = m_MapOtherInfo.constBegin(); - for (; iter != m_MapOtherInfo.end(); ++iter) { + for (; iter != m_MapOtherInfo.constEnd(); ++iter) { if (isValueValid(iter.value())) m_LstOtherInfo.append(QPair(iter.key(), iter.value())); } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index 468ceb1b..08d9e1b9 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -81,12 +81,12 @@ TomlFixMethod DeviceInput::setInfoFromTomlOneByOne(const QMap TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Interface", m_Interface); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Interface", m_Interface); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); - ret = setTomlAttribute(mapInfo, "Maximum Current", m_MaximumPower); // 将最大功率改为最大电流 + setTomlAttribute(mapInfo, "Speed", m_Speed); + setTomlAttribute(mapInfo, "Maximum Current", m_MaximumPower); // 将最大功率改为最大电流 ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); //3. 获取设备的其它信息 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp index 13bd4b8e..59021aee 100755 --- a/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMemory.cpp @@ -66,17 +66,17 @@ TomlFixMethod DeviceMemory::setInfoFromTomlOneByOne(const QMap qCDebug(appLog) << "Setting memory info from TOML one by one"; TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Size", m_Size); - ret = setTomlAttribute(mapInfo, "Type", m_Type); - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); - ret = setTomlAttribute(mapInfo, "Total Width", m_TotalBandwidth); - ret = setTomlAttribute(mapInfo, "Locator", m_Locator); - ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); + setTomlAttribute(mapInfo, "Size", m_Size); + setTomlAttribute(mapInfo, "Type", m_Type); + setTomlAttribute(mapInfo, "Speed", m_Speed); + setTomlAttribute(mapInfo, "Total Width", m_TotalBandwidth); + setTomlAttribute(mapInfo, "Locator", m_Locator); + setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Configured Voltage", m_ConfiguredVoltage); - ret = setTomlAttribute(mapInfo, "Maximum Voltage", m_MaximumVoltage); - ret = setTomlAttribute(mapInfo, "Minimum Voltage", m_MinimumVoltage); - ret = setTomlAttribute(mapInfo, "Configured Speed", m_ConfiguredSpeed); + setTomlAttribute(mapInfo, "Configured Voltage", m_ConfiguredVoltage); + setTomlAttribute(mapInfo, "Maximum Voltage", m_MaximumVoltage); + setTomlAttribute(mapInfo, "Minimum Voltage", m_MinimumVoltage); + setTomlAttribute(mapInfo, "Configured Speed", m_ConfiguredSpeed); ret = setTomlAttribute(mapInfo, "Data Width", m_DataBandwidth); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index e7a2ab2d..d8da22f5 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -137,7 +137,9 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) setAttribute(mapInfo, "", m_DisplayInput); setAttribute(mapInfo, "Size", m_ScreenSize); setAttribute(mapInfo, "", m_MainScreen); - // setAttribute(mapInfo, "Resolution", m_SupportResolution); + if (Common::specialComType > 0){ + setAttribute(mapInfo, "Resolution", m_SupportResolution); + } qCDebug(appLog) << "Basic monitor attributes set - Name:" << m_Name << "Vendor:" << m_Vendor << "Model:" << m_Model; double inch = 0.0; @@ -147,23 +149,27 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) qCDebug(appLog) << "Screen size parsed:" << m_ScreenSize << "Width:" << size.width() << "Height:" << size.height(); // 获取当前分辨率 和 当前支持分辨率 -// QStringList listResolution = m_SupportResolution.split(" "); -// m_SupportResolution = ""; -// foreach (const QString &word, listResolution) { -// if (word.contains("@")) { -// m_SupportResolution.append(word); -// m_SupportResolution.append(", "); -// } -// } + if (Common::specialComType > 0){ + QStringList listResolution = m_SupportResolution.split(" "); + m_SupportResolution = ""; + foreach (const QString &word, listResolution) { + if (word.contains("@")) { + m_SupportResolution.append(word); + m_SupportResolution.append(", "); + } + } + } // 计算显示比例 caculateScreenRatio(); - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // m_SupportResolution.replace(QRegExp(", $"), ""); - #else - // m_SupportResolution.replace(QRegularExpression(", $"), ""); - #endif + if (Common::specialComType > 0){ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + m_SupportResolution.replace(QRegExp(", $"), ""); +#else + m_SupportResolution.replace(QRegularExpression(", $"), ""); +#endif + } qCDebug(appLog) << "Supported resolutions processed:" << m_SupportResolution; m_ProductionWeek = transWeekToDate(mapInfo["Year of Manufacture"], mapInfo["Week of Manufacture"]); @@ -182,21 +188,22 @@ TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface); + if (Common::specialComType <= 0) { + QMap monitorResolutionMap = getMonitorResolutionMap(xrandr, m_RawInterface); - if (monitorResolutionMap.size() == 1) { - m_SupportResolution.clear(); - foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) { - if (word.contains("@")) { - m_SupportResolution.append(word); - m_SupportResolution.append(", "); + if (monitorResolutionMap.size() == 1) { + m_SupportResolution.clear(); + foreach (const QString &word, monitorResolutionMap.value(m_RawInterface)) { + if (word.contains("@")) { + m_SupportResolution.append(word); + m_SupportResolution.append(", "); + } } - } #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - m_SupportResolution.remove(QRegExp(", $")); + m_SupportResolution.remove(QRegExp(", $")); #else - m_SupportResolution.remove(QRegularExpression(", $")); + m_SupportResolution.remove(QRegularExpression(", $")); #endif + } } qCDebug(appLog) << "Interface already processed, returning false"; return false; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index 520868c8..4163e072 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -104,27 +104,27 @@ TomlFixMethod DeviceNetwork::setInfoFromTomlOneByOne(const QMap qCDebug(appLog) << "DeviceOthers::setInfoFromTomlOneByOne"; TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); - ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); - ret = setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); - ret = setTomlAttribute(mapInfo, "Speed", m_Speed); -////Others + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Bus Info", m_BusInfo); + setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); + setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower); + setTomlAttribute(mapInfo, "Speed", m_Speed); + // Others ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialID); -//3. 获取设备的其它信息 + // 3. 获取设备的其它信息 getOtherMapInfo(mapInfo); return ret; } diff --git a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp index 46c593c0..1fb90680 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePower.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePower.cpp @@ -48,19 +48,19 @@ TomlFixMethod DevicePower::setInfoFromTomlOneByOne(const QMap qCDebug(appLog) << "DevicePower::setInfoFromTomlOneByOne"; TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); - ret = setTomlAttribute(mapInfo, "Type", m_Type); - ret = setTomlAttribute(mapInfo, "Status", m_Status); - ret = setTomlAttribute(mapInfo, "Capacity", m_Capacity); - ret = setTomlAttribute(mapInfo, "Voltage", m_Voltage); - ret = setTomlAttribute(mapInfo, "Slot", m_Slot); - ret = setTomlAttribute(mapInfo, "Design Capacity", m_DesignCapacity); - ret = setTomlAttribute(mapInfo, "Design Voltage", m_DesignVoltage); - ret = setTomlAttribute(mapInfo, "SBDS Version", m_SBDSVersion); - ret = setTomlAttribute(mapInfo, "SBDS Serial Number", m_SBDSSerialNumber); - ret = setTomlAttribute(mapInfo, "SBDS Manufacture Date", m_SBDSManufactureDate); - ret = setTomlAttribute(mapInfo, "SBDS Chemistry", m_SBDSChemistry); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); + setTomlAttribute(mapInfo, "Type", m_Type); + setTomlAttribute(mapInfo, "Status", m_Status); + setTomlAttribute(mapInfo, "Capacity", m_Capacity); + setTomlAttribute(mapInfo, "Voltage", m_Voltage); + setTomlAttribute(mapInfo, "Slot", m_Slot); + setTomlAttribute(mapInfo, "Design Capacity", m_DesignCapacity); + setTomlAttribute(mapInfo, "Design Voltage", m_DesignVoltage); + setTomlAttribute(mapInfo, "SBDS Version", m_SBDSVersion); + setTomlAttribute(mapInfo, "SBDS Serial Number", m_SBDSSerialNumber); + setTomlAttribute(mapInfo, "SBDS Manufacture Date", m_SBDSManufactureDate); + setTomlAttribute(mapInfo, "SBDS Chemistry", m_SBDSChemistry); ret = setTomlAttribute(mapInfo, "Temperature", m_Temp); //3. 获取设备的其它信息 getOtherMapInfo(mapInfo); diff --git a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp index 65cb5709..90b0c9db 100644 --- a/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp +++ b/deepin-devicemanager/src/DeviceManager/DevicePrint.cpp @@ -36,15 +36,15 @@ TomlFixMethod DevicePrint::setInfoFromTomlOneByOne(const QMap qCDebug(appLog) << "DevicePrint::setInfoFromTomlOneByOne"; TomlFixMethod ret = TOML_None; // 添加基本信息 - ret = setTomlAttribute(mapInfo, "Model", m_Model); - ret = setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); + setTomlAttribute(mapInfo, "Model", m_Model); + setTomlAttribute(mapInfo, "Serial Number", m_SerialNumber); // 添加其他信息,成员变量 - ret = setTomlAttribute(mapInfo, "Shared", m_Shared); - ret = setTomlAttribute(mapInfo, "URI", m_URI); - ret = setTomlAttribute(mapInfo, "Status", m_Status); - ret = setTomlAttribute(mapInfo, "Interface Type", m_InterfaceType); + setTomlAttribute(mapInfo, "Shared", m_Shared); + setTomlAttribute(mapInfo, "URI", m_URI); + setTomlAttribute(mapInfo, "Status", m_Status); + setTomlAttribute(mapInfo, "Interface Type", m_InterfaceType); ret = setTomlAttribute(mapInfo, "printer-make-and-model", m_MakeAndModel); -//3. 获取设备的其它信息 + // 3. 获取设备的其它信息 getOtherMapInfo(mapInfo); return ret; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp index b8bdf1b5..2eba86b3 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp @@ -43,16 +43,16 @@ TomlFixMethod DeviceStorage::setInfoFromTomlOneByOne(const QMap @@ -455,51 +456,6 @@ void HWGenerator::getMemoryInfoFromLshw() } } -static void parseEDID(QStringList allEDIDS,QString input) -{ - qCDebug(appLog) << "HWGenerator::generatorMonitorDevice start"; - for (auto edid:allEDIDS) { - QProcess process; - process.start(QString("hexdump %1").arg(edid)); - process.waitForFinished(-1); - - QString deviceInfo = process.readAllStandardOutput(); - if (deviceInfo.isEmpty()) - continue; - - QString edidStr; - QStringList lines = deviceInfo.split("\n"); - for (auto line:lines) { - QStringList words = line.trimmed().split(" "); - if (words.size() != 9) - continue; - - words.removeAt(0); - QString l = words.join(""); - l.append("\n"); - edidStr.append(l); - } - - lines = edidStr.split("\n"); - if (lines.size() > 3){ - EDIDParser edidParser; - QString errorMsg; - edidParser.setEdid(edidStr,errorMsg,"\n", false); - - QMap mapInfo; - mapInfo.insert("Vendor",edidParser.vendor()); - mapInfo.insert("Model",edidParser.model()); - //mapInfo.insert("Date",edidParser.releaseDate()); - mapInfo.insert("Size",edidParser.screenSize()); - mapInfo.insert("Display Input",input); - - DeviceMonitor *device = new DeviceMonitor(); - device->setInfoFromEdid(mapInfo); - DeviceManager::instance()->addMonitor(device); - } - } -} - void HWGenerator::generatorMonitorDevice() { QString toDir = "/sys/class/drm"; @@ -520,7 +476,7 @@ void HWGenerator::generatorMonitorDevice() QStringList allEDIDS_all; allEDIDS_all.append(fileInfo.filePath() + "/" + "edid"); QString interface = fileInfo.fileName().remove("card0-").remove("card1-").remove("card2-"); - parseEDID(allEDIDS_all,interface); + CommonTools::parseEDID(allEDIDS_all,interface); } } } diff --git a/deepin-devicemanager/src/Page/MainWindow.cpp b/deepin-devicemanager/src/Page/MainWindow.cpp index 58cf708f..42bac79d 100644 --- a/deepin-devicemanager/src/Page/MainWindow.cpp +++ b/deepin-devicemanager/src/Page/MainWindow.cpp @@ -590,12 +590,14 @@ void MainWindow::slotLoadingFinish(const QString &message) mp_DeviceWidget->updateDevice(mp_DeviceWidget->currentIndex(), lst); // bug-325731 - if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) { - QtConcurrent::run([=](){ - QThread::msleep(700); - emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex()); - qWarning() << mp_DeviceWidget->currentIndex(); - }); + if (Common::specialComType <= 0) { + if (mp_DeviceWidget->currentIndex() == QObject::tr("Monitor")) { + QtConcurrent::run([=](){ + QThread::msleep(700); + emit mp_DeviceWidget->itemClicked(mp_DeviceWidget->currentIndex()); + qWarning() << mp_DeviceWidget->currentIndex(); + }); + } } } else { QMap overviewMap = DeviceManager::instance()->getDeviceOverview(); diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 22b465ed..222e6888 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -187,7 +187,6 @@ void ThreadExecXrandr::loadXrandrVerboseInfo(QList> &lstM // 获取当前频率 if ((*it).contains("*current")) { - // QString ss = *it; if ((it += 2) >= lines.end()) return; QRegularExpression regRate(".*([0-9]{1,5}\\.[0-9]{1,5}Hz).*");