Compare commits
15 Commits
26fc8dae9a
...
709f8064bf
Author | SHA1 | Date |
---|---|---|
Savanni D'Gerinel | 709f8064bf | |
Savanni D'Gerinel | e3cdc70b2c | |
Savanni D'Gerinel | e2866e6ab8 | |
Savanni D'Gerinel | 434815ef43 | |
Savanni D'Gerinel | ddb72d71d4 | |
Savanni D'Gerinel | eae24ae313 | |
Savanni D'Gerinel | 3e681dbffd | |
Savanni D'Gerinel | 9e0cdb50ea | |
Savanni D'Gerinel | e00d0bdf51 | |
Savanni D'Gerinel | 7b851ba051 | |
Savanni D'Gerinel | aecd188151 | |
Savanni D'Gerinel | 55e9805975 | |
Savanni D'Gerinel | 60d72bdb9b | |
Savanni D'Gerinel | b2cb7fddd5 | |
Savanni D'Gerinel | 43516ac58e |
|
@ -23,7 +23,6 @@ use adw::prelude::*;
|
||||||
use async_channel::Sender;
|
use async_channel::Sender;
|
||||||
use chrono::{FixedOffset, NaiveDate, TimeZone};
|
use chrono::{FixedOffset, NaiveDate, TimeZone};
|
||||||
use dimensioned::si::{KG, M, S};
|
use dimensioned::si::{KG, M, S};
|
||||||
use emseries::{Record, RecordId};
|
|
||||||
use ft_core::{Steps, TimeDistance, TraxRecord, Weight};
|
use ft_core::{Steps, TimeDistance, TraxRecord, Weight};
|
||||||
use gio::resources_lookup_data;
|
use gio::resources_lookup_data;
|
||||||
use gtk::STYLE_PROVIDER_PRIORITY_USER;
|
use gtk::STYLE_PROVIDER_PRIORITY_USER;
|
||||||
|
@ -80,13 +79,20 @@ impl AppWindow {
|
||||||
|
|
||||||
let navigation = adw::NavigationView::new();
|
let navigation = adw::NavigationView::new();
|
||||||
|
|
||||||
|
/*
|
||||||
|
let header = adw::HeaderBar::builder()
|
||||||
|
.title_widget(>k::Label::new(Some("FitnessTrax")))
|
||||||
|
.build();
|
||||||
|
*/
|
||||||
|
|
||||||
let layout = gtk::Box::builder()
|
let layout = gtk::Box::builder()
|
||||||
.orientation(gtk::Orientation::Vertical)
|
.orientation(gtk::Orientation::Vertical)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let initial_view = View::Placeholder(PlaceholderView::new().upcast());
|
let initial_view = View::Placeholder(PlaceholderView::new().upcast());
|
||||||
|
|
||||||
layout.append(&initial_view.widget());
|
// layout.append(&header);
|
||||||
|
layout.append(initial_view.widget());
|
||||||
|
|
||||||
let nav_layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
let nav_layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||||
nav_layout.append(&adw::HeaderBar::new());
|
nav_layout.append(&adw::HeaderBar::new());
|
||||||
|
@ -145,9 +151,9 @@ impl AppWindow {
|
||||||
// position.
|
// position.
|
||||||
fn swap_main(&self, view: View) {
|
fn swap_main(&self, view: View) {
|
||||||
let mut current_widget = self.current_view.borrow_mut();
|
let mut current_widget = self.current_view.borrow_mut();
|
||||||
self.layout.remove(¤t_widget.widget());
|
self.layout.remove(&*current_widget.widget());
|
||||||
*current_widget = view;
|
*current_widget = view;
|
||||||
self.layout.append(¤t_widget.widget());
|
self.layout.append(&*current_widget.widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn construct_view(&self, view: ViewName) -> View {
|
fn construct_view(&self, view: ViewName) -> View {
|
||||||
|
|
|
@ -14,8 +14,6 @@ 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/>.
|
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;
|
mod historical_view;
|
||||||
pub use historical_view::HistoricalView;
|
pub use historical_view::HistoricalView;
|
||||||
|
|
||||||
|
@ -35,17 +33,17 @@ pub enum ViewName {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum View {
|
pub enum View {
|
||||||
Placeholder(PlaceholderView),
|
Placeholder(gtk::Widget),
|
||||||
Welcome(WelcomeView),
|
Welcome(gtk::Widget),
|
||||||
Historical(HistoricalView),
|
Historical(gtk::Widget),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl View {
|
impl View {
|
||||||
pub fn widget(&self) -> gtk::Widget {
|
pub fn widget<'a>(&'a self) -> &'a gtk::Widget {
|
||||||
match self {
|
match self {
|
||||||
View::Placeholder(widget) => widget.clone().upcast::<gtk::Widget>(),
|
View::Placeholder(widget) => widget,
|
||||||
View::Welcome(widget) => widget.clone().upcast::<gtk::Widget>(),
|
View::Welcome(widget) => widget,
|
||||||
View::Historical(widget) => widget.clone().upcast::<gtk::Widget>(),
|
View::Historical(widget) => widget,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,8 @@ pub struct Steps {
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct TimeDistance {
|
pub struct TimeDistance {
|
||||||
/// The precise time (and the relevant timezone) of the workout. One of the edge cases that I
|
/// 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 on one day in one timezone would then
|
/// account for is that a ride which occurred at 11pm in one timezone would then count as 1am
|
||||||
/// count as 1am on the next day if the user moves two timezones to the east. While technically
|
/// if one moved two timezones to the east.
|
||||||
/// 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>,
|
pub datetime: DateTime<FixedOffset>,
|
||||||
/// The distance travelled. This is optional because such a workout makes sense even without
|
/// The distance travelled. This is optional because such a workout makes sense even without
|
||||||
/// the distance.
|
/// the distance.
|
||||||
|
|
Loading…
Reference in New Issue