1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| #===================================================================================================================
def loadSettings(self):
"""
Here we load user settings and if none a basic config by default is loaded
"""
settings = QSettings()
language = settings.value('language').toString()
new_output_path = settings.value('new_output_path').toString()
name_camcorder = settings.value('name_camcorder').toString()
formats_choose = settings.value('formats_choose').toString()
automatic_conversion = settings.value('automatic_conversion').toBool()
detection_scene = settings.value('detection_scene').toBool()
automatic_record = settings.value('automatic_record').toBool()
if language:
index = self.ui.cmblanguages.itemText(language)
self.ui.cmblanguages.setCurrentIndex(index)
else:
self.ui.cmblanguages.setCurrentIndex(language)
if new_output_path:
self.ui.lneoutputfile.setText(new_output_path)
if name_camcorder:
self.ui.lnenamecamecorder.setText(name_camcorder)
if formats_choose:
index = self.ui.cmbformatcapture.itemText(formats_choose)
self.ui.cmbformatcapture.setCurrentIndex(index)
else:
self.ui.cmbformatcapture.setCurrentIndex(formats_choose)
if automatic_conversion:
self.ui.chknone.setChecked(True)
if detection_scene:
self.ui.chkdetection.setChecked(True)
if automatic_record:
self.ui.chkautomaticrecord.setChecked(True)
#===================================================================================================================
def saveSettings(self):
"""
Here we save users setting when the application is closed and if none a basic config by default is loaded
"""
#MainWindowSettings
language = QLocale.system().name()
#GeneralSettings
new_output_path = os.path.join(QDir.homePath() + "/Videos/")
name_camcorder = self.ui.lnenamecamecorder.text()
formats_choose = self.ui.cmbformatcapture.setCurrentIndex()
#ConversionSettings
automatic_conversion = self.ui.chknone.isChecked()
detection_scene = self.ui.chkdetection.isChecked()
#CaptureSettings
automatic_record = self.ui.chkautomaticrecord.isChecked()
settings = QSettings(QSettings.SystemScope, 'eCreate', 'qdvgrab')
#settings.beginGroup('MainWindowSettings')
#settings.setValue()
#settings.setValue()
#settings.endGroup()
settings.beginGroup('GeneralSettings')
settings.setValue('language', language)
settings.setValue('new_output_path', new_output_path)
settings.setValue('name_camcorder', name_camcorder)
settings.endGroup()
settings.beginGroup('ConversionSettings')
settings.setValue('formats_choose', formats_choose)
settings.setValue('automatic_conversion', automatic_conversion)
settings.setValue('detection_scene', detection_scene)
settings.endGroup()
settings.beginGroup('CaptureSettings')
settings.setValue('automatic_record', automatic_record)
settings.endGroup()
#============================================================================================================= |
Partager