| 1645 | } |
| 1646 | |
| 1647 | void MainWindow::load_device_config() |
| 1648 | { |
| 1649 | _title_ext_string = ""; |
| 1650 | int mode = _device_agent->get_work_mode(); |
| 1651 | QString file; |
| 1652 | |
| 1653 | if (_device_agent->is_hardware()) |
| 1654 | { |
| 1655 | QString ses_name = gen_config_file_path(true); |
| 1656 | |
| 1657 | bool bExist = false; |
| 1658 | |
| 1659 | QFile sf(ses_name); |
| 1660 | if (!sf.exists()){ |
| 1661 | dsv_info("Try to load the low version profile."); |
| 1662 | ses_name = gen_config_file_path(false); |
| 1663 | } |
| 1664 | else{ |
| 1665 | bExist = true; |
| 1666 | } |
| 1667 | |
| 1668 | if (!bExist) |
| 1669 | { |
| 1670 | QFile sf2(ses_name); |
| 1671 | if (!sf2.exists()){ |
| 1672 | dsv_info("Try to load the default profile."); |
| 1673 | ses_name = _file_bar->genDefaultSessionFile(); |
| 1674 | } |
| 1675 | } |
| 1676 | |
| 1677 | file = ses_name; |
| 1678 | } |
| 1679 | else if (_device_agent->is_demo()) |
| 1680 | { |
| 1681 | QDir dir(GetFirmwareDir()); |
| 1682 | if (dir.exists()) |
| 1683 | { |
| 1684 | QString ses_name = dir.absolutePath() + "/" |
| 1685 | + _device_agent->driver_name() + QString::number(mode) + ".dsc"; |
| 1686 | |
| 1687 | QFile sf(ses_name); |
| 1688 | if (sf.exists()){ |
| 1689 | file = ses_name; |
| 1690 | } |
| 1691 | } |
| 1692 | } |
| 1693 | |
| 1694 | if (file != ""){ |
| 1695 | bool ret = load_config_from_file(file); |
| 1696 | if (ret && _device_agent->is_hardware()){ |
| 1697 | _title_ext_string = file; |
| 1698 | } |
| 1699 | } |
| 1700 | } |
| 1701 | |
| 1702 | QJsonDocument MainWindow::get_config_json_from_data_file(QString file, bool &bSucesss) |
| 1703 | { |
nothing calls this directly
no test coverage detected