-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialog for setting user-defined frequencies #1417
base: master
Are you sure you want to change the base?
Conversation
05e119a
to
64f2cce
Compare
Hey, I think a favourites list like this, that can be activated by tapping on the radio infobox, or called up via a menu option, is a good thing. What i would like to avoid, is yet another file that has to be managed by the user, outside of xcsoar. So please consider:
|
@lordfolken Would you be OK with an incremental approach, i.e. get the functionality of reading from a file and sending the frequency to a radio done first, and then expand the XCSoar editing features? Edit - incremental.. shouldn’t try to use fancy words. |
Hello, This is a draft that is far from finished. I mainly wanted to have such a discussion about proper implementation, so thank you for sharing your ideas. I already have an intention to add GUI controls for editing the list. New/Edit/Delete, maybe Copy would also be useful. I also don't like storing it in a separate file; storing it in preferences may be a good option. However, I would like to have a way to load/transfer a larger amount of frequencies quickly rather than typing them manually (for example there are going to be 8 air-to-air frequencies for cross-country gliding in Czechia this year). Maybe I can store it in preferences and add some import/export button that would load/create the frequencies file. Or I can think of a hybrid approach, where the frequencies will be loaded from both preferences and a file. In that case, it is questionable how to order them in the list (I'd like to let the user select the order rather than sorting them by name, but when they come from multiple sources, this is not so simple), and also whether the user should be able to edit the separate file (from GUI) or only those in preferences. |
The problem with that is, that you would have to code the migration path as well. As users expect "everything to just work". So i'd rather have the functionality first. |
Potentially you could also create an import/export text field, where a csv or multiline file could be pasted/copied. The result of which would go to the profile. An additional option would be to add a "to favorite" button in airspace and waypoint dialogs. |
On the other hand, thinking about it more, if we settle on where the frequencies will be stored (IMO a separate csv is better than in the preferences because if the frequencies are stored in the preferences then you'd need to ensure compatibility of preferences with frequencies / without frequencies), then the only difference would be handling reading from the csv file as the data source vs also writing to it. Plus there would be a clear separation of functions, i.e. I don't believe XCSoar stores the checklist in the preferences either, and if you mess up editing the frequencies file, for example if you don't want to input all your initial frequencies through XCSoar, then you wouldn't potentially be left with a non-functioning preferences file. But of course I could be missing something. |
maybe you know but just in case #867 tried a similar thing i believe. And about how to save/ store the data why not do something similar to how markers are saved? User never has to make or edit a file but if you want to you totaly could. |
What about taking the Waypoit Editor as a precedent? |
736be21
to
bfcbc48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A numpad kind of keyboard entry widget for numbers/frequencies would be a welcome addtion. |
set_standby_button = dialog.AddButton(_("Set Stand-by"), [this]() | ||
{ SetClicked(false); }); | ||
edit_mode_button = dialog.AddButton(_("Edit"), [this]() | ||
{ dlgUserFrequencyListWidgetShowModal(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
if (dlgFrequencyEditShowModal(item) == FrequencyEditResult::MODIFIED) | ||
{ | ||
list[GetList().GetCursorIndex()] = item; | ||
listUpdated(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
Invalid lines in user.freq get erased when saving. The question is whether this should be handled or not. |
Ive had several crashes when saving on android. Guess we more error handling. 05-06T00:26:34Z] cannot open /storage/emulated/0/Android/data/org.xcsoar/files/lua/init.lua: No such file or directory |
This behavior is same as in the Waypoint Editor. Perhaps it can't be avoided, because the message box is shown after the dialog is closed. I may show the message box after clicking Close button and closing the dialog after Yes/no is selected. However, the behavior would then be different for Close button and closing by escape key. |
I have an idea: if the file contains invalid line and user opens the edit/manage screen, show message box saying "There are invalid lines and they will be deleted if changes are saved" and immediately set the 'modified' flag to show the "save changes" prompt after closing even if no changes were made. |
bfcbc48
to
90a2da5
Compare
90a2da5
to
c50e9b1
Compare
b755b5a
to
c188422
Compare
src/Dialogs/RadioFrequencyEntry.cpp
Outdated
value = RadioFrequency(entry.GetRadioFrequency()); | ||
|
||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
{ | ||
const RadioFrequencyDataField &df = | ||
(const RadioFrequencyDataField &)GetDataField(i); | ||
assert(df.GetType() == DataField::Type::RADIO_FREQUENCY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asserts are not on in non-debug mode. Can you add a check if invalid?
Good work on the Frequency dialog. Really cool. :-) |
In case it is useful, I have pushed my rebased version of #867 mentioned last week in my repo: https://github.com/xtophe80/XCSoar/tree/FrequencyCard2 |
774c5eb
to
e41a353
Compare
e41a353
to
cea1d58
Compare
XCSoar can set the frequency of a radio. However, this is currently only possible for frequencies that are tied to an airfield (defined in a waypoints file). This PR proposes a dialog that shows a list of user-defined frequencies. the frequency list is editable via GUI and stored in user.freq file in XCSoar's root directory.
This will be particularly useful for frequencies like: