MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / MakeExportFile

Method MakeExportFile

DSView/pv/storesession.cpp:1653–1744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1651}
1652
1653QString 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);

Callers 2

export_runMethod · 0.80
on_change_fileMethod · 0.80

Calls 8

GetDirectoryNameFunction · 0.85
nameMethod · 0.80
get_deviceMethod · 0.80
pathMethod · 0.80
get_device_mode_listMethod · 0.80
get_work_modeMethod · 0.80
get_session_timeMethod · 0.80
SaveHistoryMethod · 0.80

Tested by

no test coverage detected