summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-03 11:11:00 (UTC)
committer zecke <zecke>2002-11-03 11:11:00 (UTC)
commitd26f82ea57c70fd0e77eb192f7e133c5f76c2f0f (patch) (side-by-side diff)
tree16240b40b1be5b581dc2fb7e1a0c18239c3dc4fd
parenteac6c5d3a22147d78866122c2f5b89d3fdf6bfc6 (diff)
downloadopie-d26f82ea57c70fd0e77eb192f7e133c5f76c2f0f.zip
opie-d26f82ea57c70fd0e77eb192f7e133c5f76c2f0f.tar.gz
opie-d26f82ea57c70fd0e77eb192f7e133c5f76c2f0f.tar.bz2
Gcc3 compiler fixes again
No default arguments in the implementation please
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/CDrawBuffer.cpp2
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp2
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp2
-rw-r--r--noncore/apps/opie-reader/infowin.cpp2
6 files changed, 7 insertions, 7 deletions
diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp
index 0cb9ea9..30d2881 100644
--- a/noncore/apps/opie-reader/Bkmks.cpp
+++ b/noncore/apps/opie-reader/Bkmks.cpp
@@ -46,97 +46,97 @@ Bkmk& Bkmk::operator=(const Bkmk& rhs)
}
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (rhs.m_name != NULL)
{
int len = ustrlen(rhs.m_name)+1;
m_name = new tchar[len];
for (int i = 0; i < len; i++) m_name[i] = rhs.m_name[i];
}
else
m_name = NULL;
if (rhs.m_anno != NULL)
{
int len = ustrlen(rhs.m_anno)+1;
m_anno = new tchar[len];
for (int i = 0; i < len; i++) m_anno[i] = rhs.m_anno[i];
}
else
m_anno = NULL;
m_position = rhs.m_position;
return *this;
}
bool Bkmk::operator==(const Bkmk& rhs)
{
return (m_position == rhs.m_position && ustrcmp(m_name,rhs.m_name) == 0);
}
void Bkmk::setAnno(tchar* t)
{
if (m_anno != NULL)
{
delete [] m_anno;
m_anno = NULL;
}
if (t != NULL)
{
int len = ustrlen(t)+1;
m_anno = new tchar[len];
for (int i = 0; i < len; i++) m_anno[i] = t[i];
}
else
m_anno = NULL;
}
-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(tchar* nm, tchar* an, const unsigned int& pos)
{
if (f != NULL)
{
unsigned short ln = ustrlen(nm);
fwrite(&ln,sizeof(ln),1,f);
fwrite(nm,sizeof(tchar),ln,f);
ln = ustrlen(an);
fwrite(&ln,sizeof(ln),1,f);
if (ln > 0) fwrite(an,sizeof(tchar),ln,f);
fwrite(&pos,sizeof(pos),1,f);
}
}
void BkmkFile::write(const Bkmk& b) { write(b.name(), b.anno(), b.value()); }
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);
}
}
}
Bkmk* BkmkFile::read()
{
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/CDrawBuffer.cpp b/noncore/apps/opie-reader/CDrawBuffer.cpp
index 2ceb2d5..892456f 100644
--- a/noncore/apps/opie-reader/CDrawBuffer.cpp
+++ b/noncore/apps/opie-reader/CDrawBuffer.cpp
@@ -60,97 +60,97 @@ CDrawBuffer& CDrawBuffer::operator=(const tchar*sztmp)
for (i = 0; sztmp[i] != '\0'; i++) (*this)[i] = sztmp[i];
(*this)[i] = '\0';
len = i;
return *this;
}
void CDrawBuffer::empty()
{
len = 0;
(*this)[0] = 0;
while (!segs.isEmpty()) segs.erase(0);
segs.push_back(textsegment(0,CStyle()));
m_maxstyle = m_ascent = m_descent = m_lineSpacing = 0;
}
void CDrawBuffer::addch(tchar ch, CStyle _style/* = ucFontBase*/)
{
if (len == 0)
{
int thissize = fc->getsize(_style);
m_maxstyle = thissize;
m_ascent = fc->ascent(_style);
m_descent = fc->descent(_style);
m_lineSpacing = fc->lineSpacing(_style);
segs.first().start = 0;
segs.first().style = _style;
}
else if (_style != segs.last().style)
{
int thissize = fc->getsize(_style);
if (thissize > m_maxstyle)
{
m_maxstyle = thissize;
m_ascent = fc->ascent(_style);
m_descent = fc->descent(_style);
m_lineSpacing = fc->lineSpacing(_style);
}
segs.push_back(textsegment(len, _style));
}
(*this)[len++] = ch;
}
void CDrawBuffer::truncate(int n)
{
len = n;
(*this)[n] = 0;
}
-int CDrawBuffer::width(int numchars = -1)
+int CDrawBuffer::width(int numchars)
{
int currentx = 0, end = 0;
QString text = toQString(data());
CList<textsegment>::iterator textstart = segs.begin();
CList<textsegment>::iterator textend = textstart;
do
{
textend++;
end = (textend != segs.end()) ? textend->start : length();
if (numchars >= 0 && end > numchars)
{
end = numchars;
}
CStyle currentstyle = textstart->style;
QFont f(fc->name(), fc->getsize(currentstyle), (currentstyle.isBold()) ? QFont::Bold : QFont::Normal, (currentstyle.isItalic()) );
QString str = text.mid(textstart->start, end-textstart->start);
QFontMetrics fm(f);
currentx += fm.width(str);
textstart = textend;
}
while (textend != segs.end() && end != numchars);
return currentx;
}
void CDrawBuffer::render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scwidth)
{
int currentx = 0;
QString text = toQString(data());
CList<textsegment>::iterator textstart = segs.begin();
StyleType align = textstart->style.getJustify();
switch (align)
{
case CStyle::m_AlignRight:
{
// int linelength = width();
currentx = scwidth - width();
}
break;
case CStyle::m_AlignCentre:
{
// int linelength = width();
currentx = (scwidth - width())/2;
}
break;
case CStyle::m_AlignJustify:
case CStyle::m_AlignLeft:
break;
}
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index e7bfc28..7cf08e5 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -1,86 +1,86 @@
/****************************************************************************
** $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>
#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)
{
m_overlap = 1;
// init();
}
/*
QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) :
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 )
{
if (_e->button() == RightButton)
{
mouseUpOn = false;
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index ef1f4f1..8726df7 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -1664,97 +1664,97 @@ void QTReaderApp::do_regaction()
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();
}
void QTReaderApp::do_settarget(const QString& _txt)
{
int ind = _txt.find('/');
if (ind == -1)
{
m_targetapp = "";
m_targetmsg = "";
QMessageBox::information(this, "OpieReader", "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*/);
bkmkselector->setFont( f );
regEdit->setFont( f );
searchEdit->setFont( f );
m_annoWin->setFont( f );
reader->m_fontname = lcn;
if (!reader->ChangeFont(size))
{
reader->ChangeFont(size);
}
reader->refresh();
m_fontBar->hide();
m_fontVisible = false;
showEditTools();
}
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)
{
diff --git a/noncore/apps/opie-reader/infowin.cpp b/noncore/apps/opie-reader/infowin.cpp
index 9637a62..7b8f280 100644
--- a/noncore/apps/opie-reader/infowin.cpp
+++ b/noncore/apps/opie-reader/infowin.cpp
@@ -1,42 +1,42 @@
#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, "QT Reader 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);
}