[oe-commits] org.oe.dev uqtreader: a lot of fixes and improvements

polyonymous commit openembedded-commits at lists.openembedded.org
Sun Jun 10 20:18:34 UTC 2007


uqtreader: a lot of fixes and improvements
- removed opie inheritance
- replaced hardcoded dirs with sane variables
- new and better patch that fixes quite a few issues

Author: polyonymous at openembedded.org
Branch: org.openembedded.dev
Revision: 1eb1e872a6abb77435533ba52aa27b94003eb434
ViewMTN: http://monotone.openembedded.org/revision.psp?id=1eb1e872a6abb77435533ba52aa27b94003eb434
Files:
1
packages/opie-reader/files/qt4.patch
packages/opie-reader/uqtreader_cvs.bb
Diffs:

#
# mt diff -r891a91edde2e1aad2c4999d024dde83b15785699 -r1eb1e872a6abb77435533ba52aa27b94003eb434
#
# 
# 
# patch "packages/opie-reader/files/qt4.patch"
#  from [643bce9ce388124e6f490f8070d8a481d6a0192e]
#    to [72ce442785fbf74663b7bbcfe3f016c55cb22957]
# 
# patch "packages/opie-reader/uqtreader_cvs.bb"
#  from [41cadc7ecb1fb1639efc6ee038608e24926313b3]
#    to [8403c9a2b21f0d9505daa16ba0afa062cdd3e607]
# 
============================================================
--- packages/opie-reader/files/qt4.patch	643bce9ce388124e6f490f8070d8a481d6a0192e
+++ packages/opie-reader/files/qt4.patch	72ce442785fbf74663b7bbcfe3f016c55cb22957
@@ -27,20 +27,36 @@ diff --git a/BuffDoc.cpp b/BuffDoc.cpp
  
  Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p)
 diff --git a/BuffDoc.cpp b/BuffDoc.cpp
-index 355d14d..8c1eadc 100644
+index 355d14d..170ed43 100644
 --- a/BuffDoc.cpp
 +++ b/BuffDoc.cpp
-@@ -682,7 +682,8 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
+@@ -23,6 +23,8 @@
+ #include "Reb.h"
  #endif
-   codecpath += "/plugins/reader/codecs";
+ 
++#include "uqtcommon.h"
++
+ 
+ linkType BuffDoc::hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm)
+ {
+@@ -674,35 +676,19 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
+     }
+     //        //qDebug("Doing final open:%x:%x",exp,filt);
  #else
+-#ifdef USEQPE
+-#ifdef OPIE
+-  QString codecpath(getenv("OPIEDIR"));
+-#else
+-  QString codecpath(getenv("QTDIR"));
+-#endif
+-  codecpath += "/plugins/reader/codecs";
+-#else
 -  QString codecpath(getenv("READERDIR"));
-+  const char *rd = getenv("READERDIR");
-+  QString codecpath(rd?rd:"/usr/lib/uqtreader");
-   codecpath += "/codecs";
- #endif
-   QDir d(codecpath, "*.so");
-@@ -690,19 +691,14 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
+-  codecpath += "/codecs";
+-#endif
+-  QDir d(codecpath, "*.so");
++  QDir d(uqt_codecspath(), "*.so");
+ 
    if (d.exists())
      {
  
@@ -217,19 +233,37 @@ diff --git a/CFilter.cpp b/CFilter.cpp
      QComboBox* colorbox;
   public:
 diff --git a/CFilter.cpp b/CFilter.cpp
-index a4ea60a..4baa890 100644
+index a4ea60a..84fa451 100644
 --- a/CFilter.cpp
 +++ b/CFilter.cpp
-@@ -673,7 +673,8 @@ ExternFilter::ExternFilter(const QString& nm, const QString& optional) : filt(NU
- #endif
-   filterpath += "/plugins/reader/filters/lib";
- #else
+@@ -9,6 +9,7 @@
+ #include "CDrawBuffer.h"
+ #include "CFilter.h"
+ #include "hrule.h"
++#include "uqtcommon.h"
+ 
+ #include <qregexp.h>
+ #include <qimage.h>
+@@ -665,17 +666,8 @@ class ErrorFilter : public CFilter
+ #ifndef __STATIC
+ ExternFilter::ExternFilter(const QString& nm, const QString& optional) : filt(NULL), handle(NULL)
+ {
+-#ifdef USEQPE
+-#ifdef OPIE
+-  QString filterpath(getenv("OPIEDIR"));
+-#else
+-  QString filterpath(getenv("QTDIR"));
+-#endif
+-  filterpath += "/plugins/reader/filters/lib";
+-#else
 -  QString filterpath(getenv("READERDIR"));
-+  const char *rd = getenv("READERDIR");
-+  QString filterpath(rd?rd:"/usr/lib/uqtreader");
-   filterpath += "/filters/lib";
- #endif
+-  filterpath += "/filters/lib";
+-#endif
++  QString filterpath = uqt_filterspath();
++  filterpath += "lib";
    filterpath += nm;
+   filterpath += ".so";
+   if (QFile::exists(filterpath))
 diff --git a/CHM.cpp b/CHM.cpp
 index ace5abc..3c325bb 100644
 --- a/CHM.cpp
@@ -281,7 +315,7 @@ diff --git a/FontControl.cpp b/FontContr
  class QVBoxLayout; 
  class QHBoxLayout; 
 diff --git a/FontControl.cpp b/FontControl.cpp
-index 08b8c52..b80dd6e 100644
+index 08b8c52..0be54ba 100644
 --- a/FontControl.cpp
 +++ b/FontControl.cpp
 @@ -1,4 +1,5 @@
@@ -302,6 +336,63 @@ index 08b8c52..b80dd6e 100644
      if (sizes.count() == 0)
      {
  	return false;
+@@ -65,3 +66,25 @@ bool FontControl::ChangeFont(QString& n, int tgt)
+     }
+     return true;
+ }
++
++void FontControl::setCourier() {
++    setCourier(m_fontname);
++}
++void FontControl::setCourier(const QString fn) {
++    QFontDatabase fdb;
++    QStringList fl = fdb.families();
++    setCourier(fn,fl);
++}
++void FontControl::setCourier(const QString fn,const QStringList fl) {
++    QString fp;
++    int sp = fn.indexOf(' ');
++    if(sp>=0) fp = fn.left(sp);
++    for(QStringList::const_iterator i=fl.begin();i!=fl.end();++i) {
++	if(
++		( i->startsWith(fn,Qt::CaseInsensitive)
++		 || ( (!fp.isEmpty()) && i->startsWith(fp,Qt::CaseInsensitive) ) )
++		&& ( i->endsWith("mono",Qt::CaseInsensitive)
++		    || i->endsWith("Fixed") ) )
++	    hasCourier(true,*i);
++    }
++}
+diff --git a/FontControl.h b/FontControl.h
+index 563e1a8..c7a54ab 100644
+--- a/FontControl.h
++++ b/FontControl.h
+@@ -2,6 +2,7 @@
+ #define __FONTCONTROL_H
+ 
+ #include <qfontmetrics.h>
++#include <QFontDatabase>
+ #include "StyleConsts.h"
+ 
+ class FontControl
+@@ -32,6 +33,7 @@ class FontControl
+       m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0), m_fixgraphics(true)
+     {
+ 	ChangeFont(n, size);
++	setCourier();
+     }
+     ~FontControl()
+ 	{
+@@ -167,6 +169,10 @@ class FontControl
+ 	{
+ 	    return m_extraspace;
+ 	}
++
++    void setCourier();
++    void setCourier(const QString fn);
++    void setCourier(const QString fn,const QStringList fl);
+ };
+ 
+ #endif
 diff --git a/GraphicWin.h b/GraphicWin.h
 index 70d5f7e..a6c556a 100644
 --- a/GraphicWin.h
@@ -335,10 +426,18 @@ diff --git a/Prefs.cpp b/Prefs.cpp
        m_picture = new QWidget(viewport());
        addChild(m_picture);
 diff --git a/Prefs.cpp b/Prefs.cpp
-index 6c4d45b..f3df856 100644
+index 6c4d45b..d20dc00 100644
 --- a/Prefs.cpp
 +++ b/Prefs.cpp
-@@ -27,6 +27,7 @@
+@@ -7,6 +7,7 @@
+ ** WARNING! All changes made in this file will be lost!
+ ****************************************************************************/
+ #include "Prefs.h"
++#include "uqtcommon.h"
+ 
+ #include <stdlib.h>
+ 
+@@ -27,6 +28,7 @@
  #include <qpe/menubutton.h>
  #endif
  #include <qfontdatabase.h>
@@ -346,7 +445,7 @@ index 6c4d45b..f3df856 100644
  
  #ifdef USECOMBO
  void populate_colours(QComboBox *mb)
-@@ -58,7 +59,7 @@ CLayoutPrefs::CLayoutPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -58,7 +60,7 @@ CLayoutPrefs::CLayoutPrefs( QWidget* parent,  const char* name, WFlags fl )
      : QWidget( parent, name, fl )
  {
      QHBoxLayout* hb = new QHBoxLayout(this);
@@ -355,7 +454,7 @@ index 6c4d45b..f3df856 100644
      hb->addWidget(bg);
  
      StripCR = new QCheckBox( bg );
-@@ -592,7 +593,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -592,7 +594,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
      vl->setMargin( 0 );
      hl->setMargin( 0 );
  
@@ -364,7 +463,7 @@ index 6c4d45b..f3df856 100644
      hl->addWidget( gb );
  
      annotation = new QCheckBox( gb );
-@@ -607,7 +608,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -607,7 +609,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
      boutput = new QCheckBox( gb );
      boutput->setText( tr( "Output" ) );
  
@@ -373,7 +472,7 @@ index 6c4d45b..f3df856 100644
      hl->addWidget( bg );
  
      Depluck = new QCheckBox( bg );
-@@ -618,7 +619,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -618,7 +620,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
  
      Continuous = new QCheckBox( bg );
      Continuous->setText( tr( "Continuous" ) );
@@ -382,7 +481,7 @@ index 6c4d45b..f3df856 100644
      vl->addWidget( bg );
  
  //    QLabel* TextLabel = new QLabel( bg );
-@@ -662,7 +663,7 @@ CScrollPrefs::CScrollPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -662,7 +664,7 @@ CScrollPrefs::CScrollPrefs( QWidget* parent,  const char* name, WFlags fl )
  
      hl->setMargin( 0 );
  
@@ -391,17 +490,28 @@ index 6c4d45b..f3df856 100644
      hl->addWidget( bg );
  
      //    scrollinplace = new QCheckBox( bg );
-@@ -715,7 +716,8 @@ CScrollPrefs::CScrollPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -707,18 +709,8 @@ CScrollPrefs::CScrollPrefs( QWidget* parent,  const char* name, WFlags fl )
+ #else
+     outcodec = new MenuButton( this);
  #endif
-       codecpath += "/plugins/reader/outcodecs";
- #else
+-#ifdef USEQPE
+-#ifdef OPIE
+-      QString codecpath(getenv("OPIEDIR"));
+-#else
+-      QString codecpath(getenv("QTDIR"));
+-#endif
+-      codecpath += "/plugins/reader/outcodecs";
+-#else
 -      QString codecpath(getenv("READERDIR"));
-+      const char *rd = getenv("READERDIR");
-+      QString codecpath(rd?rd:"/usr/lib/uqtreader");
-       codecpath += "/outcodecs";
- #endif
-       QDir ocd(codecpath, "lib*.so");
-@@ -772,7 +774,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
+-      codecpath += "/outcodecs";
+-#endif
+-      QDir ocd(codecpath, "lib*.so");
++    QString codecpath = uqt_outcodecspath();
++      QDir ocd(uqt_outcodecspath(), "lib*.so");
+       for (int i = 0; i < ocd.count(); ++i)
+ 	{
+ 	  QString tmp(ocd[i]);
+@@ -772,7 +764,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
  {
      QHBoxLayout* hb = new QHBoxLayout(this);
  
@@ -410,7 +520,7 @@ index 6c4d45b..f3df856 100644
  
      hb->addWidget(gb);
  
-@@ -784,7 +786,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -784,7 +776,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
      TextLabel = new QLabel( gb );
      TextLabel->setText( tr( "Ideogram Width" ) );
      ideogramwidth = new QSpinBox( gb );
@@ -419,7 +529,7 @@ index 6c4d45b..f3df856 100644
      ideogramwidth->setRange(1,200);
  
      propfontchange = new QCheckBox( gb );
-@@ -809,7 +811,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
+@@ -809,7 +801,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
  
      QVBoxLayout* vb = new QVBoxLayout;
  
@@ -530,7 +640,7 @@ diff --git a/QTReaderApp.cpp b/QTReaderA
  
  class CDrawBuffer;
 diff --git a/QTReaderApp.cpp b/QTReaderApp.cpp
-index b985094..b525435 100644
+index b985094..529ec9e 100644
 --- a/QTReaderApp.cpp
 +++ b/QTReaderApp.cpp
 @@ -20,7 +20,9 @@
@@ -538,7 +648,7 @@ index b985094..b525435 100644
  #include <qregexp.h>
  #include <qclipboard.h>
 -#include <qwidgetstack.h>
-+#include <Qt3Support/Q3WidgetStack>
++#include <QStackedWidget>
 +#include <Qt3Support/Q3Action>
 +#include <qdesktopwidget.h>
  #ifdef USEQPE
@@ -559,17 +669,35 @@ index b985094..b525435 100644
  #include <qstatusbar.h>
  #ifdef USEQPE
  #include <qpe/global.h>
-@@ -106,7 +107,8 @@ bool CheckVersion(int&, int&, char&, QWidget*);
- //#define PICDIR "/home/tim/uqtreader/pics/"
- QString picdir()
- {
+@@ -66,6 +67,7 @@
+ #include "FixedFont.h"
+ #include "URLDialog.h"
+ #include "util.h"
++#include "uqtcommon.h"
+ #include <qfontdatabase.h>
+ 
+ #ifdef USEQPE
+@@ -103,18 +105,10 @@ bool CheckVersion(int&, int&, char&, QWidget*);
+ #define USEMSGS
+ #define PICDIR "opie-reader/"
+ #else
+-//#define PICDIR "/home/tim/uqtreader/pics/"
+-QString picdir()
+-{
 -  QString hd(getenv("READERDIR"));
-+    const char *rd = getenv("READERDIR");
-+  QString hd(rd?rd:"/usr/share/uqtreader");
-   return hd + "/pics";
- }
- #define PICDIR picdir()
-@@ -156,16 +158,9 @@ void QTReaderApp::listBkmkFiles()
+-  return hd + "/pics";
+-}
+-#define PICDIR picdir()
++#define PICDIR uqt_picspath()
+ #endif
+ #endif
+ 
+-unsigned long QTReaderApp::m_uid = 0;
+-
+ void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
+ 
+ #ifdef USEQPE
+@@ -156,16 +150,9 @@ void QTReaderApp::listBkmkFiles()
          d.setFilter( QDir::Files | QDir::NoSymLinks );
  //        d.setSorting( QDir::Size | QDir::Reversed );
  
@@ -589,8 +717,17 @@ index b985094..b525435 100644
   
  #else /* USEQPE */
      int cnt = 0;
-@@ -207,6 +202,8 @@ void QTReaderApp::hidetoolbars()
+@@ -192,7 +179,7 @@ void QTReaderApp::listBkmkFiles()
+ //tjw        menu->hide();
  
+ 
+-        editorStack->raiseWidget( bkmkselector );
++        editorStack->setCurrentWidget( bkmkselector );
+         hidetoolbars();
+ 	m_nBkmkAction = cRmBkmkFile;
+       }
+@@ -207,6 +194,8 @@ void QTReaderApp::hidetoolbars()
+ 
  #if defined(USEQPE)
      menubar->hide();
 +#else
@@ -598,7 +735,7 @@ index b985094..b525435 100644
  #endif
  
      if (m_scrollbar != NULL) m_scrollbar->hide();
-@@ -233,7 +230,7 @@ void QTReaderApp::hidetoolbars()
+@@ -233,7 +222,7 @@ void QTReaderApp::hidetoolbars()
  }
  
  QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
@@ -607,7 +744,7 @@ index b985094..b525435 100644
        fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false)
  {
    {
-@@ -337,41 +334,41 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
+@@ -337,41 +326,41 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
  //    QToolBar* markBar = new QToolBar("File", this);
  
  #if defined(USEQPE)
@@ -658,18 +795,63 @@ index b985094..b525435 100644
      connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
      a->addTo( bar );
      a->addTo( file );
-@@ -384,7 +381,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
+@@ -379,34 +368,35 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
+     QWidget* widge = new QWidget(this);
+     setCentralWidget( widge );
+     QVBoxLayout* vlayout = new QVBoxLayout(widge);
++    vlayout->setMargin(0);
+     m_layout = new QBoxLayout(QBoxLayout::LeftToRight);
+     m_prog = new QLabel(widge);
      vlayout->addLayout(m_layout, 1);
      vlayout->addWidget(m_prog);
  
 -    editorStack = new QWidgetStack( widge );
-+    editorStack = new Q3WidgetStack( widge );
++    editorStack = new QStackedWidget( widge );
      //    setCentralWidget( editorStack );
  
      searchVisible = FALSE;
-@@ -574,137 +571,137 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
+     regVisible = FALSE;
+     m_fontVisible = false;
+ 
+-    m_buttonprefs = new CButtonPrefs(&kmap, this);
+-    editorStack->addWidget(m_buttonprefs, get_unique_id());
++    m_buttonprefs = new CButtonPrefs(&kmap, editorStack);
++    editorStack->addWidget(m_buttonprefs);
+     connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
+ 
+ 
+     m_annoWin = new CAnnoEdit(editorStack);
+-    editorStack->addWidget(m_annoWin, get_unique_id());
++    editorStack->addWidget(m_annoWin);
+     connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) );
+     connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) );
+ 
+     m_infoWin = new infowin(editorStack);
+-    editorStack->addWidget(m_infoWin, get_unique_id());
++    editorStack->addWidget(m_infoWin);
+     connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
+ 
+     m_graphicwin = new GraphicWin(editorStack);
+-    editorStack->addWidget(m_graphicwin, get_unique_id());
++    editorStack->addWidget(m_graphicwin);
+     connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
+ 
+ //    bkmkselector = new QListBox(editorStack, "Bookmarks");
+@@ -414,7 +404,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
+     //    connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
+     connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) );
+     connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) );
+-    editorStack->addWidget( bkmkselector, get_unique_id() );
++    editorStack->addWidget( bkmkselector);
+ 
+ /*
+     importSelector = new FileSelector( "*", editorStack, "importselector", false );
+@@ -572,139 +562,139 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
+     connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) );
+     connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) );
      connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap()));
-     editorStack->addWidget( reader, get_unique_id() );
+-    editorStack->addWidget( reader, get_unique_id() );
++    editorStack->addWidget( reader );
  
 -    m_preferences_action = new QAction( tr( "Config%s
>>> DIFF TRUNCATED @ 16K






More information about the Openembedded-commits mailing list