summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-01-23 13:26:21 (UTC)
committer mickeyl <mickeyl>2003-01-23 13:26:21 (UTC)
commit6464e96567a07c3104b31292e8a23945b13d0da6 (patch) (unidiff)
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
@@ -119,65 +119,65 @@ void Bkmk::setAnno(unsigned char* t, unsigned short len)
119 memcpy(m_anno, t, m_annolen); 119 memcpy(m_anno, t, m_annolen);
120 } 120 }
121 else 121 else
122 { 122 {
123 m_annolen = sizeof(tchar); 123 m_annolen = sizeof(tchar);
124 m_anno = new unsigned char[m_annolen]; 124 m_anno = new unsigned char[m_annolen];
125 *((tchar*)m_anno) = 0; 125 *((tchar*)m_anno) = 0;
126 } 126 }
127} 127}
128 128
129void Bkmk::setAnno(tchar* t) 129void Bkmk::setAnno(tchar* t)
130{ 130{
131 if (m_anno != NULL) 131 if (m_anno != NULL)
132 { 132 {
133 delete [] m_anno; 133 delete [] m_anno;
134 m_anno = NULL; 134 m_anno = NULL;
135 } 135 }
136 if (t != NULL) 136 if (t != NULL)
137 { 137 {
138 unsigned short len = ustrlen(t)+1; 138 unsigned short len = ustrlen(t)+1;
139 m_annolen = sizeof(tchar)*len; 139 m_annolen = sizeof(tchar)*len;
140 m_anno = new unsigned char[m_annolen]; 140 m_anno = new unsigned char[m_annolen];
141 memcpy(m_anno, t, m_annolen); 141 memcpy(m_anno, t, m_annolen);
142 } 142 }
143 else 143 else
144 { 144 {
145 m_annolen = sizeof(tchar); 145 m_annolen = sizeof(tchar);
146 m_anno = new unsigned char[m_annolen]; 146 m_anno = new unsigned char[m_annolen];
147 *((tchar*)m_anno) = 0; 147 *((tchar*)m_anno) = 0;
148 } 148 }
149} 149}
150 150
151BkmkFile::BkmkFile(const char *fnm, bool w = false) 151BkmkFile::BkmkFile(const char *fnm, bool w)
152 : 152 :
153 wt(w), isUpgraded(false) 153 wt(w), isUpgraded(false)
154{ 154{
155 if (w) 155 if (w)
156 { 156 {
157 f = fopen(fnm, "wb"); 157 f = fopen(fnm, "wb");
158 } 158 }
159 else 159 else
160 { 160 {
161 f = fopen(fnm, "rb"); 161 f = fopen(fnm, "rb");
162 } 162 }
163} 163}
164 164
165BkmkFile::~BkmkFile() 165BkmkFile::~BkmkFile()
166{ 166{
167 if (f != NULL) fclose(f); 167 if (f != NULL) fclose(f);
168} 168}
169 169
170void BkmkFile::write(const Bkmk& b) 170void BkmkFile::write(const Bkmk& b)
171{ 171{
172 if (f != NULL) 172 if (f != NULL)
173 { 173 {
174 fwrite(&b.m_namelen, sizeof(b.m_namelen),1,f); 174 fwrite(&b.m_namelen, sizeof(b.m_namelen),1,f);
175 fwrite(b.m_name,1,b.m_namelen,f); 175 fwrite(b.m_name,1,b.m_namelen,f);
176 fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f); 176 fwrite(&b.m_annolen, sizeof(b.m_annolen),1,f);
177 fwrite(b.m_anno,1,b.m_annolen,f); 177 fwrite(b.m_anno,1,b.m_annolen,f);
178 fwrite(&b.m_position,sizeof(b.m_position),1,f); 178 fwrite(&b.m_position,sizeof(b.m_position),1,f);
179 } 179 }
180} 180}
181 181
182void BkmkFile::write(CList<Bkmk>& bl) 182void BkmkFile::write(CList<Bkmk>& bl)
183{ 183{
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 @@
1#include "CBuffer.h" 1#include "CBuffer.h"
2 2
3CBufferBase& CBufferBase::assign(const void* sztmp, size_t ms) 3CBufferBase& CBufferBase::assign(const void* sztmp, size_t ms)
4{ 4{
5 if (ms*membersize > len) 5 if (ms*membersize > len)
6 { 6 {
7 delete [] buffer; 7 delete [] buffer;
8 buffer = new unsigned char[len = ms*membersize]; 8 buffer = new unsigned char[len = ms*membersize];
9 } 9 }
10 memcpy(buffer, sztmp, ms*membersize); 10 memcpy(buffer, sztmp, ms*membersize);
11 return *this; 11 return *this;
12} 12}
13 13
14CBufferBase::CBufferBase(size_t ms, size_t n = 16) : len(n), membersize(ms) 14CBufferBase::CBufferBase(size_t ms, size_t n) : len(n), membersize(ms)
15{ 15{
16 buffer = new unsigned char[len*membersize]; 16 buffer = new unsigned char[len*membersize];
17 memset(buffer, 0, len*membersize); 17 memset(buffer, 0, len*membersize);
18} 18}
19 19
20void* CBufferBase::operator[](int i) 20void* CBufferBase::operator[](int i)
21{ 21{
22 if ((i+1)*membersize > len) 22 if ((i+1)*membersize > len)
23 { 23 {
24 unsigned char* oldbuffer = buffer; 24 unsigned char* oldbuffer = buffer;
25 buffer = new unsigned char[(i+1)*membersize]; 25 buffer = new unsigned char[(i+1)*membersize];
26 memcpy(buffer, oldbuffer, len); 26 memcpy(buffer, oldbuffer, len);
27 memset(buffer+len, 0, (i+1)*membersize-len); 27 memset(buffer+len, 0, (i+1)*membersize-len);
28 len = (i+1)*membersize; 28 len = (i+1)*membersize;
29 delete [] oldbuffer; 29 delete [] oldbuffer;
30 } 30 }
31 return buffer+i*membersize; 31 return buffer+i*membersize;
32} 32}
33 33
34size_t CBufferBase::bstrlen(unsigned char* _buffer = NULL) 34size_t CBufferBase::bstrlen(unsigned char* _buffer)
35{ 35{
36 if (_buffer == NULL) _buffer = buffer; 36 if (_buffer == NULL) _buffer = buffer;
37 unsigned char* zero = new unsigned char[membersize]; 37 unsigned char* zero = new unsigned char[membersize];
38 memset(zero,0,membersize); 38 memset(zero,0,membersize);
39 unsigned char* element = _buffer; 39 unsigned char* element = _buffer;
40 while (memcmp(element, zero, membersize) != 0) 40 while (memcmp(element, zero, membersize) != 0)
41 { 41 {
42 element += membersize; 42 element += membersize;
43 } 43 }
44 delete [] zero; 44 delete [] zero;
45 return (element - _buffer)/membersize; 45 return (element - _buffer)/membersize;
46} 46}
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
@@ -7,86 +7,86 @@
7** program may be used, distributed and modified without limitation. 7** program may be used, distributed and modified without limitation.
8** 8**
9*****************************************************************************/ 9*****************************************************************************/
10 10
11#include <qpainter.h> 11#include <qpainter.h>
12#include "config.h" 12#include "config.h"
13#include "QTReader.h" 13#include "QTReader.h"
14#include "QTReaderApp.h" 14#include "QTReaderApp.h"
15#include "CDrawBuffer.h" 15#include "CDrawBuffer.h"
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <math.h> 17#include <math.h>
18#include <ctype.h> 18#include <ctype.h>
19#include <stdio.h> //for sprintf 19#include <stdio.h> //for sprintf
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qpe/applnk.h> 21#include <qpe/applnk.h>
22#include <qfontdatabase.h> 22#include <qfontdatabase.h>
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include "StateData.h" 25#include "StateData.h"
26 26
27#ifdef _UNICODE 27#ifdef _UNICODE
28const char *QTReader::fonts[] = { "unifont", "Courier", "Times", 0 }; 28const char *QTReader::fonts[] = { "unifont", "Courier", "Times", 0 };
29#else 29#else
30const char *QTReader::fonts[] = { "Helvetica", "Courier", "Times", 0 }; 30const char *QTReader::fonts[] = { "Helvetica", "Courier", "Times", 0 };
31#endif 31#endif
32//const int QTReader::fontsizes[] = { 8, 10, 12, 14, 18, 24, 30, 40, 50, 60, 70, 80, 90, 100, 0 }; 32//const int QTReader::fontsizes[] = { 8, 10, 12, 14, 18, 24, 30, 40, 50, 60, 70, 80, 90, 100, 0 };
33 33
34//const tchar *QTReader::fonts[] = { "unifont", "fixed", "micro", "smoothtimes", "Courier", "Times", 0 }; 34//const tchar *QTReader::fonts[] = { "unifont", "fixed", "micro", "smoothtimes", "Courier", "Times", 0 };
35//const int QTReader::fontsizes[] = {10,16,17,22,0}; 35//const int QTReader::fontsizes[] = {10,16,17,22,0};
36//const tchar *QTReader::fonts[] = { "verdana", "Courier", "Times", 0 }; 36//const tchar *QTReader::fonts[] = { "verdana", "Courier", "Times", 0 };
37//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}; 37//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};
38 38
39QTReader::QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0) : 39QTReader::QTReader( QWidget *parent, const char *name, WFlags f) :
40 QWidget(parent, name, f), 40 QWidget(parent, name, f),
41 m_delay(100), 41 m_delay(100),
42 m_scrolldy1(0), 42 m_scrolldy1(0),
43 m_scrolldy2(0), 43 m_scrolldy2(0),
44 m_autoScroll(false), 44 m_autoScroll(false),
45 //textarray(NULL), 45 //textarray(NULL),
46 //locnarray(NULL), 46 //locnarray(NULL),
47 numlines(0), 47 numlines(0),
48 m_fontname("unifont"), 48 m_fontname("unifont"),
49 m_fm(NULL), 49 m_fm(NULL),
50 mouseUpOn(true), 50 mouseUpOn(true),
51 m_twotouch(true), 51 m_twotouch(true),
52 m_touchone(true), 52 m_touchone(true),
53 bDoUpdates(false), 53 bDoUpdates(false),
54 m_navkeys(true) 54 m_navkeys(true)
55{ 55{
56 m_overlap = 1; 56 m_overlap = 1;
57// init(); 57// init();
58} 58}
59/* 59/*
60QTReader::QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0) : 60QTReader::QTReader( const QString& filename, QWidget *parent, const tchar *name, WFlags f ) :
61 QWidget(parent, name, f), 61 QWidget(parent, name, f),
62 m_textfont(0), 62 m_textfont(0),
63 m_textsize(1), 63 m_textsize(1),
64 textarray(NULL), 64 textarray(NULL),
65 numlines(0), 65 numlines(0),
66 bstripcr(true), 66 bstripcr(true),
67 bunindent(false), 67 bunindent(false),
68 brepara(false), 68 brepara(false),
69 bdblspce(false), 69 bdblspce(false),
70 btight(false), 70 btight(false),
71 bindenter(0), 71 bindenter(0),
72 m_fm(NULL) 72 m_fm(NULL)
73{ 73{
74 init(); 74 init();
75 // qDebug("Load_file(1)"); 75 // qDebug("Load_file(1)");
76 load_file((const tchar*)filename); 76 load_file((const tchar*)filename);
77} 77}
78*/ 78*/
79 79
80long QTReader::real_delay() 80long QTReader::real_delay()
81{ 81{
82 return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing ); 82 return ( 8976 + m_delay ) / ( m_linespacing * m_linespacing );
83} 83}
84 84
85void QTReader::mousePressEvent( QMouseEvent* _e ) 85void QTReader::mousePressEvent( QMouseEvent* _e )
86{ 86{
87 buffdoc.unsuspend(); 87 buffdoc.unsuspend();
88 if (_e->button() == RightButton) 88 if (_e->button() == RightButton)
89 { 89 {
90 mouseUpOn = false; 90 mouseUpOn = false;
91 if (buffdoc.hasnavigation()) 91 if (buffdoc.hasnavigation())
92 { 92 {
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
@@ -2140,65 +2140,65 @@ void QTReaderApp::do_regaction()
2140} 2140}
2141 2141
2142void QTReaderApp::do_settarget(const QString& _txt) 2142void QTReaderApp::do_settarget(const QString& _txt)
2143{ 2143{
2144 int ind = _txt.find('/'); 2144 int ind = _txt.find('/');
2145 if (ind == -1) 2145 if (ind == -1)
2146 { 2146 {
2147 m_targetapp = ""; 2147 m_targetapp = "";
2148 m_targetmsg = ""; 2148 m_targetmsg = "";
2149 QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); 2149 QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename");
2150 } 2150 }
2151 else 2151 else
2152 { 2152 {
2153 m_targetapp = _txt.left(ind); 2153 m_targetapp = _txt.left(ind);
2154 m_targetmsg = _txt.right(_txt.length()-ind-1); 2154 m_targetmsg = _txt.right(_txt.length()-ind-1);
2155 } 2155 }
2156} 2156}
2157 2157
2158void QTReaderApp::setfont() 2158void QTReaderApp::setfont()
2159{ 2159{
2160 for (int i = 1; i <= m_fontSelector->count(); i++) 2160 for (int i = 1; i <= m_fontSelector->count(); i++)
2161 { 2161 {
2162 if (m_fontSelector->text(i) == reader->m_fontname) 2162 if (m_fontSelector->text(i) == reader->m_fontname)
2163 { 2163 {
2164 m_fontSelector->setCurrentItem(i); 2164 m_fontSelector->setCurrentItem(i);
2165 break; 2165 break;
2166 } 2166 }
2167 } 2167 }
2168 m_fontBar->show(); 2168 m_fontBar->show();
2169 m_fontVisible = true; 2169 m_fontVisible = true;
2170} 2170}
2171 2171
2172void QTReaderApp::setfontHelper(const QString& lcn, int size = 0) 2172void QTReaderApp::setfontHelper(const QString& lcn, int size)
2173{ 2173{
2174 if (size == 0) size = reader->m_fontControl.currentsize(); 2174 if (size == 0) size = reader->m_fontControl.currentsize();
2175 QFont f(lcn, 10 /*, QFont::Bold*/); 2175 QFont f(lcn, 10 /*, QFont::Bold*/);
2176 qDebug("bs"); 2176 qDebug("bs");
2177 bkmkselector->setFont( f ); 2177 bkmkselector->setFont( f );
2178 qDebug("re"); 2178 qDebug("re");
2179 regEdit->setFont( f ); 2179 regEdit->setFont( f );
2180 qDebug("se"); 2180 qDebug("se");
2181 searchEdit->setFont( f ); 2181 searchEdit->setFont( f );
2182 qDebug("aw"); 2182 qDebug("aw");
2183 m_annoWin->setFont( f ); 2183 m_annoWin->setFont( f );
2184 reader->m_fontname = lcn; 2184 reader->m_fontname = lcn;
2185 qDebug("cf1"); 2185 qDebug("cf1");
2186 if (!reader->ChangeFont(size)) 2186 if (!reader->ChangeFont(size))
2187 { 2187 {
2188 qDebug("cf2"); 2188 qDebug("cf2");
2189 reader->ChangeFont(size); 2189 reader->ChangeFont(size);
2190 } 2190 }
2191 qDebug("ref"); 2191 qDebug("ref");
2192 reader->refresh(); 2192 reader->refresh();
2193 m_fontBar->hide(); 2193 m_fontBar->hide();
2194 m_fontVisible = false; 2194 m_fontVisible = false;
2195 qDebug("showedit"); 2195 qDebug("showedit");
2196 if (reader->isVisible()) showEditTools(); 2196 if (reader->isVisible()) showEditTools();
2197 qDebug("showeditdone"); 2197 qDebug("showeditdone");
2198} 2198}
2199 2199
2200void QTReaderApp::do_setfont(const QString& lcn) 2200void QTReaderApp::do_setfont(const QString& lcn)
2201{ 2201{
2202 setfontHelper(lcn); 2202 setfontHelper(lcn);
2203} 2203}
2204 2204
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,38 +1,38 @@
1#include "name.h" 1#include "name.h"
2#include "infowin.h" 2#include "infowin.h"
3#include "version.h" 3#include "version.h"
4#include <stdio.h> 4#include <stdio.h>
5 5
6infowin::infowin( QWidget *parent=0, const char *name=0, WFlags f = 0) : 6infowin::infowin( QWidget *parent, const char *name, WFlags f ) :
7 QWidget(parent, name, f) 7 QWidget(parent, name, f)
8{ 8{
9 grid = new QGridLayout(this, 6, 2); 9 grid = new QGridLayout(this, 6, 2);
10 QLabel* l; 10 QLabel* l;
11 l = new QLabel("Compressed file size", this); 11 l = new QLabel("Compressed file size", this);
12 grid->addWidget(l, 0, 0); 12 grid->addWidget(l, 0, 0);
13 fileSize = new QLabel("0", this); 13 fileSize = new QLabel("0", this);
14 fileSize->setAlignment( AlignVCenter | AlignRight ); 14 fileSize->setAlignment( AlignVCenter | AlignRight );
15 grid->addWidget(fileSize, 0, 1); 15 grid->addWidget(fileSize, 0, 1);
16 l = new QLabel("Original text size", this); 16 l = new QLabel("Original text size", this);
17 grid->addWidget(l, 1, 0); 17 grid->addWidget(l, 1, 0);
18 textSize = new QLabel("0", this); 18 textSize = new QLabel("0", this);
19 textSize->setAlignment( AlignVCenter | AlignRight ); 19 textSize->setAlignment( AlignVCenter | AlignRight );
20 grid->addWidget(textSize, 1, 1); 20 grid->addWidget(textSize, 1, 1);
21 l = new QLabel("Compression Ratio", this); 21 l = new QLabel("Compression Ratio", this);
22 grid->addWidget(l, 2, 0); 22 grid->addWidget(l, 2, 0);
23 ratio = new QLabel("0", this); 23 ratio = new QLabel("0", this);
24 grid->addWidget(ratio, 2, 1); 24 grid->addWidget(ratio, 2, 1);
25 ratio->setAlignment( AlignVCenter | AlignRight ); 25 ratio->setAlignment( AlignVCenter | AlignRight );
26 l = new QLabel("Current location", this); 26 l = new QLabel("Current location", this);
27 grid->addWidget(l, 3, 0); 27 grid->addWidget(l, 3, 0);
28 location = new QLabel("0", this); 28 location = new QLabel("0", this);
29 location->setAlignment( AlignVCenter | AlignRight ); 29 location->setAlignment( AlignVCenter | AlignRight );
30 grid->addWidget(location, 3, 1); 30 grid->addWidget(location, 3, 1);
31 l = new QLabel("Per centage read", this); 31 l = new QLabel("Per centage read", this);
32 grid->addWidget(l, 4, 0); 32 grid->addWidget(l, 4, 0);
33 read = new QLabel("0", this); 33 read = new QLabel("0", this);
34 read->setAlignment( AlignVCenter | AlignRight ); 34 read->setAlignment( AlignVCenter | AlignRight );
35 grid->addWidget(read, 4, 1); 35 grid->addWidget(read, 4, 1);
36 char vstr[128]; 36 char vstr[128];
37 sprintf(vstr, PROGNAME " v%u.%u%c (%s)\nA small e-text reader", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE); 37 sprintf(vstr, PROGNAME " v%u.%u%c (%s)\nA small e-text reader", MAJOR, BKMKTYPE, MINOR, RELEASE_TYPE);
38 l = new QLabel(vstr, this); 38 l = new QLabel(vstr, this);