summaryrefslogtreecommitdiff
path: root/inputmethods
Side-by-side diff
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/pickboard/pickboardcfg.cpp10
-rw-r--r--inputmethods/pickboard/pickboardcfg.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/inputmethods/pickboard/pickboardcfg.cpp b/inputmethods/pickboard/pickboardcfg.cpp
index e8b47cb..d500266 100644
--- a/inputmethods/pickboard/pickboardcfg.cpp
+++ b/inputmethods/pickboard/pickboardcfg.cpp
@@ -129,68 +129,68 @@ void PickboardConfig::doMenu(int i)
case 1: {
QMessageBox help("Pickboard Help", pickboard_help,
QMessageBox::NoIcon, 1, 0, 0);
help.showMaximized();
help.exec();
}
}
}
void StringConfig::draw(QPainter* p)
{
QFontMetrics fm = p->fontMetrics();
for (int r=0; r<nrows; r++) {
p->translate(0,fm.lineSpacing());
p->setPen(rowColor(r));
int tw=0;
QString s;
int i=0;
for (; !(s=text(r,i)).isNull(); ++i) {
int w = fm.width(s);
tw += w;
}
bool spread = spreadRow(r);// && parent->width() > tw;
int xw = spread ? (parent->width()-tw)/(i-1) : 3;
int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2;
i=0;
for (; !(s=text(r,i)).isNull(); ++i) {
int w = fm.width(s)+xw;
if ( highlight(r,i) ) {
- p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),Qt::black);
- p->setPen(Qt::white);
+ p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),::Qt::black);
+ p->setPen(::Qt::white);
}else{
- p->setPen(Qt::black);
+ p->setPen(::Qt::black);
}
p->drawText(x,-fm.descent()-1,s);
x += w;
}
}
}
void StringConfig::pickInRow(int r, int xpos, bool press)
{
QFontMetrics fm = parent->fontMetrics();
int tw=0;
QString s;
int i=0;
for (; !(s=text(r,i)).isNull(); ++i) {
int w = fm.width(s);
tw += w;
}
bool spread = spreadRow(r) && parent->width() > tw;
int xw = spread ? (parent->width()-tw)/(i-1) : 3;
int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2;
i=0;
for (; !(s=text(r,i)).isNull(); ++i) {
int x2 = x + fm.width(s)+xw;
if ( xpos >= x && xpos < x2 ) {
pick(press, r, i);
return;
}
x = x2;
}
}
@@ -402,68 +402,68 @@ QStringList DictFilterConfig::capitalize(const QStringList& l)
return r;
}
}
return l;
}
QString DictFilterConfig::capitalize(const QString& s)
{
switch ( shift ) {
case 1: {
QString u = s;
u[0] = u[0].upper();
return u;
break;
} case 2:
return s.upper();
break;
}
return s;
}
void DictFilterConfig::pick(bool press, int row, int item)
{
if ( row == 0 ) {
if ( press ) {
if ( input.isEmpty() ) {
lit0 = item;
if ( othermodes[item] == "Space" ) {
updateItem(row,item);
generateText(" ");
} else if ( othermodes[item] == "Back" ) {
updateItem(row,item);
- generateKey(Qt::Key_Backspace);
+ generateKey(::Qt::Key_Backspace);
} else if ( othermodes[item] == "Enter" ) {
updateItem(row,item);
- generateKey(Qt::Key_Return);
+ generateKey(::Qt::Key_Return);
} else if ( othermodes[item] == "Shift" ) {
updateItem(row,item);
shift = (shift+1)%3;
}
}
} else {
if ( !input.isEmpty() ) {
input.clear();
if ( item>=0 ) {
generateText(capitalize(matches[item]));
}
shift = 0;
matches.clear();
updateRows(0,0);
} else if ( item < 3 ) {
lit0 = -1;
changeMode(item+1); // I'm mode 0! ####
updateRows(0,1);
}
if ( lit0 >= 0 ) {
if ( !shift || othermodes[lit0] != "Shift" ) {
updateItem(0,lit0);
lit0 = -1;
}
}
}
} else {
lit0 = -1;
if ( press && item >= 0 ) {
lit1 = item;
add(sets[item]);
updateItem(1,item);
diff --git a/inputmethods/pickboard/pickboardcfg.h b/inputmethods/pickboard/pickboardcfg.h
index e0dc0dd..b1913df 100644
--- a/inputmethods/pickboard/pickboardcfg.h
+++ b/inputmethods/pickboard/pickboardcfg.h
@@ -83,65 +83,65 @@ public:
virtual void pickPoint(const QPoint& p, bool press);
virtual void draw(QPainter*)=0;
virtual void fillMenu(QPopupMenu&);
virtual void doMenu(int);
protected:
void updateRows(int from, int to);
virtual void updateItem(int r, int i);
virtual void pickInRow(int r, int xpos, bool press)=0;
void changeMode(int m);
virtual void generateText(const QString& s);
void generateKey( int k );
virtual void pick(bool press, int row, int item)=0;
protected:
PickboardPicks* parent;
int nrows;
private:
int pressrow, pressx;
};
class StringConfig : public PickboardConfig {
public:
StringConfig(PickboardPicks* p) : PickboardConfig(p) { }
void draw(QPainter* p);
protected:
virtual QString text(int r, int i)=0;
virtual bool spreadRow(int i)=0;
- virtual QColor rowColor(int) { return Qt::black; }
+ virtual QColor rowColor(int) { return ::Qt::black; }
virtual void pickInRow(int r, int xpos, bool press);
virtual void updateItem(int r, int i);
virtual bool highlight(int,int) const;
};
class CharStringConfig : public StringConfig {
QString input;
QStringList chars;
public:
CharStringConfig(PickboardPicks* p) : StringConfig(p) { }
void addChar(const QString& s);
virtual void doMenu(int);
protected:
QString text(int r, int i);
bool spreadRow(int i);
void pick(bool press, int row, int item);
};
class DictFilterConfig : public StringConfig {
QStringList matches;
QStringList sets;
QStringList othermodes;
int lit0;
int lit1;
int shift;
QString capitalize(const QString& s);
QStringList capitalize(const QStringList& s);
public:
QStringList input;