18 static const char*
const image_Y[] = {
25 "......................",
26 ".####################.",
27 ".#aa#bbbbbbbbbbbb#bb#.",
28 ".#aa#bbbbbbbbbbbb#bb#.",
29 ".#aa#bbbbbbbbbcbb####.",
30 ".#aa#bbbccbbbbbbb#aa#.",
31 ".#aa#bbbccbbbbbbb#aa#.",
32 ".#aa#bbbbbbbbbbbb#aa#.",
33 ".#aa#bbbbbbbbbbbb#aa#.",
34 ".#aa#bbbbbbbbbbbb#aa#.",
35 ".#aa#bbbbbbbbbbbb#aa#.",
36 ".#aaa############aaa#.",
37 ".#aaaaaaaaaaaaaaaaaa#.",
38 ".#aaaaaaaaaaaaaaaaaa#.",
39 ".#aaa#############aa#.",
40 ".#aaa#########bbb#aa#.",
41 ".#aaa#########bbb#aa#.",
42 ".#aaa#########bbb#aa#.",
43 ".#aaa#########bbb#aa#.",
44 ".#aaa#########bbb#aa#.",
45 "..##################..",
46 "......................"};
48 static const char*
const image_F[] = {
59 ".##################.",
60 ".#################..",
61 "a..##############.bb",
62 "bc..###########...bb",
63 "dbe..##########...bb",
64 "bbbb..bbbbbbbb.bbbbb",
65 "bbbbbbffggfffbbbbbbb",
66 "bbbbbfffgfggggbbbbbb",
67 "bbbbffgffgfggggbbbbb",
68 "bbbffffgggggggggbbbb",
69 "bbbfffgfggggggggbbbb",
70 "bbbfffffffgfggggbbbb",
71 "bbbffffgggggffffbbbb",
72 "bbbffffggggfffffbbbb",
73 "bbbffgfffggfffffbbbb",
74 "bbbffffffggfffggbbbb",
75 "bbbbfffffggfffgbbbbb",
76 "bbbbbfffffffffbbbbbb",
77 "bbbbbbfffffffbbbbbbb",
78 "bbbbbbbbbbbbbbbbbbbb"};
81 static const char*
const image_P[] = {
106 static const char*
const image_X[] = {
126 static const char*
const image_E[] = {
137 ".##########aaaaaaaaa",
138 ".##########aaaaaaaaa",
139 "b..########aacccccaa",
140 "bb..#######aacccccaa",
141 "bbb..######aacccccaa",
142 "dddd..dddddaacccccaa",
143 "dddddeeeeeeaaaaaaaaa",
144 "dddddeeeeeeaaaaaaaaa",
145 "ddddfeeeeeeeeegddddd",
146 "dddffffgeeeeeeggdddd",
147 "dddfffgeeeeeeeggdddd",
148 "dddffffeeegeeeggdddd",
149 "dddfffeeeggeeeffdddd",
150 "dddffeeegggeeeffdddd",
151 "dddfeeeffggfffffdddd",
152 "dddeeefffggfffggdddd",
153 "ddeeeffffggfffgddddd",
154 "deeedfffffffffdddddd",
155 "eeedddfffffffddddddd",
156 "dddddddddddddddddddd"};
158 static const char*
const refreshbutton_data[] = {
265 "QtQtQtQtQtQt.#.a.b.c.d.eQtQtQtQt",
266 "QtQtQtQt.f.g.h.i.j.k.l.m.eQtQtQt",
267 "QtQtQt.f.n.o.p.q.r.s.t.u.vQtQtQt",
268 "QtQtQt.w.x.y.z.A.B.C.D.E.vQtQtQt",
269 "QtQtQt.F.G.H.I.J.K.L.D.E.vQtQtQt",
270 "QtQt.#.M.N.O.P.Q.R.D.A.S.vQtQtQt",
271 "QtQt.T.U.V.W.X.Y.Z.0.1.2.eQtQtQt",
272 "QtQt.c.3.4.5.5.6.7.8.9#.QtQtQtQt",
273 "QtQtQt###a.B#b#c#d#e#f#g#hQtQtQt",
274 "QtQtQt.5.B#i.D#j#k#l#m#n#oQtQtQt",
275 "QtQtQt.5#b.D.C#p#q#r#s#t#uQtQtQt",
276 "QtQtQt#v#c#w#x.A.z#y#z#AQtQtQtQt",
277 "QtQtQt#B#C#D#E#F#G#H#IQtQtQtQtQt",
278 "QtQtQtQt#BQt#J#K#L#MQtQtQtQtQtQt",
279 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
280 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};
282 static const char*
const image_descend[] = {
305 static const char*
const image_ascend[] = {
327 static const char*
const image_descend2[] = {
349 static const char*
const image_ascend2[] = {
371 static const char*
const image_up[] = {
394 static const char*
const image_down[] = {
417 static const char*
const image_hsdown[] = {
428 static const char*
const image_hsup[] = {
441 int HArrayButton::defaultSizeY = 0;
444 :QPushButton(text,parent)
446 connect(
this,SIGNAL(clicked()),
this,SLOT(clickHandler()));
454 int HArrayButton::clickHandler(
void)
456 emit clickedValue(text());
462 #define MAKE_A_BUTTON(a,b) {\
463 tmp = new HArrayButton(b,parent); \
464 connect(tmp,SIGNAL(clickedValue(QString)),receiver,member); \
465 (a)->addWidget(tmp); (a)->addSpacing(2); \
470 QVBoxLayout *ml =
new QVBoxLayout(0);
472 QHBoxLayout *ll2 =
new QHBoxLayout(0);
475 QHBoxLayout *ll3 =
new QHBoxLayout(0);
481 MAKE_A_BUTTON(ll2,
".");
483 #ifdef GSAFETEXT_LANG_HU
484 MAKE_A_BUTTON(ll2,
"A"); MAKE_A_BUTTON(ll2,
"Á"); MAKE_A_BUTTON(ll2,
"B");
485 MAKE_A_BUTTON(ll2,
"C"); MAKE_A_BUTTON(ll2,
"D"); MAKE_A_BUTTON(ll2,
"E");
486 MAKE_A_BUTTON(ll2,
"É"); MAKE_A_BUTTON(ll2,
"F"); MAKE_A_BUTTON(ll2,
"G");
487 MAKE_A_BUTTON(ll2,
"H"); MAKE_A_BUTTON(ll2,
"I"); MAKE_A_BUTTON(ll2,
"Í");
488 MAKE_A_BUTTON(ll2,
"J"); MAKE_A_BUTTON(ll2,
"K"); MAKE_A_BUTTON(ll2,
"L");
489 MAKE_A_BUTTON(ll2,
"M");
491 MAKE_A_BUTTON(ll2,
"N"); MAKE_A_BUTTON(ll3,
"O"); MAKE_A_BUTTON(ll3,
"Ó");
492 MAKE_A_BUTTON(ll3,
"Ö"); MAKE_A_BUTTON(ll3,
"P");
493 MAKE_A_BUTTON(ll3,
"Q"); MAKE_A_BUTTON(ll3,
"R"); MAKE_A_BUTTON(ll3,
"S");
494 MAKE_A_BUTTON(ll3,
"T"); MAKE_A_BUTTON(ll3,
"U"); MAKE_A_BUTTON(ll3,
"Ú");
495 MAKE_A_BUTTON(ll3,
"Ü"); MAKE_A_BUTTON(ll3,
"X");
496 MAKE_A_BUTTON(ll3,
"Y"); MAKE_A_BUTTON(ll3,
"V"); MAKE_A_BUTTON(ll3,
"W");
497 MAKE_A_BUTTON(ll3,
"Z");
499 MAKE_A_BUTTON(ll2,
"A"); MAKE_A_BUTTON(ll2,
"B"); MAKE_A_BUTTON(ll2,
"C");
500 MAKE_A_BUTTON(ll2,
"D"); MAKE_A_BUTTON(ll2,
"E"); MAKE_A_BUTTON(ll2,
"F");
501 MAKE_A_BUTTON(ll2,
"G"); MAKE_A_BUTTON(ll2,
"H"); MAKE_A_BUTTON(ll2,
"I");
502 MAKE_A_BUTTON(ll2,
"J"); MAKE_A_BUTTON(ll2,
"K"); MAKE_A_BUTTON(ll2,
"L");
503 MAKE_A_BUTTON(ll2,
"M");
505 MAKE_A_BUTTON(ll3,
"N"); MAKE_A_BUTTON(ll3,
"O"); MAKE_A_BUTTON(ll3,
"P");
506 MAKE_A_BUTTON(ll3,
"Q"); MAKE_A_BUTTON(ll3,
"R"); MAKE_A_BUTTON(ll3,
"S");
507 MAKE_A_BUTTON(ll3,
"T"); MAKE_A_BUTTON(ll3,
"U"); MAKE_A_BUTTON(ll3,
"X");
508 MAKE_A_BUTTON(ll3,
"Y"); MAKE_A_BUTTON(ll3,
"V"); MAKE_A_BUTTON(ll3,
"W");
509 MAKE_A_BUTTON(ll3,
"Z");
523 HArrayButton::~HArrayButton(
void)
538 setFocusPolicy(Qt::StrongFocus);
540 setMaximumWidth(100);
547 QHBoxLayout *lay =
new QHBoxLayout(
this);
550 QVBoxLayout *swl =
new QVBoxLayout(0);
554 le =
new QLineEdit(
this);
559 QToolButton *bu =
new QToolButton(
this);
560 bu->setIcon(QPixmap(image_hsup));
561 bu->setMaximumHeight(h);
562 bu->setMinimumHeight(h);
563 bu->setMinimumWidth(14);
564 bu->setMaximumWidth(14);
566 QToolButton *bd =
new QToolButton(
this);
567 bd->setIcon(QPixmap(image_hsdown));
568 bd->setMaximumHeight(h);
569 bu->setMinimumHeight(h);
570 bd->setMinimumWidth(14);
571 bd->setMaximumWidth(14);
578 le->setAlignment(Qt::AlignRight);
582 connect(le,SIGNAL(textChanged(
const QString&)),
this,SLOT(leChanged(
const QString&)));
583 connect(bu,SIGNAL(clicked()),
this,SLOT(bUp()));
584 connect(bd,SIGNAL(clicked()),
this,SLOT(bDown()));
588 int HSpinBox::bUp(
void)
596 int HSpinBox::bDown(
void)
604 int HSpinBox::leChanged(
const QString& t)
626 le->setText(oldtext);
642 void HSpinBox::check(
void)
648 le->setText((oldtext = QString(
"%1").arg(val)));
670 #define CELLHMARGIN 3
671 #define CELLVMARGIN 3
679 #define DEFAULT_HEADCOLOR QColor(244,180,200)
680 #define DEFAULT_HEADCOLOR_CURSOR QColor(250,100,120)
681 #define DEFAULT_CURSORCOLOR QColor(140,140,230)
682 #define DEFAULT_BGCOLOR QColor(240,240,240)
684 bool HTableBrowser::staticinit =
false;
685 QPixmap *HTableBrowser::pix_up = NULL;
686 QPixmap *HTableBrowser::pix_down = NULL;
687 QPixmap *HTableBrowser::pix_asc = NULL;
688 QPixmap *HTableBrowser::pix_desc = NULL;
689 QPixmap *HTableBrowser::pix_asc2 = NULL;
690 QPixmap *HTableBrowser::pix_desc2 = NULL;
715 cachedElements.clear();
721 pix_up =
new QPixmap(image_up);
722 pix_down =
new QPixmap(image_down);
723 pix_asc =
new QPixmap(image_ascend);
724 pix_desc =
new QPixmap(image_descend);
725 pix_asc2 =
new QPixmap(image_ascend2);
726 pix_desc2=
new QPixmap(image_descend2);
729 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
730 setMidLineWidth(100);
731 setMinimumHeight(100);
732 setFocusPolicy(Qt::StrongFocus);
735 color_cursor = DEFAULT_CURSORCOLOR;
736 color_header = DEFAULT_HEADCOLOR;
737 color_header_cursor = DEFAULT_HEADCOLOR_CURSOR;
738 color_background = DEFAULT_BGCOLOR;
741 palette.setColor(QPalette::Window,color_background);
743 setAutoFillBackground(
true);
745 fm =
new QFontMetrics( QApplication::font() );
751 color_background = c;
753 palette.setColor(QPalette::Window,color_background);
755 setAutoFillBackground(
true);
766 sdebug(
"*** HTableBrowser::~HTableBrowser ***\nDestory HTableBrowser, delete items...");
769 sdebug(
"*** HTableBrowser::~HTableBrowser ***END");
821 if(col >= (
int)colc.size())
838 if(head.size() > e->
size())
840 QString errortxt=
"You try to add smaller record than previous. (Contains less cell. Why? Forget separate signals? \"|\"?) ";
846 cur = top = start = end = e;
848 for(i=0;i<e->
size();++i)
850 colw.push_back( fm->width((*e)[i]) );
851 colc.push_back( precolor.contains(i) ? precolor[i] : QColor( (100+i*25)>255 ? 255 : (100+i*25) ,200-i*5,180 ));
852 spec_sort.push_back(
"");
856 while(head.size() < colw.size())
859 for(i=0;i<(int)head.size();++i)
861 l = fm->width(head[i]) + BARW;
873 for(i=0;i<e->
size();++i)
875 l = fm->width((*e)[i]) + BARW;
902 if(seek->
prev != NULL)
904 if(seek->
next != NULL)
912 if (seek->
prev != NULL) top = seek->
prev;
913 else if(seek->
next != NULL) top = seek->
next;
918 if (seek->
prev != NULL) cur = seek->
prev;
919 else if(seek->
next != NULL) cur = seek->
next;
922 query_cursor = start;
942 if(col >= (
int)spec_sort.size())
944 sdebug(
"Warning: Less column exists than column index received in \"setSpecSort\"!!\n (Hint:Insert an element before you set the column colors!)");
948 spec_sort[col] = specsortname;
961 if( height()-(rowh) > (cur->
index - topm->
index)*(rowh+2*CELLVMARGIN)+2*rowh)
979 if(step->
index == index)
995 if(step->
index == index)
1028 if(cur->
prev != NULL)
1034 if(top->
prev == cur)
1039 else if(abs(top->
index - cur->
index) > (showrow+2))
1055 if(cur->
next != NULL)
1067 while(height()-(rowh+4*CELLVMARGIN+12) < (cur->
index - top->
index)*(rowh+2*CELLVMARGIN)+2*rowh)
1069 if(top->
next != NULL)
1080 void HTableBrowser::wheelEvent(QWheelEvent *e)
1112 void HTableBrowser::keyPressEvent(QKeyEvent *e)
1119 if(e->modifiers() == Qt::ControlModifier)
1121 QFrame::keyPressEvent(e);
1125 if(e->key() == Qt::Key_Down)
1133 if(e->key() == Qt::Key_Up)
1141 if(e->key() == Qt::Key_PageUp)
1144 for(i=0;i < showrow-2;++i)
1153 if(e->key() == Qt::Key_PageDown)
1156 for(i=0;i < showrow-2;++i)
1164 if(e->key() == Qt::Key_Home)
1172 if(e->key() == Qt::Key_End)
1180 if(e->key() == Qt::Key_Left)
1187 if(col_scroll > curc)
1194 if(e->key() == Qt::Key_Right)
1197 if(curc+1 < (
int)colw.size())
1208 for(i=col_scroll;i<=curc;++i)
1209 sum += colw[i]+2*CELLHMARGIN;
1210 if(sum > (width()-(LMARGIN*2)))
1222 if(e->key() == Qt::Key_Return || (e->key() == Qt::Key_Space && seek.isEmpty()))
1230 if(seek.isEmpty() && e->key() == Qt::Key_Escape)
1232 QFrame::keyPressEvent(e);
1237 if((!seek.isEmpty() && e->key() == Qt::Key_Escape) || (e->key() == Qt::Key_Delete))
1244 if(e->key() == Qt::Key_Backspace)
1246 seek.remove(QRegExp(
".$"));
1251 if(e->key() == Qt::Key_F3)
1254 for(t = cur ; t != NULL ; t=t->
next)
1256 if(((*t->
rows)[curc]).startsWith(seek))
1265 if(e->key() == Qt::Key_F5)
1275 seek.append(e->text());
1277 for(t = start ; t != NULL ; t=t->
next)
1279 if(((*t->
rows)[curc]).startsWith(seek))
1287 height()-(rowh+4*CELLVMARGIN+12) < (cur->
index - top->
index)*(rowh+2*CELLVMARGIN)+2*rowh)
1297 int border(
int a,
int b,
int c)
1306 #define inX(a,b) ( ((a) < e->x() && (b) > e->x()) || ((b) < e->x() && (a) > e->x()))
1307 #define inY(a,b) ( ((a) < e->y() && (b) > e->y()) || ((b) < e->y() && (a) > e->y()))
1318 if(!inX(0,width()) || !inY(0,height()))
1320 sdebug(
"==CLICK=> Outer click (do nothing)");
1325 if(inX(0,LMARGIN+CELLHMARGIN))
1327 sdebug(
"==CLICK=> Left from the first cell (backscroll the columns)");
1330 curc = --col_scroll;
1334 for(stepx=col_scroll,x=LMARGIN;
1335 (x<(width()-(LMARGIN+BARW)));
1336 x+=(colw[stepx]+2*CELLHMARGIN+plusw),stepx++)
1338 if(stepx >= colw.size())
1340 if(inX(x+CELLHMARGIN,x+colw[stepx]+plusw+CELLHMARGIN*2) && inY(TMARGIN+CELLVMARGIN,TMARGIN+rowh+CELLHMARGIN))
1342 sdebug(
"==CLICK=> Column header (sorting)");
1344 sdebug(QString(
"Click header: column %1").arg(stepx));
1346 return rmode == NEED_UPDATE ?
true :
false;
1350 for(stepy=top,y=TMARGIN+rowh+4*CELLVMARGIN;
1351 (y < height()-TMARGIN) && (stepy != NULL);
1352 y+=(rowh+2*CELLVMARGIN),stepy=stepy->
next)
1354 if(inY(y,y+rowh+2*CELLHMARGIN))
1356 for(stepx=col_scroll,x=LMARGIN;
1357 (x<(width()-(LMARGIN+BARW)));
1358 x+=(colw[stepx]+2*CELLHMARGIN+plusw),stepx++)
1360 if(stepx >= colw.size())
1362 if(inX(x,x+colw[stepx]+plusw+CELLHMARGIN*2))
1364 sdebug(
"==CLICK=> To Cell (Marking)");
1366 if(cur != stepy || curc != stepx)
1373 return rmode == NEED_UPDATE ?
false :
true;
1377 sdebug(
"==Click=> Nothing targetted, don't hit anything (exiting)");
1381 void HTableBrowser::mouseMoveEvent(QMouseEvent *e)
1386 if( inscroll || inX(width()-BARW-LMARGIN+2,width()))
1390 if( !inscroll && inY(8,8+BUTTH))
1392 sdebug(
"==MOVE/PRESS=> Up button");
1397 if( !inscroll && inY(height()-(BUTTH+8),height()-8))
1399 sdebug(
"==MOVE/PRESS=> Down button");
1405 nTH = ( (number-showrow+2) * (border(0,height()-(8+BUTTH),e->y()-(8+BUTTH))) ) / (height()-8*2-2*BUTTH);
1411 sdebug(
"==MOVE/PRESS=> Nothing hit --> Call mouseNetClick()");
1417 void HTableBrowser::mouseReleaseEvent(QMouseEvent *e)
1421 if(e->button() == Qt::RightButton)
1423 sdebug(
"HTableBrowser::mouseReleaseEvent RIGHT button!");
1425 if(last_right_clicked == cur->
key)
1427 sdebug(
"Emitting signal!");
1428 mouseRightClickPosX = e->x();
1429 mouseRightClickPosY = e->y();
1436 void HTableBrowser::mousePressEvent(QMouseEvent *e)
1440 if(e->button() == Qt::RightButton)
1442 last_right_clicked = cur->
key;
1445 void HTableBrowser::mouseDoubleClickEvent(QMouseEvent *e)
1449 if(inX(width()-BARW-LMARGIN+2,width()))
1465 bool asc = this->asc;
1466 bool asc2 = this->asc2;
1476 if(dropchar(a->
getCVal(keycolumn).toLocal8Bit()) > dropchar(b->
getCVal(keycolumn).toLocal8Bit()))
1477 return (asc ?
true :
false);
1478 if(dropchar(a->
getCVal(keycolumn).toLocal8Bit()) < dropchar(b->
getCVal(keycolumn).toLocal8Bit()))
1479 return (asc ?
false :
true );
1481 if(keycolumn2 == -1)
1484 if(dropchar(a->
getCVal(keycolumn2).toLocal8Bit()) > dropchar(b->
getCVal(keycolumn2).toLocal8Bit()))
1485 return (asc2 ?
true :
false);
1486 if(dropchar(a->
getCVal(keycolumn2).toLocal8Bit()) < dropchar(b->
getCVal(keycolumn2).toLocal8Bit()))
1487 return (asc2 ?
false :
true );
1491 if(QString::localeAwareCompare(a->
getCVal(keycolumn),b->
getCVal(keycolumn)) > 0 )
1492 return (asc ?
true :
false);
1493 if(QString::localeAwareCompare(a->
getCVal(keycolumn),b->
getCVal(keycolumn)) < 0 )
1494 return (asc ?
false :
true );
1496 if(keycolumn2 == -1)
1499 if(QString::localeAwareCompare(a->
getCVal(keycolumn2),b->
getCVal(keycolumn2)) > 0)
1500 return (asc2 ?
true :
false);
1501 if(QString::localeAwareCompare(a->
getCVal(keycolumn2),b->
getCVal(keycolumn2)) < 0)
1502 return (asc2 ?
false :
true );
1507 void HTableBrowser::q_sort(
void)
1509 HTableBrowserElementPair *t;
1513 q_sort_stack =
new QStack<HTableBrowserElementPair *> ();
1514 q_sort_stack->clear();
1515 q_sort_stack->push(
new HTableBrowserElementPair(start,end));
1517 while( ! q_sort_stack->isEmpty() )
1519 q_sort_run( (t=q_sort_stack->pop()) );
1526 void HTableBrowser::q_sort_run(HTableBrowserElementPair *p)
1535 i = (int) ((p->left->index+p->right->index) / 2);
1536 for(m=p->left;m->
index != i && m != p->right ;m=m->
next) ;
1540 while(ch(
true,left,m) && (left->
index < m->
index))
1543 while(ch(
false,right,m) && (right->
index > m->
index))
1544 right = right->
prev;
1557 if(p->left->index < m->
index)
1558 q_sort_stack->push(
new HTableBrowserElementPair(p->left,m->
prev));
1559 if(p->right->index > m->
index)
1560 q_sort_stack->push(
new HTableBrowserElementPair(m->
next,p->right));
1565 if(colw.size() == 0 )
1568 if(keycolumn == keycol)
1575 keycolumn2 = keycolumn;
1583 if(spec_sort[keycol] ==
"dropchar")
1585 sdebug(
"Special sort mask with->DROPCHAR");
1589 sdebug(QString(
"start Qsort.. %1 %2").arg(keycolumn).arg(asc));
1600 QLinkedList<HTableBrowserElement *>::Iterator i = cachedElements.begin();
1601 while(i != cachedElements.end())
1603 if((*i)->cachePixmap != NULL)
1604 delete (*i)->cachePixmap;
1605 (*i)->cachePixmap = NULL;
1609 cachedElements.clear();
1610 cacheMutex.unlock();
1614 int HTableBrowser::limitCache(
void)
1618 while(cacheLimit <= cachedElements.size())
1620 toremove = cachedElements.last();
1621 cachedElements.removeLast();
1627 cacheMutex.unlock();
1631 void HTableBrowser::paintEvent(QPaintEvent *e)
1640 QColor color,cellcolor;
1646 QPainter *p =
new QPainter();
1648 color = color_cursor;
1655 p->setPen(QColor(190,190,190));
1656 p->drawRect(0,0,width()-1,height()-1);
1657 p->drawRect(1,1,width()-3,height()-3);
1658 p->setPen(QColor(130,130,130));
1659 p->drawRect(2,2,width()-5,height()-5);
1660 p->drawRect(3,3,width()-7,height()-7);
1661 p->setPen(QColor(90,90,90));
1662 p->drawRect(4,4,width()-9,height()-9);
1663 p->drawRect(5,5,width()-11,height()-11);
1664 p->setPen(QColor(0,0,0));
1665 p->drawRect(6,6,width()-13,height()-13);
1666 p->setClipRect(7,7,width()-15,height()-15);
1670 p->setPen(QColor(220,220,220));
1671 p->drawRect(0,0,width()-1,height()-1);
1672 p->drawRect(1,1,width()-3,height()-3);
1673 p->setPen(QColor(190,190,190));
1674 p->drawRect(2,2,width()-5,height()-5);
1675 p->drawRect(3,3,width()-7,height()-7);
1676 p->setPen(QColor(130,130,130));
1677 p->drawRect(4,4,width()-9,height()-9);
1678 p->drawRect(5,5,width()-11,height()-11);
1679 p->setPen(QColor(50,50,50));
1680 p->drawRect(6,6,width()-13,height()-13);
1681 p->setClipRect(7,7,width()-15,height()-15);
1684 int posX=LMARGIN,posY=TMARGIN;
1686 p->setPen(QColor(0,0,0));
1688 if(top == NULL || cur == NULL || start == NULL)
1697 for(c=0;c<(int)colw.size();++c)
1698 allcw+=colw[c]+CELLHMARGIN*2;
1699 dv = (double)(width()-(allcw+2*LMARGIN+BARW)) / (double)colw.size();
1705 while(head.size() < colw.size())
1709 if(oldw != width() || oldh != height() || old_col_scroll != col_scroll)
1712 old_col_scroll = col_scroll;
1717 if( (
int)((height()+50)/(rowh + 2*CELLVMARGIN)) > cacheLimit)
1718 cacheLimit = ((int)((height()+50)/(rowh + 2*CELLVMARGIN)) + 5);
1728 p2.setColor(color_header);
1730 p->drawLine(LMARGIN+CELLHMARGIN,TMARGIN+CELLVMARGIN,LMARGIN+CELLHMARGIN-5,TMARGIN+CELLVMARGIN+(rowh+CELLVMARGIN)/2);
1731 p->drawLine(LMARGIN+CELLHMARGIN,TMARGIN+CELLVMARGIN+rowh+CELLVMARGIN,LMARGIN+CELLHMARGIN-5,TMARGIN+CELLVMARGIN+(rowh+CELLVMARGIN)/2);
1735 for(c=col_scroll;c<(int)colw.size();++c)
1737 p->fillRect(posX+CELLHMARGIN,posY+CELLVMARGIN,colw[c]+CELLHMARGIN+plusw-1,rowh+CELLVMARGIN,
1738 QBrush( c == curc ? color_header_cursor : color_header));
1740 p->drawText(posX+CELLHMARGIN+1,posY+CELLVMARGIN+1,colw[c]+CELLHMARGIN+plusw,rowh+CELLVMARGIN,QTextOption::NoWrap, head[c] );
1743 if(keycolumn == c && asc)
1744 p->drawPixmap(posX+CELLHMARGIN+colw[c]+CELLHMARGIN+plusw-BARW,posY+CELLVMARGIN,*pix_asc);
1745 if(keycolumn == c && !asc)
1746 p->drawPixmap(posX+CELLHMARGIN+colw[c]+CELLHMARGIN+plusw-BARW,posY+CELLVMARGIN,*pix_desc);
1748 if(keycolumn2 == c && asc2)
1749 p->drawPixmap(posX+CELLHMARGIN+colw[c]+CELLHMARGIN+plusw-BARW,posY+CELLVMARGIN,*pix_asc2);
1750 if(keycolumn2 == c && !asc2)
1751 p->drawPixmap(posX+CELLHMARGIN+colw[c]+CELLHMARGIN+plusw-BARW,posY+CELLVMARGIN,*pix_desc2);
1753 posX += colw[c] + 2*CELLHMARGIN + plusw;
1757 posY += rowh + 4*CELLVMARGIN;
1762 for(;(posY < height()+rowh) && run != NULL;run = run->
next)
1771 run->
cachePixmap = pix =
new QPixmap(width()-5,rowh + 2*CELLVMARGIN);
1772 pix->fill(Qt::white);
1773 QPainter *cP =
new QPainter(pix);
1777 for(c=col_scroll;c<(int)colw.size();++c)
1780 cellcolor = QColor(run->ocr,run->ocg,run->
ocb);
1782 cellcolor = colc[c];
1785 cP->fillRect(posX+CELLHMARGIN,CELLVMARGIN,colw[c]+CELLHMARGIN+plusw-1,rowh+CELLVMARGIN-1,
1788 cP->drawText(posX+CELLHMARGIN+1,CELLVMARGIN+1,colw[c]+CELLHMARGIN+plusw,rowh+CELLVMARGIN,
1789 QTextOption::NoWrap,(*run)[c] );
1790 posX += colw[c] + 2*CELLHMARGIN + plusw;
1797 cachedElements.push_front(run);
1801 cacheMutex.unlock();
1803 posY += rowh + 2*CELLVMARGIN;
1811 posY += rowh + 2*CELLVMARGIN;
1819 for(c=col_scroll;c<(int)colw.size();++c)
1823 if(c==col_scroll && col_scroll != 0)
1829 p2.setColor(cellcolor);
1831 p->drawLine(LMARGIN+CELLHMARGIN,dcY+CELLVMARGIN,LMARGIN+CELLHMARGIN-5,dcY+CELLVMARGIN+(rowh+CELLVMARGIN)/2);
1832 p->drawLine(LMARGIN+CELLHMARGIN,dcY+CELLVMARGIN+rowh+CELLVMARGIN,LMARGIN+CELLHMARGIN-5,dcY+CELLVMARGIN+(rowh+CELLVMARGIN)/2);
1837 p->fillRect(posX+CELLHMARGIN,dcY+CELLVMARGIN,colw[c]+CELLHMARGIN+plusw-1,rowh+CELLVMARGIN-1,
1842 p->setPen(QColor(60,60,60));
1843 p->drawRect(posX+CELLHMARGIN-2 ,dcY+CELLVMARGIN-2,
1844 colw[c]+CELLHMARGIN+3+plusw ,rowh+CELLVMARGIN+3);
1847 p->setPen(QColor(220,220,220));
1849 p->drawLine(posX+CELLHMARGIN-2+20 ,dcY+CELLVMARGIN-2,
1850 posX+CELLHMARGIN-2+colw[c]+CELLHMARGIN+4+plusw-20 ,dcY+CELLVMARGIN-2);
1852 p->drawLine(posX+CELLHMARGIN-2+20 ,dcY+CELLVMARGIN-2+rowh+CELLVMARGIN+3,
1853 posX+CELLHMARGIN-2+colw[c]+CELLHMARGIN+4+plusw-20 ,dcY+CELLVMARGIN-2+rowh+CELLVMARGIN+3);
1856 p->setPen(QColor(0,0,0));
1857 p->drawRect(posX+CELLHMARGIN-1,dcY+CELLVMARGIN-1,
1858 colw[c]+CELLHMARGIN+1+plusw,rowh+CELLVMARGIN+1);
1862 if( (*dcI)[c].startsWith(seek) )
1864 p->fillRect(posX+CELLHMARGIN,dcY+CELLVMARGIN,
1865 QApplication::fontMetrics().width(seek),rowh+CELLVMARGIN,
1866 QColor(254,230,100));
1870 p->setPen(QColor(254,254,254));
1871 p->drawRect(posX+CELLHMARGIN,dcY+CELLVMARGIN,colw[c]+CELLHMARGIN+plusw-1,rowh+CELLVMARGIN-1);
1872 p->setPen(QColor(0,0,0));
1874 p->drawText(posX+CELLHMARGIN+1,dcY+CELLVMARGIN+1,colw[c]+CELLHMARGIN+plusw,rowh+CELLVMARGIN,
1875 QTextOption::NoWrap,(*dcI)[c] );
1876 posX += colw[c] + 2*CELLHMARGIN + plusw;
1883 p->fillRect(width()-BARW-LMARGIN,6,BARW+LMARGIN,height()-12,color);
1884 p->drawRect(width()-BARW-LMARGIN,6,BARW+LMARGIN,height()-12);
1886 kx = width()-BARW-LMARGIN+4-1;
1889 if(number == 0 || number <= showrow)
1891 sy = height()-(2*TMARGIN+BUTTH);
1896 sy = border(15,height()-(2*TMARGIN+BUTTH),
1897 (
int)(showrow * (height()-(2*(BUTTH+8))) / number) );
1899 ky = border(TMARGIN+BUTTH,height()-(2*TMARGIN+BUTTH),
1900 (
int)TMARGIN+BUTTH+(top->
index * (height()-2*(BUTTH+TMARGIN)-sy) / (number-showrow)) );
1903 p->fillRect(kx,ky,sx,sy,QColor(230,230,250));
1904 p->drawLine(kx+2,ky+2,kx+2,ky+sy-2);
1905 p->drawLine(kx+6,ky+2,kx+6,ky+sy-2);
1906 p->drawLine(kx+2,ky+sy/2,kx+6,ky+sy/2);
1909 p->drawPixmap(width()-BARW-LMARGIN+2 ,8,*pix_up);
1910 p->drawPixmap(width()-BARW-LMARGIN+2 ,height()-(BUTTH+8),*pix_down);
1918 if(lastkey != cur->
key)
1925 void HTableBrowser::resizeEvent(QResizeEvent *e)
1928 QFrame::resizeEvent(e);
1940 for(c = start; c != NULL ;c=c->
next)
1955 return new QStringList(*c->
rows);
1967 return new QString(c->
key);
1971 { query_cursor = start; }
1974 { query_cursor = top; }
1977 { query_cursor = cur; }
1984 if(query_cursor != NULL)
1985 query_cursor = query_cursor->
next;
1995 if(query_cursor != NULL)
1997 query_cursor = query_cursor->
next;
1998 return new QStringList(*r->
rows);
2008 if(query_cursor != NULL)
2010 query_cursor = query_cursor->
next;
2011 return new QString(r->
key);
2032 while(strp != NULL && !found);
2040 rows =
new QStringList(*c);
2042 ocr=0; ocg=0;
ocb=0;
2049 QString v6,QString v7,QString v8,QString v9)
2052 rows =
new QStringList();
2053 rows->push_back(v1);
2055 ocr=0; ocg=0;
ocb=0;
2058 else {
rows->push_back(v2); }
2061 else {
rows->push_back(v3); }
2064 else {
rows->push_back(v4); }
2067 else {
rows->push_back(v5); }
2070 else {
rows->push_back(v6); }
2073 else {
rows->push_back(v7); }
2076 else {
rows->push_back(v8); }
2079 else {
rows->push_back(v9); }
2117 if(
rows->size() <= i)
2126 return rows->size();
2136 ocr = e.ocr; ocg = e.ocg;
ocb = e.
ocb;
2152 ocr = e->ocr; ocg = e->ocg;
ocb = e->
ocb;
2179 tocr = ocr; tocg = ocg; tocb =
ocb;
2184 ocr = x->ocr; ocg = x->ocg;
ocb = x->
ocb;
2189 x->ocr = tocr; x->ocg = tocg; x->
ocb = tocb;
2203 genhtml_parameters =
"html center";
2204 QVBoxLayout *layout=
new QVBoxLayout(
this);
2205 layout->setMargin(2);
2206 layout->setSpacing(2);
2210 QToolButton *tp,*tx,*th;
2211 QHBoxLayout *toplay =
new QHBoxLayout(0);
2212 tx =
new QToolButton(
this);
2213 tp =
new QToolButton(
this);
2214 tx->setIcon(QPixmap( (
const char **) image_X ) );
2215 tp->setIcon(QPixmap( (
const char **) image_P ) );
2217 toplay->addSpacing(5);
2218 toplay->addWidget(tp);
2219 toplay->addSpacing(3);
2220 toplay->addWidget(tx);
2223 th =
new QToolButton(
this);
2224 th->setIcon(QPixmap( (
const char **) image_F ) );
2225 toplay->addSpacing(3);
2226 toplay->addWidget(th);
2230 toplay->addStretch();
2232 layout->addLayout(toplay);
2233 connect(tx,SIGNAL(clicked()),
this,SLOT(
dialogXml()));
2234 connect(tp,SIGNAL(clicked()),
this,SLOT(
dialogPrint()));
2236 layout->addWidget(list);
2242 QStringList *sl =
new QStringList();
2252 k = QString(
"%1").arg(i);
2254 k = (*sl)[keyfield];
2263 connect(list,SIGNAL(alternateActivateItem(
const QString&)),
this,SLOT(
itemAlternateActivated(
const QString&)));
2321 QVBoxLayout *layout=
new QVBoxLayout(
this);
2322 QHBoxLayout *bottom=
new QHBoxLayout(0);
2325 QPushButton *okb =
new QPushButton(
"Ok",
this);
2326 bottom->addStretch();
2327 bottom->addWidget(okb);
2328 bottom->addStretch();
2331 layout->addWidget(dpdm);
2332 layout->addLayout(bottom);
2334 setSizeGripEnabled(
true);
2336 connect(okb,SIGNAL(clicked()),
this,SLOT(accept()));
2353 sdebug(
"*** HDispList::HDispList ***");
2364 QVBoxLayout *layout=
new QVBoxLayout(
this);
2365 layout->setMargin(2);
2366 layout->setSpacing(2);
2371 QToolButton *tp,*tx;
2373 QHBoxLayout *toplay =
new QHBoxLayout(0);
2374 tx =
new QToolButton(
this);
2375 tp =
new QToolButton(
this);
2376 tx->setIcon(QPixmap( (
const char **) image_X ) );
2377 tp->setIcon(QPixmap( (
const char **) image_P ) );
2378 toplay->addSpacing(5);
2379 toplay->addWidget(tp);
2380 toplay->addSpacing(3);
2381 toplay->addWidget(tx);
2382 toplay->addStretch();
2384 layout->addLayout(toplay);
2385 connect(tx,SIGNAL(clicked()),
this,SLOT(
dialogXml()));
2386 connect(tp,SIGNAL(clicked()),
this,SLOT(
dialogPrint()));
2391 QLabel *titlelabel =
new QLabel(
this);
2392 titlelabel->setText(QString(
"<strong>%1</strong>").arg(
data->
tableTitle()));
2393 QHBoxLayout *titlelayout =
new QHBoxLayout(0);
2394 titlelayout->addStretch();
2395 titlelayout->addWidget(titlelabel);
2396 titlelayout->addStretch();
2397 layout->addLayout(titlelayout);
2400 layout->addWidget(
list);
2403 sdebug(QString(
"connect0: ") + (ok ?
"ok" :
"not-ok"));
2406 connect(
list,SIGNAL(activateItem(
const QString&)),
this,SLOT(
itemActivated(
const QString&)));
2408 connect(
list,SIGNAL(itemChanged(
const QString&)),
this,SLOT(
litemChanged(
const QString&)));
2409 sdebug(
"*** HDispList::HDispList *** END");
2444 sdebug(
"*** HDispList::~HDispList ***");
2452 sdebug(
"*** HDispList::~HDispList *** END");
2464 QStringList::Iterator ik =
data->
getKeys()->begin();
2465 QList<QStringList *>::Iterator iv =
data->
getValues()->begin();
2490 sdebug(
"*** HDispList::updateDisplay *** END");
2493 void HDispList::keyPressEvent(QKeyEvent *e)
2495 if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_R)
2499 QFrame::keyPressEvent(e);
2504 sdebug(
"*** HDispList::itemActivated ***");
2507 sdebug(
"*** HDispList::itemActivated *** END");
2513 sdebug(
"*** HDispList::itemAlternateActivated ***");
2516 sdebug(
"*** HDispList::itemAlternateActivated *** END");
2527 sdebug(
"*** HDispTable::HDispTable ***");
2535 layout=
new QVBoxLayout(
this);
2536 layout->setMargin(2);
2537 layout->setSpacing(2);
2548 QToolButton *tp,*tx;
2550 QHBoxLayout *toplay =
new QHBoxLayout(0);
2551 tx =
new QToolButton(
this);
2552 tp =
new QToolButton(
this);
2553 tx->setIcon(QPixmap( (
const char **) image_X ) );
2554 tp->setIcon(QPixmap( (
const char **) image_P ) );
2555 toplay->addSpacing(5);
2556 toplay->addWidget(tp);
2557 toplay->addSpacing(3);
2558 toplay->addWidget(tx);
2559 toplay->addStretch();
2561 layout->addLayout(toplay);
2562 connect(tx,SIGNAL(clicked()),
this,SLOT(
dialogXml()));
2563 connect(tp,SIGNAL(clicked()),
this,SLOT(
dialogPrint()));
2568 QLabel *titlelabel =
new QLabel(
this);
2569 titlelabel->setText(QString(
"<strong>%1</strong>").arg(
data->
tableTitle()));
2570 QHBoxLayout *titlelayout =
new QHBoxLayout(0);
2571 titlelayout->addStretch();
2572 titlelayout->addWidget(titlelabel);
2573 titlelayout->addStretch();
2574 layout->addLayout(titlelayout);
2580 QHBoxLayout* static_sublayout_before = HDispDataField::static_sublayout;
2581 if(!df->
isShow())
continue;
2597 if(!ok)
error(
"libGUI system HDispTable constructor:\n Cannot connect to subfield slot! (1)");
2599 ok = connect(df,SIGNAL(disableControl()),ddf,SLOT(disableControlSlot()));
2600 if(!ok)
error(
"libGUI system HDispTable constructor:\n Cannot connect to subfield slot! (2)");
2601 ok = connect(df,SIGNAL( enableControl()),ddf,SLOT( enableControlSlot()));
2602 if(!ok)
error(
"libGUI system HDispTable constructor:\n Cannot connect to subfield slot! (3)");
2604 ok = connect(df,SIGNAL(updateStaticDisplayElementsSignal()),ddf,SLOT(updateStaticGuiElementsSlot()));
2605 if(!ok)
error(
"libGUI system HDispTable constructor:\n Cannot connect to subfield slot! (4)");
2609 ddf->enableControlSlot();
2611 ddf->disableControlSlot();
2613 if(static_sublayout_before == NULL)
2614 layout->addWidget(ddf);
2616 static_sublayout_before->addWidget(ddf);
2620 sdebug(
"*** HDispTable::HDispTable *** END");
2626 QFrame *fr =
new QFrame(
this);
2629 palette.setColor(QPalette::Window,QColor(180,180,180));
2630 fr->setPalette(palette);
2631 fr->setAutoFillBackground(
true);
2633 QVBoxLayout *lay =
new QVBoxLayout(fr);
2636 layout->addWidget(fr);
2659 sdebug(
"*** HDispTable::~HDispTable ***");
2667 sdebug(
"*** HDispTable::~HDispTable *** END");
2672 sdebug(
"*** HDispTable::updateDisplay ***");
2678 sdebug(
"*** HDispTable::updateDisplay *** END");
2685 QHBoxLayout* HDispDataField::static_sublayout = NULL;
2687 HDispDataField::HDispDataField(QWidget *parent,
HDataField *d,
bool _ro_mask)
2695 if(
data->getRColor() != 0 &&
2696 data->getGColor() != 0 &&
2697 data->getBColor() != 0 )
2700 palette.setColor(QPalette::Window,QColor(
data->getRColor(),
2702 data->getBColor() ));
2704 setPalette(palette);
2705 setAutoFillBackground(
true);
2708 sublayout =
new QHBoxLayout(
this);
2709 sublayout->setMargin(2);
2710 sublayout->setSpacing(2);
2713 static_sublayout = sublayout;
2715 static_sublayout = NULL;
2720 void HDispDataField::enableControl(
void)
2724 void HDispDataField::disableControl(
void)
2729 int HDispDataField::updateDisplaySlot(
void)
2735 int HDispDataField::timedUpdateSlot(
void)
2737 sdebug(
"*** HDispDataField::timedUpdateSlot ***");
2748 if(blink >= 3) blink = 1;
2751 QTimer::singleShot(500,
this,SLOT(timedUpdateSlot()));
2756 void HDispDataField::paintEvent(QPaintEvent *e)
2768 p.setPen( blink%2 == 0 ? Qt::red : Qt::black);
2769 p.drawRect(0,0,width()-1,height()-1);
2771 QFrame::paintEvent(e);
2774 HDispDataField::~HDispDataField(
void)
2783 HDispKey::HDispKey(QWidget *parent,
HDataField *d,
bool _ro_mask)
2786 explain =
new QLabel(
this);
2787 key =
new QLabel(
this);
2789 explain->setText(
data->getExplainText());
2790 key->setText(
data->getValue().toString());
2792 sublayout->addWidget(explain);
2793 sublayout->addWidget(key);
2796 void HDispKey::enableControl(
void)
2800 void HDispKey::disableControl(
void)
2804 int HDispKey::updateDisplaySlot(
void)
2807 key->setText(data->
getValue().toString());
2812 int HDispKey::updateStaticGuiElementsSlot(
void)
2819 HDispKey::~HDispKey(
void)
2825 HDispSmallText::HDispSmallText(QWidget *parent,
HDataField *d,
bool _ro_mask)
2832 explain =
new QLabel(
this);
2833 explain->setText(
data->getExplainText());
2834 sublayout->addWidget(explain);
2837 sublayout->addStretch();
2841 edtext =
new QLineEdit(
this);
2842 edtext->setText(
data->getValue().toString());
2846 sublayout->addWidget(edtext);
2847 if(!connect(edtext,SIGNAL(textChanged(
const QString&)),
this,SLOT(textUpdate(
const QString&))))
2848 error(
"Error, connect(edtext,SIGNAL(textChanged(const QString&)),this,SLOT(textUpdate(const QString&)))");
2851 edtext->selectAll();
2852 sdebug(
" HDispSmallText: Initial selection is YES -- call selectAll()");
2857 nedtext =
new QLabel(
this);
2858 nedtext->setText(
data->getValue().toString());
2859 sublayout->addWidget(nedtext);
2862 if(!
data->getTailText().isEmpty())
2864 tailtext =
new QLabel(
this);
2865 tailtext->setText(
data->getTailText());
2866 sublayout->addWidget(tailtext);
2870 void HDispSmallText::enableControl(
void)
2873 edtext->setEnabled(
true);
2876 void HDispSmallText::disableControl(
void)
2879 edtext->setEnabled(
false);
2882 int HDispSmallText::textUpdate(
const QString& n)
2884 sdebug(
"*** HDispSmallText::textUpdate ***");
2886 sdebug(
"*** HDispSmallText::textUpdate *** END");
2890 int HDispSmallText::updateDisplaySlot(
void)
2892 sdebug(
"*** HDispSmallText::updateDisplaySlot ***");
2895 if(edtext->text() != data->
getValue().toString())
2897 edtext->setText ( data->
getValue().toString() );
2898 if(((
HSmallText *)data)->isInitialSelected())
2900 edtext->selectAll();
2901 sdebug(
" HDispSmallText: Initial selection is YES -- call selectAll()");
2905 if(nedtext != NULL) nedtext->setText( data->
getValue().toString() );
2906 sdebug(
"*** HDispSmallText::updateDisplaySlot *** END");
2910 int HDispSmallText::updateStaticGuiElementsSlot(
void)
2914 if(tailtext != NULL)
2919 HDispSmallText::~HDispSmallText(
void)
2925 HDispLargeText::HDispLargeText(QWidget *parent,
HDataField *d,
bool _ro_mask)
2931 explain =
new QLabel(
this);
2932 explain->setText(
data->getExplainText());
2933 sublayout->addWidget(explain);
2936 sublayout->addStretch();
2940 edtext =
new QTextEdit(
this);
2941 edtext->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
2942 edtext->setText(
data->getValue().toString());
2943 edtext->setTabChangesFocus(
true);
2944 edtext->setMinimumSize(100,50);
2945 sublayout->addWidget(edtext);
2946 if(!connect(edtext,SIGNAL(textChanged()),
this,SLOT(textUpdate())))
2947 error(
"Error, connect(edtext,SIGNAL(textChanged()),this,SLOT(textUpdate()))");
2951 nedtext =
new QTextEdit(
this);
2952 nedtext->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
2953 nedtext->setText(
data->getValue().toString());
2954 nedtext->setReadOnly(
true);
2955 nedtext->setMinimumSize(100,50);
2957 palette.setColor(QPalette::Base,QColor(
data->getRColor(),
2959 data->getBColor()));
2960 nedtext->setPalette(palette);
2961 sublayout->addWidget(nedtext);
2965 void HDispLargeText::enableControl(
void)
2968 edtext->setEnabled(
true);
2971 void HDispLargeText::disableControl(
void)
2974 edtext->setEnabled(
false);
2977 int HDispLargeText::textUpdate(
void)
2979 data->
setValue(QVariant(edtext->toPlainText()));
2983 int HDispLargeText::updateDisplaySlot(
void)
2987 if(data->
getValue().toString() != edtext->toPlainText())
2989 edtext->setText ( data->
getValue().toString() );
2994 nedtext->setText( data->
getValue().toString() );
2999 int HDispLargeText::updateStaticGuiElementsSlot(
void)
3007 HDispLargeText::~HDispLargeText(
void)
3012 HDispCharHash::HDispCharHash(QWidget *parent,
HDataField *d,
bool _ro_mask)
3020 explain =
new QLabel(
this);
3021 explain->setText(
data->getExplainText());
3022 sublayout->addWidget(explain);
3025 sublayout->addStretch();
3029 edval =
new QComboBox(
this);
3034 edval->setCurrentIndex(curr);
3037 sublayout->addWidget(edval);
3039 if(!connect(edval,SIGNAL(activated(
int)),
this,SLOT(itemSelected(
int))))
3040 error(
"Error, connect(edval,SIGNAL(activated(int)),this,SLOT(itemSelected(int)))");
3044 nedtext =
new QLabel(
this);
3048 sublayout->addWidget(nedtext);
3051 if(!
data->getTailText().isEmpty())
3053 tailtext =
new QLabel(
this);
3054 tailtext->setText(
data->getTailText());
3055 sublayout->addWidget(tailtext);
3060 void HDispCharHash::enableControl(
void)
3063 edval->setEnabled(
true);
3066 void HDispCharHash::disableControl(
void)
3069 edval->setEnabled(
false);
3072 int HDispCharHash::itemSelected(
int index)
3074 sdebug(
"*** HDispCharHash::itemSelected ***");
3076 sdebug(
"*** HDispCharHash::itemSelected *** END");
3080 int HDispCharHash::updateDisplaySlot(
void)
3084 if(edval != NULL) edval->setCurrentIndex(curr);
3085 if(nedtext != NULL) nedtext->setText( ((
HCharHash *)data)->values[curr] );
3089 int HDispCharHash::updateStaticGuiElementsSlot(
void)
3093 if(tailtext != NULL)
3098 HDispCharHash::~HDispCharHash(
void)
3104 HDispNumHash::HDispNumHash(QWidget *parent,
HDataField *d,
bool _ro_mask)
3112 explain =
new QLabel(
this);
3113 explain->setText(
data->getExplainText());
3114 sublayout->addWidget(explain);
3117 sublayout->addStretch();
3121 edval =
new QComboBox(
this);
3125 curr = getIndexOf( ((
HNumHash *)
data)->keys ,
data->getValue().toString());
3126 edval->setCurrentIndex(curr);
3129 sublayout->addWidget(edval);
3131 if(!connect(edval,SIGNAL(activated(
int)),
this,SLOT(itemSelected(
int))))
3132 error(
"Error, connect(edval,SIGNAL(activated(int)),this,SLOT(itemSelected(int)))");
3136 nedtext =
new QLabel(
this);
3137 curr = getIndexOf( ((
HNumHash *)
data)->keys ,
data->getValue().toString());
3140 sublayout->addWidget(nedtext);
3143 if(!
data->getTailText().isEmpty())
3145 tailtext =
new QLabel(
this);
3146 tailtext->setText(
data->getTailText());
3147 sublayout->addWidget(tailtext);
3151 void HDispNumHash::enableControl(
void)
3154 edval->setEnabled(
true);
3157 void HDispNumHash::disableControl(
void)
3160 edval->setEnabled(
false);
3163 int HDispNumHash::itemSelected(
int index)
3165 sdebug(
"HDispNumHash::itemSelected");
3170 int HDispNumHash::updateDisplaySlot(
void)
3173 curr = getIndexOf( ((
HNumHash *)data)->keys , data->
getValue().toString());
3174 if(edval != NULL) edval->setCurrentIndex(curr);
3175 if(nedtext != NULL) nedtext->setText( ((
HNumHash *)data)->values[curr] );
3179 int HDispNumHash::updateStaticGuiElementsSlot(
void)
3183 if(tailtext != NULL)
3189 HDispNumHash::~HDispNumHash(
void)
3195 HDispNumber::HDispNumber(QWidget *parent,
HDataField *d,
bool _ro_mask)
3202 explain =
new QLabel(
this);
3203 explain->setText(
data->getExplainText());
3204 sublayout->addWidget(explain);
3207 sublayout->addStretch();
3212 edval->setMinValue( ((
HNumber *)
data)->getMinimum() );
3213 edval->setMaxValue( ((
HNumber *)
data)->getMaximum() );
3214 edval->setValue(
data->getValue().toInt() );
3215 sublayout->addWidget(edval);
3217 valueUpdate(edval->value());
3218 if(!connect(edval,SIGNAL(valueChanged(
int)),
this,SLOT(valueUpdate(
int))))
3219 error(
"Error, connect(edval,SIGNAL(valueChanged(int)),this,SLOT(valueUpdate(int)))");
3223 nedtext =
new QLabel(
this);
3224 nedtext->setText( QString(
"%1").arg(
data->getValue().toInt()) );
3225 sublayout->addWidget(nedtext);
3228 if(!
data->getTailText().isEmpty())
3230 tailtext =
new QLabel(
this);
3231 tailtext->setText(
data->getTailText());
3232 sublayout->addWidget(tailtext);
3236 void HDispNumber::enableControl(
void)
3239 edval->setEnabled(
true);
3242 void HDispNumber::disableControl(
void)
3245 edval->setEnabled(
false);
3248 int HDispNumber::valueUpdate(
int value)
3251 updateDisplaySlot();
3255 int HDispNumber::updateDisplaySlot(
void)
3258 if(nedtext != NULL) nedtext->setText( QString(
"%1").arg(data->
getValue().toInt()) );
3262 int HDispNumber::updateStaticGuiElementsSlot(
void)
3266 if(tailtext != NULL)
3271 HDispNumber::~HDispNumber()
3277 HDispStatic::HDispStatic(QWidget *parent,
HDataField *d,
bool _ro_mask)
3282 if(
data->getValue().toString().isEmpty())
3284 sublayout->addStretch(99);
3287 explain =
new QLabel(
this);
3288 explain->setText(
data->getExplainText());
3290 sublayout->addWidget(explain);
3292 sublayout->addStretch(99);
3294 if(!
data->getValue().toString().isEmpty())
3296 nedtext =
new QLabel(
this);
3297 nedtext->setText(
data->getValue().toString() );
3298 sublayout->addWidget(nedtext);
3303 void HDispStatic::enableControl(
void)
3307 void HDispStatic::disableControl(
void)
3311 int HDispStatic::updateDisplaySlot(
void)
3314 if(!data->
getValue().toString().isEmpty())
3317 nedtext->setText( data->
getValue().toString() );
3323 int HDispStatic::updateStaticGuiElementsSlot(
void)
3330 HDispStatic::~HDispStatic(
void)
3335 HDispCheck::HDispCheck(QWidget *parent,
HDataField *d,
bool _ro_mask)
3341 explain =
new QLabel(
this);
3342 explain->setText(
data->getExplainText());
3343 sublayout->addWidget(explain);
3346 sublayout->addStretch();
3350 edval =
new QCheckBox(
this);
3351 edval->setChecked(
data->getValue().toBool() );
3352 edval->setText(
data->getTailText() );
3353 sublayout->addWidget(edval);
3355 if(!connect(edval,SIGNAL(clicked()),
this,SLOT(valueUpdate())))
3356 error(
"Error, connect(edval,SIGNAL(clicked()),this,SLOT(valueUpdate()))");
3360 nedtext =
new QLabel(
this);
3361 nedtext->setText( QString(
"%1")
3362 .arg(
data->getValue().toBool() ?
3365 sublayout->addWidget(nedtext);
3369 void HDispCheck::enableControl(
void)
3372 edval->setEnabled(
true);
3375 void HDispCheck::disableControl(
void)
3378 edval->setEnabled(
false);
3381 int HDispCheck::valueUpdate(
void)
3383 data->
setValue(QVariant(edval->isChecked()));
3387 int HDispCheck::updateDisplaySlot(
void)
3391 edval->setChecked( data->
getValue().toBool() );
3396 nedtext->setText( QString(
"%1")
3403 int HDispCheck::updateStaticGuiElementsSlot(
void)
3410 HDispCheck::~HDispCheck(
void)
3415 HDispFloating::HDispFloating(QWidget *parent,
HDataField *d,
bool _ro_mask)
3422 explain =
new QLabel(
this);
3423 explain->setText(
data->getExplainText());
3424 sublayout->addWidget(explain);
3428 sublayout->addStretch();
3432 edtext =
new QLineEdit(
this);
3435 edtext->setAlignment(Qt::AlignRight);
3436 edtext->setText(
data->getValue().toString());
3439 sublayout->addWidget(edtext);
3440 if(!connect(edtext,SIGNAL(textChanged(
const QString&)),
this,SLOT(textUpdate(
const QString&))))
3441 error(
"Error, connect(edtext,SIGNAL(textChanged(const QString&)),this,SLOT(textUpdate(const QString&)))");
3445 nedtext =
new QLabel(
this);
3446 nedtext->setText(
data->dbValueToDispValue(
data->getValue()).toString());
3447 sublayout->addWidget(nedtext);
3450 if(!
data->getTailText().isEmpty() && nedtext==NULL)
3454 tailtext =
new QLabel(
this);
3455 tailtext->setText(
data->getTailText());
3456 sublayout->addWidget(tailtext);
3460 void HDispFloating::enableControl(
void)
3463 edtext->setEnabled(
true);
3466 void HDispFloating::disableControl(
void)
3469 edtext->setEnabled(
false);
3472 int HDispFloating::textUpdate(
const QString& n)
3476 sdebug(
"*** HDispFloating::textUpdate ***");
3480 number.replace(
" ",
"",Qt::CaseInsensitive);
3482 if(number.isEmpty() || number ==
"-" || number==
".")
3488 d = number.toDouble(&ok);
3491 error(QString(
"Cannot convert the string vale to floating!\nColumn \"%1\" (%2) \nPlease corrent the value!")
3494 updateDisplaySlot();
3502 int HDispFloating::updateDisplaySlot(
void)
3504 sdebug(
"*** HDispFloating::updateDisplaySlot ***");
3505 if(edtext != NULL) edtext->setText (data->
getValue().toString() );
3512 int HDispFloating::updateStaticGuiElementsSlot(
void)
3516 if(tailtext != NULL)
3521 HDispFloating::~HDispFloating(
void)
3526 HDispDate::HDispDate(QWidget *parent,
HDataField *d,
bool _ro_mask)
3533 explain =
new QLabel(
this);
3534 explain->setText(
data->getExplainText());
3535 sublayout->addWidget(explain);
3538 sublayout->addStretch();
3543 edval =
new QDateEdit(
this);
3544 edval->setCalendarPopup(
true);
3545 edval->setDate(((
HDate *)
data)->getKnownValue().toDate());
3549 unk =
new QCheckBox(
this);
3553 unk->setChecked(
true);
3554 edval->setEnabled(
false);
3558 unk->setChecked(
false);
3559 edval->setEnabled(
true);
3562 sublayout->addWidget(unk);
3563 if(!connect(unk,SIGNAL(clicked()),
this,SLOT(valueUnkUpdate())))
3564 error(
"Error, connect(unk,SIGNAL(clicked()),this,SLOT(valueUnkUpdate()))");
3567 sublayout->addWidget(edval);
3568 if(!connect(edval,SIGNAL(dateChanged(
const QDate&)),
this,SLOT(valueUpdate(
const QDate&))))
3569 error(
"Error, connect(edval,SIGNAL(dateChanged(const QDate&)),this,SLOT(valueUpdate(const QDate&)))!");
3573 nedtext =
new QLabel(
this);
3577 nedtext->setText(
data->getValue().toString());
3578 sublayout->addWidget(nedtext);
3582 void HDispDate::enableControl(
void)
3587 unk->setEnabled(
true);
3589 if(((
HDate *)data)->is_value_unknown())
3591 edval->setEnabled(
false);
3595 edval->setEnabled(
true);
3600 void HDispDate::disableControl(
void)
3603 edval->setEnabled(
false);
3605 unk->setEnabled(
false);
3608 int HDispDate::valueUnkUpdate(
void)
3610 if(unk->isChecked())
3612 ((
HDate *)data)->value_is_unknown();
3613 edval->setEnabled(
false );
3617 ((
HDate *)data)->value_is_known();
3618 edval->setEnabled(
true );
3622 int HDispDate::valueUpdate(
const QDate &d)
3628 int HDispDate::updateDisplaySlot(
void)
3632 edval->setDate(data->
getValue().toDate());
3635 unk->setChecked( ((
HDate *)data)->is_value_unknown() );
3636 edval->setEnabled( !((
HDate *)data)->is_value_unknown() );
3639 edval->setEnabled(
true);
3644 if( ((
HDate *)data)->is_unknown_alive() && ((
HDate *)data)->is_value_unknown() )
3647 nedtext->setText(data->
getValue().toString());
3652 int HDispDate::updateStaticGuiElementsSlot(
void)
3659 HDispDate::~HDispDate(
void)
3665 HDispTimestamp::HDispTimestamp(QWidget *parent,
HDataField *d,
bool _ro_mask)
3670 explain =
new QLabel(
this);
3671 explain->setText(
data->getExplainText());
3672 sublayout->addWidget(explain);
3675 sublayout->addStretch();
3677 nedtext =
new QLabel(
this);
3678 nedtext->setText(
data->dbValueToDispValue(
data->getValue()).toString());
3679 sublayout->addWidget(nedtext);
3683 void HDispTimestamp::enableControl(
void)
3687 void HDispTimestamp::disableControl(
void)
3691 int HDispTimestamp::updateDisplaySlot(
void)
3693 nedtext->setText( data->
getValue().toString() );
3697 int HDispTimestamp::updateStaticGuiElementsSlot(
void)
3704 HDispTimestamp::~HDispTimestamp(
void)
3710 HDispSqlChoose::HDispSqlChoose(QWidget *parent,
HDataField *d,
bool _ro_mask)
3719 explain =
new QLabel(
this);
3720 explain->setText(
data->getExplainText());
3721 sublayout->addWidget(explain);
3724 sublayout->addStretch();
3729 edval =
new QComboBox(
this);
3735 mess=QString(
"Warning: You selected an sqlchoose with easyform,\n"
3736 "but you don't have any element in the targetted table!\n"
3737 "You can't use initial null value in easyform sqlchoose!\n"
3739 .arg(
data->sqlInsertHead());
3751 edval->setCurrentIndex(curr);
3754 rfbutt =
new QToolButton(
this);
3755 rfbutt->setIcon( QPixmap( (
const char **) refreshbutton_data ) );
3756 sublayout->addWidget(edval);
3757 sublayout->addWidget(rfbutt);
3758 if(!connect(edval,SIGNAL(activated(
int)),
this,SLOT(itemSelected(
int))))
3759 error(
"Error, connect(edval,SIGNAL(activated(int)),this,SLOT(itemSelected(int)))");
3760 if(!connect(rfbutt,SIGNAL(clicked()),
this,SLOT(refresh())))
3761 error(
"Error, connect(rfbutt,SIGNAL(clicked()),this,SLOT(refresh()))");
3765 pbutt =
new QPushButton(
this);
3767 if(
data->getValue().toString() ==
"NULL" || ((
HSqlChoose *)
data)->getKeys().count() == 0)
3770 pbutt->setText(
" - ");
3780 sublayout->addWidget(pbutt);
3781 if(!connect(pbutt,SIGNAL(clicked()),
this,SLOT(popupSelector())))
3782 error(
"Error, connect(pbutt,SIGNAL(clicked()),this,SLOT(popupSelector()))");
3788 nedtext =
new QLabel(
this);
3789 if(
data->getValue().toString() ==
"NULL")
3792 nedtext->setText(
" - ");
3799 sublayout->addWidget(nedtext);
3803 void HDispSqlChoose::enableControl(
void)
3806 edval->setEnabled(
true);
3808 pbutt->setEnabled(
true);
3811 void HDispSqlChoose::disableControl(
void)
3814 edval->setEnabled(
false);
3816 pbutt->setEnabled(
false);
3819 int HDispSqlChoose::popupSelector(
void)
3821 pupup_dialog=
new SqlChooseDialog(
this);
3825 pupup_dialog->exec();
3826 delete pupup_dialog;
3830 int HDispSqlChoose::refresh(
void)
3833 updateDisplaySlot();
3837 int HDispSqlChoose::itemSelected(
int index)
3843 int HDispSqlChoose::updateDisplaySlot(
void)
3845 sdebug(
"*** HDispSqlChoose::updateDisplaySlot ***");
3848 if(data->
getValue().toString() ==
"NULL" || ((
HSqlChoose *)data)->getKeys().count() == 0)
3858 edval->addItems( ((
HSqlChoose *)data)->getValues() );
3859 edval->setCurrentIndex(curr);
3865 pbutt->setText(
" - ");
3867 pbutt->setText((((
HSqlChoose *)data)->getValues())[curr]);
3873 nedtext->setText(
" - ");
3875 nedtext->setText( (((
HSqlChoose *)data)->getValues())[curr]);
3877 sdebug(
"*** HDispSqlChoose::updateDisplaySlot ***END");
3881 int HDispSqlChoose::updateStaticGuiElementsSlot(
void)
3888 void HDispSqlChoose::setToolbarbuttonSignalOn(QString text)
3890 ((
HSqlChoose *)data)->toolbarbutton_down_text = text;
3893 void HDispSqlChoose::setToolbarbuttonSignalOff()
3895 ((
HSqlChoose *)data)->toolbarbutton_down_text =
"";
3898 int HDispSqlChoose::itemSelected(
const QString& s)
3903 pupup_dialog->close();
3904 updateDisplaySlot();
3908 HDispSqlChoose::~HDispSqlChoose(
void)
3913 : QDialog( p , Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint)
3918 SqlChooseDialogLayout =
new QVBoxLayout(
this);
3919 SqlChooseDialogLayout->setMargin(11);
3920 SqlChooseDialogLayout->setSpacing(6);
3922 disabled_recvkey =
true;
3925 SqlChooseDialogLayout->addWidget( table );
3927 layout1 =
new QHBoxLayout(0);
3928 layout1->setMargin(0);
3929 layout1->setSpacing(6);
3931 QSpacerItem* spacer =
new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
3932 layout1->addItem( spacer );
3934 button =
new QPushButton(
this);
3937 QPushButton *xbutton =
new QPushButton(
this);
3939 xbutton->setMinimumHeight(25);
3940 xbutton->setMinimumWidth (25);
3941 xbutton->setMaximumHeight(25);
3942 xbutton->setMaximumWidth (25);
3943 xbutton->setText(
"N");
3945 layout1->addWidget( xbutton );
3946 layout1->addWidget( button );
3948 if( parent->getHSqlChoose()->toolbrec != NULL && !parent->getHSqlChoose()->btext.isEmpty() )
3950 QPushButton *plusbutton =
new QPushButton(
this);
3951 plusbutton->setText(parent->getHSqlChoose()->btext);
3953 if(!connect(plusbutton,SIGNAL(clicked()),
this,SLOT(toolbarButtonClicked())))
3954 error(
"Cannot connect to the plus_toolbar button!");
3956 if(!connect(
this,SIGNAL(callToolButtonHandler()),parent->getHSqlChoose()->toolbrec,SLOT(toolbuttonclicked()) ))
3957 error(
"Cannot connect to the plus_toolbar button!");
3959 if(!connect(parent->getHSqlChoose()->toolbrec,SIGNAL(setKeyTo(QString)),
this,SLOT(receivedASelectedKey(QString))))
3964 layout1->addWidget( plusbutton );
3968 have_extra_func =
false;
3970 if(!parent->getHSqlChoose()->extrafunc_text[i].isEmpty())
3972 have_extra_func =
true;
3976 connect(
this,SIGNAL(sigToExtraFunc_0(QString)),
3977 parent->getHSqlChoose()->extrafunc_receiver[i],SLOT(extrafunc_0(QString)));
break;
3979 connect(
this,SIGNAL(sigToExtraFunc_1(QString)),
3980 parent->getHSqlChoose()->extrafunc_receiver[i],SLOT(extrafunc_1(QString)));
break;
3982 connect(
this,SIGNAL(sigToExtraFunc_2(QString)),
3983 parent->getHSqlChoose()->extrafunc_receiver[i],SLOT(extrafunc_2(QString)));
break;
3985 connect(
this,SIGNAL(sigToExtraFunc_3(QString)),
3986 parent->getHSqlChoose()->extrafunc_receiver[i],SLOT(extrafunc_3(QString)));
break;
3988 connect(
this,SIGNAL(sigToExtraFunc_4(QString)),
3989 parent->getHSqlChoose()->extrafunc_receiver[i],SLOT(extrafunc_4(QString)));
break;
3995 connect(table,SIGNAL(alternateActivateItem(
const QString& )),
3996 this,SLOT(popUpMenuActivated(
const QString&)));
3999 QSpacerItem* spacer_2 =
new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
4000 layout1->addItem( spacer_2 );
4001 SqlChooseDialogLayout->addLayout( layout1 );
4003 setWindowTitle(parent->getHSqlChoose()->getPopupDialogTitle().isEmpty()
4005 : parent->getHSqlChoose()->getPopupDialogTitle()
4010 resize( QSize(300, 300).expandedTo(minimumSizeHint()) );
4013 connect(xbutton,SIGNAL(clicked()),
this,SLOT(nullButtonPressed()));
4014 connect(button,SIGNAL(clicked()),
this,SLOT(buttonPressed()));
4015 connect(table,SIGNAL(activateItem(
const QString& )),
4016 this,SLOT(listviewitemSelected(
const QString& )));
4018 connect(
this,SIGNAL(itemSelected(
const QString&))
4019 ,parent,SLOT(itemSelected(
const QString&)));
4023 this,SLOT(captureNotify(QString)));
4025 setSizeGripEnabled(
true);
4026 setWindowState(Qt::WindowActive);
4029 int SqlChooseDialog::captureNotify(QString tblname)
4031 sdebug(
"*** SqlChooseDialog::captureNotify ***");
4032 QStringList::iterator i;
4034 sdebug(QString(
" %1 == %2").arg(tblname).arg(parent->getHSqlChoose()->getConnectedTableName()));
4035 if(parent->getHSqlChoose()->getConnectedTableName() == tblname)
4037 sdebug(
"Call updateList()");
4043 int SqlChooseDialog::updateList(
void)
4048 sdebug(
"*** SqlChooseDialog::updateList ***");
4051 QString headertext=
"";
4054 #ifdef PROGRESS_POSSIBILITY
4055 if(parent->getHSqlChoose()->progress_on_read)
4058 if(!connect(parent->getHSqlChoose(),SIGNAL(doWorking()),pww,SLOT(progress())))
4059 sdebug(
"Cannot connect the SQLChoose-progress-signal to progress-dialog-slot!");
4063 parent->getHSqlChoose()->refreshSqlValues(
false);
4064 headertext=parent->getHSqlChoose()->getFieldHeads();
4065 QStringList v = parent->getHSqlChoose()->getSeparatedValues();
4066 QStringList k = parent->getHSqlChoose()->getKeys();
4069 if(headertext.isEmpty())
4070 { h = QString(
"A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|R|S|T").split(
"|",QString::SkipEmptyParts); }
4072 { h = headertext.split(
"|",QString::SkipEmptyParts); }
4073 table->setHeadTexts(h);
4074 QStringList::Iterator itv = v.begin();
4075 QStringList::Iterator itk = k.begin();
4076 while ( itv != v.end() && itk != k.end() )
4078 QStringList vals = itv->split(
"|",QString::KeepEmptyParts);
4084 if((i = parent->getHSqlChoose()->getGuiSortIndicator()) != -1)
4087 #ifdef PROGRESS_POSSIBILITY
4092 table->setCurrentElement(parent->getHSqlChoose()->getValue().toString());
4096 int SqlChooseDialog::popUpMenuActivated(
const QString& key)
4098 sdebug(
"*** SqlChooseDialog::popUpMenuActivated ***");
4100 QMenu *popup =
new QMenu(
this);
4101 popup->setTitle(QString(
"Function on \"%1\"").arg(key));
4102 popup->addAction(
" ");
4103 popup->addSeparator();
4106 if(!parent->getHSqlChoose()->extrafunc_text[i].isEmpty())
4111 popup->addAction(parent->getHSqlChoose()->extrafunc_text[i],
this,SLOT(popup_catch_0()));
4114 popup->addAction(parent->getHSqlChoose()->extrafunc_text[i],
this,SLOT(popup_catch_1()));
4117 popup->addAction(parent->getHSqlChoose()->extrafunc_text[i],
this,SLOT(popup_catch_2()));
4120 popup->addAction(parent->getHSqlChoose()->extrafunc_text[i],
this,SLOT(popup_catch_3()));
4123 popup->addAction(parent->getHSqlChoose()->extrafunc_text[i],
this,SLOT(popup_catch_4()));
4128 popup->exec(table->mapToGlobal(QPoint(table->mouseRightClickPosX,table->mouseRightClickPosY)));
4133 int SqlChooseDialog::popup_catch_0(
void) { emit sigToExtraFunc_0(popupped_key);
return 0; }
4134 int SqlChooseDialog::popup_catch_1(
void) { emit sigToExtraFunc_1(popupped_key);
return 0; }
4135 int SqlChooseDialog::popup_catch_2(
void) { emit sigToExtraFunc_2(popupped_key);
return 0; }
4136 int SqlChooseDialog::popup_catch_3(
void) { emit sigToExtraFunc_3(popupped_key);
return 0; }
4137 int SqlChooseDialog::popup_catch_4(
void) { emit sigToExtraFunc_4(popupped_key);
return 0; }
4139 int SqlChooseDialog::toolbarButtonClicked(
void)
4143 parent->setToolbarbuttonSignalOn( parent->getHSqlChoose()->btext );
4144 key_received =
false;
4145 ckey = table->currentKey();
4146 disabled_recvkey =
false;
4147 emit callToolButtonHandler();
4149 disabled_recvkey =
true;
4154 ckey = received_key;
4156 table->setCurrentElement(ckey);
4157 key_received =
false;
4158 parent->setToolbarbuttonSignalOff();
4162 int SqlChooseDialog::nullButtonPressed(
void)
4166 emit itemSelected(k);
4170 int SqlChooseDialog::buttonPressed(
void)
4173 k = table->currentKey();
4174 emit itemSelected(k);
4178 int SqlChooseDialog::listviewitemSelected(
const QString& s)
4180 sdebug(
" *** SqlChooseDialog::listviewitemSelected *** ");
4181 emit itemSelected(s);
4182 sdebug(
" *** SqlChooseDialog::listviewitemSelected *** END");
4186 SqlChooseDialog::~SqlChooseDialog()
4191 int SqlChooseDialog::receivedASelectedKey(QString key)
4193 if(disabled_recvkey)
4199 key_received =
true;
4205 HShowPrintHtml::HShowPrintHtml(QWidget *parent)
4208 QVBoxLayout *vl =
new QVBoxLayout(
this);
4209 QHBoxLayout *toolbuttons =
new QHBoxLayout(0);
4210 QHBoxLayout *bottom =
new QHBoxLayout(0);
4212 QToolButton *tp =
new QToolButton(
this);
4213 QToolButton *tst =
new QToolButton(
this);
4214 QToolButton *ts =
new QToolButton(
this);
4216 tp->setIcon(QPixmap(image_P));
4217 ts->setIcon(QPixmap(image_Y));
4218 tst->setIcon(QPixmap(image_E));
4219 toolbuttons->addWidget(tp);
4220 toolbuttons->addSpacing(3);
4221 toolbuttons->addWidget(tst);
4222 toolbuttons->addSpacing(3);
4223 toolbuttons->addWidget(ts);
4224 toolbuttons->addStretch();
4226 QPushButton *okbutt =
new QPushButton(
"Ok",
this);
4227 bottom->addStretch();
4228 bottom->addWidget(okbutt);
4229 bottom->addStretch();
4231 #ifdef WEBKITBASED_HTMLSHOW
4232 te =
new QWebView(
this);
4234 te =
new QTextEdit(
this);
4235 te->setReadOnly(
true);
4238 vl->addLayout(toolbuttons);
4240 vl->addLayout(bottom);
4242 connect(tp,SIGNAL(clicked()),
this,SLOT(slotPrint()));
4243 connect(ts,SIGNAL(clicked()),
this,SLOT(slotSave()));
4244 connect(tst,SIGNAL(clicked()),
this,SLOT(slotStart()));
4246 connect(okbutt,SIGNAL(clicked()),
this,SLOT(accept()));
4247 setSizeGripEnabled(
true);
4253 void HShowPrintHtml::setWinTitle(QString t)
4258 void HShowPrintHtml::setContent(QString str)
4260 te->setHtml(html=str);
4263 void HShowPrintHtml::slotSave(
void)
4266 o = QFileDialog::getSaveFileName(
this,
"The output .html file",
"",
"*.html");
4271 if (f.open(QIODevice::WriteOnly))
4273 QTextStream *s =
new QTextStream(&f);
4281 error(
"Cannot create file!");
4287 void HShowPrintHtml::slotStart(
void)
4289 QString o=
"_temptoext_edit.html";
4291 if (f.open(QIODevice::WriteOnly))
4293 QTextStream *s =
new QTextStream(&f);
4294 *s << convNationalToHtmlCodes(html);
4300 error(
"Cannot create temporally file!");
4304 QString program = EXT_EDIT_PROCESS;
4305 QStringList arguments;
4308 QProcess *myProcess =
new QProcess(
this);
4309 myProcess->start(program, arguments);
4311 QDialog *d =
new QDialog(
this);
4314 QLabel *l=
new QLabel(d);
4317 QHBoxLayout *lay =
new QHBoxLayout(d);
4320 connect(myProcess,SIGNAL(finished(
int,QProcess::ExitStatus)),d,SLOT(close()));
4328 void HShowPrintHtml::slotPrint(
void)
4330 QPrinter *printer =
new QPrinter();
4331 printer->setPageSize(QPrinter::A4);
4332 QPrintDialog printDialog(printer,
this);
4334 if (printDialog.exec() == QDialog::Accepted)
4337 #ifdef WEBKITBASED_HTMLSHOW
4340 int dpi = printer->logicalDpiY();
4341 QTextDocument *textdoc = te->document();
4343 QRectF pageRect(printer->pageRect());
4344 QRectF body = QRectF(0,0, pageRect.width(),pageRect.height());
4346 textdoc->setPageSize(body.size());
4348 QTextFrame *rootframe = textdoc->rootFrame();
4349 QTextFrameFormat tff = rootframe->frameFormat();
4352 tff.setMargin((2/2.54)*dpi);
4353 tff.setTopMargin((2/2.54)*dpi);
4354 tff.setLeftMargin((2/2.54)*dpi);
4355 tff.setRightMargin((2/2.54)*dpi);
4356 tff.setBottomMargin((2/2.54)*dpi);
4358 rootframe->setFrameFormat(tff);
4360 textdoc->print(printer);
4366 HShowPrintHtml::~HShowPrintHtml(
void)
4375 HPleaseWaitWindow::HPleaseWaitWindow(
int sizex_,
int sizey_,
int refreshTime_) :
4376 QWidget(0,Qt::SplashScreen | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassGraphicsProxyWidget)
4381 refreshTime = refreshTime_;
4382 setMinimumSize(sizex,sizey);
4383 setMaximumSize(sizex,sizey);
4386 if(QApplication::activeWindow() == NULL)
4389 QDesktopWidget *d = QApplication::desktop();
4390 r = d->screenGeometry();
4391 setGeometry((r.width()-sizex)/2,(r.height()-sizey)/2,sizex,sizey);
4397 w = QApplication::activeWindow();
4398 QPoint gpos=w->mapToGlobal(QPoint(0,0));
4399 setGeometry(gpos.x()+((w->width()-sizex)/2),gpos.y()+((w->height()-sizey)/2),sizex,sizey);
4403 t=QTime::currentTime();
4408 HPleaseWaitWindow::~HPleaseWaitWindow(
void)
4416 tt=QTime::currentTime();
4417 if(t.msecsTo(tt) < refreshTime)
return;
4420 if(!isActiveWindow())
4424 QApplication::processEvents();
4427 void HPleaseWaitWindow::mousePressEvent(QMouseEvent *me)
4433 void HPleaseWaitWindow::mouseMoveEvent(QMouseEvent *me)
4435 move(me->globalX()-lastx,me->globalY()-lasty);
4445 p.setRenderHint(QPainter::Antialiasing);
4446 p.setClipping(FALSE);
4447 p.drawRect(1,1,78,78);
4449 p.setBrush(Qt::SolidPattern);
4453 p.setBrush(QColor(7*30-i*30,7*30-i*30,7*30-i*30));
4454 p.setPen(QColor(7*30-i*30,7*30-i*30,7*30-i*30));
4455 p.drawPie(15,15,50,50,360*16-(seq*640+i*10*16),10*16);
4492 : QDialog(parent,Qt::FramelessWindowHint)
4495 setMouseTracking(
true);
4497 this->no_action_closetime = no_action_closetime;
4498 this->title = title;
4503 titlefont = QFont(
"times", 24);
4511 titlecolor = QColor(0,0,0);
4512 indcolor = QColor(160,100,100);
4515 if(no_action_closetime != 0)
4517 end_t = ((int)(1000 / t_time)) * no_action_closetime;
4519 QTimer::singleShot(t_time,
this,SLOT(incr_t()));
4529 QFontMetrics fm(titlefont);
4530 mw = fm.width(title);
4532 setMinimumWidth(mw);
4536 int HDecorDialog::incr_t(
void)
4546 QTimer::singleShot(t_time,
this,SLOT(incr_t()));
4551 void HDecorDialog::paintEvent(QPaintEvent *pe)
4556 p.setRenderHint(QPainter::Antialiasing);
4557 p.fillRect(0,0,width(),height(),QBrush(
bgcolor,Qt::SolidPattern));
4561 p.setPen(titlecolor);
4564 if(t_t >= (
int)((1000 / t_time)))
4567 max = end_t-(1000 / t_time);
4568 curr = t_t -(1000 / t_time);
4570 p.setBrush(QBrush(indcolor,Qt::SolidPattern));
4574 p.setPen(QPen(QBrush(
frcolor,Qt::SolidPattern),
crossthick,Qt::SolidLine,Qt::RoundCap));
4584 QDialog::paintEvent(pe);
4588 void HDecorDialog::mousePressEvent(QMouseEvent *e)
4607 void HDecorDialog::mouseMoveEvent(QMouseEvent *e)
4614 void HDecorDialog::keyPressEvent(QKeyEvent *e)
4629 font = QApplication::font();
4631 font.setPointSize(8);
4639 setFocusPolicy(Qt::StrongFocus);
4669 enablestat = enable;
4677 c3deffect = effectwidth;
4689 font.setPointSize(size);
4700 void HPressButton::calcSize()
4703 QFontMetrics fm(font);
4706 boundingr = fm.boundingRect(textstr);
4708 x = boundingr.width() + 2*(c3deffect + cmargin);
4709 y = boundingr.height() + 2*(c3deffect + cmargin);
4710 if(size_sync != NULL)
4712 if(size_sync->mx < x ) size_sync->mx = x;
4713 if(size_sync->my < y ) size_sync->my = y;
4717 setMinimumSize(x,y);
4727 if(r < c3deffect*rd) r=c3deffect*rd;
4728 if(g < c3deffect*gd) g=c3deffect*gd;
4729 if(b < c3deffect*bd) b=c3deffect*bd;
4731 if(r + c3deffect*rd > 255) r=255-c3deffect*rd;
4732 if(g + c3deffect*gd > 255) g=255-c3deffect*gd;
4733 if(b + c3deffect*bd > 255) b=255-c3deffect*bd;
4736 void HPressButton::paintEvent(QPaintEvent *e)
4744 QWidget::paintEvent(e);
4748 p.setRenderHint(QPainter::Antialiasing);
4752 ex = width()-c3deffect;
4753 ey = height()-c3deffect;
4755 p.fillRect(0,0,width(),height(),QBrush(QColor(r,g,b)));
4758 for(i=0;i<c3deffect;++i)
4760 p.setPen(QColor(r+rd*i,g+gd*i,b+bd*i)); p.drawLine(sx-i,sy-i,ex+i,sy-i);
4761 p.setPen(QColor(r-rd*i,g-gd*i,b-bd*i)); p.drawLine(ex+i,sy-i,ex+i,ey+i);
4762 p.setPen(QColor(r-rd*i,g-gd*i,b-bd*i)); p.drawLine(ex+i,ey+i,sx-i,ey+i);
4763 p.setPen(QColor(r+rd*i,g+gd*i,b+bd*i)); p.drawLine(sx-i,sy-i,sx-i,ey+i);
4766 for(i=0;i<c3deffect;++i)
4768 p.setPen(QColor(r-rd*i,g-gd*i,b-bd*i)); p.drawLine(sx-i,sy-i,ex+i,sy-i);
4769 p.setPen(QColor(r+rd*i,g+gd*i,b+bd*i)); p.drawLine(ex+i,sy-i,ex+i,ey+i);
4770 p.setPen(QColor(r+rd*i,g+gd*i,b+bd*i)); p.drawLine(ex+i,ey+i,sx-i,ey+i);
4771 p.setPen(QColor(r-rd*i,g-gd*i,b-bd*i)); p.drawLine(sx-i,sy-i,sx-i,ey+i);
4776 p.setPen(QColor(0,0,0));
4778 p.setPen(QColor(100,100,100));
4780 p.drawText(sx,sy+(down ? 1 : -1),ex-sx,ey-sy+(down ? 1 : -1),
4781 Qt::AlignHCenter | Qt::AlignVCenter , textstr);
4785 p.setPen(QPen(QBrush(QColor(255,0,0),Qt::SolidPattern),6,Qt::SolidLine,Qt::RoundCap));
4786 p.drawLine(c3deffect+cmargin+15,
4788 width()-(c3deffect+cmargin+15),
4789 height()-(c3deffect+cmargin));
4790 p.drawLine(c3deffect+cmargin+15,
4791 height()-(c3deffect+cmargin),
4792 width()-(c3deffect+cmargin+15),
4796 QWidget::paintEvent(e);
4799 void HPressButton::keyPressEvent(QKeyEvent *e)
4801 if(hidestat || !enablestat)
4803 QFrame::keyPressEvent(e);
4809 QFrame::keyPressEvent(e);
4812 void HPressButton::keyReleaseEvent(QKeyEvent *e)
4814 if(hidestat || !enablestat)
4816 QFrame::keyReleaseEvent(e);
4827 QFrame::keyReleaseEvent(e);
4830 void HPressButton::mousePressEvent(QMouseEvent *e)
4832 if(hidestat || !enablestat)
4834 QFrame::mousePressEvent(e);
4840 QFrame::mousePressEvent(e);
4843 void HPressButton::mouseReleaseEvent(QMouseEvent *e)
4845 if(hidestat || !enablestat)
4847 QFrame::mouseReleaseEvent(e);
4851 bool willemit=
false;
4857 QFrame::mouseReleaseEvent(e);
4866 void HPressButton::mouseMoveEvent(QMouseEvent *e)
4868 if(hidestat || !enablestat)
4870 QFrame::mouseMoveEvent(e);
4874 if(down && ( e->x() < 0 || e->x() > width()))
4881 if(down && ( e->y() < 0 || e->y() > height()))
4887 QFrame::mouseMoveEvent(e);
4904 QList<QString> hhead;
4905 QList<QString> vhead;
4922 qtw->setColumnCount(c);
4923 qtw->setRowCount(r);
4925 qtw->setHorizontalHeaderLabels(hhead);
4926 qtw->setVerticalHeaderLabels(vhead);
4928 QTableWidgetItem *item;
4931 for(cc = 0 ; cc < c ; ++cc)
4932 for(rr = 0; rr < r ; ++rr)
4934 item =
new QTableWidgetItem();
4949 cells.push_back(cd);
4960 item->setBackground(Qt::white);
4965 item->setFlags(!Qt::ItemIsEditable);
4966 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
4968 item->setBackground(Qt::darkGray);
4970 qtw->setItem(rr,cc,item);
4973 connect(qtw,SIGNAL(cellChanged(
int,
int)),
this,SLOT(
slotCellChanged(
int,
int)));
4975 connect(dynt,SIGNAL(dataChangedNongui()),
this,SLOT(
refreshGui()));
4978 HDynTableDispConnector::~HDynTableDispConnector(
void)
4993 QTableWidgetItem *item = NULL;
4994 QList<cellData>::iterator i = cells.begin();
4995 while(i != cells.end())
4997 if(i->r == row && i->c == column)
4999 QColor c = Qt::white;
5007 c.setRgb(255,100,100);
5009 item->setBackground(QBrush(c));
5024 QTableWidgetItem *item = NULL;
5025 QList<cellData>::iterator i = cells.begin();
5026 while(i != cells.end())
5032 item->setBackground(QBrush(Qt::white));
HDataField * nextFieldAll(void)
void queryToCurrent(void)
QStringList * queryNextValues(void)
QString * queryNextKey(void)
HSpinBox(QWidget *parent)
HSpinBox ////////////////////////////////////////////////////////////////////.
HPlainDMD(QWidget *parent, HBase *d, bool htmlmode=false)
QString currentElementColumnName(void)
QString getElementValueString(QString name, bool *found=NULL)
int editBoxMaxWidth(void)
int alternateActLine(void)
~HDispPlainDataMatrix(void)
void setColumnColor(int col, QColor c)
QStringList getShortTitleHeads(void)
int setHeadTexts(QStringList h)
virtual int setValue(QVariant v, bool sdisabled=false)
QStringList * rows
The visible data of the element.
virtual QStringList * getKeys(void)
int alternateActLine(QString key)
QString sqlTableName(void)
HTableBrowserElement * elementByIndex(int n)
HDispTable(QWidget *parent, HTable *d, int datamodep=FULL_CLEAN, int ddata=DONT_DELETE_DATA)
bool isMeldedWithNext(void)
QString * keyByIndex(int n)
QString getContentAsHtml(QString params)
HTableBrowserElement * next
Pointer to the next element.
HTable * data
The HTable data pointer;.
int datamode
Data handling mode.
HTableBrowser * list
The HTableBrowser object.
void activateItem(QString k)
HTableBrowserElement * currentElement(void)
void setSpecSort(int col, QString specsortname)
QString currentElementValueString(void)
int setCurrentElement(QString c, QString t="")
static HRefreshAgent * getNotifyAgent(void)
QString currentElementName(void)
int deletedata
Data allocation handling mode.
HTableBrowserElement * setColor(int r, int g, int b)
QString currentElementRowName(void)
int addElement(HTableBrowserElement *e)
virtual QList< QStringList * > * getValues(void)
int returnToDefault(bool all=true)
bool isNoMiddleStretch(void)
int setTopElement(int index)
int sortByColumn(int col)
bool owncolor
If this attribute is true the element has own color.
#define GSAFETEXT_DISPSQLCH_SELECTBUTTON
static HPleaseWaitWindow * start(void)
void wheelEvent(QWheelEvent *e)
void setBackgroundColor(QColor c)
void setActiveKey(QString k)
void dataChangedByGui(void)
int fulshDrawingCache(void)
QString getTailText(void)
void setTitleFont(QFont f)
int removeAllElementByKey(QString key)
#define GSAFETEXT_STARTDIATEXT2
int deletedata
Data allocation handling mode.
int slotCellChanged(int row, int column)
int addStretchToEnd(void)
int deletedata
Data allocation handling mode.
virtual int clearList(void)
HTableBrowserElement * prev
Pointer to the previous element.
HDispPlainDataMatrix(QWidget *parent, HBase *d, bool htmlmode=false, int keyfield=-1, int ddata=DONT_DELETE_DATA)
QStringList * valuesByIndex(int n)
bool anywhere_click_close
int slotActivateItem(const QString k)
HDecorDialog(QWidget *parent, QString title, int no_action_closetime)
void itemChanged(const QString &s)
void setElementValue(QString name, double value)
QString operator[](int i)
HTableBrowser(QWidget *parent)
QList< QString > currentRowStr(void)
HDispList(QWidget *parent, HList *d, int datamodep=FULL_CLEAN, int ddata=DONT_DELETE_DATA)
virtual QVariant dbValueToDispValue(QVariant v)
int itemAlternateActivated(const QString &s)
QString getSpecDisplaySortMode(void)
HList * data
The HList data pointer.
#define GSAFETEXT_CALLEXTERNAL
virtual QString sqlSelectHead(void)
QString getExplainText(void)
bool mouseNetClick(QMouseEvent *e, int rmode=NEED_UPDATE)
HTableBrowserElement * topElement(void)
HTableBrowserElement * queryNextElement(void)
#define GSAFETEXT_TEXT_UNKNOWN
int ocb
If the owncolor is true these variables holds the color.
void alternateActivateItem(const QString &s)
void activateItem(const QString &s)
void listItemChanged(void)
HTableBrowserElement(QString k, QStringList *c)
HDynTableDispConnector(HDynTable *dynt, QTableWidget *qtw)
int itemAlternateActivated(const QString &s)
HTableBrowserElement * clearColor(void)
int itemActivated(const QString &s)
void paintEvent(QPaintEvent *pe)
int datamode
Data handling mode.
virtual QVariant getValue(void)
int litemChanged(const QString &s)
#define GSAFETEXT_STARTDIATEXT1
int index
Index of the element.
void swapWith(HTableBrowserElement *x)
int numberOfElements(void)
static HPleaseWaitWindow * pww
void clearAndFreeConnections(void)
bool ro_mask
Readonly mask.
bool getLastValidateStatus()
QString key
Key value of the element.
#define GSAFETEXT_UNKNOWN
~HTableBrowserElement(void)
void updateDisplaySignal(void)
#define GSAFETEXT_DISPSQLCH_TITLE
QList< QString > getHeader(void)