Compare commits
13 Commits
709f8064bf
...
26fc8dae9a
Author | SHA1 | Date |
---|---|---|
Savanni D'Gerinel | 26fc8dae9a | |
Savanni D'Gerinel | d4dc493297 | |
Savanni D'Gerinel | 68c5ab0958 | |
Savanni D'Gerinel | 57034e48d5 | |
Savanni D'Gerinel | e730d36cc9 | |
Savanni D'Gerinel | cb2f21341d | |
Savanni D'Gerinel | 64c4e971f8 | |
Savanni D'Gerinel | e84c49c343 | |
Savanni D'Gerinel | 5b8b612758 | |
Savanni D'Gerinel | 84fe6fbd8f | |
Savanni D'Gerinel | 5cd0e822c6 | |
Savanni D'Gerinel | fe5e4ed044 | |
Savanni D'Gerinel | e30668ca8e |
|
@ -23,6 +23,7 @@ use adw::prelude::*;
|
|||
use async_channel::Sender;
|
||||
use chrono::{FixedOffset, NaiveDate, TimeZone};
|
||||
use dimensioned::si::{KG, M, S};
|
||||
use emseries::{Record, RecordId};
|
||||
use ft_core::{Steps, TimeDistance, TraxRecord, Weight};
|
||||
use gio::resources_lookup_data;
|
||||
use gtk::STYLE_PROVIDER_PRIORITY_USER;
|
||||
|
@ -79,20 +80,13 @@ impl AppWindow {
|
|||
|
||||
let navigation = adw::NavigationView::new();
|
||||
|
||||
/*
|
||||
let header = adw::HeaderBar::builder()
|
||||
.title_widget(>k::Label::new(Some("FitnessTrax")))
|
||||
.build();
|
||||
*/
|
||||
|
||||
let layout = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.build();
|
||||
|
||||
let initial_view = View::Placeholder(PlaceholderView::new().upcast());
|
||||
|
||||
// layout.append(&header);
|
||||
layout.append(initial_view.widget());
|
||||
layout.append(&initial_view.widget());
|
||||
|
||||
let nav_layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||
nav_layout.append(&adw::HeaderBar::new());
|
||||
|
@ -151,9 +145,9 @@ impl AppWindow {
|
|||
// position.
|
||||
fn swap_main(&self, view: View) {
|
||||
let mut current_widget = self.current_view.borrow_mut();
|
||||
self.layout.remove(&*current_widget.widget());
|
||||
self.layout.remove(¤t_widget.widget());
|
||||
*current_widget = view;
|
||||
self.layout.append(&*current_widget.widget());
|
||||
self.layout.append(¤t_widget.widget());
|
||||
}
|
||||
|
||||
fn construct_view(&self, view: ViewName) -> View {
|
||||
|
|
|
@ -14,6 +14,8 @@ General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License along with FitnessTrax. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use gtk::prelude::*;
|
||||
|
||||
mod historical_view;
|
||||
pub use historical_view::HistoricalView;
|
||||
|
||||
|
@ -33,17 +35,17 @@ pub enum ViewName {
|
|||
}
|
||||
|
||||
pub enum View {
|
||||
Placeholder(gtk::Widget),
|
||||
Welcome(gtk::Widget),
|
||||
Historical(gtk::Widget),
|
||||
Placeholder(PlaceholderView),
|
||||
Welcome(WelcomeView),
|
||||
Historical(HistoricalView),
|
||||
}
|
||||
|
||||
impl View {
|
||||
pub fn widget<'a>(&'a self) -> &'a gtk::Widget {
|
||||
pub fn widget(&self) -> gtk::Widget {
|
||||
match self {
|
||||
View::Placeholder(widget) => widget,
|
||||
View::Welcome(widget) => widget,
|
||||
View::Historical(widget) => widget,
|
||||
View::Placeholder(widget) => widget.clone().upcast::<gtk::Widget>(),
|
||||
View::Welcome(widget) => widget.clone().upcast::<gtk::Widget>(),
|
||||
View::Historical(widget) => widget.clone().upcast::<gtk::Widget>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,12 @@ pub struct Steps {
|
|||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TimeDistance {
|
||||
/// The precise time (and the relevant timezone) of the workout. One of the edge cases that I
|
||||
/// account for is that a ride which occurred at 11pm in one timezone would then count as 1am
|
||||
/// if one moved two timezones to the east.
|
||||
/// account for is that a ride which occurred at 11pm on one day in one timezone would then
|
||||
/// count as 1am on the next day if the user moves two timezones to the east. While technically
|
||||
/// correct, for most users this would throw off many years of metrics in ways that can be very
|
||||
/// hard to understand. Keeping the fixed offset means that we can have the most precise time
|
||||
/// in the database, but we can still get a Naive Date from the DateTime, which will still read
|
||||
/// as the original day.
|
||||
pub datetime: DateTime<FixedOffset>,
|
||||
/// The distance travelled. This is optional because such a workout makes sense even without
|
||||
/// the distance.
|
||||
|
|
Loading…
Reference in New Issue