author | mjg59 <mjg59> | 2003-12-10 03:57:04 (UTC) |
---|---|---|
committer | mjg59 <mjg59> | 2003-12-10 03:57:04 (UTC) |
commit | becbcfae3bf3b5a714e7d3e39b924e08761739c2 (patch) (unidiff) | |
tree | 7ec5f6f90a9d529858da340150b415d87e7936ba /inputmethods | |
parent | 1f0b92e554b76852af210ceb277b3e9ecb09a43d (diff) | |
download | opie-becbcfae3bf3b5a714e7d3e39b924e08761739c2.zip opie-becbcfae3bf3b5a714e7d3e39b924e08761739c2.tar.gz opie-becbcfae3bf3b5a714e7d3e39b924e08761739c2.tar.bz2 |
Fix the search directory for the training file, remove the (non-working anyway) font size calculation code - with luck, this'll fix the failure to start under Opie
-rw-r--r-- | inputmethods/dasher/QtDasherPlugin.cc | 2 | ||||
-rw-r--r-- | inputmethods/dasher/QtDasherScreen.cc | 13 | ||||
-rw-r--r-- | inputmethods/dasher/QtDasherScreen.h | 9 |
3 files changed, 15 insertions, 9 deletions
diff --git a/inputmethods/dasher/QtDasherPlugin.cc b/inputmethods/dasher/QtDasherPlugin.cc index fe1712e..cf4fc2c 100644 --- a/inputmethods/dasher/QtDasherPlugin.cc +++ b/inputmethods/dasher/QtDasherPlugin.cc | |||
@@ -16,13 +16,13 @@ | |||
16 | #include <qwindowsystem_qws.h> | 16 | #include <qwindowsystem_qws.h> |
17 | 17 | ||
18 | QtDasherPlugin::QtDasherPlugin(QWidget* parent, const char* name, WFlags f) : QFrame(parent,name,f) | 18 | QtDasherPlugin::QtDasherPlugin(QWidget* parent, const char* name, WFlags f) : QFrame(parent,name,f) |
19 | { | 19 | { |
20 | (new QHBoxLayout(this))->setAutoAdd(TRUE); | 20 | (new QHBoxLayout(this))->setAutoAdd(TRUE); |
21 | interface = new CDasherInterface; | 21 | interface = new CDasherInterface; |
22 | interface->SetSystemLocation("/opt/QtPalmtop/share/dasher"); | 22 | interface->SetSystemLocation("/opt/QtPalmtop/share/dasher/"); |
23 | interface->Unpause(0); | 23 | interface->Unpause(0); |
24 | interface->Start(); | 24 | interface->Start(); |
25 | d = new QtDasherScreen(240,100,interface,this,this); | 25 | d = new QtDasherScreen(240,100,interface,this,this); |
26 | interface->ChangeMaxBitRate(2.5); | 26 | interface->ChangeMaxBitRate(2.5); |
27 | d->show(); | 27 | d->show(); |
28 | utf8_codec = new QUtf8Codec; | 28 | utf8_codec = new QUtf8Codec; |
diff --git a/inputmethods/dasher/QtDasherScreen.cc b/inputmethods/dasher/QtDasherScreen.cc index d05ef49..7d77511 100644 --- a/inputmethods/dasher/QtDasherScreen.cc +++ b/inputmethods/dasher/QtDasherScreen.cc | |||
@@ -13,39 +13,42 @@ | |||
13 | #include "DasherScreen.h" | 13 | #include "DasherScreen.h" |
14 | #include "SettingsStore.h" | 14 | #include "SettingsStore.h" |
15 | 15 | ||
16 | #define MAXFONTSIZE 25 | 16 | #define MAXFONTSIZE 25 |
17 | #define MINFONTSIZE 8 | 17 | #define MINFONTSIZE 8 |
18 | 18 | ||
19 | #include <iconv.h> | ||
20 | #include <iostream> | ||
21 | |||
19 | QtDasherScreen::QtDasherScreen (int _width, int _height, | 22 | QtDasherScreen::QtDasherScreen (int _width, int _height, |
20 | CDasherInterface *_interface, | 23 | CDasherInterface *_interface, |
21 | QWidget * _parent, Dasher::CDashEditbox *edit): | 24 | QWidget * _parent, Dasher::CDashEditbox *edit): |
22 | QWidget(_parent), interface( _interface ), | 25 | QWidget(_parent), interface( _interface ), |
23 | fontname( "fixed" ), // fontsize(12), | 26 | fontname( "fixed" ), fontsize(12), |
24 | Dasher::CDasherScreen(_width, _height) | 27 | Dasher::CDasherScreen(_width, _height) |
25 | { | 28 | { |
26 | // font = new QFont (fontname, fontsize); | 29 | font = QFont (fontname.c_str(), fontsize); |
27 | painter = new QPainter (); | 30 | painter = new QPainter (); |
28 | 31 | ||
29 | pixmap = new QPixmap (_width, _height); | 32 | pixmap = new QPixmap (_width, _height); |
30 | pixmap->setOptimization(QPixmap::BestOptim); | 33 | pixmap->setOptimization(QPixmap::BestOptim); |
31 | interface->SetSettingsStore(new CSettingsStore); | 34 | interface->SetSettingsStore(new CSettingsStore); |
32 | 35 | ||
33 | interface->ChangeLanguageModel(0); | 36 | interface->ChangeLanguageModel(0); |
34 | interface->ChangeView(0); | 37 | interface->ChangeView(0); |
35 | interface->ChangeEdit(edit); | 38 | interface->ChangeEdit(edit); |
36 | 39 | ||
37 | interface->GetFontSizes(&FontSizes); | 40 | /* interface->GetFontSizes(&FontSizes); |
38 | 41 | ||
39 | for (int i=0; i<FontSizes.size(); i++) { | 42 | for (int i=0; i<FontSizes.size(); i++) { |
40 | if (FontSizes[i]>Fonts.size()) | 43 | if (FontSizes[i]>Fonts.size()) |
41 | Fonts.resize((FontSizes[i])+1); | 44 | Fonts.resize((FontSizes[i])+1); |
42 | Fonts[FontSizes[i]]= QFont (fontname.c_str(), FontSizes[i]); | 45 | Fonts[FontSizes[i]]= QFont (fontname.c_str(), FontSizes[i]); |
43 | Fonts[FontSizes[i]].setPixelSize(FontSizes[i]); | 46 | // Fonts[FontSizes[i]].setPixelSize(FontSizes[i]); |
44 | } | 47 | } |
45 | 48 | */ | |
46 | interface->ChangeScreen(this); | 49 | interface->ChangeScreen(this); |
47 | 50 | ||
48 | paused=true; | 51 | paused=true; |
49 | 52 | ||
50 | QTimer *tmr = new QTimer(this); | 53 | QTimer *tmr = new QTimer(this); |
51 | connect (tmr, SIGNAL(timeout()), SLOT(timer())); | 54 | connect (tmr, SIGNAL(timeout()), SLOT(timer())); |
diff --git a/inputmethods/dasher/QtDasherScreen.h b/inputmethods/dasher/QtDasherScreen.h index c4d3b59..c029a60 100644 --- a/inputmethods/dasher/QtDasherScreen.h +++ b/inputmethods/dasher/QtDasherScreen.h | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <qcursor.h> | 18 | #include <qcursor.h> |
19 | 19 | ||
20 | #include "DasherScreen.h" | 20 | #include "DasherScreen.h" |
21 | #include "DashEdit.h" | 21 | #include "DashEdit.h" |
22 | #include "DasherInterface.h" | 22 | #include "DasherInterface.h" |
23 | 23 | ||
24 | #include <iconv.h> | ||
25 | |||
24 | using namespace Dasher; | 26 | using namespace Dasher; |
25 | 27 | ||
26 | class QtDasherScreen : public QWidget, public Dasher::CDasherScreen | 28 | class QtDasherScreen : public QWidget, public Dasher::CDasherScreen |
27 | 29 | ||
28 | { | 30 | { |
29 | Q_OBJECT | 31 | Q_OBJECT |
@@ -46,35 +48,36 @@ class QtDasherScreen : public QWidget, public Dasher::CDasherScreen | |||
46 | return (Dasher::Opts::Normal); | 48 | return (Dasher::Opts::Normal); |
47 | } | 49 | } |
48 | 50 | ||
49 | void TextSize(symbol Character, int* Width, int* Height, int Size) const | 51 | void TextSize(symbol Character, int* Width, int* Height, int Size) const |
50 | { | 52 | { |
51 | // should probably use QPainter::boundingRect() | 53 | // should probably use QPainter::boundingRect() |
52 | *Width = *Height = Fonts[Size].pixelSize(); | 54 | *Width = *Height = font.pixelSize(); |
53 | 55 | ||
54 | } | 56 | } |
55 | void DrawText(symbol Character, int x1, int y1, int Size) const | 57 | void DrawText(symbol Character, int x1, int y1, int Size) const |
56 | { | 58 | { |
57 | // QFont font = QFont (fontname.c_str(), Size); | 59 | // QFont font = QFont (fontname.c_str(), Size); |
58 | // font.setPixelSize(Size); | 60 | // font.setPixelSize(Size); |
59 | QPoint point = QPoint(x1, y1+Size/2); | 61 | QPoint point = QPoint(x1, y1+Size/2); |
60 | 62 | ||
61 | painter->setFont (Fonts[Size]); | 63 | painter->setFont (font); |
62 | painter->drawText (point, | 64 | painter->drawText (point, |
63 | QString(interface->GetDisplayText(Character).c_str())); | 65 | QString(interface->GetDisplayText(Character).c_str())); |
64 | } | 66 | } |
65 | 67 | ||
66 | void DrawRectangle(int x1, int y1, int x2, int y2, | 68 | void DrawRectangle(int x1, int y1, int x2, int y2, |
67 | int Color, Opts::ColorSchemes ColorScheme) const; | 69 | int Color, Opts::ColorSchemes ColorScheme) const; |
68 | void Polyline(point* Points, int Number) const; | 70 | void Polyline(point* Points, int Number) const; |
69 | void DrawPolygon(point* Points, int Number, int Color, | 71 | void DrawPolygon(point* Points, int Number, int Color, |
70 | Opts::ColorSchemes ColorScheme) const; | 72 | Opts::ColorSchemes ColorScheme) const; |
71 | 73 | ||
72 | std::vector<int> FontSizes; | 74 | std::vector<int> FontSizes; |
73 | std::vector<QFont> Fonts; | 75 | std::vector<QFont> Fonts; |
74 | 76 | QFont font; | |
77 | int fontsize; | ||
75 | void Blank() const { | 78 | void Blank() const { |
76 | painter->begin(pixmap); | 79 | painter->begin(pixmap); |
77 | painter->setPen (NoPen); | 80 | painter->setPen (NoPen); |
78 | painter->fillRect(0, 0, m_iWidth, m_iHeight, | 81 | painter->fillRect(0, 0, m_iWidth, m_iHeight, |
79 | QColor(255,255,255)); | 82 | QColor(255,255,255)); |
80 | } | 83 | } |