mainui: Added show/hide internal VMs in the view menu

This commit is contained in:
Olivier Medoc 2013-03-05 11:21:16 +01:00 committed by Marek Marczykowski
parent dded0ba510
commit 70e0a2b97a
2 changed files with 30 additions and 4 deletions

View File

@ -234,7 +234,7 @@
<x>0</x>
<y>0</y>
<width>769</width>
<height>22</height>
<height>20</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -269,6 +269,7 @@
<addaction name="action_menubar"/>
<addaction name="separator"/>
<addaction name="action_showallvms"/>
<addaction name="action_showinternalvms"/>
</widget>
<widget class="QMenu" name="menu_vm">
<property name="title">
@ -324,6 +325,9 @@
<addaction name="menu_about"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
@ -333,9 +337,6 @@
<property name="floatable">
<bool>false</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -794,6 +795,18 @@
<string>Is an internal VM</string>
</property>
</action>
<action name="action_showinternalvms">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/show-all-running.png</normaloff>:/show-all-running.png</iconset>
</property>
<property name="text">
<string>Show/Hide internal VMs</string>
</property>
</action>
</widget>
<resources>
<include location="resources.qrc"/>

View File

@ -687,6 +687,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
min_visible_rows = 10
update_interval = 1000 # in msec
show_inactive_vms = True
show_internal_vms = False
# suppress saving settings while initializing widgets
settings_loaded = False
columns_indices = { "Type": 0,
@ -831,6 +832,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.load_manager_settings()
self.action_showallvms.setChecked(self.show_inactive_vms)
self.action_showinternalvms.setChecked(self.show_internal_vms)
self.fill_table()
@ -850,6 +852,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.columns_actions[col_no].setChecked(visible)
self.manager_settings.endGroup()
self.show_inactive_vms = self.manager_settings.value("view/show_inactive_vms", defaultValue=False).toBool()
self.show_internal_vms = self.manager_settings.value("view/show_internal_vms", defaultValue=False).toBool()
self.sort_by_column = str(self.manager_settings.value("view/sort_column", defaultValue=self.sort_by_column).toString())
self.sort_order = Qt.SortOrder(self.manager_settings.value("view/sort_order", defaultValue=self.sort_order).toInt()[0])
self.table.sortItems(self.columns_indices[self.sort_by_column], self.sort_order)
@ -1562,6 +1565,16 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.manager_settings.setValue('view/show_inactive_vms', self.show_inactive_vms)
self.manager_settings.sync()
@pyqtSlot(name='on_action_showinternalvms_triggered')
def action_showinternalvms_triggered(self):
self.show_internal_vms = self.action_showinternalvms.isChecked()
self.showhide_internal_vms(self.show_internal_vms)
self.set_table_geom_size()
if self.settings_loaded:
self.manager_settings.setValue('view/show_internal_vms', self.show_internal_vms)
self.manager_settings.sync()
@pyqtSlot(name='on_action_editfwrules_triggered')
def action_editfwrules_triggered(self):
vm = self.get_selected_vm()