RiSM GUI
+
diff --git a/gui/tauri-gui/logo.png b/gui/tauri-gui/logo.png
new file mode 100644
index 0000000..5e0e442
Binary files /dev/null and b/gui/tauri-gui/logo.png differ
diff --git a/gui/tauri-gui/logo.svg b/gui/tauri-gui/logo.svg
new file mode 100644
index 0000000..520cd72
--- /dev/null
+++ b/gui/tauri-gui/logo.svg
@@ -0,0 +1,52 @@
+
+
+
+
diff --git a/gui/tauri-gui/package.json b/gui/tauri-gui/package.json
index dc56cc3..e1a4c87 100644
--- a/gui/tauri-gui/package.json
+++ b/gui/tauri-gui/package.json
@@ -16,6 +16,7 @@
"@tauri-apps/api": "^1.5.4",
"bootstrap": "^5.3.3",
"bootstrap-vue-next": "^0.17.2",
+ "bootswatch": "^5.3.3",
"pinia": "^2.1.7",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
diff --git a/gui/tauri-gui/src-tauri/icons/128x128.png b/gui/tauri-gui/src-tauri/icons/128x128.png
index 77e7d23..b1ad3c8 100644
Binary files a/gui/tauri-gui/src-tauri/icons/128x128.png and b/gui/tauri-gui/src-tauri/icons/128x128.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/128x128@2x.png b/gui/tauri-gui/src-tauri/icons/128x128@2x.png
index 0f7976f..db7c6c3 100644
Binary files a/gui/tauri-gui/src-tauri/icons/128x128@2x.png and b/gui/tauri-gui/src-tauri/icons/128x128@2x.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/32x32.png b/gui/tauri-gui/src-tauri/icons/32x32.png
index 98fda06..2bf7fba 100644
Binary files a/gui/tauri-gui/src-tauri/icons/32x32.png and b/gui/tauri-gui/src-tauri/icons/32x32.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square107x107Logo.png b/gui/tauri-gui/src-tauri/icons/Square107x107Logo.png
index f35d84f..d51e39d 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square107x107Logo.png and b/gui/tauri-gui/src-tauri/icons/Square107x107Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square142x142Logo.png b/gui/tauri-gui/src-tauri/icons/Square142x142Logo.png
index 1823bb2..36757f9 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square142x142Logo.png and b/gui/tauri-gui/src-tauri/icons/Square142x142Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square150x150Logo.png b/gui/tauri-gui/src-tauri/icons/Square150x150Logo.png
index dc2b22c..e5965f5 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square150x150Logo.png and b/gui/tauri-gui/src-tauri/icons/Square150x150Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square284x284Logo.png b/gui/tauri-gui/src-tauri/icons/Square284x284Logo.png
index 0ed3984..9d0c933 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square284x284Logo.png and b/gui/tauri-gui/src-tauri/icons/Square284x284Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square30x30Logo.png b/gui/tauri-gui/src-tauri/icons/Square30x30Logo.png
index 60bf0ea..4221a96 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square30x30Logo.png and b/gui/tauri-gui/src-tauri/icons/Square30x30Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square310x310Logo.png b/gui/tauri-gui/src-tauri/icons/Square310x310Logo.png
index c8ca0ad..6b2e038 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square310x310Logo.png and b/gui/tauri-gui/src-tauri/icons/Square310x310Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square44x44Logo.png b/gui/tauri-gui/src-tauri/icons/Square44x44Logo.png
index 8756459..77c3ae4 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square44x44Logo.png and b/gui/tauri-gui/src-tauri/icons/Square44x44Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square71x71Logo.png b/gui/tauri-gui/src-tauri/icons/Square71x71Logo.png
index 2c8023c..6b32c7b 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square71x71Logo.png and b/gui/tauri-gui/src-tauri/icons/Square71x71Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/Square89x89Logo.png b/gui/tauri-gui/src-tauri/icons/Square89x89Logo.png
index 2c5e603..4ee56e0 100644
Binary files a/gui/tauri-gui/src-tauri/icons/Square89x89Logo.png and b/gui/tauri-gui/src-tauri/icons/Square89x89Logo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/StoreLogo.png b/gui/tauri-gui/src-tauri/icons/StoreLogo.png
index 17d142c..cdde052 100644
Binary files a/gui/tauri-gui/src-tauri/icons/StoreLogo.png and b/gui/tauri-gui/src-tauri/icons/StoreLogo.png differ
diff --git a/gui/tauri-gui/src-tauri/icons/icon.icns b/gui/tauri-gui/src-tauri/icons/icon.icns
index a2993ad..76be693 100644
Binary files a/gui/tauri-gui/src-tauri/icons/icon.icns and b/gui/tauri-gui/src-tauri/icons/icon.icns differ
diff --git a/gui/tauri-gui/src-tauri/icons/icon.ico b/gui/tauri-gui/src-tauri/icons/icon.ico
index 06c23c8..c9c4f46 100644
Binary files a/gui/tauri-gui/src-tauri/icons/icon.ico and b/gui/tauri-gui/src-tauri/icons/icon.ico differ
diff --git a/gui/tauri-gui/src-tauri/icons/icon.png b/gui/tauri-gui/src-tauri/icons/icon.png
index d1756ce..5c6393f 100644
Binary files a/gui/tauri-gui/src-tauri/icons/icon.png and b/gui/tauri-gui/src-tauri/icons/icon.png differ
diff --git a/gui/tauri-gui/src-tauri/src/main.rs b/gui/tauri-gui/src-tauri/src/main.rs
index 744dd04..39f9e75 100644
--- a/gui/tauri-gui/src-tauri/src/main.rs
+++ b/gui/tauri-gui/src-tauri/src/main.rs
@@ -1,27 +1,79 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+use std::hash::{DefaultHasher, Hash, Hasher};
+use std::sync::OnceLock;
+use std::thread::ThreadId;
+use rism::constants::{Points};
+use rism::io::{import_seminars, import_students};
+use rism::rism_classic::run;
+use rism::rism_model_checking::run_model_check;
+use serde_json::to_string;
+use tauri::{ Manager, Window};
+
const VERSION: &str = env!("CARGO_PKG_VERSION");
+static WINDOW: OnceLock = OnceLock::new();
+
#[tauri::command]
fn get_version() -> String {
- return String::from(VERSION);
+ return String::from(VERSION);
}
#[tauri::command]
fn uses_system_z3() -> bool {
- #[cfg(feature = "bundle_z3")]
- return false;
+ #[cfg(feature = "bundle_z3")]
+ return false;
+
+ #[cfg(not(feature = "bundle_z3"))]
+ return true;
+}
+
+#[tauri::command]
+async fn run_normal(votes: String, seminars: String, iterations: u32, threads: u16) -> String {
+ let seminars = import_seminars(&*seminars);
+ let students = import_students(&*votes, &seminars);
+
+ let best_iteration = run(&students, &seminars, iterations, Points::default(), threads, send_progress);
+ println!("Done");
+ to_string(&best_iteration).unwrap()
+}
+
+#[tauri::command]
+async fn run_model_checking(votes: String, seminars: String) -> String {
+ let seminars = import_seminars(&*seminars);
+ let students = import_students(&*votes, &seminars);
- #[cfg(not(feature = "bundle_z3"))]
- return true;
+ let best_iteration = run_model_check(&students, &seminars, Points::default());
+ println!("Done");
+ to_string(&best_iteration).unwrap()
}
+#[derive(Clone, serde::Serialize)]
+struct ProgressPayload {
+ thread_id: u64,
+ progress: u32,
+ total: u32,
+}
+
+fn send_progress(t_id: ThreadId, p: u32, t: u32) {
+ if p % 10000 == 0 {
+ let mut hasher = DefaultHasher::new();
+ t_id.hash(&mut hasher);
+ WINDOW.get().expect("window is available").emit("progress", ProgressPayload { thread_id: hasher.finish(), progress: p, total: t }).expect("Send message");
+ }
+}
fn main() {
- tauri::Builder::default()
- .invoke_handler(tauri::generate_handler![get_version,uses_system_z3])
- .run(tauri::generate_context!())
- .expect("error while running tauri application");
+ tauri::Builder::default()
+ .setup(|app| {
+ let window = app.get_window("main").unwrap();
+
+ _ = WINDOW.set(window);
+ Ok(())
+ })
+ .invoke_handler(tauri::generate_handler![get_version,uses_system_z3,run_normal,run_model_checking])
+ .run(tauri::generate_context!())
+ .expect("error while running tauri application");
}
diff --git a/gui/tauri-gui/src-tauri/tauri.conf.json b/gui/tauri-gui/src-tauri/tauri.conf.json
index 363f308..f124279 100644
--- a/gui/tauri-gui/src-tauri/tauri.conf.json
+++ b/gui/tauri-gui/src-tauri/tauri.conf.json
@@ -59,8 +59,8 @@
"windows": [
{
"fullscreen": false,
- "height": 650,
- "resizable": false,
+ "height": 700,
+ "resizable": true,
"title": "RiSM",
"width": 1000
}
diff --git a/gui/tauri-gui/src/App.vue b/gui/tauri-gui/src/App.vue
index e99ef41..83d12d3 100644
--- a/gui/tauri-gui/src/App.vue
+++ b/gui/tauri-gui/src/App.vue
@@ -4,24 +4,35 @@ import {BNavbar} from "bootstrap-vue-next";
-
- RiSM GUI
-
-
- New calculation
- About
-
-
+
+ RiSM GUI
+
+
+ New calculation
+ About
+
+
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gui/tauri-gui/src/views/NormalRun.vue b/gui/tauri-gui/src/views/NormalRun.vue
new file mode 100644
index 0000000..f93ee32
--- /dev/null
+++ b/gui/tauri-gui/src/views/NormalRun.vue
@@ -0,0 +1,44 @@
+
+
+
+
Running...
+
+
Thread {{ key + 1 }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gui/tauri-gui/src/views/Results.vue b/gui/tauri-gui/src/views/Results.vue
new file mode 100644
index 0000000..d7bfaf6
--- /dev/null
+++ b/gui/tauri-gui/src/views/Results.vue
@@ -0,0 +1,33 @@
+
+
+
+