diff --git a/README.md b/README.md index 81df0e9..6c04939 100644 --- a/README.md +++ b/README.md @@ -59,18 +59,14 @@ config.ini db/ - ~~automatically fix broken config before loading app (new config options added)~~ - ~~allow spectrum analyzer to fall when playback stops or song is paused~~ - ~~ability to delete playlist~~ +- ~~jump to currently playing song~~ ##### QMediaPlaylist https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QMediaPlaylist.html#PySide2.QtMultimedia.PySide2.QtMultimedia.QMediaPlaylist - playback modes (normal, repeat playlist, repeat 1 song, shuffle) > Use `PySide2.QtMultimedia.QMediaPlaylist.PlaybackMode` ? > Use `PySide2.QtMultimedia.QMediaPlaylist.shuffle()` ? -- jump to currently playing song - how do i make this work regardless of current sort params? - autoplay next song in all modes > Use `PySide2.QtMultimedia.QMediaPlaylist.next()` after implementing playlist? -##### misc -- database playlist autoexporting -- .wav, .ogg, .flac convertor -- automatic "radio" based on artist or genre - playback rate audio quality fix? > https://doc.qt.io/qtforpython-5/PySide2/QtMultimedia/QAudioDecoder.html#qaudiodecoder > Since Qt 5.12.2, the url scheme gst-pipeline provides custom pipelines for the GStreamer backend. @@ -79,4 +75,7 @@ player = new QMediaPlayer; player->setMedia(QUrl("gst-pipeline: videotestsrc ! autovideosink")); player->play(); ``` - +##### misc +- database playlist autoexporting +- .wav, .ogg, .flac convertor +- automatic "radio" based on artist or genre diff --git a/components/PreferencesWindow.py b/components/PreferencesWindow.py index c412145..f035567 100644 --- a/components/PreferencesWindow.py +++ b/components/PreferencesWindow.py @@ -25,7 +25,7 @@ class PreferencesWindow(QDialog): self.reloadConfigSignal = reloadConfigSignal self.reloadDatabaseSignal = reloadDatabaseSignal self.setWindowTitle("Preferences") - self.setMinimumSize(800, 800) + self.setMinimumSize(800, 600) self.cfg_file = ( Path(user_config_dir(appname="musicpom", appauthor="billypom")) / "config.ini" @@ -34,7 +34,8 @@ class PreferencesWindow(QDialog): self.config.read(self.cfg_file) self.current_category = "" # # Labels & input fields - self.input_fields = {} + self.input_fields: dict[str, QLineEdit] = {} + self.edit_button: QPushButton # Widgets self.content_area = QWidget() @@ -70,7 +71,16 @@ class PreferencesWindow(QDialog): def on_nav_item_clicked(self, item: QListWidgetItem): self.current_category = item self.clear_layout(self.content_layout) - self.input_fields = {} + + # Edit toggle button + edit_button = QPushButton() + self.edit_button: QPushButton = edit_button + self.edit_button.setText("view mode") + self.edit_button.clicked.connect(self.on_edit_toggled) + self.content_layout.addWidget(edit_button) + + # dict of text input fields + self.input_fields: dict[str, QLineEdit] = {} if isinstance(item, str): self.current_category_str = item else: @@ -84,6 +94,7 @@ class PreferencesWindow(QDialog): for key in self.config[self.current_category_str]: label = QLabel(key) input_field = QLineEdit(self.config[self.current_category_str][key]) + input_field.setEnabled(False) self.content_layout.addWidget(label) self.content_layout.addWidget(input_field) self.input_fields[key] = input_field @@ -93,7 +104,21 @@ class PreferencesWindow(QDialog): save_button.clicked.connect(self.save_preferences) self.content_layout.addWidget(save_button) + def on_edit_toggled(self): + """Toggle editable text or not""" + # kinda ugly + is_button_on: bool = True + for _, field in self.input_fields.items(): + if field.isEnabled(): + is_button_on = False + field.setEnabled(not field.isEnabled()) + if is_button_on: + self.edit_button.setText("edit mode") + else: + self.edit_button.setText("view mode") + def clear_layout(self, layout): + """Clears all widgets in the current layout""" while layout.count(): child = layout.takeAt(0) if child.widget(): diff --git a/sample_config.ini b/sample_config.ini index 1e74152..5510880 100644 --- a/sample_config.ini +++ b/sample_config.ini @@ -6,6 +6,7 @@ database = db/library.db # Useful paths to have stored library = /path/to/music reorganize_destination = /where/to/reorganize/to +playlist_auto_export_enabled = 0 playlist_export_path = /where/to/export/to playlist_relative_path = /relative/prefix