summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CFilter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/CFilter.cpp b/noncore/apps/opie-reader/CFilter.cpp
index 6d94d70..ab98829 100644
--- a/noncore/apps/opie-reader/CFilter.cpp
+++ b/noncore/apps/opie-reader/CFilter.cpp
@@ -572,193 +572,194 @@ void HighlightFilter::refresh(unsigned long pos)
blue = i->blue();
lastpos = (*i).value();
nextpos = (*i).value2();
break;
}
if ((*i).value() > pos)
{
nextpos = (*i).value();
break;
}
lastpos = (*i).value();
}
}
}
void HighlightFilter::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
parent->getch(ch, sty, pos);
if (bkmks != pReader->Bkmklist() || pos <= lastpos || pos >= nextpos)
{
// qDebug("Recalc <%lu, %lu, %lu>", lastpos, pos, nextpos);
refresh(pos);
// qDebug("Recalc(2) <%lu, %lu, %lu>", lastpos, pos, nextpos);
}
int r = sty.bRed(), g = sty.bGreen(), b = sty.bBlue();
if (r == 255 && g == 255 && b == 255)
{
sty.setBackground(red, green, blue);
}
}
void kern::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (uselast)
{
ch = lastchar;
sty = laststy;
uselast = false;
return;
}
else
{
parent->getch(ch, sty, pos);
}
switch (ch)
{
case 'f':
{
tchar savedchar = 'f';
parent->getch(ch, sty, pos);
switch (ch)
{
case 'i':
ch = (251 << 8) + 1;
break;
case 'l':
ch = (251 << 8) + 2;
break;
default:
lastchar = ch;
uselast = true;
laststy = sty;
ch = savedchar;
}
}
break;
default:
break;
}
}
class ErrorFilter : public CFilter
{
QString error;
int currentpos;
public:
ErrorFilter(const QString& _s) : error(_s), currentpos(0) {}
~ErrorFilter() {}
void getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (currentpos == error.length())
{
ch = UEOF;
currentpos = 0;
}
else
{
ch = error[currentpos++].unicode();
}
}
QString about() { return parent->about(); }
};
#ifndef __STATIC
ExternFilter::ExternFilter(const QString& nm, const QString& optional) : filt(NULL), handle(NULL)
{
- QString filterpath(QTReaderUtil::getPluginPath("filters/lib"));
+ QString filterpath(QTReaderUtil::getPluginPath("filters"));
+ filterpath += "/lib";
filterpath += nm;
filterpath += ".so";
if (QFile::exists(filterpath))
{
qDebug("Filter:%s", (const char*)filterpath);
handle = dlopen(filterpath, RTLD_LAZY);
if (handle == 0)
{
qDebug("Can't find filter:%s", dlerror());
// status = -10;
filt = new ErrorFilter(QString("Can't find plugin:")+nm);
return;
}
CFilter* (*newfilter)(const QString&);
newfilter = (CFilter* (*)(const QString&))dlsym(handle, "newfilter");
if (newfilter == NULL)
{
qDebug("Can't find newfilter");
filt = new ErrorFilter(QString("Can't find entry point in plugin:")+nm);
return;
}
filt = (*newfilter)(optional);
}
else
{
qDebug("No filter path");
filt = new ErrorFilter(QString("No filter plugins installed:")+nm);
}
if (filt == NULL)
{
qDebug("Can't do newfilter");
filt = new ErrorFilter(QString("Filter creation failed:")+nm);
return;
}
}
#endif
void makeInverse::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
parent->getch(ch, sty, pos);
int r,g,b;
r = 255 - sty.Red(), g = 255 - sty.Green(), b = 255 - sty.Blue();
sty.setColour(r,g,b);
r = 255 - sty.bRed(), g = 255 - sty.bGreen(), b = 255 - sty.bBlue();
sty.setBackground(r,g,b);
r = 255 - sty.pRed(), g = 255 - sty.pGreen(), b = 255 - sty.pBlue();
sty.setPaper(r,g,b);
}
/*
void makeNegative::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
parent->getch(ch, sty, pos);
QColor fg(sty.Red(), sty.Green(), sty.Blue());
int h,s,v;
fg.hsv(&h,&s,&v);
fg.setHsv(h,s,255-v);
int r,g,b;
fg.rgb(&r,&g,&b);
sty.setColour(r,g,b);
fg = QColor(sty.bRed(), sty.bGreen(), sty.bBlue());
fg.hsv(&h,&s,&v);
fg.setHsv(h,s,255-v);
fg.rgb(&r,&g,&b);
sty.setBackground(r,g,b);
}
*/
void setbg::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
parent->getch(ch, sty, pos);
int r = sty.pRed(), g = sty.pGreen(), b = sty.pBlue();
if (r == 255 && g == 255 && b == 255)
{
sty.setPaper(m_r,m_g,m_b);
}
else
{
qDebug("We have background [%x%x%x]", r, g, b);
}
r = sty.bRed(), g = sty.bGreen(), b = sty.bBlue();
if (r == 255 && g == 255 && b == 255)
{
sty.setBackground(m_r,m_g,m_b);
}
else
{
qDebug("We have background [%x%x%x]", r, g, b);
}
}
void setfg::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
parent->getch(ch, sty, pos);
int r = sty.Red(), g = sty.Green(), b = sty.Blue();
if (r == 0 && g == 0 && b == 0)
{