Allow hiding of empty persistent rooms (#434)

This commit is contained in:
et0h 2021-11-07 16:11:10 +00:00
parent 07499aaef4
commit 3b2bb2726a
9 changed files with 30 additions and 0 deletions

View File

@ -288,6 +288,7 @@ de = {
"autoplay-menu-label": "Auto-Play-Knopf anzeigen", "autoplay-menu-label": "Auto-Play-Knopf anzeigen",
"autoplay-guipushbuttonlabel": "Automatisch abspielen wenn alle bereit sind", "autoplay-guipushbuttonlabel": "Automatisch abspielen wenn alle bereit sind",
"autoplay-minimum-label": "Minimum an Nutzern:", "autoplay-minimum-label": "Minimum an Nutzern:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Senden", "sendmessage-label": "Senden",

View File

@ -292,6 +292,7 @@ en = {
"autoplay-menu-label": "Show auto-play button", "autoplay-menu-label": "Show auto-play button",
"autoplay-guipushbuttonlabel": "Play when all ready", "autoplay-guipushbuttonlabel": "Play when all ready",
"autoplay-minimum-label": "Min users:", "autoplay-minimum-label": "Min users:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms",
"sendmessage-label": "Send", "sendmessage-label": "Send",

View File

@ -291,6 +291,7 @@ es = {
"autoplay-menu-label": "Mostrar botón de auto-reproducción", "autoplay-menu-label": "Mostrar botón de auto-reproducción",
"autoplay-guipushbuttonlabel": "Reproducir cuando todos estén listos", "autoplay-guipushbuttonlabel": "Reproducir cuando todos estén listos",
"autoplay-minimum-label": "Mín. de usuarios:", "autoplay-minimum-label": "Mín. de usuarios:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Enviar", "sendmessage-label": "Enviar",

View File

@ -291,6 +291,7 @@ it = {
"autoplay-menu-label": "Mostra il tasto di riproduzione automatica", "autoplay-menu-label": "Mostra il tasto di riproduzione automatica",
"autoplay-guipushbuttonlabel": "Riproduci quando tutti sono pronti", "autoplay-guipushbuttonlabel": "Riproduci quando tutti sono pronti",
"autoplay-minimum-label": "Minimo utenti pronti:", "autoplay-minimum-label": "Minimo utenti pronti:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Invia", "sendmessage-label": "Invia",

View File

@ -292,6 +292,7 @@ pt_BR = {
"autoplay-menu-label": "Mostrar botão de reprodução automática", "autoplay-menu-label": "Mostrar botão de reprodução automática",
"autoplay-guipushbuttonlabel": "Tocar quando todos estiverem prontos", "autoplay-guipushbuttonlabel": "Tocar quando todos estiverem prontos",
"autoplay-minimum-label": "Mín. de usuários:", "autoplay-minimum-label": "Mín. de usuários:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Enviar", "sendmessage-label": "Enviar",

View File

@ -290,6 +290,7 @@ pt_PT = {
"autoplay-menu-label": "Mostrar botão de reprodução automática", "autoplay-menu-label": "Mostrar botão de reprodução automática",
"autoplay-guipushbuttonlabel": "Tocar quando todos estiverem prontos", "autoplay-guipushbuttonlabel": "Tocar quando todos estiverem prontos",
"autoplay-minimum-label": "Mín. de utilizadores:", "autoplay-minimum-label": "Mín. de utilizadores:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Enviar", "sendmessage-label": "Enviar",

View File

@ -291,6 +291,7 @@ ru = {
"autoplay-menu-label": "Показывать кнопку &автовоспроизведения", "autoplay-menu-label": "Показывать кнопку &автовоспроизведения",
"autoplay-guipushbuttonlabel": "Стартовать, когда все будут готовы", "autoplay-guipushbuttonlabel": "Стартовать, когда все будут готовы",
"autoplay-minimum-label": "Минимум зрителей:", "autoplay-minimum-label": "Минимум зрителей:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Выслать", "sendmessage-label": "Выслать",
"ready-guipushbuttonlabel": "Я готов", "ready-guipushbuttonlabel": "Я готов",

View File

@ -292,6 +292,7 @@ tr = {
"autoplay-menu-label": "Otomatik oynat düğmesini göster", "autoplay-menu-label": "Otomatik oynat düğmesini göster",
"autoplay-guipushbuttonlabel": "Her şey hazır olduğunda oynat", "autoplay-guipushbuttonlabel": "Her şey hazır olduğunda oynat",
"autoplay-minimum-label": "Asgari kullanıcı:", "autoplay-minimum-label": "Asgari kullanıcı:",
"hideemptyrooms-menu-label": "Hide empty persistent rooms", # TODO: Translate
"sendmessage-label": "Gönder", "sendmessage-label": "Gönder",

View File

@ -604,6 +604,13 @@ class MainWindow(QtWidgets.QMainWindow):
self._syncplayClient.fileSwitch.setCurrentDirectory(os.path.dirname(self._syncplayClient.userlist.currentUser.file["path"])) self._syncplayClient.fileSwitch.setCurrentDirectory(os.path.dirname(self._syncplayClient.userlist.currentUser.file["path"]))
for room in rooms: for room in rooms:
if self.hideEmptyRooms:
foundEmptyRooms = False
for user in rooms[room]:
if user.username.strip() == "":
foundEmptyRooms = True
if foundEmptyRooms:
continue
self.newWatchlist = [] self.newWatchlist = []
roomitem = QtGui.QStandardItem(room) roomitem = QtGui.QStandardItem(room)
font = QtGui.QFont() font = QtGui.QFont()
@ -624,6 +631,8 @@ class MainWindow(QtWidgets.QMainWindow):
roomitem.setIcon(QtGui.QPixmap(resourcespath + 'chevrons_right.png')) roomitem.setIcon(QtGui.QPixmap(resourcespath + 'chevrons_right.png'))
for user in rooms[room]: for user in rooms[room]:
if user.username.strip() == "":
continue
useritem = QtGui.QStandardItem(user.username) useritem = QtGui.QStandardItem(user.username)
isController = user.isController() isController = user.isController()
sameRoom = room == currentUser.room sameRoom = room == currentUser.room
@ -1753,6 +1762,9 @@ class MainWindow(QtWidgets.QMainWindow):
window.autoplayAction.setCheckable(True) window.autoplayAction.setCheckable(True)
window.autoplayAction.triggered.connect(self.updateAutoplayVisibility) window.autoplayAction.triggered.connect(self.updateAutoplayVisibility)
window.hideEmptyRoomsAction = window.windowMenu.addAction(getMessage("hideemptyrooms-menu-label"))
window.hideEmptyRoomsAction.setCheckable(True)
window.hideEmptyRoomsAction.triggered.connect(self.updateEmptyRoomVisiblity)
# Help menu # Help menu
@ -1818,6 +1830,11 @@ class MainWindow(QtWidgets.QMainWindow):
def updateAutoplayVisibility(self): def updateAutoplayVisibility(self):
self.autoplayFrame.setVisible(self.autoplayAction.isChecked()) self.autoplayFrame.setVisible(self.autoplayAction.isChecked())
def updateEmptyRoomVisiblity(self):
self.hideEmptyRooms = self.hideEmptyRoomsAction.isChecked()
if self._syncplayClient:
self._syncplayClient.getUserList()
def changeReadyState(self): def changeReadyState(self):
self.updateReadyIcon() self.updateReadyIcon()
if self._syncplayClient: if self._syncplayClient:
@ -2017,6 +2034,7 @@ class MainWindow(QtWidgets.QMainWindow):
settings.setValue("pos", self.pos()) settings.setValue("pos", self.pos())
settings.setValue("showPlaybackButtons", self.playbackAction.isChecked()) settings.setValue("showPlaybackButtons", self.playbackAction.isChecked())
settings.setValue("showAutoPlayButton", self.autoplayAction.isChecked()) settings.setValue("showAutoPlayButton", self.autoplayAction.isChecked())
settings.setValue("hideEmptyRooms", self.hideEmptyRoomsAction.isChecked())
settings.setValue("autoplayChecked", self.autoplayPushButton.isChecked()) settings.setValue("autoplayChecked", self.autoplayPushButton.isChecked())
settings.setValue("autoplayMinUsers", self.autoplayThresholdSpinbox.value()) settings.setValue("autoplayMinUsers", self.autoplayThresholdSpinbox.value())
settings.endGroup() settings.endGroup()
@ -2040,6 +2058,9 @@ class MainWindow(QtWidgets.QMainWindow):
if settings.value("showAutoPlayButton", "false") == "true": if settings.value("showAutoPlayButton", "false") == "true":
self.autoplayAction.setChecked(True) self.autoplayAction.setChecked(True)
self.updateAutoplayVisibility() self.updateAutoplayVisibility()
if settings.value("hideEmptyRooms", "false") == "true":
self.hideEmptyRooms = True
self.hideEmptyRoomsAction.setChecked(True)
if settings.value("autoplayChecked", "false") == "true": if settings.value("autoplayChecked", "false") == "true":
self.updateAutoPlayState(True) self.updateAutoPlayState(True)
self.autoplayPushButton.setChecked(True) self.autoplayPushButton.setChecked(True)
@ -2063,6 +2084,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.lastCheckedForUpdates = None self.lastCheckedForUpdates = None
self._syncplayClient = None self._syncplayClient = None
self.folderSearchEnabled = True self.folderSearchEnabled = True
self.hideEmptyRooms = False
self.QtGui = QtGui self.QtGui = QtGui
if isMacOS(): if isMacOS():
self.setWindowFlags(self.windowFlags()) self.setWindowFlags(self.windowFlags())