Menu revolution (#549)

This commit is contained in:
Agnieszka Kostrzewa 2012-04-26 17:46:41 +02:00
parent 6fd5de674f
commit 9d4e58c8d4
2 changed files with 102 additions and 25 deletions

View File

@ -227,15 +227,15 @@
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuOptions">
<widget class="QMenu" name="menu_system">
<property name="title">
<string>Options</string>
<string>System</string>
</property>
<addaction name="action_global_settings"/>
<addaction name="action_backup"/>
<addaction name="action_restore"/>
</widget>
<widget class="QMenu" name="menuView">
<widget class="QMenu" name="menu_view">
<property name="title">
<string>View</string>
</property>
@ -249,9 +249,61 @@
<addaction name="action_cpu_graph"/>
<addaction name="action_mem"/>
<addaction name="action_mem_graph"/>
<addaction name="separator"/>
<addaction name="action_toolbar"/>
<addaction name="action_menubar"/>
<addaction name="separator"/>
<addaction name="action_showallvms"/>
</widget>
<addaction name="menuOptions"/>
<addaction name="menuView"/>
<widget class="QMenu" name="menu_vm">
<property name="title">
<string>VM</string>
</property>
<widget class="QMenu" name="logs_menu">
<property name="title">
<string>Logs</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/log.png</normaloff>:/log.png</iconset>
</property>
</widget>
<widget class="QMenu" name="blk_menu">
<property name="title">
<string>Block devices</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/mount.png</normaloff>:/mount.png</iconset>
</property>
</widget>
<addaction name="action_createvm"/>
<addaction name="action_removevm"/>
<addaction name="separator"/>
<addaction name="action_resumevm"/>
<addaction name="action_pausevm"/>
<addaction name="action_shutdownvm"/>
<addaction name="action_killvm"/>
<addaction name="separator"/>
<addaction name="action_settings"/>
<addaction name="action_editfwrules"/>
<addaction name="action_appmenus"/>
<addaction name="action_updatevm"/>
<addaction name="action_set_keyboard_layout"/>
<addaction name="separator"/>
<addaction name="logs_menu"/>
<addaction name="blk_menu"/>
</widget>
<widget class="QMenu" name="menu_about">
<property name="title">
<string>About</string>
</property>
<addaction name="action_about_qubes"/>
</widget>
<addaction name="menu_system"/>
<addaction name="menu_vm"/>
<addaction name="menu_view"/>
<addaction name="menu_about"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
@ -622,6 +674,37 @@
<string>Name</string>
</property>
</action>
<action name="action_toolbar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Show tool bar</string>
</property>
</action>
<action name="action_menubar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Show menu bar</string>
</property>
</action>
<action name="action_about_qubes">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/qubes.png</normaloff>:/qubes.png</iconset>
</property>
<property name="text">
<string>Qubes OS</string>
</property>
</action>
</widget>
<resources>
<include location="resources.qrc"/>

View File

@ -678,33 +678,22 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.table.sortItems(self.columns_indices["Type"], Qt.AscendingOrder)
self.context_menu = QMenu(self)
self.context_menu.addAction(self.action_settings)
self.context_menu.addAction(self.action_removevm)
self.context_menu.addAction(self.action_resumevm)
self.context_menu.addAction(self.action_pausevm)
self.context_menu.addAction(self.action_shutdownvm)
self.context_menu.addAction(self.action_killvm)
self.context_menu.addAction(self.action_settings)
self.context_menu.addAction(self.action_appmenus)
self.context_menu.addAction(self.action_editfwrules)
self.context_menu.addAction(self.action_updatevm)
self.context_menu.addAction(self.action_set_keyboard_layout)
self.table_selection_changed()
self.logs_menu = QMenu("Logs")
log_icon = QtGui.QIcon()
log_icon.addPixmap(QPixmap(":/log.png"))
self.logs_menu.setIcon(log_icon)
self.context_menu.addMenu(self.logs_menu)
self.blk_menu = QMenu("Block devices")
blk_icon = QtGui.QIcon()
blk_icon.addPixmap(QPixmap(":/mount.png"))
self.blk_menu.setIcon(blk_icon)
self.context_menu.addMenu(self.blk_menu)
self.context_menu.addSeparator()
self.table_selection_changed()
self.connect(self.table.horizontalHeader(), SIGNAL("sortIndicatorChanged(int, Qt::SortOrder)"), self.sortIndicatorChanged)
self.connect(self.table, SIGNAL("customContextMenuRequested(const QPoint&)"), self.open_context_menu)
self.connect(self.blk_menu, SIGNAL("triggered(QAction *)"), self.attach_dettach_device_triggered)
@ -714,12 +703,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.centralwidget.layout().setContentsMargins(0,0,0,0)
self.layout().setContentsMargins(0,0,0,0)
self.action_toolbar = QAction("Show tool bar", None)
self.action_toolbar.setCheckable(True)
self.action_toolbar.setChecked(True)
self.action_menubar = QAction("Show menu bar", None)
self.action_menubar.setCheckable(True)
self.action_menubar.setChecked(True)
#self.action_toolbar = QAction("Show tool bar", None)
#self.action_toolbar.setCheckable(True)
#self.action_toolbar.setChecked(True)
#self.action_menubar = QAction("Show menu bar", None)
#self.action_menubar.setCheckable(True)
#self.action_menubar.setChecked(True)
self.connect(self.action_menubar, SIGNAL("toggled(bool)"), self.showhide_menubar)
self.connect(self.action_toolbar, SIGNAL("toggled(bool)"), self.showhide_toolbar)
@ -1453,6 +1442,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.showhide_column( self.columns_indices['MEM Graph'], checked)
@pyqtSlot(name='on_action_about_qubes_triggered')
def action_about_qubes_triggered(self):
QMessageBox.about(self, "About...", "<b>Qubes OS</b><br><br>Release 1.0")
def createPopupMenu(self):
menu = QMenu()
menu.addAction(self.action_toolbar)