summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-01-23 13:26:21 (UTC)
committer mickeyl <mickeyl>2003-01-23 13:26:21 (UTC)
commit6464e96567a07c3104b31292e8a23945b13d0da6 (patch) (side-by-side diff)
tree79f75c9402edab972e099f6bdd7dbd092f370095
parent197b10539409b5650170879b904b9f781294866e (diff)
downloadopie-6464e96567a07c3104b31292e8a23945b13d0da6.zip
opie-6464e96567a07c3104b31292e8a23945b13d0da6.tar.gz
opie-6464e96567a07c3104b31292e8a23945b13d0da6.tar.bz2
g++ 3.2 fixes... repeat after me "I won't repeat default arguments in the definition I have already given in the declaration"
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp2
-rw-r--r--noncore/apps/opie-reader/CBuffer.cpp4
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp4
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp2
-rw-r--r--noncore/apps/opie-reader/infowin.cpp2
5 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp
index 998601a..a8bee13 100644
--- a/noncore/apps/opie-reader/Bkmks.cpp
+++ b/noncore/apps/opie-reader/Bkmks.cpp
@@ -55,193 +55,193 @@ void Bkmk::init(const void* _nm, unsigned short _nmlen, const void* _anno, unsig
}
else
{
m_anno = NULL;
}
m_position = _p;
}
Bkmk::~Bkmk()
{
if (m_name != NULL) delete [] m_name;
m_name = NULL;
if (m_anno != NULL) delete [] m_anno;
m_anno = NULL;
}
Bkmk& Bkmk::operator=(const Bkmk& rhs)
{
if (m_name != NULL)
{
delete [] m_name;
m_name = NULL;
}
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (rhs.m_name != NULL)
{
m_namelen = rhs.m_namelen;
m_name = new unsigned char[m_namelen];
memcpy(m_name, rhs.m_name, m_namelen);
}
else
m_name = NULL;
if (rhs.m_anno != NULL)
{
m_annolen = rhs.m_annolen;
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, rhs.m_anno, m_annolen);
}
else
m_anno = NULL;
m_position = rhs.m_position;
return *this;
}
bool Bkmk::operator==(const Bkmk& rhs)
{
return (m_position == rhs.m_position && (rhs.m_namelen == m_namelen) && memcmp(m_name,rhs.m_name,m_namelen) == 0);
}
void Bkmk::setAnno(unsigned char* t, unsigned short len)
{
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (t != NULL)
{
m_annolen = len;
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, t, m_annolen);
}
else
{
m_annolen = sizeof(tchar);
m_anno = new unsigned char[m_annolen];
*((tchar*)m_anno) = 0;
}
}
void Bkmk::setAnno(tchar* t)
{
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (t != NULL)
{
unsigned short len = ustrlen(t)+1;
m_annolen = sizeof(tchar)*len;
m_anno = new unsigned char[m_annolen];
memcpy(m_anno, t, m_annolen);
}
else
{
m_annolen = sizeof(tchar);
m_anno = new unsigned char[m_annolen];
*((tchar*)m_anno) = 0;
}
}
-BkmkFile::BkmkFile(const char *fnm, bool w = false)
+BkmkFile::BkmkFile(const char *fnm, bool w)
:
wt(w), isUpgraded(false)
{
if (w)
{
f = fopen(fnm, "wb");
}
else
{
f = fopen(fnm, "rb");
}
}
BkmkFile::~BkmkFile()
{
if (f != NULL) fclose(f);
}
void BkmkFile::write(const Bkmk& b)
{
if (f != NULL)
{
fwrite(&b.m_namelen, sizeof(b.m_namelen),1,f);
fwrite(b.m_name,1,b.m_namelen,f);
fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f);
fwrite(b.m_anno,1,b.m_annolen,f);
fwrite(&b.m_position,sizeof(b.m_position),1,f);
}
}
void BkmkFile::write(CList<Bkmk>& bl)
{
if (f != NULL)
{
fwrite(&magic, sizeof(magic), 1, f);
for (CList<Bkmk>::iterator i = bl.begin(); i != bl.end(); i++)
{
write(*i);
}
}
}
CList<Bkmk>* BkmkFile::readall()
{
CList<Bkmk>* bl = NULL;
if (f != NULL)
{
unsigned long newmagic;
fread(&newmagic, sizeof(newmagic), 1, f);
if ((newmagic & 0xffffff00) != (magic & 0xffffff00))
{
if (QMessageBox::warning(NULL, "Old bookmark file!", "Which version of " PROGNAME "\ndid you upgrade from?", "0_4*", "Any other version") == 0)
{
fseek(f,0,SEEK_SET);
bl = readall00(&read05);
}
else
{
fseek(f,0,SEEK_SET);
bl = readall00(&read03);
}
isUpgraded = true;
}
else
{
switch(newmagic & 0xff)
{
case 6:
isUpgraded = false;
bl = readall00(read06);
qDebug("Correct version!");
break;
case 5:
isUpgraded = true;
bl = readall00(read05);
qDebug("Known version!");
break;
default:
qDebug("Unknown version!");
isUpgraded = true;
bl = readall00(read05);
}
}
}
return bl;
}
CList<Bkmk>* BkmkFile::readall00(Bkmk* (*readfn)(FILE*))
{
CList<Bkmk>* bl = new CList<Bkmk>;
while (1)
{
Bkmk* b = (*readfn)(f);
if (b == NULL) break;
bl->push_back(*b);
delete b;
diff --git a/noncore/apps/opie-reader/CBuffer.cpp b/noncore/apps/opie-reader/CBuffer.cpp
index 526b25f..0780a88 100644
--- a/noncore/apps/opie-reader/CBuffer.cpp
+++ b/noncore/apps/opie-reader/CBuffer.cpp
@@ -1,46 +1,46 @@
#include "CBuffer.h"
CBufferBase& CBufferBase::assign(const void* sztmp, size_t ms)
{
if (ms*membersize > len)
{
delete [] buffer;
buffer = new unsigned char[len = ms*membersize];
}
memcpy(buffer, sztmp, ms*membersize);
return *this;
}
-CBufferBase::CBufferBase(size_t ms, size_t n = 16) : len(n), membersize(ms)
+CBufferBase::CBufferBase(size_t ms, size_t n) : len(n), membersize(ms)
{
buffer = new unsigned char[len*membersize];
memset(buffer, 0, len*membersize);
}
void* CBufferBase::operator[](int i)
{
if ((i+1)*membersize > len)
{
unsigned char* oldbuffer = buffer;
buffer = new unsigned char[(i+1)*membersize];
memcpy(buffer, oldbuffer, len);
memset(buffer+len, 0, (i+1)*membersize-len);
len = (i+1)*membersize;
delete [] oldbuffer;
}
return buffer+i*membersize;
}
-size_t CBufferBase::bstrlen(unsigned char* _buffer = NULL)
+size_t CBufferBase::bstrlen(unsigned char* _buffer)
{
if (_buffer == NULL) _buffer = buffer;
unsigned char* zero = new unsigned char[membersize];
memset(zero,0,membersize);
unsigned char* element = _buffer;
while (memcmp(element, zero, membersize) != 0)
{
element += membersize;
}
delete [] zero;
return (element - _buffer)/membersize;
}
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index 3995ee7..f2ee027 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -1,156 +1,156 @@
/****************************************************************************
** $Id$
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of an example program for Qt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
#include <qpainter.h>
#include "config.h"
#include "QTReader.h"
#include "QTReaderApp.h"
#include "CDrawBuffer.h"
#include <qpe/qpeapplication.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h> //for sprintf
#include <qpe/config.h>
#include <qpe/applnk.h>
#include <qfontdatabase.h>
#include <qpe/global.h>
#include <qpe/qcopenvelope_qws.h>
#include "StateData.h"
#ifdef _UNICODE
const char *QTReader::fonts[] = { "unifont", "Courier", "Times", 0 };
#else
const char *QTReader::fonts[] = { "Helvetica", "Courier", "Times", 0 };
#endif
//const int QTReader::fontsizes[] = { 8, 10, 12, 14, 18, 24, 30, 40, 50, 60, 70, 80, 90, 100, 0 };
//const tchar *QTReader::fonts[] = { "unifont", "fixed", "micro", "smoothtimes", "Courier", "Times", 0 };
//const int QTReader::fontsizes[] = {10,16,17,22,0};
//const tchar *QTReader::fonts[] = { "verdana", "Courier", "Times", 0 };
//const int QTReader::fontsizes[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,0};
-QTReader::QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0) :
+QTReader::QTReader( QWidget *parent, const char *name, WFlags f) :
QWidget(parent, name, f),
m_delay(100),
m_scrolldy1(0),
m_scrolldy2(0),
m_autoScroll(false),
//textarray(NULL),
//locnarray(NULL),
numlines(0),
m_fontname("unifont"),
m_fm(NULL),
mouseUpOn(true),
m_twotouch(true),
m_touchone(true),
bDoUpdates(false),
m_navkeys(true)
{
m_overlap = 1;
// init();
}
/*
-QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) :
+QTReader::QTReader( const QString& filename, QWidget *parent, const tchar *name, WFlags f ) :
QWidget(parent, name, f),
m_textfont(0),
m_textsize(1),
textarray(NULL),
numlines(0),
bstripcr(true),
bunindent(false),
brepara(false),
bdblspce(false),
btight(false),
bindenter(0),
m_fm(NULL)
{
init();
// qDebug("Load_file(1)");
load_file((const tchar*)filename);
}
*/
long QTReader::real_delay()
{
return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing );
}
void QTReader::mousePressEvent( QMouseEvent* _e )
{
buffdoc.unsuspend();
if (_e->button() == RightButton)
{
mouseUpOn = false;
if (buffdoc.hasnavigation())
{
if (_e->y() > (2*height())/3)
{
goDown();
}
else if (_e->y() < height()/3)
{
goUp();
}
else
{
if (_e->x() < width()/3)
{
size_t target = pagelocate();
if (buffdoc.back(target))
{
locate(target);
}
}
else if (_e->x() > (2*width())/3)
{
size_t target = pagelocate();
if (buffdoc.forward(target))
{
locate(target);
}
}
else
{
buffdoc.saveposn(pagelocate());
locate(buffdoc.getHome());
}
}
}
else
{
if (_e->y() > height()/2)
{
goDown();
}
else
{
goUp();
}
}
}
}
linkType QTReader::getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt)
{
int lineno = 0;
int ht = textarray[0]->lineSpacing();
while ((ht < y) && (lineno < numlines))
{
ht += textarray[++lineno]->lineSpacing();
}
start = locnarray[lineno];
if (m_bMonoSpaced)
{
offset = x/m_charWidth;
}
else
{
int i;
CDrawBuffer* t = textarray[lineno];
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index 2044b1d..7333a28 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -2076,193 +2076,193 @@ void QTReaderApp::gotobkmk(int ind)
}
void QTReaderApp::cancelbkmk()
{
if (m_nRegAction == cOpenFile)
{
QString fn = usefilebrowser();
if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
}
showEditTools();
}
void QTReaderApp::jump()
{
m_nRegAction = cJump;
char lcn[20];
sprintf(lcn, "%lu", reader->pagelocate());
regEdit->setText(lcn);
do_regedit();
}
void QTReaderApp::do_jump(const QString& lcn)
{
bool ok;
unsigned long ulcn = lcn.toULong(&ok);
if (ok)
reader->locate(ulcn);
else
QMessageBox::information(this, PROGNAME, "Must be a number");
}
void QTReaderApp::do_regaction()
{
reader->bDoUpdates = false;
regBar->hide();
Global::hideInputMethod();
regVisible = false;
switch(m_nRegAction)
{
case cAutoGen:
do_autogen(regEdit->text());
break;
case cAddBkmk:
do_addbkmk(regEdit->text());
break;
case cJump:
do_jump(regEdit->text());
break;
case cMonoSpace:
do_mono(regEdit->text());
break;
case cOverlap:
do_overlap(regEdit->text());
break;
case cSetTarget:
do_settarget(regEdit->text());
break;
}
reader->restore();
// editBar->show();
reader->setFocus();
qApp->processEvents();
reader->bDoUpdates = true;
reader->update();
}
void QTReaderApp::do_settarget(const QString& _txt)
{
int ind = _txt.find('/');
if (ind == -1)
{
m_targetapp = "";
m_targetmsg = "";
QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename");
}
else
{
m_targetapp = _txt.left(ind);
m_targetmsg = _txt.right(_txt.length()-ind-1);
}
}
void QTReaderApp::setfont()
{
for (int i = 1; i <= m_fontSelector->count(); i++)
{
if (m_fontSelector->text(i) == reader->m_fontname)
{
m_fontSelector->setCurrentItem(i);
break;
}
}
m_fontBar->show();
m_fontVisible = true;
}
-void QTReaderApp::setfontHelper(const QString& lcn, int size = 0)
+void QTReaderApp::setfontHelper(const QString& lcn, int size)
{
if (size == 0) size = reader->m_fontControl.currentsize();
QFont f(lcn, 10 /*, QFont::Bold*/);
qDebug("bs");
bkmkselector->setFont( f );
qDebug("re");
regEdit->setFont( f );
qDebug("se");
searchEdit->setFont( f );
qDebug("aw");
m_annoWin->setFont( f );
reader->m_fontname = lcn;
qDebug("cf1");
if (!reader->ChangeFont(size))
{
qDebug("cf2");
reader->ChangeFont(size);
}
qDebug("ref");
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
qDebug("showedit");
if (reader->isVisible()) showEditTools();
qDebug("showeditdone");
}
void QTReaderApp::do_setfont(const QString& lcn)
{
setfontHelper(lcn);
}
void QTReaderApp::do_autogen(const QString& regText)
{
unsigned long fs, ts;
reader->sizes(fs,ts);
// qDebug("Reg:%s\n", (const tchar*)(regEdit->text()));
m_autogenstr = regText;
QRegExp re(regText);
CBuffer buff;
if (pBkmklist != NULL) delete pBkmklist;
pBkmklist = new CList<Bkmk>;
m_fBkmksChanged = true;
pbar->show();
pbar->resize(width(), editBar->height());
pbar->reset();
qApp->processEvents();
reader->setFocus();
reader->jumpto(0);
int lastpc = 0;
int i = 0;
while (i >= 0)
{
unsigned int lcn = reader->locate();
int pc = (100*lcn)/ts;
if (pc != lastpc)
{
pbar->setProgress(pc);
qApp->processEvents();
if (reader->locate() != lcn) reader->jumpto(lcn);
reader->setFocus();
lastpc = pc;
}
i = reader->buffdoc.getpara(buff);
#ifdef _UNICODE
if (re.match(toQString(buff.data())) != -1)
#else
if (re.match(buff.data()) != -1)
#endif
pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn));
}
pBkmklist->sort();
pbar->setProgress(100);
qApp->processEvents();
pbar->hide();
}
void QTReaderApp::saveprefs()
{
// reader->saveprefs("uqtreader");
Config config( APPDIR );
config.setGroup( "View" );
reader->m_lastposn = reader->pagelocate();
config.writeEntry( "StripCr", reader->bstripcr );
config.writeEntry( "AutoFmt", reader->bautofmt );
config.writeEntry( "TextFmt", reader->btextfmt );
config.writeEntry( "StripHtml", reader->bstriphtml );
config.writeEntry( "Dehyphen", reader->bdehyphen );
config.writeEntry( "OneSpace", reader->bonespace );
config.writeEntry( "Unindent", reader->bunindent );
config.writeEntry( "Repara", reader->brepara );
config.writeEntry( "DoubleSpace", reader->bdblspce );
config.writeEntry( "Indent", reader->bindenter );
config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) );
diff --git a/noncore/apps/opie-reader/infowin.cpp b/noncore/apps/opie-reader/infowin.cpp
index 30adebf..459b648 100644
--- a/noncore/apps/opie-reader/infowin.cpp
+++ b/noncore/apps/opie-reader/infowin.cpp
@@ -1,43 +1,43 @@
#include "name.h"
#include "infowin.h"
#include "version.h"
#include <stdio.h>
-infowin::infowin( QWidget *parent=0, const char *name=0, WFlags f = 0) :
+infowin::infowin( QWidget *parent, const char *name, WFlags f ) :
QWidget(parent, name, f)
{
grid = new QGridLayout(this, 6, 2);
QLabel* l;
l = new QLabel("Compressed file size", this);
grid->addWidget(l, 0, 0);
fileSize = new QLabel("0", this);
fileSize->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(fileSize, 0, 1);
l = new QLabel("Original text size", this);
grid->addWidget(l, 1, 0);
textSize = new QLabel("0", this);
textSize->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(textSize, 1, 1);
l = new QLabel("Compression Ratio", this);
grid->addWidget(l, 2, 0);
ratio = new QLabel("0", this);
grid->addWidget(ratio, 2, 1);
ratio->setAlignment( AlignVCenter | AlignRight );
l = new QLabel("Current location", this);
grid->addWidget(l, 3, 0);
location = new QLabel("0", this);
location->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(location, 3, 1);
l = new QLabel("Per centage read", this);
grid->addWidget(l, 4, 0);
read = new QLabel("0", this);
read->setAlignment( AlignVCenter | AlignRight );
grid->addWidget(read, 4, 1);
char vstr[128];
sprintf(vstr, PROGNAME " v%u.%u%c (%s)\nA small e-text reader", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE);
l = new QLabel(vstr, this);
grid->addWidget(l, 5, 0);
QPushButton* exitbutton = new QPushButton("Cancel", this);
connect( exitbutton, SIGNAL( released() ), this, SLOT( infoClose() ) );
grid->addWidget(exitbutton, 5, 1);
}