Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
limalogger
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
Stephen D
limalogger
Commits
1115bd2b
Commit
1115bd2b
authored
3 years ago
by
Stephen D
Browse files
Options
Downloads
Patches
Plain Diff
add station callsign
parent
7411dfa7
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
add station callsign
Pipeline
#257
passed
3 years ago
Stage: test
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app.rs
+21
-4
21 additions, 4 deletions
src/app.rs
src/main.rs
+1
-0
1 addition, 0 deletions
src/main.rs
src/station.rs
+19
-0
19 additions, 0 deletions
src/station.rs
with
41 additions
and
4 deletions
src/app.rs
+
21
−
4
View file @
1115bd2b
use
crate
::
qso
::
Qso
;
use
crate
::
station
::
Station
;
use
crate
::
traits
::
TuiValue
;
use
chrono
::
Utc
;
use
serde
::{
Deserialize
,
Serialize
};
...
...
@@ -10,6 +11,8 @@ const MAX_COLUMN_WIDTH: usize = 40;
#[derive(Serialize,
Deserialize,
Default)]
pub
struct
State
{
#[serde(default)]
station
:
Station
,
qsos
:
Vec
<
Qso
>
,
}
...
...
@@ -58,12 +61,13 @@ impl App {
pub
fn
run
(
&
mut
self
)
{
loop
{
self
.render_table
();
println!
(
"
\t
[A] Add QSO
\t
[E] Edit QSO
\t
[D] Del QSO
\t
[Q] Quit"
);
println!
(
"
\t
[A] Add QSO
\t
[E] Edit QSO
\t
[D] Del QSO
\t
[C] Edit Station Callsign
\t
[Q] Quit"
);
// Wish this had unicode support ):
let
c
=
getch
::
Getch
::
new
()
.getch
()
.unwrap
()
as
char
;
match
c
{
'q'
|
'Q'
=>
break
,
'a'
|
'A'
=>
{
self
.add_qso
();
}
...
...
@@ -73,6 +77,11 @@ impl App {
'd'
|
'D'
=>
{
self
.del_qso
();
}
'c'
|
'C'
=>
{
self
.edit_station_callsign
();
}
'q'
|
'Q'
=>
break
,
_
=>
{}
}
...
...
@@ -102,6 +111,9 @@ impl App {
clearscreen
::
clear
()
.unwrap
();
// Header
println!
(
"Station: {}"
,
self
.state.station.callsign
);
// Table
print!
(
"{}"
,
table
.render
());
}
...
...
@@ -160,6 +172,11 @@ impl App {
}
}
fn
edit_station_callsign
(
&
mut
self
)
{
self
.state.station.callsign
=
Self
::
prompt
(
"Station Callsign"
,
self
.state.station.callsign
.clone
())
.to_uppercase
();
}
fn
modify_qso
(
&
mut
self
,
mut
qso
:
Qso
,
id
:
usize
)
->
Option
<
Qso
>
{
loop
{
clearscreen
::
clear
()
.unwrap
();
...
...
@@ -186,13 +203,13 @@ impl App {
qso
.freq
=
Self
::
prompt
(
"Frequency (kHz)"
,
qso
.freq
);
}
'm'
|
'M'
=>
{
qso
.mode
=
Self
::
prompt
(
"Mode"
,
qso
.mode
);
qso
.mode
=
Self
::
prompt
(
"Mode"
,
qso
.mode
)
.to_uppercase
()
;
}
'p'
|
'P'
=>
{
qso
.power
=
Self
::
prompt
(
"Power"
,
qso
.power
);
}
'c'
|
'C'
=>
{
qso
.callsign
=
Self
::
prompt
(
"Callsign"
,
qso
.callsign
);
qso
.callsign
=
Self
::
prompt
(
"Callsign"
,
qso
.callsign
)
.to_uppercase
()
;
}
'q'
|
'Q'
=>
{
qso
.qth
=
Self
::
prompt
(
"QTH"
,
qso
.qth
);
...
...
This diff is collapsed.
Click to expand it.
src/main.rs
+
1
−
0
View file @
1115bd2b
mod
app
;
mod
qso
;
mod
station
;
mod
traits
;
use
crate
::
app
::
App
;
...
...
This diff is collapsed.
Click to expand it.
src/station.rs
0 → 100644
+
19
−
0
View file @
1115bd2b
use
serde
::{
Deserialize
,
Serialize
};
#[derive(Serialize,
Deserialize)]
pub
struct
Station
{
#[serde(default
=
"default_call"
)]
pub
callsign
:
String
,
}
impl
Default
for
Station
{
fn
default
()
->
Self
{
Self
{
callsign
:
"NOCALL"
.to_string
(),
}
}
}
fn
default_call
()
->
String
{
"N0CALL"
.to_string
()
}
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