Implement #1471 (Full Screen for the Ebook Viewer component)

This commit is contained in:
Kovid Goyal 2008-12-26 21:41:07 -08:00
parent 6c78c33930
commit d2a5bd6f52
2 changed files with 22 additions and 3 deletions

View File

@ -242,6 +242,8 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
lambda x:self.view.previous_page()) lambda x:self.view.previous_page())
self.connect(self.action_find_next, SIGNAL('triggered(bool)'), self.connect(self.action_find_next, SIGNAL('triggered(bool)'),
lambda x:self.find(unicode(self.search.text()), True, repeat=True)) lambda x:self.find(unicode(self.search.text()), True, repeat=True))
self.connect(self.action_full_screen, SIGNAL('triggered(bool)'),
self.toggle_fullscreen)
self.connect(self.action_back, SIGNAL('triggered(bool)'), self.back) self.connect(self.action_back, SIGNAL('triggered(bool)'), self.back)
self.connect(self.action_bookmark, SIGNAL('triggered(bool)'), self.bookmark) self.connect(self.action_bookmark, SIGNAL('triggered(bool)'), self.bookmark)
self.connect(self.action_forward, SIGNAL('triggered(bool)'), self.forward) self.connect(self.action_forward, SIGNAL('triggered(bool)'), self.forward)
@ -263,6 +265,13 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
self.tool_bar.setContextMenuPolicy(Qt.PreventContextMenu) self.tool_bar.setContextMenuPolicy(Qt.PreventContextMenu)
self.tool_bar2.setContextMenuPolicy(Qt.PreventContextMenu) self.tool_bar2.setContextMenuPolicy(Qt.PreventContextMenu)
self.tool_bar.widgetForAction(self.action_bookmark).setPopupMode(QToolButton.MenuButtonPopup) self.tool_bar.widgetForAction(self.action_bookmark).setPopupMode(QToolButton.MenuButtonPopup)
self.action_full_screen.setCheckable(True)
def toggle_fullscreen(self, x):
if self.isFullScreen():
self.showNormal()
else:
self.showFullScreen()
def goto(self, ref): def goto(self, ref):
if ref: if ref:
@ -574,7 +583,7 @@ View an ebook.
def main(args=sys.argv): def main(args=sys.argv):
parser = option_parser() parser = option_parser()
opts, args = parser.parse_args(args) args = parser.parse_args(args)[-1]
pid = os.fork() if islinux else -1 pid = os.fork() if islinux else -1
if pid <= 0: if pid <= 0:
app = Application(args) app = Application(args)

View File

@ -27,8 +27,8 @@
<widget class="QWidget" name="layoutWidget" > <widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" name="gridLayout" > <layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QWebView" name="view" > <widget class="QWebView" native="1" name="view" >
<property name="url" > <property name="url" stdset="0" >
<url> <url>
<string>about:blank</string> <string>about:blank</string>
</url> </url>
@ -88,6 +88,7 @@
<addaction name="action_reference_mode" /> <addaction name="action_reference_mode" />
<addaction name="separator" /> <addaction name="separator" />
<addaction name="action_preferences" /> <addaction name="action_preferences" />
<addaction name="action_full_screen" />
</widget> </widget>
<widget class="QToolBar" name="tool_bar2" > <widget class="QToolBar" name="tool_bar2" >
<attribute name="toolBarArea" > <attribute name="toolBarArea" >
@ -224,6 +225,15 @@
<string>Bookmark</string> <string>Bookmark</string>
</property> </property>
</action> </action>
<action name="action_full_screen" >
<property name="icon" >
<iconset resource="../images.qrc" >
<normaloff>:/images/page.svg</normaloff>:/images/page.svg</iconset>
</property>
<property name="text" >
<string>Toggle full screen</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>