about summary refs log tree commit diff
path: root/src/gtk
diff options
context:
space:
mode:
authorRicky Kresslein <ricky@kressle.in>2022-02-18 16:14:09 +0100
committerRicky Kresslein <ricky@kressle.in>2022-02-18 16:14:09 +0100
commitac99aca2510eebb83ac9a112849d8788ef67db3d (patch)
tree57bbddbf10a83f8abd5e5020b897ed80dc7d7e44 /src/gtk
downloadFurtherance-ac99aca2510eebb83ac9a112849d8788ef67db3d.tar.zst
- Moved to com.lakoliu.Furtherance
- Removed development flag for release
- Created nicer about dialog
- Added description to data file
- Improved desktop file
- Changed database directory
- Delete All no longer enabled if no tasks
- Added GPL to top of every file
Diffstat (limited to 'src/gtk')
-rw-r--r--src/gtk/history_box.ui87
-rw-r--r--src/gtk/style.css21
-rw-r--r--src/gtk/task_details.ui138
-rw-r--r--src/gtk/task_row.ui39
-rw-r--r--src/gtk/tasks_group.ui10
-rw-r--r--src/gtk/tasks_page.ui5
-rw-r--r--src/gtk/window.ui95
7 files changed, 395 insertions, 0 deletions
diff --git a/src/gtk/history_box.ui b/src/gtk/history_box.ui
new file mode 100644
index 0000000..b761624
--- /dev/null
+++ b/src/gtk/history_box.ui
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="FurHistoryBox" parent="GtkBox">
+    <child>
+      <object class="GtkStack" id="stack">
+        <property name="transition_type">crossfade</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <child>
+          <object class="GtkStackPage">
+            <property name="name">loading</property>
+            <property name="child">
+              <object class="GtkSpinner" id="spinner">
+                <property name="halign">center</property>
+                <property name="width-request">32</property>
+              </object>
+            </property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkStackPage">
+            <property name="name">empty</property>
+            <property name="child">
+              <object class="AdwStatusPage" id="welcome_page">
+                <property name="title" translatable="yes">Start Tracking</property>
+                <property name="icon_name">com.lakoliu.Furtherance</property>
+                <property name="child">
+                  <object class="GtkGrid">
+                    <property name="halign">center</property>
+                    <property name="row_spacing">12</property>
+                    <property name="column_spacing">12</property>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="icon_name">list-add-symbolic</property>
+                        <layout>
+                          <property name="column">0</property>
+                          <property name="row">0</property>
+                        </layout>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">Type your task and press start</property>
+                        <layout>
+                          <property name="column">1</property>
+                          <property name="row">0</property>
+                        </layout>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="icon_name">window-new-symbolic</property>
+                        <layout>
+                          <property name="column">0</property>
+                          <property name="row">1</property>
+                        </layout>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">Prior tasks will show up here</property>
+                        <layout>
+                          <property name="column">1</property>
+                          <property name="row">1</property>
+                        </layout>
+                      </object>
+                    </child>
+                  </object>
+                </property>
+              </object>
+            </property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkStackPage">
+            <property name="name">tasks</property>
+            <property name="child">
+              <object class="FurTasksPage" id="tasks_page"/>
+            </property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/gtk/style.css b/src/gtk/style.css
new file mode 100644
index 0000000..5681ce3
--- /dev/null
+++ b/src/gtk/style.css
@@ -0,0 +1,21 @@
+.welcome-icon {
+  transform: scale(2.5);
+}
+
+.task-details headerbar {
+  transition: 200ms ease-out;
+  transition-property: box-shadow, background-color;
+}
+
+.task-details headerbar.hidden {
+  background-color: transparent;
+  box-shadow: inset 0 -1px transparent;
+}
+
+.inactive-button, .inactive-button:hover {
+  background-color: #f3f3f3;
+}
+
+.error_message {
+  color: red;
+}
diff --git a/src/gtk/task_details.ui b/src/gtk/task_details.ui
new file mode 100644
index 0000000..ccbfc1e
--- /dev/null
+++ b/src/gtk/task_details.ui
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="FurTaskDetails" parent="AdwWindow">
+    <property name="width-request">350</property>
+    <property name="height-request">400</property>
+    <property name="default-width">350</property>
+    <property name="default-height">550</property>
+    <property name="title" translatable="yes">Task Details</property>
+    <property name="modal">True</property>
+    <style>
+      <class name="task-details"/>
+    </style>
+    <child>
+      <object class="GtkOverlay">
+        <child type="overlay">
+          <object class="GtkHeaderBar" id="headerbar">
+            <property name="valign">start</property>
+            <property name="title-widget">
+              <object class="AdwWindowTitle" id="dialog_title">
+                <property name="visible">False</property>
+              </object>
+            </property>
+            <style>
+              <class name="hidden"/>
+            </style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolled_window">
+            <property name="vexpand">True</property>
+            <property name="hscrollbar-policy">never</property>
+            <style>
+              <class name="flat-headerbar"/>
+            </style>
+            <child>
+              <object class="AdwClamp">
+                <property name="margin-start">12</property>
+                <property name="margin-end">12</property>
+                <property name="margin-top">24</property>
+                <property name="margin-bottom">24</property>
+                <property name="maximum-size">500</property>
+                <child>
+                  <object class="GtkBox">
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">18</property>
+                    <child>
+                      <object class="AdwClamp">
+                        <property name="maximum-size">400</property>
+                        <property name="margin-top">48</property>
+                        <property name="tightening-threshold">200</property>
+                        <child>
+                          <object class="GtkLabel" id="task_name_label">
+                            <property name="wrap">True</property>
+                            <property name="justify">center</property>
+                            <property name="ellipsize">end</property>
+                            <property name="lines">3</property>
+                            <property name="wrap-mode">word-char</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="main_box">
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">8</property>
+                        <child>
+                          <object class="GtkBox">
+                            <property name="hexpand">True</property>
+                            <property name="homogeneous">True</property>
+                            <property name="spacing">5</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="label">Start</property>
+                                <style>
+                                  <class name="title-2"/>
+                                </style>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="label">Stop</property>
+                                <style>
+                                  <class name="title-2"/>
+                                </style>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="label">Total</property>
+                                <style>
+                                  <class name="title-2"/>
+                                </style>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="overlay">
+          <object class="GtkBox">
+            <property name="spacing">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-bottom">12</property>
+            <property name="orientation">vertical</property>
+            <property name="halign">end</property>
+            <property name="valign">end</property>
+            <child>
+              <object class="GtkButton" id="delete_all_btn">
+                <property name="icon-name">user-trash-symbolic</property>
+                <property name="tooltip-text" translatable="yes">Delete all</property>
+                <style>
+                  <class name="delete-all-button"/>
+                </style>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkShortcutController">
+        <property name="scope">local</property>
+        <child>
+          <object class="GtkShortcut">
+            <property name="trigger">Escape</property>
+            <property name="action">action(window.close)</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/gtk/task_row.ui b/src/gtk/task_row.ui
new file mode 100644
index 0000000..edd2899
--- /dev/null
+++ b/src/gtk/task_row.ui
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="FurTaskRow" parent="GtkListBoxRow">
+    <child>
+      <object class="GtkBox">
+        <property name="orientation">horizontal</property>
+        <property name="margin_top">10</property>
+        <property name="margin_bottom">10</property>
+        <property name="margin_end">12</property>
+        <property name="margin_start">12</property>
+        <property name="hexpand">True</property>
+        <property name="spacing">3</property>
+        <property name="valign">center</property>
+        <property name="homogeneous">True</property>
+        <child>
+          <object class="GtkLabel" id="task_name_label">
+            <property name="halign">start</property>
+            <property name="label" translatable="yes">Task</property>
+            <property name="ellipsize">end</property>
+            <property name="single_line_mode">True</property>
+            <style>
+              <class name="heading"/>
+            </style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="total_time_label">
+            <property name="halign">end</property>
+            <property name="label" translatable="yes">Time</property>
+            <property name="single_line_mode">True</property>
+            <style>
+              <class name="numeric"/>
+            </style>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/gtk/tasks_group.ui b/src/gtk/tasks_group.ui
new file mode 100644
index 0000000..be43050
--- /dev/null
+++ b/src/gtk/tasks_group.ui
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="FurTasksGroup" parent="AdwPreferencesGroup">
+    <child>
+      <object class="GtkBox" id="listbox_box">
+        <property name="orientation">vertical</property>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/gtk/tasks_page.ui b/src/gtk/tasks_page.ui
new file mode 100644
index 0000000..dcd6513
--- /dev/null
+++ b/src/gtk/tasks_page.ui
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="FurTasksPage" parent="AdwPreferencesPage">
+  </template>
+</interface>
diff --git a/src/gtk/window.ui b/src/gtk/window.ui
new file mode 100644
index 0000000..d6c5311
--- /dev/null
+++ b/src/gtk/window.ui
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk" version="4.0"/>
+  <template class="FurtheranceWindow" parent="AdwApplicationWindow">
+    <property name="title">Furtherance</property>
+    <property name="content">
+      <object class="AdwToastOverlay" id="toast_overlay">
+        <property name="child">
+          <object class="GtkBox" id="main_box">
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="AdwHeaderBar" id="header_bar">
+                <property name="title-widget">
+                  <object class="AdwWindowTitle" id="window_title">
+                    <property name="title">Furtherance</property>
+                  </object>
+                </property>
+                <child type="end">
+                  <object class="GtkMenuButton" id="app_menu_button">
+                    <property name="tooltip_text" translatable="yes">Main Menu</property>
+                    <property name="icon_name">open-menu-symbolic</property>
+                    <property name="menu_model">primary_menu</property>
+                  </object>
+                </child>
+                <style>
+                  <class name="titlebar"/>
+                </style>
+              </object>
+            </child>
+            <child>
+            <object class="GtkBox" id="win_box">
+              <property name="orientation">vertical</property>
+              <property name="spacing">10</property>
+              <property name="margin_bottom">18</property>
+              <property name="halign">center</property>
+              <property name="width_request">400</property>
+              <property name="vexpand">True</property>
+              <child>
+                <object class="GtkLabel" id="watch">
+                  <property name="label">00:00:00</property>
+                  <attributes>
+                    <attribute name="weight" value="bold"/>
+                    <attribute name="scale" value="5"/>
+                  </attributes>
+                  <style>
+                    <class name="numeric"/>
+                  </style>
+                </object>
+              </child>
+              <child>
+                <object class="GtkBox">
+                  <property name="spacing">5</property>
+                  <property name="margin_start">12</property>
+                  <property name="margin_end">8</property>
+                  <child>
+                    <object class="GtkEntry" id="task_input">
+                      <property name="placeholder-text" translatable="yes">Task Name</property>
+                      <property name="hexpand">True</property>
+                      <property name="hexpand-set">True</property>
+                    </object>
+                  </child>
+                  <child>
+                    <object class="GtkButton" id="start_button">
+                      <property name="icon-name">media-playback-start-symbolic</property>
+                    </object>
+                  </child>
+                </object>
+              </child>
+              <child>
+                <object class="FurHistoryBox" id="history_box" />
+              </child>
+            </object>
+          </child>
+          </object>
+        </property>
+      </object>
+    </property>
+  </template>
+  <menu id="primary_menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_About Furtherance</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Delete history</attribute>
+        <attribute name="action">app.delete-history</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>