{"action":"created","issue":{"url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1188","labels_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1188/labels{/name}","comments_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1188/comments","events_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1188/events","html_url":"https://github.com/mavlink/qgroundcontrol/pull/1188","id":56462006,"number":1188,"title":"File extensions need consistency. Issue #1182.","user":{"login":"dogmaphobic","id":749243,"avatar_url":"https://avatars.githubusercontent.com/u/749243?v=3","gravatar_id":"","url":"https://api.github.com/users/dogmaphobic","html_url":"https://github.com/dogmaphobic","followers_url":"https://api.github.com/users/dogmaphobic/followers","following_url":"https://api.github.com/users/dogmaphobic/following{/other_user}","gists_url":"https://api.github.com/users/dogmaphobic/gists{/gist_id}","starred_url":"https://api.github.com/users/dogmaphobic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogmaphobic/subscriptions","organizations_url":"https://api.github.com/users/dogmaphobic/orgs","repos_url":"https://api.github.com/users/dogmaphobic/repos","events_url":"https://api.github.com/users/dogmaphobic/events{/privacy}","received_events_url":"https://api.github.com/users/dogmaphobic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-04T00:29:51Z","updated_at":"2015-02-04T18:08:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mavlink/qgroundcontrol/pulls/1188","html_url":"https://github.com/mavlink/qgroundcontrol/pull/1188","diff_url":"https://github.com/mavlink/qgroundcontrol/pull/1188.diff","patch_url":"https://github.com/mavlink/qgroundcontrol/pull/1188.patch"},"body":"Fixes issue #1182 \r\n\r\nAdded a new flag to the QGCFileDialog::getSaveFileName() telling it to enforce a given file type (suffix/extension). It works in tandem with the default suffix argument I added earlier.\r\n\r\nIf a default suffix is given, it will be appended to the filename if the user does not enter one themselves. That is, if the user simply enters *foo* and the default suffix is set to *bar*, the returned filename will be *foo.bar*. However, if the user specifies a suffix, the *strict* flag will determine what is done. If the user enters *foo.txt* and *strict* is false, the function returns *foo.txt* (no suffix enforced). If strict is true however, the default suffix is appended no matter what. In the case above, the function will return *foo.txt.bar* (suffix enforced).\r\n \r\nIf *strict* is set and the file name given by the user is renamed (the *foo.txt.bar* example above), the function will check and see if the file already exists. If that's the case, it will ask the user if they want to overwrite it.\r\n\r\nThe current file types handled by this:\r\n\r\n* .mavlink \t- Flight Data Log - Enforced\r\n* .qgw \t\t- Widgets - Enforced\r\n* .log \t\t- Log files saved by LineChartWidget - Enforced\r\n* .waypoints\t- Enforced\r\n* .csv\t\t- QGCDataPlot2D output - Enforced\r\n* .params\t\t- Parameter files - Enforced\r\n*  .svg .pdf\t- Plot Files - Not enforced. The default is pdf.\r\n\r\nI left the extension used in LinechartWidget::startLogging() above set to “log” (as it was) because I felt saving it as a “csv” would confuse it with the files saved by QGCDataPlot2D. These files are not consumed (not loaded) anywhere in QGC.\r\n\r\nIn MainWindow.cc (~ 839) there is a function to “startVideoCapture()”, which is using “bmp” as the default extension. I don’t know yet what this function is saving and what type of “video” could be saved into a bmp.\r\n\r\n**Note**: Not tested under Windows. I’m curious to see how “All Files (*)” behave there."},"comment":{"url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/comments/72906352","html_url":"https://github.com/mavlink/qgroundcontrol/pull/1188#issuecomment-72906352","issue_url":"https://api.github.com/repos/mavlink/qgroundcontrol/issues/1188","id":72906352,"user":{"login":"Susurrus","id":206363,"avatar_url":"https://avatars.githubusercontent.com/u/206363?v=3","gravatar_id":"","url":"https://api.github.com/users/Susurrus","html_url":"https://github.com/Susurrus","followers_url":"https://api.github.com/users/Susurrus/followers","following_url":"https://api.github.com/users/Susurrus/following{/other_user}","gists_url":"https://api.github.com/users/Susurrus/gists{/gist_id}","starred_url":"https://api.github.com/users/Susurrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Susurrus/subscriptions","organizations_url":"https://api.github.com/users/Susurrus/orgs","repos_url":"https://api.github.com/users/Susurrus/repos","events_url":"https://api.github.com/users/Susurrus/events{/privacy}","received_events_url":"https://api.github.com/users/Susurrus/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T18:08:43Z","updated_at":"2015-02-04T18:08:43Z","body":"> I wouldn't get too hung up on going with strict extensions for everything. If there is confusion around actual usage or format then leave it as non-strict for now and people can do what they want.\r\n\r\nThe problem with leaving it not well specified is that this is what **causes** the confusion. QGC is bad about specifying the format of the files that it handles, both from a saving and a loading perspective. I suggest we actually work to tackle this and just make sure loading works for all the old formats we support but enforce strict rules for saving things. The point is that we want to have a single set of files that everyone understands, but allowing people to save file extensions however we want we make it harder for people who don't. It's the classic strict-but-consistent versus flexible-but-vague dilemma. And since I see post after post to the QGC mailing list by newbies trying to understand the system, I suggest we lean more towards being strict and consistent. It works best for new users until they understand the system. And right now QGC should be targeted towards those users. I'm sick of hearing posts on the mailing list saying how APM works and QGC doesn't. Let's change that!\r\n\r\nNow onto the widgets. QGCDataPlot2D just reads files, correct? If it does, then there's no issues with nailing that down in this PR.\r\n\r\nBut for the LineChartWidget, I'd actually suggest we move it over to using comma-separated files for saving things. This has the widest support among 3rd-party tools (Excel, MATLAB, Python, etc.). I've never heard of a program saving space-separated values. **But** let's leave this as a separate PR so it can be resolved independently. Let's just leave the LineChartWidget as saving .log files and **not** be strict about enforcing that line ending.\r\n\r\nCan the LineChartWidget load files too? If it does, can it only handle it's own .log format or is it as flexible as the QGCDataPlot2D tool? (man I wish this was a separate tool)."}}