Replace MAL group with More group and move checkboxes inside

This commit is contained in:
Etoh 2013-10-25 18:14:55 +01:00
parent fb238b8570
commit a4e76a5038

View File

@ -33,31 +33,25 @@ class GuiConfiguration:
class ConfigDialog(QtGui.QDialog): class ConfigDialog(QtGui.QDialog):
pressedclosebutton = False pressedclosebutton = False
malToggling = False moreToggling = False
def malToggled(self): def moreToggled(self):
if self.malToggling == False: if self.moreToggling == False:
self.malToggling = True self.moreToggling = True
if self.malenabledCheckbox.isChecked() and self.malenabledCheckbox.isVisible(): if self.showmoreCheckbox.isChecked() and self.showmoreCheckbox.isVisible():
self.malenabledCheckbox.setChecked(False) self.showmoreCheckbox.setChecked(False)
self.malSettingsGroup.setChecked(True) self.moreSettingsGroup.setChecked(True)
self.malSettingsGroup.show() self.moreSettingsGroup.show()
self.malpasswordLabel.show() self.showmoreCheckbox.hide()
self.malpasswordTextbox.show() self.saveMoreState(True)
self.malusernameLabel.show()
self.malusernameTextbox.show()
self.malenabledCheckbox.hide()
else: else:
self.malSettingsGroup.setChecked(False) self.moreSettingsGroup.setChecked(False)
self.malSettingsGroup.hide() self.moreSettingsGroup.hide()
self.malpasswordLabel.hide() self.showmoreCheckbox.show()
self.malpasswordTextbox.hide() self.saveMoreState(False)
self.malusernameLabel.hide()
self.malusernameTextbox.hide()
self.malenabledCheckbox.show()
self.malToggling = False self.moreToggling = False
self.adjustSize() self.adjustSize()
self.setFixedSize(self.sizeHint()) self.setFixedSize(self.sizeHint())
@ -151,6 +145,22 @@ class ConfigDialog(QtGui.QDialog):
settings.setValue("mediadir", self.mediadirectory) settings.setValue("mediadir", self.mediadirectory)
settings.endGroup() settings.endGroup()
def getMoreState(self):
settings = QSettings("Syncplay", "MoreSettings")
settings.beginGroup("MoreSettings")
morestate = unicode.lower(settings.value("ShowMoreSettings", False))
settings.endGroup()
if morestate == "true":
return(True)
else:
return(False)
def saveMoreState(self, morestate):
settings = QSettings("Syncplay", "MoreSettings")
settings.beginGroup("MoreSettings")
settings.setValue("ShowMoreSettings", morestate)
settings.endGroup()
def browseMediapath(self): def browseMediapath(self):
self.loadMediaBrowseSettings() self.loadMediaBrowseSettings()
options = QtGui.QFileDialog.Options() options = QtGui.QFileDialog.Options()
@ -200,10 +210,8 @@ class ConfigDialog(QtGui.QDialog):
else: else:
self.config['rewindOnDesync'] = False self.config['rewindOnDesync'] = False
self.config['malUsername'] = self.malusernameTextbox.text() self.config['malUsername'] = self.malusernameTextbox.text()
if self.malSettingsGroup.isChecked(): self.config['malPassword'] = self.malpasswordTextbox.text()
self.config['malPassword'] = self.malpasswordTextbox.text()
else:
self.config['malPassword'] = ""
self.pressedclosebutton = True self.pressedclosebutton = True
self.close() self.close()
return return
@ -337,55 +345,60 @@ class ConfigDialog(QtGui.QDialog):
self.mediaplayerSettingsLayout.addWidget(self.mediapathLabel, 1, 0) self.mediaplayerSettingsLayout.addWidget(self.mediapathLabel, 1, 0)
self.mediaplayerSettingsLayout.addWidget(self.mediapathTextbox , 1, 2) self.mediaplayerSettingsLayout.addWidget(self.mediapathTextbox , 1, 2)
self.mediaplayerSettingsLayout.addWidget(self.mediabrowseButton , 1, 3) self.mediaplayerSettingsLayout.addWidget(self.mediabrowseButton , 1, 3)
self.mediaplayerSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0,1,3)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
self.mediaplayerSettingsLayout.addWidget(self.rewindCheckbox, 3, 0,1,3)
self.mediaplayerSettingsGroup.setLayout(self.mediaplayerSettingsLayout) self.mediaplayerSettingsGroup.setLayout(self.mediaplayerSettingsLayout)
#BOB
self.moreSettingsGroup = QtGui.QGroupBox(getMessage("en", "more-title"))
if config['slowOnDesync'] == True: if config['slowOnDesync'] == True:
self.slowdownCheckbox.setChecked(True) self.slowdownCheckbox.setChecked(True)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True and config['rewindOnDesync'] == True: if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True and config['rewindOnDesync'] == True:
self.rewindCheckbox.setChecked(True) self.rewindCheckbox.setChecked(True)
self.moreSettingsGroup.setCheckable(True)
self.malSettingsGroup = QtGui.QGroupBox(getMessage("en", "mal-title"))
self.malSettingsGroup.setCheckable(True)
self.malSettingsGroup.toggled.connect(self.malToggled)
self.malSettingsSplit = QtGui.QSplitter(self) self.malSettingsSplit = QtGui.QSplitter(self)
self.malusernameTextbox = QLineEdit(config['malUsername'],self) self.malusernameTextbox = QLineEdit(config['malUsername'],self)
self.malusernameTextbox.setMaximumWidth(115)
self.malusernameLabel = QLabel(getMessage("en", "mal-username-label"), self) self.malusernameLabel = QLabel(getMessage("en", "mal-username-label"), self)
self.malpasswordTextbox = QLineEdit(config['malPassword'],self) self.malpasswordTextbox = QLineEdit(config['malPassword'],self)
self.malpasswordTextbox.setEchoMode(QtGui.QLineEdit.Password) self.malpasswordTextbox.setEchoMode(QtGui.QLineEdit.Password)
self.malpasswordLabel = QLabel(getMessage("en", "mal-password-label"), self) self.malpasswordLabel = QLabel(getMessage("en", "mal-password-label"), self)
self.alwaysshowCheckbox = QCheckBox(getMessage("en", "alwayshow-label"))
self.donotstoreCheckbox = QCheckBox(getMessage("en", "donotstore-label"))
if (constants.SHOW_TOOLTIPS == True): if (constants.SHOW_TOOLTIPS == True):
self.malusernameLabel.setToolTip(getMessage("en", "mal-username-tooltip")) self.malusernameLabel.setToolTip(getMessage("en", "mal-username-tooltip"))
self.malusernameTextbox.setToolTip(getMessage("en", "mal-username-tooltip")) self.malusernameTextbox.setToolTip(getMessage("en", "mal-username-tooltip"))
self.malpasswordLabel.setToolTip(getMessage("en", "mal-password-tooltip")) self.malpasswordLabel.setToolTip(getMessage("en", "mal-password-tooltip"))
self.malpasswordTextbox.setToolTip(getMessage("en", "mal-password-tooltip")) self.malpasswordTextbox.setToolTip(getMessage("en", "mal-password-tooltip"))
self.malSettingsLayout = QtGui.QGridLayout() self.alwaysshowCheckbox.setToolTip(getMessage("en", "alwayshow-tooltip"))
self.malSettingsLayout.addWidget(self.malusernameLabel , 0, 0) self.donotstoreCheckbox.setToolTip(getMessage("en", "donotstore-tooltip"))
self.malSettingsLayout.addWidget(self.malusernameTextbox, 0, 1) self.moreSettingsLayout = QtGui.QGridLayout()
self.malSettingsLayout.addWidget(self.malpasswordLabel , 1, 0) self.moreSettingsLayout.addWidget(self.malusernameLabel , 0, 0)
self.malSettingsLayout.addWidget(self.malpasswordTextbox, 1, 1) self.moreSettingsLayout.addWidget(self.malusernameTextbox, 0, 1)
self.malSettingsGroup.setLayout(self.malSettingsLayout) self.moreSettingsLayout.addWidget(self.malpasswordLabel , 0, 2)
self.moreSettingsLayout.addWidget(self.malpasswordTextbox, 0, 3)
self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0,1,4)
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
self.moreSettingsLayout.addWidget(self.rewindCheckbox, 3, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.alwaysshowCheckbox, 4, 0, 1, 4)
self.moreSettingsLayout.addWidget(self.donotstoreCheckbox, 5, 0, 1, 4)
self.malenabledCheckbox = QCheckBox(getMessage("en", "mal-title")) self.moreSettingsGroup.setLayout(self.moreSettingsLayout)
self.malenabledCheckbox.toggled.connect(self.malToggled)
if config['malPassword'] == None or config['malPassword'] == "": self.showmoreCheckbox = QCheckBox(getMessage("en", "more-title"))
self.malenabledCheckbox.setChecked(False)
self.malSettingsGroup.hide() if self.getMoreState() == False:
self.showmoreCheckbox.setChecked(False)
self.moreSettingsGroup.hide()
else: else:
self.malenabledCheckbox.hide() self.showmoreCheckbox.hide()
self.showmoreCheckbox.toggled.connect(self.moreToggled)
self.alwaysshowCheckbox = QCheckBox(getMessage("en", "alwayshow-label")) self.moreSettingsGroup.toggled.connect(self.moreToggled)
if config['forceGuiPrompt'] == True: if config['forceGuiPrompt'] == True:
self.alwaysshowCheckbox.setChecked(True) self.alwaysshowCheckbox.setChecked(True)
self.donotstoreCheckbox = QCheckBox(getMessage("en", "donotstore-label"))
if (constants.SHOW_TOOLTIPS == True): if (constants.SHOW_TOOLTIPS == True):
self.malenabledCheckbox.setToolTip(getMessage("en", "mal-tooltip")) self.showmoreCheckbox.setToolTip(getMessage("en", "more-tooltip"))
self.alwaysshowCheckbox.setToolTip(getMessage("en", "alwayshow-tooltip"))
self.donotstoreCheckbox.setToolTip(getMessage("en", "donotstore-tooltip"))
self.donotstoreCheckbox.toggled.connect(self.runButtonTextUpdate) self.donotstoreCheckbox.toggled.connect(self.runButtonTextUpdate)
@ -399,8 +412,8 @@ class ConfigDialog(QtGui.QDialog):
self.mainLayout.addSpacing(12) self.mainLayout.addSpacing(12)
self.mainLayout.addWidget(self.mediaplayerSettingsGroup) self.mainLayout.addWidget(self.mediaplayerSettingsGroup)
self.mainLayout.addSpacing(12) self.mainLayout.addSpacing(12)
self.mainLayout.addWidget(self.malenabledCheckbox) self.mainLayout.addWidget(self.showmoreCheckbox)
self.mainLayout.addWidget(self.malSettingsGroup) self.mainLayout.addWidget(self.moreSettingsGroup)
self.topLayout = QtGui.QHBoxLayout() self.topLayout = QtGui.QHBoxLayout()
self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'),getMessage("en", "help-label")) self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'),getMessage("en", "help-label"))
@ -415,8 +428,6 @@ class ConfigDialog(QtGui.QDialog):
self.runButton.setText(getMessage("en", "run-label")) self.runButton.setText(getMessage("en", "run-label"))
self.topLayout.addWidget(self.helpButton, Qt.AlignLeft) self.topLayout.addWidget(self.helpButton, Qt.AlignLeft)
self.topLayout.addWidget(self.runButton, Qt.AlignRight) self.topLayout.addWidget(self.runButton, Qt.AlignRight)
self.mainLayout.addWidget(self.alwaysshowCheckbox)
self.mainLayout.addWidget(self.donotstoreCheckbox)
self.mainLayout.addLayout(self.topLayout) self.mainLayout.addLayout(self.topLayout)
self.mainLayout.addStretch(1) self.mainLayout.addStretch(1)