Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
companion-software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CATS
companion-software
Commits
1ecd421e
Commit
1ecd421e
authored
11 months ago
by
Stephen D
Browse files
Options
Downloads
Patches
Plain Diff
wire up add new contact button
parent
863acd46
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/contact.rs
+10
-0
10 additions, 0 deletions
src/contact.rs
src/controller.rs
+10
-3
10 additions, 3 deletions
src/controller.rs
with
20 additions
and
3 deletions
src/contact.rs
+
10
−
0
View file @
1ecd421e
...
...
@@ -11,6 +11,16 @@ pub struct Contact {
pub
name
:
String
<
MAX_CONTACT_NAME_LENGTH
>
,
}
impl
Default
for
Contact
{
fn
default
()
->
Self
{
Contact
{
callsign
:
String
::
new
(),
ssid
:
0
,
name
:
String
::
new
(),
}
}
}
#[derive(Debug)]
pub
struct
ContactGroup
{
pub
contacts
:
Vec
<
Contact
,
MAX_CONTACTS
>
,
...
...
This diff is collapsed.
Click to expand it.
src/controller.rs
+
10
−
3
View file @
1ecd421e
...
...
@@ -2,7 +2,7 @@ use embedded_graphics::{pixelcolor::Rgb565, prelude::DrawTarget};
use
heapless
::{
String
,
Vec
};
use
crate
::{
contact
::{
ContactGroup
,
MAX_CONTACTS
,
MAX_CONTACT_NAME_LENGTH
},
contact
::{
Contact
,
ContactGroup
,
MAX_CONTACTS
,
MAX_CONTACT_NAME_LENGTH
},
gui
::{
chat
::
Chat
,
contact_view
::
ContactView
,
selector
::
Selector
,
status
::
StatusBar
,
Element
},
keyboard
::
KeyCode
,
voltage
::
VoltMeter
,
...
...
@@ -169,8 +169,15 @@ impl Element for Controller {
}
(
View
::
Contacts
(
c
),
KeyCode
::
Touchpad
)
=>
{
// TODO need to handle "Add New" button
self
.cur_view
=
View
::
new_contact_options
(
c
.selected
());
if
c
.selected
()
==
self
.contacts.contacts
.len
()
{
self
.contacts.contacts
.push
(
Contact
::
default
())
.unwrap
();
// Go direct to edit page
self
.cur_view
=
View
::
from_contact_options_id
(
1
,
c
.selected
(),
&
self
.contacts
)
.unwrap
();
}
else
{
self
.cur_view
=
View
::
new_contact_options
(
c
.selected
());
}
}
(
View
::
ContactOptions
(
c
,
contact_id
),
KeyCode
::
Touchpad
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment