Compare commits

...

1 commit

Author SHA1 Message Date
e301ce4bd8 Combine connection panel with server panel (close #102) 2024-05-24 16:45:40 +02:00
14 changed files with 345 additions and 366 deletions

View file

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="4.8"/>
<requires lib="adw" version="1.2" />
<object class="GtkAdjustment" id="server-port-adjustment">
<property name="lower">1024</property>
<property name="upper">9999</property>
<property name="value">6600</property>
<property name="step-increment">1</property>
<property name="page-increment">100</property>
</object>
<object class="GtkBox" id="toolbar">
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
</object>
<template class="McgConnectionPanel" parent="AdwBin">
<child>
<object class="AdwStatusPage">
<property name="title">Connect to MPD</property>
<child>
<object class="GtkBox">
<property name="hexpand">false</property>
<property name="halign">center</property>
<child>
<object class="GtkListBox" id="zeroconf_list">
<property name="hexpand">true</property>
<child type="placeholder">
<object class="GtkLabel">
<property name="label" translatable="yes">No service found</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBox">
<property name="hexpand">true</property>
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="AdwEntryRow" id="host_row">
<property name="title" translatable="yes">Host</property>
<property name="show-apply-button">true</property>
<signal name="apply" handler="on_host_entry_apply"/>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<style>
<class name="header"/>
</style>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Port</property>
<property name="halign">start</property>
<property name="hexpand">false</property>
<style>
<class name="subtitle"/>
</style>
</object>
</child>
<child>
<object class="GtkSpinButton" id="port_spinner">
<property name="name">port_spinner</property>
<property name="value">6600</property>
<property name="adjustment">server-port-adjustment</property>
<signal name="value-changed" handler="on_port_spinner_value_changed"/>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow" id="password_row">
<property name="title" translatable="yes">Password</property>
<property name="show-apply-button">true</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>

View file

@ -2,6 +2,13 @@
<interface>
<requires lib="gtk+" version="4.8"/>
<requires lib="adw" version="1.2" />
<object class="GtkAdjustment" id="server-port-adjustment">
<property name="lower">1024</property>
<property name="upper">9999</property>
<property name="value">6600</property>
<property name="step-increment">1</property>
<property name="page-increment">100</property>
</object>
<object class="GtkBox" id="toolbar">
<property name="orientation">horizontal</property>
<property name="halign">end</property>
@ -31,8 +38,84 @@
<object class="GtkStack" id="stack">
<child>
<object class="GtkStackPage">
<property name="name">connection</property>
<property name="title" translatable="yes">Connection</property>
<property name="child">
<object class="AdwStatusPage" id="connection_status_page">
<property name="icon-name">network-wired-symbolic</property>
<child>
<object class="GtkBox">
<property name="hexpand">false</property>
<property name="halign">center</property>
<child>
<object class="GtkListBox" id="zeroconf_list">
<property name="hexpand">true</property>
<child type="placeholder">
<object class="GtkLabel">
<property name="label" translatable="yes">No service found</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBox">
<property name="hexpand">true</property>
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="AdwEntryRow" id="host_row">
<property name="title" translatable="yes">Host</property>
<property name="show-apply-button">true</property>
<signal name="apply" handler="on_host_entry_apply"/>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<style>
<class name="header"/>
</style>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Port</property>
<property name="halign">start</property>
<property name="hexpand">false</property>
<style>
<class name="subtitle"/>
</style>
</object>
</child>
<child>
<object class="GtkSpinButton" id="port_spinner">
<property name="name">port_spinner</property>
<property name="value">6600</property>
<property name="adjustment">server-port-adjustment</property>
<signal name="value-changed" handler="on_port_spinner_value_changed"/>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow" id="password_row">
<property name="title" translatable="yes">Password</property>
<property name="show-apply-button">true</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage" id="status_page">
<property name="name">status</property>
<property name="title" translatable="yes">Status</property>
<property name="visible">false</property>
<property name="child">
<object class="AdwStatusPage">
<property name="icon-name">dialog-information-symbolic</property>
@ -149,9 +232,10 @@
</object>
</child>
<child>
<object class="GtkStackPage">
<object class="GtkStackPage" id="stats_page">
<property name="name">stats</property>
<property name="title" translatable="yes">Statistics</property>
<property name="visible">false</property>
<property name="child">
<object class="AdwStatusPage">
<property name="icon-name">starred-symbolic</property>
@ -298,9 +382,10 @@
</object>
</child>
<child>
<object class="GtkStackPage">
<object class="GtkStackPage" id="devices_page">
<property name="name">devices</property>
<property name="title" translatable="yes">Audio Devices</property>
<property name="visible">false</property>
<property name="child">
<object class="AdwStatusPage">
<property name="icon-name">audio-speakers-symbolic</property>

View file

@ -49,15 +49,9 @@
<child>
<object class="AdwToastOverlay" id="info_toast">
<child>
<object class="GtkStack" id="content_stack">
<property name="name">content_stack</property>
<object class="AdwViewStack" id="panel_stack">
<property name="vexpand">true</property>
<child>
<object class="AdwViewStack" id="panel_stack">
<property name="vexpand">true</property>
<signal name="notify::visible-child" handler="on_stack_switched" swapped="no"/>
</object>
</child>
<signal name="notify::visible-child" handler="on_stack_switched" swapped="no"/>
</object>
</child>
</object>

View file

@ -5,7 +5,6 @@
<file>noise-texture.png</file>
<file>ui/window.ui</file>
<file>ui/shortcuts-dialog.ui</file>
<file>ui/connection-panel.ui</file>
<file>ui/album-headerbar.ui</file>
<file>ui/server-panel.ui</file>
<file>ui/cover-panel.ui</file>

View file

@ -1,5 +1,4 @@
data/ui/album-headerbar.ui
data/ui/connection-panel.ui
data/ui/cover-panel.ui
data/ui/library-panel.ui
data/ui/playlist-panel.ui
@ -9,7 +8,6 @@ data/ui/window.ui
src/albumheaderbar.py
src/application.py
src/client.py
src/connectionpanel.py
src/coverpanel.py
src/librarypanel.py
src/main.py

BIN
po/de.mo

Binary file not shown.

View file

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-22 14:39+0200\n"
"PO-Revision-Date: 2024-05-22 14:39+0200\n"
"POT-Creation-Date: 2024-05-24 16:44+0200\n"
"PO-Revision-Date: 2024-05-24 16:45+0200\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\n"
"Language-Team: \n"
"Language: de_DE\n"
@ -15,22 +15,6 @@ msgstr ""
"X-Poedit-Basepath: ../../..\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: data/ui/connection-panel.ui:29
msgid "No service found"
msgstr "Keine Dienste gefunden"
#: data/ui/connection-panel.ui:43
msgid "Host"
msgstr "Host"
#: data/ui/connection-panel.ui:56
msgid "Port"
msgstr "Port"
#: data/ui/connection-panel.ui:76
msgid "Password"
msgstr "Passwort"
#: data/ui/cover-panel.ui:12 data/ui/shortcuts-dialog.ui:88
msgid "Show the cover in fullscreen mode"
msgstr "Das Cover im Vollbildmodus anzeigen"
@ -79,15 +63,15 @@ msgstr "Einstellungen und Aktionen"
msgid "search library"
msgstr "Bibliothek durchsuchen"
#: data/ui/library-panel.ui:263 data/ui/playlist-panel.ui:107
#: data/ui/library-panel.ui:264 data/ui/playlist-panel.ui:107
msgid "cancel"
msgstr "abbrechen"
#: data/ui/library-panel.ui:270 data/ui/library-panel.ui:327
#: data/ui/library-panel.ui:271 data/ui/library-panel.ui:328
msgid "queue"
msgstr "einreihen"
#: data/ui/library-panel.ui:320 data/ui/playlist-panel.ui:163
#: data/ui/library-panel.ui:321 data/ui/playlist-panel.ui:163
msgid "play"
msgstr "abspielen"
@ -99,60 +83,80 @@ msgstr "Die Wiedergabeliste leeren"
msgid "remove"
msgstr "entfernen"
#: data/ui/server-panel.ui:35
#: data/ui/server-panel.ui:42
msgid "Connection"
msgstr "Verbindung"
#: data/ui/server-panel.ui:55
msgid "No service found"
msgstr "Keine Dienste gefunden"
#: data/ui/server-panel.ui:69
msgid "Host"
msgstr "Host"
#: data/ui/server-panel.ui:82
msgid "Port"
msgstr "Port"
#: data/ui/server-panel.ui:102
msgid "Password"
msgstr "Passwort"
#: data/ui/server-panel.ui:117
msgid "Status"
msgstr "Status"
#: data/ui/server-panel.ui:49
#: data/ui/server-panel.ui:132
msgid "File:"
msgstr "Datei:"
#: data/ui/server-panel.ui:60
#: data/ui/server-panel.ui:143
msgid "Audio:"
msgstr "Audio:"
#: data/ui/server-panel.ui:71
#: data/ui/server-panel.ui:154
msgid "Bitrate:"
msgstr "Bitrate:"
#: data/ui/server-panel.ui:82
#: data/ui/server-panel.ui:165
msgid "Error:"
msgstr "Fehler:"
#: data/ui/server-panel.ui:92 data/ui/server-panel.ui:106
#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:134
#: data/ui/server-panel.ui:175 data/ui/server-panel.ui:189
#: data/ui/server-panel.ui:203 data/ui/server-panel.ui:217
msgid "<i>none</i>"
msgstr "<i>nichts</i>"
#: data/ui/server-panel.ui:154
#: data/ui/server-panel.ui:237
msgid "Statistics"
msgstr "Statistiken"
#: data/ui/server-panel.ui:178
#: data/ui/server-panel.ui:262
msgid "Artists"
msgstr "Künstler"
#: data/ui/server-panel.ui:198
#: data/ui/server-panel.ui:282
msgid "Albums"
msgstr "Alben"
#: data/ui/server-panel.ui:218
#: data/ui/server-panel.ui:302
msgid "Songs"
msgstr "Songs"
#: data/ui/server-panel.ui:238
#: data/ui/server-panel.ui:322
msgid "Seconds"
msgstr "Sekunden"
#: data/ui/server-panel.ui:267
#: data/ui/server-panel.ui:351
msgid "Seconds played"
msgstr "Sekunden gespielt"
#: data/ui/server-panel.ui:287
#: data/ui/server-panel.ui:371
msgid "Seconds running"
msgstr "Sekunden laufend"
#: data/ui/server-panel.ui:303
#: data/ui/server-panel.ui:387
msgid "Audio Devices"
msgstr "Audiogeräte"
@ -208,18 +212,18 @@ msgstr "Cover-Paneel"
msgid "Library Panel"
msgstr "Bibliothekspaneel"
#: src/connectionpanel.py:51
msgid "use"
msgstr "verwenden"
#: src/librarypanel.py:291
msgid "Loading albums"
msgstr "Alben werden geladen"
#: src/librarypanel.py:379
#: src/librarypanel.py:370
msgid "Loading images"
msgstr "Bilder werden geladen"
#: src/serverpanel.py:77
msgid "use"
msgstr "verwenden"
#: src/utils.py:50 src/utils.py:67
msgid "{} feat. {}"
msgstr "{} mit {}"
@ -228,19 +232,20 @@ msgstr "{} mit {}"
msgid "{}:{} minutes"
msgstr "{}:{} Minuten"
#: src/window.py:114
#. Stack
#: src/window.py:106
msgid "Server"
msgstr "Server"
#: src/window.py:115
#: src/window.py:107
msgid "Cover"
msgstr "Cover"
#: src/window.py:116
#: src/window.py:108
msgid "Playlist"
msgstr "Wiedergabeliste"
#: src/window.py:117
#: src/window.py:109
msgid "Library"
msgstr "Bibliothek"
@ -275,9 +280,6 @@ msgstr "Bibliothek"
#~ msgid "Search Library"
#~ msgstr "Bibliothek durchsuchen"
#~ msgid "Connection"
#~ msgstr "Verbindung"
#~ msgid "Keyboard Shortcuts"
#~ msgstr "Tastenkombinationen"

BIN
po/en.mo

Binary file not shown.

View file

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-22 14:39+0200\n"
"PO-Revision-Date: 2024-05-22 14:39+0200\n"
"POT-Creation-Date: 2024-05-24 16:44+0200\n"
"PO-Revision-Date: 2024-05-24 16:45+0200\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\n"
"Language-Team: \n"
"Language: en\n"
@ -16,22 +16,6 @@ msgstr ""
"X-Poedit-SearchPath-0: mcg\n"
"X-Poedit-SearchPath-1: data/ui\n"
#: data/ui/connection-panel.ui:29
msgid "No service found"
msgstr "No service found"
#: data/ui/connection-panel.ui:43
msgid "Host"
msgstr "Host"
#: data/ui/connection-panel.ui:56
msgid "Port"
msgstr "Port"
#: data/ui/connection-panel.ui:76
msgid "Password"
msgstr "Password"
#: data/ui/cover-panel.ui:12 data/ui/shortcuts-dialog.ui:88
msgid "Show the cover in fullscreen mode"
msgstr "Show the cover in fullscreen mode"
@ -80,15 +64,15 @@ msgstr "Settings and actions"
msgid "search library"
msgstr "search library"
#: data/ui/library-panel.ui:263 data/ui/playlist-panel.ui:107
#: data/ui/library-panel.ui:264 data/ui/playlist-panel.ui:107
msgid "cancel"
msgstr "cancel"
#: data/ui/library-panel.ui:270 data/ui/library-panel.ui:327
#: data/ui/library-panel.ui:271 data/ui/library-panel.ui:328
msgid "queue"
msgstr "queue"
#: data/ui/library-panel.ui:320 data/ui/playlist-panel.ui:163
#: data/ui/library-panel.ui:321 data/ui/playlist-panel.ui:163
msgid "play"
msgstr "play"
@ -100,60 +84,80 @@ msgstr "Clear the playlist"
msgid "remove"
msgstr "remove"
#: data/ui/server-panel.ui:35
#: data/ui/server-panel.ui:42
msgid "Connection"
msgstr "Connection"
#: data/ui/server-panel.ui:55
msgid "No service found"
msgstr "No service found"
#: data/ui/server-panel.ui:69
msgid "Host"
msgstr "Host"
#: data/ui/server-panel.ui:82
msgid "Port"
msgstr "Port"
#: data/ui/server-panel.ui:102
msgid "Password"
msgstr "Password"
#: data/ui/server-panel.ui:117
msgid "Status"
msgstr "Status"
#: data/ui/server-panel.ui:49
#: data/ui/server-panel.ui:132
msgid "File:"
msgstr "File:"
#: data/ui/server-panel.ui:60
#: data/ui/server-panel.ui:143
msgid "Audio:"
msgstr "Audio:"
#: data/ui/server-panel.ui:71
#: data/ui/server-panel.ui:154
msgid "Bitrate:"
msgstr "Bitrate:"
#: data/ui/server-panel.ui:82
#: data/ui/server-panel.ui:165
msgid "Error:"
msgstr "Error:"
#: data/ui/server-panel.ui:92 data/ui/server-panel.ui:106
#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:134
#: data/ui/server-panel.ui:175 data/ui/server-panel.ui:189
#: data/ui/server-panel.ui:203 data/ui/server-panel.ui:217
msgid "<i>none</i>"
msgstr "<i>none</i>"
#: data/ui/server-panel.ui:154
#: data/ui/server-panel.ui:237
msgid "Statistics"
msgstr "Statistics"
#: data/ui/server-panel.ui:178
#: data/ui/server-panel.ui:262
msgid "Artists"
msgstr "Artists"
#: data/ui/server-panel.ui:198
#: data/ui/server-panel.ui:282
msgid "Albums"
msgstr "Albums"
#: data/ui/server-panel.ui:218
#: data/ui/server-panel.ui:302
msgid "Songs"
msgstr "Songs"
#: data/ui/server-panel.ui:238
#: data/ui/server-panel.ui:322
msgid "Seconds"
msgstr "Seconds"
#: data/ui/server-panel.ui:267
#: data/ui/server-panel.ui:351
msgid "Seconds played"
msgstr "Seconds"
#: data/ui/server-panel.ui:287
#: data/ui/server-panel.ui:371
msgid "Seconds running"
msgstr "Seconds running"
#: data/ui/server-panel.ui:303
#: data/ui/server-panel.ui:387
msgid "Audio Devices"
msgstr "Audio Devices"
@ -209,18 +213,18 @@ msgstr "Cover Panel"
msgid "Library Panel"
msgstr "Library Panel"
#: src/connectionpanel.py:51
msgid "use"
msgstr "use"
#: src/librarypanel.py:291
msgid "Loading albums"
msgstr "Loading albums"
#: src/librarypanel.py:379
#: src/librarypanel.py:370
msgid "Loading images"
msgstr "Loading images"
#: src/serverpanel.py:77
msgid "use"
msgstr "use"
#: src/utils.py:50 src/utils.py:67
msgid "{} feat. {}"
msgstr "{} feat. {}"
@ -229,19 +233,20 @@ msgstr "{} feat. {}"
msgid "{}:{} minutes"
msgstr "{}:{} minutes"
#: src/window.py:114
#. Stack
#: src/window.py:106
msgid "Server"
msgstr "Server"
#: src/window.py:115
#: src/window.py:107
msgid "Cover"
msgstr "Cover"
#: src/window.py:116
#: src/window.py:108
msgid "Playlist"
msgstr "Playlist"
#: src/window.py:117
#: src/window.py:109
msgid "Library"
msgstr "Library"
@ -276,9 +281,6 @@ msgstr "Library"
#~ msgid "Search Library"
#~ msgstr "Search Library"
#~ msgid "Connection"
#~ msgstr "Connection"
#~ msgid "Keyboard Shortcuts"
#~ msgstr "Keyboard Shortcuts"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: mcg\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-22 14:39+0200\n"
"POT-Creation-Date: 2024-05-24 16:44+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,22 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: data/ui/connection-panel.ui:29
msgid "No service found"
msgstr ""
#: data/ui/connection-panel.ui:43
msgid "Host"
msgstr ""
#: data/ui/connection-panel.ui:56
msgid "Port"
msgstr ""
#: data/ui/connection-panel.ui:76
msgid "Password"
msgstr ""
#: data/ui/cover-panel.ui:12 data/ui/shortcuts-dialog.ui:88
msgid "Show the cover in fullscreen mode"
msgstr ""
@ -81,15 +65,15 @@ msgstr ""
msgid "search library"
msgstr ""
#: data/ui/library-panel.ui:263 data/ui/playlist-panel.ui:107
#: data/ui/library-panel.ui:264 data/ui/playlist-panel.ui:107
msgid "cancel"
msgstr ""
#: data/ui/library-panel.ui:270 data/ui/library-panel.ui:327
#: data/ui/library-panel.ui:271 data/ui/library-panel.ui:328
msgid "queue"
msgstr ""
#: data/ui/library-panel.ui:320 data/ui/playlist-panel.ui:163
#: data/ui/library-panel.ui:321 data/ui/playlist-panel.ui:163
msgid "play"
msgstr ""
@ -101,60 +85,80 @@ msgstr ""
msgid "remove"
msgstr ""
#: data/ui/server-panel.ui:35
msgid "Status"
#: data/ui/server-panel.ui:42
msgid "Connection"
msgstr ""
#: data/ui/server-panel.ui:49
msgid "File:"
#: data/ui/server-panel.ui:55
msgid "No service found"
msgstr ""
#: data/ui/server-panel.ui:60
msgid "Audio:"
msgstr ""
#: data/ui/server-panel.ui:71
msgid "Bitrate:"
#: data/ui/server-panel.ui:69
msgid "Host"
msgstr ""
#: data/ui/server-panel.ui:82
msgid "Error:"
msgid "Port"
msgstr ""
#: data/ui/server-panel.ui:92 data/ui/server-panel.ui:106
#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:134
msgid "<i>none</i>"
#: data/ui/server-panel.ui:102
msgid "Password"
msgstr ""
#: data/ui/server-panel.ui:117
msgid "Status"
msgstr ""
#: data/ui/server-panel.ui:132
msgid "File:"
msgstr ""
#: data/ui/server-panel.ui:143
msgid "Audio:"
msgstr ""
#: data/ui/server-panel.ui:154
msgid "Bitrate:"
msgstr ""
#: data/ui/server-panel.ui:165
msgid "Error:"
msgstr ""
#: data/ui/server-panel.ui:175 data/ui/server-panel.ui:189
#: data/ui/server-panel.ui:203 data/ui/server-panel.ui:217
msgid "<i>none</i>"
msgstr ""
#: data/ui/server-panel.ui:237
msgid "Statistics"
msgstr ""
#: data/ui/server-panel.ui:178
#: data/ui/server-panel.ui:262
msgid "Artists"
msgstr ""
#: data/ui/server-panel.ui:198
#: data/ui/server-panel.ui:282
msgid "Albums"
msgstr ""
#: data/ui/server-panel.ui:218
#: data/ui/server-panel.ui:302
msgid "Songs"
msgstr ""
#: data/ui/server-panel.ui:238
#: data/ui/server-panel.ui:322
msgid "Seconds"
msgstr ""
#: data/ui/server-panel.ui:267
#: data/ui/server-panel.ui:351
msgid "Seconds played"
msgstr ""
#: data/ui/server-panel.ui:287
#: data/ui/server-panel.ui:371
msgid "Seconds running"
msgstr ""
#: data/ui/server-panel.ui:303
#: data/ui/server-panel.ui:387
msgid "Audio Devices"
msgstr ""
@ -210,18 +214,18 @@ msgstr ""
msgid "Library Panel"
msgstr ""
#: src/connectionpanel.py:51
msgid "use"
msgstr ""
#: src/librarypanel.py:291
msgid "Loading albums"
msgstr ""
#: src/librarypanel.py:379
#: src/librarypanel.py:370
msgid "Loading images"
msgstr ""
#: src/serverpanel.py:77
msgid "use"
msgstr ""
#: src/utils.py:50 src/utils.py:67
msgid "{} feat. {}"
msgstr ""
@ -230,18 +234,19 @@ msgstr ""
msgid "{}:{} minutes"
msgstr ""
#: src/window.py:114
#. Stack
#: src/window.py:106
msgid "Server"
msgstr ""
#: src/window.py:115
#: src/window.py:107
msgid "Cover"
msgstr ""
#: src/window.py:116
#: src/window.py:108
msgid "Playlist"
msgstr ""
#: src/window.py:117
#: src/window.py:109
msgid "Library"
msgstr ""

View file

@ -1,99 +0,0 @@
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
import locale
from gi.repository import Gtk, Gio, GObject, Adw
from mcg.zeroconf import ZeroconfProvider
@Gtk.Template(resource_path='/xyz/suruatoel/mcg/ui/connection-panel.ui')
class ConnectionPanel(Adw.Bin):
__gtype_name__ = 'McgConnectionPanel'
__gsignals__ = {
'connection-changed': (GObject.SIGNAL_RUN_FIRST, None, (str, int, str))
}
# Widgets
toolbar = Gtk.Template.Child()
zeroconf_list = Gtk.Template.Child()
host_row = Gtk.Template.Child()
port_spinner = Gtk.Template.Child()
password_row = Gtk.Template.Child()
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Zeroconf provider
self._zeroconf_provider = ZeroconfProvider()
self._zeroconf_provider.connect_signal(ZeroconfProvider.SIGNAL_SERVICE_NEW, self.on_new_service)
def on_new_service(self, service):
name, host, port = service
row_button = Gtk.Button()
row_button.set_label(locale.gettext("use"))
row_button.connect("clicked", self.on_service_selected, host, port)
row = Adw.ActionRow()
row.set_title(name)
row.set_subtitle("{} ({})".format(host, port))
row.add_suffix(row_button)
self.zeroconf_list.insert(row, -1)
def on_service_selected(self, widget, host, port):
self.set_host(host)
self.set_port(port)
@Gtk.Template.Callback()
def on_host_entry_apply(self, widget):
self._call_back()
@Gtk.Template.Callback()
def on_port_spinner_value_changed(self, widget):
self._call_back()
def set_host(self, host):
self.host_row.set_text(host)
def get_host(self):
return self.host_row.get_text()
def set_port(self, port):
self.port_spinner.set_value(port)
def get_port(self):
return self.port_spinner.get_value_as_int()
def set_password(self, password):
if password is None:
password = ""
self.password_row.set_text(password)
def get_password(self):
if self.password_row.get_text() == "":
return None
else:
return self.password_entry.get_text()
def _call_back(self):
self.emit('connection-changed', self.get_host(), self.get_port(), self.get_password(),)

View file

@ -23,7 +23,6 @@ mcg_sources = [
'albumheaderbar.py',
'application.py',
'client.py',
'connectionpanel.py',
'coverpanel.py',
'librarypanel.py',
'playlistpanel.py',

View file

@ -4,9 +4,12 @@
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
import locale
from gi.repository import Gtk, Adw, GObject
from mcg.zeroconf import ZeroconfProvider
@ -14,11 +17,21 @@ from gi.repository import Gtk, Adw, GObject
class ServerPanel(Adw.Bin):
__gtype_name__ = 'McgServerPanel'
__gsignals__ = {
'connection-changed': (GObject.SIGNAL_RUN_FIRST, None, (str, int, str)),
'change-output-device': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,bool,)),
}
# Widgets
toolbar = Gtk.Template.Child()
connection_status_page = Gtk.Template.Child()
status_page = Gtk.Template.Child()
stats_page = Gtk.Template.Child()
devices_page = Gtk.Template.Child()
# Connection widgets
zeroconf_list = Gtk.Template.Child()
host_row = Gtk.Template.Child()
port_spinner = Gtk.Template.Child()
password_row = Gtk.Template.Child()
# Status widgets
status_file = Gtk.Template.Child()
status_audio = Gtk.Template.Child()
@ -44,6 +57,10 @@ class ServerPanel(Adw.Bin):
# Widgets
self._none_label = self.status_file.get_label()
# Zeroconf provider
self._zeroconf_provider = ZeroconfProvider()
self._zeroconf_provider.connect_signal(ZeroconfProvider.SIGNAL_SERVICE_NEW, self.on_new_service)
def set_selected(self, selected):
self._is_selected = selected
@ -53,6 +70,72 @@ class ServerPanel(Adw.Bin):
return self.toolbar
def on_new_service(self, service):
name, host, port = service
row_button = Gtk.Button()
row_button.set_label(locale.gettext("use"))
row_button.connect("clicked", self.on_service_selected, host, port)
row = Adw.ActionRow()
row.set_title(name)
row.set_subtitle("{} ({})".format(host, port))
row.add_suffix(row_button)
self.zeroconf_list.insert(row, -1)
def on_service_selected(self, widget, host, port):
self.set_host(host)
self.set_port(port)
@Gtk.Template.Callback()
def on_host_entry_apply(self, widget):
self._call_back()
@Gtk.Template.Callback()
def on_port_spinner_value_changed(self, widget):
self._call_back()
def set_connection_sensitive(self, sensitive):
self.connection_status_page.set_sensitive(sensitive)
self.status_page.set_visible(not sensitive)
self.stats_page.set_visible(not sensitive)
self.devices_page.set_visible(not sensitive)
def set_host(self, host):
self.host_row.set_text(host)
def get_host(self):
return self.host_row.get_text()
def set_port(self, port):
self.port_spinner.set_value(port)
def get_port(self):
return self.port_spinner.get_value_as_int()
def set_password(self, password):
if password is None:
password = ""
self.password_row.set_text(password)
def get_password(self):
if self.password_row.get_text() == "":
return None
else:
return self.password_entry.get_text()
def on_output_device_toggled(self, widget, device):
self.emit('change-output-device', device, widget.get_active())
@ -116,3 +199,7 @@ class ServerPanel(Adw.Bin):
for id in self._output_buttons.keys():
if id not in device_ids:
self.output_devices.remove(self._output_buttons[id].get_parent())
def _call_back(self):
self.emit('connection-changed', self.get_host(), self.get_port(), self.get_password(),)

View file

@ -17,7 +17,6 @@ from gi.repository import Gtk, Adw, Gdk, GObject, GLib, Gio
from . import client
from .shortcutsdialog import ShortcutsDialog
from .connectionpanel import ConnectionPanel
from .serverpanel import ServerPanel
from .coverpanel import CoverPanel
from .playlistpanel import PlaylistPanel
@ -60,7 +59,6 @@ class Window(Adw.ApplicationWindow):
# Widgets
toolbar_view = Gtk.Template.Child()
content_stack = Gtk.Template.Child()
panel_stack = Gtk.Template.Child()
toolbar_stack = Gtk.Template.Child()
# Headerbar
@ -88,8 +86,6 @@ class Window(Adw.ApplicationWindow):
# Help/Shortcuts dialog
self.set_help_overlay(ShortcutsDialog())
# Login screen
self._connection_panel = ConnectionPanel()
# Server panel
self._server_panel = ServerPanel()
self._panels.append(self._server_panel)
@ -107,7 +103,6 @@ class Window(Adw.ApplicationWindow):
self._library_panel.connect('close-standalone', self.on_panel_close_standalone)
self._panels.append(self._library_panel)
# Stack
self.content_stack.add_child(self._connection_panel)
self.panel_stack.add_titled_with_icon(self._server_panel, 'server-panel', locale.gettext("Server"), "network-wired-symbolic")
self.panel_stack.add_titled_with_icon(self._cover_panel, 'cover-panel', locale.gettext("Cover"), "image-x-generic-symbolic")
self.panel_stack.add_titled_with_icon(self._playlist_panel, 'playlist-panel', locale.gettext("Playlist"), "view-list-symbolic")
@ -120,10 +115,10 @@ class Window(Adw.ApplicationWindow):
# Properties
self._set_headerbar_sensitive(False, False)
self._connection_panel.set_host(self._settings.get_string(Window.SETTING_HOST))
self._connection_panel.set_port(self._settings.get_int(Window.SETTING_PORT))
self._server_panel.set_host(self._settings.get_string(Window.SETTING_HOST))
self._server_panel.set_port(self._settings.get_int(Window.SETTING_PORT))
if use_keyring:
self._connection_panel.set_password(keyring.get_password(ZeroconfProvider.KEYRING_SYSTEM, ZeroconfProvider.KEYRING_USERNAME))
self._server_panel.set_password(keyring.get_password(ZeroconfProvider.KEYRING_SYSTEM, ZeroconfProvider.KEYRING_USERNAME))
self._playlist_panel.set_item_size(self._settings.get_int(Window.SETTING_ITEM_SIZE))
self._library_panel.set_item_size(self._settings.get_int(Window.SETTING_ITEM_SIZE))
self._library_panel.set_sort_order(self._settings.get_enum(Window.SETTING_SORT_ORDER))
@ -134,7 +129,7 @@ class Window(Adw.ApplicationWindow):
self.connect("notify::default-height", self.on_resize)
self.connect("notify::maximized", self.on_maximized)
self.connect("notify::fullscreened", self.on_fullscreened)
self._connection_panel.connect('connection-changed', self.on_connection_panel_connection_changed)
self._server_panel.connect('connection-changed', self.on_server_panel_connection_changed)
self.panel_stack.connect('notify::visible-child', self.on_stack_switched)
self._server_panel.connect('change-output-device', self.on_server_panel_output_device_changed)
self._cover_panel.connect('toggle-fullscreen', self.on_cover_panel_toggle_fullscreen)
@ -175,7 +170,7 @@ class Window(Adw.ApplicationWindow):
self.set_default_size(self._state.width, self._state.height)
if self._state.get_property(WindowState.IS_MAXIMIZED):
self.maximize()
self.content_stack.set_visible_child(self._connection_panel)
self.panel_stack.set_visible_child(self._server_panel)
if self._settings.get_boolean(Window.SETTING_CONNECTED):
self._connect()
@ -301,7 +296,7 @@ class Window(Adw.ApplicationWindow):
self.toolbar_view.remove(panel.get_headerbar_standalone())
def on_connection_panel_connection_changed(self, widget, host, port, password):
def on_server_panel_connection_changed(self, widget, host, port, password):
self._settings.set_string(Window.SETTING_HOST, host)
self._settings.set_int(Window.SETTING_PORT, port)
if use_keyring:
@ -438,7 +433,7 @@ class Window(Adw.ApplicationWindow):
def on_mcg_load_playlist(self, playlist):
self._playlist_panel.set_playlist(self._connection_panel.get_host(), playlist)
self._playlist_panel.set_playlist(self._server_panel.get_host(), playlist)
def on_mcg_init_albums(self):
@ -450,7 +445,7 @@ class Window(Adw.ApplicationWindow):
def on_mcg_load_albums(self, albums):
self._library_panel.set_albums(self._connection_panel.get_host(), albums)
self._library_panel.set_albums(self._server_panel.get_host(), albums)
def on_mcg_load_albumart(self, album, data):
@ -489,15 +484,15 @@ class Window(Adw.ApplicationWindow):
# Private methods
def _connect(self):
self._connection_panel.set_sensitive(False)
self._server_panel.set_connection_sensitive(False)
self._set_headerbar_sensitive(False, True)
if self._mcg.is_connected():
self._mcg.disconnect()
self._settings.set_boolean(Window.SETTING_CONNECTED, False)
else:
host = self._connection_panel.get_host()
port = self._connection_panel.get_port()
password = self._connection_panel.get_password()
host = self._server_panel.get_host()
port = self._server_panel.get_port()
password = self._server_panel.get_password()
self._mcg.connect(host, port, password)
self._settings.set_boolean(Window.SETTING_CONNECTED, True)
@ -505,7 +500,6 @@ class Window(Adw.ApplicationWindow):
def _connect_connected(self):
self._headerbar_connected()
self._set_headerbar_sensitive(True, False)
self.content_stack.set_visible_child(self.panel_stack)
self.panel_stack.set_visible_child(self._panels[self._settings.get_int(Window.SETTING_PANEL)])
@ -515,8 +509,8 @@ class Window(Adw.ApplicationWindow):
self._headerbar_disconnected()
self._set_headerbar_sensitive(False, False)
self._save_visible_panel()
self.content_stack.set_visible_child(self._connection_panel)
self._connection_panel.set_sensitive(True)
self.panel_stack.set_visible_child(self._server_panel)
self._server_panel.set_connection_sensitive(True)
def _fullscreen(self, fullscreened_new):