From b0e018d0cda148ef8dba07857fcbe8d751800992 Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Date: Thu, 8 Oct 2020 08:47:44 +0200
Subject: [PATCH] make conversion from QPixmap to QIcon explicit

---
 syncplay/ui/gui.py | 106 ++++++++++++++++++++++-----------------------
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py
index c59c5697..2a4bd1a5 100755
--- a/syncplay/ui/gui.py
+++ b/syncplay/ui/gui.py
@@ -1620,24 +1620,24 @@ def addPlaybackLayout(self, window):
         window.playbackFrame.setLayout(window.playbackLayout)
         window.seekInput = QtWidgets.QLineEdit()
         window.seekInput.returnPressed.connect(self.seekFromButton)
-        window.seekButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'clock_go.png'), "")
+        window.seekButton = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'clock_go.png')), "")
         window.seekButton.setToolTip(getMessage("seektime-menu-label"))
         window.seekButton.pressed.connect(self.seekFromButton)
         window.seekInput.setText("0:00")
         window.seekInput.setFixedWidth(60)
         window.playbackLayout.addWidget(window.seekInput)
         window.playbackLayout.addWidget(window.seekButton)
-        window.unseekButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'arrow_undo.png'), "")
+        window.unseekButton = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'arrow_undo.png')), "")
         window.unseekButton.setToolTip(getMessage("undoseek-menu-label"))
         window.unseekButton.pressed.connect(self.undoSeek)

         window.miscLayout = QtWidgets.QHBoxLayout()
         window.playbackLayout.addWidget(window.unseekButton)
-        window.playButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'control_play_blue.png'), "")
+        window.playButton = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'control_play_blue.png')), "")
         window.playButton.setToolTip(getMessage("play-menu-label"))
         window.playButton.pressed.connect(self.play)
         window.playbackLayout.addWidget(window.playButton)
-        window.pauseButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'control_pause_blue.png'), "")
+        window.pauseButton = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'control_pause_blue.png')), "")
         window.pauseButton.setToolTip(getMessage("pause-menu-label"))
         window.pauseButton.pressed.connect(self.pause)
         window.playbackLayout.addWidget(window.pauseButton)
@@ -1657,13 +1657,13 @@ def populateMenubar(self, window):
         # File menu

         window.fileMenu = QtWidgets.QMenu(getMessage("file-menu-label"), self)
-        window.openAction = window.fileMenu.addAction(QtGui.QPixmap(resourcespath + 'folder_explore.png'),
+        window.openAction = window.fileMenu.addAction(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'folder_explore.png')),
                                                       getMessage("openmedia-menu-label"))
         window.openAction.triggered.connect(self.browseMediapath)
-        window.openAction = window.fileMenu.addAction(QtGui.QPixmap(resourcespath + 'world_explore.png'),
+        window.openAction = window.fileMenu.addAction(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'world_explore.png')),
                                                       getMessage("openstreamurl-menu-label"))
         window.openAction.triggered.connect(self.promptForStreamURL)
-        window.openAction = window.fileMenu.addAction(QtGui.QPixmap(resourcespath + 'film_folder_edit.png'),
+        window.openAction = window.fileMenu.addAction(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'film_folder_edit.png')),
                                                       getMessage("setmediadirectories-menu-label"))
         window.openAction.triggered.connect(self.openSetMediaDirectoriesDialog)

@@ -1671,7 +1671,7 @@ def populateMenubar(self, window):
         if isMacOS():
             window.exitAction.setMenuRole(QtWidgets.QAction.QuitRole)
         else:
-            window.exitAction.setIcon(QtGui.QPixmap(resourcespath + 'cross.png'))
+            window.exitAction.setIcon(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'cross.png')))
         window.exitAction.triggered.connect(self.exitSyncplay)

         if(window.editMenu is not None):
@@ -1683,19 +1683,19 @@ def populateMenubar(self, window):

         window.playbackMenu = QtWidgets.QMenu(getMessage("playback-menu-label"), self)
         window.playAction = window.playbackMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'control_play_blue.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'control_play_blue.png')),
             getMessage("play-menu-label"))
         window.playAction.triggered.connect(self.play)
         window.pauseAction = window.playbackMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'control_pause_blue.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'control_pause_blue.png')),
             getMessage("pause-menu-label"))
         window.pauseAction.triggered.connect(self.pause)
         window.seekAction = window.playbackMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'clock_go.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'clock_go.png')),
             getMessage("seektime-menu-label"))
         window.seekAction.triggered.connect(self.seekPositionDialog)
         window.unseekAction = window.playbackMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'arrow_undo.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'arrow_undo.png')),
             getMessage("undoseek-menu-label"))
         window.unseekAction.triggered.connect(self.undoSeek)

