mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 10:55:37 +00:00
Add fullscreen (not perfect again)
svn path=/trunk/kdegraphics/kpdf/; revision=251213
This commit is contained in:
parent
c16b87bb50
commit
9220ef7f35
|
@ -119,6 +119,15 @@ Part::~Part()
|
|||
writeSettings();
|
||||
}
|
||||
|
||||
void Part::setFullScreen( bool fs )
|
||||
{
|
||||
if ( !fs )
|
||||
pdfpartview->pagesListBox->show();
|
||||
else
|
||||
pdfpartview->pagesListBox->hide();
|
||||
}
|
||||
|
||||
|
||||
void Part::updateActionPage()
|
||||
{
|
||||
if ( m_doc )
|
||||
|
|
|
@ -70,6 +70,7 @@ namespace KPDF
|
|||
void displayPage(int pageNumber, float zoomFactor = 1.0);
|
||||
void displayDestination(LinkDest*);
|
||||
void updateActionPage();
|
||||
void setFullScreen( bool fs );
|
||||
protected:
|
||||
/**
|
||||
* This must be implemented by each part
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||
<kpartgui name="kpdf_part" version="7">
|
||||
<kpartgui name="kpdf_part" version="8">
|
||||
<MenuBar>
|
||||
<Menu name="edit"><text>&Edit</text>
|
||||
<Action name="find"/>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
#include "kpdf_shell.h"
|
||||
#include "kpdf_shell.moc"
|
||||
#include "kpdf_part.h"
|
||||
|
||||
#include <kaction.h>
|
||||
#include <kconfig.h>
|
||||
|
@ -18,11 +19,15 @@
|
|||
#include <kurl.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kmainwindow.h>
|
||||
#include <kmenubar.h>
|
||||
#include <kparts/componentfactory.h>
|
||||
|
||||
using namespace KPDF;
|
||||
|
||||
Shell::Shell()
|
||||
: KParts::MainWindow(0, "KPDF::Shell")
|
||||
: KParts::MainWindow(0, "KPDF::Shell"),
|
||||
m_isFullScreen( false )
|
||||
{
|
||||
// set the shell's ui resource file
|
||||
setXMLFile("kpdf_shell.rc");
|
||||
|
@ -40,12 +45,10 @@ Shell::Shell()
|
|||
// our hands on it
|
||||
m_part = static_cast<KParts::ReadOnlyPart*>(
|
||||
factory->create(this, "kpdf_part", "KParts::ReadOnlyPart"));
|
||||
|
||||
if (m_part)
|
||||
{
|
||||
// tell the KParts::MainWindow that this is indeed the main widget
|
||||
setCentralWidget(m_part->widget());
|
||||
|
||||
// and integrate the part's GUI with the shell's
|
||||
createGUI(m_part);
|
||||
}
|
||||
|
@ -60,6 +63,7 @@ Shell::Shell()
|
|||
// next time we enter the event loop...
|
||||
return;
|
||||
}
|
||||
|
||||
readSettings();
|
||||
}
|
||||
|
||||
|
@ -78,12 +82,24 @@ void Shell::openURL( const KURL & url )
|
|||
void Shell::readSettings()
|
||||
{
|
||||
recent->loadEntries( KGlobal::config() );
|
||||
KGlobal::config()->setDesktopGroup();
|
||||
bool fullScreen = KGlobal::config()->readBoolEntry( "FullScreen", false );
|
||||
m_fullScreenAction->setChecked( fullScreen );
|
||||
setFullScreen( fullScreen );
|
||||
}
|
||||
|
||||
void Shell::writeSettings()
|
||||
{
|
||||
saveMainWindowSettings(KGlobal::config(), "MainWindow");
|
||||
recent->saveEntries( KGlobal::config() );
|
||||
KGlobal::config()->setDesktopGroup();
|
||||
KGlobal::config()->writeEntry( "FullScreen", m_isFullScreen );
|
||||
KGlobal::config()->sync();
|
||||
}
|
||||
|
||||
void Shell::slotToggleFullScreen()
|
||||
{
|
||||
setFullScreen(m_fullScreenAction->isChecked());
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,6 +117,17 @@ Shell::setupActions()
|
|||
|
||||
KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
|
||||
KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
|
||||
|
||||
#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,90)
|
||||
createStandardStatusBarAction();
|
||||
#endif
|
||||
setAutoSaveSettings();
|
||||
setStandardToolBarMenuEnabled(true);
|
||||
#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,90)
|
||||
m_fullScreenAction = KStdAction::fullScreen( this, SLOT( slotToggleFullScreen() ), actionCollection() );
|
||||
#else
|
||||
m_fullScreenAction = new KToggleAction( this, SLOT( slotToggleFullScreen() ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -174,4 +201,40 @@ void Shell::slotQuit()
|
|||
{
|
||||
kapp->closeAllWindows();
|
||||
}
|
||||
|
||||
void Shell::setFullScreen( bool useFullScreen )
|
||||
{
|
||||
m_isFullScreen = useFullScreen;
|
||||
|
||||
if( m_isFullScreen )
|
||||
{
|
||||
menuBar()->hide();
|
||||
statusBar()->hide();
|
||||
toolBar()->hide();
|
||||
//todo fixme
|
||||
//m_part->setFullScreen( true );
|
||||
showFullScreen();
|
||||
#if 0
|
||||
kapp->installEventFilter( m_fsFilter );
|
||||
if ( m_gvpart->document()->isOpen() )
|
||||
slotFitToPage();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
//kapp->removeEventFilter( m_fsFilter );
|
||||
//todo fixme
|
||||
//m_part->setFullScreen( false );
|
||||
menuBar()->show();
|
||||
#if KDE_VERSION >= KDE_MAKE_VERSION(3,1,90)
|
||||
KToggleAction *statusbarAction = dynamic_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowStatusbar)));
|
||||
Q_ASSERT( statusbarAction );
|
||||
if (statusbarAction->isChecked()) statusBar()->show();
|
||||
#endif
|
||||
toolBar()->show();
|
||||
showNormal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// vim:ts=2:sw=2:tw=78:et
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
#include <kapplication.h>
|
||||
#include <kparts/mainwindow.h>
|
||||
|
||||
|
||||
namespace KPDF
|
||||
{
|
||||
|
||||
class Part;
|
||||
/**
|
||||
* This is the application "Shell". It has a menubar, toolbar, and
|
||||
* statusbar but relies on the "Part" to do all the real work.
|
||||
|
@ -49,6 +50,7 @@ namespace KPDF
|
|||
void readProperties(KConfig*);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
void setFullScreen( bool );
|
||||
|
||||
private slots:
|
||||
void fileOpen();
|
||||
|
@ -59,6 +61,7 @@ namespace KPDF
|
|||
void slotQuit();
|
||||
|
||||
void applyNewToolbarConfig();
|
||||
void slotToggleFullScreen();
|
||||
public slots:
|
||||
void openURL( const KURL & url );
|
||||
|
||||
|
@ -67,8 +70,10 @@ namespace KPDF
|
|||
void setupActions();
|
||||
|
||||
private:
|
||||
KParts::ReadOnlyPart* m_part;
|
||||
KParts::ReadOnlyPart* m_part;
|
||||
KRecentFilesAction* recent;
|
||||
KToggleAction* m_fullScreenAction;
|
||||
bool m_isFullScreen;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||
<kpartgui name="kpdf_shell" version="3">
|
||||
<kpartgui name="kpdf_shell" version="4">
|
||||
<MenuBar>
|
||||
<Menu name="file">
|
||||
<DefineGroup name="file_save" append="save_merge"/>
|
||||
<DefineGroup name="file_print" append="print_merge"/>
|
||||
</Menu>
|
||||
<Menu name="view">
|
||||
<Action name="fullscreen"/>
|
||||
</Menu>
|
||||
<Menu name="settings">
|
||||
<Action name="showmenubar"/>
|
||||
</Menu>
|
||||
<Merge/>
|
||||
</MenuBar>
|
||||
</kpartgui>
|
||||
|
|
Loading…
Reference in a new issue