Typica is a free program for professional coffee roasters. https://typica.us
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349
  1. /*16:*/
  2. #line 757 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*18:*/
  5. #line 840 "./typica.w"
  6. #include <QtCore>
  7. #include <QtGui>
  8. #include <QtScript>
  9. #include <QtScriptTools>
  10. #include <QtXml>
  11. #include <QtSql>
  12. #include <QtDebug>
  13. #include <QtXmlPatterns>
  14. #include <QtWebKit>
  15. /*:18*//*19:*/
  16. #line 855 "./typica.w"
  17. #include "helpmenu.h"
  18. /*:19*//*678:*/
  19. #line 15661 "./typica.w"
  20. #include "qextserialport.h"
  21. #include "qextserialenumerator.h"
  22. /*:678*/
  23. #line 760 "./typica.w"
  24. /*33:*/
  25. #line 1146 "./typica.w"
  26. class ScriptQMainWindow:public QMainWindow
  27. {
  28. Q_OBJECT
  29. public:
  30. ScriptQMainWindow();
  31. public slots:
  32. void show();
  33. void saveSizeAndPosition(const QString&key);
  34. void restoreSizeAndPosition(const QString&key);
  35. void displayStatus(const QString&message= QString());
  36. protected:
  37. void closeEvent(QCloseEvent*event);
  38. void showEvent(QShowEvent*event);
  39. signals:
  40. void aboutToClose(void);
  41. };
  42. /*:33*//*136:*/
  43. #line 3265 "./typica.w"
  44. class SqlQueryConnection:public QSqlQuery
  45. {
  46. public:
  47. SqlQueryConnection(const QString&query= QString());
  48. ~SqlQueryConnection();
  49. QSqlQuery*operator->();
  50. private:
  51. QString connection;
  52. QSqlQuery*q;
  53. };
  54. /*:136*//*197:*/
  55. #line 5035 "./typica.w"
  56. class NumericDelegate:public QItemDelegate
  57. {
  58. Q_OBJECT
  59. public:
  60. NumericDelegate(QObject*parent= NULL);
  61. QWidget*createEditor(QWidget*parent,
  62. const QStyleOptionViewItem&option,
  63. const QModelIndex&index)const;
  64. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  65. void setModelData(QWidget*editor,QAbstractItemModel*model,
  66. const QModelIndex&index)const;
  67. void updateEditorGeometry(QWidget*editor,
  68. const QStyleOptionViewItem&option,
  69. const QModelIndex&index)const;
  70. };
  71. /*:197*//*227:*/
  72. #line 5675 "./typica.w"
  73. class Measurement
  74. {
  75. public:
  76. enum TemperatureUnits
  77. {
  78. Fahrenheit= 10144,
  79. Celsius= 10143,
  80. Kelvin= 10325,
  81. Rankine= 10145
  82. };
  83. private:
  84. double theTemperature;
  85. QTime theTime;
  86. TemperatureUnits unit;
  87. public:
  88. Measurement(double temperature= 0,QTime time= QTime(),
  89. TemperatureUnits sc= Fahrenheit);
  90. Measurement(double temperature);
  91. Measurement(const Measurement&x);
  92. Measurement&operator= (Measurement&x);
  93. ~Measurement();
  94. double temperature()const;
  95. QTime time()const;
  96. void setTemperature(double temperature);
  97. void setTime(QTime time);
  98. void setUnit(TemperatureUnits scale);
  99. TemperatureUnits scale();
  100. Measurement toFahrenheit();
  101. Measurement toCelsius();
  102. Measurement toKelvin();
  103. Measurement toRankine();
  104. };
  105. /*:227*//*239:*/
  106. #line 5977 "./typica.w"
  107. class Channel;
  108. class DAQImplementation;
  109. class DAQ:public QObject
  110. {
  111. Q_OBJECT
  112. Q_ENUMS(TemperatureUnits)
  113. Q_ENUMS(ThermocoupleType)
  114. DAQImplementation*imp;
  115. private slots:
  116. void threadFinished();
  117. public:
  118. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  119. ~DAQ();
  120. Channel*newChannel(int units,int thermocouple);
  121. Q_INVOKABLE void setClockRate(double Hz);
  122. Q_INVOKABLE void start();
  123. Q_INVOKABLE void stop();
  124. enum TemperatureUnits
  125. {
  126. Fahrenheit= 10144,
  127. Celsius= 10143,
  128. Kelvin= 10325,
  129. Rankine= 10145
  130. };
  131. enum ThermocoupleType
  132. {
  133. TypeJ= 10072,
  134. TypeK= 10073,
  135. TypeN= 10077,
  136. TypeR= 10082,
  137. TypeS= 10085,
  138. TypeT= 10086,
  139. TypeB= 10047,
  140. TypeE= 10055
  141. };
  142. };
  143. /*:239*//*240:*/
  144. #line 6023 "./typica.w"
  145. class DAQImplementation:public QThread
  146. {
  147. Q_OBJECT
  148. public:
  149. DAQImplementation(const QString&driverinfo);
  150. ~DAQImplementation();
  151. void run();
  152. void measure();
  153. /*241:*/
  154. #line 6043 "./typica.w"
  155. typedef int(*daqfp)(...);
  156. daqfp read;
  157. daqfp errorInfo;
  158. daqfp startTask;
  159. daqfp createTask;
  160. daqfp createChannel;
  161. daqfp setClock;
  162. daqfp stopTask;
  163. daqfp clearTask;
  164. daqfp resetDevice;
  165. daqfp waitForMeasurement;
  166. /*:241*/
  167. #line 6032 "./typica.w"
  168. /*242:*/
  169. #line 6059 "./typica.w"
  170. bool useBase;
  171. QString device;
  172. QVector<Channel*> channelMap;
  173. unsigned int handle;
  174. int error;
  175. int channels;
  176. bool ready;
  177. QLibrary driver;
  178. QVector<Measurement::TemperatureUnits> unitMap;
  179. /*:242*/
  180. #line 6033 "./typica.w"
  181. };
  182. /*:240*//*258:*/
  183. #line 6556 "./typica.w"
  184. class FakeDAQImplementation:public QThread
  185. {
  186. Q_OBJECT
  187. public:
  188. FakeDAQImplementation();
  189. ~FakeDAQImplementation();
  190. void run();
  191. void measure();
  192. QVector<Channel*> channelMap;
  193. int channels;
  194. bool ready;
  195. double clockRate;
  196. };
  197. class FakeDAQ:public QObject
  198. {
  199. Q_OBJECT
  200. FakeDAQImplementation*imp;
  201. public:
  202. FakeDAQ(QString device);
  203. ~FakeDAQ();
  204. Channel*newChannel(int units,int thermocouple);
  205. Q_INVOKABLE void setClockRate(double Hz);
  206. Q_INVOKABLE void start();
  207. };
  208. /*:258*//*265:*/
  209. #line 6743 "./typica.w"
  210. class Channel:public QObject
  211. {
  212. Q_OBJECT
  213. public:
  214. Channel();
  215. ~Channel();
  216. public slots:
  217. void input(Measurement measurement);
  218. signals:
  219. void newData(Measurement);
  220. };
  221. /*:265*//*269:*/
  222. #line 6806 "./typica.w"
  223. class LinearCalibrator:public QObject
  224. {
  225. Q_OBJECT
  226. Q_PROPERTY(double measuredLower READ measuredLower
  227. WRITE setMeasuredLower)
  228. Q_PROPERTY(double measuredUpper READ measuredUpper
  229. WRITE setMeasuredUpper)
  230. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  231. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  232. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  233. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  234. public:
  235. LinearCalibrator(QObject*parent= NULL);
  236. double measuredLower();
  237. double measuredUpper();
  238. double mappedLower();
  239. double mappedUpper();
  240. bool isClosedRange();
  241. double sensitivity();
  242. public slots:
  243. void setMeasuredLower(double lower);
  244. void setMeasuredUpper(double upper);
  245. void setMappedLower(double lower);
  246. void setMappedUpper(double upper);
  247. void setClosedRange(bool closed);
  248. void setSensitivity(double sensitivity);
  249. void newMeasurement(Measurement measure);
  250. signals:
  251. void measurement(Measurement measure);
  252. private:
  253. double Lo1;
  254. double Lo2;
  255. double Up1;
  256. double Up2;
  257. double sensitivitySetting;
  258. bool clamp;
  259. };
  260. /*:269*//*276:*/
  261. #line 7000 "./typica.w"
  262. class LinearSplineInterpolator:public QObject
  263. {
  264. Q_OBJECT
  265. public:
  266. LinearSplineInterpolator(QObject*parent= NULL);
  267. Q_INVOKABLE void add_pair(double source,double destination);
  268. public slots:
  269. void newMeasurement(Measurement measure);
  270. signals:
  271. void newData(Measurement measure);
  272. private:
  273. void make_interpolators();
  274. QMap<double,double> *pairs;
  275. QList<LinearCalibrator*> *interpolators;
  276. };
  277. /*:276*//*281:*/
  278. #line 7135 "./typica.w"
  279. class TemperatureDisplay:public QLCDNumber
  280. {
  281. Q_OBJECT
  282. Q_ENUMS(DisplayUnits)
  283. int unit;
  284. public:
  285. enum DisplayUnits
  286. {
  287. Auto= -1,
  288. Fahrenheit= 10144,
  289. Celsius= 10143,
  290. Kelvin= 10325,
  291. Rankine= 10145
  292. };
  293. TemperatureDisplay(QWidget*parent= NULL);
  294. ~TemperatureDisplay();
  295. public slots:
  296. void setValue(Measurement temperature);
  297. void invalidate();
  298. void setDisplayUnits(DisplayUnits scale);
  299. };
  300. /*:281*//*290:*/
  301. #line 7311 "./typica.w"
  302. class MeasurementTimeOffset:public QObject
  303. {
  304. Q_OBJECT
  305. QTime epoch;
  306. QTime previous;
  307. bool hasPrevious;
  308. public:
  309. MeasurementTimeOffset(QTime zero);
  310. QTime zeroTime();
  311. public slots:
  312. void newMeasurement(Measurement measure);
  313. void setZeroTime(QTime zero);
  314. signals:
  315. void measurement(Measurement measure);
  316. };
  317. /*:290*//*297:*/
  318. #line 7461 "./typica.w"
  319. class ThresholdDetector:public QObject
  320. {
  321. Q_OBJECT
  322. Q_ENUMS(EdgeDirection)
  323. public:
  324. enum EdgeDirection{
  325. Ascending,Descending
  326. };
  327. ThresholdDetector(double value);
  328. public slots:
  329. void newMeasurement(Measurement measure);
  330. void setThreshold(double value);
  331. void setEdgeDirection(EdgeDirection direction);
  332. signals:
  333. void timeForValue(double);
  334. private:
  335. double previousValue;
  336. double threshold;
  337. EdgeDirection currentDirection;
  338. };
  339. /*:297*//*302:*/
  340. #line 7567 "./typica.w"
  341. class ZeroEmitter:public QObject
  342. {
  343. Q_OBJECT
  344. int col;
  345. double temp;
  346. public:
  347. ZeroEmitter(int tempcolumn);
  348. int column();
  349. double lastTemperature();
  350. public slots:
  351. void newMeasurement(Measurement measure);
  352. void setColumn(int column);
  353. void emitZero();
  354. signals:
  355. void measurement(Measurement measure,int tempcolumn);
  356. };
  357. /*:302*//*307:*/
  358. #line 7660 "./typica.w"
  359. class MeasurementAdapter:public QObject
  360. {
  361. Q_OBJECT
  362. int col;
  363. public:
  364. MeasurementAdapter(int tempcolumn);
  365. int column();
  366. public slots:
  367. void newMeasurement(Measurement measure);
  368. void setColumn(int column);
  369. signals:
  370. void measurement(Measurement measure,int tempcolumn);
  371. };
  372. /*:307*//*312:*/
  373. #line 7749 "./typica.w"
  374. class GraphView:public QGraphicsView
  375. {
  376. Q_OBJECT
  377. QGraphicsScene*theScene;
  378. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  379. QMap<int,QPointF> *prevPoints;
  380. QMap<int,double> *translations;
  381. QList<QGraphicsItem*> *gridLinesF;
  382. QList<QGraphicsItem*> *gridLinesC;
  383. public:
  384. GraphView(QWidget*parent= NULL);
  385. void removeSeries(int column);
  386. protected:
  387. void resizeEvent(QResizeEvent*event);
  388. public slots:
  389. void newMeasurement(Measurement measure,int tempcolumn);
  390. void setSeriesTranslation(int column,double offset);
  391. void clear();
  392. void showF();
  393. void showC();
  394. };
  395. /*:312*//*327:*/
  396. #line 8100 "./typica.w"
  397. class MeasurementModel;
  398. class ZoomLog:public QTableView
  399. {
  400. Q_OBJECT
  401. /*328:*/
  402. #line 8148 "./typica.w"
  403. MeasurementModel*model_ms;
  404. MeasurementModel*model_1s;
  405. MeasurementModel*model_5s;
  406. MeasurementModel*model_10s;
  407. MeasurementModel*model_15s;
  408. MeasurementModel*model_30s;
  409. MeasurementModel*model_1m;
  410. QList<MeasurementModel*> modelSet;
  411. QHash<int,Measurement> lastMeasurement;
  412. MeasurementModel*currentModel;
  413. QList<int> saveTempCols;
  414. QList<int> saveNoteCols;
  415. QList<int> currentColumnSet;
  416. /*:328*/
  417. #line 8105 "./typica.w"
  418. void switchLOD(MeasurementModel*m);
  419. private slots:
  420. void centerOn(int row);
  421. void persistColumnResize(int column,int oldsize,int newsize);
  422. void restoreColumnWidths();
  423. public:
  424. ZoomLog();
  425. QVariant data(int row,int column)const;
  426. int rowCount();
  427. bool saveXML(QIODevice*device);
  428. bool saveCSV(QIODevice*device);
  429. QString lastTime(int series);
  430. Q_INVOKABLE int displayUnits();
  431. public slots:
  432. void setVisible(bool visibility);
  433. void setHeaderData(int section,QString text);
  434. void LOD_ms();
  435. void LOD_1s();
  436. void LOD_5s();
  437. void LOD_10s();
  438. void LOD_15s();
  439. void LOD_30s();
  440. void LOD_1m();
  441. void newMeasurement(Measurement measure,int tempcolumn);
  442. void newAnnotation(QString annotation,int tempcolumn,
  443. int annotationcolumn);
  444. void clear();
  445. void addOutputTemperatureColumn(int column);
  446. void addOutputAnnotationColumn(int column);
  447. void clearOutputColumns();
  448. void setDisplayUnits(int scale);
  449. void addToCurrentColumnSet(int column);
  450. void clearCurrentColumnSet();
  451. protected:
  452. virtual void showEvent(QShowEvent*event);
  453. };
  454. /*:327*//*352:*/
  455. #line 8794 "./typica.w"
  456. class MeasurementList;
  457. class MeasurementModel:public QAbstractItemModel
  458. {
  459. Q_OBJECT
  460. Q_ENUMS(DisplayUnits);
  461. int unit;
  462. QList<MeasurementList*> *entries;
  463. QStringList*hData;
  464. int colcount;
  465. QHash<int,int> *lastTemperature;
  466. QList<MeasurementList*> ::iterator lastInsertion;
  467. public:
  468. enum DisplayUnits
  469. {
  470. Auto= -1,
  471. Fahrenheit= 10144,
  472. Celsius= 10143,
  473. Kelvin= 10325,
  474. Rankine= 10145
  475. };
  476. MeasurementModel(QObject*parent= NULL);
  477. ~MeasurementModel();
  478. int rowCount(const QModelIndex&parent= QModelIndex())const;
  479. int columnCount(const QModelIndex&parent= QModelIndex())const;
  480. bool setHeaderData(int section,Qt::Orientation orientation,
  481. const QVariant&value,int role= Qt::DisplayRole);
  482. QVariant data(const QModelIndex&index,int role)const;
  483. bool setData(const QModelIndex&index,const QVariant&value,
  484. int role= Qt::EditRole);
  485. Qt::ItemFlags flags(const QModelIndex&index)const;
  486. QVariant headerData(int section,Qt::Orientation orientation,
  487. int role= Qt::DisplayRole)const;
  488. QModelIndex index(int row,int column,
  489. const QModelIndex&parent= QModelIndex())const;
  490. QModelIndex parent(const QModelIndex&index)const;
  491. int displayUnits();
  492. public slots:
  493. void newMeasurement(Measurement measure,int tempcolumn);
  494. void newAnnotation(QString annotation,int tempcolumn,
  495. int annotationColumn);
  496. void clear();
  497. void setDisplayUnits(int scale);
  498. signals:
  499. void rowChanged(int);
  500. };
  501. /*:352*//*353:*/
  502. #line 8846 "./typica.w"
  503. class MeasurementList:public QVariantList
  504. {
  505. public:
  506. bool operator<(const MeasurementList&other)const;
  507. bool operator==(const MeasurementList&other)const;
  508. };
  509. /*:353*//*379:*/
  510. #line 9483 "./typica.w"
  511. class AnnotationButton:public QPushButton
  512. {
  513. Q_OBJECT
  514. QString note;
  515. int tc;
  516. int ac;
  517. int count;
  518. public:
  519. AnnotationButton(const QString&text,QWidget*parent= NULL);
  520. public slots:
  521. void setAnnotation(const QString&annotation);
  522. void setTemperatureColumn(int tempcolumn);
  523. void setAnnotationColumn(int annotationcolumn);
  524. void annotate();
  525. void resetCount();
  526. signals:
  527. void annotation(QString annotation,int tempcolumn,
  528. int notecolumn);
  529. };
  530. /*:379*//*387:*/
  531. #line 9608 "./typica.w"
  532. class AnnotationSpinBox:public QDoubleSpinBox
  533. {
  534. Q_OBJECT
  535. QString pretext;
  536. QString posttext;
  537. int tc;
  538. int ac;
  539. bool change;
  540. public:
  541. AnnotationSpinBox(const QString&pret,const QString&postt,
  542. QWidget*parent= NULL);
  543. public slots:
  544. void setPretext(const QString&pret);
  545. void setPosttext(const QString&postt);
  546. void setTemperatureColumn(int tempcolumn);
  547. void setAnnotationColumn(int annotationcolumn);
  548. void annotate();
  549. void resetChange();
  550. signals:
  551. void annotation(QString annotation,int tempcolumn,
  552. int notecolumn);
  553. };
  554. /*:387*//*395:*/
  555. #line 9767 "./typica.w"
  556. class TimerDisplay:public QLCDNumber
  557. {
  558. Q_OBJECT
  559. /*396:*/
  560. #line 9817 "./typica.w"
  561. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  562. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  563. Q_PROPERTY(bool running READ isRunning)
  564. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  565. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  566. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  567. /*:396*/
  568. #line 9771 "./typica.w"
  569. private slots:
  570. void updateTime();
  571. void setCountUpMode();
  572. void setCountDownMode();
  573. void setClockMode();
  574. public:
  575. TimerDisplay(QWidget*parent= NULL);
  576. ~TimerDisplay();
  577. enum TimerMode
  578. {
  579. CountUp,
  580. CountDown,
  581. Clock
  582. };
  583. QString value();
  584. QTime seconds();
  585. TimerMode mode();
  586. bool isRunning();
  587. QTime resetValue();
  588. QString displayFormat();
  589. bool autoReset();
  590. public slots:
  591. void setTimer(QTime value= QTime(0,0,0));
  592. void setMode(TimerMode mode);
  593. void startTimer();
  594. void stopTimer();
  595. void copyTimer();
  596. void setResetValue(QTime value= QTime(0,0,0));
  597. void reset();
  598. void setDisplayFormat(QString format);
  599. void setAutoReset(bool reset);
  600. void updateDisplay();
  601. signals:
  602. void valueChanged(QTime);
  603. void runStateChanged(bool);
  604. private:
  605. /*397:*/
  606. #line 9827 "./typica.w"
  607. QTime s;
  608. QTime r;
  609. QTimer clock;
  610. TimerDisplay::TimerMode m;
  611. bool running;
  612. bool ar;
  613. QAction*startAction;
  614. QAction*stopAction;
  615. QAction*resetAction;
  616. QString f;
  617. QTime relative;
  618. QTime base;
  619. /*:397*/
  620. #line 9808 "./typica.w"
  621. };
  622. /*:395*//*417:*/
  623. #line 10186 "./typica.w"
  624. class PackLayout:public QLayout
  625. {
  626. int doLayout(const QRect&rect,bool testOnly)const;
  627. QList<QLayoutItem*> itemList;
  628. Qt::Orientations orientation;
  629. public:
  630. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  631. PackLayout(int spacing= -1);
  632. ~PackLayout();
  633. void addItem(QLayoutItem*item);
  634. Qt::Orientations expandingDirections()const;
  635. bool hasHeightForWidth()const;
  636. int heightForWidth(int width)const;
  637. int count()const;
  638. QLayoutItem*itemAt(int index)const;
  639. QSize minimumSize()const;
  640. void setGeometry(const QRect&rect);
  641. void setOrientation(Qt::Orientations direction);
  642. QSize sizeHint()const;
  643. QLayoutItem*takeAt(int index);
  644. };
  645. /*:417*//*430:*/
  646. #line 10464 "./typica.w"
  647. class SceneButton:public QGraphicsScene
  648. {
  649. Q_OBJECT
  650. public:
  651. SceneButton();
  652. ~SceneButton();
  653. protected:
  654. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  655. signals:
  656. void clicked(QPoint pos);
  657. };
  658. /*:430*//*432:*/
  659. #line 10506 "./typica.w"
  660. class WidgetDecorator:public QWidget
  661. {
  662. Q_OBJECT
  663. PackLayout*layout;
  664. QGraphicsView*label;
  665. QGraphicsTextItem*text;
  666. SceneButton*scene;
  667. public:
  668. WidgetDecorator(QWidget*widget,const QString&labeltext,
  669. Qt::Orientations orientation= Qt::Horizontal,
  670. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  671. ~WidgetDecorator();
  672. void setBackgroundBrush(QBrush background);
  673. void setTextColor(QColor color);
  674. };
  675. /*:432*//*443:*/
  676. #line 10681 "./typica.w"
  677. class LogEditWindow:public QMainWindow
  678. {
  679. Q_OBJECT
  680. QWidget*centralWidget;
  681. PackLayout*mainLayout;
  682. QHBoxLayout*addRowsLayout;
  683. QLabel*startTimeLabel;
  684. QTimeEdit*startTime;
  685. QLabel*endTimeLabel;
  686. QTimeEdit*endTime;
  687. QLabel*intervalLabel;
  688. QSpinBox*interval;
  689. QPushButton*addRows;
  690. QAction*saveXml;
  691. QAction*saveCsv;
  692. QAction*openXml;
  693. MeasurementModel*model;
  694. QTableView*log;
  695. private slots:
  696. void addTheRows();
  697. void saveXML();
  698. void saveCSV();
  699. void openXML();
  700. protected:
  701. void closeEvent(QCloseEvent*event);
  702. public:
  703. LogEditWindow();
  704. };
  705. /*:443*//*457:*/
  706. #line 10989 "./typica.w"
  707. class XMLOutput:public QObject
  708. {
  709. Q_OBJECT
  710. MeasurementModel*data;
  711. QIODevice*out;
  712. int time;
  713. QMap<int,QString> temperatureColumns;
  714. QMap<int,QString> annotationColumns;
  715. public:
  716. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  717. void addTemperatureColumn(const QString&series,int column);
  718. void addAnnotationColumn(const QString&series,int column);
  719. void setModel(MeasurementModel*model);
  720. void setTimeColumn(int column);
  721. void setDevice(QIODevice*device);
  722. bool output();
  723. };
  724. /*:457*//*464:*/
  725. #line 11185 "./typica.w"
  726. class XMLInput:public QObject
  727. {
  728. Q_OBJECT
  729. int firstc;
  730. QIODevice*in;
  731. public:
  732. XMLInput(QIODevice*input,int c);
  733. void setFirstColumn(int column);
  734. void setDevice(QIODevice*device);
  735. bool input();
  736. signals:
  737. void measure(Measurement,int);
  738. void annotation(QString,int,int);
  739. void newTemperatureColumn(int,QString);
  740. void newAnnotationColumn(int,QString);
  741. void lastColumn(int);
  742. };
  743. /*:464*//*475:*/
  744. #line 11426 "./typica.w"
  745. class CSVOutput
  746. {
  747. MeasurementModel*data;
  748. QIODevice*out;
  749. int time;
  750. QMap<int,QString> temperatureColumns;
  751. QMap<int,QString> annotationColumns;
  752. public:
  753. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  754. void addTemperatureColumn(const QString&series,int column);
  755. void addAnnotationColumn(const QString&series,int column);
  756. void setModel(MeasurementModel*model);
  757. void setTimeColumn(int column);
  758. void setDevice(QIODevice*device);
  759. bool output();
  760. };
  761. /*:475*//*489:*/
  762. #line 11685 "./typica.w"
  763. #define AppInstance (qobject_cast<Application *> (qApp))
  764. class NodeInserter;
  765. class DeviceTreeModel;
  766. class Application:public QApplication
  767. {
  768. Q_OBJECT
  769. public:
  770. Application(int&argc,char**argv);
  771. QDomDocument*configuration();
  772. /*603:*/
  773. #line 14072 "./typica.w"
  774. QDomDocument deviceConfiguration();
  775. /*:603*//*636:*/
  776. #line 14745 "./typica.w"
  777. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  778. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  779. const QModelIndex&index);
  780. /*:636*//*641:*/
  781. #line 14849 "./typica.w"
  782. QList<NodeInserter*> topLevelNodeInserters;
  783. /*:641*/
  784. #line 11696 "./typica.w"
  785. QSqlDatabase database();
  786. QScriptEngine*engine;
  787. public slots:
  788. /*604:*/
  789. #line 14079 "./typica.w"
  790. void saveDeviceConfiguration();
  791. /*:604*/
  792. #line 11700 "./typica.w"
  793. private:
  794. /*602:*/
  795. #line 14063 "./typica.w"
  796. QDomDocument deviceConfigurationDocument;
  797. /*:602*//*635:*/
  798. #line 14739 "./typica.w"
  799. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  800. /*:635*/
  801. #line 11702 "./typica.w"
  802. QDomDocument conf;
  803. };
  804. /*:489*//*497:*/
  805. #line 11826 "./typica.w"
  806. class SaltModel:public QAbstractItemModel
  807. {
  808. Q_OBJECT
  809. QList<QList<QMap<int,QVariant> > > modelData;
  810. QStringList hData;
  811. int colcount;
  812. public:
  813. SaltModel(int columns);
  814. ~SaltModel();
  815. int rowCount(const QModelIndex&parent= QModelIndex())const;
  816. int columnCount(const QModelIndex&parent= QModelIndex())const;
  817. bool setHeaderData(int section,Qt::Orientation orientation,
  818. const QVariant&value,int role= Qt::DisplayRole);
  819. QVariant data(const QModelIndex&index,int role)const;
  820. bool setData(const QModelIndex&index,const QVariant&value,
  821. int role= Qt::EditRole);
  822. Qt::ItemFlags flags(const QModelIndex&index)const;
  823. QVariant headerData(int section,Qt::Orientation orientation,
  824. int role= Qt::DisplayRole)const;
  825. QModelIndex index(int row,int column,
  826. const QModelIndex&parent= QModelIndex())const;
  827. QModelIndex parent(const QModelIndex&index)const;
  828. QString arrayLiteral(int column,int role)const;
  829. QString quotedArrayLiteral(int column,int role)const;
  830. };
  831. /*:497*//*510:*/
  832. #line 12139 "./typica.w"
  833. class SqlComboBox:public QComboBox
  834. {
  835. Q_OBJECT
  836. int dataColumn;
  837. int displayColumn;
  838. bool dataColumnShown;
  839. public:
  840. SqlComboBox();
  841. ~SqlComboBox();
  842. SqlComboBox*clone(QWidget*parent);
  843. public slots:
  844. void addNullOption();
  845. void addSqlOptions(QString query);
  846. void setDataColumn(int column);
  847. void setDisplayColumn(int column);
  848. void showData(bool show);
  849. };
  850. /*:510*//*517:*/
  851. #line 12261 "./typica.w"
  852. class SqlComboBoxDelegate:public QItemDelegate
  853. {
  854. Q_OBJECT
  855. SqlComboBox*delegate;
  856. public:
  857. SqlComboBoxDelegate(QObject*parent= NULL);
  858. QWidget*createEditor(QWidget*parent,
  859. const QStyleOptionViewItem&option,
  860. const QModelIndex&index)const;
  861. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  862. void setModelData(QWidget*editor,QAbstractItemModel*model,
  863. const QModelIndex&index)const;
  864. void setWidget(SqlComboBox*widget);
  865. virtual QSize sizeHint()const;
  866. void updateEditorGeometry(QWidget*editor,
  867. const QStyleOptionViewItem&option,
  868. const QModelIndex&index)const;
  869. };
  870. /*:517*//*528:*/
  871. #line 12420 "./typica.w"
  872. class SqlConnectionSetup:public QDialog
  873. {
  874. Q_OBJECT
  875. public:
  876. SqlConnectionSetup();
  877. ~SqlConnectionSetup();
  878. public slots:
  879. void testConnection();
  880. private:
  881. QFormLayout*formLayout;
  882. QComboBox*driver;
  883. QLineEdit*hostname;
  884. QLineEdit*dbname;
  885. QLineEdit*user;
  886. QLineEdit*password;
  887. QVBoxLayout*layout;
  888. QHBoxLayout*buttons;
  889. QPushButton*cancelButton;
  890. QPushButton*connectButton;
  891. };
  892. /*:528*//*533:*/
  893. #line 12548 "./typica.w"
  894. class SqlQueryView:public QTableView
  895. {
  896. Q_OBJECT
  897. public:
  898. SqlQueryView(QWidget*parent= NULL);
  899. void setQuery(const QString&query);
  900. bool setHeaderData(int section,Qt::Orientation orientation,
  901. const QVariant&value,int role);
  902. Q_INVOKABLE QVariant data(int row,int column,
  903. int role= Qt::DisplayRole);
  904. signals:
  905. void openEntry(QString key);
  906. void openEntryRow(int row);
  907. protected:
  908. virtual void showEvent(QShowEvent*event);
  909. private slots:
  910. void openRow(const QModelIndex&index);
  911. void persistColumnResize(int column,int oldsize,int newsize);
  912. };
  913. /*:533*//*548:*/
  914. #line 12796 "./typica.w"
  915. class ReportAction:public QAction
  916. {
  917. Q_OBJECT
  918. public:
  919. ReportAction(const QString&fileName,const QString&reportName,
  920. QObject*parent= NULL);
  921. private slots:
  922. void createReport();
  923. private:
  924. QString reportFile;
  925. };
  926. /*:548*//*560:*/
  927. #line 13005 "./typica.w"
  928. class ReportTable:public QObject
  929. {
  930. Q_OBJECT
  931. QTextFrame*area;
  932. QDomElement configuration;
  933. QMap<QString,QVariant> bindings;
  934. public:
  935. ReportTable(QTextFrame*frame,QDomElement description);
  936. ~ReportTable();
  937. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  938. public slots:
  939. void refresh();
  940. };
  941. /*:560*//*572:*/
  942. #line 13241 "./typica.w"
  943. class FormArray:public QScrollArea
  944. {
  945. Q_OBJECT
  946. QDomElement configuration;
  947. QWidget itemContainer;
  948. QVBoxLayout itemLayout;
  949. int maxwidth;
  950. int maxheight;
  951. public:
  952. FormArray(QDomElement description);
  953. Q_INVOKABLE QWidget*elementAt(int index);
  954. Q_INVOKABLE int elements();
  955. public slots:
  956. void addElements(int copies= 1);
  957. void removeAllElements();
  958. void setMaximumElementWidth(int width);
  959. void setMaximumElementHeight(int height);
  960. };
  961. /*:572*//*582:*/
  962. #line 13457 "./typica.w"
  963. class ScaleControl:public QGraphicsView
  964. {
  965. Q_OBJECT
  966. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  967. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  968. /*583:*/
  969. #line 13483 "./typica.w"
  970. QGraphicsScene scene;
  971. QGraphicsPolygonItem initialDecrement;
  972. QGraphicsPolygonItem initialIncrement;
  973. QGraphicsPolygonItem finalDecrement;
  974. QGraphicsPolygonItem finalIncrement;
  975. QGraphicsPolygonItem initialIndicator;
  976. QGraphicsPolygonItem finalIndicator;
  977. QGraphicsPathItem scaleLine;
  978. QPolygonF left;
  979. QPolygonF right;
  980. QPolygonF down;
  981. QPolygonF up;
  982. QPainterPath scalePath;
  983. QBrush initialBrush;
  984. QBrush finalBrush;
  985. double nonScoredValue;
  986. double scoredValue;
  987. bool initialSet;
  988. bool finalSet;
  989. bool scaleDown;
  990. /*:583*/
  991. #line 13463 "./typica.w"
  992. public:
  993. ScaleControl();
  994. double initialValue(void);
  995. double finalValue(void);
  996. virtual QSize sizeHint()const;
  997. public slots:
  998. void setInitialValue(double value);
  999. void setFinalValue(double value);
  1000. signals:
  1001. void initialChanged(double);
  1002. void finalChanged(double);
  1003. protected:
  1004. virtual void mousePressEvent(QMouseEvent*event);
  1005. virtual void mouseReleaseEvent(QMouseEvent*event);
  1006. };
  1007. /*:582*//*594:*/
  1008. #line 13780 "./typica.w"
  1009. class IntensityControl:public QGraphicsView
  1010. {
  1011. Q_OBJECT
  1012. Q_PROPERTY(double value READ value WRITE setValue)
  1013. QGraphicsScene scene;
  1014. QGraphicsPolygonItem decrement;
  1015. QGraphicsPolygonItem increment;
  1016. QGraphicsPolygonItem indicator;
  1017. QGraphicsPathItem scaleLine;
  1018. QPolygonF left;
  1019. QPolygonF up;
  1020. QPolygonF down;
  1021. QPainterPath scalePath;
  1022. QBrush theBrush;
  1023. double theValue;
  1024. bool valueSet;
  1025. bool scaleDown;
  1026. public:
  1027. IntensityControl();
  1028. double value();
  1029. virtual QSize sizeHint()const;
  1030. public slots:
  1031. void setValue(double val);
  1032. signals:
  1033. void valueChanged(double);
  1034. protected:
  1035. virtual void mousePressEvent(QMouseEvent*event);
  1036. virtual void mouseReleaseEvent(QMouseEvent*event);
  1037. };
  1038. /*:594*//*610:*/
  1039. #line 14168 "./typica.w"
  1040. class DeviceTreeModelNode
  1041. {
  1042. public:
  1043. DeviceTreeModelNode(QDomNode&node,int row,
  1044. DeviceTreeModelNode*parent= NULL);
  1045. ~DeviceTreeModelNode();
  1046. DeviceTreeModelNode*child(int index);
  1047. DeviceTreeModelNode*parent();
  1048. QDomNode node()const;
  1049. int row();
  1050. private:
  1051. QDomNode domNode;
  1052. QHash<int,DeviceTreeModelNode*> children;
  1053. int rowNumber;
  1054. DeviceTreeModelNode*parentItem;
  1055. };
  1056. /*:610*//*612:*/
  1057. #line 14243 "./typica.w"
  1058. class DeviceTreeModel:public QAbstractItemModel
  1059. {
  1060. Q_OBJECT
  1061. public:
  1062. DeviceTreeModel(QObject*parent= NULL);
  1063. ~DeviceTreeModel();
  1064. QVariant data(const QModelIndex&index,int role)const;
  1065. Qt::ItemFlags flags(const QModelIndex&index)const;
  1066. QVariant headerData(int section,Qt::Orientation orientation,
  1067. int role= Qt::DisplayRole)const;
  1068. QModelIndex index(int row,int column,
  1069. const QModelIndex&parent= QModelIndex())const;
  1070. QModelIndex parent(const QModelIndex&child)const;
  1071. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1072. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1073. bool setData(const QModelIndex&index,const QVariant&value,
  1074. int role);
  1075. bool removeRows(int row,int count,const QModelIndex&parent);
  1076. QDomElement referenceElement(const QString&id);
  1077. public slots:
  1078. void newNode(const QString&name,const QString&driver,
  1079. const QModelIndex&parent);
  1080. private:
  1081. QDomDocument document;
  1082. DeviceTreeModelNode*root;
  1083. QDomNode referenceSection;
  1084. QDomNode treeRoot;
  1085. };
  1086. /*:612*//*631:*/
  1087. #line 14697 "./typica.w"
  1088. Q_DECLARE_METATYPE(QModelIndex)
  1089. /*:631*//*639:*/
  1090. #line 14804 "./typica.w"
  1091. class NodeInserter:public QAction
  1092. {
  1093. Q_OBJECT
  1094. public:
  1095. NodeInserter(const QString&title,const QString&name,
  1096. const QString&driver,QObject*parent= NULL);
  1097. signals:
  1098. void triggered(QString name,QString driver);
  1099. private slots:
  1100. void onTriggered();
  1101. private:
  1102. QString defaultNodeName;
  1103. QString driverString;
  1104. };
  1105. /*:639*//*642:*/
  1106. #line 14855 "./typica.w"
  1107. class DeviceConfigurationWindow:public QMainWindow
  1108. {
  1109. Q_OBJECT
  1110. public:
  1111. DeviceConfigurationWindow();
  1112. public slots:
  1113. void addDevice();
  1114. void removeNode();
  1115. void newSelection(const QModelIndex&index);
  1116. private:
  1117. QDomDocument document;
  1118. DeviceTreeModel*model;
  1119. QTreeView*view;
  1120. QScrollArea*configArea;
  1121. };
  1122. /*:642*//*650:*/
  1123. #line 14999 "./typica.w"
  1124. class BasicDeviceConfigurationWidget:public QWidget
  1125. {
  1126. Q_OBJECT
  1127. public:
  1128. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1129. const QModelIndex&index);
  1130. public slots:
  1131. void insertChildNode(const QString&name,const QString&driver);
  1132. void updateAttribute(const QString&name,const QString&value);
  1133. protected:
  1134. DeviceTreeModel*deviceModel;
  1135. QModelIndex currentNode;
  1136. };
  1137. /*:650*//*654:*/
  1138. #line 15084 "./typica.w"
  1139. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1140. {
  1141. Q_OBJECT
  1142. public:
  1143. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1144. const QModelIndex&index);
  1145. private slots:
  1146. void updateRoasterId(int id);
  1147. };
  1148. /*:654*//*659:*/
  1149. #line 15211 "./typica.w"
  1150. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1151. {
  1152. Q_OBJECT
  1153. public:
  1154. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1155. const QModelIndex&index);
  1156. };
  1157. /*:659*//*661:*/
  1158. #line 15257 "./typica.w"
  1159. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1160. {
  1161. Q_OBJECT
  1162. public:
  1163. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1164. const QModelIndex&index);
  1165. private slots:
  1166. void addChannel();
  1167. void updateDeviceId(const QString&newId);
  1168. };
  1169. /*:661*//*665:*/
  1170. #line 15343 "./typica.w"
  1171. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1172. {
  1173. Q_OBJECT
  1174. public:
  1175. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1176. const QModelIndex&index);
  1177. private slots:
  1178. void updateThermocoupleType(const QString&type);
  1179. void updateColumnName(const QString&name);
  1180. };
  1181. /*:665*//*670:*/
  1182. #line 15445 "./typica.w"
  1183. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1184. {
  1185. Q_OBJECT
  1186. public:
  1187. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1188. const QModelIndex&index);
  1189. };
  1190. /*:670*//*672:*/
  1191. #line 15486 "./typica.w"
  1192. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1193. {
  1194. Q_OBJECT
  1195. public:
  1196. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1197. const QModelIndex&index);
  1198. private slots:
  1199. void addChannel();
  1200. void updateDeviceId(const QString&newId);
  1201. };
  1202. /*:672*//*674:*/
  1203. #line 15555 "./typica.w"
  1204. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1205. {
  1206. Q_OBJECT
  1207. public:
  1208. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1209. const QModelIndex&index);
  1210. private slots:
  1211. void updateDeviceId(const QString&newId);
  1212. void updateThermocoupleType(const QString&type);
  1213. void updateColumnName(const QString&name);
  1214. };
  1215. /*:674*//*679:*/
  1216. #line 15672 "./typica.w"
  1217. class PortSelector:public QComboBox
  1218. {
  1219. Q_OBJECT
  1220. public:
  1221. PortSelector(QWidget*parent= NULL);
  1222. private slots:
  1223. void addDevice(QextPortInfo port);
  1224. private:
  1225. QextSerialEnumerator*lister;
  1226. };
  1227. /*:679*//*681:*/
  1228. #line 15716 "./typica.w"
  1229. class BaudSelector:public QComboBox
  1230. {
  1231. Q_OBJECT
  1232. Q_ENUMS(BaudRateType)
  1233. public:
  1234. BaudSelector(QWidget*parent= NULL);
  1235. enum BaudRateType
  1236. {
  1237. #if defined(Q_OS_UNIX) || defined(qdoc)
  1238. BAUD50= 50,
  1239. BAUD75= 75,
  1240. BAUD134= 134,
  1241. BAUD150= 150,
  1242. BAUD200= 200,
  1243. BAUD1800= 1800,
  1244. #if defined(B76800) || defined(qdoc)
  1245. BAUD76800= 76800,
  1246. #endif
  1247. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1248. BAUD230400= 230400,
  1249. BAUD460800= 460800,
  1250. BAUD500000= 500000,
  1251. BAUD576000= 576000,
  1252. BAUD921600= 921600,
  1253. BAUD1000000= 1000000,
  1254. BAUD1152000= 1152000,
  1255. BAUD1500000= 1500000,
  1256. BAUD2000000= 2000000,
  1257. BAUD2500000= 2500000,
  1258. BAUD3000000= 3000000,
  1259. BAUD3500000= 3500000,
  1260. BAUD4000000= 4000000,
  1261. #endif
  1262. #endif
  1263. #if defined(Q_OS_WIN) || defined(qdoc)
  1264. BAUD14400= 14400,
  1265. BAUD56000= 56000,
  1266. BAUD128000= 128000,
  1267. BAUD256000= 256000,
  1268. #endif
  1269. BAUD110= 110,
  1270. BAUD300= 300,
  1271. BAUD600= 600,
  1272. BAUD1200= 1200,
  1273. BAUD2400= 2400,
  1274. BAUD4800= 4800,
  1275. BAUD9600= 9600,
  1276. BAUD19200= 19200,
  1277. BAUD38400= 38400,
  1278. BAUD57600= 57600,
  1279. BAUD115200= 115200
  1280. };
  1281. };
  1282. /*:681*//*683:*/
  1283. #line 15787 "./typica.w"
  1284. class ParitySelector:public QComboBox
  1285. {
  1286. Q_OBJECT
  1287. Q_ENUMS(ParityType)
  1288. public:
  1289. ParitySelector(QWidget*parent= NULL);
  1290. enum ParityType
  1291. {
  1292. PAR_NONE,
  1293. PAR_ODD,
  1294. PAR_EVEN,
  1295. #if defined(Q_OS_WIN) || defined(qdoc)
  1296. PAR_MARK,
  1297. #endif
  1298. PAR_SPACE
  1299. };
  1300. };
  1301. /*:683*//*685:*/
  1302. #line 15825 "./typica.w"
  1303. class FlowSelector:public QComboBox
  1304. {
  1305. Q_OBJECT
  1306. Q_ENUMS(FlowType)
  1307. public:
  1308. FlowSelector(QWidget*parent= NULL);
  1309. enum FlowType
  1310. {
  1311. FLOW_OFF,
  1312. FLOW_HARDWARE,
  1313. FLOW_XONXOFF
  1314. };
  1315. };
  1316. /*:685*//*687:*/
  1317. #line 15858 "./typica.w"
  1318. class StopSelector:public QComboBox
  1319. {
  1320. Q_OBJECT
  1321. Q_ENUMS(StopBitsType)
  1322. public:
  1323. StopSelector(QWidget*parent= NULL);
  1324. enum StopBitsType
  1325. {
  1326. STOP_1,
  1327. #if defined(Q_OS_WIN) || defined(qdoc)
  1328. STOP_1_5,
  1329. #endif
  1330. STOP_2
  1331. };
  1332. };
  1333. /*:687*//*690:*/
  1334. #line 15911 "./typica.w"
  1335. class ShortHexSpinBox:public QSpinBox
  1336. {
  1337. Q_OBJECT
  1338. public:
  1339. ShortHexSpinBox(QWidget*parent= NULL);
  1340. virtual QValidator::State validate(QString&input,int&pos)const;
  1341. protected:
  1342. virtual int valueFromText(const QString&text)const;
  1343. virtual QString textFromValue(int value)const;
  1344. };
  1345. /*:690*//*692:*/
  1346. #line 15973 "./typica.w"
  1347. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1348. {
  1349. Q_OBJECT
  1350. public:
  1351. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1352. const QModelIndex&index);
  1353. private slots:
  1354. void updatePort(const QString&newPort);
  1355. void updateBaudRate(const QString&newRate);
  1356. void updateParity(const QString&newParity);
  1357. void updateFlowControl(const QString&newFlow);
  1358. void updateStopBits(const QString&newStopBits);
  1359. };
  1360. /*:692*//*694:*/
  1361. #line 16124 "./typica.w"
  1362. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1363. {
  1364. Q_OBJECT
  1365. public:
  1366. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1367. const QModelIndex&index);
  1368. private slots:
  1369. void updateStationNumber(int newStation);
  1370. void updateFixedUnit(bool newFixed);
  1371. void updateFixedDecimal(bool newFixed);
  1372. void updateUnit(const QString&newUnit);
  1373. void updateUnitAddress(int newAddress);
  1374. void updateValueF(int newValue);
  1375. void updateValueC(int newValue);
  1376. void updatePrecisionAddress(int newAddress);
  1377. void updatePrecisionValue(int newValue);
  1378. private:
  1379. QStackedLayout*unitSpecificationLayout;
  1380. QStackedLayout*decimalSpecificationLayout;
  1381. };
  1382. /*:694*//*696:*/
  1383. #line 16383 "./typica.w"
  1384. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1385. {
  1386. Q_OBJECT
  1387. public:
  1388. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1389. const QModelIndex&index);
  1390. private slots:
  1391. void updateAddress(int newAddress);
  1392. };
  1393. /*:696*//*698:*/
  1394. #line 16429 "./typica.w"
  1395. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1396. {
  1397. Q_OBJECT
  1398. public:
  1399. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1400. const QModelIndex&index);
  1401. private slots:
  1402. void updateReadAddress(int newAddress);
  1403. void updateWriteAddress(int newAddress);
  1404. void updateFixedRange(bool fixed);
  1405. void updateLower(const QString&lower);
  1406. void updateUpper(const QString&upper);
  1407. void updateLowerAddress(int newAddress);
  1408. void updateUpperAddress(int newAddress);
  1409. private:
  1410. QStackedLayout*boundsLayout;
  1411. };
  1412. /*:698*//*702:*/
  1413. #line 16623 "./typica.w"
  1414. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1415. {
  1416. Q_OBJECT
  1417. public:
  1418. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1419. private slots:
  1420. void updateButtonText(const QString&text);
  1421. void updateAnnotationText(const QString&text);
  1422. };
  1423. /*:702*//*706:*/
  1424. #line 16691 "./typica.w"
  1425. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1426. {
  1427. Q_OBJECT
  1428. public:
  1429. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1430. private slots:
  1431. void updateButtonText(const QString&text);
  1432. void updateAnnotationText(const QString&text);
  1433. };
  1434. /*:706*//*709:*/
  1435. #line 16765 "./typica.w"
  1436. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1437. {
  1438. Q_OBJECT
  1439. public:
  1440. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1441. private slots:
  1442. void updateLabel(const QString&text);
  1443. void updateMinimum(const QString&minimum);
  1444. void updateMaximum(const QString&maximum);
  1445. void updatePrecision(int precision);
  1446. void updatePretext(const QString&text);
  1447. void updatePosttext(const QString&text);
  1448. };
  1449. /*:709*//*712:*/
  1450. #line 16886 "./typica.w"
  1451. class ModbusRTUDevice:public QObject
  1452. {
  1453. Q_OBJECT
  1454. public:
  1455. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1456. ~ModbusRTUDevice();
  1457. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1458. Q_INVOKABLE double SVLower();
  1459. Q_INVOKABLE double SVUpper();
  1460. Q_INVOKABLE int decimals();
  1461. QList<Channel*> channels;
  1462. public slots:
  1463. void outputSV(double sv);
  1464. signals:
  1465. void SVLowerChanged(double);
  1466. void SVUpperChanged(double);
  1467. void SVDecimalChanged(int);
  1468. void queueEmpty();
  1469. private slots:
  1470. void dataAvailable();
  1471. void sendNextMessage();
  1472. void decimalResponse(QByteArray response);
  1473. void unitResponse(QByteArray response);
  1474. void svlResponse(QByteArray response);
  1475. void svuResponse(QByteArray response);
  1476. void requestMeasurement();
  1477. void mResponse(QByteArray response);
  1478. void ignore(QByteArray response);
  1479. private:
  1480. QextSerialPort*port;
  1481. QByteArray responseBuffer;
  1482. QList<QByteArray> messageQueue;
  1483. QList<QObject*> retObjQueue;
  1484. QList<char*> callbackQueue;
  1485. quint16 calculateCRC(QByteArray data);
  1486. QTimer*messageDelayTimer;
  1487. int delayTime;
  1488. char station;
  1489. int decimalPosition;
  1490. int valueF;
  1491. int valueC;
  1492. bool unitIsF;
  1493. double outputSVLower;
  1494. double outputSVUpper;
  1495. QByteArray outputSVStub;
  1496. QByteArray pvStub;
  1497. QByteArray svStub;
  1498. QByteArray mStub;
  1499. quint16 pvaddress;
  1500. quint16 svaddress;
  1501. bool svenabled;
  1502. bool readingsv;
  1503. double savedpv;
  1504. bool waiting;
  1505. };
  1506. /*:712*//*727:*/
  1507. #line 17558 "./typica.w"
  1508. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1509. {
  1510. Q_OBJECT
  1511. public:
  1512. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1513. private slots:
  1514. void updatePort(const QString&newPort);
  1515. void updateBaudRate(const QString&newRate);
  1516. void updateParity(const QString&newParity);
  1517. void updateFlowControl(const QString&newFlow);
  1518. void updateStopBits(const QString&newStopBits);
  1519. void updateStation(int station);
  1520. void updateFixedDecimal(bool fixed);
  1521. void updateDecimalAddress(int address);
  1522. void updateDecimalPosition(int position);
  1523. void updateFixedUnit(bool fixed);
  1524. void updateUnitAddress(int address);
  1525. void updateValueForF(int value);
  1526. void updateValueForC(int value);
  1527. void updateUnit(const QString&newUnit);
  1528. void updatePVAddress(int address);
  1529. void updateSVEnabled(bool enabled);
  1530. void updateSVReadAddress(int address);
  1531. void updateDeviceLimit(bool query);
  1532. void updateSVLowerAddress(int address);
  1533. void updateSVUpperAddress(int address);
  1534. void updateSVLower(double value);
  1535. void updateSVUpper(double value);
  1536. void updateSVWritable(bool canWriteSV);
  1537. void updateSVWriteAddress(int address);
  1538. void updatePVColumnName(const QString&name);
  1539. void updateSVColumnName(const QString&name);
  1540. private:
  1541. PortSelector*port;
  1542. BaudSelector*baud;
  1543. ParitySelector*parity;
  1544. FlowSelector*flow;
  1545. StopSelector*stop;
  1546. QSpinBox*station;
  1547. QCheckBox*decimalQuery;
  1548. ShortHexSpinBox*decimalAddress;
  1549. QSpinBox*decimalPosition;
  1550. QCheckBox*unitQuery;
  1551. ShortHexSpinBox*unitAddress;
  1552. QSpinBox*valueF;
  1553. QSpinBox*valueC;
  1554. QComboBox*fixedUnit;
  1555. ShortHexSpinBox*pVAddress;
  1556. QCheckBox*sVEnabled;
  1557. ShortHexSpinBox*sVReadAddress;
  1558. QCheckBox*deviceLimit;
  1559. ShortHexSpinBox*sVLowerAddr;
  1560. ShortHexSpinBox*sVUpperAddr;
  1561. QDoubleSpinBox*sVLower;
  1562. QDoubleSpinBox*sVUpper;
  1563. QCheckBox*sVWritable;
  1564. ShortHexSpinBox*sVOutputAddr;
  1565. QLineEdit*pVColumnName;
  1566. QLineEdit*sVColumnName;
  1567. };
  1568. /*:727*//*731:*/
  1569. #line 18064 "./typica.w"
  1570. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1571. {
  1572. Q_OBJECT
  1573. public:
  1574. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1575. const QModelIndex&index);
  1576. private slots:
  1577. void updateSourceColumn(const QString&source);
  1578. void updateDestinationColumn(const QString&dest);
  1579. void updateKnots();
  1580. private:
  1581. SaltModel*knotmodel;
  1582. };
  1583. /*:731*//*737:*/
  1584. #line 18188 "./typica.w"
  1585. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1586. {
  1587. Q_OBJECT
  1588. public:
  1589. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1590. private slots:
  1591. void updateMatchingColumn(const QString&column);
  1592. void updateTemperature();
  1593. private:
  1594. QDoubleSpinBox*temperatureValue;
  1595. QComboBox*unitSelector;
  1596. };
  1597. /*:737*/
  1598. #line 761 "./typica.w"
  1599. /*25:*/
  1600. #line 1010 "./typica.w"
  1601. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1602. /*:25*//*27:*/
  1603. #line 1025 "./typica.w"
  1604. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1605. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1606. /*:27*//*29:*/
  1607. #line 1050 "./typica.w"
  1608. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1609. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1610. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1611. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1612. QScriptEngine*engine);
  1613. /*:29*//*37:*/
  1614. #line 1248 "./typica.w"
  1615. QScriptValue constructQMainWindow(QScriptContext*context,
  1616. QScriptEngine*engine);
  1617. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1618. QScriptEngine*engine);
  1619. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1620. QScriptEngine*engine);
  1621. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1622. /*:37*//*42:*/
  1623. #line 1347 "./typica.w"
  1624. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1625. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1626. /*:42*//*45:*/
  1627. #line 1392 "./typica.w"
  1628. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1629. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1630. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1631. /*:45*//*48:*/
  1632. #line 1458 "./typica.w"
  1633. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1634. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1635. /*:48*//*51:*/
  1636. #line 1491 "./typica.w"
  1637. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1638. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1639. /*:51*//*54:*/
  1640. #line 1532 "./typica.w"
  1641. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1642. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1643. QScriptEngine*engine);
  1644. QScriptValue QSplitter_saveState(QScriptContext*context,
  1645. QScriptEngine*engine);
  1646. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1647. QScriptEngine*engine);
  1648. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1649. /*:54*//*59:*/
  1650. #line 1651 "./typica.w"
  1651. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1652. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1653. /*:59*//*61:*/
  1654. #line 1706 "./typica.w"
  1655. QScriptValue constructQBoxLayout(QScriptContext*context,
  1656. QScriptEngine*engine);
  1657. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1658. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1659. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1660. /*:61*//*65:*/
  1661. #line 1819 "./typica.w"
  1662. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1663. QScriptValue QAction_setShortcut(QScriptContext*context,
  1664. QScriptEngine*engine);
  1665. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1666. /*:65*//*68:*/
  1667. #line 1875 "./typica.w"
  1668. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  1669. QScriptEngine*engine);
  1670. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  1671. QScriptEngine*engine);
  1672. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  1673. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  1674. /*:68*//*73:*/
  1675. #line 1986 "./typica.w"
  1676. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  1677. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  1678. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  1679. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  1680. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  1681. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  1682. QScriptValue QIODevice_readToString(QScriptContext*context,
  1683. QScriptEngine*engine);
  1684. /*:73*//*80:*/
  1685. #line 2108 "./typica.w"
  1686. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  1687. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  1688. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  1689. /*:80*//*83:*/
  1690. #line 2153 "./typica.w"
  1691. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  1692. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1693. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  1694. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  1695. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  1696. /*:83*//*89:*/
  1697. #line 2226 "./typica.w"
  1698. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  1699. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  1700. QScriptEngine*engine);
  1701. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  1702. QScriptEngine*engine);
  1703. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  1704. QScriptEngine*engine);
  1705. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  1706. QScriptEngine*engine);
  1707. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  1708. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  1709. QScriptEngine*engine);
  1710. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  1711. QScriptEngine*engine);
  1712. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  1713. QScriptEngine*engine);
  1714. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  1715. QScriptEngine*engine);
  1716. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  1717. QScriptEngine*engine);
  1718. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  1719. QScriptEngine*engine);
  1720. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  1721. QScriptEngine*engine);
  1722. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  1723. QScriptEngine*engine);
  1724. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  1725. /*:89*//*98:*/
  1726. #line 2444 "./typica.w"
  1727. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  1728. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  1729. QScriptValue XmlReader_attribute(QScriptContext*context,
  1730. QScriptEngine*engine);
  1731. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  1732. QScriptEngine*engine);
  1733. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  1734. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  1735. QScriptEngine*engine);
  1736. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  1737. QScriptValue XmlReader_readElementText(QScriptContext*context,
  1738. QScriptEngine*engine);
  1739. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  1740. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  1741. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  1742. /*:98*//*105:*/
  1743. #line 2579 "./typica.w"
  1744. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  1745. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  1746. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  1747. /*:105*//*109:*/
  1748. #line 2661 "./typica.w"
  1749. QScriptValue constructQLCDNumber(QScriptContext*context,
  1750. QScriptEngine*engine);
  1751. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  1752. /*:109*//*112:*/
  1753. #line 2699 "./typica.w"
  1754. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  1755. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  1756. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  1757. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  1758. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  1759. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  1760. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  1761. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  1762. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  1763. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  1764. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  1765. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  1766. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  1767. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  1768. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  1769. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  1770. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  1771. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  1772. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  1773. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  1774. /*:112*//*127:*/
  1775. #line 3168 "./typica.w"
  1776. void setQAbstractScrollAreaProperties(QScriptValue value,
  1777. QScriptEngine*engine);
  1778. /*:127*//*129:*/
  1779. #line 3183 "./typica.w"
  1780. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  1781. /*:129*//*131:*/
  1782. #line 3196 "./typica.w"
  1783. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  1784. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  1785. /*:131*//*133:*/
  1786. #line 3220 "./typica.w"
  1787. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  1788. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  1789. QScriptValue constructQPushButton(QScriptContext*context,
  1790. QScriptEngine*engine);
  1791. /*:133*//*140:*/
  1792. #line 3319 "./typica.w"
  1793. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  1794. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  1795. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1796. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  1797. QScriptEngine*engine);
  1798. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  1799. QScriptEngine*engine);
  1800. QScriptValue QSqlQuery_exec(QScriptContext*context,
  1801. QScriptEngine*engine);
  1802. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  1803. QScriptEngine*engine);
  1804. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  1805. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  1806. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  1807. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  1808. /*:140*//*147:*/
  1809. #line 3489 "./typica.w"
  1810. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  1811. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  1812. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  1813. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  1814. QScriptValue annotationFromRecord(QScriptContext*context,
  1815. QScriptEngine*engine);
  1816. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  1817. /*:147*//*158:*/
  1818. #line 3772 "./typica.w"
  1819. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  1820. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1821. QStack<QLayout*> *layoutStack);
  1822. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1823. QStack<QLayout*> *layoutStack);
  1824. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1825. QStack<QLayout*> *layoutStack);
  1826. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1827. QStack<QLayout*> *layoutStack);
  1828. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1829. QStack<QLayout*> *layoutStack);
  1830. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1831. QStack<QLayout*> *layoutStack);
  1832. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1833. QStack<QLayout*> *layoutStack);
  1834. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1835. QStack<QLayout*> *layoutStack);
  1836. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1837. QStack<QLayout*> *layoutStack);
  1838. void addTemperatureDisplayToSplitter(QDomElement element,
  1839. QStack<QWidget*> *widgetStack,
  1840. QStack<QLayout*> *layoutStack);
  1841. void addTemperatureDisplayToLayout(QDomElement element,
  1842. QStack<QWidget*> *widgetStack,
  1843. QStack<QLayout*> *layoutStack);
  1844. void addTimerDisplayToSplitter(QDomElement element,
  1845. QStack<QWidget*> *widgetStack,
  1846. QStack<QLayout*> *layoutStack);
  1847. void addTimerDisplayToLayout(QDomElement element,
  1848. QStack<QWidget*> *widgetStack,
  1849. QStack<QLayout*> *layoutStack);
  1850. void addDecorationToSplitter(QDomElement element,
  1851. QStack<QWidget*> *widgetStack,
  1852. QStack<QLayout*> *layoutStack);
  1853. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1854. QStack<QLayout*> *layoutStack);
  1855. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1856. QStack<QLayout*> *layoutStack);
  1857. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1858. QStack<QLayout*> *layoutStack);
  1859. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1860. QStack<QLayout*> *layoutStack);
  1861. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1862. QStack<QLayout*> *layoutStack);
  1863. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1864. QStack<QLayout*> *layoutStack);
  1865. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1866. QStack<QLayout*> *layoutStack);
  1867. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1868. QStack<QLayout*> *layoutStack);
  1869. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1870. QStack<QLayout*> *layoutStack);
  1871. void addSqlQueryViewToLayout(QDomElement element,
  1872. QStack<QWidget*> *widgetStack,
  1873. QStack<QLayout*> *layoutStack);
  1874. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1875. QStack<QLayout*> *layoutStack);
  1876. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1877. QStack<QLayout*> *layoutStack);
  1878. /*:158*//*209:*/
  1879. #line 5288 "./typica.w"
  1880. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  1881. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  1882. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  1883. QScriptEngine*engine);
  1884. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  1885. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  1886. QScriptEngine*engine);
  1887. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  1888. /*:209*//*210:*/
  1889. #line 5303 "./typica.w"
  1890. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  1891. /*:210*//*214:*/
  1892. #line 5430 "./typica.w"
  1893. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  1894. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  1895. QScriptEngine*engine);
  1896. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  1897. QScriptEngine*engine);
  1898. QScriptValue SaltTable_columnSum(QScriptContext*context,
  1899. QScriptEngine*engine);
  1900. QScriptValue SaltTable_columnArray(QScriptContext*context,
  1901. QScriptEngine*engine);
  1902. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  1903. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  1904. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  1905. QScriptEngine*engine);
  1906. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  1907. /*:214*//*221:*/
  1908. #line 5600 "./typica.w"
  1909. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1910. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1911. QScriptValue QComboBox_currentData(QScriptContext*context,
  1912. QScriptEngine*engine);
  1913. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  1914. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  1915. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  1916. /*:221*//*253:*/
  1917. #line 6478 "./typica.w"
  1918. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  1919. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1920. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  1921. /*:253*//*262:*/
  1922. #line 6676 "./typica.w"
  1923. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  1924. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1925. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  1926. /*:262*//*267:*/
  1927. #line 6777 "./typica.w"
  1928. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  1929. /*:267*//*273:*/
  1930. #line 6953 "./typica.w"
  1931. QScriptValue constructLinearCalibrator(QScriptContext*context,
  1932. QScriptEngine*engine);
  1933. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  1934. /*:273*//*278:*/
  1935. #line 7092 "./typica.w"
  1936. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  1937. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  1938. /*:278*//*287:*/
  1939. #line 7274 "./typica.w"
  1940. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  1941. QScriptEngine*engine);
  1942. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1943. /*:287*//*294:*/
  1944. #line 7411 "./typica.w"
  1945. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  1946. QScriptEngine*engine);
  1947. void setMeasurementTimeOffsetProperties(QScriptValue value,
  1948. QScriptEngine*engine);
  1949. /*:294*//*299:*/
  1950. #line 7524 "./typica.w"
  1951. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  1952. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  1953. /*:299*//*304:*/
  1954. #line 7621 "./typica.w"
  1955. QScriptValue constructZeroEmitter(QScriptContext*context,
  1956. QScriptEngine*engine);
  1957. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  1958. /*:304*//*309:*/
  1959. #line 7700 "./typica.w"
  1960. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  1961. QScriptEngine*engine);
  1962. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  1963. /*:309*//*324:*/
  1964. #line 8050 "./typica.w"
  1965. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  1966. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  1967. /*:324*//*347:*/
  1968. #line 8645 "./typica.w"
  1969. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  1970. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  1971. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  1972. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  1973. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  1974. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  1975. QScriptEngine*engine);
  1976. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  1977. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  1978. QScriptEngine*engnie);
  1979. /*:347*//*384:*/
  1980. #line 9570 "./typica.w"
  1981. QScriptValue constructAnnotationButton(QScriptContext*context,
  1982. QScriptEngine*engine);
  1983. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  1984. /*:384*//*392:*/
  1985. #line 9710 "./typica.w"
  1986. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  1987. QScriptEngine*engine);
  1988. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1989. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1990. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1991. /*:392*//*413:*/
  1992. #line 10133 "./typica.w"
  1993. QScriptValue constructTimerDisplay(QScriptContext*context,
  1994. QScriptEngine*engine);
  1995. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1996. /*:413*//*440:*/
  1997. #line 10627 "./typica.w"
  1998. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  1999. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2000. QScriptEngine*engine);
  2001. /*:440*//*453:*/
  2002. #line 10910 "./typica.w"
  2003. QScriptValue constructLogEditWindow(QScriptContext*context,
  2004. QScriptEngine*engine);
  2005. /*:453*//*472:*/
  2006. #line 11384 "./typica.w"
  2007. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2008. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2009. /*:472*//*488:*/
  2010. #line 11667 "./typica.w"
  2011. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2012. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*engine);
  2013. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*engine);
  2014. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*engine);
  2015. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*engine);
  2016. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*);
  2017. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2018. QStack<QLayout*> *layoutStack);
  2019. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2020. /*:488*//*543:*/
  2021. #line 12683 "./typica.w"
  2022. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2023. QScriptValue constructSqlQueryView(QScriptContext*context,
  2024. QScriptEngine*engine);
  2025. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2026. QScriptEngine*engine);
  2027. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2028. QScriptEngine*engine);
  2029. /*:543*//*553:*/
  2030. #line 12912 "./typica.w"
  2031. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2032. QStack<QLayout*> *layoutStack);
  2033. /*:553*//*569:*/
  2034. #line 13196 "./typica.w"
  2035. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2036. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2037. /*:569*//*579:*/
  2038. #line 13391 "./typica.w"
  2039. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2040. QStack<QLayout*> *layoutStack);
  2041. /*:579*//*600:*/
  2042. #line 13975 "./typica.w"
  2043. void addScaleControlToLayout(QDomElement element,
  2044. QStack<QWidget*> *widgetStack,
  2045. QStack<QLayout*> *layoutStack);
  2046. void addIntensityControlToLayout(QDomElement element,
  2047. QStack<QWidget*> *widgetStack,
  2048. QStack<QLayout*> *layoutStack);
  2049. /*:600*//*626:*/
  2050. #line 14561 "./typica.w"
  2051. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2052. QScriptEngine*engine);
  2053. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2054. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2055. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2056. QScriptEngine*engine);
  2057. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2058. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2059. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2060. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2061. /*:626*//*632:*/
  2062. #line 14703 "./typica.w"
  2063. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2064. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2065. /*:632*//*647:*/
  2066. #line 14971 "./typica.w"
  2067. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2068. QScriptEngine*engine);
  2069. /*:647*//*722:*/
  2070. #line 17465 "./typica.w"
  2071. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2072. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2073. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2074. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2075. /*:722*/
  2076. #line 762 "./typica.w"
  2077. /*17:*/
  2078. #line 770 "./typica.w"
  2079. /*640:*/
  2080. #line 14824 "./typica.w"
  2081. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2082. const QString&driver,QObject*parent):
  2083. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2084. {
  2085. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2086. }
  2087. void NodeInserter::onTriggered()
  2088. {
  2089. emit triggered(defaultNodeName,driverString);
  2090. }
  2091. /*:640*/
  2092. #line 771 "./typica.w"
  2093. /*228:*/
  2094. #line 5715 "./typica.w"
  2095. Measurement::Measurement(double temperature,QTime time,
  2096. TemperatureUnits sc):
  2097. theTemperature(temperature),theTime(time),unit(sc)
  2098. {
  2099. }
  2100. Measurement::Measurement(double temperature):
  2101. theTemperature(temperature),theTime(QTime::currentTime()),
  2102. unit(Fahrenheit)
  2103. {
  2104. }
  2105. /*:228*//*230:*/
  2106. #line 5743 "./typica.w"
  2107. Measurement::Measurement(const Measurement&x):
  2108. theTemperature(x.temperature()),theTime(x.time()),
  2109. unit(x.unit)
  2110. {
  2111. }
  2112. Measurement::~Measurement()
  2113. {
  2114. }
  2115. /*:230*//*231:*/
  2116. #line 5759 "./typica.w"
  2117. Measurement&Measurement::operator= (Measurement&x)
  2118. {
  2119. theTemperature= x.temperature();
  2120. theTime= x.time();
  2121. unit= x.unit;
  2122. return*this;
  2123. }
  2124. /*:231*//*232:*/
  2125. #line 5773 "./typica.w"
  2126. double Measurement::temperature()const
  2127. {
  2128. return theTemperature;
  2129. }
  2130. QTime Measurement::time()const
  2131. {
  2132. return theTime;
  2133. }
  2134. void Measurement::setTemperature(double temperature)
  2135. {
  2136. theTemperature= temperature;
  2137. }
  2138. void Measurement::setTime(QTime time)
  2139. {
  2140. theTime= time;
  2141. }
  2142. /*:232*//*233:*/
  2143. #line 5799 "./typica.w"
  2144. void Measurement::setUnit(TemperatureUnits scale)
  2145. {
  2146. unit= scale;
  2147. }
  2148. Measurement::TemperatureUnits Measurement::scale()
  2149. {
  2150. return unit;
  2151. }
  2152. /*:233*//*234:*/
  2153. #line 5819 "./typica.w"
  2154. Measurement Measurement::toFahrenheit()
  2155. {
  2156. switch(unit)
  2157. {
  2158. case Celsius:
  2159. return Measurement(this->temperature()*9/5+32,this->time(),
  2160. Fahrenheit);
  2161. break;
  2162. case Kelvin:
  2163. return Measurement(this->temperature()*5/9-459.67,
  2164. this->time(),Fahrenheit);
  2165. break;
  2166. case Rankine:
  2167. return Measurement(this->temperature()-459.67,this->time(),
  2168. Fahrenheit);
  2169. break;
  2170. default:
  2171. return Measurement(this->temperature(),this->time(),Fahrenheit);
  2172. break;
  2173. }
  2174. }
  2175. /*:234*//*235:*/
  2176. #line 5844 "./typica.w"
  2177. Measurement Measurement::toCelsius()
  2178. {
  2179. switch(unit)
  2180. {
  2181. case Fahrenheit:
  2182. return Measurement((this->temperature()-32)*5/9,this->time(),
  2183. Celsius);
  2184. break;
  2185. case Kelvin:
  2186. return Measurement(this->temperature()-273.15,this->time(),
  2187. Celsius);
  2188. break;
  2189. case Rankine:
  2190. return Measurement((this->temperature()-491.67)*5/9,
  2191. this->time(),Celsius);
  2192. break;
  2193. default:
  2194. return Measurement(this->temperature(),this->time(),Celsius);
  2195. break;
  2196. }
  2197. }
  2198. /*:235*//*236:*/
  2199. #line 5870 "./typica.w"
  2200. Measurement Measurement::toKelvin()
  2201. {
  2202. switch(unit)
  2203. {
  2204. case Fahrenheit:
  2205. return Measurement((this->temperature()+459.67)*5/9,
  2206. this->time(),Kelvin);
  2207. break;
  2208. case Celsius:
  2209. return Measurement(this->temperature()+273.15,this->time(),
  2210. Kelvin);
  2211. break;
  2212. case Rankine:
  2213. return Measurement(this->temperature()*5/9,this->time(),
  2214. Kelvin);
  2215. break;
  2216. default:
  2217. return Measurement(this->temperature(),this->time(),Kelvin);
  2218. break;
  2219. }
  2220. }
  2221. /*:236*//*237:*/
  2222. #line 5895 "./typica.w"
  2223. Measurement Measurement::toRankine()
  2224. {
  2225. switch(unit)
  2226. {
  2227. case Fahrenheit:
  2228. return Measurement(this->temperature()+459.67,this->time(),
  2229. Rankine);
  2230. break;
  2231. case Celsius:
  2232. return Measurement((this->temperature()+273.15)*9/5,
  2233. this->time(),Rankine);
  2234. break;
  2235. case Kelvin:
  2236. return Measurement(this->temperature()*9/5,this->time(),
  2237. Rankine);
  2238. break;
  2239. default:
  2240. return Measurement(this->temperature(),this->time(),Rankine);
  2241. break;
  2242. }
  2243. }
  2244. /*:237*/
  2245. #line 772 "./typica.w"
  2246. /*243:*/
  2247. #line 6084 "./typica.w"
  2248. void DAQImplementation::measure()
  2249. {
  2250. int samplesRead= 0;
  2251. double buffer[channels];
  2252. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2253. (unsigned long)(0),buffer,(unsigned long)(channels),
  2254. &samplesRead,(signed long)(0));
  2255. if(error)
  2256. {
  2257. ready= false;
  2258. }
  2259. else
  2260. {
  2261. if(samplesRead)
  2262. {
  2263. QTime time= QTime::currentTime();
  2264. for(int i= 0;i<samplesRead;i++)
  2265. {
  2266. for(int j= 0;j<channels;j++)
  2267. {
  2268. Measurement measure(buffer[j+(i*channels)],time,
  2269. unitMap[j]);
  2270. channelMap[j]->input(measure);
  2271. }
  2272. }
  2273. }
  2274. }
  2275. }
  2276. /*:243*//*244:*/
  2277. #line 6126 "./typica.w"
  2278. void DAQImplementation::run()
  2279. {
  2280. setPriority(QThread::TimeCriticalPriority);
  2281. while(ready)
  2282. {
  2283. measure();
  2284. }
  2285. }
  2286. /*:244*//*245:*/
  2287. #line 6142 "./typica.w"
  2288. void DAQ::threadFinished()
  2289. {
  2290. if(imp->error)
  2291. {
  2292. /*246:*/
  2293. #line 6193 "./typica.w"
  2294. imp->ready= false;
  2295. QMessageBox warning;
  2296. warning.setStandardButtons(QMessageBox::Cancel);
  2297. warning.setIcon(QMessageBox::Warning);
  2298. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2299. unsigned long bytes= imp->errorInfo(NULL,0);
  2300. char string[bytes];
  2301. imp->errorInfo(string,bytes);
  2302. warning.setInformativeText(QString(string));
  2303. warning.setWindowTitle(QString(PROGRAM_NAME));
  2304. warning.exec();
  2305. /*:246*/
  2306. #line 6147 "./typica.w"
  2307. }
  2308. }
  2309. /*:245*//*247:*/
  2310. #line 6218 "./typica.w"
  2311. void DAQ::start()
  2312. {
  2313. if(imp->ready)
  2314. {
  2315. imp->error= imp->startTask(imp->handle);
  2316. if(imp->error)
  2317. {
  2318. /*246:*/
  2319. #line 6193 "./typica.w"
  2320. imp->ready= false;
  2321. QMessageBox warning;
  2322. warning.setStandardButtons(QMessageBox::Cancel);
  2323. warning.setIcon(QMessageBox::Warning);
  2324. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2325. unsigned long bytes= imp->errorInfo(NULL,0);
  2326. char string[bytes];
  2327. imp->errorInfo(string,bytes);
  2328. warning.setInformativeText(QString(string));
  2329. warning.setWindowTitle(QString(PROGRAM_NAME));
  2330. warning.exec();
  2331. /*:246*/
  2332. #line 6226 "./typica.w"
  2333. }
  2334. else
  2335. {
  2336. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2337. imp->start();
  2338. }
  2339. }
  2340. }
  2341. void DAQ::stop()
  2342. {
  2343. if(imp->useBase)
  2344. {
  2345. imp->ready= false;
  2346. imp->wait(ULONG_MAX);
  2347. imp->stopTask(imp->handle);
  2348. }
  2349. else
  2350. {
  2351. imp->ready= false;
  2352. imp->error= imp->stopTask(imp->handle);
  2353. if(imp->error)
  2354. {
  2355. /*246:*/
  2356. #line 6193 "./typica.w"
  2357. imp->ready= false;
  2358. QMessageBox warning;
  2359. warning.setStandardButtons(QMessageBox::Cancel);
  2360. warning.setIcon(QMessageBox::Warning);
  2361. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2362. unsigned long bytes= imp->errorInfo(NULL,0);
  2363. char string[bytes];
  2364. imp->errorInfo(string,bytes);
  2365. warning.setInformativeText(QString(string));
  2366. warning.setWindowTitle(QString(PROGRAM_NAME));
  2367. warning.exec();
  2368. /*:246*/
  2369. #line 6250 "./typica.w"
  2370. }
  2371. imp->error= imp->clearTask(imp->handle);
  2372. if(imp->error)
  2373. {
  2374. /*246:*/
  2375. #line 6193 "./typica.w"
  2376. imp->ready= false;
  2377. QMessageBox warning;
  2378. warning.setStandardButtons(QMessageBox::Cancel);
  2379. warning.setIcon(QMessageBox::Warning);
  2380. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2381. unsigned long bytes= imp->errorInfo(NULL,0);
  2382. char string[bytes];
  2383. imp->errorInfo(string,bytes);
  2384. warning.setInformativeText(QString(string));
  2385. warning.setWindowTitle(QString(PROGRAM_NAME));
  2386. warning.exec();
  2387. /*:246*/
  2388. #line 6255 "./typica.w"
  2389. }
  2390. }
  2391. }
  2392. /*:247*//*248:*/
  2393. #line 6265 "./typica.w"
  2394. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2395. {
  2396. imp->device= device;
  2397. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2398. if(imp->error)
  2399. {
  2400. /*246:*/
  2401. #line 6193 "./typica.w"
  2402. imp->ready= false;
  2403. QMessageBox warning;
  2404. warning.setStandardButtons(QMessageBox::Cancel);
  2405. warning.setIcon(QMessageBox::Warning);
  2406. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2407. unsigned long bytes= imp->errorInfo(NULL,0);
  2408. char string[bytes];
  2409. imp->errorInfo(string,bytes);
  2410. warning.setInformativeText(QString(string));
  2411. warning.setWindowTitle(QString(PROGRAM_NAME));
  2412. warning.exec();
  2413. /*:246*/
  2414. #line 6272 "./typica.w"
  2415. }
  2416. else
  2417. {
  2418. imp->ready= true;
  2419. }
  2420. }
  2421. /*:248*//*249:*/
  2422. #line 6286 "./typica.w"
  2423. Channel*DAQ::newChannel(int units,int thermocouple)
  2424. {
  2425. Channel*retval= new Channel();
  2426. imp->channelMap[imp->channels]= retval;
  2427. imp->unitMap[imp->channels]= (Measurement::TemperatureUnits)units;
  2428. imp->channels++;
  2429. if(imp->ready)
  2430. {
  2431. if(imp->useBase)
  2432. {
  2433. imp->error= imp->createChannel(imp->handle,
  2434. QString("%1/ai%2").arg(imp->device).
  2435. arg(imp->channels-1).
  2436. toAscii().data(),
  2437. "",(double)(-1.0),(double)(100.0),
  2438. (signed long)(units),
  2439. (signed long)(thermocouple),
  2440. (signed long)(10200),(double)(0),
  2441. "");
  2442. }
  2443. else
  2444. {
  2445. imp->error= imp->createChannel(imp->handle,
  2446. QString("%1/ai%2").arg(imp->device).
  2447. arg(imp->channels-1).
  2448. toAscii().data(),
  2449. "",(double)(50.0),(double)(500.0),
  2450. (signed long)(units),
  2451. (signed long)(thermocouple),
  2452. (signed long)(10200),(double)(0),
  2453. "");
  2454. }
  2455. if(imp->error)
  2456. {
  2457. /*246:*/
  2458. #line 6193 "./typica.w"
  2459. imp->ready= false;
  2460. QMessageBox warning;
  2461. warning.setStandardButtons(QMessageBox::Cancel);
  2462. warning.setIcon(QMessageBox::Warning);
  2463. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2464. unsigned long bytes= imp->errorInfo(NULL,0);
  2465. char string[bytes];
  2466. imp->errorInfo(string,bytes);
  2467. warning.setInformativeText(QString(string));
  2468. warning.setWindowTitle(QString(PROGRAM_NAME));
  2469. warning.exec();
  2470. /*:246*/
  2471. #line 6321 "./typica.w"
  2472. }
  2473. }
  2474. return retval;
  2475. }
  2476. /*:249*//*250:*/
  2477. #line 6335 "./typica.w"
  2478. void DAQ::setClockRate(double Hz)
  2479. {
  2480. if(imp->ready)
  2481. {
  2482. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2483. (signed long)(10280),(signed long)(10123),
  2484. (unsigned long long)(1));
  2485. if(imp->error)
  2486. {
  2487. /*246:*/
  2488. #line 6193 "./typica.w"
  2489. imp->ready= false;
  2490. QMessageBox warning;
  2491. warning.setStandardButtons(QMessageBox::Cancel);
  2492. warning.setIcon(QMessageBox::Warning);
  2493. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2494. unsigned long bytes= imp->errorInfo(NULL,0);
  2495. char string[bytes];
  2496. imp->errorInfo(string,bytes);
  2497. warning.setInformativeText(QString(string));
  2498. warning.setWindowTitle(QString(PROGRAM_NAME));
  2499. warning.exec();
  2500. /*:246*/
  2501. #line 6345 "./typica.w"
  2502. }
  2503. }
  2504. }
  2505. /*:250*//*251:*/
  2506. #line 6355 "./typica.w"
  2507. DAQ::~DAQ()
  2508. {
  2509. if(imp->useBase)
  2510. {
  2511. imp->resetDevice(imp->device.toAscii().data());
  2512. imp->clearTask(imp->handle);
  2513. }
  2514. else
  2515. {
  2516. if(imp->ready)
  2517. {
  2518. imp->ready= false;
  2519. imp->wait(ULONG_MAX);
  2520. imp->stopTask(imp->handle);
  2521. imp->resetDevice(imp->device.toAscii().data());
  2522. imp->clearTask(imp->handle);
  2523. }
  2524. }
  2525. delete imp;
  2526. }
  2527. /*:251*//*252:*/
  2528. #line 6386 "./typica.w"
  2529. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2530. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2531. unitMap(4)
  2532. {
  2533. if(driverinfo=="nidaqmxbase")
  2534. {
  2535. useBase= true;
  2536. }
  2537. else
  2538. {
  2539. useBase= false;
  2540. }
  2541. if(useBase)
  2542. {
  2543. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2544. if(!driver.load())
  2545. {
  2546. driver.setFileName("nidaqmxbase");
  2547. if(!driver.load())
  2548. {
  2549. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2550. tr("Failed to find nidaqmxbase. Please install it."));
  2551. QApplication::quit();
  2552. }
  2553. }
  2554. }
  2555. else
  2556. {
  2557. driver.setFileName("nicaiu");
  2558. if(!driver.load())
  2559. {
  2560. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2561. tr("Failed to find nidaqmx. Please install it."));
  2562. QApplication::quit();
  2563. }
  2564. }
  2565. if(useBase)
  2566. {
  2567. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2568. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2569. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2570. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2571. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2572. ==0||
  2573. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2574. 0||
  2575. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2576. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2577. 0||
  2578. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2579. {
  2580. waitForMeasurement= NULL;
  2581. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2582. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2583. QApplication::quit();
  2584. }
  2585. }
  2586. else
  2587. {
  2588. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2589. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2590. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2591. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2592. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2593. ==0||
  2594. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2595. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2596. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2597. 0||
  2598. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2599. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2600. {
  2601. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2602. tr("Failed to link a required symbol in NI-DAQmx."));
  2603. QApplication::quit();
  2604. }
  2605. }
  2606. }
  2607. DAQImplementation::~DAQImplementation()
  2608. {
  2609. driver.unload();
  2610. }
  2611. /*:252*/
  2612. #line 773 "./typica.w"
  2613. /*259:*/
  2614. #line 6588 "./typica.w"
  2615. void FakeDAQImplementation::measure()
  2616. {
  2617. msleep((int)(1000/clockRate));
  2618. QTime time= QTime::currentTime();
  2619. for(int i= 0;i<channels;i++)
  2620. {
  2621. Measurement measure(qrand()%500,time);
  2622. channelMap[i]->input(measure);
  2623. }
  2624. }
  2625. /*:259*//*260:*/
  2626. #line 6602 "./typica.w"
  2627. void FakeDAQImplementation::run()
  2628. {
  2629. setPriority(QThread::TimeCriticalPriority);
  2630. while(ready)
  2631. {
  2632. measure();
  2633. }
  2634. }
  2635. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  2636. channels(0),ready(false),clockRate(1)
  2637. {
  2638. }
  2639. FakeDAQImplementation::~FakeDAQImplementation()
  2640. {
  2641. }
  2642. /*:260*//*261:*/
  2643. #line 6627 "./typica.w"
  2644. void FakeDAQ::start()
  2645. {
  2646. if(imp->ready)
  2647. {
  2648. imp->start();
  2649. }
  2650. }
  2651. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  2652. {
  2653. imp->ready= true;
  2654. }
  2655. Channel*FakeDAQ::newChannel(int,int)
  2656. {
  2657. Channel*retval;
  2658. if(imp->ready)
  2659. {
  2660. retval= new Channel();
  2661. imp->channelMap[imp->channels]= retval;
  2662. imp->channels++;
  2663. }
  2664. else
  2665. {
  2666. return NULL;
  2667. }
  2668. return retval;
  2669. }
  2670. void FakeDAQ::setClockRate(double Hz)
  2671. {
  2672. if(imp->ready)
  2673. {
  2674. imp->clockRate= Hz;
  2675. }
  2676. }
  2677. FakeDAQ::~FakeDAQ()
  2678. {
  2679. imp->ready= false;
  2680. imp->wait(ULONG_MAX);
  2681. delete imp;
  2682. }
  2683. /*:261*/
  2684. #line 774 "./typica.w"
  2685. /*266:*/
  2686. #line 6758 "./typica.w"
  2687. Channel::Channel():QObject(NULL)
  2688. {
  2689. }
  2690. Channel::~Channel()
  2691. {
  2692. }
  2693. void Channel::input(Measurement measurement)
  2694. {
  2695. emit newData(measurement);
  2696. }
  2697. /*:266*/
  2698. #line 775 "./typica.w"
  2699. /*282:*/
  2700. #line 7169 "./typica.w"
  2701. void TemperatureDisplay::setValue(Measurement temperature)
  2702. {
  2703. QString number;
  2704. switch(unit)
  2705. {
  2706. case Auto:
  2707. switch(temperature.scale())
  2708. {
  2709. case Fahrenheit:
  2710. display(QString("%1'F").
  2711. arg(number.setNum(temperature.temperature(),'f',2)));
  2712. break;
  2713. case Celsius:
  2714. display(QString("%1'C").
  2715. arg(number.setNum(temperature.temperature(),'f',2)));
  2716. break;
  2717. case Kelvin:
  2718. display(QString("%1").
  2719. arg(number.setNum(temperature.temperature(),'f',2)));
  2720. break;
  2721. case Rankine:
  2722. display(QString("%1'r").
  2723. arg(number.setNum(temperature.temperature(),'f',2)));
  2724. break;
  2725. }
  2726. break;
  2727. case Fahrenheit:
  2728. display(QString("%1'F").
  2729. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  2730. 2)));
  2731. break;
  2732. case Celsius:
  2733. display(QString("%1'C").
  2734. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  2735. 2)));
  2736. break;
  2737. case Kelvin:
  2738. display(QString("%1").
  2739. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  2740. 2)));
  2741. break;
  2742. case Rankine:
  2743. display(QString("%1'r").
  2744. arg(number.setNum(temperature.toRankine().temperature(),'f',
  2745. 2)));
  2746. break;
  2747. }
  2748. }
  2749. /*:282*//*283:*/
  2750. #line 7229 "./typica.w"
  2751. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  2752. QLCDNumber(8,parent),unit(Auto)
  2753. {
  2754. setSegmentStyle(Filled);
  2755. display("---.--'F");
  2756. }
  2757. /*:283*//*284:*/
  2758. #line 7245 "./typica.w"
  2759. void TemperatureDisplay::invalidate()
  2760. {
  2761. display("---.--'F");
  2762. }
  2763. /*:284*//*285:*/
  2764. #line 7257 "./typica.w"
  2765. void TemperatureDisplay::setDisplayUnits(DisplayUnits scale)
  2766. {
  2767. unit= scale;
  2768. }
  2769. /*:285*//*286:*/
  2770. #line 7265 "./typica.w"
  2771. TemperatureDisplay::~TemperatureDisplay()
  2772. {
  2773. }
  2774. /*:286*/
  2775. #line 776 "./typica.w"
  2776. /*291:*/
  2777. #line 7345 "./typica.w"
  2778. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  2779. {
  2780. if(measure.time()<epoch)
  2781. {
  2782. if(hasPrevious)
  2783. {
  2784. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  2785. epoch.msec());
  2786. QTime jitComp(epoch.hour(),measure.time().minute(),
  2787. measure.time().second(),measure.time().msec());
  2788. int relTime= jitBase.msecsTo(jitComp);
  2789. /*292:*/
  2790. #line 7378 "./typica.w"
  2791. QTime newTime(0,0,0,0);
  2792. newTime= newTime.addMSecs(relTime);
  2793. if(newTime.hour()> 0)
  2794. {
  2795. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2796. }
  2797. Measurement rel(measure.temperature(),newTime);
  2798. emit measurement(rel);
  2799. /*:292*/
  2800. #line 7357 "./typica.w"
  2801. }
  2802. else
  2803. {
  2804. Measurement rel(measure.temperature(),QTime(0,0,0,0));
  2805. emit measurement(rel);
  2806. }
  2807. }
  2808. else
  2809. {
  2810. int relTime= epoch.msecsTo(measure.time());
  2811. /*292:*/
  2812. #line 7378 "./typica.w"
  2813. QTime newTime(0,0,0,0);
  2814. newTime= newTime.addMSecs(relTime);
  2815. if(newTime.hour()> 0)
  2816. {
  2817. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2818. }
  2819. Measurement rel(measure.temperature(),newTime);
  2820. emit measurement(rel);
  2821. /*:292*/
  2822. #line 7368 "./typica.w"
  2823. }
  2824. hasPrevious= true;
  2825. previous= measure.time();
  2826. }
  2827. /*:291*//*293:*/
  2828. #line 7390 "./typica.w"
  2829. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  2830. previous(0,0,0,0),hasPrevious(false)
  2831. {
  2832. }
  2833. QTime MeasurementTimeOffset::zeroTime()
  2834. {
  2835. return epoch;
  2836. }
  2837. void MeasurementTimeOffset::setZeroTime(QTime zero)
  2838. {
  2839. epoch= zero;
  2840. hasPrevious= false;
  2841. }
  2842. /*:293*/
  2843. #line 777 "./typica.w"
  2844. /*303:*/
  2845. #line 7587 "./typica.w"
  2846. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn),
  2847. temp(0)
  2848. {
  2849. }
  2850. int ZeroEmitter::column()
  2851. {
  2852. return col;
  2853. }
  2854. double ZeroEmitter::lastTemperature()
  2855. {
  2856. return temp;
  2857. }
  2858. void ZeroEmitter::newMeasurement(Measurement measure)
  2859. {
  2860. temp= measure.temperature();
  2861. }
  2862. void ZeroEmitter::setColumn(int column)
  2863. {
  2864. col= column;
  2865. }
  2866. void ZeroEmitter::emitZero()
  2867. {
  2868. emit measurement(Measurement(temp,QTime(0,0,0,0)),col);
  2869. }
  2870. /*:303*/
  2871. #line 778 "./typica.w"
  2872. /*308:*/
  2873. #line 7677 "./typica.w"
  2874. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  2875. {
  2876. }
  2877. int MeasurementAdapter::column()
  2878. {
  2879. return col;
  2880. }
  2881. void MeasurementAdapter::newMeasurement(Measurement measure)
  2882. {
  2883. emit measurement(measure,col);
  2884. }
  2885. void MeasurementAdapter::setColumn(int column)
  2886. {
  2887. col= column;
  2888. }
  2889. /*:308*/
  2890. #line 779 "./typica.w"
  2891. /*313:*/
  2892. #line 7793 "./typica.w"
  2893. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  2894. theScene(new QGraphicsScene),
  2895. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  2896. prevPoints(new QMap<int,QPointF> ),
  2897. translations(new QMap<int,double> ),
  2898. gridLinesF(new QList<QGraphicsItem*> ),
  2899. gridLinesC(new QList<QGraphicsItem*> )
  2900. {
  2901. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2902. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2903. setScene(theScene);
  2904. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  2905. /*314:*/
  2906. #line 7821 "./typica.w"
  2907. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  2908. tempaxis->setLine(-10,-500,-10,0);
  2909. theScene->addItem(tempaxis);
  2910. QGraphicsLineItem*gridLine;
  2911. QGraphicsTextItem*label;
  2912. for(int y= -100;y> -600;y-= 100)
  2913. {
  2914. gridLine= new QGraphicsLineItem;
  2915. gridLine->setLine(0,y,1200,y);
  2916. theScene->addItem(gridLine);
  2917. label= new QGraphicsTextItem;
  2918. label->setHtml(QString("%1&deg;F").arg(-y));
  2919. label->setPos(-55,y-(label->boundingRect().height()/2));
  2920. theScene->addItem(label);
  2921. gridLinesF->append(gridLine);
  2922. gridLinesF->append(label);
  2923. }
  2924. for(int degC= 50;degC<=250;degC+= 50)
  2925. {
  2926. gridLine= new QGraphicsLineItem;
  2927. int y= -(degC*(9.0/5.0)+32);
  2928. gridLine->setLine(0,y,1200,y);
  2929. gridLine->hide();
  2930. theScene->addItem(gridLine);
  2931. gridLinesC->append(gridLine);
  2932. label= new QGraphicsTextItem;
  2933. label->setHtml(QString("%1&deg;C").arg(degC));
  2934. label->setPos(-55,y-(label->boundingRect().height()/2));
  2935. label->hide();
  2936. theScene->addItem(label);
  2937. gridLinesC->append(label);
  2938. }
  2939. /*:314*/
  2940. #line 7806 "./typica.w"
  2941. ;
  2942. /*316:*/
  2943. #line 7887 "./typica.w"
  2944. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  2945. timeaxis->setLine(0,10,1200,10);
  2946. theScene->addItem(timeaxis);
  2947. for(int x= 0;x<1201;x+= 120)
  2948. {
  2949. QGraphicsLineItem*tick= new QGraphicsLineItem;
  2950. tick->setLine(x,0,x,20);
  2951. theScene->addItem(tick);
  2952. QGraphicsTextItem*label= new QGraphicsTextItem;
  2953. label->setPlainText(QString("%1").arg(x/60));
  2954. label->setPos(x-(label->boundingRect().width()/2),20);
  2955. theScene->addItem(label);
  2956. }
  2957. /*:316*/
  2958. #line 7807 "./typica.w"
  2959. ;
  2960. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2961. }
  2962. /*:313*//*315:*/
  2963. #line 7857 "./typica.w"
  2964. void GraphView::showF()
  2965. {
  2966. for(int i= 0;i<gridLinesF->size();i++)
  2967. {
  2968. gridLinesF->at(i)->show();
  2969. }
  2970. for(int i= 0;i<gridLinesC->size();i++)
  2971. {
  2972. gridLinesC->at(i)->hide();
  2973. }
  2974. }
  2975. void GraphView::showC()
  2976. {
  2977. for(int i= 0;i<gridLinesF->size();i++)
  2978. {
  2979. gridLinesF->at(i)->hide();
  2980. }
  2981. for(int i= 0;i<gridLinesC->size();i++)
  2982. {
  2983. gridLinesC->at(i)->show();
  2984. }
  2985. }
  2986. /*:315*//*317:*/
  2987. #line 7906 "./typica.w"
  2988. void GraphView::resizeEvent(QResizeEvent*)
  2989. {
  2990. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2991. }
  2992. /*:317*//*318:*/
  2993. #line 7917 "./typica.w"
  2994. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  2995. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  2996. {
  2997. double offset= 0;
  2998. if(translations->contains(tempcolumn))
  2999. {
  3000. offset= translations->value(tempcolumn);
  3001. }
  3002. if(prevPoints->contains(tempcolumn))
  3003. {
  3004. /*320:*/
  3005. #line 7976 "./typica.w"
  3006. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3007. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3008. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3009. -(prevPoints->value(tempcolumn).y()),
  3010. nextPoint.x()+offset,-(nextPoint.y()));
  3011. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3012. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3013. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3014. Qt::darkYellow};
  3015. segment->setPen(p[tempcolumn%12]);
  3016. theScene->addItem(segment);
  3017. prevPoints->insert(tempcolumn,nextPoint);
  3018. /*:320*/
  3019. #line 7929 "./typica.w"
  3020. if(graphLines->contains(tempcolumn))
  3021. {
  3022. graphLines->value(tempcolumn)->append(segment);
  3023. }
  3024. else
  3025. {
  3026. QList<QGraphicsLineItem*> *newLine=
  3027. new QList<QGraphicsLineItem*> ;
  3028. newLine->append(segment);
  3029. graphLines->insert(tempcolumn,newLine);
  3030. }
  3031. }
  3032. else
  3033. {
  3034. /*319:*/
  3035. #line 7965 "./typica.w"
  3036. int x= FULLTIMETOINT(measure.time())/1000;
  3037. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3038. /*:319*/
  3039. #line 7946 "./typica.w"
  3040. }
  3041. }
  3042. /*:318*//*321:*/
  3043. #line 7993 "./typica.w"
  3044. void GraphView::clear()
  3045. {
  3046. int i;
  3047. foreach(i,prevPoints->keys())
  3048. {
  3049. removeSeries(i);
  3050. }
  3051. translations->clear();
  3052. }
  3053. /*:321*//*322:*/
  3054. #line 8007 "./typica.w"
  3055. void GraphView::removeSeries(int column)
  3056. {
  3057. if(graphLines->contains(column))
  3058. {
  3059. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3060. QGraphicsLineItem*segment;
  3061. foreach(segment,*series)
  3062. {
  3063. theScene->removeItem(segment);
  3064. }
  3065. qDeleteAll(*series);
  3066. }
  3067. graphLines->remove(column);
  3068. prevPoints->remove(column);
  3069. }
  3070. /*:322*//*323:*/
  3071. #line 8026 "./typica.w"
  3072. void GraphView::setSeriesTranslation(int column,double offset)
  3073. {
  3074. if(graphLines->contains(column))
  3075. {
  3076. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3077. QGraphicsLineItem*segment;
  3078. foreach(segment,*series)
  3079. {
  3080. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3081. }
  3082. }
  3083. if(translations->contains(column))
  3084. {
  3085. translations->insert(column,offset+translations->value(column));
  3086. }
  3087. else
  3088. {
  3089. translations->insert(column,offset);
  3090. }
  3091. }
  3092. /*:323*/
  3093. #line 780 "./typica.w"
  3094. /*329:*/
  3095. #line 8176 "./typica.w"
  3096. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3097. {
  3098. /*331:*/
  3099. #line 8247 "./typica.w"
  3100. if(lastMeasurement[tempcolumn].time()<measure.time())
  3101. {
  3102. QList<QTime> timelist;
  3103. for(QTime i= lastMeasurement[tempcolumn].time().addSecs(1);i<measure.time();i= i.addSecs(1))
  3104. {
  3105. timelist.append(i);
  3106. }
  3107. for(int i= 0;i<timelist.size();i++)
  3108. {
  3109. newMeasurement(Measurement(measure.temperature(),timelist[i],measure.scale()),tempcolumn);
  3110. }
  3111. }
  3112. /*:331*/
  3113. #line 8179 "./typica.w"
  3114. model_ms->newMeasurement(measure,tempcolumn);
  3115. if(lastMeasurement.contains(tempcolumn))
  3116. {
  3117. if(measure.time().second()!=
  3118. lastMeasurement.value(tempcolumn).time().second())
  3119. {
  3120. Measurement adjusted(measure.temperature(),
  3121. QTime(0,measure.time().minute(),
  3122. measure.time().second(),0));
  3123. model_1s->newMeasurement(adjusted,tempcolumn);
  3124. if(adjusted.time().second()%5==0)
  3125. {
  3126. model_5s->newMeasurement(adjusted,tempcolumn);
  3127. if(adjusted.time().second()%10==0)
  3128. {
  3129. model_10s->newMeasurement(adjusted,tempcolumn);
  3130. }
  3131. if(adjusted.time().second()%15==0)
  3132. {
  3133. model_15s->newMeasurement(adjusted,tempcolumn);
  3134. if(adjusted.time().second()%30==0)
  3135. {
  3136. model_30s->newMeasurement(adjusted,tempcolumn);
  3137. if(adjusted.time().second()==0)
  3138. {
  3139. model_1m->newMeasurement(adjusted,tempcolumn);
  3140. }
  3141. }
  3142. }
  3143. }
  3144. }
  3145. /*333:*/
  3146. #line 8286 "./typica.w"
  3147. if(currentColumnSet.contains(tempcolumn))
  3148. {
  3149. int replicationcolumn;
  3150. foreach(replicationcolumn,currentColumnSet)
  3151. {
  3152. if(replicationcolumn!=tempcolumn)
  3153. {
  3154. if(lastMeasurement.contains(replicationcolumn))
  3155. {
  3156. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3157. {
  3158. Measurement synthetic(lastMeasurement.value(replicationcolumn).temperature(),
  3159. measure.time());
  3160. model_ms->newMeasurement(synthetic,replicationcolumn);
  3161. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3162. {
  3163. Measurement adjusted(synthetic.temperature(),QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3164. model_1s->newMeasurement(adjusted,replicationcolumn);
  3165. if(adjusted.time().second()%5==0)
  3166. {
  3167. model_5s->newMeasurement(adjusted,replicationcolumn);
  3168. if(adjusted.time().second()%10==0)
  3169. {
  3170. model_10s->newMeasurement(adjusted,replicationcolumn);
  3171. }
  3172. if(adjusted.time().second()%15==0)
  3173. {
  3174. model_15s->newMeasurement(adjusted,replicationcolumn);
  3175. if(adjusted.time().second()%30==0)
  3176. {
  3177. model_30s->newMeasurement(adjusted,replicationcolumn);
  3178. if(adjusted.time().second()==0)
  3179. {
  3180. model_1m->newMeasurement(adjusted,replicationcolumn);
  3181. }
  3182. }
  3183. }
  3184. }
  3185. }
  3186. lastMeasurement[replicationcolumn]= synthetic;
  3187. }
  3188. }
  3189. }
  3190. }
  3191. }
  3192. /*:333*/
  3193. #line 8211 "./typica.w"
  3194. }
  3195. else
  3196. {
  3197. /*330:*/
  3198. #line 8223 "./typica.w"
  3199. MeasurementModel*m;
  3200. foreach(m,modelSet)
  3201. {
  3202. m->newMeasurement(measure,tempcolumn);
  3203. }
  3204. /*:330*/
  3205. #line 8215 "./typica.w"
  3206. }
  3207. lastMeasurement[tempcolumn]= measure;
  3208. }
  3209. /*:329*//*332:*/
  3210. #line 8272 "./typica.w"
  3211. void ZoomLog::addToCurrentColumnSet(int column)
  3212. {
  3213. currentColumnSet.append(column);
  3214. }
  3215. void ZoomLog::clearCurrentColumnSet()
  3216. {
  3217. currentColumnSet.clear();
  3218. }
  3219. /*:332*//*334:*/
  3220. #line 8355 "./typica.w"
  3221. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3222. int annotationcolumn)
  3223. {
  3224. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3225. MeasurementModel*m;
  3226. if(lastMeasurement.contains(tempcolumn))
  3227. {
  3228. foreach(m,modelSet)
  3229. {
  3230. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3231. }
  3232. }
  3233. foreach(m,modelSet)
  3234. {
  3235. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3236. }
  3237. }
  3238. /*:334*//*335:*/
  3239. #line 8379 "./typica.w"
  3240. void ZoomLog::centerOn(int row)
  3241. {
  3242. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  3243. }
  3244. /*:335*//*336:*/
  3245. #line 8389 "./typica.w"
  3246. void ZoomLog::clear()
  3247. {
  3248. MeasurementModel*m;
  3249. foreach(m,modelSet)
  3250. {
  3251. m->clear();
  3252. }
  3253. lastMeasurement.clear();
  3254. saveTempCols.clear();
  3255. saveNoteCols.clear();
  3256. }
  3257. /*:336*//*337:*/
  3258. #line 8406 "./typica.w"
  3259. QVariant ZoomLog::data(int row,int column)const
  3260. {
  3261. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  3262. Qt::DisplayRole);
  3263. }
  3264. int ZoomLog::rowCount()
  3265. {
  3266. return model_ms->rowCount();
  3267. }
  3268. /*:337*//*338:*/
  3269. #line 8429 "./typica.w"
  3270. bool ZoomLog::saveXML(QIODevice*device)
  3271. {
  3272. int prevUnits= model_ms->displayUnits();
  3273. if(prevUnits!=10144)
  3274. {
  3275. model_ms->setDisplayUnits(10144);
  3276. }
  3277. XMLOutput writer(model_ms,device,0);
  3278. int c;
  3279. foreach(c,saveTempCols)
  3280. {
  3281. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3282. toString(),c);
  3283. }
  3284. foreach(c,saveNoteCols)
  3285. {
  3286. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3287. toString(),c);
  3288. }
  3289. bool retval= writer.output();
  3290. if(prevUnits!=10144)
  3291. {
  3292. model_ms->setDisplayUnits(prevUnits);
  3293. }
  3294. return retval;
  3295. }
  3296. /*:338*//*339:*/
  3297. #line 8460 "./typica.w"
  3298. bool ZoomLog::saveCSV(QIODevice*device)
  3299. {
  3300. CSVOutput writer(currentModel,device,0);
  3301. int c;
  3302. foreach(c,saveTempCols)
  3303. {
  3304. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3305. toString(),c);
  3306. }
  3307. foreach(c,saveNoteCols)
  3308. {
  3309. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3310. toString(),c);
  3311. }
  3312. return writer.output();
  3313. }
  3314. /*:339*//*340:*/
  3315. #line 8484 "./typica.w"
  3316. void ZoomLog::switchLOD(MeasurementModel*m)
  3317. {
  3318. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  3319. setModel(m);
  3320. currentModel= m;
  3321. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3322. }
  3323. void ZoomLog::LOD_ms()
  3324. {
  3325. switchLOD(model_ms);
  3326. }
  3327. void ZoomLog::LOD_1s()
  3328. {
  3329. switchLOD(model_1s);
  3330. }
  3331. void ZoomLog::LOD_5s()
  3332. {
  3333. switchLOD(model_5s);
  3334. }
  3335. void ZoomLog::LOD_10s()
  3336. {
  3337. switchLOD(model_10s);
  3338. }
  3339. void ZoomLog::LOD_15s()
  3340. {
  3341. switchLOD(model_15s);
  3342. }
  3343. void ZoomLog::LOD_30s()
  3344. {
  3345. switchLOD(model_30s);
  3346. }
  3347. void ZoomLog::LOD_1m()
  3348. {
  3349. switchLOD(model_1m);
  3350. }
  3351. /*:340*//*341:*/
  3352. #line 8532 "./typica.w"
  3353. void ZoomLog::setDisplayUnits(int scale)
  3354. {
  3355. model_ms->setDisplayUnits(scale);
  3356. model_1s->setDisplayUnits(scale);
  3357. model_5s->setDisplayUnits(scale);
  3358. model_10s->setDisplayUnits(scale);
  3359. model_15s->setDisplayUnits(scale);
  3360. model_30s->setDisplayUnits(scale);
  3361. model_1m->setDisplayUnits(scale);
  3362. }
  3363. int ZoomLog::displayUnits()
  3364. {
  3365. return model_ms->displayUnits();
  3366. }
  3367. /*:341*//*342:*/
  3368. #line 8552 "./typica.w"
  3369. QString ZoomLog::lastTime(int series)
  3370. {
  3371. Measurement measure= lastMeasurement.value(series);
  3372. QTime time= measure.time();
  3373. return time.toString("h:mm:ss.zzz");
  3374. }
  3375. /*:342*//*343:*/
  3376. #line 8562 "./typica.w"
  3377. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  3378. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  3379. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  3380. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  3381. {
  3382. setEditTriggers(QAbstractItemView::NoEditTriggers);
  3383. setSelectionMode(QAbstractItemView::NoSelection);
  3384. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  3385. model_30s<<model_1m;
  3386. currentModel= model_30s;
  3387. setModel(currentModel);
  3388. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3389. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  3390. this,SLOT(persistColumnResize(int,int,int)));
  3391. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  3392. this,SLOT(restoreColumnWidths()));
  3393. }
  3394. /*:343*//*344:*/
  3395. #line 8585 "./typica.w"
  3396. void ZoomLog::setHeaderData(int section,QString text)
  3397. {
  3398. MeasurementModel*m;
  3399. foreach(m,modelSet)
  3400. {
  3401. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  3402. }
  3403. }
  3404. /*:344*//*345:*/
  3405. #line 8599 "./typica.w"
  3406. void ZoomLog::addOutputTemperatureColumn(int column)
  3407. {
  3408. saveTempCols.append(column);
  3409. }
  3410. void ZoomLog::addOutputAnnotationColumn(int column)
  3411. {
  3412. saveNoteCols.append(column);
  3413. }
  3414. void ZoomLog::clearOutputColumns()
  3415. {
  3416. saveTempCols.clear();
  3417. saveNoteCols.clear();
  3418. }
  3419. /*:345*//*346:*/
  3420. #line 8619 "./typica.w"
  3421. void ZoomLog::persistColumnResize(int column,int,int newsize)
  3422. {
  3423. /*536:*/
  3424. #line 12597 "./typica.w"
  3425. QSettings settings;
  3426. /*537:*/
  3427. #line 12610 "./typica.w"
  3428. QWidget*topLevelWidget= this;
  3429. while(topLevelWidget->parentWidget())
  3430. {
  3431. topLevelWidget= topLevelWidget->parentWidget();
  3432. }
  3433. /*:537*/
  3434. #line 12599 "./typica.w"
  3435. settings.setValue(QString("columnWidths/%1/%2/%3").
  3436. arg(topLevelWidget->objectName()).
  3437. arg(objectName()).arg(column),
  3438. QVariant(newsize));
  3439. /*:536*/
  3440. #line 8622 "./typica.w"
  3441. }
  3442. void ZoomLog::restoreColumnWidths()
  3443. {
  3444. /*539:*/
  3445. #line 12630 "./typica.w"
  3446. QSettings settings;
  3447. /*537:*/
  3448. #line 12610 "./typica.w"
  3449. QWidget*topLevelWidget= this;
  3450. while(topLevelWidget->parentWidget())
  3451. {
  3452. topLevelWidget= topLevelWidget->parentWidget();
  3453. }
  3454. /*:537*/
  3455. #line 12632 "./typica.w"
  3456. QString baseKey=
  3457. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3458. arg(objectName());
  3459. for(int i= 0;i<model()->columnCount();i++)
  3460. {
  3461. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3462. if(settings.contains(key))
  3463. {
  3464. setColumnWidth(i,settings.value(key).toInt());
  3465. }
  3466. }
  3467. /*:539*/
  3468. #line 8627 "./typica.w"
  3469. }
  3470. void ZoomLog::setVisible(bool visibility)
  3471. {
  3472. QTableView::setVisible(visibility);
  3473. }
  3474. void ZoomLog::showEvent(QShowEvent*)
  3475. {
  3476. /*539:*/
  3477. #line 12630 "./typica.w"
  3478. QSettings settings;
  3479. /*537:*/
  3480. #line 12610 "./typica.w"
  3481. QWidget*topLevelWidget= this;
  3482. while(topLevelWidget->parentWidget())
  3483. {
  3484. topLevelWidget= topLevelWidget->parentWidget();
  3485. }
  3486. /*:537*/
  3487. #line 12632 "./typica.w"
  3488. QString baseKey=
  3489. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3490. arg(objectName());
  3491. for(int i= 0;i<model()->columnCount();i++)
  3492. {
  3493. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3494. if(settings.contains(key))
  3495. {
  3496. setColumnWidth(i,settings.value(key).toInt());
  3497. }
  3498. }
  3499. /*:539*/
  3500. #line 8637 "./typica.w"
  3501. }
  3502. /*:346*/
  3503. #line 781 "./typica.w"
  3504. /*354:*/
  3505. #line 8859 "./typica.w"
  3506. bool MeasurementList::operator<(const MeasurementList&other)const
  3507. {
  3508. return this->first().toTime()<other.first().toTime();
  3509. }
  3510. bool MeasurementList::operator==(const MeasurementList&other)const
  3511. {
  3512. return this->first().toTime()==other.first().toTime();
  3513. }
  3514. /*:354*//*355:*/
  3515. #line 8875 "./typica.w"
  3516. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  3517. {
  3518. return QModelIndex();
  3519. }
  3520. /*:355*//*356:*/
  3521. #line 8885 "./typica.w"
  3522. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  3523. {
  3524. MeasurementList*temp;
  3525. temp= new MeasurementList;
  3526. temp->append(QVariant(measure.time()));
  3527. /*357:*/
  3528. #line 8936 "./typica.w"
  3529. /*358:*/
  3530. #line 8981 "./typica.w"
  3531. QList<MeasurementList*> ::iterator i= lastInsertion;
  3532. bool quickscan= false;
  3533. if(entries->size()> 5)
  3534. {
  3535. if(**i<*temp)
  3536. {
  3537. i+= 1;
  3538. for(int j= 10;j> 0;j--)
  3539. {
  3540. if(i!=entries->end())
  3541. {
  3542. if(**i<*temp)
  3543. {
  3544. i+= 1;
  3545. }
  3546. else
  3547. {
  3548. quickscan= true;
  3549. break;
  3550. }
  3551. }
  3552. else
  3553. {
  3554. quickscan= true;
  3555. break;
  3556. }
  3557. }
  3558. }
  3559. else
  3560. {
  3561. if(**i==*temp)
  3562. {
  3563. quickscan= true;
  3564. }
  3565. }
  3566. }
  3567. /*:358*/
  3568. #line 8937 "./typica.w"
  3569. if(quickscan==false)
  3570. {
  3571. i= entries->begin();
  3572. QList<MeasurementList*> ::iterator u= entries->end();
  3573. QList<MeasurementList*> ::iterator midpoint;
  3574. int n= u-i;
  3575. int rA;
  3576. while(n> 0)
  3577. {
  3578. rA= n>>1;
  3579. midpoint= i+rA;
  3580. if(**midpoint<*temp)
  3581. {
  3582. i= midpoint+1;
  3583. n-= rA+1;
  3584. }
  3585. else
  3586. {
  3587. n= rA;
  3588. }
  3589. }
  3590. }
  3591. /*:357*/
  3592. #line 8891 "./typica.w"
  3593. MeasurementList*newEntry;
  3594. int insertion;
  3595. if(i!=entries->end())
  3596. {
  3597. insertion= entries->indexOf(*i);
  3598. if((*i)->first().toTime()==measure.time())
  3599. {
  3600. /*359:*/
  3601. #line 9023 "./typica.w"
  3602. if((*i)->size()<tempcolumn+1)
  3603. {
  3604. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  3605. {
  3606. (*i)->append(QVariant());
  3607. }
  3608. }
  3609. (*i)->replace(tempcolumn,measure.temperature());
  3610. lastInsertion= i;
  3611. emit dataChanged(createIndex(insertion,tempcolumn),
  3612. createIndex(insertion,tempcolumn));
  3613. lastTemperature->insert(tempcolumn,insertion);
  3614. /*:359*/
  3615. #line 8899 "./typica.w"
  3616. }
  3617. else
  3618. {
  3619. /*360:*/
  3620. #line 9041 "./typica.w"
  3621. beginInsertRows(QModelIndex(),insertion,insertion);
  3622. newEntry= new MeasurementList;
  3623. newEntry->append(QVariant(measure.time()));
  3624. for(int j= 0;j<tempcolumn+1;j++)
  3625. {
  3626. newEntry->append(QVariant());
  3627. }
  3628. newEntry->replace(tempcolumn,measure.temperature());
  3629. lastInsertion= entries->insert(i,newEntry);
  3630. endInsertRows();
  3631. lastTemperature->insert(tempcolumn,insertion);
  3632. /*:360*/
  3633. #line 8903 "./typica.w"
  3634. }
  3635. }
  3636. else
  3637. {
  3638. /*361:*/
  3639. #line 9059 "./typica.w"
  3640. insertion= entries->size();
  3641. /*360:*/
  3642. #line 9041 "./typica.w"
  3643. beginInsertRows(QModelIndex(),insertion,insertion);
  3644. newEntry= new MeasurementList;
  3645. newEntry->append(QVariant(measure.time()));
  3646. for(int j= 0;j<tempcolumn+1;j++)
  3647. {
  3648. newEntry->append(QVariant());
  3649. }
  3650. newEntry->replace(tempcolumn,measure.temperature());
  3651. lastInsertion= entries->insert(i,newEntry);
  3652. endInsertRows();
  3653. lastTemperature->insert(tempcolumn,insertion);
  3654. /*:360*/
  3655. #line 9061 "./typica.w"
  3656. /*:361*/
  3657. #line 8908 "./typica.w"
  3658. }
  3659. if(tempcolumn>=colcount)
  3660. {
  3661. colcount= tempcolumn+1;
  3662. }
  3663. emit rowChanged(insertion);
  3664. delete temp;
  3665. }
  3666. /*:356*//*362:*/
  3667. #line 9070 "./typica.w"
  3668. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  3669. int annotationColumn)
  3670. {
  3671. int r;
  3672. if(lastTemperature->contains(tempcolumn))
  3673. {
  3674. r= lastTemperature->value(tempcolumn);
  3675. }
  3676. else
  3677. {
  3678. r= 0;
  3679. }
  3680. if(r==0&&entries->size()==0)
  3681. {
  3682. /*363:*/
  3683. #line 9108 "./typica.w"
  3684. beginInsertRows(QModelIndex(),0,0);
  3685. MeasurementList*newEntry= new MeasurementList;
  3686. newEntry->append(QVariant(QTime(0,0,0,0)));
  3687. entries->append(newEntry);
  3688. endInsertRows();
  3689. /*:363*/
  3690. #line 9085 "./typica.w"
  3691. }
  3692. MeasurementList*row= entries->at(r);
  3693. if(row->size()<=annotationColumn)
  3694. {
  3695. for(int i= row->size()-1;i<annotationColumn+1;i++)
  3696. {
  3697. row->append(QVariant());
  3698. }
  3699. }
  3700. row->replace(annotationColumn,annotation);
  3701. emit dataChanged(createIndex(r,annotationColumn),
  3702. createIndex(r,annotationColumn));
  3703. emit rowChanged(r);
  3704. if(annotationColumn> colcount-1)
  3705. {
  3706. colcount= annotationColumn+1;
  3707. }
  3708. }
  3709. /*:362*//*364:*/
  3710. #line 9119 "./typica.w"
  3711. void MeasurementModel::clear()
  3712. {
  3713. beginRemoveRows(QModelIndex(),0,entries->size());
  3714. while(entries->size()!=0)
  3715. {
  3716. MeasurementList*row= entries->takeFirst();
  3717. delete row;
  3718. }
  3719. endRemoveRows();
  3720. colcount= hData->size();
  3721. lastTemperature->clear();
  3722. reset();
  3723. }
  3724. /*:364*//*365:*/
  3725. #line 9145 "./typica.w"
  3726. bool MeasurementModel::setData(const QModelIndex&index,
  3727. const QVariant&value,int role)
  3728. {
  3729. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  3730. {
  3731. return false;
  3732. }
  3733. /*366:*/
  3734. #line 9177 "./typica.w"
  3735. bool valid= false;
  3736. if(index.isValid())
  3737. {
  3738. if(index.row()<entries->size())
  3739. {
  3740. if(index.column()<colcount)
  3741. {
  3742. valid= true;
  3743. }
  3744. }
  3745. }
  3746. /*:366*/
  3747. #line 9153 "./typica.w"
  3748. if(!valid)
  3749. {
  3750. return false;
  3751. }
  3752. MeasurementList*row= entries->at(index.row());
  3753. if(index.column()>=row->size())
  3754. {
  3755. /*367:*/
  3756. #line 9194 "./typica.w"
  3757. for(int i= row->size()-1;i<index.column();i++)
  3758. {
  3759. row->append(QVariant());
  3760. }
  3761. /*:367*/
  3762. #line 9161 "./typica.w"
  3763. }
  3764. if(index.column()==0)
  3765. {
  3766. /*368:*/
  3767. #line 9209 "./typica.w"
  3768. QTime time;
  3769. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  3770. {
  3771. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  3772. {
  3773. return false;
  3774. }
  3775. }
  3776. row= entries->takeAt(index.row());
  3777. row->replace(index.column(),QVariant(time));
  3778. MeasurementList*temp= row;
  3779. /*357:*/
  3780. #line 8936 "./typica.w"
  3781. /*358:*/
  3782. #line 8981 "./typica.w"
  3783. QList<MeasurementList*> ::iterator i= lastInsertion;
  3784. bool quickscan= false;
  3785. if(entries->size()> 5)
  3786. {
  3787. if(**i<*temp)
  3788. {
  3789. i+= 1;
  3790. for(int j= 10;j> 0;j--)
  3791. {
  3792. if(i!=entries->end())
  3793. {
  3794. if(**i<*temp)
  3795. {
  3796. i+= 1;
  3797. }
  3798. else
  3799. {
  3800. quickscan= true;
  3801. break;
  3802. }
  3803. }
  3804. else
  3805. {
  3806. quickscan= true;
  3807. break;
  3808. }
  3809. }
  3810. }
  3811. else
  3812. {
  3813. if(**i==*temp)
  3814. {
  3815. quickscan= true;
  3816. }
  3817. }
  3818. }
  3819. /*:358*/
  3820. #line 8937 "./typica.w"
  3821. if(quickscan==false)
  3822. {
  3823. i= entries->begin();
  3824. QList<MeasurementList*> ::iterator u= entries->end();
  3825. QList<MeasurementList*> ::iterator midpoint;
  3826. int n= u-i;
  3827. int rA;
  3828. while(n> 0)
  3829. {
  3830. rA= n>>1;
  3831. midpoint= i+rA;
  3832. if(**midpoint<*temp)
  3833. {
  3834. i= midpoint+1;
  3835. n-= rA+1;
  3836. }
  3837. else
  3838. {
  3839. n= rA;
  3840. }
  3841. }
  3842. }
  3843. /*:357*/
  3844. #line 9221 "./typica.w"
  3845. entries->insert(i,row);
  3846. int newRow= entries->indexOf(*i);
  3847. if(newRow<index.row())
  3848. {
  3849. emit dataChanged(createIndex(newRow,index.column()),index);
  3850. }
  3851. else
  3852. {
  3853. emit dataChanged(index,createIndex(newRow,index.column()));
  3854. }
  3855. /*:368*/
  3856. #line 9165 "./typica.w"
  3857. }
  3858. else
  3859. {
  3860. /*369:*/
  3861. #line 9235 "./typica.w"
  3862. row->replace(index.column(),value);
  3863. emit dataChanged(index,index);
  3864. /*:369*/
  3865. #line 9169 "./typica.w"
  3866. }
  3867. return true;
  3868. }
  3869. /*:365*//*370:*/
  3870. #line 9243 "./typica.w"
  3871. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  3872. unit(Fahrenheit),hData(new QStringList),
  3873. lastTemperature(new QHash<int,int> )
  3874. {
  3875. colcount= 1;
  3876. entries= new QList<MeasurementList*> ;
  3877. lastInsertion= entries->begin();
  3878. hData->append(tr("Time"));
  3879. }
  3880. /*:370*//*371:*/
  3881. #line 9256 "./typica.w"
  3882. MeasurementModel::~MeasurementModel()
  3883. {
  3884. clear();
  3885. delete entries;
  3886. delete hData;
  3887. }
  3888. /*:371*//*372:*/
  3889. #line 9268 "./typica.w"
  3890. int MeasurementModel::rowCount(const QModelIndex&parent)const
  3891. {
  3892. if(parent==QModelIndex())
  3893. {
  3894. return entries->size();
  3895. }
  3896. return 0;
  3897. }
  3898. int MeasurementModel::columnCount(const QModelIndex&parent)const
  3899. {
  3900. if(parent==QModelIndex())
  3901. {
  3902. return colcount;
  3903. }
  3904. return 0;
  3905. }
  3906. /*:372*//*373:*/
  3907. #line 9295 "./typica.w"
  3908. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  3909. const QVariant&value,int)
  3910. {
  3911. if(orientation==Qt::Horizontal)
  3912. {
  3913. if(hData->size()<section+1)
  3914. {
  3915. for(int i= hData->size();i<section+1;i++)
  3916. {
  3917. if(colcount<i)
  3918. {
  3919. beginInsertColumns(QModelIndex(),i,i);
  3920. }
  3921. hData->append(QString());
  3922. if(colcount<i)
  3923. {
  3924. endInsertColumns();
  3925. }
  3926. }
  3927. }
  3928. hData->replace(section,value.toString());
  3929. emit headerDataChanged(orientation,section,section);
  3930. if(colcount<section+1)
  3931. {
  3932. colcount= section+1;
  3933. }
  3934. return true;
  3935. }
  3936. return false;
  3937. }
  3938. /*:373*//*374:*/
  3939. #line 9335 "./typica.w"
  3940. void MeasurementModel::setDisplayUnits(int scale)
  3941. {
  3942. beginResetModel();
  3943. unit= scale;
  3944. endResetModel();
  3945. }
  3946. int MeasurementModel::displayUnits()
  3947. {
  3948. return unit;
  3949. }
  3950. /*:374*//*375:*/
  3951. #line 9359 "./typica.w"
  3952. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  3953. {
  3954. /*366:*/
  3955. #line 9177 "./typica.w"
  3956. bool valid= false;
  3957. if(index.isValid())
  3958. {
  3959. if(index.row()<entries->size())
  3960. {
  3961. if(index.column()<colcount)
  3962. {
  3963. valid= true;
  3964. }
  3965. }
  3966. }
  3967. /*:366*/
  3968. #line 9362 "./typica.w"
  3969. if(!valid)
  3970. {
  3971. return QVariant();
  3972. }
  3973. if(role==Qt::DisplayRole||role==Qt::EditRole)
  3974. {
  3975. MeasurementList*row= entries->at(index.row());
  3976. if(index.column()> row->size())
  3977. {
  3978. return QVariant();
  3979. }
  3980. else
  3981. {
  3982. if(index.column()==0)
  3983. {
  3984. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  3985. }
  3986. else if(lastTemperature->contains(index.column()))
  3987. {
  3988. if(row->at(index.column()).toString().isEmpty())
  3989. {
  3990. return QVariant();
  3991. }
  3992. switch(unit)
  3993. {
  3994. case Auto:
  3995. case Fahrenheit:
  3996. return QVariant(row->at(index.column()).toString());
  3997. break;
  3998. case Celsius:
  3999. return QVariant((row->at(index.column()).toDouble()-
  4000. 32)*5/9);
  4001. break;
  4002. case Kelvin:
  4003. return QVariant((row->at(index.column()).toDouble()+
  4004. 459.67)*5/9);
  4005. break;
  4006. case Rankine:
  4007. return QVariant(row->at(index.column()).toDouble()+
  4008. 459.67);
  4009. break;
  4010. default:
  4011. break;
  4012. }
  4013. }
  4014. return QVariant(row->at(index.column()).toString());
  4015. }
  4016. }
  4017. return QVariant();
  4018. }
  4019. /*:375*//*376:*/
  4020. #line 9416 "./typica.w"
  4021. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4022. int role)const
  4023. {
  4024. if(orientation==Qt::Horizontal)
  4025. {
  4026. if(role==Qt::DisplayRole)
  4027. {
  4028. if(section<hData->size())
  4029. {
  4030. return QVariant(hData->at(section));
  4031. }
  4032. }
  4033. }
  4034. return QVariant();
  4035. }
  4036. /*:376*//*377:*/
  4037. #line 9443 "./typica.w"
  4038. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4039. {
  4040. /*366:*/
  4041. #line 9177 "./typica.w"
  4042. bool valid= false;
  4043. if(index.isValid())
  4044. {
  4045. if(index.row()<entries->size())
  4046. {
  4047. if(index.column()<colcount)
  4048. {
  4049. valid= true;
  4050. }
  4051. }
  4052. }
  4053. /*:366*/
  4054. #line 9446 "./typica.w"
  4055. if(valid)
  4056. {
  4057. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4058. }
  4059. return 0;
  4060. }
  4061. /*:377*//*378:*/
  4062. #line 9458 "./typica.w"
  4063. QModelIndex MeasurementModel::index(int row,int column,
  4064. const QModelIndex&parent)const
  4065. {
  4066. if(parent==QModelIndex())
  4067. {
  4068. if(row<entries->size()&&entries->isEmpty()==false)
  4069. {
  4070. if(column<entries->at(row)->size())
  4071. {
  4072. return createIndex(row,column);
  4073. }
  4074. }
  4075. }
  4076. return QModelIndex();
  4077. }
  4078. /*:378*/
  4079. #line 782 "./typica.w"
  4080. /*380:*/
  4081. #line 9509 "./typica.w"
  4082. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4083. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4084. {
  4085. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4086. }
  4087. /*:380*//*381:*/
  4088. #line 9524 "./typica.w"
  4089. void AnnotationButton::annotate()
  4090. {
  4091. if(note.contains("%1"))
  4092. {
  4093. count++;
  4094. emit annotation(note.arg(count),tc,ac);
  4095. }
  4096. else
  4097. {
  4098. emit annotation(note,tc,ac);
  4099. }
  4100. }
  4101. /*:381*//*382:*/
  4102. #line 9542 "./typica.w"
  4103. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4104. {
  4105. tc= tempcolumn;
  4106. }
  4107. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4108. {
  4109. ac= annotationcolumn;
  4110. }
  4111. void AnnotationButton::setAnnotation(const QString&annotation)
  4112. {
  4113. note= annotation;
  4114. }
  4115. /*:382*//*383:*/
  4116. #line 9561 "./typica.w"
  4117. void AnnotationButton::resetCount()
  4118. {
  4119. count= 0;
  4120. }
  4121. /*:383*/
  4122. #line 783 "./typica.w"
  4123. /*388:*/
  4124. #line 9644 "./typica.w"
  4125. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4126. const QString&postt,
  4127. QWidget*parent)
  4128. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4129. {
  4130. resetChange();
  4131. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4132. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4133. }
  4134. /*:388*//*389:*/
  4135. #line 9661 "./typica.w"
  4136. void AnnotationSpinBox::resetChange()
  4137. {
  4138. change= true;
  4139. }
  4140. /*:389*//*390:*/
  4141. #line 9672 "./typica.w"
  4142. void AnnotationSpinBox::annotate()
  4143. {
  4144. if(change)
  4145. {
  4146. change= false;
  4147. emit annotation(QString("%1%2%3").arg(pretext).
  4148. arg(value()).arg(posttext),tc,ac);
  4149. }
  4150. }
  4151. /*:390*//*391:*/
  4152. #line 9685 "./typica.w"
  4153. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4154. {
  4155. tc= tempcolumn;
  4156. }
  4157. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4158. {
  4159. ac= annotationcolumn;
  4160. }
  4161. void AnnotationSpinBox::setPretext(const QString&pret)
  4162. {
  4163. pretext= pret;
  4164. }
  4165. void AnnotationSpinBox::setPosttext(const QString&postt)
  4166. {
  4167. posttext= postt;
  4168. }
  4169. /*:391*/
  4170. #line 784 "./typica.w"
  4171. /*398:*/
  4172. #line 9853 "./typica.w"
  4173. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4174. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4175. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4176. stopAction(new QAction(tr("Stop"),NULL)),
  4177. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4178. relative(QTime::currentTime()),base(QTime(0,0,0))
  4179. {
  4180. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4181. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4182. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4183. clock.setInterval(500);
  4184. clock.setSingleShot(false);
  4185. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4186. setSegmentStyle(Filled);
  4187. updateDisplay();
  4188. }
  4189. /*:398*//*399:*/
  4190. #line 9874 "./typica.w"
  4191. void TimerDisplay::updateTime()
  4192. {
  4193. QTime time;
  4194. int cseconds= 0;
  4195. int oseconds= 0;
  4196. int r= 0;
  4197. QTime nt= QTime(0,0,0);
  4198. int n= 0;
  4199. int bseconds= 0;
  4200. switch(m)
  4201. {
  4202. case TimerDisplay::CountUp:
  4203. /*400:*/
  4204. #line 9906 "./typica.w"
  4205. /*401:*/
  4206. #line 9919 "./typica.w"
  4207. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4208. time= QTime::currentTime();
  4209. cseconds= TIMETOINT(time);
  4210. oseconds= TIMETOINT(relative);
  4211. r= cseconds-oseconds;
  4212. /*:401*/
  4213. #line 9907 "./typica.w"
  4214. nt= nt.addSecs(r);
  4215. if(nt!=s)
  4216. {
  4217. s= nt;
  4218. emit valueChanged(s);
  4219. }
  4220. /*:400*/
  4221. #line 9887 "./typica.w"
  4222. ;
  4223. break;
  4224. case TimerDisplay::CountDown:
  4225. /*402:*/
  4226. #line 9931 "./typica.w"
  4227. if(s> QTime(0,0,0))
  4228. {
  4229. /*401:*/
  4230. #line 9919 "./typica.w"
  4231. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4232. time= QTime::currentTime();
  4233. cseconds= TIMETOINT(time);
  4234. oseconds= TIMETOINT(relative);
  4235. r= cseconds-oseconds;
  4236. /*:401*/
  4237. #line 9934 "./typica.w"
  4238. bseconds= TIMETOINT(base);
  4239. n= bseconds-r;
  4240. nt= nt.addSecs(n);
  4241. if(nt!=s)
  4242. {
  4243. s= nt;
  4244. emit valueChanged(s);
  4245. }
  4246. }
  4247. /*:402*/
  4248. #line 9890 "./typica.w"
  4249. ;
  4250. break;
  4251. case TimerDisplay::Clock:
  4252. /*403:*/
  4253. #line 9948 "./typica.w"
  4254. time= QTime::currentTime();
  4255. if(time!=s)
  4256. {
  4257. s= time;
  4258. emit valueChanged(s);
  4259. }
  4260. /*:403*/
  4261. #line 9893 "./typica.w"
  4262. ;
  4263. break;
  4264. default:
  4265. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  4266. break;
  4267. }
  4268. updateDisplay();
  4269. }
  4270. /*:399*//*404:*/
  4271. #line 9960 "./typica.w"
  4272. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  4273. void TimerDisplay::startTimer()
  4274. {
  4275. if(!running)
  4276. {
  4277. relative= QTime::currentTime();
  4278. if(ar)
  4279. {
  4280. reset();
  4281. }
  4282. else
  4283. {
  4284. relative= TIMESUBTRACT(relative,s);
  4285. }
  4286. if(m==Clock)
  4287. {
  4288. updateTime();
  4289. }
  4290. base= s;
  4291. clock.start();
  4292. running= true;
  4293. emit runStateChanged(true);
  4294. }
  4295. }
  4296. /*:404*//*405:*/
  4297. #line 9990 "./typica.w"
  4298. void TimerDisplay::stopTimer()
  4299. {
  4300. if(running)
  4301. {
  4302. clock.stop();
  4303. running= false;
  4304. emit runStateChanged(false);
  4305. }
  4306. }
  4307. /*:405*//*406:*/
  4308. #line 10003 "./typica.w"
  4309. TimerDisplay::~TimerDisplay()
  4310. {
  4311. clock.stop();
  4312. }
  4313. /*:406*//*407:*/
  4314. #line 10012 "./typica.w"
  4315. void TimerDisplay::setCountUpMode()
  4316. {
  4317. m= TimerDisplay::CountUp;
  4318. }
  4319. void TimerDisplay::setCountDownMode()
  4320. {
  4321. m= TimerDisplay::CountDown;
  4322. }
  4323. void TimerDisplay::setClockMode()
  4324. {
  4325. m= TimerDisplay::Clock;
  4326. }
  4327. /*:407*//*408:*/
  4328. #line 10030 "./typica.w"
  4329. QString TimerDisplay::value()
  4330. {
  4331. return s.toString(f);
  4332. }
  4333. QTime TimerDisplay::seconds()
  4334. {
  4335. return s;
  4336. }
  4337. TimerDisplay::TimerMode TimerDisplay::mode()
  4338. {
  4339. return m;
  4340. }
  4341. bool TimerDisplay::isRunning()
  4342. {
  4343. return running;
  4344. }
  4345. QTime TimerDisplay::resetValue()
  4346. {
  4347. return r;
  4348. }
  4349. QString TimerDisplay::displayFormat()
  4350. {
  4351. return f;
  4352. }
  4353. bool TimerDisplay::autoReset()
  4354. {
  4355. return ar;
  4356. }
  4357. /*:408*//*409:*/
  4358. #line 10068 "./typica.w"
  4359. void TimerDisplay::setTimer(QTime value)
  4360. {
  4361. if(value.isValid())
  4362. {
  4363. s= value;
  4364. updateDisplay();
  4365. emit valueChanged(value);
  4366. }
  4367. }
  4368. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  4369. {
  4370. m= mode;
  4371. }
  4372. void TimerDisplay::setResetValue(QTime value)
  4373. {
  4374. r= value;
  4375. }
  4376. void TimerDisplay::setDisplayFormat(QString format)
  4377. {
  4378. f= format;
  4379. setNumDigits(format.length());
  4380. }
  4381. void TimerDisplay::setAutoReset(bool reset)
  4382. {
  4383. ar= reset;
  4384. }
  4385. /*:409*//*410:*/
  4386. #line 10103 "./typica.w"
  4387. void TimerDisplay::copyTimer()
  4388. {
  4389. QApplication::clipboard()->setText(value());
  4390. }
  4391. /*:410*//*411:*/
  4392. #line 10112 "./typica.w"
  4393. void TimerDisplay::reset()
  4394. {
  4395. if(!running)
  4396. {
  4397. s= r;
  4398. updateDisplay();
  4399. }
  4400. }
  4401. /*:411*//*412:*/
  4402. #line 10125 "./typica.w"
  4403. void TimerDisplay::updateDisplay()
  4404. {
  4405. display(value());
  4406. }
  4407. /*:412*/
  4408. #line 785 "./typica.w"
  4409. /*418:*/
  4410. #line 10219 "./typica.w"
  4411. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  4412. {
  4413. int x= rect.x();
  4414. int y= rect.y();
  4415. QLayoutItem*item;
  4416. if(orientation==Qt::Horizontal)
  4417. {
  4418. /*419:*/
  4419. #line 10243 "./typica.w"
  4420. foreach(item,itemList)
  4421. {
  4422. int nextX= x+item->sizeHint().width()+spacing();
  4423. int right= x+item->sizeHint().width();
  4424. if(item==itemList.last())
  4425. {
  4426. right= rect.right();
  4427. }
  4428. int bottom= rect.bottom();
  4429. if(!testOnly)
  4430. {
  4431. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4432. }
  4433. x= nextX;
  4434. }
  4435. /*:419*/
  4436. #line 10227 "./typica.w"
  4437. }
  4438. else
  4439. {
  4440. /*420:*/
  4441. #line 10262 "./typica.w"
  4442. foreach(item,itemList)
  4443. {
  4444. int nextY= y+item->sizeHint().height()+spacing();
  4445. int bottom= y+item->sizeHint().height();
  4446. if(item==itemList.last())
  4447. {
  4448. bottom= rect.bottom();
  4449. }
  4450. int right= rect.right();
  4451. if(!testOnly)
  4452. {
  4453. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4454. }
  4455. y= nextY;
  4456. }
  4457. /*:420*/
  4458. #line 10231 "./typica.w"
  4459. }
  4460. return y;
  4461. }
  4462. /*:418*//*421:*/
  4463. #line 10286 "./typica.w"
  4464. QSize PackLayout::minimumSize()const
  4465. {
  4466. QSize size;
  4467. QLayoutItem*item;
  4468. foreach(item,itemList)
  4469. {
  4470. if(orientation==Qt::Horizontal)
  4471. {
  4472. size+= QSize(item->minimumSize().width(),0);
  4473. if(size.height()<item->minimumSize().height())
  4474. {
  4475. size.setHeight(item->minimumSize().height());
  4476. }
  4477. }
  4478. else
  4479. {
  4480. size+= QSize(0,item->minimumSize().height());
  4481. if(size.width()<item->minimumSize().width())
  4482. {
  4483. size.setWidth(item->minimumSize().width());
  4484. }
  4485. }
  4486. }
  4487. size+= QSize(2*margin(),2*margin());
  4488. return size;
  4489. }
  4490. /*:421*//*422:*/
  4491. #line 10318 "./typica.w"
  4492. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  4493. QLayout(parent)
  4494. {
  4495. setMargin(margin);
  4496. setSpacing(spacing);
  4497. setOrientation(Qt::Horizontal);
  4498. }
  4499. PackLayout::PackLayout(int spacing)
  4500. {
  4501. setSpacing(spacing);
  4502. setOrientation(Qt::Horizontal);
  4503. }
  4504. /*:422*//*423:*/
  4505. #line 10336 "./typica.w"
  4506. PackLayout::~PackLayout()
  4507. {
  4508. QLayoutItem*item;
  4509. while((item= takeAt(0)))
  4510. {
  4511. delete item;
  4512. }
  4513. }
  4514. /*:423*//*424:*/
  4515. #line 10350 "./typica.w"
  4516. QLayoutItem*PackLayout::takeAt(int index)
  4517. {
  4518. if(index>=0&&index<itemList.size())
  4519. {
  4520. return itemList.takeAt(index);
  4521. }
  4522. else
  4523. {
  4524. return NULL;
  4525. }
  4526. }
  4527. /*:424*//*425:*/
  4528. #line 10366 "./typica.w"
  4529. QLayoutItem*PackLayout::itemAt(int index)const
  4530. {
  4531. if(index>=0&&index<itemList.size())
  4532. {
  4533. return itemList.at(index);
  4534. }
  4535. else
  4536. {
  4537. return NULL;
  4538. }
  4539. }
  4540. /*:425*//*426:*/
  4541. #line 10389 "./typica.w"
  4542. void PackLayout::addItem(QLayoutItem*item)
  4543. {
  4544. itemList.append(item);
  4545. }
  4546. /*:426*//*427:*/
  4547. #line 10397 "./typica.w"
  4548. int PackLayout::count()const
  4549. {
  4550. return itemList.size();
  4551. }
  4552. /*:427*//*428:*/
  4553. #line 10409 "./typica.w"
  4554. Qt::Orientations PackLayout::expandingDirections()const
  4555. {
  4556. return Qt::Vertical|Qt::Horizontal;
  4557. }
  4558. bool PackLayout::hasHeightForWidth()const
  4559. {
  4560. return false;
  4561. }
  4562. int PackLayout::heightForWidth(int width)const
  4563. {
  4564. return doLayout(QRect(0,0,width,0),true);
  4565. }
  4566. void PackLayout::setGeometry(const QRect&rect)
  4567. {
  4568. QLayout::setGeometry(rect);
  4569. doLayout(rect,false);
  4570. }
  4571. QSize PackLayout::sizeHint()const
  4572. {
  4573. return minimumSize();
  4574. }
  4575. /*:428*//*429:*/
  4576. #line 10440 "./typica.w"
  4577. void PackLayout::setOrientation(Qt::Orientations direction)
  4578. {
  4579. orientation= direction;
  4580. doLayout(geometry(),false);
  4581. }
  4582. /*:429*/
  4583. #line 786 "./typica.w"
  4584. /*431:*/
  4585. #line 10479 "./typica.w"
  4586. SceneButton::SceneButton():QGraphicsScene()
  4587. {
  4588. }
  4589. SceneButton::~SceneButton()
  4590. {
  4591. }
  4592. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  4593. {
  4594. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  4595. }
  4596. /*:431*/
  4597. #line 787 "./typica.w"
  4598. /*433:*/
  4599. #line 10525 "./typica.w"
  4600. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  4601. Qt::Orientations orientation,
  4602. QWidget*parent,Qt::WindowFlags f):
  4603. QWidget(parent,f),label(new QGraphicsView()),
  4604. scene(new SceneButton())
  4605. {
  4606. layout= new PackLayout(this);
  4607. layout->setOrientation(orientation);
  4608. /*434:*/
  4609. #line 10545 "./typica.w"
  4610. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4611. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4612. label->setFrameShape(QFrame::NoFrame);
  4613. label->setInteractive(true);
  4614. /*:434*/
  4615. #line 10534 "./typica.w"
  4616. /*435:*/
  4617. #line 10556 "./typica.w"
  4618. scene->setBackgroundBrush(Qt::cyan);
  4619. text= scene->addText(labeltext);
  4620. if(orientation==Qt::Horizontal)
  4621. {
  4622. text->rotate(270.0);
  4623. }
  4624. label->setScene(scene);
  4625. /*:435*/
  4626. #line 10535 "./typica.w"
  4627. /*436:*/
  4628. #line 10574 "./typica.w"
  4629. if(orientation==Qt::Horizontal)
  4630. {
  4631. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  4632. }
  4633. else
  4634. {
  4635. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  4636. }
  4637. label->centerOn(text);
  4638. /*:436*/
  4639. #line 10536 "./typica.w"
  4640. /*437:*/
  4641. #line 10589 "./typica.w"
  4642. layout->addWidget(label);
  4643. layout->addWidget(widget);
  4644. if(orientation==Qt::Horizontal)
  4645. {
  4646. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  4647. widget->sizeHint().height());
  4648. }
  4649. else
  4650. {
  4651. setMinimumSize(widget->sizeHint().width(),
  4652. widget->sizeHint().height()+label->sizeHint().height());
  4653. }
  4654. /*:437*/
  4655. #line 10537 "./typica.w"
  4656. }
  4657. /*:433*//*438:*/
  4658. #line 10606 "./typica.w"
  4659. void WidgetDecorator::setBackgroundBrush(QBrush background)
  4660. {
  4661. scene->setBackgroundBrush(background);
  4662. }
  4663. void WidgetDecorator::setTextColor(QColor color)
  4664. {
  4665. text->setDefaultTextColor(color);
  4666. }
  4667. /*:438*//*439:*/
  4668. #line 10619 "./typica.w"
  4669. WidgetDecorator::~WidgetDecorator()
  4670. {
  4671. }
  4672. /*:439*/
  4673. #line 788 "./typica.w"
  4674. /*444:*/
  4675. #line 10718 "./typica.w"
  4676. void LogEditWindow::addTheRows()
  4677. {
  4678. QTime s= startTime->time();
  4679. while(s<endTime->time())
  4680. {
  4681. model->newMeasurement(Measurement(0,s),1);
  4682. s= s.addSecs(interval->value());
  4683. }
  4684. model->newMeasurement(Measurement(0,endTime->time()),1);
  4685. }
  4686. /*:444*//*445:*/
  4687. #line 10732 "./typica.w"
  4688. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  4689. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  4690. addRowsLayout(new QHBoxLayout(NULL)),
  4691. startTimeLabel(new QLabel("Start Time")),
  4692. startTime(new QTimeEdit(QTime(0,0,0,0))),
  4693. endTimeLabel(new QLabel("End Time")),
  4694. endTime(new QTimeEdit(QTime(0,20,0,0))),
  4695. intervalLabel(new QLabel("Interval (seconds)")),
  4696. interval(new QSpinBox()),
  4697. addRows(new QPushButton("Add Rows")),
  4698. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  4699. saveCsv(new QAction(tr("Export CSV"),NULL)),
  4700. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  4701. model(new MeasurementModel()),
  4702. log(new QTableView())
  4703. {
  4704. /*446:*/
  4705. #line 10769 "./typica.w"
  4706. QSettings settings;
  4707. resize(settings.value("logSize",QSize(620,400)).toSize());
  4708. move(settings.value("logPos",QPoint(200,60)).toPoint());
  4709. /*:446*/
  4710. #line 10749 "./typica.w"
  4711. /*447:*/
  4712. #line 10782 "./typica.w"
  4713. mainLayout->setOrientation(Qt::Vertical);
  4714. addRowsLayout->addSpacing(10);
  4715. addRowsLayout->addWidget(startTimeLabel);
  4716. addRowsLayout->addWidget(startTime);
  4717. addRowsLayout->addSpacing(10);
  4718. startTime->setDisplayFormat("mm:ss");
  4719. addRowsLayout->addWidget(endTimeLabel);
  4720. addRowsLayout->addWidget(endTime);
  4721. addRowsLayout->addSpacing(10);
  4722. endTime->setDisplayFormat("mm:ss");
  4723. addRowsLayout->addWidget(intervalLabel);
  4724. addRowsLayout->addWidget(interval);
  4725. addRowsLayout->addSpacing(10);
  4726. interval->setRange(0,60);
  4727. interval->setValue(30);
  4728. addRowsLayout->addWidget(addRows);
  4729. addRowsLayout->addSpacing(10);
  4730. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  4731. /*:447*/
  4732. #line 10750 "./typica.w"
  4733. /*448:*/
  4734. #line 10805 "./typica.w"
  4735. model->setHeaderData(0,Qt::Horizontal,"Time");
  4736. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  4737. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  4738. model->clear();
  4739. /*:448*/
  4740. #line 10751 "./typica.w"
  4741. /*449:*/
  4742. #line 10814 "./typica.w"
  4743. log->setModel(model);
  4744. log->setColumnWidth(0,100);
  4745. log->setColumnWidth(1,100);
  4746. log->setColumnWidth(2,100);
  4747. /*:449*/
  4748. #line 10752 "./typica.w"
  4749. mainLayout->addItem(addRowsLayout);
  4750. mainLayout->addWidget(log);
  4751. centralWidget->setLayout(mainLayout);
  4752. setCentralWidget(centralWidget);
  4753. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  4754. fileMenu->addAction(openXml);
  4755. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  4756. fileMenu->addAction(saveXml);
  4757. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  4758. fileMenu->addAction(saveCsv);
  4759. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  4760. }
  4761. /*:445*//*450:*/
  4762. #line 10825 "./typica.w"
  4763. void LogEditWindow::saveXML()
  4764. {
  4765. QSettings settings;
  4766. QString lastDir= settings.value("lastDirectory").toString();
  4767. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  4768. lastDir,"",0);
  4769. QFile file(filename);
  4770. XMLOutput writer(model,&file,0);
  4771. writer.addTemperatureColumn("Temperature",1);
  4772. writer.addAnnotationColumn("Annotation",2);
  4773. if(writer.output())
  4774. {
  4775. QFileInfo info(filename);
  4776. QDir directory= info.dir();
  4777. lastDir= directory.path();
  4778. settings.setValue("lastDirectory",lastDir);
  4779. }
  4780. }
  4781. void LogEditWindow::saveCSV()
  4782. {
  4783. QSettings settings;
  4784. QString lastDir= settings.value("lastDirectory").toString();
  4785. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  4786. lastDir,"",0);
  4787. QFile file(filename);
  4788. CSVOutput writer(model,&file,0);
  4789. writer.addTemperatureColumn("Temperature",1);
  4790. writer.addAnnotationColumn("Annotation",2);
  4791. if(writer.output())
  4792. {
  4793. QFileInfo info(filename);
  4794. QDir directory= info.dir();
  4795. lastDir= directory.path();
  4796. settings.setValue("lastDirectory",lastDir);
  4797. }
  4798. }
  4799. /*:450*//*451:*/
  4800. #line 10868 "./typica.w"
  4801. void LogEditWindow::openXML()
  4802. {
  4803. QSettings settings;
  4804. QString lastDir= settings.value("lastDirectory").toString();
  4805. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  4806. lastDir,"",0);
  4807. if(filename.isNull())
  4808. {
  4809. return;
  4810. }
  4811. QFile file(filename);
  4812. XMLInput reader(&file,1);
  4813. connect(&reader,SIGNAL(measure(Measurement,int)),
  4814. model,SLOT(newMeasurement(Measurement,int)));
  4815. connect(&reader,SIGNAL(annotation(QString,int,int)),
  4816. model,SLOT(newAnnotation(QString,int,int)));
  4817. if(reader.input())
  4818. {
  4819. QFileInfo info(filename);
  4820. setWindowTitle(QString(tr("%1 - %2")).
  4821. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  4822. QDir directory= info.dir();
  4823. lastDir= directory.path();
  4824. settings.setValue("lastDirectory",lastDir);
  4825. }
  4826. }
  4827. /*:451*//*452:*/
  4828. #line 10899 "./typica.w"
  4829. void LogEditWindow::closeEvent(QCloseEvent*event)
  4830. {
  4831. QSettings settings;
  4832. settings.setValue("logSize",size());
  4833. settings.setValue("logPos",pos());
  4834. event->accept();
  4835. }
  4836. /*:452*/
  4837. #line 789 "./typica.w"
  4838. /*458:*/
  4839. #line 11012 "./typica.w"
  4840. bool XMLOutput::output()
  4841. {
  4842. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  4843. {
  4844. return false;
  4845. }
  4846. QXmlStreamWriter xmlout(out);
  4847. xmlout.writeStartDocument("1.0");
  4848. xmlout.writeDTD("<!DOCTYPE roastlog2.0>");
  4849. xmlout.writeStartElement("roastlog");
  4850. /*459:*/
  4851. #line 11045 "./typica.w"
  4852. foreach(int c,temperatureColumns.keys())
  4853. {
  4854. xmlout.writeStartElement("tempseries");
  4855. xmlout.writeAttribute("name",temperatureColumns.value(c));
  4856. xmlout.writeEndElement();
  4857. }
  4858. foreach(int c,annotationColumns.keys())
  4859. {
  4860. xmlout.writeStartElement("noteseries");
  4861. xmlout.writeAttribute("name",annotationColumns.value(c));
  4862. xmlout.writeEndElement();
  4863. }
  4864. /*:459*/
  4865. #line 11023 "./typica.w"
  4866. xmlout.writeStartElement("roast");
  4867. bool oresult;
  4868. for(int i= 0;i<data->rowCount();i++)
  4869. {
  4870. /*460:*/
  4871. #line 11064 "./typica.w"
  4872. oresult= false;
  4873. foreach(int c,temperatureColumns.keys())
  4874. {
  4875. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4876. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4877. {
  4878. oresult= true;
  4879. break;
  4880. }
  4881. }
  4882. if(oresult==false)
  4883. {
  4884. foreach(int c,annotationColumns.keys())
  4885. {
  4886. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4887. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  4888. isEmpty()))
  4889. {
  4890. oresult= true;
  4891. break;
  4892. }
  4893. }
  4894. }
  4895. /*:460*/
  4896. #line 11028 "./typica.w"
  4897. if(oresult)
  4898. {
  4899. /*461:*/
  4900. #line 11094 "./typica.w"
  4901. xmlout.writeStartElement("tuple");
  4902. xmlout.writeTextElement("time",data->data(data->index(i,time),
  4903. Qt::DisplayRole).toString());
  4904. foreach(int c,temperatureColumns.keys())
  4905. {
  4906. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4907. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4908. {
  4909. xmlout.writeStartElement("temperature");
  4910. xmlout.writeAttribute("series",temperatureColumns.value(c));
  4911. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4912. toString());
  4913. xmlout.writeEndElement();
  4914. }
  4915. }
  4916. foreach(int c,annotationColumns.keys())
  4917. {
  4918. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4919. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4920. {
  4921. xmlout.writeStartElement("annotation");
  4922. xmlout.writeAttribute("series",annotationColumns.value(c));
  4923. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4924. toString());
  4925. xmlout.writeEndElement();
  4926. }
  4927. }
  4928. xmlout.writeEndElement();
  4929. /*:461*/
  4930. #line 11031 "./typica.w"
  4931. }
  4932. }
  4933. xmlout.writeEndElement();
  4934. xmlout.writeEndElement();
  4935. xmlout.writeEndDocument();
  4936. out->close();
  4937. return true;
  4938. }
  4939. /*:458*//*462:*/
  4940. #line 11126 "./typica.w"
  4941. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  4942. :QObject(NULL),data(model),out(device),time(timec)
  4943. {
  4944. }
  4945. void XMLOutput::setModel(MeasurementModel*model)
  4946. {
  4947. data= model;
  4948. }
  4949. void XMLOutput::setTimeColumn(int column)
  4950. {
  4951. time= column;
  4952. }
  4953. void XMLOutput::setDevice(QIODevice*device)
  4954. {
  4955. out= device;
  4956. }
  4957. /*:462*//*463:*/
  4958. #line 11155 "./typica.w"
  4959. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  4960. {
  4961. temperatureColumns.insert(column,series);
  4962. }
  4963. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  4964. {
  4965. annotationColumns.insert(column,series);
  4966. }
  4967. /*:463*/
  4968. #line 790 "./typica.w"
  4969. /*465:*/
  4970. #line 11207 "./typica.w"
  4971. bool XMLInput::input()
  4972. {
  4973. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  4974. {
  4975. return false;
  4976. }
  4977. QXmlStreamReader xmlin(in);
  4978. QMap<QString,int> temperatureColumns;
  4979. QMap<QString,int> annotationColumns;
  4980. int nextColumn= firstc;
  4981. /*466:*/
  4982. #line 11238 "./typica.w"
  4983. while(!xmlin.isDTD())
  4984. {
  4985. xmlin.readNext();
  4986. }
  4987. if(xmlin.isDTD())
  4988. {
  4989. if(xmlin.text()=="<!DOCTYPE roastlog>")
  4990. {
  4991. /*467:*/
  4992. #line 11260 "./typica.w"
  4993. emit newTemperatureColumn(firstc,"Bean");
  4994. emit newAnnotationColumn(firstc+1,"Note");
  4995. emit lastColumn(firstc+1);
  4996. /*:467*/
  4997. #line 11247 "./typica.w"
  4998. }
  4999. else
  5000. {
  5001. xmlin.readNext();
  5002. /*468:*/
  5003. #line 11269 "./typica.w"
  5004. while(xmlin.name()!="roast")
  5005. {
  5006. if(xmlin.isStartElement())
  5007. {
  5008. if(xmlin.name()=="tempseries")
  5009. {
  5010. temperatureColumns.insert(xmlin.attributes().value("name").
  5011. toString(),
  5012. nextColumn);
  5013. emit newTemperatureColumn(nextColumn,
  5014. xmlin.attributes().value("name").
  5015. toString());
  5016. nextColumn++;
  5017. }
  5018. else if(xmlin.name()=="noteseries")
  5019. {
  5020. annotationColumns.insert(xmlin.attributes().value("name").
  5021. toString(),nextColumn);
  5022. emit newAnnotationColumn(nextColumn,
  5023. xmlin.attributes().value("name").
  5024. toString());
  5025. nextColumn++;
  5026. }
  5027. }
  5028. xmlin.readNext();
  5029. }
  5030. emit lastColumn(nextColumn-1);
  5031. /*:468*/
  5032. #line 11252 "./typica.w"
  5033. }
  5034. }
  5035. /*:466*/
  5036. #line 11218 "./typica.w"
  5037. QTime timeval= QTime();
  5038. double tempval= 0;
  5039. QString noteval= QString();
  5040. int column;
  5041. int counter= 0;
  5042. while(!xmlin.atEnd())
  5043. {
  5044. /*469:*/
  5045. #line 11310 "./typica.w"
  5046. xmlin.readNext();
  5047. if(xmlin.isStartElement())
  5048. {
  5049. /*470:*/
  5050. #line 11336 "./typica.w"
  5051. if(xmlin.name()=="time")
  5052. {
  5053. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5054. }
  5055. else if(xmlin.name()=="temperature")
  5056. {
  5057. column= xmlin.attributes().value("series").toString().isEmpty()?
  5058. firstc:temperatureColumns.value(xmlin.attributes().
  5059. value("series").toString());
  5060. tempval= xmlin.readElementText().toDouble();
  5061. Measurement measurement(tempval,timeval);
  5062. emit measure(measurement,column);
  5063. }
  5064. else if(xmlin.name()=="annotation")
  5065. {
  5066. column= xmlin.attributes().value("series").toString().isEmpty()?
  5067. firstc+1:annotationColumns.value(xmlin.attributes().
  5068. value("series").toString());
  5069. noteval= xmlin.readElementText();
  5070. if(!noteval.isEmpty())
  5071. {
  5072. emit annotation(noteval,firstc,column);
  5073. }
  5074. }
  5075. /*:470*/
  5076. #line 11314 "./typica.w"
  5077. }
  5078. counter++;
  5079. if(counter%100==0)
  5080. {
  5081. QCoreApplication::processEvents();
  5082. }
  5083. /*:469*/
  5084. #line 11226 "./typica.w"
  5085. }
  5086. return true;
  5087. }
  5088. /*:465*//*471:*/
  5089. #line 11364 "./typica.w"
  5090. XMLInput::XMLInput(QIODevice*input,int c):
  5091. firstc(c),in(input)
  5092. {
  5093. }
  5094. void XMLInput::setFirstColumn(int column)
  5095. {
  5096. firstc= column;
  5097. }
  5098. void XMLInput::setDevice(QIODevice*device)
  5099. {
  5100. in= device;
  5101. }
  5102. /*:471*/
  5103. #line 791 "./typica.w"
  5104. /*476:*/
  5105. #line 11453 "./typica.w"
  5106. bool CSVOutput::output()
  5107. {
  5108. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5109. {
  5110. return false;
  5111. }
  5112. QTextStream output(out);
  5113. /*477:*/
  5114. #line 11477 "./typica.w"
  5115. output<<"Time";
  5116. foreach(int c,temperatureColumns.keys())
  5117. {
  5118. output<<','<<temperatureColumns.value(c);
  5119. }
  5120. foreach(int c,annotationColumns.keys())
  5121. {
  5122. output<<','<<annotationColumns.value(c);
  5123. }
  5124. output<<'\n';
  5125. /*:477*/
  5126. #line 11461 "./typica.w"
  5127. bool oresult;
  5128. for(int i= 0;i<data->rowCount();i++)
  5129. {
  5130. /*460:*/
  5131. #line 11064 "./typica.w"
  5132. oresult= false;
  5133. foreach(int c,temperatureColumns.keys())
  5134. {
  5135. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5136. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5137. {
  5138. oresult= true;
  5139. break;
  5140. }
  5141. }
  5142. if(oresult==false)
  5143. {
  5144. foreach(int c,annotationColumns.keys())
  5145. {
  5146. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5147. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5148. isEmpty()))
  5149. {
  5150. oresult= true;
  5151. break;
  5152. }
  5153. }
  5154. }
  5155. /*:460*/
  5156. #line 11465 "./typica.w"
  5157. if(oresult)
  5158. {
  5159. /*478:*/
  5160. #line 11498 "./typica.w"
  5161. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  5162. foreach(int c,temperatureColumns.keys())
  5163. {
  5164. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5165. }
  5166. foreach(int c,annotationColumns.keys())
  5167. {
  5168. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5169. }
  5170. output<<'\n';
  5171. /*:478*/
  5172. #line 11468 "./typica.w"
  5173. }
  5174. }
  5175. out->close();
  5176. return true;
  5177. }
  5178. /*:476*//*479:*/
  5179. #line 11513 "./typica.w"
  5180. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  5181. data(model),out(device),time(timec)
  5182. {
  5183. }
  5184. void CSVOutput::setModel(MeasurementModel*model)
  5185. {
  5186. data= model;
  5187. }
  5188. void CSVOutput::setTimeColumn(int column)
  5189. {
  5190. time= column;
  5191. }
  5192. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  5193. {
  5194. temperatureColumns.insert(column,series);
  5195. }
  5196. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  5197. {
  5198. annotationColumns.insert(column,series);
  5199. }
  5200. void CSVOutput::setDevice(QIODevice*device)
  5201. {
  5202. out= device;
  5203. }
  5204. /*:479*/
  5205. #line 792 "./typica.w"
  5206. /*498:*/
  5207. #line 11895 "./typica.w"
  5208. QString SaltModel::arrayLiteral(int column,int role)const
  5209. {
  5210. QString literal= "'{";
  5211. for(int i= 0;i<rowCount();i++)
  5212. {
  5213. QString datum= data(index(i,column),role).toString();
  5214. if(!datum.isEmpty())
  5215. {
  5216. literal.append(datum);
  5217. literal.append(", ");
  5218. }
  5219. }
  5220. if(literal.size()> 2)
  5221. {
  5222. literal.chop(2);
  5223. }
  5224. literal.append("}'");
  5225. return literal;
  5226. }
  5227. QString SaltModel::quotedArrayLiteral(int column,int role)const
  5228. {
  5229. QString literal= "'{";
  5230. for(int i= 0;i<rowCount();i++)
  5231. {
  5232. QString datum= data(index(i,column),role).toString();
  5233. if(!datum.isEmpty())
  5234. {
  5235. literal.append("\"");
  5236. literal.append(datum);
  5237. literal.append("\", ");
  5238. }
  5239. }
  5240. if(literal.size()> 2)
  5241. {
  5242. literal.chop(2);
  5243. }
  5244. literal.append("}'");
  5245. return literal;
  5246. }
  5247. /*:498*//*499:*/
  5248. #line 11939 "./typica.w"
  5249. QModelIndex SaltModel::parent(const QModelIndex&)const
  5250. {
  5251. return QModelIndex();
  5252. }
  5253. /*:499*//*500:*/
  5254. #line 11958 "./typica.w"
  5255. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  5256. int role)
  5257. {
  5258. /*501:*/
  5259. #line 11989 "./typica.w"
  5260. bool valid= false;
  5261. if(index.isValid())
  5262. {
  5263. if(index.row()<modelData.size())
  5264. {
  5265. if(index.column()<colcount)
  5266. {
  5267. valid= true;
  5268. }
  5269. }
  5270. }
  5271. /*:501*/
  5272. #line 11962 "./typica.w"
  5273. if(!valid)
  5274. {
  5275. return false;
  5276. }
  5277. if(index.row()==modelData.size()-1)
  5278. {
  5279. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  5280. /*502:*/
  5281. #line 12005 "./typica.w"
  5282. QList<QMap<int,QVariant> > newRow;
  5283. QMap<int,QVariant> defaults;
  5284. for(int i= 0;i<colcount;i++)
  5285. {
  5286. newRow.append(defaults);
  5287. }
  5288. modelData.append(newRow);
  5289. /*:502*/
  5290. #line 11970 "./typica.w"
  5291. endInsertRows();
  5292. }
  5293. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5294. QMap<int,QVariant> cell= row.at(index.column());
  5295. cell.insert(role,value);
  5296. if(role==Qt::EditRole)
  5297. {
  5298. cell.insert(Qt::DisplayRole,value);
  5299. }
  5300. row.replace(index.column(),cell);
  5301. modelData.replace(index.row(),row);
  5302. emit dataChanged(index,index);
  5303. return true;
  5304. }
  5305. /*:500*//*503:*/
  5306. #line 12016 "./typica.w"
  5307. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  5308. {
  5309. for(int i= 0;i<columns;i++)
  5310. {
  5311. hData<<"";
  5312. }
  5313. /*502:*/
  5314. #line 12005 "./typica.w"
  5315. QList<QMap<int,QVariant> > newRow;
  5316. QMap<int,QVariant> defaults;
  5317. for(int i= 0;i<colcount;i++)
  5318. {
  5319. newRow.append(defaults);
  5320. }
  5321. modelData.append(newRow);
  5322. /*:502*/
  5323. #line 12023 "./typica.w"
  5324. }
  5325. /*:503*//*504:*/
  5326. #line 12028 "./typica.w"
  5327. SaltModel::~SaltModel()
  5328. {
  5329. }
  5330. /*:504*//*505:*/
  5331. #line 12038 "./typica.w"
  5332. int SaltModel::rowCount(const QModelIndex&parent)const
  5333. {
  5334. return(parent==QModelIndex()?modelData.size():0);
  5335. }
  5336. int SaltModel::columnCount(const QModelIndex&parent)const
  5337. {
  5338. return(parent==QModelIndex()?colcount:0);
  5339. }
  5340. /*:505*//*506:*/
  5341. #line 12051 "./typica.w"
  5342. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  5343. const QVariant&value,int)
  5344. {
  5345. if(orientation==Qt::Horizontal&&section<colcount)
  5346. {
  5347. hData.replace(section,value.toString());
  5348. emit headerDataChanged(orientation,section,section);
  5349. return true;
  5350. }
  5351. return false;
  5352. }
  5353. /*:506*//*507:*/
  5354. #line 12066 "./typica.w"
  5355. QVariant SaltModel::data(const QModelIndex&index,int role)const
  5356. {
  5357. /*501:*/
  5358. #line 11989 "./typica.w"
  5359. bool valid= false;
  5360. if(index.isValid())
  5361. {
  5362. if(index.row()<modelData.size())
  5363. {
  5364. if(index.column()<colcount)
  5365. {
  5366. valid= true;
  5367. }
  5368. }
  5369. }
  5370. /*:501*/
  5371. #line 12069 "./typica.w"
  5372. if(!valid)
  5373. {
  5374. return QVariant();
  5375. }
  5376. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5377. QMap<int,QVariant> cell= row.at(index.column());
  5378. return cell.value(role,QVariant());
  5379. }
  5380. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  5381. int role)const
  5382. {
  5383. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  5384. section<colcount)
  5385. {
  5386. return QVariant(hData.at(section));
  5387. }
  5388. return QVariant();
  5389. }
  5390. /*:507*//*508:*/
  5391. #line 12093 "./typica.w"
  5392. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  5393. {
  5394. /*501:*/
  5395. #line 11989 "./typica.w"
  5396. bool valid= false;
  5397. if(index.isValid())
  5398. {
  5399. if(index.row()<modelData.size())
  5400. {
  5401. if(index.column()<colcount)
  5402. {
  5403. valid= true;
  5404. }
  5405. }
  5406. }
  5407. /*:501*/
  5408. #line 12096 "./typica.w"
  5409. if(valid)
  5410. {
  5411. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5412. }
  5413. return 0;
  5414. }
  5415. /*:508*//*509:*/
  5416. #line 12107 "./typica.w"
  5417. QModelIndex SaltModel::index(int row,int column,
  5418. const QModelIndex&parent)const
  5419. {
  5420. if(parent==QModelIndex())
  5421. {
  5422. if(row<modelData.size()&&column<colcount)
  5423. {
  5424. return createIndex(row,column);
  5425. }
  5426. }
  5427. return QModelIndex();
  5428. }
  5429. /*:509*/
  5430. #line 793 "./typica.w"
  5431. /*511:*/
  5432. #line 12162 "./typica.w"
  5433. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  5434. {
  5435. SqlComboBox*widget= new SqlComboBox();
  5436. widget->setParent(parent);
  5437. for(int i= 0;i<count();i++)
  5438. {
  5439. widget->addItem(itemText(i),itemData(i));
  5440. }
  5441. return widget;
  5442. }
  5443. /*:511*//*512:*/
  5444. #line 12179 "./typica.w"
  5445. void SqlComboBox::showData(bool show)
  5446. {
  5447. dataColumnShown= show;
  5448. }
  5449. /*:512*//*513:*/
  5450. #line 12190 "./typica.w"
  5451. void SqlComboBox::addNullOption()
  5452. {
  5453. addItem(tr("Unknown"),QVariant(QVariant::String));
  5454. }
  5455. /*:513*//*514:*/
  5456. #line 12203 "./typica.w"
  5457. void SqlComboBox::setDataColumn(int column)
  5458. {
  5459. dataColumn= column;
  5460. }
  5461. void SqlComboBox::setDisplayColumn(int column)
  5462. {
  5463. displayColumn= column;
  5464. }
  5465. /*:514*//*515:*/
  5466. #line 12217 "./typica.w"
  5467. void SqlComboBox::addSqlOptions(QString query)
  5468. {
  5469. SqlQueryConnection*dbquery= new SqlQueryConnection;
  5470. if(!dbquery->exec(query))
  5471. {
  5472. QSqlError error= dbquery->lastError();
  5473. qDebug()<<error.databaseText();
  5474. qDebug()<<error.driverText();
  5475. qDebug()<<error.text();
  5476. qDebug()<<dbquery->lastQuery();
  5477. }
  5478. while(dbquery->next())
  5479. {
  5480. QString displayValue(dbquery->value(displayColumn).toString());
  5481. QString dataValue(dbquery->value(dataColumn).toString());
  5482. if(dataColumnShown)
  5483. {
  5484. displayValue.append(QString(" (%1)").arg(dataValue));
  5485. }
  5486. addItem(displayValue,dataValue);
  5487. }
  5488. delete dbquery;
  5489. }
  5490. /*:515*//*516:*/
  5491. #line 12246 "./typica.w"
  5492. SqlComboBox::SqlComboBox():
  5493. dataColumn(0),displayColumn(0),dataColumnShown(false)
  5494. {
  5495. }
  5496. SqlComboBox::~SqlComboBox()
  5497. {
  5498. }
  5499. /*:516*/
  5500. #line 794 "./typica.w"
  5501. /*518:*/
  5502. #line 12284 "./typica.w"
  5503. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  5504. {
  5505. delegate= widget;
  5506. }
  5507. /*:518*//*519:*/
  5508. #line 12293 "./typica.w"
  5509. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  5510. const QStyleOptionViewItem&,
  5511. const QModelIndex&)const
  5512. {
  5513. return delegate->clone(parent);
  5514. }
  5515. /*:519*//*520:*/
  5516. #line 12304 "./typica.w"
  5517. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  5518. const QModelIndex&index)const
  5519. {
  5520. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5521. self->setCurrentIndex(self->findData(
  5522. index.model()->data(index,
  5523. Qt::UserRole).toString()));
  5524. }
  5525. /*:520*//*521:*/
  5526. #line 12317 "./typica.w"
  5527. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  5528. QAbstractItemModel*model,
  5529. const QModelIndex&index)const
  5530. {
  5531. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5532. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  5533. Qt::UserRole);
  5534. model->setData(index,self->currentText(),Qt::DisplayRole);
  5535. }
  5536. /*:521*//*522:*/
  5537. #line 12330 "./typica.w"
  5538. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  5539. const QStyleOptionViewItem&option,
  5540. const QModelIndex&)const
  5541. {
  5542. editor->setGeometry(option.rect);
  5543. }
  5544. /*:522*//*523:*/
  5545. #line 12341 "./typica.w"
  5546. QSize SqlComboBoxDelegate::sizeHint()const
  5547. {
  5548. return delegate->sizeHint();
  5549. }
  5550. /*:523*//*524:*/
  5551. #line 12349 "./typica.w"
  5552. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  5553. :QItemDelegate(parent)
  5554. {
  5555. }
  5556. /*:524*/
  5557. #line 795 "./typica.w"
  5558. /*490:*/
  5559. #line 11709 "./typica.w"
  5560. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  5561. {
  5562. /*491:*/
  5563. #line 11724 "./typica.w"
  5564. setOrganizationName("Wilson's Coffee & Tea");
  5565. setOrganizationDomain("wilsonscoffee.com");
  5566. setApplicationName(PROGRAM_NAME);
  5567. /*:491*/
  5568. #line 11712 "./typica.w"
  5569. /*492:*/
  5570. #line 11733 "./typica.w"
  5571. QTranslator base;
  5572. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  5573. {
  5574. installTranslator(&base);
  5575. }
  5576. QTranslator app;
  5577. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  5578. {
  5579. installTranslator(&app);
  5580. }
  5581. /*:492*/
  5582. #line 11713 "./typica.w"
  5583. /*229:*/
  5584. #line 5736 "./typica.w"
  5585. qRegisterMetaType<Measurement> ("Measurement");
  5586. /*:229*/
  5587. #line 11714 "./typica.w"
  5588. /*669:*/
  5589. #line 15429 "./typica.w"
  5590. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  5591. tr("NI DAQmx Base"),
  5592. "nidaqmxbase",NULL);
  5593. topLevelNodeInserters.append(inserter);
  5594. /*:669*//*677:*/
  5595. #line 15646 "./typica.w"
  5596. #ifdef Q_OS_WIN32
  5597. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  5598. topLevelNodeInserters.append(inserter);
  5599. #endif
  5600. /*:677*//*701:*/
  5601. #line 16605 "./typica.w"
  5602. #if 0
  5603. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  5604. topLevelNodeInserters.append(inserter);
  5605. #endif
  5606. /*:701*//*730:*/
  5607. #line 18055 "./typica.w"
  5608. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  5609. topLevelNodeInserters.append(inserter);
  5610. /*:730*/
  5611. #line 11715 "./typica.w"
  5612. }
  5613. /*:490*//*494:*/
  5614. #line 11756 "./typica.w"
  5615. QDomDocument*Application::configuration()
  5616. {
  5617. return&conf;
  5618. }
  5619. /*:494*//*495:*/
  5620. #line 11765 "./typica.w"
  5621. QSqlDatabase Application::database()
  5622. {
  5623. QString connectionName;
  5624. QSqlDatabase connection= QSqlDatabase::database();
  5625. do
  5626. {
  5627. connectionName= QUuid::createUuid().toString();
  5628. }while(QSqlDatabase::connectionNames().contains(connectionName));
  5629. return QSqlDatabase::cloneDatabase(connection,connectionName);
  5630. }
  5631. /*:495*//*605:*/
  5632. #line 14084 "./typica.w"
  5633. void Application::saveDeviceConfiguration()
  5634. {
  5635. QSettings settings;
  5636. settings.setValue("DeviceConfiguration",
  5637. QVariant(deviceConfigurationDocument.toByteArray()));
  5638. }
  5639. /*:605*//*606:*/
  5640. #line 14096 "./typica.w"
  5641. QDomDocument Application::deviceConfiguration()
  5642. {
  5643. if(deviceConfigurationDocument.isNull())
  5644. {
  5645. /*607:*/
  5646. #line 14110 "./typica.w"
  5647. QSettings settings;
  5648. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  5649. QString etext;
  5650. int eline;
  5651. int ecol;
  5652. if(document.length()==0)
  5653. {
  5654. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  5655. /*608:*/
  5656. #line 14134 "./typica.w"
  5657. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5658. emptyDocument.open(QIODevice::ReadOnly);
  5659. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5660. &etext,&eline,&ecol))
  5661. {
  5662. /*609:*/
  5663. #line 14151 "./typica.w"
  5664. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5665. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5666. qDebug()<<etext;
  5667. /*:609*/
  5668. #line 14140 "./typica.w"
  5669. }
  5670. else
  5671. {
  5672. saveDeviceConfiguration();
  5673. }
  5674. /*:608*/
  5675. #line 14119 "./typica.w"
  5676. }
  5677. else
  5678. {
  5679. if(!deviceConfigurationDocument.setContent(document,false,
  5680. &etext,&eline,&ecol))
  5681. {
  5682. /*609:*/
  5683. #line 14151 "./typica.w"
  5684. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5685. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5686. qDebug()<<etext;
  5687. /*:609*/
  5688. #line 14126 "./typica.w"
  5689. /*608:*/
  5690. #line 14134 "./typica.w"
  5691. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5692. emptyDocument.open(QIODevice::ReadOnly);
  5693. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5694. &etext,&eline,&ecol))
  5695. {
  5696. /*609:*/
  5697. #line 14151 "./typica.w"
  5698. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5699. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5700. qDebug()<<etext;
  5701. /*:609*/
  5702. #line 14140 "./typica.w"
  5703. }
  5704. else
  5705. {
  5706. saveDeviceConfiguration();
  5707. }
  5708. /*:608*/
  5709. #line 14127 "./typica.w"
  5710. }
  5711. }
  5712. /*:607*/
  5713. #line 14101 "./typica.w"
  5714. }
  5715. return deviceConfigurationDocument;
  5716. }
  5717. /*:606*//*637:*/
  5718. #line 14752 "./typica.w"
  5719. void Application::registerDeviceConfigurationWidget(QString driver,
  5720. QMetaObject widget)
  5721. {
  5722. deviceConfigurationWidgets.insert(driver,widget);
  5723. }
  5724. /*:637*//*638:*/
  5725. #line 14768 "./typica.w"
  5726. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  5727. const QModelIndex&index)
  5728. {
  5729. QVariant nodeReference= index.data(Qt::UserRole);
  5730. QDomElement referenceElement= model->referenceElement(
  5731. model->data(index,Qt::UserRole).toString());
  5732. QMetaObject metaObject=
  5733. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  5734. QWidget::staticMetaObject);
  5735. QWidget*editor;
  5736. if(metaObject.className()==QWidget::staticMetaObject.className())
  5737. {
  5738. editor= NULL;
  5739. }
  5740. else
  5741. {
  5742. editor= qobject_cast<QWidget*> (
  5743. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  5744. Q_ARG(QModelIndex,index)));
  5745. }
  5746. return editor;
  5747. }
  5748. /*:638*/
  5749. #line 796 "./typica.w"
  5750. /*529:*/
  5751. #line 12444 "./typica.w"
  5752. SqlConnectionSetup::SqlConnectionSetup():
  5753. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  5754. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  5755. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  5756. cancelButton(new QPushButton(tr("Cancel"))),
  5757. connectButton(new QPushButton(tr("Connect")))
  5758. {
  5759. driver->addItem("PostgreSQL","QPSQL");
  5760. formLayout->addRow(tr("Database driver:"),driver);
  5761. formLayout->addRow(tr("Host name:"),hostname);
  5762. formLayout->addRow(tr("Database name:"),dbname);
  5763. formLayout->addRow(tr("User name:"),user);
  5764. password->setEchoMode(QLineEdit::Password);
  5765. formLayout->addRow(tr("Password:"),password);
  5766. layout->addLayout(formLayout);
  5767. buttons->addStretch(1);
  5768. buttons->addWidget(cancelButton);
  5769. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  5770. buttons->addWidget(connectButton);
  5771. layout->addLayout(buttons);
  5772. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  5773. setLayout(layout);
  5774. setModal(true);
  5775. }
  5776. SqlConnectionSetup::~SqlConnectionSetup()
  5777. {
  5778. }
  5779. /*:529*//*530:*/
  5780. #line 12478 "./typica.w"
  5781. void SqlConnectionSetup::testConnection()
  5782. {
  5783. QSqlDatabase database=
  5784. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  5785. toString());
  5786. database.setHostName(hostname->text());
  5787. database.setDatabaseName(dbname->text());
  5788. database.setUserName(user->text());
  5789. database.setPassword(password->text());
  5790. if(database.open())
  5791. {
  5792. QSettings settings;
  5793. settings.setValue("database/exists","true");
  5794. settings.setValue("database/driver",
  5795. driver->itemData(driver->currentIndex()).toString());
  5796. settings.setValue("database/hostname",hostname->text());
  5797. settings.setValue("database/dbname",dbname->text());
  5798. settings.setValue("database/user",user->text());
  5799. settings.setValue("database/password",password->text());
  5800. accept();
  5801. }
  5802. else
  5803. {
  5804. QMessageBox::information(this,tr("Database connection failed"),
  5805. tr("Failed to connect to database."));
  5806. }
  5807. }
  5808. /*:530*/
  5809. #line 797 "./typica.w"
  5810. /*534:*/
  5811. #line 12573 "./typica.w"
  5812. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  5813. {
  5814. setModel(new QSqlQueryModel);
  5815. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  5816. this,SLOT(openRow(QModelIndex)));
  5817. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  5818. this,SLOT(persistColumnResize(int,int,int)));
  5819. }
  5820. /*:534*//*535:*/
  5821. #line 12588 "./typica.w"
  5822. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  5823. {
  5824. /*536:*/
  5825. #line 12597 "./typica.w"
  5826. QSettings settings;
  5827. /*537:*/
  5828. #line 12610 "./typica.w"
  5829. QWidget*topLevelWidget= this;
  5830. while(topLevelWidget->parentWidget())
  5831. {
  5832. topLevelWidget= topLevelWidget->parentWidget();
  5833. }
  5834. /*:537*/
  5835. #line 12599 "./typica.w"
  5836. settings.setValue(QString("columnWidths/%1/%2/%3").
  5837. arg(topLevelWidget->objectName()).
  5838. arg(objectName()).arg(column),
  5839. QVariant(newsize));
  5840. /*:536*/
  5841. #line 12591 "./typica.w"
  5842. }
  5843. /*:535*//*538:*/
  5844. #line 12620 "./typica.w"
  5845. void SqlQueryView::showEvent(QShowEvent*event)
  5846. {
  5847. /*539:*/
  5848. #line 12630 "./typica.w"
  5849. QSettings settings;
  5850. /*537:*/
  5851. #line 12610 "./typica.w"
  5852. QWidget*topLevelWidget= this;
  5853. while(topLevelWidget->parentWidget())
  5854. {
  5855. topLevelWidget= topLevelWidget->parentWidget();
  5856. }
  5857. /*:537*/
  5858. #line 12632 "./typica.w"
  5859. QString baseKey=
  5860. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5861. arg(objectName());
  5862. for(int i= 0;i<model()->columnCount();i++)
  5863. {
  5864. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5865. if(settings.contains(key))
  5866. {
  5867. setColumnWidth(i,settings.value(key).toInt());
  5868. }
  5869. }
  5870. /*:539*/
  5871. #line 12623 "./typica.w"
  5872. event->accept();
  5873. }
  5874. /*:538*//*540:*/
  5875. #line 12647 "./typica.w"
  5876. void SqlQueryView::openRow(const QModelIndex&index)
  5877. {
  5878. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  5879. emit openEntryRow(index.row());
  5880. }
  5881. /*:540*//*541:*/
  5882. #line 12658 "./typica.w"
  5883. void SqlQueryView::setQuery(const QString&query)
  5884. {
  5885. QSqlDatabase database= AppInstance->database();
  5886. database.open();
  5887. QSqlQuery q(query,database);
  5888. ((QSqlQueryModel*)model())->setQuery(q);
  5889. }
  5890. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  5891. const QVariant&value,int role)
  5892. {
  5893. return model()->setHeaderData(section,orientation,value,role);
  5894. }
  5895. /*:541*//*542:*/
  5896. #line 12675 "./typica.w"
  5897. QVariant SqlQueryView::data(int row,int column,int role)
  5898. {
  5899. return model()->data(model()->index(row,column),role);
  5900. }
  5901. /*:542*/
  5902. #line 798 "./typica.w"
  5903. /*137:*/
  5904. #line 3283 "./typica.w"
  5905. SqlQueryConnection::SqlQueryConnection(const QString&query)
  5906. {
  5907. QSqlDatabase database= AppInstance->database();
  5908. database.open();
  5909. q= new QSqlQuery(query,database);
  5910. connection= database.connectionName();
  5911. }
  5912. /*:137*//*138:*/
  5913. #line 3296 "./typica.w"
  5914. SqlQueryConnection::~SqlQueryConnection()
  5915. {
  5916. delete q;
  5917. {
  5918. QSqlDatabase database= QSqlDatabase::database(connection);
  5919. database.close();
  5920. }
  5921. QSqlDatabase::removeDatabase(connection);
  5922. }
  5923. /*:138*//*139:*/
  5924. #line 3310 "./typica.w"
  5925. QSqlQuery*SqlQueryConnection::operator->()
  5926. {
  5927. return q;
  5928. }
  5929. /*:139*/
  5930. #line 799 "./typica.w"
  5931. /*561:*/
  5932. #line 13024 "./typica.w"
  5933. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  5934. area(frame),configuration(description)
  5935. {
  5936. refresh();
  5937. }
  5938. ReportTable::~ReportTable()
  5939. {
  5940. }
  5941. /*:561*//*562:*/
  5942. #line 13040 "./typica.w"
  5943. void ReportTable::bind(QString placeholder,QVariant value)
  5944. {
  5945. bindings.insert(placeholder,value);
  5946. }
  5947. /*:562*//*563:*/
  5948. #line 13050 "./typica.w"
  5949. void ReportTable::refresh()
  5950. {
  5951. /*564:*/
  5952. #line 13071 "./typica.w"
  5953. QTextCursor cursor= area->firstCursorPosition();
  5954. while(cursor<area->lastCursorPosition())
  5955. {
  5956. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  5957. }
  5958. cursor.removeSelectedText();
  5959. /*:564*/
  5960. #line 13053 "./typica.w"
  5961. int rows= 1;
  5962. int columns= 1;
  5963. int currentRow= 0;
  5964. QTextTable*table= cursor.insertTable(rows,columns);
  5965. /*565:*/
  5966. #line 13084 "./typica.w"
  5967. QTextTableFormat format= table->format();
  5968. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  5969. if(configuration.hasAttribute("align"))
  5970. {
  5971. if(configuration.attribute("align")=="center")
  5972. {
  5973. format.setAlignment(Qt::AlignHCenter);
  5974. }
  5975. }
  5976. table->setFormat(format);
  5977. /*:565*/
  5978. #line 13058 "./typica.w"
  5979. /*566:*/
  5980. #line 13098 "./typica.w"
  5981. QDomNodeList children= configuration.childNodes();
  5982. for(int i= 0;i<children.count();i++)
  5983. {
  5984. QDomNode current;
  5985. QDomElement currentElement;
  5986. current= children.at(i);
  5987. if(current.isElement())
  5988. {
  5989. currentElement= current.toElement();
  5990. if(currentElement.tagName()=="query")
  5991. {
  5992. /*567:*/
  5993. #line 13125 "./typica.w"
  5994. SqlQueryConnection query;
  5995. query.prepare(currentElement.text());
  5996. foreach(QString key,bindings.uniqueKeys())
  5997. {
  5998. if(currentElement.text().contains(key))
  5999. {
  6000. query.bindValue(key,bindings.value(key));
  6001. }
  6002. }
  6003. query.exec();
  6004. if(!query.next())
  6005. {
  6006. continue;
  6007. }
  6008. if(query.record().count()> columns)
  6009. {
  6010. table->appendColumns(query.record().count()-columns);
  6011. }
  6012. do
  6013. {
  6014. table->appendRows(1);
  6015. rows++;
  6016. currentRow++;
  6017. for(int j= 0;j<query.record().count();j++)
  6018. {
  6019. QTextTableCell cell= table->cellAt(currentRow,j);
  6020. cursor= cell.firstCursorPosition();
  6021. cursor.insertText(query.value(j).toString());
  6022. }
  6023. }while(query.next());
  6024. /*:567*/
  6025. #line 13110 "./typica.w"
  6026. }
  6027. else if(currentElement.tagName()=="row")
  6028. {
  6029. /*568:*/
  6030. #line 13164 "./typica.w"
  6031. table->appendRows(1);
  6032. currentRow++;
  6033. rows++;
  6034. QDomNodeList rowChildren= currentElement.childNodes();
  6035. int currentColumn= 0;
  6036. for(int j= 0;j<rowChildren.count();j++)
  6037. {
  6038. QDomNode node;
  6039. QDomElement nodeElement;
  6040. node= rowChildren.at(j);
  6041. if(node.isElement())
  6042. {
  6043. nodeElement= node.toElement();
  6044. if(nodeElement.tagName()=="cell")
  6045. {
  6046. if(currentColumn==columns)
  6047. {
  6048. table->appendColumns(1);
  6049. columns++;
  6050. }
  6051. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  6052. cursor= cell.firstCursorPosition();
  6053. cursor.insertText(nodeElement.text());
  6054. currentColumn++;
  6055. }
  6056. }
  6057. }
  6058. /*:568*/
  6059. #line 13114 "./typica.w"
  6060. }
  6061. }
  6062. }
  6063. /*:566*/
  6064. #line 13059 "./typica.w"
  6065. if(rows> 1)
  6066. {
  6067. table->removeRows(0,1);
  6068. }
  6069. }
  6070. /*:563*/
  6071. #line 800 "./typica.w"
  6072. /*573:*/
  6073. #line 13266 "./typica.w"
  6074. FormArray::FormArray(QDomElement description):configuration(description),
  6075. maxwidth(-1),maxheight(-1)
  6076. {
  6077. setWidget(&itemContainer);
  6078. itemContainer.setLayout(&itemLayout);
  6079. }
  6080. /*:573*//*574:*/
  6081. #line 13283 "./typica.w"
  6082. void FormArray::addElements(int copies)
  6083. {
  6084. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  6085. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  6086. QWidget*widget;
  6087. for(int i= 0;i<copies;i++)
  6088. {
  6089. widget= new QWidget;
  6090. if(maxwidth> -1)
  6091. {
  6092. widget->setMaximumWidth(maxwidth);
  6093. }
  6094. if(maxheight> -1)
  6095. {
  6096. widget->setMaximumHeight(maxheight);
  6097. }
  6098. if(configuration.hasChildNodes())
  6099. {
  6100. widgetStack->push(widget);
  6101. populateWidget(configuration,widgetStack,layoutStack);
  6102. widgetStack->pop();
  6103. widget->setMinimumHeight(widget->sizeHint().height());
  6104. itemLayout.addWidget(widget);
  6105. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  6106. {
  6107. itemContainer.setMinimumHeight(maxheight*elements()+50);
  6108. }
  6109. else
  6110. {
  6111. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  6112. +widget->sizeHint().height());
  6113. }
  6114. if(maxwidth> -1)
  6115. {
  6116. itemContainer.setMinimumWidth(maxwidth+50);
  6117. }
  6118. else
  6119. {
  6120. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  6121. }
  6122. }
  6123. }
  6124. }
  6125. /*:574*//*575:*/
  6126. #line 13333 "./typica.w"
  6127. QWidget*FormArray::elementAt(int index)
  6128. {
  6129. if(index<itemLayout.count())
  6130. {
  6131. QLayoutItem*item= itemLayout.itemAt(index);
  6132. return item->widget();
  6133. }
  6134. else
  6135. {
  6136. return NULL;
  6137. }
  6138. }
  6139. /*:575*//*576:*/
  6140. #line 13350 "./typica.w"
  6141. void FormArray::removeAllElements()
  6142. {
  6143. while(itemLayout.count()> 0)
  6144. {
  6145. QLayoutItem*item;
  6146. item= itemLayout.itemAt(0);
  6147. item->widget()->hide();
  6148. itemLayout.removeWidget(item->widget());
  6149. }
  6150. itemContainer.setMinimumHeight(0);
  6151. }
  6152. /*:576*//*577:*/
  6153. #line 13366 "./typica.w"
  6154. int FormArray::elements()
  6155. {
  6156. return itemLayout.count();
  6157. }
  6158. /*:577*//*578:*/
  6159. #line 13377 "./typica.w"
  6160. void FormArray::setMaximumElementWidth(int width)
  6161. {
  6162. maxwidth= width;
  6163. }
  6164. void FormArray::setMaximumElementHeight(int height)
  6165. {
  6166. maxheight= height;
  6167. }
  6168. /*:578*/
  6169. #line 801 "./typica.w"
  6170. /*584:*/
  6171. #line 13508 "./typica.w"
  6172. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  6173. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  6174. {
  6175. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  6176. QPointF(0,5);
  6177. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  6178. QPointF(10,5);
  6179. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  6180. QPointF(0,0);
  6181. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  6182. initialBrush.setColor(QColor(170,170,255));
  6183. initialBrush.setStyle(Qt::SolidPattern);
  6184. finalBrush.setColor(Qt::blue);
  6185. finalBrush.setStyle(Qt::SolidPattern);
  6186. initialDecrement.setPolygon(left);
  6187. initialDecrement.setBrush(initialBrush);
  6188. initialDecrement.setPos(0,0);
  6189. scene.addItem(&initialDecrement);
  6190. initialIncrement.setPolygon(right);
  6191. initialIncrement.setBrush(initialBrush);
  6192. initialIncrement.setPos(122,0);
  6193. scene.addItem(&initialIncrement);
  6194. finalDecrement.setPolygon(left);
  6195. finalDecrement.setBrush(finalBrush);
  6196. finalDecrement.setPos(0,12);
  6197. scene.addItem(&finalDecrement);
  6198. finalIncrement.setPolygon(right);
  6199. finalIncrement.setBrush(finalBrush);
  6200. finalIncrement.setPos(122,12);
  6201. scene.addItem(&finalIncrement);
  6202. scalePath.moveTo(0,10);
  6203. scalePath.lineTo(100,10);
  6204. scalePath.moveTo(0,0);
  6205. scalePath.lineTo(0,20);
  6206. scalePath.moveTo(10,5);
  6207. scalePath.lineTo(10,15);
  6208. scalePath.moveTo(20,5);
  6209. scalePath.lineTo(20,15);
  6210. scalePath.moveTo(30,5);
  6211. scalePath.lineTo(30,15);
  6212. scalePath.moveTo(40,5);
  6213. scalePath.lineTo(40,15);
  6214. scalePath.moveTo(50,0);
  6215. scalePath.lineTo(50,20);
  6216. scalePath.moveTo(60,5);
  6217. scalePath.lineTo(60,15);
  6218. scalePath.moveTo(70,5);
  6219. scalePath.lineTo(70,15);
  6220. scalePath.moveTo(80,5);
  6221. scalePath.lineTo(80,15);
  6222. scalePath.moveTo(90,5);
  6223. scalePath.lineTo(90,15);
  6224. scalePath.moveTo(100,0);
  6225. scalePath.lineTo(100,20);
  6226. scaleLine.setPath(scalePath);
  6227. scaleLine.setPos(16,1);
  6228. scene.addItem(&scaleLine);
  6229. setScene(&scene);
  6230. initialIndicator.setPolygon(down);
  6231. initialIndicator.setBrush(initialBrush);
  6232. finalIndicator.setPolygon(up);
  6233. finalIndicator.setBrush(finalBrush);
  6234. setMinimumSize(sizeHint());
  6235. setMaximumSize(sizeHint());
  6236. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6237. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6238. setMinimumSize(sizeHint());
  6239. }
  6240. /*:584*//*585:*/
  6241. #line 13581 "./typica.w"
  6242. QSize ScaleControl::sizeHint()const
  6243. {
  6244. return QSize(140,30);
  6245. }
  6246. /*:585*//*586:*/
  6247. #line 13590 "./typica.w"
  6248. void ScaleControl::setInitialValue(double value)
  6249. {
  6250. if(value>=0&&value<=10)
  6251. {
  6252. nonScoredValue= value;
  6253. if(!initialSet)
  6254. {
  6255. scene.addItem(&initialIndicator);
  6256. }
  6257. initialSet= true;
  6258. initialIndicator.setPos(value*10+16,10);
  6259. emit initialChanged(value);
  6260. if(!finalSet)
  6261. {
  6262. setFinalValue(value);
  6263. }
  6264. }
  6265. }
  6266. void ScaleControl::setFinalValue(double value)
  6267. {
  6268. if(value>=0&&value<=10)
  6269. {
  6270. scoredValue= value;
  6271. if(!finalSet)
  6272. {
  6273. scene.addItem(&finalIndicator);
  6274. }
  6275. finalSet= true;
  6276. finalIndicator.setPos(value*10+16,11);
  6277. emit finalChanged(value);
  6278. }
  6279. }
  6280. /*:586*//*587:*/
  6281. #line 13627 "./typica.w"
  6282. double ScaleControl::initialValue(void)
  6283. {
  6284. return nonScoredValue;
  6285. }
  6286. double ScaleControl::finalValue(void)
  6287. {
  6288. return scoredValue;
  6289. }
  6290. /*:587*//*588:*/
  6291. #line 13648 "./typica.w"
  6292. void ScaleControl::mousePressEvent(QMouseEvent*event)
  6293. {
  6294. /*589:*/
  6295. #line 13660 "./typica.w"
  6296. if(event->button()!=Qt::LeftButton)
  6297. {
  6298. event->ignore();
  6299. return;
  6300. }
  6301. /*:589*/
  6302. #line 13651 "./typica.w"
  6303. scaleDown= true;
  6304. event->accept();
  6305. }
  6306. /*:588*//*590:*/
  6307. #line 13671 "./typica.w"
  6308. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  6309. {
  6310. /*589:*/
  6311. #line 13660 "./typica.w"
  6312. if(event->button()!=Qt::LeftButton)
  6313. {
  6314. event->ignore();
  6315. return;
  6316. }
  6317. /*:589*/
  6318. #line 13674 "./typica.w"
  6319. if(!scaleDown)
  6320. {
  6321. event->ignore();
  6322. return;
  6323. }
  6324. scaleDown= false;
  6325. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6326. /*591:*/
  6327. #line 13696 "./typica.w"
  6328. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  6329. {
  6330. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6331. {
  6332. if(initialSet)
  6333. {
  6334. setInitialValue(nonScoredValue-0.05);
  6335. }
  6336. event->accept();
  6337. return;
  6338. }
  6339. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6340. {
  6341. if(finalSet)
  6342. {
  6343. setFinalValue(scoredValue-0.05);
  6344. event->accept();
  6345. return;
  6346. }
  6347. }
  6348. }
  6349. /*:591*/
  6350. #line 13682 "./typica.w"
  6351. /*592:*/
  6352. #line 13722 "./typica.w"
  6353. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  6354. {
  6355. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6356. {
  6357. if(initialSet)
  6358. {
  6359. setInitialValue(nonScoredValue+0.05);
  6360. event->accept();
  6361. return;
  6362. }
  6363. }
  6364. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6365. {
  6366. if(finalSet)
  6367. {
  6368. setFinalValue(scoredValue+0.05);
  6369. event->accept();
  6370. return;
  6371. }
  6372. }
  6373. }
  6374. /*:592*/
  6375. #line 13683 "./typica.w"
  6376. /*593:*/
  6377. #line 13748 "./typica.w"
  6378. double relativeX= sceneCoordinate.x()-16;
  6379. if(initialSet)
  6380. {
  6381. if(relativeX>=0&&relativeX<=100)
  6382. {
  6383. setFinalValue(relativeX/10.0);
  6384. event->accept();
  6385. return;
  6386. }
  6387. }
  6388. else
  6389. {
  6390. if(relativeX>=0&&relativeX<=100)
  6391. {
  6392. setInitialValue(relativeX/10.0);
  6393. event->accept();
  6394. return;
  6395. }
  6396. }
  6397. /*:593*/
  6398. #line 13684 "./typica.w"
  6399. event->ignore();
  6400. return;
  6401. }
  6402. /*:590*/
  6403. #line 802 "./typica.w"
  6404. /*595:*/
  6405. #line 13814 "./typica.w"
  6406. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  6407. valueSet(false),scaleDown(false)
  6408. {
  6409. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6410. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6411. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  6412. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  6413. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  6414. theBrush.setColor(Qt::blue);
  6415. theBrush.setStyle(Qt::SolidPattern);
  6416. increment.setPolygon(up);
  6417. increment.setBrush(theBrush);
  6418. increment.setPos(0,0);
  6419. scene.addItem(&increment);
  6420. decrement.setPolygon(down);
  6421. decrement.setBrush(theBrush);
  6422. decrement.setPos(0,122);
  6423. scene.addItem(&decrement);
  6424. scalePath.moveTo(5,0);
  6425. scalePath.lineTo(5,100);
  6426. scalePath.moveTo(0,0);
  6427. scalePath.lineTo(10,0);
  6428. scalePath.moveTo(0,10);
  6429. scalePath.lineTo(10,10);
  6430. scalePath.moveTo(0,20);
  6431. scalePath.lineTo(10,20);
  6432. scalePath.moveTo(0,30);
  6433. scalePath.lineTo(10,30);
  6434. scalePath.moveTo(0,40);
  6435. scalePath.lineTo(10,40);
  6436. scalePath.moveTo(0,50);
  6437. scalePath.lineTo(10,50);
  6438. scalePath.moveTo(0,60);
  6439. scalePath.lineTo(10,60);
  6440. scalePath.moveTo(0,70);
  6441. scalePath.lineTo(10,70);
  6442. scalePath.moveTo(0,80);
  6443. scalePath.lineTo(10,80);
  6444. scalePath.moveTo(0,90);
  6445. scalePath.lineTo(10,90);
  6446. scalePath.moveTo(0,100);
  6447. scalePath.lineTo(10,100);
  6448. scaleLine.setPath(scalePath);
  6449. scaleLine.setPos(0,16);
  6450. scene.addItem(&scaleLine);
  6451. setScene(&scene);
  6452. indicator.setPolygon(left);
  6453. indicator.setBrush(theBrush);
  6454. setMinimumSize(sizeHint());
  6455. setMaximumSize(sizeHint());
  6456. }
  6457. /*:595*//*596:*/
  6458. #line 13869 "./typica.w"
  6459. QSize IntensityControl::sizeHint()const
  6460. {
  6461. return QSize(25,160);
  6462. }
  6463. /*:596*//*597:*/
  6464. #line 13884 "./typica.w"
  6465. void IntensityControl::setValue(double val)
  6466. {
  6467. if(val>=0&&val<=10)
  6468. {
  6469. theValue= val;
  6470. if(!valueSet)
  6471. {
  6472. scene.addItem(&indicator);
  6473. }
  6474. valueSet= true;
  6475. indicator.setPos(6,(100-(val*10))+16);
  6476. emit(valueChanged(val));
  6477. }
  6478. else if(val<1)
  6479. {
  6480. setValue(0);
  6481. }
  6482. else
  6483. {
  6484. setValue(10);
  6485. }
  6486. }
  6487. double IntensityControl::value()
  6488. {
  6489. return theValue;
  6490. }
  6491. /*:597*//*598:*/
  6492. #line 13916 "./typica.w"
  6493. void IntensityControl::mousePressEvent(QMouseEvent*event)
  6494. {
  6495. /*589:*/
  6496. #line 13660 "./typica.w"
  6497. if(event->button()!=Qt::LeftButton)
  6498. {
  6499. event->ignore();
  6500. return;
  6501. }
  6502. /*:589*/
  6503. #line 13919 "./typica.w"
  6504. scaleDown= true;
  6505. event->accept();
  6506. }
  6507. /*:598*//*599:*/
  6508. #line 13930 "./typica.w"
  6509. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  6510. {
  6511. /*589:*/
  6512. #line 13660 "./typica.w"
  6513. if(event->button()!=Qt::LeftButton)
  6514. {
  6515. event->ignore();
  6516. return;
  6517. }
  6518. /*:589*/
  6519. #line 13933 "./typica.w"
  6520. if(!scaleDown)
  6521. {
  6522. event->ignore();
  6523. return;
  6524. }
  6525. scaleDown= false;
  6526. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6527. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  6528. {
  6529. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6530. {
  6531. if(valueSet)
  6532. {
  6533. setValue(theValue+0.05);
  6534. }
  6535. event->accept();
  6536. return;
  6537. }
  6538. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  6539. {
  6540. if(valueSet)
  6541. {
  6542. setValue(theValue-0.05);
  6543. }
  6544. event->accept();
  6545. return;
  6546. }
  6547. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  6548. {
  6549. setValue(10-((sceneCoordinate.y()-16)/10.0));
  6550. event->accept();
  6551. return;
  6552. }
  6553. }
  6554. }
  6555. /*:599*/
  6556. #line 803 "./typica.w"
  6557. /*298:*/
  6558. #line 7486 "./typica.w"
  6559. void ThresholdDetector::newMeasurement(Measurement measure)
  6560. {
  6561. if((currentDirection==Ascending&&previousValue<threshold&&
  6562. previousValue>=0)||(currentDirection==Descending&&
  6563. previousValue> threshold&&previousValue>=0))
  6564. {
  6565. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  6566. (currentDirection==Descending&&measure.temperature()<=threshold))
  6567. {
  6568. double offset= measure.time().hour()*60*60;
  6569. offset+= measure.time().minute()*60;
  6570. offset+= measure.time().second();
  6571. offset+= measure.time().msec()/1000;
  6572. emit timeForValue(offset);
  6573. }
  6574. }
  6575. previousValue= measure.temperature();
  6576. }
  6577. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  6578. previousValue(-1),threshold(value),currentDirection(Ascending)
  6579. {
  6580. }
  6581. void ThresholdDetector::setThreshold(double value)
  6582. {
  6583. threshold= value;
  6584. }
  6585. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  6586. {
  6587. currentDirection= direction;
  6588. }
  6589. /*:298*/
  6590. #line 804 "./typica.w"
  6591. /*680:*/
  6592. #line 15686 "./typica.w"
  6593. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  6594. lister(new QextSerialEnumerator)
  6595. {
  6596. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  6597. QextPortInfo port;
  6598. foreach(port,ports)
  6599. {
  6600. addItem(port.portName);
  6601. }
  6602. lister->setUpNotifications();
  6603. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  6604. this,SLOT(addDevice(QextPortInfo)));
  6605. setEditable(true);
  6606. }
  6607. void PortSelector::addDevice(QextPortInfo port)
  6608. {
  6609. addItem(port.portName);
  6610. }
  6611. /*:680*/
  6612. #line 805 "./typica.w"
  6613. /*682:*/
  6614. #line 15774 "./typica.w"
  6615. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  6616. {
  6617. QMetaObject meta= BaudSelector::staticMetaObject;
  6618. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  6619. for(int i= 0;i<type.keyCount();i++)
  6620. {
  6621. addItem(QString("%1").arg(type.value(i)));
  6622. }
  6623. }
  6624. /*:682*/
  6625. #line 806 "./typica.w"
  6626. /*684:*/
  6627. #line 15812 "./typica.w"
  6628. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  6629. {
  6630. QMetaObject meta= ParitySelector::staticMetaObject;
  6631. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  6632. for(int i= 0;i<type.keyCount();i++)
  6633. {
  6634. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6635. }
  6636. }
  6637. /*:684*/
  6638. #line 807 "./typica.w"
  6639. /*686:*/
  6640. #line 15842 "./typica.w"
  6641. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  6642. {
  6643. QMetaObject meta= FlowSelector::staticMetaObject;
  6644. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  6645. for(int i= 0;i<type.keyCount();i++)
  6646. {
  6647. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6648. }
  6649. }
  6650. /*:686*/
  6651. #line 808 "./typica.w"
  6652. /*688:*/
  6653. #line 15877 "./typica.w"
  6654. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  6655. {
  6656. QMetaObject meta= StopSelector::staticMetaObject;
  6657. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  6658. for(int i= 0;i<type.keyCount();i++)
  6659. {
  6660. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6661. }
  6662. }
  6663. /*:688*/
  6664. #line 809 "./typica.w"
  6665. /*728:*/
  6666. #line 17622 "./typica.w"
  6667. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  6668. :BasicDeviceConfigurationWidget(model,index),
  6669. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  6670. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  6671. decimalQuery(new QCheckBox(tr("Enable"))),
  6672. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  6673. unitQuery(new QCheckBox(tr("Enable"))),
  6674. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  6675. valueC(new QSpinBox),fixedUnit(new QComboBox),
  6676. pVAddress(new ShortHexSpinBox),
  6677. sVEnabled(new QCheckBox(tr("Enable"))),
  6678. sVReadAddress(new ShortHexSpinBox),
  6679. deviceLimit(new QCheckBox(tr("Enable"))),
  6680. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  6681. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  6682. sVWritable(new QCheckBox(tr("Enable"))),
  6683. sVOutputAddr(new ShortHexSpinBox),
  6684. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  6685. {
  6686. QHBoxLayout*layout= new QHBoxLayout;
  6687. QWidget*form= new QWidget;
  6688. QHBoxLayout*masterLayout= new QHBoxLayout;
  6689. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  6690. QVBoxLayout*seriesLayout= new QVBoxLayout;
  6691. QFormLayout*serialSection= new QFormLayout;
  6692. serialSection->addRow(QString(tr("Port:")),port);
  6693. serialSection->addRow(QString(tr("Baud rate:")),baud);
  6694. serialSection->addRow(QString(tr("Parity:")),parity);
  6695. serialSection->addRow(QString(tr("Flow control:")),flow);
  6696. serialSection->addRow(QString(tr("Stop bits:")),stop);
  6697. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  6698. serialSectionBox->setLayout(serialSection);
  6699. portAndDeviceLayout->addWidget(serialSectionBox);
  6700. QFormLayout*deviceSection= new QFormLayout;
  6701. station->setMinimum(1);
  6702. station->setMaximum(255);
  6703. decimalPosition->setMinimum(0);
  6704. decimalPosition->setMaximum(9);
  6705. valueF->setMinimum(0);
  6706. valueF->setMaximum(0xFFFF);
  6707. valueC->setMinimum(0);
  6708. valueC->setMaximum(0xFFFF);
  6709. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  6710. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  6711. deviceSection->addRow(tr("Station:"),station);
  6712. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  6713. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  6714. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  6715. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  6716. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  6717. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  6718. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  6719. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  6720. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  6721. deviceSectionBox->setLayout(deviceSection);
  6722. portAndDeviceLayout->addWidget(deviceSectionBox);
  6723. QFormLayout*pVSection= new QFormLayout;
  6724. pVSection->addRow(tr("Value relative address:"),pVAddress);
  6725. pVSection->addRow(tr("PV column name:"),pVColumnName);
  6726. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  6727. processValueBox->setLayout(pVSection);
  6728. seriesLayout->addWidget(processValueBox);
  6729. QFormLayout*sVSection= new QFormLayout;
  6730. sVLower->setDecimals(1);
  6731. sVLower->setMinimum(0.0);
  6732. sVLower->setMaximum(999.9);
  6733. sVUpper->setDecimals(1);
  6734. sVUpper->setMinimum(0.0);
  6735. sVUpper->setMaximum(999.9);
  6736. sVSection->addRow(tr("Set value:"),sVEnabled);
  6737. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  6738. sVSection->addRow(tr("SV column name:"),sVColumnName);
  6739. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  6740. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  6741. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  6742. sVSection->addRow(tr("Lower limit:"),sVLower);
  6743. sVSection->addRow(tr("Upper limit:"),sVUpper);
  6744. sVSection->addRow(tr("Output set value:"),sVWritable);
  6745. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  6746. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  6747. setValueBox->setLayout(sVSection);
  6748. seriesLayout->addWidget(setValueBox);
  6749. masterLayout->addLayout(portAndDeviceLayout);
  6750. masterLayout->addLayout(seriesLayout);
  6751. form->setLayout(masterLayout);
  6752. /*656:*/
  6753. #line 15170 "./typica.w"
  6754. QDomElement referenceElement=
  6755. model->referenceElement(model->data(index,Qt::UserRole).toString());
  6756. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  6757. QDomElement node;
  6758. /*:656*/
  6759. #line 17708 "./typica.w"
  6760. for(int i= 0;i<configData.size();i++)
  6761. {
  6762. node= configData.at(i).toElement();
  6763. if(node.attribute("name")=="port")
  6764. {
  6765. QString portname= node.attribute("value");
  6766. int idx= port->findText(portname);
  6767. if(idx>=0)
  6768. {
  6769. port->setCurrentIndex(idx);
  6770. }
  6771. else
  6772. {
  6773. port->addItem(portname);
  6774. }
  6775. }
  6776. else if(node.attribute("name")=="baud")
  6777. {
  6778. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  6779. }
  6780. else if(node.attribute("name")=="parity")
  6781. {
  6782. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  6783. }
  6784. else if(node.attribute("name")=="flow")
  6785. {
  6786. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  6787. }
  6788. else if(node.attribute("name")=="stop")
  6789. {
  6790. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  6791. }
  6792. else if(node.attribute("name")=="station")
  6793. {
  6794. station->setValue(node.attribute("value").toInt());
  6795. }
  6796. else if(node.attribute("name")=="decimalQuery")
  6797. {
  6798. if(node.attribute("value")=="true")
  6799. {
  6800. decimalQuery->setChecked(true);
  6801. }
  6802. else
  6803. {
  6804. decimalQuery->setChecked(false);
  6805. }
  6806. }
  6807. else if(node.attribute("name")=="decimalAddress")
  6808. {
  6809. decimalAddress->setValue(node.attribute("value").toInt());
  6810. }
  6811. else if(node.attribute("name")=="decimalPosition")
  6812. {
  6813. decimalPosition->setValue(node.attribute("value").toInt());
  6814. }
  6815. else if(node.attribute("name")=="unitQuery")
  6816. {
  6817. if(node.attribute("value")=="true")
  6818. {
  6819. unitQuery->setChecked(true);
  6820. }
  6821. else
  6822. {
  6823. unitQuery->setChecked(false);
  6824. }
  6825. }
  6826. else if(node.attribute("name")=="unitAddress")
  6827. {
  6828. unitAddress->setValue(node.attribute("value").toInt());
  6829. }
  6830. else if(node.attribute("name")=="valueF")
  6831. {
  6832. valueF->setValue(node.attribute("value").toInt());
  6833. }
  6834. else if(node.attribute("name")=="valueC")
  6835. {
  6836. valueC->setValue(node.attribute("value").toInt());
  6837. }
  6838. else if(node.attribute("name")=="fixedUnit")
  6839. {
  6840. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  6841. }
  6842. else if(node.attribute("name")=="pVAddress")
  6843. {
  6844. pVAddress->setValue(node.attribute("value").toInt());
  6845. }
  6846. else if(node.attribute("name")=="sVEnabled")
  6847. {
  6848. if(node.attribute("value")=="true")
  6849. {
  6850. sVEnabled->setChecked(true);
  6851. }
  6852. else
  6853. {
  6854. sVEnabled->setChecked(false);
  6855. }
  6856. }
  6857. else if(node.attribute("name")=="sVReadAddress")
  6858. {
  6859. sVReadAddress->setValue(node.attribute("value").toInt());
  6860. }
  6861. else if(node.attribute("name")=="deviceLimit")
  6862. {
  6863. if(node.attribute("value")=="true")
  6864. {
  6865. deviceLimit->setChecked(true);
  6866. }
  6867. else
  6868. {
  6869. deviceLimit->setChecked(false);
  6870. }
  6871. }
  6872. else if(node.attribute("name")=="sVLowerAddr")
  6873. {
  6874. sVLowerAddr->setValue(node.attribute("value").toInt());
  6875. }
  6876. else if(node.attribute("name")=="sVUpperAddr")
  6877. {
  6878. sVUpperAddr->setValue(node.attribute("value").toInt());
  6879. }
  6880. else if(node.attribute("name")=="sVLower")
  6881. {
  6882. sVLower->setValue(node.attribute("value").toDouble());
  6883. }
  6884. else if(node.attribute("name")=="sVUpper")
  6885. {
  6886. sVUpper->setValue(node.attribute("value").toDouble());
  6887. }
  6888. else if(node.attribute("name")=="sVWritable")
  6889. {
  6890. if(node.attribute("value")=="true")
  6891. {
  6892. sVWritable->setChecked(true);
  6893. }
  6894. else
  6895. {
  6896. sVWritable->setChecked(false);
  6897. }
  6898. }
  6899. else if(node.attribute("name")=="sVOutputAddr")
  6900. {
  6901. sVOutputAddr->setValue(node.attribute("value").toInt());
  6902. }
  6903. else if(node.attribute("name")=="pvcolname")
  6904. {
  6905. pVColumnName->setText(node.attribute("value"));
  6906. }
  6907. else if(node.attribute("name")=="svcolname")
  6908. {
  6909. sVColumnName->setText(node.attribute("value"));
  6910. }
  6911. }
  6912. updatePort(port->currentText());
  6913. updateBaudRate(baud->currentText());
  6914. updateParity(parity->itemData(parity->currentIndex()).toString());
  6915. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  6916. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  6917. updateStation(station->value());
  6918. updateFixedDecimal(decimalQuery->isChecked());
  6919. updateDecimalAddress(decimalAddress->value());
  6920. updateDecimalPosition(decimalPosition->value());
  6921. updateFixedUnit(unitQuery->isChecked());
  6922. updateUnitAddress(unitAddress->value());
  6923. updateValueForF(valueF->value());
  6924. updateValueForC(valueC->value());
  6925. updateUnit(fixedUnit->currentText());
  6926. updatePVAddress(pVAddress->value());
  6927. updateSVEnabled(sVEnabled->isChecked());
  6928. updateSVReadAddress(sVReadAddress->value());
  6929. updateDeviceLimit(deviceLimit->isChecked());
  6930. updateSVLowerAddress(sVLowerAddr->value());
  6931. updateSVUpperAddress(sVUpperAddr->value());
  6932. updateSVLower(sVLower->value());
  6933. updateSVUpper(sVUpper->value());
  6934. updateSVWritable(sVWritable->isChecked());
  6935. updateSVWriteAddress(sVOutputAddr->value());
  6936. updatePVColumnName(pVColumnName->text());
  6937. updateSVColumnName(sVColumnName->text());
  6938. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  6939. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  6940. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  6941. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  6942. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  6943. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  6944. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  6945. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  6946. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  6947. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  6948. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  6949. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  6950. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  6951. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  6952. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  6953. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  6954. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  6955. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  6956. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  6957. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  6958. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  6959. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  6960. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  6961. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  6962. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  6963. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  6964. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  6965. layout->addWidget(form);
  6966. setLayout(layout);
  6967. }
  6968. void ModbusConfigurator::updatePort(const QString&newPort)
  6969. {
  6970. updateAttribute("port",newPort);
  6971. }
  6972. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  6973. {
  6974. updateAttribute("baud",newRate);
  6975. }
  6976. void ModbusConfigurator::updateParity(const QString&)
  6977. {
  6978. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  6979. }
  6980. void ModbusConfigurator::updateFlowControl(const QString&)
  6981. {
  6982. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  6983. }
  6984. void ModbusConfigurator::updateStopBits(const QString&)
  6985. {
  6986. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  6987. }
  6988. void ModbusConfigurator::updateStation(int station)
  6989. {
  6990. updateAttribute("station",QString("%1").arg(station));
  6991. }
  6992. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  6993. {
  6994. updateAttribute("decimalQuery",fixed?"true":"false");
  6995. }
  6996. void ModbusConfigurator::updateDecimalAddress(int address)
  6997. {
  6998. updateAttribute("decimalAddress",QString("%1").arg(address));
  6999. }
  7000. void ModbusConfigurator::updateDecimalPosition(int position)
  7001. {
  7002. updateAttribute("decimalPosition",QString("%1").arg(position));
  7003. }
  7004. void ModbusConfigurator::updateFixedUnit(bool fixed)
  7005. {
  7006. updateAttribute("unitQuery",fixed?"true":"false");
  7007. }
  7008. void ModbusConfigurator::updateUnitAddress(int address)
  7009. {
  7010. updateAttribute("unitAddress",QString("%1").arg(address));
  7011. }
  7012. void ModbusConfigurator::updateValueForF(int value)
  7013. {
  7014. updateAttribute("valueF",QString("%1").arg(value));
  7015. }
  7016. void ModbusConfigurator::updateValueForC(int value)
  7017. {
  7018. updateAttribute("valueC",QString("%1").arg(value));
  7019. }
  7020. void ModbusConfigurator::updateUnit(const QString&newUnit)
  7021. {
  7022. updateAttribute("fixedUnit",newUnit);
  7023. }
  7024. void ModbusConfigurator::updatePVAddress(int address)
  7025. {
  7026. updateAttribute("pVAddress",QString("%1").arg(address));
  7027. }
  7028. void ModbusConfigurator::updateSVEnabled(bool enabled)
  7029. {
  7030. updateAttribute("sVEnabled",enabled?"true":"false");
  7031. }
  7032. void ModbusConfigurator::updateSVReadAddress(int address)
  7033. {
  7034. updateAttribute("sVReadAddress",QString("%1").arg(address));
  7035. }
  7036. void ModbusConfigurator::updateDeviceLimit(bool query)
  7037. {
  7038. updateAttribute("deviceLimit",query?"true":"false");
  7039. }
  7040. void ModbusConfigurator::updateSVLowerAddress(int address)
  7041. {
  7042. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  7043. }
  7044. void ModbusConfigurator::updateSVUpperAddress(int address)
  7045. {
  7046. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  7047. }
  7048. void ModbusConfigurator::updateSVLower(double value)
  7049. {
  7050. updateAttribute("sVLower",QString("%1").arg(value));
  7051. }
  7052. void ModbusConfigurator::updateSVUpper(double value)
  7053. {
  7054. updateAttribute("sVUpper",QString("%1").arg(value));
  7055. }
  7056. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  7057. {
  7058. updateAttribute("sVWritable",canWriteSV?"true":"false");
  7059. }
  7060. void ModbusConfigurator::updateSVWriteAddress(int address)
  7061. {
  7062. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  7063. }
  7064. void ModbusConfigurator::updatePVColumnName(const QString&name)
  7065. {
  7066. updateAttribute("pvcolname",name);
  7067. }
  7068. void ModbusConfigurator::updateSVColumnName(const QString&name)
  7069. {
  7070. updateAttribute("svcolname",name);
  7071. }
  7072. /*:728*/
  7073. #line 810 "./typica.w"
  7074. /*691:*/
  7075. #line 15926 "./typica.w"
  7076. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  7077. {
  7078. setMinimum(0);
  7079. setMaximum(0xFFFF);
  7080. setPrefix("0x");
  7081. setMinimumWidth(65);
  7082. }
  7083. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  7084. {
  7085. if(input.size()==2)
  7086. {
  7087. return QValidator::Intermediate;
  7088. }
  7089. bool okay;
  7090. input.toInt(&okay,16);
  7091. if(okay)
  7092. {
  7093. return QValidator::Acceptable;
  7094. }
  7095. return QValidator::Invalid;
  7096. }
  7097. int ShortHexSpinBox::valueFromText(const QString&text)const
  7098. {
  7099. return text.toInt(NULL,16);
  7100. }
  7101. QString ShortHexSpinBox::textFromValue(int value)const
  7102. {
  7103. QString retval;
  7104. retval.setNum(value,16);
  7105. while(retval.size()<4)
  7106. {
  7107. retval.prepend("0");
  7108. }
  7109. return retval.toUpper();
  7110. }
  7111. /*:691*/
  7112. #line 811 "./typica.w"
  7113. /*713:*/
  7114. #line 16952 "./typica.w"
  7115. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  7116. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  7117. waiting(false)
  7118. {
  7119. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  7120. Qt::UserRole).toString());
  7121. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  7122. QDomElement node;
  7123. QVariantMap attributes;
  7124. for(int i= 0;i<portConfigData.size();i++)
  7125. {
  7126. node= portConfigData.at(i).toElement();
  7127. attributes.insert(node.attribute("name"),node.attribute("value"));
  7128. }
  7129. port= new QextSerialPort(attributes.value("port").toString(),
  7130. QextSerialPort::EventDriven);
  7131. int baudRate= attributes.value("baud").toInt();
  7132. port->setBaudRate((BaudRateType)baudRate);
  7133. double temp= ((double)(1)/(double)(baudRate))*48;
  7134. delayTime= (int)(temp*3000);
  7135. messageDelayTimer->setSingleShot(true);
  7136. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  7137. port->setDataBits(DATA_8);
  7138. port->setParity((ParityType)attributes.value("parity").toInt());
  7139. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  7140. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  7141. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  7142. port->open(QIODevice::ReadWrite);
  7143. station= (char)attributes.value("station").toInt();
  7144. if(attributes.value("decimalQuery")=="true")
  7145. {
  7146. decimalPosition= 0;
  7147. QByteArray message;
  7148. message.append(station);
  7149. message.append((char)0x03);
  7150. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  7151. char*addressBytes= (char*)&address;
  7152. message.append(addressBytes[1]);
  7153. message.append(addressBytes[0]);
  7154. message.append((char)0x00);
  7155. message.append((char)0x01);
  7156. queueMessage(message,this,"decimalResponse(QByteArray)");
  7157. }
  7158. else
  7159. {
  7160. decimalPosition= attributes.value("decimalPosition").toInt();
  7161. }
  7162. valueF= attributes.value("valueF").toInt();
  7163. valueC= attributes.value("valueC").toInt();
  7164. if(attributes.value("unitQuery")=="true")
  7165. {
  7166. QByteArray message;
  7167. message.append(station);
  7168. message.append((char)0x03);
  7169. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  7170. char*addressBytes= (char*)&address;
  7171. message.append(addressBytes[1]);
  7172. message.append(addressBytes[0]);
  7173. message.append((char)0x00);
  7174. message.append((char)0x01);
  7175. queueMessage(message,this,"unitResponse(QByteArray)");
  7176. }
  7177. else
  7178. {
  7179. if(attributes.value("fixedUnit")=="Celsius")
  7180. {
  7181. unitIsF= false;
  7182. }
  7183. }
  7184. if(attributes.value("sVWritable")=="true")
  7185. {
  7186. if(attributes.value("deviceLimit")=="true")
  7187. {
  7188. QByteArray lmessage;
  7189. lmessage.append(station);
  7190. lmessage.append((char)0x03);
  7191. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  7192. char*addressBytes= (char*)&laddress;
  7193. lmessage.append(addressBytes[1]);
  7194. lmessage.append(addressBytes[0]);
  7195. lmessage.append((char)0x00);
  7196. lmessage.append((char)0x01);
  7197. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  7198. QByteArray umessage;
  7199. umessage.append(station);
  7200. umessage.append((char)0x03);
  7201. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  7202. addressBytes= (char*)&uaddress;
  7203. umessage.append(addressBytes[1]);
  7204. umessage.append(addressBytes[0]);
  7205. umessage.append((char)0x00);
  7206. umessage.append((char)0x01);
  7207. queueMessage(umessage,this,"svuResponse(QByteArray)");
  7208. }
  7209. else
  7210. {
  7211. outputSVLower= attributes.value("sVLower").toDouble();
  7212. outputSVUpper= attributes.value("sVUpper").toDouble();
  7213. }
  7214. outputSVStub.append(station);
  7215. outputSVStub.append((char)0x06);
  7216. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  7217. char*addressBytes= (char*)&address;
  7218. outputSVStub.append(addressBytes[1]);
  7219. outputSVStub.append(addressBytes[0]);
  7220. }
  7221. Channel*pv= new Channel;
  7222. channels.append(pv);
  7223. pvStub.append(station);
  7224. pvStub.append((char)0x04);
  7225. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  7226. char*pvac= (char*)&pvaddress;
  7227. pvStub.append(pvac[1]);
  7228. pvStub.append(pvac[0]);
  7229. pvStub.append((char)0x00);
  7230. pvStub.append((char)0x01);
  7231. svenabled= attributes.value("sVEnabled").toBool();
  7232. if(svenabled)
  7233. {
  7234. Channel*sv= new Channel;
  7235. channels.append(sv);
  7236. svStub.append(station);
  7237. svStub.append((char)0x04);
  7238. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  7239. char*svac= (char*)&svaddress;
  7240. svStub.append(svac[1]);
  7241. svStub.append(svac[0]);
  7242. svStub.append((char)0x00);
  7243. svStub.append((char)0x01);
  7244. if(svaddress-pvaddress==1)
  7245. {
  7246. mStub.append(station);
  7247. mStub.append((char)0x04);
  7248. mStub.append(pvac[1]);
  7249. mStub.append(pvac[0]);
  7250. mStub.append((char)0x00);
  7251. mStub.append((char)0x02);
  7252. }
  7253. }
  7254. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  7255. requestMeasurement();
  7256. }
  7257. double ModbusRTUDevice::SVLower()
  7258. {
  7259. return outputSVLower;
  7260. }
  7261. double ModbusRTUDevice::SVUpper()
  7262. {
  7263. return outputSVUpper;
  7264. }
  7265. int ModbusRTUDevice::decimals()
  7266. {
  7267. return decimalPosition;
  7268. }
  7269. void ModbusRTUDevice::decimalResponse(QByteArray response)
  7270. {
  7271. quint16 temp;
  7272. char*tchar= (char*)&temp;
  7273. tchar[1]= response.at(3);
  7274. tchar[0]= response.at(4);
  7275. decimalPosition= temp;
  7276. emit SVDecimalChanged(decimalPosition);
  7277. qDebug()<<"Received decimal response";
  7278. }
  7279. void ModbusRTUDevice::unitResponse(QByteArray response)
  7280. {
  7281. quint16 temp;
  7282. char*tchar= (char*)&temp;
  7283. tchar[1]= response.at(3);
  7284. tchar[0]= response.at(4);
  7285. int value= temp;
  7286. if(value==valueF)
  7287. {
  7288. unitIsF= true;
  7289. }
  7290. else
  7291. {
  7292. unitIsF= false;
  7293. }
  7294. }
  7295. void ModbusRTUDevice::svlResponse(QByteArray response)
  7296. {
  7297. quint16 temp;
  7298. char*tchar= (char*)&temp;
  7299. tchar[1]= response.at(3);
  7300. tchar[0]= response.at(4);
  7301. outputSVLower= (double)temp;
  7302. for(int i= 0;i<decimalPosition;i++)
  7303. {
  7304. outputSVLower/= 10;
  7305. }
  7306. emit SVLowerChanged(outputSVLower);
  7307. }
  7308. void ModbusRTUDevice::svuResponse(QByteArray response)
  7309. {
  7310. quint16 temp;
  7311. char*tchar= (char*)&temp;
  7312. tchar[1]= response.at(3);
  7313. tchar[0]= response.at(4);
  7314. outputSVUpper= (double)temp;
  7315. for(int i= 0;i<decimalPosition;i++)
  7316. {
  7317. outputSVUpper/= 10;
  7318. }
  7319. emit SVUpperChanged(outputSVUpper);
  7320. }
  7321. void ModbusRTUDevice::requestMeasurement()
  7322. {
  7323. if(mStub.length()> 0)
  7324. {
  7325. queueMessage(mStub,this,"mResponse(QByteArray)");
  7326. }
  7327. else
  7328. {
  7329. queueMessage(pvStub,this,"mResponse(QByteArray)");
  7330. if(svenabled)
  7331. {
  7332. queueMessage(svStub,this,"mResponse(QByteArray)");
  7333. }
  7334. }
  7335. }
  7336. void ModbusRTUDevice::mResponse(QByteArray response)
  7337. {
  7338. QTime time= QTime::currentTime();
  7339. if(response.at(2)==0x04)
  7340. {
  7341. /*714:*/
  7342. #line 17201 "./typica.w"
  7343. quint16 pv;
  7344. quint16 sv;
  7345. char*pvBytes= (char*)&pv;
  7346. char*svBytes= (char*)&sv;
  7347. pvBytes[1]= response.at(3);
  7348. pvBytes[0]= response.at(4);
  7349. svBytes[1]= response.at(5);
  7350. svBytes[0]= response.at(6);
  7351. double pvOut= (double)pv;
  7352. double svOut= (double)sv;
  7353. for(int i= 0;i<decimalPosition;i++)
  7354. {
  7355. pvOut/= 10;
  7356. svOut/= 10;
  7357. }
  7358. if(!unitIsF)
  7359. {
  7360. pvOut= pvOut*9/5+32;
  7361. svOut= svOut*9/5+32;
  7362. }
  7363. Measurement pvm(pvOut,time,Measurement::Fahrenheit);
  7364. Measurement svm(svOut,time,Measurement::Fahrenheit);
  7365. channels.at(0)->input(pvm);
  7366. channels.at(1)->input(svm);
  7367. /*:714*/
  7368. #line 17188 "./typica.w"
  7369. }
  7370. else
  7371. {
  7372. /*715:*/
  7373. #line 17231 "./typica.w"
  7374. quint16 value;
  7375. char*valueBytes= (char*)&value;
  7376. valueBytes[1]= response.at(3);
  7377. valueBytes[0]= response.at(4);
  7378. double valueOut= (double)value;
  7379. for(int i= 0;i<decimalPosition;i++)
  7380. {
  7381. valueOut/= 10;
  7382. }
  7383. if(!unitIsF)
  7384. {
  7385. valueOut= valueOut*9/5+32;
  7386. }
  7387. if(!svenabled)
  7388. {
  7389. Measurement vm(valueOut,time,Measurement::Fahrenheit);
  7390. channels.at(0)->input(vm);
  7391. }
  7392. else
  7393. {
  7394. if(readingsv)
  7395. {
  7396. Measurement pvm(savedpv,time,Measurement::Fahrenheit);
  7397. Measurement svm(valueOut,time,Measurement::Fahrenheit);
  7398. channels.at(0)->input(pvm);
  7399. channels.at(1)->input(svm);
  7400. readingsv= false;
  7401. }
  7402. else
  7403. {
  7404. savedpv= valueOut;
  7405. readingsv= true;
  7406. }
  7407. }
  7408. /*:715*/
  7409. #line 17192 "./typica.w"
  7410. }
  7411. }
  7412. /*:713*//*716:*/
  7413. #line 17269 "./typica.w"
  7414. ModbusRTUDevice::~ModbusRTUDevice()
  7415. {
  7416. messageDelayTimer->stop();
  7417. port->close();
  7418. }
  7419. /*:716*//*717:*/
  7420. #line 17291 "./typica.w"
  7421. void ModbusRTUDevice::dataAvailable()
  7422. {
  7423. if(messageDelayTimer->isActive())
  7424. {
  7425. messageDelayTimer->stop();
  7426. }
  7427. responseBuffer.append(port->readAll());
  7428. /*718:*/
  7429. #line 17336 "./typica.w"
  7430. if(responseBuffer.size()<5)
  7431. {
  7432. return;
  7433. }
  7434. switch(responseBuffer.at(1))
  7435. {
  7436. case 0x01:
  7437. case 0x02:
  7438. if(responseBuffer.size()<6)
  7439. {
  7440. return;
  7441. }
  7442. responseBuffer= responseBuffer.left(6);
  7443. break;
  7444. case 0x03:
  7445. case 0x04:
  7446. if(responseBuffer.size()<5+responseBuffer.at(2))
  7447. {
  7448. return;
  7449. }
  7450. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  7451. break;
  7452. case 0x05:
  7453. case 0x06:
  7454. case 0x10:
  7455. if(responseBuffer.size()<8)
  7456. {
  7457. return;
  7458. }
  7459. responseBuffer= responseBuffer.left(8);
  7460. break;
  7461. }
  7462. /*:718*/
  7463. #line 17299 "./typica.w"
  7464. if(calculateCRC(responseBuffer)==0)
  7465. {
  7466. QObject*object= retObjQueue.at(0);
  7467. char*method= callbackQueue.at(0);
  7468. QMetaMethod metamethod= object->metaObject()->
  7469. method(object->metaObject()->
  7470. indexOfMethod(QMetaObject::normalizedSignature(method)));
  7471. metamethod.invoke(object,Qt::QueuedConnection,
  7472. Q_ARG(QByteArray,responseBuffer));
  7473. messageQueue.removeAt(0);
  7474. retObjQueue.removeAt(0);
  7475. callbackQueue.removeAt(0);
  7476. messageDelayTimer->start(delayTime);
  7477. }
  7478. else
  7479. {
  7480. qDebug()<<"CRC failed";
  7481. }
  7482. waiting= false;
  7483. responseBuffer.clear();
  7484. }
  7485. /*:717*//*719:*/
  7486. #line 17378 "./typica.w"
  7487. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  7488. {
  7489. quint16 retval= 0xFFFF;
  7490. int i= 0;
  7491. while(i<data.size())
  7492. {
  7493. retval^= 0x00FF&(quint16)data.at(i);
  7494. for(int j= 0;j<8;j++)
  7495. {
  7496. if(retval&1)
  7497. {
  7498. retval= (retval>>1)^0xA001;
  7499. }
  7500. else
  7501. {
  7502. retval>>= 1;
  7503. }
  7504. }
  7505. i++;
  7506. }
  7507. return retval;
  7508. }
  7509. /*:719*//*720:*/
  7510. #line 17409 "./typica.w"
  7511. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  7512. const char*callback)
  7513. {
  7514. messageQueue.append(request);
  7515. retObjQueue.append(object);
  7516. callbackQueue.append(const_cast<char*> (callback));
  7517. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  7518. {
  7519. sendNextMessage();
  7520. }
  7521. }
  7522. void ModbusRTUDevice::sendNextMessage()
  7523. {
  7524. if(messageQueue.size()> 0&&!waiting)
  7525. {
  7526. QByteArray message= messageQueue.at(0);
  7527. quint16 crc= calculateCRC(message);
  7528. char*check= (char*)&crc;
  7529. message.append(check[0]);
  7530. message.append(check[1]);
  7531. port->write(message);
  7532. messageDelayTimer->start(delayTime);
  7533. waiting= true;
  7534. }
  7535. else
  7536. {
  7537. emit queueEmpty();
  7538. }
  7539. }
  7540. void ModbusRTUDevice::outputSV(double value)
  7541. {
  7542. for(int i= 0;i<decimalPosition;i++)
  7543. {
  7544. value*= 10;
  7545. }
  7546. quint16 outval= (quint16)value;
  7547. QByteArray message(outputSVStub);
  7548. char*valBytes= (char*)&outval;
  7549. message.append(valBytes[1]);
  7550. message.append(valBytes[0]);
  7551. queueMessage(message,this,"ignore(QByteArray)");
  7552. }
  7553. /*:720*//*721:*/
  7554. #line 17457 "./typica.w"
  7555. void ModbusRTUDevice::ignore(QByteArray)
  7556. {
  7557. return;
  7558. }
  7559. /*:721*/
  7560. #line 812 "./typica.w"
  7561. /*611:*/
  7562. #line 14188 "./typica.w"
  7563. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  7564. DeviceTreeModelNode*parent)
  7565. :domNode(node),rowNumber(row),parentItem(parent)
  7566. {
  7567. }
  7568. DeviceTreeModelNode::~DeviceTreeModelNode()
  7569. {
  7570. QHash<int,DeviceTreeModelNode*> ::iterator i;
  7571. for(i= children.begin();i!=children.end();i++)
  7572. {
  7573. delete i.value();
  7574. }
  7575. }
  7576. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  7577. {
  7578. return parentItem;
  7579. }
  7580. int DeviceTreeModelNode::row()
  7581. {
  7582. return rowNumber;
  7583. }
  7584. QDomNode DeviceTreeModelNode::node()const
  7585. {
  7586. return domNode;
  7587. }
  7588. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  7589. {
  7590. if(children.contains(index))
  7591. {
  7592. return children[index];
  7593. }
  7594. if(index>=0&&index<domNode.childNodes().count())
  7595. {
  7596. QDomNode childNode= domNode.childNodes().item(index);
  7597. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  7598. index,this);
  7599. children[index]= childItem;
  7600. return childItem;
  7601. }
  7602. return NULL;
  7603. }
  7604. /*:611*/
  7605. #line 813 "./typica.w"
  7606. /*613:*/
  7607. #line 14277 "./typica.w"
  7608. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  7609. :QAbstractItemModel(parent)
  7610. {
  7611. document= AppInstance->deviceConfiguration();
  7612. QDomNodeList elements= document.elementsByTagName("devices");
  7613. if(elements.size()!=1)
  7614. {
  7615. qDebug()<<"Unexpected result when loading device map.";
  7616. }
  7617. treeRoot= elements.at(0);
  7618. root= new DeviceTreeModelNode(treeRoot,0);
  7619. elements= document.elementsByTagName("references");
  7620. if(elements.size()!=1)
  7621. {
  7622. qDebug()<<"No references section. Creating.";
  7623. referenceSection= document.createElement("references");
  7624. document.appendChild(referenceSection);
  7625. }
  7626. else
  7627. {
  7628. referenceSection= elements.at(0);
  7629. }
  7630. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  7631. AppInstance,SLOT(saveDeviceConfiguration()));
  7632. connect(this,SIGNAL(modelReset()),
  7633. AppInstance,SLOT(saveDeviceConfiguration()));
  7634. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7635. AppInstance,SLOT(saveDeviceConfiguration()));
  7636. }
  7637. /*:613*//*614:*/
  7638. #line 14312 "./typica.w"
  7639. int DeviceTreeModel::columnCount(const QModelIndex&)const
  7640. {
  7641. return 1;
  7642. }
  7643. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  7644. {
  7645. if(parent.column()> 0)
  7646. {
  7647. return 0;
  7648. }
  7649. /*615:*/
  7650. #line 14331 "./typica.w"
  7651. DeviceTreeModelNode*parentItem;
  7652. if(!parent.isValid())
  7653. {
  7654. parentItem= root;
  7655. }
  7656. else
  7657. {
  7658. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7659. }
  7660. /*:615*/
  7661. #line 14324 "./typica.w"
  7662. return parentItem->node().childNodes().count();
  7663. }
  7664. /*:614*//*616:*/
  7665. #line 14345 "./typica.w"
  7666. QModelIndex DeviceTreeModel::index(int row,int column,
  7667. const QModelIndex&parent)const
  7668. {
  7669. if(!hasIndex(row,column,parent))
  7670. {
  7671. return QModelIndex();
  7672. }
  7673. /*615:*/
  7674. #line 14331 "./typica.w"
  7675. DeviceTreeModelNode*parentItem;
  7676. if(!parent.isValid())
  7677. {
  7678. parentItem= root;
  7679. }
  7680. else
  7681. {
  7682. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7683. }
  7684. /*:615*/
  7685. #line 14353 "./typica.w"
  7686. DeviceTreeModelNode*childItem= parentItem->child(row);
  7687. if(childItem)
  7688. {
  7689. return createIndex(row,column,childItem);
  7690. }
  7691. return QModelIndex();
  7692. }
  7693. /*:616*//*617:*/
  7694. #line 14364 "./typica.w"
  7695. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  7696. {
  7697. if(!child.isValid())
  7698. {
  7699. return QModelIndex();
  7700. }
  7701. DeviceTreeModelNode*childItem=
  7702. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  7703. DeviceTreeModelNode*parentItem= childItem->parent();
  7704. if(!parentItem||parentItem==root)
  7705. {
  7706. return QModelIndex();
  7707. }
  7708. return createIndex(parentItem->row(),0,parentItem);
  7709. }
  7710. /*:617*//*618:*/
  7711. #line 14383 "./typica.w"
  7712. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  7713. {
  7714. if(!index.isValid())
  7715. {
  7716. return 0;
  7717. }
  7718. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  7719. }
  7720. /*:618*//*619:*/
  7721. #line 14398 "./typica.w"
  7722. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  7723. {
  7724. if(!index.isValid())
  7725. {
  7726. return QVariant();
  7727. }
  7728. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  7729. {
  7730. return QVariant();
  7731. }
  7732. DeviceTreeModelNode*item=
  7733. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7734. QDomNode node= item->node();
  7735. QDomElement element= node.toElement();
  7736. switch(role)
  7737. {
  7738. case Qt::DisplayRole:
  7739. case Qt::EditRole:
  7740. return QVariant(element.attribute("name"));
  7741. case Qt::UserRole:
  7742. return QVariant(element.attribute("reference"));
  7743. default:
  7744. return QVariant();
  7745. }
  7746. return QVariant();
  7747. }
  7748. /*:619*//*620:*/
  7749. #line 14430 "./typica.w"
  7750. bool DeviceTreeModel::setData(const QModelIndex&index,
  7751. const QVariant&value,int)
  7752. {
  7753. if(!index.isValid())
  7754. {
  7755. return false;
  7756. }
  7757. DeviceTreeModelNode*item=
  7758. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7759. QDomNode node= item->node();
  7760. QDomElement element= node.toElement();
  7761. element.setAttribute("name",value.toString());
  7762. emit dataChanged(index,index);
  7763. return true;
  7764. }
  7765. /*:620*//*621:*/
  7766. #line 14453 "./typica.w"
  7767. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  7768. const QModelIndex&parent)
  7769. {
  7770. QString referenceID= QUuid::createUuid().toString();
  7771. /*615:*/
  7772. #line 14331 "./typica.w"
  7773. DeviceTreeModelNode*parentItem;
  7774. if(!parent.isValid())
  7775. {
  7776. parentItem= root;
  7777. }
  7778. else
  7779. {
  7780. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7781. }
  7782. /*:615*/
  7783. #line 14458 "./typica.w"
  7784. QDomNode parentNode= parentItem->node();
  7785. int newRowNumber= rowCount(parent);
  7786. beginInsertRows(parent,newRowNumber,newRowNumber);
  7787. QDomElement deviceElement= document.createElement("node");
  7788. deviceElement.setAttribute("name",name);
  7789. deviceElement.setAttribute("reference",referenceID);
  7790. parentNode.appendChild(deviceElement);
  7791. QDomElement referenceElement= document.createElement("reference");
  7792. referenceElement.setAttribute("id",referenceID);
  7793. referenceElement.setAttribute("driver",driver);
  7794. referenceSection.appendChild(referenceElement);
  7795. endInsertRows();
  7796. }
  7797. /*:621*//*622:*/
  7798. #line 14476 "./typica.w"
  7799. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  7800. {
  7801. /*615:*/
  7802. #line 14331 "./typica.w"
  7803. DeviceTreeModelNode*parentItem;
  7804. if(!parent.isValid())
  7805. {
  7806. parentItem= root;
  7807. }
  7808. else
  7809. {
  7810. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7811. }
  7812. /*:615*/
  7813. #line 14479 "./typica.w"
  7814. QDomNode parentNode= parentItem->node();
  7815. QDomNodeList childNodes= parentNode.childNodes();
  7816. if(childNodes.size()<row+count)
  7817. {
  7818. return false;
  7819. }
  7820. beginRemoveRows(parent,row,row+count-1);
  7821. QList<QDomElement> removalList;
  7822. for(int i= row;i<row+count;i++)
  7823. {
  7824. removalList.append(childNodes.at(i).toElement());
  7825. }
  7826. QDomElement element;
  7827. QDomElement reference;
  7828. for(int i= 0;i<count;i++)
  7829. {
  7830. element= removalList.at(i);
  7831. if(element.hasAttribute("reference"))
  7832. {
  7833. reference= referenceElement(element.attribute("reference"));
  7834. if(!reference.isNull())
  7835. {
  7836. referenceSection.removeChild(reference);
  7837. }
  7838. }
  7839. parentNode.removeChild(element);
  7840. }
  7841. endRemoveRows();
  7842. beginResetModel();
  7843. delete root;
  7844. root= new DeviceTreeModelNode(treeRoot,0);
  7845. endResetModel();
  7846. return true;
  7847. }
  7848. /*:622*//*623:*/
  7849. #line 14518 "./typica.w"
  7850. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  7851. {
  7852. QDomNodeList childNodes= referenceSection.childNodes();
  7853. QDomElement element;
  7854. for(int i= 0;i<childNodes.size();i++)
  7855. {
  7856. element= childNodes.at(i).toElement();
  7857. if(element.hasAttribute("id"))
  7858. {
  7859. if(element.attribute("id")==id)
  7860. {
  7861. return element;
  7862. }
  7863. }
  7864. }
  7865. return QDomElement();
  7866. }
  7867. /*:623*//*624:*/
  7868. #line 14539 "./typica.w"
  7869. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  7870. {
  7871. return QVariant();
  7872. }
  7873. /*:624*//*625:*/
  7874. #line 14548 "./typica.w"
  7875. DeviceTreeModel::~DeviceTreeModel()
  7876. {
  7877. delete root;
  7878. }
  7879. /*:625*/
  7880. #line 814 "./typica.w"
  7881. /*651:*/
  7882. #line 15018 "./typica.w"
  7883. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  7884. DeviceTreeModel*model,const QModelIndex&index)
  7885. :QWidget(NULL),deviceModel(model),currentNode(index)
  7886. {
  7887. }
  7888. /*:651*//*652:*/
  7889. #line 15030 "./typica.w"
  7890. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  7891. const QString&value)
  7892. {
  7893. QDomElement referenceElement= deviceModel->referenceElement(
  7894. deviceModel->data(currentNode,Qt::UserRole).toString());
  7895. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7896. QDomElement node;
  7897. bool found= false;
  7898. for(int i= 0;i<configData.size();i++)
  7899. {
  7900. node= configData.at(i).toElement();
  7901. if(node.attribute("name")==name)
  7902. {
  7903. node.setAttribute("value",value);
  7904. found= true;
  7905. break;
  7906. }
  7907. }
  7908. if(!found)
  7909. {
  7910. node= AppInstance->deviceConfiguration().createElement("attribute");
  7911. node.setAttribute("name",name);
  7912. node.setAttribute("value",value);
  7913. referenceElement.appendChild(node);
  7914. }
  7915. AppInstance->saveDeviceConfiguration();
  7916. }
  7917. /*:652*//*653:*/
  7918. #line 15064 "./typica.w"
  7919. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  7920. const QString&driver)
  7921. {
  7922. deviceModel->newNode(name,driver,currentNode);
  7923. }
  7924. /*:653*/
  7925. #line 815 "./typica.w"
  7926. /*643:*/
  7927. #line 14886 "./typica.w"
  7928. DeviceConfigurationWindow::DeviceConfigurationWindow():QMainWindow(NULL),
  7929. view(new QTreeView),configArea(new QScrollArea)
  7930. {
  7931. QSplitter*splitter= new QSplitter;
  7932. QWidget*leftWidget= new QWidget;
  7933. leftWidget->setMinimumWidth(200);
  7934. QVBoxLayout*left= new QVBoxLayout;
  7935. view->setAnimated(true);
  7936. view->setSelectionMode(QAbstractItemView::SingleSelection);
  7937. document= AppInstance->deviceConfiguration();
  7938. model= new DeviceTreeModel;
  7939. view->setModel(model);
  7940. view->expandAll();
  7941. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  7942. QHBoxLayout*treeButtons= new QHBoxLayout;
  7943. QToolButton*addDeviceButton= new QToolButton;
  7944. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  7945. addDeviceButton->setToolTip(tr("New Roaster"));
  7946. connect(addDeviceButton,SIGNAL(clicked()),
  7947. this,SLOT(addDevice()));
  7948. QToolButton*removeNodeButton= new QToolButton;
  7949. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  7950. removeNodeButton->setToolTip(tr("Delete Selection"));
  7951. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  7952. treeButtons->addWidget(addDeviceButton);
  7953. treeButtons->addWidget(removeNodeButton);
  7954. left->addWidget(view);
  7955. left->addLayout(treeButtons);
  7956. leftWidget->setLayout(left);
  7957. splitter->addWidget(leftWidget);
  7958. configArea->setMinimumWidth(580);
  7959. configArea->setMinimumHeight(460);
  7960. splitter->addWidget(configArea);
  7961. setCentralWidget(splitter);
  7962. connect(view,SIGNAL(activated(QModelIndex)),
  7963. this,SLOT(newSelection(QModelIndex)));
  7964. connect(view,SIGNAL(clicked(QModelIndex)),
  7965. this,SLOT(newSelection(QModelIndex)));
  7966. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7967. view,SLOT(expand(QModelIndex)));
  7968. }
  7969. /*:643*//*644:*/
  7970. #line 14932 "./typica.w"
  7971. void DeviceConfigurationWindow::addDevice()
  7972. {
  7973. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  7974. }
  7975. /*:644*//*645:*/
  7976. #line 14940 "./typica.w"
  7977. void DeviceConfigurationWindow::removeNode()
  7978. {
  7979. QModelIndex index= view->currentIndex();
  7980. if(index.isValid())
  7981. {
  7982. int row= index.row();
  7983. QModelIndex parent= index.parent();
  7984. model->removeRow(row,parent);
  7985. }
  7986. }
  7987. /*:645*//*646:*/
  7988. #line 14956 "./typica.w"
  7989. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  7990. {
  7991. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  7992. if(editor)
  7993. {
  7994. configArea->setWidget(editor);
  7995. editor->show();
  7996. }
  7997. }
  7998. /*:646*/
  7999. #line 816 "./typica.w"
  8000. /*666:*/
  8001. #line 15360 "./typica.w"
  8002. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  8003. const QModelIndex&index):
  8004. BasicDeviceConfigurationWidget(model,index)
  8005. {
  8006. QFormLayout*layout= new QFormLayout;
  8007. QLineEdit*columnName= new QLineEdit;
  8008. layout->addRow(tr("Column Name:"),columnName);
  8009. QComboBox*typeSelector= new QComboBox;
  8010. typeSelector->addItem("J");
  8011. typeSelector->addItem("K");
  8012. typeSelector->addItem("T");
  8013. typeSelector->addItem("B");
  8014. typeSelector->addItem("E");
  8015. typeSelector->addItem("N");
  8016. typeSelector->addItem("R");
  8017. typeSelector->addItem("S");
  8018. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8019. setLayout(layout);
  8020. /*656:*/
  8021. #line 15170 "./typica.w"
  8022. QDomElement referenceElement=
  8023. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8024. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8025. QDomElement node;
  8026. /*:656*/
  8027. #line 15379 "./typica.w"
  8028. for(int i= 0;i<configData.size();i++)
  8029. {
  8030. node= configData.at(i).toElement();
  8031. if(node.attribute("name")=="type")
  8032. {
  8033. typeSelector->setCurrentIndex(
  8034. typeSelector->findText(node.attribute("value")));
  8035. }
  8036. else if(node.attribute("name")=="columnname")
  8037. {
  8038. columnName->setText(node.attribute("value"));
  8039. }
  8040. }
  8041. updateThermocoupleType(typeSelector->currentText());
  8042. updateColumnName(columnName->text());
  8043. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  8044. this,SLOT(updateThermocoupleType(QString)));
  8045. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8046. }
  8047. /*:666*//*667:*/
  8048. #line 15403 "./typica.w"
  8049. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  8050. {
  8051. updateAttribute("type",type);
  8052. }
  8053. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  8054. {
  8055. updateAttribute("columnname",name);
  8056. }
  8057. /*:667*/
  8058. #line 817 "./typica.w"
  8059. /*662:*/
  8060. #line 15275 "./typica.w"
  8061. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  8062. const QModelIndex&index)
  8063. :BasicDeviceConfigurationWidget(model,index)
  8064. {
  8065. QVBoxLayout*layout= new QVBoxLayout;
  8066. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8067. QLabel*label= new QLabel(tr("Device ID:"));
  8068. QLineEdit*deviceId= new QLineEdit;
  8069. deviceIdLayout->addWidget(label);
  8070. deviceIdLayout->addWidget(deviceId);
  8071. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8072. layout->addLayout(deviceIdLayout);
  8073. layout->addWidget(addChannelButton);
  8074. /*656:*/
  8075. #line 15170 "./typica.w"
  8076. QDomElement referenceElement=
  8077. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8078. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8079. QDomElement node;
  8080. /*:656*/
  8081. #line 15289 "./typica.w"
  8082. for(int i= 0;i<configData.size();i++)
  8083. {
  8084. node= configData.at(i).toElement();
  8085. if(node.attribute("name")=="deviceID")
  8086. {
  8087. deviceId->setText(node.attribute("value","Dev1"));
  8088. break;
  8089. }
  8090. }
  8091. updateDeviceId(deviceId->text());
  8092. connect(addChannelButton,SIGNAL(clicked()),
  8093. this,SLOT(addChannel()));
  8094. connect(deviceId,SIGNAL(textEdited(QString)),
  8095. this,SLOT(updateDeviceId(QString)));
  8096. setLayout(layout);
  8097. }
  8098. /*:662*//*663:*/
  8099. #line 15311 "./typica.w"
  8100. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  8101. {
  8102. updateAttribute("deviceID",newId);
  8103. }
  8104. /*:663*//*664:*/
  8105. #line 15319 "./typica.w"
  8106. void NiDaqMxBase9211ConfWidget::addChannel()
  8107. {
  8108. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8109. }
  8110. /*:664*/
  8111. #line 818 "./typica.w"
  8112. /*660:*/
  8113. #line 15226 "./typica.w"
  8114. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  8115. DeviceTreeModel*model,const QModelIndex&index):
  8116. BasicDeviceConfigurationWidget(model,index)
  8117. {
  8118. QHBoxLayout*layout= new QHBoxLayout;
  8119. QToolButton*addDeviceButton= new QToolButton;
  8120. addDeviceButton->setText(tr("Add Device"));
  8121. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  8122. "nidaqmxbase9211series");
  8123. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8124. "nidaqmxbase9211series");
  8125. connect(add9211,SIGNAL(triggered(QString,QString)),
  8126. this,SLOT(insertChildNode(QString,QString)));
  8127. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8128. this,SLOT(insertChildNode(QString,QString)));
  8129. QMenu*deviceMenu= new QMenu;
  8130. deviceMenu->addAction(add9211);
  8131. deviceMenu->addAction(add9211a);
  8132. addDeviceButton->setMenu(deviceMenu);
  8133. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8134. layout->addWidget(addDeviceButton);
  8135. setLayout(layout);
  8136. }
  8137. /*:660*/
  8138. #line 819 "./typica.w"
  8139. /*549:*/
  8140. #line 12813 "./typica.w"
  8141. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  8142. QObject*parent):
  8143. QAction(reportName,parent),reportFile(fileName)
  8144. {
  8145. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  8146. }
  8147. /*:549*//*550:*/
  8148. #line 12829 "./typica.w"
  8149. void ReportAction::createReport()
  8150. {
  8151. QFile file(reportFile);
  8152. QDomDocument document;
  8153. if(file.open(QIODevice::ReadOnly))
  8154. {
  8155. document.setContent(&file,true);
  8156. QDomElement element= document.documentElement();
  8157. QScriptEngine*engine= AppInstance->engine;
  8158. QScriptContext*context= engine->pushContext();
  8159. QScriptValue object;
  8160. QString targetID= reportFile;
  8161. /*162:*/
  8162. #line 3897 "./typica.w"
  8163. ScriptQMainWindow*window= new ScriptQMainWindow;
  8164. window->setObjectName(targetID);
  8165. object= engine->newQObject(window);
  8166. setQMainWindowProperties(object,engine);
  8167. QWidget*central= new(QWidget);
  8168. central->setParent(window);
  8169. central->setObjectName("centralWidget");
  8170. window->setCentralWidget(central);
  8171. if(element.hasChildNodes())
  8172. {
  8173. /*163:*/
  8174. #line 3932 "./typica.w"
  8175. QStack<QWidget*> widgetStack;
  8176. QStack<QLayout*> layoutStack;
  8177. QString windowScript;
  8178. widgetStack.push(central);
  8179. QDomNodeList windowChildren= element.childNodes();
  8180. int i= 0;
  8181. while(i<windowChildren.count())
  8182. {
  8183. QDomNode current;
  8184. QDomElement element;
  8185. current= windowChildren.at(i);
  8186. if(current.isElement())
  8187. {
  8188. element= current.toElement();
  8189. if(element.tagName()=="program")
  8190. {
  8191. windowScript.append(element.text());
  8192. }
  8193. else if(element.tagName()=="layout")
  8194. {
  8195. addLayoutToWidget(element,&widgetStack,&layoutStack);
  8196. }
  8197. else if(element.tagName()=="menu")
  8198. {
  8199. /*164:*/
  8200. #line 3979 "./typica.w"
  8201. QMenuBar*bar= window->menuBar();
  8202. bar->setParent(window);
  8203. bar->setObjectName("menuBar");
  8204. if(element.hasAttribute("name"))
  8205. {
  8206. QMenu*menu= bar->addMenu(element.attribute("name"));
  8207. menu->setParent(bar);
  8208. if(element.hasAttribute("type"))
  8209. {
  8210. if(element.attribute("type")=="reports")
  8211. {
  8212. if(element.hasAttribute("src"))
  8213. {
  8214. /*547:*/
  8215. #line 12776 "./typica.w"
  8216. QSettings settings;
  8217. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  8218. arg(element.attribute("src")));
  8219. directory.setFilter(QDir::Files);
  8220. directory.setSorting(QDir::Name);
  8221. QStringList nameFilter;
  8222. nameFilter<<"*.xml";
  8223. directory.setNameFilters(nameFilter);
  8224. QFileInfoList reportFiles= directory.entryInfoList();
  8225. for(int i= 0;i<reportFiles.size();i++)
  8226. {
  8227. QFileInfo reportFile= reportFiles.at(i);
  8228. /*551:*/
  8229. #line 12853 "./typica.w"
  8230. QString path= reportFile.absoluteFilePath();
  8231. QFile file(path);
  8232. if(file.open(QIODevice::ReadOnly))
  8233. {
  8234. QDomDocument document;
  8235. document.setContent(&file,true);
  8236. QDomElement root= document.documentElement();
  8237. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  8238. if(!titleNode.isNull())
  8239. {
  8240. QDomElement titleElement= titleNode.toElement();
  8241. QString title= titleElement.text();
  8242. if(!title.isEmpty())
  8243. {
  8244. QStringList hierarchy= title.split(":->");
  8245. QMenu*insertionPoint= menu;
  8246. /*552:*/
  8247. #line 12880 "./typica.w"
  8248. for(int j= 0;j<hierarchy.size()-1;j++)
  8249. {
  8250. QObjectList menuList= insertionPoint->children();
  8251. bool menuFound= false;
  8252. for(int k= 0;k<menuList.size();k++)
  8253. {
  8254. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  8255. if(currentItem)
  8256. {
  8257. if(currentItem->title()==hierarchy.at(j))
  8258. {
  8259. menuFound= true;
  8260. insertionPoint= currentItem;
  8261. break;
  8262. }
  8263. }
  8264. }
  8265. if(!menuFound)
  8266. {
  8267. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  8268. }
  8269. }
  8270. /*:552*/
  8271. #line 12870 "./typica.w"
  8272. ReportAction*action= new ReportAction(path,hierarchy.last());
  8273. insertionPoint->addAction(action);
  8274. }
  8275. }
  8276. }
  8277. /*:551*/
  8278. #line 12789 "./typica.w"
  8279. }
  8280. /*:547*/
  8281. #line 3993 "./typica.w"
  8282. }
  8283. }
  8284. }
  8285. if(element.hasChildNodes())
  8286. {
  8287. /*165:*/
  8288. #line 4006 "./typica.w"
  8289. QDomNodeList menuItems= element.childNodes();
  8290. int j= 0;
  8291. while(j<menuItems.count())
  8292. {
  8293. QDomNode item= menuItems.at(j);
  8294. if(item.isElement())
  8295. {
  8296. QDomElement itemElement= item.toElement();
  8297. if(itemElement.tagName()=="item")
  8298. {
  8299. QAction*itemAction= new QAction(itemElement.text(),menu);
  8300. if(itemElement.hasAttribute("id"))
  8301. {
  8302. itemAction->setObjectName(itemElement.attribute("id"));
  8303. }
  8304. if(itemElement.hasAttribute("shortcut"))
  8305. {
  8306. itemAction->setShortcut(itemElement.attribute("shortcut"));
  8307. }
  8308. menu->addAction(itemAction);
  8309. }
  8310. else if(itemElement.tagName()=="separator")
  8311. {
  8312. menu->addSeparator();
  8313. }
  8314. }
  8315. j++;
  8316. }
  8317. #line 1 "./helpmenu.w"
  8318. /*:165*/
  8319. #line 3999 "./typica.w"
  8320. }
  8321. }
  8322. /*:164*/
  8323. #line 3957 "./typica.w"
  8324. }
  8325. }
  8326. i++;
  8327. }
  8328. QScriptValue oldThis= context->thisObject();
  8329. context->setThisObject(object);
  8330. QScriptValue result= engine->evaluate(windowScript);
  8331. /*157:*/
  8332. #line 3746 "./typica.w"
  8333. if(engine->hasUncaughtException())
  8334. {
  8335. int line= engine->uncaughtExceptionLineNumber();
  8336. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  8337. result.toString();
  8338. QString trace;
  8339. foreach(trace,engine->uncaughtExceptionBacktrace())
  8340. {
  8341. qDebug()<<trace;
  8342. }
  8343. }
  8344. /*:157*/
  8345. #line 3965 "./typica.w"
  8346. context->setThisObject(oldThis);
  8347. /*:163*/
  8348. #line 3908 "./typica.w"
  8349. }
  8350. /*166:*/
  8351. #line 9 "./helpmenu.w"
  8352. HelpMenu*helpMenu= new HelpMenu();
  8353. window->menuBar()->addMenu(helpMenu);
  8354. /*:166*/
  8355. #line 3910 "./typica.w"
  8356. window->show();
  8357. /*:162*/
  8358. #line 12842 "./typica.w"
  8359. file.close();
  8360. engine->popContext();
  8361. }
  8362. }
  8363. /*:550*/
  8364. #line 820 "./typica.w"
  8365. /*198:*/
  8366. #line 5054 "./typica.w"
  8367. NumericDelegate::NumericDelegate(QObject*parent):
  8368. QItemDelegate(parent)
  8369. {
  8370. }
  8371. /*:198*//*199:*/
  8372. #line 5066 "./typica.w"
  8373. void NumericDelegate::setEditorData(QWidget*editor,
  8374. const QModelIndex&index)const
  8375. {
  8376. QString value= index.model()->data(index,Qt::EditRole).toString();
  8377. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8378. line->setText(value);
  8379. }
  8380. /*:199*//*200:*/
  8381. #line 5081 "./typica.w"
  8382. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  8383. const QModelIndex&index)const
  8384. {
  8385. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8386. model->setData(index,line->text(),Qt::EditRole);
  8387. QScriptEngine*engine= AppInstance->engine;
  8388. engine->pushContext();
  8389. QString script= QString("Number(%1)").arg(line->text());
  8390. QScriptValue result= engine->evaluate(line->text());
  8391. if(result.isNumber())
  8392. {
  8393. model->setData(index,result.toVariant(),Qt::DisplayRole);
  8394. }
  8395. else
  8396. {
  8397. model->setData(index,QVariant(),Qt::DisplayRole);
  8398. }
  8399. engine->popContext();
  8400. }
  8401. /*:200*//*201:*/
  8402. #line 5104 "./typica.w"
  8403. QWidget*NumericDelegate::createEditor(QWidget*parent,
  8404. const QStyleOptionViewItem&,
  8405. const QModelIndex&)const
  8406. {
  8407. return(new QLineEdit(parent));
  8408. }
  8409. /*:201*//*202:*/
  8410. #line 5115 "./typica.w"
  8411. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  8412. const QStyleOptionViewItem&option,
  8413. const QModelIndex&)const
  8414. {
  8415. editor->setGeometry(option.rect);
  8416. }
  8417. /*:202*/
  8418. #line 821 "./typica.w"
  8419. /*671:*/
  8420. #line 15457 "./typica.w"
  8421. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  8422. const QModelIndex&index)
  8423. :BasicDeviceConfigurationWidget(model,index)
  8424. {
  8425. QHBoxLayout*layout= new QHBoxLayout;
  8426. QToolButton*addDeviceButton= new QToolButton;
  8427. addDeviceButton->setText(tr("Add Device"));
  8428. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8429. "nidaqmx9211series");
  8430. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  8431. "nidaqmxtc01");
  8432. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8433. this,SLOT(insertChildNode(QString,QString)));
  8434. connect(addtc01,SIGNAL(triggered(QString,QString)),
  8435. this,SLOT(insertChildNode(QString,QString)));
  8436. QMenu*deviceMenu= new QMenu;
  8437. deviceMenu->addAction(add9211a);
  8438. deviceMenu->addAction(addtc01);
  8439. addDeviceButton->setMenu(deviceMenu);
  8440. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8441. layout->addWidget(addDeviceButton);
  8442. setLayout(layout);
  8443. }
  8444. /*:671*/
  8445. #line 822 "./typica.w"
  8446. /*673:*/
  8447. #line 15506 "./typica.w"
  8448. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  8449. const QModelIndex&index)
  8450. :BasicDeviceConfigurationWidget(model,index)
  8451. {
  8452. QVBoxLayout*layout= new QVBoxLayout;
  8453. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8454. QLabel*label= new QLabel(tr("Device ID:"));
  8455. QLineEdit*deviceId= new QLineEdit;
  8456. deviceIdLayout->addWidget(label);
  8457. deviceIdLayout->addWidget(deviceId);
  8458. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8459. layout->addLayout(deviceIdLayout);
  8460. layout->addWidget(addChannelButton);
  8461. /*656:*/
  8462. #line 15170 "./typica.w"
  8463. QDomElement referenceElement=
  8464. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8465. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8466. QDomElement node;
  8467. /*:656*/
  8468. #line 15520 "./typica.w"
  8469. for(int i= 0;i<configData.size();i++)
  8470. {
  8471. node= configData.at(i).toElement();
  8472. if(node.attribute("name")=="deviceID")
  8473. {
  8474. deviceId->setText(node.attribute("value","Dev1"));
  8475. break;
  8476. }
  8477. }
  8478. updateDeviceId(deviceId->text());
  8479. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  8480. connect(deviceId,SIGNAL(textEdited(QString)),
  8481. this,SLOT(updateDeviceId(QString)));
  8482. setLayout(layout);
  8483. }
  8484. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  8485. {
  8486. updateAttribute("deviceID",newId);
  8487. }
  8488. void NiDaqMx9211ConfWidget::addChannel()
  8489. {
  8490. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8491. }
  8492. /*:673*/
  8493. #line 823 "./typica.w"
  8494. /*675:*/
  8495. #line 15570 "./typica.w"
  8496. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  8497. const QModelIndex&index)
  8498. :BasicDeviceConfigurationWidget(model,index)
  8499. {
  8500. QFormLayout*layout= new QFormLayout;
  8501. QLineEdit*deviceId= new QLineEdit;
  8502. layout->addRow(tr("Device ID:"),deviceId);
  8503. QLineEdit*columnName= new QLineEdit;
  8504. layout->addRow(tr("Column Name:"),columnName);
  8505. QComboBox*typeSelector= new QComboBox;
  8506. typeSelector->addItem("J");
  8507. typeSelector->addItem("K");
  8508. typeSelector->addItem("T");
  8509. typeSelector->addItem("B");
  8510. typeSelector->addItem("E");
  8511. typeSelector->addItem("N");
  8512. typeSelector->addItem("R");
  8513. typeSelector->addItem("S");
  8514. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8515. /*656:*/
  8516. #line 15170 "./typica.w"
  8517. QDomElement referenceElement=
  8518. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8519. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8520. QDomElement node;
  8521. /*:656*/
  8522. #line 15590 "./typica.w"
  8523. for(int i= 0;i<configData.size();i++)
  8524. {
  8525. node= configData.at(i).toElement();
  8526. if(node.attribute("name")=="deviceID")
  8527. {
  8528. deviceId->setText(node.attribute("value"));
  8529. }
  8530. else if(node.attribute("name")=="type")
  8531. {
  8532. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  8533. }
  8534. else if(node.attribute("name")=="columnname")
  8535. {
  8536. columnName->setText(node.attribute("value"));
  8537. }
  8538. }
  8539. updateDeviceId(deviceId->text());
  8540. updateThermocoupleType(typeSelector->currentText());
  8541. updateColumnName(columnName->text());
  8542. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  8543. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  8544. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8545. setLayout(layout);
  8546. }
  8547. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  8548. {
  8549. updateAttribute("deviceID",newId);
  8550. }
  8551. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  8552. {
  8553. updateAttribute("type",type);
  8554. }
  8555. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  8556. {
  8557. updateAttribute("columnname",name);
  8558. }
  8559. /*:675*/
  8560. #line 824 "./typica.w"
  8561. /*693:*/
  8562. #line 15991 "./typica.w"
  8563. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  8564. const QModelIndex&index)
  8565. :BasicDeviceConfigurationWidget(model,index)
  8566. {
  8567. QFormLayout*layout= new QFormLayout;
  8568. QToolButton*addDeviceButton= new QToolButton;
  8569. addDeviceButton->setText(tr("Add Device"));
  8570. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  8571. "Modbus RTU Device",
  8572. "modbusrtudevice");
  8573. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  8574. this,SLOT(insertChildNode(QString,QString)));
  8575. QMenu*deviceMenu= new QMenu;
  8576. deviceMenu->addAction(addModbusRtuDevice);
  8577. addDeviceButton->setMenu(deviceMenu);
  8578. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8579. layout->addRow(QString(),addDeviceButton);
  8580. PortSelector*port= new PortSelector;
  8581. layout->addRow(tr("Port:"),port);
  8582. connect(port,SIGNAL(currentIndexChanged(QString)),
  8583. this,SLOT(updatePort(QString)));
  8584. connect(port,SIGNAL(editTextChanged(QString)),
  8585. this,SLOT(updatePort(QString)));
  8586. BaudSelector*rate= new BaudSelector;
  8587. layout->addRow(tr("Baud:"),rate);
  8588. connect(rate,SIGNAL(currentIndexChanged(QString)),
  8589. this,SLOT(updateBaudRate(QString)));
  8590. ParitySelector*parity= new ParitySelector;
  8591. layout->addRow(tr("Parity:"),parity);
  8592. connect(parity,SIGNAL(currentIndexChanged(QString)),
  8593. this,SLOT(updateParity(QString)));
  8594. FlowSelector*flow= new FlowSelector;
  8595. layout->addRow(tr("Flow Control:"),flow);
  8596. connect(flow,SIGNAL(currentIndexChanged(QString)),
  8597. this,SLOT(updateFlowControl(QString)));
  8598. StopSelector*stop= new StopSelector;
  8599. layout->addRow(tr("Stop Bits:"),stop);
  8600. connect(stop,SIGNAL(currentIndexChanged(QString)),
  8601. this,SLOT(updateStopBits(QString)));
  8602. /*656:*/
  8603. #line 15170 "./typica.w"
  8604. QDomElement referenceElement=
  8605. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8606. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8607. QDomElement node;
  8608. /*:656*/
  8609. #line 16031 "./typica.w"
  8610. for(int i= 0;i<configData.size();i++)
  8611. {
  8612. node= configData.at(i).toElement();
  8613. if(node.attribute("name")=="port")
  8614. {
  8615. int j= port->findText(node.attribute("value"));
  8616. if(j>=0)
  8617. {
  8618. port->setCurrentIndex(j);
  8619. }
  8620. else
  8621. {
  8622. port->insertItem(0,node.attribute("value"));
  8623. port->setCurrentIndex(0);
  8624. }
  8625. }
  8626. else if(node.attribute("name")=="baudrate")
  8627. {
  8628. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  8629. }
  8630. else if(node.attribute("name")=="parity")
  8631. {
  8632. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  8633. }
  8634. else if(node.attribute("name")=="flowcontrol")
  8635. {
  8636. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  8637. }
  8638. else if(node.attribute("name")=="stopbits")
  8639. {
  8640. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  8641. }
  8642. }
  8643. updatePort(port->currentText());
  8644. updateBaudRate(rate->currentText());
  8645. updateParity(parity->currentText());
  8646. updateFlowControl(flow->currentText());
  8647. updateStopBits(stop->currentText());
  8648. setLayout(layout);
  8649. }
  8650. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  8651. {
  8652. updateAttribute("port",newPort);
  8653. }
  8654. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  8655. {
  8656. updateAttribute("baudrate",newRate);
  8657. }
  8658. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  8659. {
  8660. updateAttribute("parity",newParity);
  8661. }
  8662. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  8663. {
  8664. updateAttribute("flowcontrol",newFlow);
  8665. }
  8666. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  8667. {
  8668. updateAttribute("stopbits",newStopBits);
  8669. }
  8670. /*:693*/
  8671. #line 825 "./typica.w"
  8672. /*695:*/
  8673. #line 16154 "./typica.w"
  8674. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  8675. const QModelIndex&index)
  8676. :BasicDeviceConfigurationWidget(model,index),
  8677. unitSpecificationLayout(new QStackedLayout),
  8678. decimalSpecificationLayout(new QStackedLayout)
  8679. {
  8680. QVBoxLayout*layout= new QVBoxLayout;
  8681. QToolButton*addChannelButton= new QToolButton;
  8682. addChannelButton->setText(tr("Add Channel"));
  8683. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  8684. "Temperature Process Value",
  8685. "modbustemperaturepv");
  8686. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  8687. "Temperature Set Value",
  8688. "modbustemperaturesv");
  8689. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  8690. this,SLOT(insertChildNode(QString,QString)));
  8691. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  8692. this,SLOT(insertChildNode(QString,QString)));
  8693. QMenu*channelMenu= new QMenu;
  8694. channelMenu->addAction(addTemperaturePV);
  8695. channelMenu->addAction(addTemperatureSV);
  8696. addChannelButton->setMenu(channelMenu);
  8697. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  8698. layout->addWidget(addChannelButton);
  8699. QHBoxLayout*stationLayout= new QHBoxLayout;
  8700. QLabel*stationLabel= new QLabel(tr("Station:"));
  8701. QSpinBox*stationNumber= new QSpinBox;
  8702. stationNumber->setMinimum(0);
  8703. stationNumber->setMaximum(255);
  8704. stationLayout->addWidget(stationLabel);
  8705. stationLayout->addWidget(stationNumber);
  8706. layout->addLayout(stationLayout);
  8707. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  8708. layout->addWidget(fixedUnit);
  8709. QWidget*fixedUnitPlaceholder= new QWidget(this);
  8710. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  8711. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  8712. QComboBox*fixedUnitSelector= new QComboBox;
  8713. fixedUnitSelector->addItem("Fahrenheit");
  8714. fixedUnitSelector->addItem("Celsius");
  8715. fixedUnitLayout->addWidget(fixedUnitLabel);
  8716. fixedUnitLayout->addWidget(fixedUnitSelector);
  8717. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  8718. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  8719. QWidget*queriedUnitPlaceholder= new QWidget(this);
  8720. QFormLayout*queriedUnitLayout= new QFormLayout;
  8721. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  8722. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  8723. QSpinBox*valueF= new QSpinBox;
  8724. valueF->setMinimum(0);
  8725. valueF->setMaximum(65535);
  8726. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  8727. QSpinBox*valueC= new QSpinBox;
  8728. valueC->setMinimum(0);
  8729. valueC->setMaximum(65535);
  8730. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  8731. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  8732. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  8733. layout->addLayout(unitSpecificationLayout);
  8734. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  8735. layout->addWidget(fixedPrecision);
  8736. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  8737. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  8738. QSpinBox*fixedPrecisionValue= new QSpinBox;
  8739. fixedPrecisionValue->setMinimum(0);
  8740. fixedPrecisionValue->setMaximum(9);
  8741. fixedPrecisionLayout->addRow("Places after the decimal point:",
  8742. fixedPrecisionValue);
  8743. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  8744. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  8745. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  8746. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  8747. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  8748. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  8749. precisionAddress);
  8750. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  8751. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  8752. layout->addLayout(decimalSpecificationLayout);
  8753. /*656:*/
  8754. #line 15170 "./typica.w"
  8755. QDomElement referenceElement=
  8756. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8757. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8758. QDomElement node;
  8759. /*:656*/
  8760. #line 16234 "./typica.w"
  8761. for(int i= 0;i<configData.size();i++)
  8762. {
  8763. node= configData.at(i).toElement();
  8764. if(node.attribute("name")=="station")
  8765. {
  8766. stationNumber->setValue(node.attribute("value").toInt());
  8767. }
  8768. else if(node.attribute("name")=="fixedunit")
  8769. {
  8770. if(node.attribute("value")=="true")
  8771. {
  8772. fixedUnit->setCheckState(Qt::Checked);
  8773. }
  8774. else if(node.attribute("value")=="false")
  8775. {
  8776. fixedUnit->setCheckState(Qt::Unchecked);
  8777. }
  8778. }
  8779. else if(node.attribute("name")=="fixedprecision")
  8780. {
  8781. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8782. }
  8783. else if(node.attribute("name")=="unit")
  8784. {
  8785. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  8786. }
  8787. else if(node.attribute("name")=="unitaddress")
  8788. {
  8789. unitAddress->setValue(node.attribute("value").toInt());
  8790. }
  8791. else if(node.attribute("name")=="fvalue")
  8792. {
  8793. valueF->setValue(node.attribute("value").toInt());
  8794. }
  8795. else if(node.attribute("name")=="cvalue")
  8796. {
  8797. valueC->setValue(node.attribute("value").toInt());
  8798. }
  8799. else if(node.attribute("name")=="precisionaddress")
  8800. {
  8801. precisionAddress->setValue(node.attribute("value").toInt());
  8802. }
  8803. else if(node.attribute("name")=="precision")
  8804. {
  8805. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8806. }
  8807. }
  8808. updateStationNumber(stationNumber->value());
  8809. updateFixedUnit(fixedUnit->isChecked());
  8810. updateFixedDecimal(fixedPrecision->isChecked());
  8811. updateUnit(fixedUnitSelector->currentText());
  8812. updateUnitAddress(unitAddress->value());
  8813. updateValueF(valueF->value());
  8814. updateValueC(valueC->value());
  8815. updatePrecisionAddress(precisionAddress->value());
  8816. updatePrecisionValue(fixedPrecisionValue->value());
  8817. connect(stationNumber,SIGNAL(valueChanged(int)),
  8818. this,SLOT(updateStationNumber(int)));
  8819. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  8820. this,SLOT(updateUnit(QString)));
  8821. connect(unitAddress,SIGNAL(valueChanged(int)),
  8822. this,SLOT(updateUnitAddress(int)));
  8823. connect(valueF,SIGNAL(valueChanged(int)),
  8824. this,SLOT(updateValueF(int)));
  8825. connect(valueC,SIGNAL(valueChanged(int)),
  8826. this,SLOT(updateValueC(int)));
  8827. connect(fixedUnit,SIGNAL(toggled(bool)),
  8828. this,SLOT(updateFixedUnit(bool)));
  8829. connect(fixedPrecision,SIGNAL(toggled(bool)),
  8830. this,SLOT(updateFixedDecimal(bool)));
  8831. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  8832. this,SLOT(updatePrecisionValue(int)));
  8833. connect(precisionAddress,SIGNAL(valueChanged(int)),
  8834. this,SLOT(updatePrecisionAddress(int)));
  8835. setLayout(layout);
  8836. }
  8837. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  8838. {
  8839. updateAttribute("station",QString("%1").arg(newStation));
  8840. }
  8841. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  8842. {
  8843. if(newFixed)
  8844. {
  8845. unitSpecificationLayout->setCurrentIndex(0);
  8846. updateAttribute("fixedunit","true");
  8847. }
  8848. else
  8849. {
  8850. unitSpecificationLayout->setCurrentIndex(1);
  8851. updateAttribute("fixedunit","false");
  8852. }
  8853. }
  8854. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  8855. {
  8856. if(newFixed)
  8857. {
  8858. decimalSpecificationLayout->setCurrentIndex(0);
  8859. updateAttribute("fixedprecision","true");
  8860. }
  8861. else
  8862. {
  8863. decimalSpecificationLayout->setCurrentIndex(1);
  8864. updateAttribute("fixedprecision","false");
  8865. }
  8866. }
  8867. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  8868. {
  8869. updateAttribute("unit",newUnit);
  8870. }
  8871. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  8872. {
  8873. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  8874. }
  8875. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  8876. {
  8877. updateAttribute("fvalue",QString("%1").arg(newValue));
  8878. }
  8879. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  8880. {
  8881. updateAttribute("cvalue",QString("%1").arg(newValue));
  8882. }
  8883. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  8884. {
  8885. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  8886. }
  8887. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  8888. {
  8889. updateAttribute("precision",QString("%1").arg(newValue));
  8890. }
  8891. /*:695*/
  8892. #line 826 "./typica.w"
  8893. /*697:*/
  8894. #line 16397 "./typica.w"
  8895. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  8896. const QModelIndex&index)
  8897. :BasicDeviceConfigurationWidget(model,index)
  8898. {
  8899. QFormLayout*layout= new QFormLayout;
  8900. ShortHexSpinBox*address= new ShortHexSpinBox;
  8901. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  8902. /*656:*/
  8903. #line 15170 "./typica.w"
  8904. QDomElement referenceElement=
  8905. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8906. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8907. QDomElement node;
  8908. /*:656*/
  8909. #line 16405 "./typica.w"
  8910. for(int i= 0;i<configData.size();i++)
  8911. {
  8912. node= configData.at(i).toElement();
  8913. if(node.attribute("name")=="address")
  8914. {
  8915. address->setValue(node.attribute("value").toInt());
  8916. break;
  8917. }
  8918. }
  8919. updateAddress(address->value());
  8920. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  8921. setLayout(layout);
  8922. }
  8923. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  8924. {
  8925. updateAttribute("address",QString("%1").arg(newAddress));
  8926. }
  8927. /*:697*/
  8928. #line 827 "./typica.w"
  8929. /*699:*/
  8930. #line 16453 "./typica.w"
  8931. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  8932. const QModelIndex&index)
  8933. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  8934. {
  8935. QVBoxLayout*layout= new QVBoxLayout;
  8936. QFormLayout*addressLayout= new QFormLayout;
  8937. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  8938. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  8939. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  8940. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  8941. layout->addLayout(addressLayout);
  8942. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  8943. layout->addWidget(fixedRange);
  8944. QWidget*queriedRangePlaceholder= new QWidget(this);
  8945. QFormLayout*queriedRangeLayout= new QFormLayout;
  8946. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  8947. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  8948. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  8949. lowerAddress);
  8950. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  8951. upperAddress);
  8952. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  8953. boundsLayout->addWidget(queriedRangePlaceholder);
  8954. QWidget*fixedRangePlaceholder= new QWidget(this);
  8955. QFormLayout*fixedRangeLayout= new QFormLayout;
  8956. QLineEdit*fixedLower= new QLineEdit;
  8957. QLineEdit*fixedUpper= new QLineEdit;
  8958. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  8959. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  8960. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  8961. boundsLayout->addWidget(fixedRangePlaceholder);
  8962. layout->addLayout(boundsLayout);
  8963. /*656:*/
  8964. #line 15170 "./typica.w"
  8965. QDomElement referenceElement=
  8966. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8967. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8968. QDomElement node;
  8969. /*:656*/
  8970. #line 16486 "./typica.w"
  8971. for(int i= 0;i<configData.size();i++)
  8972. {
  8973. node= configData.at(i).toElement();
  8974. if(node.attribute("name")=="readaddress")
  8975. {
  8976. readAddress->setValue(node.attribute("value").toInt());
  8977. }
  8978. else if(node.attribute("name")=="writeaddress")
  8979. {
  8980. writeAddress->setValue(node.attribute("value").toInt());
  8981. }
  8982. else if(node.attribute("name")=="fixedrange")
  8983. {
  8984. if(node.attribute("value")=="true")
  8985. {
  8986. fixedRange->setCheckState(Qt::Checked);
  8987. }
  8988. else if(node.attribute("value")=="false")
  8989. {
  8990. fixedRange->setCheckState(Qt::Unchecked);
  8991. }
  8992. }
  8993. else if(node.attribute("name")=="fixedlower")
  8994. {
  8995. fixedLower->setText(node.attribute("value"));
  8996. }
  8997. else if(node.attribute("name")=="fixedupper")
  8998. {
  8999. fixedUpper->setText(node.attribute("value"));
  9000. }
  9001. else if(node.attribute("name")=="loweraddress")
  9002. {
  9003. lowerAddress->setValue(node.attribute("value").toInt());
  9004. }
  9005. else if(node.attribute("name")=="upperaddress")
  9006. {
  9007. upperAddress->setValue(node.attribute("value").toInt());
  9008. }
  9009. }
  9010. updateReadAddress(readAddress->value());
  9011. updateWriteAddress(writeAddress->value());
  9012. updateFixedRange(fixedRange->isChecked());
  9013. updateLower(fixedLower->text());
  9014. updateUpper(fixedUpper->text());
  9015. updateLowerAddress(lowerAddress->value());
  9016. updateUpperAddress(upperAddress->value());
  9017. connect(readAddress,SIGNAL(valueChanged(int)),
  9018. this,SLOT(updateReadAddress(int)));
  9019. connect(writeAddress,SIGNAL(valueChanged(int)),
  9020. this,SLOT(updateWriteAddress(int)));
  9021. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  9022. connect(fixedLower,SIGNAL(textChanged(QString)),
  9023. this,SLOT(updateLower(QString)));
  9024. connect(fixedUpper,SIGNAL(textChanged(QString)),
  9025. this,SLOT(updateUpper(QString)));
  9026. connect(lowerAddress,SIGNAL(valueChanged(int)),
  9027. this,SLOT(updateLowerAddress(int)));
  9028. connect(upperAddress,SIGNAL(valueChanged(int)),
  9029. this,SLOT(updateUpperAddress(int)));
  9030. setLayout(layout);
  9031. }
  9032. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  9033. {
  9034. updateAttribute("readaddress",QString("%1").arg(newAddress));
  9035. }
  9036. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  9037. {
  9038. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  9039. }
  9040. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  9041. {
  9042. if(fixed)
  9043. {
  9044. updateAttribute("fixedrange","true");
  9045. boundsLayout->setCurrentIndex(1);
  9046. }
  9047. else
  9048. {
  9049. updateAttribute("fixedrange","false");
  9050. boundsLayout->setCurrentIndex(0);
  9051. }
  9052. }
  9053. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  9054. {
  9055. updateAttribute("fixedlower",lower);
  9056. }
  9057. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  9058. {
  9059. updateAttribute("fixedupper",upper);
  9060. }
  9061. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  9062. {
  9063. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  9064. }
  9065. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  9066. {
  9067. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  9068. }
  9069. /*:699*/
  9070. #line 828 "./typica.w"
  9071. /*655:*/
  9072. #line 15100 "./typica.w"
  9073. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9074. :BasicDeviceConfigurationWidget(model,index)
  9075. {
  9076. QVBoxLayout*layout= new QVBoxLayout;
  9077. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  9078. QMenu*deviceMenu= new QMenu;
  9079. NodeInserter*insertAction;
  9080. foreach(insertAction,AppInstance->topLevelNodeInserters)
  9081. {
  9082. connect(insertAction,SIGNAL(triggered(QString,QString)),
  9083. this,SLOT(insertChildNode(QString,QString)));
  9084. deviceMenu->addAction(insertAction);
  9085. }
  9086. addDeviceButton->setMenu(deviceMenu);
  9087. layout->addWidget(addDeviceButton);
  9088. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  9089. QMenu*annotationMenu= new QMenu;
  9090. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  9091. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  9092. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  9093. annotationMenu->addAction(basicButtonInserter);
  9094. annotationMenu->addAction(countingButtonInserter);
  9095. annotationMenu->addAction(spinBoxInserter);
  9096. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  9097. this,SLOT(insertChildNode(QString,QString)));
  9098. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  9099. this,SLOT(insertChildNode(QString,QString)));
  9100. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  9101. this,SLOT(insertChildNode(QString,QString)));
  9102. addAnnotationControlButton->setMenu(annotationMenu);
  9103. layout->addWidget(addAnnotationControlButton);
  9104. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  9105. QMenu*advancedMenu= new QMenu;
  9106. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  9107. advancedMenu->addAction(linearsplineinserter);
  9108. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  9109. advancedMenu->addAction(translationinserter);
  9110. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9111. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9112. advancedButton->setMenu(advancedMenu);
  9113. layout->addWidget(advancedButton);
  9114. QHBoxLayout*idLayout= new QHBoxLayout;
  9115. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  9116. idLayout->addWidget(idLabel);
  9117. QSpinBox*id= new QSpinBox;
  9118. idLayout->addWidget(id);
  9119. layout->addLayout(idLayout);
  9120. /*656:*/
  9121. #line 15170 "./typica.w"
  9122. QDomElement referenceElement=
  9123. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9124. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9125. QDomElement node;
  9126. /*:656*/
  9127. #line 15148 "./typica.w"
  9128. for(int i= 0;i<configData.size();i++)
  9129. {
  9130. node= configData.at(i).toElement();
  9131. if(node.attribute("name")=="databaseid")
  9132. {
  9133. id->setValue(node.attribute("value").toInt());
  9134. break;
  9135. }
  9136. }
  9137. updateRoasterId(id->value());
  9138. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  9139. setLayout(layout);
  9140. }
  9141. /*:655*//*657:*/
  9142. #line 15180 "./typica.w"
  9143. void RoasterConfWidget::updateRoasterId(int id)
  9144. {
  9145. updateAttribute("databaseid",QString("%1").arg(id));
  9146. }
  9147. /*:657*/
  9148. #line 829 "./typica.w"
  9149. /*703:*/
  9150. #line 16636 "./typica.w"
  9151. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9152. :BasicDeviceConfigurationWidget(model,index)
  9153. {
  9154. QFormLayout*layout= new QFormLayout;
  9155. QLineEdit*buttonTextEdit= new QLineEdit;
  9156. QLineEdit*annotationTextEdit= new QLineEdit;
  9157. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9158. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9159. /*656:*/
  9160. #line 15170 "./typica.w"
  9161. QDomElement referenceElement=
  9162. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9163. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9164. QDomElement node;
  9165. /*:656*/
  9166. #line 16645 "./typica.w"
  9167. for(int i= 0;i<configData.size();i++)
  9168. {
  9169. node= configData.at(i).toElement();
  9170. if(node.attribute("name")=="buttontext")
  9171. {
  9172. buttonTextEdit->setText(node.attribute("value"));
  9173. }
  9174. else if(node.attribute("name")=="annotationtext")
  9175. {
  9176. annotationTextEdit->setText(node.attribute("value"));
  9177. }
  9178. }
  9179. updateButtonText(buttonTextEdit->text());
  9180. updateAnnotationText(annotationTextEdit->text());
  9181. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9182. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9183. setLayout(layout);
  9184. }
  9185. /*:703*//*704:*/
  9186. #line 16667 "./typica.w"
  9187. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  9188. {
  9189. updateAttribute("buttontext",text);
  9190. }
  9191. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9192. {
  9193. updateAttribute("annotationtext",text);
  9194. }
  9195. /*:704*//*707:*/
  9196. #line 16705 "./typica.w"
  9197. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9198. :BasicDeviceConfigurationWidget(model,index)
  9199. {
  9200. QFormLayout*layout= new QFormLayout;
  9201. QLineEdit*buttonTextEdit= new QLineEdit;
  9202. QLineEdit*annotationTextEdit= new QLineEdit;
  9203. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9204. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9205. /*656:*/
  9206. #line 15170 "./typica.w"
  9207. QDomElement referenceElement=
  9208. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9209. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9210. QDomElement node;
  9211. /*:656*/
  9212. #line 16714 "./typica.w"
  9213. for(int i= 0;i<configData.size();i++)
  9214. {
  9215. node= configData.at(i).toElement();
  9216. if(node.attribute("name")=="buttontext")
  9217. {
  9218. buttonTextEdit->setText(node.attribute("value"));
  9219. }
  9220. else if(node.attribute("name")=="annotationtext")
  9221. {
  9222. annotationTextEdit->setText(node.attribute("value"));
  9223. }
  9224. }
  9225. updateButtonText(buttonTextEdit->text());
  9226. updateAnnotationText(annotationTextEdit->text());
  9227. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9228. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9229. QTextEdit*documentation= new QTextEdit;
  9230. documentation->setHtml(tr("If the <b>Annotation Text</b> contains <tt>%1</tt>, this will be replaced in the annotation with a number that increments each time the button is pressed."));
  9231. documentation->setReadOnly(true);
  9232. layout->addRow("",documentation);
  9233. setLayout(layout);
  9234. }
  9235. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  9236. {
  9237. updateAttribute("buttontext",text);
  9238. }
  9239. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9240. {
  9241. updateAttribute("annotationtext",text);
  9242. }
  9243. /*:707*/
  9244. #line 830 "./typica.w"
  9245. /*710:*/
  9246. #line 16782 "./typica.w"
  9247. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9248. :BasicDeviceConfigurationWidget(model,index)
  9249. {
  9250. QFormLayout*layout= new QFormLayout;
  9251. QLineEdit*labelEdit= new QLineEdit;
  9252. layout->addRow(tr("Control Label: "),labelEdit);
  9253. QLineEdit*minimumEdit= new QLineEdit;
  9254. layout->addRow(tr("Minimum Value: "),minimumEdit);
  9255. QLineEdit*maximumEdit= new QLineEdit;
  9256. layout->addRow(tr("Maximum Value: "),maximumEdit);
  9257. QSpinBox*precisionEdit= new QSpinBox;
  9258. precisionEdit->setMinimum(0);
  9259. precisionEdit->setMaximum(9);
  9260. layout->addRow(tr("Precision"),precisionEdit);
  9261. QLineEdit*pretext= new QLineEdit;
  9262. layout->addRow(tr("Prefix text"),pretext);
  9263. QLineEdit*posttext= new QLineEdit;
  9264. layout->addRow(tr("Suffix text"),posttext);
  9265. /*656:*/
  9266. #line 15170 "./typica.w"
  9267. QDomElement referenceElement=
  9268. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9269. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9270. QDomElement node;
  9271. /*:656*/
  9272. #line 16801 "./typica.w"
  9273. for(int i= 0;i<configData.size();i++)
  9274. {
  9275. node= configData.at(i).toElement();
  9276. if(node.attribute("name")=="label")
  9277. {
  9278. labelEdit->setText(node.attribute("value"));
  9279. }
  9280. else if(node.attribute("name")=="minimum")
  9281. {
  9282. minimumEdit->setText(node.attribute("value"));
  9283. }
  9284. else if(node.attribute("name")=="maximum")
  9285. {
  9286. maximumEdit->setText(node.attribute("value"));
  9287. }
  9288. else if(node.attribute("name")=="precision")
  9289. {
  9290. precisionEdit->setValue(node.attribute("value").toInt());
  9291. }
  9292. else if(node.attribute("name")=="pretext")
  9293. {
  9294. pretext->setText(node.attribute("value"));
  9295. }
  9296. else if(node.attribute("name")=="posttext")
  9297. {
  9298. posttext->setText(node.attribute("value"));
  9299. }
  9300. }
  9301. updateLabel(labelEdit->text());
  9302. updateMinimum(minimumEdit->text());
  9303. updateMaximum(maximumEdit->text());
  9304. updatePrecision(precisionEdit->value());
  9305. updatePretext(pretext->text());
  9306. updatePosttext(posttext->text());
  9307. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  9308. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  9309. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  9310. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  9311. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  9312. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  9313. setLayout(layout);
  9314. }
  9315. void NoteSpinConfWidget::updateLabel(const QString&text)
  9316. {
  9317. updateAttribute("label",text);
  9318. }
  9319. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  9320. {
  9321. updateAttribute("minimum",minimum);
  9322. }
  9323. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  9324. {
  9325. updateAttribute("maximum",maximum);
  9326. }
  9327. void NoteSpinConfWidget::updatePrecision(int precision)
  9328. {
  9329. updateAttribute("precision",QString("%1").arg(precision));
  9330. }
  9331. void NoteSpinConfWidget::updatePretext(const QString&text)
  9332. {
  9333. updateAttribute("pretext",text);
  9334. }
  9335. void NoteSpinConfWidget::updatePosttext(const QString&text)
  9336. {
  9337. updateAttribute("posttext",text);
  9338. }
  9339. /*:710*/
  9340. #line 831 "./typica.w"
  9341. /*270:*/
  9342. #line 6849 "./typica.w"
  9343. LinearCalibrator::LinearCalibrator(QObject*parent):
  9344. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  9345. {
  9346. }
  9347. /*:270*//*271:*/
  9348. #line 6863 "./typica.w"
  9349. void LinearCalibrator::newMeasurement(Measurement measure)
  9350. {
  9351. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  9352. if(clamp)
  9353. {
  9354. if(outval<Lo1)
  9355. {
  9356. outval= Lo1;
  9357. }
  9358. else if(outval> Up1)
  9359. {
  9360. outval= Up1;
  9361. }
  9362. }
  9363. if(sensitivitySetting>=0.05)
  9364. {
  9365. int temp= qRound(outval/sensitivitySetting);
  9366. outval= temp*sensitivitySetting;
  9367. }
  9368. Measurement adjusted(outval,measure.time(),measure.scale());
  9369. emit measurement(adjusted);
  9370. }
  9371. /*:271*//*272:*/
  9372. #line 6889 "./typica.w"
  9373. double LinearCalibrator::measuredLower()
  9374. {
  9375. return Lo2;
  9376. }
  9377. double LinearCalibrator::measuredUpper()
  9378. {
  9379. return Up2;
  9380. }
  9381. double LinearCalibrator::mappedLower()
  9382. {
  9383. return Lo1;
  9384. }
  9385. double LinearCalibrator::mappedUpper()
  9386. {
  9387. return Up1;
  9388. }
  9389. bool LinearCalibrator::isClosedRange()
  9390. {
  9391. return clamp;
  9392. }
  9393. void LinearCalibrator::setMeasuredLower(double lower)
  9394. {
  9395. Lo2= lower;
  9396. }
  9397. void LinearCalibrator::setMeasuredUpper(double upper)
  9398. {
  9399. Up2= upper;
  9400. }
  9401. void LinearCalibrator::setMappedLower(double lower)
  9402. {
  9403. Lo1= lower;
  9404. }
  9405. void LinearCalibrator::setMappedUpper(double upper)
  9406. {
  9407. Up1= upper;
  9408. }
  9409. void LinearCalibrator::setClosedRange(bool closed)
  9410. {
  9411. clamp= closed;
  9412. }
  9413. void LinearCalibrator::setSensitivity(double sensitivity)
  9414. {
  9415. sensitivitySetting= sensitivity;
  9416. }
  9417. double LinearCalibrator::sensitivity()
  9418. {
  9419. return sensitivitySetting;
  9420. }
  9421. /*:272*/
  9422. #line 832 "./typica.w"
  9423. /*277:*/
  9424. #line 7022 "./typica.w"
  9425. void LinearSplineInterpolator::add_pair(double source,double destination)
  9426. {
  9427. pairs->insert(source,destination);
  9428. make_interpolators();
  9429. }
  9430. void LinearSplineInterpolator::make_interpolators()
  9431. {
  9432. if(pairs->size()> 1)
  9433. {
  9434. while(interpolators->size()> 0)
  9435. {
  9436. LinearCalibrator*removed= interpolators->takeFirst();
  9437. removed->deleteLater();
  9438. }
  9439. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9440. QMap<double,double> ::const_iterator j= i+1;
  9441. while(j!=pairs->constEnd())
  9442. {
  9443. LinearCalibrator*segment= new LinearCalibrator();
  9444. segment->setMeasuredLower(i.key());
  9445. segment->setMappedLower(i.value());
  9446. segment->setMeasuredUpper(j.key());
  9447. segment->setMappedUpper(j.value());
  9448. segment->setClosedRange(false);
  9449. interpolators->append(segment);
  9450. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  9451. i++;
  9452. j++;
  9453. }
  9454. }
  9455. }
  9456. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  9457. QObject(parent),pairs(new QMap<double,double> ),
  9458. interpolators(new QList<LinearCalibrator*> )
  9459. {
  9460. }
  9461. void LinearSplineInterpolator::newMeasurement(Measurement measure)
  9462. {
  9463. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9464. int index= -1;
  9465. while(i!=pairs->constEnd())
  9466. {
  9467. if(measure.temperature()<=i.key())
  9468. {
  9469. break;
  9470. }
  9471. i++;
  9472. index++;
  9473. }
  9474. if(index<0)
  9475. {
  9476. index= 0;
  9477. }
  9478. if(index>=interpolators->size())
  9479. {
  9480. index= interpolators->size()-1;
  9481. }
  9482. if(interpolators->at(index)!=NULL)
  9483. {
  9484. interpolators->at(index)->newMeasurement(measure);
  9485. }
  9486. }
  9487. /*:277*/
  9488. #line 833 "./typica.w"
  9489. /*732:*/
  9490. #line 18083 "./typica.w"
  9491. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9492. :BasicDeviceConfigurationWidget(model,index),knotmodel(new SaltModel(2))
  9493. {
  9494. QFormLayout*layout= new QFormLayout;
  9495. QLineEdit*source= new QLineEdit;
  9496. layout->addRow(tr("Source column name:"),source);
  9497. QLineEdit*destination= new QLineEdit;
  9498. layout->addRow(tr("Destination column name:"),destination);
  9499. knotmodel->setHeaderData(0,Qt::Horizontal,"Input");
  9500. knotmodel->setHeaderData(1,Qt::Horizontal,"Output");
  9501. QTableView*mappingTable= new QTableView;
  9502. mappingTable->setModel(knotmodel);
  9503. NumericDelegate*delegate= new NumericDelegate;
  9504. mappingTable->setItemDelegate(delegate);
  9505. layout->addRow(tr("Mapping data:"),mappingTable);
  9506. /*656:*/
  9507. #line 15170 "./typica.w"
  9508. QDomElement referenceElement=
  9509. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9510. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9511. QDomElement node;
  9512. /*:656*/
  9513. #line 18099 "./typica.w"
  9514. for(int i= 0;i<configData.size();i++)
  9515. {
  9516. node= configData.at(i).toElement();
  9517. if(node.attribute("name")=="source")
  9518. {
  9519. source->setText(node.attribute("value"));
  9520. }
  9521. else if(node.attribute("name")=="destination")
  9522. {
  9523. destination->setText(node.attribute("value"));
  9524. }
  9525. else if(node.attribute("name")=="sourcevalues")
  9526. {
  9527. /*733:*/
  9528. #line 18138 "./typica.w"
  9529. QString data= node.attribute("value");
  9530. if(data.length()> 3)
  9531. {
  9532. data.chop(2);
  9533. data= data.remove(0,2);
  9534. }
  9535. QStringList itemList= data.split(",");
  9536. /*:733*/
  9537. #line 18113 "./typica.w"
  9538. int column= 0;
  9539. /*734:*/
  9540. #line 18150 "./typica.w"
  9541. for(int i= 0;i<itemList.size();i++)
  9542. {
  9543. knotmodel->setData(knotmodel->index(i,column),
  9544. QVariant(itemList.at(i).toDouble()),
  9545. Qt::DisplayRole);
  9546. }
  9547. /*:734*/
  9548. #line 18115 "./typica.w"
  9549. }
  9550. else if(node.attribute("name")=="destinationvalues")
  9551. {
  9552. /*733:*/
  9553. #line 18138 "./typica.w"
  9554. QString data= node.attribute("value");
  9555. if(data.length()> 3)
  9556. {
  9557. data.chop(2);
  9558. data= data.remove(0,2);
  9559. }
  9560. QStringList itemList= data.split(",");
  9561. /*:733*/
  9562. #line 18120 "./typica.w"
  9563. int column= 1;
  9564. /*734:*/
  9565. #line 18150 "./typica.w"
  9566. for(int i= 0;i<itemList.size();i++)
  9567. {
  9568. knotmodel->setData(knotmodel->index(i,column),
  9569. QVariant(itemList.at(i).toDouble()),
  9570. Qt::DisplayRole);
  9571. }
  9572. /*:734*/
  9573. #line 18122 "./typica.w"
  9574. }
  9575. }
  9576. updateSourceColumn(source->text());
  9577. updateDestinationColumn(destination->text());
  9578. updateKnots();
  9579. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  9580. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  9581. connect(knotmodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  9582. setLayout(layout);
  9583. }
  9584. /*:732*//*735:*/
  9585. #line 18161 "./typica.w"
  9586. void LinearSplineInterpolationConfWidget::updateKnots()
  9587. {
  9588. updateAttribute("sourcevalues",knotmodel->arrayLiteral(0,Qt::DisplayRole));
  9589. updateAttribute("destinationvalues",knotmodel->arrayLiteral(1,Qt::DisplayRole));
  9590. }
  9591. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  9592. {
  9593. updateAttribute("source",source);
  9594. }
  9595. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  9596. {
  9597. updateAttribute("destination",dest);
  9598. }
  9599. /*:735*/
  9600. #line 834 "./typica.w"
  9601. /*738:*/
  9602. #line 18204 "./typica.w"
  9603. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9604. :BasicDeviceConfigurationWidget(model,index),
  9605. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  9606. {
  9607. unitSelector->addItem("Fahrenheit");
  9608. unitSelector->addItem("Celsius");
  9609. temperatureValue->setMinimum(0);
  9610. temperatureValue->setMaximum(1000);
  9611. QFormLayout*layout= new QFormLayout;
  9612. QLineEdit*column= new QLineEdit;
  9613. layout->addRow(tr("Column to match:"),column);
  9614. layout->addRow(tr("Unit:"),unitSelector);
  9615. layout->addRow(tr("Value:"),temperatureValue);
  9616. /*656:*/
  9617. #line 15170 "./typica.w"
  9618. QDomElement referenceElement=
  9619. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9620. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9621. QDomElement node;
  9622. /*:656*/
  9623. #line 18218 "./typica.w"
  9624. for(int i= 0;i<configData.size();i++)
  9625. {
  9626. node= configData.at(i).toElement();
  9627. if(node.attribute("name")=="column")
  9628. {
  9629. column->setText(node.attribute("value"));
  9630. }
  9631. else if(node.attribute("name")=="unit")
  9632. {
  9633. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  9634. }
  9635. else if(node.attribute("name")=="value")
  9636. {
  9637. temperatureValue->setValue(node.attribute("value").toDouble());
  9638. }
  9639. }
  9640. updateMatchingColumn(column->text());
  9641. updateTemperature();
  9642. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  9643. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  9644. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  9645. setLayout(layout);
  9646. }
  9647. /*:738*//*739:*/
  9648. #line 18247 "./typica.w"
  9649. void TranslationConfWidget::updateTemperature()
  9650. {
  9651. updateAttribute("unit",unitSelector->currentText());
  9652. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  9653. if(unitSelector->currentText()=="Fahrenheit")
  9654. {
  9655. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  9656. }
  9657. else
  9658. {
  9659. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  9660. }
  9661. }
  9662. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  9663. {
  9664. updateAttribute("column",column);
  9665. }
  9666. /*:739*/
  9667. #line 835 "./typica.w"
  9668. /*:17*/
  9669. #line 763 "./typica.w"
  9670. /*21:*/
  9671. #line 895 "./typica.w"
  9672. template<class TYPE> TYPE getself(QScriptContext*context)
  9673. {
  9674. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  9675. return self;
  9676. }
  9677. template<> QTime getself(QScriptContext*context)
  9678. {
  9679. QTime self= context->thisObject().toVariant().toTime();
  9680. return self;
  9681. }
  9682. template<> SqlQueryConnection*getself(QScriptContext*context)
  9683. {
  9684. SqlQueryConnection*self=
  9685. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  9686. return self;
  9687. }
  9688. template<> QXmlQuery*getself(QScriptContext*context)
  9689. {
  9690. QXmlQuery*self=
  9691. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  9692. return self;
  9693. }
  9694. template<> QXmlStreamWriter*getself(QScriptContext*context)
  9695. {
  9696. QXmlStreamWriter*self=
  9697. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  9698. return self;
  9699. }
  9700. template<> QXmlStreamReader*getself(QScriptContext*context)
  9701. {
  9702. QXmlStreamReader*self=
  9703. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  9704. return self;
  9705. }
  9706. /*:21*//*22:*/
  9707. #line 940 "./typica.w"
  9708. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  9709. {
  9710. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  9711. return argument;
  9712. }
  9713. template<> QString argument(int arg,QScriptContext*context)
  9714. {
  9715. return context->argument(arg).toString();
  9716. }
  9717. template<> QVariant argument(int arg,QScriptContext*context)
  9718. {
  9719. return context->argument(arg).toVariant();
  9720. }
  9721. template<> int argument(int arg,QScriptContext*context)
  9722. {
  9723. return context->argument(arg).toInt32();
  9724. }
  9725. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  9726. {
  9727. return(SqlQueryConnection*)
  9728. qscriptvalue_cast<void*> (context->argument(arg));
  9729. }
  9730. template<> QModelIndex argument(int arg,QScriptContext*context)
  9731. {
  9732. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  9733. }
  9734. /*:22*//*26:*/
  9735. #line 1017 "./typica.w"
  9736. void setQObjectProperties(QScriptValue,QScriptEngine*)
  9737. {
  9738. }
  9739. /*:26*//*28:*/
  9740. #line 1031 "./typica.w"
  9741. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  9742. {
  9743. }
  9744. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  9745. {
  9746. }
  9747. /*:28*//*31:*/
  9748. #line 1070 "./typica.w"
  9749. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  9750. {
  9751. QScriptValue object= engine->newQObject(new QWidget);
  9752. setQWidgetProperties(object,engine);
  9753. return object;
  9754. }
  9755. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  9756. {
  9757. setQObjectProperties(value,engine);
  9758. setQPaintDeviceProperties(value,engine);
  9759. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  9760. value.setProperty("activateWindow",
  9761. engine->newFunction(QWidget_activateWindow));
  9762. }
  9763. /*:31*//*32:*/
  9764. #line 1092 "./typica.w"
  9765. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  9766. {
  9767. if(context->argumentCount()==1)
  9768. {
  9769. QWidget*self= getself<QWidget*> (context);
  9770. QLayout*layout= argument<QLayout*> (0,context);
  9771. if(layout)
  9772. {
  9773. self->setLayout(layout);
  9774. }
  9775. else
  9776. {
  9777. context->throwError("Incorrect argument type passed to "
  9778. "QWidget::setLayout(). This method requires "
  9779. "a QLayout.");
  9780. }
  9781. }
  9782. else
  9783. {
  9784. context->throwError("Incorrect number of arguments passed to "
  9785. "QWidget::setLayout(). This method takes one "
  9786. "QLayout as an argument.");
  9787. }
  9788. return QScriptValue();
  9789. }
  9790. QScriptValue QWidget_activateWindow(QScriptContext*context,
  9791. QScriptEngine*)
  9792. {
  9793. QWidget*self= getself<QWidget*> (context);
  9794. self->activateWindow();
  9795. return QScriptValue();
  9796. }
  9797. /*:32*//*34:*/
  9798. #line 1166 "./typica.w"
  9799. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL)
  9800. {
  9801. }
  9802. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  9803. {
  9804. QSettings settings;
  9805. settings.beginGroup(key);
  9806. settings.setValue("pos",pos());
  9807. settings.setValue("size",size());
  9808. settings.endGroup();
  9809. }
  9810. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  9811. {
  9812. QSettings settings;
  9813. settings.beginGroup(key);
  9814. if(settings.contains("size"))
  9815. {
  9816. resize(settings.value("size").toSize());
  9817. }
  9818. if(settings.contains("pos"))
  9819. {
  9820. move(settings.value("pos").toPoint());
  9821. }
  9822. settings.endGroup();
  9823. }
  9824. void ScriptQMainWindow::displayStatus(const QString&message)
  9825. {
  9826. statusBar()->showMessage(message);
  9827. }
  9828. void ScriptQMainWindow::showEvent(QShowEvent*event)
  9829. {
  9830. if(!event->spontaneous())
  9831. {
  9832. /*36:*/
  9833. #line 1240 "./typica.w"
  9834. QSettings settings;
  9835. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  9836. toByteArray());
  9837. /*:36*/
  9838. #line 1205 "./typica.w"
  9839. event->accept();
  9840. }
  9841. else
  9842. {
  9843. event->ignore();
  9844. }
  9845. }
  9846. void ScriptQMainWindow::show()
  9847. {
  9848. QMainWindow::show();
  9849. }
  9850. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  9851. {
  9852. emit aboutToClose();
  9853. /*35:*/
  9854. #line 1234 "./typica.w"
  9855. QSettings settings;
  9856. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  9857. /*:35*/
  9858. #line 1222 "./typica.w"
  9859. event->accept();
  9860. }
  9861. /*:34*//*39:*/
  9862. #line 1268 "./typica.w"
  9863. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  9864. {
  9865. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  9866. setQMainWindowProperties(object,engine);
  9867. return object;
  9868. }
  9869. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  9870. {
  9871. setQWidgetProperties(value,engine);
  9872. value.setProperty("setCentralWidget",
  9873. engine->newFunction(QMainWindow_setCentralWidget));
  9874. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  9875. }
  9876. /*:39*//*40:*/
  9877. #line 1290 "./typica.w"
  9878. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  9879. QScriptEngine*)
  9880. {
  9881. if(context->argumentCount()==1)
  9882. {
  9883. QMainWindow*self= getself<QMainWindow*> (context);
  9884. QWidget*widget= argument<QWidget*> (0,context);
  9885. if(widget)
  9886. {
  9887. self->setCentralWidget(widget);
  9888. }
  9889. else
  9890. {
  9891. context->throwError("Incorrect argument type passed to "
  9892. "QMainWindow::setCentralWidget(). This "
  9893. "method requires a QWidget.");
  9894. }
  9895. }
  9896. else
  9897. {
  9898. context->throwError("Incorrect number of arguments passed to "
  9899. "QMainWindow::setCentralWidget(). This method "
  9900. "takes one QWidget as an argument.");
  9901. }
  9902. return QScriptValue();
  9903. }
  9904. /*:40*//*41:*/
  9905. #line 1324 "./typica.w"
  9906. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  9907. {
  9908. QScriptValue object;
  9909. if(context->argumentCount()==0)
  9910. {
  9911. QMainWindow*self= getself<QMainWindow*> (context);
  9912. QMenuBar*bar= self->menuBar();
  9913. object= engine->newQObject(bar);
  9914. setQMenuBarProperties(object,engine);
  9915. }
  9916. else
  9917. {
  9918. context->throwError("Incorrect number of arguments passed to "
  9919. "QMainWindow::menuBar(). This method takes no "
  9920. "arguments.");
  9921. }
  9922. return object;
  9923. }
  9924. /*:41*//*43:*/
  9925. #line 1354 "./typica.w"
  9926. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  9927. {
  9928. setQWidgetProperties(value,engine);
  9929. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  9930. }
  9931. /*:43*//*44:*/
  9932. #line 1369 "./typica.w"
  9933. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  9934. {
  9935. QScriptValue object;
  9936. if(context->argumentCount()==1)
  9937. {
  9938. QMenuBar*self= getself<QMenuBar*> (context);
  9939. QString title= argument<QString> (0,context);
  9940. object= engine->newQObject(self->addMenu(title));
  9941. setQMenuProperties(object,engine);
  9942. }
  9943. else
  9944. {
  9945. context->throwError("Incorrect number of arguments passed to "
  9946. "QMenuBar::addMenu(). This method takes one "
  9947. "string as an argument.");
  9948. }
  9949. return object;
  9950. }
  9951. /*:44*//*46:*/
  9952. #line 1399 "./typica.w"
  9953. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  9954. {
  9955. setQWidgetProperties(value,engine);
  9956. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  9957. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  9958. }
  9959. /*:46*//*47:*/
  9960. #line 1409 "./typica.w"
  9961. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  9962. {
  9963. if(context->argumentCount()==1)
  9964. {
  9965. QMenu*self= getself<QMenu*> (context);
  9966. QAction*action= argument<QAction*> (0,context);
  9967. if(action)
  9968. {
  9969. self->addAction(action);
  9970. }
  9971. else
  9972. {
  9973. context->throwError("Incorrect argument type passed to "
  9974. "QMenu::addAction(). This method requires a "
  9975. "QAction.");
  9976. }
  9977. }
  9978. else
  9979. {
  9980. context->throwError("Incorrect number of arguments passed to "
  9981. "QMenu::addAction(). This method takes one "
  9982. "QAction as an argument.");
  9983. }
  9984. return QScriptValue();
  9985. }
  9986. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  9987. {
  9988. if(context->argumentCount()==0)
  9989. {
  9990. QMenu*self= getself<QMenu*> (context);
  9991. self->addSeparator();
  9992. }
  9993. else
  9994. {
  9995. context->throwError("Incorrect number of arguments passed to "
  9996. "QMenu::addSeparator(). This method takes no "
  9997. "arguments.");
  9998. }
  9999. return QScriptValue();
  10000. }
  10001. /*:47*//*50:*/
  10002. #line 1471 "./typica.w"
  10003. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  10004. {
  10005. QScriptValue object= engine->newQObject(new QFrame);
  10006. setQFrameProperties(object,engine);
  10007. return object;
  10008. }
  10009. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  10010. {
  10011. setQWidgetProperties(value,engine);
  10012. }
  10013. /*:50*//*53:*/
  10014. #line 1505 "./typica.w"
  10015. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  10016. {
  10017. QString text;
  10018. if(context->argumentCount()==1)
  10019. {
  10020. text= argument<QString> (0,context);
  10021. }
  10022. QScriptValue object= engine->newQObject(new QLabel(text));
  10023. setQLabelProperties(object,engine);
  10024. return object;
  10025. }
  10026. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  10027. {
  10028. setQFrameProperties(value,engine);
  10029. }
  10030. /*:53*//*56:*/
  10031. #line 1551 "./typica.w"
  10032. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  10033. {
  10034. QScriptValue object= engine->newQObject(new QSplitter);
  10035. setQSplitterProperties(object,engine);
  10036. return object;
  10037. }
  10038. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  10039. {
  10040. setQFrameProperties(value,engine);
  10041. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  10042. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  10043. value.setProperty("restoreState",
  10044. engine->newFunction(QSplitter_restoreState));
  10045. }
  10046. /*:56*//*57:*/
  10047. #line 1571 "./typica.w"
  10048. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  10049. {
  10050. if(context->argumentCount()==1)
  10051. {
  10052. QSplitter*self= getself<QSplitter*> (context);
  10053. QWidget*widget= argument<QWidget*> (0,context);
  10054. if(widget)
  10055. {
  10056. self->addWidget(widget);
  10057. }
  10058. else
  10059. {
  10060. context->throwError("Incorrect argument type passed to "
  10061. "QSplitter::addWidget(). This method "
  10062. "requires a QWidget.");
  10063. }
  10064. }
  10065. else
  10066. {
  10067. context->throwError("Incorrect number of arguments passed to "
  10068. "QSplitter::addWidget(). This method takes one "
  10069. "QWidget as an argument.");
  10070. }
  10071. return QScriptValue();
  10072. }
  10073. /*:57*//*58:*/
  10074. #line 1604 "./typica.w"
  10075. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  10076. {
  10077. if(context->argumentCount()==1)
  10078. {
  10079. QSplitter*self= getself<QSplitter*> (context);
  10080. QString key= argument<QString> (0,context);
  10081. QSettings settings;
  10082. settings.setValue(key,self->saveState());
  10083. }
  10084. else
  10085. {
  10086. context->throwError("Incorrect number of arguments passed to "
  10087. "QSplitter::saveState(). This method takes one "
  10088. "string as an argument.");
  10089. }
  10090. return QScriptValue();
  10091. }
  10092. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  10093. {
  10094. if(context->argumentCount()==1)
  10095. {
  10096. QSplitter*self= getself<QSplitter*> (context);
  10097. QString key= argument<QString> (0,context);
  10098. QSettings settings;
  10099. self->restoreState(settings.value(key).toByteArray());
  10100. }
  10101. else
  10102. {
  10103. context->throwError("Incorrect number of arguments passed to "
  10104. "QSplitter::restoreState(). This method takes "
  10105. "one string as an argument.");
  10106. }
  10107. return QScriptValue();
  10108. }
  10109. /*:58*//*60:*/
  10110. #line 1657 "./typica.w"
  10111. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10112. {
  10113. setQLayoutItemProperties(value,engine);
  10114. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  10115. }
  10116. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10117. {
  10118. if(context->argumentCount()==1)
  10119. {
  10120. QLayout*self= getself<QLayout*> (context);
  10121. QWidget*widget= argument<QWidget*> (0,context);
  10122. if(widget)
  10123. {
  10124. self->addWidget(widget);
  10125. }
  10126. else
  10127. {
  10128. context->throwError("Incorrect argument type passed to "
  10129. "QLayout::addWidget(). This method requires "
  10130. "a QWidget.");
  10131. }
  10132. }
  10133. else
  10134. {
  10135. context->throwError("Incorrect number of arguments passed to "
  10136. "QLayout::addWidget(). This method takes one "
  10137. "QWidget as an argument.");
  10138. }
  10139. return QScriptValue();
  10140. }
  10141. /*:60*//*63:*/
  10142. #line 1724 "./typica.w"
  10143. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  10144. {
  10145. QScriptValue object=
  10146. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  10147. setQBoxLayoutProperties(object,engine);
  10148. return object;
  10149. }
  10150. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10151. {
  10152. setQLayoutProperties(value,engine);
  10153. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  10154. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  10155. }
  10156. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  10157. {
  10158. if(context->argumentCount()> 0&&context->argumentCount()<3)
  10159. {
  10160. QBoxLayout*self= getself<QBoxLayout*> (context);
  10161. QLayout*layout= argument<QLayout*> (0,context);
  10162. int stretch= 0;
  10163. if(context->argumentCount()==2)
  10164. {
  10165. stretch= argument<int> (1,context);
  10166. }
  10167. if(layout)
  10168. {
  10169. self->addLayout(layout,stretch);
  10170. }
  10171. else
  10172. {
  10173. context->throwError("Incorrect argument type passed to "
  10174. "QLayout::addLayout(). This method requires "
  10175. "a QLayout.");
  10176. }
  10177. }
  10178. else
  10179. {
  10180. context->throwError("Incorrect number of arguments passed to "
  10181. "QLayout::addLayout(). This method takes one "
  10182. "QLayout as an argument and optionally one integer.");
  10183. }
  10184. return QScriptValue();
  10185. }
  10186. /*:63*//*64:*/
  10187. #line 1775 "./typica.w"
  10188. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10189. {
  10190. if(context->argumentCount()> 0&&context->argumentCount()<4)
  10191. {
  10192. QBoxLayout*self= getself<QBoxLayout*> (context);
  10193. QWidget*widget= argument<QWidget*> (0,context);
  10194. int stretch= 0;
  10195. Qt::Alignment alignment= 0;
  10196. if(context->argumentCount()> 1)
  10197. {
  10198. stretch= argument<int> (1,context);
  10199. }
  10200. if(context->argumentCount()> 2)
  10201. {
  10202. alignment= (Qt::Alignment)(argument<int> (2,context));
  10203. }
  10204. if(widget)
  10205. {
  10206. self->addWidget(widget,stretch,alignment);
  10207. }
  10208. else
  10209. {
  10210. context->throwError("Incorrect argument type passed to "
  10211. "QBoxLayout::addWidget(). This method requires "
  10212. "a QWidget.");
  10213. }
  10214. }
  10215. else
  10216. {
  10217. context->throwError("Incorrect number of arguments passed to "
  10218. "QBoxLayout::addWidget(). This method takes one "
  10219. "QWidget and optionally up to two integers as "
  10220. "arguments.");
  10221. }
  10222. return QScriptValue();
  10223. }
  10224. /*:64*//*67:*/
  10225. #line 1839 "./typica.w"
  10226. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  10227. {
  10228. QScriptValue object= engine->newQObject(new QAction(NULL));
  10229. setQActionProperties(object,engine);
  10230. return object;
  10231. }
  10232. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  10233. {
  10234. setQObjectProperties(value,engine);
  10235. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  10236. }
  10237. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  10238. {
  10239. if(context->argumentCount()==1)
  10240. {
  10241. QAction*self= getself<QAction*> (context);
  10242. self->setShortcut(argument<QString> (0,context));
  10243. }
  10244. else
  10245. {
  10246. context->throwError("Incorrect number of arguments passed to "
  10247. "QAction::setShortcut(). This method takes one "
  10248. "string as an argument.");
  10249. }
  10250. return QScriptValue();
  10251. }
  10252. /*:67*//*70:*/
  10253. #line 1897 "./typica.w"
  10254. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  10255. QScriptEngine*engine)
  10256. {
  10257. QScriptValue retval;
  10258. if(context->argumentCount()==3)
  10259. {
  10260. QWidget*widget= argument<QWidget*> (0,context);
  10261. if(widget)
  10262. {
  10263. QString caption= argument<QString> (1,context);
  10264. QString dir= argument<QString> (2,context);
  10265. retval= QScriptValue(engine,
  10266. QFileDialog::getOpenFileName(widget,caption,
  10267. dir,"",0,0));
  10268. setQFileDialogProperties(retval,engine);
  10269. }
  10270. else
  10271. {
  10272. context->throwError("Incorrect argument type passed to "
  10273. "QFileDialog::getOpenFileName(). The first "
  10274. "argument to this method must be a QWidget.");
  10275. }
  10276. }
  10277. else
  10278. {
  10279. context->throwError("Incorrect number of arguments passed to "
  10280. "QFileDialog::getOpenFileName(). This method "
  10281. "takes one QWidget followed by two strings for a "
  10282. "total of three arguments.");
  10283. }
  10284. return retval;
  10285. }
  10286. /*:70*//*71:*/
  10287. #line 1933 "./typica.w"
  10288. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  10289. QScriptEngine*engine)
  10290. {
  10291. QScriptValue retval;
  10292. if(context->argumentCount()==3)
  10293. {
  10294. QWidget*widget= argument<QWidget*> (0,context);
  10295. if(widget)
  10296. {
  10297. QString caption= argument<QString> (1,context);
  10298. QString dir= argument<QString> (2,context);
  10299. retval= QScriptValue(engine,
  10300. QFileDialog::getSaveFileName(widget,caption,
  10301. dir,"",0,0));
  10302. setQFileDialogProperties(retval,engine);
  10303. }
  10304. else
  10305. {
  10306. context->throwError("Incorrect argument type passed to "
  10307. "QFileDialog::getSaveFileName(). The first "
  10308. "argument to this method must be a QWidget.");
  10309. }
  10310. }
  10311. else
  10312. {
  10313. context->throwError("Incorrect number of arguments passed to "
  10314. "QFileDialog::getSaveFileName(). This method "
  10315. "takes one QWidget followed by two strings for a "
  10316. "total of three arguments.");
  10317. }
  10318. return retval;
  10319. }
  10320. /*:71*//*72:*/
  10321. #line 1970 "./typica.w"
  10322. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  10323. {
  10324. setQDialogProperties(value,engine);
  10325. }
  10326. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  10327. {
  10328. setQWidgetProperties(value,engine);
  10329. }
  10330. /*:72*//*75:*/
  10331. #line 2005 "./typica.w"
  10332. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  10333. {
  10334. QScriptValue object=
  10335. engine->newQObject(new QFile(argument<QString> (0,context)));
  10336. setQFileProperties(object,engine);
  10337. return object;
  10338. }
  10339. /*:75*//*76:*/
  10340. #line 2016 "./typica.w"
  10341. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  10342. {
  10343. setQIODeviceProperties(value,engine);
  10344. value.setProperty("remove",engine->newFunction(QFile_remove));
  10345. }
  10346. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  10347. {
  10348. QFile*self= getself<QFile*> (context);
  10349. bool retval= self->remove();
  10350. return QScriptValue(engine,retval);
  10351. }
  10352. /*:76*//*77:*/
  10353. #line 2038 "./typica.w"
  10354. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  10355. {
  10356. setQObjectProperties(value,engine);
  10357. value.setProperty("open",engine->newFunction(QIODevice_open));
  10358. value.setProperty("close",engine->newFunction(QIODevice_close));
  10359. value.setProperty("readToString",
  10360. engine->newFunction(QIODevice_readToString));
  10361. }
  10362. /*:77*//*78:*/
  10363. #line 2053 "./typica.w"
  10364. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  10365. {
  10366. QIODevice*self= getself<QIODevice*> (context);
  10367. if(context->argumentCount()==1)
  10368. {
  10369. switch(argument<int> (0,context))
  10370. {
  10371. case 1:
  10372. self->open(QIODevice::ReadOnly);
  10373. break;
  10374. case 2:
  10375. self->open(QIODevice::WriteOnly);
  10376. break;
  10377. case 3:
  10378. self->open(QIODevice::ReadWrite);
  10379. break;
  10380. default:
  10381. break;
  10382. }
  10383. }
  10384. else
  10385. {
  10386. self->open(QIODevice::ReadWrite);
  10387. }
  10388. return QScriptValue();
  10389. }
  10390. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  10391. {
  10392. QIODevice*self= getself<QIODevice*> (context);
  10393. self->close();
  10394. return QScriptValue();
  10395. }
  10396. /*:78*//*79:*/
  10397. #line 2092 "./typica.w"
  10398. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  10399. {
  10400. QIODevice*self= getself<QIODevice*> (context);
  10401. self->reset();
  10402. return QScriptValue(QString(self->readAll()));
  10403. }
  10404. /*:79*//*82:*/
  10405. #line 2122 "./typica.w"
  10406. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  10407. {
  10408. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  10409. QScriptValue object= engine->newQObject(new QBuffer(array));
  10410. setQBufferProperties(object,engine);
  10411. return object;
  10412. }
  10413. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  10414. {
  10415. setQIODeviceProperties(value,engine);
  10416. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  10417. }
  10418. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  10419. {
  10420. QBuffer*self= getself<QBuffer*> (context);
  10421. self->setData(argument<QString> (0,context).toAscii());
  10422. return QScriptValue();
  10423. }
  10424. /*:82*//*85:*/
  10425. #line 2170 "./typica.w"
  10426. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  10427. {
  10428. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  10429. setXQueryProperties(object,engine);
  10430. return object;
  10431. }
  10432. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  10433. {
  10434. value.setProperty("bind",engine->newFunction(XQuery_bind));
  10435. value.setProperty("exec",engine->newFunction(XQuery_exec));
  10436. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  10437. }
  10438. /*:85*//*86:*/
  10439. #line 2188 "./typica.w"
  10440. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  10441. {
  10442. QXmlQuery*self= getself<QXmlQuery*> (context);
  10443. QIODevice*buffer= argument<QIODevice*> (1,context);
  10444. self->bindVariable(argument<QString> (0,context),buffer);
  10445. return QScriptValue();
  10446. }
  10447. /*:86*//*87:*/
  10448. #line 2199 "./typica.w"
  10449. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  10450. {
  10451. QXmlQuery*self= getself<QXmlQuery*> (context);
  10452. self->setQuery(argument<QString> (0,context));
  10453. return QScriptValue();
  10454. }
  10455. /*:87*//*88:*/
  10456. #line 2209 "./typica.w"
  10457. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  10458. {
  10459. QXmlQuery*self= getself<QXmlQuery*> (context);
  10460. QString result;
  10461. self->evaluateTo(&result);
  10462. return QScriptValue(result);
  10463. }
  10464. /*:88*//*91:*/
  10465. #line 2264 "./typica.w"
  10466. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  10467. {
  10468. QXmlStreamWriter*retval;
  10469. if(context->argumentCount()==1)
  10470. {
  10471. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  10472. }
  10473. else
  10474. {
  10475. retval= new QXmlStreamWriter;
  10476. }
  10477. QScriptValue object= engine->toScriptValue<void*> (retval);
  10478. setXmlWriterProperties(object,engine);
  10479. return object;
  10480. }
  10481. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  10482. {
  10483. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  10484. value.setProperty("writeAttribute",
  10485. engine->newFunction(XmlWriter_writeAttribute));
  10486. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  10487. value.setProperty("writeCharacters",
  10488. engine->newFunction(XmlWriter_writeCharacters));
  10489. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  10490. value.setProperty("writeEmptyElement",
  10491. engine->newFunction(XmlWriter_writeEmptyElement));
  10492. value.setProperty("writeEndDocument",
  10493. engine->newFunction(XmlWriter_writeEndDocument));
  10494. value.setProperty("writeEndElement",
  10495. engine->newFunction(XmlWriter_writeEndElement));
  10496. value.setProperty("writeEntityReference",
  10497. engine->newFunction(XmlWriter_writeEntityReference));
  10498. value.setProperty("writeProcessingInstruction",
  10499. engine->newFunction(XmlWriter_writeProcessingInstruction));
  10500. value.setProperty("writeStartDocument",
  10501. engine->newFunction(XmlWriter_writeStartDocument));
  10502. value.setProperty("writeStartElement",
  10503. engine->newFunction(XmlWriter_writeStartElement));
  10504. value.setProperty("writeTextElement",
  10505. engine->newFunction(XmlWriter_writeTextElement));
  10506. }
  10507. /*:91*//*92:*/
  10508. #line 2311 "./typica.w"
  10509. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  10510. {
  10511. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10512. QIODevice*device= argument<QIODevice*> (0,context);
  10513. self->setDevice(device);
  10514. return QScriptValue();
  10515. }
  10516. /*:92*//*93:*/
  10517. #line 2325 "./typica.w"
  10518. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  10519. QScriptEngine*)
  10520. {
  10521. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10522. self->writeStartDocument(argument<QString> (0,context));
  10523. return QScriptValue();
  10524. }
  10525. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  10526. QScriptEngine*)
  10527. {
  10528. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10529. self->writeEndDocument();
  10530. return QScriptValue();
  10531. }
  10532. /*:93*//*94:*/
  10533. #line 2344 "./typica.w"
  10534. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  10535. {
  10536. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10537. self->writeDTD(argument<QString> (0,context));
  10538. return QScriptValue();
  10539. }
  10540. /*:94*//*95:*/
  10541. #line 2355 "./typica.w"
  10542. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  10543. QScriptEngine*)
  10544. {
  10545. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10546. self->writeStartElement(argument<QString> (0,context));
  10547. return QScriptValue();
  10548. }
  10549. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  10550. {
  10551. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10552. self->writeAttribute(argument<QString> (0,context),
  10553. argument<QString> (1,context));
  10554. return QScriptValue();
  10555. }
  10556. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  10557. {
  10558. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10559. self->writeCharacters(argument<QString> (0,context));
  10560. return QScriptValue();
  10561. }
  10562. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  10563. {
  10564. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10565. self->writeEndElement();
  10566. return QScriptValue();
  10567. }
  10568. /*:95*//*96:*/
  10569. #line 2391 "./typica.w"
  10570. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  10571. QScriptEngine*)
  10572. {
  10573. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10574. self->writeEmptyElement(argument<QString> (0,context));
  10575. return QScriptValue();
  10576. }
  10577. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  10578. QScriptEngine*)
  10579. {
  10580. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10581. self->writeTextElement(argument<QString> (0,context),
  10582. argument<QString> (1,context));
  10583. return QScriptValue();
  10584. }
  10585. /*:96*//*97:*/
  10586. #line 2412 "./typica.w"
  10587. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  10588. {
  10589. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10590. self->writeCDATA(argument<QString> (0,context));
  10591. return QScriptValue();
  10592. }
  10593. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  10594. QScriptEngine*)
  10595. {
  10596. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10597. self->writeEntityReference(argument<QString> (0,context));
  10598. return QScriptValue();
  10599. }
  10600. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  10601. QScriptEngine*)
  10602. {
  10603. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10604. self->writeProcessingInstruction(argument<QString> (0,context),
  10605. argument<QString> (1,context));
  10606. return QScriptValue();
  10607. }
  10608. /*:97*//*100:*/
  10609. #line 2471 "./typica.w"
  10610. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  10611. {
  10612. QXmlStreamReader*retval=
  10613. new QXmlStreamReader(argument<QIODevice*> (0,context));
  10614. QScriptValue object= engine->toScriptValue<void*> (retval);
  10615. setXmlReaderProperties(object,engine);
  10616. return object;
  10617. }
  10618. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  10619. {
  10620. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  10621. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  10622. value.setProperty("hasAttribute",
  10623. engine->newFunction(XmlReader_hasAttribute));
  10624. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  10625. value.setProperty("isStartElement",
  10626. engine->newFunction(XmlReader_isStartElement));
  10627. value.setProperty("name",engine->newFunction(XmlReader_name));
  10628. value.setProperty("readElementText",
  10629. engine->newFunction(XmlReader_readElementText));
  10630. value.setProperty("readNext",
  10631. engine->newFunction(XmlReader_readNext));
  10632. value.setProperty("text",engine->newFunction(XmlReader_text));
  10633. }
  10634. /*:100*//*101:*/
  10635. #line 2501 "./typica.w"
  10636. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  10637. {
  10638. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10639. QString retval=
  10640. self->attributes().value(argument<QString> (0,context)).toString();
  10641. return QScriptValue(retval);
  10642. }
  10643. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  10644. {
  10645. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10646. bool retval=
  10647. self->attributes().hasAttribute(argument<QString> (0,context));
  10648. return QScriptValue(retval);
  10649. }
  10650. /*:101*//*102:*/
  10651. #line 2521 "./typica.w"
  10652. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  10653. {
  10654. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10655. return QScriptValue(self->atEnd());
  10656. }
  10657. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  10658. {
  10659. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10660. return QScriptValue(self->isDTD());
  10661. }
  10662. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  10663. {
  10664. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10665. return QScriptValue(self->isStartElement());
  10666. }
  10667. /*:102*//*103:*/
  10668. #line 2542 "./typica.w"
  10669. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  10670. {
  10671. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10672. self->readNext();
  10673. return QScriptValue();
  10674. }
  10675. /*:103*//*104:*/
  10676. #line 2552 "./typica.w"
  10677. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  10678. {
  10679. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10680. return QScriptValue(self->name().toString());
  10681. }
  10682. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  10683. {
  10684. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10685. return QScriptValue(self->readElementText());
  10686. }
  10687. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  10688. {
  10689. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10690. return QScriptValue(self->text().toString());
  10691. }
  10692. /*:104*//*107:*/
  10693. #line 2594 "./typica.w"
  10694. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  10695. {
  10696. setQObjectProperties(value,engine);
  10697. value.setProperty("value",engine->newFunction(QSettings_value));
  10698. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  10699. }
  10700. /*:107*//*108:*/
  10701. #line 2606 "./typica.w"
  10702. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  10703. {
  10704. QScriptValue object;
  10705. if(context->argumentCount()==1||context->argumentCount()==2)
  10706. {
  10707. QSettings settings;
  10708. QString key= argument<QString> (0,context);
  10709. QVariant value;
  10710. QVariant retval;
  10711. if(context->argumentCount()> 1)
  10712. {
  10713. value= argument<QVariant> (1,context);
  10714. retval= settings.value(key,value);
  10715. }
  10716. else
  10717. {
  10718. retval= settings.value(key);
  10719. }
  10720. object= engine->newVariant(retval);
  10721. }
  10722. else
  10723. {
  10724. context->throwError("Incorrect number of arguments passed to "
  10725. "QSettings::value(). This method takes one "
  10726. "string and one optional variant type.");
  10727. }
  10728. return object;
  10729. }
  10730. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  10731. {
  10732. if(context->argumentCount()==2)
  10733. {
  10734. QSettings settings;
  10735. QString key= argument<QString> (0,context);
  10736. QVariant value= argument<QVariant> (1,context);
  10737. settings.setValue(key,value);
  10738. }
  10739. else
  10740. {
  10741. context->throwError("Incorrect number of arguments passed to "
  10742. "QSettings::setValue(). This method takes one "
  10743. "string and one variant type for a total of two "
  10744. "arguments.");
  10745. }
  10746. return QScriptValue();
  10747. }
  10748. /*:108*//*111:*/
  10749. #line 2675 "./typica.w"
  10750. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  10751. {
  10752. QScriptValue object= engine->newQObject(new QLCDNumber());
  10753. setQLCDNumberProperties(object,engine);
  10754. return object;
  10755. }
  10756. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  10757. {
  10758. setQFrameProperties(value,engine);
  10759. }
  10760. /*:111*//*114:*/
  10761. #line 2733 "./typica.w"
  10762. QScriptValue constructQTime(QScriptContext*context,
  10763. QScriptEngine*engine)
  10764. {
  10765. QScriptValue object;
  10766. if(context->argumentCount()==0||
  10767. (context->argumentCount()>=2&&context->argumentCount()<=4))
  10768. {
  10769. int arg1= 0;
  10770. int arg2= 0;
  10771. int arg3= 0;
  10772. int arg4= 0;
  10773. switch(context->argumentCount())
  10774. {
  10775. case 4:
  10776. arg4= argument<int> (3,context);
  10777. case 3:
  10778. arg3= argument<int> (2,context);
  10779. case 2:
  10780. arg2= argument<int> (1,context);
  10781. arg1= argument<int> (0,context);
  10782. default:
  10783. break;
  10784. }
  10785. if(context->argumentCount())
  10786. {
  10787. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  10788. arg4));
  10789. }
  10790. else
  10791. {
  10792. object= engine->toScriptValue<QTime> (QTime());
  10793. }
  10794. setQTimeProperties(object,engine);
  10795. }
  10796. else
  10797. {
  10798. context->throwError("Incorrect number of arguments passed to "
  10799. "QTime::QTime(). This method takes zero, two, "
  10800. "three, or four integer arguments.");
  10801. }
  10802. return object;
  10803. }
  10804. /*:114*//*115:*/
  10805. #line 2781 "./typica.w"
  10806. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  10807. {
  10808. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  10809. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  10810. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  10811. value.setProperty("hour",engine->newFunction(QTime_hour));
  10812. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  10813. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  10814. value.setProperty("minute",engine->newFunction(QTime_minute));
  10815. value.setProperty("msec",engine->newFunction(QTime_msec));
  10816. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  10817. value.setProperty("restart",engine->newFunction(QTime_restart));
  10818. value.setProperty("second",engine->newFunction(QTime_second));
  10819. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  10820. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  10821. value.setProperty("start",engine->newFunction(QTime_start));
  10822. value.setProperty("toString",engine->newFunction(QTime_toString));
  10823. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  10824. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  10825. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  10826. }
  10827. /*:115*//*116:*/
  10828. #line 2810 "./typica.w"
  10829. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  10830. {
  10831. QTime self= getself<QTime> (context);
  10832. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  10833. (self.second()*1000)+self.msec();
  10834. return QScriptValue(retval);
  10835. }
  10836. /*:116*//*117:*/
  10837. #line 2824 "./typica.w"
  10838. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  10839. {
  10840. QTime time;
  10841. QScriptValue retval;
  10842. if(context->argumentCount()==1)
  10843. {
  10844. QTime self= getself<QTime> (context);
  10845. time= self.addMSecs(argument<int> (0,context));
  10846. retval= engine->toScriptValue<QTime> (time);
  10847. setQTimeProperties(retval,engine);
  10848. }
  10849. else
  10850. {
  10851. context->throwError("Incorrect number of arguments passed to "
  10852. "QTime::addMSecs(). This method takes one "
  10853. "integer as an argument.");
  10854. }
  10855. return retval;
  10856. }
  10857. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  10858. {
  10859. QTime time;
  10860. QScriptValue retval;
  10861. if(context->argumentCount()==1)
  10862. {
  10863. QTime self= getself<QTime> (context);
  10864. time= self.addSecs(argument<int> (0,context));
  10865. retval= engine->toScriptValue<QTime> (time);
  10866. setQTimeProperties(retval,engine);
  10867. }
  10868. else
  10869. {
  10870. context->throwError("Incorrect number of arguments passed to "
  10871. "QTime::addSecs(). This method takes one "
  10872. "integer as an argument.");
  10873. }
  10874. return retval;
  10875. }
  10876. /*:117*//*118:*/
  10877. #line 2867 "./typica.w"
  10878. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  10879. {
  10880. QScriptValue retval;
  10881. if(context->argumentCount()==0)
  10882. {
  10883. QTime self= getself<QTime> (context);
  10884. retval= QScriptValue(engine,self.elapsed());
  10885. }
  10886. else
  10887. {
  10888. context->throwError("Incorrect number of arguments passed to "
  10889. "QTime::elapsed(). This method takes no "
  10890. "arguments.");
  10891. }
  10892. return retval;
  10893. }
  10894. /*:118*//*119:*/
  10895. #line 2888 "./typica.w"
  10896. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  10897. {
  10898. QScriptValue retval;
  10899. if(context->argumentCount()==0)
  10900. {
  10901. QTime self= getself<QTime> (context);
  10902. retval= QScriptValue(engine,self.hour());
  10903. }
  10904. else
  10905. {
  10906. context->throwError("Incorrect number of arguments passed to "
  10907. "QTime::hour(). This method takes no "
  10908. "arguments.");
  10909. }
  10910. return retval;
  10911. }
  10912. /*:119*//*120:*/
  10913. #line 2908 "./typica.w"
  10914. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  10915. {
  10916. QScriptValue retval;
  10917. if(context->argumentCount()==0)
  10918. {
  10919. QTime self= getself<QTime> (context);
  10920. retval= QScriptValue(engine,self.minute());
  10921. }
  10922. else
  10923. {
  10924. context->throwError("Incorrect number of arguments passed to "
  10925. "QTime::minute(). This method takes no "
  10926. "arguments.");
  10927. }
  10928. return retval;
  10929. }
  10930. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  10931. {
  10932. QScriptValue retval;
  10933. if(context->argumentCount()==0)
  10934. {
  10935. QTime self= getself<QTime> (context);
  10936. retval= QScriptValue(engine,self.second());
  10937. }
  10938. else
  10939. {
  10940. context->throwError("Incorrect number of arguments passed to "
  10941. "QTime::second(). This method takes no "
  10942. "arguments.");
  10943. }
  10944. return retval;
  10945. }
  10946. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  10947. {
  10948. QScriptValue retval;
  10949. if(context->argumentCount()==0)
  10950. {
  10951. QTime self= getself<QTime> (context);
  10952. retval= QScriptValue(engine,self.msec());
  10953. }
  10954. else
  10955. {
  10956. context->throwError("Incorrect number of arguments passed to "
  10957. "QTime::msec(). This method takes no "
  10958. "arguments.");
  10959. }
  10960. return retval;
  10961. }
  10962. /*:120*//*121:*/
  10963. #line 2964 "./typica.w"
  10964. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  10965. {
  10966. QScriptValue retval;
  10967. if(context->argumentCount()==0)
  10968. {
  10969. QTime self= getself<QTime> (context);
  10970. retval= QScriptValue(engine,self.isNull());
  10971. }
  10972. else
  10973. {
  10974. context->throwError("Incorrect number of arguments passed to "
  10975. "QTime::isNull(). This method takes no "
  10976. "arguments.");
  10977. }
  10978. return retval;
  10979. }
  10980. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  10981. {
  10982. QScriptValue retval;
  10983. if(context->argumentCount()==0)
  10984. {
  10985. QTime self= getself<QTime> (context);
  10986. retval= QScriptValue(engine,self.isValid());
  10987. }
  10988. else
  10989. {
  10990. context->throwError("Incorrect number of arguments passed to "
  10991. "QTime::isValid(). This method takes no "
  10992. "arguments.");
  10993. }
  10994. return retval;
  10995. }
  10996. /*:121*//*122:*/
  10997. #line 3002 "./typica.w"
  10998. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  10999. {
  11000. QScriptValue retval;
  11001. if(context->argumentCount()==1)
  11002. {
  11003. QTime self= getself<QTime> (context);
  11004. QTime arg= argument<QVariant> (0,context).toTime();
  11005. retval= QScriptValue(engine,self.msecsTo(arg));
  11006. }
  11007. else
  11008. {
  11009. context->throwError("Incorrect number of arguments passed to "
  11010. "QTime::msecsTo(). This method takes one QTime.");
  11011. }
  11012. return retval;
  11013. }
  11014. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  11015. {
  11016. QScriptValue retval;
  11017. if(context->argumentCount()==1)
  11018. {
  11019. QTime self= getself<QTime> (context);
  11020. QTime arg= argument<QVariant> (0,context).toTime();
  11021. retval= QScriptValue(engine,self.secsTo(arg));
  11022. }
  11023. else
  11024. {
  11025. context->throwError("Incorrect number of arguments passed to "
  11026. "QTime::secsTo(). This method takes one QTime.");
  11027. }
  11028. return retval;
  11029. }
  11030. /*:122*//*123:*/
  11031. #line 3041 "./typica.w"
  11032. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  11033. {
  11034. QScriptValue retval;
  11035. if(context->argumentCount()==0)
  11036. {
  11037. QTime self= getself<QTime> (context);
  11038. retval= QScriptValue(engine,self.restart());
  11039. }
  11040. else
  11041. {
  11042. context->throwError("Incorrect number of arguments passed to "
  11043. "QTime::restart(). This method takes no "
  11044. "arguments.");
  11045. }
  11046. return retval;
  11047. }
  11048. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  11049. {
  11050. if(context->argumentCount()==0)
  11051. {
  11052. QTime self= getself<QTime> (context);
  11053. self.start();
  11054. }
  11055. else
  11056. {
  11057. context->throwError("Incorrect number of arguments passed to "
  11058. "QTime::start(). This method takes no arguments.");
  11059. }
  11060. return QScriptValue();
  11061. }
  11062. /*:123*//*124:*/
  11063. #line 3077 "./typica.w"
  11064. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  11065. {
  11066. QScriptValue retval;
  11067. if(context->argumentCount()==3||context->argumentCount()==4)
  11068. {
  11069. QTime self= getself<QTime> (context);
  11070. int arg1= 0;
  11071. int arg2= 0;
  11072. int arg3= 0;
  11073. int arg4= 0;
  11074. switch(context->argumentCount())
  11075. {
  11076. case 4:
  11077. arg4= argument<int> (3,context);
  11078. case 3:
  11079. arg3= argument<int> (2,context);
  11080. arg2= argument<int> (1,context);
  11081. arg1= argument<int> (0,context);
  11082. default:
  11083. break;
  11084. }
  11085. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  11086. }
  11087. else
  11088. {
  11089. context->throwError("Incorrect number of arguments passed to "
  11090. "QTime::setHMS(). This method takes three or "
  11091. "four integer arguments.");
  11092. }
  11093. return retval;
  11094. }
  11095. /*:124*//*125:*/
  11096. #line 3113 "./typica.w"
  11097. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  11098. {
  11099. QScriptValue retval;
  11100. if(context->argumentCount()==1)
  11101. {
  11102. QTime self= getself<QTime> (context);
  11103. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  11104. }
  11105. else
  11106. {
  11107. context->throwError("Incorrect number of arguments passed to "
  11108. "QTime::toString(). This method takes one QString "
  11109. "as an argument.");
  11110. }
  11111. return retval;
  11112. }
  11113. /*:125*//*126:*/
  11114. #line 3134 "./typica.w"
  11115. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  11116. {
  11117. QScriptValue object;
  11118. object= engine->toScriptValue<QTime> (QTime::currentTime());
  11119. setQTimeProperties(object,engine);
  11120. return object;
  11121. }
  11122. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  11123. {
  11124. QScriptValue object;
  11125. if(context->argumentCount()==2)
  11126. {
  11127. QString time= argument<QString> (0,context);
  11128. QString format= argument<QString> (1,context);
  11129. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  11130. setQTimeProperties(object,engine);
  11131. }
  11132. else
  11133. {
  11134. context->throwError("Incorrect number of arguments passed to "
  11135. "QTime::fromString(). This method takes two "
  11136. "string arguments.");
  11137. }
  11138. return object;
  11139. }
  11140. /*:126*//*128:*/
  11141. #line 3174 "./typica.w"
  11142. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  11143. {
  11144. setQFrameProperties(value,engine);
  11145. }
  11146. /*:128*//*130:*/
  11147. #line 3188 "./typica.w"
  11148. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  11149. {
  11150. setQAbstractScrollAreaProperties(value,engine);
  11151. }
  11152. /*:130*//*132:*/
  11153. #line 3202 "./typica.w"
  11154. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  11155. {
  11156. setQAbstractScrollAreaProperties(value,engine);
  11157. }
  11158. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  11159. {
  11160. setQAbstractItemViewProperties(value,engine);
  11161. }
  11162. /*:132*//*135:*/
  11163. #line 3235 "./typica.w"
  11164. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  11165. {
  11166. QScriptValue object= engine->newQObject(new QPushButton());
  11167. setQPushButtonProperties(object,engine);
  11168. return object;
  11169. }
  11170. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  11171. {
  11172. setQAbstractButtonProperties(value,engine);
  11173. }
  11174. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  11175. {
  11176. setQWidgetProperties(value,engine);
  11177. }
  11178. /*:135*//*142:*/
  11179. #line 3347 "./typica.w"
  11180. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  11181. {
  11182. QScriptValue object=
  11183. engine->toScriptValue<void*> (new SqlQueryConnection());
  11184. setQSqlQueryProperties(object,engine);
  11185. return object;
  11186. }
  11187. /*:142*//*143:*/
  11188. #line 3359 "./typica.w"
  11189. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  11190. {
  11191. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  11192. value.setProperty("bindFileData",
  11193. engine->newFunction(QSqlQuery_bindFileData));
  11194. value.setProperty("bindDeviceData",
  11195. engine->newFunction(QSqlQuery_bindDeviceData));
  11196. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  11197. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  11198. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  11199. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  11200. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  11201. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  11202. }
  11203. /*:143*//*144:*/
  11204. #line 3377 "./typica.w"
  11205. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  11206. {
  11207. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11208. QScriptValue retval;
  11209. if(context->argumentCount()==1)
  11210. {
  11211. retval= QScriptValue(engine,
  11212. query->exec(argument<QString> (0,context)));
  11213. }
  11214. else
  11215. {
  11216. retval= QScriptValue(engine,query->exec());
  11217. }
  11218. if(query->lastError().isValid())
  11219. {
  11220. qDebug()<<query->lastQuery();
  11221. qDebug()<<query->lastError().text();
  11222. }
  11223. return retval;
  11224. }
  11225. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  11226. {
  11227. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11228. return QScriptValue(query->lastQuery());
  11229. }
  11230. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  11231. {
  11232. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11233. return QScriptValue(engine,query->next());
  11234. }
  11235. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  11236. {
  11237. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11238. return QScriptValue(engine,
  11239. query->value(argument<int> (0,context)).toString());
  11240. }
  11241. /*:144*//*145:*/
  11242. #line 3421 "./typica.w"
  11243. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  11244. {
  11245. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11246. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  11247. }
  11248. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  11249. {
  11250. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11251. query->bindValue(argument<QString> (0,context),
  11252. argument<QVariant> (1,context));
  11253. return QScriptValue();
  11254. }
  11255. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  11256. QScriptEngine*)
  11257. {
  11258. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11259. QString placeholder= argument<QString> (0,context);
  11260. QString filename= argument<QString> (1,context);
  11261. QFile file(filename);
  11262. QByteArray data;
  11263. if(file.open(QIODevice::ReadOnly))
  11264. {
  11265. data= file.readAll();
  11266. file.close();
  11267. }
  11268. query->bindValue(placeholder,data);
  11269. return QScriptValue();
  11270. }
  11271. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  11272. QScriptEngine*)
  11273. {
  11274. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11275. QString placeholder= argument<QString> (0,context);
  11276. QIODevice*device= argument<QIODevice*> (1,context);
  11277. device->reset();
  11278. QByteArray data;
  11279. data= device->readAll();
  11280. query->bindValue(placeholder,data);
  11281. return QScriptValue();
  11282. }
  11283. /*:145*//*146:*/
  11284. #line 3473 "./typica.w"
  11285. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  11286. {
  11287. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11288. delete query;
  11289. return QScriptValue::UndefinedValue;
  11290. }
  11291. /*:146*//*149:*/
  11292. #line 3514 "./typica.w"
  11293. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  11294. {
  11295. QFileInfo info(argument<QString> (0,context));
  11296. QScriptValue retval(engine,info.baseName());
  11297. return retval;
  11298. }
  11299. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  11300. {
  11301. QFileInfo info(argument<QString> (0,context));
  11302. QDir dir= info.dir();
  11303. QScriptValue retval(engine,dir.path());
  11304. return retval;
  11305. }
  11306. /*:149*//*150:*/
  11307. #line 3533 "./typica.w"
  11308. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  11309. {
  11310. QString source= argument<QString> (0,context);
  11311. source.remove(0,1);
  11312. source.chop(1);
  11313. QStringList elements= source.split(",");
  11314. QString element;
  11315. QScriptValue dest= engine->newArray(elements.size());
  11316. int i= 0;
  11317. foreach(element,elements)
  11318. {
  11319. if(element.startsWith("\"")&&element.endsWith("\""))
  11320. {
  11321. element.chop(1);
  11322. element= element.remove(0,1);
  11323. }
  11324. dest.setProperty(i,QScriptValue(engine,element));
  11325. i++;
  11326. }
  11327. return dest;
  11328. }
  11329. /*:150*//*151:*/
  11330. #line 3559 "./typica.w"
  11331. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  11332. {
  11333. QString font= argument<QString> (0,context);
  11334. QString classname;
  11335. if(context->argumentCount()> 1)
  11336. {
  11337. classname= argument<QString> (1,context);
  11338. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  11339. }
  11340. else
  11341. {
  11342. QApplication::setFont(QFont(font));
  11343. }
  11344. return QScriptValue();
  11345. }
  11346. /*:151*//*152:*/
  11347. #line 3579 "./typica.w"
  11348. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  11349. {
  11350. SqlQueryConnection query;
  11351. QString q= "SELECT file FROM files WHERE id = :file";
  11352. query.prepare(q);
  11353. query.bindValue(":file",argument<int> (0,context));
  11354. query.exec();
  11355. query.next();
  11356. QByteArray array= query.value(0).toByteArray();
  11357. QBuffer buffer(&array);
  11358. buffer.open(QIODevice::ReadOnly);
  11359. QXmlQuery xquery;
  11360. xquery.bindVariable("profile",&buffer);
  11361. QString xq;
  11362. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  11363. xquery.setQuery(xq);
  11364. QString result;
  11365. xquery.evaluateTo(&result);
  11366. return QScriptValue(result);
  11367. }
  11368. /*:152*//*153:*/
  11369. #line 3605 "./typica.w"
  11370. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  11371. {
  11372. QWidget::setTabOrder(argument<QWidget*> (0,context),
  11373. argument<QWidget*> (1,context));
  11374. return QScriptValue();
  11375. }
  11376. /*:153*//*160:*/
  11377. #line 3844 "./typica.w"
  11378. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  11379. {
  11380. QString targetID= argument<QString> (0,context);
  11381. QDomNode element;
  11382. QScriptValue object;
  11383. /*161:*/
  11384. #line 3865 "./typica.w"
  11385. QDomNodeList windows=
  11386. AppInstance->configuration()->documentElement().elementsByTagName("window");
  11387. QDomNode nullNode;
  11388. int i= 0;
  11389. element= nullNode;
  11390. while(i<windows.count())
  11391. {
  11392. element= windows.at(i);
  11393. QDomNamedNodeMap attributes= element.attributes();
  11394. if(attributes.contains("id"))
  11395. {
  11396. if(attributes.namedItem("id").toAttr().value()==targetID)
  11397. {
  11398. break;
  11399. }
  11400. }
  11401. element= nullNode;
  11402. i++;
  11403. }
  11404. /*:161*/
  11405. #line 3850 "./typica.w"
  11406. if(!element.isNull())
  11407. {
  11408. /*162:*/
  11409. #line 3897 "./typica.w"
  11410. ScriptQMainWindow*window= new ScriptQMainWindow;
  11411. window->setObjectName(targetID);
  11412. object= engine->newQObject(window);
  11413. setQMainWindowProperties(object,engine);
  11414. QWidget*central= new(QWidget);
  11415. central->setParent(window);
  11416. central->setObjectName("centralWidget");
  11417. window->setCentralWidget(central);
  11418. if(element.hasChildNodes())
  11419. {
  11420. /*163:*/
  11421. #line 3932 "./typica.w"
  11422. QStack<QWidget*> widgetStack;
  11423. QStack<QLayout*> layoutStack;
  11424. QString windowScript;
  11425. widgetStack.push(central);
  11426. QDomNodeList windowChildren= element.childNodes();
  11427. int i= 0;
  11428. while(i<windowChildren.count())
  11429. {
  11430. QDomNode current;
  11431. QDomElement element;
  11432. current= windowChildren.at(i);
  11433. if(current.isElement())
  11434. {
  11435. element= current.toElement();
  11436. if(element.tagName()=="program")
  11437. {
  11438. windowScript.append(element.text());
  11439. }
  11440. else if(element.tagName()=="layout")
  11441. {
  11442. addLayoutToWidget(element,&widgetStack,&layoutStack);
  11443. }
  11444. else if(element.tagName()=="menu")
  11445. {
  11446. /*164:*/
  11447. #line 3979 "./typica.w"
  11448. QMenuBar*bar= window->menuBar();
  11449. bar->setParent(window);
  11450. bar->setObjectName("menuBar");
  11451. if(element.hasAttribute("name"))
  11452. {
  11453. QMenu*menu= bar->addMenu(element.attribute("name"));
  11454. menu->setParent(bar);
  11455. if(element.hasAttribute("type"))
  11456. {
  11457. if(element.attribute("type")=="reports")
  11458. {
  11459. if(element.hasAttribute("src"))
  11460. {
  11461. /*547:*/
  11462. #line 12776 "./typica.w"
  11463. QSettings settings;
  11464. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  11465. arg(element.attribute("src")));
  11466. directory.setFilter(QDir::Files);
  11467. directory.setSorting(QDir::Name);
  11468. QStringList nameFilter;
  11469. nameFilter<<"*.xml";
  11470. directory.setNameFilters(nameFilter);
  11471. QFileInfoList reportFiles= directory.entryInfoList();
  11472. for(int i= 0;i<reportFiles.size();i++)
  11473. {
  11474. QFileInfo reportFile= reportFiles.at(i);
  11475. /*551:*/
  11476. #line 12853 "./typica.w"
  11477. QString path= reportFile.absoluteFilePath();
  11478. QFile file(path);
  11479. if(file.open(QIODevice::ReadOnly))
  11480. {
  11481. QDomDocument document;
  11482. document.setContent(&file,true);
  11483. QDomElement root= document.documentElement();
  11484. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  11485. if(!titleNode.isNull())
  11486. {
  11487. QDomElement titleElement= titleNode.toElement();
  11488. QString title= titleElement.text();
  11489. if(!title.isEmpty())
  11490. {
  11491. QStringList hierarchy= title.split(":->");
  11492. QMenu*insertionPoint= menu;
  11493. /*552:*/
  11494. #line 12880 "./typica.w"
  11495. for(int j= 0;j<hierarchy.size()-1;j++)
  11496. {
  11497. QObjectList menuList= insertionPoint->children();
  11498. bool menuFound= false;
  11499. for(int k= 0;k<menuList.size();k++)
  11500. {
  11501. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  11502. if(currentItem)
  11503. {
  11504. if(currentItem->title()==hierarchy.at(j))
  11505. {
  11506. menuFound= true;
  11507. insertionPoint= currentItem;
  11508. break;
  11509. }
  11510. }
  11511. }
  11512. if(!menuFound)
  11513. {
  11514. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  11515. }
  11516. }
  11517. /*:552*/
  11518. #line 12870 "./typica.w"
  11519. ReportAction*action= new ReportAction(path,hierarchy.last());
  11520. insertionPoint->addAction(action);
  11521. }
  11522. }
  11523. }
  11524. /*:551*/
  11525. #line 12789 "./typica.w"
  11526. }
  11527. /*:547*/
  11528. #line 3993 "./typica.w"
  11529. }
  11530. }
  11531. }
  11532. if(element.hasChildNodes())
  11533. {
  11534. /*165:*/
  11535. #line 4006 "./typica.w"
  11536. QDomNodeList menuItems= element.childNodes();
  11537. int j= 0;
  11538. while(j<menuItems.count())
  11539. {
  11540. QDomNode item= menuItems.at(j);
  11541. if(item.isElement())
  11542. {
  11543. QDomElement itemElement= item.toElement();
  11544. if(itemElement.tagName()=="item")
  11545. {
  11546. QAction*itemAction= new QAction(itemElement.text(),menu);
  11547. if(itemElement.hasAttribute("id"))
  11548. {
  11549. itemAction->setObjectName(itemElement.attribute("id"));
  11550. }
  11551. if(itemElement.hasAttribute("shortcut"))
  11552. {
  11553. itemAction->setShortcut(itemElement.attribute("shortcut"));
  11554. }
  11555. menu->addAction(itemAction);
  11556. }
  11557. else if(itemElement.tagName()=="separator")
  11558. {
  11559. menu->addSeparator();
  11560. }
  11561. }
  11562. j++;
  11563. }
  11564. #line 1 "./helpmenu.w"
  11565. /*:165*/
  11566. #line 3999 "./typica.w"
  11567. }
  11568. }
  11569. /*:164*/
  11570. #line 3957 "./typica.w"
  11571. }
  11572. }
  11573. i++;
  11574. }
  11575. QScriptValue oldThis= context->thisObject();
  11576. context->setThisObject(object);
  11577. QScriptValue result= engine->evaluate(windowScript);
  11578. /*157:*/
  11579. #line 3746 "./typica.w"
  11580. if(engine->hasUncaughtException())
  11581. {
  11582. int line= engine->uncaughtExceptionLineNumber();
  11583. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  11584. result.toString();
  11585. QString trace;
  11586. foreach(trace,engine->uncaughtExceptionBacktrace())
  11587. {
  11588. qDebug()<<trace;
  11589. }
  11590. }
  11591. /*:157*/
  11592. #line 3965 "./typica.w"
  11593. context->setThisObject(oldThis);
  11594. /*:163*/
  11595. #line 3908 "./typica.w"
  11596. }
  11597. /*166:*/
  11598. #line 9 "./helpmenu.w"
  11599. HelpMenu*helpMenu= new HelpMenu();
  11600. window->menuBar()->addMenu(helpMenu);
  11601. /*:166*/
  11602. #line 3910 "./typica.w"
  11603. window->show();
  11604. /*:162*/
  11605. #line 3853 "./typica.w"
  11606. }
  11607. return object;
  11608. }
  11609. /*:160*//*171:*/
  11610. #line 4048 "./typica.w"
  11611. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  11612. QStack<QLayout*> *layoutStack)
  11613. {
  11614. if(element.hasAttribute("type"))
  11615. {
  11616. /*172:*/
  11617. #line 4069 "./typica.w"
  11618. QLayout*layout;
  11619. QString layoutType= element.attribute("type");
  11620. if(layoutType=="horizontal")
  11621. {
  11622. layout= new QHBoxLayout;
  11623. layoutStack->push(layout);
  11624. populateBoxLayout(element,widgetStack,layoutStack);
  11625. }
  11626. else if(layoutType=="vertical")
  11627. {
  11628. layout= new QVBoxLayout;
  11629. layoutStack->push(layout);
  11630. populateBoxLayout(element,widgetStack,layoutStack);
  11631. }
  11632. else if(layoutType=="grid")
  11633. {
  11634. layout= new QGridLayout;
  11635. layoutStack->push(layout);
  11636. populateGridLayout(element,widgetStack,layoutStack);
  11637. }
  11638. else if(layoutType=="stack")
  11639. {
  11640. layout= new QStackedLayout;
  11641. layoutStack->push(layout);
  11642. populateStackedLayout(element,widgetStack,layoutStack);
  11643. }
  11644. if(element.hasAttribute("id"))
  11645. {
  11646. layout->setObjectName(element.attribute("id"));
  11647. }
  11648. /*:172*/
  11649. #line 4054 "./typica.w"
  11650. QWidget*widget= widgetStack->top();
  11651. if(layout)
  11652. {
  11653. widget->setLayout(layout);
  11654. }
  11655. layoutStack->pop();
  11656. }
  11657. }
  11658. /*:171*//*173:*/
  11659. #line 4107 "./typica.w"
  11660. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11661. QStack<QLayout*> *layoutStack)
  11662. {
  11663. QDomNodeList children= element.childNodes();
  11664. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  11665. for(int i= 0;i<children.count();i++)
  11666. {
  11667. QDomNode current;
  11668. QDomElement currentElement;
  11669. current= children.at(i);
  11670. if(current.isElement())
  11671. {
  11672. currentElement= current.toElement();
  11673. if(currentElement.tagName()=="page")
  11674. {
  11675. QWidget*widget= new QWidget;
  11676. layout->addWidget(widget);
  11677. widgetStack->push(widget);
  11678. populateWidget(currentElement,widgetStack,layoutStack);
  11679. widgetStack->pop();
  11680. }
  11681. }
  11682. }
  11683. }
  11684. /*:173*//*174:*/
  11685. #line 4139 "./typica.w"
  11686. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11687. QStack<QLayout*> *layoutStack)
  11688. {
  11689. QDomNodeList children= element.childNodes();
  11690. int row= -1;
  11691. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  11692. for(int i= 0;i<children.count();i++)
  11693. {
  11694. QDomNode current;
  11695. QDomElement currentElement;
  11696. current= children.at(i);
  11697. if(current.isElement())
  11698. {
  11699. currentElement= current.toElement();
  11700. if(currentElement.tagName()=="row")
  11701. {
  11702. row++;
  11703. if(currentElement.hasAttribute("height"))
  11704. {
  11705. layout->setRowMinimumHeight(row,
  11706. currentElement.attribute("height").toInt());
  11707. }
  11708. if(currentElement.hasAttribute("stretch"))
  11709. {
  11710. layout->setRowStretch(row,
  11711. currentElement.attribute("stretch").toInt());
  11712. }
  11713. /*175:*/
  11714. #line 4195 "./typica.w"
  11715. int column= -1;
  11716. QDomNodeList rowChildren= currentElement.childNodes();
  11717. for(int j= 0;j<rowChildren.count();j++)
  11718. {
  11719. QDomNode columnNode;
  11720. QDomElement columnElement;
  11721. columnNode= rowChildren.at(j);
  11722. if(columnNode.isElement())
  11723. {
  11724. columnElement= columnNode.toElement();
  11725. if(columnElement.tagName()=="column")
  11726. {
  11727. column++;
  11728. if(columnElement.hasAttribute("column"))
  11729. {
  11730. column= columnElement.attribute("column").toInt();
  11731. }
  11732. if(columnElement.hasAttribute("width"))
  11733. {
  11734. layout->setColumnMinimumWidth(column,
  11735. columnElement.attribute("width").toInt());
  11736. }
  11737. if(columnElement.hasAttribute("stretch"))
  11738. {
  11739. layout->setColumnStretch(column,
  11740. columnElement.attribute("stretch").toInt());
  11741. }
  11742. int hspan= 1;
  11743. int vspan= 1;
  11744. if(columnElement.hasAttribute("rowspan"))
  11745. {
  11746. vspan= columnElement.attribute("rowspan").toInt();
  11747. }
  11748. if(columnElement.hasAttribute("colspan"))
  11749. {
  11750. hspan= columnElement.attribute("colspan").toInt();
  11751. }
  11752. QHBoxLayout*cell= new QHBoxLayout;
  11753. layout->addLayout(cell,row,column,vspan,hspan);
  11754. layoutStack->push(cell);
  11755. populateBoxLayout(columnElement,widgetStack,layoutStack);
  11756. layoutStack->pop();
  11757. }
  11758. }
  11759. }
  11760. /*:175*/
  11761. #line 4167 "./typica.w"
  11762. }
  11763. }
  11764. }
  11765. }
  11766. /*:174*//*176:*/
  11767. #line 4245 "./typica.w"
  11768. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11769. QStack<QLayout*> *layoutStack)
  11770. {
  11771. QDomNodeList children= element.childNodes();
  11772. for(int i= 0;i<children.count();i++)
  11773. {
  11774. QDomNode current;
  11775. QDomElement currentElement;
  11776. current= children.at(i);
  11777. if(current.isElement())
  11778. {
  11779. currentElement= current.toElement();
  11780. if(currentElement.tagName()=="button")
  11781. {
  11782. addButtonToLayout(currentElement,widgetStack,layoutStack);
  11783. }
  11784. else if(currentElement.tagName()=="calendar")
  11785. {
  11786. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  11787. }
  11788. else if(currentElement.tagName()=="decoration")
  11789. {
  11790. addDecorationToLayout(currentElement,widgetStack,
  11791. layoutStack);
  11792. }
  11793. else if(currentElement.tagName()=="layout")
  11794. {
  11795. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  11796. }
  11797. else if(currentElement.tagName()=="splitter")
  11798. {
  11799. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  11800. }
  11801. else if(currentElement.tagName()=="label")
  11802. {
  11803. QBoxLayout*layout=
  11804. qobject_cast<QBoxLayout*> (layoutStack->top());
  11805. QLabel*label= new QLabel(currentElement.text());
  11806. layout->addWidget(label);
  11807. }
  11808. else if(currentElement.tagName()=="lcdtemperature")
  11809. {
  11810. addTemperatureDisplayToLayout(currentElement,widgetStack,
  11811. layoutStack);
  11812. }
  11813. else if(currentElement.tagName()=="lcdtimer")
  11814. {
  11815. addTimerDisplayToLayout(currentElement,widgetStack,
  11816. layoutStack);
  11817. }
  11818. else if(currentElement.tagName()=="line")
  11819. {
  11820. addLineToLayout(currentElement,widgetStack,layoutStack);
  11821. }
  11822. else if(currentElement.tagName()=="report")
  11823. {
  11824. addReportToLayout(currentElement,widgetStack,layoutStack);
  11825. }
  11826. else if(currentElement.tagName()=="sqldrop")
  11827. {
  11828. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  11829. }
  11830. else if(currentElement.tagName()=="sqltablearray")
  11831. {
  11832. addSaltToLayout(currentElement,widgetStack,layoutStack);
  11833. }
  11834. else if(currentElement.tagName()=="sqlview")
  11835. {
  11836. addSqlQueryViewToLayout(currentElement,widgetStack,
  11837. layoutStack);
  11838. }
  11839. else if(currentElement.tagName()=="textarea")
  11840. {
  11841. addTextToLayout(currentElement,widgetStack,layoutStack);
  11842. }
  11843. else if(currentElement.tagName()=="spinbox")
  11844. {
  11845. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  11846. }
  11847. else if(currentElement.tagName()=="formarray")
  11848. {
  11849. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  11850. }
  11851. else if(currentElement.tagName()=="hscale")
  11852. {
  11853. addScaleControlToLayout(currentElement,widgetStack,
  11854. layoutStack);
  11855. }
  11856. else if(currentElement.tagName()=="vscale")
  11857. {
  11858. addIntensityControlToLayout(currentElement,widgetStack,
  11859. layoutStack);
  11860. }
  11861. else if(currentElement.tagName()=="webview")
  11862. {
  11863. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  11864. }
  11865. else if(currentElement.tagName()=="stretch")
  11866. {
  11867. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11868. layout->addStretch();
  11869. }
  11870. }
  11871. }
  11872. }
  11873. /*:176*//*177:*/
  11874. #line 4355 "./typica.w"
  11875. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11876. QStack<QLayout*> *layoutStack)
  11877. {
  11878. QLayout*targetLayout= layoutStack->pop();
  11879. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  11880. if(element.hasAttribute("type"))
  11881. {
  11882. /*172:*/
  11883. #line 4069 "./typica.w"
  11884. QLayout*layout;
  11885. QString layoutType= element.attribute("type");
  11886. if(layoutType=="horizontal")
  11887. {
  11888. layout= new QHBoxLayout;
  11889. layoutStack->push(layout);
  11890. populateBoxLayout(element,widgetStack,layoutStack);
  11891. }
  11892. else if(layoutType=="vertical")
  11893. {
  11894. layout= new QVBoxLayout;
  11895. layoutStack->push(layout);
  11896. populateBoxLayout(element,widgetStack,layoutStack);
  11897. }
  11898. else if(layoutType=="grid")
  11899. {
  11900. layout= new QGridLayout;
  11901. layoutStack->push(layout);
  11902. populateGridLayout(element,widgetStack,layoutStack);
  11903. }
  11904. else if(layoutType=="stack")
  11905. {
  11906. layout= new QStackedLayout;
  11907. layoutStack->push(layout);
  11908. populateStackedLayout(element,widgetStack,layoutStack);
  11909. }
  11910. if(element.hasAttribute("id"))
  11911. {
  11912. layout->setObjectName(element.attribute("id"));
  11913. }
  11914. /*:172*/
  11915. #line 4363 "./typica.w"
  11916. boxLayout->addLayout(layout);
  11917. layoutStack->pop();
  11918. }
  11919. layoutStack->push(targetLayout);
  11920. }
  11921. /*:177*//*178:*/
  11922. #line 4374 "./typica.w"
  11923. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11924. QStack<QLayout*> *layoutStack)
  11925. {
  11926. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11927. QSplitter*splitter= new(QSplitter);
  11928. layout->addWidget(splitter);
  11929. /*179:*/
  11930. #line 4387 "./typica.w"
  11931. QString orientation= element.attribute("type");
  11932. if(orientation=="horizontal")
  11933. {
  11934. splitter->setOrientation(Qt::Horizontal);
  11935. }
  11936. else if(orientation=="vertical")
  11937. {
  11938. splitter->setOrientation(Qt::Vertical);
  11939. }
  11940. QString id= element.attribute("id");
  11941. if(!id.isEmpty())
  11942. {
  11943. splitter->setObjectName(id);
  11944. }
  11945. if(element.hasChildNodes())
  11946. {
  11947. widgetStack->push(splitter);
  11948. populateSplitter(element,widgetStack,layoutStack);
  11949. widgetStack->pop();
  11950. }
  11951. /*:179*/
  11952. #line 4381 "./typica.w"
  11953. }
  11954. /*:178*//*180:*/
  11955. #line 4413 "./typica.w"
  11956. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  11957. QStack<QLayout*> *layoutStack)
  11958. {
  11959. QDomNodeList children= element.childNodes();
  11960. for(int i= 0;i<children.count();i++)
  11961. {
  11962. QDomNode current;
  11963. QDomElement currentElement;
  11964. current= children.at(i);
  11965. if(current.isElement())
  11966. {
  11967. currentElement= current.toElement();
  11968. if(currentElement.tagName()=="decoration")
  11969. {
  11970. addDecorationToSplitter(currentElement,widgetStack,
  11971. layoutStack);
  11972. }
  11973. else if(currentElement.tagName()=="graph")
  11974. {
  11975. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  11976. }
  11977. else if(currentElement.tagName()=="splitter")
  11978. {
  11979. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  11980. }
  11981. else if(currentElement.tagName()=="lcdtemperature")
  11982. {
  11983. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  11984. layoutStack);
  11985. }
  11986. else if(currentElement.tagName()=="lcdtimer")
  11987. {
  11988. addTimerDisplayToSplitter(currentElement,widgetStack,
  11989. layoutStack);
  11990. }
  11991. else if(currentElement.tagName()=="measurementtable")
  11992. {
  11993. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  11994. }
  11995. else if(currentElement.tagName()=="widget")
  11996. {
  11997. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  11998. }
  11999. }
  12000. }
  12001. }
  12002. /*:180*//*181:*/
  12003. #line 4463 "./typica.w"
  12004. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12005. QStack<QLayout*> *layoutStack)
  12006. {
  12007. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  12008. QSplitter*splitter= new(QSplitter);
  12009. splitter->setParent(parent);
  12010. parent->addWidget(splitter);
  12011. /*179:*/
  12012. #line 4387 "./typica.w"
  12013. QString orientation= element.attribute("type");
  12014. if(orientation=="horizontal")
  12015. {
  12016. splitter->setOrientation(Qt::Horizontal);
  12017. }
  12018. else if(orientation=="vertical")
  12019. {
  12020. splitter->setOrientation(Qt::Vertical);
  12021. }
  12022. QString id= element.attribute("id");
  12023. if(!id.isEmpty())
  12024. {
  12025. splitter->setObjectName(id);
  12026. }
  12027. if(element.hasChildNodes())
  12028. {
  12029. widgetStack->push(splitter);
  12030. populateSplitter(element,widgetStack,layoutStack);
  12031. widgetStack->pop();
  12032. }
  12033. /*:179*/
  12034. #line 4471 "./typica.w"
  12035. }
  12036. /*:181*//*182:*/
  12037. #line 4480 "./typica.w"
  12038. void addTemperatureDisplayToSplitter(QDomElement element,
  12039. QStack<QWidget*> *widgetStack,
  12040. QStack<QLayout*> *)
  12041. {
  12042. TemperatureDisplay*display= new(TemperatureDisplay);
  12043. if(element.hasAttribute("id"))
  12044. {
  12045. display->setObjectName(element.attribute("id"));
  12046. }
  12047. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12048. splitter->addWidget(display);
  12049. }
  12050. void addTemperatureDisplayToLayout(QDomElement element,
  12051. QStack<QWidget*> *,
  12052. QStack<QLayout*> *layoutStack)
  12053. {
  12054. TemperatureDisplay*display= new(TemperatureDisplay);
  12055. if(element.hasAttribute("id"))
  12056. {
  12057. display->setObjectName(element.attribute("id"));
  12058. }
  12059. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12060. layout->addWidget(display);
  12061. }
  12062. /*:182*//*183:*/
  12063. #line 4511 "./typica.w"
  12064. void addTimerDisplayToSplitter(QDomElement element,
  12065. QStack<QWidget*> *widgetStack,
  12066. QStack<QLayout*> *)
  12067. {
  12068. TimerDisplay*display= new(TimerDisplay);
  12069. if(element.hasAttribute("id"))
  12070. {
  12071. display->setObjectName(element.attribute("id"));
  12072. }
  12073. if(element.hasAttribute("format"))
  12074. {
  12075. display->setDisplayFormat(element.attribute("format"));
  12076. }
  12077. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12078. splitter->addWidget(display);
  12079. }
  12080. void addTimerDisplayToLayout(QDomElement element,
  12081. QStack<QWidget*> *,
  12082. QStack<QLayout*> *layoutStack)
  12083. {
  12084. TimerDisplay*display= new(TimerDisplay);
  12085. if(element.hasAttribute("id"))
  12086. {
  12087. display->setObjectName(element.attribute("id"));
  12088. }
  12089. if(element.hasAttribute("format"))
  12090. {
  12091. display->setDisplayFormat(element.attribute("format"));
  12092. }
  12093. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12094. layout->addWidget(display);
  12095. }
  12096. /*:183*//*184:*/
  12097. #line 4549 "./typica.w"
  12098. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  12099. QStack<QLayout*> *layoutStack)
  12100. {
  12101. /*185:*/
  12102. #line 4570 "./typica.w"
  12103. QString labelText= element.attribute("name");
  12104. Qt::Orientations orientation= Qt::Horizontal;
  12105. if(element.hasAttribute("type"))
  12106. {
  12107. if(element.attribute("type")=="horizontal")
  12108. {
  12109. orientation= Qt::Horizontal;
  12110. }
  12111. else if(element.attribute("type")=="vertical")
  12112. {
  12113. orientation= Qt::Vertical;
  12114. }
  12115. }
  12116. /*186:*/
  12117. #line 4595 "./typica.w"
  12118. QWidget*theWidget= NULL;
  12119. QDomNodeList children= element.childNodes();
  12120. for(int i= 0;i<children.count();i++)
  12121. {
  12122. QDomNode item= children.at(i);
  12123. if(item.isElement())
  12124. {
  12125. QDomElement itemElement= item.toElement();
  12126. if(itemElement.tagName()=="lcdtemperature")
  12127. {
  12128. TemperatureDisplay*display= new TemperatureDisplay;
  12129. if(itemElement.hasAttribute("id"))
  12130. {
  12131. display->setObjectName(itemElement.attribute("id"));
  12132. }
  12133. theWidget= display;
  12134. }
  12135. else if(itemElement.tagName()=="lcdtimer")
  12136. {
  12137. TimerDisplay*display= new TimerDisplay;
  12138. if(itemElement.hasAttribute("id"))
  12139. {
  12140. display->setObjectName(itemElement.attribute("id"));
  12141. }
  12142. if(itemElement.hasAttribute("format"))
  12143. {
  12144. display->setDisplayFormat(itemElement.attribute("format"));
  12145. }
  12146. theWidget= display;
  12147. }
  12148. }
  12149. }
  12150. /*:186*/
  12151. #line 4584 "./typica.w"
  12152. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12153. orientation);
  12154. if(element.hasAttribute("id"))
  12155. {
  12156. decoration->setObjectName(element.attribute("id"));
  12157. }
  12158. /*:185*/
  12159. #line 4553 "./typica.w"
  12160. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12161. layout->addWidget(decoration);
  12162. }
  12163. void addDecorationToSplitter(QDomElement element,
  12164. QStack<QWidget*> *widgetStack,
  12165. QStack<QLayout*> *)
  12166. {
  12167. /*185:*/
  12168. #line 4570 "./typica.w"
  12169. QString labelText= element.attribute("name");
  12170. Qt::Orientations orientation= Qt::Horizontal;
  12171. if(element.hasAttribute("type"))
  12172. {
  12173. if(element.attribute("type")=="horizontal")
  12174. {
  12175. orientation= Qt::Horizontal;
  12176. }
  12177. else if(element.attribute("type")=="vertical")
  12178. {
  12179. orientation= Qt::Vertical;
  12180. }
  12181. }
  12182. /*186:*/
  12183. #line 4595 "./typica.w"
  12184. QWidget*theWidget= NULL;
  12185. QDomNodeList children= element.childNodes();
  12186. for(int i= 0;i<children.count();i++)
  12187. {
  12188. QDomNode item= children.at(i);
  12189. if(item.isElement())
  12190. {
  12191. QDomElement itemElement= item.toElement();
  12192. if(itemElement.tagName()=="lcdtemperature")
  12193. {
  12194. TemperatureDisplay*display= new TemperatureDisplay;
  12195. if(itemElement.hasAttribute("id"))
  12196. {
  12197. display->setObjectName(itemElement.attribute("id"));
  12198. }
  12199. theWidget= display;
  12200. }
  12201. else if(itemElement.tagName()=="lcdtimer")
  12202. {
  12203. TimerDisplay*display= new TimerDisplay;
  12204. if(itemElement.hasAttribute("id"))
  12205. {
  12206. display->setObjectName(itemElement.attribute("id"));
  12207. }
  12208. if(itemElement.hasAttribute("format"))
  12209. {
  12210. display->setDisplayFormat(itemElement.attribute("format"));
  12211. }
  12212. theWidget= display;
  12213. }
  12214. }
  12215. }
  12216. /*:186*/
  12217. #line 4584 "./typica.w"
  12218. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12219. orientation);
  12220. if(element.hasAttribute("id"))
  12221. {
  12222. decoration->setObjectName(element.attribute("id"));
  12223. }
  12224. /*:185*/
  12225. #line 4562 "./typica.w"
  12226. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12227. splitter->addWidget(decoration);
  12228. }
  12229. /*:184*//*187:*/
  12230. #line 4634 "./typica.w"
  12231. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12232. QStack<QLayout*> *layoutStack)
  12233. {
  12234. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12235. QWidget*widget= new QWidget;
  12236. if(element.hasAttribute("id"))
  12237. {
  12238. widget->setObjectName(element.attribute("id"));
  12239. }
  12240. splitter->addWidget(widget);
  12241. if(element.hasChildNodes())
  12242. {
  12243. widgetStack->push(widget);
  12244. populateWidget(element,widgetStack,layoutStack);
  12245. widgetStack->pop();
  12246. }
  12247. }
  12248. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  12249. QStack<QLayout*> *layoutStack)
  12250. {
  12251. QDomNodeList children= element.childNodes();
  12252. for(int i= 0;i<children.count();i++)
  12253. {
  12254. QDomNode current;
  12255. QDomElement currentElement;
  12256. current= children.at(i);
  12257. if(current.isElement())
  12258. {
  12259. currentElement= current.toElement();
  12260. if(currentElement.tagName()=="layout")
  12261. {
  12262. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  12263. }
  12264. }
  12265. }
  12266. }
  12267. /*:187*//*188:*/
  12268. #line 4677 "./typica.w"
  12269. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  12270. QStack<QLayout*> *layoutStack)
  12271. {
  12272. QAbstractButton*button= NULL;
  12273. QString text= element.attribute("name");
  12274. if(element.hasAttribute("type"))
  12275. {
  12276. QString type= element.attribute("type");
  12277. if(type=="annotation")
  12278. {
  12279. AnnotationButton*abutton= new AnnotationButton(text);
  12280. if(element.hasAttribute("annotation"))
  12281. {
  12282. abutton->setAnnotation(element.attribute("annotation"));
  12283. }
  12284. if(element.hasAttribute("series"))
  12285. {
  12286. abutton->setTemperatureColumn(element.attribute("series").
  12287. toInt());
  12288. }
  12289. if(element.hasAttribute("column"))
  12290. {
  12291. abutton->setAnnotationColumn(element.attribute("column").
  12292. toInt());
  12293. }
  12294. button= abutton;
  12295. }
  12296. else if(type=="check")
  12297. {
  12298. button= new QCheckBox(text);
  12299. }
  12300. else if(type=="push")
  12301. {
  12302. button= new QPushButton(text);
  12303. }
  12304. }
  12305. if(element.hasAttribute("id"))
  12306. {
  12307. button->setObjectName(element.attribute("id"));
  12308. }
  12309. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12310. layout->addWidget(button);
  12311. }
  12312. /*:188*//*189:*/
  12313. #line 4729 "./typica.w"
  12314. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  12315. QStack<QLayout*> *layoutStack)
  12316. {
  12317. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  12318. if(element.hasAttribute("pretext"))
  12319. {
  12320. box->setPretext(element.attribute("pretext"));
  12321. }
  12322. if(element.hasAttribute("posttext"))
  12323. {
  12324. box->setPosttext(element.attribute("posttext"));
  12325. }
  12326. if(element.hasAttribute("series"))
  12327. {
  12328. box->setTemperatureColumn(element.attribute("series").toInt());
  12329. }
  12330. if(element.hasAttribute("column"))
  12331. {
  12332. box->setAnnotationColumn(element.attribute("column").toInt());
  12333. }
  12334. if(element.hasAttribute("min"))
  12335. {
  12336. box->setMinimum(element.attribute("min").toDouble());
  12337. }
  12338. if(element.hasAttribute("max"))
  12339. {
  12340. box->setMaximum(element.attribute("max").toDouble());
  12341. }
  12342. if(element.hasAttribute("decimals"))
  12343. {
  12344. box->setDecimals(element.attribute("decimals").toInt());
  12345. }
  12346. if(element.hasAttribute("step"))
  12347. {
  12348. box->setSingleStep(element.attribute("step").toDouble());
  12349. }
  12350. if(element.hasAttribute("id"))
  12351. {
  12352. box->setObjectName(element.attribute("id"));
  12353. }
  12354. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12355. layout->addWidget(box);
  12356. }
  12357. /*:189*//*190:*/
  12358. #line 4785 "./typica.w"
  12359. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12360. QStack<QLayout*> *)
  12361. {
  12362. ZoomLog*widget= new ZoomLog;
  12363. if(!widget)
  12364. {
  12365. qDebug()<<"Error constructing widget!";
  12366. }
  12367. if(element.hasAttribute("id"))
  12368. {
  12369. widget->setObjectName(element.attribute("id"));
  12370. }
  12371. if(element.hasChildNodes())
  12372. {
  12373. QDomNodeList children= element.childNodes();
  12374. int column= 0;
  12375. for(int i= 0;i<children.count();i++)
  12376. {
  12377. QDomNode current;
  12378. QDomElement currentElement;
  12379. current= children.at(i);
  12380. if(current.isElement())
  12381. {
  12382. currentElement= current.toElement();
  12383. if(currentElement.tagName()=="column")
  12384. {
  12385. QString text= currentElement.text();
  12386. widget->setHeaderData(column,text);
  12387. column++;
  12388. }
  12389. }
  12390. }
  12391. }
  12392. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12393. if(splitter)
  12394. {
  12395. splitter->addWidget(widget);
  12396. }
  12397. else
  12398. {
  12399. qDebug()<<"Splitter not found at top of widget stack!";
  12400. }
  12401. }
  12402. /*:190*//*191:*/
  12403. #line 4833 "./typica.w"
  12404. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12405. QStack<QLayout*> *)
  12406. {
  12407. GraphView*view= new GraphView;
  12408. if(element.hasAttribute("id"))
  12409. {
  12410. view->setObjectName(element.attribute("id"));
  12411. }
  12412. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12413. splitter->addWidget(view);
  12414. }
  12415. /*:191*//*192:*/
  12416. #line 4850 "./typica.w"
  12417. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  12418. QStack<QLayout*> *layoutStack)
  12419. {
  12420. SqlComboBox*box= new SqlComboBox();
  12421. if(element.hasAttribute("data"))
  12422. {
  12423. box->setDataColumn(element.attribute("data").toInt());
  12424. }
  12425. if(element.hasAttribute("display"))
  12426. {
  12427. box->setDisplayColumn(element.attribute("display").toInt());
  12428. }
  12429. if(element.hasAttribute("showdata"))
  12430. {
  12431. if(element.attribute("showdata")=="true")
  12432. {
  12433. box->showData(true);
  12434. }
  12435. }
  12436. if(element.hasAttribute("editable"))
  12437. {
  12438. if(element.attribute("editable")=="true")
  12439. {
  12440. box->setEditable(true);
  12441. }
  12442. }
  12443. if(element.hasChildNodes())
  12444. {
  12445. QDomNodeList children= element.childNodes();
  12446. for(int i= 0;i<children.count();i++)
  12447. {
  12448. QDomNode current;
  12449. QDomElement currentElement;
  12450. current= children.at(i);
  12451. if(current.isElement())
  12452. {
  12453. currentElement= current.toElement();
  12454. if(currentElement.tagName()=="null")
  12455. {
  12456. box->addNullOption();
  12457. }
  12458. else if(currentElement.tagName()=="query")
  12459. {
  12460. box->addSqlOptions(currentElement.text());
  12461. }
  12462. }
  12463. }
  12464. }
  12465. if(element.hasAttribute("id"))
  12466. {
  12467. box->setObjectName(element.attribute("id"));
  12468. }
  12469. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12470. layout->addWidget(box);
  12471. }
  12472. /*:192*//*193:*/
  12473. #line 4929 "./typica.w"
  12474. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  12475. QStack<QLayout*> *layoutStack)
  12476. {
  12477. QTableView*view= new QTableView;
  12478. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  12479. SaltModel*model= new SaltModel(element.childNodes().count());
  12480. if(element.hasAttribute("id"))
  12481. {
  12482. view->setObjectName(element.attribute("id"));
  12483. }
  12484. if(element.hasChildNodes())
  12485. {
  12486. QDomNodeList children= element.childNodes();
  12487. int currentColumn= 0;
  12488. for(int i= 0;i<children.count();i++)
  12489. {
  12490. QDomNode current;
  12491. QDomElement currentElement;
  12492. current= children.at(i);
  12493. if(current.isElement())
  12494. {
  12495. currentElement= current.toElement();
  12496. if(currentElement.tagName()=="column")
  12497. {
  12498. if(currentElement.hasAttribute("name"))
  12499. {
  12500. model->setHeaderData(currentColumn,Qt::Horizontal,
  12501. currentElement.attribute("name"));
  12502. }
  12503. if(currentElement.hasAttribute("delegate"))
  12504. {
  12505. /*194:*/
  12506. #line 4977 "./typica.w"
  12507. if(currentElement.attribute("delegate")=="sql")
  12508. {
  12509. /*195:*/
  12510. #line 4993 "./typica.w"
  12511. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  12512. SqlComboBox*widget= new SqlComboBox();
  12513. if(currentElement.hasAttribute("null"))
  12514. {
  12515. if(currentElement.attribute("null")=="true")
  12516. {
  12517. widget->addNullOption();
  12518. }
  12519. }
  12520. if(currentElement.hasAttribute("showdata"))
  12521. {
  12522. if(currentElement.attribute("showdata")=="true")
  12523. {
  12524. widget->showData(true);
  12525. }
  12526. }
  12527. if(currentElement.hasAttribute("data"))
  12528. {
  12529. widget->setDataColumn(currentElement.attribute("data").toInt());
  12530. }
  12531. if(currentElement.hasAttribute("display"))
  12532. {
  12533. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  12534. }
  12535. widget->addSqlOptions(currentElement.text());
  12536. delegate->setWidget(widget);
  12537. view->setItemDelegateForColumn(currentColumn,delegate);
  12538. /*:195*/
  12539. #line 4980 "./typica.w"
  12540. }
  12541. else if(currentElement.attribute("delegate")=="numeric")
  12542. {
  12543. /*196:*/
  12544. #line 5026 "./typica.w"
  12545. NumericDelegate*delegate= new NumericDelegate;
  12546. view->setItemDelegateForColumn(currentColumn,delegate);
  12547. /*:196*/
  12548. #line 4984 "./typica.w"
  12549. }
  12550. /*:194*/
  12551. #line 4961 "./typica.w"
  12552. }
  12553. currentColumn++;
  12554. }
  12555. }
  12556. }
  12557. }
  12558. view->setModel(model);
  12559. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12560. layout->addWidget(view);
  12561. }
  12562. /*:193*//*203:*/
  12563. #line 5136 "./typica.w"
  12564. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  12565. QStack<QLayout*> *layoutStack)
  12566. {
  12567. QLineEdit*widget= new QLineEdit(element.text());
  12568. if(element.hasAttribute("id"))
  12569. {
  12570. widget->setObjectName(element.attribute("id"));
  12571. }
  12572. if(element.hasAttribute("writable"))
  12573. {
  12574. if(element.attribute("writable")=="false")
  12575. {
  12576. widget->setReadOnly(true);
  12577. }
  12578. }
  12579. if(element.hasAttribute("validator"))
  12580. {
  12581. if(element.attribute("validator")=="numeric")
  12582. {
  12583. widget->setValidator(new QDoubleValidator(NULL));
  12584. }
  12585. else if(element.attribute("validator")=="integer")
  12586. {
  12587. widget->setValidator(new QIntValidator(NULL));
  12588. }
  12589. else if(element.attribute("validator")=="expression"&&
  12590. element.hasAttribute("expression"))
  12591. {
  12592. widget->setValidator(new QRegExpValidator(
  12593. QRegExp(element.attribute("expression")),
  12594. NULL));
  12595. }
  12596. }
  12597. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12598. layout->addWidget(widget);
  12599. }
  12600. /*:203*//*204:*/
  12601. #line 5177 "./typica.w"
  12602. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  12603. QStack<QLayout*> *layoutStack)
  12604. {
  12605. QTextEdit*widget= new QTextEdit;
  12606. if(element.hasAttribute("id"))
  12607. {
  12608. widget->setObjectName(element.attribute("id"));
  12609. }
  12610. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12611. layout->addWidget(widget);
  12612. }
  12613. /*:204*//*205:*/
  12614. #line 5194 "./typica.w"
  12615. void addSqlQueryViewToLayout(QDomElement element,
  12616. QStack<QWidget*> *,
  12617. QStack<QLayout*> *layoutStack)
  12618. {
  12619. SqlQueryView*view= new SqlQueryView;
  12620. if(element.hasAttribute("id"))
  12621. {
  12622. view->setObjectName(element.attribute("id"));
  12623. }
  12624. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12625. layout->addWidget(view);
  12626. }
  12627. /*:205*//*206:*/
  12628. #line 5211 "./typica.w"
  12629. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  12630. QStack<QLayout*> *layoutStack)
  12631. {
  12632. QDateEdit*widget= new QDateEdit;
  12633. widget->setCalendarPopup(true);
  12634. if(element.hasAttribute("id"))
  12635. {
  12636. widget->setObjectName(element.attribute("id"));
  12637. }
  12638. widget->setDate(QDate::currentDate());
  12639. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12640. layout->addWidget(widget);
  12641. }
  12642. /*:206*//*207:*/
  12643. #line 5229 "./typica.w"
  12644. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  12645. {
  12646. setQDateTimeEditProperties(value,engine);
  12647. }
  12648. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  12649. {
  12650. setQAbstractSpinBoxProperties(value,engine);
  12651. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  12652. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  12653. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  12654. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  12655. }
  12656. /*:207*//*208:*/
  12657. #line 5249 "./typica.w"
  12658. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  12659. {
  12660. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12661. if(context->argumentCount()==3)
  12662. {
  12663. self->setDate(QDate(argument<int> (0,context),
  12664. argument<int> (1,context),
  12665. argument<int> (2,context)));
  12666. }
  12667. else
  12668. {
  12669. context->throwError("Incorrect number of arguments passed to "
  12670. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  12671. "specifying the year, month, and day.");
  12672. }
  12673. return QScriptValue();
  12674. }
  12675. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  12676. {
  12677. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12678. return QScriptValue(self->date().day());
  12679. }
  12680. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  12681. {
  12682. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12683. return QScriptValue(self->date().month());
  12684. }
  12685. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  12686. {
  12687. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12688. return QScriptValue(self->date().year());
  12689. }
  12690. /*:208*//*212:*/
  12691. #line 5316 "./typica.w"
  12692. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  12693. {
  12694. QObject*parent= argument<QObject*> (0,context);
  12695. QString name= argument<QString> (1,context);
  12696. QObject*object= parent->findChild<QObject*> (name);
  12697. QScriptValue value;
  12698. if(object)
  12699. {
  12700. value= engine->newQObject(object);
  12701. QString className= object->metaObject()->className();
  12702. /*213:*/
  12703. #line 5334 "./typica.w"
  12704. if(className=="TemperatureDisplay")
  12705. {
  12706. setTemperatureDisplayProperties(value,engine);
  12707. }
  12708. else if(className=="TimerDisplay")
  12709. {
  12710. setTimerDisplayProperties(value,engine);
  12711. }
  12712. else if(className=="QAction")
  12713. {
  12714. setQActionProperties(value,engine);
  12715. }
  12716. else if(className=="QBoxLayout")
  12717. {
  12718. setQBoxLayoutProperties(value,engine);
  12719. }
  12720. else if(className=="QDateEdit")
  12721. {
  12722. setQDateEditProperties(value,engine);
  12723. }
  12724. else if(className=="QFrame")
  12725. {
  12726. setQFrameProperties(value,engine);
  12727. }
  12728. else if(className=="QHBoxLayout")
  12729. {
  12730. setQBoxLayoutProperties(value,engine);
  12731. }
  12732. else if(className=="QLCDNumber")
  12733. {
  12734. setQLCDNumberProperties(value,engine);
  12735. }
  12736. else if(className=="QMenu")
  12737. {
  12738. setQMenuProperties(value,engine);
  12739. }
  12740. else if(className=="QMenuBar")
  12741. {
  12742. setQMenuBarProperties(value,engine);
  12743. }
  12744. else if(className=="QPushButton")
  12745. {
  12746. setQPushButtonProperties(value,engine);
  12747. }
  12748. else if(className=="QSplitter")
  12749. {
  12750. setQSplitterProperties(value,engine);
  12751. }
  12752. else if(className=="QTableView")
  12753. {
  12754. if(object->property("tabletype").isValid())
  12755. {
  12756. if(object->property("tabletype").toString()=="SaltTable")
  12757. {
  12758. setSaltTableProperties(value,engine);
  12759. }
  12760. }
  12761. }
  12762. else if(className=="QVBoxLayout")
  12763. {
  12764. setQBoxLayoutProperties(value,engine);
  12765. }
  12766. else if(className=="QWidget")
  12767. {
  12768. setQWidgetProperties(value,engine);
  12769. }
  12770. else if(className=="ScriptQMainWindow")
  12771. {
  12772. setQMainWindowProperties(value,engine);
  12773. }
  12774. else if(className=="SqlComboBox")
  12775. {
  12776. setSqlComboBoxProperties(value,engine);
  12777. }
  12778. else if(className=="SqlQueryView")
  12779. {
  12780. setSqlQueryViewProperties(value,engine);
  12781. }
  12782. else if(className=="ZoomLog")
  12783. {
  12784. setZoomLogProperties(value,engine);
  12785. }
  12786. else if(className=="QTextEdit")
  12787. {
  12788. setQTextEditProperties(value,engine);
  12789. }
  12790. else if(className=="QWebView")
  12791. {
  12792. setQWebViewProperties(value,engine);
  12793. }
  12794. /*:213*/
  12795. #line 5327 "./typica.w"
  12796. }
  12797. return value;
  12798. }
  12799. /*:212*//*215:*/
  12800. #line 5452 "./typica.w"
  12801. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  12802. {
  12803. QTableView*self= getself<QTableView*> (context);
  12804. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12805. QString datum;
  12806. double total= 0.0;
  12807. int column= argument<int> (0,context);
  12808. int role= argument<int> (1,context);
  12809. for(int i= 0;i<model->rowCount();i++)
  12810. {
  12811. datum= model->data(model->index(i,column),role).toString();
  12812. if(!datum.isEmpty())
  12813. {
  12814. total+= datum.toDouble();
  12815. }
  12816. }
  12817. return QScriptValue(engine,total);
  12818. }
  12819. /*:215*//*216:*/
  12820. #line 5476 "./typica.w"
  12821. QScriptValue SaltTable_columnArray(QScriptContext*context,
  12822. QScriptEngine*engine)
  12823. {
  12824. QTableView*self= getself<QTableView*> (context);
  12825. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12826. int column= argument<int> (0,context);
  12827. int role= argument<int> (1,context);
  12828. QString literal= model->arrayLiteral(column,role);
  12829. return QScriptValue(engine,literal);
  12830. }
  12831. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  12832. QScriptEngine*engine)
  12833. {
  12834. QTableView*self= getself<QTableView*> (context);
  12835. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12836. int column= argument<int> (0,context);
  12837. int role= argument<int> (1,context);
  12838. QString literal= model->quotedArrayLiteral(column,role);
  12839. return QScriptValue(engine,literal);
  12840. }
  12841. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  12842. QScriptEngine*engine)
  12843. {
  12844. QTableView*self= getself<QTableView*> (context);
  12845. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12846. int column= argument<int> (0,context);
  12847. int role= argument<int> (1,context);
  12848. QString literal= model->arrayLiteral(column,role);
  12849. literal.chop(1);
  12850. literal= literal.remove(0,1);
  12851. return QScriptValue(engine,literal);
  12852. }
  12853. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  12854. QScriptEngine*engine)
  12855. {
  12856. QTableView*self= getself<QTableView*> (context);
  12857. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12858. int column= argument<int> (0,context);
  12859. int role= argument<int> (1,context);
  12860. QString literal= model->quotedArrayLiteral(column,role);
  12861. literal.chop(1);
  12862. literal= literal.remove(0,1);
  12863. return QScriptValue(engine,literal);
  12864. }
  12865. /*:216*//*217:*/
  12866. #line 5528 "./typica.w"
  12867. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  12868. {
  12869. QTableView*self= getself<QTableView*> (context);
  12870. QScriptValue value= engine->newQObject(self->model());
  12871. return value;
  12872. }
  12873. /*:217*//*218:*/
  12874. #line 5542 "./typica.w"
  12875. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  12876. {
  12877. QTableView*self= getself<QTableView*> (context);
  12878. int row= argument<int> (0,context);
  12879. int column= argument<int> (1,context);
  12880. QVariant value= argument<QVariant> (2,context);
  12881. int role= argument<int> (3,context);
  12882. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12883. QModelIndex cell= model->index(row,column);
  12884. model->setData(cell,value,role);
  12885. self->update(cell);
  12886. return QScriptValue();
  12887. }
  12888. /*:218*//*219:*/
  12889. #line 5560 "./typica.w"
  12890. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  12891. {
  12892. QTableView*self= getself<QTableView*> (context);
  12893. int row= argument<int> (0,context);
  12894. int column= argument<int> (1,context);
  12895. int role= argument<int> (2,context);
  12896. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12897. QModelIndex cell= model->index(row,column);
  12898. QVariant value= model->data(cell,role);
  12899. QScriptValue retval= engine->newVariant(value);
  12900. retval.setProperty("value",QScriptValue(value.toString()));
  12901. return retval;
  12902. }
  12903. /*:219*//*220:*/
  12904. #line 5578 "./typica.w"
  12905. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  12906. {
  12907. setQWidgetProperties(value,engine);
  12908. value.setProperty("columnArray",
  12909. engine->newFunction(SaltTable_columnArray));
  12910. value.setProperty("quotedColumnArray",
  12911. engine->newFunction(SaltTable_quotedColumnArray));
  12912. value.setProperty("bindableColumnArray",
  12913. engine->newFunction(SaltTable_bindableColumnArray));
  12914. value.setProperty("bindableQuotedColumnArray",
  12915. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  12916. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  12917. value.setProperty("data",engine->newFunction(SaltTable_data));
  12918. value.setProperty("model",engine->newFunction(SaltTable_model));
  12919. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  12920. }
  12921. /*:220*//*222:*/
  12922. #line 5611 "./typica.w"
  12923. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12924. {
  12925. setQComboBoxProperties(value,engine);
  12926. }
  12927. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12928. {
  12929. setQWidgetProperties(value,engine);
  12930. value.setProperty("currentData",
  12931. engine->newFunction(QComboBox_currentData));
  12932. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  12933. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  12934. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  12935. }
  12936. QScriptValue QComboBox_currentData(QScriptContext*context,
  12937. QScriptEngine*engine)
  12938. {
  12939. QComboBox*self= getself<QComboBox*> (context);
  12940. return QScriptValue(engine,
  12941. self->itemData(self->currentIndex()).toString());
  12942. }
  12943. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  12944. {
  12945. QComboBox*self= getself<QComboBox*> (context);
  12946. self->addItem(argument<QString> (0,context));
  12947. return QScriptValue();
  12948. }
  12949. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  12950. {
  12951. QComboBox*self= getself<QComboBox*> (context);
  12952. self->setModel(argument<QAbstractItemModel*> (0,context));
  12953. return QScriptValue();
  12954. }
  12955. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  12956. {
  12957. QComboBox*self= getself<QComboBox*> (context);
  12958. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  12959. }
  12960. #line 1 "./abouttypica.w"
  12961. /*:222*//*255:*/
  12962. #line 6495 "./typica.w"
  12963. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  12964. {
  12965. QScriptValue object;
  12966. if(context->argumentCount()==1)
  12967. {
  12968. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  12969. QScriptEngine::ScriptOwnership);
  12970. setDAQProperties(object,engine);
  12971. }
  12972. else if(context->argumentCount()==2)
  12973. {
  12974. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  12975. argument<QString> (1,context)),
  12976. QScriptEngine::ScriptOwnership);
  12977. setDAQProperties(object,engine);
  12978. }
  12979. else
  12980. {
  12981. context->throwError("Incorrect number of arguments passed to DAQ"
  12982. "constructor. The DAQ constructor takes one"
  12983. "string as an argument specifying a device name."
  12984. "Example: Dev1");
  12985. }
  12986. return object;
  12987. }
  12988. /*:255*//*256:*/
  12989. #line 6525 "./typica.w"
  12990. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  12991. {
  12992. setQObjectProperties(value,engine);
  12993. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  12994. }
  12995. /*:256*//*257:*/
  12996. #line 6535 "./typica.w"
  12997. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  12998. {
  12999. DAQ*self= getself<DAQ*> (context);
  13000. QScriptValue object;
  13001. if(self)
  13002. {
  13003. object=
  13004. engine->newQObject(self->newChannel(argument<int> (0,context),
  13005. argument<int> (1,context)));
  13006. setChannelProperties(object,engine);
  13007. }
  13008. return object;
  13009. }
  13010. /*:257*//*264:*/
  13011. #line 6691 "./typica.w"
  13012. QScriptValue constructFakeDAQ(QScriptContext*context,
  13013. QScriptEngine*engine)
  13014. {
  13015. QScriptValue object;
  13016. if(context->argumentCount()==1)
  13017. {
  13018. object=
  13019. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  13020. QScriptEngine::ScriptOwnership);
  13021. setFakeDAQProperties(object,engine);
  13022. }
  13023. else
  13024. {
  13025. context->throwError("Incorrect number of arguments passed to DAQ"
  13026. "constructor. The DAQ constructor takes one"
  13027. "string as an argument specifying a device name."
  13028. "Example: Dev1");
  13029. }
  13030. return object;
  13031. }
  13032. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  13033. {
  13034. setQObjectProperties(value,engine);
  13035. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  13036. }
  13037. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  13038. {
  13039. FakeDAQ*self= getself<FakeDAQ*> (context);
  13040. QScriptValue object;
  13041. if(self)
  13042. {
  13043. object=
  13044. engine->newQObject(self->newChannel(argument<int> (0,context),
  13045. argument<int> (1,context)));
  13046. setChannelProperties(object,engine);
  13047. }
  13048. return object;
  13049. }
  13050. /*:264*//*268:*/
  13051. #line 6782 "./typica.w"
  13052. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  13053. {
  13054. setQObjectProperties(value,engine);
  13055. }
  13056. /*:268*//*275:*/
  13057. #line 6968 "./typica.w"
  13058. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  13059. {
  13060. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  13061. setLinearCalibratorProperties(object,engine);
  13062. return object;
  13063. }
  13064. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  13065. {
  13066. setQObjectProperties(value,engine);
  13067. }
  13068. /*:275*//*280:*/
  13069. #line 7105 "./typica.w"
  13070. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  13071. {
  13072. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  13073. setLinearSplineInterpolatorProperties(object,engine);
  13074. return object;
  13075. }
  13076. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  13077. {
  13078. setQObjectProperties(value,engine);
  13079. }
  13080. /*:280*//*289:*/
  13081. #line 7289 "./typica.w"
  13082. QScriptValue constructTemperatureDisplay(QScriptContext*,
  13083. QScriptEngine*engine)
  13084. {
  13085. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  13086. setTemperatureDisplayProperties(object,engine);
  13087. return object;
  13088. }
  13089. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13090. {
  13091. setQLCDNumberProperties(value,engine);
  13092. }
  13093. /*:289*//*296:*/
  13094. #line 7430 "./typica.w"
  13095. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  13096. QScriptEngine*engine)
  13097. {
  13098. QScriptValue object=
  13099. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  13100. setMeasurementTimeOffsetProperties(object,engine);
  13101. return object;
  13102. }
  13103. void setMeasurementTimeOffsetProperties(QScriptValue value,
  13104. QScriptEngine*engine)
  13105. {
  13106. setQObjectProperties(value,engine);
  13107. }
  13108. /*:296*//*301:*/
  13109. #line 7539 "./typica.w"
  13110. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  13111. {
  13112. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  13113. return object;
  13114. }
  13115. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  13116. {
  13117. setQObjectProperties(value,engine);
  13118. }
  13119. /*:301*//*306:*/
  13120. #line 7635 "./typica.w"
  13121. QScriptValue constructZeroEmitter(QScriptContext*context,
  13122. QScriptEngine*engine)
  13123. {
  13124. QScriptValue object=
  13125. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  13126. setZeroEmitterProperties(object,engine);
  13127. return object;
  13128. }
  13129. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  13130. {
  13131. setQObjectProperties(value,engine);
  13132. }
  13133. /*:306*//*311:*/
  13134. #line 7715 "./typica.w"
  13135. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  13136. QScriptEngine*engine)
  13137. {
  13138. QScriptValue object=
  13139. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  13140. setMeasurementAdapterProperties(object,engine);
  13141. return object;
  13142. }
  13143. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  13144. {
  13145. setQObjectProperties(value,engine);
  13146. }
  13147. /*:311*//*326:*/
  13148. #line 8063 "./typica.w"
  13149. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  13150. {
  13151. QScriptValue object= engine->newQObject(new GraphView);
  13152. setGraphViewProperties(object,engine);
  13153. return object;
  13154. }
  13155. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  13156. {
  13157. setQGraphicsViewProperties(value,engine);
  13158. }
  13159. /*:326*//*349:*/
  13160. #line 8667 "./typica.w"
  13161. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  13162. {
  13163. QScriptValue object= engine->newQObject(new ZoomLog);
  13164. setZoomLogProperties(object,engine);
  13165. return object;
  13166. }
  13167. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  13168. {
  13169. setQTableViewProperties(value,engine);
  13170. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  13171. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  13172. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  13173. value.setProperty("restoreState",
  13174. engine->newFunction(ZoomLog_restoreState));
  13175. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  13176. value.setProperty("saveTemporary",
  13177. engine->newFunction(ZoomLog_saveTemporary));
  13178. }
  13179. /*:349*//*350:*/
  13180. #line 8693 "./typica.w"
  13181. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  13182. {
  13183. ZoomLog*self= getself<ZoomLog*> (context);
  13184. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  13185. return QScriptValue(engine,retval);
  13186. }
  13187. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  13188. {
  13189. ZoomLog*self= getself<ZoomLog*> (context);
  13190. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  13191. return QScriptValue(engine,retval);
  13192. }
  13193. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  13194. QScriptEngine*engine)
  13195. {
  13196. ZoomLog*self= getself<ZoomLog*> (context);
  13197. QString filename= QDir::tempPath();
  13198. filename.append("/");
  13199. filename.append(QUuid::createUuid().toString());
  13200. filename.append(".xml");
  13201. QFile*file= new QFile(filename);
  13202. self->saveXML(file);
  13203. file->close();
  13204. delete file;
  13205. return QScriptValue(engine,filename);
  13206. }
  13207. /*:350*//*351:*/
  13208. #line 8741 "./typica.w"
  13209. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  13210. {
  13211. ZoomLog*self= getself<ZoomLog*> (context);
  13212. QString key= argument<QString> (0,context);
  13213. int columns= argument<int> (1,context);
  13214. QSettings settings;
  13215. for(int i= 0;i<columns;i++)
  13216. {
  13217. if(self->columnWidth(i))
  13218. {
  13219. settings.beginGroup(key);
  13220. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  13221. settings.endGroup();
  13222. }
  13223. }
  13224. return QScriptValue();
  13225. }
  13226. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  13227. {
  13228. ZoomLog*self= getself<ZoomLog*> (context);
  13229. QString key= argument<QString> (0,context);
  13230. int columns= argument<int> (1,context);
  13231. QSettings settings;
  13232. for(int i= 0;i<columns;i++)
  13233. {
  13234. settings.beginGroup(key);
  13235. self->setColumnWidth(i,
  13236. settings.value(QString("%1").arg(i),80).toInt());
  13237. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  13238. {
  13239. self->setColumnWidth(i,80);
  13240. }
  13241. settings.endGroup();
  13242. }
  13243. return QScriptValue();
  13244. }
  13245. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  13246. {
  13247. ZoomLog*self= getself<ZoomLog*> (context);
  13248. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  13249. }
  13250. /*:351*//*386:*/
  13251. #line 9585 "./typica.w"
  13252. QScriptValue constructAnnotationButton(QScriptContext*context,
  13253. QScriptEngine*engine)
  13254. {
  13255. QScriptValue object=
  13256. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  13257. setAnnotationButtonProperties(object,engine);
  13258. return object;
  13259. }
  13260. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  13261. {
  13262. setQPushButtonProperties(value,engine);
  13263. }
  13264. /*:386*//*394:*/
  13265. #line 9728 "./typica.w"
  13266. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  13267. QScriptEngine*engine)
  13268. {
  13269. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  13270. argument<QString> (0,context),argument<QString> (1,context)));
  13271. setAnnotationSpinBoxProperties(object,engine);
  13272. return object;
  13273. }
  13274. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13275. {
  13276. setQDoubleSpinBoxProperties(value,engine);
  13277. }
  13278. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13279. {
  13280. setQAbstractSpinBoxProperties(value,engine);
  13281. }
  13282. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13283. {
  13284. setQWidgetProperties(value,engine);
  13285. }
  13286. /*:394*//*415:*/
  13287. #line 10147 "./typica.w"
  13288. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  13289. {
  13290. QScriptValue object= engine->newQObject(new TimerDisplay);
  13291. setTimerDisplayProperties(object,engine);
  13292. return object;
  13293. }
  13294. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13295. {
  13296. setQLCDNumberProperties(value,engine);
  13297. }
  13298. /*:415*//*442:*/
  13299. #line 10642 "./typica.w"
  13300. QScriptValue constructWidgetDecorator(QScriptContext*context,
  13301. QScriptEngine*engine)
  13302. {
  13303. QWidget*widget= argument<QWidget*> (0,context);
  13304. QString text= argument<QString> (1,context);
  13305. Qt::Orientations orientation;
  13306. switch(argument<int> (2,context))
  13307. {
  13308. case 2:
  13309. orientation= Qt::Vertical;
  13310. break;
  13311. default:
  13312. orientation= Qt::Horizontal;
  13313. break;
  13314. }
  13315. QScriptValue object=
  13316. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  13317. setWidgetDecoratorProperties(object,engine);
  13318. return object;
  13319. }
  13320. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  13321. {
  13322. setQWidgetProperties(value,engine);
  13323. }
  13324. /*:442*//*455:*/
  13325. #line 10923 "./typica.w"
  13326. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  13327. {
  13328. QScriptValue object= engine->newQObject(new LogEditWindow);
  13329. return object;
  13330. }
  13331. /*:455*//*474:*/
  13332. #line 11397 "./typica.w"
  13333. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  13334. {
  13335. QIODevice*device= argument<QIODevice*> (0,context);
  13336. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  13337. argument<int> (1,context)));
  13338. object.setProperty("input",engine->newFunction(XMLInput_input));
  13339. return object;
  13340. }
  13341. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  13342. {
  13343. XMLInput*self= getself<XMLInput*> (context);
  13344. self->input();
  13345. return QScriptValue();
  13346. }
  13347. /*:474*//*481:*/
  13348. #line 11565 "./typica.w"
  13349. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  13350. {
  13351. QScriptValue object= engine->newQObject(new QWebView());
  13352. setQWebViewProperties(object,engine);
  13353. return object;
  13354. }
  13355. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  13356. {
  13357. setQWidgetProperties(value,engine);
  13358. value.setProperty("load",engine->newFunction(WebView_load));
  13359. value.setProperty("print",engine->newFunction(WebView_print));
  13360. value.setProperty("setHtml",engine->newFunction(WebView_setHtml));
  13361. value.setProperty("setContent",engine->newFunction(WebView_setContent));
  13362. value.setProperty("saveXml",engine->newFunction(WebView_saveXml));
  13363. }
  13364. /*:481*//*482:*/
  13365. #line 11586 "./typica.w"
  13366. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*)
  13367. {
  13368. QWebView*self= getself<QWebView*> (context);
  13369. QString file= argument<QString> (0,context);
  13370. self->load(QUrl(file));
  13371. return QScriptValue();
  13372. }
  13373. /*:482*//*483:*/
  13374. #line 11599 "./typica.w"
  13375. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*)
  13376. {
  13377. QWebView*self= getself<QWebView*> (context);
  13378. QPrinter*printer= new QPrinter(QPrinter::HighResolution);
  13379. QPrintDialog printDialog(printer,NULL);
  13380. if(printDialog.exec()==QDialog::Accepted)
  13381. {
  13382. self->print(printer);
  13383. }
  13384. return QScriptValue();
  13385. }
  13386. /*:483*//*484:*/
  13387. #line 11615 "./typica.w"
  13388. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*)
  13389. {
  13390. QWebView*self= getself<QWebView*> (context);
  13391. QString content= argument<QString> (0,context);
  13392. self->setHtml(content);
  13393. return QScriptValue();
  13394. }
  13395. /*:484*//*485:*/
  13396. #line 11628 "./typica.w"
  13397. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*)
  13398. {
  13399. QWebView*self= getself<QWebView*> (context);
  13400. QIODevice*device= argument<QIODevice*> (0,context);
  13401. device->reset();
  13402. QByteArray content= device->readAll();
  13403. self->setContent(content,"application/xhtml+xml");
  13404. return QScriptValue();
  13405. }
  13406. /*:485*//*486:*/
  13407. #line 11642 "./typica.w"
  13408. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*)
  13409. {
  13410. QWebView*self= getself<QWebView*> (context);
  13411. return QScriptValue(self->page()->currentFrame()->documentElement().toOuterXml());
  13412. }
  13413. /*:486*//*487:*/
  13414. #line 11652 "./typica.w"
  13415. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  13416. QStack<QLayout*> *layoutStack)
  13417. {
  13418. QWebView*view= new QWebView;
  13419. if(element.hasAttribute("id"))
  13420. {
  13421. view->setObjectName(element.attribute("id"));
  13422. }
  13423. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13424. layout->addWidget(view);
  13425. }
  13426. /*:487*//*545:*/
  13427. #line 12702 "./typica.w"
  13428. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  13429. {
  13430. QScriptValue object= engine->newQObject(new SqlQueryView);
  13431. setSqlQueryViewProperties(object,engine);
  13432. return object;
  13433. }
  13434. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  13435. {
  13436. setQTableViewProperties(value,engine);
  13437. value.setProperty("setHeaderData",
  13438. engine->newFunction(SqlQueryView_setHeaderData));
  13439. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  13440. }
  13441. /*:545*//*546:*/
  13442. #line 12720 "./typica.w"
  13443. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  13444. {
  13445. SqlQueryView*self= getself<SqlQueryView*> (context);
  13446. QString query= argument<QString> (0,context);
  13447. self->setQuery(query);
  13448. self->reset();
  13449. return QScriptValue();
  13450. }
  13451. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  13452. QScriptEngine*)
  13453. {
  13454. SqlQueryView*self= getself<SqlQueryView*> (context);
  13455. int section= argument<int> (0,context);
  13456. QString data= argument<QString> (1,context);
  13457. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  13458. return QScriptValue();
  13459. }
  13460. /*:546*//*554:*/
  13461. #line 12919 "./typica.w"
  13462. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  13463. QStack<QLayout*> *layoutStack)
  13464. {
  13465. QTextEdit*widget= new QTextEdit;
  13466. if(element.hasAttribute("id"))
  13467. {
  13468. widget->setObjectName(element.attribute("id"));
  13469. }
  13470. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13471. layout->addWidget(widget);
  13472. QTextDocument*document= new QTextDocument;
  13473. QFont defaultFont;
  13474. defaultFont.setPointSize(11);
  13475. document->setDefaultFont(defaultFont);
  13476. QTextCursor cursor(document);
  13477. /*555:*/
  13478. #line 12942 "./typica.w"
  13479. QDomNodeList children= element.childNodes();
  13480. for(int i= 0;i<children.count();i++)
  13481. {
  13482. QDomNode current;
  13483. QDomElement currentElement;
  13484. current= children.at(i);
  13485. if(current.isElement())
  13486. {
  13487. currentElement= current.toElement();
  13488. /*556:*/
  13489. #line 12959 "./typica.w"
  13490. if(currentElement.tagName()=="style")
  13491. {
  13492. document->setDefaultStyleSheet(currentElement.text());
  13493. }
  13494. /*:556*//*557:*/
  13495. #line 12970 "./typica.w"
  13496. if(currentElement.tagName()=="html")
  13497. {
  13498. cursor.insertHtml(currentElement.text());
  13499. }
  13500. /*:557*//*558:*/
  13501. #line 12980 "./typica.w"
  13502. if(currentElement.tagName()=="text")
  13503. {
  13504. cursor.insertText(currentElement.text());
  13505. }
  13506. /*:558*//*559:*/
  13507. #line 12990 "./typica.w"
  13508. if(currentElement.tagName()=="table")
  13509. {
  13510. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  13511. ReportTable*table= new ReportTable(frame,currentElement);
  13512. table->setParent(widget);
  13513. if(currentElement.hasAttribute("id"))
  13514. {
  13515. table->setObjectName(currentElement.attribute("id"));
  13516. }
  13517. }
  13518. /*:559*/
  13519. #line 12952 "./typica.w"
  13520. }
  13521. }
  13522. /*:555*/
  13523. #line 12935 "./typica.w"
  13524. widget->setDocument(document);
  13525. }
  13526. /*:554*//*570:*/
  13527. #line 13202 "./typica.w"
  13528. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  13529. {
  13530. QTextEdit*self= getself<QTextEdit*> (context);
  13531. QTextDocument*document= self->document();
  13532. QPrinter printer;
  13533. QPrintDialog printwindow(&printer,self);
  13534. if(printwindow.exec()!=QDialog::Accepted)
  13535. {
  13536. return QScriptValue();
  13537. }
  13538. document->print(&printer);
  13539. return QScriptValue();
  13540. }
  13541. /*:570*//*571:*/
  13542. #line 13220 "./typica.w"
  13543. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  13544. {
  13545. setQAbstractScrollAreaProperties(value,engine);
  13546. value.setProperty("print",engine->newFunction(QTextEdit_print));
  13547. }
  13548. /*:571*//*580:*/
  13549. #line 13398 "./typica.w"
  13550. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  13551. QStack<QLayout*> *layoutStack)
  13552. {
  13553. FormArray*widget= new FormArray(element);
  13554. if(element.hasAttribute("id"))
  13555. {
  13556. widget->setObjectName(element.attribute("id"));
  13557. }
  13558. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13559. layout->addWidget(widget);
  13560. }
  13561. /*:580*//*601:*/
  13562. #line 13985 "./typica.w"
  13563. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  13564. QStack<QLayout*> *layoutStack)
  13565. {
  13566. ScaleControl*scale= new ScaleControl;
  13567. if(element.hasAttribute("id"))
  13568. {
  13569. scale->setObjectName(element.attribute("id"));
  13570. }
  13571. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13572. layout->addWidget(scale);
  13573. }
  13574. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  13575. QStack<QLayout*> *layoutStack)
  13576. {
  13577. IntensityControl*scale= new IntensityControl;
  13578. if(element.hasAttribute("id"))
  13579. {
  13580. scale->setObjectName(element.attribute("id"));
  13581. }
  13582. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13583. layout->addWidget(scale);
  13584. }
  13585. /*:601*//*627:*/
  13586. #line 14575 "./typica.w"
  13587. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  13588. {
  13589. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  13590. setDeviceTreeModelProperties(object,engine);
  13591. return object;
  13592. }
  13593. /*:627*//*629:*/
  13594. #line 14598 "./typica.w"
  13595. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  13596. {
  13597. setQAbstractItemModelProperties(value,engine);
  13598. value.setProperty("referenceElement",
  13599. engine->newFunction(DeviceTreeModel_referenceElement));
  13600. }
  13601. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  13602. {
  13603. setQObjectProperties(value,engine);
  13604. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  13605. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  13606. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  13607. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  13608. }
  13609. /*:629*//*630:*/
  13610. #line 14625 "./typica.w"
  13611. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  13612. QScriptEngine*engine)
  13613. {
  13614. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  13615. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  13616. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13617. QDomElement node;
  13618. QVariantMap retval;
  13619. retval.insert("driver",referenceElement.attribute("driver"));
  13620. for(int i= 0;i<configData.size();i++)
  13621. {
  13622. node= configData.at(i).toElement();
  13623. retval.insert(node.attribute("name"),node.attribute("value"));
  13624. }
  13625. return engine->toScriptValue(retval);
  13626. }
  13627. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  13628. {
  13629. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13630. QModelIndex index= argument<QModelIndex> (0,context);
  13631. int role= argument<int> (1,context);
  13632. return engine->toScriptValue(model->data(index,role));
  13633. }
  13634. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  13635. {
  13636. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13637. int row= 0;
  13638. int column= 0;
  13639. QModelIndex index;
  13640. if(context->argumentCount()> 1)
  13641. {
  13642. row= argument<int> (0,context);
  13643. column= argument<int> (1,context);
  13644. }
  13645. if(context->argumentCount()> 2)
  13646. {
  13647. index= argument<QModelIndex> (2,context);
  13648. }
  13649. QModelIndex retval= model->index(row,column,index);
  13650. return engine->toScriptValue(retval);
  13651. }
  13652. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  13653. QScriptEngine*)
  13654. {
  13655. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13656. QModelIndex index;
  13657. if(context->argumentCount()==1)
  13658. {
  13659. index= argument<QModelIndex> (0,context);
  13660. }
  13661. return QScriptValue(model->rowCount(index));
  13662. }
  13663. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  13664. QScriptEngine*engine)
  13665. {
  13666. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13667. QModelIndex index;
  13668. if(context->argumentCount()==1)
  13669. {
  13670. index= argument<QModelIndex> (0,context);
  13671. }
  13672. return QScriptValue(engine,model->hasChildren(index));
  13673. }
  13674. /*:630*//*633:*/
  13675. #line 14709 "./typica.w"
  13676. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  13677. {
  13678. QVariant var;
  13679. var.setValue(index);
  13680. QScriptValue object= engine->newVariant(var);
  13681. return object;
  13682. }
  13683. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  13684. {
  13685. index= value.toVariant().value<QModelIndex> ();
  13686. }
  13687. /*:633*//*648:*/
  13688. #line 14977 "./typica.w"
  13689. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  13690. QScriptEngine*engine)
  13691. {
  13692. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  13693. return object;
  13694. }
  13695. /*:648*//*724:*/
  13696. #line 17482 "./typica.w"
  13697. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  13698. {
  13699. QScriptValue object;
  13700. if(context->argumentCount()==2)
  13701. {
  13702. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  13703. argument<QModelIndex> (1,context)),
  13704. QScriptEngine::ScriptOwnership);
  13705. setModbusRTUDeviceProperties(object,engine);
  13706. }
  13707. else
  13708. {
  13709. context->throwError("Incorrect number of arguments passed to "
  13710. "ModbusRTUDevice constructor. This takes the configuration model "
  13711. "and an index.");
  13712. }
  13713. return object;
  13714. }
  13715. /*:724*//*725:*/
  13716. #line 17504 "./typica.w"
  13717. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  13718. {
  13719. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13720. QScriptValue object;
  13721. if(self)
  13722. {
  13723. if(self->channels.size()> 0)
  13724. {
  13725. object= engine->newQObject(self->channels.at(0));
  13726. setChannelProperties(object,engine);
  13727. }
  13728. }
  13729. return object;
  13730. }
  13731. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  13732. {
  13733. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13734. QScriptValue object;
  13735. if(self)
  13736. {
  13737. if(self->channels.size()> 1)
  13738. {
  13739. object= engine->newQObject(self->channels.at(1));
  13740. setChannelProperties(object,engine);
  13741. }
  13742. }
  13743. return object;
  13744. }
  13745. /*:725*//*726:*/
  13746. #line 17537 "./typica.w"
  13747. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  13748. {
  13749. setQObjectProperties(value,engine);
  13750. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  13751. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  13752. }
  13753. /*:726*/
  13754. #line 764 "./typica.w"
  13755. /*525:*/
  13756. #line 12364 "./typica.w"
  13757. int main(int argc,char**argv)
  13758. {
  13759. int*c= &argc;
  13760. Application app(*c,argv);
  13761. /*526:*/
  13762. #line 12388 "./typica.w"
  13763. QStringList themeSearchPath= QIcon::themeSearchPaths();
  13764. themeSearchPath.append(":/resources/icons/tango");
  13765. QIcon::setThemeSearchPaths(themeSearchPath);
  13766. QIcon::setThemeName(":/resources/icons/tango");
  13767. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  13768. /*:526*/
  13769. #line 12369 "./typica.w"
  13770. QSettings settings;
  13771. /*658:*/
  13772. #line 15189 "./typica.w"
  13773. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  13774. /*:658*//*668:*/
  13775. #line 15417 "./typica.w"
  13776. app.registerDeviceConfigurationWidget("nidaqmxbase",
  13777. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  13778. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  13779. NiDaqMxBase9211ConfWidget::staticMetaObject);
  13780. app.registerDeviceConfigurationWidget("ni9211seriestc",
  13781. Ni9211TcConfWidget::staticMetaObject);
  13782. /*:668*//*676:*/
  13783. #line 15634 "./typica.w"
  13784. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  13785. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  13786. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  13787. /*:676*//*700:*/
  13788. #line 16595 "./typica.w"
  13789. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  13790. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  13791. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  13792. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  13793. /*:700*//*705:*/
  13794. #line 16680 "./typica.w"
  13795. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  13796. /*:705*//*708:*/
  13797. #line 16750 "./typica.w"
  13798. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  13799. /*:708*//*711:*/
  13800. #line 16877 "./typica.w"
  13801. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  13802. /*:711*//*729:*/
  13803. #line 18050 "./typica.w"
  13804. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  13805. /*:729*//*736:*/
  13806. #line 18180 "./typica.w"
  13807. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  13808. /*:736*//*740:*/
  13809. #line 18269 "./typica.w"
  13810. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  13811. /*:740*/
  13812. #line 12372 "./typica.w"
  13813. /*527:*/
  13814. #line 12401 "./typica.w"
  13815. if(settings.value("database/exists","false").toString()=="true")
  13816. {
  13817. /*532:*/
  13818. #line 12521 "./typica.w"
  13819. QSqlDatabase database=
  13820. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  13821. database.setHostName(settings.value("database/hostname").toString());
  13822. database.setDatabaseName(settings.value("database/dbname").toString());
  13823. database.setUserName(settings.value("database/user").toString());
  13824. database.setPassword(settings.value("database/password").toString());
  13825. if(!database.open())
  13826. {
  13827. settings.setValue("database/exists","false");
  13828. }
  13829. /*:532*/
  13830. #line 12404 "./typica.w"
  13831. }
  13832. if(settings.value("database/exists","false").toString()=="false")
  13833. {
  13834. /*531:*/
  13835. #line 12512 "./typica.w"
  13836. SqlConnectionSetup dialog;
  13837. dialog.exec();
  13838. /*:531*/
  13839. #line 12408 "./typica.w"
  13840. }
  13841. /*:527*/
  13842. #line 12373 "./typica.w"
  13843. /*154:*/
  13844. #line 3639 "./typica.w"
  13845. QStringList arguments= QCoreApplication::arguments();
  13846. int position= arguments.indexOf("-c");
  13847. QString filename= QString();
  13848. if(position!=-1)
  13849. {
  13850. if(arguments.size()>=position+1)
  13851. {
  13852. filename= arguments.at(position+1);
  13853. }
  13854. }
  13855. if(filename.isEmpty())
  13856. {
  13857. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  13858. settings.value("config","").toString());
  13859. }
  13860. QDir directory;
  13861. if(!filename.isEmpty())
  13862. {
  13863. QFile file(filename);
  13864. QFileInfo info(filename);
  13865. directory= info.dir();
  13866. settings.setValue("config",directory.path());
  13867. if(file.open(QIODevice::ReadOnly))
  13868. {
  13869. app.configuration()->setContent(&file,true);
  13870. }
  13871. }
  13872. /*155:*/
  13873. #line 3673 "./typica.w"
  13874. QDomElement root= app.configuration()->documentElement();
  13875. QDomNodeList children= root.childNodes();
  13876. QString replacementDoc;
  13877. QDomDocument includedDoc;
  13878. QDomDocumentFragment fragment;
  13879. for(int i= 0;i<children.size();i++)
  13880. {
  13881. QDomNode currentNode= children.at(i);
  13882. QDomElement currentElement;
  13883. if(currentNode.nodeName()=="include")
  13884. {
  13885. currentElement= currentNode.toElement();
  13886. if(currentElement.hasAttribute("src"))
  13887. {
  13888. replacementDoc= directory.path();
  13889. replacementDoc.append('/');
  13890. replacementDoc.append(currentElement.attribute("src"));
  13891. QFile doc(replacementDoc);
  13892. if(doc.open(QIODevice::ReadOnly))
  13893. {
  13894. includedDoc.setContent(&doc,true);
  13895. fragment= includedDoc.createDocumentFragment();
  13896. fragment.appendChild(includedDoc.documentElement());
  13897. root.replaceChild(fragment,currentNode);
  13898. doc.close();
  13899. }
  13900. }
  13901. }
  13902. }
  13903. /*:155*/
  13904. #line 3667 "./typica.w"
  13905. /*:154*/
  13906. #line 12374 "./typica.w"
  13907. /*20:*/
  13908. #line 883 "./typica.w"
  13909. QScriptEngine*engine= new QScriptEngine;
  13910. QScriptValue constructor;
  13911. QScriptValue value;
  13912. /*:20*//*30:*/
  13913. #line 1059 "./typica.w"
  13914. constructor= engine->newFunction(constructQWidget);
  13915. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  13916. engine->globalObject().setProperty("QWidget",value);
  13917. /*:30*//*38:*/
  13918. #line 1259 "./typica.w"
  13919. constructor= engine->newFunction(constructQMainWindow);
  13920. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  13921. constructor);
  13922. engine->globalObject().setProperty("QMainWindow",value);
  13923. /*:38*//*49:*/
  13924. #line 1464 "./typica.w"
  13925. constructor= engine->newFunction(constructQFrame);
  13926. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  13927. engine->globalObject().setProperty("QFrame",value);
  13928. /*:49*//*52:*/
  13929. #line 1497 "./typica.w"
  13930. constructor= engine->newFunction(constructQLabel);
  13931. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  13932. engine->globalObject().setProperty("QLabel",value);
  13933. /*:52*//*55:*/
  13934. #line 1544 "./typica.w"
  13935. constructor= engine->newFunction(constructQSplitter);
  13936. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  13937. engine->globalObject().setProperty("QSplitter",value);
  13938. /*:55*//*62:*/
  13939. #line 1715 "./typica.w"
  13940. constructor= engine->newFunction(constructQBoxLayout);
  13941. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  13942. engine->globalObject().setProperty("QBoxLayout",value);
  13943. /*:62*//*66:*/
  13944. #line 1827 "./typica.w"
  13945. constructor= engine->newFunction(constructQAction);
  13946. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  13947. engine->globalObject().setProperty("QAction",value);
  13948. /*:66*//*69:*/
  13949. #line 1886 "./typica.w"
  13950. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  13951. value.setProperty("getOpenFileName",
  13952. engine->newFunction(QFileDialog_getOpenFileName));
  13953. value.setProperty("getSaveFileName",
  13954. engine->newFunction(QFileDialog_getSaveFileName));
  13955. engine->globalObject().setProperty("QFileDialog",value);
  13956. /*:69*//*74:*/
  13957. #line 1998 "./typica.w"
  13958. constructor= engine->newFunction(constructQFile);
  13959. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  13960. engine->globalObject().setProperty("QFile",value);
  13961. /*:74*//*81:*/
  13962. #line 2115 "./typica.w"
  13963. constructor= engine->newFunction(constructQBuffer);
  13964. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  13965. engine->globalObject().setProperty("QBuffer",value);
  13966. /*:81*//*84:*/
  13967. #line 2163 "./typica.w"
  13968. constructor= engine->newFunction(constructXQuery);
  13969. engine->globalObject().setProperty("XQuery",constructor);
  13970. /*:84*//*90:*/
  13971. #line 2257 "./typica.w"
  13972. constructor= engine->newFunction(constructXmlWriter);
  13973. engine->globalObject().setProperty("XmlWriter",constructor);
  13974. /*:90*//*99:*/
  13975. #line 2463 "./typica.w"
  13976. constructor= engine->newFunction(constructXmlReader);
  13977. engine->globalObject().setProperty("XmlReader",constructor);
  13978. /*:99*//*106:*/
  13979. #line 2587 "./typica.w"
  13980. value= engine->newQObject(&settings);
  13981. setQSettingsProperties(value,engine);
  13982. engine->globalObject().setProperty("QSettings",value);
  13983. /*:106*//*110:*/
  13984. #line 2668 "./typica.w"
  13985. constructor= engine->newFunction(constructQLCDNumber);
  13986. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  13987. engine->globalObject().setProperty("QLCDNumber",value);
  13988. /*:110*//*113:*/
  13989. #line 2724 "./typica.w"
  13990. constructor= engine->newFunction(constructQTime);
  13991. engine->globalObject().setProperty("QTime",constructor);
  13992. /*:113*//*134:*/
  13993. #line 3228 "./typica.w"
  13994. constructor= engine->newFunction(constructQPushButton);
  13995. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  13996. engine->globalObject().setProperty("QPushButton",value);
  13997. /*:134*//*141:*/
  13998. #line 3339 "./typica.w"
  13999. constructor= engine->newFunction(constructQSqlQuery);
  14000. engine->globalObject().setProperty("QSqlQuery",constructor);
  14001. /*:141*//*148:*/
  14002. #line 3500 "./typica.w"
  14003. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  14004. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  14005. engine->globalObject().setProperty("sqlToArray",
  14006. engine->newFunction(sqlToArray));
  14007. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  14008. engine->globalObject().setProperty("annotationFromRecord",
  14009. engine->newFunction(annotationFromRecord));
  14010. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  14011. /*:148*//*159:*/
  14012. #line 3836 "./typica.w"
  14013. engine->globalObject().setProperty("createWindow",
  14014. engine->newFunction(createWindow));
  14015. /*:159*//*211:*/
  14016. #line 5308 "./typica.w"
  14017. engine->globalObject().setProperty("findChildObject",
  14018. engine->newFunction(findChildObject));
  14019. /*:211*//*254:*/
  14020. #line 6485 "./typica.w"
  14021. constructor= engine->newFunction(constructDAQ);
  14022. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  14023. engine->globalObject().setProperty("DAQ",value);
  14024. /*:254*//*263:*/
  14025. #line 6683 "./typica.w"
  14026. constructor= engine->newFunction(constructFakeDAQ);
  14027. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  14028. engine->globalObject().setProperty("FakeDAQ",value);
  14029. /*:263*//*274:*/
  14030. #line 6960 "./typica.w"
  14031. constructor= engine->newFunction(constructLinearCalibrator);
  14032. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  14033. constructor);
  14034. engine->globalObject().setProperty("LinearCalibrator",value);
  14035. /*:274*//*279:*/
  14036. #line 7098 "./typica.w"
  14037. constructor= engine->newFunction(constructLinearSplineInterpolator);
  14038. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  14039. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  14040. /*:279*//*288:*/
  14041. #line 7281 "./typica.w"
  14042. constructor= engine->newFunction(constructTemperatureDisplay);
  14043. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  14044. constructor);
  14045. engine->globalObject().setProperty("TemperatureDisplay",value);
  14046. /*:288*//*295:*/
  14047. #line 7419 "./typica.w"
  14048. constructor= engine->newFunction(constructMeasurementTimeOffset);
  14049. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  14050. constructor);
  14051. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  14052. /*:295*//*300:*/
  14053. #line 7530 "./typica.w"
  14054. constructor= engine->newFunction(constructThresholdDetector);
  14055. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  14056. engine->globalObject().setProperty("ThresholdDetector",value);
  14057. /*:300*//*305:*/
  14058. #line 7628 "./typica.w"
  14059. constructor= engine->newFunction(constructZeroEmitter);
  14060. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  14061. engine->globalObject().setProperty("ZeroEmitter",value);
  14062. /*:305*//*310:*/
  14063. #line 7707 "./typica.w"
  14064. constructor= engine->newFunction(constructMeasurementAdapter);
  14065. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  14066. constructor);
  14067. engine->globalObject().setProperty("MeasurementAdapter",value);
  14068. /*:310*//*325:*/
  14069. #line 8056 "./typica.w"
  14070. constructor= engine->newFunction(constructGraphView);
  14071. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  14072. engine->globalObject().setProperty("GraphView",value);
  14073. /*:325*//*348:*/
  14074. #line 8659 "./typica.w"
  14075. constructor= engine->newFunction(constructZoomLog);
  14076. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  14077. engine->globalObject().setProperty("ZoomLog",value);
  14078. /*:348*//*385:*/
  14079. #line 9577 "./typica.w"
  14080. constructor= engine->newFunction(constructAnnotationButton);
  14081. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  14082. constructor);
  14083. engine->globalObject().setProperty("AnnotationButton",value);
  14084. /*:385*//*393:*/
  14085. #line 9719 "./typica.w"
  14086. constructor= engine->newFunction(constructAnnotationSpinBox);
  14087. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  14088. constructor);
  14089. engine->globalObject().setProperty("AnnotationSpinBox",value);
  14090. /*:393*//*414:*/
  14091. #line 10140 "./typica.w"
  14092. constructor= engine->newFunction(constructTimerDisplay);
  14093. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  14094. engine->globalObject().setProperty("TimerDisplay",value);
  14095. /*:414*//*441:*/
  14096. #line 10634 "./typica.w"
  14097. constructor= engine->newFunction(constructWidgetDecorator);
  14098. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  14099. engine->globalObject().setProperty("WidgetDecorator",value);
  14100. /*:441*//*454:*/
  14101. #line 10916 "./typica.w"
  14102. constructor= engine->newFunction(constructLogEditWindow);
  14103. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  14104. engine->globalObject().setProperty("LogEditWindow",value);
  14105. /*:454*//*473:*/
  14106. #line 11390 "./typica.w"
  14107. constructor= engine->newFunction(constructXMLInput);
  14108. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  14109. engine->globalObject().setProperty("XMLInput",value);
  14110. /*:473*//*480:*/
  14111. #line 11557 "./typica.w"
  14112. constructor= engine->newFunction(constructWebView);
  14113. value= engine->newQMetaObject(&QWebView::staticMetaObject,constructor);
  14114. engine->globalObject().setProperty("WebView",value);
  14115. /*:480*//*493:*/
  14116. #line 11749 "./typica.w"
  14117. value= engine->newQObject(AppInstance);
  14118. engine->globalObject().setProperty("Application",value);
  14119. /*:493*//*544:*/
  14120. #line 12694 "./typica.w"
  14121. constructor= engine->newFunction(constructSqlQueryView);
  14122. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  14123. engine->globalObject().setProperty("SqlQueryView",value);
  14124. /*:544*//*628:*/
  14125. #line 14585 "./typica.w"
  14126. constructor= engine->newFunction(constructDeviceTreeModel);
  14127. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  14128. constructor);
  14129. engine->globalObject().setProperty("DeviceTreeModel",value);
  14130. /*:628*//*634:*/
  14131. #line 14725 "./typica.w"
  14132. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  14133. /*:634*//*649:*/
  14134. #line 14987 "./typica.w"
  14135. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  14136. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  14137. constructor);
  14138. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  14139. /*:649*//*723:*/
  14140. #line 17473 "./typica.w"
  14141. constructor= engine->newFunction(constructModbusRTUDevice);
  14142. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  14143. engine->globalObject().setProperty("ModbusRTUDevice",value);
  14144. /*:723*/
  14145. #line 12375 "./typica.w"
  14146. app.engine= engine;
  14147. /*156:*/
  14148. #line 3721 "./typica.w"
  14149. QString styleText;
  14150. QString programText;
  14151. QDomElement currentElement;
  14152. for(int i= 0;i<children.size();i++)
  14153. {
  14154. QDomNode currentNode= children.at(i);
  14155. if(currentNode.nodeName()=="style")
  14156. {
  14157. currentElement= currentNode.toElement();
  14158. styleText.append(currentElement.text());
  14159. }
  14160. else if(currentNode.nodeName()=="program")
  14161. {
  14162. currentElement= currentNode.toElement();
  14163. programText.append(currentElement.text());
  14164. }
  14165. }
  14166. app.setStyleSheet(styleText);
  14167. QScriptValue result= engine->evaluate(programText);
  14168. /*157:*/
  14169. #line 3746 "./typica.w"
  14170. if(engine->hasUncaughtException())
  14171. {
  14172. int line= engine->uncaughtExceptionLineNumber();
  14173. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14174. result.toString();
  14175. QString trace;
  14176. foreach(trace,engine->uncaughtExceptionBacktrace())
  14177. {
  14178. qDebug()<<trace;
  14179. }
  14180. }
  14181. /*:157*/
  14182. #line 3741 "./typica.w"
  14183. /*:156*/
  14184. #line 12377 "./typica.w"
  14185. int retval= app.exec();
  14186. delete engine;
  14187. return retval;
  14188. }
  14189. /*:525*/
  14190. #line 765 "./typica.w"
  14191. #include "moc_typica.cpp"
  14192. /*:16*/