mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-03 22:54:31 +00:00
fullscreenmode lovin'
svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=370269
This commit is contained in:
parent
f46c9176e4
commit
1df24e0951
|
@ -68,6 +68,7 @@ More items (first items will enter 'In progress list' first):
|
|||
-> investigate 'Splash' lack of smoothness at low resolutions (see lines in thumbnails)
|
||||
|
||||
Done (newest feature comes firts):
|
||||
-> FIX: Some fullScreen loving, if we are on fullscreen put an action on RMB menu ti get out of it, if we were on fullScreen mode on exit bring back correctly if we were also seeing toolbar or menubar
|
||||
-> FIX: When in non continous mode and scrolling up a page, set the viewport at the bottom of the page (Albert)
|
||||
-> FIX: Dynamic zoom repaints the page while rescaling.
|
||||
-> ADD: Show the window maximized when the user opens the program for the very first time (Albert)
|
||||
|
|
|
@ -71,7 +71,7 @@ unsigned int Part::m_count = 0;
|
|||
Part::Part(QWidget *parentWidget, const char *widgetName,
|
||||
QObject *parent, const char *name,
|
||||
const QStringList & /*args*/ )
|
||||
: DCOPObject("kpdf"), KParts::ReadOnlyPart(parent, name), m_showMenuBarAction(0), m_showMenuBarActionSearched(false)
|
||||
: DCOPObject("kpdf"), KParts::ReadOnlyPart(parent, name), m_showMenuBarAction(0), m_actionsSearched(false)
|
||||
{
|
||||
// create browser extension (for printing when embedded into browser)
|
||||
new BrowserExtension(this);
|
||||
|
@ -508,7 +508,8 @@ void Part::slotPrintPreview()
|
|||
|
||||
void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
||||
{
|
||||
if (!m_showMenuBarActionSearched)
|
||||
bool reallyShow = false;
|
||||
if (!m_actionsSearched)
|
||||
{
|
||||
// the quest for options_show_menubar
|
||||
KXMLGUIClient *client;
|
||||
|
@ -517,7 +518,7 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
|||
KActionPtrList actions;
|
||||
QPtrList<KXMLGUIClient> clients(factory()->clients());
|
||||
QPtrListIterator<KXMLGUIClient> clientsIt( clients );
|
||||
for( ; !m_showMenuBarAction && clientsIt.current(); ++clientsIt)
|
||||
for( ; (!m_showMenuBarAction || !m_showFullScreenAction) && clientsIt.current(); ++clientsIt)
|
||||
{
|
||||
client = clientsIt.current();
|
||||
ac = client->actionCollection();
|
||||
|
@ -525,9 +526,12 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
|||
end = actions.end();
|
||||
begin = actions.begin();
|
||||
for ( it = begin; it != end; ++it )
|
||||
{
|
||||
if (QString((*it)->name()) == "options_show_menubar") m_showMenuBarAction = (KToggleAction*)(*it);
|
||||
if (QString((*it)->name()) == "fullscreen") m_showFullScreenAction = (KToggleAction*)(*it);
|
||||
}
|
||||
}
|
||||
m_showMenuBarActionSearched = true;
|
||||
m_actionsSearched = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -542,6 +546,7 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
|||
popup->insertItem( SmallIcon("viewmagfit"), i18n("Fit Width"), 2 );
|
||||
//popup->insertItem( SmallIcon("pencil"), i18n("Edit"), 3 );
|
||||
//popup->setItemEnabled( 3, false );
|
||||
reallyShow = true;
|
||||
}
|
||||
/*
|
||||
//Albert says: I have not ported this as i don't see it does anything
|
||||
|
@ -551,25 +556,31 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
|||
m_popup->setItemEnabled( 4, false );
|
||||
}*/
|
||||
|
||||
if (m_showMenuBarAction)
|
||||
if ((m_showMenuBarAction && !m_showMenuBarAction->isChecked()) || (m_showFullScreenAction && m_showFullScreenAction->isChecked()))
|
||||
{
|
||||
popup->insertTitle( i18n( "Tools" ) );
|
||||
m_showMenuBarAction->plug(popup);
|
||||
if (m_showMenuBarAction && !m_showMenuBarAction->isChecked()) m_showMenuBarAction->plug(popup);
|
||||
if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) m_showFullScreenAction->plug(popup);
|
||||
reallyShow = true;
|
||||
|
||||
}
|
||||
|
||||
switch ( popup->exec(point) )
|
||||
if (reallyShow)
|
||||
{
|
||||
case 1:
|
||||
m_document->toggleBookmark( page->number() );
|
||||
break;
|
||||
case 2: // zoom: Fit Width, columns: 1. setActions + relayout + setPage + update
|
||||
// (FIXME restore faster behavior and txt change as in old pageview implementation)
|
||||
m_pageView->setZoomFitWidth();
|
||||
m_document->setCurrentPage( page->number() );
|
||||
break;
|
||||
// case 3: // ToDO switch to edit mode
|
||||
// m_pageView->slotSetMouseDraw();
|
||||
// break;
|
||||
switch ( popup->exec(point) )
|
||||
{
|
||||
case 1:
|
||||
m_document->toggleBookmark( page->number() );
|
||||
break;
|
||||
case 2: // zoom: Fit Width, columns: 1. setActions + relayout + setPage + update
|
||||
// (FIXME restore faster behavior and txt change as in old pageview implementation)
|
||||
m_pageView->setZoomFitWidth();
|
||||
m_document->setCurrentPage( page->number() );
|
||||
break;
|
||||
// case 3: // ToDO switch to edit mode
|
||||
// m_pageView->slotSetMouseDraw();
|
||||
// break;
|
||||
}
|
||||
}
|
||||
delete popup;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,8 @@ private:
|
|||
KAction *m_showProperties;
|
||||
KToggleAction* m_watchFile;
|
||||
KToggleAction* m_showMenuBarAction;
|
||||
bool m_showMenuBarActionSearched;
|
||||
KToggleAction* m_showFullScreenAction;
|
||||
bool m_actionsSearched;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
using namespace KPDF;
|
||||
|
||||
Shell::Shell()
|
||||
: KParts::MainWindow(0, "KPDF::Shell")
|
||||
: KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true)
|
||||
{
|
||||
// set the shell's ui resource file
|
||||
setXMLFile("kpdf_shell.rc");
|
||||
|
@ -64,6 +64,7 @@ Shell::Shell()
|
|||
// and integrate the part's GUI with the shell's
|
||||
setupGUI(Keys | Save);
|
||||
createGUI(m_part);
|
||||
m_showToolBarAction = static_cast<KToggleAction*>(toolBarMenuAction());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -103,6 +104,31 @@ void Shell::readSettings()
|
|||
KGlobal::config()->setDesktopGroup();
|
||||
bool fullScreen = KGlobal::config()->readBoolEntry( "FullScreen", false );
|
||||
setFullScreen( fullScreen );
|
||||
|
||||
// necessary to make fullscreen mode obey the last showmenubar / showtoolbarsettings
|
||||
KGlobal::config()->setGroup("MainWindow");
|
||||
if (KGlobal::config()->readBoolEntry( "MenuBar", true ))
|
||||
{
|
||||
m_showMenuBarAction->setChecked(true);
|
||||
menuBar()->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_showMenuBarAction->setChecked(false);
|
||||
menuBar()->hide();
|
||||
}
|
||||
|
||||
KGlobal::config()->setGroup("MainWindow Toolbar mainToolBar");
|
||||
if (KGlobal::config()->readBoolEntry("Hidden", false))
|
||||
{
|
||||
m_showToolBarAction->setChecked(true);
|
||||
toolBar()->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_showToolBarAction->setChecked(false);
|
||||
toolBar()->show();
|
||||
}
|
||||
}
|
||||
|
||||
void Shell::writeSettings()
|
||||
|
@ -126,9 +152,7 @@ Shell::setupActions()
|
|||
|
||||
setStandardToolBarMenuEnabled(true);
|
||||
|
||||
m_showMenuBarAction = KStdAction::showMenubar( this, SLOT( slotShowMenubar() ), actionCollection(), "options_show_menubar" );
|
||||
KGlobal::config()->setGroup("MainWindow");
|
||||
m_showMenuBarAction->setChecked(KGlobal::config()->readBoolEntry( "MenuBar", true ));
|
||||
m_showMenuBarAction = KStdAction::showMenubar( this, SLOT( slotShowMenubar() ), actionCollection());
|
||||
KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
|
||||
m_fullScreenAction = KStdAction::fullScreen( this, SLOT( slotUpdateFullScreen() ), actionCollection(), this );
|
||||
}
|
||||
|
@ -196,6 +220,7 @@ void Shell::slotQuit()
|
|||
kapp->closeAllWindows();
|
||||
}
|
||||
|
||||
// only called when starting the program
|
||||
void Shell::setFullScreen( bool useFullScreen )
|
||||
{
|
||||
if( useFullScreen )
|
||||
|
@ -206,24 +231,31 @@ void Shell::setFullScreen( bool useFullScreen )
|
|||
|
||||
void Shell::slotUpdateFullScreen()
|
||||
{
|
||||
if( m_fullScreenAction->isChecked())
|
||||
if(m_fullScreenAction->isChecked())
|
||||
{
|
||||
menuBar()->hide();
|
||||
toolBar()->hide();
|
||||
//todo fixme
|
||||
showFullScreen();
|
||||
#if 0
|
||||
kapp->installEventFilter( m_fsFilter );
|
||||
if ( m_gvpart->document()->isOpen() )
|
||||
slotFitToPage();
|
||||
#endif
|
||||
m_menuBarWasShown = m_showMenuBarAction->isChecked();
|
||||
m_showMenuBarAction->setChecked(false);
|
||||
menuBar()->hide();
|
||||
|
||||
m_toolBarWasShown = m_showToolBarAction->isChecked();
|
||||
m_showToolBarAction->setChecked(false);
|
||||
toolBar()->hide();
|
||||
|
||||
showFullScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
//kapp->removeEventFilter( m_fsFilter );
|
||||
menuBar()->show();
|
||||
toolBar()->show();
|
||||
showNormal();
|
||||
if (m_menuBarWasShown)
|
||||
{
|
||||
m_showMenuBarAction->setChecked(true);
|
||||
menuBar()->show();
|
||||
}
|
||||
if (m_toolBarWasShown)
|
||||
{
|
||||
m_showToolBarAction->setChecked(true);
|
||||
toolBar()->show();
|
||||
}
|
||||
showNormal();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@ namespace KPDF
|
|||
KRecentFilesAction* m_recent;
|
||||
KToggleAction* m_fullScreenAction;
|
||||
KToggleAction* m_showMenuBarAction;
|
||||
bool m_isFullScreen;
|
||||
KToggleAction* m_showToolBarAction;
|
||||
bool m_menuBarWasShown, m_toolBarWasShown;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue