| 1651 | } |
| 1652 | |
| 1653 | QString StoreSession::MakeExportFile(bool bDlg) |
| 1654 | { |
| 1655 | QString default_name; |
| 1656 | AppConfig &app = AppConfig::Instance(); |
| 1657 | |
| 1658 | if (app.userHistory.exportDir != "") |
| 1659 | { |
| 1660 | default_name = app.userHistory.exportDir + "/" + _session->get_device()->name() + "-"; |
| 1661 | } |
| 1662 | else{ |
| 1663 | QDir _dir; |
| 1664 | QString _root = _dir.home().path(); |
| 1665 | default_name = _root + "/" + _session->get_device()->name() + "-"; |
| 1666 | } |
| 1667 | |
| 1668 | for (const GSList *l = _session->get_device()->get_device_mode_list(); l; l = l->next) { |
| 1669 | const sr_dev_mode *mode = (const sr_dev_mode *)l->data; |
| 1670 | if (_session->get_device()->get_work_mode() == mode->mode) { |
| 1671 | default_name += mode->acronym; |
| 1672 | break; |
| 1673 | } |
| 1674 | } |
| 1675 | default_name += _session->get_session_time().toString("-yyMMdd-hhmmss"); |
| 1676 | |
| 1677 | //ext name |
| 1678 | QList<QString> supportedFormats = getSuportedExportFormats(); |
| 1679 | QString filter; |
| 1680 | for(int i = 0; i < supportedFormats.count();i++){ |
| 1681 | filter.append(supportedFormats[i]); |
| 1682 | if(i < supportedFormats.count() - 1) |
| 1683 | filter.append(";;"); |
| 1684 | } |
| 1685 | |
| 1686 | QString selfilter; |
| 1687 | if (app.userHistory.exportFormat != "" |
| 1688 | && _session->get_device()->get_work_mode() == LOGIC){ |
| 1689 | selfilter.append(app.userHistory.exportFormat); |
| 1690 | } |
| 1691 | else{ |
| 1692 | selfilter.append(".csv"); |
| 1693 | } |
| 1694 | |
| 1695 | if (bDlg) |
| 1696 | { |
| 1697 | default_name = QFileDialog::getSaveFileName( |
| 1698 | NULL, |
| 1699 | L_S(STR_PAGE_MSG, S_ID(IDS_MSG_EXPORT_DATA),"Export Data"), |
| 1700 | default_name, |
| 1701 | filter, |
| 1702 | &selfilter); |
| 1703 | |
| 1704 | if (default_name == "") |
| 1705 | { |
| 1706 | return ""; |
| 1707 | } |
| 1708 | |
| 1709 | bool bChange = false; |
| 1710 | QString _dir_path = path::GetDirectoryName(default_name); |
no test coverage detected