audio-input setting and status
This commit is contained in:
parent
3f8cd88ec0
commit
6499ec315a
BIN
icons/mic.png
Normal file
BIN
icons/mic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -298,6 +298,7 @@
|
|||||||
<addaction name="action_updatevm"/>
|
<addaction name="action_updatevm"/>
|
||||||
<addaction name="action_run_command_in_vm"/>
|
<addaction name="action_run_command_in_vm"/>
|
||||||
<addaction name="action_set_keyboard_layout"/>
|
<addaction name="action_set_keyboard_layout"/>
|
||||||
|
<addaction name="action_toggle_audio_input"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="logs_menu"/>
|
<addaction name="logs_menu"/>
|
||||||
<addaction name="blk_menu"/>
|
<addaction name="blk_menu"/>
|
||||||
@ -341,6 +342,7 @@
|
|||||||
<addaction name="action_appmenus"/>
|
<addaction name="action_appmenus"/>
|
||||||
<addaction name="action_updatevm"/>
|
<addaction name="action_updatevm"/>
|
||||||
<addaction name="action_set_keyboard_layout"/>
|
<addaction name="action_set_keyboard_layout"/>
|
||||||
|
<addaction name="action_toggle_audio_input"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_global_settings"/>
|
<addaction name="action_global_settings"/>
|
||||||
<addaction name="action_backup"/>
|
<addaction name="action_backup"/>
|
||||||
@ -450,6 +452,21 @@
|
|||||||
<string>Update VM system</string>
|
<string>Update VM system</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_toggle_audio_input">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/mic.png</normaloff>:/mic.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Toggle audio-input to the VM</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Toggle audio-input to the VM</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="action_showallvms">
|
<action name="action_showallvms">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -68,6 +68,7 @@ update_suggestion_interval = 14 # 14 days
|
|||||||
dbus_object_path = '/org/qubesos/QubesManager'
|
dbus_object_path = '/org/qubesos/QubesManager'
|
||||||
dbus_interface = 'org.qubesos.QubesManager'
|
dbus_interface = 'org.qubesos.QubesManager'
|
||||||
system_bus = None
|
system_bus = None
|
||||||
|
session_bus = None
|
||||||
|
|
||||||
power_order = Qt.DescendingOrder
|
power_order = Qt.DescendingOrder
|
||||||
update_order = Qt.AscendingOrder
|
update_order = Qt.AscendingOrder
|
||||||
@ -249,26 +250,31 @@ class VmInfoWidget (QWidget):
|
|||||||
self.upd_info = VmUpdateInfoWidget(vm, show_text=False)
|
self.upd_info = VmUpdateInfoWidget(vm, show_text=False)
|
||||||
self.error_icon = VmIconWidget(":/warning.png")
|
self.error_icon = VmIconWidget(":/warning.png")
|
||||||
self.blk_icon = VmIconWidget(":/mount.png")
|
self.blk_icon = VmIconWidget(":/mount.png")
|
||||||
|
self.rec_icon = VmIconWidget(":/mic.png")
|
||||||
|
|
||||||
layout.addWidget(self.on_icon)
|
layout.addWidget(self.on_icon)
|
||||||
layout.addWidget(self.upd_info)
|
layout.addWidget(self.upd_info)
|
||||||
layout.addWidget(self.error_icon)
|
layout.addWidget(self.error_icon)
|
||||||
layout.addItem(QSpacerItem(0, 10, QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
|
layout.addItem(QSpacerItem(0, 10, QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
|
||||||
layout.addWidget(self.blk_icon)
|
layout.addWidget(self.blk_icon)
|
||||||
|
layout.addWidget(self.rec_icon)
|
||||||
|
|
||||||
layout.setContentsMargins(5,0,5,0)
|
layout.setContentsMargins(5,0,5,0)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
self.rec_icon.setVisible(False)
|
||||||
self.blk_icon.setVisible(False)
|
self.blk_icon.setVisible(False)
|
||||||
self.error_icon.setVisible(False)
|
self.error_icon.setVisible(False)
|
||||||
|
|
||||||
self.tableItem = self.VmInfoItem(self.upd_info.tableItem, vm)
|
self.tableItem = self.VmInfoItem(self.upd_info.tableItem, vm)
|
||||||
|
|
||||||
def update_vm_state(self, vm, blk_visible):
|
def update_vm_state(self, vm, blk_visible, rec_visible=None):
|
||||||
self.on_icon.update()
|
self.on_icon.update()
|
||||||
self.upd_info.update_outdated(vm)
|
self.upd_info.update_outdated(vm)
|
||||||
if blk_visible != None:
|
if blk_visible != None:
|
||||||
self.blk_icon.setVisible(blk_visible)
|
self.blk_icon.setVisible(blk_visible)
|
||||||
|
if rec_visible != None:
|
||||||
|
self.rec_icon.setVisible(rec_visible)
|
||||||
self.error_icon.setToolTip(vm.error_msg)
|
self.error_icon.setToolTip(vm.error_msg)
|
||||||
self.error_icon.setVisible(vm.error_msg is not None)
|
self.error_icon.setVisible(vm.error_msg is not None)
|
||||||
|
|
||||||
@ -625,8 +631,8 @@ class VmRowInTable(object):
|
|||||||
table.setItem(row_no, VmManagerWindow.columns_indices['Size'], self.size_widget)
|
table.setItem(row_no, VmManagerWindow.columns_indices['Size'], self.size_widget)
|
||||||
|
|
||||||
|
|
||||||
def update(self, blk_visible = None, cpu_load = None, update_size_on_disk = False):
|
def update(self, blk_visible = None, cpu_load = None, update_size_on_disk = False, rec_visible = None):
|
||||||
self.info_widget.update_vm_state(self.vm, blk_visible)
|
self.info_widget.update_vm_state(self.vm, blk_visible, rec_visible)
|
||||||
if cpu_load is not None:
|
if cpu_load is not None:
|
||||||
self.cpu_usage_widget.update_load(self.vm, cpu_load)
|
self.cpu_usage_widget.update_load(self.vm, cpu_load)
|
||||||
self.mem_usage_widget.update_load(self.vm, None)
|
self.mem_usage_widget.update_load(self.vm, None)
|
||||||
@ -713,6 +719,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.running_vms_count = 0
|
self.running_vms_count = 0
|
||||||
|
|
||||||
self.vm_errors = {}
|
self.vm_errors = {}
|
||||||
|
self.vm_rec = {}
|
||||||
|
|
||||||
self.frame_width = 0
|
self.frame_width = 0
|
||||||
self.frame_height = 0
|
self.frame_height = 0
|
||||||
@ -760,6 +767,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.context_menu.addAction(self.action_appmenus)
|
self.context_menu.addAction(self.action_appmenus)
|
||||||
self.context_menu.addAction(self.action_set_keyboard_layout)
|
self.context_menu.addAction(self.action_set_keyboard_layout)
|
||||||
self.context_menu.addMenu(self.blk_menu)
|
self.context_menu.addMenu(self.blk_menu)
|
||||||
|
self.context_menu.addAction(self.action_toggle_audio_input)
|
||||||
self.context_menu.addSeparator()
|
self.context_menu.addSeparator()
|
||||||
|
|
||||||
self.context_menu.addAction(self.action_updatevm)
|
self.context_menu.addAction(self.action_updatevm)
|
||||||
@ -791,6 +799,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.connect(self.action_menubar, SIGNAL("toggled(bool)"), self.showhide_menubar)
|
self.connect(self.action_menubar, SIGNAL("toggled(bool)"), self.showhide_menubar)
|
||||||
self.connect(self.action_toolbar, SIGNAL("toggled(bool)"), self.showhide_toolbar)
|
self.connect(self.action_toolbar, SIGNAL("toggled(bool)"), self.showhide_toolbar)
|
||||||
|
|
||||||
|
self.register_dbus_watches()
|
||||||
|
|
||||||
self.load_manager_settings()
|
self.load_manager_settings()
|
||||||
|
|
||||||
self.action_showallvms.setChecked(self.show_inactive_vms)
|
self.action_showallvms.setChecked(self.show_inactive_vms)
|
||||||
@ -985,6 +995,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
# Clear error state when VM just started
|
# Clear error state when VM just started
|
||||||
self.clear_error(vm.qid)
|
self.clear_error(vm.qid)
|
||||||
elif prev_running and not vm.last_running:
|
elif prev_running and not vm.last_running:
|
||||||
|
# FIXME: remove when recAllowed state will be preserved
|
||||||
|
self.vm_rec.pop(vm.name)
|
||||||
self.running_vms_count -= 1
|
self.running_vms_count -= 1
|
||||||
some_vms_have_changed_power_state = True
|
some_vms_have_changed_power_state = True
|
||||||
|
|
||||||
@ -1035,7 +1047,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
else:
|
else:
|
||||||
blk_visible = False
|
blk_visible = False
|
||||||
|
|
||||||
vm_row.update(blk_visible=blk_visible, cpu_load = cur_cpu_load, update_size_on_disk = self.update_size_on_disk)
|
vm_row.update(blk_visible=blk_visible, cpu_load = cur_cpu_load, update_size_on_disk = self.update_size_on_disk, rec_visible = self.vm_rec.get(vm_row.vm.name, False))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for vm_row in self.vms_in_table.values():
|
for vm_row in self.vms_in_table.values():
|
||||||
@ -1045,7 +1057,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
else:
|
else:
|
||||||
blk_visible = False
|
blk_visible = False
|
||||||
|
|
||||||
vm_row.update(blk_visible=blk_visible, update_size_on_disk = self.update_size_on_disk)
|
vm_row.update(blk_visible=blk_visible, update_size_on_disk = self.update_size_on_disk, rec_visible = self.vm_rec.get(vm_row.vm.name, False))
|
||||||
|
|
||||||
if self.sort_by_column in ["CPU", "CPU Graph", "MEM", "MEM Graph", "State", "Size" ]:
|
if self.sort_by_column in ["CPU", "CPU Graph", "MEM", "MEM Graph", "State", "Size" ]:
|
||||||
# "State": needed to sort after reload (fill_table sorts items with setSortingEnabled, but by that time the widgets values are not correct yet).
|
# "State": needed to sort after reload (fill_table sorts items with setSortingEnabled, but by that time the widgets values are not correct yet).
|
||||||
@ -1066,6 +1078,24 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
trayIcon.showMessage (str, msecs=5000)
|
trayIcon.showMessage (str, msecs=5000)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def recAllowedChanged(self, state, path = None):
|
||||||
|
if path is None:
|
||||||
|
print "dbus signal: No path found"
|
||||||
|
return
|
||||||
|
|
||||||
|
if not path.startswith('/org/qubesos/audio/'):
|
||||||
|
print "dbus signal: Invalid object caller: %s" % path
|
||||||
|
|
||||||
|
vmname = path.strip('/org/qubesos/audio/')
|
||||||
|
self.vm_rec[vmname] = bool(state)
|
||||||
|
|
||||||
|
def register_dbus_watches(self):
|
||||||
|
global session_bus
|
||||||
|
|
||||||
|
if not session_bus:
|
||||||
|
session_bus = dbus.SessionBus()
|
||||||
|
|
||||||
|
session_bus.add_signal_receiver(self.recAllowedChanged, signal_name="RecAllowedChanged", dbus_interface="org.QubesOS.Audio", path_keyword='path')
|
||||||
|
|
||||||
def sortIndicatorChanged(self, column, order):
|
def sortIndicatorChanged(self, column, order):
|
||||||
self.sort_by_column = [name for name in self.columns_indices.keys() if self.columns_indices[name] == column][0]
|
self.sort_by_column = [name for name in self.columns_indices.keys() if self.columns_indices[name] == column][0]
|
||||||
@ -1091,6 +1121,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.action_appmenus.setEnabled(not vm.is_netvm())
|
self.action_appmenus.setEnabled(not vm.is_netvm())
|
||||||
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
|
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
|
||||||
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
|
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
|
||||||
|
self.action_toggle_audio_input.setEnabled(vm.last_running and vm.qid != 0)
|
||||||
self.action_run_command_in_vm.setEnabled(vm.qid != 0)
|
self.action_run_command_in_vm.setEnabled(vm.qid != 0)
|
||||||
self.action_set_keyboard_layout.setEnabled(vm.qid != 0 and vm.last_running)
|
self.action_set_keyboard_layout.setEnabled(vm.qid != 0 and vm.last_running)
|
||||||
else:
|
else:
|
||||||
@ -1104,6 +1135,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.action_appmenus.setEnabled(False)
|
self.action_appmenus.setEnabled(False)
|
||||||
self.action_editfwrules.setEnabled(False)
|
self.action_editfwrules.setEnabled(False)
|
||||||
self.action_updatevm.setEnabled(False)
|
self.action_updatevm.setEnabled(False)
|
||||||
|
self.action_toggle_audio_input.setEnabled(False)
|
||||||
self.action_run_command_in_vm.setEnabled(False)
|
self.action_run_command_in_vm.setEnabled(False)
|
||||||
self.action_set_keyboard_layout.setEnabled(False)
|
self.action_set_keyboard_layout.setEnabled(False)
|
||||||
|
|
||||||
@ -1405,6 +1437,14 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
settings_window = VMSettingsWindow(vm, app, self.qvm_collection, "applications")
|
settings_window = VMSettingsWindow(vm, app, self.qvm_collection, "applications")
|
||||||
settings_window.exec_()
|
settings_window.exec_()
|
||||||
|
|
||||||
|
@pyqtSlot(name='on_action_toggle_audio_input_triggered')
|
||||||
|
def action_toggle_audio_input_triggered(self):
|
||||||
|
vm = self.get_selected_vm()
|
||||||
|
audio = session_bus.get_object('org.QubesOS.Audio.%s' % vm.name,
|
||||||
|
'/org/qubesos/audio/%s' % vm.name)
|
||||||
|
current_audio = bool(audio.Get('org.QubesOS.Audio', 'RecAllowed'))
|
||||||
|
audio.Set('org.QubesOS.Audio', 'RecAllowed', dbus.Boolean(not current_audio, variant_level=1))
|
||||||
|
# icon will be updated based on dbus signal
|
||||||
|
|
||||||
@pyqtSlot(name='on_action_updatevm_triggered')
|
@pyqtSlot(name='on_action_updatevm_triggered')
|
||||||
def action_updatevm_triggered(self):
|
def action_updatevm_triggered(self):
|
||||||
@ -2076,6 +2116,9 @@ def main():
|
|||||||
name = dbus.service.BusName('org.qubesos.QubesManager', system_bus)
|
name = dbus.service.BusName('org.qubesos.QubesManager', system_bus)
|
||||||
dbus_notifier = QubesDbusNotify(system_bus, manager_window)
|
dbus_notifier = QubesDbusNotify(system_bus, manager_window)
|
||||||
|
|
||||||
|
global session_bus
|
||||||
|
session_bus = dbus.SessionBus()
|
||||||
|
|
||||||
global trayIcon
|
global trayIcon
|
||||||
trayIcon = QubesTrayIcon(QIcon(":/qubes.png"))
|
trayIcon = QubesTrayIcon(QIcon(":/qubes.png"))
|
||||||
trayIcon.show()
|
trayIcon.show()
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
<file alias="resumevm.png">icons/resumevm.png</file>
|
<file alias="resumevm.png">icons/resumevm.png</file>
|
||||||
<file alias="pausevm.png">icons/pausevm.png</file>
|
<file alias="pausevm.png">icons/pausevm.png</file>
|
||||||
<file alias="showcpuload.png">icons/showcpuload.png</file>
|
<file alias="showcpuload.png">icons/showcpuload.png</file>
|
||||||
|
<file alias="mic.png">icons/mic.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource/>
|
<qresource/>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
Reference in New Issue
Block a user