1# -*- coding: utf-8 -*- 2# 3# Picard, the next-generation MusicBrainz tagger 4# 5# Copyright (C) 2006 Lukáš Lalinský 6# Copyright (C) 2019-2020 Philipp Wolfer 7# 8# This program is free software; you can redistribute it and/or 9# modify it under the terms of the GNU General Public License 10# as published by the Free Software Foundation; either version 2 11# of the License, or (at your option) any later version. 12# 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18# You should have received a copy of the GNU General Public License 19# along with this program; if not, write to the Free Software 20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 22 23from picard.config import ( 24 BoolOption, 25 get_config, 26) 27 28from picard.ui.options import ( 29 OptionsPage, 30 register_options_page, 31) 32from picard.ui.ui_options_tags_compatibility_aac import ( 33 Ui_TagsCompatibilityOptionsPage, 34) 35 36 37class TagsCompatibilityAACOptionsPage(OptionsPage): 38 39 NAME = "tags_compatibility_aac" 40 TITLE = N_("AAC") 41 PARENT = "tags" 42 SORT_ORDER = 40 43 ACTIVE = True 44 HELP_URL = '/config/options_tags_compatibility_aac.html' 45 46 options = [ 47 BoolOption("setting", "aac_save_ape", True), 48 BoolOption("setting", "remove_ape_from_aac", False), 49 ] 50 51 def __init__(self, parent=None): 52 super().__init__(parent) 53 self.ui = Ui_TagsCompatibilityOptionsPage() 54 self.ui.setupUi(self) 55 self.ui.aac_no_tags.toggled.connect(self.ui.remove_ape_from_aac.setEnabled) 56 57 def load(self): 58 config = get_config() 59 if config.setting["aac_save_ape"]: 60 self.ui.aac_save_ape.setChecked(True) 61 else: 62 self.ui.aac_no_tags.setChecked(True) 63 self.ui.remove_ape_from_aac.setChecked(config.setting["remove_ape_from_aac"]) 64 self.ui.remove_ape_from_aac.setEnabled(not config.setting["aac_save_ape"]) 65 66 def save(self): 67 config = get_config() 68 config.setting["aac_save_ape"] = self.ui.aac_save_ape.isChecked() 69 config.setting["remove_ape_from_aac"] = self.ui.remove_ape_from_aac.isChecked() 70 71 72register_options_page(TagsCompatibilityAACOptionsPage) 73