Add the placeholders for game review and settings
This commit is contained in:
parent
057090cfe0
commit
283205081c
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Copyright 2024, Savanni D'Gerinel <savanni@luminescent-dreams.com>
|
||||
|
||||
This file is part of Kifu.
|
||||
|
||||
Kifu is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
Kifu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with Kifu. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use crate::LocalObserver;
|
||||
use kifu_core::{Core, CoreNotification};
|
||||
|
||||
pub struct GameReviewViewModel {
|
||||
core: Core,
|
||||
notification_observer: LocalObserver<CoreNotification>,
|
||||
widget: gtk::Box,
|
||||
}
|
||||
|
||||
impl GameReviewViewModel {
|
||||
fn new(core: Core) -> Self {
|
||||
let notification_observer = LocalObserver::new(&core, |msg| {
|
||||
println!("GameReviewViewModel called with message: {:?}", msg)
|
||||
});
|
||||
|
||||
Self {
|
||||
core,
|
||||
notification_observer,
|
||||
widget: gtk::Box::new(gtk::Orientation::Horizontal, 0),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,13 +18,13 @@ use crate::LocalObserver;
|
|||
use kifu_core::{Core, CoreNotification};
|
||||
|
||||
/// DatabaseViewModel controls the view that the user sees when starting the application if the application has been configured and if there are no games in progress. It provides a window into the database, showing a list of recently recorded games (whether from this app or from a main database). It also provides the UI for starting a new game. This will render an empty database view if the user hasn't configured a database yet.
|
||||
pub struct DatabaseViewModel {
|
||||
pub struct HomeViewModel {
|
||||
core: Core,
|
||||
notification_observer: LocalObserver<CoreNotification>,
|
||||
widget: gtk::Box,
|
||||
}
|
||||
|
||||
impl DatabaseViewModel {
|
||||
impl HomeViewModel {
|
||||
fn new(core: Core) -> Self {
|
||||
let notification_observer = LocalObserver::new(&core, |msg| {
|
||||
println!("DatabaseViewModelHandler called with message: {:?}", msg)
|
|
@ -20,8 +20,14 @@ Every view model requires a reference to the app so that it can call functions o
|
|||
The view model is primary over the view. It will construct the view, it can make major changes to the view or even swap for another related view. It must listen for all messages from the core, discarding those that aren't relevant to it. It will also convert requests from sync to async.
|
||||
*/
|
||||
|
||||
mod database_view_model;
|
||||
pub use database_view_model::DatabaseViewModel;
|
||||
|
||||
mod game_view_model;
|
||||
pub use game_view_model::GameViewModel;
|
||||
|
||||
mod game_review_view_model;
|
||||
pub use game_review_view_model::GameReviewViewModel;
|
||||
|
||||
mod home_view_model;
|
||||
pub use home_view_model::HomeViewModel;
|
||||
|
||||
mod settings_view_model;
|
||||
pub use settings_view_model::SettingsViewModel;
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Copyright 2024, Savanni D'Gerinel <savanni@luminescent-dreams.com>
|
||||
|
||||
This file is part of Kifu.
|
||||
|
||||
Kifu is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
Kifu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with Kifu. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use crate::LocalObserver;
|
||||
use kifu_core::{Core, CoreNotification};
|
||||
|
||||
pub struct SettingsViewModel {
|
||||
core: Core,
|
||||
notification_observer: LocalObserver<CoreNotification>,
|
||||
widget: gtk::Box,
|
||||
}
|
||||
|
||||
impl SettingsViewModel {
|
||||
fn new(core: Core) -> Self {
|
||||
let notification_observer = LocalObserver::new(&core, |msg| {
|
||||
println!("SettingsViewModel called with message: {:?}", msg)
|
||||
});
|
||||
|
||||
Self {
|
||||
core,
|
||||
notification_observer,
|
||||
widget: gtk::Box::new(gtk::Orientation::Horizontal, 0),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue