-rw-r--r-- | noncore/unsupported/qpdf/qpdf.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/qpdf/qpdf.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/noncore/unsupported/qpdf/qpdf.cpp b/noncore/unsupported/qpdf/qpdf.cpp index f338509..e78f081 100644 --- a/noncore/unsupported/qpdf/qpdf.cpp +++ b/noncore/unsupported/qpdf/qpdf.cpp | |||
@@ -1,185 +1,185 @@ | |||
1 | //======================================================================== | 1 | //======================================================================== |
2 | // | 2 | // |
3 | // qpdf.cc | 3 | // qpdf.cc |
4 | // | 4 | // |
5 | // Copyright 2001 Robert Griebl | 5 | // Copyright 2001 Robert Griebl |
6 | // | 6 | // |
7 | //======================================================================== | 7 | //======================================================================== |
8 | 8 | ||
9 | #include "aconf.h" | 9 | #include "aconf.h" |
10 | #include "GString.h" | 10 | #include "GString.h" |
11 | #include "PDFDoc.h" | 11 | #include "PDFDoc.h" |
12 | #include "TextOutputDev.h" | 12 | #include "TextOutputDev.h" |
13 | 13 | ||
14 | #include "QPEOutputDev.h" | 14 | #include "QPEOutputDev.h" |
15 | 15 | ||
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/applnk.h> | 18 | #include <qpe/applnk.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | 20 | ||
21 | 21 | ||
22 | #include <qclipboard.h> | 22 | #include <qclipboard.h> |
23 | #include <qtoolbar.h> | 23 | #include <qpe/qpetoolbar.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qmenubar.h> | 25 | #include <qpe/qpemenubar.h> |
26 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
27 | #include <qwidgetstack.h> | 27 | #include <qwidgetstack.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qfileinfo.h> | 29 | #include <qfileinfo.h> |
30 | #include <qstring.h> | 30 | #include <qstring.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qdialog.h> | 34 | #include <qdialog.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | 37 | ||
38 | #include "qpdf.h" | 38 | #include "qpdf.h" |
39 | 39 | ||
40 | #ifdef QPDF_QPE_ONLY | 40 | #ifdef QPDF_QPE_ONLY |
41 | #include <qpe/fileselector.h> | 41 | #include <qpe/fileselector.h> |
42 | #else | 42 | #else |
43 | #include <opie/ofileselector.h> | 43 | #include <opie/ofileselector.h> |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
47 | int main ( int argc, char **argv ) | 47 | int main ( int argc, char **argv ) |
48 | { | 48 | { |
49 | QPEApplication app ( argc, argv ); | 49 | QPEApplication app ( argc, argv ); |
50 | 50 | ||
51 | // read config file | 51 | // read config file |
52 | globalParams = new GlobalParams ( "" ); | 52 | globalParams = new GlobalParams ( "" ); |
53 | globalParams-> setErrQuiet ( true ); | 53 | globalParams-> setErrQuiet ( true ); |
54 | 54 | ||
55 | QPdfDlg *dlg = new QPdfDlg ( ); | 55 | QPdfDlg *dlg = new QPdfDlg ( ); |
56 | app. showMainDocumentWidget ( dlg ); | 56 | app. showMainDocumentWidget ( dlg ); |
57 | 57 | ||
58 | if (( app. argc ( ) == 3 ) && ( app. argv ( ) [1] == QCString ( "-f" ))) | 58 | if (( app. argc ( ) == 3 ) && ( app. argv ( ) [1] == QCString ( "-f" ))) |
59 | dlg-> openFile ( app. argv ( ) [2] ); | 59 | dlg-> openFile ( app. argv ( ) [2] ); |
60 | 60 | ||
61 | return app. exec ( ); | 61 | return app. exec ( ); |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | QPdfDlg::QPdfDlg ( ) : QMainWindow ( ) | 65 | QPdfDlg::QPdfDlg ( ) : QMainWindow ( ) |
66 | { | 66 | { |
67 | setCaption ( tr( "QPdf" )); | 67 | setCaption ( tr( "QPdf" )); |
68 | setIcon ( Resource::loadPixmap ( "qpdf_icon" )); | 68 | setIcon ( Resource::loadPixmap ( "qpdf_icon" )); |
69 | 69 | ||
70 | m_busy = false; | 70 | m_busy = false; |
71 | 71 | ||
72 | m_doc = 0; | 72 | m_doc = 0; |
73 | m_pages = 0; | 73 | m_pages = 0; |
74 | m_zoom = 72; | 74 | m_zoom = 72; |
75 | m_currentpage = 0; | 75 | m_currentpage = 0; |
76 | 76 | ||
77 | m_fullscreen = false; | 77 | m_fullscreen = false; |
78 | m_renderok = false; | 78 | m_renderok = false; |
79 | 79 | ||
80 | 80 | ||
81 | setToolBarsMovable ( false ); | 81 | setToolBarsMovable ( false ); |
82 | 82 | ||
83 | m_stack = new QWidgetStack ( this ); | 83 | m_stack = new QWidgetStack ( this ); |
84 | m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); | 84 | m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); |
85 | setCentralWidget ( m_stack ); | 85 | setCentralWidget ( m_stack ); |
86 | 86 | ||
87 | m_outdev = new QPEOutputDev ( m_stack ); | 87 | m_outdev = new QPEOutputDev ( m_stack ); |
88 | connect ( m_outdev, SIGNAL( selectionChanged ( const QRect & )), this, SLOT( copyToClipboard ( const QRect & ))); | 88 | connect ( m_outdev, SIGNAL( selectionChanged ( const QRect & )), this, SLOT( copyToClipboard ( const QRect & ))); |
89 | 89 | ||
90 | #ifdef QPDF_QPE_ONLY | 90 | #ifdef QPDF_QPE_ONLY |
91 | m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true ); | 91 | m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true ); |
92 | #else | 92 | #else |
93 | m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true ); | 93 | m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true ); |
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | connect ( m_filesel, SIGNAL( closeMe ( )), this, SLOT( closeFileSelector ( ))); | 96 | connect ( m_filesel, SIGNAL( closeMe ( )), this, SLOT( closeFileSelector ( ))); |
97 | connect ( m_filesel, SIGNAL( fileSelected ( const DocLnk & )), this, SLOT( openFile ( const DocLnk & ))); | 97 | connect ( m_filesel, SIGNAL( fileSelected ( const DocLnk & )), this, SLOT( openFile ( const DocLnk & ))); |
98 | 98 | ||
99 | m_tb_menu = new QToolBar ( this ); | 99 | m_tb_menu = new QToolBar ( this ); |
100 | m_tb_menu-> setHorizontalStretchable ( true ); | 100 | m_tb_menu-> setHorizontalStretchable ( true ); |
101 | 101 | ||
102 | QMenuBar *mb = new QMenuBar ( m_tb_menu ); | 102 | QMenuBar *mb = new QPEMenuBar ( m_tb_menu ); |
103 | 103 | ||
104 | m_pm_zoom = new QPopupMenu ( mb ); | 104 | m_pm_zoom = new QPopupMenu ( mb ); |
105 | m_pm_zoom-> setCheckable ( true ); | 105 | m_pm_zoom-> setCheckable ( true ); |
106 | 106 | ||
107 | mb-> insertItem ( tr( "Zoom" ), m_pm_zoom ); | 107 | mb-> insertItem ( tr( "Zoom" ), m_pm_zoom ); |
108 | 108 | ||
109 | m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 ); | 109 | m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 ); |
110 | m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 ); | 110 | m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 ); |
111 | m_pm_zoom-> insertSeparator ( ); | 111 | m_pm_zoom-> insertSeparator ( ); |
112 | m_pm_zoom-> insertItem ( tr( "50%" ), 50 ); | 112 | m_pm_zoom-> insertItem ( tr( "50%" ), 50 ); |
113 | m_pm_zoom-> insertItem ( tr( "75%" ), 75 ); | 113 | m_pm_zoom-> insertItem ( tr( "75%" ), 75 ); |
114 | m_pm_zoom-> insertItem ( tr( "100%" ), 100 ); | 114 | m_pm_zoom-> insertItem ( tr( "100%" ), 100 ); |
115 | m_pm_zoom-> insertItem ( tr( "125%" ), 125 ); | 115 | m_pm_zoom-> insertItem ( tr( "125%" ), 125 ); |
116 | m_pm_zoom-> insertItem ( tr( "150%" ), 150 ); | 116 | m_pm_zoom-> insertItem ( tr( "150%" ), 150 ); |
117 | m_pm_zoom-> insertItem ( tr( "200%" ), 200 ); | 117 | m_pm_zoom-> insertItem ( tr( "200%" ), 200 ); |
118 | 118 | ||
119 | connect ( m_pm_zoom, SIGNAL( activated ( int )), this, SLOT( setZoom ( int ))); | 119 | connect ( m_pm_zoom, SIGNAL( activated ( int )), this, SLOT( setZoom ( int ))); |
120 | 120 | ||
121 | m_tb_tool = new QToolBar ( this ); | 121 | m_tb_tool = new QPEToolBar ( this ); |
122 | 122 | ||
123 | new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile ( )), m_tb_tool, "open" ); | 123 | new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile ( )), m_tb_tool, "open" ); |
124 | m_tb_tool-> addSeparator ( ); | 124 | m_tb_tool-> addSeparator ( ); |
125 | m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar ( )), m_tb_tool, "find" ); | 125 | m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar ( )), m_tb_tool, "find" ); |
126 | m_to_find-> setToggleButton ( true ); | 126 | m_to_find-> setToggleButton ( true ); |
127 | m_tb_tool-> addSeparator ( ); | 127 | m_tb_tool-> addSeparator ( ); |
128 | m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen ( )), m_tb_tool, "fullscreen" ); | 128 | m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen ( )), m_tb_tool, "fullscreen" ); |
129 | m_to_full-> setToggleButton ( true ); | 129 | m_to_full-> setToggleButton ( true ); |
130 | m_tb_tool-> addSeparator ( ); | 130 | m_tb_tool-> addSeparator ( ); |
131 | new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage ( )), m_tb_tool, "first" ); | 131 | new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage ( )), m_tb_tool, "first" ); |
132 | new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage ( )), m_tb_tool, "prev" ); | 132 | new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage ( )), m_tb_tool, "prev" ); |
133 | new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog ( )), m_tb_tool, "goto" ); | 133 | new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog ( )), m_tb_tool, "goto" ); |
134 | new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage ( )), m_tb_tool, "next" ); | 134 | new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage ( )), m_tb_tool, "next" ); |
135 | new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage ( )), m_tb_tool, "last" ); | 135 | new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage ( )), m_tb_tool, "last" ); |
136 | 136 | ||
137 | m_tb_find = new QToolBar ( this ); | 137 | m_tb_find = new QPEToolBar ( this ); |
138 | addToolBar ( m_tb_find, "Search", QMainWindow::Top, true ); | 138 | addToolBar ( m_tb_find, "Search", QMainWindow::Top, true ); |
139 | m_tb_find-> setHorizontalStretchable ( true ); | 139 | m_tb_find-> setHorizontalStretchable ( true ); |
140 | m_tb_find-> hide ( ); | 140 | m_tb_find-> hide ( ); |
141 | 141 | ||
142 | m_findedit = new QLineEdit ( m_tb_find, "findedit" ); | 142 | m_findedit = new QLineEdit ( m_tb_find, "findedit" ); |
143 | m_tb_find-> setStretchableWidget ( m_findedit ); | 143 | m_tb_find-> setStretchableWidget ( m_findedit ); |
144 | connect ( m_findedit, SIGNAL( textChanged ( const QString & )), this, SLOT( findText ( const QString & ))); | 144 | connect ( m_findedit, SIGNAL( textChanged ( const QString & )), this, SLOT( findText ( const QString & ))); |
145 | 145 | ||
146 | new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText ( )), m_tb_find, "findnext" ); | 146 | new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText ( )), m_tb_find, "findnext" ); |
147 | 147 | ||
148 | openFile ( ); | 148 | openFile ( ); |
149 | } | 149 | } |
150 | 150 | ||
151 | QPdfDlg::~QPdfDlg ( ) | 151 | QPdfDlg::~QPdfDlg ( ) |
152 | { | 152 | { |
153 | delete m_doc; | 153 | delete m_doc; |
154 | } | 154 | } |
155 | 155 | ||
156 | // vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com] | 156 | // vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com] |
157 | 157 | ||
158 | void QPdfDlg::resizeEvent ( QResizeEvent * ) | 158 | void QPdfDlg::resizeEvent ( QResizeEvent * ) |
159 | { | 159 | { |
160 | if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( ))) | 160 | if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( ))) |
161 | setFullscreen ( true ); | 161 | setFullscreen ( true ); |
162 | } | 162 | } |
163 | 163 | ||
164 | void QPdfDlg::focusInEvent ( QFocusEvent * ) | 164 | void QPdfDlg::focusInEvent ( QFocusEvent * ) |
165 | { | 165 | { |
166 | if ( m_fullscreen ) | 166 | if ( m_fullscreen ) |
167 | setFullscreen ( true ); | 167 | setFullscreen ( true ); |
168 | } | 168 | } |
169 | 169 | ||
170 | void QPdfDlg::toggleFullscreen ( ) | 170 | void QPdfDlg::toggleFullscreen ( ) |
171 | { | 171 | { |
172 | if ( m_to_full-> isOn ( ) == m_fullscreen ) | 172 | if ( m_to_full-> isOn ( ) == m_fullscreen ) |
173 | m_to_full-> setOn ( !m_fullscreen ); | 173 | m_to_full-> setOn ( !m_fullscreen ); |
174 | 174 | ||
175 | m_fullscreen = !m_fullscreen; | 175 | m_fullscreen = !m_fullscreen; |
176 | setFullscreen ( m_fullscreen ); | 176 | setFullscreen ( m_fullscreen ); |
177 | } | 177 | } |
178 | 178 | ||
179 | void QPdfDlg::setFullscreen ( bool b ) | 179 | void QPdfDlg::setFullscreen ( bool b ) |
180 | { | 180 | { |
181 | static QSize normalsize; | 181 | static QSize normalsize; |
182 | 182 | ||
183 | if ( b ) { | 183 | if ( b ) { |
184 | if ( !normalsize. isValid ( )) | 184 | if ( !normalsize. isValid ( )) |
185 | normalsize = size ( ); | 185 | normalsize = size ( ); |
diff --git a/noncore/unsupported/qpdf/qpdf.h b/noncore/unsupported/qpdf/qpdf.h index 8b3cff9..fd4f013 100644 --- a/noncore/unsupported/qpdf/qpdf.h +++ b/noncore/unsupported/qpdf/qpdf.h | |||
@@ -1,56 +1,56 @@ | |||
1 | #ifndef __QPDF_H__ | 1 | #ifndef __QPDF_H__ |
2 | #define __QPDF_H__ | 2 | #define __QPDF_H__ |
3 | 3 | ||
4 | #include "aconf.h" | 4 | #include "aconf.h" |
5 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | 7 | ||
8 | #define QPDF_QPE_ONLY 1 // ofileselector does not work right currently | 8 | //#define QPDF_QPE_ONLY 1 |
9 | 9 | ||
10 | class QPEOutputDev; | 10 | class QPEOutputDev; |
11 | class PDFDoc; | 11 | class PDFDoc; |
12 | 12 | ||
13 | class DocLnk; | 13 | class DocLnk; |
14 | class FileSelector; | 14 | class FileSelector; |
15 | class OFileSelector; | 15 | class OFileSelector; |
16 | class QWidgetStack; | 16 | class QWidgetStack; |
17 | class QLineEdit; | 17 | class QLineEdit; |
18 | 18 | ||
19 | 19 | ||
20 | class QPdfDlg : public QMainWindow { | 20 | class QPdfDlg : public QMainWindow { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | QPdfDlg ( ); | 24 | QPdfDlg ( ); |
25 | virtual ~QPdfDlg ( ); | 25 | virtual ~QPdfDlg ( ); |
26 | 26 | ||
27 | public slots: | 27 | public slots: |
28 | void firstPage ( ); | 28 | void firstPage ( ); |
29 | void prevPage ( ); | 29 | void prevPage ( ); |
30 | void nextPage ( ); | 30 | void nextPage ( ); |
31 | void lastPage ( ); | 31 | void lastPage ( ); |
32 | 32 | ||
33 | void gotoPage ( int n ); | 33 | void gotoPage ( int n ); |
34 | 34 | ||
35 | void setZoom ( int z ); | 35 | void setZoom ( int z ); |
36 | 36 | ||
37 | void gotoPageDialog ( ); | 37 | void gotoPageDialog ( ); |
38 | 38 | ||
39 | void toggleFullscreen ( ); | 39 | void toggleFullscreen ( ); |
40 | void toggleFindBar ( ); | 40 | void toggleFindBar ( ); |
41 | 41 | ||
42 | void findText ( const QString & ); | 42 | void findText ( const QString & ); |
43 | void findText ( ); | 43 | void findText ( ); |
44 | 44 | ||
45 | void openFile ( ); | 45 | void openFile ( ); |
46 | void openFile ( const QString & ); | 46 | void openFile ( const QString & ); |
47 | void openFile ( const DocLnk & ); | 47 | void openFile ( const DocLnk & ); |
48 | 48 | ||
49 | void setDocument ( const QString & ); | 49 | void setDocument ( const QString & ); |
50 | 50 | ||
51 | private slots: | 51 | private slots: |
52 | void delayedInit ( ); | 52 | void delayedInit ( ); |
53 | void closeFileSelector ( ); | 53 | void closeFileSelector ( ); |
54 | 54 | ||
55 | void updateCaption ( ); | 55 | void updateCaption ( ); |
56 | 56 | ||