Use different room icon for controlled/uncontroleld rooms

This commit is contained in:
Et0h 2014-10-24 23:03:25 +01:00
parent 7794a94aa7
commit 2aa7b50ac6
2 changed files with 13 additions and 0 deletions

BIN
resources/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

View File

@ -15,6 +15,12 @@ class UserlistItemDelegate(QtGui.QStyledItemDelegate):
def paint(self, itemQPainter, optionQStyleOptionViewItem, indexQModelIndex):
column = indexQModelIndex.column()
if column == 0:
isRoomRow = indexQModelIndex.parent() == indexQModelIndex.parent().parent()
itemQPainter.resetTransform()
if not isRoomRow:
transformer = QtGui.QTransform()
transformer.translate(21,0)
itemQPainter.setTransform(transformer)
currentQAbstractItemModel = indexQModelIndex.model()
itemQModelIndex = currentQAbstractItemModel.index(indexQModelIndex.row(), 0, indexQModelIndex.parent())
if sys.platform.startswith('win'):
@ -105,6 +111,12 @@ class MainWindow(QtGui.QMainWindow):
roomitem.setFont(font)
roomitem.setFlags(roomitem.flags() & ~Qt.ItemIsEditable)
usertreeRoot.appendRow(roomitem)
isControlledRoom = RoomPasswordProvider.isControlledRoom(room)
if isControlledRoom:
roomitem.setIcon(QtGui.QIcon(self.resourcespath + 'lock.png'))
else:
roomitem.setIcon(QtGui.QIcon(self.resourcespath + 'bullet_black.png'))
for user in rooms[room]:
useritem = QtGui.QStandardItem(user.username)
@ -147,6 +159,7 @@ class MainWindow(QtGui.QMainWindow):
self.listTreeView.setModel(self.listTreeModel)
self.listTreeView.setItemDelegate(UserlistItemDelegate())
self.listTreeView.setItemsExpandable(False)
self.listTreeView.setRootIsDecorated(False)
self.listTreeView.expandAll()
roomtocheck = 0
while self.listTreeModel.item(roomtocheck):