Typica is a free program for professional coffee roasters. https://typica.us
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

typica.cpp 361KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318
  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*//*667:*/
  16. #line 15624 "./typica.w"
  17. #include "qextserialport.h"
  18. #include "qextserialenumerator.h"
  19. /*:667*/
  20. #line 760 "./typica.w"
  21. /*32:*/
  22. #line 1139 "./typica.w"
  23. class ScriptQMainWindow:public QMainWindow
  24. {
  25. Q_OBJECT
  26. public:
  27. ScriptQMainWindow();
  28. public slots:
  29. void show();
  30. void saveSizeAndPosition(const QString&key);
  31. void restoreSizeAndPosition(const QString&key);
  32. void displayStatus(const QString&message= QString());
  33. protected:
  34. void closeEvent(QCloseEvent*event);
  35. void showEvent(QShowEvent*event);
  36. signals:
  37. void aboutToClose(void);
  38. };
  39. /*:32*//*135:*/
  40. #line 3258 "./typica.w"
  41. class SqlQueryConnection:public QSqlQuery
  42. {
  43. public:
  44. SqlQueryConnection(const QString&query= QString());
  45. ~SqlQueryConnection();
  46. QSqlQuery*operator->();
  47. private:
  48. QString connection;
  49. QSqlQuery*q;
  50. };
  51. /*:135*//*191:*/
  52. #line 5032 "./typica.w"
  53. class NumericDelegate:public QItemDelegate
  54. {
  55. Q_OBJECT
  56. public:
  57. NumericDelegate(QObject*parent= NULL);
  58. QWidget*createEditor(QWidget*parent,
  59. const QStyleOptionViewItem&option,
  60. const QModelIndex&index)const;
  61. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  62. void setModelData(QWidget*editor,QAbstractItemModel*model,
  63. const QModelIndex&index)const;
  64. void updateEditorGeometry(QWidget*editor,
  65. const QStyleOptionViewItem&option,
  66. const QModelIndex&index)const;
  67. };
  68. /*:191*//*217:*/
  69. #line 5670 "./typica.w"
  70. class Measurement
  71. {
  72. public:
  73. enum TemperatureUnits
  74. {
  75. Fahrenheit= 10144,
  76. Celsius= 10143,
  77. Kelvin= 10325,
  78. Rankine= 10145
  79. };
  80. private:
  81. double theTemperature;
  82. QTime theTime;
  83. TemperatureUnits unit;
  84. public:
  85. Measurement(double temperature= 0,QTime time= QTime(),
  86. TemperatureUnits sc= Fahrenheit);
  87. Measurement(double temperature);
  88. Measurement(const Measurement&x);
  89. Measurement&operator= (Measurement&x);
  90. ~Measurement();
  91. double temperature()const;
  92. QTime time()const;
  93. void setTemperature(double temperature);
  94. void setTime(QTime time);
  95. void setUnit(TemperatureUnits scale);
  96. TemperatureUnits scale();
  97. Measurement toFahrenheit();
  98. Measurement toCelsius();
  99. Measurement toKelvin();
  100. Measurement toRankine();
  101. };
  102. /*:217*//*229:*/
  103. #line 5972 "./typica.w"
  104. class Channel;
  105. class DAQImplementation;
  106. class DAQ:public QObject
  107. {
  108. Q_OBJECT
  109. Q_ENUMS(TemperatureUnits)
  110. Q_ENUMS(ThermocoupleType)
  111. DAQImplementation*imp;
  112. private slots:
  113. void threadFinished();
  114. public:
  115. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  116. ~DAQ();
  117. Channel*newChannel(int units,int thermocouple);
  118. Q_INVOKABLE void setClockRate(double Hz);
  119. Q_INVOKABLE void start();
  120. Q_INVOKABLE void stop();
  121. enum TemperatureUnits
  122. {
  123. Fahrenheit= 10144,
  124. Celsius= 10143,
  125. Kelvin= 10325,
  126. Rankine= 10145
  127. };
  128. enum ThermocoupleType
  129. {
  130. TypeJ= 10072,
  131. TypeK= 10073,
  132. TypeN= 10077,
  133. TypeR= 10082,
  134. TypeS= 10085,
  135. TypeT= 10086,
  136. TypeB= 10047,
  137. TypeE= 10055
  138. };
  139. };
  140. /*:229*//*230:*/
  141. #line 6018 "./typica.w"
  142. class DAQImplementation:public QThread
  143. {
  144. Q_OBJECT
  145. public:
  146. DAQImplementation(const QString&driverinfo);
  147. ~DAQImplementation();
  148. void run();
  149. void measure();
  150. /*231:*/
  151. #line 6038 "./typica.w"
  152. typedef int(*daqfp)(...);
  153. daqfp read;
  154. daqfp errorInfo;
  155. daqfp startTask;
  156. daqfp createTask;
  157. daqfp createChannel;
  158. daqfp setClock;
  159. daqfp stopTask;
  160. daqfp clearTask;
  161. daqfp resetDevice;
  162. daqfp waitForMeasurement;
  163. /*:231*/
  164. #line 6027 "./typica.w"
  165. /*232:*/
  166. #line 6054 "./typica.w"
  167. bool useBase;
  168. QString device;
  169. QVector<Channel*> channelMap;
  170. unsigned int handle;
  171. int error;
  172. int channels;
  173. bool ready;
  174. QLibrary driver;
  175. QVector<Measurement::TemperatureUnits> unitMap;
  176. /*:232*/
  177. #line 6028 "./typica.w"
  178. };
  179. /*:230*//*248:*/
  180. #line 6551 "./typica.w"
  181. class FakeDAQImplementation:public QThread
  182. {
  183. Q_OBJECT
  184. public:
  185. FakeDAQImplementation();
  186. ~FakeDAQImplementation();
  187. void run();
  188. void measure();
  189. QVector<Channel*> channelMap;
  190. int channels;
  191. bool ready;
  192. double clockRate;
  193. };
  194. class FakeDAQ:public QObject
  195. {
  196. Q_OBJECT
  197. FakeDAQImplementation*imp;
  198. public:
  199. FakeDAQ(QString device);
  200. ~FakeDAQ();
  201. Channel*newChannel(int units,int thermocouple);
  202. Q_INVOKABLE void setClockRate(double Hz);
  203. Q_INVOKABLE void start();
  204. };
  205. /*:248*//*255:*/
  206. #line 6738 "./typica.w"
  207. class Channel:public QObject
  208. {
  209. Q_OBJECT
  210. public:
  211. Channel();
  212. ~Channel();
  213. public slots:
  214. void input(Measurement measurement);
  215. signals:
  216. void newData(Measurement);
  217. };
  218. /*:255*//*259:*/
  219. #line 6801 "./typica.w"
  220. class LinearCalibrator:public QObject
  221. {
  222. Q_OBJECT
  223. Q_PROPERTY(double measuredLower READ measuredLower
  224. WRITE setMeasuredLower)
  225. Q_PROPERTY(double measuredUpper READ measuredUpper
  226. WRITE setMeasuredUpper)
  227. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  228. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  229. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  230. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  231. public:
  232. LinearCalibrator(QObject*parent= NULL);
  233. double measuredLower();
  234. double measuredUpper();
  235. double mappedLower();
  236. double mappedUpper();
  237. bool isClosedRange();
  238. double sensitivity();
  239. public slots:
  240. void setMeasuredLower(double lower);
  241. void setMeasuredUpper(double upper);
  242. void setMappedLower(double lower);
  243. void setMappedUpper(double upper);
  244. void setClosedRange(bool closed);
  245. void setSensitivity(double sensitivity);
  246. void newMeasurement(Measurement measure);
  247. signals:
  248. void measurement(Measurement measure);
  249. private:
  250. double Lo1;
  251. double Lo2;
  252. double Up1;
  253. double Up2;
  254. double sensitivitySetting;
  255. bool clamp;
  256. };
  257. /*:259*//*266:*/
  258. #line 6995 "./typica.w"
  259. class LinearSplineInterpolator:public QObject
  260. {
  261. Q_OBJECT
  262. public:
  263. LinearSplineInterpolator(QObject*parent= NULL);
  264. Q_INVOKABLE void add_pair(double source,double destination);
  265. public slots:
  266. void newMeasurement(Measurement measure);
  267. signals:
  268. void newData(Measurement measure);
  269. private:
  270. void make_interpolators();
  271. QMap<double,double> *pairs;
  272. QList<LinearCalibrator*> *interpolators;
  273. };
  274. /*:266*//*271:*/
  275. #line 7130 "./typica.w"
  276. class TemperatureDisplay:public QLCDNumber
  277. {
  278. Q_OBJECT
  279. Q_ENUMS(DisplayUnits)
  280. int unit;
  281. public:
  282. enum DisplayUnits
  283. {
  284. Auto= -1,
  285. Fahrenheit= 10144,
  286. Celsius= 10143,
  287. Kelvin= 10325,
  288. Rankine= 10145
  289. };
  290. TemperatureDisplay(QWidget*parent= NULL);
  291. ~TemperatureDisplay();
  292. public slots:
  293. void setValue(Measurement temperature);
  294. void invalidate();
  295. void setDisplayUnits(DisplayUnits scale);
  296. };
  297. /*:271*//*280:*/
  298. #line 7306 "./typica.w"
  299. class MeasurementTimeOffset:public QObject
  300. {
  301. Q_OBJECT
  302. QTime epoch;
  303. QTime previous;
  304. bool hasPrevious;
  305. public:
  306. MeasurementTimeOffset(QTime zero);
  307. QTime zeroTime();
  308. public slots:
  309. void newMeasurement(Measurement measure);
  310. void setZeroTime(QTime zero);
  311. signals:
  312. void measurement(Measurement measure);
  313. };
  314. /*:280*//*287:*/
  315. #line 7456 "./typica.w"
  316. class ThresholdDetector:public QObject
  317. {
  318. Q_OBJECT
  319. Q_ENUMS(EdgeDirection)
  320. public:
  321. enum EdgeDirection{
  322. Ascending,Descending
  323. };
  324. ThresholdDetector(double value);
  325. public slots:
  326. void newMeasurement(Measurement measure);
  327. void setThreshold(double value);
  328. void setEdgeDirection(EdgeDirection direction);
  329. signals:
  330. void timeForValue(double);
  331. private:
  332. double previousValue;
  333. double threshold;
  334. EdgeDirection currentDirection;
  335. };
  336. /*:287*//*292:*/
  337. #line 7562 "./typica.w"
  338. class ZeroEmitter:public QObject
  339. {
  340. Q_OBJECT
  341. int col;
  342. double temp;
  343. public:
  344. ZeroEmitter(int tempcolumn);
  345. int column();
  346. double lastTemperature();
  347. public slots:
  348. void newMeasurement(Measurement measure);
  349. void setColumn(int column);
  350. void emitZero();
  351. signals:
  352. void measurement(Measurement measure,int tempcolumn);
  353. };
  354. /*:292*//*297:*/
  355. #line 7655 "./typica.w"
  356. class MeasurementAdapter:public QObject
  357. {
  358. Q_OBJECT
  359. int col;
  360. public:
  361. MeasurementAdapter(int tempcolumn);
  362. int column();
  363. public slots:
  364. void newMeasurement(Measurement measure);
  365. void setColumn(int column);
  366. signals:
  367. void measurement(Measurement measure,int tempcolumn);
  368. };
  369. /*:297*//*302:*/
  370. #line 7744 "./typica.w"
  371. class GraphView:public QGraphicsView
  372. {
  373. Q_OBJECT
  374. QGraphicsScene*theScene;
  375. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  376. QMap<int,QPointF> *prevPoints;
  377. QMap<int,double> *translations;
  378. QList<QGraphicsItem*> *gridLinesF;
  379. QList<QGraphicsItem*> *gridLinesC;
  380. public:
  381. GraphView(QWidget*parent= NULL);
  382. void removeSeries(int column);
  383. protected:
  384. void resizeEvent(QResizeEvent*event);
  385. public slots:
  386. void newMeasurement(Measurement measure,int tempcolumn);
  387. void setSeriesTranslation(int column,double offset);
  388. void clear();
  389. void showF();
  390. void showC();
  391. };
  392. /*:302*//*317:*/
  393. #line 8095 "./typica.w"
  394. class MeasurementModel;
  395. class ZoomLog:public QTableView
  396. {
  397. Q_OBJECT
  398. /*318:*/
  399. #line 8143 "./typica.w"
  400. MeasurementModel*model_ms;
  401. MeasurementModel*model_1s;
  402. MeasurementModel*model_5s;
  403. MeasurementModel*model_10s;
  404. MeasurementModel*model_15s;
  405. MeasurementModel*model_30s;
  406. MeasurementModel*model_1m;
  407. QList<MeasurementModel*> modelSet;
  408. QHash<int,Measurement> lastMeasurement;
  409. MeasurementModel*currentModel;
  410. QList<int> saveTempCols;
  411. QList<int> saveNoteCols;
  412. QList<int> currentColumnSet;
  413. /*:318*/
  414. #line 8100 "./typica.w"
  415. void switchLOD(MeasurementModel*m);
  416. private slots:
  417. void centerOn(int row);
  418. void persistColumnResize(int column,int oldsize,int newsize);
  419. void restoreColumnWidths();
  420. public:
  421. ZoomLog();
  422. QVariant data(int row,int column)const;
  423. int rowCount();
  424. bool saveXML(QIODevice*device);
  425. bool saveCSV(QIODevice*device);
  426. QString lastTime(int series);
  427. Q_INVOKABLE int displayUnits();
  428. public slots:
  429. void setVisible(bool visibility);
  430. void setHeaderData(int section,QString text);
  431. void LOD_ms();
  432. void LOD_1s();
  433. void LOD_5s();
  434. void LOD_10s();
  435. void LOD_15s();
  436. void LOD_30s();
  437. void LOD_1m();
  438. void newMeasurement(Measurement measure,int tempcolumn);
  439. void newAnnotation(QString annotation,int tempcolumn,
  440. int annotationcolumn);
  441. void clear();
  442. void addOutputTemperatureColumn(int column);
  443. void addOutputAnnotationColumn(int column);
  444. void clearOutputColumns();
  445. void setDisplayUnits(int scale);
  446. void addToCurrentColumnSet(int column);
  447. void clearCurrentColumnSet();
  448. protected:
  449. virtual void showEvent(QShowEvent*event);
  450. };
  451. /*:317*//*341:*/
  452. #line 8757 "./typica.w"
  453. class MeasurementList;
  454. class MeasurementModel:public QAbstractItemModel
  455. {
  456. Q_OBJECT
  457. Q_ENUMS(DisplayUnits);
  458. int unit;
  459. QList<MeasurementList*> *entries;
  460. QStringList*hData;
  461. int colcount;
  462. QHash<int,int> *lastTemperature;
  463. QList<MeasurementList*> ::iterator lastInsertion;
  464. public:
  465. enum DisplayUnits
  466. {
  467. Auto= -1,
  468. Fahrenheit= 10144,
  469. Celsius= 10143,
  470. Kelvin= 10325,
  471. Rankine= 10145
  472. };
  473. MeasurementModel(QObject*parent= NULL);
  474. ~MeasurementModel();
  475. int rowCount(const QModelIndex&parent= QModelIndex())const;
  476. int columnCount(const QModelIndex&parent= QModelIndex())const;
  477. bool setHeaderData(int section,Qt::Orientation orientation,
  478. const QVariant&value,int role= Qt::DisplayRole);
  479. QVariant data(const QModelIndex&index,int role)const;
  480. bool setData(const QModelIndex&index,const QVariant&value,
  481. int role= Qt::EditRole);
  482. Qt::ItemFlags flags(const QModelIndex&index)const;
  483. QVariant headerData(int section,Qt::Orientation orientation,
  484. int role= Qt::DisplayRole)const;
  485. QModelIndex index(int row,int column,
  486. const QModelIndex&parent= QModelIndex())const;
  487. QModelIndex parent(const QModelIndex&index)const;
  488. int displayUnits();
  489. public slots:
  490. void newMeasurement(Measurement measure,int tempcolumn);
  491. void newAnnotation(QString annotation,int tempcolumn,
  492. int annotationColumn);
  493. void clear();
  494. void setDisplayUnits(int scale);
  495. signals:
  496. void rowChanged(int);
  497. };
  498. /*:341*//*342:*/
  499. #line 8809 "./typica.w"
  500. class MeasurementList:public QVariantList
  501. {
  502. public:
  503. bool operator<(const MeasurementList&other)const;
  504. bool operator==(const MeasurementList&other)const;
  505. };
  506. /*:342*//*368:*/
  507. #line 9446 "./typica.w"
  508. class AnnotationButton:public QPushButton
  509. {
  510. Q_OBJECT
  511. QString note;
  512. int tc;
  513. int ac;
  514. int count;
  515. public:
  516. AnnotationButton(const QString&text,QWidget*parent= NULL);
  517. public slots:
  518. void setAnnotation(const QString&annotation);
  519. void setTemperatureColumn(int tempcolumn);
  520. void setAnnotationColumn(int annotationcolumn);
  521. void annotate();
  522. void resetCount();
  523. signals:
  524. void annotation(QString annotation,int tempcolumn,
  525. int notecolumn);
  526. };
  527. /*:368*//*376:*/
  528. #line 9571 "./typica.w"
  529. class AnnotationSpinBox:public QDoubleSpinBox
  530. {
  531. Q_OBJECT
  532. QString pretext;
  533. QString posttext;
  534. int tc;
  535. int ac;
  536. bool change;
  537. public:
  538. AnnotationSpinBox(const QString&pret,const QString&postt,
  539. QWidget*parent= NULL);
  540. public slots:
  541. void setPretext(const QString&pret);
  542. void setPosttext(const QString&postt);
  543. void setTemperatureColumn(int tempcolumn);
  544. void setAnnotationColumn(int annotationcolumn);
  545. void annotate();
  546. void resetChange();
  547. signals:
  548. void annotation(QString annotation,int tempcolumn,
  549. int notecolumn);
  550. };
  551. /*:376*//*384:*/
  552. #line 9730 "./typica.w"
  553. class TimerDisplay:public QLCDNumber
  554. {
  555. Q_OBJECT
  556. /*385:*/
  557. #line 9780 "./typica.w"
  558. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  559. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  560. Q_PROPERTY(bool running READ isRunning)
  561. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  562. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  563. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  564. /*:385*/
  565. #line 9734 "./typica.w"
  566. private slots:
  567. void updateTime();
  568. void setCountUpMode();
  569. void setCountDownMode();
  570. void setClockMode();
  571. public:
  572. TimerDisplay(QWidget*parent= NULL);
  573. ~TimerDisplay();
  574. enum TimerMode
  575. {
  576. CountUp,
  577. CountDown,
  578. Clock
  579. };
  580. QString value();
  581. QTime seconds();
  582. TimerMode mode();
  583. bool isRunning();
  584. QTime resetValue();
  585. QString displayFormat();
  586. bool autoReset();
  587. public slots:
  588. void setTimer(QTime value= QTime(0,0,0));
  589. void setMode(TimerMode mode);
  590. void startTimer();
  591. void stopTimer();
  592. void copyTimer();
  593. void setResetValue(QTime value= QTime(0,0,0));
  594. void reset();
  595. void setDisplayFormat(QString format);
  596. void setAutoReset(bool reset);
  597. void updateDisplay();
  598. signals:
  599. void valueChanged(QTime);
  600. void runStateChanged(bool);
  601. private:
  602. /*386:*/
  603. #line 9790 "./typica.w"
  604. QTime s;
  605. QTime r;
  606. QTimer clock;
  607. TimerDisplay::TimerMode m;
  608. bool running;
  609. bool ar;
  610. QAction*startAction;
  611. QAction*stopAction;
  612. QAction*resetAction;
  613. QString f;
  614. QTime relative;
  615. QTime base;
  616. /*:386*/
  617. #line 9771 "./typica.w"
  618. };
  619. /*:384*//*406:*/
  620. #line 10149 "./typica.w"
  621. class PackLayout:public QLayout
  622. {
  623. int doLayout(const QRect&rect,bool testOnly)const;
  624. QList<QLayoutItem*> itemList;
  625. Qt::Orientations orientation;
  626. public:
  627. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  628. PackLayout(int spacing= -1);
  629. ~PackLayout();
  630. void addItem(QLayoutItem*item);
  631. Qt::Orientations expandingDirections()const;
  632. bool hasHeightForWidth()const;
  633. int heightForWidth(int width)const;
  634. int count()const;
  635. QLayoutItem*itemAt(int index)const;
  636. QSize minimumSize()const;
  637. void setGeometry(const QRect&rect);
  638. void setOrientation(Qt::Orientations direction);
  639. QSize sizeHint()const;
  640. QLayoutItem*takeAt(int index);
  641. };
  642. /*:406*//*419:*/
  643. #line 10427 "./typica.w"
  644. class SceneButton:public QGraphicsScene
  645. {
  646. Q_OBJECT
  647. public:
  648. SceneButton();
  649. ~SceneButton();
  650. protected:
  651. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  652. signals:
  653. void clicked(QPoint pos);
  654. };
  655. /*:419*//*421:*/
  656. #line 10469 "./typica.w"
  657. class WidgetDecorator:public QWidget
  658. {
  659. Q_OBJECT
  660. PackLayout*layout;
  661. QGraphicsView*label;
  662. QGraphicsTextItem*text;
  663. SceneButton*scene;
  664. public:
  665. WidgetDecorator(QWidget*widget,const QString&labeltext,
  666. Qt::Orientations orientation= Qt::Horizontal,
  667. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  668. ~WidgetDecorator();
  669. void setBackgroundBrush(QBrush background);
  670. void setTextColor(QColor color);
  671. };
  672. /*:421*//*432:*/
  673. #line 10644 "./typica.w"
  674. class LogEditWindow:public QMainWindow
  675. {
  676. Q_OBJECT
  677. QWidget*centralWidget;
  678. PackLayout*mainLayout;
  679. QHBoxLayout*addRowsLayout;
  680. QLabel*startTimeLabel;
  681. QTimeEdit*startTime;
  682. QLabel*endTimeLabel;
  683. QTimeEdit*endTime;
  684. QLabel*intervalLabel;
  685. QSpinBox*interval;
  686. QPushButton*addRows;
  687. QAction*saveXml;
  688. QAction*saveCsv;
  689. QAction*openXml;
  690. MeasurementModel*model;
  691. QTableView*log;
  692. private slots:
  693. void addTheRows();
  694. void saveXML();
  695. void saveCSV();
  696. void openXML();
  697. protected:
  698. void closeEvent(QCloseEvent*event);
  699. public:
  700. LogEditWindow();
  701. };
  702. /*:432*//*446:*/
  703. #line 10952 "./typica.w"
  704. class XMLOutput:public QObject
  705. {
  706. Q_OBJECT
  707. MeasurementModel*data;
  708. QIODevice*out;
  709. int time;
  710. QMap<int,QString> temperatureColumns;
  711. QMap<int,QString> annotationColumns;
  712. public:
  713. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  714. void addTemperatureColumn(const QString&series,int column);
  715. void addAnnotationColumn(const QString&series,int column);
  716. void setModel(MeasurementModel*model);
  717. void setTimeColumn(int column);
  718. void setDevice(QIODevice*device);
  719. bool output();
  720. };
  721. /*:446*//*453:*/
  722. #line 11148 "./typica.w"
  723. class XMLInput:public QObject
  724. {
  725. Q_OBJECT
  726. int firstc;
  727. QIODevice*in;
  728. public:
  729. XMLInput(QIODevice*input,int c);
  730. void setFirstColumn(int column);
  731. void setDevice(QIODevice*device);
  732. bool input();
  733. signals:
  734. void measure(Measurement,int);
  735. void annotation(QString,int,int);
  736. void newTemperatureColumn(int,QString);
  737. void newAnnotationColumn(int,QString);
  738. void lastColumn(int);
  739. };
  740. /*:453*//*464:*/
  741. #line 11389 "./typica.w"
  742. class CSVOutput
  743. {
  744. MeasurementModel*data;
  745. QIODevice*out;
  746. int time;
  747. QMap<int,QString> temperatureColumns;
  748. QMap<int,QString> annotationColumns;
  749. public:
  750. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  751. void addTemperatureColumn(const QString&series,int column);
  752. void addAnnotationColumn(const QString&series,int column);
  753. void setModel(MeasurementModel*model);
  754. void setTimeColumn(int column);
  755. void setDevice(QIODevice*device);
  756. bool output();
  757. };
  758. /*:464*//*478:*/
  759. #line 11648 "./typica.w"
  760. #define AppInstance (qobject_cast<Application *> (qApp))
  761. class NodeInserter;
  762. class DeviceTreeModel;
  763. class Application:public QApplication
  764. {
  765. Q_OBJECT
  766. public:
  767. Application(int&argc,char**argv);
  768. QDomDocument*configuration();
  769. /*592:*/
  770. #line 14035 "./typica.w"
  771. QDomDocument deviceConfiguration();
  772. /*:592*//*625:*/
  773. #line 14708 "./typica.w"
  774. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  775. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  776. const QModelIndex&index);
  777. /*:625*//*630:*/
  778. #line 14812 "./typica.w"
  779. QList<NodeInserter*> topLevelNodeInserters;
  780. /*:630*/
  781. #line 11659 "./typica.w"
  782. QSqlDatabase database();
  783. QScriptEngine*engine;
  784. public slots:
  785. /*593:*/
  786. #line 14042 "./typica.w"
  787. void saveDeviceConfiguration();
  788. /*:593*/
  789. #line 11663 "./typica.w"
  790. private:
  791. /*591:*/
  792. #line 14026 "./typica.w"
  793. QDomDocument deviceConfigurationDocument;
  794. /*:591*//*624:*/
  795. #line 14702 "./typica.w"
  796. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  797. /*:624*/
  798. #line 11665 "./typica.w"
  799. QDomDocument conf;
  800. };
  801. /*:478*//*486:*/
  802. #line 11789 "./typica.w"
  803. class SaltModel:public QAbstractItemModel
  804. {
  805. Q_OBJECT
  806. QList<QList<QMap<int,QVariant> > > modelData;
  807. QStringList hData;
  808. int colcount;
  809. public:
  810. SaltModel(int columns);
  811. ~SaltModel();
  812. int rowCount(const QModelIndex&parent= QModelIndex())const;
  813. int columnCount(const QModelIndex&parent= QModelIndex())const;
  814. bool setHeaderData(int section,Qt::Orientation orientation,
  815. const QVariant&value,int role= Qt::DisplayRole);
  816. QVariant data(const QModelIndex&index,int role)const;
  817. bool setData(const QModelIndex&index,const QVariant&value,
  818. int role= Qt::EditRole);
  819. Qt::ItemFlags flags(const QModelIndex&index)const;
  820. QVariant headerData(int section,Qt::Orientation orientation,
  821. int role= Qt::DisplayRole)const;
  822. QModelIndex index(int row,int column,
  823. const QModelIndex&parent= QModelIndex())const;
  824. QModelIndex parent(const QModelIndex&index)const;
  825. QString arrayLiteral(int column,int role)const;
  826. QString quotedArrayLiteral(int column,int role)const;
  827. };
  828. /*:486*//*499:*/
  829. #line 12102 "./typica.w"
  830. class SqlComboBox:public QComboBox
  831. {
  832. Q_OBJECT
  833. int dataColumn;
  834. int displayColumn;
  835. bool dataColumnShown;
  836. public:
  837. SqlComboBox();
  838. ~SqlComboBox();
  839. SqlComboBox*clone(QWidget*parent);
  840. public slots:
  841. void addNullOption();
  842. void addSqlOptions(QString query);
  843. void setDataColumn(int column);
  844. void setDisplayColumn(int column);
  845. void showData(bool show);
  846. };
  847. /*:499*//*506:*/
  848. #line 12224 "./typica.w"
  849. class SqlComboBoxDelegate:public QItemDelegate
  850. {
  851. Q_OBJECT
  852. SqlComboBox*delegate;
  853. public:
  854. SqlComboBoxDelegate(QObject*parent= NULL);
  855. QWidget*createEditor(QWidget*parent,
  856. const QStyleOptionViewItem&option,
  857. const QModelIndex&index)const;
  858. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  859. void setModelData(QWidget*editor,QAbstractItemModel*model,
  860. const QModelIndex&index)const;
  861. void setWidget(SqlComboBox*widget);
  862. virtual QSize sizeHint()const;
  863. void updateEditorGeometry(QWidget*editor,
  864. const QStyleOptionViewItem&option,
  865. const QModelIndex&index)const;
  866. };
  867. /*:506*//*517:*/
  868. #line 12383 "./typica.w"
  869. class SqlConnectionSetup:public QDialog
  870. {
  871. Q_OBJECT
  872. public:
  873. SqlConnectionSetup();
  874. ~SqlConnectionSetup();
  875. public slots:
  876. void testConnection();
  877. private:
  878. QFormLayout*formLayout;
  879. QComboBox*driver;
  880. QLineEdit*hostname;
  881. QLineEdit*dbname;
  882. QLineEdit*user;
  883. QLineEdit*password;
  884. QVBoxLayout*layout;
  885. QHBoxLayout*buttons;
  886. QPushButton*cancelButton;
  887. QPushButton*connectButton;
  888. };
  889. /*:517*//*522:*/
  890. #line 12511 "./typica.w"
  891. class SqlQueryView:public QTableView
  892. {
  893. Q_OBJECT
  894. public:
  895. SqlQueryView(QWidget*parent= NULL);
  896. void setQuery(const QString&query);
  897. bool setHeaderData(int section,Qt::Orientation orientation,
  898. const QVariant&value,int role);
  899. Q_INVOKABLE QVariant data(int row,int column,
  900. int role= Qt::DisplayRole);
  901. signals:
  902. void openEntry(QString key);
  903. void openEntryRow(int row);
  904. protected:
  905. virtual void showEvent(QShowEvent*event);
  906. private slots:
  907. void openRow(const QModelIndex&index);
  908. void persistColumnResize(int column,int oldsize,int newsize);
  909. };
  910. /*:522*//*537:*/
  911. #line 12759 "./typica.w"
  912. class ReportAction:public QAction
  913. {
  914. Q_OBJECT
  915. public:
  916. ReportAction(const QString&fileName,const QString&reportName,
  917. QObject*parent= NULL);
  918. private slots:
  919. void createReport();
  920. private:
  921. QString reportFile;
  922. };
  923. /*:537*//*549:*/
  924. #line 12968 "./typica.w"
  925. class ReportTable:public QObject
  926. {
  927. Q_OBJECT
  928. QTextFrame*area;
  929. QDomElement configuration;
  930. QMap<QString,QVariant> bindings;
  931. public:
  932. ReportTable(QTextFrame*frame,QDomElement description);
  933. ~ReportTable();
  934. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  935. public slots:
  936. void refresh();
  937. };
  938. /*:549*//*561:*/
  939. #line 13204 "./typica.w"
  940. class FormArray:public QScrollArea
  941. {
  942. Q_OBJECT
  943. QDomElement configuration;
  944. QWidget itemContainer;
  945. QVBoxLayout itemLayout;
  946. int maxwidth;
  947. int maxheight;
  948. public:
  949. FormArray(QDomElement description);
  950. Q_INVOKABLE QWidget*elementAt(int index);
  951. Q_INVOKABLE int elements();
  952. public slots:
  953. void addElements(int copies= 1);
  954. void removeAllElements();
  955. void setMaximumElementWidth(int width);
  956. void setMaximumElementHeight(int height);
  957. };
  958. /*:561*//*571:*/
  959. #line 13420 "./typica.w"
  960. class ScaleControl:public QGraphicsView
  961. {
  962. Q_OBJECT
  963. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  964. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  965. /*572:*/
  966. #line 13446 "./typica.w"
  967. QGraphicsScene scene;
  968. QGraphicsPolygonItem initialDecrement;
  969. QGraphicsPolygonItem initialIncrement;
  970. QGraphicsPolygonItem finalDecrement;
  971. QGraphicsPolygonItem finalIncrement;
  972. QGraphicsPolygonItem initialIndicator;
  973. QGraphicsPolygonItem finalIndicator;
  974. QGraphicsPathItem scaleLine;
  975. QPolygonF left;
  976. QPolygonF right;
  977. QPolygonF down;
  978. QPolygonF up;
  979. QPainterPath scalePath;
  980. QBrush initialBrush;
  981. QBrush finalBrush;
  982. double nonScoredValue;
  983. double scoredValue;
  984. bool initialSet;
  985. bool finalSet;
  986. bool scaleDown;
  987. /*:572*/
  988. #line 13426 "./typica.w"
  989. public:
  990. ScaleControl();
  991. double initialValue(void);
  992. double finalValue(void);
  993. virtual QSize sizeHint()const;
  994. public slots:
  995. void setInitialValue(double value);
  996. void setFinalValue(double value);
  997. signals:
  998. void initialChanged(double);
  999. void finalChanged(double);
  1000. protected:
  1001. virtual void mousePressEvent(QMouseEvent*event);
  1002. virtual void mouseReleaseEvent(QMouseEvent*event);
  1003. };
  1004. /*:571*//*583:*/
  1005. #line 13743 "./typica.w"
  1006. class IntensityControl:public QGraphicsView
  1007. {
  1008. Q_OBJECT
  1009. Q_PROPERTY(double value READ value WRITE setValue)
  1010. QGraphicsScene scene;
  1011. QGraphicsPolygonItem decrement;
  1012. QGraphicsPolygonItem increment;
  1013. QGraphicsPolygonItem indicator;
  1014. QGraphicsPathItem scaleLine;
  1015. QPolygonF left;
  1016. QPolygonF up;
  1017. QPolygonF down;
  1018. QPainterPath scalePath;
  1019. QBrush theBrush;
  1020. double theValue;
  1021. bool valueSet;
  1022. bool scaleDown;
  1023. public:
  1024. IntensityControl();
  1025. double value();
  1026. virtual QSize sizeHint()const;
  1027. public slots:
  1028. void setValue(double val);
  1029. signals:
  1030. void valueChanged(double);
  1031. protected:
  1032. virtual void mousePressEvent(QMouseEvent*event);
  1033. virtual void mouseReleaseEvent(QMouseEvent*event);
  1034. };
  1035. /*:583*//*599:*/
  1036. #line 14131 "./typica.w"
  1037. class DeviceTreeModelNode
  1038. {
  1039. public:
  1040. DeviceTreeModelNode(QDomNode&node,int row,
  1041. DeviceTreeModelNode*parent= NULL);
  1042. ~DeviceTreeModelNode();
  1043. DeviceTreeModelNode*child(int index);
  1044. DeviceTreeModelNode*parent();
  1045. QDomNode node()const;
  1046. int row();
  1047. private:
  1048. QDomNode domNode;
  1049. QHash<int,DeviceTreeModelNode*> children;
  1050. int rowNumber;
  1051. DeviceTreeModelNode*parentItem;
  1052. };
  1053. /*:599*//*601:*/
  1054. #line 14206 "./typica.w"
  1055. class DeviceTreeModel:public QAbstractItemModel
  1056. {
  1057. Q_OBJECT
  1058. public:
  1059. DeviceTreeModel(QObject*parent= NULL);
  1060. ~DeviceTreeModel();
  1061. QVariant data(const QModelIndex&index,int role)const;
  1062. Qt::ItemFlags flags(const QModelIndex&index)const;
  1063. QVariant headerData(int section,Qt::Orientation orientation,
  1064. int role= Qt::DisplayRole)const;
  1065. QModelIndex index(int row,int column,
  1066. const QModelIndex&parent= QModelIndex())const;
  1067. QModelIndex parent(const QModelIndex&child)const;
  1068. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1069. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1070. bool setData(const QModelIndex&index,const QVariant&value,
  1071. int role);
  1072. bool removeRows(int row,int count,const QModelIndex&parent);
  1073. QDomElement referenceElement(const QString&id);
  1074. public slots:
  1075. void newNode(const QString&name,const QString&driver,
  1076. const QModelIndex&parent);
  1077. private:
  1078. QDomDocument document;
  1079. DeviceTreeModelNode*root;
  1080. QDomNode referenceSection;
  1081. QDomNode treeRoot;
  1082. };
  1083. /*:601*//*620:*/
  1084. #line 14660 "./typica.w"
  1085. Q_DECLARE_METATYPE(QModelIndex)
  1086. /*:620*//*628:*/
  1087. #line 14767 "./typica.w"
  1088. class NodeInserter:public QAction
  1089. {
  1090. Q_OBJECT
  1091. public:
  1092. NodeInserter(const QString&title,const QString&name,
  1093. const QString&driver,QObject*parent= NULL);
  1094. signals:
  1095. void triggered(QString name,QString driver);
  1096. private slots:
  1097. void onTriggered();
  1098. private:
  1099. QString defaultNodeName;
  1100. QString driverString;
  1101. };
  1102. /*:628*//*631:*/
  1103. #line 14818 "./typica.w"
  1104. class DeviceConfigurationWindow:public QMainWindow
  1105. {
  1106. Q_OBJECT
  1107. public:
  1108. DeviceConfigurationWindow();
  1109. public slots:
  1110. void addDevice();
  1111. void removeNode();
  1112. void newSelection(const QModelIndex&index);
  1113. private:
  1114. QDomDocument document;
  1115. DeviceTreeModel*model;
  1116. QTreeView*view;
  1117. QScrollArea*configArea;
  1118. };
  1119. /*:631*//*639:*/
  1120. #line 14962 "./typica.w"
  1121. class BasicDeviceConfigurationWidget:public QWidget
  1122. {
  1123. Q_OBJECT
  1124. public:
  1125. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1126. const QModelIndex&index);
  1127. public slots:
  1128. void insertChildNode(const QString&name,const QString&driver);
  1129. void updateAttribute(const QString&name,const QString&value);
  1130. protected:
  1131. DeviceTreeModel*deviceModel;
  1132. QModelIndex currentNode;
  1133. };
  1134. /*:639*//*643:*/
  1135. #line 15047 "./typica.w"
  1136. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1137. {
  1138. Q_OBJECT
  1139. public:
  1140. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1141. const QModelIndex&index);
  1142. private slots:
  1143. void updateRoasterId(int id);
  1144. };
  1145. /*:643*//*648:*/
  1146. #line 15174 "./typica.w"
  1147. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1148. {
  1149. Q_OBJECT
  1150. public:
  1151. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1152. const QModelIndex&index);
  1153. };
  1154. /*:648*//*650:*/
  1155. #line 15220 "./typica.w"
  1156. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1157. {
  1158. Q_OBJECT
  1159. public:
  1160. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1161. const QModelIndex&index);
  1162. private slots:
  1163. void addChannel();
  1164. void updateDeviceId(const QString&newId);
  1165. };
  1166. /*:650*//*654:*/
  1167. #line 15306 "./typica.w"
  1168. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1169. {
  1170. Q_OBJECT
  1171. public:
  1172. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1173. const QModelIndex&index);
  1174. private slots:
  1175. void updateThermocoupleType(const QString&type);
  1176. void updateColumnName(const QString&name);
  1177. };
  1178. /*:654*//*659:*/
  1179. #line 15408 "./typica.w"
  1180. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1181. {
  1182. Q_OBJECT
  1183. public:
  1184. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1185. const QModelIndex&index);
  1186. };
  1187. /*:659*//*661:*/
  1188. #line 15449 "./typica.w"
  1189. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1190. {
  1191. Q_OBJECT
  1192. public:
  1193. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1194. const QModelIndex&index);
  1195. private slots:
  1196. void addChannel();
  1197. void updateDeviceId(const QString&newId);
  1198. };
  1199. /*:661*//*663:*/
  1200. #line 15518 "./typica.w"
  1201. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1202. {
  1203. Q_OBJECT
  1204. public:
  1205. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1206. const QModelIndex&index);
  1207. private slots:
  1208. void updateDeviceId(const QString&newId);
  1209. void updateThermocoupleType(const QString&type);
  1210. void updateColumnName(const QString&name);
  1211. };
  1212. /*:663*//*668:*/
  1213. #line 15635 "./typica.w"
  1214. class PortSelector:public QComboBox
  1215. {
  1216. Q_OBJECT
  1217. public:
  1218. PortSelector(QWidget*parent= NULL);
  1219. private slots:
  1220. void addDevice(QextPortInfo port);
  1221. private:
  1222. QextSerialEnumerator*lister;
  1223. };
  1224. /*:668*//*670:*/
  1225. #line 15679 "./typica.w"
  1226. class BaudSelector:public QComboBox
  1227. {
  1228. Q_OBJECT
  1229. Q_ENUMS(BaudRateType)
  1230. public:
  1231. BaudSelector(QWidget*parent= NULL);
  1232. enum BaudRateType
  1233. {
  1234. #if defined(Q_OS_UNIX) || defined(qdoc)
  1235. BAUD50= 50,
  1236. BAUD75= 75,
  1237. BAUD134= 134,
  1238. BAUD150= 150,
  1239. BAUD200= 200,
  1240. BAUD1800= 1800,
  1241. #if defined(B76800) || defined(qdoc)
  1242. BAUD76800= 76800,
  1243. #endif
  1244. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1245. BAUD230400= 230400,
  1246. BAUD460800= 460800,
  1247. BAUD500000= 500000,
  1248. BAUD576000= 576000,
  1249. BAUD921600= 921600,
  1250. BAUD1000000= 1000000,
  1251. BAUD1152000= 1152000,
  1252. BAUD1500000= 1500000,
  1253. BAUD2000000= 2000000,
  1254. BAUD2500000= 2500000,
  1255. BAUD3000000= 3000000,
  1256. BAUD3500000= 3500000,
  1257. BAUD4000000= 4000000,
  1258. #endif
  1259. #endif
  1260. #if defined(Q_OS_WIN) || defined(qdoc)
  1261. BAUD14400= 14400,
  1262. BAUD56000= 56000,
  1263. BAUD128000= 128000,
  1264. BAUD256000= 256000,
  1265. #endif
  1266. BAUD110= 110,
  1267. BAUD300= 300,
  1268. BAUD600= 600,
  1269. BAUD1200= 1200,
  1270. BAUD2400= 2400,
  1271. BAUD4800= 4800,
  1272. BAUD9600= 9600,
  1273. BAUD19200= 19200,
  1274. BAUD38400= 38400,
  1275. BAUD57600= 57600,
  1276. BAUD115200= 115200
  1277. };
  1278. };
  1279. /*:670*//*672:*/
  1280. #line 15750 "./typica.w"
  1281. class ParitySelector:public QComboBox
  1282. {
  1283. Q_OBJECT
  1284. Q_ENUMS(ParityType)
  1285. public:
  1286. ParitySelector(QWidget*parent= NULL);
  1287. enum ParityType
  1288. {
  1289. PAR_NONE,
  1290. PAR_ODD,
  1291. PAR_EVEN,
  1292. #if defined(Q_OS_WIN) || defined(qdoc)
  1293. PAR_MARK,
  1294. #endif
  1295. PAR_SPACE
  1296. };
  1297. };
  1298. /*:672*//*674:*/
  1299. #line 15788 "./typica.w"
  1300. class FlowSelector:public QComboBox
  1301. {
  1302. Q_OBJECT
  1303. Q_ENUMS(FlowType)
  1304. public:
  1305. FlowSelector(QWidget*parent= NULL);
  1306. enum FlowType
  1307. {
  1308. FLOW_OFF,
  1309. FLOW_HARDWARE,
  1310. FLOW_XONXOFF
  1311. };
  1312. };
  1313. /*:674*//*676:*/
  1314. #line 15821 "./typica.w"
  1315. class StopSelector:public QComboBox
  1316. {
  1317. Q_OBJECT
  1318. Q_ENUMS(StopBitsType)
  1319. public:
  1320. StopSelector(QWidget*parent= NULL);
  1321. enum StopBitsType
  1322. {
  1323. STOP_1,
  1324. #if defined(Q_OS_WIN) || defined(qdoc)
  1325. STOP_1_5,
  1326. #endif
  1327. STOP_2
  1328. };
  1329. };
  1330. /*:676*//*679:*/
  1331. #line 15874 "./typica.w"
  1332. class ShortHexSpinBox:public QSpinBox
  1333. {
  1334. Q_OBJECT
  1335. public:
  1336. ShortHexSpinBox(QWidget*parent= NULL);
  1337. virtual QValidator::State validate(QString&input,int&pos)const;
  1338. protected:
  1339. virtual int valueFromText(const QString&text)const;
  1340. virtual QString textFromValue(int value)const;
  1341. };
  1342. /*:679*//*681:*/
  1343. #line 15936 "./typica.w"
  1344. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1345. {
  1346. Q_OBJECT
  1347. public:
  1348. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1349. const QModelIndex&index);
  1350. private slots:
  1351. void updatePort(const QString&newPort);
  1352. void updateBaudRate(const QString&newRate);
  1353. void updateParity(const QString&newParity);
  1354. void updateFlowControl(const QString&newFlow);
  1355. void updateStopBits(const QString&newStopBits);
  1356. };
  1357. /*:681*//*683:*/
  1358. #line 16087 "./typica.w"
  1359. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1360. {
  1361. Q_OBJECT
  1362. public:
  1363. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1364. const QModelIndex&index);
  1365. private slots:
  1366. void updateStationNumber(int newStation);
  1367. void updateFixedUnit(bool newFixed);
  1368. void updateFixedDecimal(bool newFixed);
  1369. void updateUnit(const QString&newUnit);
  1370. void updateUnitAddress(int newAddress);
  1371. void updateValueF(int newValue);
  1372. void updateValueC(int newValue);
  1373. void updatePrecisionAddress(int newAddress);
  1374. void updatePrecisionValue(int newValue);
  1375. private:
  1376. QStackedLayout*unitSpecificationLayout;
  1377. QStackedLayout*decimalSpecificationLayout;
  1378. };
  1379. /*:683*//*685:*/
  1380. #line 16346 "./typica.w"
  1381. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1382. {
  1383. Q_OBJECT
  1384. public:
  1385. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1386. const QModelIndex&index);
  1387. private slots:
  1388. void updateAddress(int newAddress);
  1389. };
  1390. /*:685*//*687:*/
  1391. #line 16392 "./typica.w"
  1392. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1393. {
  1394. Q_OBJECT
  1395. public:
  1396. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1397. const QModelIndex&index);
  1398. private slots:
  1399. void updateReadAddress(int newAddress);
  1400. void updateWriteAddress(int newAddress);
  1401. void updateFixedRange(bool fixed);
  1402. void updateLower(const QString&lower);
  1403. void updateUpper(const QString&upper);
  1404. void updateLowerAddress(int newAddress);
  1405. void updateUpperAddress(int newAddress);
  1406. private:
  1407. QStackedLayout*boundsLayout;
  1408. };
  1409. /*:687*//*691:*/
  1410. #line 16586 "./typica.w"
  1411. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1412. {
  1413. Q_OBJECT
  1414. public:
  1415. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1416. private slots:
  1417. void updateButtonText(const QString&text);
  1418. void updateAnnotationText(const QString&text);
  1419. };
  1420. /*:691*//*695:*/
  1421. #line 16654 "./typica.w"
  1422. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1423. {
  1424. Q_OBJECT
  1425. public:
  1426. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1427. private slots:
  1428. void updateButtonText(const QString&text);
  1429. void updateAnnotationText(const QString&text);
  1430. };
  1431. /*:695*//*698:*/
  1432. #line 16728 "./typica.w"
  1433. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1434. {
  1435. Q_OBJECT
  1436. public:
  1437. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1438. private slots:
  1439. void updateLabel(const QString&text);
  1440. void updateMinimum(const QString&minimum);
  1441. void updateMaximum(const QString&maximum);
  1442. void updatePrecision(int precision);
  1443. void updatePretext(const QString&text);
  1444. void updatePosttext(const QString&text);
  1445. };
  1446. /*:698*//*701:*/
  1447. #line 16849 "./typica.w"
  1448. class ModbusRTUDevice:public QObject
  1449. {
  1450. Q_OBJECT
  1451. public:
  1452. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1453. ~ModbusRTUDevice();
  1454. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1455. Q_INVOKABLE double SVLower();
  1456. Q_INVOKABLE double SVUpper();
  1457. Q_INVOKABLE int decimals();
  1458. QList<Channel*> channels;
  1459. public slots:
  1460. void outputSV(double sv);
  1461. signals:
  1462. void SVLowerChanged(double);
  1463. void SVUpperChanged(double);
  1464. void SVDecimalChanged(int);
  1465. void queueEmpty();
  1466. private slots:
  1467. void dataAvailable();
  1468. void sendNextMessage();
  1469. void decimalResponse(QByteArray response);
  1470. void unitResponse(QByteArray response);
  1471. void svlResponse(QByteArray response);
  1472. void svuResponse(QByteArray response);
  1473. void requestMeasurement();
  1474. void mResponse(QByteArray response);
  1475. void ignore(QByteArray response);
  1476. private:
  1477. QextSerialPort*port;
  1478. QByteArray responseBuffer;
  1479. QList<QByteArray> messageQueue;
  1480. QList<QObject*> retObjQueue;
  1481. QList<char*> callbackQueue;
  1482. quint16 calculateCRC(QByteArray data);
  1483. QTimer*messageDelayTimer;
  1484. int delayTime;
  1485. char station;
  1486. int decimalPosition;
  1487. int valueF;
  1488. int valueC;
  1489. bool unitIsF;
  1490. double outputSVLower;
  1491. double outputSVUpper;
  1492. QByteArray outputSVStub;
  1493. QByteArray pvStub;
  1494. QByteArray svStub;
  1495. QByteArray mStub;
  1496. quint16 pvaddress;
  1497. quint16 svaddress;
  1498. bool svenabled;
  1499. bool readingsv;
  1500. double savedpv;
  1501. bool waiting;
  1502. };
  1503. /*:701*//*716:*/
  1504. #line 17521 "./typica.w"
  1505. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1506. {
  1507. Q_OBJECT
  1508. public:
  1509. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1510. private slots:
  1511. void updatePort(const QString&newPort);
  1512. void updateBaudRate(const QString&newRate);
  1513. void updateParity(const QString&newParity);
  1514. void updateFlowControl(const QString&newFlow);
  1515. void updateStopBits(const QString&newStopBits);
  1516. void updateStation(int station);
  1517. void updateFixedDecimal(bool fixed);
  1518. void updateDecimalAddress(int address);
  1519. void updateDecimalPosition(int position);
  1520. void updateFixedUnit(bool fixed);
  1521. void updateUnitAddress(int address);
  1522. void updateValueForF(int value);
  1523. void updateValueForC(int value);
  1524. void updateUnit(const QString&newUnit);
  1525. void updatePVAddress(int address);
  1526. void updateSVEnabled(bool enabled);
  1527. void updateSVReadAddress(int address);
  1528. void updateDeviceLimit(bool query);
  1529. void updateSVLowerAddress(int address);
  1530. void updateSVUpperAddress(int address);
  1531. void updateSVLower(double value);
  1532. void updateSVUpper(double value);
  1533. void updateSVWritable(bool canWriteSV);
  1534. void updateSVWriteAddress(int address);
  1535. void updatePVColumnName(const QString&name);
  1536. void updateSVColumnName(const QString&name);
  1537. private:
  1538. PortSelector*port;
  1539. BaudSelector*baud;
  1540. ParitySelector*parity;
  1541. FlowSelector*flow;
  1542. StopSelector*stop;
  1543. QSpinBox*station;
  1544. QCheckBox*decimalQuery;
  1545. ShortHexSpinBox*decimalAddress;
  1546. QSpinBox*decimalPosition;
  1547. QCheckBox*unitQuery;
  1548. ShortHexSpinBox*unitAddress;
  1549. QSpinBox*valueF;
  1550. QSpinBox*valueC;
  1551. QComboBox*fixedUnit;
  1552. ShortHexSpinBox*pVAddress;
  1553. QCheckBox*sVEnabled;
  1554. ShortHexSpinBox*sVReadAddress;
  1555. QCheckBox*deviceLimit;
  1556. ShortHexSpinBox*sVLowerAddr;
  1557. ShortHexSpinBox*sVUpperAddr;
  1558. QDoubleSpinBox*sVLower;
  1559. QDoubleSpinBox*sVUpper;
  1560. QCheckBox*sVWritable;
  1561. ShortHexSpinBox*sVOutputAddr;
  1562. QLineEdit*pVColumnName;
  1563. QLineEdit*sVColumnName;
  1564. };
  1565. /*:716*//*720:*/
  1566. #line 18027 "./typica.w"
  1567. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1568. {
  1569. Q_OBJECT
  1570. public:
  1571. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1572. const QModelIndex&index);
  1573. private slots:
  1574. void updateSourceColumn(const QString&source);
  1575. void updateDestinationColumn(const QString&dest);
  1576. void updateKnots();
  1577. private:
  1578. SaltModel*knotmodel;
  1579. };
  1580. /*:720*//*726:*/
  1581. #line 18151 "./typica.w"
  1582. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1583. {
  1584. Q_OBJECT
  1585. public:
  1586. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1587. private slots:
  1588. void updateMatchingColumn(const QString&column);
  1589. void updateTemperature();
  1590. private:
  1591. QDoubleSpinBox*temperatureValue;
  1592. QComboBox*unitSelector;
  1593. };
  1594. /*:726*/
  1595. #line 761 "./typica.w"
  1596. /*24:*/
  1597. #line 1003 "./typica.w"
  1598. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1599. /*:24*//*26:*/
  1600. #line 1018 "./typica.w"
  1601. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1602. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1603. /*:26*//*28:*/
  1604. #line 1043 "./typica.w"
  1605. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1606. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1607. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1608. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1609. QScriptEngine*engine);
  1610. /*:28*//*36:*/
  1611. #line 1241 "./typica.w"
  1612. QScriptValue constructQMainWindow(QScriptContext*context,
  1613. QScriptEngine*engine);
  1614. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1615. QScriptEngine*engine);
  1616. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1617. QScriptEngine*engine);
  1618. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1619. /*:36*//*41:*/
  1620. #line 1340 "./typica.w"
  1621. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1622. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1623. /*:41*//*44:*/
  1624. #line 1385 "./typica.w"
  1625. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1626. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1627. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1628. /*:44*//*47:*/
  1629. #line 1451 "./typica.w"
  1630. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1631. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1632. /*:47*//*50:*/
  1633. #line 1484 "./typica.w"
  1634. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1635. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1636. /*:50*//*53:*/
  1637. #line 1525 "./typica.w"
  1638. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1639. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1640. QScriptEngine*engine);
  1641. QScriptValue QSplitter_saveState(QScriptContext*context,
  1642. QScriptEngine*engine);
  1643. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1644. QScriptEngine*engine);
  1645. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1646. /*:53*//*58:*/
  1647. #line 1644 "./typica.w"
  1648. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1649. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1650. /*:58*//*60:*/
  1651. #line 1699 "./typica.w"
  1652. QScriptValue constructQBoxLayout(QScriptContext*context,
  1653. QScriptEngine*engine);
  1654. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1655. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1656. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1657. /*:60*//*64:*/
  1658. #line 1812 "./typica.w"
  1659. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1660. QScriptValue QAction_setShortcut(QScriptContext*context,
  1661. QScriptEngine*engine);
  1662. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1663. /*:64*//*67:*/
  1664. #line 1868 "./typica.w"
  1665. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  1666. QScriptEngine*engine);
  1667. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  1668. QScriptEngine*engine);
  1669. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  1670. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  1671. /*:67*//*72:*/
  1672. #line 1979 "./typica.w"
  1673. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  1674. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  1675. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  1676. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  1677. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  1678. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  1679. QScriptValue QIODevice_readToString(QScriptContext*context,
  1680. QScriptEngine*engine);
  1681. /*:72*//*79:*/
  1682. #line 2101 "./typica.w"
  1683. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  1684. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  1685. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  1686. /*:79*//*82:*/
  1687. #line 2146 "./typica.w"
  1688. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  1689. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1690. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  1691. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  1692. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  1693. /*:82*//*88:*/
  1694. #line 2219 "./typica.w"
  1695. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  1696. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  1697. QScriptEngine*engine);
  1698. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  1699. QScriptEngine*engine);
  1700. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  1701. QScriptEngine*engine);
  1702. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  1703. QScriptEngine*engine);
  1704. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  1705. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  1706. QScriptEngine*engine);
  1707. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  1708. QScriptEngine*engine);
  1709. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  1710. QScriptEngine*engine);
  1711. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  1712. QScriptEngine*engine);
  1713. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  1714. QScriptEngine*engine);
  1715. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  1716. QScriptEngine*engine);
  1717. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  1718. QScriptEngine*engine);
  1719. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  1720. QScriptEngine*engine);
  1721. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  1722. /*:88*//*97:*/
  1723. #line 2437 "./typica.w"
  1724. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  1725. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  1726. QScriptValue XmlReader_attribute(QScriptContext*context,
  1727. QScriptEngine*engine);
  1728. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  1729. QScriptEngine*engine);
  1730. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  1731. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  1732. QScriptEngine*engine);
  1733. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  1734. QScriptValue XmlReader_readElementText(QScriptContext*context,
  1735. QScriptEngine*engine);
  1736. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  1737. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  1738. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  1739. /*:97*//*104:*/
  1740. #line 2572 "./typica.w"
  1741. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  1742. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  1743. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  1744. /*:104*//*108:*/
  1745. #line 2654 "./typica.w"
  1746. QScriptValue constructQLCDNumber(QScriptContext*context,
  1747. QScriptEngine*engine);
  1748. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  1749. /*:108*//*111:*/
  1750. #line 2692 "./typica.w"
  1751. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  1752. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  1753. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  1754. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  1755. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  1756. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  1757. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  1758. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  1759. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  1760. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  1761. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  1762. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  1763. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  1764. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  1765. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  1766. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  1767. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  1768. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  1769. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  1770. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  1771. /*:111*//*126:*/
  1772. #line 3161 "./typica.w"
  1773. void setQAbstractScrollAreaProperties(QScriptValue value,
  1774. QScriptEngine*engine);
  1775. /*:126*//*128:*/
  1776. #line 3176 "./typica.w"
  1777. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  1778. /*:128*//*130:*/
  1779. #line 3189 "./typica.w"
  1780. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  1781. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  1782. /*:130*//*132:*/
  1783. #line 3213 "./typica.w"
  1784. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  1785. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  1786. QScriptValue constructQPushButton(QScriptContext*context,
  1787. QScriptEngine*engine);
  1788. /*:132*//*139:*/
  1789. #line 3312 "./typica.w"
  1790. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  1791. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  1792. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1793. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  1794. QScriptEngine*engine);
  1795. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  1796. QScriptEngine*engine);
  1797. QScriptValue QSqlQuery_exec(QScriptContext*context,
  1798. QScriptEngine*engine);
  1799. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  1800. QScriptEngine*engine);
  1801. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  1802. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  1803. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  1804. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  1805. /*:139*//*146:*/
  1806. #line 3482 "./typica.w"
  1807. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  1808. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  1809. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  1810. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  1811. QScriptValue annotationFromRecord(QScriptContext*context,
  1812. QScriptEngine*engine);
  1813. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  1814. /*:146*//*157:*/
  1815. #line 3765 "./typica.w"
  1816. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  1817. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1818. QStack<QLayout*> *layoutStack);
  1819. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1820. QStack<QLayout*> *layoutStack);
  1821. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1822. QStack<QLayout*> *layoutStack);
  1823. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1824. QStack<QLayout*> *layoutStack);
  1825. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1826. QStack<QLayout*> *layoutStack);
  1827. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1828. QStack<QLayout*> *layoutStack);
  1829. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1830. QStack<QLayout*> *layoutStack);
  1831. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1832. QStack<QLayout*> *layoutStack);
  1833. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1834. QStack<QLayout*> *layoutStack);
  1835. void addTemperatureDisplayToSplitter(QDomElement element,
  1836. QStack<QWidget*> *widgetStack,
  1837. QStack<QLayout*> *layoutStack);
  1838. void addTemperatureDisplayToLayout(QDomElement element,
  1839. QStack<QWidget*> *widgetStack,
  1840. QStack<QLayout*> *layoutStack);
  1841. void addTimerDisplayToSplitter(QDomElement element,
  1842. QStack<QWidget*> *widgetStack,
  1843. QStack<QLayout*> *layoutStack);
  1844. void addTimerDisplayToLayout(QDomElement element,
  1845. QStack<QWidget*> *widgetStack,
  1846. QStack<QLayout*> *layoutStack);
  1847. void addDecorationToSplitter(QDomElement element,
  1848. QStack<QWidget*> *widgetStack,
  1849. QStack<QLayout*> *layoutStack);
  1850. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1851. QStack<QLayout*> *layoutStack);
  1852. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1853. QStack<QLayout*> *layoutStack);
  1854. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1855. QStack<QLayout*> *layoutStack);
  1856. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1857. QStack<QLayout*> *layoutStack);
  1858. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1859. QStack<QLayout*> *layoutStack);
  1860. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1861. QStack<QLayout*> *layoutStack);
  1862. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1863. QStack<QLayout*> *layoutStack);
  1864. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1865. QStack<QLayout*> *layoutStack);
  1866. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1867. QStack<QLayout*> *layoutStack);
  1868. void addSqlQueryViewToLayout(QDomElement element,
  1869. QStack<QWidget*> *widgetStack,
  1870. QStack<QLayout*> *layoutStack);
  1871. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1872. QStack<QLayout*> *layoutStack);
  1873. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1874. QStack<QLayout*> *layoutStack);
  1875. /*:157*//*203:*/
  1876. #line 5285 "./typica.w"
  1877. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  1878. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  1879. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  1880. QScriptEngine*engine);
  1881. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  1882. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  1883. QScriptEngine*engine);
  1884. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  1885. /*:203*//*204:*/
  1886. #line 5300 "./typica.w"
  1887. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  1888. /*:204*//*208:*/
  1889. #line 5427 "./typica.w"
  1890. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  1891. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  1892. QScriptEngine*engine);
  1893. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  1894. QScriptEngine*engine);
  1895. QScriptValue SaltTable_columnSum(QScriptContext*context,
  1896. QScriptEngine*engine);
  1897. QScriptValue SaltTable_columnArray(QScriptContext*context,
  1898. QScriptEngine*engine);
  1899. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  1900. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  1901. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  1902. QScriptEngine*engine);
  1903. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  1904. /*:208*//*215:*/
  1905. #line 5597 "./typica.w"
  1906. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1907. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1908. QScriptValue QComboBox_currentData(QScriptContext*context,
  1909. QScriptEngine*engine);
  1910. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  1911. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  1912. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  1913. /*:215*//*243:*/
  1914. #line 6473 "./typica.w"
  1915. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  1916. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1917. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  1918. /*:243*//*252:*/
  1919. #line 6671 "./typica.w"
  1920. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  1921. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1922. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  1923. /*:252*//*257:*/
  1924. #line 6772 "./typica.w"
  1925. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  1926. /*:257*//*263:*/
  1927. #line 6948 "./typica.w"
  1928. QScriptValue constructLinearCalibrator(QScriptContext*context,
  1929. QScriptEngine*engine);
  1930. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  1931. /*:263*//*268:*/
  1932. #line 7087 "./typica.w"
  1933. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  1934. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  1935. /*:268*//*277:*/
  1936. #line 7269 "./typica.w"
  1937. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  1938. QScriptEngine*engine);
  1939. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1940. /*:277*//*284:*/
  1941. #line 7406 "./typica.w"
  1942. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  1943. QScriptEngine*engine);
  1944. void setMeasurementTimeOffsetProperties(QScriptValue value,
  1945. QScriptEngine*engine);
  1946. /*:284*//*289:*/
  1947. #line 7519 "./typica.w"
  1948. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  1949. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  1950. /*:289*//*294:*/
  1951. #line 7616 "./typica.w"
  1952. QScriptValue constructZeroEmitter(QScriptContext*context,
  1953. QScriptEngine*engine);
  1954. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  1955. /*:294*//*299:*/
  1956. #line 7695 "./typica.w"
  1957. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  1958. QScriptEngine*engine);
  1959. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  1960. /*:299*//*314:*/
  1961. #line 8045 "./typica.w"
  1962. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  1963. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  1964. /*:314*//*336:*/
  1965. #line 8608 "./typica.w"
  1966. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  1967. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  1968. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  1969. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  1970. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  1971. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  1972. QScriptEngine*engine);
  1973. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  1974. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  1975. QScriptEngine*engnie);
  1976. /*:336*//*373:*/
  1977. #line 9533 "./typica.w"
  1978. QScriptValue constructAnnotationButton(QScriptContext*context,
  1979. QScriptEngine*engine);
  1980. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  1981. /*:373*//*381:*/
  1982. #line 9673 "./typica.w"
  1983. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  1984. QScriptEngine*engine);
  1985. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1986. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1987. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1988. /*:381*//*402:*/
  1989. #line 10096 "./typica.w"
  1990. QScriptValue constructTimerDisplay(QScriptContext*context,
  1991. QScriptEngine*engine);
  1992. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1993. /*:402*//*429:*/
  1994. #line 10590 "./typica.w"
  1995. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  1996. QScriptValue constructWidgetDecorator(QScriptContext*context,
  1997. QScriptEngine*engine);
  1998. /*:429*//*442:*/
  1999. #line 10873 "./typica.w"
  2000. QScriptValue constructLogEditWindow(QScriptContext*context,
  2001. QScriptEngine*engine);
  2002. /*:442*//*461:*/
  2003. #line 11347 "./typica.w"
  2004. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2005. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2006. /*:461*//*477:*/
  2007. #line 11630 "./typica.w"
  2008. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2009. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*engine);
  2010. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*engine);
  2011. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*engine);
  2012. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*engine);
  2013. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*);
  2014. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2015. QStack<QLayout*> *layoutStack);
  2016. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2017. /*:477*//*532:*/
  2018. #line 12646 "./typica.w"
  2019. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2020. QScriptValue constructSqlQueryView(QScriptContext*context,
  2021. QScriptEngine*engine);
  2022. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2023. QScriptEngine*engine);
  2024. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2025. QScriptEngine*engine);
  2026. /*:532*//*542:*/
  2027. #line 12875 "./typica.w"
  2028. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2029. QStack<QLayout*> *layoutStack);
  2030. /*:542*//*558:*/
  2031. #line 13159 "./typica.w"
  2032. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2033. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2034. /*:558*//*568:*/
  2035. #line 13354 "./typica.w"
  2036. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2037. QStack<QLayout*> *layoutStack);
  2038. /*:568*//*589:*/
  2039. #line 13938 "./typica.w"
  2040. void addScaleControlToLayout(QDomElement element,
  2041. QStack<QWidget*> *widgetStack,
  2042. QStack<QLayout*> *layoutStack);
  2043. void addIntensityControlToLayout(QDomElement element,
  2044. QStack<QWidget*> *widgetStack,
  2045. QStack<QLayout*> *layoutStack);
  2046. /*:589*//*615:*/
  2047. #line 14524 "./typica.w"
  2048. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2049. QScriptEngine*engine);
  2050. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2051. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2052. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2053. QScriptEngine*engine);
  2054. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2055. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2056. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2057. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2058. /*:615*//*621:*/
  2059. #line 14666 "./typica.w"
  2060. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2061. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2062. /*:621*//*636:*/
  2063. #line 14934 "./typica.w"
  2064. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2065. QScriptEngine*engine);
  2066. /*:636*//*711:*/
  2067. #line 17428 "./typica.w"
  2068. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2069. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2070. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2071. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2072. /*:711*/
  2073. #line 762 "./typica.w"
  2074. /*17:*/
  2075. #line 770 "./typica.w"
  2076. /*629:*/
  2077. #line 14787 "./typica.w"
  2078. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2079. const QString&driver,QObject*parent):
  2080. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2081. {
  2082. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2083. }
  2084. void NodeInserter::onTriggered()
  2085. {
  2086. emit triggered(defaultNodeName,driverString);
  2087. }
  2088. /*:629*/
  2089. #line 771 "./typica.w"
  2090. /*218:*/
  2091. #line 5710 "./typica.w"
  2092. Measurement::Measurement(double temperature,QTime time,
  2093. TemperatureUnits sc):
  2094. theTemperature(temperature),theTime(time),unit(sc)
  2095. {
  2096. }
  2097. Measurement::Measurement(double temperature):
  2098. theTemperature(temperature),theTime(QTime::currentTime()),
  2099. unit(Fahrenheit)
  2100. {
  2101. }
  2102. /*:218*//*220:*/
  2103. #line 5738 "./typica.w"
  2104. Measurement::Measurement(const Measurement&x):
  2105. theTemperature(x.temperature()),theTime(x.time()),
  2106. unit(x.unit)
  2107. {
  2108. }
  2109. Measurement::~Measurement()
  2110. {
  2111. }
  2112. /*:220*//*221:*/
  2113. #line 5754 "./typica.w"
  2114. Measurement&Measurement::operator= (Measurement&x)
  2115. {
  2116. theTemperature= x.temperature();
  2117. theTime= x.time();
  2118. unit= x.unit;
  2119. return*this;
  2120. }
  2121. /*:221*//*222:*/
  2122. #line 5768 "./typica.w"
  2123. double Measurement::temperature()const
  2124. {
  2125. return theTemperature;
  2126. }
  2127. QTime Measurement::time()const
  2128. {
  2129. return theTime;
  2130. }
  2131. void Measurement::setTemperature(double temperature)
  2132. {
  2133. theTemperature= temperature;
  2134. }
  2135. void Measurement::setTime(QTime time)
  2136. {
  2137. theTime= time;
  2138. }
  2139. /*:222*//*223:*/
  2140. #line 5794 "./typica.w"
  2141. void Measurement::setUnit(TemperatureUnits scale)
  2142. {
  2143. unit= scale;
  2144. }
  2145. Measurement::TemperatureUnits Measurement::scale()
  2146. {
  2147. return unit;
  2148. }
  2149. /*:223*//*224:*/
  2150. #line 5814 "./typica.w"
  2151. Measurement Measurement::toFahrenheit()
  2152. {
  2153. switch(unit)
  2154. {
  2155. case Celsius:
  2156. return Measurement(this->temperature()*9/5+32,this->time(),
  2157. Fahrenheit);
  2158. break;
  2159. case Kelvin:
  2160. return Measurement(this->temperature()*5/9-459.67,
  2161. this->time(),Fahrenheit);
  2162. break;
  2163. case Rankine:
  2164. return Measurement(this->temperature()-459.67,this->time(),
  2165. Fahrenheit);
  2166. break;
  2167. default:
  2168. return Measurement(this->temperature(),this->time(),Fahrenheit);
  2169. break;
  2170. }
  2171. }
  2172. /*:224*//*225:*/
  2173. #line 5839 "./typica.w"
  2174. Measurement Measurement::toCelsius()
  2175. {
  2176. switch(unit)
  2177. {
  2178. case Fahrenheit:
  2179. return Measurement((this->temperature()-32)*5/9,this->time(),
  2180. Celsius);
  2181. break;
  2182. case Kelvin:
  2183. return Measurement(this->temperature()-273.15,this->time(),
  2184. Celsius);
  2185. break;
  2186. case Rankine:
  2187. return Measurement((this->temperature()-491.67)*5/9,
  2188. this->time(),Celsius);
  2189. break;
  2190. default:
  2191. return Measurement(this->temperature(),this->time(),Celsius);
  2192. break;
  2193. }
  2194. }
  2195. /*:225*//*226:*/
  2196. #line 5865 "./typica.w"
  2197. Measurement Measurement::toKelvin()
  2198. {
  2199. switch(unit)
  2200. {
  2201. case Fahrenheit:
  2202. return Measurement((this->temperature()+459.67)*5/9,
  2203. this->time(),Kelvin);
  2204. break;
  2205. case Celsius:
  2206. return Measurement(this->temperature()+273.15,this->time(),
  2207. Kelvin);
  2208. break;
  2209. case Rankine:
  2210. return Measurement(this->temperature()*5/9,this->time(),
  2211. Kelvin);
  2212. break;
  2213. default:
  2214. return Measurement(this->temperature(),this->time(),Kelvin);
  2215. break;
  2216. }
  2217. }
  2218. /*:226*//*227:*/
  2219. #line 5890 "./typica.w"
  2220. Measurement Measurement::toRankine()
  2221. {
  2222. switch(unit)
  2223. {
  2224. case Fahrenheit:
  2225. return Measurement(this->temperature()+459.67,this->time(),
  2226. Rankine);
  2227. break;
  2228. case Celsius:
  2229. return Measurement((this->temperature()+273.15)*9/5,
  2230. this->time(),Rankine);
  2231. break;
  2232. case Kelvin:
  2233. return Measurement(this->temperature()*9/5,this->time(),
  2234. Rankine);
  2235. break;
  2236. default:
  2237. return Measurement(this->temperature(),this->time(),Rankine);
  2238. break;
  2239. }
  2240. }
  2241. /*:227*/
  2242. #line 772 "./typica.w"
  2243. /*233:*/
  2244. #line 6079 "./typica.w"
  2245. void DAQImplementation::measure()
  2246. {
  2247. int samplesRead= 0;
  2248. double buffer[channels];
  2249. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2250. (unsigned long)(0),buffer,(unsigned long)(channels),
  2251. &samplesRead,(signed long)(0));
  2252. if(error)
  2253. {
  2254. ready= false;
  2255. }
  2256. else
  2257. {
  2258. if(samplesRead)
  2259. {
  2260. QTime time= QTime::currentTime();
  2261. for(int i= 0;i<samplesRead;i++)
  2262. {
  2263. for(int j= 0;j<channels;j++)
  2264. {
  2265. Measurement measure(buffer[j+(i*channels)],time,
  2266. unitMap[j]);
  2267. channelMap[j]->input(measure);
  2268. }
  2269. }
  2270. }
  2271. }
  2272. }
  2273. /*:233*//*234:*/
  2274. #line 6121 "./typica.w"
  2275. void DAQImplementation::run()
  2276. {
  2277. setPriority(QThread::TimeCriticalPriority);
  2278. while(ready)
  2279. {
  2280. measure();
  2281. }
  2282. }
  2283. /*:234*//*235:*/
  2284. #line 6137 "./typica.w"
  2285. void DAQ::threadFinished()
  2286. {
  2287. if(imp->error)
  2288. {
  2289. /*236:*/
  2290. #line 6188 "./typica.w"
  2291. imp->ready= false;
  2292. QMessageBox warning;
  2293. warning.setStandardButtons(QMessageBox::Cancel);
  2294. warning.setIcon(QMessageBox::Warning);
  2295. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2296. unsigned long bytes= imp->errorInfo(NULL,0);
  2297. char string[bytes];
  2298. imp->errorInfo(string,bytes);
  2299. warning.setInformativeText(QString(string));
  2300. warning.setWindowTitle(QString(PROGRAM_NAME));
  2301. warning.exec();
  2302. /*:236*/
  2303. #line 6142 "./typica.w"
  2304. }
  2305. }
  2306. /*:235*//*237:*/
  2307. #line 6213 "./typica.w"
  2308. void DAQ::start()
  2309. {
  2310. if(imp->ready)
  2311. {
  2312. imp->error= imp->startTask(imp->handle);
  2313. if(imp->error)
  2314. {
  2315. /*236:*/
  2316. #line 6188 "./typica.w"
  2317. imp->ready= false;
  2318. QMessageBox warning;
  2319. warning.setStandardButtons(QMessageBox::Cancel);
  2320. warning.setIcon(QMessageBox::Warning);
  2321. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2322. unsigned long bytes= imp->errorInfo(NULL,0);
  2323. char string[bytes];
  2324. imp->errorInfo(string,bytes);
  2325. warning.setInformativeText(QString(string));
  2326. warning.setWindowTitle(QString(PROGRAM_NAME));
  2327. warning.exec();
  2328. /*:236*/
  2329. #line 6221 "./typica.w"
  2330. }
  2331. else
  2332. {
  2333. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2334. imp->start();
  2335. }
  2336. }
  2337. }
  2338. void DAQ::stop()
  2339. {
  2340. if(imp->useBase)
  2341. {
  2342. imp->ready= false;
  2343. imp->wait(ULONG_MAX);
  2344. imp->stopTask(imp->handle);
  2345. }
  2346. else
  2347. {
  2348. imp->ready= false;
  2349. imp->error= imp->stopTask(imp->handle);
  2350. if(imp->error)
  2351. {
  2352. /*236:*/
  2353. #line 6188 "./typica.w"
  2354. imp->ready= false;
  2355. QMessageBox warning;
  2356. warning.setStandardButtons(QMessageBox::Cancel);
  2357. warning.setIcon(QMessageBox::Warning);
  2358. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2359. unsigned long bytes= imp->errorInfo(NULL,0);
  2360. char string[bytes];
  2361. imp->errorInfo(string,bytes);
  2362. warning.setInformativeText(QString(string));
  2363. warning.setWindowTitle(QString(PROGRAM_NAME));
  2364. warning.exec();
  2365. /*:236*/
  2366. #line 6245 "./typica.w"
  2367. }
  2368. imp->error= imp->clearTask(imp->handle);
  2369. if(imp->error)
  2370. {
  2371. /*236:*/
  2372. #line 6188 "./typica.w"
  2373. imp->ready= false;
  2374. QMessageBox warning;
  2375. warning.setStandardButtons(QMessageBox::Cancel);
  2376. warning.setIcon(QMessageBox::Warning);
  2377. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2378. unsigned long bytes= imp->errorInfo(NULL,0);
  2379. char string[bytes];
  2380. imp->errorInfo(string,bytes);
  2381. warning.setInformativeText(QString(string));
  2382. warning.setWindowTitle(QString(PROGRAM_NAME));
  2383. warning.exec();
  2384. /*:236*/
  2385. #line 6250 "./typica.w"
  2386. }
  2387. }
  2388. }
  2389. /*:237*//*238:*/
  2390. #line 6260 "./typica.w"
  2391. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2392. {
  2393. imp->device= device;
  2394. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2395. if(imp->error)
  2396. {
  2397. /*236:*/
  2398. #line 6188 "./typica.w"
  2399. imp->ready= false;
  2400. QMessageBox warning;
  2401. warning.setStandardButtons(QMessageBox::Cancel);
  2402. warning.setIcon(QMessageBox::Warning);
  2403. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2404. unsigned long bytes= imp->errorInfo(NULL,0);
  2405. char string[bytes];
  2406. imp->errorInfo(string,bytes);
  2407. warning.setInformativeText(QString(string));
  2408. warning.setWindowTitle(QString(PROGRAM_NAME));
  2409. warning.exec();
  2410. /*:236*/
  2411. #line 6267 "./typica.w"
  2412. }
  2413. else
  2414. {
  2415. imp->ready= true;
  2416. }
  2417. }
  2418. /*:238*//*239:*/
  2419. #line 6281 "./typica.w"
  2420. Channel*DAQ::newChannel(int units,int thermocouple)
  2421. {
  2422. Channel*retval= new Channel();
  2423. imp->channelMap[imp->channels]= retval;
  2424. imp->unitMap[imp->channels]= (Measurement::TemperatureUnits)units;
  2425. imp->channels++;
  2426. if(imp->ready)
  2427. {
  2428. if(imp->useBase)
  2429. {
  2430. imp->error= imp->createChannel(imp->handle,
  2431. QString("%1/ai%2").arg(imp->device).
  2432. arg(imp->channels-1).
  2433. toAscii().data(),
  2434. "",(double)(-1.0),(double)(100.0),
  2435. (signed long)(units),
  2436. (signed long)(thermocouple),
  2437. (signed long)(10200),(double)(0),
  2438. "");
  2439. }
  2440. else
  2441. {
  2442. imp->error= imp->createChannel(imp->handle,
  2443. QString("%1/ai%2").arg(imp->device).
  2444. arg(imp->channels-1).
  2445. toAscii().data(),
  2446. "",(double)(50.0),(double)(500.0),
  2447. (signed long)(units),
  2448. (signed long)(thermocouple),
  2449. (signed long)(10200),(double)(0),
  2450. "");
  2451. }
  2452. if(imp->error)
  2453. {
  2454. /*236:*/
  2455. #line 6188 "./typica.w"
  2456. imp->ready= false;
  2457. QMessageBox warning;
  2458. warning.setStandardButtons(QMessageBox::Cancel);
  2459. warning.setIcon(QMessageBox::Warning);
  2460. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2461. unsigned long bytes= imp->errorInfo(NULL,0);
  2462. char string[bytes];
  2463. imp->errorInfo(string,bytes);
  2464. warning.setInformativeText(QString(string));
  2465. warning.setWindowTitle(QString(PROGRAM_NAME));
  2466. warning.exec();
  2467. /*:236*/
  2468. #line 6316 "./typica.w"
  2469. }
  2470. }
  2471. return retval;
  2472. }
  2473. /*:239*//*240:*/
  2474. #line 6330 "./typica.w"
  2475. void DAQ::setClockRate(double Hz)
  2476. {
  2477. if(imp->ready)
  2478. {
  2479. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2480. (signed long)(10280),(signed long)(10123),
  2481. (unsigned long long)(1));
  2482. if(imp->error)
  2483. {
  2484. /*236:*/
  2485. #line 6188 "./typica.w"
  2486. imp->ready= false;
  2487. QMessageBox warning;
  2488. warning.setStandardButtons(QMessageBox::Cancel);
  2489. warning.setIcon(QMessageBox::Warning);
  2490. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2491. unsigned long bytes= imp->errorInfo(NULL,0);
  2492. char string[bytes];
  2493. imp->errorInfo(string,bytes);
  2494. warning.setInformativeText(QString(string));
  2495. warning.setWindowTitle(QString(PROGRAM_NAME));
  2496. warning.exec();
  2497. /*:236*/
  2498. #line 6340 "./typica.w"
  2499. }
  2500. }
  2501. }
  2502. /*:240*//*241:*/
  2503. #line 6350 "./typica.w"
  2504. DAQ::~DAQ()
  2505. {
  2506. if(imp->useBase)
  2507. {
  2508. imp->resetDevice(imp->device.toAscii().data());
  2509. imp->clearTask(imp->handle);
  2510. }
  2511. else
  2512. {
  2513. if(imp->ready)
  2514. {
  2515. imp->ready= false;
  2516. imp->wait(ULONG_MAX);
  2517. imp->stopTask(imp->handle);
  2518. imp->resetDevice(imp->device.toAscii().data());
  2519. imp->clearTask(imp->handle);
  2520. }
  2521. }
  2522. delete imp;
  2523. }
  2524. /*:241*//*242:*/
  2525. #line 6381 "./typica.w"
  2526. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2527. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2528. unitMap(4)
  2529. {
  2530. if(driverinfo=="nidaqmxbase")
  2531. {
  2532. useBase= true;
  2533. }
  2534. else
  2535. {
  2536. useBase= false;
  2537. }
  2538. if(useBase)
  2539. {
  2540. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2541. if(!driver.load())
  2542. {
  2543. driver.setFileName("nidaqmxbase");
  2544. if(!driver.load())
  2545. {
  2546. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2547. tr("Failed to find nidaqmxbase. Please install it."));
  2548. QApplication::quit();
  2549. }
  2550. }
  2551. }
  2552. else
  2553. {
  2554. driver.setFileName("nicaiu");
  2555. if(!driver.load())
  2556. {
  2557. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2558. tr("Failed to find nidaqmx. Please install it."));
  2559. QApplication::quit();
  2560. }
  2561. }
  2562. if(useBase)
  2563. {
  2564. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2565. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2566. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2567. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2568. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2569. ==0||
  2570. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2571. 0||
  2572. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2573. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2574. 0||
  2575. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2576. {
  2577. waitForMeasurement= NULL;
  2578. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2579. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2580. QApplication::quit();
  2581. }
  2582. }
  2583. else
  2584. {
  2585. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2586. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2587. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2588. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2589. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2590. ==0||
  2591. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2592. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2593. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2594. 0||
  2595. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2596. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2597. {
  2598. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2599. tr("Failed to link a required symbol in NI-DAQmx."));
  2600. QApplication::quit();
  2601. }
  2602. }
  2603. }
  2604. DAQImplementation::~DAQImplementation()
  2605. {
  2606. driver.unload();
  2607. }
  2608. /*:242*/
  2609. #line 773 "./typica.w"
  2610. /*249:*/
  2611. #line 6583 "./typica.w"
  2612. void FakeDAQImplementation::measure()
  2613. {
  2614. msleep((int)(1000/clockRate));
  2615. QTime time= QTime::currentTime();
  2616. for(int i= 0;i<channels;i++)
  2617. {
  2618. Measurement measure(qrand()%500,time);
  2619. channelMap[i]->input(measure);
  2620. }
  2621. }
  2622. /*:249*//*250:*/
  2623. #line 6597 "./typica.w"
  2624. void FakeDAQImplementation::run()
  2625. {
  2626. setPriority(QThread::TimeCriticalPriority);
  2627. while(ready)
  2628. {
  2629. measure();
  2630. }
  2631. }
  2632. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  2633. channels(0),ready(false),clockRate(1)
  2634. {
  2635. }
  2636. FakeDAQImplementation::~FakeDAQImplementation()
  2637. {
  2638. }
  2639. /*:250*//*251:*/
  2640. #line 6622 "./typica.w"
  2641. void FakeDAQ::start()
  2642. {
  2643. if(imp->ready)
  2644. {
  2645. imp->start();
  2646. }
  2647. }
  2648. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  2649. {
  2650. imp->ready= true;
  2651. }
  2652. Channel*FakeDAQ::newChannel(int,int)
  2653. {
  2654. Channel*retval;
  2655. if(imp->ready)
  2656. {
  2657. retval= new Channel();
  2658. imp->channelMap[imp->channels]= retval;
  2659. imp->channels++;
  2660. }
  2661. else
  2662. {
  2663. return NULL;
  2664. }
  2665. return retval;
  2666. }
  2667. void FakeDAQ::setClockRate(double Hz)
  2668. {
  2669. if(imp->ready)
  2670. {
  2671. imp->clockRate= Hz;
  2672. }
  2673. }
  2674. FakeDAQ::~FakeDAQ()
  2675. {
  2676. imp->ready= false;
  2677. imp->wait(ULONG_MAX);
  2678. delete imp;
  2679. }
  2680. /*:251*/
  2681. #line 774 "./typica.w"
  2682. /*256:*/
  2683. #line 6753 "./typica.w"
  2684. Channel::Channel():QObject(NULL)
  2685. {
  2686. }
  2687. Channel::~Channel()
  2688. {
  2689. }
  2690. void Channel::input(Measurement measurement)
  2691. {
  2692. emit newData(measurement);
  2693. }
  2694. /*:256*/
  2695. #line 775 "./typica.w"
  2696. /*272:*/
  2697. #line 7164 "./typica.w"
  2698. void TemperatureDisplay::setValue(Measurement temperature)
  2699. {
  2700. QString number;
  2701. switch(unit)
  2702. {
  2703. case Auto:
  2704. switch(temperature.scale())
  2705. {
  2706. case Fahrenheit:
  2707. display(QString("%1'F").
  2708. arg(number.setNum(temperature.temperature(),'f',2)));
  2709. break;
  2710. case Celsius:
  2711. display(QString("%1'C").
  2712. arg(number.setNum(temperature.temperature(),'f',2)));
  2713. break;
  2714. case Kelvin:
  2715. display(QString("%1").
  2716. arg(number.setNum(temperature.temperature(),'f',2)));
  2717. break;
  2718. case Rankine:
  2719. display(QString("%1'r").
  2720. arg(number.setNum(temperature.temperature(),'f',2)));
  2721. break;
  2722. }
  2723. break;
  2724. case Fahrenheit:
  2725. display(QString("%1'F").
  2726. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  2727. 2)));
  2728. break;
  2729. case Celsius:
  2730. display(QString("%1'C").
  2731. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  2732. 2)));
  2733. break;
  2734. case Kelvin:
  2735. display(QString("%1").
  2736. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  2737. 2)));
  2738. break;
  2739. case Rankine:
  2740. display(QString("%1'r").
  2741. arg(number.setNum(temperature.toRankine().temperature(),'f',
  2742. 2)));
  2743. break;
  2744. }
  2745. }
  2746. /*:272*//*273:*/
  2747. #line 7224 "./typica.w"
  2748. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  2749. QLCDNumber(8,parent),unit(Auto)
  2750. {
  2751. setSegmentStyle(Filled);
  2752. display("---.--'F");
  2753. }
  2754. /*:273*//*274:*/
  2755. #line 7240 "./typica.w"
  2756. void TemperatureDisplay::invalidate()
  2757. {
  2758. display("---.--'F");
  2759. }
  2760. /*:274*//*275:*/
  2761. #line 7252 "./typica.w"
  2762. void TemperatureDisplay::setDisplayUnits(DisplayUnits scale)
  2763. {
  2764. unit= scale;
  2765. }
  2766. /*:275*//*276:*/
  2767. #line 7260 "./typica.w"
  2768. TemperatureDisplay::~TemperatureDisplay()
  2769. {
  2770. }
  2771. /*:276*/
  2772. #line 776 "./typica.w"
  2773. /*281:*/
  2774. #line 7340 "./typica.w"
  2775. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  2776. {
  2777. if(measure.time()<epoch)
  2778. {
  2779. if(hasPrevious)
  2780. {
  2781. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  2782. epoch.msec());
  2783. QTime jitComp(epoch.hour(),measure.time().minute(),
  2784. measure.time().second(),measure.time().msec());
  2785. int relTime= jitBase.msecsTo(jitComp);
  2786. /*282:*/
  2787. #line 7373 "./typica.w"
  2788. QTime newTime(0,0,0,0);
  2789. newTime= newTime.addMSecs(relTime);
  2790. if(newTime.hour()> 0)
  2791. {
  2792. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2793. }
  2794. Measurement rel(measure.temperature(),newTime);
  2795. emit measurement(rel);
  2796. /*:282*/
  2797. #line 7352 "./typica.w"
  2798. }
  2799. else
  2800. {
  2801. Measurement rel(measure.temperature(),QTime(0,0,0,0));
  2802. emit measurement(rel);
  2803. }
  2804. }
  2805. else
  2806. {
  2807. int relTime= epoch.msecsTo(measure.time());
  2808. /*282:*/
  2809. #line 7373 "./typica.w"
  2810. QTime newTime(0,0,0,0);
  2811. newTime= newTime.addMSecs(relTime);
  2812. if(newTime.hour()> 0)
  2813. {
  2814. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2815. }
  2816. Measurement rel(measure.temperature(),newTime);
  2817. emit measurement(rel);
  2818. /*:282*/
  2819. #line 7363 "./typica.w"
  2820. }
  2821. hasPrevious= true;
  2822. previous= measure.time();
  2823. }
  2824. /*:281*//*283:*/
  2825. #line 7385 "./typica.w"
  2826. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  2827. previous(0,0,0,0),hasPrevious(false)
  2828. {
  2829. }
  2830. QTime MeasurementTimeOffset::zeroTime()
  2831. {
  2832. return epoch;
  2833. }
  2834. void MeasurementTimeOffset::setZeroTime(QTime zero)
  2835. {
  2836. epoch= zero;
  2837. hasPrevious= false;
  2838. }
  2839. /*:283*/
  2840. #line 777 "./typica.w"
  2841. /*293:*/
  2842. #line 7582 "./typica.w"
  2843. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn),
  2844. temp(0)
  2845. {
  2846. }
  2847. int ZeroEmitter::column()
  2848. {
  2849. return col;
  2850. }
  2851. double ZeroEmitter::lastTemperature()
  2852. {
  2853. return temp;
  2854. }
  2855. void ZeroEmitter::newMeasurement(Measurement measure)
  2856. {
  2857. temp= measure.temperature();
  2858. }
  2859. void ZeroEmitter::setColumn(int column)
  2860. {
  2861. col= column;
  2862. }
  2863. void ZeroEmitter::emitZero()
  2864. {
  2865. emit measurement(Measurement(temp,QTime(0,0,0,0)),col);
  2866. }
  2867. /*:293*/
  2868. #line 778 "./typica.w"
  2869. /*298:*/
  2870. #line 7672 "./typica.w"
  2871. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  2872. {
  2873. }
  2874. int MeasurementAdapter::column()
  2875. {
  2876. return col;
  2877. }
  2878. void MeasurementAdapter::newMeasurement(Measurement measure)
  2879. {
  2880. emit measurement(measure,col);
  2881. }
  2882. void MeasurementAdapter::setColumn(int column)
  2883. {
  2884. col= column;
  2885. }
  2886. /*:298*/
  2887. #line 779 "./typica.w"
  2888. /*303:*/
  2889. #line 7788 "./typica.w"
  2890. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  2891. theScene(new QGraphicsScene),
  2892. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  2893. prevPoints(new QMap<int,QPointF> ),
  2894. translations(new QMap<int,double> ),
  2895. gridLinesF(new QList<QGraphicsItem*> ),
  2896. gridLinesC(new QList<QGraphicsItem*> )
  2897. {
  2898. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2899. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2900. setScene(theScene);
  2901. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  2902. /*304:*/
  2903. #line 7816 "./typica.w"
  2904. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  2905. tempaxis->setLine(-10,-500,-10,0);
  2906. theScene->addItem(tempaxis);
  2907. QGraphicsLineItem*gridLine;
  2908. QGraphicsTextItem*label;
  2909. for(int y= -100;y> -600;y-= 100)
  2910. {
  2911. gridLine= new QGraphicsLineItem;
  2912. gridLine->setLine(0,y,1200,y);
  2913. theScene->addItem(gridLine);
  2914. label= new QGraphicsTextItem;
  2915. label->setHtml(QString("%1&deg;F").arg(-y));
  2916. label->setPos(-55,y-(label->boundingRect().height()/2));
  2917. theScene->addItem(label);
  2918. gridLinesF->append(gridLine);
  2919. gridLinesF->append(label);
  2920. }
  2921. for(int degC= 50;degC<=250;degC+= 50)
  2922. {
  2923. gridLine= new QGraphicsLineItem;
  2924. int y= -(degC*(9.0/5.0)+32);
  2925. gridLine->setLine(0,y,1200,y);
  2926. gridLine->hide();
  2927. theScene->addItem(gridLine);
  2928. gridLinesC->append(gridLine);
  2929. label= new QGraphicsTextItem;
  2930. label->setHtml(QString("%1&deg;C").arg(degC));
  2931. label->setPos(-55,y-(label->boundingRect().height()/2));
  2932. label->hide();
  2933. theScene->addItem(label);
  2934. gridLinesC->append(label);
  2935. }
  2936. /*:304*/
  2937. #line 7801 "./typica.w"
  2938. ;
  2939. /*306:*/
  2940. #line 7882 "./typica.w"
  2941. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  2942. timeaxis->setLine(0,10,1200,10);
  2943. theScene->addItem(timeaxis);
  2944. for(int x= 0;x<1201;x+= 120)
  2945. {
  2946. QGraphicsLineItem*tick= new QGraphicsLineItem;
  2947. tick->setLine(x,0,x,20);
  2948. theScene->addItem(tick);
  2949. QGraphicsTextItem*label= new QGraphicsTextItem;
  2950. label->setPlainText(QString("%1").arg(x/60));
  2951. label->setPos(x-(label->boundingRect().width()/2),20);
  2952. theScene->addItem(label);
  2953. }
  2954. /*:306*/
  2955. #line 7802 "./typica.w"
  2956. ;
  2957. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2958. }
  2959. /*:303*//*305:*/
  2960. #line 7852 "./typica.w"
  2961. void GraphView::showF()
  2962. {
  2963. for(int i= 0;i<gridLinesF->size();i++)
  2964. {
  2965. gridLinesF->at(i)->show();
  2966. }
  2967. for(int i= 0;i<gridLinesC->size();i++)
  2968. {
  2969. gridLinesC->at(i)->hide();
  2970. }
  2971. }
  2972. void GraphView::showC()
  2973. {
  2974. for(int i= 0;i<gridLinesF->size();i++)
  2975. {
  2976. gridLinesF->at(i)->hide();
  2977. }
  2978. for(int i= 0;i<gridLinesC->size();i++)
  2979. {
  2980. gridLinesC->at(i)->show();
  2981. }
  2982. }
  2983. /*:305*//*307:*/
  2984. #line 7901 "./typica.w"
  2985. void GraphView::resizeEvent(QResizeEvent*)
  2986. {
  2987. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2988. }
  2989. /*:307*//*308:*/
  2990. #line 7912 "./typica.w"
  2991. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  2992. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  2993. {
  2994. double offset= 0;
  2995. if(translations->contains(tempcolumn))
  2996. {
  2997. offset= translations->value(tempcolumn);
  2998. }
  2999. if(prevPoints->contains(tempcolumn))
  3000. {
  3001. /*310:*/
  3002. #line 7971 "./typica.w"
  3003. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3004. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3005. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3006. -(prevPoints->value(tempcolumn).y()),
  3007. nextPoint.x()+offset,-(nextPoint.y()));
  3008. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3009. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3010. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3011. Qt::darkYellow};
  3012. segment->setPen(p[tempcolumn%12]);
  3013. theScene->addItem(segment);
  3014. prevPoints->insert(tempcolumn,nextPoint);
  3015. /*:310*/
  3016. #line 7924 "./typica.w"
  3017. if(graphLines->contains(tempcolumn))
  3018. {
  3019. graphLines->value(tempcolumn)->append(segment);
  3020. }
  3021. else
  3022. {
  3023. QList<QGraphicsLineItem*> *newLine=
  3024. new QList<QGraphicsLineItem*> ;
  3025. newLine->append(segment);
  3026. graphLines->insert(tempcolumn,newLine);
  3027. }
  3028. }
  3029. else
  3030. {
  3031. /*309:*/
  3032. #line 7960 "./typica.w"
  3033. int x= FULLTIMETOINT(measure.time())/1000;
  3034. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3035. /*:309*/
  3036. #line 7941 "./typica.w"
  3037. }
  3038. }
  3039. /*:308*//*311:*/
  3040. #line 7988 "./typica.w"
  3041. void GraphView::clear()
  3042. {
  3043. int i;
  3044. foreach(i,prevPoints->keys())
  3045. {
  3046. removeSeries(i);
  3047. }
  3048. translations->clear();
  3049. }
  3050. /*:311*//*312:*/
  3051. #line 8002 "./typica.w"
  3052. void GraphView::removeSeries(int column)
  3053. {
  3054. if(graphLines->contains(column))
  3055. {
  3056. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3057. QGraphicsLineItem*segment;
  3058. foreach(segment,*series)
  3059. {
  3060. theScene->removeItem(segment);
  3061. }
  3062. qDeleteAll(*series);
  3063. }
  3064. graphLines->remove(column);
  3065. prevPoints->remove(column);
  3066. }
  3067. /*:312*//*313:*/
  3068. #line 8021 "./typica.w"
  3069. void GraphView::setSeriesTranslation(int column,double offset)
  3070. {
  3071. if(graphLines->contains(column))
  3072. {
  3073. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3074. QGraphicsLineItem*segment;
  3075. foreach(segment,*series)
  3076. {
  3077. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3078. }
  3079. }
  3080. if(translations->contains(column))
  3081. {
  3082. translations->insert(column,offset+translations->value(column));
  3083. }
  3084. else
  3085. {
  3086. translations->insert(column,offset);
  3087. }
  3088. }
  3089. /*:313*/
  3090. #line 780 "./typica.w"
  3091. /*319:*/
  3092. #line 8171 "./typica.w"
  3093. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3094. {
  3095. model_ms->newMeasurement(measure,tempcolumn);
  3096. if(lastMeasurement.contains(tempcolumn))
  3097. {
  3098. if(measure.time().second()!=
  3099. lastMeasurement.value(tempcolumn).time().second())
  3100. {
  3101. Measurement adjusted(measure.temperature(),
  3102. QTime(0,measure.time().minute(),
  3103. measure.time().second(),0));
  3104. model_1s->newMeasurement(adjusted,tempcolumn);
  3105. if(adjusted.time().second()%5==0)
  3106. {
  3107. model_5s->newMeasurement(adjusted,tempcolumn);
  3108. if(adjusted.time().second()%10==0)
  3109. {
  3110. model_10s->newMeasurement(adjusted,tempcolumn);
  3111. }
  3112. if(adjusted.time().second()%15==0)
  3113. {
  3114. model_15s->newMeasurement(adjusted,tempcolumn);
  3115. if(adjusted.time().second()%30==0)
  3116. {
  3117. model_30s->newMeasurement(adjusted,tempcolumn);
  3118. if(adjusted.time().second()==0)
  3119. {
  3120. model_1m->newMeasurement(adjusted,tempcolumn);
  3121. }
  3122. }
  3123. }
  3124. }
  3125. }
  3126. /*322:*/
  3127. #line 8249 "./typica.w"
  3128. if(currentColumnSet.contains(tempcolumn))
  3129. {
  3130. int replicationcolumn;
  3131. foreach(replicationcolumn,currentColumnSet)
  3132. {
  3133. if(replicationcolumn!=tempcolumn)
  3134. {
  3135. if(lastMeasurement.contains(replicationcolumn))
  3136. {
  3137. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3138. {
  3139. Measurement synthetic(lastMeasurement.value(replicationcolumn).temperature(),
  3140. measure.time());
  3141. model_ms->newMeasurement(synthetic,replicationcolumn);
  3142. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3143. {
  3144. Measurement adjusted(synthetic.temperature(),QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3145. model_1s->newMeasurement(adjusted,replicationcolumn);
  3146. if(adjusted.time().second()%5==0)
  3147. {
  3148. model_5s->newMeasurement(adjusted,replicationcolumn);
  3149. if(adjusted.time().second()%10==0)
  3150. {
  3151. model_10s->newMeasurement(adjusted,replicationcolumn);
  3152. }
  3153. if(adjusted.time().second()%15==0)
  3154. {
  3155. model_15s->newMeasurement(adjusted,replicationcolumn);
  3156. if(adjusted.time().second()%30==0)
  3157. {
  3158. model_30s->newMeasurement(adjusted,replicationcolumn);
  3159. if(adjusted.time().second()==0)
  3160. {
  3161. model_1m->newMeasurement(adjusted,replicationcolumn);
  3162. }
  3163. }
  3164. }
  3165. }
  3166. }
  3167. lastMeasurement[replicationcolumn]= synthetic;
  3168. }
  3169. }
  3170. }
  3171. }
  3172. }
  3173. /*:322*/
  3174. #line 8205 "./typica.w"
  3175. }
  3176. else
  3177. {
  3178. /*320:*/
  3179. #line 8217 "./typica.w"
  3180. MeasurementModel*m;
  3181. foreach(m,modelSet)
  3182. {
  3183. m->newMeasurement(measure,tempcolumn);
  3184. }
  3185. /*:320*/
  3186. #line 8209 "./typica.w"
  3187. }
  3188. lastMeasurement[tempcolumn]= measure;
  3189. }
  3190. /*:319*//*321:*/
  3191. #line 8235 "./typica.w"
  3192. void ZoomLog::addToCurrentColumnSet(int column)
  3193. {
  3194. currentColumnSet.append(column);
  3195. }
  3196. void ZoomLog::clearCurrentColumnSet()
  3197. {
  3198. currentColumnSet.clear();
  3199. }
  3200. /*:321*//*323:*/
  3201. #line 8318 "./typica.w"
  3202. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3203. int annotationcolumn)
  3204. {
  3205. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3206. MeasurementModel*m;
  3207. if(lastMeasurement.contains(tempcolumn))
  3208. {
  3209. foreach(m,modelSet)
  3210. {
  3211. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3212. }
  3213. }
  3214. foreach(m,modelSet)
  3215. {
  3216. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3217. }
  3218. }
  3219. /*:323*//*324:*/
  3220. #line 8342 "./typica.w"
  3221. void ZoomLog::centerOn(int row)
  3222. {
  3223. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  3224. }
  3225. /*:324*//*325:*/
  3226. #line 8352 "./typica.w"
  3227. void ZoomLog::clear()
  3228. {
  3229. MeasurementModel*m;
  3230. foreach(m,modelSet)
  3231. {
  3232. m->clear();
  3233. }
  3234. lastMeasurement.clear();
  3235. saveTempCols.clear();
  3236. saveNoteCols.clear();
  3237. }
  3238. /*:325*//*326:*/
  3239. #line 8369 "./typica.w"
  3240. QVariant ZoomLog::data(int row,int column)const
  3241. {
  3242. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  3243. Qt::DisplayRole);
  3244. }
  3245. int ZoomLog::rowCount()
  3246. {
  3247. return model_ms->rowCount();
  3248. }
  3249. /*:326*//*327:*/
  3250. #line 8392 "./typica.w"
  3251. bool ZoomLog::saveXML(QIODevice*device)
  3252. {
  3253. int prevUnits= model_ms->displayUnits();
  3254. if(prevUnits!=10144)
  3255. {
  3256. model_ms->setDisplayUnits(10144);
  3257. }
  3258. XMLOutput writer(model_ms,device,0);
  3259. int c;
  3260. foreach(c,saveTempCols)
  3261. {
  3262. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3263. toString(),c);
  3264. }
  3265. foreach(c,saveNoteCols)
  3266. {
  3267. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3268. toString(),c);
  3269. }
  3270. bool retval= writer.output();
  3271. if(prevUnits!=10144)
  3272. {
  3273. model_ms->setDisplayUnits(prevUnits);
  3274. }
  3275. return retval;
  3276. }
  3277. /*:327*//*328:*/
  3278. #line 8423 "./typica.w"
  3279. bool ZoomLog::saveCSV(QIODevice*device)
  3280. {
  3281. CSVOutput writer(currentModel,device,0);
  3282. int c;
  3283. foreach(c,saveTempCols)
  3284. {
  3285. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3286. toString(),c);
  3287. }
  3288. foreach(c,saveNoteCols)
  3289. {
  3290. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3291. toString(),c);
  3292. }
  3293. return writer.output();
  3294. }
  3295. /*:328*//*329:*/
  3296. #line 8447 "./typica.w"
  3297. void ZoomLog::switchLOD(MeasurementModel*m)
  3298. {
  3299. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  3300. setModel(m);
  3301. currentModel= m;
  3302. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3303. }
  3304. void ZoomLog::LOD_ms()
  3305. {
  3306. switchLOD(model_ms);
  3307. }
  3308. void ZoomLog::LOD_1s()
  3309. {
  3310. switchLOD(model_1s);
  3311. }
  3312. void ZoomLog::LOD_5s()
  3313. {
  3314. switchLOD(model_5s);
  3315. }
  3316. void ZoomLog::LOD_10s()
  3317. {
  3318. switchLOD(model_10s);
  3319. }
  3320. void ZoomLog::LOD_15s()
  3321. {
  3322. switchLOD(model_15s);
  3323. }
  3324. void ZoomLog::LOD_30s()
  3325. {
  3326. switchLOD(model_30s);
  3327. }
  3328. void ZoomLog::LOD_1m()
  3329. {
  3330. switchLOD(model_1m);
  3331. }
  3332. /*:329*//*330:*/
  3333. #line 8495 "./typica.w"
  3334. void ZoomLog::setDisplayUnits(int scale)
  3335. {
  3336. model_ms->setDisplayUnits(scale);
  3337. model_1s->setDisplayUnits(scale);
  3338. model_5s->setDisplayUnits(scale);
  3339. model_10s->setDisplayUnits(scale);
  3340. model_15s->setDisplayUnits(scale);
  3341. model_30s->setDisplayUnits(scale);
  3342. model_1m->setDisplayUnits(scale);
  3343. }
  3344. int ZoomLog::displayUnits()
  3345. {
  3346. return model_ms->displayUnits();
  3347. }
  3348. /*:330*//*331:*/
  3349. #line 8515 "./typica.w"
  3350. QString ZoomLog::lastTime(int series)
  3351. {
  3352. Measurement measure= lastMeasurement.value(series);
  3353. QTime time= measure.time();
  3354. return time.toString("h:mm:ss.zzz");
  3355. }
  3356. /*:331*//*332:*/
  3357. #line 8525 "./typica.w"
  3358. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  3359. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  3360. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  3361. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  3362. {
  3363. setEditTriggers(QAbstractItemView::NoEditTriggers);
  3364. setSelectionMode(QAbstractItemView::NoSelection);
  3365. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  3366. model_30s<<model_1m;
  3367. currentModel= model_30s;
  3368. setModel(currentModel);
  3369. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3370. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  3371. this,SLOT(persistColumnResize(int,int,int)));
  3372. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  3373. this,SLOT(restoreColumnWidths()));
  3374. }
  3375. /*:332*//*333:*/
  3376. #line 8548 "./typica.w"
  3377. void ZoomLog::setHeaderData(int section,QString text)
  3378. {
  3379. MeasurementModel*m;
  3380. foreach(m,modelSet)
  3381. {
  3382. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  3383. }
  3384. }
  3385. /*:333*//*334:*/
  3386. #line 8562 "./typica.w"
  3387. void ZoomLog::addOutputTemperatureColumn(int column)
  3388. {
  3389. saveTempCols.append(column);
  3390. }
  3391. void ZoomLog::addOutputAnnotationColumn(int column)
  3392. {
  3393. saveNoteCols.append(column);
  3394. }
  3395. void ZoomLog::clearOutputColumns()
  3396. {
  3397. saveTempCols.clear();
  3398. saveNoteCols.clear();
  3399. }
  3400. /*:334*//*335:*/
  3401. #line 8582 "./typica.w"
  3402. void ZoomLog::persistColumnResize(int column,int,int newsize)
  3403. {
  3404. /*525:*/
  3405. #line 12560 "./typica.w"
  3406. QSettings settings;
  3407. /*526:*/
  3408. #line 12573 "./typica.w"
  3409. QWidget*topLevelWidget= this;
  3410. while(topLevelWidget->parentWidget())
  3411. {
  3412. topLevelWidget= topLevelWidget->parentWidget();
  3413. }
  3414. /*:526*/
  3415. #line 12562 "./typica.w"
  3416. settings.setValue(QString("columnWidths/%1/%2/%3").
  3417. arg(topLevelWidget->objectName()).
  3418. arg(objectName()).arg(column),
  3419. QVariant(newsize));
  3420. /*:525*/
  3421. #line 8585 "./typica.w"
  3422. }
  3423. void ZoomLog::restoreColumnWidths()
  3424. {
  3425. /*528:*/
  3426. #line 12593 "./typica.w"
  3427. QSettings settings;
  3428. /*526:*/
  3429. #line 12573 "./typica.w"
  3430. QWidget*topLevelWidget= this;
  3431. while(topLevelWidget->parentWidget())
  3432. {
  3433. topLevelWidget= topLevelWidget->parentWidget();
  3434. }
  3435. /*:526*/
  3436. #line 12595 "./typica.w"
  3437. QString baseKey=
  3438. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3439. arg(objectName());
  3440. for(int i= 0;i<model()->columnCount();i++)
  3441. {
  3442. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3443. if(settings.contains(key))
  3444. {
  3445. setColumnWidth(i,settings.value(key).toInt());
  3446. }
  3447. }
  3448. /*:528*/
  3449. #line 8590 "./typica.w"
  3450. }
  3451. void ZoomLog::setVisible(bool visibility)
  3452. {
  3453. QTableView::setVisible(visibility);
  3454. }
  3455. void ZoomLog::showEvent(QShowEvent*)
  3456. {
  3457. /*528:*/
  3458. #line 12593 "./typica.w"
  3459. QSettings settings;
  3460. /*526:*/
  3461. #line 12573 "./typica.w"
  3462. QWidget*topLevelWidget= this;
  3463. while(topLevelWidget->parentWidget())
  3464. {
  3465. topLevelWidget= topLevelWidget->parentWidget();
  3466. }
  3467. /*:526*/
  3468. #line 12595 "./typica.w"
  3469. QString baseKey=
  3470. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3471. arg(objectName());
  3472. for(int i= 0;i<model()->columnCount();i++)
  3473. {
  3474. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3475. if(settings.contains(key))
  3476. {
  3477. setColumnWidth(i,settings.value(key).toInt());
  3478. }
  3479. }
  3480. /*:528*/
  3481. #line 8600 "./typica.w"
  3482. }
  3483. /*:335*/
  3484. #line 781 "./typica.w"
  3485. /*343:*/
  3486. #line 8822 "./typica.w"
  3487. bool MeasurementList::operator<(const MeasurementList&other)const
  3488. {
  3489. return this->first().toTime()<other.first().toTime();
  3490. }
  3491. bool MeasurementList::operator==(const MeasurementList&other)const
  3492. {
  3493. return this->first().toTime()==other.first().toTime();
  3494. }
  3495. /*:343*//*344:*/
  3496. #line 8838 "./typica.w"
  3497. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  3498. {
  3499. return QModelIndex();
  3500. }
  3501. /*:344*//*345:*/
  3502. #line 8848 "./typica.w"
  3503. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  3504. {
  3505. MeasurementList*temp;
  3506. temp= new MeasurementList;
  3507. temp->append(QVariant(measure.time()));
  3508. /*346:*/
  3509. #line 8899 "./typica.w"
  3510. /*347:*/
  3511. #line 8944 "./typica.w"
  3512. QList<MeasurementList*> ::iterator i= lastInsertion;
  3513. bool quickscan= false;
  3514. if(entries->size()> 5)
  3515. {
  3516. if(**i<*temp)
  3517. {
  3518. i+= 1;
  3519. for(int j= 10;j> 0;j--)
  3520. {
  3521. if(i!=entries->end())
  3522. {
  3523. if(**i<*temp)
  3524. {
  3525. i+= 1;
  3526. }
  3527. else
  3528. {
  3529. quickscan= true;
  3530. break;
  3531. }
  3532. }
  3533. else
  3534. {
  3535. quickscan= true;
  3536. break;
  3537. }
  3538. }
  3539. }
  3540. else
  3541. {
  3542. if(**i==*temp)
  3543. {
  3544. quickscan= true;
  3545. }
  3546. }
  3547. }
  3548. /*:347*/
  3549. #line 8900 "./typica.w"
  3550. if(quickscan==false)
  3551. {
  3552. i= entries->begin();
  3553. QList<MeasurementList*> ::iterator u= entries->end();
  3554. QList<MeasurementList*> ::iterator midpoint;
  3555. int n= u-i;
  3556. int rA;
  3557. while(n> 0)
  3558. {
  3559. rA= n>>1;
  3560. midpoint= i+rA;
  3561. if(**midpoint<*temp)
  3562. {
  3563. i= midpoint+1;
  3564. n-= rA+1;
  3565. }
  3566. else
  3567. {
  3568. n= rA;
  3569. }
  3570. }
  3571. }
  3572. /*:346*/
  3573. #line 8854 "./typica.w"
  3574. MeasurementList*newEntry;
  3575. int insertion;
  3576. if(i!=entries->end())
  3577. {
  3578. insertion= entries->indexOf(*i);
  3579. if((*i)->first().toTime()==measure.time())
  3580. {
  3581. /*348:*/
  3582. #line 8986 "./typica.w"
  3583. if((*i)->size()<tempcolumn+1)
  3584. {
  3585. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  3586. {
  3587. (*i)->append(QVariant());
  3588. }
  3589. }
  3590. (*i)->replace(tempcolumn,measure.temperature());
  3591. lastInsertion= i;
  3592. emit dataChanged(createIndex(insertion,tempcolumn),
  3593. createIndex(insertion,tempcolumn));
  3594. lastTemperature->insert(tempcolumn,insertion);
  3595. /*:348*/
  3596. #line 8862 "./typica.w"
  3597. }
  3598. else
  3599. {
  3600. /*349:*/
  3601. #line 9004 "./typica.w"
  3602. beginInsertRows(QModelIndex(),insertion,insertion);
  3603. newEntry= new MeasurementList;
  3604. newEntry->append(QVariant(measure.time()));
  3605. for(int j= 0;j<tempcolumn+1;j++)
  3606. {
  3607. newEntry->append(QVariant());
  3608. }
  3609. newEntry->replace(tempcolumn,measure.temperature());
  3610. lastInsertion= entries->insert(i,newEntry);
  3611. endInsertRows();
  3612. lastTemperature->insert(tempcolumn,insertion);
  3613. /*:349*/
  3614. #line 8866 "./typica.w"
  3615. }
  3616. }
  3617. else
  3618. {
  3619. /*350:*/
  3620. #line 9022 "./typica.w"
  3621. insertion= entries->size();
  3622. /*349:*/
  3623. #line 9004 "./typica.w"
  3624. beginInsertRows(QModelIndex(),insertion,insertion);
  3625. newEntry= new MeasurementList;
  3626. newEntry->append(QVariant(measure.time()));
  3627. for(int j= 0;j<tempcolumn+1;j++)
  3628. {
  3629. newEntry->append(QVariant());
  3630. }
  3631. newEntry->replace(tempcolumn,measure.temperature());
  3632. lastInsertion= entries->insert(i,newEntry);
  3633. endInsertRows();
  3634. lastTemperature->insert(tempcolumn,insertion);
  3635. /*:349*/
  3636. #line 9024 "./typica.w"
  3637. /*:350*/
  3638. #line 8871 "./typica.w"
  3639. }
  3640. if(tempcolumn>=colcount)
  3641. {
  3642. colcount= tempcolumn+1;
  3643. }
  3644. emit rowChanged(insertion);
  3645. delete temp;
  3646. }
  3647. /*:345*//*351:*/
  3648. #line 9033 "./typica.w"
  3649. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  3650. int annotationColumn)
  3651. {
  3652. int r;
  3653. if(lastTemperature->contains(tempcolumn))
  3654. {
  3655. r= lastTemperature->value(tempcolumn);
  3656. }
  3657. else
  3658. {
  3659. r= 0;
  3660. }
  3661. if(r==0&&entries->size()==0)
  3662. {
  3663. /*352:*/
  3664. #line 9071 "./typica.w"
  3665. beginInsertRows(QModelIndex(),0,0);
  3666. MeasurementList*newEntry= new MeasurementList;
  3667. newEntry->append(QVariant(QTime(0,0,0,0)));
  3668. entries->append(newEntry);
  3669. endInsertRows();
  3670. /*:352*/
  3671. #line 9048 "./typica.w"
  3672. }
  3673. MeasurementList*row= entries->at(r);
  3674. if(row->size()<=annotationColumn)
  3675. {
  3676. for(int i= row->size()-1;i<annotationColumn+1;i++)
  3677. {
  3678. row->append(QVariant());
  3679. }
  3680. }
  3681. row->replace(annotationColumn,annotation);
  3682. emit dataChanged(createIndex(r,annotationColumn),
  3683. createIndex(r,annotationColumn));
  3684. emit rowChanged(r);
  3685. if(annotationColumn> colcount-1)
  3686. {
  3687. colcount= annotationColumn+1;
  3688. }
  3689. }
  3690. /*:351*//*353:*/
  3691. #line 9082 "./typica.w"
  3692. void MeasurementModel::clear()
  3693. {
  3694. beginRemoveRows(QModelIndex(),0,entries->size());
  3695. while(entries->size()!=0)
  3696. {
  3697. MeasurementList*row= entries->takeFirst();
  3698. delete row;
  3699. }
  3700. endRemoveRows();
  3701. colcount= hData->size();
  3702. lastTemperature->clear();
  3703. reset();
  3704. }
  3705. /*:353*//*354:*/
  3706. #line 9108 "./typica.w"
  3707. bool MeasurementModel::setData(const QModelIndex&index,
  3708. const QVariant&value,int role)
  3709. {
  3710. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  3711. {
  3712. return false;
  3713. }
  3714. /*355:*/
  3715. #line 9140 "./typica.w"
  3716. bool valid= false;
  3717. if(index.isValid())
  3718. {
  3719. if(index.row()<entries->size())
  3720. {
  3721. if(index.column()<colcount)
  3722. {
  3723. valid= true;
  3724. }
  3725. }
  3726. }
  3727. /*:355*/
  3728. #line 9116 "./typica.w"
  3729. if(!valid)
  3730. {
  3731. return false;
  3732. }
  3733. MeasurementList*row= entries->at(index.row());
  3734. if(index.column()>=row->size())
  3735. {
  3736. /*356:*/
  3737. #line 9157 "./typica.w"
  3738. for(int i= row->size()-1;i<index.column();i++)
  3739. {
  3740. row->append(QVariant());
  3741. }
  3742. /*:356*/
  3743. #line 9124 "./typica.w"
  3744. }
  3745. if(index.column()==0)
  3746. {
  3747. /*357:*/
  3748. #line 9172 "./typica.w"
  3749. QTime time;
  3750. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  3751. {
  3752. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  3753. {
  3754. return false;
  3755. }
  3756. }
  3757. row= entries->takeAt(index.row());
  3758. row->replace(index.column(),QVariant(time));
  3759. MeasurementList*temp= row;
  3760. /*346:*/
  3761. #line 8899 "./typica.w"
  3762. /*347:*/
  3763. #line 8944 "./typica.w"
  3764. QList<MeasurementList*> ::iterator i= lastInsertion;
  3765. bool quickscan= false;
  3766. if(entries->size()> 5)
  3767. {
  3768. if(**i<*temp)
  3769. {
  3770. i+= 1;
  3771. for(int j= 10;j> 0;j--)
  3772. {
  3773. if(i!=entries->end())
  3774. {
  3775. if(**i<*temp)
  3776. {
  3777. i+= 1;
  3778. }
  3779. else
  3780. {
  3781. quickscan= true;
  3782. break;
  3783. }
  3784. }
  3785. else
  3786. {
  3787. quickscan= true;
  3788. break;
  3789. }
  3790. }
  3791. }
  3792. else
  3793. {
  3794. if(**i==*temp)
  3795. {
  3796. quickscan= true;
  3797. }
  3798. }
  3799. }
  3800. /*:347*/
  3801. #line 8900 "./typica.w"
  3802. if(quickscan==false)
  3803. {
  3804. i= entries->begin();
  3805. QList<MeasurementList*> ::iterator u= entries->end();
  3806. QList<MeasurementList*> ::iterator midpoint;
  3807. int n= u-i;
  3808. int rA;
  3809. while(n> 0)
  3810. {
  3811. rA= n>>1;
  3812. midpoint= i+rA;
  3813. if(**midpoint<*temp)
  3814. {
  3815. i= midpoint+1;
  3816. n-= rA+1;
  3817. }
  3818. else
  3819. {
  3820. n= rA;
  3821. }
  3822. }
  3823. }
  3824. /*:346*/
  3825. #line 9184 "./typica.w"
  3826. entries->insert(i,row);
  3827. int newRow= entries->indexOf(*i);
  3828. if(newRow<index.row())
  3829. {
  3830. emit dataChanged(createIndex(newRow,index.column()),index);
  3831. }
  3832. else
  3833. {
  3834. emit dataChanged(index,createIndex(newRow,index.column()));
  3835. }
  3836. /*:357*/
  3837. #line 9128 "./typica.w"
  3838. }
  3839. else
  3840. {
  3841. /*358:*/
  3842. #line 9198 "./typica.w"
  3843. row->replace(index.column(),value);
  3844. emit dataChanged(index,index);
  3845. /*:358*/
  3846. #line 9132 "./typica.w"
  3847. }
  3848. return true;
  3849. }
  3850. /*:354*//*359:*/
  3851. #line 9206 "./typica.w"
  3852. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  3853. unit(Fahrenheit),hData(new QStringList),
  3854. lastTemperature(new QHash<int,int> )
  3855. {
  3856. colcount= 1;
  3857. entries= new QList<MeasurementList*> ;
  3858. lastInsertion= entries->begin();
  3859. hData->append(tr("Time"));
  3860. }
  3861. /*:359*//*360:*/
  3862. #line 9219 "./typica.w"
  3863. MeasurementModel::~MeasurementModel()
  3864. {
  3865. clear();
  3866. delete entries;
  3867. delete hData;
  3868. }
  3869. /*:360*//*361:*/
  3870. #line 9231 "./typica.w"
  3871. int MeasurementModel::rowCount(const QModelIndex&parent)const
  3872. {
  3873. if(parent==QModelIndex())
  3874. {
  3875. return entries->size();
  3876. }
  3877. return 0;
  3878. }
  3879. int MeasurementModel::columnCount(const QModelIndex&parent)const
  3880. {
  3881. if(parent==QModelIndex())
  3882. {
  3883. return colcount;
  3884. }
  3885. return 0;
  3886. }
  3887. /*:361*//*362:*/
  3888. #line 9258 "./typica.w"
  3889. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  3890. const QVariant&value,int)
  3891. {
  3892. if(orientation==Qt::Horizontal)
  3893. {
  3894. if(hData->size()<section+1)
  3895. {
  3896. for(int i= hData->size();i<section+1;i++)
  3897. {
  3898. if(colcount<i)
  3899. {
  3900. beginInsertColumns(QModelIndex(),i,i);
  3901. }
  3902. hData->append(QString());
  3903. if(colcount<i)
  3904. {
  3905. endInsertColumns();
  3906. }
  3907. }
  3908. }
  3909. hData->replace(section,value.toString());
  3910. emit headerDataChanged(orientation,section,section);
  3911. if(colcount<section+1)
  3912. {
  3913. colcount= section+1;
  3914. }
  3915. return true;
  3916. }
  3917. return false;
  3918. }
  3919. /*:362*//*363:*/
  3920. #line 9298 "./typica.w"
  3921. void MeasurementModel::setDisplayUnits(int scale)
  3922. {
  3923. beginResetModel();
  3924. unit= scale;
  3925. endResetModel();
  3926. }
  3927. int MeasurementModel::displayUnits()
  3928. {
  3929. return unit;
  3930. }
  3931. /*:363*//*364:*/
  3932. #line 9322 "./typica.w"
  3933. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  3934. {
  3935. /*355:*/
  3936. #line 9140 "./typica.w"
  3937. bool valid= false;
  3938. if(index.isValid())
  3939. {
  3940. if(index.row()<entries->size())
  3941. {
  3942. if(index.column()<colcount)
  3943. {
  3944. valid= true;
  3945. }
  3946. }
  3947. }
  3948. /*:355*/
  3949. #line 9325 "./typica.w"
  3950. if(!valid)
  3951. {
  3952. return QVariant();
  3953. }
  3954. if(role==Qt::DisplayRole||role==Qt::EditRole)
  3955. {
  3956. MeasurementList*row= entries->at(index.row());
  3957. if(index.column()> row->size())
  3958. {
  3959. return QVariant();
  3960. }
  3961. else
  3962. {
  3963. if(index.column()==0)
  3964. {
  3965. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  3966. }
  3967. else if(lastTemperature->contains(index.column()))
  3968. {
  3969. if(row->at(index.column()).toString().isEmpty())
  3970. {
  3971. return QVariant();
  3972. }
  3973. switch(unit)
  3974. {
  3975. case Auto:
  3976. case Fahrenheit:
  3977. return QVariant(row->at(index.column()).toString());
  3978. break;
  3979. case Celsius:
  3980. return QVariant((row->at(index.column()).toDouble()-
  3981. 32)*5/9);
  3982. break;
  3983. case Kelvin:
  3984. return QVariant((row->at(index.column()).toDouble()+
  3985. 459.67)*5/9);
  3986. break;
  3987. case Rankine:
  3988. return QVariant(row->at(index.column()).toDouble()+
  3989. 459.67);
  3990. break;
  3991. default:
  3992. break;
  3993. }
  3994. }
  3995. return QVariant(row->at(index.column()).toString());
  3996. }
  3997. }
  3998. return QVariant();
  3999. }
  4000. /*:364*//*365:*/
  4001. #line 9379 "./typica.w"
  4002. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4003. int role)const
  4004. {
  4005. if(orientation==Qt::Horizontal)
  4006. {
  4007. if(role==Qt::DisplayRole)
  4008. {
  4009. if(section<hData->size())
  4010. {
  4011. return QVariant(hData->at(section));
  4012. }
  4013. }
  4014. }
  4015. return QVariant();
  4016. }
  4017. /*:365*//*366:*/
  4018. #line 9406 "./typica.w"
  4019. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4020. {
  4021. /*355:*/
  4022. #line 9140 "./typica.w"
  4023. bool valid= false;
  4024. if(index.isValid())
  4025. {
  4026. if(index.row()<entries->size())
  4027. {
  4028. if(index.column()<colcount)
  4029. {
  4030. valid= true;
  4031. }
  4032. }
  4033. }
  4034. /*:355*/
  4035. #line 9409 "./typica.w"
  4036. if(valid)
  4037. {
  4038. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4039. }
  4040. return 0;
  4041. }
  4042. /*:366*//*367:*/
  4043. #line 9421 "./typica.w"
  4044. QModelIndex MeasurementModel::index(int row,int column,
  4045. const QModelIndex&parent)const
  4046. {
  4047. if(parent==QModelIndex())
  4048. {
  4049. if(row<entries->size()&&entries->isEmpty()==false)
  4050. {
  4051. if(column<entries->at(row)->size())
  4052. {
  4053. return createIndex(row,column);
  4054. }
  4055. }
  4056. }
  4057. return QModelIndex();
  4058. }
  4059. /*:367*/
  4060. #line 782 "./typica.w"
  4061. /*369:*/
  4062. #line 9472 "./typica.w"
  4063. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4064. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4065. {
  4066. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4067. }
  4068. /*:369*//*370:*/
  4069. #line 9487 "./typica.w"
  4070. void AnnotationButton::annotate()
  4071. {
  4072. if(note.contains("%1"))
  4073. {
  4074. count++;
  4075. emit annotation(note.arg(count),tc,ac);
  4076. }
  4077. else
  4078. {
  4079. emit annotation(note,tc,ac);
  4080. }
  4081. }
  4082. /*:370*//*371:*/
  4083. #line 9505 "./typica.w"
  4084. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4085. {
  4086. tc= tempcolumn;
  4087. }
  4088. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4089. {
  4090. ac= annotationcolumn;
  4091. }
  4092. void AnnotationButton::setAnnotation(const QString&annotation)
  4093. {
  4094. note= annotation;
  4095. }
  4096. /*:371*//*372:*/
  4097. #line 9524 "./typica.w"
  4098. void AnnotationButton::resetCount()
  4099. {
  4100. count= 0;
  4101. }
  4102. /*:372*/
  4103. #line 783 "./typica.w"
  4104. /*377:*/
  4105. #line 9607 "./typica.w"
  4106. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4107. const QString&postt,
  4108. QWidget*parent)
  4109. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4110. {
  4111. resetChange();
  4112. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4113. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4114. }
  4115. /*:377*//*378:*/
  4116. #line 9624 "./typica.w"
  4117. void AnnotationSpinBox::resetChange()
  4118. {
  4119. change= true;
  4120. }
  4121. /*:378*//*379:*/
  4122. #line 9635 "./typica.w"
  4123. void AnnotationSpinBox::annotate()
  4124. {
  4125. if(change)
  4126. {
  4127. change= false;
  4128. emit annotation(QString("%1%2%3").arg(pretext).
  4129. arg(value()).arg(posttext),tc,ac);
  4130. }
  4131. }
  4132. /*:379*//*380:*/
  4133. #line 9648 "./typica.w"
  4134. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4135. {
  4136. tc= tempcolumn;
  4137. }
  4138. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4139. {
  4140. ac= annotationcolumn;
  4141. }
  4142. void AnnotationSpinBox::setPretext(const QString&pret)
  4143. {
  4144. pretext= pret;
  4145. }
  4146. void AnnotationSpinBox::setPosttext(const QString&postt)
  4147. {
  4148. posttext= postt;
  4149. }
  4150. /*:380*/
  4151. #line 784 "./typica.w"
  4152. /*387:*/
  4153. #line 9816 "./typica.w"
  4154. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4155. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4156. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4157. stopAction(new QAction(tr("Stop"),NULL)),
  4158. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4159. relative(QTime::currentTime()),base(QTime(0,0,0))
  4160. {
  4161. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4162. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4163. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4164. clock.setInterval(500);
  4165. clock.setSingleShot(false);
  4166. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4167. setSegmentStyle(Filled);
  4168. updateDisplay();
  4169. }
  4170. /*:387*//*388:*/
  4171. #line 9837 "./typica.w"
  4172. void TimerDisplay::updateTime()
  4173. {
  4174. QTime time;
  4175. int cseconds= 0;
  4176. int oseconds= 0;
  4177. int r= 0;
  4178. QTime nt= QTime(0,0,0);
  4179. int n= 0;
  4180. int bseconds= 0;
  4181. switch(m)
  4182. {
  4183. case TimerDisplay::CountUp:
  4184. /*389:*/
  4185. #line 9869 "./typica.w"
  4186. /*390:*/
  4187. #line 9882 "./typica.w"
  4188. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4189. time= QTime::currentTime();
  4190. cseconds= TIMETOINT(time);
  4191. oseconds= TIMETOINT(relative);
  4192. r= cseconds-oseconds;
  4193. /*:390*/
  4194. #line 9870 "./typica.w"
  4195. nt= nt.addSecs(r);
  4196. if(nt!=s)
  4197. {
  4198. s= nt;
  4199. emit valueChanged(s);
  4200. }
  4201. /*:389*/
  4202. #line 9850 "./typica.w"
  4203. ;
  4204. break;
  4205. case TimerDisplay::CountDown:
  4206. /*391:*/
  4207. #line 9894 "./typica.w"
  4208. if(s> QTime(0,0,0))
  4209. {
  4210. /*390:*/
  4211. #line 9882 "./typica.w"
  4212. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4213. time= QTime::currentTime();
  4214. cseconds= TIMETOINT(time);
  4215. oseconds= TIMETOINT(relative);
  4216. r= cseconds-oseconds;
  4217. /*:390*/
  4218. #line 9897 "./typica.w"
  4219. bseconds= TIMETOINT(base);
  4220. n= bseconds-r;
  4221. nt= nt.addSecs(n);
  4222. if(nt!=s)
  4223. {
  4224. s= nt;
  4225. emit valueChanged(s);
  4226. }
  4227. }
  4228. /*:391*/
  4229. #line 9853 "./typica.w"
  4230. ;
  4231. break;
  4232. case TimerDisplay::Clock:
  4233. /*392:*/
  4234. #line 9911 "./typica.w"
  4235. time= QTime::currentTime();
  4236. if(time!=s)
  4237. {
  4238. s= time;
  4239. emit valueChanged(s);
  4240. }
  4241. /*:392*/
  4242. #line 9856 "./typica.w"
  4243. ;
  4244. break;
  4245. default:
  4246. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  4247. break;
  4248. }
  4249. updateDisplay();
  4250. }
  4251. /*:388*//*393:*/
  4252. #line 9923 "./typica.w"
  4253. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  4254. void TimerDisplay::startTimer()
  4255. {
  4256. if(!running)
  4257. {
  4258. relative= QTime::currentTime();
  4259. if(ar)
  4260. {
  4261. reset();
  4262. }
  4263. else
  4264. {
  4265. relative= TIMESUBTRACT(relative,s);
  4266. }
  4267. if(m==Clock)
  4268. {
  4269. updateTime();
  4270. }
  4271. base= s;
  4272. clock.start();
  4273. running= true;
  4274. emit runStateChanged(true);
  4275. }
  4276. }
  4277. /*:393*//*394:*/
  4278. #line 9953 "./typica.w"
  4279. void TimerDisplay::stopTimer()
  4280. {
  4281. if(running)
  4282. {
  4283. clock.stop();
  4284. running= false;
  4285. emit runStateChanged(false);
  4286. }
  4287. }
  4288. /*:394*//*395:*/
  4289. #line 9966 "./typica.w"
  4290. TimerDisplay::~TimerDisplay()
  4291. {
  4292. clock.stop();
  4293. }
  4294. /*:395*//*396:*/
  4295. #line 9975 "./typica.w"
  4296. void TimerDisplay::setCountUpMode()
  4297. {
  4298. m= TimerDisplay::CountUp;
  4299. }
  4300. void TimerDisplay::setCountDownMode()
  4301. {
  4302. m= TimerDisplay::CountDown;
  4303. }
  4304. void TimerDisplay::setClockMode()
  4305. {
  4306. m= TimerDisplay::Clock;
  4307. }
  4308. /*:396*//*397:*/
  4309. #line 9993 "./typica.w"
  4310. QString TimerDisplay::value()
  4311. {
  4312. return s.toString(f);
  4313. }
  4314. QTime TimerDisplay::seconds()
  4315. {
  4316. return s;
  4317. }
  4318. TimerDisplay::TimerMode TimerDisplay::mode()
  4319. {
  4320. return m;
  4321. }
  4322. bool TimerDisplay::isRunning()
  4323. {
  4324. return running;
  4325. }
  4326. QTime TimerDisplay::resetValue()
  4327. {
  4328. return r;
  4329. }
  4330. QString TimerDisplay::displayFormat()
  4331. {
  4332. return f;
  4333. }
  4334. bool TimerDisplay::autoReset()
  4335. {
  4336. return ar;
  4337. }
  4338. /*:397*//*398:*/
  4339. #line 10031 "./typica.w"
  4340. void TimerDisplay::setTimer(QTime value)
  4341. {
  4342. if(value.isValid())
  4343. {
  4344. s= value;
  4345. updateDisplay();
  4346. emit valueChanged(value);
  4347. }
  4348. }
  4349. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  4350. {
  4351. m= mode;
  4352. }
  4353. void TimerDisplay::setResetValue(QTime value)
  4354. {
  4355. r= value;
  4356. }
  4357. void TimerDisplay::setDisplayFormat(QString format)
  4358. {
  4359. f= format;
  4360. setNumDigits(format.length());
  4361. }
  4362. void TimerDisplay::setAutoReset(bool reset)
  4363. {
  4364. ar= reset;
  4365. }
  4366. /*:398*//*399:*/
  4367. #line 10066 "./typica.w"
  4368. void TimerDisplay::copyTimer()
  4369. {
  4370. QApplication::clipboard()->setText(value());
  4371. }
  4372. /*:399*//*400:*/
  4373. #line 10075 "./typica.w"
  4374. void TimerDisplay::reset()
  4375. {
  4376. if(!running)
  4377. {
  4378. s= r;
  4379. updateDisplay();
  4380. }
  4381. }
  4382. /*:400*//*401:*/
  4383. #line 10088 "./typica.w"
  4384. void TimerDisplay::updateDisplay()
  4385. {
  4386. display(value());
  4387. }
  4388. /*:401*/
  4389. #line 785 "./typica.w"
  4390. /*407:*/
  4391. #line 10182 "./typica.w"
  4392. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  4393. {
  4394. int x= rect.x();
  4395. int y= rect.y();
  4396. QLayoutItem*item;
  4397. if(orientation==Qt::Horizontal)
  4398. {
  4399. /*408:*/
  4400. #line 10206 "./typica.w"
  4401. foreach(item,itemList)
  4402. {
  4403. int nextX= x+item->sizeHint().width()+spacing();
  4404. int right= x+item->sizeHint().width();
  4405. if(item==itemList.last())
  4406. {
  4407. right= rect.right();
  4408. }
  4409. int bottom= rect.bottom();
  4410. if(!testOnly)
  4411. {
  4412. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4413. }
  4414. x= nextX;
  4415. }
  4416. /*:408*/
  4417. #line 10190 "./typica.w"
  4418. }
  4419. else
  4420. {
  4421. /*409:*/
  4422. #line 10225 "./typica.w"
  4423. foreach(item,itemList)
  4424. {
  4425. int nextY= y+item->sizeHint().height()+spacing();
  4426. int bottom= y+item->sizeHint().height();
  4427. if(item==itemList.last())
  4428. {
  4429. bottom= rect.bottom();
  4430. }
  4431. int right= rect.right();
  4432. if(!testOnly)
  4433. {
  4434. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4435. }
  4436. y= nextY;
  4437. }
  4438. /*:409*/
  4439. #line 10194 "./typica.w"
  4440. }
  4441. return y;
  4442. }
  4443. /*:407*//*410:*/
  4444. #line 10249 "./typica.w"
  4445. QSize PackLayout::minimumSize()const
  4446. {
  4447. QSize size;
  4448. QLayoutItem*item;
  4449. foreach(item,itemList)
  4450. {
  4451. if(orientation==Qt::Horizontal)
  4452. {
  4453. size+= QSize(item->minimumSize().width(),0);
  4454. if(size.height()<item->minimumSize().height())
  4455. {
  4456. size.setHeight(item->minimumSize().height());
  4457. }
  4458. }
  4459. else
  4460. {
  4461. size+= QSize(0,item->minimumSize().height());
  4462. if(size.width()<item->minimumSize().width())
  4463. {
  4464. size.setWidth(item->minimumSize().width());
  4465. }
  4466. }
  4467. }
  4468. size+= QSize(2*margin(),2*margin());
  4469. return size;
  4470. }
  4471. /*:410*//*411:*/
  4472. #line 10281 "./typica.w"
  4473. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  4474. QLayout(parent)
  4475. {
  4476. setMargin(margin);
  4477. setSpacing(spacing);
  4478. setOrientation(Qt::Horizontal);
  4479. }
  4480. PackLayout::PackLayout(int spacing)
  4481. {
  4482. setSpacing(spacing);
  4483. setOrientation(Qt::Horizontal);
  4484. }
  4485. /*:411*//*412:*/
  4486. #line 10299 "./typica.w"
  4487. PackLayout::~PackLayout()
  4488. {
  4489. QLayoutItem*item;
  4490. while((item= takeAt(0)))
  4491. {
  4492. delete item;
  4493. }
  4494. }
  4495. /*:412*//*413:*/
  4496. #line 10313 "./typica.w"
  4497. QLayoutItem*PackLayout::takeAt(int index)
  4498. {
  4499. if(index>=0&&index<itemList.size())
  4500. {
  4501. return itemList.takeAt(index);
  4502. }
  4503. else
  4504. {
  4505. return NULL;
  4506. }
  4507. }
  4508. /*:413*//*414:*/
  4509. #line 10329 "./typica.w"
  4510. QLayoutItem*PackLayout::itemAt(int index)const
  4511. {
  4512. if(index>=0&&index<itemList.size())
  4513. {
  4514. return itemList.at(index);
  4515. }
  4516. else
  4517. {
  4518. return NULL;
  4519. }
  4520. }
  4521. /*:414*//*415:*/
  4522. #line 10352 "./typica.w"
  4523. void PackLayout::addItem(QLayoutItem*item)
  4524. {
  4525. itemList.append(item);
  4526. }
  4527. /*:415*//*416:*/
  4528. #line 10360 "./typica.w"
  4529. int PackLayout::count()const
  4530. {
  4531. return itemList.size();
  4532. }
  4533. /*:416*//*417:*/
  4534. #line 10372 "./typica.w"
  4535. Qt::Orientations PackLayout::expandingDirections()const
  4536. {
  4537. return Qt::Vertical|Qt::Horizontal;
  4538. }
  4539. bool PackLayout::hasHeightForWidth()const
  4540. {
  4541. return false;
  4542. }
  4543. int PackLayout::heightForWidth(int width)const
  4544. {
  4545. return doLayout(QRect(0,0,width,0),true);
  4546. }
  4547. void PackLayout::setGeometry(const QRect&rect)
  4548. {
  4549. QLayout::setGeometry(rect);
  4550. doLayout(rect,false);
  4551. }
  4552. QSize PackLayout::sizeHint()const
  4553. {
  4554. return minimumSize();
  4555. }
  4556. /*:417*//*418:*/
  4557. #line 10403 "./typica.w"
  4558. void PackLayout::setOrientation(Qt::Orientations direction)
  4559. {
  4560. orientation= direction;
  4561. doLayout(geometry(),false);
  4562. }
  4563. /*:418*/
  4564. #line 786 "./typica.w"
  4565. /*420:*/
  4566. #line 10442 "./typica.w"
  4567. SceneButton::SceneButton():QGraphicsScene()
  4568. {
  4569. }
  4570. SceneButton::~SceneButton()
  4571. {
  4572. }
  4573. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  4574. {
  4575. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  4576. }
  4577. /*:420*/
  4578. #line 787 "./typica.w"
  4579. /*422:*/
  4580. #line 10488 "./typica.w"
  4581. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  4582. Qt::Orientations orientation,
  4583. QWidget*parent,Qt::WindowFlags f):
  4584. QWidget(parent,f),label(new QGraphicsView()),
  4585. scene(new SceneButton())
  4586. {
  4587. layout= new PackLayout(this);
  4588. layout->setOrientation(orientation);
  4589. /*423:*/
  4590. #line 10508 "./typica.w"
  4591. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4592. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4593. label->setFrameShape(QFrame::NoFrame);
  4594. label->setInteractive(true);
  4595. /*:423*/
  4596. #line 10497 "./typica.w"
  4597. /*424:*/
  4598. #line 10519 "./typica.w"
  4599. scene->setBackgroundBrush(Qt::cyan);
  4600. text= scene->addText(labeltext);
  4601. if(orientation==Qt::Horizontal)
  4602. {
  4603. text->rotate(270.0);
  4604. }
  4605. label->setScene(scene);
  4606. /*:424*/
  4607. #line 10498 "./typica.w"
  4608. /*425:*/
  4609. #line 10537 "./typica.w"
  4610. if(orientation==Qt::Horizontal)
  4611. {
  4612. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  4613. }
  4614. else
  4615. {
  4616. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  4617. }
  4618. label->centerOn(text);
  4619. /*:425*/
  4620. #line 10499 "./typica.w"
  4621. /*426:*/
  4622. #line 10552 "./typica.w"
  4623. layout->addWidget(label);
  4624. layout->addWidget(widget);
  4625. if(orientation==Qt::Horizontal)
  4626. {
  4627. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  4628. widget->sizeHint().height());
  4629. }
  4630. else
  4631. {
  4632. setMinimumSize(widget->sizeHint().width(),
  4633. widget->sizeHint().height()+label->sizeHint().height());
  4634. }
  4635. /*:426*/
  4636. #line 10500 "./typica.w"
  4637. }
  4638. /*:422*//*427:*/
  4639. #line 10569 "./typica.w"
  4640. void WidgetDecorator::setBackgroundBrush(QBrush background)
  4641. {
  4642. scene->setBackgroundBrush(background);
  4643. }
  4644. void WidgetDecorator::setTextColor(QColor color)
  4645. {
  4646. text->setDefaultTextColor(color);
  4647. }
  4648. /*:427*//*428:*/
  4649. #line 10582 "./typica.w"
  4650. WidgetDecorator::~WidgetDecorator()
  4651. {
  4652. }
  4653. /*:428*/
  4654. #line 788 "./typica.w"
  4655. /*433:*/
  4656. #line 10681 "./typica.w"
  4657. void LogEditWindow::addTheRows()
  4658. {
  4659. QTime s= startTime->time();
  4660. while(s<endTime->time())
  4661. {
  4662. model->newMeasurement(Measurement(0,s),1);
  4663. s= s.addSecs(interval->value());
  4664. }
  4665. model->newMeasurement(Measurement(0,endTime->time()),1);
  4666. }
  4667. /*:433*//*434:*/
  4668. #line 10695 "./typica.w"
  4669. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  4670. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  4671. addRowsLayout(new QHBoxLayout(NULL)),
  4672. startTimeLabel(new QLabel("Start Time")),
  4673. startTime(new QTimeEdit(QTime(0,0,0,0))),
  4674. endTimeLabel(new QLabel("End Time")),
  4675. endTime(new QTimeEdit(QTime(0,20,0,0))),
  4676. intervalLabel(new QLabel("Interval (seconds)")),
  4677. interval(new QSpinBox()),
  4678. addRows(new QPushButton("Add Rows")),
  4679. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  4680. saveCsv(new QAction(tr("Export CSV"),NULL)),
  4681. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  4682. model(new MeasurementModel()),
  4683. log(new QTableView())
  4684. {
  4685. /*435:*/
  4686. #line 10732 "./typica.w"
  4687. QSettings settings;
  4688. resize(settings.value("logSize",QSize(620,400)).toSize());
  4689. move(settings.value("logPos",QPoint(200,60)).toPoint());
  4690. /*:435*/
  4691. #line 10712 "./typica.w"
  4692. /*436:*/
  4693. #line 10745 "./typica.w"
  4694. mainLayout->setOrientation(Qt::Vertical);
  4695. addRowsLayout->addSpacing(10);
  4696. addRowsLayout->addWidget(startTimeLabel);
  4697. addRowsLayout->addWidget(startTime);
  4698. addRowsLayout->addSpacing(10);
  4699. startTime->setDisplayFormat("mm:ss");
  4700. addRowsLayout->addWidget(endTimeLabel);
  4701. addRowsLayout->addWidget(endTime);
  4702. addRowsLayout->addSpacing(10);
  4703. endTime->setDisplayFormat("mm:ss");
  4704. addRowsLayout->addWidget(intervalLabel);
  4705. addRowsLayout->addWidget(interval);
  4706. addRowsLayout->addSpacing(10);
  4707. interval->setRange(0,60);
  4708. interval->setValue(30);
  4709. addRowsLayout->addWidget(addRows);
  4710. addRowsLayout->addSpacing(10);
  4711. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  4712. /*:436*/
  4713. #line 10713 "./typica.w"
  4714. /*437:*/
  4715. #line 10768 "./typica.w"
  4716. model->setHeaderData(0,Qt::Horizontal,"Time");
  4717. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  4718. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  4719. model->clear();
  4720. /*:437*/
  4721. #line 10714 "./typica.w"
  4722. /*438:*/
  4723. #line 10777 "./typica.w"
  4724. log->setModel(model);
  4725. log->setColumnWidth(0,100);
  4726. log->setColumnWidth(1,100);
  4727. log->setColumnWidth(2,100);
  4728. /*:438*/
  4729. #line 10715 "./typica.w"
  4730. mainLayout->addItem(addRowsLayout);
  4731. mainLayout->addWidget(log);
  4732. centralWidget->setLayout(mainLayout);
  4733. setCentralWidget(centralWidget);
  4734. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  4735. fileMenu->addAction(openXml);
  4736. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  4737. fileMenu->addAction(saveXml);
  4738. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  4739. fileMenu->addAction(saveCsv);
  4740. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  4741. }
  4742. /*:434*//*439:*/
  4743. #line 10788 "./typica.w"
  4744. void LogEditWindow::saveXML()
  4745. {
  4746. QSettings settings;
  4747. QString lastDir= settings.value("lastDirectory").toString();
  4748. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  4749. lastDir,"",0);
  4750. QFile file(filename);
  4751. XMLOutput writer(model,&file,0);
  4752. writer.addTemperatureColumn("Temperature",1);
  4753. writer.addAnnotationColumn("Annotation",2);
  4754. if(writer.output())
  4755. {
  4756. QFileInfo info(filename);
  4757. QDir directory= info.dir();
  4758. lastDir= directory.path();
  4759. settings.setValue("lastDirectory",lastDir);
  4760. }
  4761. }
  4762. void LogEditWindow::saveCSV()
  4763. {
  4764. QSettings settings;
  4765. QString lastDir= settings.value("lastDirectory").toString();
  4766. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  4767. lastDir,"",0);
  4768. QFile file(filename);
  4769. CSVOutput writer(model,&file,0);
  4770. writer.addTemperatureColumn("Temperature",1);
  4771. writer.addAnnotationColumn("Annotation",2);
  4772. if(writer.output())
  4773. {
  4774. QFileInfo info(filename);
  4775. QDir directory= info.dir();
  4776. lastDir= directory.path();
  4777. settings.setValue("lastDirectory",lastDir);
  4778. }
  4779. }
  4780. /*:439*//*440:*/
  4781. #line 10831 "./typica.w"
  4782. void LogEditWindow::openXML()
  4783. {
  4784. QSettings settings;
  4785. QString lastDir= settings.value("lastDirectory").toString();
  4786. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  4787. lastDir,"",0);
  4788. if(filename.isNull())
  4789. {
  4790. return;
  4791. }
  4792. QFile file(filename);
  4793. XMLInput reader(&file,1);
  4794. connect(&reader,SIGNAL(measure(Measurement,int)),
  4795. model,SLOT(newMeasurement(Measurement,int)));
  4796. connect(&reader,SIGNAL(annotation(QString,int,int)),
  4797. model,SLOT(newAnnotation(QString,int,int)));
  4798. if(reader.input())
  4799. {
  4800. QFileInfo info(filename);
  4801. setWindowTitle(QString(tr("%1 - %2")).
  4802. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  4803. QDir directory= info.dir();
  4804. lastDir= directory.path();
  4805. settings.setValue("lastDirectory",lastDir);
  4806. }
  4807. }
  4808. /*:440*//*441:*/
  4809. #line 10862 "./typica.w"
  4810. void LogEditWindow::closeEvent(QCloseEvent*event)
  4811. {
  4812. QSettings settings;
  4813. settings.setValue("logSize",size());
  4814. settings.setValue("logPos",pos());
  4815. event->accept();
  4816. }
  4817. /*:441*/
  4818. #line 789 "./typica.w"
  4819. /*447:*/
  4820. #line 10975 "./typica.w"
  4821. bool XMLOutput::output()
  4822. {
  4823. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  4824. {
  4825. return false;
  4826. }
  4827. QXmlStreamWriter xmlout(out);
  4828. xmlout.writeStartDocument("1.0");
  4829. xmlout.writeDTD("<!DOCTYPE roastlog2.0>");
  4830. xmlout.writeStartElement("roastlog");
  4831. /*448:*/
  4832. #line 11008 "./typica.w"
  4833. foreach(int c,temperatureColumns.keys())
  4834. {
  4835. xmlout.writeStartElement("tempseries");
  4836. xmlout.writeAttribute("name",temperatureColumns.value(c));
  4837. xmlout.writeEndElement();
  4838. }
  4839. foreach(int c,annotationColumns.keys())
  4840. {
  4841. xmlout.writeStartElement("noteseries");
  4842. xmlout.writeAttribute("name",annotationColumns.value(c));
  4843. xmlout.writeEndElement();
  4844. }
  4845. /*:448*/
  4846. #line 10986 "./typica.w"
  4847. xmlout.writeStartElement("roast");
  4848. bool oresult;
  4849. for(int i= 0;i<data->rowCount();i++)
  4850. {
  4851. /*449:*/
  4852. #line 11027 "./typica.w"
  4853. oresult= false;
  4854. foreach(int c,temperatureColumns.keys())
  4855. {
  4856. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4857. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4858. {
  4859. oresult= true;
  4860. break;
  4861. }
  4862. }
  4863. if(oresult==false)
  4864. {
  4865. foreach(int c,annotationColumns.keys())
  4866. {
  4867. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4868. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  4869. isEmpty()))
  4870. {
  4871. oresult= true;
  4872. break;
  4873. }
  4874. }
  4875. }
  4876. /*:449*/
  4877. #line 10991 "./typica.w"
  4878. if(oresult)
  4879. {
  4880. /*450:*/
  4881. #line 11057 "./typica.w"
  4882. xmlout.writeStartElement("tuple");
  4883. xmlout.writeTextElement("time",data->data(data->index(i,time),
  4884. Qt::DisplayRole).toString());
  4885. foreach(int c,temperatureColumns.keys())
  4886. {
  4887. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4888. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4889. {
  4890. xmlout.writeStartElement("temperature");
  4891. xmlout.writeAttribute("series",temperatureColumns.value(c));
  4892. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4893. toString());
  4894. xmlout.writeEndElement();
  4895. }
  4896. }
  4897. foreach(int c,annotationColumns.keys())
  4898. {
  4899. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4900. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4901. {
  4902. xmlout.writeStartElement("annotation");
  4903. xmlout.writeAttribute("series",annotationColumns.value(c));
  4904. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4905. toString());
  4906. xmlout.writeEndElement();
  4907. }
  4908. }
  4909. xmlout.writeEndElement();
  4910. /*:450*/
  4911. #line 10994 "./typica.w"
  4912. }
  4913. }
  4914. xmlout.writeEndElement();
  4915. xmlout.writeEndElement();
  4916. xmlout.writeEndDocument();
  4917. out->close();
  4918. return true;
  4919. }
  4920. /*:447*//*451:*/
  4921. #line 11089 "./typica.w"
  4922. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  4923. :QObject(NULL),data(model),out(device),time(timec)
  4924. {
  4925. }
  4926. void XMLOutput::setModel(MeasurementModel*model)
  4927. {
  4928. data= model;
  4929. }
  4930. void XMLOutput::setTimeColumn(int column)
  4931. {
  4932. time= column;
  4933. }
  4934. void XMLOutput::setDevice(QIODevice*device)
  4935. {
  4936. out= device;
  4937. }
  4938. /*:451*//*452:*/
  4939. #line 11118 "./typica.w"
  4940. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  4941. {
  4942. temperatureColumns.insert(column,series);
  4943. }
  4944. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  4945. {
  4946. annotationColumns.insert(column,series);
  4947. }
  4948. /*:452*/
  4949. #line 790 "./typica.w"
  4950. /*454:*/
  4951. #line 11170 "./typica.w"
  4952. bool XMLInput::input()
  4953. {
  4954. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  4955. {
  4956. return false;
  4957. }
  4958. QXmlStreamReader xmlin(in);
  4959. QMap<QString,int> temperatureColumns;
  4960. QMap<QString,int> annotationColumns;
  4961. int nextColumn= firstc;
  4962. /*455:*/
  4963. #line 11201 "./typica.w"
  4964. while(!xmlin.isDTD())
  4965. {
  4966. xmlin.readNext();
  4967. }
  4968. if(xmlin.isDTD())
  4969. {
  4970. if(xmlin.text()=="<!DOCTYPE roastlog>")
  4971. {
  4972. /*456:*/
  4973. #line 11223 "./typica.w"
  4974. emit newTemperatureColumn(firstc,"Bean");
  4975. emit newAnnotationColumn(firstc+1,"Note");
  4976. emit lastColumn(firstc+1);
  4977. /*:456*/
  4978. #line 11210 "./typica.w"
  4979. }
  4980. else
  4981. {
  4982. xmlin.readNext();
  4983. /*457:*/
  4984. #line 11232 "./typica.w"
  4985. while(xmlin.name()!="roast")
  4986. {
  4987. if(xmlin.isStartElement())
  4988. {
  4989. if(xmlin.name()=="tempseries")
  4990. {
  4991. temperatureColumns.insert(xmlin.attributes().value("name").
  4992. toString(),
  4993. nextColumn);
  4994. emit newTemperatureColumn(nextColumn,
  4995. xmlin.attributes().value("name").
  4996. toString());
  4997. nextColumn++;
  4998. }
  4999. else if(xmlin.name()=="noteseries")
  5000. {
  5001. annotationColumns.insert(xmlin.attributes().value("name").
  5002. toString(),nextColumn);
  5003. emit newAnnotationColumn(nextColumn,
  5004. xmlin.attributes().value("name").
  5005. toString());
  5006. nextColumn++;
  5007. }
  5008. }
  5009. xmlin.readNext();
  5010. }
  5011. emit lastColumn(nextColumn-1);
  5012. /*:457*/
  5013. #line 11215 "./typica.w"
  5014. }
  5015. }
  5016. /*:455*/
  5017. #line 11181 "./typica.w"
  5018. QTime timeval= QTime();
  5019. double tempval= 0;
  5020. QString noteval= QString();
  5021. int column;
  5022. int counter= 0;
  5023. while(!xmlin.atEnd())
  5024. {
  5025. /*458:*/
  5026. #line 11273 "./typica.w"
  5027. xmlin.readNext();
  5028. if(xmlin.isStartElement())
  5029. {
  5030. /*459:*/
  5031. #line 11299 "./typica.w"
  5032. if(xmlin.name()=="time")
  5033. {
  5034. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5035. }
  5036. else if(xmlin.name()=="temperature")
  5037. {
  5038. column= xmlin.attributes().value("series").toString().isEmpty()?
  5039. firstc:temperatureColumns.value(xmlin.attributes().
  5040. value("series").toString());
  5041. tempval= xmlin.readElementText().toDouble();
  5042. Measurement measurement(tempval,timeval);
  5043. emit measure(measurement,column);
  5044. }
  5045. else if(xmlin.name()=="annotation")
  5046. {
  5047. column= xmlin.attributes().value("series").toString().isEmpty()?
  5048. firstc+1:annotationColumns.value(xmlin.attributes().
  5049. value("series").toString());
  5050. noteval= xmlin.readElementText();
  5051. if(!noteval.isEmpty())
  5052. {
  5053. emit annotation(noteval,firstc,column);
  5054. }
  5055. }
  5056. /*:459*/
  5057. #line 11277 "./typica.w"
  5058. }
  5059. counter++;
  5060. if(counter%100==0)
  5061. {
  5062. QCoreApplication::processEvents();
  5063. }
  5064. /*:458*/
  5065. #line 11189 "./typica.w"
  5066. }
  5067. return true;
  5068. }
  5069. /*:454*//*460:*/
  5070. #line 11327 "./typica.w"
  5071. XMLInput::XMLInput(QIODevice*input,int c):
  5072. firstc(c),in(input)
  5073. {
  5074. }
  5075. void XMLInput::setFirstColumn(int column)
  5076. {
  5077. firstc= column;
  5078. }
  5079. void XMLInput::setDevice(QIODevice*device)
  5080. {
  5081. in= device;
  5082. }
  5083. /*:460*/
  5084. #line 791 "./typica.w"
  5085. /*465:*/
  5086. #line 11416 "./typica.w"
  5087. bool CSVOutput::output()
  5088. {
  5089. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5090. {
  5091. return false;
  5092. }
  5093. QTextStream output(out);
  5094. /*466:*/
  5095. #line 11440 "./typica.w"
  5096. output<<"Time";
  5097. foreach(int c,temperatureColumns.keys())
  5098. {
  5099. output<<','<<temperatureColumns.value(c);
  5100. }
  5101. foreach(int c,annotationColumns.keys())
  5102. {
  5103. output<<','<<annotationColumns.value(c);
  5104. }
  5105. output<<'\n';
  5106. /*:466*/
  5107. #line 11424 "./typica.w"
  5108. bool oresult;
  5109. for(int i= 0;i<data->rowCount();i++)
  5110. {
  5111. /*449:*/
  5112. #line 11027 "./typica.w"
  5113. oresult= false;
  5114. foreach(int c,temperatureColumns.keys())
  5115. {
  5116. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5117. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5118. {
  5119. oresult= true;
  5120. break;
  5121. }
  5122. }
  5123. if(oresult==false)
  5124. {
  5125. foreach(int c,annotationColumns.keys())
  5126. {
  5127. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5128. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5129. isEmpty()))
  5130. {
  5131. oresult= true;
  5132. break;
  5133. }
  5134. }
  5135. }
  5136. /*:449*/
  5137. #line 11428 "./typica.w"
  5138. if(oresult)
  5139. {
  5140. /*467:*/
  5141. #line 11461 "./typica.w"
  5142. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  5143. foreach(int c,temperatureColumns.keys())
  5144. {
  5145. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5146. }
  5147. foreach(int c,annotationColumns.keys())
  5148. {
  5149. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5150. }
  5151. output<<'\n';
  5152. /*:467*/
  5153. #line 11431 "./typica.w"
  5154. }
  5155. }
  5156. out->close();
  5157. return true;
  5158. }
  5159. /*:465*//*468:*/
  5160. #line 11476 "./typica.w"
  5161. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  5162. data(model),out(device),time(timec)
  5163. {
  5164. }
  5165. void CSVOutput::setModel(MeasurementModel*model)
  5166. {
  5167. data= model;
  5168. }
  5169. void CSVOutput::setTimeColumn(int column)
  5170. {
  5171. time= column;
  5172. }
  5173. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  5174. {
  5175. temperatureColumns.insert(column,series);
  5176. }
  5177. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  5178. {
  5179. annotationColumns.insert(column,series);
  5180. }
  5181. void CSVOutput::setDevice(QIODevice*device)
  5182. {
  5183. out= device;
  5184. }
  5185. /*:468*/
  5186. #line 792 "./typica.w"
  5187. /*487:*/
  5188. #line 11858 "./typica.w"
  5189. QString SaltModel::arrayLiteral(int column,int role)const
  5190. {
  5191. QString literal= "'{";
  5192. for(int i= 0;i<rowCount();i++)
  5193. {
  5194. QString datum= data(index(i,column),role).toString();
  5195. if(!datum.isEmpty())
  5196. {
  5197. literal.append(datum);
  5198. literal.append(", ");
  5199. }
  5200. }
  5201. if(literal.size()> 2)
  5202. {
  5203. literal.chop(2);
  5204. }
  5205. literal.append("}'");
  5206. return literal;
  5207. }
  5208. QString SaltModel::quotedArrayLiteral(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("\"");
  5217. literal.append(datum);
  5218. literal.append("\", ");
  5219. }
  5220. }
  5221. if(literal.size()> 2)
  5222. {
  5223. literal.chop(2);
  5224. }
  5225. literal.append("}'");
  5226. return literal;
  5227. }
  5228. /*:487*//*488:*/
  5229. #line 11902 "./typica.w"
  5230. QModelIndex SaltModel::parent(const QModelIndex&)const
  5231. {
  5232. return QModelIndex();
  5233. }
  5234. /*:488*//*489:*/
  5235. #line 11921 "./typica.w"
  5236. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  5237. int role)
  5238. {
  5239. /*490:*/
  5240. #line 11952 "./typica.w"
  5241. bool valid= false;
  5242. if(index.isValid())
  5243. {
  5244. if(index.row()<modelData.size())
  5245. {
  5246. if(index.column()<colcount)
  5247. {
  5248. valid= true;
  5249. }
  5250. }
  5251. }
  5252. /*:490*/
  5253. #line 11925 "./typica.w"
  5254. if(!valid)
  5255. {
  5256. return false;
  5257. }
  5258. if(index.row()==modelData.size()-1)
  5259. {
  5260. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  5261. /*491:*/
  5262. #line 11968 "./typica.w"
  5263. QList<QMap<int,QVariant> > newRow;
  5264. QMap<int,QVariant> defaults;
  5265. for(int i= 0;i<colcount;i++)
  5266. {
  5267. newRow.append(defaults);
  5268. }
  5269. modelData.append(newRow);
  5270. /*:491*/
  5271. #line 11933 "./typica.w"
  5272. endInsertRows();
  5273. }
  5274. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5275. QMap<int,QVariant> cell= row.at(index.column());
  5276. cell.insert(role,value);
  5277. if(role==Qt::EditRole)
  5278. {
  5279. cell.insert(Qt::DisplayRole,value);
  5280. }
  5281. row.replace(index.column(),cell);
  5282. modelData.replace(index.row(),row);
  5283. emit dataChanged(index,index);
  5284. return true;
  5285. }
  5286. /*:489*//*492:*/
  5287. #line 11979 "./typica.w"
  5288. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  5289. {
  5290. for(int i= 0;i<columns;i++)
  5291. {
  5292. hData<<"";
  5293. }
  5294. /*491:*/
  5295. #line 11968 "./typica.w"
  5296. QList<QMap<int,QVariant> > newRow;
  5297. QMap<int,QVariant> defaults;
  5298. for(int i= 0;i<colcount;i++)
  5299. {
  5300. newRow.append(defaults);
  5301. }
  5302. modelData.append(newRow);
  5303. /*:491*/
  5304. #line 11986 "./typica.w"
  5305. }
  5306. /*:492*//*493:*/
  5307. #line 11991 "./typica.w"
  5308. SaltModel::~SaltModel()
  5309. {
  5310. }
  5311. /*:493*//*494:*/
  5312. #line 12001 "./typica.w"
  5313. int SaltModel::rowCount(const QModelIndex&parent)const
  5314. {
  5315. return(parent==QModelIndex()?modelData.size():0);
  5316. }
  5317. int SaltModel::columnCount(const QModelIndex&parent)const
  5318. {
  5319. return(parent==QModelIndex()?colcount:0);
  5320. }
  5321. /*:494*//*495:*/
  5322. #line 12014 "./typica.w"
  5323. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  5324. const QVariant&value,int)
  5325. {
  5326. if(orientation==Qt::Horizontal&&section<colcount)
  5327. {
  5328. hData.replace(section,value.toString());
  5329. emit headerDataChanged(orientation,section,section);
  5330. return true;
  5331. }
  5332. return false;
  5333. }
  5334. /*:495*//*496:*/
  5335. #line 12029 "./typica.w"
  5336. QVariant SaltModel::data(const QModelIndex&index,int role)const
  5337. {
  5338. /*490:*/
  5339. #line 11952 "./typica.w"
  5340. bool valid= false;
  5341. if(index.isValid())
  5342. {
  5343. if(index.row()<modelData.size())
  5344. {
  5345. if(index.column()<colcount)
  5346. {
  5347. valid= true;
  5348. }
  5349. }
  5350. }
  5351. /*:490*/
  5352. #line 12032 "./typica.w"
  5353. if(!valid)
  5354. {
  5355. return QVariant();
  5356. }
  5357. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5358. QMap<int,QVariant> cell= row.at(index.column());
  5359. return cell.value(role,QVariant());
  5360. }
  5361. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  5362. int role)const
  5363. {
  5364. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  5365. section<colcount)
  5366. {
  5367. return QVariant(hData.at(section));
  5368. }
  5369. return QVariant();
  5370. }
  5371. /*:496*//*497:*/
  5372. #line 12056 "./typica.w"
  5373. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  5374. {
  5375. /*490:*/
  5376. #line 11952 "./typica.w"
  5377. bool valid= false;
  5378. if(index.isValid())
  5379. {
  5380. if(index.row()<modelData.size())
  5381. {
  5382. if(index.column()<colcount)
  5383. {
  5384. valid= true;
  5385. }
  5386. }
  5387. }
  5388. /*:490*/
  5389. #line 12059 "./typica.w"
  5390. if(valid)
  5391. {
  5392. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5393. }
  5394. return 0;
  5395. }
  5396. /*:497*//*498:*/
  5397. #line 12070 "./typica.w"
  5398. QModelIndex SaltModel::index(int row,int column,
  5399. const QModelIndex&parent)const
  5400. {
  5401. if(parent==QModelIndex())
  5402. {
  5403. if(row<modelData.size()&&column<colcount)
  5404. {
  5405. return createIndex(row,column);
  5406. }
  5407. }
  5408. return QModelIndex();
  5409. }
  5410. /*:498*/
  5411. #line 793 "./typica.w"
  5412. /*500:*/
  5413. #line 12125 "./typica.w"
  5414. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  5415. {
  5416. SqlComboBox*widget= new SqlComboBox();
  5417. widget->setParent(parent);
  5418. for(int i= 0;i<count();i++)
  5419. {
  5420. widget->addItem(itemText(i),itemData(i));
  5421. }
  5422. return widget;
  5423. }
  5424. /*:500*//*501:*/
  5425. #line 12142 "./typica.w"
  5426. void SqlComboBox::showData(bool show)
  5427. {
  5428. dataColumnShown= show;
  5429. }
  5430. /*:501*//*502:*/
  5431. #line 12153 "./typica.w"
  5432. void SqlComboBox::addNullOption()
  5433. {
  5434. addItem(tr("Unknown"),QVariant(QVariant::String));
  5435. }
  5436. /*:502*//*503:*/
  5437. #line 12166 "./typica.w"
  5438. void SqlComboBox::setDataColumn(int column)
  5439. {
  5440. dataColumn= column;
  5441. }
  5442. void SqlComboBox::setDisplayColumn(int column)
  5443. {
  5444. displayColumn= column;
  5445. }
  5446. /*:503*//*504:*/
  5447. #line 12180 "./typica.w"
  5448. void SqlComboBox::addSqlOptions(QString query)
  5449. {
  5450. SqlQueryConnection*dbquery= new SqlQueryConnection;
  5451. if(!dbquery->exec(query))
  5452. {
  5453. QSqlError error= dbquery->lastError();
  5454. qDebug()<<error.databaseText();
  5455. qDebug()<<error.driverText();
  5456. qDebug()<<error.text();
  5457. qDebug()<<dbquery->lastQuery();
  5458. }
  5459. while(dbquery->next())
  5460. {
  5461. QString displayValue(dbquery->value(displayColumn).toString());
  5462. QString dataValue(dbquery->value(dataColumn).toString());
  5463. if(dataColumnShown)
  5464. {
  5465. displayValue.append(QString(" (%1)").arg(dataValue));
  5466. }
  5467. addItem(displayValue,dataValue);
  5468. }
  5469. delete dbquery;
  5470. }
  5471. /*:504*//*505:*/
  5472. #line 12209 "./typica.w"
  5473. SqlComboBox::SqlComboBox():
  5474. dataColumn(0),displayColumn(0),dataColumnShown(false)
  5475. {
  5476. }
  5477. SqlComboBox::~SqlComboBox()
  5478. {
  5479. }
  5480. /*:505*/
  5481. #line 794 "./typica.w"
  5482. /*507:*/
  5483. #line 12247 "./typica.w"
  5484. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  5485. {
  5486. delegate= widget;
  5487. }
  5488. /*:507*//*508:*/
  5489. #line 12256 "./typica.w"
  5490. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  5491. const QStyleOptionViewItem&,
  5492. const QModelIndex&)const
  5493. {
  5494. return delegate->clone(parent);
  5495. }
  5496. /*:508*//*509:*/
  5497. #line 12267 "./typica.w"
  5498. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  5499. const QModelIndex&index)const
  5500. {
  5501. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5502. self->setCurrentIndex(self->findData(
  5503. index.model()->data(index,
  5504. Qt::UserRole).toString()));
  5505. }
  5506. /*:509*//*510:*/
  5507. #line 12280 "./typica.w"
  5508. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  5509. QAbstractItemModel*model,
  5510. const QModelIndex&index)const
  5511. {
  5512. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5513. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  5514. Qt::UserRole);
  5515. model->setData(index,self->currentText(),Qt::DisplayRole);
  5516. }
  5517. /*:510*//*511:*/
  5518. #line 12293 "./typica.w"
  5519. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  5520. const QStyleOptionViewItem&option,
  5521. const QModelIndex&)const
  5522. {
  5523. editor->setGeometry(option.rect);
  5524. }
  5525. /*:511*//*512:*/
  5526. #line 12304 "./typica.w"
  5527. QSize SqlComboBoxDelegate::sizeHint()const
  5528. {
  5529. return delegate->sizeHint();
  5530. }
  5531. /*:512*//*513:*/
  5532. #line 12312 "./typica.w"
  5533. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  5534. :QItemDelegate(parent)
  5535. {
  5536. }
  5537. /*:513*/
  5538. #line 795 "./typica.w"
  5539. /*479:*/
  5540. #line 11672 "./typica.w"
  5541. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  5542. {
  5543. /*480:*/
  5544. #line 11687 "./typica.w"
  5545. setOrganizationName("Wilson's Coffee & Tea");
  5546. setOrganizationDomain("wilsonscoffee.com");
  5547. setApplicationName(PROGRAM_NAME);
  5548. /*:480*/
  5549. #line 11675 "./typica.w"
  5550. /*481:*/
  5551. #line 11696 "./typica.w"
  5552. QTranslator base;
  5553. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  5554. {
  5555. installTranslator(&base);
  5556. }
  5557. QTranslator app;
  5558. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  5559. {
  5560. installTranslator(&app);
  5561. }
  5562. /*:481*/
  5563. #line 11676 "./typica.w"
  5564. /*219:*/
  5565. #line 5731 "./typica.w"
  5566. qRegisterMetaType<Measurement> ("Measurement");
  5567. /*:219*/
  5568. #line 11677 "./typica.w"
  5569. /*658:*/
  5570. #line 15392 "./typica.w"
  5571. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  5572. tr("NI DAQmx Base"),
  5573. "nidaqmxbase",NULL);
  5574. topLevelNodeInserters.append(inserter);
  5575. /*:658*//*666:*/
  5576. #line 15609 "./typica.w"
  5577. #ifdef Q_OS_WIN32
  5578. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  5579. topLevelNodeInserters.append(inserter);
  5580. #endif
  5581. /*:666*//*690:*/
  5582. #line 16568 "./typica.w"
  5583. #if 0
  5584. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  5585. topLevelNodeInserters.append(inserter);
  5586. #endif
  5587. /*:690*//*719:*/
  5588. #line 18018 "./typica.w"
  5589. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  5590. topLevelNodeInserters.append(inserter);
  5591. /*:719*/
  5592. #line 11678 "./typica.w"
  5593. }
  5594. /*:479*//*483:*/
  5595. #line 11719 "./typica.w"
  5596. QDomDocument*Application::configuration()
  5597. {
  5598. return&conf;
  5599. }
  5600. /*:483*//*484:*/
  5601. #line 11728 "./typica.w"
  5602. QSqlDatabase Application::database()
  5603. {
  5604. QString connectionName;
  5605. QSqlDatabase connection= QSqlDatabase::database();
  5606. do
  5607. {
  5608. connectionName= QUuid::createUuid().toString();
  5609. }while(QSqlDatabase::connectionNames().contains(connectionName));
  5610. return QSqlDatabase::cloneDatabase(connection,connectionName);
  5611. }
  5612. /*:484*//*594:*/
  5613. #line 14047 "./typica.w"
  5614. void Application::saveDeviceConfiguration()
  5615. {
  5616. QSettings settings;
  5617. settings.setValue("DeviceConfiguration",
  5618. QVariant(deviceConfigurationDocument.toByteArray()));
  5619. }
  5620. /*:594*//*595:*/
  5621. #line 14059 "./typica.w"
  5622. QDomDocument Application::deviceConfiguration()
  5623. {
  5624. if(deviceConfigurationDocument.isNull())
  5625. {
  5626. /*596:*/
  5627. #line 14073 "./typica.w"
  5628. QSettings settings;
  5629. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  5630. QString etext;
  5631. int eline;
  5632. int ecol;
  5633. if(document.length()==0)
  5634. {
  5635. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  5636. /*597:*/
  5637. #line 14097 "./typica.w"
  5638. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5639. emptyDocument.open(QIODevice::ReadOnly);
  5640. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5641. &etext,&eline,&ecol))
  5642. {
  5643. /*598:*/
  5644. #line 14114 "./typica.w"
  5645. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5646. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5647. qDebug()<<etext;
  5648. /*:598*/
  5649. #line 14103 "./typica.w"
  5650. }
  5651. else
  5652. {
  5653. saveDeviceConfiguration();
  5654. }
  5655. /*:597*/
  5656. #line 14082 "./typica.w"
  5657. }
  5658. else
  5659. {
  5660. if(!deviceConfigurationDocument.setContent(document,false,
  5661. &etext,&eline,&ecol))
  5662. {
  5663. /*598:*/
  5664. #line 14114 "./typica.w"
  5665. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5666. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5667. qDebug()<<etext;
  5668. /*:598*/
  5669. #line 14089 "./typica.w"
  5670. /*597:*/
  5671. #line 14097 "./typica.w"
  5672. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5673. emptyDocument.open(QIODevice::ReadOnly);
  5674. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5675. &etext,&eline,&ecol))
  5676. {
  5677. /*598:*/
  5678. #line 14114 "./typica.w"
  5679. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5680. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5681. qDebug()<<etext;
  5682. /*:598*/
  5683. #line 14103 "./typica.w"
  5684. }
  5685. else
  5686. {
  5687. saveDeviceConfiguration();
  5688. }
  5689. /*:597*/
  5690. #line 14090 "./typica.w"
  5691. }
  5692. }
  5693. /*:596*/
  5694. #line 14064 "./typica.w"
  5695. }
  5696. return deviceConfigurationDocument;
  5697. }
  5698. /*:595*//*626:*/
  5699. #line 14715 "./typica.w"
  5700. void Application::registerDeviceConfigurationWidget(QString driver,
  5701. QMetaObject widget)
  5702. {
  5703. deviceConfigurationWidgets.insert(driver,widget);
  5704. }
  5705. /*:626*//*627:*/
  5706. #line 14731 "./typica.w"
  5707. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  5708. const QModelIndex&index)
  5709. {
  5710. QVariant nodeReference= index.data(Qt::UserRole);
  5711. QDomElement referenceElement= model->referenceElement(
  5712. model->data(index,Qt::UserRole).toString());
  5713. QMetaObject metaObject=
  5714. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  5715. QWidget::staticMetaObject);
  5716. QWidget*editor;
  5717. if(metaObject.className()==QWidget::staticMetaObject.className())
  5718. {
  5719. editor= NULL;
  5720. }
  5721. else
  5722. {
  5723. editor= qobject_cast<QWidget*> (
  5724. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  5725. Q_ARG(QModelIndex,index)));
  5726. }
  5727. return editor;
  5728. }
  5729. /*:627*/
  5730. #line 796 "./typica.w"
  5731. /*518:*/
  5732. #line 12407 "./typica.w"
  5733. SqlConnectionSetup::SqlConnectionSetup():
  5734. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  5735. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  5736. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  5737. cancelButton(new QPushButton(tr("Cancel"))),
  5738. connectButton(new QPushButton(tr("Connect")))
  5739. {
  5740. driver->addItem("PostgreSQL","QPSQL");
  5741. formLayout->addRow(tr("Database driver:"),driver);
  5742. formLayout->addRow(tr("Host name:"),hostname);
  5743. formLayout->addRow(tr("Database name:"),dbname);
  5744. formLayout->addRow(tr("User name:"),user);
  5745. password->setEchoMode(QLineEdit::Password);
  5746. formLayout->addRow(tr("Password:"),password);
  5747. layout->addLayout(formLayout);
  5748. buttons->addStretch(1);
  5749. buttons->addWidget(cancelButton);
  5750. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  5751. buttons->addWidget(connectButton);
  5752. layout->addLayout(buttons);
  5753. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  5754. setLayout(layout);
  5755. setModal(true);
  5756. }
  5757. SqlConnectionSetup::~SqlConnectionSetup()
  5758. {
  5759. }
  5760. /*:518*//*519:*/
  5761. #line 12441 "./typica.w"
  5762. void SqlConnectionSetup::testConnection()
  5763. {
  5764. QSqlDatabase database=
  5765. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  5766. toString());
  5767. database.setHostName(hostname->text());
  5768. database.setDatabaseName(dbname->text());
  5769. database.setUserName(user->text());
  5770. database.setPassword(password->text());
  5771. if(database.open())
  5772. {
  5773. QSettings settings;
  5774. settings.setValue("database/exists","true");
  5775. settings.setValue("database/driver",
  5776. driver->itemData(driver->currentIndex()).toString());
  5777. settings.setValue("database/hostname",hostname->text());
  5778. settings.setValue("database/dbname",dbname->text());
  5779. settings.setValue("database/user",user->text());
  5780. settings.setValue("database/password",password->text());
  5781. accept();
  5782. }
  5783. else
  5784. {
  5785. QMessageBox::information(this,tr("Database connection failed"),
  5786. tr("Failed to connect to database."));
  5787. }
  5788. }
  5789. /*:519*/
  5790. #line 797 "./typica.w"
  5791. /*523:*/
  5792. #line 12536 "./typica.w"
  5793. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  5794. {
  5795. setModel(new QSqlQueryModel);
  5796. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  5797. this,SLOT(openRow(QModelIndex)));
  5798. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  5799. this,SLOT(persistColumnResize(int,int,int)));
  5800. }
  5801. /*:523*//*524:*/
  5802. #line 12551 "./typica.w"
  5803. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  5804. {
  5805. /*525:*/
  5806. #line 12560 "./typica.w"
  5807. QSettings settings;
  5808. /*526:*/
  5809. #line 12573 "./typica.w"
  5810. QWidget*topLevelWidget= this;
  5811. while(topLevelWidget->parentWidget())
  5812. {
  5813. topLevelWidget= topLevelWidget->parentWidget();
  5814. }
  5815. /*:526*/
  5816. #line 12562 "./typica.w"
  5817. settings.setValue(QString("columnWidths/%1/%2/%3").
  5818. arg(topLevelWidget->objectName()).
  5819. arg(objectName()).arg(column),
  5820. QVariant(newsize));
  5821. /*:525*/
  5822. #line 12554 "./typica.w"
  5823. }
  5824. /*:524*//*527:*/
  5825. #line 12583 "./typica.w"
  5826. void SqlQueryView::showEvent(QShowEvent*event)
  5827. {
  5828. /*528:*/
  5829. #line 12593 "./typica.w"
  5830. QSettings settings;
  5831. /*526:*/
  5832. #line 12573 "./typica.w"
  5833. QWidget*topLevelWidget= this;
  5834. while(topLevelWidget->parentWidget())
  5835. {
  5836. topLevelWidget= topLevelWidget->parentWidget();
  5837. }
  5838. /*:526*/
  5839. #line 12595 "./typica.w"
  5840. QString baseKey=
  5841. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5842. arg(objectName());
  5843. for(int i= 0;i<model()->columnCount();i++)
  5844. {
  5845. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5846. if(settings.contains(key))
  5847. {
  5848. setColumnWidth(i,settings.value(key).toInt());
  5849. }
  5850. }
  5851. /*:528*/
  5852. #line 12586 "./typica.w"
  5853. event->accept();
  5854. }
  5855. /*:527*//*529:*/
  5856. #line 12610 "./typica.w"
  5857. void SqlQueryView::openRow(const QModelIndex&index)
  5858. {
  5859. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  5860. emit openEntryRow(index.row());
  5861. }
  5862. /*:529*//*530:*/
  5863. #line 12621 "./typica.w"
  5864. void SqlQueryView::setQuery(const QString&query)
  5865. {
  5866. QSqlDatabase database= AppInstance->database();
  5867. database.open();
  5868. QSqlQuery q(query,database);
  5869. ((QSqlQueryModel*)model())->setQuery(q);
  5870. }
  5871. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  5872. const QVariant&value,int role)
  5873. {
  5874. return model()->setHeaderData(section,orientation,value,role);
  5875. }
  5876. /*:530*//*531:*/
  5877. #line 12638 "./typica.w"
  5878. QVariant SqlQueryView::data(int row,int column,int role)
  5879. {
  5880. return model()->data(model()->index(row,column),role);
  5881. }
  5882. /*:531*/
  5883. #line 798 "./typica.w"
  5884. /*136:*/
  5885. #line 3276 "./typica.w"
  5886. SqlQueryConnection::SqlQueryConnection(const QString&query)
  5887. {
  5888. QSqlDatabase database= AppInstance->database();
  5889. database.open();
  5890. q= new QSqlQuery(query,database);
  5891. connection= database.connectionName();
  5892. }
  5893. /*:136*//*137:*/
  5894. #line 3289 "./typica.w"
  5895. SqlQueryConnection::~SqlQueryConnection()
  5896. {
  5897. delete q;
  5898. {
  5899. QSqlDatabase database= QSqlDatabase::database(connection);
  5900. database.close();
  5901. }
  5902. QSqlDatabase::removeDatabase(connection);
  5903. }
  5904. /*:137*//*138:*/
  5905. #line 3303 "./typica.w"
  5906. QSqlQuery*SqlQueryConnection::operator->()
  5907. {
  5908. return q;
  5909. }
  5910. /*:138*/
  5911. #line 799 "./typica.w"
  5912. /*550:*/
  5913. #line 12987 "./typica.w"
  5914. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  5915. area(frame),configuration(description)
  5916. {
  5917. refresh();
  5918. }
  5919. ReportTable::~ReportTable()
  5920. {
  5921. }
  5922. /*:550*//*551:*/
  5923. #line 13003 "./typica.w"
  5924. void ReportTable::bind(QString placeholder,QVariant value)
  5925. {
  5926. bindings.insert(placeholder,value);
  5927. }
  5928. /*:551*//*552:*/
  5929. #line 13013 "./typica.w"
  5930. void ReportTable::refresh()
  5931. {
  5932. /*553:*/
  5933. #line 13034 "./typica.w"
  5934. QTextCursor cursor= area->firstCursorPosition();
  5935. while(cursor<area->lastCursorPosition())
  5936. {
  5937. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  5938. }
  5939. cursor.removeSelectedText();
  5940. /*:553*/
  5941. #line 13016 "./typica.w"
  5942. int rows= 1;
  5943. int columns= 1;
  5944. int currentRow= 0;
  5945. QTextTable*table= cursor.insertTable(rows,columns);
  5946. /*554:*/
  5947. #line 13047 "./typica.w"
  5948. QTextTableFormat format= table->format();
  5949. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  5950. if(configuration.hasAttribute("align"))
  5951. {
  5952. if(configuration.attribute("align")=="center")
  5953. {
  5954. format.setAlignment(Qt::AlignHCenter);
  5955. }
  5956. }
  5957. table->setFormat(format);
  5958. /*:554*/
  5959. #line 13021 "./typica.w"
  5960. /*555:*/
  5961. #line 13061 "./typica.w"
  5962. QDomNodeList children= configuration.childNodes();
  5963. for(int i= 0;i<children.count();i++)
  5964. {
  5965. QDomNode current;
  5966. QDomElement currentElement;
  5967. current= children.at(i);
  5968. if(current.isElement())
  5969. {
  5970. currentElement= current.toElement();
  5971. if(currentElement.tagName()=="query")
  5972. {
  5973. /*556:*/
  5974. #line 13088 "./typica.w"
  5975. SqlQueryConnection query;
  5976. query.prepare(currentElement.text());
  5977. foreach(QString key,bindings.uniqueKeys())
  5978. {
  5979. if(currentElement.text().contains(key))
  5980. {
  5981. query.bindValue(key,bindings.value(key));
  5982. }
  5983. }
  5984. query.exec();
  5985. if(!query.next())
  5986. {
  5987. continue;
  5988. }
  5989. if(query.record().count()> columns)
  5990. {
  5991. table->appendColumns(query.record().count()-columns);
  5992. }
  5993. do
  5994. {
  5995. table->appendRows(1);
  5996. rows++;
  5997. currentRow++;
  5998. for(int j= 0;j<query.record().count();j++)
  5999. {
  6000. QTextTableCell cell= table->cellAt(currentRow,j);
  6001. cursor= cell.firstCursorPosition();
  6002. cursor.insertText(query.value(j).toString());
  6003. }
  6004. }while(query.next());
  6005. /*:556*/
  6006. #line 13073 "./typica.w"
  6007. }
  6008. else if(currentElement.tagName()=="row")
  6009. {
  6010. /*557:*/
  6011. #line 13127 "./typica.w"
  6012. table->appendRows(1);
  6013. currentRow++;
  6014. rows++;
  6015. QDomNodeList rowChildren= currentElement.childNodes();
  6016. int currentColumn= 0;
  6017. for(int j= 0;j<rowChildren.count();j++)
  6018. {
  6019. QDomNode node;
  6020. QDomElement nodeElement;
  6021. node= rowChildren.at(j);
  6022. if(node.isElement())
  6023. {
  6024. nodeElement= node.toElement();
  6025. if(nodeElement.tagName()=="cell")
  6026. {
  6027. if(currentColumn==columns)
  6028. {
  6029. table->appendColumns(1);
  6030. columns++;
  6031. }
  6032. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  6033. cursor= cell.firstCursorPosition();
  6034. cursor.insertText(nodeElement.text());
  6035. currentColumn++;
  6036. }
  6037. }
  6038. }
  6039. /*:557*/
  6040. #line 13077 "./typica.w"
  6041. }
  6042. }
  6043. }
  6044. /*:555*/
  6045. #line 13022 "./typica.w"
  6046. if(rows> 1)
  6047. {
  6048. table->removeRows(0,1);
  6049. }
  6050. }
  6051. /*:552*/
  6052. #line 800 "./typica.w"
  6053. /*562:*/
  6054. #line 13229 "./typica.w"
  6055. FormArray::FormArray(QDomElement description):configuration(description),
  6056. maxwidth(-1),maxheight(-1)
  6057. {
  6058. setWidget(&itemContainer);
  6059. itemContainer.setLayout(&itemLayout);
  6060. }
  6061. /*:562*//*563:*/
  6062. #line 13246 "./typica.w"
  6063. void FormArray::addElements(int copies)
  6064. {
  6065. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  6066. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  6067. QWidget*widget;
  6068. for(int i= 0;i<copies;i++)
  6069. {
  6070. widget= new QWidget;
  6071. if(maxwidth> -1)
  6072. {
  6073. widget->setMaximumWidth(maxwidth);
  6074. }
  6075. if(maxheight> -1)
  6076. {
  6077. widget->setMaximumHeight(maxheight);
  6078. }
  6079. if(configuration.hasChildNodes())
  6080. {
  6081. widgetStack->push(widget);
  6082. populateWidget(configuration,widgetStack,layoutStack);
  6083. widgetStack->pop();
  6084. widget->setMinimumHeight(widget->sizeHint().height());
  6085. itemLayout.addWidget(widget);
  6086. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  6087. {
  6088. itemContainer.setMinimumHeight(maxheight*elements()+50);
  6089. }
  6090. else
  6091. {
  6092. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  6093. +widget->sizeHint().height());
  6094. }
  6095. if(maxwidth> -1)
  6096. {
  6097. itemContainer.setMinimumWidth(maxwidth+50);
  6098. }
  6099. else
  6100. {
  6101. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  6102. }
  6103. }
  6104. }
  6105. }
  6106. /*:563*//*564:*/
  6107. #line 13296 "./typica.w"
  6108. QWidget*FormArray::elementAt(int index)
  6109. {
  6110. if(index<itemLayout.count())
  6111. {
  6112. QLayoutItem*item= itemLayout.itemAt(index);
  6113. return item->widget();
  6114. }
  6115. else
  6116. {
  6117. return NULL;
  6118. }
  6119. }
  6120. /*:564*//*565:*/
  6121. #line 13313 "./typica.w"
  6122. void FormArray::removeAllElements()
  6123. {
  6124. while(itemLayout.count()> 0)
  6125. {
  6126. QLayoutItem*item;
  6127. item= itemLayout.itemAt(0);
  6128. item->widget()->hide();
  6129. itemLayout.removeWidget(item->widget());
  6130. }
  6131. itemContainer.setMinimumHeight(0);
  6132. }
  6133. /*:565*//*566:*/
  6134. #line 13329 "./typica.w"
  6135. int FormArray::elements()
  6136. {
  6137. return itemLayout.count();
  6138. }
  6139. /*:566*//*567:*/
  6140. #line 13340 "./typica.w"
  6141. void FormArray::setMaximumElementWidth(int width)
  6142. {
  6143. maxwidth= width;
  6144. }
  6145. void FormArray::setMaximumElementHeight(int height)
  6146. {
  6147. maxheight= height;
  6148. }
  6149. /*:567*/
  6150. #line 801 "./typica.w"
  6151. /*573:*/
  6152. #line 13471 "./typica.w"
  6153. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  6154. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  6155. {
  6156. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  6157. QPointF(0,5);
  6158. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  6159. QPointF(10,5);
  6160. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  6161. QPointF(0,0);
  6162. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  6163. initialBrush.setColor(QColor(170,170,255));
  6164. initialBrush.setStyle(Qt::SolidPattern);
  6165. finalBrush.setColor(Qt::blue);
  6166. finalBrush.setStyle(Qt::SolidPattern);
  6167. initialDecrement.setPolygon(left);
  6168. initialDecrement.setBrush(initialBrush);
  6169. initialDecrement.setPos(0,0);
  6170. scene.addItem(&initialDecrement);
  6171. initialIncrement.setPolygon(right);
  6172. initialIncrement.setBrush(initialBrush);
  6173. initialIncrement.setPos(122,0);
  6174. scene.addItem(&initialIncrement);
  6175. finalDecrement.setPolygon(left);
  6176. finalDecrement.setBrush(finalBrush);
  6177. finalDecrement.setPos(0,12);
  6178. scene.addItem(&finalDecrement);
  6179. finalIncrement.setPolygon(right);
  6180. finalIncrement.setBrush(finalBrush);
  6181. finalIncrement.setPos(122,12);
  6182. scene.addItem(&finalIncrement);
  6183. scalePath.moveTo(0,10);
  6184. scalePath.lineTo(100,10);
  6185. scalePath.moveTo(0,0);
  6186. scalePath.lineTo(0,20);
  6187. scalePath.moveTo(10,5);
  6188. scalePath.lineTo(10,15);
  6189. scalePath.moveTo(20,5);
  6190. scalePath.lineTo(20,15);
  6191. scalePath.moveTo(30,5);
  6192. scalePath.lineTo(30,15);
  6193. scalePath.moveTo(40,5);
  6194. scalePath.lineTo(40,15);
  6195. scalePath.moveTo(50,0);
  6196. scalePath.lineTo(50,20);
  6197. scalePath.moveTo(60,5);
  6198. scalePath.lineTo(60,15);
  6199. scalePath.moveTo(70,5);
  6200. scalePath.lineTo(70,15);
  6201. scalePath.moveTo(80,5);
  6202. scalePath.lineTo(80,15);
  6203. scalePath.moveTo(90,5);
  6204. scalePath.lineTo(90,15);
  6205. scalePath.moveTo(100,0);
  6206. scalePath.lineTo(100,20);
  6207. scaleLine.setPath(scalePath);
  6208. scaleLine.setPos(16,1);
  6209. scene.addItem(&scaleLine);
  6210. setScene(&scene);
  6211. initialIndicator.setPolygon(down);
  6212. initialIndicator.setBrush(initialBrush);
  6213. finalIndicator.setPolygon(up);
  6214. finalIndicator.setBrush(finalBrush);
  6215. setMinimumSize(sizeHint());
  6216. setMaximumSize(sizeHint());
  6217. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6218. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6219. setMinimumSize(sizeHint());
  6220. }
  6221. /*:573*//*574:*/
  6222. #line 13544 "./typica.w"
  6223. QSize ScaleControl::sizeHint()const
  6224. {
  6225. return QSize(140,30);
  6226. }
  6227. /*:574*//*575:*/
  6228. #line 13553 "./typica.w"
  6229. void ScaleControl::setInitialValue(double value)
  6230. {
  6231. if(value>=0&&value<=10)
  6232. {
  6233. nonScoredValue= value;
  6234. if(!initialSet)
  6235. {
  6236. scene.addItem(&initialIndicator);
  6237. }
  6238. initialSet= true;
  6239. initialIndicator.setPos(value*10+16,10);
  6240. emit initialChanged(value);
  6241. if(!finalSet)
  6242. {
  6243. setFinalValue(value);
  6244. }
  6245. }
  6246. }
  6247. void ScaleControl::setFinalValue(double value)
  6248. {
  6249. if(value>=0&&value<=10)
  6250. {
  6251. scoredValue= value;
  6252. if(!finalSet)
  6253. {
  6254. scene.addItem(&finalIndicator);
  6255. }
  6256. finalSet= true;
  6257. finalIndicator.setPos(value*10+16,11);
  6258. emit finalChanged(value);
  6259. }
  6260. }
  6261. /*:575*//*576:*/
  6262. #line 13590 "./typica.w"
  6263. double ScaleControl::initialValue(void)
  6264. {
  6265. return nonScoredValue;
  6266. }
  6267. double ScaleControl::finalValue(void)
  6268. {
  6269. return scoredValue;
  6270. }
  6271. /*:576*//*577:*/
  6272. #line 13611 "./typica.w"
  6273. void ScaleControl::mousePressEvent(QMouseEvent*event)
  6274. {
  6275. /*578:*/
  6276. #line 13623 "./typica.w"
  6277. if(event->button()!=Qt::LeftButton)
  6278. {
  6279. event->ignore();
  6280. return;
  6281. }
  6282. /*:578*/
  6283. #line 13614 "./typica.w"
  6284. scaleDown= true;
  6285. event->accept();
  6286. }
  6287. /*:577*//*579:*/
  6288. #line 13634 "./typica.w"
  6289. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  6290. {
  6291. /*578:*/
  6292. #line 13623 "./typica.w"
  6293. if(event->button()!=Qt::LeftButton)
  6294. {
  6295. event->ignore();
  6296. return;
  6297. }
  6298. /*:578*/
  6299. #line 13637 "./typica.w"
  6300. if(!scaleDown)
  6301. {
  6302. event->ignore();
  6303. return;
  6304. }
  6305. scaleDown= false;
  6306. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6307. /*580:*/
  6308. #line 13659 "./typica.w"
  6309. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  6310. {
  6311. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6312. {
  6313. if(initialSet)
  6314. {
  6315. setInitialValue(nonScoredValue-0.05);
  6316. }
  6317. event->accept();
  6318. return;
  6319. }
  6320. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6321. {
  6322. if(finalSet)
  6323. {
  6324. setFinalValue(scoredValue-0.05);
  6325. event->accept();
  6326. return;
  6327. }
  6328. }
  6329. }
  6330. /*:580*/
  6331. #line 13645 "./typica.w"
  6332. /*581:*/
  6333. #line 13685 "./typica.w"
  6334. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  6335. {
  6336. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6337. {
  6338. if(initialSet)
  6339. {
  6340. setInitialValue(nonScoredValue+0.05);
  6341. event->accept();
  6342. return;
  6343. }
  6344. }
  6345. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6346. {
  6347. if(finalSet)
  6348. {
  6349. setFinalValue(scoredValue+0.05);
  6350. event->accept();
  6351. return;
  6352. }
  6353. }
  6354. }
  6355. /*:581*/
  6356. #line 13646 "./typica.w"
  6357. /*582:*/
  6358. #line 13711 "./typica.w"
  6359. double relativeX= sceneCoordinate.x()-16;
  6360. if(initialSet)
  6361. {
  6362. if(relativeX>=0&&relativeX<=100)
  6363. {
  6364. setFinalValue(relativeX/10.0);
  6365. event->accept();
  6366. return;
  6367. }
  6368. }
  6369. else
  6370. {
  6371. if(relativeX>=0&&relativeX<=100)
  6372. {
  6373. setInitialValue(relativeX/10.0);
  6374. event->accept();
  6375. return;
  6376. }
  6377. }
  6378. /*:582*/
  6379. #line 13647 "./typica.w"
  6380. event->ignore();
  6381. return;
  6382. }
  6383. /*:579*/
  6384. #line 802 "./typica.w"
  6385. /*584:*/
  6386. #line 13777 "./typica.w"
  6387. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  6388. valueSet(false),scaleDown(false)
  6389. {
  6390. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6391. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6392. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  6393. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  6394. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  6395. theBrush.setColor(Qt::blue);
  6396. theBrush.setStyle(Qt::SolidPattern);
  6397. increment.setPolygon(up);
  6398. increment.setBrush(theBrush);
  6399. increment.setPos(0,0);
  6400. scene.addItem(&increment);
  6401. decrement.setPolygon(down);
  6402. decrement.setBrush(theBrush);
  6403. decrement.setPos(0,122);
  6404. scene.addItem(&decrement);
  6405. scalePath.moveTo(5,0);
  6406. scalePath.lineTo(5,100);
  6407. scalePath.moveTo(0,0);
  6408. scalePath.lineTo(10,0);
  6409. scalePath.moveTo(0,10);
  6410. scalePath.lineTo(10,10);
  6411. scalePath.moveTo(0,20);
  6412. scalePath.lineTo(10,20);
  6413. scalePath.moveTo(0,30);
  6414. scalePath.lineTo(10,30);
  6415. scalePath.moveTo(0,40);
  6416. scalePath.lineTo(10,40);
  6417. scalePath.moveTo(0,50);
  6418. scalePath.lineTo(10,50);
  6419. scalePath.moveTo(0,60);
  6420. scalePath.lineTo(10,60);
  6421. scalePath.moveTo(0,70);
  6422. scalePath.lineTo(10,70);
  6423. scalePath.moveTo(0,80);
  6424. scalePath.lineTo(10,80);
  6425. scalePath.moveTo(0,90);
  6426. scalePath.lineTo(10,90);
  6427. scalePath.moveTo(0,100);
  6428. scalePath.lineTo(10,100);
  6429. scaleLine.setPath(scalePath);
  6430. scaleLine.setPos(0,16);
  6431. scene.addItem(&scaleLine);
  6432. setScene(&scene);
  6433. indicator.setPolygon(left);
  6434. indicator.setBrush(theBrush);
  6435. setMinimumSize(sizeHint());
  6436. setMaximumSize(sizeHint());
  6437. }
  6438. /*:584*//*585:*/
  6439. #line 13832 "./typica.w"
  6440. QSize IntensityControl::sizeHint()const
  6441. {
  6442. return QSize(25,160);
  6443. }
  6444. /*:585*//*586:*/
  6445. #line 13847 "./typica.w"
  6446. void IntensityControl::setValue(double val)
  6447. {
  6448. if(val>=0&&val<=10)
  6449. {
  6450. theValue= val;
  6451. if(!valueSet)
  6452. {
  6453. scene.addItem(&indicator);
  6454. }
  6455. valueSet= true;
  6456. indicator.setPos(6,(100-(val*10))+16);
  6457. emit(valueChanged(val));
  6458. }
  6459. else if(val<1)
  6460. {
  6461. setValue(0);
  6462. }
  6463. else
  6464. {
  6465. setValue(10);
  6466. }
  6467. }
  6468. double IntensityControl::value()
  6469. {
  6470. return theValue;
  6471. }
  6472. /*:586*//*587:*/
  6473. #line 13879 "./typica.w"
  6474. void IntensityControl::mousePressEvent(QMouseEvent*event)
  6475. {
  6476. /*578:*/
  6477. #line 13623 "./typica.w"
  6478. if(event->button()!=Qt::LeftButton)
  6479. {
  6480. event->ignore();
  6481. return;
  6482. }
  6483. /*:578*/
  6484. #line 13882 "./typica.w"
  6485. scaleDown= true;
  6486. event->accept();
  6487. }
  6488. /*:587*//*588:*/
  6489. #line 13893 "./typica.w"
  6490. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  6491. {
  6492. /*578:*/
  6493. #line 13623 "./typica.w"
  6494. if(event->button()!=Qt::LeftButton)
  6495. {
  6496. event->ignore();
  6497. return;
  6498. }
  6499. /*:578*/
  6500. #line 13896 "./typica.w"
  6501. if(!scaleDown)
  6502. {
  6503. event->ignore();
  6504. return;
  6505. }
  6506. scaleDown= false;
  6507. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6508. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  6509. {
  6510. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6511. {
  6512. if(valueSet)
  6513. {
  6514. setValue(theValue+0.05);
  6515. }
  6516. event->accept();
  6517. return;
  6518. }
  6519. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  6520. {
  6521. if(valueSet)
  6522. {
  6523. setValue(theValue-0.05);
  6524. }
  6525. event->accept();
  6526. return;
  6527. }
  6528. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  6529. {
  6530. setValue(10-((sceneCoordinate.y()-16)/10.0));
  6531. event->accept();
  6532. return;
  6533. }
  6534. }
  6535. }
  6536. /*:588*/
  6537. #line 803 "./typica.w"
  6538. /*288:*/
  6539. #line 7481 "./typica.w"
  6540. void ThresholdDetector::newMeasurement(Measurement measure)
  6541. {
  6542. if((currentDirection==Ascending&&previousValue<threshold&&
  6543. previousValue>=0)||(currentDirection==Descending&&
  6544. previousValue> threshold&&previousValue>=0))
  6545. {
  6546. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  6547. (currentDirection==Descending&&measure.temperature()<=threshold))
  6548. {
  6549. double offset= measure.time().hour()*60*60;
  6550. offset+= measure.time().minute()*60;
  6551. offset+= measure.time().second();
  6552. offset+= measure.time().msec()/1000;
  6553. emit timeForValue(offset);
  6554. }
  6555. }
  6556. previousValue= measure.temperature();
  6557. }
  6558. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  6559. previousValue(-1),threshold(value),currentDirection(Ascending)
  6560. {
  6561. }
  6562. void ThresholdDetector::setThreshold(double value)
  6563. {
  6564. threshold= value;
  6565. }
  6566. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  6567. {
  6568. currentDirection= direction;
  6569. }
  6570. /*:288*/
  6571. #line 804 "./typica.w"
  6572. /*669:*/
  6573. #line 15649 "./typica.w"
  6574. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  6575. lister(new QextSerialEnumerator)
  6576. {
  6577. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  6578. QextPortInfo port;
  6579. foreach(port,ports)
  6580. {
  6581. addItem(port.portName);
  6582. }
  6583. lister->setUpNotifications();
  6584. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  6585. this,SLOT(addDevice(QextPortInfo)));
  6586. setEditable(true);
  6587. }
  6588. void PortSelector::addDevice(QextPortInfo port)
  6589. {
  6590. addItem(port.portName);
  6591. }
  6592. /*:669*/
  6593. #line 805 "./typica.w"
  6594. /*671:*/
  6595. #line 15737 "./typica.w"
  6596. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  6597. {
  6598. QMetaObject meta= BaudSelector::staticMetaObject;
  6599. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  6600. for(int i= 0;i<type.keyCount();i++)
  6601. {
  6602. addItem(QString("%1").arg(type.value(i)));
  6603. }
  6604. }
  6605. /*:671*/
  6606. #line 806 "./typica.w"
  6607. /*673:*/
  6608. #line 15775 "./typica.w"
  6609. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  6610. {
  6611. QMetaObject meta= ParitySelector::staticMetaObject;
  6612. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  6613. for(int i= 0;i<type.keyCount();i++)
  6614. {
  6615. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6616. }
  6617. }
  6618. /*:673*/
  6619. #line 807 "./typica.w"
  6620. /*675:*/
  6621. #line 15805 "./typica.w"
  6622. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  6623. {
  6624. QMetaObject meta= FlowSelector::staticMetaObject;
  6625. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  6626. for(int i= 0;i<type.keyCount();i++)
  6627. {
  6628. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6629. }
  6630. }
  6631. /*:675*/
  6632. #line 808 "./typica.w"
  6633. /*677:*/
  6634. #line 15840 "./typica.w"
  6635. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  6636. {
  6637. QMetaObject meta= StopSelector::staticMetaObject;
  6638. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  6639. for(int i= 0;i<type.keyCount();i++)
  6640. {
  6641. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6642. }
  6643. }
  6644. /*:677*/
  6645. #line 809 "./typica.w"
  6646. /*717:*/
  6647. #line 17585 "./typica.w"
  6648. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  6649. :BasicDeviceConfigurationWidget(model,index),
  6650. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  6651. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  6652. decimalQuery(new QCheckBox(tr("Enable"))),
  6653. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  6654. unitQuery(new QCheckBox(tr("Enable"))),
  6655. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  6656. valueC(new QSpinBox),fixedUnit(new QComboBox),
  6657. pVAddress(new ShortHexSpinBox),
  6658. sVEnabled(new QCheckBox(tr("Enable"))),
  6659. sVReadAddress(new ShortHexSpinBox),
  6660. deviceLimit(new QCheckBox(tr("Enable"))),
  6661. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  6662. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  6663. sVWritable(new QCheckBox(tr("Enable"))),
  6664. sVOutputAddr(new ShortHexSpinBox),
  6665. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  6666. {
  6667. QHBoxLayout*layout= new QHBoxLayout;
  6668. QWidget*form= new QWidget;
  6669. QHBoxLayout*masterLayout= new QHBoxLayout;
  6670. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  6671. QVBoxLayout*seriesLayout= new QVBoxLayout;
  6672. QFormLayout*serialSection= new QFormLayout;
  6673. serialSection->addRow(QString(tr("Port:")),port);
  6674. serialSection->addRow(QString(tr("Baud rate:")),baud);
  6675. serialSection->addRow(QString(tr("Parity:")),parity);
  6676. serialSection->addRow(QString(tr("Flow control:")),flow);
  6677. serialSection->addRow(QString(tr("Stop bits:")),stop);
  6678. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  6679. serialSectionBox->setLayout(serialSection);
  6680. portAndDeviceLayout->addWidget(serialSectionBox);
  6681. QFormLayout*deviceSection= new QFormLayout;
  6682. station->setMinimum(1);
  6683. station->setMaximum(255);
  6684. decimalPosition->setMinimum(0);
  6685. decimalPosition->setMaximum(9);
  6686. valueF->setMinimum(0);
  6687. valueF->setMaximum(0xFFFF);
  6688. valueC->setMinimum(0);
  6689. valueC->setMaximum(0xFFFF);
  6690. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  6691. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  6692. deviceSection->addRow(tr("Station:"),station);
  6693. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  6694. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  6695. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  6696. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  6697. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  6698. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  6699. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  6700. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  6701. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  6702. deviceSectionBox->setLayout(deviceSection);
  6703. portAndDeviceLayout->addWidget(deviceSectionBox);
  6704. QFormLayout*pVSection= new QFormLayout;
  6705. pVSection->addRow(tr("Value relative address:"),pVAddress);
  6706. pVSection->addRow(tr("PV column name:"),pVColumnName);
  6707. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  6708. processValueBox->setLayout(pVSection);
  6709. seriesLayout->addWidget(processValueBox);
  6710. QFormLayout*sVSection= new QFormLayout;
  6711. sVLower->setDecimals(1);
  6712. sVLower->setMinimum(0.0);
  6713. sVLower->setMaximum(999.9);
  6714. sVUpper->setDecimals(1);
  6715. sVUpper->setMinimum(0.0);
  6716. sVUpper->setMaximum(999.9);
  6717. sVSection->addRow(tr("Set value:"),sVEnabled);
  6718. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  6719. sVSection->addRow(tr("SV column name:"),sVColumnName);
  6720. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  6721. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  6722. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  6723. sVSection->addRow(tr("Lower limit:"),sVLower);
  6724. sVSection->addRow(tr("Upper limit:"),sVUpper);
  6725. sVSection->addRow(tr("Output set value:"),sVWritable);
  6726. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  6727. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  6728. setValueBox->setLayout(sVSection);
  6729. seriesLayout->addWidget(setValueBox);
  6730. masterLayout->addLayout(portAndDeviceLayout);
  6731. masterLayout->addLayout(seriesLayout);
  6732. form->setLayout(masterLayout);
  6733. /*645:*/
  6734. #line 15133 "./typica.w"
  6735. QDomElement referenceElement=
  6736. model->referenceElement(model->data(index,Qt::UserRole).toString());
  6737. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  6738. QDomElement node;
  6739. /*:645*/
  6740. #line 17671 "./typica.w"
  6741. for(int i= 0;i<configData.size();i++)
  6742. {
  6743. node= configData.at(i).toElement();
  6744. if(node.attribute("name")=="port")
  6745. {
  6746. QString portname= node.attribute("value");
  6747. int idx= port->findText(portname);
  6748. if(idx>=0)
  6749. {
  6750. port->setCurrentIndex(idx);
  6751. }
  6752. else
  6753. {
  6754. port->addItem(portname);
  6755. }
  6756. }
  6757. else if(node.attribute("name")=="baud")
  6758. {
  6759. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  6760. }
  6761. else if(node.attribute("name")=="parity")
  6762. {
  6763. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  6764. }
  6765. else if(node.attribute("name")=="flow")
  6766. {
  6767. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  6768. }
  6769. else if(node.attribute("name")=="stop")
  6770. {
  6771. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  6772. }
  6773. else if(node.attribute("name")=="station")
  6774. {
  6775. station->setValue(node.attribute("value").toInt());
  6776. }
  6777. else if(node.attribute("name")=="decimalQuery")
  6778. {
  6779. if(node.attribute("value")=="true")
  6780. {
  6781. decimalQuery->setChecked(true);
  6782. }
  6783. else
  6784. {
  6785. decimalQuery->setChecked(false);
  6786. }
  6787. }
  6788. else if(node.attribute("name")=="decimalAddress")
  6789. {
  6790. decimalAddress->setValue(node.attribute("value").toInt());
  6791. }
  6792. else if(node.attribute("name")=="decimalPosition")
  6793. {
  6794. decimalPosition->setValue(node.attribute("value").toInt());
  6795. }
  6796. else if(node.attribute("name")=="unitQuery")
  6797. {
  6798. if(node.attribute("value")=="true")
  6799. {
  6800. unitQuery->setChecked(true);
  6801. }
  6802. else
  6803. {
  6804. unitQuery->setChecked(false);
  6805. }
  6806. }
  6807. else if(node.attribute("name")=="unitAddress")
  6808. {
  6809. unitAddress->setValue(node.attribute("value").toInt());
  6810. }
  6811. else if(node.attribute("name")=="valueF")
  6812. {
  6813. valueF->setValue(node.attribute("value").toInt());
  6814. }
  6815. else if(node.attribute("name")=="valueC")
  6816. {
  6817. valueC->setValue(node.attribute("value").toInt());
  6818. }
  6819. else if(node.attribute("name")=="fixedUnit")
  6820. {
  6821. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  6822. }
  6823. else if(node.attribute("name")=="pVAddress")
  6824. {
  6825. pVAddress->setValue(node.attribute("value").toInt());
  6826. }
  6827. else if(node.attribute("name")=="sVEnabled")
  6828. {
  6829. if(node.attribute("value")=="true")
  6830. {
  6831. sVEnabled->setChecked(true);
  6832. }
  6833. else
  6834. {
  6835. sVEnabled->setChecked(false);
  6836. }
  6837. }
  6838. else if(node.attribute("name")=="sVReadAddress")
  6839. {
  6840. sVReadAddress->setValue(node.attribute("value").toInt());
  6841. }
  6842. else if(node.attribute("name")=="deviceLimit")
  6843. {
  6844. if(node.attribute("value")=="true")
  6845. {
  6846. deviceLimit->setChecked(true);
  6847. }
  6848. else
  6849. {
  6850. deviceLimit->setChecked(false);
  6851. }
  6852. }
  6853. else if(node.attribute("name")=="sVLowerAddr")
  6854. {
  6855. sVLowerAddr->setValue(node.attribute("value").toInt());
  6856. }
  6857. else if(node.attribute("name")=="sVUpperAddr")
  6858. {
  6859. sVUpperAddr->setValue(node.attribute("value").toInt());
  6860. }
  6861. else if(node.attribute("name")=="sVLower")
  6862. {
  6863. sVLower->setValue(node.attribute("value").toDouble());
  6864. }
  6865. else if(node.attribute("name")=="sVUpper")
  6866. {
  6867. sVUpper->setValue(node.attribute("value").toDouble());
  6868. }
  6869. else if(node.attribute("name")=="sVWritable")
  6870. {
  6871. if(node.attribute("value")=="true")
  6872. {
  6873. sVWritable->setChecked(true);
  6874. }
  6875. else
  6876. {
  6877. sVWritable->setChecked(false);
  6878. }
  6879. }
  6880. else if(node.attribute("name")=="sVOutputAddr")
  6881. {
  6882. sVOutputAddr->setValue(node.attribute("value").toInt());
  6883. }
  6884. else if(node.attribute("name")=="pvcolname")
  6885. {
  6886. pVColumnName->setText(node.attribute("value"));
  6887. }
  6888. else if(node.attribute("name")=="svcolname")
  6889. {
  6890. sVColumnName->setText(node.attribute("value"));
  6891. }
  6892. }
  6893. updatePort(port->currentText());
  6894. updateBaudRate(baud->currentText());
  6895. updateParity(parity->itemData(parity->currentIndex()).toString());
  6896. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  6897. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  6898. updateStation(station->value());
  6899. updateFixedDecimal(decimalQuery->isChecked());
  6900. updateDecimalAddress(decimalAddress->value());
  6901. updateDecimalPosition(decimalPosition->value());
  6902. updateFixedUnit(unitQuery->isChecked());
  6903. updateUnitAddress(unitAddress->value());
  6904. updateValueForF(valueF->value());
  6905. updateValueForC(valueC->value());
  6906. updateUnit(fixedUnit->currentText());
  6907. updatePVAddress(pVAddress->value());
  6908. updateSVEnabled(sVEnabled->isChecked());
  6909. updateSVReadAddress(sVReadAddress->value());
  6910. updateDeviceLimit(deviceLimit->isChecked());
  6911. updateSVLowerAddress(sVLowerAddr->value());
  6912. updateSVUpperAddress(sVUpperAddr->value());
  6913. updateSVLower(sVLower->value());
  6914. updateSVUpper(sVUpper->value());
  6915. updateSVWritable(sVWritable->isChecked());
  6916. updateSVWriteAddress(sVOutputAddr->value());
  6917. updatePVColumnName(pVColumnName->text());
  6918. updateSVColumnName(sVColumnName->text());
  6919. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  6920. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  6921. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  6922. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  6923. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  6924. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  6925. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  6926. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  6927. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  6928. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  6929. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  6930. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  6931. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  6932. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  6933. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  6934. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  6935. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  6936. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  6937. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  6938. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  6939. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  6940. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  6941. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  6942. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  6943. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  6944. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  6945. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  6946. layout->addWidget(form);
  6947. setLayout(layout);
  6948. }
  6949. void ModbusConfigurator::updatePort(const QString&newPort)
  6950. {
  6951. updateAttribute("port",newPort);
  6952. }
  6953. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  6954. {
  6955. updateAttribute("baud",newRate);
  6956. }
  6957. void ModbusConfigurator::updateParity(const QString&)
  6958. {
  6959. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  6960. }
  6961. void ModbusConfigurator::updateFlowControl(const QString&)
  6962. {
  6963. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  6964. }
  6965. void ModbusConfigurator::updateStopBits(const QString&)
  6966. {
  6967. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  6968. }
  6969. void ModbusConfigurator::updateStation(int station)
  6970. {
  6971. updateAttribute("station",QString("%1").arg(station));
  6972. }
  6973. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  6974. {
  6975. updateAttribute("decimalQuery",fixed?"true":"false");
  6976. }
  6977. void ModbusConfigurator::updateDecimalAddress(int address)
  6978. {
  6979. updateAttribute("decimalAddress",QString("%1").arg(address));
  6980. }
  6981. void ModbusConfigurator::updateDecimalPosition(int position)
  6982. {
  6983. updateAttribute("decimalPosition",QString("%1").arg(position));
  6984. }
  6985. void ModbusConfigurator::updateFixedUnit(bool fixed)
  6986. {
  6987. updateAttribute("unitQuery",fixed?"true":"false");
  6988. }
  6989. void ModbusConfigurator::updateUnitAddress(int address)
  6990. {
  6991. updateAttribute("unitAddress",QString("%1").arg(address));
  6992. }
  6993. void ModbusConfigurator::updateValueForF(int value)
  6994. {
  6995. updateAttribute("valueF",QString("%1").arg(value));
  6996. }
  6997. void ModbusConfigurator::updateValueForC(int value)
  6998. {
  6999. updateAttribute("valueC",QString("%1").arg(value));
  7000. }
  7001. void ModbusConfigurator::updateUnit(const QString&newUnit)
  7002. {
  7003. updateAttribute("fixedUnit",newUnit);
  7004. }
  7005. void ModbusConfigurator::updatePVAddress(int address)
  7006. {
  7007. updateAttribute("pVAddress",QString("%1").arg(address));
  7008. }
  7009. void ModbusConfigurator::updateSVEnabled(bool enabled)
  7010. {
  7011. updateAttribute("sVEnabled",enabled?"true":"false");
  7012. }
  7013. void ModbusConfigurator::updateSVReadAddress(int address)
  7014. {
  7015. updateAttribute("sVReadAddress",QString("%1").arg(address));
  7016. }
  7017. void ModbusConfigurator::updateDeviceLimit(bool query)
  7018. {
  7019. updateAttribute("deviceLimit",query?"true":"false");
  7020. }
  7021. void ModbusConfigurator::updateSVLowerAddress(int address)
  7022. {
  7023. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  7024. }
  7025. void ModbusConfigurator::updateSVUpperAddress(int address)
  7026. {
  7027. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  7028. }
  7029. void ModbusConfigurator::updateSVLower(double value)
  7030. {
  7031. updateAttribute("sVLower",QString("%1").arg(value));
  7032. }
  7033. void ModbusConfigurator::updateSVUpper(double value)
  7034. {
  7035. updateAttribute("sVUpper",QString("%1").arg(value));
  7036. }
  7037. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  7038. {
  7039. updateAttribute("sVWritable",canWriteSV?"true":"false");
  7040. }
  7041. void ModbusConfigurator::updateSVWriteAddress(int address)
  7042. {
  7043. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  7044. }
  7045. void ModbusConfigurator::updatePVColumnName(const QString&name)
  7046. {
  7047. updateAttribute("pvcolname",name);
  7048. }
  7049. void ModbusConfigurator::updateSVColumnName(const QString&name)
  7050. {
  7051. updateAttribute("svcolname",name);
  7052. }
  7053. /*:717*/
  7054. #line 810 "./typica.w"
  7055. /*680:*/
  7056. #line 15889 "./typica.w"
  7057. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  7058. {
  7059. setMinimum(0);
  7060. setMaximum(0xFFFF);
  7061. setPrefix("0x");
  7062. setMinimumWidth(65);
  7063. }
  7064. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  7065. {
  7066. if(input.size()==2)
  7067. {
  7068. return QValidator::Intermediate;
  7069. }
  7070. bool okay;
  7071. input.toInt(&okay,16);
  7072. if(okay)
  7073. {
  7074. return QValidator::Acceptable;
  7075. }
  7076. return QValidator::Invalid;
  7077. }
  7078. int ShortHexSpinBox::valueFromText(const QString&text)const
  7079. {
  7080. return text.toInt(NULL,16);
  7081. }
  7082. QString ShortHexSpinBox::textFromValue(int value)const
  7083. {
  7084. QString retval;
  7085. retval.setNum(value,16);
  7086. while(retval.size()<4)
  7087. {
  7088. retval.prepend("0");
  7089. }
  7090. return retval.toUpper();
  7091. }
  7092. /*:680*/
  7093. #line 811 "./typica.w"
  7094. /*702:*/
  7095. #line 16915 "./typica.w"
  7096. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  7097. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  7098. waiting(false)
  7099. {
  7100. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  7101. Qt::UserRole).toString());
  7102. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  7103. QDomElement node;
  7104. QVariantMap attributes;
  7105. for(int i= 0;i<portConfigData.size();i++)
  7106. {
  7107. node= portConfigData.at(i).toElement();
  7108. attributes.insert(node.attribute("name"),node.attribute("value"));
  7109. }
  7110. port= new QextSerialPort(attributes.value("port").toString(),
  7111. QextSerialPort::EventDriven);
  7112. int baudRate= attributes.value("baud").toInt();
  7113. port->setBaudRate((BaudRateType)baudRate);
  7114. double temp= ((double)(1)/(double)(baudRate))*48;
  7115. delayTime= (int)(temp*3000);
  7116. messageDelayTimer->setSingleShot(true);
  7117. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  7118. port->setDataBits(DATA_8);
  7119. port->setParity((ParityType)attributes.value("parity").toInt());
  7120. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  7121. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  7122. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  7123. port->open(QIODevice::ReadWrite);
  7124. station= (char)attributes.value("station").toInt();
  7125. if(attributes.value("decimalQuery")=="true")
  7126. {
  7127. decimalPosition= 0;
  7128. QByteArray message;
  7129. message.append(station);
  7130. message.append((char)0x03);
  7131. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  7132. char*addressBytes= (char*)&address;
  7133. message.append(addressBytes[1]);
  7134. message.append(addressBytes[0]);
  7135. message.append((char)0x00);
  7136. message.append((char)0x01);
  7137. queueMessage(message,this,"decimalResponse(QByteArray)");
  7138. }
  7139. else
  7140. {
  7141. decimalPosition= attributes.value("decimalPosition").toInt();
  7142. }
  7143. valueF= attributes.value("valueF").toInt();
  7144. valueC= attributes.value("valueC").toInt();
  7145. if(attributes.value("unitQuery")=="true")
  7146. {
  7147. QByteArray message;
  7148. message.append(station);
  7149. message.append((char)0x03);
  7150. quint16 address= (quint16)attributes.value("unitAddress").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,"unitResponse(QByteArray)");
  7157. }
  7158. else
  7159. {
  7160. if(attributes.value("fixedUnit")=="Celsius")
  7161. {
  7162. unitIsF= false;
  7163. }
  7164. }
  7165. if(attributes.value("sVWritable")=="true")
  7166. {
  7167. if(attributes.value("deviceLimit")=="true")
  7168. {
  7169. QByteArray lmessage;
  7170. lmessage.append(station);
  7171. lmessage.append((char)0x03);
  7172. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  7173. char*addressBytes= (char*)&laddress;
  7174. lmessage.append(addressBytes[1]);
  7175. lmessage.append(addressBytes[0]);
  7176. lmessage.append((char)0x00);
  7177. lmessage.append((char)0x01);
  7178. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  7179. QByteArray umessage;
  7180. umessage.append(station);
  7181. umessage.append((char)0x03);
  7182. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  7183. addressBytes= (char*)&uaddress;
  7184. umessage.append(addressBytes[1]);
  7185. umessage.append(addressBytes[0]);
  7186. umessage.append((char)0x00);
  7187. umessage.append((char)0x01);
  7188. queueMessage(umessage,this,"svuResponse(QByteArray)");
  7189. }
  7190. else
  7191. {
  7192. outputSVLower= attributes.value("sVLower").toDouble();
  7193. outputSVUpper= attributes.value("sVUpper").toDouble();
  7194. }
  7195. outputSVStub.append(station);
  7196. outputSVStub.append((char)0x06);
  7197. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  7198. char*addressBytes= (char*)&address;
  7199. outputSVStub.append(addressBytes[1]);
  7200. outputSVStub.append(addressBytes[0]);
  7201. }
  7202. Channel*pv= new Channel;
  7203. channels.append(pv);
  7204. pvStub.append(station);
  7205. pvStub.append((char)0x04);
  7206. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  7207. char*pvac= (char*)&pvaddress;
  7208. pvStub.append(pvac[1]);
  7209. pvStub.append(pvac[0]);
  7210. pvStub.append((char)0x00);
  7211. pvStub.append((char)0x01);
  7212. svenabled= attributes.value("sVEnabled").toBool();
  7213. if(svenabled)
  7214. {
  7215. Channel*sv= new Channel;
  7216. channels.append(sv);
  7217. svStub.append(station);
  7218. svStub.append((char)0x04);
  7219. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  7220. char*svac= (char*)&svaddress;
  7221. svStub.append(svac[1]);
  7222. svStub.append(svac[0]);
  7223. svStub.append((char)0x00);
  7224. svStub.append((char)0x01);
  7225. if(svaddress-pvaddress==1)
  7226. {
  7227. mStub.append(station);
  7228. mStub.append((char)0x04);
  7229. mStub.append(pvac[1]);
  7230. mStub.append(pvac[0]);
  7231. mStub.append((char)0x00);
  7232. mStub.append((char)0x02);
  7233. }
  7234. }
  7235. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  7236. requestMeasurement();
  7237. }
  7238. double ModbusRTUDevice::SVLower()
  7239. {
  7240. return outputSVLower;
  7241. }
  7242. double ModbusRTUDevice::SVUpper()
  7243. {
  7244. return outputSVUpper;
  7245. }
  7246. int ModbusRTUDevice::decimals()
  7247. {
  7248. return decimalPosition;
  7249. }
  7250. void ModbusRTUDevice::decimalResponse(QByteArray response)
  7251. {
  7252. quint16 temp;
  7253. char*tchar= (char*)&temp;
  7254. tchar[1]= response.at(3);
  7255. tchar[0]= response.at(4);
  7256. decimalPosition= temp;
  7257. emit SVDecimalChanged(decimalPosition);
  7258. qDebug()<<"Received decimal response";
  7259. }
  7260. void ModbusRTUDevice::unitResponse(QByteArray response)
  7261. {
  7262. quint16 temp;
  7263. char*tchar= (char*)&temp;
  7264. tchar[1]= response.at(3);
  7265. tchar[0]= response.at(4);
  7266. int value= temp;
  7267. if(value==valueF)
  7268. {
  7269. unitIsF= true;
  7270. }
  7271. else
  7272. {
  7273. unitIsF= false;
  7274. }
  7275. }
  7276. void ModbusRTUDevice::svlResponse(QByteArray response)
  7277. {
  7278. quint16 temp;
  7279. char*tchar= (char*)&temp;
  7280. tchar[1]= response.at(3);
  7281. tchar[0]= response.at(4);
  7282. outputSVLower= (double)temp;
  7283. for(int i= 0;i<decimalPosition;i++)
  7284. {
  7285. outputSVLower/= 10;
  7286. }
  7287. emit SVLowerChanged(outputSVLower);
  7288. }
  7289. void ModbusRTUDevice::svuResponse(QByteArray response)
  7290. {
  7291. quint16 temp;
  7292. char*tchar= (char*)&temp;
  7293. tchar[1]= response.at(3);
  7294. tchar[0]= response.at(4);
  7295. outputSVUpper= (double)temp;
  7296. for(int i= 0;i<decimalPosition;i++)
  7297. {
  7298. outputSVUpper/= 10;
  7299. }
  7300. emit SVUpperChanged(outputSVUpper);
  7301. }
  7302. void ModbusRTUDevice::requestMeasurement()
  7303. {
  7304. if(mStub.length()> 0)
  7305. {
  7306. queueMessage(mStub,this,"mResponse(QByteArray)");
  7307. }
  7308. else
  7309. {
  7310. queueMessage(pvStub,this,"mResponse(QByteArray)");
  7311. if(svenabled)
  7312. {
  7313. queueMessage(svStub,this,"mResponse(QByteArray)");
  7314. }
  7315. }
  7316. }
  7317. void ModbusRTUDevice::mResponse(QByteArray response)
  7318. {
  7319. QTime time= QTime::currentTime();
  7320. if(response.at(2)==0x04)
  7321. {
  7322. /*703:*/
  7323. #line 17164 "./typica.w"
  7324. quint16 pv;
  7325. quint16 sv;
  7326. char*pvBytes= (char*)&pv;
  7327. char*svBytes= (char*)&sv;
  7328. pvBytes[1]= response.at(3);
  7329. pvBytes[0]= response.at(4);
  7330. svBytes[1]= response.at(5);
  7331. svBytes[0]= response.at(6);
  7332. double pvOut= (double)pv;
  7333. double svOut= (double)sv;
  7334. for(int i= 0;i<decimalPosition;i++)
  7335. {
  7336. pvOut/= 10;
  7337. svOut/= 10;
  7338. }
  7339. if(!unitIsF)
  7340. {
  7341. pvOut= pvOut*9/5+32;
  7342. svOut= svOut*9/5+32;
  7343. }
  7344. Measurement pvm(pvOut,time,Measurement::Fahrenheit);
  7345. Measurement svm(svOut,time,Measurement::Fahrenheit);
  7346. channels.at(0)->input(pvm);
  7347. channels.at(1)->input(svm);
  7348. /*:703*/
  7349. #line 17151 "./typica.w"
  7350. }
  7351. else
  7352. {
  7353. /*704:*/
  7354. #line 17194 "./typica.w"
  7355. quint16 value;
  7356. char*valueBytes= (char*)&value;
  7357. valueBytes[1]= response.at(3);
  7358. valueBytes[0]= response.at(4);
  7359. double valueOut= (double)value;
  7360. for(int i= 0;i<decimalPosition;i++)
  7361. {
  7362. valueOut/= 10;
  7363. }
  7364. if(!unitIsF)
  7365. {
  7366. valueOut= valueOut*9/5+32;
  7367. }
  7368. if(!svenabled)
  7369. {
  7370. Measurement vm(valueOut,time,Measurement::Fahrenheit);
  7371. channels.at(0)->input(vm);
  7372. }
  7373. else
  7374. {
  7375. if(readingsv)
  7376. {
  7377. Measurement pvm(savedpv,time,Measurement::Fahrenheit);
  7378. Measurement svm(valueOut,time,Measurement::Fahrenheit);
  7379. channels.at(0)->input(pvm);
  7380. channels.at(1)->input(svm);
  7381. readingsv= false;
  7382. }
  7383. else
  7384. {
  7385. savedpv= valueOut;
  7386. readingsv= true;
  7387. }
  7388. }
  7389. /*:704*/
  7390. #line 17155 "./typica.w"
  7391. }
  7392. }
  7393. /*:702*//*705:*/
  7394. #line 17232 "./typica.w"
  7395. ModbusRTUDevice::~ModbusRTUDevice()
  7396. {
  7397. messageDelayTimer->stop();
  7398. port->close();
  7399. }
  7400. /*:705*//*706:*/
  7401. #line 17254 "./typica.w"
  7402. void ModbusRTUDevice::dataAvailable()
  7403. {
  7404. if(messageDelayTimer->isActive())
  7405. {
  7406. messageDelayTimer->stop();
  7407. }
  7408. responseBuffer.append(port->readAll());
  7409. /*707:*/
  7410. #line 17299 "./typica.w"
  7411. if(responseBuffer.size()<5)
  7412. {
  7413. return;
  7414. }
  7415. switch(responseBuffer.at(1))
  7416. {
  7417. case 0x01:
  7418. case 0x02:
  7419. if(responseBuffer.size()<6)
  7420. {
  7421. return;
  7422. }
  7423. responseBuffer= responseBuffer.left(6);
  7424. break;
  7425. case 0x03:
  7426. case 0x04:
  7427. if(responseBuffer.size()<5+responseBuffer.at(2))
  7428. {
  7429. return;
  7430. }
  7431. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  7432. break;
  7433. case 0x05:
  7434. case 0x06:
  7435. case 0x10:
  7436. if(responseBuffer.size()<8)
  7437. {
  7438. return;
  7439. }
  7440. responseBuffer= responseBuffer.left(8);
  7441. break;
  7442. }
  7443. /*:707*/
  7444. #line 17262 "./typica.w"
  7445. if(calculateCRC(responseBuffer)==0)
  7446. {
  7447. QObject*object= retObjQueue.at(0);
  7448. char*method= callbackQueue.at(0);
  7449. QMetaMethod metamethod= object->metaObject()->
  7450. method(object->metaObject()->
  7451. indexOfMethod(QMetaObject::normalizedSignature(method)));
  7452. metamethod.invoke(object,Qt::QueuedConnection,
  7453. Q_ARG(QByteArray,responseBuffer));
  7454. messageQueue.removeAt(0);
  7455. retObjQueue.removeAt(0);
  7456. callbackQueue.removeAt(0);
  7457. messageDelayTimer->start(delayTime);
  7458. }
  7459. else
  7460. {
  7461. qDebug()<<"CRC failed";
  7462. }
  7463. waiting= false;
  7464. responseBuffer.clear();
  7465. }
  7466. /*:706*//*708:*/
  7467. #line 17341 "./typica.w"
  7468. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  7469. {
  7470. quint16 retval= 0xFFFF;
  7471. int i= 0;
  7472. while(i<data.size())
  7473. {
  7474. retval^= 0x00FF&(quint16)data.at(i);
  7475. for(int j= 0;j<8;j++)
  7476. {
  7477. if(retval&1)
  7478. {
  7479. retval= (retval>>1)^0xA001;
  7480. }
  7481. else
  7482. {
  7483. retval>>= 1;
  7484. }
  7485. }
  7486. i++;
  7487. }
  7488. return retval;
  7489. }
  7490. /*:708*//*709:*/
  7491. #line 17372 "./typica.w"
  7492. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  7493. const char*callback)
  7494. {
  7495. messageQueue.append(request);
  7496. retObjQueue.append(object);
  7497. callbackQueue.append(const_cast<char*> (callback));
  7498. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  7499. {
  7500. sendNextMessage();
  7501. }
  7502. }
  7503. void ModbusRTUDevice::sendNextMessage()
  7504. {
  7505. if(messageQueue.size()> 0&&!waiting)
  7506. {
  7507. QByteArray message= messageQueue.at(0);
  7508. quint16 crc= calculateCRC(message);
  7509. char*check= (char*)&crc;
  7510. message.append(check[0]);
  7511. message.append(check[1]);
  7512. port->write(message);
  7513. messageDelayTimer->start(delayTime);
  7514. waiting= true;
  7515. }
  7516. else
  7517. {
  7518. emit queueEmpty();
  7519. }
  7520. }
  7521. void ModbusRTUDevice::outputSV(double value)
  7522. {
  7523. for(int i= 0;i<decimalPosition;i++)
  7524. {
  7525. value*= 10;
  7526. }
  7527. quint16 outval= (quint16)value;
  7528. QByteArray message(outputSVStub);
  7529. char*valBytes= (char*)&outval;
  7530. message.append(valBytes[1]);
  7531. message.append(valBytes[0]);
  7532. queueMessage(message,this,"ignore(QByteArray)");
  7533. }
  7534. /*:709*//*710:*/
  7535. #line 17420 "./typica.w"
  7536. void ModbusRTUDevice::ignore(QByteArray)
  7537. {
  7538. return;
  7539. }
  7540. /*:710*/
  7541. #line 812 "./typica.w"
  7542. /*600:*/
  7543. #line 14151 "./typica.w"
  7544. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  7545. DeviceTreeModelNode*parent)
  7546. :domNode(node),rowNumber(row),parentItem(parent)
  7547. {
  7548. }
  7549. DeviceTreeModelNode::~DeviceTreeModelNode()
  7550. {
  7551. QHash<int,DeviceTreeModelNode*> ::iterator i;
  7552. for(i= children.begin();i!=children.end();i++)
  7553. {
  7554. delete i.value();
  7555. }
  7556. }
  7557. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  7558. {
  7559. return parentItem;
  7560. }
  7561. int DeviceTreeModelNode::row()
  7562. {
  7563. return rowNumber;
  7564. }
  7565. QDomNode DeviceTreeModelNode::node()const
  7566. {
  7567. return domNode;
  7568. }
  7569. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  7570. {
  7571. if(children.contains(index))
  7572. {
  7573. return children[index];
  7574. }
  7575. if(index>=0&&index<domNode.childNodes().count())
  7576. {
  7577. QDomNode childNode= domNode.childNodes().item(index);
  7578. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  7579. index,this);
  7580. children[index]= childItem;
  7581. return childItem;
  7582. }
  7583. return NULL;
  7584. }
  7585. /*:600*/
  7586. #line 813 "./typica.w"
  7587. /*602:*/
  7588. #line 14240 "./typica.w"
  7589. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  7590. :QAbstractItemModel(parent)
  7591. {
  7592. document= AppInstance->deviceConfiguration();
  7593. QDomNodeList elements= document.elementsByTagName("devices");
  7594. if(elements.size()!=1)
  7595. {
  7596. qDebug()<<"Unexpected result when loading device map.";
  7597. }
  7598. treeRoot= elements.at(0);
  7599. root= new DeviceTreeModelNode(treeRoot,0);
  7600. elements= document.elementsByTagName("references");
  7601. if(elements.size()!=1)
  7602. {
  7603. qDebug()<<"No references section. Creating.";
  7604. referenceSection= document.createElement("references");
  7605. document.appendChild(referenceSection);
  7606. }
  7607. else
  7608. {
  7609. referenceSection= elements.at(0);
  7610. }
  7611. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  7612. AppInstance,SLOT(saveDeviceConfiguration()));
  7613. connect(this,SIGNAL(modelReset()),
  7614. AppInstance,SLOT(saveDeviceConfiguration()));
  7615. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7616. AppInstance,SLOT(saveDeviceConfiguration()));
  7617. }
  7618. /*:602*//*603:*/
  7619. #line 14275 "./typica.w"
  7620. int DeviceTreeModel::columnCount(const QModelIndex&)const
  7621. {
  7622. return 1;
  7623. }
  7624. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  7625. {
  7626. if(parent.column()> 0)
  7627. {
  7628. return 0;
  7629. }
  7630. /*604:*/
  7631. #line 14294 "./typica.w"
  7632. DeviceTreeModelNode*parentItem;
  7633. if(!parent.isValid())
  7634. {
  7635. parentItem= root;
  7636. }
  7637. else
  7638. {
  7639. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7640. }
  7641. /*:604*/
  7642. #line 14287 "./typica.w"
  7643. return parentItem->node().childNodes().count();
  7644. }
  7645. /*:603*//*605:*/
  7646. #line 14308 "./typica.w"
  7647. QModelIndex DeviceTreeModel::index(int row,int column,
  7648. const QModelIndex&parent)const
  7649. {
  7650. if(!hasIndex(row,column,parent))
  7651. {
  7652. return QModelIndex();
  7653. }
  7654. /*604:*/
  7655. #line 14294 "./typica.w"
  7656. DeviceTreeModelNode*parentItem;
  7657. if(!parent.isValid())
  7658. {
  7659. parentItem= root;
  7660. }
  7661. else
  7662. {
  7663. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7664. }
  7665. /*:604*/
  7666. #line 14316 "./typica.w"
  7667. DeviceTreeModelNode*childItem= parentItem->child(row);
  7668. if(childItem)
  7669. {
  7670. return createIndex(row,column,childItem);
  7671. }
  7672. return QModelIndex();
  7673. }
  7674. /*:605*//*606:*/
  7675. #line 14327 "./typica.w"
  7676. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  7677. {
  7678. if(!child.isValid())
  7679. {
  7680. return QModelIndex();
  7681. }
  7682. DeviceTreeModelNode*childItem=
  7683. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  7684. DeviceTreeModelNode*parentItem= childItem->parent();
  7685. if(!parentItem||parentItem==root)
  7686. {
  7687. return QModelIndex();
  7688. }
  7689. return createIndex(parentItem->row(),0,parentItem);
  7690. }
  7691. /*:606*//*607:*/
  7692. #line 14346 "./typica.w"
  7693. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  7694. {
  7695. if(!index.isValid())
  7696. {
  7697. return 0;
  7698. }
  7699. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  7700. }
  7701. /*:607*//*608:*/
  7702. #line 14361 "./typica.w"
  7703. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  7704. {
  7705. if(!index.isValid())
  7706. {
  7707. return QVariant();
  7708. }
  7709. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  7710. {
  7711. return QVariant();
  7712. }
  7713. DeviceTreeModelNode*item=
  7714. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7715. QDomNode node= item->node();
  7716. QDomElement element= node.toElement();
  7717. switch(role)
  7718. {
  7719. case Qt::DisplayRole:
  7720. case Qt::EditRole:
  7721. return QVariant(element.attribute("name"));
  7722. case Qt::UserRole:
  7723. return QVariant(element.attribute("reference"));
  7724. default:
  7725. return QVariant();
  7726. }
  7727. return QVariant();
  7728. }
  7729. /*:608*//*609:*/
  7730. #line 14393 "./typica.w"
  7731. bool DeviceTreeModel::setData(const QModelIndex&index,
  7732. const QVariant&value,int)
  7733. {
  7734. if(!index.isValid())
  7735. {
  7736. return false;
  7737. }
  7738. DeviceTreeModelNode*item=
  7739. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7740. QDomNode node= item->node();
  7741. QDomElement element= node.toElement();
  7742. element.setAttribute("name",value.toString());
  7743. emit dataChanged(index,index);
  7744. return true;
  7745. }
  7746. /*:609*//*610:*/
  7747. #line 14416 "./typica.w"
  7748. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  7749. const QModelIndex&parent)
  7750. {
  7751. QString referenceID= QUuid::createUuid().toString();
  7752. /*604:*/
  7753. #line 14294 "./typica.w"
  7754. DeviceTreeModelNode*parentItem;
  7755. if(!parent.isValid())
  7756. {
  7757. parentItem= root;
  7758. }
  7759. else
  7760. {
  7761. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7762. }
  7763. /*:604*/
  7764. #line 14421 "./typica.w"
  7765. QDomNode parentNode= parentItem->node();
  7766. int newRowNumber= rowCount(parent);
  7767. beginInsertRows(parent,newRowNumber,newRowNumber);
  7768. QDomElement deviceElement= document.createElement("node");
  7769. deviceElement.setAttribute("name",name);
  7770. deviceElement.setAttribute("reference",referenceID);
  7771. parentNode.appendChild(deviceElement);
  7772. QDomElement referenceElement= document.createElement("reference");
  7773. referenceElement.setAttribute("id",referenceID);
  7774. referenceElement.setAttribute("driver",driver);
  7775. referenceSection.appendChild(referenceElement);
  7776. endInsertRows();
  7777. }
  7778. /*:610*//*611:*/
  7779. #line 14439 "./typica.w"
  7780. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  7781. {
  7782. /*604:*/
  7783. #line 14294 "./typica.w"
  7784. DeviceTreeModelNode*parentItem;
  7785. if(!parent.isValid())
  7786. {
  7787. parentItem= root;
  7788. }
  7789. else
  7790. {
  7791. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7792. }
  7793. /*:604*/
  7794. #line 14442 "./typica.w"
  7795. QDomNode parentNode= parentItem->node();
  7796. QDomNodeList childNodes= parentNode.childNodes();
  7797. if(childNodes.size()<row+count)
  7798. {
  7799. return false;
  7800. }
  7801. beginRemoveRows(parent,row,row+count-1);
  7802. QList<QDomElement> removalList;
  7803. for(int i= row;i<row+count;i++)
  7804. {
  7805. removalList.append(childNodes.at(i).toElement());
  7806. }
  7807. QDomElement element;
  7808. QDomElement reference;
  7809. for(int i= 0;i<count;i++)
  7810. {
  7811. element= removalList.at(i);
  7812. if(element.hasAttribute("reference"))
  7813. {
  7814. reference= referenceElement(element.attribute("reference"));
  7815. if(!reference.isNull())
  7816. {
  7817. referenceSection.removeChild(reference);
  7818. }
  7819. }
  7820. parentNode.removeChild(element);
  7821. }
  7822. endRemoveRows();
  7823. beginResetModel();
  7824. delete root;
  7825. root= new DeviceTreeModelNode(treeRoot,0);
  7826. endResetModel();
  7827. return true;
  7828. }
  7829. /*:611*//*612:*/
  7830. #line 14481 "./typica.w"
  7831. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  7832. {
  7833. QDomNodeList childNodes= referenceSection.childNodes();
  7834. QDomElement element;
  7835. for(int i= 0;i<childNodes.size();i++)
  7836. {
  7837. element= childNodes.at(i).toElement();
  7838. if(element.hasAttribute("id"))
  7839. {
  7840. if(element.attribute("id")==id)
  7841. {
  7842. return element;
  7843. }
  7844. }
  7845. }
  7846. return QDomElement();
  7847. }
  7848. /*:612*//*613:*/
  7849. #line 14502 "./typica.w"
  7850. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  7851. {
  7852. return QVariant();
  7853. }
  7854. /*:613*//*614:*/
  7855. #line 14511 "./typica.w"
  7856. DeviceTreeModel::~DeviceTreeModel()
  7857. {
  7858. delete root;
  7859. }
  7860. /*:614*/
  7861. #line 814 "./typica.w"
  7862. /*640:*/
  7863. #line 14981 "./typica.w"
  7864. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  7865. DeviceTreeModel*model,const QModelIndex&index)
  7866. :QWidget(NULL),deviceModel(model),currentNode(index)
  7867. {
  7868. }
  7869. /*:640*//*641:*/
  7870. #line 14993 "./typica.w"
  7871. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  7872. const QString&value)
  7873. {
  7874. QDomElement referenceElement= deviceModel->referenceElement(
  7875. deviceModel->data(currentNode,Qt::UserRole).toString());
  7876. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7877. QDomElement node;
  7878. bool found= false;
  7879. for(int i= 0;i<configData.size();i++)
  7880. {
  7881. node= configData.at(i).toElement();
  7882. if(node.attribute("name")==name)
  7883. {
  7884. node.setAttribute("value",value);
  7885. found= true;
  7886. break;
  7887. }
  7888. }
  7889. if(!found)
  7890. {
  7891. node= AppInstance->deviceConfiguration().createElement("attribute");
  7892. node.setAttribute("name",name);
  7893. node.setAttribute("value",value);
  7894. referenceElement.appendChild(node);
  7895. }
  7896. AppInstance->saveDeviceConfiguration();
  7897. }
  7898. /*:641*//*642:*/
  7899. #line 15027 "./typica.w"
  7900. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  7901. const QString&driver)
  7902. {
  7903. deviceModel->newNode(name,driver,currentNode);
  7904. }
  7905. /*:642*/
  7906. #line 815 "./typica.w"
  7907. /*632:*/
  7908. #line 14849 "./typica.w"
  7909. DeviceConfigurationWindow::DeviceConfigurationWindow():QMainWindow(NULL),
  7910. view(new QTreeView),configArea(new QScrollArea)
  7911. {
  7912. QSplitter*splitter= new QSplitter;
  7913. QWidget*leftWidget= new QWidget;
  7914. leftWidget->setMinimumWidth(200);
  7915. QVBoxLayout*left= new QVBoxLayout;
  7916. view->setAnimated(true);
  7917. view->setSelectionMode(QAbstractItemView::SingleSelection);
  7918. document= AppInstance->deviceConfiguration();
  7919. model= new DeviceTreeModel;
  7920. view->setModel(model);
  7921. view->expandAll();
  7922. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  7923. QHBoxLayout*treeButtons= new QHBoxLayout;
  7924. QToolButton*addDeviceButton= new QToolButton;
  7925. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  7926. addDeviceButton->setToolTip(tr("New Roaster"));
  7927. connect(addDeviceButton,SIGNAL(clicked()),
  7928. this,SLOT(addDevice()));
  7929. QToolButton*removeNodeButton= new QToolButton;
  7930. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  7931. removeNodeButton->setToolTip(tr("Delete Selection"));
  7932. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  7933. treeButtons->addWidget(addDeviceButton);
  7934. treeButtons->addWidget(removeNodeButton);
  7935. left->addWidget(view);
  7936. left->addLayout(treeButtons);
  7937. leftWidget->setLayout(left);
  7938. splitter->addWidget(leftWidget);
  7939. configArea->setMinimumWidth(580);
  7940. configArea->setMinimumHeight(460);
  7941. splitter->addWidget(configArea);
  7942. setCentralWidget(splitter);
  7943. connect(view,SIGNAL(activated(QModelIndex)),
  7944. this,SLOT(newSelection(QModelIndex)));
  7945. connect(view,SIGNAL(clicked(QModelIndex)),
  7946. this,SLOT(newSelection(QModelIndex)));
  7947. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7948. view,SLOT(expand(QModelIndex)));
  7949. }
  7950. /*:632*//*633:*/
  7951. #line 14895 "./typica.w"
  7952. void DeviceConfigurationWindow::addDevice()
  7953. {
  7954. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  7955. }
  7956. /*:633*//*634:*/
  7957. #line 14903 "./typica.w"
  7958. void DeviceConfigurationWindow::removeNode()
  7959. {
  7960. QModelIndex index= view->currentIndex();
  7961. if(index.isValid())
  7962. {
  7963. int row= index.row();
  7964. QModelIndex parent= index.parent();
  7965. model->removeRow(row,parent);
  7966. }
  7967. }
  7968. /*:634*//*635:*/
  7969. #line 14919 "./typica.w"
  7970. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  7971. {
  7972. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  7973. if(editor)
  7974. {
  7975. configArea->setWidget(editor);
  7976. editor->show();
  7977. }
  7978. }
  7979. /*:635*/
  7980. #line 816 "./typica.w"
  7981. /*655:*/
  7982. #line 15323 "./typica.w"
  7983. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  7984. const QModelIndex&index):
  7985. BasicDeviceConfigurationWidget(model,index)
  7986. {
  7987. QFormLayout*layout= new QFormLayout;
  7988. QLineEdit*columnName= new QLineEdit;
  7989. layout->addRow(tr("Column Name:"),columnName);
  7990. QComboBox*typeSelector= new QComboBox;
  7991. typeSelector->addItem("J");
  7992. typeSelector->addItem("K");
  7993. typeSelector->addItem("T");
  7994. typeSelector->addItem("B");
  7995. typeSelector->addItem("E");
  7996. typeSelector->addItem("N");
  7997. typeSelector->addItem("R");
  7998. typeSelector->addItem("S");
  7999. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8000. setLayout(layout);
  8001. /*645:*/
  8002. #line 15133 "./typica.w"
  8003. QDomElement referenceElement=
  8004. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8005. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8006. QDomElement node;
  8007. /*:645*/
  8008. #line 15342 "./typica.w"
  8009. for(int i= 0;i<configData.size();i++)
  8010. {
  8011. node= configData.at(i).toElement();
  8012. if(node.attribute("name")=="type")
  8013. {
  8014. typeSelector->setCurrentIndex(
  8015. typeSelector->findText(node.attribute("value")));
  8016. }
  8017. else if(node.attribute("name")=="columnname")
  8018. {
  8019. columnName->setText(node.attribute("value"));
  8020. }
  8021. }
  8022. updateThermocoupleType(typeSelector->currentText());
  8023. updateColumnName(columnName->text());
  8024. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  8025. this,SLOT(updateThermocoupleType(QString)));
  8026. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8027. }
  8028. /*:655*//*656:*/
  8029. #line 15366 "./typica.w"
  8030. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  8031. {
  8032. updateAttribute("type",type);
  8033. }
  8034. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  8035. {
  8036. updateAttribute("columnname",name);
  8037. }
  8038. /*:656*/
  8039. #line 817 "./typica.w"
  8040. /*651:*/
  8041. #line 15238 "./typica.w"
  8042. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  8043. const QModelIndex&index)
  8044. :BasicDeviceConfigurationWidget(model,index)
  8045. {
  8046. QVBoxLayout*layout= new QVBoxLayout;
  8047. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8048. QLabel*label= new QLabel(tr("Device ID:"));
  8049. QLineEdit*deviceId= new QLineEdit;
  8050. deviceIdLayout->addWidget(label);
  8051. deviceIdLayout->addWidget(deviceId);
  8052. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8053. layout->addLayout(deviceIdLayout);
  8054. layout->addWidget(addChannelButton);
  8055. /*645:*/
  8056. #line 15133 "./typica.w"
  8057. QDomElement referenceElement=
  8058. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8059. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8060. QDomElement node;
  8061. /*:645*/
  8062. #line 15252 "./typica.w"
  8063. for(int i= 0;i<configData.size();i++)
  8064. {
  8065. node= configData.at(i).toElement();
  8066. if(node.attribute("name")=="deviceID")
  8067. {
  8068. deviceId->setText(node.attribute("value","Dev1"));
  8069. break;
  8070. }
  8071. }
  8072. updateDeviceId(deviceId->text());
  8073. connect(addChannelButton,SIGNAL(clicked()),
  8074. this,SLOT(addChannel()));
  8075. connect(deviceId,SIGNAL(textEdited(QString)),
  8076. this,SLOT(updateDeviceId(QString)));
  8077. setLayout(layout);
  8078. }
  8079. /*:651*//*652:*/
  8080. #line 15274 "./typica.w"
  8081. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  8082. {
  8083. updateAttribute("deviceID",newId);
  8084. }
  8085. /*:652*//*653:*/
  8086. #line 15282 "./typica.w"
  8087. void NiDaqMxBase9211ConfWidget::addChannel()
  8088. {
  8089. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8090. }
  8091. /*:653*/
  8092. #line 818 "./typica.w"
  8093. /*649:*/
  8094. #line 15189 "./typica.w"
  8095. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  8096. DeviceTreeModel*model,const QModelIndex&index):
  8097. BasicDeviceConfigurationWidget(model,index)
  8098. {
  8099. QHBoxLayout*layout= new QHBoxLayout;
  8100. QToolButton*addDeviceButton= new QToolButton;
  8101. addDeviceButton->setText(tr("Add Device"));
  8102. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  8103. "nidaqmxbase9211series");
  8104. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8105. "nidaqmxbase9211series");
  8106. connect(add9211,SIGNAL(triggered(QString,QString)),
  8107. this,SLOT(insertChildNode(QString,QString)));
  8108. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8109. this,SLOT(insertChildNode(QString,QString)));
  8110. QMenu*deviceMenu= new QMenu;
  8111. deviceMenu->addAction(add9211);
  8112. deviceMenu->addAction(add9211a);
  8113. addDeviceButton->setMenu(deviceMenu);
  8114. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8115. layout->addWidget(addDeviceButton);
  8116. setLayout(layout);
  8117. }
  8118. /*:649*/
  8119. #line 819 "./typica.w"
  8120. /*538:*/
  8121. #line 12776 "./typica.w"
  8122. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  8123. QObject*parent):
  8124. QAction(reportName,parent),reportFile(fileName)
  8125. {
  8126. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  8127. }
  8128. /*:538*//*539:*/
  8129. #line 12792 "./typica.w"
  8130. void ReportAction::createReport()
  8131. {
  8132. QFile file(reportFile);
  8133. QDomDocument document;
  8134. if(file.open(QIODevice::ReadOnly))
  8135. {
  8136. document.setContent(&file,true);
  8137. QDomElement element= document.documentElement();
  8138. QScriptEngine*engine= AppInstance->engine;
  8139. QScriptContext*context= engine->pushContext();
  8140. QScriptValue object;
  8141. QString targetID= reportFile;
  8142. /*161:*/
  8143. #line 3890 "./typica.w"
  8144. ScriptQMainWindow*window= new ScriptQMainWindow;
  8145. window->setObjectName(targetID);
  8146. object= engine->newQObject(window);
  8147. setQMainWindowProperties(object,engine);
  8148. QWidget*central= new(QWidget);
  8149. central->setParent(window);
  8150. central->setObjectName("centralWidget");
  8151. window->setCentralWidget(central);
  8152. if(element.hasChildNodes())
  8153. {
  8154. /*162:*/
  8155. #line 3931 "./typica.w"
  8156. QStack<QWidget*> widgetStack;
  8157. QStack<QLayout*> layoutStack;
  8158. QString windowScript;
  8159. widgetStack.push(central);
  8160. QDomNodeList windowChildren= element.childNodes();
  8161. int i= 0;
  8162. while(i<windowChildren.count())
  8163. {
  8164. QDomNode current;
  8165. QDomElement element;
  8166. current= windowChildren.at(i);
  8167. if(current.isElement())
  8168. {
  8169. element= current.toElement();
  8170. if(element.tagName()=="program")
  8171. {
  8172. windowScript.append(element.text());
  8173. }
  8174. else if(element.tagName()=="layout")
  8175. {
  8176. addLayoutToWidget(element,&widgetStack,&layoutStack);
  8177. }
  8178. else if(element.tagName()=="menu")
  8179. {
  8180. /*163:*/
  8181. #line 3978 "./typica.w"
  8182. QMenuBar*bar= window->menuBar();
  8183. bar->setParent(window);
  8184. bar->setObjectName("menuBar");
  8185. if(element.hasAttribute("name"))
  8186. {
  8187. QMenu*menu= bar->addMenu(element.attribute("name"));
  8188. menu->setParent(bar);
  8189. if(element.hasAttribute("type"))
  8190. {
  8191. if(element.attribute("type")=="reports")
  8192. {
  8193. if(element.hasAttribute("src"))
  8194. {
  8195. /*536:*/
  8196. #line 12739 "./typica.w"
  8197. QSettings settings;
  8198. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  8199. arg(element.attribute("src")));
  8200. directory.setFilter(QDir::Files);
  8201. directory.setSorting(QDir::Name);
  8202. QStringList nameFilter;
  8203. nameFilter<<"*.xml";
  8204. directory.setNameFilters(nameFilter);
  8205. QFileInfoList reportFiles= directory.entryInfoList();
  8206. for(int i= 0;i<reportFiles.size();i++)
  8207. {
  8208. QFileInfo reportFile= reportFiles.at(i);
  8209. /*540:*/
  8210. #line 12816 "./typica.w"
  8211. QString path= reportFile.absoluteFilePath();
  8212. QFile file(path);
  8213. if(file.open(QIODevice::ReadOnly))
  8214. {
  8215. QDomDocument document;
  8216. document.setContent(&file,true);
  8217. QDomElement root= document.documentElement();
  8218. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  8219. if(!titleNode.isNull())
  8220. {
  8221. QDomElement titleElement= titleNode.toElement();
  8222. QString title= titleElement.text();
  8223. if(!title.isEmpty())
  8224. {
  8225. QStringList hierarchy= title.split(":->");
  8226. QMenu*insertionPoint= menu;
  8227. /*541:*/
  8228. #line 12843 "./typica.w"
  8229. for(int j= 0;j<hierarchy.size()-1;j++)
  8230. {
  8231. QObjectList menuList= insertionPoint->children();
  8232. bool menuFound= false;
  8233. for(int k= 0;k<menuList.size();k++)
  8234. {
  8235. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  8236. if(currentItem)
  8237. {
  8238. if(currentItem->title()==hierarchy.at(j))
  8239. {
  8240. menuFound= true;
  8241. insertionPoint= currentItem;
  8242. break;
  8243. }
  8244. }
  8245. }
  8246. if(!menuFound)
  8247. {
  8248. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  8249. }
  8250. }
  8251. /*:541*/
  8252. #line 12833 "./typica.w"
  8253. ReportAction*action= new ReportAction(path,hierarchy.last());
  8254. insertionPoint->addAction(action);
  8255. }
  8256. }
  8257. }
  8258. /*:540*/
  8259. #line 12752 "./typica.w"
  8260. }
  8261. /*:536*/
  8262. #line 3992 "./typica.w"
  8263. }
  8264. }
  8265. }
  8266. if(element.hasChildNodes())
  8267. {
  8268. /*164:*/
  8269. #line 4005 "./typica.w"
  8270. QDomNodeList menuItems= element.childNodes();
  8271. int j= 0;
  8272. while(j<menuItems.count())
  8273. {
  8274. QDomNode item= menuItems.at(j);
  8275. if(item.isElement())
  8276. {
  8277. QDomElement itemElement= item.toElement();
  8278. if(itemElement.tagName()=="item")
  8279. {
  8280. QAction*itemAction= new QAction(itemElement.text(),menu);
  8281. if(itemElement.hasAttribute("id"))
  8282. {
  8283. itemAction->setObjectName(itemElement.attribute("id"));
  8284. }
  8285. if(itemElement.hasAttribute("shortcut"))
  8286. {
  8287. itemAction->setShortcut(itemElement.attribute("shortcut"));
  8288. }
  8289. menu->addAction(itemAction);
  8290. }
  8291. else if(itemElement.tagName()=="separator")
  8292. {
  8293. menu->addSeparator();
  8294. }
  8295. }
  8296. j++;
  8297. }
  8298. /*:164*/
  8299. #line 3998 "./typica.w"
  8300. }
  8301. }
  8302. /*:163*/
  8303. #line 3956 "./typica.w"
  8304. }
  8305. }
  8306. i++;
  8307. }
  8308. QScriptValue oldThis= context->thisObject();
  8309. context->setThisObject(object);
  8310. QScriptValue result= engine->evaluate(windowScript);
  8311. /*156:*/
  8312. #line 3739 "./typica.w"
  8313. if(engine->hasUncaughtException())
  8314. {
  8315. int line= engine->uncaughtExceptionLineNumber();
  8316. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  8317. result.toString();
  8318. QString trace;
  8319. foreach(trace,engine->uncaughtExceptionBacktrace())
  8320. {
  8321. qDebug()<<trace;
  8322. }
  8323. }
  8324. /*:156*/
  8325. #line 3964 "./typica.w"
  8326. context->setThisObject(oldThis);
  8327. /*:162*/
  8328. #line 3901 "./typica.w"
  8329. }
  8330. if(window)
  8331. {
  8332. window->show();
  8333. }
  8334. else
  8335. {
  8336. qDebug()<<"Error! Window invalidated";
  8337. }
  8338. /*:161*/
  8339. #line 12805 "./typica.w"
  8340. file.close();
  8341. engine->popContext();
  8342. }
  8343. }
  8344. /*:539*/
  8345. #line 820 "./typica.w"
  8346. /*192:*/
  8347. #line 5051 "./typica.w"
  8348. NumericDelegate::NumericDelegate(QObject*parent):
  8349. QItemDelegate(parent)
  8350. {
  8351. }
  8352. /*:192*//*193:*/
  8353. #line 5063 "./typica.w"
  8354. void NumericDelegate::setEditorData(QWidget*editor,
  8355. const QModelIndex&index)const
  8356. {
  8357. QString value= index.model()->data(index,Qt::EditRole).toString();
  8358. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8359. line->setText(value);
  8360. }
  8361. /*:193*//*194:*/
  8362. #line 5078 "./typica.w"
  8363. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  8364. const QModelIndex&index)const
  8365. {
  8366. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8367. model->setData(index,line->text(),Qt::EditRole);
  8368. QScriptEngine*engine= AppInstance->engine;
  8369. engine->pushContext();
  8370. QString script= QString("Number(%1)").arg(line->text());
  8371. QScriptValue result= engine->evaluate(line->text());
  8372. if(result.isNumber())
  8373. {
  8374. model->setData(index,result.toVariant(),Qt::DisplayRole);
  8375. }
  8376. else
  8377. {
  8378. model->setData(index,QVariant(),Qt::DisplayRole);
  8379. }
  8380. engine->popContext();
  8381. }
  8382. /*:194*//*195:*/
  8383. #line 5101 "./typica.w"
  8384. QWidget*NumericDelegate::createEditor(QWidget*parent,
  8385. const QStyleOptionViewItem&,
  8386. const QModelIndex&)const
  8387. {
  8388. return(new QLineEdit(parent));
  8389. }
  8390. /*:195*//*196:*/
  8391. #line 5112 "./typica.w"
  8392. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  8393. const QStyleOptionViewItem&option,
  8394. const QModelIndex&)const
  8395. {
  8396. editor->setGeometry(option.rect);
  8397. }
  8398. /*:196*/
  8399. #line 821 "./typica.w"
  8400. /*660:*/
  8401. #line 15420 "./typica.w"
  8402. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  8403. const QModelIndex&index)
  8404. :BasicDeviceConfigurationWidget(model,index)
  8405. {
  8406. QHBoxLayout*layout= new QHBoxLayout;
  8407. QToolButton*addDeviceButton= new QToolButton;
  8408. addDeviceButton->setText(tr("Add Device"));
  8409. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8410. "nidaqmx9211series");
  8411. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  8412. "nidaqmxtc01");
  8413. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8414. this,SLOT(insertChildNode(QString,QString)));
  8415. connect(addtc01,SIGNAL(triggered(QString,QString)),
  8416. this,SLOT(insertChildNode(QString,QString)));
  8417. QMenu*deviceMenu= new QMenu;
  8418. deviceMenu->addAction(add9211a);
  8419. deviceMenu->addAction(addtc01);
  8420. addDeviceButton->setMenu(deviceMenu);
  8421. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8422. layout->addWidget(addDeviceButton);
  8423. setLayout(layout);
  8424. }
  8425. /*:660*/
  8426. #line 822 "./typica.w"
  8427. /*662:*/
  8428. #line 15469 "./typica.w"
  8429. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  8430. const QModelIndex&index)
  8431. :BasicDeviceConfigurationWidget(model,index)
  8432. {
  8433. QVBoxLayout*layout= new QVBoxLayout;
  8434. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8435. QLabel*label= new QLabel(tr("Device ID:"));
  8436. QLineEdit*deviceId= new QLineEdit;
  8437. deviceIdLayout->addWidget(label);
  8438. deviceIdLayout->addWidget(deviceId);
  8439. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8440. layout->addLayout(deviceIdLayout);
  8441. layout->addWidget(addChannelButton);
  8442. /*645:*/
  8443. #line 15133 "./typica.w"
  8444. QDomElement referenceElement=
  8445. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8446. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8447. QDomElement node;
  8448. /*:645*/
  8449. #line 15483 "./typica.w"
  8450. for(int i= 0;i<configData.size();i++)
  8451. {
  8452. node= configData.at(i).toElement();
  8453. if(node.attribute("name")=="deviceID")
  8454. {
  8455. deviceId->setText(node.attribute("value","Dev1"));
  8456. break;
  8457. }
  8458. }
  8459. updateDeviceId(deviceId->text());
  8460. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  8461. connect(deviceId,SIGNAL(textEdited(QString)),
  8462. this,SLOT(updateDeviceId(QString)));
  8463. setLayout(layout);
  8464. }
  8465. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  8466. {
  8467. updateAttribute("deviceID",newId);
  8468. }
  8469. void NiDaqMx9211ConfWidget::addChannel()
  8470. {
  8471. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8472. }
  8473. /*:662*/
  8474. #line 823 "./typica.w"
  8475. /*664:*/
  8476. #line 15533 "./typica.w"
  8477. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  8478. const QModelIndex&index)
  8479. :BasicDeviceConfigurationWidget(model,index)
  8480. {
  8481. QFormLayout*layout= new QFormLayout;
  8482. QLineEdit*deviceId= new QLineEdit;
  8483. layout->addRow(tr("Device ID:"),deviceId);
  8484. QLineEdit*columnName= new QLineEdit;
  8485. layout->addRow(tr("Column Name:"),columnName);
  8486. QComboBox*typeSelector= new QComboBox;
  8487. typeSelector->addItem("J");
  8488. typeSelector->addItem("K");
  8489. typeSelector->addItem("T");
  8490. typeSelector->addItem("B");
  8491. typeSelector->addItem("E");
  8492. typeSelector->addItem("N");
  8493. typeSelector->addItem("R");
  8494. typeSelector->addItem("S");
  8495. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8496. /*645:*/
  8497. #line 15133 "./typica.w"
  8498. QDomElement referenceElement=
  8499. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8500. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8501. QDomElement node;
  8502. /*:645*/
  8503. #line 15553 "./typica.w"
  8504. for(int i= 0;i<configData.size();i++)
  8505. {
  8506. node= configData.at(i).toElement();
  8507. if(node.attribute("name")=="deviceID")
  8508. {
  8509. deviceId->setText(node.attribute("value"));
  8510. }
  8511. else if(node.attribute("name")=="type")
  8512. {
  8513. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  8514. }
  8515. else if(node.attribute("name")=="columnname")
  8516. {
  8517. columnName->setText(node.attribute("value"));
  8518. }
  8519. }
  8520. updateDeviceId(deviceId->text());
  8521. updateThermocoupleType(typeSelector->currentText());
  8522. updateColumnName(columnName->text());
  8523. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  8524. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  8525. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8526. setLayout(layout);
  8527. }
  8528. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  8529. {
  8530. updateAttribute("deviceID",newId);
  8531. }
  8532. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  8533. {
  8534. updateAttribute("type",type);
  8535. }
  8536. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  8537. {
  8538. updateAttribute("columnname",name);
  8539. }
  8540. /*:664*/
  8541. #line 824 "./typica.w"
  8542. /*682:*/
  8543. #line 15954 "./typica.w"
  8544. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  8545. const QModelIndex&index)
  8546. :BasicDeviceConfigurationWidget(model,index)
  8547. {
  8548. QFormLayout*layout= new QFormLayout;
  8549. QToolButton*addDeviceButton= new QToolButton;
  8550. addDeviceButton->setText(tr("Add Device"));
  8551. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  8552. "Modbus RTU Device",
  8553. "modbusrtudevice");
  8554. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  8555. this,SLOT(insertChildNode(QString,QString)));
  8556. QMenu*deviceMenu= new QMenu;
  8557. deviceMenu->addAction(addModbusRtuDevice);
  8558. addDeviceButton->setMenu(deviceMenu);
  8559. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8560. layout->addRow(QString(),addDeviceButton);
  8561. PortSelector*port= new PortSelector;
  8562. layout->addRow(tr("Port:"),port);
  8563. connect(port,SIGNAL(currentIndexChanged(QString)),
  8564. this,SLOT(updatePort(QString)));
  8565. connect(port,SIGNAL(editTextChanged(QString)),
  8566. this,SLOT(updatePort(QString)));
  8567. BaudSelector*rate= new BaudSelector;
  8568. layout->addRow(tr("Baud:"),rate);
  8569. connect(rate,SIGNAL(currentIndexChanged(QString)),
  8570. this,SLOT(updateBaudRate(QString)));
  8571. ParitySelector*parity= new ParitySelector;
  8572. layout->addRow(tr("Parity:"),parity);
  8573. connect(parity,SIGNAL(currentIndexChanged(QString)),
  8574. this,SLOT(updateParity(QString)));
  8575. FlowSelector*flow= new FlowSelector;
  8576. layout->addRow(tr("Flow Control:"),flow);
  8577. connect(flow,SIGNAL(currentIndexChanged(QString)),
  8578. this,SLOT(updateFlowControl(QString)));
  8579. StopSelector*stop= new StopSelector;
  8580. layout->addRow(tr("Stop Bits:"),stop);
  8581. connect(stop,SIGNAL(currentIndexChanged(QString)),
  8582. this,SLOT(updateStopBits(QString)));
  8583. /*645:*/
  8584. #line 15133 "./typica.w"
  8585. QDomElement referenceElement=
  8586. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8587. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8588. QDomElement node;
  8589. /*:645*/
  8590. #line 15994 "./typica.w"
  8591. for(int i= 0;i<configData.size();i++)
  8592. {
  8593. node= configData.at(i).toElement();
  8594. if(node.attribute("name")=="port")
  8595. {
  8596. int j= port->findText(node.attribute("value"));
  8597. if(j>=0)
  8598. {
  8599. port->setCurrentIndex(j);
  8600. }
  8601. else
  8602. {
  8603. port->insertItem(0,node.attribute("value"));
  8604. port->setCurrentIndex(0);
  8605. }
  8606. }
  8607. else if(node.attribute("name")=="baudrate")
  8608. {
  8609. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  8610. }
  8611. else if(node.attribute("name")=="parity")
  8612. {
  8613. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  8614. }
  8615. else if(node.attribute("name")=="flowcontrol")
  8616. {
  8617. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  8618. }
  8619. else if(node.attribute("name")=="stopbits")
  8620. {
  8621. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  8622. }
  8623. }
  8624. updatePort(port->currentText());
  8625. updateBaudRate(rate->currentText());
  8626. updateParity(parity->currentText());
  8627. updateFlowControl(flow->currentText());
  8628. updateStopBits(stop->currentText());
  8629. setLayout(layout);
  8630. }
  8631. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  8632. {
  8633. updateAttribute("port",newPort);
  8634. }
  8635. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  8636. {
  8637. updateAttribute("baudrate",newRate);
  8638. }
  8639. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  8640. {
  8641. updateAttribute("parity",newParity);
  8642. }
  8643. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  8644. {
  8645. updateAttribute("flowcontrol",newFlow);
  8646. }
  8647. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  8648. {
  8649. updateAttribute("stopbits",newStopBits);
  8650. }
  8651. /*:682*/
  8652. #line 825 "./typica.w"
  8653. /*684:*/
  8654. #line 16117 "./typica.w"
  8655. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  8656. const QModelIndex&index)
  8657. :BasicDeviceConfigurationWidget(model,index),
  8658. unitSpecificationLayout(new QStackedLayout),
  8659. decimalSpecificationLayout(new QStackedLayout)
  8660. {
  8661. QVBoxLayout*layout= new QVBoxLayout;
  8662. QToolButton*addChannelButton= new QToolButton;
  8663. addChannelButton->setText(tr("Add Channel"));
  8664. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  8665. "Temperature Process Value",
  8666. "modbustemperaturepv");
  8667. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  8668. "Temperature Set Value",
  8669. "modbustemperaturesv");
  8670. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  8671. this,SLOT(insertChildNode(QString,QString)));
  8672. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  8673. this,SLOT(insertChildNode(QString,QString)));
  8674. QMenu*channelMenu= new QMenu;
  8675. channelMenu->addAction(addTemperaturePV);
  8676. channelMenu->addAction(addTemperatureSV);
  8677. addChannelButton->setMenu(channelMenu);
  8678. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  8679. layout->addWidget(addChannelButton);
  8680. QHBoxLayout*stationLayout= new QHBoxLayout;
  8681. QLabel*stationLabel= new QLabel(tr("Station:"));
  8682. QSpinBox*stationNumber= new QSpinBox;
  8683. stationNumber->setMinimum(0);
  8684. stationNumber->setMaximum(255);
  8685. stationLayout->addWidget(stationLabel);
  8686. stationLayout->addWidget(stationNumber);
  8687. layout->addLayout(stationLayout);
  8688. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  8689. layout->addWidget(fixedUnit);
  8690. QWidget*fixedUnitPlaceholder= new QWidget(this);
  8691. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  8692. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  8693. QComboBox*fixedUnitSelector= new QComboBox;
  8694. fixedUnitSelector->addItem("Fahrenheit");
  8695. fixedUnitSelector->addItem("Celsius");
  8696. fixedUnitLayout->addWidget(fixedUnitLabel);
  8697. fixedUnitLayout->addWidget(fixedUnitSelector);
  8698. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  8699. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  8700. QWidget*queriedUnitPlaceholder= new QWidget(this);
  8701. QFormLayout*queriedUnitLayout= new QFormLayout;
  8702. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  8703. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  8704. QSpinBox*valueF= new QSpinBox;
  8705. valueF->setMinimum(0);
  8706. valueF->setMaximum(65535);
  8707. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  8708. QSpinBox*valueC= new QSpinBox;
  8709. valueC->setMinimum(0);
  8710. valueC->setMaximum(65535);
  8711. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  8712. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  8713. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  8714. layout->addLayout(unitSpecificationLayout);
  8715. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  8716. layout->addWidget(fixedPrecision);
  8717. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  8718. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  8719. QSpinBox*fixedPrecisionValue= new QSpinBox;
  8720. fixedPrecisionValue->setMinimum(0);
  8721. fixedPrecisionValue->setMaximum(9);
  8722. fixedPrecisionLayout->addRow("Places after the decimal point:",
  8723. fixedPrecisionValue);
  8724. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  8725. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  8726. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  8727. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  8728. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  8729. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  8730. precisionAddress);
  8731. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  8732. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  8733. layout->addLayout(decimalSpecificationLayout);
  8734. /*645:*/
  8735. #line 15133 "./typica.w"
  8736. QDomElement referenceElement=
  8737. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8738. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8739. QDomElement node;
  8740. /*:645*/
  8741. #line 16197 "./typica.w"
  8742. for(int i= 0;i<configData.size();i++)
  8743. {
  8744. node= configData.at(i).toElement();
  8745. if(node.attribute("name")=="station")
  8746. {
  8747. stationNumber->setValue(node.attribute("value").toInt());
  8748. }
  8749. else if(node.attribute("name")=="fixedunit")
  8750. {
  8751. if(node.attribute("value")=="true")
  8752. {
  8753. fixedUnit->setCheckState(Qt::Checked);
  8754. }
  8755. else if(node.attribute("value")=="false")
  8756. {
  8757. fixedUnit->setCheckState(Qt::Unchecked);
  8758. }
  8759. }
  8760. else if(node.attribute("name")=="fixedprecision")
  8761. {
  8762. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8763. }
  8764. else if(node.attribute("name")=="unit")
  8765. {
  8766. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  8767. }
  8768. else if(node.attribute("name")=="unitaddress")
  8769. {
  8770. unitAddress->setValue(node.attribute("value").toInt());
  8771. }
  8772. else if(node.attribute("name")=="fvalue")
  8773. {
  8774. valueF->setValue(node.attribute("value").toInt());
  8775. }
  8776. else if(node.attribute("name")=="cvalue")
  8777. {
  8778. valueC->setValue(node.attribute("value").toInt());
  8779. }
  8780. else if(node.attribute("name")=="precisionaddress")
  8781. {
  8782. precisionAddress->setValue(node.attribute("value").toInt());
  8783. }
  8784. else if(node.attribute("name")=="precision")
  8785. {
  8786. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8787. }
  8788. }
  8789. updateStationNumber(stationNumber->value());
  8790. updateFixedUnit(fixedUnit->isChecked());
  8791. updateFixedDecimal(fixedPrecision->isChecked());
  8792. updateUnit(fixedUnitSelector->currentText());
  8793. updateUnitAddress(unitAddress->value());
  8794. updateValueF(valueF->value());
  8795. updateValueC(valueC->value());
  8796. updatePrecisionAddress(precisionAddress->value());
  8797. updatePrecisionValue(fixedPrecisionValue->value());
  8798. connect(stationNumber,SIGNAL(valueChanged(int)),
  8799. this,SLOT(updateStationNumber(int)));
  8800. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  8801. this,SLOT(updateUnit(QString)));
  8802. connect(unitAddress,SIGNAL(valueChanged(int)),
  8803. this,SLOT(updateUnitAddress(int)));
  8804. connect(valueF,SIGNAL(valueChanged(int)),
  8805. this,SLOT(updateValueF(int)));
  8806. connect(valueC,SIGNAL(valueChanged(int)),
  8807. this,SLOT(updateValueC(int)));
  8808. connect(fixedUnit,SIGNAL(toggled(bool)),
  8809. this,SLOT(updateFixedUnit(bool)));
  8810. connect(fixedPrecision,SIGNAL(toggled(bool)),
  8811. this,SLOT(updateFixedDecimal(bool)));
  8812. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  8813. this,SLOT(updatePrecisionValue(int)));
  8814. connect(precisionAddress,SIGNAL(valueChanged(int)),
  8815. this,SLOT(updatePrecisionAddress(int)));
  8816. setLayout(layout);
  8817. }
  8818. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  8819. {
  8820. updateAttribute("station",QString("%1").arg(newStation));
  8821. }
  8822. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  8823. {
  8824. if(newFixed)
  8825. {
  8826. unitSpecificationLayout->setCurrentIndex(0);
  8827. updateAttribute("fixedunit","true");
  8828. }
  8829. else
  8830. {
  8831. unitSpecificationLayout->setCurrentIndex(1);
  8832. updateAttribute("fixedunit","false");
  8833. }
  8834. }
  8835. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  8836. {
  8837. if(newFixed)
  8838. {
  8839. decimalSpecificationLayout->setCurrentIndex(0);
  8840. updateAttribute("fixedprecision","true");
  8841. }
  8842. else
  8843. {
  8844. decimalSpecificationLayout->setCurrentIndex(1);
  8845. updateAttribute("fixedprecision","false");
  8846. }
  8847. }
  8848. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  8849. {
  8850. updateAttribute("unit",newUnit);
  8851. }
  8852. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  8853. {
  8854. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  8855. }
  8856. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  8857. {
  8858. updateAttribute("fvalue",QString("%1").arg(newValue));
  8859. }
  8860. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  8861. {
  8862. updateAttribute("cvalue",QString("%1").arg(newValue));
  8863. }
  8864. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  8865. {
  8866. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  8867. }
  8868. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  8869. {
  8870. updateAttribute("precision",QString("%1").arg(newValue));
  8871. }
  8872. /*:684*/
  8873. #line 826 "./typica.w"
  8874. /*686:*/
  8875. #line 16360 "./typica.w"
  8876. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  8877. const QModelIndex&index)
  8878. :BasicDeviceConfigurationWidget(model,index)
  8879. {
  8880. QFormLayout*layout= new QFormLayout;
  8881. ShortHexSpinBox*address= new ShortHexSpinBox;
  8882. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  8883. /*645:*/
  8884. #line 15133 "./typica.w"
  8885. QDomElement referenceElement=
  8886. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8887. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8888. QDomElement node;
  8889. /*:645*/
  8890. #line 16368 "./typica.w"
  8891. for(int i= 0;i<configData.size();i++)
  8892. {
  8893. node= configData.at(i).toElement();
  8894. if(node.attribute("name")=="address")
  8895. {
  8896. address->setValue(node.attribute("value").toInt());
  8897. break;
  8898. }
  8899. }
  8900. updateAddress(address->value());
  8901. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  8902. setLayout(layout);
  8903. }
  8904. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  8905. {
  8906. updateAttribute("address",QString("%1").arg(newAddress));
  8907. }
  8908. /*:686*/
  8909. #line 827 "./typica.w"
  8910. /*688:*/
  8911. #line 16416 "./typica.w"
  8912. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  8913. const QModelIndex&index)
  8914. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  8915. {
  8916. QVBoxLayout*layout= new QVBoxLayout;
  8917. QFormLayout*addressLayout= new QFormLayout;
  8918. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  8919. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  8920. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  8921. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  8922. layout->addLayout(addressLayout);
  8923. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  8924. layout->addWidget(fixedRange);
  8925. QWidget*queriedRangePlaceholder= new QWidget(this);
  8926. QFormLayout*queriedRangeLayout= new QFormLayout;
  8927. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  8928. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  8929. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  8930. lowerAddress);
  8931. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  8932. upperAddress);
  8933. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  8934. boundsLayout->addWidget(queriedRangePlaceholder);
  8935. QWidget*fixedRangePlaceholder= new QWidget(this);
  8936. QFormLayout*fixedRangeLayout= new QFormLayout;
  8937. QLineEdit*fixedLower= new QLineEdit;
  8938. QLineEdit*fixedUpper= new QLineEdit;
  8939. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  8940. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  8941. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  8942. boundsLayout->addWidget(fixedRangePlaceholder);
  8943. layout->addLayout(boundsLayout);
  8944. /*645:*/
  8945. #line 15133 "./typica.w"
  8946. QDomElement referenceElement=
  8947. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8948. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8949. QDomElement node;
  8950. /*:645*/
  8951. #line 16449 "./typica.w"
  8952. for(int i= 0;i<configData.size();i++)
  8953. {
  8954. node= configData.at(i).toElement();
  8955. if(node.attribute("name")=="readaddress")
  8956. {
  8957. readAddress->setValue(node.attribute("value").toInt());
  8958. }
  8959. else if(node.attribute("name")=="writeaddress")
  8960. {
  8961. writeAddress->setValue(node.attribute("value").toInt());
  8962. }
  8963. else if(node.attribute("name")=="fixedrange")
  8964. {
  8965. if(node.attribute("value")=="true")
  8966. {
  8967. fixedRange->setCheckState(Qt::Checked);
  8968. }
  8969. else if(node.attribute("value")=="false")
  8970. {
  8971. fixedRange->setCheckState(Qt::Unchecked);
  8972. }
  8973. }
  8974. else if(node.attribute("name")=="fixedlower")
  8975. {
  8976. fixedLower->setText(node.attribute("value"));
  8977. }
  8978. else if(node.attribute("name")=="fixedupper")
  8979. {
  8980. fixedUpper->setText(node.attribute("value"));
  8981. }
  8982. else if(node.attribute("name")=="loweraddress")
  8983. {
  8984. lowerAddress->setValue(node.attribute("value").toInt());
  8985. }
  8986. else if(node.attribute("name")=="upperaddress")
  8987. {
  8988. upperAddress->setValue(node.attribute("value").toInt());
  8989. }
  8990. }
  8991. updateReadAddress(readAddress->value());
  8992. updateWriteAddress(writeAddress->value());
  8993. updateFixedRange(fixedRange->isChecked());
  8994. updateLower(fixedLower->text());
  8995. updateUpper(fixedUpper->text());
  8996. updateLowerAddress(lowerAddress->value());
  8997. updateUpperAddress(upperAddress->value());
  8998. connect(readAddress,SIGNAL(valueChanged(int)),
  8999. this,SLOT(updateReadAddress(int)));
  9000. connect(writeAddress,SIGNAL(valueChanged(int)),
  9001. this,SLOT(updateWriteAddress(int)));
  9002. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  9003. connect(fixedLower,SIGNAL(textChanged(QString)),
  9004. this,SLOT(updateLower(QString)));
  9005. connect(fixedUpper,SIGNAL(textChanged(QString)),
  9006. this,SLOT(updateUpper(QString)));
  9007. connect(lowerAddress,SIGNAL(valueChanged(int)),
  9008. this,SLOT(updateLowerAddress(int)));
  9009. connect(upperAddress,SIGNAL(valueChanged(int)),
  9010. this,SLOT(updateUpperAddress(int)));
  9011. setLayout(layout);
  9012. }
  9013. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  9014. {
  9015. updateAttribute("readaddress",QString("%1").arg(newAddress));
  9016. }
  9017. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  9018. {
  9019. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  9020. }
  9021. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  9022. {
  9023. if(fixed)
  9024. {
  9025. updateAttribute("fixedrange","true");
  9026. boundsLayout->setCurrentIndex(1);
  9027. }
  9028. else
  9029. {
  9030. updateAttribute("fixedrange","false");
  9031. boundsLayout->setCurrentIndex(0);
  9032. }
  9033. }
  9034. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  9035. {
  9036. updateAttribute("fixedlower",lower);
  9037. }
  9038. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  9039. {
  9040. updateAttribute("fixedupper",upper);
  9041. }
  9042. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  9043. {
  9044. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  9045. }
  9046. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  9047. {
  9048. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  9049. }
  9050. /*:688*/
  9051. #line 828 "./typica.w"
  9052. /*644:*/
  9053. #line 15063 "./typica.w"
  9054. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9055. :BasicDeviceConfigurationWidget(model,index)
  9056. {
  9057. QVBoxLayout*layout= new QVBoxLayout;
  9058. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  9059. QMenu*deviceMenu= new QMenu;
  9060. NodeInserter*insertAction;
  9061. foreach(insertAction,AppInstance->topLevelNodeInserters)
  9062. {
  9063. connect(insertAction,SIGNAL(triggered(QString,QString)),
  9064. this,SLOT(insertChildNode(QString,QString)));
  9065. deviceMenu->addAction(insertAction);
  9066. }
  9067. addDeviceButton->setMenu(deviceMenu);
  9068. layout->addWidget(addDeviceButton);
  9069. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  9070. QMenu*annotationMenu= new QMenu;
  9071. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  9072. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  9073. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  9074. annotationMenu->addAction(basicButtonInserter);
  9075. annotationMenu->addAction(countingButtonInserter);
  9076. annotationMenu->addAction(spinBoxInserter);
  9077. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  9078. this,SLOT(insertChildNode(QString,QString)));
  9079. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  9080. this,SLOT(insertChildNode(QString,QString)));
  9081. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  9082. this,SLOT(insertChildNode(QString,QString)));
  9083. addAnnotationControlButton->setMenu(annotationMenu);
  9084. layout->addWidget(addAnnotationControlButton);
  9085. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  9086. QMenu*advancedMenu= new QMenu;
  9087. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  9088. advancedMenu->addAction(linearsplineinserter);
  9089. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  9090. advancedMenu->addAction(translationinserter);
  9091. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9092. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9093. advancedButton->setMenu(advancedMenu);
  9094. layout->addWidget(advancedButton);
  9095. QHBoxLayout*idLayout= new QHBoxLayout;
  9096. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  9097. idLayout->addWidget(idLabel);
  9098. QSpinBox*id= new QSpinBox;
  9099. idLayout->addWidget(id);
  9100. layout->addLayout(idLayout);
  9101. /*645:*/
  9102. #line 15133 "./typica.w"
  9103. QDomElement referenceElement=
  9104. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9105. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9106. QDomElement node;
  9107. /*:645*/
  9108. #line 15111 "./typica.w"
  9109. for(int i= 0;i<configData.size();i++)
  9110. {
  9111. node= configData.at(i).toElement();
  9112. if(node.attribute("name")=="databaseid")
  9113. {
  9114. id->setValue(node.attribute("value").toInt());
  9115. break;
  9116. }
  9117. }
  9118. updateRoasterId(id->value());
  9119. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  9120. setLayout(layout);
  9121. }
  9122. /*:644*//*646:*/
  9123. #line 15143 "./typica.w"
  9124. void RoasterConfWidget::updateRoasterId(int id)
  9125. {
  9126. updateAttribute("databaseid",QString("%1").arg(id));
  9127. }
  9128. /*:646*/
  9129. #line 829 "./typica.w"
  9130. /*692:*/
  9131. #line 16599 "./typica.w"
  9132. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9133. :BasicDeviceConfigurationWidget(model,index)
  9134. {
  9135. QFormLayout*layout= new QFormLayout;
  9136. QLineEdit*buttonTextEdit= new QLineEdit;
  9137. QLineEdit*annotationTextEdit= new QLineEdit;
  9138. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9139. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9140. /*645:*/
  9141. #line 15133 "./typica.w"
  9142. QDomElement referenceElement=
  9143. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9144. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9145. QDomElement node;
  9146. /*:645*/
  9147. #line 16608 "./typica.w"
  9148. for(int i= 0;i<configData.size();i++)
  9149. {
  9150. node= configData.at(i).toElement();
  9151. if(node.attribute("name")=="buttontext")
  9152. {
  9153. buttonTextEdit->setText(node.attribute("value"));
  9154. }
  9155. else if(node.attribute("name")=="annotationtext")
  9156. {
  9157. annotationTextEdit->setText(node.attribute("value"));
  9158. }
  9159. }
  9160. updateButtonText(buttonTextEdit->text());
  9161. updateAnnotationText(annotationTextEdit->text());
  9162. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9163. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9164. setLayout(layout);
  9165. }
  9166. /*:692*//*693:*/
  9167. #line 16630 "./typica.w"
  9168. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  9169. {
  9170. updateAttribute("buttontext",text);
  9171. }
  9172. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9173. {
  9174. updateAttribute("annotationtext",text);
  9175. }
  9176. /*:693*//*696:*/
  9177. #line 16668 "./typica.w"
  9178. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9179. :BasicDeviceConfigurationWidget(model,index)
  9180. {
  9181. QFormLayout*layout= new QFormLayout;
  9182. QLineEdit*buttonTextEdit= new QLineEdit;
  9183. QLineEdit*annotationTextEdit= new QLineEdit;
  9184. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9185. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9186. /*645:*/
  9187. #line 15133 "./typica.w"
  9188. QDomElement referenceElement=
  9189. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9190. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9191. QDomElement node;
  9192. /*:645*/
  9193. #line 16677 "./typica.w"
  9194. for(int i= 0;i<configData.size();i++)
  9195. {
  9196. node= configData.at(i).toElement();
  9197. if(node.attribute("name")=="buttontext")
  9198. {
  9199. buttonTextEdit->setText(node.attribute("value"));
  9200. }
  9201. else if(node.attribute("name")=="annotationtext")
  9202. {
  9203. annotationTextEdit->setText(node.attribute("value"));
  9204. }
  9205. }
  9206. updateButtonText(buttonTextEdit->text());
  9207. updateAnnotationText(annotationTextEdit->text());
  9208. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9209. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9210. QTextEdit*documentation= new QTextEdit;
  9211. 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."));
  9212. documentation->setReadOnly(true);
  9213. layout->addRow("",documentation);
  9214. setLayout(layout);
  9215. }
  9216. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  9217. {
  9218. updateAttribute("buttontext",text);
  9219. }
  9220. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9221. {
  9222. updateAttribute("annotationtext",text);
  9223. }
  9224. /*:696*/
  9225. #line 830 "./typica.w"
  9226. /*699:*/
  9227. #line 16745 "./typica.w"
  9228. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9229. :BasicDeviceConfigurationWidget(model,index)
  9230. {
  9231. QFormLayout*layout= new QFormLayout;
  9232. QLineEdit*labelEdit= new QLineEdit;
  9233. layout->addRow(tr("Control Label: "),labelEdit);
  9234. QLineEdit*minimumEdit= new QLineEdit;
  9235. layout->addRow(tr("Minimum Value: "),minimumEdit);
  9236. QLineEdit*maximumEdit= new QLineEdit;
  9237. layout->addRow(tr("Maximum Value: "),maximumEdit);
  9238. QSpinBox*precisionEdit= new QSpinBox;
  9239. precisionEdit->setMinimum(0);
  9240. precisionEdit->setMaximum(9);
  9241. layout->addRow(tr("Precision"),precisionEdit);
  9242. QLineEdit*pretext= new QLineEdit;
  9243. layout->addRow(tr("Prefix text"),pretext);
  9244. QLineEdit*posttext= new QLineEdit;
  9245. layout->addRow(tr("Suffix text"),posttext);
  9246. /*645:*/
  9247. #line 15133 "./typica.w"
  9248. QDomElement referenceElement=
  9249. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9250. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9251. QDomElement node;
  9252. /*:645*/
  9253. #line 16764 "./typica.w"
  9254. for(int i= 0;i<configData.size();i++)
  9255. {
  9256. node= configData.at(i).toElement();
  9257. if(node.attribute("name")=="label")
  9258. {
  9259. labelEdit->setText(node.attribute("value"));
  9260. }
  9261. else if(node.attribute("name")=="minimum")
  9262. {
  9263. minimumEdit->setText(node.attribute("value"));
  9264. }
  9265. else if(node.attribute("name")=="maximum")
  9266. {
  9267. maximumEdit->setText(node.attribute("value"));
  9268. }
  9269. else if(node.attribute("name")=="precision")
  9270. {
  9271. precisionEdit->setValue(node.attribute("value").toInt());
  9272. }
  9273. else if(node.attribute("name")=="pretext")
  9274. {
  9275. pretext->setText(node.attribute("value"));
  9276. }
  9277. else if(node.attribute("name")=="posttext")
  9278. {
  9279. posttext->setText(node.attribute("value"));
  9280. }
  9281. }
  9282. updateLabel(labelEdit->text());
  9283. updateMinimum(minimumEdit->text());
  9284. updateMaximum(maximumEdit->text());
  9285. updatePrecision(precisionEdit->value());
  9286. updatePretext(pretext->text());
  9287. updatePosttext(posttext->text());
  9288. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  9289. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  9290. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  9291. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  9292. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  9293. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  9294. setLayout(layout);
  9295. }
  9296. void NoteSpinConfWidget::updateLabel(const QString&text)
  9297. {
  9298. updateAttribute("label",text);
  9299. }
  9300. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  9301. {
  9302. updateAttribute("minimum",minimum);
  9303. }
  9304. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  9305. {
  9306. updateAttribute("maximum",maximum);
  9307. }
  9308. void NoteSpinConfWidget::updatePrecision(int precision)
  9309. {
  9310. updateAttribute("precision",QString("%1").arg(precision));
  9311. }
  9312. void NoteSpinConfWidget::updatePretext(const QString&text)
  9313. {
  9314. updateAttribute("pretext",text);
  9315. }
  9316. void NoteSpinConfWidget::updatePosttext(const QString&text)
  9317. {
  9318. updateAttribute("posttext",text);
  9319. }
  9320. /*:699*/
  9321. #line 831 "./typica.w"
  9322. /*260:*/
  9323. #line 6844 "./typica.w"
  9324. LinearCalibrator::LinearCalibrator(QObject*parent):
  9325. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  9326. {
  9327. }
  9328. /*:260*//*261:*/
  9329. #line 6858 "./typica.w"
  9330. void LinearCalibrator::newMeasurement(Measurement measure)
  9331. {
  9332. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  9333. if(clamp)
  9334. {
  9335. if(outval<Lo1)
  9336. {
  9337. outval= Lo1;
  9338. }
  9339. else if(outval> Up1)
  9340. {
  9341. outval= Up1;
  9342. }
  9343. }
  9344. if(sensitivitySetting>=0.05)
  9345. {
  9346. int temp= qRound(outval/sensitivitySetting);
  9347. outval= temp*sensitivitySetting;
  9348. }
  9349. Measurement adjusted(outval,measure.time(),measure.scale());
  9350. emit measurement(adjusted);
  9351. }
  9352. /*:261*//*262:*/
  9353. #line 6884 "./typica.w"
  9354. double LinearCalibrator::measuredLower()
  9355. {
  9356. return Lo2;
  9357. }
  9358. double LinearCalibrator::measuredUpper()
  9359. {
  9360. return Up2;
  9361. }
  9362. double LinearCalibrator::mappedLower()
  9363. {
  9364. return Lo1;
  9365. }
  9366. double LinearCalibrator::mappedUpper()
  9367. {
  9368. return Up1;
  9369. }
  9370. bool LinearCalibrator::isClosedRange()
  9371. {
  9372. return clamp;
  9373. }
  9374. void LinearCalibrator::setMeasuredLower(double lower)
  9375. {
  9376. Lo2= lower;
  9377. }
  9378. void LinearCalibrator::setMeasuredUpper(double upper)
  9379. {
  9380. Up2= upper;
  9381. }
  9382. void LinearCalibrator::setMappedLower(double lower)
  9383. {
  9384. Lo1= lower;
  9385. }
  9386. void LinearCalibrator::setMappedUpper(double upper)
  9387. {
  9388. Up1= upper;
  9389. }
  9390. void LinearCalibrator::setClosedRange(bool closed)
  9391. {
  9392. clamp= closed;
  9393. }
  9394. void LinearCalibrator::setSensitivity(double sensitivity)
  9395. {
  9396. sensitivitySetting= sensitivity;
  9397. }
  9398. double LinearCalibrator::sensitivity()
  9399. {
  9400. return sensitivitySetting;
  9401. }
  9402. /*:262*/
  9403. #line 832 "./typica.w"
  9404. /*267:*/
  9405. #line 7017 "./typica.w"
  9406. void LinearSplineInterpolator::add_pair(double source,double destination)
  9407. {
  9408. pairs->insert(source,destination);
  9409. make_interpolators();
  9410. }
  9411. void LinearSplineInterpolator::make_interpolators()
  9412. {
  9413. if(pairs->size()> 1)
  9414. {
  9415. while(interpolators->size()> 0)
  9416. {
  9417. LinearCalibrator*removed= interpolators->takeFirst();
  9418. removed->deleteLater();
  9419. }
  9420. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9421. QMap<double,double> ::const_iterator j= i+1;
  9422. while(j!=pairs->constEnd())
  9423. {
  9424. LinearCalibrator*segment= new LinearCalibrator();
  9425. segment->setMeasuredLower(i.key());
  9426. segment->setMappedLower(i.value());
  9427. segment->setMeasuredUpper(j.key());
  9428. segment->setMappedUpper(j.value());
  9429. segment->setClosedRange(false);
  9430. interpolators->append(segment);
  9431. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  9432. i++;
  9433. j++;
  9434. }
  9435. }
  9436. }
  9437. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  9438. QObject(parent),pairs(new QMap<double,double> ),
  9439. interpolators(new QList<LinearCalibrator*> )
  9440. {
  9441. }
  9442. void LinearSplineInterpolator::newMeasurement(Measurement measure)
  9443. {
  9444. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9445. int index= -1;
  9446. while(i!=pairs->constEnd())
  9447. {
  9448. if(measure.temperature()<=i.key())
  9449. {
  9450. break;
  9451. }
  9452. i++;
  9453. index++;
  9454. }
  9455. if(index<0)
  9456. {
  9457. index= 0;
  9458. }
  9459. if(index>=interpolators->size())
  9460. {
  9461. index= interpolators->size()-1;
  9462. }
  9463. if(interpolators->at(index)!=NULL)
  9464. {
  9465. interpolators->at(index)->newMeasurement(measure);
  9466. }
  9467. }
  9468. /*:267*/
  9469. #line 833 "./typica.w"
  9470. /*721:*/
  9471. #line 18046 "./typica.w"
  9472. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9473. :BasicDeviceConfigurationWidget(model,index),knotmodel(new SaltModel(2))
  9474. {
  9475. QFormLayout*layout= new QFormLayout;
  9476. QLineEdit*source= new QLineEdit;
  9477. layout->addRow(tr("Source column name:"),source);
  9478. QLineEdit*destination= new QLineEdit;
  9479. layout->addRow(tr("Destination column name:"),destination);
  9480. knotmodel->setHeaderData(0,Qt::Horizontal,"Input");
  9481. knotmodel->setHeaderData(1,Qt::Horizontal,"Output");
  9482. QTableView*mappingTable= new QTableView;
  9483. mappingTable->setModel(knotmodel);
  9484. NumericDelegate*delegate= new NumericDelegate;
  9485. mappingTable->setItemDelegate(delegate);
  9486. layout->addRow(tr("Mapping data:"),mappingTable);
  9487. /*645:*/
  9488. #line 15133 "./typica.w"
  9489. QDomElement referenceElement=
  9490. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9491. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9492. QDomElement node;
  9493. /*:645*/
  9494. #line 18062 "./typica.w"
  9495. for(int i= 0;i<configData.size();i++)
  9496. {
  9497. node= configData.at(i).toElement();
  9498. if(node.attribute("name")=="source")
  9499. {
  9500. source->setText(node.attribute("value"));
  9501. }
  9502. else if(node.attribute("name")=="destination")
  9503. {
  9504. destination->setText(node.attribute("value"));
  9505. }
  9506. else if(node.attribute("name")=="sourcevalues")
  9507. {
  9508. /*722:*/
  9509. #line 18101 "./typica.w"
  9510. QString data= node.attribute("value");
  9511. if(data.length()> 3)
  9512. {
  9513. data.chop(2);
  9514. data= data.remove(0,2);
  9515. }
  9516. QStringList itemList= data.split(",");
  9517. /*:722*/
  9518. #line 18076 "./typica.w"
  9519. int column= 0;
  9520. /*723:*/
  9521. #line 18113 "./typica.w"
  9522. for(int i= 0;i<itemList.size();i++)
  9523. {
  9524. knotmodel->setData(knotmodel->index(i,column),
  9525. QVariant(itemList.at(i).toDouble()),
  9526. Qt::DisplayRole);
  9527. }
  9528. /*:723*/
  9529. #line 18078 "./typica.w"
  9530. }
  9531. else if(node.attribute("name")=="destinationvalues")
  9532. {
  9533. /*722:*/
  9534. #line 18101 "./typica.w"
  9535. QString data= node.attribute("value");
  9536. if(data.length()> 3)
  9537. {
  9538. data.chop(2);
  9539. data= data.remove(0,2);
  9540. }
  9541. QStringList itemList= data.split(",");
  9542. /*:722*/
  9543. #line 18083 "./typica.w"
  9544. int column= 1;
  9545. /*723:*/
  9546. #line 18113 "./typica.w"
  9547. for(int i= 0;i<itemList.size();i++)
  9548. {
  9549. knotmodel->setData(knotmodel->index(i,column),
  9550. QVariant(itemList.at(i).toDouble()),
  9551. Qt::DisplayRole);
  9552. }
  9553. /*:723*/
  9554. #line 18085 "./typica.w"
  9555. }
  9556. }
  9557. updateSourceColumn(source->text());
  9558. updateDestinationColumn(destination->text());
  9559. updateKnots();
  9560. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  9561. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  9562. connect(knotmodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  9563. setLayout(layout);
  9564. }
  9565. /*:721*//*724:*/
  9566. #line 18124 "./typica.w"
  9567. void LinearSplineInterpolationConfWidget::updateKnots()
  9568. {
  9569. updateAttribute("sourcevalues",knotmodel->arrayLiteral(0,Qt::DisplayRole));
  9570. updateAttribute("destinationvalues",knotmodel->arrayLiteral(1,Qt::DisplayRole));
  9571. }
  9572. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  9573. {
  9574. updateAttribute("source",source);
  9575. }
  9576. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  9577. {
  9578. updateAttribute("destination",dest);
  9579. }
  9580. /*:724*/
  9581. #line 834 "./typica.w"
  9582. /*727:*/
  9583. #line 18167 "./typica.w"
  9584. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9585. :BasicDeviceConfigurationWidget(model,index),
  9586. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  9587. {
  9588. unitSelector->addItem("Fahrenheit");
  9589. unitSelector->addItem("Celsius");
  9590. temperatureValue->setMinimum(0);
  9591. temperatureValue->setMaximum(1000);
  9592. QFormLayout*layout= new QFormLayout;
  9593. QLineEdit*column= new QLineEdit;
  9594. layout->addRow(tr("Column to match:"),column);
  9595. layout->addRow(tr("Unit:"),unitSelector);
  9596. layout->addRow(tr("Value:"),temperatureValue);
  9597. /*645:*/
  9598. #line 15133 "./typica.w"
  9599. QDomElement referenceElement=
  9600. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9601. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9602. QDomElement node;
  9603. /*:645*/
  9604. #line 18181 "./typica.w"
  9605. for(int i= 0;i<configData.size();i++)
  9606. {
  9607. node= configData.at(i).toElement();
  9608. if(node.attribute("name")=="column")
  9609. {
  9610. column->setText(node.attribute("value"));
  9611. }
  9612. else if(node.attribute("name")=="unit")
  9613. {
  9614. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  9615. }
  9616. else if(node.attribute("name")=="value")
  9617. {
  9618. temperatureValue->setValue(node.attribute("value").toDouble());
  9619. }
  9620. }
  9621. updateMatchingColumn(column->text());
  9622. updateTemperature();
  9623. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  9624. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  9625. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  9626. setLayout(layout);
  9627. }
  9628. /*:727*//*728:*/
  9629. #line 18210 "./typica.w"
  9630. void TranslationConfWidget::updateTemperature()
  9631. {
  9632. updateAttribute("unit",unitSelector->currentText());
  9633. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  9634. if(unitSelector->currentText()=="Fahrenheit")
  9635. {
  9636. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  9637. }
  9638. else
  9639. {
  9640. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  9641. }
  9642. }
  9643. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  9644. {
  9645. updateAttribute("column",column);
  9646. }
  9647. /*:728*/
  9648. #line 835 "./typica.w"
  9649. /*:17*/
  9650. #line 763 "./typica.w"
  9651. /*20:*/
  9652. #line 888 "./typica.w"
  9653. template<class TYPE> TYPE getself(QScriptContext*context)
  9654. {
  9655. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  9656. return self;
  9657. }
  9658. template<> QTime getself(QScriptContext*context)
  9659. {
  9660. QTime self= context->thisObject().toVariant().toTime();
  9661. return self;
  9662. }
  9663. template<> SqlQueryConnection*getself(QScriptContext*context)
  9664. {
  9665. SqlQueryConnection*self=
  9666. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  9667. return self;
  9668. }
  9669. template<> QXmlQuery*getself(QScriptContext*context)
  9670. {
  9671. QXmlQuery*self=
  9672. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  9673. return self;
  9674. }
  9675. template<> QXmlStreamWriter*getself(QScriptContext*context)
  9676. {
  9677. QXmlStreamWriter*self=
  9678. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  9679. return self;
  9680. }
  9681. template<> QXmlStreamReader*getself(QScriptContext*context)
  9682. {
  9683. QXmlStreamReader*self=
  9684. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  9685. return self;
  9686. }
  9687. /*:20*//*21:*/
  9688. #line 933 "./typica.w"
  9689. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  9690. {
  9691. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  9692. return argument;
  9693. }
  9694. template<> QString argument(int arg,QScriptContext*context)
  9695. {
  9696. return context->argument(arg).toString();
  9697. }
  9698. template<> QVariant argument(int arg,QScriptContext*context)
  9699. {
  9700. return context->argument(arg).toVariant();
  9701. }
  9702. template<> int argument(int arg,QScriptContext*context)
  9703. {
  9704. return context->argument(arg).toInt32();
  9705. }
  9706. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  9707. {
  9708. return(SqlQueryConnection*)
  9709. qscriptvalue_cast<void*> (context->argument(arg));
  9710. }
  9711. template<> QModelIndex argument(int arg,QScriptContext*context)
  9712. {
  9713. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  9714. }
  9715. /*:21*//*25:*/
  9716. #line 1010 "./typica.w"
  9717. void setQObjectProperties(QScriptValue,QScriptEngine*)
  9718. {
  9719. }
  9720. /*:25*//*27:*/
  9721. #line 1024 "./typica.w"
  9722. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  9723. {
  9724. }
  9725. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  9726. {
  9727. }
  9728. /*:27*//*30:*/
  9729. #line 1063 "./typica.w"
  9730. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  9731. {
  9732. QScriptValue object= engine->newQObject(new QWidget);
  9733. setQWidgetProperties(object,engine);
  9734. return object;
  9735. }
  9736. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  9737. {
  9738. setQObjectProperties(value,engine);
  9739. setQPaintDeviceProperties(value,engine);
  9740. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  9741. value.setProperty("activateWindow",
  9742. engine->newFunction(QWidget_activateWindow));
  9743. }
  9744. /*:30*//*31:*/
  9745. #line 1085 "./typica.w"
  9746. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  9747. {
  9748. if(context->argumentCount()==1)
  9749. {
  9750. QWidget*self= getself<QWidget*> (context);
  9751. QLayout*layout= argument<QLayout*> (0,context);
  9752. if(layout)
  9753. {
  9754. self->setLayout(layout);
  9755. }
  9756. else
  9757. {
  9758. context->throwError("Incorrect argument type passed to "
  9759. "QWidget::setLayout(). This method requires "
  9760. "a QLayout.");
  9761. }
  9762. }
  9763. else
  9764. {
  9765. context->throwError("Incorrect number of arguments passed to "
  9766. "QWidget::setLayout(). This method takes one "
  9767. "QLayout as an argument.");
  9768. }
  9769. return QScriptValue();
  9770. }
  9771. QScriptValue QWidget_activateWindow(QScriptContext*context,
  9772. QScriptEngine*)
  9773. {
  9774. QWidget*self= getself<QWidget*> (context);
  9775. self->activateWindow();
  9776. return QScriptValue();
  9777. }
  9778. /*:31*//*33:*/
  9779. #line 1159 "./typica.w"
  9780. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL)
  9781. {
  9782. }
  9783. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  9784. {
  9785. QSettings settings;
  9786. settings.beginGroup(key);
  9787. settings.setValue("pos",pos());
  9788. settings.setValue("size",size());
  9789. settings.endGroup();
  9790. }
  9791. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  9792. {
  9793. QSettings settings;
  9794. settings.beginGroup(key);
  9795. if(settings.contains("size"))
  9796. {
  9797. resize(settings.value("size").toSize());
  9798. }
  9799. if(settings.contains("pos"))
  9800. {
  9801. move(settings.value("pos").toPoint());
  9802. }
  9803. settings.endGroup();
  9804. }
  9805. void ScriptQMainWindow::displayStatus(const QString&message)
  9806. {
  9807. statusBar()->showMessage(message);
  9808. }
  9809. void ScriptQMainWindow::showEvent(QShowEvent*event)
  9810. {
  9811. if(!event->spontaneous())
  9812. {
  9813. /*35:*/
  9814. #line 1233 "./typica.w"
  9815. QSettings settings;
  9816. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  9817. toByteArray());
  9818. /*:35*/
  9819. #line 1198 "./typica.w"
  9820. event->accept();
  9821. }
  9822. else
  9823. {
  9824. event->ignore();
  9825. }
  9826. }
  9827. void ScriptQMainWindow::show()
  9828. {
  9829. QMainWindow::show();
  9830. }
  9831. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  9832. {
  9833. emit aboutToClose();
  9834. /*34:*/
  9835. #line 1227 "./typica.w"
  9836. QSettings settings;
  9837. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  9838. /*:34*/
  9839. #line 1215 "./typica.w"
  9840. event->accept();
  9841. }
  9842. /*:33*//*38:*/
  9843. #line 1261 "./typica.w"
  9844. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  9845. {
  9846. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  9847. setQMainWindowProperties(object,engine);
  9848. return object;
  9849. }
  9850. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  9851. {
  9852. setQWidgetProperties(value,engine);
  9853. value.setProperty("setCentralWidget",
  9854. engine->newFunction(QMainWindow_setCentralWidget));
  9855. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  9856. }
  9857. /*:38*//*39:*/
  9858. #line 1283 "./typica.w"
  9859. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  9860. QScriptEngine*)
  9861. {
  9862. if(context->argumentCount()==1)
  9863. {
  9864. QMainWindow*self= getself<QMainWindow*> (context);
  9865. QWidget*widget= argument<QWidget*> (0,context);
  9866. if(widget)
  9867. {
  9868. self->setCentralWidget(widget);
  9869. }
  9870. else
  9871. {
  9872. context->throwError("Incorrect argument type passed to "
  9873. "QMainWindow::setCentralWidget(). This "
  9874. "method requires a QWidget.");
  9875. }
  9876. }
  9877. else
  9878. {
  9879. context->throwError("Incorrect number of arguments passed to "
  9880. "QMainWindow::setCentralWidget(). This method "
  9881. "takes one QWidget as an argument.");
  9882. }
  9883. return QScriptValue();
  9884. }
  9885. /*:39*//*40:*/
  9886. #line 1317 "./typica.w"
  9887. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  9888. {
  9889. QScriptValue object;
  9890. if(context->argumentCount()==0)
  9891. {
  9892. QMainWindow*self= getself<QMainWindow*> (context);
  9893. QMenuBar*bar= self->menuBar();
  9894. object= engine->newQObject(bar);
  9895. setQMenuBarProperties(object,engine);
  9896. }
  9897. else
  9898. {
  9899. context->throwError("Incorrect number of arguments passed to "
  9900. "QMainWindow::menuBar(). This method takes no "
  9901. "arguments.");
  9902. }
  9903. return object;
  9904. }
  9905. /*:40*//*42:*/
  9906. #line 1347 "./typica.w"
  9907. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  9908. {
  9909. setQWidgetProperties(value,engine);
  9910. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  9911. }
  9912. /*:42*//*43:*/
  9913. #line 1362 "./typica.w"
  9914. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  9915. {
  9916. QScriptValue object;
  9917. if(context->argumentCount()==1)
  9918. {
  9919. QMenuBar*self= getself<QMenuBar*> (context);
  9920. QString title= argument<QString> (0,context);
  9921. object= engine->newQObject(self->addMenu(title));
  9922. setQMenuProperties(object,engine);
  9923. }
  9924. else
  9925. {
  9926. context->throwError("Incorrect number of arguments passed to "
  9927. "QMenuBar::addMenu(). This method takes one "
  9928. "string as an argument.");
  9929. }
  9930. return object;
  9931. }
  9932. /*:43*//*45:*/
  9933. #line 1392 "./typica.w"
  9934. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  9935. {
  9936. setQWidgetProperties(value,engine);
  9937. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  9938. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  9939. }
  9940. /*:45*//*46:*/
  9941. #line 1402 "./typica.w"
  9942. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  9943. {
  9944. if(context->argumentCount()==1)
  9945. {
  9946. QMenu*self= getself<QMenu*> (context);
  9947. QAction*action= argument<QAction*> (0,context);
  9948. if(action)
  9949. {
  9950. self->addAction(action);
  9951. }
  9952. else
  9953. {
  9954. context->throwError("Incorrect argument type passed to "
  9955. "QMenu::addAction(). This method requires a "
  9956. "QAction.");
  9957. }
  9958. }
  9959. else
  9960. {
  9961. context->throwError("Incorrect number of arguments passed to "
  9962. "QMenu::addAction(). This method takes one "
  9963. "QAction as an argument.");
  9964. }
  9965. return QScriptValue();
  9966. }
  9967. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  9968. {
  9969. if(context->argumentCount()==0)
  9970. {
  9971. QMenu*self= getself<QMenu*> (context);
  9972. self->addSeparator();
  9973. }
  9974. else
  9975. {
  9976. context->throwError("Incorrect number of arguments passed to "
  9977. "QMenu::addSeparator(). This method takes no "
  9978. "arguments.");
  9979. }
  9980. return QScriptValue();
  9981. }
  9982. /*:46*//*49:*/
  9983. #line 1464 "./typica.w"
  9984. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  9985. {
  9986. QScriptValue object= engine->newQObject(new QFrame);
  9987. setQFrameProperties(object,engine);
  9988. return object;
  9989. }
  9990. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  9991. {
  9992. setQWidgetProperties(value,engine);
  9993. }
  9994. /*:49*//*52:*/
  9995. #line 1498 "./typica.w"
  9996. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  9997. {
  9998. QString text;
  9999. if(context->argumentCount()==1)
  10000. {
  10001. text= argument<QString> (0,context);
  10002. }
  10003. QScriptValue object= engine->newQObject(new QLabel(text));
  10004. setQLabelProperties(object,engine);
  10005. return object;
  10006. }
  10007. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  10008. {
  10009. setQFrameProperties(value,engine);
  10010. }
  10011. /*:52*//*55:*/
  10012. #line 1544 "./typica.w"
  10013. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  10014. {
  10015. QScriptValue object= engine->newQObject(new QSplitter);
  10016. setQSplitterProperties(object,engine);
  10017. return object;
  10018. }
  10019. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  10020. {
  10021. setQFrameProperties(value,engine);
  10022. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  10023. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  10024. value.setProperty("restoreState",
  10025. engine->newFunction(QSplitter_restoreState));
  10026. }
  10027. /*:55*//*56:*/
  10028. #line 1564 "./typica.w"
  10029. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  10030. {
  10031. if(context->argumentCount()==1)
  10032. {
  10033. QSplitter*self= getself<QSplitter*> (context);
  10034. QWidget*widget= argument<QWidget*> (0,context);
  10035. if(widget)
  10036. {
  10037. self->addWidget(widget);
  10038. }
  10039. else
  10040. {
  10041. context->throwError("Incorrect argument type passed to "
  10042. "QSplitter::addWidget(). This method "
  10043. "requires a QWidget.");
  10044. }
  10045. }
  10046. else
  10047. {
  10048. context->throwError("Incorrect number of arguments passed to "
  10049. "QSplitter::addWidget(). This method takes one "
  10050. "QWidget as an argument.");
  10051. }
  10052. return QScriptValue();
  10053. }
  10054. /*:56*//*57:*/
  10055. #line 1597 "./typica.w"
  10056. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  10057. {
  10058. if(context->argumentCount()==1)
  10059. {
  10060. QSplitter*self= getself<QSplitter*> (context);
  10061. QString key= argument<QString> (0,context);
  10062. QSettings settings;
  10063. settings.setValue(key,self->saveState());
  10064. }
  10065. else
  10066. {
  10067. context->throwError("Incorrect number of arguments passed to "
  10068. "QSplitter::saveState(). This method takes one "
  10069. "string as an argument.");
  10070. }
  10071. return QScriptValue();
  10072. }
  10073. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  10074. {
  10075. if(context->argumentCount()==1)
  10076. {
  10077. QSplitter*self= getself<QSplitter*> (context);
  10078. QString key= argument<QString> (0,context);
  10079. QSettings settings;
  10080. self->restoreState(settings.value(key).toByteArray());
  10081. }
  10082. else
  10083. {
  10084. context->throwError("Incorrect number of arguments passed to "
  10085. "QSplitter::restoreState(). This method takes "
  10086. "one string as an argument.");
  10087. }
  10088. return QScriptValue();
  10089. }
  10090. /*:57*//*59:*/
  10091. #line 1650 "./typica.w"
  10092. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10093. {
  10094. setQLayoutItemProperties(value,engine);
  10095. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  10096. }
  10097. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10098. {
  10099. if(context->argumentCount()==1)
  10100. {
  10101. QLayout*self= getself<QLayout*> (context);
  10102. QWidget*widget= argument<QWidget*> (0,context);
  10103. if(widget)
  10104. {
  10105. self->addWidget(widget);
  10106. }
  10107. else
  10108. {
  10109. context->throwError("Incorrect argument type passed to "
  10110. "QLayout::addWidget(). This method requires "
  10111. "a QWidget.");
  10112. }
  10113. }
  10114. else
  10115. {
  10116. context->throwError("Incorrect number of arguments passed to "
  10117. "QLayout::addWidget(). This method takes one "
  10118. "QWidget as an argument.");
  10119. }
  10120. return QScriptValue();
  10121. }
  10122. /*:59*//*62:*/
  10123. #line 1717 "./typica.w"
  10124. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  10125. {
  10126. QScriptValue object=
  10127. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  10128. setQBoxLayoutProperties(object,engine);
  10129. return object;
  10130. }
  10131. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10132. {
  10133. setQLayoutProperties(value,engine);
  10134. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  10135. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  10136. }
  10137. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  10138. {
  10139. if(context->argumentCount()> 0&&context->argumentCount()<3)
  10140. {
  10141. QBoxLayout*self= getself<QBoxLayout*> (context);
  10142. QLayout*layout= argument<QLayout*> (0,context);
  10143. int stretch= 0;
  10144. if(context->argumentCount()==2)
  10145. {
  10146. stretch= argument<int> (1,context);
  10147. }
  10148. if(layout)
  10149. {
  10150. self->addLayout(layout,stretch);
  10151. }
  10152. else
  10153. {
  10154. context->throwError("Incorrect argument type passed to "
  10155. "QLayout::addLayout(). This method requires "
  10156. "a QLayout.");
  10157. }
  10158. }
  10159. else
  10160. {
  10161. context->throwError("Incorrect number of arguments passed to "
  10162. "QLayout::addLayout(). This method takes one "
  10163. "QLayout as an argument and optionally one integer.");
  10164. }
  10165. return QScriptValue();
  10166. }
  10167. /*:62*//*63:*/
  10168. #line 1768 "./typica.w"
  10169. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10170. {
  10171. if(context->argumentCount()> 0&&context->argumentCount()<4)
  10172. {
  10173. QBoxLayout*self= getself<QBoxLayout*> (context);
  10174. QWidget*widget= argument<QWidget*> (0,context);
  10175. int stretch= 0;
  10176. Qt::Alignment alignment= 0;
  10177. if(context->argumentCount()> 1)
  10178. {
  10179. stretch= argument<int> (1,context);
  10180. }
  10181. if(context->argumentCount()> 2)
  10182. {
  10183. alignment= (Qt::Alignment)(argument<int> (2,context));
  10184. }
  10185. if(widget)
  10186. {
  10187. self->addWidget(widget,stretch,alignment);
  10188. }
  10189. else
  10190. {
  10191. context->throwError("Incorrect argument type passed to "
  10192. "QBoxLayout::addWidget(). This method requires "
  10193. "a QWidget.");
  10194. }
  10195. }
  10196. else
  10197. {
  10198. context->throwError("Incorrect number of arguments passed to "
  10199. "QBoxLayout::addWidget(). This method takes one "
  10200. "QWidget and optionally up to two integers as "
  10201. "arguments.");
  10202. }
  10203. return QScriptValue();
  10204. }
  10205. /*:63*//*66:*/
  10206. #line 1832 "./typica.w"
  10207. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  10208. {
  10209. QScriptValue object= engine->newQObject(new QAction(NULL));
  10210. setQActionProperties(object,engine);
  10211. return object;
  10212. }
  10213. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  10214. {
  10215. setQObjectProperties(value,engine);
  10216. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  10217. }
  10218. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  10219. {
  10220. if(context->argumentCount()==1)
  10221. {
  10222. QAction*self= getself<QAction*> (context);
  10223. self->setShortcut(argument<QString> (0,context));
  10224. }
  10225. else
  10226. {
  10227. context->throwError("Incorrect number of arguments passed to "
  10228. "QAction::setShortcut(). This method takes one "
  10229. "string as an argument.");
  10230. }
  10231. return QScriptValue();
  10232. }
  10233. /*:66*//*69:*/
  10234. #line 1890 "./typica.w"
  10235. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  10236. QScriptEngine*engine)
  10237. {
  10238. QScriptValue retval;
  10239. if(context->argumentCount()==3)
  10240. {
  10241. QWidget*widget= argument<QWidget*> (0,context);
  10242. if(widget)
  10243. {
  10244. QString caption= argument<QString> (1,context);
  10245. QString dir= argument<QString> (2,context);
  10246. retval= QScriptValue(engine,
  10247. QFileDialog::getOpenFileName(widget,caption,
  10248. dir,"",0,0));
  10249. setQFileDialogProperties(retval,engine);
  10250. }
  10251. else
  10252. {
  10253. context->throwError("Incorrect argument type passed to "
  10254. "QFileDialog::getOpenFileName(). The first "
  10255. "argument to this method must be a QWidget.");
  10256. }
  10257. }
  10258. else
  10259. {
  10260. context->throwError("Incorrect number of arguments passed to "
  10261. "QFileDialog::getOpenFileName(). This method "
  10262. "takes one QWidget followed by two strings for a "
  10263. "total of three arguments.");
  10264. }
  10265. return retval;
  10266. }
  10267. /*:69*//*70:*/
  10268. #line 1926 "./typica.w"
  10269. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  10270. QScriptEngine*engine)
  10271. {
  10272. QScriptValue retval;
  10273. if(context->argumentCount()==3)
  10274. {
  10275. QWidget*widget= argument<QWidget*> (0,context);
  10276. if(widget)
  10277. {
  10278. QString caption= argument<QString> (1,context);
  10279. QString dir= argument<QString> (2,context);
  10280. retval= QScriptValue(engine,
  10281. QFileDialog::getSaveFileName(widget,caption,
  10282. dir,"",0,0));
  10283. setQFileDialogProperties(retval,engine);
  10284. }
  10285. else
  10286. {
  10287. context->throwError("Incorrect argument type passed to "
  10288. "QFileDialog::getSaveFileName(). The first "
  10289. "argument to this method must be a QWidget.");
  10290. }
  10291. }
  10292. else
  10293. {
  10294. context->throwError("Incorrect number of arguments passed to "
  10295. "QFileDialog::getSaveFileName(). This method "
  10296. "takes one QWidget followed by two strings for a "
  10297. "total of three arguments.");
  10298. }
  10299. return retval;
  10300. }
  10301. /*:70*//*71:*/
  10302. #line 1963 "./typica.w"
  10303. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  10304. {
  10305. setQDialogProperties(value,engine);
  10306. }
  10307. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  10308. {
  10309. setQWidgetProperties(value,engine);
  10310. }
  10311. /*:71*//*74:*/
  10312. #line 1998 "./typica.w"
  10313. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  10314. {
  10315. QScriptValue object=
  10316. engine->newQObject(new QFile(argument<QString> (0,context)));
  10317. setQFileProperties(object,engine);
  10318. return object;
  10319. }
  10320. /*:74*//*75:*/
  10321. #line 2009 "./typica.w"
  10322. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  10323. {
  10324. setQIODeviceProperties(value,engine);
  10325. value.setProperty("remove",engine->newFunction(QFile_remove));
  10326. }
  10327. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  10328. {
  10329. QFile*self= getself<QFile*> (context);
  10330. bool retval= self->remove();
  10331. return QScriptValue(engine,retval);
  10332. }
  10333. /*:75*//*76:*/
  10334. #line 2031 "./typica.w"
  10335. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  10336. {
  10337. setQObjectProperties(value,engine);
  10338. value.setProperty("open",engine->newFunction(QIODevice_open));
  10339. value.setProperty("close",engine->newFunction(QIODevice_close));
  10340. value.setProperty("readToString",
  10341. engine->newFunction(QIODevice_readToString));
  10342. }
  10343. /*:76*//*77:*/
  10344. #line 2046 "./typica.w"
  10345. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  10346. {
  10347. QIODevice*self= getself<QIODevice*> (context);
  10348. if(context->argumentCount()==1)
  10349. {
  10350. switch(argument<int> (0,context))
  10351. {
  10352. case 1:
  10353. self->open(QIODevice::ReadOnly);
  10354. break;
  10355. case 2:
  10356. self->open(QIODevice::WriteOnly);
  10357. break;
  10358. case 3:
  10359. self->open(QIODevice::ReadWrite);
  10360. break;
  10361. default:
  10362. break;
  10363. }
  10364. }
  10365. else
  10366. {
  10367. self->open(QIODevice::ReadWrite);
  10368. }
  10369. return QScriptValue();
  10370. }
  10371. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  10372. {
  10373. QIODevice*self= getself<QIODevice*> (context);
  10374. self->close();
  10375. return QScriptValue();
  10376. }
  10377. /*:77*//*78:*/
  10378. #line 2085 "./typica.w"
  10379. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  10380. {
  10381. QIODevice*self= getself<QIODevice*> (context);
  10382. self->reset();
  10383. return QScriptValue(QString(self->readAll()));
  10384. }
  10385. /*:78*//*81:*/
  10386. #line 2115 "./typica.w"
  10387. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  10388. {
  10389. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  10390. QScriptValue object= engine->newQObject(new QBuffer(array));
  10391. setQBufferProperties(object,engine);
  10392. return object;
  10393. }
  10394. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  10395. {
  10396. setQIODeviceProperties(value,engine);
  10397. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  10398. }
  10399. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  10400. {
  10401. QBuffer*self= getself<QBuffer*> (context);
  10402. self->setData(argument<QString> (0,context).toAscii());
  10403. return QScriptValue();
  10404. }
  10405. /*:81*//*84:*/
  10406. #line 2163 "./typica.w"
  10407. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  10408. {
  10409. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  10410. setXQueryProperties(object,engine);
  10411. return object;
  10412. }
  10413. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  10414. {
  10415. value.setProperty("bind",engine->newFunction(XQuery_bind));
  10416. value.setProperty("exec",engine->newFunction(XQuery_exec));
  10417. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  10418. }
  10419. /*:84*//*85:*/
  10420. #line 2181 "./typica.w"
  10421. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  10422. {
  10423. QXmlQuery*self= getself<QXmlQuery*> (context);
  10424. QIODevice*buffer= argument<QIODevice*> (1,context);
  10425. self->bindVariable(argument<QString> (0,context),buffer);
  10426. return QScriptValue();
  10427. }
  10428. /*:85*//*86:*/
  10429. #line 2192 "./typica.w"
  10430. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  10431. {
  10432. QXmlQuery*self= getself<QXmlQuery*> (context);
  10433. self->setQuery(argument<QString> (0,context));
  10434. return QScriptValue();
  10435. }
  10436. /*:86*//*87:*/
  10437. #line 2202 "./typica.w"
  10438. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  10439. {
  10440. QXmlQuery*self= getself<QXmlQuery*> (context);
  10441. QString result;
  10442. self->evaluateTo(&result);
  10443. return QScriptValue(result);
  10444. }
  10445. /*:87*//*90:*/
  10446. #line 2257 "./typica.w"
  10447. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  10448. {
  10449. QXmlStreamWriter*retval;
  10450. if(context->argumentCount()==1)
  10451. {
  10452. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  10453. }
  10454. else
  10455. {
  10456. retval= new QXmlStreamWriter;
  10457. }
  10458. QScriptValue object= engine->toScriptValue<void*> (retval);
  10459. setXmlWriterProperties(object,engine);
  10460. return object;
  10461. }
  10462. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  10463. {
  10464. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  10465. value.setProperty("writeAttribute",
  10466. engine->newFunction(XmlWriter_writeAttribute));
  10467. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  10468. value.setProperty("writeCharacters",
  10469. engine->newFunction(XmlWriter_writeCharacters));
  10470. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  10471. value.setProperty("writeEmptyElement",
  10472. engine->newFunction(XmlWriter_writeEmptyElement));
  10473. value.setProperty("writeEndDocument",
  10474. engine->newFunction(XmlWriter_writeEndDocument));
  10475. value.setProperty("writeEndElement",
  10476. engine->newFunction(XmlWriter_writeEndElement));
  10477. value.setProperty("writeEntityReference",
  10478. engine->newFunction(XmlWriter_writeEntityReference));
  10479. value.setProperty("writeProcessingInstruction",
  10480. engine->newFunction(XmlWriter_writeProcessingInstruction));
  10481. value.setProperty("writeStartDocument",
  10482. engine->newFunction(XmlWriter_writeStartDocument));
  10483. value.setProperty("writeStartElement",
  10484. engine->newFunction(XmlWriter_writeStartElement));
  10485. value.setProperty("writeTextElement",
  10486. engine->newFunction(XmlWriter_writeTextElement));
  10487. }
  10488. /*:90*//*91:*/
  10489. #line 2304 "./typica.w"
  10490. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  10491. {
  10492. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10493. QIODevice*device= argument<QIODevice*> (0,context);
  10494. self->setDevice(device);
  10495. return QScriptValue();
  10496. }
  10497. /*:91*//*92:*/
  10498. #line 2318 "./typica.w"
  10499. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  10500. QScriptEngine*)
  10501. {
  10502. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10503. self->writeStartDocument(argument<QString> (0,context));
  10504. return QScriptValue();
  10505. }
  10506. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  10507. QScriptEngine*)
  10508. {
  10509. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10510. self->writeEndDocument();
  10511. return QScriptValue();
  10512. }
  10513. /*:92*//*93:*/
  10514. #line 2337 "./typica.w"
  10515. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  10516. {
  10517. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10518. self->writeDTD(argument<QString> (0,context));
  10519. return QScriptValue();
  10520. }
  10521. /*:93*//*94:*/
  10522. #line 2348 "./typica.w"
  10523. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  10524. QScriptEngine*)
  10525. {
  10526. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10527. self->writeStartElement(argument<QString> (0,context));
  10528. return QScriptValue();
  10529. }
  10530. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  10531. {
  10532. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10533. self->writeAttribute(argument<QString> (0,context),
  10534. argument<QString> (1,context));
  10535. return QScriptValue();
  10536. }
  10537. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  10538. {
  10539. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10540. self->writeCharacters(argument<QString> (0,context));
  10541. return QScriptValue();
  10542. }
  10543. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  10544. {
  10545. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10546. self->writeEndElement();
  10547. return QScriptValue();
  10548. }
  10549. /*:94*//*95:*/
  10550. #line 2384 "./typica.w"
  10551. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  10552. QScriptEngine*)
  10553. {
  10554. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10555. self->writeEmptyElement(argument<QString> (0,context));
  10556. return QScriptValue();
  10557. }
  10558. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  10559. QScriptEngine*)
  10560. {
  10561. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10562. self->writeTextElement(argument<QString> (0,context),
  10563. argument<QString> (1,context));
  10564. return QScriptValue();
  10565. }
  10566. /*:95*//*96:*/
  10567. #line 2405 "./typica.w"
  10568. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  10569. {
  10570. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10571. self->writeCDATA(argument<QString> (0,context));
  10572. return QScriptValue();
  10573. }
  10574. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  10575. QScriptEngine*)
  10576. {
  10577. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10578. self->writeEntityReference(argument<QString> (0,context));
  10579. return QScriptValue();
  10580. }
  10581. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  10582. QScriptEngine*)
  10583. {
  10584. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10585. self->writeProcessingInstruction(argument<QString> (0,context),
  10586. argument<QString> (1,context));
  10587. return QScriptValue();
  10588. }
  10589. /*:96*//*99:*/
  10590. #line 2464 "./typica.w"
  10591. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  10592. {
  10593. QXmlStreamReader*retval=
  10594. new QXmlStreamReader(argument<QIODevice*> (0,context));
  10595. QScriptValue object= engine->toScriptValue<void*> (retval);
  10596. setXmlReaderProperties(object,engine);
  10597. return object;
  10598. }
  10599. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  10600. {
  10601. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  10602. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  10603. value.setProperty("hasAttribute",
  10604. engine->newFunction(XmlReader_hasAttribute));
  10605. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  10606. value.setProperty("isStartElement",
  10607. engine->newFunction(XmlReader_isStartElement));
  10608. value.setProperty("name",engine->newFunction(XmlReader_name));
  10609. value.setProperty("readElementText",
  10610. engine->newFunction(XmlReader_readElementText));
  10611. value.setProperty("readNext",
  10612. engine->newFunction(XmlReader_readNext));
  10613. value.setProperty("text",engine->newFunction(XmlReader_text));
  10614. }
  10615. /*:99*//*100:*/
  10616. #line 2494 "./typica.w"
  10617. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  10618. {
  10619. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10620. QString retval=
  10621. self->attributes().value(argument<QString> (0,context)).toString();
  10622. return QScriptValue(retval);
  10623. }
  10624. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  10625. {
  10626. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10627. bool retval=
  10628. self->attributes().hasAttribute(argument<QString> (0,context));
  10629. return QScriptValue(retval);
  10630. }
  10631. /*:100*//*101:*/
  10632. #line 2514 "./typica.w"
  10633. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  10634. {
  10635. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10636. return QScriptValue(self->atEnd());
  10637. }
  10638. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  10639. {
  10640. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10641. return QScriptValue(self->isDTD());
  10642. }
  10643. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  10644. {
  10645. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10646. return QScriptValue(self->isStartElement());
  10647. }
  10648. /*:101*//*102:*/
  10649. #line 2535 "./typica.w"
  10650. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  10651. {
  10652. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10653. self->readNext();
  10654. return QScriptValue();
  10655. }
  10656. /*:102*//*103:*/
  10657. #line 2545 "./typica.w"
  10658. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  10659. {
  10660. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10661. return QScriptValue(self->name().toString());
  10662. }
  10663. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  10664. {
  10665. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10666. return QScriptValue(self->readElementText());
  10667. }
  10668. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  10669. {
  10670. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10671. return QScriptValue(self->text().toString());
  10672. }
  10673. /*:103*//*106:*/
  10674. #line 2587 "./typica.w"
  10675. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  10676. {
  10677. setQObjectProperties(value,engine);
  10678. value.setProperty("value",engine->newFunction(QSettings_value));
  10679. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  10680. }
  10681. /*:106*//*107:*/
  10682. #line 2599 "./typica.w"
  10683. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  10684. {
  10685. QScriptValue object;
  10686. if(context->argumentCount()==1||context->argumentCount()==2)
  10687. {
  10688. QSettings settings;
  10689. QString key= argument<QString> (0,context);
  10690. QVariant value;
  10691. QVariant retval;
  10692. if(context->argumentCount()> 1)
  10693. {
  10694. value= argument<QVariant> (1,context);
  10695. retval= settings.value(key,value);
  10696. }
  10697. else
  10698. {
  10699. retval= settings.value(key);
  10700. }
  10701. object= engine->newVariant(retval);
  10702. }
  10703. else
  10704. {
  10705. context->throwError("Incorrect number of arguments passed to "
  10706. "QSettings::value(). This method takes one "
  10707. "string and one optional variant type.");
  10708. }
  10709. return object;
  10710. }
  10711. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  10712. {
  10713. if(context->argumentCount()==2)
  10714. {
  10715. QSettings settings;
  10716. QString key= argument<QString> (0,context);
  10717. QVariant value= argument<QVariant> (1,context);
  10718. settings.setValue(key,value);
  10719. }
  10720. else
  10721. {
  10722. context->throwError("Incorrect number of arguments passed to "
  10723. "QSettings::setValue(). This method takes one "
  10724. "string and one variant type for a total of two "
  10725. "arguments.");
  10726. }
  10727. return QScriptValue();
  10728. }
  10729. /*:107*//*110:*/
  10730. #line 2668 "./typica.w"
  10731. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  10732. {
  10733. QScriptValue object= engine->newQObject(new QLCDNumber());
  10734. setQLCDNumberProperties(object,engine);
  10735. return object;
  10736. }
  10737. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  10738. {
  10739. setQFrameProperties(value,engine);
  10740. }
  10741. /*:110*//*113:*/
  10742. #line 2726 "./typica.w"
  10743. QScriptValue constructQTime(QScriptContext*context,
  10744. QScriptEngine*engine)
  10745. {
  10746. QScriptValue object;
  10747. if(context->argumentCount()==0||
  10748. (context->argumentCount()>=2&&context->argumentCount()<=4))
  10749. {
  10750. int arg1= 0;
  10751. int arg2= 0;
  10752. int arg3= 0;
  10753. int arg4= 0;
  10754. switch(context->argumentCount())
  10755. {
  10756. case 4:
  10757. arg4= argument<int> (3,context);
  10758. case 3:
  10759. arg3= argument<int> (2,context);
  10760. case 2:
  10761. arg2= argument<int> (1,context);
  10762. arg1= argument<int> (0,context);
  10763. default:
  10764. break;
  10765. }
  10766. if(context->argumentCount())
  10767. {
  10768. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  10769. arg4));
  10770. }
  10771. else
  10772. {
  10773. object= engine->toScriptValue<QTime> (QTime());
  10774. }
  10775. setQTimeProperties(object,engine);
  10776. }
  10777. else
  10778. {
  10779. context->throwError("Incorrect number of arguments passed to "
  10780. "QTime::QTime(). This method takes zero, two, "
  10781. "three, or four integer arguments.");
  10782. }
  10783. return object;
  10784. }
  10785. /*:113*//*114:*/
  10786. #line 2774 "./typica.w"
  10787. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  10788. {
  10789. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  10790. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  10791. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  10792. value.setProperty("hour",engine->newFunction(QTime_hour));
  10793. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  10794. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  10795. value.setProperty("minute",engine->newFunction(QTime_minute));
  10796. value.setProperty("msec",engine->newFunction(QTime_msec));
  10797. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  10798. value.setProperty("restart",engine->newFunction(QTime_restart));
  10799. value.setProperty("second",engine->newFunction(QTime_second));
  10800. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  10801. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  10802. value.setProperty("start",engine->newFunction(QTime_start));
  10803. value.setProperty("toString",engine->newFunction(QTime_toString));
  10804. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  10805. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  10806. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  10807. }
  10808. /*:114*//*115:*/
  10809. #line 2803 "./typica.w"
  10810. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  10811. {
  10812. QTime self= getself<QTime> (context);
  10813. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  10814. (self.second()*1000)+self.msec();
  10815. return QScriptValue(retval);
  10816. }
  10817. /*:115*//*116:*/
  10818. #line 2817 "./typica.w"
  10819. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  10820. {
  10821. QTime time;
  10822. QScriptValue retval;
  10823. if(context->argumentCount()==1)
  10824. {
  10825. QTime self= getself<QTime> (context);
  10826. time= self.addMSecs(argument<int> (0,context));
  10827. retval= engine->toScriptValue<QTime> (time);
  10828. setQTimeProperties(retval,engine);
  10829. }
  10830. else
  10831. {
  10832. context->throwError("Incorrect number of arguments passed to "
  10833. "QTime::addMSecs(). This method takes one "
  10834. "integer as an argument.");
  10835. }
  10836. return retval;
  10837. }
  10838. QScriptValue QTime_addSecs(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.addSecs(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::addSecs(). This method takes one "
  10853. "integer as an argument.");
  10854. }
  10855. return retval;
  10856. }
  10857. /*:116*//*117:*/
  10858. #line 2860 "./typica.w"
  10859. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  10860. {
  10861. QScriptValue retval;
  10862. if(context->argumentCount()==0)
  10863. {
  10864. QTime self= getself<QTime> (context);
  10865. retval= QScriptValue(engine,self.elapsed());
  10866. }
  10867. else
  10868. {
  10869. context->throwError("Incorrect number of arguments passed to "
  10870. "QTime::elapsed(). This method takes no "
  10871. "arguments.");
  10872. }
  10873. return retval;
  10874. }
  10875. /*:117*//*118:*/
  10876. #line 2881 "./typica.w"
  10877. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  10878. {
  10879. QScriptValue retval;
  10880. if(context->argumentCount()==0)
  10881. {
  10882. QTime self= getself<QTime> (context);
  10883. retval= QScriptValue(engine,self.hour());
  10884. }
  10885. else
  10886. {
  10887. context->throwError("Incorrect number of arguments passed to "
  10888. "QTime::hour(). This method takes no "
  10889. "arguments.");
  10890. }
  10891. return retval;
  10892. }
  10893. /*:118*//*119:*/
  10894. #line 2901 "./typica.w"
  10895. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  10896. {
  10897. QScriptValue retval;
  10898. if(context->argumentCount()==0)
  10899. {
  10900. QTime self= getself<QTime> (context);
  10901. retval= QScriptValue(engine,self.minute());
  10902. }
  10903. else
  10904. {
  10905. context->throwError("Incorrect number of arguments passed to "
  10906. "QTime::minute(). This method takes no "
  10907. "arguments.");
  10908. }
  10909. return retval;
  10910. }
  10911. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  10912. {
  10913. QScriptValue retval;
  10914. if(context->argumentCount()==0)
  10915. {
  10916. QTime self= getself<QTime> (context);
  10917. retval= QScriptValue(engine,self.second());
  10918. }
  10919. else
  10920. {
  10921. context->throwError("Incorrect number of arguments passed to "
  10922. "QTime::second(). This method takes no "
  10923. "arguments.");
  10924. }
  10925. return retval;
  10926. }
  10927. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  10928. {
  10929. QScriptValue retval;
  10930. if(context->argumentCount()==0)
  10931. {
  10932. QTime self= getself<QTime> (context);
  10933. retval= QScriptValue(engine,self.msec());
  10934. }
  10935. else
  10936. {
  10937. context->throwError("Incorrect number of arguments passed to "
  10938. "QTime::msec(). This method takes no "
  10939. "arguments.");
  10940. }
  10941. return retval;
  10942. }
  10943. /*:119*//*120:*/
  10944. #line 2957 "./typica.w"
  10945. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  10946. {
  10947. QScriptValue retval;
  10948. if(context->argumentCount()==0)
  10949. {
  10950. QTime self= getself<QTime> (context);
  10951. retval= QScriptValue(engine,self.isNull());
  10952. }
  10953. else
  10954. {
  10955. context->throwError("Incorrect number of arguments passed to "
  10956. "QTime::isNull(). This method takes no "
  10957. "arguments.");
  10958. }
  10959. return retval;
  10960. }
  10961. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  10962. {
  10963. QScriptValue retval;
  10964. if(context->argumentCount()==0)
  10965. {
  10966. QTime self= getself<QTime> (context);
  10967. retval= QScriptValue(engine,self.isValid());
  10968. }
  10969. else
  10970. {
  10971. context->throwError("Incorrect number of arguments passed to "
  10972. "QTime::isValid(). This method takes no "
  10973. "arguments.");
  10974. }
  10975. return retval;
  10976. }
  10977. /*:120*//*121:*/
  10978. #line 2995 "./typica.w"
  10979. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  10980. {
  10981. QScriptValue retval;
  10982. if(context->argumentCount()==1)
  10983. {
  10984. QTime self= getself<QTime> (context);
  10985. QTime arg= argument<QVariant> (0,context).toTime();
  10986. retval= QScriptValue(engine,self.msecsTo(arg));
  10987. }
  10988. else
  10989. {
  10990. context->throwError("Incorrect number of arguments passed to "
  10991. "QTime::msecsTo(). This method takes one QTime.");
  10992. }
  10993. return retval;
  10994. }
  10995. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  10996. {
  10997. QScriptValue retval;
  10998. if(context->argumentCount()==1)
  10999. {
  11000. QTime self= getself<QTime> (context);
  11001. QTime arg= argument<QVariant> (0,context).toTime();
  11002. retval= QScriptValue(engine,self.secsTo(arg));
  11003. }
  11004. else
  11005. {
  11006. context->throwError("Incorrect number of arguments passed to "
  11007. "QTime::secsTo(). This method takes one QTime.");
  11008. }
  11009. return retval;
  11010. }
  11011. /*:121*//*122:*/
  11012. #line 3034 "./typica.w"
  11013. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  11014. {
  11015. QScriptValue retval;
  11016. if(context->argumentCount()==0)
  11017. {
  11018. QTime self= getself<QTime> (context);
  11019. retval= QScriptValue(engine,self.restart());
  11020. }
  11021. else
  11022. {
  11023. context->throwError("Incorrect number of arguments passed to "
  11024. "QTime::restart(). This method takes no "
  11025. "arguments.");
  11026. }
  11027. return retval;
  11028. }
  11029. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  11030. {
  11031. if(context->argumentCount()==0)
  11032. {
  11033. QTime self= getself<QTime> (context);
  11034. self.start();
  11035. }
  11036. else
  11037. {
  11038. context->throwError("Incorrect number of arguments passed to "
  11039. "QTime::start(). This method takes no arguments.");
  11040. }
  11041. return QScriptValue();
  11042. }
  11043. /*:122*//*123:*/
  11044. #line 3070 "./typica.w"
  11045. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  11046. {
  11047. QScriptValue retval;
  11048. if(context->argumentCount()==3||context->argumentCount()==4)
  11049. {
  11050. QTime self= getself<QTime> (context);
  11051. int arg1= 0;
  11052. int arg2= 0;
  11053. int arg3= 0;
  11054. int arg4= 0;
  11055. switch(context->argumentCount())
  11056. {
  11057. case 4:
  11058. arg4= argument<int> (3,context);
  11059. case 3:
  11060. arg3= argument<int> (2,context);
  11061. arg2= argument<int> (1,context);
  11062. arg1= argument<int> (0,context);
  11063. default:
  11064. break;
  11065. }
  11066. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  11067. }
  11068. else
  11069. {
  11070. context->throwError("Incorrect number of arguments passed to "
  11071. "QTime::setHMS(). This method takes three or "
  11072. "four integer arguments.");
  11073. }
  11074. return retval;
  11075. }
  11076. /*:123*//*124:*/
  11077. #line 3106 "./typica.w"
  11078. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  11079. {
  11080. QScriptValue retval;
  11081. if(context->argumentCount()==1)
  11082. {
  11083. QTime self= getself<QTime> (context);
  11084. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  11085. }
  11086. else
  11087. {
  11088. context->throwError("Incorrect number of arguments passed to "
  11089. "QTime::toString(). This method takes one QString "
  11090. "as an argument.");
  11091. }
  11092. return retval;
  11093. }
  11094. /*:124*//*125:*/
  11095. #line 3127 "./typica.w"
  11096. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  11097. {
  11098. QScriptValue object;
  11099. object= engine->toScriptValue<QTime> (QTime::currentTime());
  11100. setQTimeProperties(object,engine);
  11101. return object;
  11102. }
  11103. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  11104. {
  11105. QScriptValue object;
  11106. if(context->argumentCount()==2)
  11107. {
  11108. QString time= argument<QString> (0,context);
  11109. QString format= argument<QString> (1,context);
  11110. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  11111. setQTimeProperties(object,engine);
  11112. }
  11113. else
  11114. {
  11115. context->throwError("Incorrect number of arguments passed to "
  11116. "QTime::fromString(). This method takes two "
  11117. "string arguments.");
  11118. }
  11119. return object;
  11120. }
  11121. /*:125*//*127:*/
  11122. #line 3167 "./typica.w"
  11123. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  11124. {
  11125. setQFrameProperties(value,engine);
  11126. }
  11127. /*:127*//*129:*/
  11128. #line 3181 "./typica.w"
  11129. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  11130. {
  11131. setQAbstractScrollAreaProperties(value,engine);
  11132. }
  11133. /*:129*//*131:*/
  11134. #line 3195 "./typica.w"
  11135. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  11136. {
  11137. setQAbstractScrollAreaProperties(value,engine);
  11138. }
  11139. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  11140. {
  11141. setQAbstractItemViewProperties(value,engine);
  11142. }
  11143. /*:131*//*134:*/
  11144. #line 3228 "./typica.w"
  11145. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  11146. {
  11147. QScriptValue object= engine->newQObject(new QPushButton());
  11148. setQPushButtonProperties(object,engine);
  11149. return object;
  11150. }
  11151. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  11152. {
  11153. setQAbstractButtonProperties(value,engine);
  11154. }
  11155. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  11156. {
  11157. setQWidgetProperties(value,engine);
  11158. }
  11159. /*:134*//*141:*/
  11160. #line 3340 "./typica.w"
  11161. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  11162. {
  11163. QScriptValue object=
  11164. engine->toScriptValue<void*> (new SqlQueryConnection());
  11165. setQSqlQueryProperties(object,engine);
  11166. return object;
  11167. }
  11168. /*:141*//*142:*/
  11169. #line 3352 "./typica.w"
  11170. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  11171. {
  11172. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  11173. value.setProperty("bindFileData",
  11174. engine->newFunction(QSqlQuery_bindFileData));
  11175. value.setProperty("bindDeviceData",
  11176. engine->newFunction(QSqlQuery_bindDeviceData));
  11177. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  11178. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  11179. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  11180. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  11181. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  11182. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  11183. }
  11184. /*:142*//*143:*/
  11185. #line 3370 "./typica.w"
  11186. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  11187. {
  11188. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11189. QScriptValue retval;
  11190. if(context->argumentCount()==1)
  11191. {
  11192. retval= QScriptValue(engine,
  11193. query->exec(argument<QString> (0,context)));
  11194. }
  11195. else
  11196. {
  11197. retval= QScriptValue(engine,query->exec());
  11198. }
  11199. if(query->lastError().isValid())
  11200. {
  11201. qDebug()<<query->lastQuery();
  11202. qDebug()<<query->lastError().text();
  11203. }
  11204. return retval;
  11205. }
  11206. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  11207. {
  11208. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11209. return QScriptValue(query->lastQuery());
  11210. }
  11211. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  11212. {
  11213. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11214. return QScriptValue(engine,query->next());
  11215. }
  11216. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  11217. {
  11218. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11219. return QScriptValue(engine,
  11220. query->value(argument<int> (0,context)).toString());
  11221. }
  11222. /*:143*//*144:*/
  11223. #line 3414 "./typica.w"
  11224. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  11225. {
  11226. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11227. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  11228. }
  11229. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  11230. {
  11231. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11232. query->bindValue(argument<QString> (0,context),
  11233. argument<QVariant> (1,context));
  11234. return QScriptValue();
  11235. }
  11236. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  11237. QScriptEngine*)
  11238. {
  11239. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11240. QString placeholder= argument<QString> (0,context);
  11241. QString filename= argument<QString> (1,context);
  11242. QFile file(filename);
  11243. QByteArray data;
  11244. if(file.open(QIODevice::ReadOnly))
  11245. {
  11246. data= file.readAll();
  11247. file.close();
  11248. }
  11249. query->bindValue(placeholder,data);
  11250. return QScriptValue();
  11251. }
  11252. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  11253. QScriptEngine*)
  11254. {
  11255. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11256. QString placeholder= argument<QString> (0,context);
  11257. QIODevice*device= argument<QIODevice*> (1,context);
  11258. device->reset();
  11259. QByteArray data;
  11260. data= device->readAll();
  11261. query->bindValue(placeholder,data);
  11262. return QScriptValue();
  11263. }
  11264. /*:144*//*145:*/
  11265. #line 3466 "./typica.w"
  11266. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  11267. {
  11268. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11269. delete query;
  11270. return QScriptValue::UndefinedValue;
  11271. }
  11272. /*:145*//*148:*/
  11273. #line 3507 "./typica.w"
  11274. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  11275. {
  11276. QFileInfo info(argument<QString> (0,context));
  11277. QScriptValue retval(engine,info.baseName());
  11278. return retval;
  11279. }
  11280. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  11281. {
  11282. QFileInfo info(argument<QString> (0,context));
  11283. QDir dir= info.dir();
  11284. QScriptValue retval(engine,dir.path());
  11285. return retval;
  11286. }
  11287. /*:148*//*149:*/
  11288. #line 3526 "./typica.w"
  11289. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  11290. {
  11291. QString source= argument<QString> (0,context);
  11292. source.remove(0,1);
  11293. source.chop(1);
  11294. QStringList elements= source.split(",");
  11295. QString element;
  11296. QScriptValue dest= engine->newArray(elements.size());
  11297. int i= 0;
  11298. foreach(element,elements)
  11299. {
  11300. if(element.startsWith("\"")&&element.endsWith("\""))
  11301. {
  11302. element.chop(1);
  11303. element= element.remove(0,1);
  11304. }
  11305. dest.setProperty(i,QScriptValue(engine,element));
  11306. i++;
  11307. }
  11308. return dest;
  11309. }
  11310. /*:149*//*150:*/
  11311. #line 3552 "./typica.w"
  11312. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  11313. {
  11314. QString font= argument<QString> (0,context);
  11315. QString classname;
  11316. if(context->argumentCount()> 1)
  11317. {
  11318. classname= argument<QString> (1,context);
  11319. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  11320. }
  11321. else
  11322. {
  11323. QApplication::setFont(QFont(font));
  11324. }
  11325. return QScriptValue();
  11326. }
  11327. /*:150*//*151:*/
  11328. #line 3572 "./typica.w"
  11329. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  11330. {
  11331. SqlQueryConnection query;
  11332. QString q= "SELECT file FROM files WHERE id = :file";
  11333. query.prepare(q);
  11334. query.bindValue(":file",argument<int> (0,context));
  11335. query.exec();
  11336. query.next();
  11337. QByteArray array= query.value(0).toByteArray();
  11338. QBuffer buffer(&array);
  11339. buffer.open(QIODevice::ReadOnly);
  11340. QXmlQuery xquery;
  11341. xquery.bindVariable("profile",&buffer);
  11342. QString xq;
  11343. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  11344. xquery.setQuery(xq);
  11345. QString result;
  11346. xquery.evaluateTo(&result);
  11347. return QScriptValue(result);
  11348. }
  11349. /*:151*//*152:*/
  11350. #line 3598 "./typica.w"
  11351. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  11352. {
  11353. QWidget::setTabOrder(argument<QWidget*> (0,context),
  11354. argument<QWidget*> (1,context));
  11355. return QScriptValue();
  11356. }
  11357. /*:152*//*159:*/
  11358. #line 3837 "./typica.w"
  11359. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  11360. {
  11361. QString targetID= argument<QString> (0,context);
  11362. QDomNode element;
  11363. QScriptValue object;
  11364. /*160:*/
  11365. #line 3858 "./typica.w"
  11366. QDomNodeList windows=
  11367. AppInstance->configuration()->documentElement().elementsByTagName("window");
  11368. QDomNode nullNode;
  11369. int i= 0;
  11370. element= nullNode;
  11371. while(i<windows.count())
  11372. {
  11373. element= windows.at(i);
  11374. QDomNamedNodeMap attributes= element.attributes();
  11375. if(attributes.contains("id"))
  11376. {
  11377. if(attributes.namedItem("id").toAttr().value()==targetID)
  11378. {
  11379. break;
  11380. }
  11381. }
  11382. element= nullNode;
  11383. i++;
  11384. }
  11385. /*:160*/
  11386. #line 3843 "./typica.w"
  11387. if(!element.isNull())
  11388. {
  11389. /*161:*/
  11390. #line 3890 "./typica.w"
  11391. ScriptQMainWindow*window= new ScriptQMainWindow;
  11392. window->setObjectName(targetID);
  11393. object= engine->newQObject(window);
  11394. setQMainWindowProperties(object,engine);
  11395. QWidget*central= new(QWidget);
  11396. central->setParent(window);
  11397. central->setObjectName("centralWidget");
  11398. window->setCentralWidget(central);
  11399. if(element.hasChildNodes())
  11400. {
  11401. /*162:*/
  11402. #line 3931 "./typica.w"
  11403. QStack<QWidget*> widgetStack;
  11404. QStack<QLayout*> layoutStack;
  11405. QString windowScript;
  11406. widgetStack.push(central);
  11407. QDomNodeList windowChildren= element.childNodes();
  11408. int i= 0;
  11409. while(i<windowChildren.count())
  11410. {
  11411. QDomNode current;
  11412. QDomElement element;
  11413. current= windowChildren.at(i);
  11414. if(current.isElement())
  11415. {
  11416. element= current.toElement();
  11417. if(element.tagName()=="program")
  11418. {
  11419. windowScript.append(element.text());
  11420. }
  11421. else if(element.tagName()=="layout")
  11422. {
  11423. addLayoutToWidget(element,&widgetStack,&layoutStack);
  11424. }
  11425. else if(element.tagName()=="menu")
  11426. {
  11427. /*163:*/
  11428. #line 3978 "./typica.w"
  11429. QMenuBar*bar= window->menuBar();
  11430. bar->setParent(window);
  11431. bar->setObjectName("menuBar");
  11432. if(element.hasAttribute("name"))
  11433. {
  11434. QMenu*menu= bar->addMenu(element.attribute("name"));
  11435. menu->setParent(bar);
  11436. if(element.hasAttribute("type"))
  11437. {
  11438. if(element.attribute("type")=="reports")
  11439. {
  11440. if(element.hasAttribute("src"))
  11441. {
  11442. /*536:*/
  11443. #line 12739 "./typica.w"
  11444. QSettings settings;
  11445. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  11446. arg(element.attribute("src")));
  11447. directory.setFilter(QDir::Files);
  11448. directory.setSorting(QDir::Name);
  11449. QStringList nameFilter;
  11450. nameFilter<<"*.xml";
  11451. directory.setNameFilters(nameFilter);
  11452. QFileInfoList reportFiles= directory.entryInfoList();
  11453. for(int i= 0;i<reportFiles.size();i++)
  11454. {
  11455. QFileInfo reportFile= reportFiles.at(i);
  11456. /*540:*/
  11457. #line 12816 "./typica.w"
  11458. QString path= reportFile.absoluteFilePath();
  11459. QFile file(path);
  11460. if(file.open(QIODevice::ReadOnly))
  11461. {
  11462. QDomDocument document;
  11463. document.setContent(&file,true);
  11464. QDomElement root= document.documentElement();
  11465. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  11466. if(!titleNode.isNull())
  11467. {
  11468. QDomElement titleElement= titleNode.toElement();
  11469. QString title= titleElement.text();
  11470. if(!title.isEmpty())
  11471. {
  11472. QStringList hierarchy= title.split(":->");
  11473. QMenu*insertionPoint= menu;
  11474. /*541:*/
  11475. #line 12843 "./typica.w"
  11476. for(int j= 0;j<hierarchy.size()-1;j++)
  11477. {
  11478. QObjectList menuList= insertionPoint->children();
  11479. bool menuFound= false;
  11480. for(int k= 0;k<menuList.size();k++)
  11481. {
  11482. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  11483. if(currentItem)
  11484. {
  11485. if(currentItem->title()==hierarchy.at(j))
  11486. {
  11487. menuFound= true;
  11488. insertionPoint= currentItem;
  11489. break;
  11490. }
  11491. }
  11492. }
  11493. if(!menuFound)
  11494. {
  11495. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  11496. }
  11497. }
  11498. /*:541*/
  11499. #line 12833 "./typica.w"
  11500. ReportAction*action= new ReportAction(path,hierarchy.last());
  11501. insertionPoint->addAction(action);
  11502. }
  11503. }
  11504. }
  11505. /*:540*/
  11506. #line 12752 "./typica.w"
  11507. }
  11508. /*:536*/
  11509. #line 3992 "./typica.w"
  11510. }
  11511. }
  11512. }
  11513. if(element.hasChildNodes())
  11514. {
  11515. /*164:*/
  11516. #line 4005 "./typica.w"
  11517. QDomNodeList menuItems= element.childNodes();
  11518. int j= 0;
  11519. while(j<menuItems.count())
  11520. {
  11521. QDomNode item= menuItems.at(j);
  11522. if(item.isElement())
  11523. {
  11524. QDomElement itemElement= item.toElement();
  11525. if(itemElement.tagName()=="item")
  11526. {
  11527. QAction*itemAction= new QAction(itemElement.text(),menu);
  11528. if(itemElement.hasAttribute("id"))
  11529. {
  11530. itemAction->setObjectName(itemElement.attribute("id"));
  11531. }
  11532. if(itemElement.hasAttribute("shortcut"))
  11533. {
  11534. itemAction->setShortcut(itemElement.attribute("shortcut"));
  11535. }
  11536. menu->addAction(itemAction);
  11537. }
  11538. else if(itemElement.tagName()=="separator")
  11539. {
  11540. menu->addSeparator();
  11541. }
  11542. }
  11543. j++;
  11544. }
  11545. /*:164*/
  11546. #line 3998 "./typica.w"
  11547. }
  11548. }
  11549. /*:163*/
  11550. #line 3956 "./typica.w"
  11551. }
  11552. }
  11553. i++;
  11554. }
  11555. QScriptValue oldThis= context->thisObject();
  11556. context->setThisObject(object);
  11557. QScriptValue result= engine->evaluate(windowScript);
  11558. /*156:*/
  11559. #line 3739 "./typica.w"
  11560. if(engine->hasUncaughtException())
  11561. {
  11562. int line= engine->uncaughtExceptionLineNumber();
  11563. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  11564. result.toString();
  11565. QString trace;
  11566. foreach(trace,engine->uncaughtExceptionBacktrace())
  11567. {
  11568. qDebug()<<trace;
  11569. }
  11570. }
  11571. /*:156*/
  11572. #line 3964 "./typica.w"
  11573. context->setThisObject(oldThis);
  11574. /*:162*/
  11575. #line 3901 "./typica.w"
  11576. }
  11577. if(window)
  11578. {
  11579. window->show();
  11580. }
  11581. else
  11582. {
  11583. qDebug()<<"Error! Window invalidated";
  11584. }
  11585. /*:161*/
  11586. #line 3846 "./typica.w"
  11587. }
  11588. return object;
  11589. }
  11590. /*:159*//*165:*/
  11591. #line 4045 "./typica.w"
  11592. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  11593. QStack<QLayout*> *layoutStack)
  11594. {
  11595. if(element.hasAttribute("type"))
  11596. {
  11597. /*166:*/
  11598. #line 4066 "./typica.w"
  11599. QLayout*layout;
  11600. QString layoutType= element.attribute("type");
  11601. if(layoutType=="horizontal")
  11602. {
  11603. layout= new QHBoxLayout;
  11604. layoutStack->push(layout);
  11605. populateBoxLayout(element,widgetStack,layoutStack);
  11606. }
  11607. else if(layoutType=="vertical")
  11608. {
  11609. layout= new QVBoxLayout;
  11610. layoutStack->push(layout);
  11611. populateBoxLayout(element,widgetStack,layoutStack);
  11612. }
  11613. else if(layoutType=="grid")
  11614. {
  11615. layout= new QGridLayout;
  11616. layoutStack->push(layout);
  11617. populateGridLayout(element,widgetStack,layoutStack);
  11618. }
  11619. else if(layoutType=="stack")
  11620. {
  11621. layout= new QStackedLayout;
  11622. layoutStack->push(layout);
  11623. populateStackedLayout(element,widgetStack,layoutStack);
  11624. }
  11625. if(element.hasAttribute("id"))
  11626. {
  11627. layout->setObjectName(element.attribute("id"));
  11628. }
  11629. /*:166*/
  11630. #line 4051 "./typica.w"
  11631. QWidget*widget= widgetStack->top();
  11632. if(layout)
  11633. {
  11634. widget->setLayout(layout);
  11635. }
  11636. layoutStack->pop();
  11637. }
  11638. }
  11639. /*:165*//*167:*/
  11640. #line 4104 "./typica.w"
  11641. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11642. QStack<QLayout*> *layoutStack)
  11643. {
  11644. QDomNodeList children= element.childNodes();
  11645. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  11646. for(int i= 0;i<children.count();i++)
  11647. {
  11648. QDomNode current;
  11649. QDomElement currentElement;
  11650. current= children.at(i);
  11651. if(current.isElement())
  11652. {
  11653. currentElement= current.toElement();
  11654. if(currentElement.tagName()=="page")
  11655. {
  11656. QWidget*widget= new QWidget;
  11657. layout->addWidget(widget);
  11658. widgetStack->push(widget);
  11659. populateWidget(currentElement,widgetStack,layoutStack);
  11660. widgetStack->pop();
  11661. }
  11662. }
  11663. }
  11664. }
  11665. /*:167*//*168:*/
  11666. #line 4136 "./typica.w"
  11667. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11668. QStack<QLayout*> *layoutStack)
  11669. {
  11670. QDomNodeList children= element.childNodes();
  11671. int row= -1;
  11672. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  11673. for(int i= 0;i<children.count();i++)
  11674. {
  11675. QDomNode current;
  11676. QDomElement currentElement;
  11677. current= children.at(i);
  11678. if(current.isElement())
  11679. {
  11680. currentElement= current.toElement();
  11681. if(currentElement.tagName()=="row")
  11682. {
  11683. row++;
  11684. if(currentElement.hasAttribute("height"))
  11685. {
  11686. layout->setRowMinimumHeight(row,
  11687. currentElement.attribute("height").toInt());
  11688. }
  11689. if(currentElement.hasAttribute("stretch"))
  11690. {
  11691. layout->setRowStretch(row,
  11692. currentElement.attribute("stretch").toInt());
  11693. }
  11694. /*169:*/
  11695. #line 4192 "./typica.w"
  11696. int column= -1;
  11697. QDomNodeList rowChildren= currentElement.childNodes();
  11698. for(int j= 0;j<rowChildren.count();j++)
  11699. {
  11700. QDomNode columnNode;
  11701. QDomElement columnElement;
  11702. columnNode= rowChildren.at(j);
  11703. if(columnNode.isElement())
  11704. {
  11705. columnElement= columnNode.toElement();
  11706. if(columnElement.tagName()=="column")
  11707. {
  11708. column++;
  11709. if(columnElement.hasAttribute("column"))
  11710. {
  11711. column= columnElement.attribute("column").toInt();
  11712. }
  11713. if(columnElement.hasAttribute("width"))
  11714. {
  11715. layout->setColumnMinimumWidth(column,
  11716. columnElement.attribute("width").toInt());
  11717. }
  11718. if(columnElement.hasAttribute("stretch"))
  11719. {
  11720. layout->setColumnStretch(column,
  11721. columnElement.attribute("stretch").toInt());
  11722. }
  11723. int hspan= 1;
  11724. int vspan= 1;
  11725. if(columnElement.hasAttribute("rowspan"))
  11726. {
  11727. vspan= columnElement.attribute("rowspan").toInt();
  11728. }
  11729. if(columnElement.hasAttribute("colspan"))
  11730. {
  11731. hspan= columnElement.attribute("colspan").toInt();
  11732. }
  11733. QHBoxLayout*cell= new QHBoxLayout;
  11734. layout->addLayout(cell,row,column,vspan,hspan);
  11735. layoutStack->push(cell);
  11736. populateBoxLayout(columnElement,widgetStack,layoutStack);
  11737. layoutStack->pop();
  11738. }
  11739. }
  11740. }
  11741. /*:169*/
  11742. #line 4164 "./typica.w"
  11743. }
  11744. }
  11745. }
  11746. }
  11747. /*:168*//*170:*/
  11748. #line 4242 "./typica.w"
  11749. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11750. QStack<QLayout*> *layoutStack)
  11751. {
  11752. QDomNodeList children= element.childNodes();
  11753. for(int i= 0;i<children.count();i++)
  11754. {
  11755. QDomNode current;
  11756. QDomElement currentElement;
  11757. current= children.at(i);
  11758. if(current.isElement())
  11759. {
  11760. currentElement= current.toElement();
  11761. if(currentElement.tagName()=="button")
  11762. {
  11763. addButtonToLayout(currentElement,widgetStack,layoutStack);
  11764. }
  11765. else if(currentElement.tagName()=="calendar")
  11766. {
  11767. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  11768. }
  11769. else if(currentElement.tagName()=="decoration")
  11770. {
  11771. addDecorationToLayout(currentElement,widgetStack,
  11772. layoutStack);
  11773. }
  11774. else if(currentElement.tagName()=="layout")
  11775. {
  11776. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  11777. }
  11778. else if(currentElement.tagName()=="splitter")
  11779. {
  11780. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  11781. }
  11782. else if(currentElement.tagName()=="label")
  11783. {
  11784. QBoxLayout*layout=
  11785. qobject_cast<QBoxLayout*> (layoutStack->top());
  11786. QLabel*label= new QLabel(currentElement.text());
  11787. layout->addWidget(label);
  11788. }
  11789. else if(currentElement.tagName()=="lcdtemperature")
  11790. {
  11791. addTemperatureDisplayToLayout(currentElement,widgetStack,
  11792. layoutStack);
  11793. }
  11794. else if(currentElement.tagName()=="lcdtimer")
  11795. {
  11796. addTimerDisplayToLayout(currentElement,widgetStack,
  11797. layoutStack);
  11798. }
  11799. else if(currentElement.tagName()=="line")
  11800. {
  11801. addLineToLayout(currentElement,widgetStack,layoutStack);
  11802. }
  11803. else if(currentElement.tagName()=="report")
  11804. {
  11805. addReportToLayout(currentElement,widgetStack,layoutStack);
  11806. }
  11807. else if(currentElement.tagName()=="sqldrop")
  11808. {
  11809. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  11810. }
  11811. else if(currentElement.tagName()=="sqltablearray")
  11812. {
  11813. addSaltToLayout(currentElement,widgetStack,layoutStack);
  11814. }
  11815. else if(currentElement.tagName()=="sqlview")
  11816. {
  11817. addSqlQueryViewToLayout(currentElement,widgetStack,
  11818. layoutStack);
  11819. }
  11820. else if(currentElement.tagName()=="textarea")
  11821. {
  11822. addTextToLayout(currentElement,widgetStack,layoutStack);
  11823. }
  11824. else if(currentElement.tagName()=="spinbox")
  11825. {
  11826. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  11827. }
  11828. else if(currentElement.tagName()=="formarray")
  11829. {
  11830. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  11831. }
  11832. else if(currentElement.tagName()=="hscale")
  11833. {
  11834. addScaleControlToLayout(currentElement,widgetStack,
  11835. layoutStack);
  11836. }
  11837. else if(currentElement.tagName()=="vscale")
  11838. {
  11839. addIntensityControlToLayout(currentElement,widgetStack,
  11840. layoutStack);
  11841. }
  11842. else if(currentElement.tagName()=="webview")
  11843. {
  11844. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  11845. }
  11846. else if(currentElement.tagName()=="stretch")
  11847. {
  11848. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11849. layout->addStretch();
  11850. }
  11851. }
  11852. }
  11853. }
  11854. /*:170*//*171:*/
  11855. #line 4352 "./typica.w"
  11856. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11857. QStack<QLayout*> *layoutStack)
  11858. {
  11859. QLayout*targetLayout= layoutStack->pop();
  11860. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  11861. if(element.hasAttribute("type"))
  11862. {
  11863. /*166:*/
  11864. #line 4066 "./typica.w"
  11865. QLayout*layout;
  11866. QString layoutType= element.attribute("type");
  11867. if(layoutType=="horizontal")
  11868. {
  11869. layout= new QHBoxLayout;
  11870. layoutStack->push(layout);
  11871. populateBoxLayout(element,widgetStack,layoutStack);
  11872. }
  11873. else if(layoutType=="vertical")
  11874. {
  11875. layout= new QVBoxLayout;
  11876. layoutStack->push(layout);
  11877. populateBoxLayout(element,widgetStack,layoutStack);
  11878. }
  11879. else if(layoutType=="grid")
  11880. {
  11881. layout= new QGridLayout;
  11882. layoutStack->push(layout);
  11883. populateGridLayout(element,widgetStack,layoutStack);
  11884. }
  11885. else if(layoutType=="stack")
  11886. {
  11887. layout= new QStackedLayout;
  11888. layoutStack->push(layout);
  11889. populateStackedLayout(element,widgetStack,layoutStack);
  11890. }
  11891. if(element.hasAttribute("id"))
  11892. {
  11893. layout->setObjectName(element.attribute("id"));
  11894. }
  11895. /*:166*/
  11896. #line 4360 "./typica.w"
  11897. boxLayout->addLayout(layout);
  11898. layoutStack->pop();
  11899. }
  11900. layoutStack->push(targetLayout);
  11901. }
  11902. /*:171*//*172:*/
  11903. #line 4371 "./typica.w"
  11904. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11905. QStack<QLayout*> *layoutStack)
  11906. {
  11907. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11908. QSplitter*splitter= new(QSplitter);
  11909. layout->addWidget(splitter);
  11910. /*173:*/
  11911. #line 4384 "./typica.w"
  11912. QString orientation= element.attribute("type");
  11913. if(orientation=="horizontal")
  11914. {
  11915. splitter->setOrientation(Qt::Horizontal);
  11916. }
  11917. else if(orientation=="vertical")
  11918. {
  11919. splitter->setOrientation(Qt::Vertical);
  11920. }
  11921. QString id= element.attribute("id");
  11922. if(!id.isEmpty())
  11923. {
  11924. splitter->setObjectName(id);
  11925. }
  11926. if(element.hasChildNodes())
  11927. {
  11928. widgetStack->push(splitter);
  11929. populateSplitter(element,widgetStack,layoutStack);
  11930. widgetStack->pop();
  11931. }
  11932. /*:173*/
  11933. #line 4378 "./typica.w"
  11934. }
  11935. /*:172*//*174:*/
  11936. #line 4410 "./typica.w"
  11937. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  11938. QStack<QLayout*> *layoutStack)
  11939. {
  11940. QDomNodeList children= element.childNodes();
  11941. for(int i= 0;i<children.count();i++)
  11942. {
  11943. QDomNode current;
  11944. QDomElement currentElement;
  11945. current= children.at(i);
  11946. if(current.isElement())
  11947. {
  11948. currentElement= current.toElement();
  11949. if(currentElement.tagName()=="decoration")
  11950. {
  11951. addDecorationToSplitter(currentElement,widgetStack,
  11952. layoutStack);
  11953. }
  11954. else if(currentElement.tagName()=="graph")
  11955. {
  11956. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  11957. }
  11958. else if(currentElement.tagName()=="splitter")
  11959. {
  11960. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  11961. }
  11962. else if(currentElement.tagName()=="lcdtemperature")
  11963. {
  11964. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  11965. layoutStack);
  11966. }
  11967. else if(currentElement.tagName()=="lcdtimer")
  11968. {
  11969. addTimerDisplayToSplitter(currentElement,widgetStack,
  11970. layoutStack);
  11971. }
  11972. else if(currentElement.tagName()=="measurementtable")
  11973. {
  11974. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  11975. }
  11976. else if(currentElement.tagName()=="widget")
  11977. {
  11978. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  11979. }
  11980. }
  11981. }
  11982. }
  11983. /*:174*//*175:*/
  11984. #line 4460 "./typica.w"
  11985. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  11986. QStack<QLayout*> *layoutStack)
  11987. {
  11988. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  11989. QSplitter*splitter= new(QSplitter);
  11990. splitter->setParent(parent);
  11991. parent->addWidget(splitter);
  11992. /*173:*/
  11993. #line 4384 "./typica.w"
  11994. QString orientation= element.attribute("type");
  11995. if(orientation=="horizontal")
  11996. {
  11997. splitter->setOrientation(Qt::Horizontal);
  11998. }
  11999. else if(orientation=="vertical")
  12000. {
  12001. splitter->setOrientation(Qt::Vertical);
  12002. }
  12003. QString id= element.attribute("id");
  12004. if(!id.isEmpty())
  12005. {
  12006. splitter->setObjectName(id);
  12007. }
  12008. if(element.hasChildNodes())
  12009. {
  12010. widgetStack->push(splitter);
  12011. populateSplitter(element,widgetStack,layoutStack);
  12012. widgetStack->pop();
  12013. }
  12014. /*:173*/
  12015. #line 4468 "./typica.w"
  12016. }
  12017. /*:175*//*176:*/
  12018. #line 4477 "./typica.w"
  12019. void addTemperatureDisplayToSplitter(QDomElement element,
  12020. QStack<QWidget*> *widgetStack,
  12021. QStack<QLayout*> *)
  12022. {
  12023. TemperatureDisplay*display= new(TemperatureDisplay);
  12024. if(element.hasAttribute("id"))
  12025. {
  12026. display->setObjectName(element.attribute("id"));
  12027. }
  12028. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12029. splitter->addWidget(display);
  12030. }
  12031. void addTemperatureDisplayToLayout(QDomElement element,
  12032. QStack<QWidget*> *,
  12033. QStack<QLayout*> *layoutStack)
  12034. {
  12035. TemperatureDisplay*display= new(TemperatureDisplay);
  12036. if(element.hasAttribute("id"))
  12037. {
  12038. display->setObjectName(element.attribute("id"));
  12039. }
  12040. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12041. layout->addWidget(display);
  12042. }
  12043. /*:176*//*177:*/
  12044. #line 4508 "./typica.w"
  12045. void addTimerDisplayToSplitter(QDomElement element,
  12046. QStack<QWidget*> *widgetStack,
  12047. QStack<QLayout*> *)
  12048. {
  12049. TimerDisplay*display= new(TimerDisplay);
  12050. if(element.hasAttribute("id"))
  12051. {
  12052. display->setObjectName(element.attribute("id"));
  12053. }
  12054. if(element.hasAttribute("format"))
  12055. {
  12056. display->setDisplayFormat(element.attribute("format"));
  12057. }
  12058. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12059. splitter->addWidget(display);
  12060. }
  12061. void addTimerDisplayToLayout(QDomElement element,
  12062. QStack<QWidget*> *,
  12063. QStack<QLayout*> *layoutStack)
  12064. {
  12065. TimerDisplay*display= new(TimerDisplay);
  12066. if(element.hasAttribute("id"))
  12067. {
  12068. display->setObjectName(element.attribute("id"));
  12069. }
  12070. if(element.hasAttribute("format"))
  12071. {
  12072. display->setDisplayFormat(element.attribute("format"));
  12073. }
  12074. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12075. layout->addWidget(display);
  12076. }
  12077. /*:177*//*178:*/
  12078. #line 4546 "./typica.w"
  12079. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  12080. QStack<QLayout*> *layoutStack)
  12081. {
  12082. /*179:*/
  12083. #line 4567 "./typica.w"
  12084. QString labelText= element.attribute("name");
  12085. Qt::Orientations orientation= Qt::Horizontal;
  12086. if(element.hasAttribute("type"))
  12087. {
  12088. if(element.attribute("type")=="horizontal")
  12089. {
  12090. orientation= Qt::Horizontal;
  12091. }
  12092. else if(element.attribute("type")=="vertical")
  12093. {
  12094. orientation= Qt::Vertical;
  12095. }
  12096. }
  12097. /*180:*/
  12098. #line 4592 "./typica.w"
  12099. QWidget*theWidget= NULL;
  12100. QDomNodeList children= element.childNodes();
  12101. for(int i= 0;i<children.count();i++)
  12102. {
  12103. QDomNode item= children.at(i);
  12104. if(item.isElement())
  12105. {
  12106. QDomElement itemElement= item.toElement();
  12107. if(itemElement.tagName()=="lcdtemperature")
  12108. {
  12109. TemperatureDisplay*display= new TemperatureDisplay;
  12110. if(itemElement.hasAttribute("id"))
  12111. {
  12112. display->setObjectName(itemElement.attribute("id"));
  12113. }
  12114. theWidget= display;
  12115. }
  12116. else if(itemElement.tagName()=="lcdtimer")
  12117. {
  12118. TimerDisplay*display= new TimerDisplay;
  12119. if(itemElement.hasAttribute("id"))
  12120. {
  12121. display->setObjectName(itemElement.attribute("id"));
  12122. }
  12123. if(itemElement.hasAttribute("format"))
  12124. {
  12125. display->setDisplayFormat(itemElement.attribute("format"));
  12126. }
  12127. theWidget= display;
  12128. }
  12129. }
  12130. }
  12131. /*:180*/
  12132. #line 4581 "./typica.w"
  12133. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12134. orientation);
  12135. if(element.hasAttribute("id"))
  12136. {
  12137. decoration->setObjectName(element.attribute("id"));
  12138. }
  12139. /*:179*/
  12140. #line 4550 "./typica.w"
  12141. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12142. layout->addWidget(decoration);
  12143. }
  12144. void addDecorationToSplitter(QDomElement element,
  12145. QStack<QWidget*> *widgetStack,
  12146. QStack<QLayout*> *)
  12147. {
  12148. /*179:*/
  12149. #line 4567 "./typica.w"
  12150. QString labelText= element.attribute("name");
  12151. Qt::Orientations orientation= Qt::Horizontal;
  12152. if(element.hasAttribute("type"))
  12153. {
  12154. if(element.attribute("type")=="horizontal")
  12155. {
  12156. orientation= Qt::Horizontal;
  12157. }
  12158. else if(element.attribute("type")=="vertical")
  12159. {
  12160. orientation= Qt::Vertical;
  12161. }
  12162. }
  12163. /*180:*/
  12164. #line 4592 "./typica.w"
  12165. QWidget*theWidget= NULL;
  12166. QDomNodeList children= element.childNodes();
  12167. for(int i= 0;i<children.count();i++)
  12168. {
  12169. QDomNode item= children.at(i);
  12170. if(item.isElement())
  12171. {
  12172. QDomElement itemElement= item.toElement();
  12173. if(itemElement.tagName()=="lcdtemperature")
  12174. {
  12175. TemperatureDisplay*display= new TemperatureDisplay;
  12176. if(itemElement.hasAttribute("id"))
  12177. {
  12178. display->setObjectName(itemElement.attribute("id"));
  12179. }
  12180. theWidget= display;
  12181. }
  12182. else if(itemElement.tagName()=="lcdtimer")
  12183. {
  12184. TimerDisplay*display= new TimerDisplay;
  12185. if(itemElement.hasAttribute("id"))
  12186. {
  12187. display->setObjectName(itemElement.attribute("id"));
  12188. }
  12189. if(itemElement.hasAttribute("format"))
  12190. {
  12191. display->setDisplayFormat(itemElement.attribute("format"));
  12192. }
  12193. theWidget= display;
  12194. }
  12195. }
  12196. }
  12197. /*:180*/
  12198. #line 4581 "./typica.w"
  12199. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12200. orientation);
  12201. if(element.hasAttribute("id"))
  12202. {
  12203. decoration->setObjectName(element.attribute("id"));
  12204. }
  12205. /*:179*/
  12206. #line 4559 "./typica.w"
  12207. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12208. splitter->addWidget(decoration);
  12209. }
  12210. /*:178*//*181:*/
  12211. #line 4631 "./typica.w"
  12212. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12213. QStack<QLayout*> *layoutStack)
  12214. {
  12215. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12216. QWidget*widget= new QWidget;
  12217. if(element.hasAttribute("id"))
  12218. {
  12219. widget->setObjectName(element.attribute("id"));
  12220. }
  12221. splitter->addWidget(widget);
  12222. if(element.hasChildNodes())
  12223. {
  12224. widgetStack->push(widget);
  12225. populateWidget(element,widgetStack,layoutStack);
  12226. widgetStack->pop();
  12227. }
  12228. }
  12229. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  12230. QStack<QLayout*> *layoutStack)
  12231. {
  12232. QDomNodeList children= element.childNodes();
  12233. for(int i= 0;i<children.count();i++)
  12234. {
  12235. QDomNode current;
  12236. QDomElement currentElement;
  12237. current= children.at(i);
  12238. if(current.isElement())
  12239. {
  12240. currentElement= current.toElement();
  12241. if(currentElement.tagName()=="layout")
  12242. {
  12243. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  12244. }
  12245. }
  12246. }
  12247. }
  12248. /*:181*//*182:*/
  12249. #line 4674 "./typica.w"
  12250. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  12251. QStack<QLayout*> *layoutStack)
  12252. {
  12253. QAbstractButton*button= NULL;
  12254. QString text= element.attribute("name");
  12255. if(element.hasAttribute("type"))
  12256. {
  12257. QString type= element.attribute("type");
  12258. if(type=="annotation")
  12259. {
  12260. AnnotationButton*abutton= new AnnotationButton(text);
  12261. if(element.hasAttribute("annotation"))
  12262. {
  12263. abutton->setAnnotation(element.attribute("annotation"));
  12264. }
  12265. if(element.hasAttribute("series"))
  12266. {
  12267. abutton->setTemperatureColumn(element.attribute("series").
  12268. toInt());
  12269. }
  12270. if(element.hasAttribute("column"))
  12271. {
  12272. abutton->setAnnotationColumn(element.attribute("column").
  12273. toInt());
  12274. }
  12275. button= abutton;
  12276. }
  12277. else if(type=="check")
  12278. {
  12279. button= new QCheckBox(text);
  12280. }
  12281. else if(type=="push")
  12282. {
  12283. button= new QPushButton(text);
  12284. }
  12285. }
  12286. if(element.hasAttribute("id"))
  12287. {
  12288. button->setObjectName(element.attribute("id"));
  12289. }
  12290. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12291. layout->addWidget(button);
  12292. }
  12293. /*:182*//*183:*/
  12294. #line 4726 "./typica.w"
  12295. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  12296. QStack<QLayout*> *layoutStack)
  12297. {
  12298. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  12299. if(element.hasAttribute("pretext"))
  12300. {
  12301. box->setPretext(element.attribute("pretext"));
  12302. }
  12303. if(element.hasAttribute("posttext"))
  12304. {
  12305. box->setPosttext(element.attribute("posttext"));
  12306. }
  12307. if(element.hasAttribute("series"))
  12308. {
  12309. box->setTemperatureColumn(element.attribute("series").toInt());
  12310. }
  12311. if(element.hasAttribute("column"))
  12312. {
  12313. box->setAnnotationColumn(element.attribute("column").toInt());
  12314. }
  12315. if(element.hasAttribute("min"))
  12316. {
  12317. box->setMinimum(element.attribute("min").toDouble());
  12318. }
  12319. if(element.hasAttribute("max"))
  12320. {
  12321. box->setMaximum(element.attribute("max").toDouble());
  12322. }
  12323. if(element.hasAttribute("decimals"))
  12324. {
  12325. box->setDecimals(element.attribute("decimals").toInt());
  12326. }
  12327. if(element.hasAttribute("step"))
  12328. {
  12329. box->setSingleStep(element.attribute("step").toDouble());
  12330. }
  12331. if(element.hasAttribute("id"))
  12332. {
  12333. box->setObjectName(element.attribute("id"));
  12334. }
  12335. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12336. layout->addWidget(box);
  12337. }
  12338. /*:183*//*184:*/
  12339. #line 4782 "./typica.w"
  12340. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12341. QStack<QLayout*> *)
  12342. {
  12343. ZoomLog*widget= new ZoomLog;
  12344. if(!widget)
  12345. {
  12346. qDebug()<<"Error constructing widget!";
  12347. }
  12348. if(element.hasAttribute("id"))
  12349. {
  12350. widget->setObjectName(element.attribute("id"));
  12351. }
  12352. if(element.hasChildNodes())
  12353. {
  12354. QDomNodeList children= element.childNodes();
  12355. int column= 0;
  12356. for(int i= 0;i<children.count();i++)
  12357. {
  12358. QDomNode current;
  12359. QDomElement currentElement;
  12360. current= children.at(i);
  12361. if(current.isElement())
  12362. {
  12363. currentElement= current.toElement();
  12364. if(currentElement.tagName()=="column")
  12365. {
  12366. QString text= currentElement.text();
  12367. widget->setHeaderData(column,text);
  12368. column++;
  12369. }
  12370. }
  12371. }
  12372. }
  12373. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12374. if(splitter)
  12375. {
  12376. splitter->addWidget(widget);
  12377. }
  12378. else
  12379. {
  12380. qDebug()<<"Splitter not found at top of widget stack!";
  12381. }
  12382. }
  12383. /*:184*//*185:*/
  12384. #line 4830 "./typica.w"
  12385. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12386. QStack<QLayout*> *)
  12387. {
  12388. GraphView*view= new GraphView;
  12389. if(element.hasAttribute("id"))
  12390. {
  12391. view->setObjectName(element.attribute("id"));
  12392. }
  12393. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12394. splitter->addWidget(view);
  12395. }
  12396. /*:185*//*186:*/
  12397. #line 4847 "./typica.w"
  12398. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  12399. QStack<QLayout*> *layoutStack)
  12400. {
  12401. SqlComboBox*box= new SqlComboBox();
  12402. if(element.hasAttribute("data"))
  12403. {
  12404. box->setDataColumn(element.attribute("data").toInt());
  12405. }
  12406. if(element.hasAttribute("display"))
  12407. {
  12408. box->setDisplayColumn(element.attribute("display").toInt());
  12409. }
  12410. if(element.hasAttribute("showdata"))
  12411. {
  12412. if(element.attribute("showdata")=="true")
  12413. {
  12414. box->showData(true);
  12415. }
  12416. }
  12417. if(element.hasAttribute("editable"))
  12418. {
  12419. if(element.attribute("editable")=="true")
  12420. {
  12421. box->setEditable(true);
  12422. }
  12423. }
  12424. if(element.hasChildNodes())
  12425. {
  12426. QDomNodeList children= element.childNodes();
  12427. for(int i= 0;i<children.count();i++)
  12428. {
  12429. QDomNode current;
  12430. QDomElement currentElement;
  12431. current= children.at(i);
  12432. if(current.isElement())
  12433. {
  12434. currentElement= current.toElement();
  12435. if(currentElement.tagName()=="null")
  12436. {
  12437. box->addNullOption();
  12438. }
  12439. else if(currentElement.tagName()=="query")
  12440. {
  12441. box->addSqlOptions(currentElement.text());
  12442. }
  12443. }
  12444. }
  12445. }
  12446. if(element.hasAttribute("id"))
  12447. {
  12448. box->setObjectName(element.attribute("id"));
  12449. }
  12450. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12451. layout->addWidget(box);
  12452. }
  12453. /*:186*//*187:*/
  12454. #line 4926 "./typica.w"
  12455. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  12456. QStack<QLayout*> *layoutStack)
  12457. {
  12458. QTableView*view= new QTableView;
  12459. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  12460. SaltModel*model= new SaltModel(element.childNodes().count());
  12461. if(element.hasAttribute("id"))
  12462. {
  12463. view->setObjectName(element.attribute("id"));
  12464. }
  12465. if(element.hasChildNodes())
  12466. {
  12467. QDomNodeList children= element.childNodes();
  12468. int currentColumn= 0;
  12469. for(int i= 0;i<children.count();i++)
  12470. {
  12471. QDomNode current;
  12472. QDomElement currentElement;
  12473. current= children.at(i);
  12474. if(current.isElement())
  12475. {
  12476. currentElement= current.toElement();
  12477. if(currentElement.tagName()=="column")
  12478. {
  12479. if(currentElement.hasAttribute("name"))
  12480. {
  12481. model->setHeaderData(currentColumn,Qt::Horizontal,
  12482. currentElement.attribute("name"));
  12483. }
  12484. if(currentElement.hasAttribute("delegate"))
  12485. {
  12486. /*188:*/
  12487. #line 4974 "./typica.w"
  12488. if(currentElement.attribute("delegate")=="sql")
  12489. {
  12490. /*189:*/
  12491. #line 4990 "./typica.w"
  12492. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  12493. SqlComboBox*widget= new SqlComboBox();
  12494. if(currentElement.hasAttribute("null"))
  12495. {
  12496. if(currentElement.attribute("null")=="true")
  12497. {
  12498. widget->addNullOption();
  12499. }
  12500. }
  12501. if(currentElement.hasAttribute("showdata"))
  12502. {
  12503. if(currentElement.attribute("showdata")=="true")
  12504. {
  12505. widget->showData(true);
  12506. }
  12507. }
  12508. if(currentElement.hasAttribute("data"))
  12509. {
  12510. widget->setDataColumn(currentElement.attribute("data").toInt());
  12511. }
  12512. if(currentElement.hasAttribute("display"))
  12513. {
  12514. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  12515. }
  12516. widget->addSqlOptions(currentElement.text());
  12517. delegate->setWidget(widget);
  12518. view->setItemDelegateForColumn(currentColumn,delegate);
  12519. /*:189*/
  12520. #line 4977 "./typica.w"
  12521. }
  12522. else if(currentElement.attribute("delegate")=="numeric")
  12523. {
  12524. /*190:*/
  12525. #line 5023 "./typica.w"
  12526. NumericDelegate*delegate= new NumericDelegate;
  12527. view->setItemDelegateForColumn(currentColumn,delegate);
  12528. /*:190*/
  12529. #line 4981 "./typica.w"
  12530. }
  12531. /*:188*/
  12532. #line 4958 "./typica.w"
  12533. }
  12534. currentColumn++;
  12535. }
  12536. }
  12537. }
  12538. }
  12539. view->setModel(model);
  12540. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12541. layout->addWidget(view);
  12542. }
  12543. /*:187*//*197:*/
  12544. #line 5133 "./typica.w"
  12545. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  12546. QStack<QLayout*> *layoutStack)
  12547. {
  12548. QLineEdit*widget= new QLineEdit(element.text());
  12549. if(element.hasAttribute("id"))
  12550. {
  12551. widget->setObjectName(element.attribute("id"));
  12552. }
  12553. if(element.hasAttribute("writable"))
  12554. {
  12555. if(element.attribute("writable")=="false")
  12556. {
  12557. widget->setReadOnly(true);
  12558. }
  12559. }
  12560. if(element.hasAttribute("validator"))
  12561. {
  12562. if(element.attribute("validator")=="numeric")
  12563. {
  12564. widget->setValidator(new QDoubleValidator(NULL));
  12565. }
  12566. else if(element.attribute("validator")=="integer")
  12567. {
  12568. widget->setValidator(new QIntValidator(NULL));
  12569. }
  12570. else if(element.attribute("validator")=="expression"&&
  12571. element.hasAttribute("expression"))
  12572. {
  12573. widget->setValidator(new QRegExpValidator(
  12574. QRegExp(element.attribute("expression")),
  12575. NULL));
  12576. }
  12577. }
  12578. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12579. layout->addWidget(widget);
  12580. }
  12581. /*:197*//*198:*/
  12582. #line 5174 "./typica.w"
  12583. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  12584. QStack<QLayout*> *layoutStack)
  12585. {
  12586. QTextEdit*widget= new QTextEdit;
  12587. if(element.hasAttribute("id"))
  12588. {
  12589. widget->setObjectName(element.attribute("id"));
  12590. }
  12591. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12592. layout->addWidget(widget);
  12593. }
  12594. /*:198*//*199:*/
  12595. #line 5191 "./typica.w"
  12596. void addSqlQueryViewToLayout(QDomElement element,
  12597. QStack<QWidget*> *,
  12598. QStack<QLayout*> *layoutStack)
  12599. {
  12600. SqlQueryView*view= new SqlQueryView;
  12601. if(element.hasAttribute("id"))
  12602. {
  12603. view->setObjectName(element.attribute("id"));
  12604. }
  12605. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12606. layout->addWidget(view);
  12607. }
  12608. /*:199*//*200:*/
  12609. #line 5208 "./typica.w"
  12610. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  12611. QStack<QLayout*> *layoutStack)
  12612. {
  12613. QDateEdit*widget= new QDateEdit;
  12614. widget->setCalendarPopup(true);
  12615. if(element.hasAttribute("id"))
  12616. {
  12617. widget->setObjectName(element.attribute("id"));
  12618. }
  12619. widget->setDate(QDate::currentDate());
  12620. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12621. layout->addWidget(widget);
  12622. }
  12623. /*:200*//*201:*/
  12624. #line 5226 "./typica.w"
  12625. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  12626. {
  12627. setQDateTimeEditProperties(value,engine);
  12628. }
  12629. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  12630. {
  12631. setQAbstractSpinBoxProperties(value,engine);
  12632. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  12633. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  12634. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  12635. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  12636. }
  12637. /*:201*//*202:*/
  12638. #line 5246 "./typica.w"
  12639. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  12640. {
  12641. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12642. if(context->argumentCount()==3)
  12643. {
  12644. self->setDate(QDate(argument<int> (0,context),
  12645. argument<int> (1,context),
  12646. argument<int> (2,context)));
  12647. }
  12648. else
  12649. {
  12650. context->throwError("Incorrect number of arguments passed to "
  12651. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  12652. "specifying the year, month, and day.");
  12653. }
  12654. return QScriptValue();
  12655. }
  12656. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  12657. {
  12658. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12659. return QScriptValue(self->date().day());
  12660. }
  12661. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  12662. {
  12663. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12664. return QScriptValue(self->date().month());
  12665. }
  12666. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  12667. {
  12668. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12669. return QScriptValue(self->date().year());
  12670. }
  12671. /*:202*//*206:*/
  12672. #line 5313 "./typica.w"
  12673. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  12674. {
  12675. QObject*parent= argument<QObject*> (0,context);
  12676. QString name= argument<QString> (1,context);
  12677. QObject*object= parent->findChild<QObject*> (name);
  12678. QScriptValue value;
  12679. if(object)
  12680. {
  12681. value= engine->newQObject(object);
  12682. QString className= object->metaObject()->className();
  12683. /*207:*/
  12684. #line 5331 "./typica.w"
  12685. if(className=="TemperatureDisplay")
  12686. {
  12687. setTemperatureDisplayProperties(value,engine);
  12688. }
  12689. else if(className=="TimerDisplay")
  12690. {
  12691. setTimerDisplayProperties(value,engine);
  12692. }
  12693. else if(className=="QAction")
  12694. {
  12695. setQActionProperties(value,engine);
  12696. }
  12697. else if(className=="QBoxLayout")
  12698. {
  12699. setQBoxLayoutProperties(value,engine);
  12700. }
  12701. else if(className=="QDateEdit")
  12702. {
  12703. setQDateEditProperties(value,engine);
  12704. }
  12705. else if(className=="QFrame")
  12706. {
  12707. setQFrameProperties(value,engine);
  12708. }
  12709. else if(className=="QHBoxLayout")
  12710. {
  12711. setQBoxLayoutProperties(value,engine);
  12712. }
  12713. else if(className=="QLCDNumber")
  12714. {
  12715. setQLCDNumberProperties(value,engine);
  12716. }
  12717. else if(className=="QMenu")
  12718. {
  12719. setQMenuProperties(value,engine);
  12720. }
  12721. else if(className=="QMenuBar")
  12722. {
  12723. setQMenuBarProperties(value,engine);
  12724. }
  12725. else if(className=="QPushButton")
  12726. {
  12727. setQPushButtonProperties(value,engine);
  12728. }
  12729. else if(className=="QSplitter")
  12730. {
  12731. setQSplitterProperties(value,engine);
  12732. }
  12733. else if(className=="QTableView")
  12734. {
  12735. if(object->property("tabletype").isValid())
  12736. {
  12737. if(object->property("tabletype").toString()=="SaltTable")
  12738. {
  12739. setSaltTableProperties(value,engine);
  12740. }
  12741. }
  12742. }
  12743. else if(className=="QVBoxLayout")
  12744. {
  12745. setQBoxLayoutProperties(value,engine);
  12746. }
  12747. else if(className=="QWidget")
  12748. {
  12749. setQWidgetProperties(value,engine);
  12750. }
  12751. else if(className=="ScriptQMainWindow")
  12752. {
  12753. setQMainWindowProperties(value,engine);
  12754. }
  12755. else if(className=="SqlComboBox")
  12756. {
  12757. setSqlComboBoxProperties(value,engine);
  12758. }
  12759. else if(className=="SqlQueryView")
  12760. {
  12761. setSqlQueryViewProperties(value,engine);
  12762. }
  12763. else if(className=="ZoomLog")
  12764. {
  12765. setZoomLogProperties(value,engine);
  12766. }
  12767. else if(className=="QTextEdit")
  12768. {
  12769. setQTextEditProperties(value,engine);
  12770. }
  12771. else if(className=="QWebView")
  12772. {
  12773. setQWebViewProperties(value,engine);
  12774. }
  12775. /*:207*/
  12776. #line 5324 "./typica.w"
  12777. }
  12778. return value;
  12779. }
  12780. /*:206*//*209:*/
  12781. #line 5449 "./typica.w"
  12782. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  12783. {
  12784. QTableView*self= getself<QTableView*> (context);
  12785. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12786. QString datum;
  12787. double total= 0.0;
  12788. int column= argument<int> (0,context);
  12789. int role= argument<int> (1,context);
  12790. for(int i= 0;i<model->rowCount();i++)
  12791. {
  12792. datum= model->data(model->index(i,column),role).toString();
  12793. if(!datum.isEmpty())
  12794. {
  12795. total+= datum.toDouble();
  12796. }
  12797. }
  12798. return QScriptValue(engine,total);
  12799. }
  12800. /*:209*//*210:*/
  12801. #line 5473 "./typica.w"
  12802. QScriptValue SaltTable_columnArray(QScriptContext*context,
  12803. QScriptEngine*engine)
  12804. {
  12805. QTableView*self= getself<QTableView*> (context);
  12806. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12807. int column= argument<int> (0,context);
  12808. int role= argument<int> (1,context);
  12809. QString literal= model->arrayLiteral(column,role);
  12810. return QScriptValue(engine,literal);
  12811. }
  12812. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  12813. QScriptEngine*engine)
  12814. {
  12815. QTableView*self= getself<QTableView*> (context);
  12816. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12817. int column= argument<int> (0,context);
  12818. int role= argument<int> (1,context);
  12819. QString literal= model->quotedArrayLiteral(column,role);
  12820. return QScriptValue(engine,literal);
  12821. }
  12822. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  12823. QScriptEngine*engine)
  12824. {
  12825. QTableView*self= getself<QTableView*> (context);
  12826. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12827. int column= argument<int> (0,context);
  12828. int role= argument<int> (1,context);
  12829. QString literal= model->arrayLiteral(column,role);
  12830. literal.chop(1);
  12831. literal= literal.remove(0,1);
  12832. return QScriptValue(engine,literal);
  12833. }
  12834. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  12835. QScriptEngine*engine)
  12836. {
  12837. QTableView*self= getself<QTableView*> (context);
  12838. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12839. int column= argument<int> (0,context);
  12840. int role= argument<int> (1,context);
  12841. QString literal= model->quotedArrayLiteral(column,role);
  12842. literal.chop(1);
  12843. literal= literal.remove(0,1);
  12844. return QScriptValue(engine,literal);
  12845. }
  12846. /*:210*//*211:*/
  12847. #line 5525 "./typica.w"
  12848. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  12849. {
  12850. QTableView*self= getself<QTableView*> (context);
  12851. QScriptValue value= engine->newQObject(self->model());
  12852. return value;
  12853. }
  12854. /*:211*//*212:*/
  12855. #line 5539 "./typica.w"
  12856. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  12857. {
  12858. QTableView*self= getself<QTableView*> (context);
  12859. int row= argument<int> (0,context);
  12860. int column= argument<int> (1,context);
  12861. QVariant value= argument<QVariant> (2,context);
  12862. int role= argument<int> (3,context);
  12863. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12864. QModelIndex cell= model->index(row,column);
  12865. model->setData(cell,value,role);
  12866. self->update(cell);
  12867. return QScriptValue();
  12868. }
  12869. /*:212*//*213:*/
  12870. #line 5557 "./typica.w"
  12871. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  12872. {
  12873. QTableView*self= getself<QTableView*> (context);
  12874. int row= argument<int> (0,context);
  12875. int column= argument<int> (1,context);
  12876. int role= argument<int> (2,context);
  12877. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12878. QModelIndex cell= model->index(row,column);
  12879. QVariant value= model->data(cell,role);
  12880. QScriptValue retval= engine->newVariant(value);
  12881. retval.setProperty("value",QScriptValue(value.toString()));
  12882. return retval;
  12883. }
  12884. /*:213*//*214:*/
  12885. #line 5575 "./typica.w"
  12886. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  12887. {
  12888. setQWidgetProperties(value,engine);
  12889. value.setProperty("columnArray",
  12890. engine->newFunction(SaltTable_columnArray));
  12891. value.setProperty("quotedColumnArray",
  12892. engine->newFunction(SaltTable_quotedColumnArray));
  12893. value.setProperty("bindableColumnArray",
  12894. engine->newFunction(SaltTable_bindableColumnArray));
  12895. value.setProperty("bindableQuotedColumnArray",
  12896. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  12897. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  12898. value.setProperty("data",engine->newFunction(SaltTable_data));
  12899. value.setProperty("model",engine->newFunction(SaltTable_model));
  12900. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  12901. }
  12902. /*:214*//*216:*/
  12903. #line 5608 "./typica.w"
  12904. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12905. {
  12906. setQComboBoxProperties(value,engine);
  12907. }
  12908. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12909. {
  12910. setQWidgetProperties(value,engine);
  12911. value.setProperty("currentData",
  12912. engine->newFunction(QComboBox_currentData));
  12913. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  12914. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  12915. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  12916. }
  12917. QScriptValue QComboBox_currentData(QScriptContext*context,
  12918. QScriptEngine*engine)
  12919. {
  12920. QComboBox*self= getself<QComboBox*> (context);
  12921. return QScriptValue(engine,
  12922. self->itemData(self->currentIndex()).toString());
  12923. }
  12924. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  12925. {
  12926. QComboBox*self= getself<QComboBox*> (context);
  12927. self->addItem(argument<QString> (0,context));
  12928. return QScriptValue();
  12929. }
  12930. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  12931. {
  12932. QComboBox*self= getself<QComboBox*> (context);
  12933. self->setModel(argument<QAbstractItemModel*> (0,context));
  12934. return QScriptValue();
  12935. }
  12936. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  12937. {
  12938. QComboBox*self= getself<QComboBox*> (context);
  12939. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  12940. }
  12941. /*:216*//*245:*/
  12942. #line 6490 "./typica.w"
  12943. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  12944. {
  12945. QScriptValue object;
  12946. if(context->argumentCount()==1)
  12947. {
  12948. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  12949. QScriptEngine::ScriptOwnership);
  12950. setDAQProperties(object,engine);
  12951. }
  12952. else if(context->argumentCount()==2)
  12953. {
  12954. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  12955. argument<QString> (1,context)),
  12956. QScriptEngine::ScriptOwnership);
  12957. setDAQProperties(object,engine);
  12958. }
  12959. else
  12960. {
  12961. context->throwError("Incorrect number of arguments passed to DAQ"
  12962. "constructor. The DAQ constructor takes one"
  12963. "string as an argument specifying a device name."
  12964. "Example: Dev1");
  12965. }
  12966. return object;
  12967. }
  12968. /*:245*//*246:*/
  12969. #line 6520 "./typica.w"
  12970. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  12971. {
  12972. setQObjectProperties(value,engine);
  12973. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  12974. }
  12975. /*:246*//*247:*/
  12976. #line 6530 "./typica.w"
  12977. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  12978. {
  12979. DAQ*self= getself<DAQ*> (context);
  12980. QScriptValue object;
  12981. if(self)
  12982. {
  12983. object=
  12984. engine->newQObject(self->newChannel(argument<int> (0,context),
  12985. argument<int> (1,context)));
  12986. setChannelProperties(object,engine);
  12987. }
  12988. return object;
  12989. }
  12990. /*:247*//*254:*/
  12991. #line 6686 "./typica.w"
  12992. QScriptValue constructFakeDAQ(QScriptContext*context,
  12993. QScriptEngine*engine)
  12994. {
  12995. QScriptValue object;
  12996. if(context->argumentCount()==1)
  12997. {
  12998. object=
  12999. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  13000. QScriptEngine::ScriptOwnership);
  13001. setFakeDAQProperties(object,engine);
  13002. }
  13003. else
  13004. {
  13005. context->throwError("Incorrect number of arguments passed to DAQ"
  13006. "constructor. The DAQ constructor takes one"
  13007. "string as an argument specifying a device name."
  13008. "Example: Dev1");
  13009. }
  13010. return object;
  13011. }
  13012. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  13013. {
  13014. setQObjectProperties(value,engine);
  13015. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  13016. }
  13017. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  13018. {
  13019. FakeDAQ*self= getself<FakeDAQ*> (context);
  13020. QScriptValue object;
  13021. if(self)
  13022. {
  13023. object=
  13024. engine->newQObject(self->newChannel(argument<int> (0,context),
  13025. argument<int> (1,context)));
  13026. setChannelProperties(object,engine);
  13027. }
  13028. return object;
  13029. }
  13030. /*:254*//*258:*/
  13031. #line 6777 "./typica.w"
  13032. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  13033. {
  13034. setQObjectProperties(value,engine);
  13035. }
  13036. /*:258*//*265:*/
  13037. #line 6963 "./typica.w"
  13038. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  13039. {
  13040. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  13041. setLinearCalibratorProperties(object,engine);
  13042. return object;
  13043. }
  13044. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  13045. {
  13046. setQObjectProperties(value,engine);
  13047. }
  13048. /*:265*//*270:*/
  13049. #line 7100 "./typica.w"
  13050. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  13051. {
  13052. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  13053. setLinearSplineInterpolatorProperties(object,engine);
  13054. return object;
  13055. }
  13056. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  13057. {
  13058. setQObjectProperties(value,engine);
  13059. }
  13060. /*:270*//*279:*/
  13061. #line 7284 "./typica.w"
  13062. QScriptValue constructTemperatureDisplay(QScriptContext*,
  13063. QScriptEngine*engine)
  13064. {
  13065. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  13066. setTemperatureDisplayProperties(object,engine);
  13067. return object;
  13068. }
  13069. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13070. {
  13071. setQLCDNumberProperties(value,engine);
  13072. }
  13073. /*:279*//*286:*/
  13074. #line 7425 "./typica.w"
  13075. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  13076. QScriptEngine*engine)
  13077. {
  13078. QScriptValue object=
  13079. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  13080. setMeasurementTimeOffsetProperties(object,engine);
  13081. return object;
  13082. }
  13083. void setMeasurementTimeOffsetProperties(QScriptValue value,
  13084. QScriptEngine*engine)
  13085. {
  13086. setQObjectProperties(value,engine);
  13087. }
  13088. /*:286*//*291:*/
  13089. #line 7534 "./typica.w"
  13090. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  13091. {
  13092. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  13093. return object;
  13094. }
  13095. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  13096. {
  13097. setQObjectProperties(value,engine);
  13098. }
  13099. /*:291*//*296:*/
  13100. #line 7630 "./typica.w"
  13101. QScriptValue constructZeroEmitter(QScriptContext*context,
  13102. QScriptEngine*engine)
  13103. {
  13104. QScriptValue object=
  13105. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  13106. setZeroEmitterProperties(object,engine);
  13107. return object;
  13108. }
  13109. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  13110. {
  13111. setQObjectProperties(value,engine);
  13112. }
  13113. /*:296*//*301:*/
  13114. #line 7710 "./typica.w"
  13115. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  13116. QScriptEngine*engine)
  13117. {
  13118. QScriptValue object=
  13119. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  13120. setMeasurementAdapterProperties(object,engine);
  13121. return object;
  13122. }
  13123. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  13124. {
  13125. setQObjectProperties(value,engine);
  13126. }
  13127. /*:301*//*316:*/
  13128. #line 8058 "./typica.w"
  13129. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  13130. {
  13131. QScriptValue object= engine->newQObject(new GraphView);
  13132. setGraphViewProperties(object,engine);
  13133. return object;
  13134. }
  13135. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  13136. {
  13137. setQGraphicsViewProperties(value,engine);
  13138. }
  13139. /*:316*//*338:*/
  13140. #line 8630 "./typica.w"
  13141. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  13142. {
  13143. QScriptValue object= engine->newQObject(new ZoomLog);
  13144. setZoomLogProperties(object,engine);
  13145. return object;
  13146. }
  13147. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  13148. {
  13149. setQTableViewProperties(value,engine);
  13150. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  13151. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  13152. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  13153. value.setProperty("restoreState",
  13154. engine->newFunction(ZoomLog_restoreState));
  13155. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  13156. value.setProperty("saveTemporary",
  13157. engine->newFunction(ZoomLog_saveTemporary));
  13158. }
  13159. /*:338*//*339:*/
  13160. #line 8656 "./typica.w"
  13161. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  13162. {
  13163. ZoomLog*self= getself<ZoomLog*> (context);
  13164. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  13165. return QScriptValue(engine,retval);
  13166. }
  13167. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  13168. {
  13169. ZoomLog*self= getself<ZoomLog*> (context);
  13170. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  13171. return QScriptValue(engine,retval);
  13172. }
  13173. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  13174. QScriptEngine*engine)
  13175. {
  13176. ZoomLog*self= getself<ZoomLog*> (context);
  13177. QString filename= QDir::tempPath();
  13178. filename.append("/");
  13179. filename.append(QUuid::createUuid().toString());
  13180. filename.append(".xml");
  13181. QFile*file= new QFile(filename);
  13182. self->saveXML(file);
  13183. file->close();
  13184. delete file;
  13185. return QScriptValue(engine,filename);
  13186. }
  13187. /*:339*//*340:*/
  13188. #line 8704 "./typica.w"
  13189. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  13190. {
  13191. ZoomLog*self= getself<ZoomLog*> (context);
  13192. QString key= argument<QString> (0,context);
  13193. int columns= argument<int> (1,context);
  13194. QSettings settings;
  13195. for(int i= 0;i<columns;i++)
  13196. {
  13197. if(self->columnWidth(i))
  13198. {
  13199. settings.beginGroup(key);
  13200. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  13201. settings.endGroup();
  13202. }
  13203. }
  13204. return QScriptValue();
  13205. }
  13206. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  13207. {
  13208. ZoomLog*self= getself<ZoomLog*> (context);
  13209. QString key= argument<QString> (0,context);
  13210. int columns= argument<int> (1,context);
  13211. QSettings settings;
  13212. for(int i= 0;i<columns;i++)
  13213. {
  13214. settings.beginGroup(key);
  13215. self->setColumnWidth(i,
  13216. settings.value(QString("%1").arg(i),80).toInt());
  13217. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  13218. {
  13219. self->setColumnWidth(i,80);
  13220. }
  13221. settings.endGroup();
  13222. }
  13223. return QScriptValue();
  13224. }
  13225. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  13226. {
  13227. ZoomLog*self= getself<ZoomLog*> (context);
  13228. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  13229. }
  13230. /*:340*//*375:*/
  13231. #line 9548 "./typica.w"
  13232. QScriptValue constructAnnotationButton(QScriptContext*context,
  13233. QScriptEngine*engine)
  13234. {
  13235. QScriptValue object=
  13236. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  13237. setAnnotationButtonProperties(object,engine);
  13238. return object;
  13239. }
  13240. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  13241. {
  13242. setQPushButtonProperties(value,engine);
  13243. }
  13244. /*:375*//*383:*/
  13245. #line 9691 "./typica.w"
  13246. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  13247. QScriptEngine*engine)
  13248. {
  13249. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  13250. argument<QString> (0,context),argument<QString> (1,context)));
  13251. setAnnotationSpinBoxProperties(object,engine);
  13252. return object;
  13253. }
  13254. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13255. {
  13256. setQDoubleSpinBoxProperties(value,engine);
  13257. }
  13258. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13259. {
  13260. setQAbstractSpinBoxProperties(value,engine);
  13261. }
  13262. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13263. {
  13264. setQWidgetProperties(value,engine);
  13265. }
  13266. /*:383*//*404:*/
  13267. #line 10110 "./typica.w"
  13268. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  13269. {
  13270. QScriptValue object= engine->newQObject(new TimerDisplay);
  13271. setTimerDisplayProperties(object,engine);
  13272. return object;
  13273. }
  13274. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13275. {
  13276. setQLCDNumberProperties(value,engine);
  13277. }
  13278. /*:404*//*431:*/
  13279. #line 10605 "./typica.w"
  13280. QScriptValue constructWidgetDecorator(QScriptContext*context,
  13281. QScriptEngine*engine)
  13282. {
  13283. QWidget*widget= argument<QWidget*> (0,context);
  13284. QString text= argument<QString> (1,context);
  13285. Qt::Orientations orientation;
  13286. switch(argument<int> (2,context))
  13287. {
  13288. case 2:
  13289. orientation= Qt::Vertical;
  13290. break;
  13291. default:
  13292. orientation= Qt::Horizontal;
  13293. break;
  13294. }
  13295. QScriptValue object=
  13296. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  13297. setWidgetDecoratorProperties(object,engine);
  13298. return object;
  13299. }
  13300. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  13301. {
  13302. setQWidgetProperties(value,engine);
  13303. }
  13304. /*:431*//*444:*/
  13305. #line 10886 "./typica.w"
  13306. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  13307. {
  13308. QScriptValue object= engine->newQObject(new LogEditWindow);
  13309. return object;
  13310. }
  13311. /*:444*//*463:*/
  13312. #line 11360 "./typica.w"
  13313. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  13314. {
  13315. QIODevice*device= argument<QIODevice*> (0,context);
  13316. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  13317. argument<int> (1,context)));
  13318. object.setProperty("input",engine->newFunction(XMLInput_input));
  13319. return object;
  13320. }
  13321. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  13322. {
  13323. XMLInput*self= getself<XMLInput*> (context);
  13324. self->input();
  13325. return QScriptValue();
  13326. }
  13327. /*:463*//*470:*/
  13328. #line 11528 "./typica.w"
  13329. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  13330. {
  13331. QScriptValue object= engine->newQObject(new QWebView());
  13332. setQWebViewProperties(object,engine);
  13333. return object;
  13334. }
  13335. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  13336. {
  13337. setQWidgetProperties(value,engine);
  13338. value.setProperty("load",engine->newFunction(WebView_load));
  13339. value.setProperty("print",engine->newFunction(WebView_print));
  13340. value.setProperty("setHtml",engine->newFunction(WebView_setHtml));
  13341. value.setProperty("setContent",engine->newFunction(WebView_setContent));
  13342. value.setProperty("saveXml",engine->newFunction(WebView_saveXml));
  13343. }
  13344. /*:470*//*471:*/
  13345. #line 11549 "./typica.w"
  13346. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*)
  13347. {
  13348. QWebView*self= getself<QWebView*> (context);
  13349. QString file= argument<QString> (0,context);
  13350. self->load(QUrl(file));
  13351. return QScriptValue();
  13352. }
  13353. /*:471*//*472:*/
  13354. #line 11562 "./typica.w"
  13355. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*)
  13356. {
  13357. QWebView*self= getself<QWebView*> (context);
  13358. QPrinter*printer= new QPrinter(QPrinter::HighResolution);
  13359. QPrintDialog printDialog(printer,NULL);
  13360. if(printDialog.exec()==QDialog::Accepted)
  13361. {
  13362. self->print(printer);
  13363. }
  13364. return QScriptValue();
  13365. }
  13366. /*:472*//*473:*/
  13367. #line 11578 "./typica.w"
  13368. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*)
  13369. {
  13370. QWebView*self= getself<QWebView*> (context);
  13371. QString content= argument<QString> (0,context);
  13372. self->setHtml(content);
  13373. return QScriptValue();
  13374. }
  13375. /*:473*//*474:*/
  13376. #line 11591 "./typica.w"
  13377. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*)
  13378. {
  13379. QWebView*self= getself<QWebView*> (context);
  13380. QIODevice*device= argument<QIODevice*> (0,context);
  13381. device->reset();
  13382. QByteArray content= device->readAll();
  13383. self->setContent(content,"application/xhtml+xml");
  13384. return QScriptValue();
  13385. }
  13386. /*:474*//*475:*/
  13387. #line 11605 "./typica.w"
  13388. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*)
  13389. {
  13390. QWebView*self= getself<QWebView*> (context);
  13391. return QScriptValue(self->page()->currentFrame()->documentElement().toOuterXml());
  13392. }
  13393. /*:475*//*476:*/
  13394. #line 11615 "./typica.w"
  13395. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  13396. QStack<QLayout*> *layoutStack)
  13397. {
  13398. QWebView*view= new QWebView;
  13399. if(element.hasAttribute("id"))
  13400. {
  13401. view->setObjectName(element.attribute("id"));
  13402. }
  13403. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13404. layout->addWidget(view);
  13405. }
  13406. /*:476*//*534:*/
  13407. #line 12665 "./typica.w"
  13408. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  13409. {
  13410. QScriptValue object= engine->newQObject(new SqlQueryView);
  13411. setSqlQueryViewProperties(object,engine);
  13412. return object;
  13413. }
  13414. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  13415. {
  13416. setQTableViewProperties(value,engine);
  13417. value.setProperty("setHeaderData",
  13418. engine->newFunction(SqlQueryView_setHeaderData));
  13419. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  13420. }
  13421. /*:534*//*535:*/
  13422. #line 12683 "./typica.w"
  13423. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  13424. {
  13425. SqlQueryView*self= getself<SqlQueryView*> (context);
  13426. QString query= argument<QString> (0,context);
  13427. self->setQuery(query);
  13428. self->reset();
  13429. return QScriptValue();
  13430. }
  13431. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  13432. QScriptEngine*)
  13433. {
  13434. SqlQueryView*self= getself<SqlQueryView*> (context);
  13435. int section= argument<int> (0,context);
  13436. QString data= argument<QString> (1,context);
  13437. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  13438. return QScriptValue();
  13439. }
  13440. /*:535*//*543:*/
  13441. #line 12882 "./typica.w"
  13442. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  13443. QStack<QLayout*> *layoutStack)
  13444. {
  13445. QTextEdit*widget= new QTextEdit;
  13446. if(element.hasAttribute("id"))
  13447. {
  13448. widget->setObjectName(element.attribute("id"));
  13449. }
  13450. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13451. layout->addWidget(widget);
  13452. QTextDocument*document= new QTextDocument;
  13453. QFont defaultFont;
  13454. defaultFont.setPointSize(11);
  13455. document->setDefaultFont(defaultFont);
  13456. QTextCursor cursor(document);
  13457. /*544:*/
  13458. #line 12905 "./typica.w"
  13459. QDomNodeList children= element.childNodes();
  13460. for(int i= 0;i<children.count();i++)
  13461. {
  13462. QDomNode current;
  13463. QDomElement currentElement;
  13464. current= children.at(i);
  13465. if(current.isElement())
  13466. {
  13467. currentElement= current.toElement();
  13468. /*545:*/
  13469. #line 12922 "./typica.w"
  13470. if(currentElement.tagName()=="style")
  13471. {
  13472. document->setDefaultStyleSheet(currentElement.text());
  13473. }
  13474. /*:545*//*546:*/
  13475. #line 12933 "./typica.w"
  13476. if(currentElement.tagName()=="html")
  13477. {
  13478. cursor.insertHtml(currentElement.text());
  13479. }
  13480. /*:546*//*547:*/
  13481. #line 12943 "./typica.w"
  13482. if(currentElement.tagName()=="text")
  13483. {
  13484. cursor.insertText(currentElement.text());
  13485. }
  13486. /*:547*//*548:*/
  13487. #line 12953 "./typica.w"
  13488. if(currentElement.tagName()=="table")
  13489. {
  13490. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  13491. ReportTable*table= new ReportTable(frame,currentElement);
  13492. table->setParent(widget);
  13493. if(currentElement.hasAttribute("id"))
  13494. {
  13495. table->setObjectName(currentElement.attribute("id"));
  13496. }
  13497. }
  13498. /*:548*/
  13499. #line 12915 "./typica.w"
  13500. }
  13501. }
  13502. /*:544*/
  13503. #line 12898 "./typica.w"
  13504. widget->setDocument(document);
  13505. }
  13506. /*:543*//*559:*/
  13507. #line 13165 "./typica.w"
  13508. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  13509. {
  13510. QTextEdit*self= getself<QTextEdit*> (context);
  13511. QTextDocument*document= self->document();
  13512. QPrinter printer;
  13513. QPrintDialog printwindow(&printer,self);
  13514. if(printwindow.exec()!=QDialog::Accepted)
  13515. {
  13516. return QScriptValue();
  13517. }
  13518. document->print(&printer);
  13519. return QScriptValue();
  13520. }
  13521. /*:559*//*560:*/
  13522. #line 13183 "./typica.w"
  13523. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  13524. {
  13525. setQAbstractScrollAreaProperties(value,engine);
  13526. value.setProperty("print",engine->newFunction(QTextEdit_print));
  13527. }
  13528. /*:560*//*569:*/
  13529. #line 13361 "./typica.w"
  13530. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  13531. QStack<QLayout*> *layoutStack)
  13532. {
  13533. FormArray*widget= new FormArray(element);
  13534. if(element.hasAttribute("id"))
  13535. {
  13536. widget->setObjectName(element.attribute("id"));
  13537. }
  13538. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13539. layout->addWidget(widget);
  13540. }
  13541. /*:569*//*590:*/
  13542. #line 13948 "./typica.w"
  13543. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  13544. QStack<QLayout*> *layoutStack)
  13545. {
  13546. ScaleControl*scale= new ScaleControl;
  13547. if(element.hasAttribute("id"))
  13548. {
  13549. scale->setObjectName(element.attribute("id"));
  13550. }
  13551. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13552. layout->addWidget(scale);
  13553. }
  13554. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  13555. QStack<QLayout*> *layoutStack)
  13556. {
  13557. IntensityControl*scale= new IntensityControl;
  13558. if(element.hasAttribute("id"))
  13559. {
  13560. scale->setObjectName(element.attribute("id"));
  13561. }
  13562. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13563. layout->addWidget(scale);
  13564. }
  13565. /*:590*//*616:*/
  13566. #line 14538 "./typica.w"
  13567. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  13568. {
  13569. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  13570. setDeviceTreeModelProperties(object,engine);
  13571. return object;
  13572. }
  13573. /*:616*//*618:*/
  13574. #line 14561 "./typica.w"
  13575. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  13576. {
  13577. setQAbstractItemModelProperties(value,engine);
  13578. value.setProperty("referenceElement",
  13579. engine->newFunction(DeviceTreeModel_referenceElement));
  13580. }
  13581. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  13582. {
  13583. setQObjectProperties(value,engine);
  13584. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  13585. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  13586. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  13587. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  13588. }
  13589. /*:618*//*619:*/
  13590. #line 14588 "./typica.w"
  13591. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  13592. QScriptEngine*engine)
  13593. {
  13594. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  13595. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  13596. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13597. QDomElement node;
  13598. QVariantMap retval;
  13599. retval.insert("driver",referenceElement.attribute("driver"));
  13600. for(int i= 0;i<configData.size();i++)
  13601. {
  13602. node= configData.at(i).toElement();
  13603. retval.insert(node.attribute("name"),node.attribute("value"));
  13604. }
  13605. return engine->toScriptValue(retval);
  13606. }
  13607. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  13608. {
  13609. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13610. QModelIndex index= argument<QModelIndex> (0,context);
  13611. int role= argument<int> (1,context);
  13612. return engine->toScriptValue(model->data(index,role));
  13613. }
  13614. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  13615. {
  13616. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13617. int row= 0;
  13618. int column= 0;
  13619. QModelIndex index;
  13620. if(context->argumentCount()> 1)
  13621. {
  13622. row= argument<int> (0,context);
  13623. column= argument<int> (1,context);
  13624. }
  13625. if(context->argumentCount()> 2)
  13626. {
  13627. index= argument<QModelIndex> (2,context);
  13628. }
  13629. QModelIndex retval= model->index(row,column,index);
  13630. return engine->toScriptValue(retval);
  13631. }
  13632. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  13633. QScriptEngine*)
  13634. {
  13635. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13636. QModelIndex index;
  13637. if(context->argumentCount()==1)
  13638. {
  13639. index= argument<QModelIndex> (0,context);
  13640. }
  13641. return QScriptValue(model->rowCount(index));
  13642. }
  13643. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  13644. QScriptEngine*engine)
  13645. {
  13646. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13647. QModelIndex index;
  13648. if(context->argumentCount()==1)
  13649. {
  13650. index= argument<QModelIndex> (0,context);
  13651. }
  13652. return QScriptValue(engine,model->hasChildren(index));
  13653. }
  13654. /*:619*//*622:*/
  13655. #line 14672 "./typica.w"
  13656. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  13657. {
  13658. QVariant var;
  13659. var.setValue(index);
  13660. QScriptValue object= engine->newVariant(var);
  13661. return object;
  13662. }
  13663. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  13664. {
  13665. index= value.toVariant().value<QModelIndex> ();
  13666. }
  13667. /*:622*//*637:*/
  13668. #line 14940 "./typica.w"
  13669. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  13670. QScriptEngine*engine)
  13671. {
  13672. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  13673. return object;
  13674. }
  13675. /*:637*//*713:*/
  13676. #line 17445 "./typica.w"
  13677. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  13678. {
  13679. QScriptValue object;
  13680. if(context->argumentCount()==2)
  13681. {
  13682. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  13683. argument<QModelIndex> (1,context)),
  13684. QScriptEngine::ScriptOwnership);
  13685. setModbusRTUDeviceProperties(object,engine);
  13686. }
  13687. else
  13688. {
  13689. context->throwError("Incorrect number of arguments passed to "
  13690. "ModbusRTUDevice constructor. This takes the configuration model "
  13691. "and an index.");
  13692. }
  13693. return object;
  13694. }
  13695. /*:713*//*714:*/
  13696. #line 17467 "./typica.w"
  13697. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  13698. {
  13699. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13700. QScriptValue object;
  13701. if(self)
  13702. {
  13703. if(self->channels.size()> 0)
  13704. {
  13705. object= engine->newQObject(self->channels.at(0));
  13706. setChannelProperties(object,engine);
  13707. }
  13708. }
  13709. return object;
  13710. }
  13711. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  13712. {
  13713. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13714. QScriptValue object;
  13715. if(self)
  13716. {
  13717. if(self->channels.size()> 1)
  13718. {
  13719. object= engine->newQObject(self->channels.at(1));
  13720. setChannelProperties(object,engine);
  13721. }
  13722. }
  13723. return object;
  13724. }
  13725. /*:714*//*715:*/
  13726. #line 17500 "./typica.w"
  13727. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  13728. {
  13729. setQObjectProperties(value,engine);
  13730. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  13731. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  13732. }
  13733. /*:715*/
  13734. #line 764 "./typica.w"
  13735. /*514:*/
  13736. #line 12327 "./typica.w"
  13737. int main(int argc,char**argv)
  13738. {
  13739. int*c= &argc;
  13740. Application app(*c,argv);
  13741. /*515:*/
  13742. #line 12351 "./typica.w"
  13743. QStringList themeSearchPath= QIcon::themeSearchPaths();
  13744. themeSearchPath.append(":/resources/icons/tango");
  13745. QIcon::setThemeSearchPaths(themeSearchPath);
  13746. QIcon::setThemeName(":/resources/icons/tango");
  13747. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  13748. /*:515*/
  13749. #line 12332 "./typica.w"
  13750. QSettings settings;
  13751. /*647:*/
  13752. #line 15152 "./typica.w"
  13753. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  13754. /*:647*//*657:*/
  13755. #line 15380 "./typica.w"
  13756. app.registerDeviceConfigurationWidget("nidaqmxbase",
  13757. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  13758. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  13759. NiDaqMxBase9211ConfWidget::staticMetaObject);
  13760. app.registerDeviceConfigurationWidget("ni9211seriestc",
  13761. Ni9211TcConfWidget::staticMetaObject);
  13762. /*:657*//*665:*/
  13763. #line 15597 "./typica.w"
  13764. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  13765. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  13766. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  13767. /*:665*//*689:*/
  13768. #line 16558 "./typica.w"
  13769. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  13770. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  13771. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  13772. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  13773. /*:689*//*694:*/
  13774. #line 16643 "./typica.w"
  13775. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  13776. /*:694*//*697:*/
  13777. #line 16713 "./typica.w"
  13778. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  13779. /*:697*//*700:*/
  13780. #line 16840 "./typica.w"
  13781. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  13782. /*:700*//*718:*/
  13783. #line 18013 "./typica.w"
  13784. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  13785. /*:718*//*725:*/
  13786. #line 18143 "./typica.w"
  13787. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  13788. /*:725*//*729:*/
  13789. #line 18232 "./typica.w"
  13790. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  13791. /*:729*/
  13792. #line 12335 "./typica.w"
  13793. /*516:*/
  13794. #line 12364 "./typica.w"
  13795. if(settings.value("database/exists","false").toString()=="true")
  13796. {
  13797. /*521:*/
  13798. #line 12484 "./typica.w"
  13799. QSqlDatabase database=
  13800. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  13801. database.setHostName(settings.value("database/hostname").toString());
  13802. database.setDatabaseName(settings.value("database/dbname").toString());
  13803. database.setUserName(settings.value("database/user").toString());
  13804. database.setPassword(settings.value("database/password").toString());
  13805. if(!database.open())
  13806. {
  13807. settings.setValue("database/exists","false");
  13808. }
  13809. /*:521*/
  13810. #line 12367 "./typica.w"
  13811. }
  13812. if(settings.value("database/exists","false").toString()=="false")
  13813. {
  13814. /*520:*/
  13815. #line 12475 "./typica.w"
  13816. SqlConnectionSetup dialog;
  13817. dialog.exec();
  13818. /*:520*/
  13819. #line 12371 "./typica.w"
  13820. }
  13821. /*:516*/
  13822. #line 12336 "./typica.w"
  13823. /*153:*/
  13824. #line 3632 "./typica.w"
  13825. QStringList arguments= QCoreApplication::arguments();
  13826. int position= arguments.indexOf("-c");
  13827. QString filename= QString();
  13828. if(position!=-1)
  13829. {
  13830. if(arguments.size()>=position+1)
  13831. {
  13832. filename= arguments.at(position+1);
  13833. }
  13834. }
  13835. if(filename.isEmpty())
  13836. {
  13837. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  13838. settings.value("config","").toString());
  13839. }
  13840. QDir directory;
  13841. if(!filename.isEmpty())
  13842. {
  13843. QFile file(filename);
  13844. QFileInfo info(filename);
  13845. directory= info.dir();
  13846. settings.setValue("config",directory.path());
  13847. if(file.open(QIODevice::ReadOnly))
  13848. {
  13849. app.configuration()->setContent(&file,true);
  13850. }
  13851. }
  13852. /*154:*/
  13853. #line 3666 "./typica.w"
  13854. QDomElement root= app.configuration()->documentElement();
  13855. QDomNodeList children= root.childNodes();
  13856. QString replacementDoc;
  13857. QDomDocument includedDoc;
  13858. QDomDocumentFragment fragment;
  13859. for(int i= 0;i<children.size();i++)
  13860. {
  13861. QDomNode currentNode= children.at(i);
  13862. QDomElement currentElement;
  13863. if(currentNode.nodeName()=="include")
  13864. {
  13865. currentElement= currentNode.toElement();
  13866. if(currentElement.hasAttribute("src"))
  13867. {
  13868. replacementDoc= directory.path();
  13869. replacementDoc.append('/');
  13870. replacementDoc.append(currentElement.attribute("src"));
  13871. QFile doc(replacementDoc);
  13872. if(doc.open(QIODevice::ReadOnly))
  13873. {
  13874. includedDoc.setContent(&doc,true);
  13875. fragment= includedDoc.createDocumentFragment();
  13876. fragment.appendChild(includedDoc.documentElement());
  13877. root.replaceChild(fragment,currentNode);
  13878. doc.close();
  13879. }
  13880. }
  13881. }
  13882. }
  13883. /*:154*/
  13884. #line 3660 "./typica.w"
  13885. /*:153*/
  13886. #line 12337 "./typica.w"
  13887. /*19:*/
  13888. #line 876 "./typica.w"
  13889. QScriptEngine*engine= new QScriptEngine;
  13890. QScriptValue constructor;
  13891. QScriptValue value;
  13892. /*:19*//*29:*/
  13893. #line 1052 "./typica.w"
  13894. constructor= engine->newFunction(constructQWidget);
  13895. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  13896. engine->globalObject().setProperty("QWidget",value);
  13897. /*:29*//*37:*/
  13898. #line 1252 "./typica.w"
  13899. constructor= engine->newFunction(constructQMainWindow);
  13900. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  13901. constructor);
  13902. engine->globalObject().setProperty("QMainWindow",value);
  13903. /*:37*//*48:*/
  13904. #line 1457 "./typica.w"
  13905. constructor= engine->newFunction(constructQFrame);
  13906. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  13907. engine->globalObject().setProperty("QFrame",value);
  13908. /*:48*//*51:*/
  13909. #line 1490 "./typica.w"
  13910. constructor= engine->newFunction(constructQLabel);
  13911. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  13912. engine->globalObject().setProperty("QLabel",value);
  13913. /*:51*//*54:*/
  13914. #line 1537 "./typica.w"
  13915. constructor= engine->newFunction(constructQSplitter);
  13916. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  13917. engine->globalObject().setProperty("QSplitter",value);
  13918. /*:54*//*61:*/
  13919. #line 1708 "./typica.w"
  13920. constructor= engine->newFunction(constructQBoxLayout);
  13921. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  13922. engine->globalObject().setProperty("QBoxLayout",value);
  13923. /*:61*//*65:*/
  13924. #line 1820 "./typica.w"
  13925. constructor= engine->newFunction(constructQAction);
  13926. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  13927. engine->globalObject().setProperty("QAction",value);
  13928. /*:65*//*68:*/
  13929. #line 1879 "./typica.w"
  13930. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  13931. value.setProperty("getOpenFileName",
  13932. engine->newFunction(QFileDialog_getOpenFileName));
  13933. value.setProperty("getSaveFileName",
  13934. engine->newFunction(QFileDialog_getSaveFileName));
  13935. engine->globalObject().setProperty("QFileDialog",value);
  13936. /*:68*//*73:*/
  13937. #line 1991 "./typica.w"
  13938. constructor= engine->newFunction(constructQFile);
  13939. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  13940. engine->globalObject().setProperty("QFile",value);
  13941. /*:73*//*80:*/
  13942. #line 2108 "./typica.w"
  13943. constructor= engine->newFunction(constructQBuffer);
  13944. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  13945. engine->globalObject().setProperty("QBuffer",value);
  13946. /*:80*//*83:*/
  13947. #line 2156 "./typica.w"
  13948. constructor= engine->newFunction(constructXQuery);
  13949. engine->globalObject().setProperty("XQuery",constructor);
  13950. /*:83*//*89:*/
  13951. #line 2250 "./typica.w"
  13952. constructor= engine->newFunction(constructXmlWriter);
  13953. engine->globalObject().setProperty("XmlWriter",constructor);
  13954. /*:89*//*98:*/
  13955. #line 2456 "./typica.w"
  13956. constructor= engine->newFunction(constructXmlReader);
  13957. engine->globalObject().setProperty("XmlReader",constructor);
  13958. /*:98*//*105:*/
  13959. #line 2580 "./typica.w"
  13960. value= engine->newQObject(&settings);
  13961. setQSettingsProperties(value,engine);
  13962. engine->globalObject().setProperty("QSettings",value);
  13963. /*:105*//*109:*/
  13964. #line 2661 "./typica.w"
  13965. constructor= engine->newFunction(constructQLCDNumber);
  13966. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  13967. engine->globalObject().setProperty("QLCDNumber",value);
  13968. /*:109*//*112:*/
  13969. #line 2717 "./typica.w"
  13970. constructor= engine->newFunction(constructQTime);
  13971. engine->globalObject().setProperty("QTime",constructor);
  13972. /*:112*//*133:*/
  13973. #line 3221 "./typica.w"
  13974. constructor= engine->newFunction(constructQPushButton);
  13975. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  13976. engine->globalObject().setProperty("QPushButton",value);
  13977. /*:133*//*140:*/
  13978. #line 3332 "./typica.w"
  13979. constructor= engine->newFunction(constructQSqlQuery);
  13980. engine->globalObject().setProperty("QSqlQuery",constructor);
  13981. /*:140*//*147:*/
  13982. #line 3493 "./typica.w"
  13983. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  13984. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  13985. engine->globalObject().setProperty("sqlToArray",
  13986. engine->newFunction(sqlToArray));
  13987. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  13988. engine->globalObject().setProperty("annotationFromRecord",
  13989. engine->newFunction(annotationFromRecord));
  13990. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  13991. /*:147*//*158:*/
  13992. #line 3829 "./typica.w"
  13993. engine->globalObject().setProperty("createWindow",
  13994. engine->newFunction(createWindow));
  13995. /*:158*//*205:*/
  13996. #line 5305 "./typica.w"
  13997. engine->globalObject().setProperty("findChildObject",
  13998. engine->newFunction(findChildObject));
  13999. /*:205*//*244:*/
  14000. #line 6480 "./typica.w"
  14001. constructor= engine->newFunction(constructDAQ);
  14002. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  14003. engine->globalObject().setProperty("DAQ",value);
  14004. /*:244*//*253:*/
  14005. #line 6678 "./typica.w"
  14006. constructor= engine->newFunction(constructFakeDAQ);
  14007. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  14008. engine->globalObject().setProperty("FakeDAQ",value);
  14009. /*:253*//*264:*/
  14010. #line 6955 "./typica.w"
  14011. constructor= engine->newFunction(constructLinearCalibrator);
  14012. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  14013. constructor);
  14014. engine->globalObject().setProperty("LinearCalibrator",value);
  14015. /*:264*//*269:*/
  14016. #line 7093 "./typica.w"
  14017. constructor= engine->newFunction(constructLinearSplineInterpolator);
  14018. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  14019. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  14020. /*:269*//*278:*/
  14021. #line 7276 "./typica.w"
  14022. constructor= engine->newFunction(constructTemperatureDisplay);
  14023. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  14024. constructor);
  14025. engine->globalObject().setProperty("TemperatureDisplay",value);
  14026. /*:278*//*285:*/
  14027. #line 7414 "./typica.w"
  14028. constructor= engine->newFunction(constructMeasurementTimeOffset);
  14029. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  14030. constructor);
  14031. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  14032. /*:285*//*290:*/
  14033. #line 7525 "./typica.w"
  14034. constructor= engine->newFunction(constructThresholdDetector);
  14035. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  14036. engine->globalObject().setProperty("ThresholdDetector",value);
  14037. /*:290*//*295:*/
  14038. #line 7623 "./typica.w"
  14039. constructor= engine->newFunction(constructZeroEmitter);
  14040. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  14041. engine->globalObject().setProperty("ZeroEmitter",value);
  14042. /*:295*//*300:*/
  14043. #line 7702 "./typica.w"
  14044. constructor= engine->newFunction(constructMeasurementAdapter);
  14045. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  14046. constructor);
  14047. engine->globalObject().setProperty("MeasurementAdapter",value);
  14048. /*:300*//*315:*/
  14049. #line 8051 "./typica.w"
  14050. constructor= engine->newFunction(constructGraphView);
  14051. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  14052. engine->globalObject().setProperty("GraphView",value);
  14053. /*:315*//*337:*/
  14054. #line 8622 "./typica.w"
  14055. constructor= engine->newFunction(constructZoomLog);
  14056. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  14057. engine->globalObject().setProperty("ZoomLog",value);
  14058. /*:337*//*374:*/
  14059. #line 9540 "./typica.w"
  14060. constructor= engine->newFunction(constructAnnotationButton);
  14061. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  14062. constructor);
  14063. engine->globalObject().setProperty("AnnotationButton",value);
  14064. /*:374*//*382:*/
  14065. #line 9682 "./typica.w"
  14066. constructor= engine->newFunction(constructAnnotationSpinBox);
  14067. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  14068. constructor);
  14069. engine->globalObject().setProperty("AnnotationSpinBox",value);
  14070. /*:382*//*403:*/
  14071. #line 10103 "./typica.w"
  14072. constructor= engine->newFunction(constructTimerDisplay);
  14073. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  14074. engine->globalObject().setProperty("TimerDisplay",value);
  14075. /*:403*//*430:*/
  14076. #line 10597 "./typica.w"
  14077. constructor= engine->newFunction(constructWidgetDecorator);
  14078. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  14079. engine->globalObject().setProperty("WidgetDecorator",value);
  14080. /*:430*//*443:*/
  14081. #line 10879 "./typica.w"
  14082. constructor= engine->newFunction(constructLogEditWindow);
  14083. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  14084. engine->globalObject().setProperty("LogEditWindow",value);
  14085. /*:443*//*462:*/
  14086. #line 11353 "./typica.w"
  14087. constructor= engine->newFunction(constructXMLInput);
  14088. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  14089. engine->globalObject().setProperty("XMLInput",value);
  14090. /*:462*//*469:*/
  14091. #line 11520 "./typica.w"
  14092. constructor= engine->newFunction(constructWebView);
  14093. value= engine->newQMetaObject(&QWebView::staticMetaObject,constructor);
  14094. engine->globalObject().setProperty("WebView",value);
  14095. /*:469*//*482:*/
  14096. #line 11712 "./typica.w"
  14097. value= engine->newQObject(AppInstance);
  14098. engine->globalObject().setProperty("Application",value);
  14099. /*:482*//*533:*/
  14100. #line 12657 "./typica.w"
  14101. constructor= engine->newFunction(constructSqlQueryView);
  14102. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  14103. engine->globalObject().setProperty("SqlQueryView",value);
  14104. /*:533*//*617:*/
  14105. #line 14548 "./typica.w"
  14106. constructor= engine->newFunction(constructDeviceTreeModel);
  14107. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  14108. constructor);
  14109. engine->globalObject().setProperty("DeviceTreeModel",value);
  14110. /*:617*//*623:*/
  14111. #line 14688 "./typica.w"
  14112. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  14113. /*:623*//*638:*/
  14114. #line 14950 "./typica.w"
  14115. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  14116. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  14117. constructor);
  14118. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  14119. /*:638*//*712:*/
  14120. #line 17436 "./typica.w"
  14121. constructor= engine->newFunction(constructModbusRTUDevice);
  14122. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  14123. engine->globalObject().setProperty("ModbusRTUDevice",value);
  14124. /*:712*/
  14125. #line 12338 "./typica.w"
  14126. app.engine= engine;
  14127. /*155:*/
  14128. #line 3714 "./typica.w"
  14129. QString styleText;
  14130. QString programText;
  14131. QDomElement currentElement;
  14132. for(int i= 0;i<children.size();i++)
  14133. {
  14134. QDomNode currentNode= children.at(i);
  14135. if(currentNode.nodeName()=="style")
  14136. {
  14137. currentElement= currentNode.toElement();
  14138. styleText.append(currentElement.text());
  14139. }
  14140. else if(currentNode.nodeName()=="program")
  14141. {
  14142. currentElement= currentNode.toElement();
  14143. programText.append(currentElement.text());
  14144. }
  14145. }
  14146. app.setStyleSheet(styleText);
  14147. QScriptValue result= engine->evaluate(programText);
  14148. /*156:*/
  14149. #line 3739 "./typica.w"
  14150. if(engine->hasUncaughtException())
  14151. {
  14152. int line= engine->uncaughtExceptionLineNumber();
  14153. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14154. result.toString();
  14155. QString trace;
  14156. foreach(trace,engine->uncaughtExceptionBacktrace())
  14157. {
  14158. qDebug()<<trace;
  14159. }
  14160. }
  14161. /*:156*/
  14162. #line 3734 "./typica.w"
  14163. /*:155*/
  14164. #line 12340 "./typica.w"
  14165. int retval= app.exec();
  14166. delete engine;
  14167. return retval;
  14168. }
  14169. /*:514*/
  14170. #line 765 "./typica.w"
  14171. #include "moc_typica.cpp"
  14172. /*:16*/