@@ -1705,17 +1705,17 @@ def populateMenubar(self, window):

         window.advancedMenu = QtWidgets.QMenu(getMessage("advanced-menu-label"), self)
         window.setoffsetAction = window.advancedMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'timeline_marker.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'timeline_marker.png')),
             getMessage("setoffset-menu-label"))
         window.setoffsetAction.triggered.connect(self.setOffset)
         window.setTrustedDomainsAction = window.advancedMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'shield_edit.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'shield_edit.png')),
             getMessage("settrusteddomains-menu-label"))
         window.setTrustedDomainsAction.triggered.connect(self.openSetTrustedDomainsDialog)
         window.createcontrolledroomAction = window.advancedMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'page_white_key.png'), getMessage("createcontrolledroom-menu-label"))
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'page_white_key.png')), getMessage("createcontrolledroom-menu-label"))
         window.createcontrolledroomAction.triggered.connect(self.createControlledRoom)
-        window.identifyascontroller = window.advancedMenu.addAction(QtGui.QPixmap(resourcespath + 'key_go.png'),
+        window.identifyascontroller = window.advancedMenu.addAction(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'key_go.png')),
                                                                     getMessage("identifyascontroller-menu-label"))
         window.identifyascontroller.triggered.connect(self.identifyAsController)

@@ -1725,7 +1725,7 @@ def populateMenubar(self, window):

         window.windowMenu = QtWidgets.QMenu(getMessage("window-menu-label"), self)

-        window.editroomsAction = window.windowMenu.addAction(QtGui.QPixmap(resourcespath + 'door_open_edit.png'), getMessage("roomlist-msgbox-label"))
+        window.editroomsAction = window.windowMenu.addAction(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'door_open_edit.png')), getMessage("roomlist-msgbox-label"))
         window.editroomsAction.triggered.connect(self.openEditRoomsDialog)
         window.menuBar.addMenu(window.windowMenu)

@@ -1743,18 +1743,18 @@ def populateMenubar(self, window):
         window.helpMenu = QtWidgets.QMenu(getMessage("help-menu-label"), self)

         window.userguideAction = window.helpMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'help.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'help.png')),
             getMessage("userguide-menu-label"))
         window.userguideAction.triggered.connect(self.openUserGuide)
         window.updateAction = window.helpMenu.addAction(
-            QtGui.QPixmap(resourcespath + 'application_get.png'),
+            QtGui.QIcon(QtGui.QPixmap(resourcespath + 'application_get.png')),
             getMessage("update-menu-label"))
         window.updateAction.triggered.connect(self.userCheckForUpdates)

         if not isMacOS():
             window.helpMenu.addSeparator()
             window.about = window.helpMenu.addAction(
-                QtGui.QPixmap(resourcespath + 'syncplay.png'),
+                QtGui.QIcon(QtGui.QPixmap(resourcespath + 'syncplay.png')),
                 getMessage("about-menu-label"))
         else:
             window.about = window.helpMenu.addAction("&About")
@@ -1835,16 +1835,16 @@ def changeAutoplayState(self, source=None):
     def updateReadyIcon(self):
         ready = self.readyPushButton.isChecked()
         if ready:
-            self.readyPushButton.setIcon(QtGui.QPixmap(resourcespath + 'tick_checkbox.png'))
+            self.readyPushButton.setIcon(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'tick_checkbox.png')))
         else:
-            self.readyPushButton.setIcon(QtGui.QPixmap(resourcespath + 'empty_checkbox.png'))
+            self.readyPushButton.setIcon(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'empty_checkbox.png')))

     def updateAutoPlayIcon(self):
         ready = self.autoplayPushButton.isChecked()
         if ready:
-            self.autoplayPushButton.setIcon(QtGui.QPixmap(resourcespath + 'tick_checkbox.png'))
+            self.autoplayPushButton.setIcon(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'tick_checkbox.png')))
         else:
-            self.autoplayPushButton.setIcon(QtGui.QPixmap(resourcespath + 'empty_checkbox.png'))
+            self.autoplayPushButton.setIcon(QtGui.QIcon(QtGui.QPixmap(resourcespath + 'empty_checkbox.png')))

     def automaticUpdateCheck(self):
         currentDateTimeValue = QDateTime.currentDateTime()
@@ -2060,7 +2060,7 @@ def __init__(self, passedBar=None):
         self.populateMenubar(self)
         self.addMainFrame(self)
         self.loadSettings()
-        self.setWindowIcon(QtGui.QPixmap(resourcespath + "syncplay.png"))
+        self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(resourcespath + "syncplay.png")))
         self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & Qt.WindowMinimizeButtonHint & ~Qt.WindowContextHelpButtonHint)
         self.show()
         self.setAcceptDrops(True)

