Add rooms editing ability
* add rooms dialog * new button to open rooms dialog
This commit is contained in:
parent
bc87d53c11
commit
f2e2be9949
@ -156,6 +156,28 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
def openHelp(self):
|
def openHelp(self):
|
||||||
self.QtGui.QDesktopServices.openUrl(QUrl("https://syncplay.pl/guide/client/"))
|
self.QtGui.QDesktopServices.openUrl(QUrl("https://syncplay.pl/guide/client/"))
|
||||||
|
|
||||||
|
def openRoomsDialog(self):
|
||||||
|
RoomsDialog = QtWidgets.QDialog()
|
||||||
|
RoomsDialog.setWindowFlags(Qt.FramelessWindowHint)
|
||||||
|
RoomsLayout = QtWidgets.QGridLayout()
|
||||||
|
RoomsTextbox = QtWidgets.QPlainTextEdit()
|
||||||
|
RoomsTextbox.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
|
||||||
|
RoomsTextbox.setPlainText(utils.getListAsMultilineString(self.config['roomhistory']))
|
||||||
|
RoomsLayout.addWidget(RoomsTextbox, 0, 0, 1, 1)
|
||||||
|
RoomsButtonBox = QtWidgets.QDialogButtonBox()
|
||||||
|
RoomsButtonBox.setOrientation(Qt.Horizontal)
|
||||||
|
RoomsButtonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
|
||||||
|
RoomsButtonBox.accepted.connect(RoomsDialog.accept)
|
||||||
|
RoomsButtonBox.rejected.connect(RoomsDialog.reject)
|
||||||
|
RoomsLayout.addWidget(RoomsButtonBox, 1, 0, 1, 1)
|
||||||
|
RoomsDialog.setLayout(RoomsLayout)
|
||||||
|
RoomsDialog.setModal(True)
|
||||||
|
RoomsDialog.show()
|
||||||
|
result = RoomsDialog.exec_()
|
||||||
|
if result == QtWidgets.QDialog.Accepted:
|
||||||
|
newRooms = utils.convertMultilineStringToList(RoomsTextbox.toPlainText())
|
||||||
|
self.relistRoomHistory(newRooms)
|
||||||
|
|
||||||
def safenormcaseandpath(self, path):
|
def safenormcaseandpath(self, path):
|
||||||
if utils.isURL(path):
|
if utils.isURL(path):
|
||||||
return path
|
return path
|
||||||
@ -380,9 +402,19 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
settings.setValue("publicServers", servers)
|
settings.setValue("publicServers", servers)
|
||||||
self.hostCombobox.setEditText(currentServer)
|
self.hostCombobox.setEditText(currentServer)
|
||||||
|
|
||||||
def updateRoomHistory(self, newRoom=None):
|
def fillRoomsCombobox(self):
|
||||||
|
self.roomsCombobox.clear()
|
||||||
|
for roomHistoryValue in self.config['roomhistory']:
|
||||||
|
self.roomsCombobox.addItem(roomHistoryValue)
|
||||||
|
|
||||||
|
def relistRoomHistory(self, newRooms):
|
||||||
|
filteredNewRooms = [room for room in newRooms if room and not room.isspace()]
|
||||||
|
self.config['roomhistory'] = filteredNewRooms
|
||||||
|
self.fillRoomsCombobox()
|
||||||
|
|
||||||
|
def addRoomToHistory(self, newRoom=None):
|
||||||
if newRoom is None:
|
if newRoom is None:
|
||||||
newRoom = self.defaultroomCombobox.currentText()
|
newRoom = self.roomsCombobox.currentText()
|
||||||
if not newRoom:
|
if not newRoom:
|
||||||
return
|
return
|
||||||
roomHistory = self.config['roomhistory']
|
roomHistory = self.config['roomhistory']
|
||||||
@ -458,7 +490,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
else:
|
else:
|
||||||
self.config['file'] = str(self.mediapathTextbox.text())
|
self.config['file'] = str(self.mediapathTextbox.text())
|
||||||
self.config['publicServers'] = self.publicServerAddresses
|
self.config['publicServers'] = self.publicServerAddresses
|
||||||
self.config['room'] = self.defaultroomCombobox.currentText()
|
self.config['room'] = self.roomsCombobox.currentText()
|
||||||
|
|
||||||
self.pressedclosebutton = False
|
self.pressedclosebutton = False
|
||||||
self.close()
|
self.close()
|
||||||
@ -611,15 +643,17 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
|
|
||||||
self.usernameTextbox.setObjectName("name")
|
self.usernameTextbox.setObjectName("name")
|
||||||
self.serverpassLabel = QLabel(getMessage("password-label"), self)
|
self.serverpassLabel = QLabel(getMessage("password-label"), self)
|
||||||
self.defaultroomCombobox = QtWidgets.QComboBox(self)
|
self.roomsCombobox = QtWidgets.QComboBox(self)
|
||||||
self.updateRoomHistory(config['room'])
|
self.roomsCombobox.setEditable(True)
|
||||||
for roomHistoryValue in self.config['roomhistory']:
|
self.addRoomToHistory(config['room'])
|
||||||
self.defaultroomCombobox.addItem(roomHistoryValue)
|
self.fillRoomsCombobox()
|
||||||
self.defaultroomCombobox.setEditable(True)
|
|
||||||
self.usernameLabel = QLabel(getMessage("name-label"), self)
|
self.usernameLabel = QLabel(getMessage("name-label"), self)
|
||||||
self.serverpassTextbox = QLineEdit(self)
|
self.serverpassTextbox = QLineEdit(self)
|
||||||
self.serverpassTextbox.setText(self.storedPassword)
|
self.serverpassTextbox.setText(self.storedPassword)
|
||||||
self.defaultroomLabel = QLabel(getMessage("room-label"), self)
|
self.defaultroomLabel = QLabel(getMessage("room-label"), self)
|
||||||
|
self.editRoomsButton = QtWidgets.QToolButton()
|
||||||
|
self.editRoomsButton.setIcon(QtGui.QIcon(resourcespath + 'eye.png'))
|
||||||
|
self.editRoomsButton.released.connect(self.openRoomsDialog)
|
||||||
|
|
||||||
self.hostLabel.setObjectName("host")
|
self.hostLabel.setObjectName("host")
|
||||||
self.hostCombobox.setObjectName(constants.LOAD_SAVE_MANUALLY_MARKER + "host")
|
self.hostCombobox.setObjectName(constants.LOAD_SAVE_MANUALLY_MARKER + "host")
|
||||||
@ -630,7 +664,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
self.hostCombobox.editTextChanged.connect(self.updatePasswordVisibilty)
|
self.hostCombobox.editTextChanged.connect(self.updatePasswordVisibilty)
|
||||||
self.hostCombobox.currentIndexChanged.connect(self.updatePasswordVisibilty)
|
self.hostCombobox.currentIndexChanged.connect(self.updatePasswordVisibilty)
|
||||||
self.defaultroomLabel.setObjectName("room")
|
self.defaultroomLabel.setObjectName("room")
|
||||||
self.defaultroomCombobox.setObjectName("room")
|
self.roomsCombobox.setObjectName("room")
|
||||||
|
|
||||||
self.connectionSettingsLayout = QtWidgets.QGridLayout()
|
self.connectionSettingsLayout = QtWidgets.QGridLayout()
|
||||||
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
|
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
|
||||||
@ -640,7 +674,8 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0)
|
self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0)
|
||||||
self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1)
|
self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1)
|
||||||
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
|
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
|
||||||
self.connectionSettingsLayout.addWidget(self.defaultroomCombobox, 3, 1)
|
self.connectionSettingsLayout.addWidget(self.editRoomsButton, 3, 0, Qt.AlignRight)
|
||||||
|
self.connectionSettingsLayout.addWidget(self.roomsCombobox, 3, 1)
|
||||||
self.connectionSettingsLayout.setSpacing(10)
|
self.connectionSettingsLayout.setSpacing(10)
|
||||||
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
|
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
|
||||||
if isMacOS():
|
if isMacOS():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user