MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / MakeSaveFile

Method MakeSaveFile

DSView/pv/storesession.cpp:1593–1651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1591}
1592
1593QString StoreSession::MakeSaveFile(bool bDlg)
1594{
1595 QString default_name;
1596
1597 AppConfig &app = AppConfig::Instance();
1598 if (app.userHistory.saveDir != "")
1599 {
1600 default_name = app.userHistory.saveDir + "/" + _session->get_device()->name() + "-";
1601 }
1602 else{
1603 QDir _dir;
1604 QString _root = _dir.home().path();
1605 default_name = _root + "/" + _session->get_device()->name() + "-";
1606 }
1607
1608 for (const GSList *l = _session->get_device()->get_device_mode_list(); l; l = l->next)
1609 {
1610 const sr_dev_mode *mode = (const sr_dev_mode *)l->data;
1611 if (_session->get_device()->get_work_mode() == mode->mode) {
1612 default_name += mode->acronym;
1613 break;
1614 }
1615 }
1616
1617 default_name += _session->get_session_time().toString("-yyMMdd-hhmmss");
1618
1619 // Show the dialog
1620 if (bDlg)
1621 {
1622 default_name = QFileDialog::getSaveFileName(
1623 NULL,
1624 L_S(STR_PAGE_MSG, S_ID(IDS_MSG_SAVE_FILE),"Save File"),
1625 default_name,
1626 //tr
1627 "DSView Data (*.dsl)");
1628
1629 if (default_name.isEmpty())
1630 {
1631 return ""; //no select file
1632 }
1633
1634 QString _dir_path = path::GetDirectoryName(default_name);
1635
1636 if (_dir_path != app.userHistory.saveDir)
1637 {
1638 app.userHistory.saveDir = _dir_path;
1639 app.SaveHistory();
1640 }
1641 }
1642
1643 QFileInfo f(default_name);
1644 if (f.suffix().compare("dsl"))
1645 {
1646 //Tr
1647 default_name.append(".dsl");
1648 }
1649 _file_name = default_name;
1650 return default_name;

Callers 2

save_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