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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489
  1. /*16:*/
  2. #line 757 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*18:*/
  5. #line 841 "./typica.w"
  6. #include <QtCore>
  7. #include <QtGui>
  8. #include <QtScript>
  9. #include <QtScriptTools>
  10. #include <QtXml>
  11. #include <QtSql>
  12. #include <QtDebug>
  13. #include <QtXmlPatterns>
  14. #include <QtWebKit>
  15. /*:18*//*19:*/
  16. #line 856 "./typica.w"
  17. #include "helpmenu.h"
  18. /*:19*//*684:*/
  19. #line 15744 "./typica.w"
  20. #include "qextserialport.h"
  21. #include "qextserialenumerator.h"
  22. /*:684*/
  23. #line 760 "./typica.w"
  24. /*33:*/
  25. #line 1147 "./typica.w"
  26. class ScriptQMainWindow:public QMainWindow
  27. {
  28. Q_OBJECT
  29. public:
  30. ScriptQMainWindow();
  31. public slots:
  32. void show();
  33. void saveSizeAndPosition(const QString&key);
  34. void restoreSizeAndPosition(const QString&key);
  35. void displayStatus(const QString&message= QString());
  36. protected:
  37. void closeEvent(QCloseEvent*event);
  38. void showEvent(QShowEvent*event);
  39. signals:
  40. void aboutToClose(void);
  41. };
  42. /*:33*//*140:*/
  43. #line 3302 "./typica.w"
  44. class SqlQueryConnection:public QSqlQuery
  45. {
  46. public:
  47. SqlQueryConnection(const QString&query= QString());
  48. ~SqlQueryConnection();
  49. QSqlQuery*operator->();
  50. private:
  51. QString connection;
  52. QSqlQuery*q;
  53. };
  54. /*:140*//*201:*/
  55. #line 5072 "./typica.w"
  56. class NumericDelegate:public QItemDelegate
  57. {
  58. Q_OBJECT
  59. public:
  60. NumericDelegate(QObject*parent= NULL);
  61. QWidget*createEditor(QWidget*parent,
  62. const QStyleOptionViewItem&option,
  63. const QModelIndex&index)const;
  64. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  65. void setModelData(QWidget*editor,QAbstractItemModel*model,
  66. const QModelIndex&index)const;
  67. void updateEditorGeometry(QWidget*editor,
  68. const QStyleOptionViewItem&option,
  69. const QModelIndex&index)const;
  70. };
  71. /*:201*//*231:*/
  72. #line 5716 "./typica.w"
  73. class Measurement
  74. {
  75. public:
  76. enum TemperatureUnits
  77. {
  78. Fahrenheit= 10144,
  79. Celsius= 10143,
  80. Kelvin= 10325,
  81. Rankine= 10145
  82. };
  83. private:
  84. double theTemperature;
  85. QTime theTime;
  86. TemperatureUnits unit;
  87. public:
  88. Measurement(double temperature= 0,QTime time= QTime(),
  89. TemperatureUnits sc= Fahrenheit);
  90. Measurement(double temperature);
  91. Measurement(const Measurement&x);
  92. Measurement&operator= (Measurement&x);
  93. ~Measurement();
  94. double temperature()const;
  95. QTime time()const;
  96. void setTemperature(double temperature);
  97. void setTime(QTime time);
  98. void setUnit(TemperatureUnits scale);
  99. TemperatureUnits scale();
  100. Measurement toFahrenheit();
  101. Measurement toCelsius();
  102. Measurement toKelvin();
  103. Measurement toRankine();
  104. };
  105. /*:231*//*243:*/
  106. #line 6018 "./typica.w"
  107. class Channel;
  108. class DAQImplementation;
  109. class DAQ:public QObject
  110. {
  111. Q_OBJECT
  112. Q_ENUMS(TemperatureUnits)
  113. Q_ENUMS(ThermocoupleType)
  114. DAQImplementation*imp;
  115. private slots:
  116. void threadFinished();
  117. public:
  118. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  119. ~DAQ();
  120. Channel*newChannel(int units,int thermocouple);
  121. Q_INVOKABLE void setClockRate(double Hz);
  122. Q_INVOKABLE void start();
  123. Q_INVOKABLE void stop();
  124. enum TemperatureUnits
  125. {
  126. Fahrenheit= 10144,
  127. Celsius= 10143,
  128. Kelvin= 10325,
  129. Rankine= 10145
  130. };
  131. enum ThermocoupleType
  132. {
  133. TypeJ= 10072,
  134. TypeK= 10073,
  135. TypeN= 10077,
  136. TypeR= 10082,
  137. TypeS= 10085,
  138. TypeT= 10086,
  139. TypeB= 10047,
  140. TypeE= 10055
  141. };
  142. };
  143. /*:243*//*244:*/
  144. #line 6064 "./typica.w"
  145. class DAQImplementation:public QThread
  146. {
  147. Q_OBJECT
  148. public:
  149. DAQImplementation(const QString&driverinfo);
  150. ~DAQImplementation();
  151. void run();
  152. void measure();
  153. /*245:*/
  154. #line 6084 "./typica.w"
  155. typedef int(*daqfp)(...);
  156. daqfp read;
  157. daqfp errorInfo;
  158. daqfp startTask;
  159. daqfp createTask;
  160. daqfp createChannel;
  161. daqfp setClock;
  162. daqfp stopTask;
  163. daqfp clearTask;
  164. daqfp resetDevice;
  165. daqfp waitForMeasurement;
  166. /*:245*/
  167. #line 6073 "./typica.w"
  168. /*246:*/
  169. #line 6100 "./typica.w"
  170. bool useBase;
  171. QString device;
  172. QVector<Channel*> channelMap;
  173. unsigned int handle;
  174. int error;
  175. int channels;
  176. bool ready;
  177. QLibrary driver;
  178. QVector<Measurement::TemperatureUnits> unitMap;
  179. /*:246*/
  180. #line 6074 "./typica.w"
  181. };
  182. /*:244*//*262:*/
  183. #line 6597 "./typica.w"
  184. class FakeDAQImplementation:public QThread
  185. {
  186. Q_OBJECT
  187. public:
  188. FakeDAQImplementation();
  189. ~FakeDAQImplementation();
  190. void run();
  191. void measure();
  192. QVector<Channel*> channelMap;
  193. int channels;
  194. bool ready;
  195. double clockRate;
  196. };
  197. class FakeDAQ:public QObject
  198. {
  199. Q_OBJECT
  200. FakeDAQImplementation*imp;
  201. public:
  202. FakeDAQ(QString device);
  203. ~FakeDAQ();
  204. Channel*newChannel(int units,int thermocouple);
  205. Q_INVOKABLE void setClockRate(double Hz);
  206. Q_INVOKABLE void start();
  207. };
  208. /*:262*//*269:*/
  209. #line 6784 "./typica.w"
  210. class Channel:public QObject
  211. {
  212. Q_OBJECT
  213. public:
  214. Channel();
  215. ~Channel();
  216. public slots:
  217. void input(Measurement measurement);
  218. signals:
  219. void newData(Measurement);
  220. };
  221. /*:269*//*273:*/
  222. #line 6847 "./typica.w"
  223. class LinearCalibrator:public QObject
  224. {
  225. Q_OBJECT
  226. Q_PROPERTY(double measuredLower READ measuredLower
  227. WRITE setMeasuredLower)
  228. Q_PROPERTY(double measuredUpper READ measuredUpper
  229. WRITE setMeasuredUpper)
  230. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  231. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  232. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  233. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  234. public:
  235. LinearCalibrator(QObject*parent= NULL);
  236. double measuredLower();
  237. double measuredUpper();
  238. double mappedLower();
  239. double mappedUpper();
  240. bool isClosedRange();
  241. double sensitivity();
  242. public slots:
  243. void setMeasuredLower(double lower);
  244. void setMeasuredUpper(double upper);
  245. void setMappedLower(double lower);
  246. void setMappedUpper(double upper);
  247. void setClosedRange(bool closed);
  248. void setSensitivity(double sensitivity);
  249. void newMeasurement(Measurement measure);
  250. signals:
  251. void measurement(Measurement measure);
  252. private:
  253. double Lo1;
  254. double Lo2;
  255. double Up1;
  256. double Up2;
  257. double sensitivitySetting;
  258. bool clamp;
  259. };
  260. /*:273*//*280:*/
  261. #line 7041 "./typica.w"
  262. class LinearSplineInterpolator:public QObject
  263. {
  264. Q_OBJECT
  265. public:
  266. LinearSplineInterpolator(QObject*parent= NULL);
  267. Q_INVOKABLE void add_pair(double source,double destination);
  268. public slots:
  269. void newMeasurement(Measurement measure);
  270. signals:
  271. void newData(Measurement measure);
  272. private:
  273. void make_interpolators();
  274. QMap<double,double> *pairs;
  275. QList<LinearCalibrator*> *interpolators;
  276. };
  277. /*:280*//*285:*/
  278. #line 7176 "./typica.w"
  279. class TemperatureDisplay:public QLCDNumber
  280. {
  281. Q_OBJECT
  282. Q_ENUMS(DisplayUnits)
  283. int unit;
  284. public:
  285. enum DisplayUnits
  286. {
  287. Auto= -1,
  288. Fahrenheit= 10144,
  289. Celsius= 10143,
  290. Kelvin= 10325,
  291. Rankine= 10145
  292. };
  293. TemperatureDisplay(QWidget*parent= NULL);
  294. ~TemperatureDisplay();
  295. public slots:
  296. void setValue(Measurement temperature);
  297. void invalidate();
  298. void setDisplayUnits(DisplayUnits scale);
  299. };
  300. /*:285*//*294:*/
  301. #line 7352 "./typica.w"
  302. class MeasurementTimeOffset:public QObject
  303. {
  304. Q_OBJECT
  305. QTime epoch;
  306. QTime previous;
  307. bool hasPrevious;
  308. public:
  309. MeasurementTimeOffset(QTime zero);
  310. QTime zeroTime();
  311. public slots:
  312. void newMeasurement(Measurement measure);
  313. void setZeroTime(QTime zero);
  314. signals:
  315. void measurement(Measurement measure);
  316. };
  317. /*:294*//*301:*/
  318. #line 7502 "./typica.w"
  319. class ThresholdDetector:public QObject
  320. {
  321. Q_OBJECT
  322. Q_ENUMS(EdgeDirection)
  323. public:
  324. enum EdgeDirection{
  325. Ascending,Descending
  326. };
  327. ThresholdDetector(double value);
  328. public slots:
  329. void newMeasurement(Measurement measure);
  330. void setThreshold(double value);
  331. void setEdgeDirection(EdgeDirection direction);
  332. signals:
  333. void timeForValue(double);
  334. private:
  335. double previousValue;
  336. double threshold;
  337. EdgeDirection currentDirection;
  338. };
  339. /*:301*//*306:*/
  340. #line 7608 "./typica.w"
  341. class ZeroEmitter:public QObject
  342. {
  343. Q_OBJECT
  344. int col;
  345. double temp;
  346. public:
  347. ZeroEmitter(int tempcolumn);
  348. int column();
  349. double lastTemperature();
  350. public slots:
  351. void newMeasurement(Measurement measure);
  352. void setColumn(int column);
  353. void emitZero();
  354. signals:
  355. void measurement(Measurement measure,int tempcolumn);
  356. };
  357. /*:306*//*311:*/
  358. #line 7701 "./typica.w"
  359. class MeasurementAdapter:public QObject
  360. {
  361. Q_OBJECT
  362. int col;
  363. public:
  364. MeasurementAdapter(int tempcolumn);
  365. int column();
  366. public slots:
  367. void newMeasurement(Measurement measure);
  368. void setColumn(int column);
  369. signals:
  370. void measurement(Measurement measure,int tempcolumn);
  371. };
  372. /*:311*//*316:*/
  373. #line 7790 "./typica.w"
  374. class GraphView:public QGraphicsView
  375. {
  376. Q_OBJECT
  377. QGraphicsScene*theScene;
  378. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  379. QMap<int,QPointF> *prevPoints;
  380. QMap<int,double> *translations;
  381. QList<QGraphicsItem*> *gridLinesF;
  382. QList<QGraphicsItem*> *gridLinesC;
  383. public:
  384. GraphView(QWidget*parent= NULL);
  385. void removeSeries(int column);
  386. protected:
  387. void resizeEvent(QResizeEvent*event);
  388. public slots:
  389. void newMeasurement(Measurement measure,int tempcolumn);
  390. void setSeriesTranslation(int column,double offset);
  391. void clear();
  392. void showF();
  393. void showC();
  394. };
  395. /*:316*//*331:*/
  396. #line 8141 "./typica.w"
  397. class MeasurementModel;
  398. class ZoomLog:public QTableView
  399. {
  400. Q_OBJECT
  401. /*332:*/
  402. #line 8189 "./typica.w"
  403. MeasurementModel*model_ms;
  404. MeasurementModel*model_1s;
  405. MeasurementModel*model_5s;
  406. MeasurementModel*model_10s;
  407. MeasurementModel*model_15s;
  408. MeasurementModel*model_30s;
  409. MeasurementModel*model_1m;
  410. QList<MeasurementModel*> modelSet;
  411. QHash<int,Measurement> lastMeasurement;
  412. MeasurementModel*currentModel;
  413. QList<int> saveTempCols;
  414. QList<int> saveNoteCols;
  415. QList<int> currentColumnSet;
  416. /*:332*/
  417. #line 8146 "./typica.w"
  418. void switchLOD(MeasurementModel*m);
  419. private slots:
  420. void centerOn(int row);
  421. void persistColumnResize(int column,int oldsize,int newsize);
  422. void restoreColumnWidths();
  423. public:
  424. ZoomLog();
  425. QVariant data(int row,int column)const;
  426. int rowCount();
  427. bool saveXML(QIODevice*device);
  428. bool saveCSV(QIODevice*device);
  429. QString lastTime(int series);
  430. Q_INVOKABLE int displayUnits();
  431. public slots:
  432. void setVisible(bool visibility);
  433. void setHeaderData(int section,QString text);
  434. void LOD_ms();
  435. void LOD_1s();
  436. void LOD_5s();
  437. void LOD_10s();
  438. void LOD_15s();
  439. void LOD_30s();
  440. void LOD_1m();
  441. void newMeasurement(Measurement measure,int tempcolumn);
  442. void newAnnotation(QString annotation,int tempcolumn,
  443. int annotationcolumn);
  444. void clear();
  445. void addOutputTemperatureColumn(int column);
  446. void addOutputAnnotationColumn(int column);
  447. void clearOutputColumns();
  448. void setDisplayUnits(int scale);
  449. void addToCurrentColumnSet(int column);
  450. void clearCurrentColumnSet();
  451. protected:
  452. virtual void showEvent(QShowEvent*event);
  453. };
  454. /*:331*//*356:*/
  455. #line 8838 "./typica.w"
  456. class MeasurementList;
  457. class MeasurementModel:public QAbstractItemModel
  458. {
  459. Q_OBJECT
  460. Q_ENUMS(DisplayUnits);
  461. int unit;
  462. QList<MeasurementList*> *entries;
  463. QStringList*hData;
  464. int colcount;
  465. QHash<int,int> *lastTemperature;
  466. QList<MeasurementList*> ::iterator lastInsertion;
  467. public:
  468. enum DisplayUnits
  469. {
  470. Auto= -1,
  471. Fahrenheit= 10144,
  472. Celsius= 10143,
  473. Kelvin= 10325,
  474. Rankine= 10145
  475. };
  476. MeasurementModel(QObject*parent= NULL);
  477. ~MeasurementModel();
  478. int rowCount(const QModelIndex&parent= QModelIndex())const;
  479. int columnCount(const QModelIndex&parent= QModelIndex())const;
  480. bool setHeaderData(int section,Qt::Orientation orientation,
  481. const QVariant&value,int role= Qt::DisplayRole);
  482. QVariant data(const QModelIndex&index,int role)const;
  483. bool setData(const QModelIndex&index,const QVariant&value,
  484. int role= Qt::EditRole);
  485. Qt::ItemFlags flags(const QModelIndex&index)const;
  486. QVariant headerData(int section,Qt::Orientation orientation,
  487. int role= Qt::DisplayRole)const;
  488. QModelIndex index(int row,int column,
  489. const QModelIndex&parent= QModelIndex())const;
  490. QModelIndex parent(const QModelIndex&index)const;
  491. int displayUnits();
  492. public slots:
  493. void newMeasurement(Measurement measure,int tempcolumn);
  494. void newAnnotation(QString annotation,int tempcolumn,
  495. int annotationColumn);
  496. void clear();
  497. void setDisplayUnits(int scale);
  498. signals:
  499. void rowChanged(int);
  500. };
  501. /*:356*//*357:*/
  502. #line 8890 "./typica.w"
  503. class MeasurementList:public QVariantList
  504. {
  505. public:
  506. bool operator<(const MeasurementList&other)const;
  507. bool operator==(const MeasurementList&other)const;
  508. };
  509. /*:357*//*383:*/
  510. #line 9527 "./typica.w"
  511. class AnnotationButton:public QPushButton
  512. {
  513. Q_OBJECT
  514. QString note;
  515. int tc;
  516. int ac;
  517. int count;
  518. public:
  519. AnnotationButton(const QString&text,QWidget*parent= NULL);
  520. public slots:
  521. void setAnnotation(const QString&annotation);
  522. void setTemperatureColumn(int tempcolumn);
  523. void setAnnotationColumn(int annotationcolumn);
  524. void annotate();
  525. void resetCount();
  526. signals:
  527. void annotation(QString annotation,int tempcolumn,
  528. int notecolumn);
  529. };
  530. /*:383*//*391:*/
  531. #line 9652 "./typica.w"
  532. class AnnotationSpinBox:public QDoubleSpinBox
  533. {
  534. Q_OBJECT
  535. QString pretext;
  536. QString posttext;
  537. int tc;
  538. int ac;
  539. bool change;
  540. public:
  541. AnnotationSpinBox(const QString&pret,const QString&postt,
  542. QWidget*parent= NULL);
  543. public slots:
  544. void setPretext(const QString&pret);
  545. void setPosttext(const QString&postt);
  546. void setTemperatureColumn(int tempcolumn);
  547. void setAnnotationColumn(int annotationcolumn);
  548. void annotate();
  549. void resetChange();
  550. signals:
  551. void annotation(QString annotation,int tempcolumn,
  552. int notecolumn);
  553. };
  554. /*:391*//*399:*/
  555. #line 9811 "./typica.w"
  556. class TimerDisplay:public QLCDNumber
  557. {
  558. Q_OBJECT
  559. /*400:*/
  560. #line 9861 "./typica.w"
  561. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  562. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  563. Q_PROPERTY(bool running READ isRunning)
  564. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  565. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  566. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  567. /*:400*/
  568. #line 9815 "./typica.w"
  569. private slots:
  570. void updateTime();
  571. void setCountUpMode();
  572. void setCountDownMode();
  573. void setClockMode();
  574. public:
  575. TimerDisplay(QWidget*parent= NULL);
  576. ~TimerDisplay();
  577. enum TimerMode
  578. {
  579. CountUp,
  580. CountDown,
  581. Clock
  582. };
  583. QString value();
  584. QTime seconds();
  585. TimerMode mode();
  586. bool isRunning();
  587. QTime resetValue();
  588. QString displayFormat();
  589. bool autoReset();
  590. public slots:
  591. void setTimer(QTime value= QTime(0,0,0));
  592. void setMode(TimerMode mode);
  593. void startTimer();
  594. void stopTimer();
  595. void copyTimer();
  596. void setResetValue(QTime value= QTime(0,0,0));
  597. void reset();
  598. void setDisplayFormat(QString format);
  599. void setAutoReset(bool reset);
  600. void updateDisplay();
  601. signals:
  602. void valueChanged(QTime);
  603. void runStateChanged(bool);
  604. private:
  605. /*401:*/
  606. #line 9871 "./typica.w"
  607. QTime s;
  608. QTime r;
  609. QTimer clock;
  610. TimerDisplay::TimerMode m;
  611. bool running;
  612. bool ar;
  613. QAction*startAction;
  614. QAction*stopAction;
  615. QAction*resetAction;
  616. QString f;
  617. QTime relative;
  618. QTime base;
  619. /*:401*/
  620. #line 9852 "./typica.w"
  621. };
  622. /*:399*//*421:*/
  623. #line 10230 "./typica.w"
  624. class PackLayout:public QLayout
  625. {
  626. int doLayout(const QRect&rect,bool testOnly)const;
  627. QList<QLayoutItem*> itemList;
  628. Qt::Orientations orientation;
  629. public:
  630. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  631. PackLayout(int spacing= -1);
  632. ~PackLayout();
  633. void addItem(QLayoutItem*item);
  634. Qt::Orientations expandingDirections()const;
  635. bool hasHeightForWidth()const;
  636. int heightForWidth(int width)const;
  637. int count()const;
  638. QLayoutItem*itemAt(int index)const;
  639. QSize minimumSize()const;
  640. void setGeometry(const QRect&rect);
  641. void setOrientation(Qt::Orientations direction);
  642. QSize sizeHint()const;
  643. QLayoutItem*takeAt(int index);
  644. };
  645. /*:421*//*434:*/
  646. #line 10508 "./typica.w"
  647. class SceneButton:public QGraphicsScene
  648. {
  649. Q_OBJECT
  650. public:
  651. SceneButton();
  652. ~SceneButton();
  653. protected:
  654. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  655. signals:
  656. void clicked(QPoint pos);
  657. };
  658. /*:434*//*436:*/
  659. #line 10550 "./typica.w"
  660. class WidgetDecorator:public QWidget
  661. {
  662. Q_OBJECT
  663. PackLayout*layout;
  664. QGraphicsView*label;
  665. QGraphicsTextItem*text;
  666. SceneButton*scene;
  667. public:
  668. WidgetDecorator(QWidget*widget,const QString&labeltext,
  669. Qt::Orientations orientation= Qt::Horizontal,
  670. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  671. ~WidgetDecorator();
  672. void setBackgroundBrush(QBrush background);
  673. void setTextColor(QColor color);
  674. };
  675. /*:436*//*447:*/
  676. #line 10725 "./typica.w"
  677. class LogEditWindow:public QMainWindow
  678. {
  679. Q_OBJECT
  680. QWidget*centralWidget;
  681. PackLayout*mainLayout;
  682. QHBoxLayout*addRowsLayout;
  683. QLabel*startTimeLabel;
  684. QTimeEdit*startTime;
  685. QLabel*endTimeLabel;
  686. QTimeEdit*endTime;
  687. QLabel*intervalLabel;
  688. QSpinBox*interval;
  689. QPushButton*addRows;
  690. QAction*saveXml;
  691. QAction*saveCsv;
  692. QAction*openXml;
  693. MeasurementModel*model;
  694. QTableView*log;
  695. private slots:
  696. void addTheRows();
  697. void saveXML();
  698. void saveCSV();
  699. void openXML();
  700. protected:
  701. void closeEvent(QCloseEvent*event);
  702. public:
  703. LogEditWindow();
  704. };
  705. /*:447*//*461:*/
  706. #line 11033 "./typica.w"
  707. class XMLOutput:public QObject
  708. {
  709. Q_OBJECT
  710. MeasurementModel*data;
  711. QIODevice*out;
  712. int time;
  713. QMap<int,QString> temperatureColumns;
  714. QMap<int,QString> annotationColumns;
  715. public:
  716. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  717. void addTemperatureColumn(const QString&series,int column);
  718. void addAnnotationColumn(const QString&series,int column);
  719. void setModel(MeasurementModel*model);
  720. void setTimeColumn(int column);
  721. void setDevice(QIODevice*device);
  722. bool output();
  723. };
  724. /*:461*//*468:*/
  725. #line 11229 "./typica.w"
  726. class XMLInput:public QObject
  727. {
  728. Q_OBJECT
  729. int firstc;
  730. QIODevice*in;
  731. public:
  732. XMLInput(QIODevice*input,int c);
  733. void setFirstColumn(int column);
  734. void setDevice(QIODevice*device);
  735. bool input();
  736. signals:
  737. void measure(Measurement,int);
  738. void annotation(QString,int,int);
  739. void newTemperatureColumn(int,QString);
  740. void newAnnotationColumn(int,QString);
  741. void lastColumn(int);
  742. };
  743. /*:468*//*479:*/
  744. #line 11470 "./typica.w"
  745. class CSVOutput
  746. {
  747. MeasurementModel*data;
  748. QIODevice*out;
  749. int time;
  750. QMap<int,QString> temperatureColumns;
  751. QMap<int,QString> annotationColumns;
  752. public:
  753. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  754. void addTemperatureColumn(const QString&series,int column);
  755. void addAnnotationColumn(const QString&series,int column);
  756. void setModel(MeasurementModel*model);
  757. void setTimeColumn(int column);
  758. void setDevice(QIODevice*device);
  759. bool output();
  760. };
  761. /*:479*//*493:*/
  762. #line 11729 "./typica.w"
  763. #define AppInstance (qobject_cast<Application *> (qApp))
  764. class NodeInserter;
  765. class DeviceTreeModel;
  766. class Application:public QApplication
  767. {
  768. Q_OBJECT
  769. public:
  770. Application(int&argc,char**argv);
  771. QDomDocument*configuration();
  772. /*608:*/
  773. #line 14129 "./typica.w"
  774. QDomDocument deviceConfiguration();
  775. /*:608*//*641:*/
  776. #line 14802 "./typica.w"
  777. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  778. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  779. const QModelIndex&index);
  780. /*:641*//*646:*/
  781. #line 14906 "./typica.w"
  782. QList<NodeInserter*> topLevelNodeInserters;
  783. /*:646*/
  784. #line 11740 "./typica.w"
  785. QSqlDatabase database();
  786. QScriptEngine*engine;
  787. public slots:
  788. /*609:*/
  789. #line 14136 "./typica.w"
  790. void saveDeviceConfiguration();
  791. /*:609*/
  792. #line 11744 "./typica.w"
  793. private:
  794. /*607:*/
  795. #line 14120 "./typica.w"
  796. QDomDocument deviceConfigurationDocument;
  797. /*:607*//*640:*/
  798. #line 14796 "./typica.w"
  799. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  800. /*:640*/
  801. #line 11746 "./typica.w"
  802. QDomDocument conf;
  803. };
  804. /*:493*//*501:*/
  805. #line 11870 "./typica.w"
  806. class SaltModel:public QAbstractItemModel
  807. {
  808. Q_OBJECT
  809. QList<QList<QMap<int,QVariant> > > modelData;
  810. QStringList hData;
  811. int colcount;
  812. public:
  813. SaltModel(int columns);
  814. ~SaltModel();
  815. int rowCount(const QModelIndex&parent= QModelIndex())const;
  816. int columnCount(const QModelIndex&parent= QModelIndex())const;
  817. bool setHeaderData(int section,Qt::Orientation orientation,
  818. const QVariant&value,int role= Qt::DisplayRole);
  819. QVariant data(const QModelIndex&index,int role)const;
  820. bool setData(const QModelIndex&index,const QVariant&value,
  821. int role= Qt::EditRole);
  822. Qt::ItemFlags flags(const QModelIndex&index)const;
  823. QVariant headerData(int section,Qt::Orientation orientation,
  824. int role= Qt::DisplayRole)const;
  825. QModelIndex index(int row,int column,
  826. const QModelIndex&parent= QModelIndex())const;
  827. QModelIndex parent(const QModelIndex&index)const;
  828. QString arrayLiteral(int column,int role)const;
  829. QString quotedArrayLiteral(int column,int role)const;
  830. };
  831. /*:501*//*514:*/
  832. #line 12183 "./typica.w"
  833. class SqlComboBox:public QComboBox
  834. {
  835. Q_OBJECT
  836. int dataColumn;
  837. int displayColumn;
  838. bool dataColumnShown;
  839. public:
  840. SqlComboBox();
  841. ~SqlComboBox();
  842. SqlComboBox*clone(QWidget*parent);
  843. public slots:
  844. void addNullOption();
  845. void addSqlOptions(QString query);
  846. void setDataColumn(int column);
  847. void setDisplayColumn(int column);
  848. void showData(bool show);
  849. };
  850. /*:514*//*521:*/
  851. #line 12305 "./typica.w"
  852. class SqlComboBoxDelegate:public QItemDelegate
  853. {
  854. Q_OBJECT
  855. SqlComboBox*delegate;
  856. public:
  857. SqlComboBoxDelegate(QObject*parent= NULL);
  858. QWidget*createEditor(QWidget*parent,
  859. const QStyleOptionViewItem&option,
  860. const QModelIndex&index)const;
  861. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  862. void setModelData(QWidget*editor,QAbstractItemModel*model,
  863. const QModelIndex&index)const;
  864. void setWidget(SqlComboBox*widget);
  865. virtual QSize sizeHint()const;
  866. void updateEditorGeometry(QWidget*editor,
  867. const QStyleOptionViewItem&option,
  868. const QModelIndex&index)const;
  869. };
  870. /*:521*//*533:*/
  871. #line 12475 "./typica.w"
  872. class SqlConnectionSetup:public QDialog
  873. {
  874. Q_OBJECT
  875. public:
  876. SqlConnectionSetup();
  877. ~SqlConnectionSetup();
  878. public slots:
  879. void testConnection();
  880. private:
  881. QFormLayout*formLayout;
  882. QComboBox*driver;
  883. QLineEdit*hostname;
  884. QLineEdit*dbname;
  885. QLineEdit*user;
  886. QLineEdit*password;
  887. QVBoxLayout*layout;
  888. QHBoxLayout*buttons;
  889. QPushButton*cancelButton;
  890. QPushButton*connectButton;
  891. };
  892. /*:533*//*538:*/
  893. #line 12605 "./typica.w"
  894. class SqlQueryView:public QTableView
  895. {
  896. Q_OBJECT
  897. public:
  898. SqlQueryView(QWidget*parent= NULL);
  899. void setQuery(const QString&query);
  900. bool setHeaderData(int section,Qt::Orientation orientation,
  901. const QVariant&value,int role);
  902. Q_INVOKABLE QVariant data(int row,int column,
  903. int role= Qt::DisplayRole);
  904. signals:
  905. void openEntry(QString key);
  906. void openEntryRow(int row);
  907. protected:
  908. virtual void showEvent(QShowEvent*event);
  909. private slots:
  910. void openRow(const QModelIndex&index);
  911. void persistColumnResize(int column,int oldsize,int newsize);
  912. };
  913. /*:538*//*553:*/
  914. #line 12853 "./typica.w"
  915. class ReportAction:public QAction
  916. {
  917. Q_OBJECT
  918. public:
  919. ReportAction(const QString&fileName,const QString&reportName,
  920. QObject*parent= NULL);
  921. private slots:
  922. void createReport();
  923. private:
  924. QString reportFile;
  925. };
  926. /*:553*//*565:*/
  927. #line 13062 "./typica.w"
  928. class ReportTable:public QObject
  929. {
  930. Q_OBJECT
  931. QTextFrame*area;
  932. QDomElement configuration;
  933. QMap<QString,QVariant> bindings;
  934. public:
  935. ReportTable(QTextFrame*frame,QDomElement description);
  936. ~ReportTable();
  937. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  938. public slots:
  939. void refresh();
  940. };
  941. /*:565*//*577:*/
  942. #line 13298 "./typica.w"
  943. class FormArray:public QScrollArea
  944. {
  945. Q_OBJECT
  946. QDomElement configuration;
  947. QWidget itemContainer;
  948. QVBoxLayout itemLayout;
  949. int maxwidth;
  950. int maxheight;
  951. public:
  952. FormArray(QDomElement description);
  953. Q_INVOKABLE QWidget*elementAt(int index);
  954. Q_INVOKABLE int elements();
  955. public slots:
  956. void addElements(int copies= 1);
  957. void removeAllElements();
  958. void setMaximumElementWidth(int width);
  959. void setMaximumElementHeight(int height);
  960. };
  961. /*:577*//*587:*/
  962. #line 13514 "./typica.w"
  963. class ScaleControl:public QGraphicsView
  964. {
  965. Q_OBJECT
  966. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  967. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  968. /*588:*/
  969. #line 13540 "./typica.w"
  970. QGraphicsScene scene;
  971. QGraphicsPolygonItem initialDecrement;
  972. QGraphicsPolygonItem initialIncrement;
  973. QGraphicsPolygonItem finalDecrement;
  974. QGraphicsPolygonItem finalIncrement;
  975. QGraphicsPolygonItem initialIndicator;
  976. QGraphicsPolygonItem finalIndicator;
  977. QGraphicsPathItem scaleLine;
  978. QPolygonF left;
  979. QPolygonF right;
  980. QPolygonF down;
  981. QPolygonF up;
  982. QPainterPath scalePath;
  983. QBrush initialBrush;
  984. QBrush finalBrush;
  985. double nonScoredValue;
  986. double scoredValue;
  987. bool initialSet;
  988. bool finalSet;
  989. bool scaleDown;
  990. /*:588*/
  991. #line 13520 "./typica.w"
  992. public:
  993. ScaleControl();
  994. double initialValue(void);
  995. double finalValue(void);
  996. virtual QSize sizeHint()const;
  997. public slots:
  998. void setInitialValue(double value);
  999. void setFinalValue(double value);
  1000. signals:
  1001. void initialChanged(double);
  1002. void finalChanged(double);
  1003. protected:
  1004. virtual void mousePressEvent(QMouseEvent*event);
  1005. virtual void mouseReleaseEvent(QMouseEvent*event);
  1006. };
  1007. /*:587*//*599:*/
  1008. #line 13837 "./typica.w"
  1009. class IntensityControl:public QGraphicsView
  1010. {
  1011. Q_OBJECT
  1012. Q_PROPERTY(double value READ value WRITE setValue)
  1013. QGraphicsScene scene;
  1014. QGraphicsPolygonItem decrement;
  1015. QGraphicsPolygonItem increment;
  1016. QGraphicsPolygonItem indicator;
  1017. QGraphicsPathItem scaleLine;
  1018. QPolygonF left;
  1019. QPolygonF up;
  1020. QPolygonF down;
  1021. QPainterPath scalePath;
  1022. QBrush theBrush;
  1023. double theValue;
  1024. bool valueSet;
  1025. bool scaleDown;
  1026. public:
  1027. IntensityControl();
  1028. double value();
  1029. virtual QSize sizeHint()const;
  1030. public slots:
  1031. void setValue(double val);
  1032. signals:
  1033. void valueChanged(double);
  1034. protected:
  1035. virtual void mousePressEvent(QMouseEvent*event);
  1036. virtual void mouseReleaseEvent(QMouseEvent*event);
  1037. };
  1038. /*:599*//*615:*/
  1039. #line 14225 "./typica.w"
  1040. class DeviceTreeModelNode
  1041. {
  1042. public:
  1043. DeviceTreeModelNode(QDomNode&node,int row,
  1044. DeviceTreeModelNode*parent= NULL);
  1045. ~DeviceTreeModelNode();
  1046. DeviceTreeModelNode*child(int index);
  1047. DeviceTreeModelNode*parent();
  1048. QDomNode node()const;
  1049. int row();
  1050. private:
  1051. QDomNode domNode;
  1052. QHash<int,DeviceTreeModelNode*> children;
  1053. int rowNumber;
  1054. DeviceTreeModelNode*parentItem;
  1055. };
  1056. /*:615*//*617:*/
  1057. #line 14300 "./typica.w"
  1058. class DeviceTreeModel:public QAbstractItemModel
  1059. {
  1060. Q_OBJECT
  1061. public:
  1062. DeviceTreeModel(QObject*parent= NULL);
  1063. ~DeviceTreeModel();
  1064. QVariant data(const QModelIndex&index,int role)const;
  1065. Qt::ItemFlags flags(const QModelIndex&index)const;
  1066. QVariant headerData(int section,Qt::Orientation orientation,
  1067. int role= Qt::DisplayRole)const;
  1068. QModelIndex index(int row,int column,
  1069. const QModelIndex&parent= QModelIndex())const;
  1070. QModelIndex parent(const QModelIndex&child)const;
  1071. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1072. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1073. bool setData(const QModelIndex&index,const QVariant&value,
  1074. int role);
  1075. bool removeRows(int row,int count,const QModelIndex&parent);
  1076. QDomElement referenceElement(const QString&id);
  1077. public slots:
  1078. void newNode(const QString&name,const QString&driver,
  1079. const QModelIndex&parent);
  1080. private:
  1081. QDomDocument document;
  1082. DeviceTreeModelNode*root;
  1083. QDomNode referenceSection;
  1084. QDomNode treeRoot;
  1085. };
  1086. /*:617*//*636:*/
  1087. #line 14754 "./typica.w"
  1088. Q_DECLARE_METATYPE(QModelIndex)
  1089. /*:636*//*644:*/
  1090. #line 14861 "./typica.w"
  1091. class NodeInserter:public QAction
  1092. {
  1093. Q_OBJECT
  1094. public:
  1095. NodeInserter(const QString&title,const QString&name,
  1096. const QString&driver,QObject*parent= NULL);
  1097. signals:
  1098. void triggered(QString name,QString driver);
  1099. private slots:
  1100. void onTriggered();
  1101. private:
  1102. QString defaultNodeName;
  1103. QString driverString;
  1104. };
  1105. /*:644*//*647:*/
  1106. #line 14912 "./typica.w"
  1107. class DeviceConfigurationWindow:public QMainWindow
  1108. {
  1109. Q_OBJECT
  1110. public:
  1111. DeviceConfigurationWindow();
  1112. public slots:
  1113. void addDevice();
  1114. void removeNode();
  1115. void newSelection(const QModelIndex&index);
  1116. private slots:
  1117. void resizeColumn();
  1118. private:
  1119. QDomDocument document;
  1120. DeviceTreeModel*model;
  1121. QTreeView*view;
  1122. QScrollArea*configArea;
  1123. };
  1124. /*:647*//*656:*/
  1125. #line 15076 "./typica.w"
  1126. class BasicDeviceConfigurationWidget:public QWidget
  1127. {
  1128. Q_OBJECT
  1129. public:
  1130. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1131. const QModelIndex&index);
  1132. public slots:
  1133. void insertChildNode(const QString&name,const QString&driver);
  1134. void updateAttribute(const QString&name,const QString&value);
  1135. protected:
  1136. DeviceTreeModel*deviceModel;
  1137. QModelIndex currentNode;
  1138. };
  1139. /*:656*//*660:*/
  1140. #line 15161 "./typica.w"
  1141. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1142. {
  1143. Q_OBJECT
  1144. public:
  1145. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1146. const QModelIndex&index);
  1147. private slots:
  1148. void updateRoasterId(int id);
  1149. };
  1150. /*:660*//*665:*/
  1151. #line 15294 "./typica.w"
  1152. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1153. {
  1154. Q_OBJECT
  1155. public:
  1156. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1157. const QModelIndex&index);
  1158. };
  1159. /*:665*//*667:*/
  1160. #line 15340 "./typica.w"
  1161. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1162. {
  1163. Q_OBJECT
  1164. public:
  1165. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1166. const QModelIndex&index);
  1167. private slots:
  1168. void addChannel();
  1169. void updateDeviceId(const QString&newId);
  1170. };
  1171. /*:667*//*671:*/
  1172. #line 15426 "./typica.w"
  1173. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1174. {
  1175. Q_OBJECT
  1176. public:
  1177. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1178. const QModelIndex&index);
  1179. private slots:
  1180. void updateThermocoupleType(const QString&type);
  1181. void updateColumnName(const QString&name);
  1182. };
  1183. /*:671*//*676:*/
  1184. #line 15528 "./typica.w"
  1185. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1186. {
  1187. Q_OBJECT
  1188. public:
  1189. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1190. const QModelIndex&index);
  1191. };
  1192. /*:676*//*678:*/
  1193. #line 15569 "./typica.w"
  1194. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1195. {
  1196. Q_OBJECT
  1197. public:
  1198. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1199. const QModelIndex&index);
  1200. private slots:
  1201. void addChannel();
  1202. void updateDeviceId(const QString&newId);
  1203. };
  1204. /*:678*//*680:*/
  1205. #line 15638 "./typica.w"
  1206. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1207. {
  1208. Q_OBJECT
  1209. public:
  1210. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1211. const QModelIndex&index);
  1212. private slots:
  1213. void updateDeviceId(const QString&newId);
  1214. void updateThermocoupleType(const QString&type);
  1215. void updateColumnName(const QString&name);
  1216. };
  1217. /*:680*//*685:*/
  1218. #line 15755 "./typica.w"
  1219. class PortSelector:public QComboBox
  1220. {
  1221. Q_OBJECT
  1222. public:
  1223. PortSelector(QWidget*parent= NULL);
  1224. private slots:
  1225. void addDevice(QextPortInfo port);
  1226. private:
  1227. QextSerialEnumerator*lister;
  1228. };
  1229. /*:685*//*687:*/
  1230. #line 15799 "./typica.w"
  1231. class BaudSelector:public QComboBox
  1232. {
  1233. Q_OBJECT
  1234. Q_ENUMS(BaudRateType)
  1235. public:
  1236. BaudSelector(QWidget*parent= NULL);
  1237. enum BaudRateType
  1238. {
  1239. #if defined(Q_OS_UNIX) || defined(qdoc)
  1240. BAUD50= 50,
  1241. BAUD75= 75,
  1242. BAUD134= 134,
  1243. BAUD150= 150,
  1244. BAUD200= 200,
  1245. BAUD1800= 1800,
  1246. #if defined(B76800) || defined(qdoc)
  1247. BAUD76800= 76800,
  1248. #endif
  1249. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1250. BAUD230400= 230400,
  1251. BAUD460800= 460800,
  1252. BAUD500000= 500000,
  1253. BAUD576000= 576000,
  1254. BAUD921600= 921600,
  1255. BAUD1000000= 1000000,
  1256. BAUD1152000= 1152000,
  1257. BAUD1500000= 1500000,
  1258. BAUD2000000= 2000000,
  1259. BAUD2500000= 2500000,
  1260. BAUD3000000= 3000000,
  1261. BAUD3500000= 3500000,
  1262. BAUD4000000= 4000000,
  1263. #endif
  1264. #endif
  1265. #if defined(Q_OS_WIN) || defined(qdoc)
  1266. BAUD14400= 14400,
  1267. BAUD56000= 56000,
  1268. BAUD128000= 128000,
  1269. BAUD256000= 256000,
  1270. #endif
  1271. BAUD110= 110,
  1272. BAUD300= 300,
  1273. BAUD600= 600,
  1274. BAUD1200= 1200,
  1275. BAUD2400= 2400,
  1276. BAUD4800= 4800,
  1277. BAUD9600= 9600,
  1278. BAUD19200= 19200,
  1279. BAUD38400= 38400,
  1280. BAUD57600= 57600,
  1281. BAUD115200= 115200
  1282. };
  1283. };
  1284. /*:687*//*689:*/
  1285. #line 15870 "./typica.w"
  1286. class ParitySelector:public QComboBox
  1287. {
  1288. Q_OBJECT
  1289. Q_ENUMS(ParityType)
  1290. public:
  1291. ParitySelector(QWidget*parent= NULL);
  1292. enum ParityType
  1293. {
  1294. PAR_NONE,
  1295. PAR_ODD,
  1296. PAR_EVEN,
  1297. #if defined(Q_OS_WIN) || defined(qdoc)
  1298. PAR_MARK,
  1299. #endif
  1300. PAR_SPACE
  1301. };
  1302. };
  1303. /*:689*//*691:*/
  1304. #line 15908 "./typica.w"
  1305. class FlowSelector:public QComboBox
  1306. {
  1307. Q_OBJECT
  1308. Q_ENUMS(FlowType)
  1309. public:
  1310. FlowSelector(QWidget*parent= NULL);
  1311. enum FlowType
  1312. {
  1313. FLOW_OFF,
  1314. FLOW_HARDWARE,
  1315. FLOW_XONXOFF
  1316. };
  1317. };
  1318. /*:691*//*693:*/
  1319. #line 15941 "./typica.w"
  1320. class StopSelector:public QComboBox
  1321. {
  1322. Q_OBJECT
  1323. Q_ENUMS(StopBitsType)
  1324. public:
  1325. StopSelector(QWidget*parent= NULL);
  1326. enum StopBitsType
  1327. {
  1328. STOP_1,
  1329. #if defined(Q_OS_WIN) || defined(qdoc)
  1330. STOP_1_5,
  1331. #endif
  1332. STOP_2
  1333. };
  1334. };
  1335. /*:693*//*696:*/
  1336. #line 15994 "./typica.w"
  1337. class ShortHexSpinBox:public QSpinBox
  1338. {
  1339. Q_OBJECT
  1340. public:
  1341. ShortHexSpinBox(QWidget*parent= NULL);
  1342. virtual QValidator::State validate(QString&input,int&pos)const;
  1343. protected:
  1344. virtual int valueFromText(const QString&text)const;
  1345. virtual QString textFromValue(int value)const;
  1346. };
  1347. /*:696*//*698:*/
  1348. #line 16056 "./typica.w"
  1349. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1350. {
  1351. Q_OBJECT
  1352. public:
  1353. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1354. const QModelIndex&index);
  1355. private slots:
  1356. void updatePort(const QString&newPort);
  1357. void updateBaudRate(const QString&newRate);
  1358. void updateParity(const QString&newParity);
  1359. void updateFlowControl(const QString&newFlow);
  1360. void updateStopBits(const QString&newStopBits);
  1361. };
  1362. /*:698*//*700:*/
  1363. #line 16207 "./typica.w"
  1364. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1365. {
  1366. Q_OBJECT
  1367. public:
  1368. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1369. const QModelIndex&index);
  1370. private slots:
  1371. void updateStationNumber(int newStation);
  1372. void updateFixedUnit(bool newFixed);
  1373. void updateFixedDecimal(bool newFixed);
  1374. void updateUnit(const QString&newUnit);
  1375. void updateUnitAddress(int newAddress);
  1376. void updateValueF(int newValue);
  1377. void updateValueC(int newValue);
  1378. void updatePrecisionAddress(int newAddress);
  1379. void updatePrecisionValue(int newValue);
  1380. private:
  1381. QStackedLayout*unitSpecificationLayout;
  1382. QStackedLayout*decimalSpecificationLayout;
  1383. };
  1384. /*:700*//*702:*/
  1385. #line 16466 "./typica.w"
  1386. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1387. {
  1388. Q_OBJECT
  1389. public:
  1390. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1391. const QModelIndex&index);
  1392. private slots:
  1393. void updateAddress(int newAddress);
  1394. };
  1395. /*:702*//*704:*/
  1396. #line 16512 "./typica.w"
  1397. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1398. {
  1399. Q_OBJECT
  1400. public:
  1401. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1402. const QModelIndex&index);
  1403. private slots:
  1404. void updateReadAddress(int newAddress);
  1405. void updateWriteAddress(int newAddress);
  1406. void updateFixedRange(bool fixed);
  1407. void updateLower(const QString&lower);
  1408. void updateUpper(const QString&upper);
  1409. void updateLowerAddress(int newAddress);
  1410. void updateUpperAddress(int newAddress);
  1411. private:
  1412. QStackedLayout*boundsLayout;
  1413. };
  1414. /*:704*//*708:*/
  1415. #line 16706 "./typica.w"
  1416. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1417. {
  1418. Q_OBJECT
  1419. public:
  1420. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1421. private slots:
  1422. void updateButtonText(const QString&text);
  1423. void updateAnnotationText(const QString&text);
  1424. };
  1425. /*:708*//*712:*/
  1426. #line 16774 "./typica.w"
  1427. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1428. {
  1429. Q_OBJECT
  1430. public:
  1431. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1432. private slots:
  1433. void updateButtonText(const QString&text);
  1434. void updateAnnotationText(const QString&text);
  1435. };
  1436. /*:712*//*715:*/
  1437. #line 16848 "./typica.w"
  1438. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1439. {
  1440. Q_OBJECT
  1441. public:
  1442. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1443. private slots:
  1444. void updateLabel(const QString&text);
  1445. void updateMinimum(const QString&minimum);
  1446. void updateMaximum(const QString&maximum);
  1447. void updatePrecision(int precision);
  1448. void updatePretext(const QString&text);
  1449. void updatePosttext(const QString&text);
  1450. };
  1451. /*:715*//*718:*/
  1452. #line 12 "./freeannotation.w"
  1453. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1454. {
  1455. Q_OBJECT
  1456. public:
  1457. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1458. private slots:
  1459. void updateLabel(const QString&text);
  1460. };
  1461. /*:718*//*722:*/
  1462. #line 16971 "./typica.w"
  1463. class ModbusRTUDevice:public QObject
  1464. {
  1465. Q_OBJECT
  1466. public:
  1467. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1468. ~ModbusRTUDevice();
  1469. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1470. Q_INVOKABLE double SVLower();
  1471. Q_INVOKABLE double SVUpper();
  1472. Q_INVOKABLE int decimals();
  1473. QList<Channel*> channels;
  1474. public slots:
  1475. void outputSV(double sv);
  1476. signals:
  1477. void SVLowerChanged(double);
  1478. void SVUpperChanged(double);
  1479. void SVDecimalChanged(int);
  1480. void queueEmpty();
  1481. private slots:
  1482. void dataAvailable();
  1483. void sendNextMessage();
  1484. void decimalResponse(QByteArray response);
  1485. void unitResponse(QByteArray response);
  1486. void svlResponse(QByteArray response);
  1487. void svuResponse(QByteArray response);
  1488. void requestMeasurement();
  1489. void mResponse(QByteArray response);
  1490. void ignore(QByteArray response);
  1491. private:
  1492. QextSerialPort*port;
  1493. QByteArray responseBuffer;
  1494. QList<QByteArray> messageQueue;
  1495. QList<QObject*> retObjQueue;
  1496. QList<char*> callbackQueue;
  1497. quint16 calculateCRC(QByteArray data);
  1498. QTimer*messageDelayTimer;
  1499. int delayTime;
  1500. char station;
  1501. int decimalPosition;
  1502. int valueF;
  1503. int valueC;
  1504. bool unitIsF;
  1505. double outputSVLower;
  1506. double outputSVUpper;
  1507. QByteArray outputSVStub;
  1508. QByteArray pvStub;
  1509. QByteArray svStub;
  1510. QByteArray mStub;
  1511. quint16 pvaddress;
  1512. quint16 svaddress;
  1513. bool svenabled;
  1514. bool readingsv;
  1515. double savedpv;
  1516. bool waiting;
  1517. };
  1518. /*:722*//*737:*/
  1519. #line 17643 "./typica.w"
  1520. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1521. {
  1522. Q_OBJECT
  1523. public:
  1524. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1525. private slots:
  1526. void updatePort(const QString&newPort);
  1527. void updateBaudRate(const QString&newRate);
  1528. void updateParity(const QString&newParity);
  1529. void updateFlowControl(const QString&newFlow);
  1530. void updateStopBits(const QString&newStopBits);
  1531. void updateStation(int station);
  1532. void updateFixedDecimal(bool fixed);
  1533. void updateDecimalAddress(int address);
  1534. void updateDecimalPosition(int position);
  1535. void updateFixedUnit(bool fixed);
  1536. void updateUnitAddress(int address);
  1537. void updateValueForF(int value);
  1538. void updateValueForC(int value);
  1539. void updateUnit(const QString&newUnit);
  1540. void updatePVAddress(int address);
  1541. void updateSVEnabled(bool enabled);
  1542. void updateSVReadAddress(int address);
  1543. void updateDeviceLimit(bool query);
  1544. void updateSVLowerAddress(int address);
  1545. void updateSVUpperAddress(int address);
  1546. void updateSVLower(double value);
  1547. void updateSVUpper(double value);
  1548. void updateSVWritable(bool canWriteSV);
  1549. void updateSVWriteAddress(int address);
  1550. void updatePVColumnName(const QString&name);
  1551. void updateSVColumnName(const QString&name);
  1552. private:
  1553. PortSelector*port;
  1554. BaudSelector*baud;
  1555. ParitySelector*parity;
  1556. FlowSelector*flow;
  1557. StopSelector*stop;
  1558. QSpinBox*station;
  1559. QCheckBox*decimalQuery;
  1560. ShortHexSpinBox*decimalAddress;
  1561. QSpinBox*decimalPosition;
  1562. QCheckBox*unitQuery;
  1563. ShortHexSpinBox*unitAddress;
  1564. QSpinBox*valueF;
  1565. QSpinBox*valueC;
  1566. QComboBox*fixedUnit;
  1567. ShortHexSpinBox*pVAddress;
  1568. QCheckBox*sVEnabled;
  1569. ShortHexSpinBox*sVReadAddress;
  1570. QCheckBox*deviceLimit;
  1571. ShortHexSpinBox*sVLowerAddr;
  1572. ShortHexSpinBox*sVUpperAddr;
  1573. QDoubleSpinBox*sVLower;
  1574. QDoubleSpinBox*sVUpper;
  1575. QCheckBox*sVWritable;
  1576. ShortHexSpinBox*sVOutputAddr;
  1577. QLineEdit*pVColumnName;
  1578. QLineEdit*sVColumnName;
  1579. };
  1580. /*:737*//*741:*/
  1581. #line 18149 "./typica.w"
  1582. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1583. {
  1584. Q_OBJECT
  1585. public:
  1586. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1587. const QModelIndex&index);
  1588. private slots:
  1589. void updateSourceColumn(const QString&source);
  1590. void updateDestinationColumn(const QString&dest);
  1591. void updateKnots();
  1592. private:
  1593. SaltModel*knotmodel;
  1594. };
  1595. /*:741*//*747:*/
  1596. #line 18273 "./typica.w"
  1597. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1598. {
  1599. Q_OBJECT
  1600. public:
  1601. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1602. private slots:
  1603. void updateMatchingColumn(const QString&column);
  1604. void updateTemperature();
  1605. private:
  1606. QDoubleSpinBox*temperatureValue;
  1607. QComboBox*unitSelector;
  1608. };
  1609. /*:747*/
  1610. #line 761 "./typica.w"
  1611. /*25:*/
  1612. #line 1011 "./typica.w"
  1613. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1614. /*:25*//*27:*/
  1615. #line 1026 "./typica.w"
  1616. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1617. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1618. /*:27*//*29:*/
  1619. #line 1051 "./typica.w"
  1620. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1621. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1622. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1623. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1624. QScriptEngine*engine);
  1625. /*:29*//*37:*/
  1626. #line 1249 "./typica.w"
  1627. QScriptValue constructQMainWindow(QScriptContext*context,
  1628. QScriptEngine*engine);
  1629. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1630. QScriptEngine*engine);
  1631. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1632. QScriptEngine*engine);
  1633. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1634. /*:37*//*42:*/
  1635. #line 1348 "./typica.w"
  1636. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1637. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1638. /*:42*//*45:*/
  1639. #line 1393 "./typica.w"
  1640. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1641. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1642. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1643. /*:45*//*48:*/
  1644. #line 1459 "./typica.w"
  1645. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1646. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1647. /*:48*//*51:*/
  1648. #line 1492 "./typica.w"
  1649. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1650. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1651. /*:51*//*54:*/
  1652. #line 1530 "./typica.w"
  1653. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  1654. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  1655. /*:54*//*58:*/
  1656. #line 1569 "./typica.w"
  1657. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1658. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1659. QScriptEngine*engine);
  1660. QScriptValue QSplitter_saveState(QScriptContext*context,
  1661. QScriptEngine*engine);
  1662. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1663. QScriptEngine*engine);
  1664. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1665. /*:58*//*63:*/
  1666. #line 1688 "./typica.w"
  1667. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1668. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1669. /*:63*//*65:*/
  1670. #line 1743 "./typica.w"
  1671. QScriptValue constructQBoxLayout(QScriptContext*context,
  1672. QScriptEngine*engine);
  1673. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1674. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1675. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1676. /*:65*//*69:*/
  1677. #line 1856 "./typica.w"
  1678. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1679. QScriptValue QAction_setShortcut(QScriptContext*context,
  1680. QScriptEngine*engine);
  1681. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1682. /*:69*//*72:*/
  1683. #line 1912 "./typica.w"
  1684. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  1685. QScriptEngine*engine);
  1686. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  1687. QScriptEngine*engine);
  1688. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  1689. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  1690. /*:72*//*77:*/
  1691. #line 2023 "./typica.w"
  1692. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  1693. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  1694. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  1695. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  1696. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  1697. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  1698. QScriptValue QIODevice_readToString(QScriptContext*context,
  1699. QScriptEngine*engine);
  1700. /*:77*//*84:*/
  1701. #line 2145 "./typica.w"
  1702. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  1703. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  1704. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  1705. /*:84*//*87:*/
  1706. #line 2190 "./typica.w"
  1707. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  1708. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1709. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  1710. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  1711. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  1712. /*:87*//*93:*/
  1713. #line 2263 "./typica.w"
  1714. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  1715. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  1716. QScriptEngine*engine);
  1717. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  1718. QScriptEngine*engine);
  1719. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  1720. QScriptEngine*engine);
  1721. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  1722. QScriptEngine*engine);
  1723. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  1724. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  1725. QScriptEngine*engine);
  1726. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  1727. QScriptEngine*engine);
  1728. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  1729. QScriptEngine*engine);
  1730. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  1731. QScriptEngine*engine);
  1732. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  1733. QScriptEngine*engine);
  1734. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  1735. QScriptEngine*engine);
  1736. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  1737. QScriptEngine*engine);
  1738. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  1739. QScriptEngine*engine);
  1740. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  1741. /*:93*//*102:*/
  1742. #line 2481 "./typica.w"
  1743. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  1744. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  1745. QScriptValue XmlReader_attribute(QScriptContext*context,
  1746. QScriptEngine*engine);
  1747. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  1748. QScriptEngine*engine);
  1749. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  1750. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  1751. QScriptEngine*engine);
  1752. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  1753. QScriptValue XmlReader_readElementText(QScriptContext*context,
  1754. QScriptEngine*engine);
  1755. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  1756. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  1757. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  1758. /*:102*//*109:*/
  1759. #line 2616 "./typica.w"
  1760. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  1761. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  1762. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  1763. /*:109*//*113:*/
  1764. #line 2698 "./typica.w"
  1765. QScriptValue constructQLCDNumber(QScriptContext*context,
  1766. QScriptEngine*engine);
  1767. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  1768. /*:113*//*116:*/
  1769. #line 2736 "./typica.w"
  1770. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  1771. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  1772. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  1773. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  1774. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  1775. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  1776. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  1777. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  1778. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  1779. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  1780. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  1781. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  1782. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  1783. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  1784. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  1785. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  1786. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  1787. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  1788. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  1789. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  1790. /*:116*//*131:*/
  1791. #line 3205 "./typica.w"
  1792. void setQAbstractScrollAreaProperties(QScriptValue value,
  1793. QScriptEngine*engine);
  1794. /*:131*//*133:*/
  1795. #line 3220 "./typica.w"
  1796. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  1797. /*:133*//*135:*/
  1798. #line 3233 "./typica.w"
  1799. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  1800. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  1801. /*:135*//*137:*/
  1802. #line 3257 "./typica.w"
  1803. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  1804. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  1805. QScriptValue constructQPushButton(QScriptContext*context,
  1806. QScriptEngine*engine);
  1807. /*:137*//*144:*/
  1808. #line 3356 "./typica.w"
  1809. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  1810. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  1811. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1812. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  1813. QScriptEngine*engine);
  1814. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  1815. QScriptEngine*engine);
  1816. QScriptValue QSqlQuery_exec(QScriptContext*context,
  1817. QScriptEngine*engine);
  1818. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  1819. QScriptEngine*engine);
  1820. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  1821. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  1822. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  1823. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  1824. /*:144*//*151:*/
  1825. #line 3526 "./typica.w"
  1826. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  1827. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  1828. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  1829. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  1830. QScriptValue annotationFromRecord(QScriptContext*context,
  1831. QScriptEngine*engine);
  1832. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  1833. /*:151*//*162:*/
  1834. #line 3809 "./typica.w"
  1835. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  1836. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1837. QStack<QLayout*> *layoutStack);
  1838. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1839. QStack<QLayout*> *layoutStack);
  1840. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1841. QStack<QLayout*> *layoutStack);
  1842. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1843. QStack<QLayout*> *layoutStack);
  1844. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1845. QStack<QLayout*> *layoutStack);
  1846. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1847. QStack<QLayout*> *layoutStack);
  1848. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1849. QStack<QLayout*> *layoutStack);
  1850. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1851. QStack<QLayout*> *layoutStack);
  1852. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1853. QStack<QLayout*> *layoutStack);
  1854. void addTemperatureDisplayToSplitter(QDomElement element,
  1855. QStack<QWidget*> *widgetStack,
  1856. QStack<QLayout*> *layoutStack);
  1857. void addTemperatureDisplayToLayout(QDomElement element,
  1858. QStack<QWidget*> *widgetStack,
  1859. QStack<QLayout*> *layoutStack);
  1860. void addTimerDisplayToSplitter(QDomElement element,
  1861. QStack<QWidget*> *widgetStack,
  1862. QStack<QLayout*> *layoutStack);
  1863. void addTimerDisplayToLayout(QDomElement element,
  1864. QStack<QWidget*> *widgetStack,
  1865. QStack<QLayout*> *layoutStack);
  1866. void addDecorationToSplitter(QDomElement element,
  1867. QStack<QWidget*> *widgetStack,
  1868. QStack<QLayout*> *layoutStack);
  1869. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1870. QStack<QLayout*> *layoutStack);
  1871. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1872. QStack<QLayout*> *layoutStack);
  1873. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1874. QStack<QLayout*> *layoutStack);
  1875. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1876. QStack<QLayout*> *layoutStack);
  1877. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1878. QStack<QLayout*> *layoutStack);
  1879. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1880. QStack<QLayout*> *layoutStack);
  1881. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1882. QStack<QLayout*> *layoutStack);
  1883. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1884. QStack<QLayout*> *layoutStack);
  1885. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1886. QStack<QLayout*> *layoutStack);
  1887. void addSqlQueryViewToLayout(QDomElement element,
  1888. QStack<QWidget*> *widgetStack,
  1889. QStack<QLayout*> *layoutStack);
  1890. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1891. QStack<QLayout*> *layoutStack);
  1892. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1893. QStack<QLayout*> *layoutStack);
  1894. /*:162*//*213:*/
  1895. #line 5325 "./typica.w"
  1896. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  1897. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  1898. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  1899. QScriptEngine*engine);
  1900. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  1901. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  1902. QScriptEngine*engine);
  1903. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  1904. /*:213*//*214:*/
  1905. #line 5340 "./typica.w"
  1906. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  1907. /*:214*//*218:*/
  1908. #line 5471 "./typica.w"
  1909. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  1910. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  1911. QScriptEngine*engine);
  1912. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  1913. QScriptEngine*engine);
  1914. QScriptValue SaltTable_columnSum(QScriptContext*context,
  1915. QScriptEngine*engine);
  1916. QScriptValue SaltTable_columnArray(QScriptContext*context,
  1917. QScriptEngine*engine);
  1918. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  1919. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  1920. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  1921. QScriptEngine*engine);
  1922. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  1923. /*:218*//*225:*/
  1924. #line 5641 "./typica.w"
  1925. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1926. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1927. QScriptValue QComboBox_currentData(QScriptContext*context,
  1928. QScriptEngine*engine);
  1929. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  1930. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  1931. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  1932. /*:225*//*257:*/
  1933. #line 6519 "./typica.w"
  1934. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  1935. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1936. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  1937. /*:257*//*266:*/
  1938. #line 6717 "./typica.w"
  1939. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  1940. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1941. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  1942. /*:266*//*271:*/
  1943. #line 6818 "./typica.w"
  1944. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  1945. /*:271*//*277:*/
  1946. #line 6994 "./typica.w"
  1947. QScriptValue constructLinearCalibrator(QScriptContext*context,
  1948. QScriptEngine*engine);
  1949. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  1950. /*:277*//*282:*/
  1951. #line 7133 "./typica.w"
  1952. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  1953. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  1954. /*:282*//*291:*/
  1955. #line 7315 "./typica.w"
  1956. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  1957. QScriptEngine*engine);
  1958. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1959. /*:291*//*298:*/
  1960. #line 7452 "./typica.w"
  1961. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  1962. QScriptEngine*engine);
  1963. void setMeasurementTimeOffsetProperties(QScriptValue value,
  1964. QScriptEngine*engine);
  1965. /*:298*//*303:*/
  1966. #line 7565 "./typica.w"
  1967. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  1968. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  1969. /*:303*//*308:*/
  1970. #line 7662 "./typica.w"
  1971. QScriptValue constructZeroEmitter(QScriptContext*context,
  1972. QScriptEngine*engine);
  1973. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  1974. /*:308*//*313:*/
  1975. #line 7741 "./typica.w"
  1976. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  1977. QScriptEngine*engine);
  1978. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  1979. /*:313*//*328:*/
  1980. #line 8091 "./typica.w"
  1981. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  1982. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  1983. /*:328*//*351:*/
  1984. #line 8689 "./typica.w"
  1985. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  1986. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  1987. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  1988. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  1989. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  1990. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  1991. QScriptEngine*engine);
  1992. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  1993. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  1994. QScriptEngine*engnie);
  1995. /*:351*//*388:*/
  1996. #line 9614 "./typica.w"
  1997. QScriptValue constructAnnotationButton(QScriptContext*context,
  1998. QScriptEngine*engine);
  1999. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2000. /*:388*//*396:*/
  2001. #line 9754 "./typica.w"
  2002. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2003. QScriptEngine*engine);
  2004. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2005. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2006. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2007. /*:396*//*417:*/
  2008. #line 10177 "./typica.w"
  2009. QScriptValue constructTimerDisplay(QScriptContext*context,
  2010. QScriptEngine*engine);
  2011. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2012. /*:417*//*444:*/
  2013. #line 10671 "./typica.w"
  2014. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2015. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2016. QScriptEngine*engine);
  2017. /*:444*//*457:*/
  2018. #line 10954 "./typica.w"
  2019. QScriptValue constructLogEditWindow(QScriptContext*context,
  2020. QScriptEngine*engine);
  2021. /*:457*//*476:*/
  2022. #line 11428 "./typica.w"
  2023. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2024. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2025. /*:476*//*492:*/
  2026. #line 11711 "./typica.w"
  2027. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2028. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*engine);
  2029. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*engine);
  2030. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*engine);
  2031. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*engine);
  2032. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*);
  2033. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2034. QStack<QLayout*> *layoutStack);
  2035. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2036. /*:492*//*548:*/
  2037. #line 12740 "./typica.w"
  2038. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2039. QScriptValue constructSqlQueryView(QScriptContext*context,
  2040. QScriptEngine*engine);
  2041. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2042. QScriptEngine*engine);
  2043. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2044. QScriptEngine*engine);
  2045. /*:548*//*558:*/
  2046. #line 12969 "./typica.w"
  2047. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2048. QStack<QLayout*> *layoutStack);
  2049. /*:558*//*574:*/
  2050. #line 13253 "./typica.w"
  2051. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2052. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2053. /*:574*//*584:*/
  2054. #line 13448 "./typica.w"
  2055. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2056. QStack<QLayout*> *layoutStack);
  2057. /*:584*//*605:*/
  2058. #line 14032 "./typica.w"
  2059. void addScaleControlToLayout(QDomElement element,
  2060. QStack<QWidget*> *widgetStack,
  2061. QStack<QLayout*> *layoutStack);
  2062. void addIntensityControlToLayout(QDomElement element,
  2063. QStack<QWidget*> *widgetStack,
  2064. QStack<QLayout*> *layoutStack);
  2065. /*:605*//*631:*/
  2066. #line 14618 "./typica.w"
  2067. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2068. QScriptEngine*engine);
  2069. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2070. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2071. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2072. QScriptEngine*engine);
  2073. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2074. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2075. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2076. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2077. /*:631*//*637:*/
  2078. #line 14760 "./typica.w"
  2079. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2080. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2081. /*:637*//*653:*/
  2082. #line 15048 "./typica.w"
  2083. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2084. QScriptEngine*engine);
  2085. /*:653*//*732:*/
  2086. #line 17550 "./typica.w"
  2087. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2088. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2089. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2090. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2091. /*:732*/
  2092. #line 762 "./typica.w"
  2093. /*17:*/
  2094. #line 770 "./typica.w"
  2095. /*645:*/
  2096. #line 14881 "./typica.w"
  2097. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2098. const QString&driver,QObject*parent):
  2099. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2100. {
  2101. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2102. }
  2103. void NodeInserter::onTriggered()
  2104. {
  2105. emit triggered(defaultNodeName,driverString);
  2106. }
  2107. /*:645*/
  2108. #line 771 "./typica.w"
  2109. /*232:*/
  2110. #line 5756 "./typica.w"
  2111. Measurement::Measurement(double temperature,QTime time,
  2112. TemperatureUnits sc):
  2113. theTemperature(temperature),theTime(time),unit(sc)
  2114. {
  2115. }
  2116. Measurement::Measurement(double temperature):
  2117. theTemperature(temperature),theTime(QTime::currentTime()),
  2118. unit(Fahrenheit)
  2119. {
  2120. }
  2121. /*:232*//*234:*/
  2122. #line 5784 "./typica.w"
  2123. Measurement::Measurement(const Measurement&x):
  2124. theTemperature(x.temperature()),theTime(x.time()),
  2125. unit(x.unit)
  2126. {
  2127. }
  2128. Measurement::~Measurement()
  2129. {
  2130. }
  2131. /*:234*//*235:*/
  2132. #line 5800 "./typica.w"
  2133. Measurement&Measurement::operator= (Measurement&x)
  2134. {
  2135. theTemperature= x.temperature();
  2136. theTime= x.time();
  2137. unit= x.unit;
  2138. return*this;
  2139. }
  2140. /*:235*//*236:*/
  2141. #line 5814 "./typica.w"
  2142. double Measurement::temperature()const
  2143. {
  2144. return theTemperature;
  2145. }
  2146. QTime Measurement::time()const
  2147. {
  2148. return theTime;
  2149. }
  2150. void Measurement::setTemperature(double temperature)
  2151. {
  2152. theTemperature= temperature;
  2153. }
  2154. void Measurement::setTime(QTime time)
  2155. {
  2156. theTime= time;
  2157. }
  2158. /*:236*//*237:*/
  2159. #line 5840 "./typica.w"
  2160. void Measurement::setUnit(TemperatureUnits scale)
  2161. {
  2162. unit= scale;
  2163. }
  2164. Measurement::TemperatureUnits Measurement::scale()
  2165. {
  2166. return unit;
  2167. }
  2168. /*:237*//*238:*/
  2169. #line 5860 "./typica.w"
  2170. Measurement Measurement::toFahrenheit()
  2171. {
  2172. switch(unit)
  2173. {
  2174. case Celsius:
  2175. return Measurement(this->temperature()*9/5+32,this->time(),
  2176. Fahrenheit);
  2177. break;
  2178. case Kelvin:
  2179. return Measurement(this->temperature()*5/9-459.67,
  2180. this->time(),Fahrenheit);
  2181. break;
  2182. case Rankine:
  2183. return Measurement(this->temperature()-459.67,this->time(),
  2184. Fahrenheit);
  2185. break;
  2186. default:
  2187. return Measurement(this->temperature(),this->time(),Fahrenheit);
  2188. break;
  2189. }
  2190. }
  2191. /*:238*//*239:*/
  2192. #line 5885 "./typica.w"
  2193. Measurement Measurement::toCelsius()
  2194. {
  2195. switch(unit)
  2196. {
  2197. case Fahrenheit:
  2198. return Measurement((this->temperature()-32)*5/9,this->time(),
  2199. Celsius);
  2200. break;
  2201. case Kelvin:
  2202. return Measurement(this->temperature()-273.15,this->time(),
  2203. Celsius);
  2204. break;
  2205. case Rankine:
  2206. return Measurement((this->temperature()-491.67)*5/9,
  2207. this->time(),Celsius);
  2208. break;
  2209. default:
  2210. return Measurement(this->temperature(),this->time(),Celsius);
  2211. break;
  2212. }
  2213. }
  2214. /*:239*//*240:*/
  2215. #line 5911 "./typica.w"
  2216. Measurement Measurement::toKelvin()
  2217. {
  2218. switch(unit)
  2219. {
  2220. case Fahrenheit:
  2221. return Measurement((this->temperature()+459.67)*5/9,
  2222. this->time(),Kelvin);
  2223. break;
  2224. case Celsius:
  2225. return Measurement(this->temperature()+273.15,this->time(),
  2226. Kelvin);
  2227. break;
  2228. case Rankine:
  2229. return Measurement(this->temperature()*5/9,this->time(),
  2230. Kelvin);
  2231. break;
  2232. default:
  2233. return Measurement(this->temperature(),this->time(),Kelvin);
  2234. break;
  2235. }
  2236. }
  2237. /*:240*//*241:*/
  2238. #line 5936 "./typica.w"
  2239. Measurement Measurement::toRankine()
  2240. {
  2241. switch(unit)
  2242. {
  2243. case Fahrenheit:
  2244. return Measurement(this->temperature()+459.67,this->time(),
  2245. Rankine);
  2246. break;
  2247. case Celsius:
  2248. return Measurement((this->temperature()+273.15)*9/5,
  2249. this->time(),Rankine);
  2250. break;
  2251. case Kelvin:
  2252. return Measurement(this->temperature()*9/5,this->time(),
  2253. Rankine);
  2254. break;
  2255. default:
  2256. return Measurement(this->temperature(),this->time(),Rankine);
  2257. break;
  2258. }
  2259. }
  2260. /*:241*/
  2261. #line 772 "./typica.w"
  2262. /*247:*/
  2263. #line 6125 "./typica.w"
  2264. void DAQImplementation::measure()
  2265. {
  2266. int samplesRead= 0;
  2267. double buffer[channels];
  2268. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2269. (unsigned long)(0),buffer,(unsigned long)(channels),
  2270. &samplesRead,(signed long)(0));
  2271. if(error)
  2272. {
  2273. ready= false;
  2274. }
  2275. else
  2276. {
  2277. if(samplesRead)
  2278. {
  2279. QTime time= QTime::currentTime();
  2280. for(int i= 0;i<samplesRead;i++)
  2281. {
  2282. for(int j= 0;j<channels;j++)
  2283. {
  2284. Measurement measure(buffer[j+(i*channels)],time,
  2285. unitMap[j]);
  2286. channelMap[j]->input(measure);
  2287. }
  2288. }
  2289. }
  2290. }
  2291. }
  2292. /*:247*//*248:*/
  2293. #line 6167 "./typica.w"
  2294. void DAQImplementation::run()
  2295. {
  2296. setPriority(QThread::TimeCriticalPriority);
  2297. while(ready)
  2298. {
  2299. measure();
  2300. }
  2301. }
  2302. /*:248*//*249:*/
  2303. #line 6183 "./typica.w"
  2304. void DAQ::threadFinished()
  2305. {
  2306. if(imp->error)
  2307. {
  2308. /*250:*/
  2309. #line 6234 "./typica.w"
  2310. imp->ready= false;
  2311. QMessageBox warning;
  2312. warning.setStandardButtons(QMessageBox::Cancel);
  2313. warning.setIcon(QMessageBox::Warning);
  2314. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2315. unsigned long bytes= imp->errorInfo(NULL,0);
  2316. char string[bytes];
  2317. imp->errorInfo(string,bytes);
  2318. warning.setInformativeText(QString(string));
  2319. warning.setWindowTitle(QString(PROGRAM_NAME));
  2320. warning.exec();
  2321. /*:250*/
  2322. #line 6188 "./typica.w"
  2323. }
  2324. }
  2325. /*:249*//*251:*/
  2326. #line 6259 "./typica.w"
  2327. void DAQ::start()
  2328. {
  2329. if(imp->ready)
  2330. {
  2331. imp->error= imp->startTask(imp->handle);
  2332. if(imp->error)
  2333. {
  2334. /*250:*/
  2335. #line 6234 "./typica.w"
  2336. imp->ready= false;
  2337. QMessageBox warning;
  2338. warning.setStandardButtons(QMessageBox::Cancel);
  2339. warning.setIcon(QMessageBox::Warning);
  2340. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2341. unsigned long bytes= imp->errorInfo(NULL,0);
  2342. char string[bytes];
  2343. imp->errorInfo(string,bytes);
  2344. warning.setInformativeText(QString(string));
  2345. warning.setWindowTitle(QString(PROGRAM_NAME));
  2346. warning.exec();
  2347. /*:250*/
  2348. #line 6267 "./typica.w"
  2349. }
  2350. else
  2351. {
  2352. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2353. imp->start();
  2354. }
  2355. }
  2356. }
  2357. void DAQ::stop()
  2358. {
  2359. if(imp->useBase)
  2360. {
  2361. imp->ready= false;
  2362. imp->wait(ULONG_MAX);
  2363. imp->stopTask(imp->handle);
  2364. }
  2365. else
  2366. {
  2367. imp->ready= false;
  2368. imp->error= imp->stopTask(imp->handle);
  2369. if(imp->error)
  2370. {
  2371. /*250:*/
  2372. #line 6234 "./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. /*:250*/
  2385. #line 6291 "./typica.w"
  2386. }
  2387. imp->error= imp->clearTask(imp->handle);
  2388. if(imp->error)
  2389. {
  2390. /*250:*/
  2391. #line 6234 "./typica.w"
  2392. imp->ready= false;
  2393. QMessageBox warning;
  2394. warning.setStandardButtons(QMessageBox::Cancel);
  2395. warning.setIcon(QMessageBox::Warning);
  2396. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2397. unsigned long bytes= imp->errorInfo(NULL,0);
  2398. char string[bytes];
  2399. imp->errorInfo(string,bytes);
  2400. warning.setInformativeText(QString(string));
  2401. warning.setWindowTitle(QString(PROGRAM_NAME));
  2402. warning.exec();
  2403. /*:250*/
  2404. #line 6296 "./typica.w"
  2405. }
  2406. }
  2407. }
  2408. /*:251*//*252:*/
  2409. #line 6306 "./typica.w"
  2410. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2411. {
  2412. imp->device= device;
  2413. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2414. if(imp->error)
  2415. {
  2416. /*250:*/
  2417. #line 6234 "./typica.w"
  2418. imp->ready= false;
  2419. QMessageBox warning;
  2420. warning.setStandardButtons(QMessageBox::Cancel);
  2421. warning.setIcon(QMessageBox::Warning);
  2422. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2423. unsigned long bytes= imp->errorInfo(NULL,0);
  2424. char string[bytes];
  2425. imp->errorInfo(string,bytes);
  2426. warning.setInformativeText(QString(string));
  2427. warning.setWindowTitle(QString(PROGRAM_NAME));
  2428. warning.exec();
  2429. /*:250*/
  2430. #line 6313 "./typica.w"
  2431. }
  2432. else
  2433. {
  2434. imp->ready= true;
  2435. }
  2436. }
  2437. /*:252*//*253:*/
  2438. #line 6327 "./typica.w"
  2439. Channel*DAQ::newChannel(int units,int thermocouple)
  2440. {
  2441. Channel*retval= new Channel();
  2442. imp->channelMap[imp->channels]= retval;
  2443. imp->unitMap[imp->channels]= (Measurement::TemperatureUnits)units;
  2444. imp->channels++;
  2445. if(imp->ready)
  2446. {
  2447. if(imp->useBase)
  2448. {
  2449. imp->error= imp->createChannel(imp->handle,
  2450. QString("%1/ai%2").arg(imp->device).
  2451. arg(imp->channels-1).
  2452. toAscii().data(),
  2453. "",(double)(-1.0),(double)(100.0),
  2454. (signed long)(units),
  2455. (signed long)(thermocouple),
  2456. (signed long)(10200),(double)(0),
  2457. "");
  2458. }
  2459. else
  2460. {
  2461. imp->error= imp->createChannel(imp->handle,
  2462. QString("%1/ai%2").arg(imp->device).
  2463. arg(imp->channels-1).
  2464. toAscii().data(),
  2465. "",(double)(50.0),(double)(500.0),
  2466. (signed long)(units),
  2467. (signed long)(thermocouple),
  2468. (signed long)(10200),(double)(0),
  2469. "");
  2470. }
  2471. if(imp->error)
  2472. {
  2473. /*250:*/
  2474. #line 6234 "./typica.w"
  2475. imp->ready= false;
  2476. QMessageBox warning;
  2477. warning.setStandardButtons(QMessageBox::Cancel);
  2478. warning.setIcon(QMessageBox::Warning);
  2479. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2480. unsigned long bytes= imp->errorInfo(NULL,0);
  2481. char string[bytes];
  2482. imp->errorInfo(string,bytes);
  2483. warning.setInformativeText(QString(string));
  2484. warning.setWindowTitle(QString(PROGRAM_NAME));
  2485. warning.exec();
  2486. /*:250*/
  2487. #line 6362 "./typica.w"
  2488. }
  2489. }
  2490. return retval;
  2491. }
  2492. /*:253*//*254:*/
  2493. #line 6376 "./typica.w"
  2494. void DAQ::setClockRate(double Hz)
  2495. {
  2496. if(imp->ready)
  2497. {
  2498. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2499. (signed long)(10280),(signed long)(10123),
  2500. (unsigned long long)(1));
  2501. if(imp->error)
  2502. {
  2503. /*250:*/
  2504. #line 6234 "./typica.w"
  2505. imp->ready= false;
  2506. QMessageBox warning;
  2507. warning.setStandardButtons(QMessageBox::Cancel);
  2508. warning.setIcon(QMessageBox::Warning);
  2509. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2510. unsigned long bytes= imp->errorInfo(NULL,0);
  2511. char string[bytes];
  2512. imp->errorInfo(string,bytes);
  2513. warning.setInformativeText(QString(string));
  2514. warning.setWindowTitle(QString(PROGRAM_NAME));
  2515. warning.exec();
  2516. /*:250*/
  2517. #line 6386 "./typica.w"
  2518. }
  2519. }
  2520. }
  2521. /*:254*//*255:*/
  2522. #line 6396 "./typica.w"
  2523. DAQ::~DAQ()
  2524. {
  2525. if(imp->useBase)
  2526. {
  2527. imp->resetDevice(imp->device.toAscii().data());
  2528. imp->clearTask(imp->handle);
  2529. }
  2530. else
  2531. {
  2532. if(imp->ready)
  2533. {
  2534. imp->ready= false;
  2535. imp->wait(ULONG_MAX);
  2536. imp->stopTask(imp->handle);
  2537. imp->resetDevice(imp->device.toAscii().data());
  2538. imp->clearTask(imp->handle);
  2539. }
  2540. }
  2541. delete imp;
  2542. }
  2543. /*:255*//*256:*/
  2544. #line 6427 "./typica.w"
  2545. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2546. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2547. unitMap(4)
  2548. {
  2549. if(driverinfo=="nidaqmxbase")
  2550. {
  2551. useBase= true;
  2552. }
  2553. else
  2554. {
  2555. useBase= false;
  2556. }
  2557. if(useBase)
  2558. {
  2559. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2560. if(!driver.load())
  2561. {
  2562. driver.setFileName("nidaqmxbase");
  2563. if(!driver.load())
  2564. {
  2565. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2566. tr("Failed to find nidaqmxbase. Please install it."));
  2567. QApplication::quit();
  2568. }
  2569. }
  2570. }
  2571. else
  2572. {
  2573. driver.setFileName("nicaiu");
  2574. if(!driver.load())
  2575. {
  2576. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2577. tr("Failed to find nidaqmx. Please install it."));
  2578. QApplication::quit();
  2579. }
  2580. }
  2581. if(useBase)
  2582. {
  2583. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2584. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2585. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2586. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2587. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2588. ==0||
  2589. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2590. 0||
  2591. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2592. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2593. 0||
  2594. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2595. {
  2596. waitForMeasurement= NULL;
  2597. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2598. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2599. QApplication::quit();
  2600. }
  2601. }
  2602. else
  2603. {
  2604. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2605. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2606. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2607. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2608. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2609. ==0||
  2610. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2611. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2612. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2613. 0||
  2614. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2615. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2616. {
  2617. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2618. tr("Failed to link a required symbol in NI-DAQmx."));
  2619. QApplication::quit();
  2620. }
  2621. }
  2622. }
  2623. DAQImplementation::~DAQImplementation()
  2624. {
  2625. driver.unload();
  2626. }
  2627. /*:256*/
  2628. #line 773 "./typica.w"
  2629. /*263:*/
  2630. #line 6629 "./typica.w"
  2631. void FakeDAQImplementation::measure()
  2632. {
  2633. msleep((int)(1000/clockRate));
  2634. QTime time= QTime::currentTime();
  2635. for(int i= 0;i<channels;i++)
  2636. {
  2637. Measurement measure(qrand()%500,time);
  2638. channelMap[i]->input(measure);
  2639. }
  2640. }
  2641. /*:263*//*264:*/
  2642. #line 6643 "./typica.w"
  2643. void FakeDAQImplementation::run()
  2644. {
  2645. setPriority(QThread::TimeCriticalPriority);
  2646. while(ready)
  2647. {
  2648. measure();
  2649. }
  2650. }
  2651. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  2652. channels(0),ready(false),clockRate(1)
  2653. {
  2654. }
  2655. FakeDAQImplementation::~FakeDAQImplementation()
  2656. {
  2657. }
  2658. /*:264*//*265:*/
  2659. #line 6668 "./typica.w"
  2660. void FakeDAQ::start()
  2661. {
  2662. if(imp->ready)
  2663. {
  2664. imp->start();
  2665. }
  2666. }
  2667. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  2668. {
  2669. imp->ready= true;
  2670. }
  2671. Channel*FakeDAQ::newChannel(int,int)
  2672. {
  2673. Channel*retval;
  2674. if(imp->ready)
  2675. {
  2676. retval= new Channel();
  2677. imp->channelMap[imp->channels]= retval;
  2678. imp->channels++;
  2679. }
  2680. else
  2681. {
  2682. return NULL;
  2683. }
  2684. return retval;
  2685. }
  2686. void FakeDAQ::setClockRate(double Hz)
  2687. {
  2688. if(imp->ready)
  2689. {
  2690. imp->clockRate= Hz;
  2691. }
  2692. }
  2693. FakeDAQ::~FakeDAQ()
  2694. {
  2695. imp->ready= false;
  2696. imp->wait(ULONG_MAX);
  2697. delete imp;
  2698. }
  2699. /*:265*/
  2700. #line 774 "./typica.w"
  2701. /*270:*/
  2702. #line 6799 "./typica.w"
  2703. Channel::Channel():QObject(NULL)
  2704. {
  2705. }
  2706. Channel::~Channel()
  2707. {
  2708. }
  2709. void Channel::input(Measurement measurement)
  2710. {
  2711. emit newData(measurement);
  2712. }
  2713. /*:270*/
  2714. #line 775 "./typica.w"
  2715. /*286:*/
  2716. #line 7210 "./typica.w"
  2717. void TemperatureDisplay::setValue(Measurement temperature)
  2718. {
  2719. QString number;
  2720. switch(unit)
  2721. {
  2722. case Auto:
  2723. switch(temperature.scale())
  2724. {
  2725. case Fahrenheit:
  2726. display(QString("%1'F").
  2727. arg(number.setNum(temperature.temperature(),'f',2)));
  2728. break;
  2729. case Celsius:
  2730. display(QString("%1'C").
  2731. arg(number.setNum(temperature.temperature(),'f',2)));
  2732. break;
  2733. case Kelvin:
  2734. display(QString("%1").
  2735. arg(number.setNum(temperature.temperature(),'f',2)));
  2736. break;
  2737. case Rankine:
  2738. display(QString("%1'r").
  2739. arg(number.setNum(temperature.temperature(),'f',2)));
  2740. break;
  2741. }
  2742. break;
  2743. case Fahrenheit:
  2744. display(QString("%1'F").
  2745. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  2746. 2)));
  2747. break;
  2748. case Celsius:
  2749. display(QString("%1'C").
  2750. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  2751. 2)));
  2752. break;
  2753. case Kelvin:
  2754. display(QString("%1").
  2755. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  2756. 2)));
  2757. break;
  2758. case Rankine:
  2759. display(QString("%1'r").
  2760. arg(number.setNum(temperature.toRankine().temperature(),'f',
  2761. 2)));
  2762. break;
  2763. }
  2764. }
  2765. /*:286*//*287:*/
  2766. #line 7270 "./typica.w"
  2767. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  2768. QLCDNumber(8,parent),unit(Auto)
  2769. {
  2770. setSegmentStyle(Filled);
  2771. display("---.--'F");
  2772. }
  2773. /*:287*//*288:*/
  2774. #line 7286 "./typica.w"
  2775. void TemperatureDisplay::invalidate()
  2776. {
  2777. display("---.--'F");
  2778. }
  2779. /*:288*//*289:*/
  2780. #line 7298 "./typica.w"
  2781. void TemperatureDisplay::setDisplayUnits(DisplayUnits scale)
  2782. {
  2783. unit= scale;
  2784. }
  2785. /*:289*//*290:*/
  2786. #line 7306 "./typica.w"
  2787. TemperatureDisplay::~TemperatureDisplay()
  2788. {
  2789. }
  2790. /*:290*/
  2791. #line 776 "./typica.w"
  2792. /*295:*/
  2793. #line 7386 "./typica.w"
  2794. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  2795. {
  2796. if(measure.time()<epoch)
  2797. {
  2798. if(hasPrevious)
  2799. {
  2800. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  2801. epoch.msec());
  2802. QTime jitComp(epoch.hour(),measure.time().minute(),
  2803. measure.time().second(),measure.time().msec());
  2804. int relTime= jitBase.msecsTo(jitComp);
  2805. /*296:*/
  2806. #line 7419 "./typica.w"
  2807. QTime newTime(0,0,0,0);
  2808. newTime= newTime.addMSecs(relTime);
  2809. if(newTime.hour()> 0)
  2810. {
  2811. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2812. }
  2813. Measurement rel(measure.temperature(),newTime);
  2814. emit measurement(rel);
  2815. /*:296*/
  2816. #line 7398 "./typica.w"
  2817. }
  2818. else
  2819. {
  2820. Measurement rel(measure.temperature(),QTime(0,0,0,0));
  2821. emit measurement(rel);
  2822. }
  2823. }
  2824. else
  2825. {
  2826. int relTime= epoch.msecsTo(measure.time());
  2827. /*296:*/
  2828. #line 7419 "./typica.w"
  2829. QTime newTime(0,0,0,0);
  2830. newTime= newTime.addMSecs(relTime);
  2831. if(newTime.hour()> 0)
  2832. {
  2833. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2834. }
  2835. Measurement rel(measure.temperature(),newTime);
  2836. emit measurement(rel);
  2837. /*:296*/
  2838. #line 7409 "./typica.w"
  2839. }
  2840. hasPrevious= true;
  2841. previous= measure.time();
  2842. }
  2843. /*:295*//*297:*/
  2844. #line 7431 "./typica.w"
  2845. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  2846. previous(0,0,0,0),hasPrevious(false)
  2847. {
  2848. }
  2849. QTime MeasurementTimeOffset::zeroTime()
  2850. {
  2851. return epoch;
  2852. }
  2853. void MeasurementTimeOffset::setZeroTime(QTime zero)
  2854. {
  2855. epoch= zero;
  2856. hasPrevious= false;
  2857. }
  2858. /*:297*/
  2859. #line 777 "./typica.w"
  2860. /*307:*/
  2861. #line 7628 "./typica.w"
  2862. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn),
  2863. temp(0)
  2864. {
  2865. }
  2866. int ZeroEmitter::column()
  2867. {
  2868. return col;
  2869. }
  2870. double ZeroEmitter::lastTemperature()
  2871. {
  2872. return temp;
  2873. }
  2874. void ZeroEmitter::newMeasurement(Measurement measure)
  2875. {
  2876. temp= measure.temperature();
  2877. }
  2878. void ZeroEmitter::setColumn(int column)
  2879. {
  2880. col= column;
  2881. }
  2882. void ZeroEmitter::emitZero()
  2883. {
  2884. emit measurement(Measurement(temp,QTime(0,0,0,0)),col);
  2885. }
  2886. /*:307*/
  2887. #line 778 "./typica.w"
  2888. /*312:*/
  2889. #line 7718 "./typica.w"
  2890. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  2891. {
  2892. }
  2893. int MeasurementAdapter::column()
  2894. {
  2895. return col;
  2896. }
  2897. void MeasurementAdapter::newMeasurement(Measurement measure)
  2898. {
  2899. emit measurement(measure,col);
  2900. }
  2901. void MeasurementAdapter::setColumn(int column)
  2902. {
  2903. col= column;
  2904. }
  2905. /*:312*/
  2906. #line 779 "./typica.w"
  2907. /*317:*/
  2908. #line 7834 "./typica.w"
  2909. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  2910. theScene(new QGraphicsScene),
  2911. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  2912. prevPoints(new QMap<int,QPointF> ),
  2913. translations(new QMap<int,double> ),
  2914. gridLinesF(new QList<QGraphicsItem*> ),
  2915. gridLinesC(new QList<QGraphicsItem*> )
  2916. {
  2917. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2918. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2919. setScene(theScene);
  2920. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  2921. /*318:*/
  2922. #line 7862 "./typica.w"
  2923. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  2924. tempaxis->setLine(-10,-500,-10,0);
  2925. theScene->addItem(tempaxis);
  2926. QGraphicsLineItem*gridLine;
  2927. QGraphicsTextItem*label;
  2928. for(int y= -100;y> -600;y-= 100)
  2929. {
  2930. gridLine= new QGraphicsLineItem;
  2931. gridLine->setLine(0,y,1200,y);
  2932. theScene->addItem(gridLine);
  2933. label= new QGraphicsTextItem;
  2934. label->setHtml(QString("%1&deg;F").arg(-y));
  2935. label->setPos(-55,y-(label->boundingRect().height()/2));
  2936. theScene->addItem(label);
  2937. gridLinesF->append(gridLine);
  2938. gridLinesF->append(label);
  2939. }
  2940. for(int degC= 50;degC<=250;degC+= 50)
  2941. {
  2942. gridLine= new QGraphicsLineItem;
  2943. int y= -(degC*(9.0/5.0)+32);
  2944. gridLine->setLine(0,y,1200,y);
  2945. gridLine->hide();
  2946. theScene->addItem(gridLine);
  2947. gridLinesC->append(gridLine);
  2948. label= new QGraphicsTextItem;
  2949. label->setHtml(QString("%1&deg;C").arg(degC));
  2950. label->setPos(-55,y-(label->boundingRect().height()/2));
  2951. label->hide();
  2952. theScene->addItem(label);
  2953. gridLinesC->append(label);
  2954. }
  2955. /*:318*/
  2956. #line 7847 "./typica.w"
  2957. ;
  2958. /*320:*/
  2959. #line 7928 "./typica.w"
  2960. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  2961. timeaxis->setLine(0,10,1200,10);
  2962. theScene->addItem(timeaxis);
  2963. for(int x= 0;x<1201;x+= 120)
  2964. {
  2965. QGraphicsLineItem*tick= new QGraphicsLineItem;
  2966. tick->setLine(x,0,x,20);
  2967. theScene->addItem(tick);
  2968. QGraphicsTextItem*label= new QGraphicsTextItem;
  2969. label->setPlainText(QString("%1").arg(x/60));
  2970. label->setPos(x-(label->boundingRect().width()/2),20);
  2971. theScene->addItem(label);
  2972. }
  2973. /*:320*/
  2974. #line 7848 "./typica.w"
  2975. ;
  2976. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2977. }
  2978. /*:317*//*319:*/
  2979. #line 7898 "./typica.w"
  2980. void GraphView::showF()
  2981. {
  2982. for(int i= 0;i<gridLinesF->size();i++)
  2983. {
  2984. gridLinesF->at(i)->show();
  2985. }
  2986. for(int i= 0;i<gridLinesC->size();i++)
  2987. {
  2988. gridLinesC->at(i)->hide();
  2989. }
  2990. }
  2991. void GraphView::showC()
  2992. {
  2993. for(int i= 0;i<gridLinesF->size();i++)
  2994. {
  2995. gridLinesF->at(i)->hide();
  2996. }
  2997. for(int i= 0;i<gridLinesC->size();i++)
  2998. {
  2999. gridLinesC->at(i)->show();
  3000. }
  3001. }
  3002. /*:319*//*321:*/
  3003. #line 7947 "./typica.w"
  3004. void GraphView::resizeEvent(QResizeEvent*)
  3005. {
  3006. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3007. }
  3008. /*:321*//*322:*/
  3009. #line 7958 "./typica.w"
  3010. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  3011. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  3012. {
  3013. double offset= 0;
  3014. if(translations->contains(tempcolumn))
  3015. {
  3016. offset= translations->value(tempcolumn);
  3017. }
  3018. if(prevPoints->contains(tempcolumn))
  3019. {
  3020. /*324:*/
  3021. #line 8017 "./typica.w"
  3022. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3023. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3024. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3025. -(prevPoints->value(tempcolumn).y()),
  3026. nextPoint.x()+offset,-(nextPoint.y()));
  3027. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3028. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3029. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3030. Qt::darkYellow};
  3031. segment->setPen(p[tempcolumn%12]);
  3032. theScene->addItem(segment);
  3033. prevPoints->insert(tempcolumn,nextPoint);
  3034. /*:324*/
  3035. #line 7970 "./typica.w"
  3036. if(graphLines->contains(tempcolumn))
  3037. {
  3038. graphLines->value(tempcolumn)->append(segment);
  3039. }
  3040. else
  3041. {
  3042. QList<QGraphicsLineItem*> *newLine=
  3043. new QList<QGraphicsLineItem*> ;
  3044. newLine->append(segment);
  3045. graphLines->insert(tempcolumn,newLine);
  3046. }
  3047. }
  3048. else
  3049. {
  3050. /*323:*/
  3051. #line 8006 "./typica.w"
  3052. int x= FULLTIMETOINT(measure.time())/1000;
  3053. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3054. /*:323*/
  3055. #line 7987 "./typica.w"
  3056. }
  3057. }
  3058. /*:322*//*325:*/
  3059. #line 8034 "./typica.w"
  3060. void GraphView::clear()
  3061. {
  3062. int i;
  3063. foreach(i,prevPoints->keys())
  3064. {
  3065. removeSeries(i);
  3066. }
  3067. translations->clear();
  3068. }
  3069. /*:325*//*326:*/
  3070. #line 8048 "./typica.w"
  3071. void GraphView::removeSeries(int column)
  3072. {
  3073. if(graphLines->contains(column))
  3074. {
  3075. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3076. QGraphicsLineItem*segment;
  3077. foreach(segment,*series)
  3078. {
  3079. theScene->removeItem(segment);
  3080. }
  3081. qDeleteAll(*series);
  3082. }
  3083. graphLines->remove(column);
  3084. prevPoints->remove(column);
  3085. }
  3086. /*:326*//*327:*/
  3087. #line 8067 "./typica.w"
  3088. void GraphView::setSeriesTranslation(int column,double offset)
  3089. {
  3090. if(graphLines->contains(column))
  3091. {
  3092. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3093. QGraphicsLineItem*segment;
  3094. foreach(segment,*series)
  3095. {
  3096. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3097. }
  3098. }
  3099. if(translations->contains(column))
  3100. {
  3101. translations->insert(column,offset+translations->value(column));
  3102. }
  3103. else
  3104. {
  3105. translations->insert(column,offset);
  3106. }
  3107. }
  3108. /*:327*/
  3109. #line 780 "./typica.w"
  3110. /*333:*/
  3111. #line 8217 "./typica.w"
  3112. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3113. {
  3114. if(measure.time()!=QTime(0,0,0,0))
  3115. {
  3116. /*335:*/
  3117. #line 8291 "./typica.w"
  3118. if(lastMeasurement[tempcolumn].time()<measure.time())
  3119. {
  3120. QList<QTime> timelist;
  3121. for(QTime i= lastMeasurement[tempcolumn].time().addSecs(1);i<measure.time();i= i.addSecs(1))
  3122. {
  3123. timelist.append(i);
  3124. }
  3125. for(int i= 0;i<timelist.size();i++)
  3126. {
  3127. newMeasurement(Measurement(measure.temperature(),timelist[i],measure.scale()),tempcolumn);
  3128. }
  3129. }
  3130. /*:335*/
  3131. #line 8222 "./typica.w"
  3132. }
  3133. model_ms->newMeasurement(measure,tempcolumn);
  3134. if(lastMeasurement.contains(tempcolumn))
  3135. {
  3136. if(measure.time().second()!=
  3137. lastMeasurement.value(tempcolumn).time().second())
  3138. {
  3139. Measurement adjusted(measure.temperature(),
  3140. QTime(0,measure.time().minute(),
  3141. measure.time().second(),0));
  3142. model_1s->newMeasurement(adjusted,tempcolumn);
  3143. if(adjusted.time().second()%5==0)
  3144. {
  3145. model_5s->newMeasurement(adjusted,tempcolumn);
  3146. if(adjusted.time().second()%10==0)
  3147. {
  3148. model_10s->newMeasurement(adjusted,tempcolumn);
  3149. }
  3150. if(adjusted.time().second()%15==0)
  3151. {
  3152. model_15s->newMeasurement(adjusted,tempcolumn);
  3153. if(adjusted.time().second()%30==0)
  3154. {
  3155. model_30s->newMeasurement(adjusted,tempcolumn);
  3156. if(adjusted.time().second()==0)
  3157. {
  3158. model_1m->newMeasurement(adjusted,tempcolumn);
  3159. }
  3160. }
  3161. }
  3162. }
  3163. }
  3164. /*337:*/
  3165. #line 8330 "./typica.w"
  3166. if(currentColumnSet.contains(tempcolumn))
  3167. {
  3168. int replicationcolumn;
  3169. foreach(replicationcolumn,currentColumnSet)
  3170. {
  3171. if(replicationcolumn!=tempcolumn)
  3172. {
  3173. if(lastMeasurement.contains(replicationcolumn))
  3174. {
  3175. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3176. {
  3177. Measurement synthetic(lastMeasurement.value(replicationcolumn).temperature(),
  3178. measure.time());
  3179. model_ms->newMeasurement(synthetic,replicationcolumn);
  3180. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3181. {
  3182. Measurement adjusted(synthetic.temperature(),QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3183. model_1s->newMeasurement(adjusted,replicationcolumn);
  3184. if(adjusted.time().second()%5==0)
  3185. {
  3186. model_5s->newMeasurement(adjusted,replicationcolumn);
  3187. if(adjusted.time().second()%10==0)
  3188. {
  3189. model_10s->newMeasurement(adjusted,replicationcolumn);
  3190. }
  3191. if(adjusted.time().second()%15==0)
  3192. {
  3193. model_15s->newMeasurement(adjusted,replicationcolumn);
  3194. if(adjusted.time().second()%30==0)
  3195. {
  3196. model_30s->newMeasurement(adjusted,replicationcolumn);
  3197. if(adjusted.time().second()==0)
  3198. {
  3199. model_1m->newMeasurement(adjusted,replicationcolumn);
  3200. }
  3201. }
  3202. }
  3203. }
  3204. }
  3205. lastMeasurement[replicationcolumn]= synthetic;
  3206. }
  3207. }
  3208. }
  3209. }
  3210. }
  3211. /*:337*/
  3212. #line 8255 "./typica.w"
  3213. }
  3214. else
  3215. {
  3216. /*334:*/
  3217. #line 8267 "./typica.w"
  3218. MeasurementModel*m;
  3219. foreach(m,modelSet)
  3220. {
  3221. m->newMeasurement(measure,tempcolumn);
  3222. }
  3223. /*:334*/
  3224. #line 8259 "./typica.w"
  3225. }
  3226. lastMeasurement[tempcolumn]= measure;
  3227. }
  3228. /*:333*//*336:*/
  3229. #line 8316 "./typica.w"
  3230. void ZoomLog::addToCurrentColumnSet(int column)
  3231. {
  3232. currentColumnSet.append(column);
  3233. }
  3234. void ZoomLog::clearCurrentColumnSet()
  3235. {
  3236. currentColumnSet.clear();
  3237. }
  3238. /*:336*//*338:*/
  3239. #line 8399 "./typica.w"
  3240. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3241. int annotationcolumn)
  3242. {
  3243. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3244. MeasurementModel*m;
  3245. if(lastMeasurement.contains(tempcolumn))
  3246. {
  3247. foreach(m,modelSet)
  3248. {
  3249. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3250. }
  3251. }
  3252. foreach(m,modelSet)
  3253. {
  3254. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3255. }
  3256. }
  3257. /*:338*//*339:*/
  3258. #line 8423 "./typica.w"
  3259. void ZoomLog::centerOn(int row)
  3260. {
  3261. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  3262. }
  3263. /*:339*//*340:*/
  3264. #line 8433 "./typica.w"
  3265. void ZoomLog::clear()
  3266. {
  3267. MeasurementModel*m;
  3268. foreach(m,modelSet)
  3269. {
  3270. m->clear();
  3271. }
  3272. lastMeasurement.clear();
  3273. saveTempCols.clear();
  3274. saveNoteCols.clear();
  3275. }
  3276. /*:340*//*341:*/
  3277. #line 8450 "./typica.w"
  3278. QVariant ZoomLog::data(int row,int column)const
  3279. {
  3280. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  3281. Qt::DisplayRole);
  3282. }
  3283. int ZoomLog::rowCount()
  3284. {
  3285. return model_ms->rowCount();
  3286. }
  3287. /*:341*//*342:*/
  3288. #line 8473 "./typica.w"
  3289. bool ZoomLog::saveXML(QIODevice*device)
  3290. {
  3291. int prevUnits= model_ms->displayUnits();
  3292. if(prevUnits!=10144)
  3293. {
  3294. model_ms->setDisplayUnits(10144);
  3295. }
  3296. XMLOutput writer(model_ms,device,0);
  3297. int c;
  3298. foreach(c,saveTempCols)
  3299. {
  3300. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3301. toString(),c);
  3302. }
  3303. foreach(c,saveNoteCols)
  3304. {
  3305. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3306. toString(),c);
  3307. }
  3308. bool retval= writer.output();
  3309. if(prevUnits!=10144)
  3310. {
  3311. model_ms->setDisplayUnits(prevUnits);
  3312. }
  3313. return retval;
  3314. }
  3315. /*:342*//*343:*/
  3316. #line 8504 "./typica.w"
  3317. bool ZoomLog::saveCSV(QIODevice*device)
  3318. {
  3319. CSVOutput writer(currentModel,device,0);
  3320. int c;
  3321. foreach(c,saveTempCols)
  3322. {
  3323. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3324. toString(),c);
  3325. }
  3326. foreach(c,saveNoteCols)
  3327. {
  3328. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3329. toString(),c);
  3330. }
  3331. return writer.output();
  3332. }
  3333. /*:343*//*344:*/
  3334. #line 8528 "./typica.w"
  3335. void ZoomLog::switchLOD(MeasurementModel*m)
  3336. {
  3337. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  3338. setModel(m);
  3339. currentModel= m;
  3340. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3341. }
  3342. void ZoomLog::LOD_ms()
  3343. {
  3344. switchLOD(model_ms);
  3345. }
  3346. void ZoomLog::LOD_1s()
  3347. {
  3348. switchLOD(model_1s);
  3349. }
  3350. void ZoomLog::LOD_5s()
  3351. {
  3352. switchLOD(model_5s);
  3353. }
  3354. void ZoomLog::LOD_10s()
  3355. {
  3356. switchLOD(model_10s);
  3357. }
  3358. void ZoomLog::LOD_15s()
  3359. {
  3360. switchLOD(model_15s);
  3361. }
  3362. void ZoomLog::LOD_30s()
  3363. {
  3364. switchLOD(model_30s);
  3365. }
  3366. void ZoomLog::LOD_1m()
  3367. {
  3368. switchLOD(model_1m);
  3369. }
  3370. /*:344*//*345:*/
  3371. #line 8576 "./typica.w"
  3372. void ZoomLog::setDisplayUnits(int scale)
  3373. {
  3374. model_ms->setDisplayUnits(scale);
  3375. model_1s->setDisplayUnits(scale);
  3376. model_5s->setDisplayUnits(scale);
  3377. model_10s->setDisplayUnits(scale);
  3378. model_15s->setDisplayUnits(scale);
  3379. model_30s->setDisplayUnits(scale);
  3380. model_1m->setDisplayUnits(scale);
  3381. }
  3382. int ZoomLog::displayUnits()
  3383. {
  3384. return model_ms->displayUnits();
  3385. }
  3386. /*:345*//*346:*/
  3387. #line 8596 "./typica.w"
  3388. QString ZoomLog::lastTime(int series)
  3389. {
  3390. Measurement measure= lastMeasurement.value(series);
  3391. QTime time= measure.time();
  3392. return time.toString("h:mm:ss.zzz");
  3393. }
  3394. /*:346*//*347:*/
  3395. #line 8606 "./typica.w"
  3396. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  3397. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  3398. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  3399. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  3400. {
  3401. setEditTriggers(QAbstractItemView::NoEditTriggers);
  3402. setSelectionMode(QAbstractItemView::NoSelection);
  3403. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  3404. model_30s<<model_1m;
  3405. currentModel= model_30s;
  3406. setModel(currentModel);
  3407. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3408. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  3409. this,SLOT(persistColumnResize(int,int,int)));
  3410. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  3411. this,SLOT(restoreColumnWidths()));
  3412. }
  3413. /*:347*//*348:*/
  3414. #line 8629 "./typica.w"
  3415. void ZoomLog::setHeaderData(int section,QString text)
  3416. {
  3417. MeasurementModel*m;
  3418. foreach(m,modelSet)
  3419. {
  3420. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  3421. }
  3422. }
  3423. /*:348*//*349:*/
  3424. #line 8643 "./typica.w"
  3425. void ZoomLog::addOutputTemperatureColumn(int column)
  3426. {
  3427. saveTempCols.append(column);
  3428. }
  3429. void ZoomLog::addOutputAnnotationColumn(int column)
  3430. {
  3431. saveNoteCols.append(column);
  3432. }
  3433. void ZoomLog::clearOutputColumns()
  3434. {
  3435. saveTempCols.clear();
  3436. saveNoteCols.clear();
  3437. }
  3438. /*:349*//*350:*/
  3439. #line 8663 "./typica.w"
  3440. void ZoomLog::persistColumnResize(int column,int,int newsize)
  3441. {
  3442. /*541:*/
  3443. #line 12654 "./typica.w"
  3444. QSettings settings;
  3445. /*542:*/
  3446. #line 12667 "./typica.w"
  3447. QWidget*topLevelWidget= this;
  3448. while(topLevelWidget->parentWidget())
  3449. {
  3450. topLevelWidget= topLevelWidget->parentWidget();
  3451. }
  3452. /*:542*/
  3453. #line 12656 "./typica.w"
  3454. settings.setValue(QString("columnWidths/%1/%2/%3").
  3455. arg(topLevelWidget->objectName()).
  3456. arg(objectName()).arg(column),
  3457. QVariant(newsize));
  3458. /*:541*/
  3459. #line 8666 "./typica.w"
  3460. }
  3461. void ZoomLog::restoreColumnWidths()
  3462. {
  3463. /*544:*/
  3464. #line 12687 "./typica.w"
  3465. QSettings settings;
  3466. /*542:*/
  3467. #line 12667 "./typica.w"
  3468. QWidget*topLevelWidget= this;
  3469. while(topLevelWidget->parentWidget())
  3470. {
  3471. topLevelWidget= topLevelWidget->parentWidget();
  3472. }
  3473. /*:542*/
  3474. #line 12689 "./typica.w"
  3475. QString baseKey=
  3476. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3477. arg(objectName());
  3478. for(int i= 0;i<model()->columnCount();i++)
  3479. {
  3480. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3481. if(settings.contains(key))
  3482. {
  3483. setColumnWidth(i,settings.value(key).toInt());
  3484. }
  3485. }
  3486. /*:544*/
  3487. #line 8671 "./typica.w"
  3488. }
  3489. void ZoomLog::setVisible(bool visibility)
  3490. {
  3491. QTableView::setVisible(visibility);
  3492. }
  3493. void ZoomLog::showEvent(QShowEvent*)
  3494. {
  3495. /*544:*/
  3496. #line 12687 "./typica.w"
  3497. QSettings settings;
  3498. /*542:*/
  3499. #line 12667 "./typica.w"
  3500. QWidget*topLevelWidget= this;
  3501. while(topLevelWidget->parentWidget())
  3502. {
  3503. topLevelWidget= topLevelWidget->parentWidget();
  3504. }
  3505. /*:542*/
  3506. #line 12689 "./typica.w"
  3507. QString baseKey=
  3508. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3509. arg(objectName());
  3510. for(int i= 0;i<model()->columnCount();i++)
  3511. {
  3512. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3513. if(settings.contains(key))
  3514. {
  3515. setColumnWidth(i,settings.value(key).toInt());
  3516. }
  3517. }
  3518. /*:544*/
  3519. #line 8681 "./typica.w"
  3520. }
  3521. /*:350*/
  3522. #line 781 "./typica.w"
  3523. /*358:*/
  3524. #line 8903 "./typica.w"
  3525. bool MeasurementList::operator<(const MeasurementList&other)const
  3526. {
  3527. return this->first().toTime()<other.first().toTime();
  3528. }
  3529. bool MeasurementList::operator==(const MeasurementList&other)const
  3530. {
  3531. return this->first().toTime()==other.first().toTime();
  3532. }
  3533. /*:358*//*359:*/
  3534. #line 8919 "./typica.w"
  3535. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  3536. {
  3537. return QModelIndex();
  3538. }
  3539. /*:359*//*360:*/
  3540. #line 8929 "./typica.w"
  3541. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  3542. {
  3543. MeasurementList*temp;
  3544. temp= new MeasurementList;
  3545. temp->append(QVariant(measure.time()));
  3546. /*361:*/
  3547. #line 8980 "./typica.w"
  3548. /*362:*/
  3549. #line 9025 "./typica.w"
  3550. QList<MeasurementList*> ::iterator i= lastInsertion;
  3551. bool quickscan= false;
  3552. if(entries->size()> 5)
  3553. {
  3554. if(**i<*temp)
  3555. {
  3556. i+= 1;
  3557. for(int j= 10;j> 0;j--)
  3558. {
  3559. if(i!=entries->end())
  3560. {
  3561. if(**i<*temp)
  3562. {
  3563. i+= 1;
  3564. }
  3565. else
  3566. {
  3567. quickscan= true;
  3568. break;
  3569. }
  3570. }
  3571. else
  3572. {
  3573. quickscan= true;
  3574. break;
  3575. }
  3576. }
  3577. }
  3578. else
  3579. {
  3580. if(**i==*temp)
  3581. {
  3582. quickscan= true;
  3583. }
  3584. }
  3585. }
  3586. /*:362*/
  3587. #line 8981 "./typica.w"
  3588. if(quickscan==false)
  3589. {
  3590. i= entries->begin();
  3591. QList<MeasurementList*> ::iterator u= entries->end();
  3592. QList<MeasurementList*> ::iterator midpoint;
  3593. int n= u-i;
  3594. int rA;
  3595. while(n> 0)
  3596. {
  3597. rA= n>>1;
  3598. midpoint= i+rA;
  3599. if(**midpoint<*temp)
  3600. {
  3601. i= midpoint+1;
  3602. n-= rA+1;
  3603. }
  3604. else
  3605. {
  3606. n= rA;
  3607. }
  3608. }
  3609. }
  3610. /*:361*/
  3611. #line 8935 "./typica.w"
  3612. MeasurementList*newEntry;
  3613. int insertion;
  3614. if(i!=entries->end())
  3615. {
  3616. insertion= entries->indexOf(*i);
  3617. if((*i)->first().toTime()==measure.time())
  3618. {
  3619. /*363:*/
  3620. #line 9067 "./typica.w"
  3621. if((*i)->size()<tempcolumn+1)
  3622. {
  3623. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  3624. {
  3625. (*i)->append(QVariant());
  3626. }
  3627. }
  3628. (*i)->replace(tempcolumn,measure.temperature());
  3629. lastInsertion= i;
  3630. emit dataChanged(createIndex(insertion,tempcolumn),
  3631. createIndex(insertion,tempcolumn));
  3632. lastTemperature->insert(tempcolumn,insertion);
  3633. /*:363*/
  3634. #line 8943 "./typica.w"
  3635. }
  3636. else
  3637. {
  3638. /*364:*/
  3639. #line 9085 "./typica.w"
  3640. beginInsertRows(QModelIndex(),insertion,insertion);
  3641. newEntry= new MeasurementList;
  3642. newEntry->append(QVariant(measure.time()));
  3643. for(int j= 0;j<tempcolumn+1;j++)
  3644. {
  3645. newEntry->append(QVariant());
  3646. }
  3647. newEntry->replace(tempcolumn,measure.temperature());
  3648. lastInsertion= entries->insert(i,newEntry);
  3649. endInsertRows();
  3650. lastTemperature->insert(tempcolumn,insertion);
  3651. /*:364*/
  3652. #line 8947 "./typica.w"
  3653. }
  3654. }
  3655. else
  3656. {
  3657. /*365:*/
  3658. #line 9103 "./typica.w"
  3659. insertion= entries->size();
  3660. /*364:*/
  3661. #line 9085 "./typica.w"
  3662. beginInsertRows(QModelIndex(),insertion,insertion);
  3663. newEntry= new MeasurementList;
  3664. newEntry->append(QVariant(measure.time()));
  3665. for(int j= 0;j<tempcolumn+1;j++)
  3666. {
  3667. newEntry->append(QVariant());
  3668. }
  3669. newEntry->replace(tempcolumn,measure.temperature());
  3670. lastInsertion= entries->insert(i,newEntry);
  3671. endInsertRows();
  3672. lastTemperature->insert(tempcolumn,insertion);
  3673. /*:364*/
  3674. #line 9105 "./typica.w"
  3675. /*:365*/
  3676. #line 8952 "./typica.w"
  3677. }
  3678. if(tempcolumn>=colcount)
  3679. {
  3680. colcount= tempcolumn+1;
  3681. }
  3682. emit rowChanged(insertion);
  3683. delete temp;
  3684. }
  3685. /*:360*//*366:*/
  3686. #line 9114 "./typica.w"
  3687. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  3688. int annotationColumn)
  3689. {
  3690. int r;
  3691. if(lastTemperature->contains(tempcolumn))
  3692. {
  3693. r= lastTemperature->value(tempcolumn);
  3694. }
  3695. else
  3696. {
  3697. r= 0;
  3698. }
  3699. if(r==0&&entries->size()==0)
  3700. {
  3701. /*367:*/
  3702. #line 9152 "./typica.w"
  3703. beginInsertRows(QModelIndex(),0,0);
  3704. MeasurementList*newEntry= new MeasurementList;
  3705. newEntry->append(QVariant(QTime(0,0,0,0)));
  3706. entries->append(newEntry);
  3707. endInsertRows();
  3708. /*:367*/
  3709. #line 9129 "./typica.w"
  3710. }
  3711. MeasurementList*row= entries->at(r);
  3712. if(row->size()<=annotationColumn)
  3713. {
  3714. for(int i= row->size()-1;i<annotationColumn+1;i++)
  3715. {
  3716. row->append(QVariant());
  3717. }
  3718. }
  3719. row->replace(annotationColumn,annotation);
  3720. emit dataChanged(createIndex(r,annotationColumn),
  3721. createIndex(r,annotationColumn));
  3722. emit rowChanged(r);
  3723. if(annotationColumn> colcount-1)
  3724. {
  3725. colcount= annotationColumn+1;
  3726. }
  3727. }
  3728. /*:366*//*368:*/
  3729. #line 9163 "./typica.w"
  3730. void MeasurementModel::clear()
  3731. {
  3732. beginRemoveRows(QModelIndex(),0,entries->size());
  3733. while(entries->size()!=0)
  3734. {
  3735. MeasurementList*row= entries->takeFirst();
  3736. delete row;
  3737. }
  3738. endRemoveRows();
  3739. colcount= hData->size();
  3740. lastTemperature->clear();
  3741. reset();
  3742. }
  3743. /*:368*//*369:*/
  3744. #line 9189 "./typica.w"
  3745. bool MeasurementModel::setData(const QModelIndex&index,
  3746. const QVariant&value,int role)
  3747. {
  3748. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  3749. {
  3750. return false;
  3751. }
  3752. /*370:*/
  3753. #line 9221 "./typica.w"
  3754. bool valid= false;
  3755. if(index.isValid())
  3756. {
  3757. if(index.row()<entries->size())
  3758. {
  3759. if(index.column()<colcount)
  3760. {
  3761. valid= true;
  3762. }
  3763. }
  3764. }
  3765. /*:370*/
  3766. #line 9197 "./typica.w"
  3767. if(!valid)
  3768. {
  3769. return false;
  3770. }
  3771. MeasurementList*row= entries->at(index.row());
  3772. if(index.column()>=row->size())
  3773. {
  3774. /*371:*/
  3775. #line 9238 "./typica.w"
  3776. for(int i= row->size()-1;i<index.column();i++)
  3777. {
  3778. row->append(QVariant());
  3779. }
  3780. /*:371*/
  3781. #line 9205 "./typica.w"
  3782. }
  3783. if(index.column()==0)
  3784. {
  3785. /*372:*/
  3786. #line 9253 "./typica.w"
  3787. QTime time;
  3788. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  3789. {
  3790. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  3791. {
  3792. return false;
  3793. }
  3794. }
  3795. row= entries->takeAt(index.row());
  3796. row->replace(index.column(),QVariant(time));
  3797. MeasurementList*temp= row;
  3798. /*361:*/
  3799. #line 8980 "./typica.w"
  3800. /*362:*/
  3801. #line 9025 "./typica.w"
  3802. QList<MeasurementList*> ::iterator i= lastInsertion;
  3803. bool quickscan= false;
  3804. if(entries->size()> 5)
  3805. {
  3806. if(**i<*temp)
  3807. {
  3808. i+= 1;
  3809. for(int j= 10;j> 0;j--)
  3810. {
  3811. if(i!=entries->end())
  3812. {
  3813. if(**i<*temp)
  3814. {
  3815. i+= 1;
  3816. }
  3817. else
  3818. {
  3819. quickscan= true;
  3820. break;
  3821. }
  3822. }
  3823. else
  3824. {
  3825. quickscan= true;
  3826. break;
  3827. }
  3828. }
  3829. }
  3830. else
  3831. {
  3832. if(**i==*temp)
  3833. {
  3834. quickscan= true;
  3835. }
  3836. }
  3837. }
  3838. /*:362*/
  3839. #line 8981 "./typica.w"
  3840. if(quickscan==false)
  3841. {
  3842. i= entries->begin();
  3843. QList<MeasurementList*> ::iterator u= entries->end();
  3844. QList<MeasurementList*> ::iterator midpoint;
  3845. int n= u-i;
  3846. int rA;
  3847. while(n> 0)
  3848. {
  3849. rA= n>>1;
  3850. midpoint= i+rA;
  3851. if(**midpoint<*temp)
  3852. {
  3853. i= midpoint+1;
  3854. n-= rA+1;
  3855. }
  3856. else
  3857. {
  3858. n= rA;
  3859. }
  3860. }
  3861. }
  3862. /*:361*/
  3863. #line 9265 "./typica.w"
  3864. entries->insert(i,row);
  3865. int newRow= entries->indexOf(*i);
  3866. if(newRow<index.row())
  3867. {
  3868. emit dataChanged(createIndex(newRow,index.column()),index);
  3869. }
  3870. else
  3871. {
  3872. emit dataChanged(index,createIndex(newRow,index.column()));
  3873. }
  3874. /*:372*/
  3875. #line 9209 "./typica.w"
  3876. }
  3877. else
  3878. {
  3879. /*373:*/
  3880. #line 9279 "./typica.w"
  3881. row->replace(index.column(),value);
  3882. emit dataChanged(index,index);
  3883. /*:373*/
  3884. #line 9213 "./typica.w"
  3885. }
  3886. return true;
  3887. }
  3888. /*:369*//*374:*/
  3889. #line 9287 "./typica.w"
  3890. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  3891. unit(Fahrenheit),hData(new QStringList),
  3892. lastTemperature(new QHash<int,int> )
  3893. {
  3894. colcount= 1;
  3895. entries= new QList<MeasurementList*> ;
  3896. lastInsertion= entries->begin();
  3897. hData->append(tr("Time"));
  3898. }
  3899. /*:374*//*375:*/
  3900. #line 9300 "./typica.w"
  3901. MeasurementModel::~MeasurementModel()
  3902. {
  3903. clear();
  3904. delete entries;
  3905. delete hData;
  3906. }
  3907. /*:375*//*376:*/
  3908. #line 9312 "./typica.w"
  3909. int MeasurementModel::rowCount(const QModelIndex&parent)const
  3910. {
  3911. if(parent==QModelIndex())
  3912. {
  3913. return entries->size();
  3914. }
  3915. return 0;
  3916. }
  3917. int MeasurementModel::columnCount(const QModelIndex&parent)const
  3918. {
  3919. if(parent==QModelIndex())
  3920. {
  3921. return colcount;
  3922. }
  3923. return 0;
  3924. }
  3925. /*:376*//*377:*/
  3926. #line 9339 "./typica.w"
  3927. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  3928. const QVariant&value,int)
  3929. {
  3930. if(orientation==Qt::Horizontal)
  3931. {
  3932. if(hData->size()<section+1)
  3933. {
  3934. for(int i= hData->size();i<section+1;i++)
  3935. {
  3936. if(colcount<i)
  3937. {
  3938. beginInsertColumns(QModelIndex(),i,i);
  3939. }
  3940. hData->append(QString());
  3941. if(colcount<i)
  3942. {
  3943. endInsertColumns();
  3944. }
  3945. }
  3946. }
  3947. hData->replace(section,value.toString());
  3948. emit headerDataChanged(orientation,section,section);
  3949. if(colcount<section+1)
  3950. {
  3951. colcount= section+1;
  3952. }
  3953. return true;
  3954. }
  3955. return false;
  3956. }
  3957. /*:377*//*378:*/
  3958. #line 9379 "./typica.w"
  3959. void MeasurementModel::setDisplayUnits(int scale)
  3960. {
  3961. beginResetModel();
  3962. unit= scale;
  3963. endResetModel();
  3964. }
  3965. int MeasurementModel::displayUnits()
  3966. {
  3967. return unit;
  3968. }
  3969. /*:378*//*379:*/
  3970. #line 9403 "./typica.w"
  3971. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  3972. {
  3973. /*370:*/
  3974. #line 9221 "./typica.w"
  3975. bool valid= false;
  3976. if(index.isValid())
  3977. {
  3978. if(index.row()<entries->size())
  3979. {
  3980. if(index.column()<colcount)
  3981. {
  3982. valid= true;
  3983. }
  3984. }
  3985. }
  3986. /*:370*/
  3987. #line 9406 "./typica.w"
  3988. if(!valid)
  3989. {
  3990. return QVariant();
  3991. }
  3992. if(role==Qt::DisplayRole||role==Qt::EditRole)
  3993. {
  3994. MeasurementList*row= entries->at(index.row());
  3995. if(index.column()> row->size())
  3996. {
  3997. return QVariant();
  3998. }
  3999. else
  4000. {
  4001. if(index.column()==0)
  4002. {
  4003. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  4004. }
  4005. else if(lastTemperature->contains(index.column()))
  4006. {
  4007. if(row->at(index.column()).toString().isEmpty())
  4008. {
  4009. return QVariant();
  4010. }
  4011. switch(unit)
  4012. {
  4013. case Auto:
  4014. case Fahrenheit:
  4015. return QVariant(row->at(index.column()).toString());
  4016. break;
  4017. case Celsius:
  4018. return QVariant((row->at(index.column()).toDouble()-
  4019. 32)*5/9);
  4020. break;
  4021. case Kelvin:
  4022. return QVariant((row->at(index.column()).toDouble()+
  4023. 459.67)*5/9);
  4024. break;
  4025. case Rankine:
  4026. return QVariant(row->at(index.column()).toDouble()+
  4027. 459.67);
  4028. break;
  4029. default:
  4030. break;
  4031. }
  4032. }
  4033. return QVariant(row->at(index.column()).toString());
  4034. }
  4035. }
  4036. return QVariant();
  4037. }
  4038. /*:379*//*380:*/
  4039. #line 9460 "./typica.w"
  4040. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4041. int role)const
  4042. {
  4043. if(orientation==Qt::Horizontal)
  4044. {
  4045. if(role==Qt::DisplayRole)
  4046. {
  4047. if(section<hData->size())
  4048. {
  4049. return QVariant(hData->at(section));
  4050. }
  4051. }
  4052. }
  4053. return QVariant();
  4054. }
  4055. /*:380*//*381:*/
  4056. #line 9487 "./typica.w"
  4057. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4058. {
  4059. /*370:*/
  4060. #line 9221 "./typica.w"
  4061. bool valid= false;
  4062. if(index.isValid())
  4063. {
  4064. if(index.row()<entries->size())
  4065. {
  4066. if(index.column()<colcount)
  4067. {
  4068. valid= true;
  4069. }
  4070. }
  4071. }
  4072. /*:370*/
  4073. #line 9490 "./typica.w"
  4074. if(valid)
  4075. {
  4076. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4077. }
  4078. return 0;
  4079. }
  4080. /*:381*//*382:*/
  4081. #line 9502 "./typica.w"
  4082. QModelIndex MeasurementModel::index(int row,int column,
  4083. const QModelIndex&parent)const
  4084. {
  4085. if(parent==QModelIndex())
  4086. {
  4087. if(row<entries->size()&&entries->isEmpty()==false)
  4088. {
  4089. if(column<entries->at(row)->size())
  4090. {
  4091. return createIndex(row,column);
  4092. }
  4093. }
  4094. }
  4095. return QModelIndex();
  4096. }
  4097. /*:382*/
  4098. #line 782 "./typica.w"
  4099. /*384:*/
  4100. #line 9553 "./typica.w"
  4101. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4102. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4103. {
  4104. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4105. }
  4106. /*:384*//*385:*/
  4107. #line 9568 "./typica.w"
  4108. void AnnotationButton::annotate()
  4109. {
  4110. if(note.contains("%1"))
  4111. {
  4112. count++;
  4113. emit annotation(note.arg(count),tc,ac);
  4114. }
  4115. else
  4116. {
  4117. emit annotation(note,tc,ac);
  4118. }
  4119. }
  4120. /*:385*//*386:*/
  4121. #line 9586 "./typica.w"
  4122. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4123. {
  4124. tc= tempcolumn;
  4125. }
  4126. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4127. {
  4128. ac= annotationcolumn;
  4129. }
  4130. void AnnotationButton::setAnnotation(const QString&annotation)
  4131. {
  4132. note= annotation;
  4133. }
  4134. /*:386*//*387:*/
  4135. #line 9605 "./typica.w"
  4136. void AnnotationButton::resetCount()
  4137. {
  4138. count= 0;
  4139. }
  4140. /*:387*/
  4141. #line 783 "./typica.w"
  4142. /*392:*/
  4143. #line 9688 "./typica.w"
  4144. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4145. const QString&postt,
  4146. QWidget*parent)
  4147. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4148. {
  4149. resetChange();
  4150. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4151. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4152. }
  4153. /*:392*//*393:*/
  4154. #line 9705 "./typica.w"
  4155. void AnnotationSpinBox::resetChange()
  4156. {
  4157. change= true;
  4158. }
  4159. /*:393*//*394:*/
  4160. #line 9716 "./typica.w"
  4161. void AnnotationSpinBox::annotate()
  4162. {
  4163. if(change)
  4164. {
  4165. change= false;
  4166. emit annotation(QString("%1%2%3").arg(pretext).
  4167. arg(value()).arg(posttext),tc,ac);
  4168. }
  4169. }
  4170. /*:394*//*395:*/
  4171. #line 9729 "./typica.w"
  4172. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4173. {
  4174. tc= tempcolumn;
  4175. }
  4176. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4177. {
  4178. ac= annotationcolumn;
  4179. }
  4180. void AnnotationSpinBox::setPretext(const QString&pret)
  4181. {
  4182. pretext= pret;
  4183. }
  4184. void AnnotationSpinBox::setPosttext(const QString&postt)
  4185. {
  4186. posttext= postt;
  4187. }
  4188. /*:395*/
  4189. #line 784 "./typica.w"
  4190. /*402:*/
  4191. #line 9897 "./typica.w"
  4192. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4193. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4194. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4195. stopAction(new QAction(tr("Stop"),NULL)),
  4196. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4197. relative(QTime::currentTime()),base(QTime(0,0,0))
  4198. {
  4199. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4200. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4201. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4202. clock.setInterval(500);
  4203. clock.setSingleShot(false);
  4204. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4205. setSegmentStyle(Filled);
  4206. updateDisplay();
  4207. }
  4208. /*:402*//*403:*/
  4209. #line 9918 "./typica.w"
  4210. void TimerDisplay::updateTime()
  4211. {
  4212. QTime time;
  4213. int cseconds= 0;
  4214. int oseconds= 0;
  4215. int r= 0;
  4216. QTime nt= QTime(0,0,0);
  4217. int n= 0;
  4218. int bseconds= 0;
  4219. switch(m)
  4220. {
  4221. case TimerDisplay::CountUp:
  4222. /*404:*/
  4223. #line 9950 "./typica.w"
  4224. /*405:*/
  4225. #line 9963 "./typica.w"
  4226. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4227. time= QTime::currentTime();
  4228. cseconds= TIMETOINT(time);
  4229. oseconds= TIMETOINT(relative);
  4230. r= cseconds-oseconds;
  4231. /*:405*/
  4232. #line 9951 "./typica.w"
  4233. nt= nt.addSecs(r);
  4234. if(nt!=s)
  4235. {
  4236. s= nt;
  4237. emit valueChanged(s);
  4238. }
  4239. /*:404*/
  4240. #line 9931 "./typica.w"
  4241. ;
  4242. break;
  4243. case TimerDisplay::CountDown:
  4244. /*406:*/
  4245. #line 9975 "./typica.w"
  4246. if(s> QTime(0,0,0))
  4247. {
  4248. /*405:*/
  4249. #line 9963 "./typica.w"
  4250. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4251. time= QTime::currentTime();
  4252. cseconds= TIMETOINT(time);
  4253. oseconds= TIMETOINT(relative);
  4254. r= cseconds-oseconds;
  4255. /*:405*/
  4256. #line 9978 "./typica.w"
  4257. bseconds= TIMETOINT(base);
  4258. n= bseconds-r;
  4259. nt= nt.addSecs(n);
  4260. if(nt!=s)
  4261. {
  4262. s= nt;
  4263. emit valueChanged(s);
  4264. }
  4265. }
  4266. /*:406*/
  4267. #line 9934 "./typica.w"
  4268. ;
  4269. break;
  4270. case TimerDisplay::Clock:
  4271. /*407:*/
  4272. #line 9992 "./typica.w"
  4273. time= QTime::currentTime();
  4274. if(time!=s)
  4275. {
  4276. s= time;
  4277. emit valueChanged(s);
  4278. }
  4279. /*:407*/
  4280. #line 9937 "./typica.w"
  4281. ;
  4282. break;
  4283. default:
  4284. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  4285. break;
  4286. }
  4287. updateDisplay();
  4288. }
  4289. /*:403*//*408:*/
  4290. #line 10004 "./typica.w"
  4291. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  4292. void TimerDisplay::startTimer()
  4293. {
  4294. if(!running)
  4295. {
  4296. relative= QTime::currentTime();
  4297. if(ar)
  4298. {
  4299. reset();
  4300. }
  4301. else
  4302. {
  4303. relative= TIMESUBTRACT(relative,s);
  4304. }
  4305. if(m==Clock)
  4306. {
  4307. updateTime();
  4308. }
  4309. base= s;
  4310. clock.start();
  4311. running= true;
  4312. emit runStateChanged(true);
  4313. }
  4314. }
  4315. /*:408*//*409:*/
  4316. #line 10034 "./typica.w"
  4317. void TimerDisplay::stopTimer()
  4318. {
  4319. if(running)
  4320. {
  4321. clock.stop();
  4322. running= false;
  4323. emit runStateChanged(false);
  4324. }
  4325. }
  4326. /*:409*//*410:*/
  4327. #line 10047 "./typica.w"
  4328. TimerDisplay::~TimerDisplay()
  4329. {
  4330. clock.stop();
  4331. }
  4332. /*:410*//*411:*/
  4333. #line 10056 "./typica.w"
  4334. void TimerDisplay::setCountUpMode()
  4335. {
  4336. m= TimerDisplay::CountUp;
  4337. }
  4338. void TimerDisplay::setCountDownMode()
  4339. {
  4340. m= TimerDisplay::CountDown;
  4341. }
  4342. void TimerDisplay::setClockMode()
  4343. {
  4344. m= TimerDisplay::Clock;
  4345. }
  4346. /*:411*//*412:*/
  4347. #line 10074 "./typica.w"
  4348. QString TimerDisplay::value()
  4349. {
  4350. return s.toString(f);
  4351. }
  4352. QTime TimerDisplay::seconds()
  4353. {
  4354. return s;
  4355. }
  4356. TimerDisplay::TimerMode TimerDisplay::mode()
  4357. {
  4358. return m;
  4359. }
  4360. bool TimerDisplay::isRunning()
  4361. {
  4362. return running;
  4363. }
  4364. QTime TimerDisplay::resetValue()
  4365. {
  4366. return r;
  4367. }
  4368. QString TimerDisplay::displayFormat()
  4369. {
  4370. return f;
  4371. }
  4372. bool TimerDisplay::autoReset()
  4373. {
  4374. return ar;
  4375. }
  4376. /*:412*//*413:*/
  4377. #line 10112 "./typica.w"
  4378. void TimerDisplay::setTimer(QTime value)
  4379. {
  4380. if(value.isValid())
  4381. {
  4382. s= value;
  4383. updateDisplay();
  4384. emit valueChanged(value);
  4385. }
  4386. }
  4387. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  4388. {
  4389. m= mode;
  4390. }
  4391. void TimerDisplay::setResetValue(QTime value)
  4392. {
  4393. r= value;
  4394. }
  4395. void TimerDisplay::setDisplayFormat(QString format)
  4396. {
  4397. f= format;
  4398. setNumDigits(format.length());
  4399. }
  4400. void TimerDisplay::setAutoReset(bool reset)
  4401. {
  4402. ar= reset;
  4403. }
  4404. /*:413*//*414:*/
  4405. #line 10147 "./typica.w"
  4406. void TimerDisplay::copyTimer()
  4407. {
  4408. QApplication::clipboard()->setText(value());
  4409. }
  4410. /*:414*//*415:*/
  4411. #line 10156 "./typica.w"
  4412. void TimerDisplay::reset()
  4413. {
  4414. if(!running)
  4415. {
  4416. s= r;
  4417. updateDisplay();
  4418. }
  4419. }
  4420. /*:415*//*416:*/
  4421. #line 10169 "./typica.w"
  4422. void TimerDisplay::updateDisplay()
  4423. {
  4424. display(value());
  4425. }
  4426. /*:416*/
  4427. #line 785 "./typica.w"
  4428. /*422:*/
  4429. #line 10263 "./typica.w"
  4430. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  4431. {
  4432. int x= rect.x();
  4433. int y= rect.y();
  4434. QLayoutItem*item;
  4435. if(orientation==Qt::Horizontal)
  4436. {
  4437. /*423:*/
  4438. #line 10287 "./typica.w"
  4439. foreach(item,itemList)
  4440. {
  4441. int nextX= x+item->sizeHint().width()+spacing();
  4442. int right= x+item->sizeHint().width();
  4443. if(item==itemList.last())
  4444. {
  4445. right= rect.right();
  4446. }
  4447. int bottom= rect.bottom();
  4448. if(!testOnly)
  4449. {
  4450. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4451. }
  4452. x= nextX;
  4453. }
  4454. /*:423*/
  4455. #line 10271 "./typica.w"
  4456. }
  4457. else
  4458. {
  4459. /*424:*/
  4460. #line 10306 "./typica.w"
  4461. foreach(item,itemList)
  4462. {
  4463. int nextY= y+item->sizeHint().height()+spacing();
  4464. int bottom= y+item->sizeHint().height();
  4465. if(item==itemList.last())
  4466. {
  4467. bottom= rect.bottom();
  4468. }
  4469. int right= rect.right();
  4470. if(!testOnly)
  4471. {
  4472. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4473. }
  4474. y= nextY;
  4475. }
  4476. /*:424*/
  4477. #line 10275 "./typica.w"
  4478. }
  4479. return y;
  4480. }
  4481. /*:422*//*425:*/
  4482. #line 10330 "./typica.w"
  4483. QSize PackLayout::minimumSize()const
  4484. {
  4485. QSize size;
  4486. QLayoutItem*item;
  4487. foreach(item,itemList)
  4488. {
  4489. if(orientation==Qt::Horizontal)
  4490. {
  4491. size+= QSize(item->minimumSize().width(),0);
  4492. if(size.height()<item->minimumSize().height())
  4493. {
  4494. size.setHeight(item->minimumSize().height());
  4495. }
  4496. }
  4497. else
  4498. {
  4499. size+= QSize(0,item->minimumSize().height());
  4500. if(size.width()<item->minimumSize().width())
  4501. {
  4502. size.setWidth(item->minimumSize().width());
  4503. }
  4504. }
  4505. }
  4506. size+= QSize(2*margin(),2*margin());
  4507. return size;
  4508. }
  4509. /*:425*//*426:*/
  4510. #line 10362 "./typica.w"
  4511. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  4512. QLayout(parent)
  4513. {
  4514. setMargin(margin);
  4515. setSpacing(spacing);
  4516. setOrientation(Qt::Horizontal);
  4517. }
  4518. PackLayout::PackLayout(int spacing)
  4519. {
  4520. setSpacing(spacing);
  4521. setOrientation(Qt::Horizontal);
  4522. }
  4523. /*:426*//*427:*/
  4524. #line 10380 "./typica.w"
  4525. PackLayout::~PackLayout()
  4526. {
  4527. QLayoutItem*item;
  4528. while((item= takeAt(0)))
  4529. {
  4530. delete item;
  4531. }
  4532. }
  4533. /*:427*//*428:*/
  4534. #line 10394 "./typica.w"
  4535. QLayoutItem*PackLayout::takeAt(int index)
  4536. {
  4537. if(index>=0&&index<itemList.size())
  4538. {
  4539. return itemList.takeAt(index);
  4540. }
  4541. else
  4542. {
  4543. return NULL;
  4544. }
  4545. }
  4546. /*:428*//*429:*/
  4547. #line 10410 "./typica.w"
  4548. QLayoutItem*PackLayout::itemAt(int index)const
  4549. {
  4550. if(index>=0&&index<itemList.size())
  4551. {
  4552. return itemList.at(index);
  4553. }
  4554. else
  4555. {
  4556. return NULL;
  4557. }
  4558. }
  4559. /*:429*//*430:*/
  4560. #line 10433 "./typica.w"
  4561. void PackLayout::addItem(QLayoutItem*item)
  4562. {
  4563. itemList.append(item);
  4564. }
  4565. /*:430*//*431:*/
  4566. #line 10441 "./typica.w"
  4567. int PackLayout::count()const
  4568. {
  4569. return itemList.size();
  4570. }
  4571. /*:431*//*432:*/
  4572. #line 10453 "./typica.w"
  4573. Qt::Orientations PackLayout::expandingDirections()const
  4574. {
  4575. return Qt::Vertical|Qt::Horizontal;
  4576. }
  4577. bool PackLayout::hasHeightForWidth()const
  4578. {
  4579. return false;
  4580. }
  4581. int PackLayout::heightForWidth(int width)const
  4582. {
  4583. return doLayout(QRect(0,0,width,0),true);
  4584. }
  4585. void PackLayout::setGeometry(const QRect&rect)
  4586. {
  4587. QLayout::setGeometry(rect);
  4588. doLayout(rect,false);
  4589. }
  4590. QSize PackLayout::sizeHint()const
  4591. {
  4592. return minimumSize();
  4593. }
  4594. /*:432*//*433:*/
  4595. #line 10484 "./typica.w"
  4596. void PackLayout::setOrientation(Qt::Orientations direction)
  4597. {
  4598. orientation= direction;
  4599. doLayout(geometry(),false);
  4600. }
  4601. /*:433*/
  4602. #line 786 "./typica.w"
  4603. /*435:*/
  4604. #line 10523 "./typica.w"
  4605. SceneButton::SceneButton():QGraphicsScene()
  4606. {
  4607. }
  4608. SceneButton::~SceneButton()
  4609. {
  4610. }
  4611. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  4612. {
  4613. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  4614. }
  4615. /*:435*/
  4616. #line 787 "./typica.w"
  4617. /*437:*/
  4618. #line 10569 "./typica.w"
  4619. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  4620. Qt::Orientations orientation,
  4621. QWidget*parent,Qt::WindowFlags f):
  4622. QWidget(parent,f),label(new QGraphicsView()),
  4623. scene(new SceneButton())
  4624. {
  4625. layout= new PackLayout(this);
  4626. layout->setOrientation(orientation);
  4627. /*438:*/
  4628. #line 10589 "./typica.w"
  4629. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4630. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4631. label->setFrameShape(QFrame::NoFrame);
  4632. label->setInteractive(true);
  4633. /*:438*/
  4634. #line 10578 "./typica.w"
  4635. /*439:*/
  4636. #line 10600 "./typica.w"
  4637. scene->setBackgroundBrush(Qt::cyan);
  4638. text= scene->addText(labeltext);
  4639. if(orientation==Qt::Horizontal)
  4640. {
  4641. text->rotate(270.0);
  4642. }
  4643. label->setScene(scene);
  4644. /*:439*/
  4645. #line 10579 "./typica.w"
  4646. /*440:*/
  4647. #line 10618 "./typica.w"
  4648. if(orientation==Qt::Horizontal)
  4649. {
  4650. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  4651. }
  4652. else
  4653. {
  4654. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  4655. }
  4656. label->centerOn(text);
  4657. /*:440*/
  4658. #line 10580 "./typica.w"
  4659. /*441:*/
  4660. #line 10633 "./typica.w"
  4661. layout->addWidget(label);
  4662. layout->addWidget(widget);
  4663. if(orientation==Qt::Horizontal)
  4664. {
  4665. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  4666. widget->sizeHint().height());
  4667. }
  4668. else
  4669. {
  4670. setMinimumSize(widget->sizeHint().width(),
  4671. widget->sizeHint().height()+label->sizeHint().height());
  4672. }
  4673. /*:441*/
  4674. #line 10581 "./typica.w"
  4675. }
  4676. /*:437*//*442:*/
  4677. #line 10650 "./typica.w"
  4678. void WidgetDecorator::setBackgroundBrush(QBrush background)
  4679. {
  4680. scene->setBackgroundBrush(background);
  4681. }
  4682. void WidgetDecorator::setTextColor(QColor color)
  4683. {
  4684. text->setDefaultTextColor(color);
  4685. }
  4686. /*:442*//*443:*/
  4687. #line 10663 "./typica.w"
  4688. WidgetDecorator::~WidgetDecorator()
  4689. {
  4690. }
  4691. /*:443*/
  4692. #line 788 "./typica.w"
  4693. /*448:*/
  4694. #line 10762 "./typica.w"
  4695. void LogEditWindow::addTheRows()
  4696. {
  4697. QTime s= startTime->time();
  4698. while(s<endTime->time())
  4699. {
  4700. model->newMeasurement(Measurement(0,s),1);
  4701. s= s.addSecs(interval->value());
  4702. }
  4703. model->newMeasurement(Measurement(0,endTime->time()),1);
  4704. }
  4705. /*:448*//*449:*/
  4706. #line 10776 "./typica.w"
  4707. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  4708. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  4709. addRowsLayout(new QHBoxLayout(NULL)),
  4710. startTimeLabel(new QLabel("Start Time")),
  4711. startTime(new QTimeEdit(QTime(0,0,0,0))),
  4712. endTimeLabel(new QLabel("End Time")),
  4713. endTime(new QTimeEdit(QTime(0,20,0,0))),
  4714. intervalLabel(new QLabel("Interval (seconds)")),
  4715. interval(new QSpinBox()),
  4716. addRows(new QPushButton("Add Rows")),
  4717. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  4718. saveCsv(new QAction(tr("Export CSV"),NULL)),
  4719. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  4720. model(new MeasurementModel()),
  4721. log(new QTableView())
  4722. {
  4723. /*450:*/
  4724. #line 10813 "./typica.w"
  4725. QSettings settings;
  4726. resize(settings.value("logSize",QSize(620,400)).toSize());
  4727. move(settings.value("logPos",QPoint(200,60)).toPoint());
  4728. /*:450*/
  4729. #line 10793 "./typica.w"
  4730. /*451:*/
  4731. #line 10826 "./typica.w"
  4732. mainLayout->setOrientation(Qt::Vertical);
  4733. addRowsLayout->addSpacing(10);
  4734. addRowsLayout->addWidget(startTimeLabel);
  4735. addRowsLayout->addWidget(startTime);
  4736. addRowsLayout->addSpacing(10);
  4737. startTime->setDisplayFormat("mm:ss");
  4738. addRowsLayout->addWidget(endTimeLabel);
  4739. addRowsLayout->addWidget(endTime);
  4740. addRowsLayout->addSpacing(10);
  4741. endTime->setDisplayFormat("mm:ss");
  4742. addRowsLayout->addWidget(intervalLabel);
  4743. addRowsLayout->addWidget(interval);
  4744. addRowsLayout->addSpacing(10);
  4745. interval->setRange(0,60);
  4746. interval->setValue(30);
  4747. addRowsLayout->addWidget(addRows);
  4748. addRowsLayout->addSpacing(10);
  4749. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  4750. /*:451*/
  4751. #line 10794 "./typica.w"
  4752. /*452:*/
  4753. #line 10849 "./typica.w"
  4754. model->setHeaderData(0,Qt::Horizontal,"Time");
  4755. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  4756. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  4757. model->clear();
  4758. /*:452*/
  4759. #line 10795 "./typica.w"
  4760. /*453:*/
  4761. #line 10858 "./typica.w"
  4762. log->setModel(model);
  4763. log->setColumnWidth(0,100);
  4764. log->setColumnWidth(1,100);
  4765. log->setColumnWidth(2,100);
  4766. /*:453*/
  4767. #line 10796 "./typica.w"
  4768. mainLayout->addItem(addRowsLayout);
  4769. mainLayout->addWidget(log);
  4770. centralWidget->setLayout(mainLayout);
  4771. setCentralWidget(centralWidget);
  4772. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  4773. fileMenu->addAction(openXml);
  4774. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  4775. fileMenu->addAction(saveXml);
  4776. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  4777. fileMenu->addAction(saveCsv);
  4778. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  4779. }
  4780. /*:449*//*454:*/
  4781. #line 10869 "./typica.w"
  4782. void LogEditWindow::saveXML()
  4783. {
  4784. QSettings settings;
  4785. QString lastDir= settings.value("lastDirectory").toString();
  4786. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  4787. lastDir,"",0);
  4788. QFile file(filename);
  4789. XMLOutput writer(model,&file,0);
  4790. writer.addTemperatureColumn("Temperature",1);
  4791. writer.addAnnotationColumn("Annotation",2);
  4792. if(writer.output())
  4793. {
  4794. QFileInfo info(filename);
  4795. QDir directory= info.dir();
  4796. lastDir= directory.path();
  4797. settings.setValue("lastDirectory",lastDir);
  4798. }
  4799. }
  4800. void LogEditWindow::saveCSV()
  4801. {
  4802. QSettings settings;
  4803. QString lastDir= settings.value("lastDirectory").toString();
  4804. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  4805. lastDir,"",0);
  4806. QFile file(filename);
  4807. CSVOutput writer(model,&file,0);
  4808. writer.addTemperatureColumn("Temperature",1);
  4809. writer.addAnnotationColumn("Annotation",2);
  4810. if(writer.output())
  4811. {
  4812. QFileInfo info(filename);
  4813. QDir directory= info.dir();
  4814. lastDir= directory.path();
  4815. settings.setValue("lastDirectory",lastDir);
  4816. }
  4817. }
  4818. /*:454*//*455:*/
  4819. #line 10912 "./typica.w"
  4820. void LogEditWindow::openXML()
  4821. {
  4822. QSettings settings;
  4823. QString lastDir= settings.value("lastDirectory").toString();
  4824. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  4825. lastDir,"",0);
  4826. if(filename.isNull())
  4827. {
  4828. return;
  4829. }
  4830. QFile file(filename);
  4831. XMLInput reader(&file,1);
  4832. connect(&reader,SIGNAL(measure(Measurement,int)),
  4833. model,SLOT(newMeasurement(Measurement,int)));
  4834. connect(&reader,SIGNAL(annotation(QString,int,int)),
  4835. model,SLOT(newAnnotation(QString,int,int)));
  4836. if(reader.input())
  4837. {
  4838. QFileInfo info(filename);
  4839. setWindowTitle(QString(tr("%1 - %2")).
  4840. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  4841. QDir directory= info.dir();
  4842. lastDir= directory.path();
  4843. settings.setValue("lastDirectory",lastDir);
  4844. }
  4845. }
  4846. /*:455*//*456:*/
  4847. #line 10943 "./typica.w"
  4848. void LogEditWindow::closeEvent(QCloseEvent*event)
  4849. {
  4850. QSettings settings;
  4851. settings.setValue("logSize",size());
  4852. settings.setValue("logPos",pos());
  4853. event->accept();
  4854. }
  4855. /*:456*/
  4856. #line 789 "./typica.w"
  4857. /*462:*/
  4858. #line 11056 "./typica.w"
  4859. bool XMLOutput::output()
  4860. {
  4861. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  4862. {
  4863. return false;
  4864. }
  4865. QXmlStreamWriter xmlout(out);
  4866. xmlout.writeStartDocument("1.0");
  4867. xmlout.writeDTD("<!DOCTYPE roastlog2.0>");
  4868. xmlout.writeStartElement("roastlog");
  4869. /*463:*/
  4870. #line 11089 "./typica.w"
  4871. foreach(int c,temperatureColumns.keys())
  4872. {
  4873. xmlout.writeStartElement("tempseries");
  4874. xmlout.writeAttribute("name",temperatureColumns.value(c));
  4875. xmlout.writeEndElement();
  4876. }
  4877. foreach(int c,annotationColumns.keys())
  4878. {
  4879. xmlout.writeStartElement("noteseries");
  4880. xmlout.writeAttribute("name",annotationColumns.value(c));
  4881. xmlout.writeEndElement();
  4882. }
  4883. /*:463*/
  4884. #line 11067 "./typica.w"
  4885. xmlout.writeStartElement("roast");
  4886. bool oresult;
  4887. for(int i= 0;i<data->rowCount();i++)
  4888. {
  4889. /*464:*/
  4890. #line 11108 "./typica.w"
  4891. oresult= false;
  4892. foreach(int c,temperatureColumns.keys())
  4893. {
  4894. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4895. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4896. {
  4897. oresult= true;
  4898. break;
  4899. }
  4900. }
  4901. if(oresult==false)
  4902. {
  4903. foreach(int c,annotationColumns.keys())
  4904. {
  4905. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4906. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  4907. isEmpty()))
  4908. {
  4909. oresult= true;
  4910. break;
  4911. }
  4912. }
  4913. }
  4914. /*:464*/
  4915. #line 11072 "./typica.w"
  4916. if(oresult)
  4917. {
  4918. /*465:*/
  4919. #line 11138 "./typica.w"
  4920. xmlout.writeStartElement("tuple");
  4921. xmlout.writeTextElement("time",data->data(data->index(i,time),
  4922. Qt::DisplayRole).toString());
  4923. foreach(int c,temperatureColumns.keys())
  4924. {
  4925. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4926. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4927. {
  4928. xmlout.writeStartElement("temperature");
  4929. xmlout.writeAttribute("series",temperatureColumns.value(c));
  4930. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4931. toString());
  4932. xmlout.writeEndElement();
  4933. }
  4934. }
  4935. foreach(int c,annotationColumns.keys())
  4936. {
  4937. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4938. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4939. {
  4940. xmlout.writeStartElement("annotation");
  4941. xmlout.writeAttribute("series",annotationColumns.value(c));
  4942. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4943. toString());
  4944. xmlout.writeEndElement();
  4945. }
  4946. }
  4947. xmlout.writeEndElement();
  4948. /*:465*/
  4949. #line 11075 "./typica.w"
  4950. }
  4951. }
  4952. xmlout.writeEndElement();
  4953. xmlout.writeEndElement();
  4954. xmlout.writeEndDocument();
  4955. out->close();
  4956. return true;
  4957. }
  4958. /*:462*//*466:*/
  4959. #line 11170 "./typica.w"
  4960. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  4961. :QObject(NULL),data(model),out(device),time(timec)
  4962. {
  4963. }
  4964. void XMLOutput::setModel(MeasurementModel*model)
  4965. {
  4966. data= model;
  4967. }
  4968. void XMLOutput::setTimeColumn(int column)
  4969. {
  4970. time= column;
  4971. }
  4972. void XMLOutput::setDevice(QIODevice*device)
  4973. {
  4974. out= device;
  4975. }
  4976. /*:466*//*467:*/
  4977. #line 11199 "./typica.w"
  4978. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  4979. {
  4980. temperatureColumns.insert(column,series);
  4981. }
  4982. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  4983. {
  4984. annotationColumns.insert(column,series);
  4985. }
  4986. /*:467*/
  4987. #line 790 "./typica.w"
  4988. /*469:*/
  4989. #line 11251 "./typica.w"
  4990. bool XMLInput::input()
  4991. {
  4992. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  4993. {
  4994. return false;
  4995. }
  4996. QXmlStreamReader xmlin(in);
  4997. QMap<QString,int> temperatureColumns;
  4998. QMap<QString,int> annotationColumns;
  4999. int nextColumn= firstc;
  5000. /*470:*/
  5001. #line 11282 "./typica.w"
  5002. while(!xmlin.isDTD())
  5003. {
  5004. xmlin.readNext();
  5005. }
  5006. if(xmlin.isDTD())
  5007. {
  5008. if(xmlin.text()=="<!DOCTYPE roastlog>")
  5009. {
  5010. /*471:*/
  5011. #line 11304 "./typica.w"
  5012. emit newTemperatureColumn(firstc,"Bean");
  5013. emit newAnnotationColumn(firstc+1,"Note");
  5014. emit lastColumn(firstc+1);
  5015. /*:471*/
  5016. #line 11291 "./typica.w"
  5017. }
  5018. else
  5019. {
  5020. xmlin.readNext();
  5021. /*472:*/
  5022. #line 11313 "./typica.w"
  5023. while(xmlin.name()!="roast")
  5024. {
  5025. if(xmlin.isStartElement())
  5026. {
  5027. if(xmlin.name()=="tempseries")
  5028. {
  5029. temperatureColumns.insert(xmlin.attributes().value("name").
  5030. toString(),
  5031. nextColumn);
  5032. emit newTemperatureColumn(nextColumn,
  5033. xmlin.attributes().value("name").
  5034. toString());
  5035. nextColumn++;
  5036. }
  5037. else if(xmlin.name()=="noteseries")
  5038. {
  5039. annotationColumns.insert(xmlin.attributes().value("name").
  5040. toString(),nextColumn);
  5041. emit newAnnotationColumn(nextColumn,
  5042. xmlin.attributes().value("name").
  5043. toString());
  5044. nextColumn++;
  5045. }
  5046. }
  5047. xmlin.readNext();
  5048. }
  5049. emit lastColumn(nextColumn-1);
  5050. /*:472*/
  5051. #line 11296 "./typica.w"
  5052. }
  5053. }
  5054. /*:470*/
  5055. #line 11262 "./typica.w"
  5056. QTime timeval= QTime();
  5057. double tempval= 0;
  5058. QString noteval= QString();
  5059. int column;
  5060. int counter= 0;
  5061. while(!xmlin.atEnd())
  5062. {
  5063. /*473:*/
  5064. #line 11354 "./typica.w"
  5065. xmlin.readNext();
  5066. if(xmlin.isStartElement())
  5067. {
  5068. /*474:*/
  5069. #line 11380 "./typica.w"
  5070. if(xmlin.name()=="time")
  5071. {
  5072. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5073. }
  5074. else if(xmlin.name()=="temperature")
  5075. {
  5076. column= xmlin.attributes().value("series").toString().isEmpty()?
  5077. firstc:temperatureColumns.value(xmlin.attributes().
  5078. value("series").toString());
  5079. tempval= xmlin.readElementText().toDouble();
  5080. Measurement measurement(tempval,timeval);
  5081. emit measure(measurement,column);
  5082. }
  5083. else if(xmlin.name()=="annotation")
  5084. {
  5085. column= xmlin.attributes().value("series").toString().isEmpty()?
  5086. firstc+1:annotationColumns.value(xmlin.attributes().
  5087. value("series").toString());
  5088. noteval= xmlin.readElementText();
  5089. if(!noteval.isEmpty())
  5090. {
  5091. emit annotation(noteval,firstc,column);
  5092. }
  5093. }
  5094. /*:474*/
  5095. #line 11358 "./typica.w"
  5096. }
  5097. counter++;
  5098. if(counter%100==0)
  5099. {
  5100. QCoreApplication::processEvents();
  5101. }
  5102. /*:473*/
  5103. #line 11270 "./typica.w"
  5104. }
  5105. return true;
  5106. }
  5107. /*:469*//*475:*/
  5108. #line 11408 "./typica.w"
  5109. XMLInput::XMLInput(QIODevice*input,int c):
  5110. firstc(c),in(input)
  5111. {
  5112. }
  5113. void XMLInput::setFirstColumn(int column)
  5114. {
  5115. firstc= column;
  5116. }
  5117. void XMLInput::setDevice(QIODevice*device)
  5118. {
  5119. in= device;
  5120. }
  5121. /*:475*/
  5122. #line 791 "./typica.w"
  5123. /*480:*/
  5124. #line 11497 "./typica.w"
  5125. bool CSVOutput::output()
  5126. {
  5127. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5128. {
  5129. return false;
  5130. }
  5131. QTextStream output(out);
  5132. /*481:*/
  5133. #line 11521 "./typica.w"
  5134. output<<"Time";
  5135. foreach(int c,temperatureColumns.keys())
  5136. {
  5137. output<<','<<temperatureColumns.value(c);
  5138. }
  5139. foreach(int c,annotationColumns.keys())
  5140. {
  5141. output<<','<<annotationColumns.value(c);
  5142. }
  5143. output<<'\n';
  5144. /*:481*/
  5145. #line 11505 "./typica.w"
  5146. bool oresult;
  5147. for(int i= 0;i<data->rowCount();i++)
  5148. {
  5149. /*464:*/
  5150. #line 11108 "./typica.w"
  5151. oresult= false;
  5152. foreach(int c,temperatureColumns.keys())
  5153. {
  5154. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5155. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5156. {
  5157. oresult= true;
  5158. break;
  5159. }
  5160. }
  5161. if(oresult==false)
  5162. {
  5163. foreach(int c,annotationColumns.keys())
  5164. {
  5165. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5166. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5167. isEmpty()))
  5168. {
  5169. oresult= true;
  5170. break;
  5171. }
  5172. }
  5173. }
  5174. /*:464*/
  5175. #line 11509 "./typica.w"
  5176. if(oresult)
  5177. {
  5178. /*482:*/
  5179. #line 11542 "./typica.w"
  5180. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  5181. foreach(int c,temperatureColumns.keys())
  5182. {
  5183. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5184. }
  5185. foreach(int c,annotationColumns.keys())
  5186. {
  5187. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5188. }
  5189. output<<'\n';
  5190. /*:482*/
  5191. #line 11512 "./typica.w"
  5192. }
  5193. }
  5194. out->close();
  5195. return true;
  5196. }
  5197. /*:480*//*483:*/
  5198. #line 11557 "./typica.w"
  5199. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  5200. data(model),out(device),time(timec)
  5201. {
  5202. }
  5203. void CSVOutput::setModel(MeasurementModel*model)
  5204. {
  5205. data= model;
  5206. }
  5207. void CSVOutput::setTimeColumn(int column)
  5208. {
  5209. time= column;
  5210. }
  5211. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  5212. {
  5213. temperatureColumns.insert(column,series);
  5214. }
  5215. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  5216. {
  5217. annotationColumns.insert(column,series);
  5218. }
  5219. void CSVOutput::setDevice(QIODevice*device)
  5220. {
  5221. out= device;
  5222. }
  5223. /*:483*/
  5224. #line 792 "./typica.w"
  5225. /*502:*/
  5226. #line 11939 "./typica.w"
  5227. QString SaltModel::arrayLiteral(int column,int role)const
  5228. {
  5229. QString literal= "'{";
  5230. for(int i= 0;i<rowCount();i++)
  5231. {
  5232. QString datum= data(index(i,column),role).toString();
  5233. if(!datum.isEmpty())
  5234. {
  5235. literal.append(datum);
  5236. literal.append(", ");
  5237. }
  5238. }
  5239. if(literal.size()> 2)
  5240. {
  5241. literal.chop(2);
  5242. }
  5243. literal.append("}'");
  5244. return literal;
  5245. }
  5246. QString SaltModel::quotedArrayLiteral(int column,int role)const
  5247. {
  5248. QString literal= "'{";
  5249. for(int i= 0;i<rowCount();i++)
  5250. {
  5251. QString datum= data(index(i,column),role).toString();
  5252. if(!datum.isEmpty())
  5253. {
  5254. literal.append("\"");
  5255. literal.append(datum);
  5256. literal.append("\", ");
  5257. }
  5258. }
  5259. if(literal.size()> 2)
  5260. {
  5261. literal.chop(2);
  5262. }
  5263. literal.append("}'");
  5264. return literal;
  5265. }
  5266. /*:502*//*503:*/
  5267. #line 11983 "./typica.w"
  5268. QModelIndex SaltModel::parent(const QModelIndex&)const
  5269. {
  5270. return QModelIndex();
  5271. }
  5272. /*:503*//*504:*/
  5273. #line 12002 "./typica.w"
  5274. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  5275. int role)
  5276. {
  5277. /*505:*/
  5278. #line 12033 "./typica.w"
  5279. bool valid= false;
  5280. if(index.isValid())
  5281. {
  5282. if(index.row()<modelData.size())
  5283. {
  5284. if(index.column()<colcount)
  5285. {
  5286. valid= true;
  5287. }
  5288. }
  5289. }
  5290. /*:505*/
  5291. #line 12006 "./typica.w"
  5292. if(!valid)
  5293. {
  5294. return false;
  5295. }
  5296. if(index.row()==modelData.size()-1)
  5297. {
  5298. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  5299. /*506:*/
  5300. #line 12049 "./typica.w"
  5301. QList<QMap<int,QVariant> > newRow;
  5302. QMap<int,QVariant> defaults;
  5303. for(int i= 0;i<colcount;i++)
  5304. {
  5305. newRow.append(defaults);
  5306. }
  5307. modelData.append(newRow);
  5308. /*:506*/
  5309. #line 12014 "./typica.w"
  5310. endInsertRows();
  5311. }
  5312. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5313. QMap<int,QVariant> cell= row.at(index.column());
  5314. cell.insert(role,value);
  5315. if(role==Qt::EditRole)
  5316. {
  5317. cell.insert(Qt::DisplayRole,value);
  5318. }
  5319. row.replace(index.column(),cell);
  5320. modelData.replace(index.row(),row);
  5321. emit dataChanged(index,index);
  5322. return true;
  5323. }
  5324. /*:504*//*507:*/
  5325. #line 12060 "./typica.w"
  5326. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  5327. {
  5328. for(int i= 0;i<columns;i++)
  5329. {
  5330. hData<<"";
  5331. }
  5332. /*506:*/
  5333. #line 12049 "./typica.w"
  5334. QList<QMap<int,QVariant> > newRow;
  5335. QMap<int,QVariant> defaults;
  5336. for(int i= 0;i<colcount;i++)
  5337. {
  5338. newRow.append(defaults);
  5339. }
  5340. modelData.append(newRow);
  5341. /*:506*/
  5342. #line 12067 "./typica.w"
  5343. }
  5344. /*:507*//*508:*/
  5345. #line 12072 "./typica.w"
  5346. SaltModel::~SaltModel()
  5347. {
  5348. }
  5349. /*:508*//*509:*/
  5350. #line 12082 "./typica.w"
  5351. int SaltModel::rowCount(const QModelIndex&parent)const
  5352. {
  5353. return(parent==QModelIndex()?modelData.size():0);
  5354. }
  5355. int SaltModel::columnCount(const QModelIndex&parent)const
  5356. {
  5357. return(parent==QModelIndex()?colcount:0);
  5358. }
  5359. /*:509*//*510:*/
  5360. #line 12095 "./typica.w"
  5361. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  5362. const QVariant&value,int)
  5363. {
  5364. if(orientation==Qt::Horizontal&&section<colcount)
  5365. {
  5366. hData.replace(section,value.toString());
  5367. emit headerDataChanged(orientation,section,section);
  5368. return true;
  5369. }
  5370. return false;
  5371. }
  5372. /*:510*//*511:*/
  5373. #line 12110 "./typica.w"
  5374. QVariant SaltModel::data(const QModelIndex&index,int role)const
  5375. {
  5376. /*505:*/
  5377. #line 12033 "./typica.w"
  5378. bool valid= false;
  5379. if(index.isValid())
  5380. {
  5381. if(index.row()<modelData.size())
  5382. {
  5383. if(index.column()<colcount)
  5384. {
  5385. valid= true;
  5386. }
  5387. }
  5388. }
  5389. /*:505*/
  5390. #line 12113 "./typica.w"
  5391. if(!valid)
  5392. {
  5393. return QVariant();
  5394. }
  5395. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5396. QMap<int,QVariant> cell= row.at(index.column());
  5397. return cell.value(role,QVariant());
  5398. }
  5399. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  5400. int role)const
  5401. {
  5402. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  5403. section<colcount)
  5404. {
  5405. return QVariant(hData.at(section));
  5406. }
  5407. return QVariant();
  5408. }
  5409. /*:511*//*512:*/
  5410. #line 12137 "./typica.w"
  5411. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  5412. {
  5413. /*505:*/
  5414. #line 12033 "./typica.w"
  5415. bool valid= false;
  5416. if(index.isValid())
  5417. {
  5418. if(index.row()<modelData.size())
  5419. {
  5420. if(index.column()<colcount)
  5421. {
  5422. valid= true;
  5423. }
  5424. }
  5425. }
  5426. /*:505*/
  5427. #line 12140 "./typica.w"
  5428. if(valid)
  5429. {
  5430. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5431. }
  5432. return 0;
  5433. }
  5434. /*:512*//*513:*/
  5435. #line 12151 "./typica.w"
  5436. QModelIndex SaltModel::index(int row,int column,
  5437. const QModelIndex&parent)const
  5438. {
  5439. if(parent==QModelIndex())
  5440. {
  5441. if(row<modelData.size()&&column<colcount)
  5442. {
  5443. return createIndex(row,column);
  5444. }
  5445. }
  5446. return QModelIndex();
  5447. }
  5448. /*:513*/
  5449. #line 793 "./typica.w"
  5450. /*515:*/
  5451. #line 12206 "./typica.w"
  5452. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  5453. {
  5454. SqlComboBox*widget= new SqlComboBox();
  5455. widget->setParent(parent);
  5456. for(int i= 0;i<count();i++)
  5457. {
  5458. widget->addItem(itemText(i),itemData(i));
  5459. }
  5460. return widget;
  5461. }
  5462. /*:515*//*516:*/
  5463. #line 12223 "./typica.w"
  5464. void SqlComboBox::showData(bool show)
  5465. {
  5466. dataColumnShown= show;
  5467. }
  5468. /*:516*//*517:*/
  5469. #line 12234 "./typica.w"
  5470. void SqlComboBox::addNullOption()
  5471. {
  5472. addItem(tr("Unknown"),QVariant(QVariant::String));
  5473. }
  5474. /*:517*//*518:*/
  5475. #line 12247 "./typica.w"
  5476. void SqlComboBox::setDataColumn(int column)
  5477. {
  5478. dataColumn= column;
  5479. }
  5480. void SqlComboBox::setDisplayColumn(int column)
  5481. {
  5482. displayColumn= column;
  5483. }
  5484. /*:518*//*519:*/
  5485. #line 12261 "./typica.w"
  5486. void SqlComboBox::addSqlOptions(QString query)
  5487. {
  5488. SqlQueryConnection*dbquery= new SqlQueryConnection;
  5489. if(!dbquery->exec(query))
  5490. {
  5491. QSqlError error= dbquery->lastError();
  5492. qDebug()<<error.databaseText();
  5493. qDebug()<<error.driverText();
  5494. qDebug()<<error.text();
  5495. qDebug()<<dbquery->lastQuery();
  5496. }
  5497. while(dbquery->next())
  5498. {
  5499. QString displayValue(dbquery->value(displayColumn).toString());
  5500. QString dataValue(dbquery->value(dataColumn).toString());
  5501. if(dataColumnShown)
  5502. {
  5503. displayValue.append(QString(" (%1)").arg(dataValue));
  5504. }
  5505. addItem(displayValue,dataValue);
  5506. }
  5507. delete dbquery;
  5508. }
  5509. /*:519*//*520:*/
  5510. #line 12290 "./typica.w"
  5511. SqlComboBox::SqlComboBox():
  5512. dataColumn(0),displayColumn(0),dataColumnShown(false)
  5513. {
  5514. }
  5515. SqlComboBox::~SqlComboBox()
  5516. {
  5517. }
  5518. /*:520*/
  5519. #line 794 "./typica.w"
  5520. /*522:*/
  5521. #line 12328 "./typica.w"
  5522. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  5523. {
  5524. delegate= widget;
  5525. }
  5526. /*:522*//*523:*/
  5527. #line 12337 "./typica.w"
  5528. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  5529. const QStyleOptionViewItem&,
  5530. const QModelIndex&)const
  5531. {
  5532. return delegate->clone(parent);
  5533. }
  5534. /*:523*//*524:*/
  5535. #line 12348 "./typica.w"
  5536. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  5537. const QModelIndex&index)const
  5538. {
  5539. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5540. self->setCurrentIndex(self->findData(
  5541. index.model()->data(index,
  5542. Qt::UserRole).toString()));
  5543. }
  5544. /*:524*//*525:*/
  5545. #line 12361 "./typica.w"
  5546. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  5547. QAbstractItemModel*model,
  5548. const QModelIndex&index)const
  5549. {
  5550. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5551. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  5552. Qt::UserRole);
  5553. model->setData(index,self->currentText(),Qt::DisplayRole);
  5554. }
  5555. /*:525*//*526:*/
  5556. #line 12374 "./typica.w"
  5557. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  5558. const QStyleOptionViewItem&option,
  5559. const QModelIndex&)const
  5560. {
  5561. editor->setGeometry(option.rect);
  5562. }
  5563. /*:526*//*527:*/
  5564. #line 12385 "./typica.w"
  5565. QSize SqlComboBoxDelegate::sizeHint()const
  5566. {
  5567. return delegate->sizeHint();
  5568. }
  5569. /*:527*//*528:*/
  5570. #line 12393 "./typica.w"
  5571. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  5572. :QItemDelegate(parent)
  5573. {
  5574. }
  5575. /*:528*/
  5576. #line 795 "./typica.w"
  5577. /*494:*/
  5578. #line 11753 "./typica.w"
  5579. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  5580. {
  5581. /*495:*/
  5582. #line 11768 "./typica.w"
  5583. setOrganizationName("Wilson's Coffee & Tea");
  5584. setOrganizationDomain("wilsonscoffee.com");
  5585. setApplicationName(PROGRAM_NAME);
  5586. /*:495*/
  5587. #line 11756 "./typica.w"
  5588. /*496:*/
  5589. #line 11777 "./typica.w"
  5590. QTranslator base;
  5591. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  5592. {
  5593. installTranslator(&base);
  5594. }
  5595. QTranslator app;
  5596. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  5597. {
  5598. installTranslator(&app);
  5599. }
  5600. /*:496*/
  5601. #line 11757 "./typica.w"
  5602. /*233:*/
  5603. #line 5777 "./typica.w"
  5604. qRegisterMetaType<Measurement> ("Measurement");
  5605. /*:233*/
  5606. #line 11758 "./typica.w"
  5607. /*675:*/
  5608. #line 15512 "./typica.w"
  5609. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  5610. tr("NI DAQmx Base"),
  5611. "nidaqmxbase",NULL);
  5612. topLevelNodeInserters.append(inserter);
  5613. /*:675*//*683:*/
  5614. #line 15729 "./typica.w"
  5615. #ifdef Q_OS_WIN32
  5616. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  5617. topLevelNodeInserters.append(inserter);
  5618. #endif
  5619. /*:683*//*707:*/
  5620. #line 16688 "./typica.w"
  5621. #if 0
  5622. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  5623. topLevelNodeInserters.append(inserter);
  5624. #endif
  5625. /*:707*//*740:*/
  5626. #line 18140 "./typica.w"
  5627. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  5628. topLevelNodeInserters.append(inserter);
  5629. /*:740*/
  5630. #line 11759 "./typica.w"
  5631. }
  5632. /*:494*//*498:*/
  5633. #line 11800 "./typica.w"
  5634. QDomDocument*Application::configuration()
  5635. {
  5636. return&conf;
  5637. }
  5638. /*:498*//*499:*/
  5639. #line 11809 "./typica.w"
  5640. QSqlDatabase Application::database()
  5641. {
  5642. QString connectionName;
  5643. QSqlDatabase connection= QSqlDatabase::database();
  5644. do
  5645. {
  5646. connectionName= QUuid::createUuid().toString();
  5647. }while(QSqlDatabase::connectionNames().contains(connectionName));
  5648. return QSqlDatabase::cloneDatabase(connection,connectionName);
  5649. }
  5650. /*:499*//*610:*/
  5651. #line 14141 "./typica.w"
  5652. void Application::saveDeviceConfiguration()
  5653. {
  5654. QSettings settings;
  5655. settings.setValue("DeviceConfiguration",
  5656. QVariant(deviceConfigurationDocument.toByteArray()));
  5657. }
  5658. /*:610*//*611:*/
  5659. #line 14153 "./typica.w"
  5660. QDomDocument Application::deviceConfiguration()
  5661. {
  5662. if(deviceConfigurationDocument.isNull())
  5663. {
  5664. /*612:*/
  5665. #line 14167 "./typica.w"
  5666. QSettings settings;
  5667. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  5668. QString etext;
  5669. int eline;
  5670. int ecol;
  5671. if(document.length()==0)
  5672. {
  5673. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  5674. /*613:*/
  5675. #line 14191 "./typica.w"
  5676. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5677. emptyDocument.open(QIODevice::ReadOnly);
  5678. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5679. &etext,&eline,&ecol))
  5680. {
  5681. /*614:*/
  5682. #line 14208 "./typica.w"
  5683. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5684. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5685. qDebug()<<etext;
  5686. /*:614*/
  5687. #line 14197 "./typica.w"
  5688. }
  5689. else
  5690. {
  5691. saveDeviceConfiguration();
  5692. }
  5693. /*:613*/
  5694. #line 14176 "./typica.w"
  5695. }
  5696. else
  5697. {
  5698. if(!deviceConfigurationDocument.setContent(document,false,
  5699. &etext,&eline,&ecol))
  5700. {
  5701. /*614:*/
  5702. #line 14208 "./typica.w"
  5703. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5704. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5705. qDebug()<<etext;
  5706. /*:614*/
  5707. #line 14183 "./typica.w"
  5708. /*613:*/
  5709. #line 14191 "./typica.w"
  5710. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5711. emptyDocument.open(QIODevice::ReadOnly);
  5712. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5713. &etext,&eline,&ecol))
  5714. {
  5715. /*614:*/
  5716. #line 14208 "./typica.w"
  5717. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5718. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5719. qDebug()<<etext;
  5720. /*:614*/
  5721. #line 14197 "./typica.w"
  5722. }
  5723. else
  5724. {
  5725. saveDeviceConfiguration();
  5726. }
  5727. /*:613*/
  5728. #line 14184 "./typica.w"
  5729. }
  5730. }
  5731. /*:612*/
  5732. #line 14158 "./typica.w"
  5733. }
  5734. return deviceConfigurationDocument;
  5735. }
  5736. /*:611*//*642:*/
  5737. #line 14809 "./typica.w"
  5738. void Application::registerDeviceConfigurationWidget(QString driver,
  5739. QMetaObject widget)
  5740. {
  5741. deviceConfigurationWidgets.insert(driver,widget);
  5742. }
  5743. /*:642*//*643:*/
  5744. #line 14825 "./typica.w"
  5745. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  5746. const QModelIndex&index)
  5747. {
  5748. QVariant nodeReference= index.data(Qt::UserRole);
  5749. QDomElement referenceElement= model->referenceElement(
  5750. model->data(index,Qt::UserRole).toString());
  5751. QMetaObject metaObject=
  5752. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  5753. QWidget::staticMetaObject);
  5754. QWidget*editor;
  5755. if(metaObject.className()==QWidget::staticMetaObject.className())
  5756. {
  5757. editor= NULL;
  5758. }
  5759. else
  5760. {
  5761. editor= qobject_cast<QWidget*> (
  5762. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  5763. Q_ARG(QModelIndex,index)));
  5764. }
  5765. return editor;
  5766. }
  5767. /*:643*/
  5768. #line 796 "./typica.w"
  5769. /*534:*/
  5770. #line 12499 "./typica.w"
  5771. SqlConnectionSetup::SqlConnectionSetup():
  5772. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  5773. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  5774. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  5775. cancelButton(new QPushButton(tr("Cancel"))),
  5776. connectButton(new QPushButton(tr("Connect")))
  5777. {
  5778. driver->addItem("PostgreSQL","QPSQL");
  5779. formLayout->addRow(tr("Database driver:"),driver);
  5780. formLayout->addRow(tr("Host name:"),hostname);
  5781. formLayout->addRow(tr("Database name:"),dbname);
  5782. formLayout->addRow(tr("User name:"),user);
  5783. password->setEchoMode(QLineEdit::Password);
  5784. formLayout->addRow(tr("Password:"),password);
  5785. layout->addLayout(formLayout);
  5786. buttons->addStretch(1);
  5787. buttons->addWidget(cancelButton);
  5788. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  5789. buttons->addWidget(connectButton);
  5790. layout->addLayout(buttons);
  5791. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  5792. setLayout(layout);
  5793. setModal(true);
  5794. }
  5795. SqlConnectionSetup::~SqlConnectionSetup()
  5796. {
  5797. }
  5798. /*:534*//*535:*/
  5799. #line 12533 "./typica.w"
  5800. void SqlConnectionSetup::testConnection()
  5801. {
  5802. QSqlDatabase database=
  5803. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  5804. toString());
  5805. database.setConnectOptions("application_name=Typica");
  5806. database.setHostName(hostname->text());
  5807. database.setDatabaseName(dbname->text());
  5808. database.setUserName(user->text());
  5809. database.setPassword(password->text());
  5810. if(database.open())
  5811. {
  5812. QSettings settings;
  5813. settings.setValue("database/exists","true");
  5814. settings.setValue("database/driver",
  5815. driver->itemData(driver->currentIndex()).toString());
  5816. settings.setValue("database/hostname",hostname->text());
  5817. settings.setValue("database/dbname",dbname->text());
  5818. settings.setValue("database/user",user->text());
  5819. settings.setValue("database/password",password->text());
  5820. accept();
  5821. }
  5822. else
  5823. {
  5824. QMessageBox::information(this,tr("Database connection failed"),
  5825. tr("Failed to connect to database."));
  5826. }
  5827. }
  5828. /*:535*/
  5829. #line 797 "./typica.w"
  5830. /*539:*/
  5831. #line 12630 "./typica.w"
  5832. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  5833. {
  5834. setModel(new QSqlQueryModel);
  5835. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  5836. this,SLOT(openRow(QModelIndex)));
  5837. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  5838. this,SLOT(persistColumnResize(int,int,int)));
  5839. }
  5840. /*:539*//*540:*/
  5841. #line 12645 "./typica.w"
  5842. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  5843. {
  5844. /*541:*/
  5845. #line 12654 "./typica.w"
  5846. QSettings settings;
  5847. /*542:*/
  5848. #line 12667 "./typica.w"
  5849. QWidget*topLevelWidget= this;
  5850. while(topLevelWidget->parentWidget())
  5851. {
  5852. topLevelWidget= topLevelWidget->parentWidget();
  5853. }
  5854. /*:542*/
  5855. #line 12656 "./typica.w"
  5856. settings.setValue(QString("columnWidths/%1/%2/%3").
  5857. arg(topLevelWidget->objectName()).
  5858. arg(objectName()).arg(column),
  5859. QVariant(newsize));
  5860. /*:541*/
  5861. #line 12648 "./typica.w"
  5862. }
  5863. /*:540*//*543:*/
  5864. #line 12677 "./typica.w"
  5865. void SqlQueryView::showEvent(QShowEvent*event)
  5866. {
  5867. /*544:*/
  5868. #line 12687 "./typica.w"
  5869. QSettings settings;
  5870. /*542:*/
  5871. #line 12667 "./typica.w"
  5872. QWidget*topLevelWidget= this;
  5873. while(topLevelWidget->parentWidget())
  5874. {
  5875. topLevelWidget= topLevelWidget->parentWidget();
  5876. }
  5877. /*:542*/
  5878. #line 12689 "./typica.w"
  5879. QString baseKey=
  5880. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5881. arg(objectName());
  5882. for(int i= 0;i<model()->columnCount();i++)
  5883. {
  5884. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5885. if(settings.contains(key))
  5886. {
  5887. setColumnWidth(i,settings.value(key).toInt());
  5888. }
  5889. }
  5890. /*:544*/
  5891. #line 12680 "./typica.w"
  5892. event->accept();
  5893. }
  5894. /*:543*//*545:*/
  5895. #line 12704 "./typica.w"
  5896. void SqlQueryView::openRow(const QModelIndex&index)
  5897. {
  5898. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  5899. emit openEntryRow(index.row());
  5900. }
  5901. /*:545*//*546:*/
  5902. #line 12715 "./typica.w"
  5903. void SqlQueryView::setQuery(const QString&query)
  5904. {
  5905. QSqlDatabase database= AppInstance->database();
  5906. database.open();
  5907. QSqlQuery q(query,database);
  5908. ((QSqlQueryModel*)model())->setQuery(q);
  5909. }
  5910. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  5911. const QVariant&value,int role)
  5912. {
  5913. return model()->setHeaderData(section,orientation,value,role);
  5914. }
  5915. /*:546*//*547:*/
  5916. #line 12732 "./typica.w"
  5917. QVariant SqlQueryView::data(int row,int column,int role)
  5918. {
  5919. return model()->data(model()->index(row,column),role);
  5920. }
  5921. /*:547*/
  5922. #line 798 "./typica.w"
  5923. /*141:*/
  5924. #line 3320 "./typica.w"
  5925. SqlQueryConnection::SqlQueryConnection(const QString&query)
  5926. {
  5927. QSqlDatabase database= AppInstance->database();
  5928. database.open();
  5929. q= new QSqlQuery(query,database);
  5930. connection= database.connectionName();
  5931. }
  5932. /*:141*//*142:*/
  5933. #line 3333 "./typica.w"
  5934. SqlQueryConnection::~SqlQueryConnection()
  5935. {
  5936. delete q;
  5937. {
  5938. QSqlDatabase database= QSqlDatabase::database(connection);
  5939. database.close();
  5940. }
  5941. QSqlDatabase::removeDatabase(connection);
  5942. }
  5943. /*:142*//*143:*/
  5944. #line 3347 "./typica.w"
  5945. QSqlQuery*SqlQueryConnection::operator->()
  5946. {
  5947. return q;
  5948. }
  5949. /*:143*/
  5950. #line 799 "./typica.w"
  5951. /*566:*/
  5952. #line 13081 "./typica.w"
  5953. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  5954. area(frame),configuration(description)
  5955. {
  5956. refresh();
  5957. }
  5958. ReportTable::~ReportTable()
  5959. {
  5960. }
  5961. /*:566*//*567:*/
  5962. #line 13097 "./typica.w"
  5963. void ReportTable::bind(QString placeholder,QVariant value)
  5964. {
  5965. bindings.insert(placeholder,value);
  5966. }
  5967. /*:567*//*568:*/
  5968. #line 13107 "./typica.w"
  5969. void ReportTable::refresh()
  5970. {
  5971. /*569:*/
  5972. #line 13128 "./typica.w"
  5973. QTextCursor cursor= area->firstCursorPosition();
  5974. while(cursor<area->lastCursorPosition())
  5975. {
  5976. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  5977. }
  5978. cursor.removeSelectedText();
  5979. /*:569*/
  5980. #line 13110 "./typica.w"
  5981. int rows= 1;
  5982. int columns= 1;
  5983. int currentRow= 0;
  5984. QTextTable*table= cursor.insertTable(rows,columns);
  5985. /*570:*/
  5986. #line 13141 "./typica.w"
  5987. QTextTableFormat format= table->format();
  5988. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  5989. if(configuration.hasAttribute("align"))
  5990. {
  5991. if(configuration.attribute("align")=="center")
  5992. {
  5993. format.setAlignment(Qt::AlignHCenter);
  5994. }
  5995. }
  5996. table->setFormat(format);
  5997. /*:570*/
  5998. #line 13115 "./typica.w"
  5999. /*571:*/
  6000. #line 13155 "./typica.w"
  6001. QDomNodeList children= configuration.childNodes();
  6002. for(int i= 0;i<children.count();i++)
  6003. {
  6004. QDomNode current;
  6005. QDomElement currentElement;
  6006. current= children.at(i);
  6007. if(current.isElement())
  6008. {
  6009. currentElement= current.toElement();
  6010. if(currentElement.tagName()=="query")
  6011. {
  6012. /*572:*/
  6013. #line 13182 "./typica.w"
  6014. SqlQueryConnection query;
  6015. query.prepare(currentElement.text());
  6016. foreach(QString key,bindings.uniqueKeys())
  6017. {
  6018. if(currentElement.text().contains(key))
  6019. {
  6020. query.bindValue(key,bindings.value(key));
  6021. }
  6022. }
  6023. query.exec();
  6024. if(!query.next())
  6025. {
  6026. continue;
  6027. }
  6028. if(query.record().count()> columns)
  6029. {
  6030. table->appendColumns(query.record().count()-columns);
  6031. }
  6032. do
  6033. {
  6034. table->appendRows(1);
  6035. rows++;
  6036. currentRow++;
  6037. for(int j= 0;j<query.record().count();j++)
  6038. {
  6039. QTextTableCell cell= table->cellAt(currentRow,j);
  6040. cursor= cell.firstCursorPosition();
  6041. cursor.insertText(query.value(j).toString());
  6042. }
  6043. }while(query.next());
  6044. /*:572*/
  6045. #line 13167 "./typica.w"
  6046. }
  6047. else if(currentElement.tagName()=="row")
  6048. {
  6049. /*573:*/
  6050. #line 13221 "./typica.w"
  6051. table->appendRows(1);
  6052. currentRow++;
  6053. rows++;
  6054. QDomNodeList rowChildren= currentElement.childNodes();
  6055. int currentColumn= 0;
  6056. for(int j= 0;j<rowChildren.count();j++)
  6057. {
  6058. QDomNode node;
  6059. QDomElement nodeElement;
  6060. node= rowChildren.at(j);
  6061. if(node.isElement())
  6062. {
  6063. nodeElement= node.toElement();
  6064. if(nodeElement.tagName()=="cell")
  6065. {
  6066. if(currentColumn==columns)
  6067. {
  6068. table->appendColumns(1);
  6069. columns++;
  6070. }
  6071. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  6072. cursor= cell.firstCursorPosition();
  6073. cursor.insertText(nodeElement.text());
  6074. currentColumn++;
  6075. }
  6076. }
  6077. }
  6078. /*:573*/
  6079. #line 13171 "./typica.w"
  6080. }
  6081. }
  6082. }
  6083. /*:571*/
  6084. #line 13116 "./typica.w"
  6085. if(rows> 1)
  6086. {
  6087. table->removeRows(0,1);
  6088. }
  6089. }
  6090. /*:568*/
  6091. #line 800 "./typica.w"
  6092. /*578:*/
  6093. #line 13323 "./typica.w"
  6094. FormArray::FormArray(QDomElement description):configuration(description),
  6095. maxwidth(-1),maxheight(-1)
  6096. {
  6097. setWidget(&itemContainer);
  6098. itemContainer.setLayout(&itemLayout);
  6099. }
  6100. /*:578*//*579:*/
  6101. #line 13340 "./typica.w"
  6102. void FormArray::addElements(int copies)
  6103. {
  6104. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  6105. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  6106. QWidget*widget;
  6107. for(int i= 0;i<copies;i++)
  6108. {
  6109. widget= new QWidget;
  6110. if(maxwidth> -1)
  6111. {
  6112. widget->setMaximumWidth(maxwidth);
  6113. }
  6114. if(maxheight> -1)
  6115. {
  6116. widget->setMaximumHeight(maxheight);
  6117. }
  6118. if(configuration.hasChildNodes())
  6119. {
  6120. widgetStack->push(widget);
  6121. populateWidget(configuration,widgetStack,layoutStack);
  6122. widgetStack->pop();
  6123. widget->setMinimumHeight(widget->sizeHint().height());
  6124. itemLayout.addWidget(widget);
  6125. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  6126. {
  6127. itemContainer.setMinimumHeight(maxheight*elements()+50);
  6128. }
  6129. else
  6130. {
  6131. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  6132. +widget->sizeHint().height());
  6133. }
  6134. if(maxwidth> -1)
  6135. {
  6136. itemContainer.setMinimumWidth(maxwidth+50);
  6137. }
  6138. else
  6139. {
  6140. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  6141. }
  6142. }
  6143. }
  6144. }
  6145. /*:579*//*580:*/
  6146. #line 13390 "./typica.w"
  6147. QWidget*FormArray::elementAt(int index)
  6148. {
  6149. if(index<itemLayout.count())
  6150. {
  6151. QLayoutItem*item= itemLayout.itemAt(index);
  6152. return item->widget();
  6153. }
  6154. else
  6155. {
  6156. return NULL;
  6157. }
  6158. }
  6159. /*:580*//*581:*/
  6160. #line 13407 "./typica.w"
  6161. void FormArray::removeAllElements()
  6162. {
  6163. while(itemLayout.count()> 0)
  6164. {
  6165. QLayoutItem*item;
  6166. item= itemLayout.itemAt(0);
  6167. item->widget()->hide();
  6168. itemLayout.removeWidget(item->widget());
  6169. }
  6170. itemContainer.setMinimumHeight(0);
  6171. }
  6172. /*:581*//*582:*/
  6173. #line 13423 "./typica.w"
  6174. int FormArray::elements()
  6175. {
  6176. return itemLayout.count();
  6177. }
  6178. /*:582*//*583:*/
  6179. #line 13434 "./typica.w"
  6180. void FormArray::setMaximumElementWidth(int width)
  6181. {
  6182. maxwidth= width;
  6183. }
  6184. void FormArray::setMaximumElementHeight(int height)
  6185. {
  6186. maxheight= height;
  6187. }
  6188. /*:583*/
  6189. #line 801 "./typica.w"
  6190. /*589:*/
  6191. #line 13565 "./typica.w"
  6192. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  6193. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  6194. {
  6195. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  6196. QPointF(0,5);
  6197. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  6198. QPointF(10,5);
  6199. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  6200. QPointF(0,0);
  6201. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  6202. initialBrush.setColor(QColor(170,170,255));
  6203. initialBrush.setStyle(Qt::SolidPattern);
  6204. finalBrush.setColor(Qt::blue);
  6205. finalBrush.setStyle(Qt::SolidPattern);
  6206. initialDecrement.setPolygon(left);
  6207. initialDecrement.setBrush(initialBrush);
  6208. initialDecrement.setPos(0,0);
  6209. scene.addItem(&initialDecrement);
  6210. initialIncrement.setPolygon(right);
  6211. initialIncrement.setBrush(initialBrush);
  6212. initialIncrement.setPos(122,0);
  6213. scene.addItem(&initialIncrement);
  6214. finalDecrement.setPolygon(left);
  6215. finalDecrement.setBrush(finalBrush);
  6216. finalDecrement.setPos(0,12);
  6217. scene.addItem(&finalDecrement);
  6218. finalIncrement.setPolygon(right);
  6219. finalIncrement.setBrush(finalBrush);
  6220. finalIncrement.setPos(122,12);
  6221. scene.addItem(&finalIncrement);
  6222. scalePath.moveTo(0,10);
  6223. scalePath.lineTo(100,10);
  6224. scalePath.moveTo(0,0);
  6225. scalePath.lineTo(0,20);
  6226. scalePath.moveTo(10,5);
  6227. scalePath.lineTo(10,15);
  6228. scalePath.moveTo(20,5);
  6229. scalePath.lineTo(20,15);
  6230. scalePath.moveTo(30,5);
  6231. scalePath.lineTo(30,15);
  6232. scalePath.moveTo(40,5);
  6233. scalePath.lineTo(40,15);
  6234. scalePath.moveTo(50,0);
  6235. scalePath.lineTo(50,20);
  6236. scalePath.moveTo(60,5);
  6237. scalePath.lineTo(60,15);
  6238. scalePath.moveTo(70,5);
  6239. scalePath.lineTo(70,15);
  6240. scalePath.moveTo(80,5);
  6241. scalePath.lineTo(80,15);
  6242. scalePath.moveTo(90,5);
  6243. scalePath.lineTo(90,15);
  6244. scalePath.moveTo(100,0);
  6245. scalePath.lineTo(100,20);
  6246. scaleLine.setPath(scalePath);
  6247. scaleLine.setPos(16,1);
  6248. scene.addItem(&scaleLine);
  6249. setScene(&scene);
  6250. initialIndicator.setPolygon(down);
  6251. initialIndicator.setBrush(initialBrush);
  6252. finalIndicator.setPolygon(up);
  6253. finalIndicator.setBrush(finalBrush);
  6254. setMinimumSize(sizeHint());
  6255. setMaximumSize(sizeHint());
  6256. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6257. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6258. setMinimumSize(sizeHint());
  6259. }
  6260. /*:589*//*590:*/
  6261. #line 13638 "./typica.w"
  6262. QSize ScaleControl::sizeHint()const
  6263. {
  6264. return QSize(140,30);
  6265. }
  6266. /*:590*//*591:*/
  6267. #line 13647 "./typica.w"
  6268. void ScaleControl::setInitialValue(double value)
  6269. {
  6270. if(value>=0&&value<=10)
  6271. {
  6272. nonScoredValue= value;
  6273. if(!initialSet)
  6274. {
  6275. scene.addItem(&initialIndicator);
  6276. }
  6277. initialSet= true;
  6278. initialIndicator.setPos(value*10+16,10);
  6279. emit initialChanged(value);
  6280. if(!finalSet)
  6281. {
  6282. setFinalValue(value);
  6283. }
  6284. }
  6285. }
  6286. void ScaleControl::setFinalValue(double value)
  6287. {
  6288. if(value>=0&&value<=10)
  6289. {
  6290. scoredValue= value;
  6291. if(!finalSet)
  6292. {
  6293. scene.addItem(&finalIndicator);
  6294. }
  6295. finalSet= true;
  6296. finalIndicator.setPos(value*10+16,11);
  6297. emit finalChanged(value);
  6298. }
  6299. }
  6300. /*:591*//*592:*/
  6301. #line 13684 "./typica.w"
  6302. double ScaleControl::initialValue(void)
  6303. {
  6304. return nonScoredValue;
  6305. }
  6306. double ScaleControl::finalValue(void)
  6307. {
  6308. return scoredValue;
  6309. }
  6310. /*:592*//*593:*/
  6311. #line 13705 "./typica.w"
  6312. void ScaleControl::mousePressEvent(QMouseEvent*event)
  6313. {
  6314. /*594:*/
  6315. #line 13717 "./typica.w"
  6316. if(event->button()!=Qt::LeftButton)
  6317. {
  6318. event->ignore();
  6319. return;
  6320. }
  6321. /*:594*/
  6322. #line 13708 "./typica.w"
  6323. scaleDown= true;
  6324. event->accept();
  6325. }
  6326. /*:593*//*595:*/
  6327. #line 13728 "./typica.w"
  6328. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  6329. {
  6330. /*594:*/
  6331. #line 13717 "./typica.w"
  6332. if(event->button()!=Qt::LeftButton)
  6333. {
  6334. event->ignore();
  6335. return;
  6336. }
  6337. /*:594*/
  6338. #line 13731 "./typica.w"
  6339. if(!scaleDown)
  6340. {
  6341. event->ignore();
  6342. return;
  6343. }
  6344. scaleDown= false;
  6345. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6346. /*596:*/
  6347. #line 13753 "./typica.w"
  6348. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  6349. {
  6350. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6351. {
  6352. if(initialSet)
  6353. {
  6354. setInitialValue(nonScoredValue-0.05);
  6355. }
  6356. event->accept();
  6357. return;
  6358. }
  6359. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6360. {
  6361. if(finalSet)
  6362. {
  6363. setFinalValue(scoredValue-0.05);
  6364. event->accept();
  6365. return;
  6366. }
  6367. }
  6368. }
  6369. /*:596*/
  6370. #line 13739 "./typica.w"
  6371. /*597:*/
  6372. #line 13779 "./typica.w"
  6373. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  6374. {
  6375. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6376. {
  6377. if(initialSet)
  6378. {
  6379. setInitialValue(nonScoredValue+0.05);
  6380. event->accept();
  6381. return;
  6382. }
  6383. }
  6384. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6385. {
  6386. if(finalSet)
  6387. {
  6388. setFinalValue(scoredValue+0.05);
  6389. event->accept();
  6390. return;
  6391. }
  6392. }
  6393. }
  6394. /*:597*/
  6395. #line 13740 "./typica.w"
  6396. /*598:*/
  6397. #line 13805 "./typica.w"
  6398. double relativeX= sceneCoordinate.x()-16;
  6399. if(initialSet)
  6400. {
  6401. if(relativeX>=0&&relativeX<=100)
  6402. {
  6403. setFinalValue(relativeX/10.0);
  6404. event->accept();
  6405. return;
  6406. }
  6407. }
  6408. else
  6409. {
  6410. if(relativeX>=0&&relativeX<=100)
  6411. {
  6412. setInitialValue(relativeX/10.0);
  6413. event->accept();
  6414. return;
  6415. }
  6416. }
  6417. /*:598*/
  6418. #line 13741 "./typica.w"
  6419. event->ignore();
  6420. return;
  6421. }
  6422. /*:595*/
  6423. #line 802 "./typica.w"
  6424. /*600:*/
  6425. #line 13871 "./typica.w"
  6426. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  6427. valueSet(false),scaleDown(false)
  6428. {
  6429. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6430. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6431. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  6432. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  6433. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  6434. theBrush.setColor(Qt::blue);
  6435. theBrush.setStyle(Qt::SolidPattern);
  6436. increment.setPolygon(up);
  6437. increment.setBrush(theBrush);
  6438. increment.setPos(0,0);
  6439. scene.addItem(&increment);
  6440. decrement.setPolygon(down);
  6441. decrement.setBrush(theBrush);
  6442. decrement.setPos(0,122);
  6443. scene.addItem(&decrement);
  6444. scalePath.moveTo(5,0);
  6445. scalePath.lineTo(5,100);
  6446. scalePath.moveTo(0,0);
  6447. scalePath.lineTo(10,0);
  6448. scalePath.moveTo(0,10);
  6449. scalePath.lineTo(10,10);
  6450. scalePath.moveTo(0,20);
  6451. scalePath.lineTo(10,20);
  6452. scalePath.moveTo(0,30);
  6453. scalePath.lineTo(10,30);
  6454. scalePath.moveTo(0,40);
  6455. scalePath.lineTo(10,40);
  6456. scalePath.moveTo(0,50);
  6457. scalePath.lineTo(10,50);
  6458. scalePath.moveTo(0,60);
  6459. scalePath.lineTo(10,60);
  6460. scalePath.moveTo(0,70);
  6461. scalePath.lineTo(10,70);
  6462. scalePath.moveTo(0,80);
  6463. scalePath.lineTo(10,80);
  6464. scalePath.moveTo(0,90);
  6465. scalePath.lineTo(10,90);
  6466. scalePath.moveTo(0,100);
  6467. scalePath.lineTo(10,100);
  6468. scaleLine.setPath(scalePath);
  6469. scaleLine.setPos(0,16);
  6470. scene.addItem(&scaleLine);
  6471. setScene(&scene);
  6472. indicator.setPolygon(left);
  6473. indicator.setBrush(theBrush);
  6474. setMinimumSize(sizeHint());
  6475. setMaximumSize(sizeHint());
  6476. }
  6477. /*:600*//*601:*/
  6478. #line 13926 "./typica.w"
  6479. QSize IntensityControl::sizeHint()const
  6480. {
  6481. return QSize(25,160);
  6482. }
  6483. /*:601*//*602:*/
  6484. #line 13941 "./typica.w"
  6485. void IntensityControl::setValue(double val)
  6486. {
  6487. if(val>=0&&val<=10)
  6488. {
  6489. theValue= val;
  6490. if(!valueSet)
  6491. {
  6492. scene.addItem(&indicator);
  6493. }
  6494. valueSet= true;
  6495. indicator.setPos(6,(100-(val*10))+16);
  6496. emit(valueChanged(val));
  6497. }
  6498. else if(val<1)
  6499. {
  6500. setValue(0);
  6501. }
  6502. else
  6503. {
  6504. setValue(10);
  6505. }
  6506. }
  6507. double IntensityControl::value()
  6508. {
  6509. return theValue;
  6510. }
  6511. /*:602*//*603:*/
  6512. #line 13973 "./typica.w"
  6513. void IntensityControl::mousePressEvent(QMouseEvent*event)
  6514. {
  6515. /*594:*/
  6516. #line 13717 "./typica.w"
  6517. if(event->button()!=Qt::LeftButton)
  6518. {
  6519. event->ignore();
  6520. return;
  6521. }
  6522. /*:594*/
  6523. #line 13976 "./typica.w"
  6524. scaleDown= true;
  6525. event->accept();
  6526. }
  6527. /*:603*//*604:*/
  6528. #line 13987 "./typica.w"
  6529. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  6530. {
  6531. /*594:*/
  6532. #line 13717 "./typica.w"
  6533. if(event->button()!=Qt::LeftButton)
  6534. {
  6535. event->ignore();
  6536. return;
  6537. }
  6538. /*:594*/
  6539. #line 13990 "./typica.w"
  6540. if(!scaleDown)
  6541. {
  6542. event->ignore();
  6543. return;
  6544. }
  6545. scaleDown= false;
  6546. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6547. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  6548. {
  6549. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6550. {
  6551. if(valueSet)
  6552. {
  6553. setValue(theValue+0.05);
  6554. }
  6555. event->accept();
  6556. return;
  6557. }
  6558. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  6559. {
  6560. if(valueSet)
  6561. {
  6562. setValue(theValue-0.05);
  6563. }
  6564. event->accept();
  6565. return;
  6566. }
  6567. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  6568. {
  6569. setValue(10-((sceneCoordinate.y()-16)/10.0));
  6570. event->accept();
  6571. return;
  6572. }
  6573. }
  6574. }
  6575. /*:604*/
  6576. #line 803 "./typica.w"
  6577. /*302:*/
  6578. #line 7527 "./typica.w"
  6579. void ThresholdDetector::newMeasurement(Measurement measure)
  6580. {
  6581. if((currentDirection==Ascending&&previousValue<threshold&&
  6582. previousValue>=0)||(currentDirection==Descending&&
  6583. previousValue> threshold&&previousValue>=0))
  6584. {
  6585. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  6586. (currentDirection==Descending&&measure.temperature()<=threshold))
  6587. {
  6588. double offset= measure.time().hour()*60*60;
  6589. offset+= measure.time().minute()*60;
  6590. offset+= measure.time().second();
  6591. offset+= measure.time().msec()/1000;
  6592. emit timeForValue(offset);
  6593. }
  6594. }
  6595. previousValue= measure.temperature();
  6596. }
  6597. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  6598. previousValue(-1),threshold(value),currentDirection(Ascending)
  6599. {
  6600. }
  6601. void ThresholdDetector::setThreshold(double value)
  6602. {
  6603. threshold= value;
  6604. }
  6605. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  6606. {
  6607. currentDirection= direction;
  6608. }
  6609. /*:302*/
  6610. #line 804 "./typica.w"
  6611. /*686:*/
  6612. #line 15769 "./typica.w"
  6613. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  6614. lister(new QextSerialEnumerator)
  6615. {
  6616. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  6617. QextPortInfo port;
  6618. foreach(port,ports)
  6619. {
  6620. addItem(port.portName);
  6621. }
  6622. lister->setUpNotifications();
  6623. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  6624. this,SLOT(addDevice(QextPortInfo)));
  6625. setEditable(true);
  6626. }
  6627. void PortSelector::addDevice(QextPortInfo port)
  6628. {
  6629. addItem(port.portName);
  6630. }
  6631. /*:686*/
  6632. #line 805 "./typica.w"
  6633. /*688:*/
  6634. #line 15857 "./typica.w"
  6635. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  6636. {
  6637. QMetaObject meta= BaudSelector::staticMetaObject;
  6638. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  6639. for(int i= 0;i<type.keyCount();i++)
  6640. {
  6641. addItem(QString("%1").arg(type.value(i)));
  6642. }
  6643. }
  6644. /*:688*/
  6645. #line 806 "./typica.w"
  6646. /*690:*/
  6647. #line 15895 "./typica.w"
  6648. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  6649. {
  6650. QMetaObject meta= ParitySelector::staticMetaObject;
  6651. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  6652. for(int i= 0;i<type.keyCount();i++)
  6653. {
  6654. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6655. }
  6656. }
  6657. /*:690*/
  6658. #line 807 "./typica.w"
  6659. /*692:*/
  6660. #line 15925 "./typica.w"
  6661. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  6662. {
  6663. QMetaObject meta= FlowSelector::staticMetaObject;
  6664. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  6665. for(int i= 0;i<type.keyCount();i++)
  6666. {
  6667. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6668. }
  6669. }
  6670. /*:692*/
  6671. #line 808 "./typica.w"
  6672. /*694:*/
  6673. #line 15960 "./typica.w"
  6674. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  6675. {
  6676. QMetaObject meta= StopSelector::staticMetaObject;
  6677. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  6678. for(int i= 0;i<type.keyCount();i++)
  6679. {
  6680. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6681. }
  6682. }
  6683. /*:694*/
  6684. #line 809 "./typica.w"
  6685. /*738:*/
  6686. #line 17707 "./typica.w"
  6687. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  6688. :BasicDeviceConfigurationWidget(model,index),
  6689. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  6690. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  6691. decimalQuery(new QCheckBox(tr("Enable"))),
  6692. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  6693. unitQuery(new QCheckBox(tr("Enable"))),
  6694. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  6695. valueC(new QSpinBox),fixedUnit(new QComboBox),
  6696. pVAddress(new ShortHexSpinBox),
  6697. sVEnabled(new QCheckBox(tr("Enable"))),
  6698. sVReadAddress(new ShortHexSpinBox),
  6699. deviceLimit(new QCheckBox(tr("Enable"))),
  6700. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  6701. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  6702. sVWritable(new QCheckBox(tr("Enable"))),
  6703. sVOutputAddr(new ShortHexSpinBox),
  6704. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  6705. {
  6706. QHBoxLayout*layout= new QHBoxLayout;
  6707. QWidget*form= new QWidget;
  6708. QHBoxLayout*masterLayout= new QHBoxLayout;
  6709. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  6710. QVBoxLayout*seriesLayout= new QVBoxLayout;
  6711. QFormLayout*serialSection= new QFormLayout;
  6712. serialSection->addRow(QString(tr("Port:")),port);
  6713. serialSection->addRow(QString(tr("Baud rate:")),baud);
  6714. serialSection->addRow(QString(tr("Parity:")),parity);
  6715. serialSection->addRow(QString(tr("Flow control:")),flow);
  6716. serialSection->addRow(QString(tr("Stop bits:")),stop);
  6717. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  6718. serialSectionBox->setLayout(serialSection);
  6719. portAndDeviceLayout->addWidget(serialSectionBox);
  6720. QFormLayout*deviceSection= new QFormLayout;
  6721. station->setMinimum(1);
  6722. station->setMaximum(255);
  6723. decimalPosition->setMinimum(0);
  6724. decimalPosition->setMaximum(9);
  6725. valueF->setMinimum(0);
  6726. valueF->setMaximum(0xFFFF);
  6727. valueC->setMinimum(0);
  6728. valueC->setMaximum(0xFFFF);
  6729. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  6730. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  6731. deviceSection->addRow(tr("Station:"),station);
  6732. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  6733. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  6734. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  6735. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  6736. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  6737. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  6738. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  6739. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  6740. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  6741. deviceSectionBox->setLayout(deviceSection);
  6742. portAndDeviceLayout->addWidget(deviceSectionBox);
  6743. QFormLayout*pVSection= new QFormLayout;
  6744. pVSection->addRow(tr("Value relative address:"),pVAddress);
  6745. pVSection->addRow(tr("PV column name:"),pVColumnName);
  6746. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  6747. processValueBox->setLayout(pVSection);
  6748. seriesLayout->addWidget(processValueBox);
  6749. QFormLayout*sVSection= new QFormLayout;
  6750. sVLower->setDecimals(1);
  6751. sVLower->setMinimum(0.0);
  6752. sVLower->setMaximum(999.9);
  6753. sVUpper->setDecimals(1);
  6754. sVUpper->setMinimum(0.0);
  6755. sVUpper->setMaximum(999.9);
  6756. sVSection->addRow(tr("Set value:"),sVEnabled);
  6757. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  6758. sVSection->addRow(tr("SV column name:"),sVColumnName);
  6759. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  6760. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  6761. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  6762. sVSection->addRow(tr("Lower limit:"),sVLower);
  6763. sVSection->addRow(tr("Upper limit:"),sVUpper);
  6764. sVSection->addRow(tr("Output set value:"),sVWritable);
  6765. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  6766. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  6767. setValueBox->setLayout(sVSection);
  6768. seriesLayout->addWidget(setValueBox);
  6769. masterLayout->addLayout(portAndDeviceLayout);
  6770. masterLayout->addLayout(seriesLayout);
  6771. form->setLayout(masterLayout);
  6772. /*662:*/
  6773. #line 15253 "./typica.w"
  6774. QDomElement referenceElement=
  6775. model->referenceElement(model->data(index,Qt::UserRole).toString());
  6776. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  6777. QDomElement node;
  6778. /*:662*/
  6779. #line 17793 "./typica.w"
  6780. for(int i= 0;i<configData.size();i++)
  6781. {
  6782. node= configData.at(i).toElement();
  6783. if(node.attribute("name")=="port")
  6784. {
  6785. QString portname= node.attribute("value");
  6786. int idx= port->findText(portname);
  6787. if(idx>=0)
  6788. {
  6789. port->setCurrentIndex(idx);
  6790. }
  6791. else
  6792. {
  6793. port->addItem(portname);
  6794. }
  6795. }
  6796. else if(node.attribute("name")=="baud")
  6797. {
  6798. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  6799. }
  6800. else if(node.attribute("name")=="parity")
  6801. {
  6802. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  6803. }
  6804. else if(node.attribute("name")=="flow")
  6805. {
  6806. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  6807. }
  6808. else if(node.attribute("name")=="stop")
  6809. {
  6810. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  6811. }
  6812. else if(node.attribute("name")=="station")
  6813. {
  6814. station->setValue(node.attribute("value").toInt());
  6815. }
  6816. else if(node.attribute("name")=="decimalQuery")
  6817. {
  6818. if(node.attribute("value")=="true")
  6819. {
  6820. decimalQuery->setChecked(true);
  6821. }
  6822. else
  6823. {
  6824. decimalQuery->setChecked(false);
  6825. }
  6826. }
  6827. else if(node.attribute("name")=="decimalAddress")
  6828. {
  6829. decimalAddress->setValue(node.attribute("value").toInt());
  6830. }
  6831. else if(node.attribute("name")=="decimalPosition")
  6832. {
  6833. decimalPosition->setValue(node.attribute("value").toInt());
  6834. }
  6835. else if(node.attribute("name")=="unitQuery")
  6836. {
  6837. if(node.attribute("value")=="true")
  6838. {
  6839. unitQuery->setChecked(true);
  6840. }
  6841. else
  6842. {
  6843. unitQuery->setChecked(false);
  6844. }
  6845. }
  6846. else if(node.attribute("name")=="unitAddress")
  6847. {
  6848. unitAddress->setValue(node.attribute("value").toInt());
  6849. }
  6850. else if(node.attribute("name")=="valueF")
  6851. {
  6852. valueF->setValue(node.attribute("value").toInt());
  6853. }
  6854. else if(node.attribute("name")=="valueC")
  6855. {
  6856. valueC->setValue(node.attribute("value").toInt());
  6857. }
  6858. else if(node.attribute("name")=="fixedUnit")
  6859. {
  6860. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  6861. }
  6862. else if(node.attribute("name")=="pVAddress")
  6863. {
  6864. pVAddress->setValue(node.attribute("value").toInt());
  6865. }
  6866. else if(node.attribute("name")=="sVEnabled")
  6867. {
  6868. if(node.attribute("value")=="true")
  6869. {
  6870. sVEnabled->setChecked(true);
  6871. }
  6872. else
  6873. {
  6874. sVEnabled->setChecked(false);
  6875. }
  6876. }
  6877. else if(node.attribute("name")=="sVReadAddress")
  6878. {
  6879. sVReadAddress->setValue(node.attribute("value").toInt());
  6880. }
  6881. else if(node.attribute("name")=="deviceLimit")
  6882. {
  6883. if(node.attribute("value")=="true")
  6884. {
  6885. deviceLimit->setChecked(true);
  6886. }
  6887. else
  6888. {
  6889. deviceLimit->setChecked(false);
  6890. }
  6891. }
  6892. else if(node.attribute("name")=="sVLowerAddr")
  6893. {
  6894. sVLowerAddr->setValue(node.attribute("value").toInt());
  6895. }
  6896. else if(node.attribute("name")=="sVUpperAddr")
  6897. {
  6898. sVUpperAddr->setValue(node.attribute("value").toInt());
  6899. }
  6900. else if(node.attribute("name")=="sVLower")
  6901. {
  6902. sVLower->setValue(node.attribute("value").toDouble());
  6903. }
  6904. else if(node.attribute("name")=="sVUpper")
  6905. {
  6906. sVUpper->setValue(node.attribute("value").toDouble());
  6907. }
  6908. else if(node.attribute("name")=="sVWritable")
  6909. {
  6910. if(node.attribute("value")=="true")
  6911. {
  6912. sVWritable->setChecked(true);
  6913. }
  6914. else
  6915. {
  6916. sVWritable->setChecked(false);
  6917. }
  6918. }
  6919. else if(node.attribute("name")=="sVOutputAddr")
  6920. {
  6921. sVOutputAddr->setValue(node.attribute("value").toInt());
  6922. }
  6923. else if(node.attribute("name")=="pvcolname")
  6924. {
  6925. pVColumnName->setText(node.attribute("value"));
  6926. }
  6927. else if(node.attribute("name")=="svcolname")
  6928. {
  6929. sVColumnName->setText(node.attribute("value"));
  6930. }
  6931. }
  6932. updatePort(port->currentText());
  6933. updateBaudRate(baud->currentText());
  6934. updateParity(parity->itemData(parity->currentIndex()).toString());
  6935. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  6936. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  6937. updateStation(station->value());
  6938. updateFixedDecimal(decimalQuery->isChecked());
  6939. updateDecimalAddress(decimalAddress->value());
  6940. updateDecimalPosition(decimalPosition->value());
  6941. updateFixedUnit(unitQuery->isChecked());
  6942. updateUnitAddress(unitAddress->value());
  6943. updateValueForF(valueF->value());
  6944. updateValueForC(valueC->value());
  6945. updateUnit(fixedUnit->currentText());
  6946. updatePVAddress(pVAddress->value());
  6947. updateSVEnabled(sVEnabled->isChecked());
  6948. updateSVReadAddress(sVReadAddress->value());
  6949. updateDeviceLimit(deviceLimit->isChecked());
  6950. updateSVLowerAddress(sVLowerAddr->value());
  6951. updateSVUpperAddress(sVUpperAddr->value());
  6952. updateSVLower(sVLower->value());
  6953. updateSVUpper(sVUpper->value());
  6954. updateSVWritable(sVWritable->isChecked());
  6955. updateSVWriteAddress(sVOutputAddr->value());
  6956. updatePVColumnName(pVColumnName->text());
  6957. updateSVColumnName(sVColumnName->text());
  6958. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  6959. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  6960. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  6961. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  6962. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  6963. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  6964. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  6965. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  6966. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  6967. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  6968. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  6969. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  6970. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  6971. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  6972. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  6973. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  6974. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  6975. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  6976. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  6977. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  6978. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  6979. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  6980. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  6981. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  6982. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  6983. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  6984. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  6985. layout->addWidget(form);
  6986. setLayout(layout);
  6987. }
  6988. void ModbusConfigurator::updatePort(const QString&newPort)
  6989. {
  6990. updateAttribute("port",newPort);
  6991. }
  6992. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  6993. {
  6994. updateAttribute("baud",newRate);
  6995. }
  6996. void ModbusConfigurator::updateParity(const QString&)
  6997. {
  6998. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  6999. }
  7000. void ModbusConfigurator::updateFlowControl(const QString&)
  7001. {
  7002. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  7003. }
  7004. void ModbusConfigurator::updateStopBits(const QString&)
  7005. {
  7006. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  7007. }
  7008. void ModbusConfigurator::updateStation(int station)
  7009. {
  7010. updateAttribute("station",QString("%1").arg(station));
  7011. }
  7012. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  7013. {
  7014. updateAttribute("decimalQuery",fixed?"true":"false");
  7015. }
  7016. void ModbusConfigurator::updateDecimalAddress(int address)
  7017. {
  7018. updateAttribute("decimalAddress",QString("%1").arg(address));
  7019. }
  7020. void ModbusConfigurator::updateDecimalPosition(int position)
  7021. {
  7022. updateAttribute("decimalPosition",QString("%1").arg(position));
  7023. }
  7024. void ModbusConfigurator::updateFixedUnit(bool fixed)
  7025. {
  7026. updateAttribute("unitQuery",fixed?"true":"false");
  7027. }
  7028. void ModbusConfigurator::updateUnitAddress(int address)
  7029. {
  7030. updateAttribute("unitAddress",QString("%1").arg(address));
  7031. }
  7032. void ModbusConfigurator::updateValueForF(int value)
  7033. {
  7034. updateAttribute("valueF",QString("%1").arg(value));
  7035. }
  7036. void ModbusConfigurator::updateValueForC(int value)
  7037. {
  7038. updateAttribute("valueC",QString("%1").arg(value));
  7039. }
  7040. void ModbusConfigurator::updateUnit(const QString&newUnit)
  7041. {
  7042. updateAttribute("fixedUnit",newUnit);
  7043. }
  7044. void ModbusConfigurator::updatePVAddress(int address)
  7045. {
  7046. updateAttribute("pVAddress",QString("%1").arg(address));
  7047. }
  7048. void ModbusConfigurator::updateSVEnabled(bool enabled)
  7049. {
  7050. updateAttribute("sVEnabled",enabled?"true":"false");
  7051. }
  7052. void ModbusConfigurator::updateSVReadAddress(int address)
  7053. {
  7054. updateAttribute("sVReadAddress",QString("%1").arg(address));
  7055. }
  7056. void ModbusConfigurator::updateDeviceLimit(bool query)
  7057. {
  7058. updateAttribute("deviceLimit",query?"true":"false");
  7059. }
  7060. void ModbusConfigurator::updateSVLowerAddress(int address)
  7061. {
  7062. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  7063. }
  7064. void ModbusConfigurator::updateSVUpperAddress(int address)
  7065. {
  7066. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  7067. }
  7068. void ModbusConfigurator::updateSVLower(double value)
  7069. {
  7070. updateAttribute("sVLower",QString("%1").arg(value));
  7071. }
  7072. void ModbusConfigurator::updateSVUpper(double value)
  7073. {
  7074. updateAttribute("sVUpper",QString("%1").arg(value));
  7075. }
  7076. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  7077. {
  7078. updateAttribute("sVWritable",canWriteSV?"true":"false");
  7079. }
  7080. void ModbusConfigurator::updateSVWriteAddress(int address)
  7081. {
  7082. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  7083. }
  7084. void ModbusConfigurator::updatePVColumnName(const QString&name)
  7085. {
  7086. updateAttribute("pvcolname",name);
  7087. }
  7088. void ModbusConfigurator::updateSVColumnName(const QString&name)
  7089. {
  7090. updateAttribute("svcolname",name);
  7091. }
  7092. /*:738*/
  7093. #line 810 "./typica.w"
  7094. /*697:*/
  7095. #line 16009 "./typica.w"
  7096. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  7097. {
  7098. setMinimum(0);
  7099. setMaximum(0xFFFF);
  7100. setPrefix("0x");
  7101. setMinimumWidth(65);
  7102. }
  7103. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  7104. {
  7105. if(input.size()==2)
  7106. {
  7107. return QValidator::Intermediate;
  7108. }
  7109. bool okay;
  7110. input.toInt(&okay,16);
  7111. if(okay)
  7112. {
  7113. return QValidator::Acceptable;
  7114. }
  7115. return QValidator::Invalid;
  7116. }
  7117. int ShortHexSpinBox::valueFromText(const QString&text)const
  7118. {
  7119. return text.toInt(NULL,16);
  7120. }
  7121. QString ShortHexSpinBox::textFromValue(int value)const
  7122. {
  7123. QString retval;
  7124. retval.setNum(value,16);
  7125. while(retval.size()<4)
  7126. {
  7127. retval.prepend("0");
  7128. }
  7129. return retval.toUpper();
  7130. }
  7131. /*:697*/
  7132. #line 811 "./typica.w"
  7133. /*723:*/
  7134. #line 17037 "./typica.w"
  7135. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  7136. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  7137. waiting(false)
  7138. {
  7139. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  7140. Qt::UserRole).toString());
  7141. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  7142. QDomElement node;
  7143. QVariantMap attributes;
  7144. for(int i= 0;i<portConfigData.size();i++)
  7145. {
  7146. node= portConfigData.at(i).toElement();
  7147. attributes.insert(node.attribute("name"),node.attribute("value"));
  7148. }
  7149. port= new QextSerialPort(attributes.value("port").toString(),
  7150. QextSerialPort::EventDriven);
  7151. int baudRate= attributes.value("baud").toInt();
  7152. port->setBaudRate((BaudRateType)baudRate);
  7153. double temp= ((double)(1)/(double)(baudRate))*48;
  7154. delayTime= (int)(temp*3000);
  7155. messageDelayTimer->setSingleShot(true);
  7156. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  7157. port->setDataBits(DATA_8);
  7158. port->setParity((ParityType)attributes.value("parity").toInt());
  7159. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  7160. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  7161. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  7162. port->open(QIODevice::ReadWrite);
  7163. station= (char)attributes.value("station").toInt();
  7164. if(attributes.value("decimalQuery")=="true")
  7165. {
  7166. decimalPosition= 0;
  7167. QByteArray message;
  7168. message.append(station);
  7169. message.append((char)0x03);
  7170. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  7171. char*addressBytes= (char*)&address;
  7172. message.append(addressBytes[1]);
  7173. message.append(addressBytes[0]);
  7174. message.append((char)0x00);
  7175. message.append((char)0x01);
  7176. queueMessage(message,this,"decimalResponse(QByteArray)");
  7177. }
  7178. else
  7179. {
  7180. decimalPosition= attributes.value("decimalPosition").toInt();
  7181. }
  7182. valueF= attributes.value("valueF").toInt();
  7183. valueC= attributes.value("valueC").toInt();
  7184. if(attributes.value("unitQuery")=="true")
  7185. {
  7186. QByteArray message;
  7187. message.append(station);
  7188. message.append((char)0x03);
  7189. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  7190. char*addressBytes= (char*)&address;
  7191. message.append(addressBytes[1]);
  7192. message.append(addressBytes[0]);
  7193. message.append((char)0x00);
  7194. message.append((char)0x01);
  7195. queueMessage(message,this,"unitResponse(QByteArray)");
  7196. }
  7197. else
  7198. {
  7199. if(attributes.value("fixedUnit")=="Celsius")
  7200. {
  7201. unitIsF= false;
  7202. }
  7203. }
  7204. if(attributes.value("sVWritable")=="true")
  7205. {
  7206. if(attributes.value("deviceLimit")=="true")
  7207. {
  7208. QByteArray lmessage;
  7209. lmessage.append(station);
  7210. lmessage.append((char)0x03);
  7211. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  7212. char*addressBytes= (char*)&laddress;
  7213. lmessage.append(addressBytes[1]);
  7214. lmessage.append(addressBytes[0]);
  7215. lmessage.append((char)0x00);
  7216. lmessage.append((char)0x01);
  7217. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  7218. QByteArray umessage;
  7219. umessage.append(station);
  7220. umessage.append((char)0x03);
  7221. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  7222. addressBytes= (char*)&uaddress;
  7223. umessage.append(addressBytes[1]);
  7224. umessage.append(addressBytes[0]);
  7225. umessage.append((char)0x00);
  7226. umessage.append((char)0x01);
  7227. queueMessage(umessage,this,"svuResponse(QByteArray)");
  7228. }
  7229. else
  7230. {
  7231. outputSVLower= attributes.value("sVLower").toDouble();
  7232. outputSVUpper= attributes.value("sVUpper").toDouble();
  7233. }
  7234. outputSVStub.append(station);
  7235. outputSVStub.append((char)0x06);
  7236. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  7237. char*addressBytes= (char*)&address;
  7238. outputSVStub.append(addressBytes[1]);
  7239. outputSVStub.append(addressBytes[0]);
  7240. }
  7241. Channel*pv= new Channel;
  7242. channels.append(pv);
  7243. pvStub.append(station);
  7244. pvStub.append((char)0x04);
  7245. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  7246. char*pvac= (char*)&pvaddress;
  7247. pvStub.append(pvac[1]);
  7248. pvStub.append(pvac[0]);
  7249. pvStub.append((char)0x00);
  7250. pvStub.append((char)0x01);
  7251. svenabled= attributes.value("sVEnabled").toBool();
  7252. if(svenabled)
  7253. {
  7254. Channel*sv= new Channel;
  7255. channels.append(sv);
  7256. svStub.append(station);
  7257. svStub.append((char)0x04);
  7258. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  7259. char*svac= (char*)&svaddress;
  7260. svStub.append(svac[1]);
  7261. svStub.append(svac[0]);
  7262. svStub.append((char)0x00);
  7263. svStub.append((char)0x01);
  7264. if(svaddress-pvaddress==1)
  7265. {
  7266. mStub.append(station);
  7267. mStub.append((char)0x04);
  7268. mStub.append(pvac[1]);
  7269. mStub.append(pvac[0]);
  7270. mStub.append((char)0x00);
  7271. mStub.append((char)0x02);
  7272. }
  7273. }
  7274. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  7275. requestMeasurement();
  7276. }
  7277. double ModbusRTUDevice::SVLower()
  7278. {
  7279. return outputSVLower;
  7280. }
  7281. double ModbusRTUDevice::SVUpper()
  7282. {
  7283. return outputSVUpper;
  7284. }
  7285. int ModbusRTUDevice::decimals()
  7286. {
  7287. return decimalPosition;
  7288. }
  7289. void ModbusRTUDevice::decimalResponse(QByteArray response)
  7290. {
  7291. quint16 temp;
  7292. char*tchar= (char*)&temp;
  7293. tchar[1]= response.at(3);
  7294. tchar[0]= response.at(4);
  7295. decimalPosition= temp;
  7296. emit SVDecimalChanged(decimalPosition);
  7297. qDebug()<<"Received decimal response";
  7298. }
  7299. void ModbusRTUDevice::unitResponse(QByteArray response)
  7300. {
  7301. quint16 temp;
  7302. char*tchar= (char*)&temp;
  7303. tchar[1]= response.at(3);
  7304. tchar[0]= response.at(4);
  7305. int value= temp;
  7306. if(value==valueF)
  7307. {
  7308. unitIsF= true;
  7309. }
  7310. else
  7311. {
  7312. unitIsF= false;
  7313. }
  7314. }
  7315. void ModbusRTUDevice::svlResponse(QByteArray response)
  7316. {
  7317. quint16 temp;
  7318. char*tchar= (char*)&temp;
  7319. tchar[1]= response.at(3);
  7320. tchar[0]= response.at(4);
  7321. outputSVLower= (double)temp;
  7322. for(int i= 0;i<decimalPosition;i++)
  7323. {
  7324. outputSVLower/= 10;
  7325. }
  7326. emit SVLowerChanged(outputSVLower);
  7327. }
  7328. void ModbusRTUDevice::svuResponse(QByteArray response)
  7329. {
  7330. quint16 temp;
  7331. char*tchar= (char*)&temp;
  7332. tchar[1]= response.at(3);
  7333. tchar[0]= response.at(4);
  7334. outputSVUpper= (double)temp;
  7335. for(int i= 0;i<decimalPosition;i++)
  7336. {
  7337. outputSVUpper/= 10;
  7338. }
  7339. emit SVUpperChanged(outputSVUpper);
  7340. }
  7341. void ModbusRTUDevice::requestMeasurement()
  7342. {
  7343. if(mStub.length()> 0)
  7344. {
  7345. queueMessage(mStub,this,"mResponse(QByteArray)");
  7346. }
  7347. else
  7348. {
  7349. queueMessage(pvStub,this,"mResponse(QByteArray)");
  7350. if(svenabled)
  7351. {
  7352. queueMessage(svStub,this,"mResponse(QByteArray)");
  7353. }
  7354. }
  7355. }
  7356. void ModbusRTUDevice::mResponse(QByteArray response)
  7357. {
  7358. QTime time= QTime::currentTime();
  7359. if(response.at(2)==0x04)
  7360. {
  7361. /*724:*/
  7362. #line 17286 "./typica.w"
  7363. quint16 pv;
  7364. quint16 sv;
  7365. char*pvBytes= (char*)&pv;
  7366. char*svBytes= (char*)&sv;
  7367. pvBytes[1]= response.at(3);
  7368. pvBytes[0]= response.at(4);
  7369. svBytes[1]= response.at(5);
  7370. svBytes[0]= response.at(6);
  7371. double pvOut= (double)pv;
  7372. double svOut= (double)sv;
  7373. for(int i= 0;i<decimalPosition;i++)
  7374. {
  7375. pvOut/= 10;
  7376. svOut/= 10;
  7377. }
  7378. if(!unitIsF)
  7379. {
  7380. pvOut= pvOut*9/5+32;
  7381. svOut= svOut*9/5+32;
  7382. }
  7383. Measurement pvm(pvOut,time,Measurement::Fahrenheit);
  7384. Measurement svm(svOut,time,Measurement::Fahrenheit);
  7385. channels.at(0)->input(pvm);
  7386. channels.at(1)->input(svm);
  7387. /*:724*/
  7388. #line 17273 "./typica.w"
  7389. }
  7390. else
  7391. {
  7392. /*725:*/
  7393. #line 17316 "./typica.w"
  7394. quint16 value;
  7395. char*valueBytes= (char*)&value;
  7396. valueBytes[1]= response.at(3);
  7397. valueBytes[0]= response.at(4);
  7398. double valueOut= (double)value;
  7399. for(int i= 0;i<decimalPosition;i++)
  7400. {
  7401. valueOut/= 10;
  7402. }
  7403. if(!unitIsF)
  7404. {
  7405. valueOut= valueOut*9/5+32;
  7406. }
  7407. if(!svenabled)
  7408. {
  7409. Measurement vm(valueOut,time,Measurement::Fahrenheit);
  7410. channels.at(0)->input(vm);
  7411. }
  7412. else
  7413. {
  7414. if(readingsv)
  7415. {
  7416. Measurement pvm(savedpv,time,Measurement::Fahrenheit);
  7417. Measurement svm(valueOut,time,Measurement::Fahrenheit);
  7418. channels.at(0)->input(pvm);
  7419. channels.at(1)->input(svm);
  7420. readingsv= false;
  7421. }
  7422. else
  7423. {
  7424. savedpv= valueOut;
  7425. readingsv= true;
  7426. }
  7427. }
  7428. /*:725*/
  7429. #line 17277 "./typica.w"
  7430. }
  7431. }
  7432. /*:723*//*726:*/
  7433. #line 17354 "./typica.w"
  7434. ModbusRTUDevice::~ModbusRTUDevice()
  7435. {
  7436. messageDelayTimer->stop();
  7437. port->close();
  7438. }
  7439. /*:726*//*727:*/
  7440. #line 17376 "./typica.w"
  7441. void ModbusRTUDevice::dataAvailable()
  7442. {
  7443. if(messageDelayTimer->isActive())
  7444. {
  7445. messageDelayTimer->stop();
  7446. }
  7447. responseBuffer.append(port->readAll());
  7448. /*728:*/
  7449. #line 17421 "./typica.w"
  7450. if(responseBuffer.size()<5)
  7451. {
  7452. return;
  7453. }
  7454. switch(responseBuffer.at(1))
  7455. {
  7456. case 0x01:
  7457. case 0x02:
  7458. if(responseBuffer.size()<6)
  7459. {
  7460. return;
  7461. }
  7462. responseBuffer= responseBuffer.left(6);
  7463. break;
  7464. case 0x03:
  7465. case 0x04:
  7466. if(responseBuffer.size()<5+responseBuffer.at(2))
  7467. {
  7468. return;
  7469. }
  7470. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  7471. break;
  7472. case 0x05:
  7473. case 0x06:
  7474. case 0x10:
  7475. if(responseBuffer.size()<8)
  7476. {
  7477. return;
  7478. }
  7479. responseBuffer= responseBuffer.left(8);
  7480. break;
  7481. }
  7482. /*:728*/
  7483. #line 17384 "./typica.w"
  7484. if(calculateCRC(responseBuffer)==0)
  7485. {
  7486. QObject*object= retObjQueue.at(0);
  7487. char*method= callbackQueue.at(0);
  7488. QMetaMethod metamethod= object->metaObject()->
  7489. method(object->metaObject()->
  7490. indexOfMethod(QMetaObject::normalizedSignature(method)));
  7491. metamethod.invoke(object,Qt::QueuedConnection,
  7492. Q_ARG(QByteArray,responseBuffer));
  7493. messageQueue.removeAt(0);
  7494. retObjQueue.removeAt(0);
  7495. callbackQueue.removeAt(0);
  7496. messageDelayTimer->start(delayTime);
  7497. }
  7498. else
  7499. {
  7500. qDebug()<<"CRC failed";
  7501. }
  7502. waiting= false;
  7503. responseBuffer.clear();
  7504. }
  7505. /*:727*//*729:*/
  7506. #line 17463 "./typica.w"
  7507. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  7508. {
  7509. quint16 retval= 0xFFFF;
  7510. int i= 0;
  7511. while(i<data.size())
  7512. {
  7513. retval^= 0x00FF&(quint16)data.at(i);
  7514. for(int j= 0;j<8;j++)
  7515. {
  7516. if(retval&1)
  7517. {
  7518. retval= (retval>>1)^0xA001;
  7519. }
  7520. else
  7521. {
  7522. retval>>= 1;
  7523. }
  7524. }
  7525. i++;
  7526. }
  7527. return retval;
  7528. }
  7529. /*:729*//*730:*/
  7530. #line 17494 "./typica.w"
  7531. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  7532. const char*callback)
  7533. {
  7534. messageQueue.append(request);
  7535. retObjQueue.append(object);
  7536. callbackQueue.append(const_cast<char*> (callback));
  7537. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  7538. {
  7539. sendNextMessage();
  7540. }
  7541. }
  7542. void ModbusRTUDevice::sendNextMessage()
  7543. {
  7544. if(messageQueue.size()> 0&&!waiting)
  7545. {
  7546. QByteArray message= messageQueue.at(0);
  7547. quint16 crc= calculateCRC(message);
  7548. char*check= (char*)&crc;
  7549. message.append(check[0]);
  7550. message.append(check[1]);
  7551. port->write(message);
  7552. messageDelayTimer->start(delayTime);
  7553. waiting= true;
  7554. }
  7555. else
  7556. {
  7557. emit queueEmpty();
  7558. }
  7559. }
  7560. void ModbusRTUDevice::outputSV(double value)
  7561. {
  7562. for(int i= 0;i<decimalPosition;i++)
  7563. {
  7564. value*= 10;
  7565. }
  7566. quint16 outval= (quint16)value;
  7567. QByteArray message(outputSVStub);
  7568. char*valBytes= (char*)&outval;
  7569. message.append(valBytes[1]);
  7570. message.append(valBytes[0]);
  7571. queueMessage(message,this,"ignore(QByteArray)");
  7572. }
  7573. /*:730*//*731:*/
  7574. #line 17542 "./typica.w"
  7575. void ModbusRTUDevice::ignore(QByteArray)
  7576. {
  7577. return;
  7578. }
  7579. /*:731*/
  7580. #line 812 "./typica.w"
  7581. /*616:*/
  7582. #line 14245 "./typica.w"
  7583. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  7584. DeviceTreeModelNode*parent)
  7585. :domNode(node),rowNumber(row),parentItem(parent)
  7586. {
  7587. }
  7588. DeviceTreeModelNode::~DeviceTreeModelNode()
  7589. {
  7590. QHash<int,DeviceTreeModelNode*> ::iterator i;
  7591. for(i= children.begin();i!=children.end();i++)
  7592. {
  7593. delete i.value();
  7594. }
  7595. }
  7596. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  7597. {
  7598. return parentItem;
  7599. }
  7600. int DeviceTreeModelNode::row()
  7601. {
  7602. return rowNumber;
  7603. }
  7604. QDomNode DeviceTreeModelNode::node()const
  7605. {
  7606. return domNode;
  7607. }
  7608. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  7609. {
  7610. if(children.contains(index))
  7611. {
  7612. return children[index];
  7613. }
  7614. if(index>=0&&index<domNode.childNodes().count())
  7615. {
  7616. QDomNode childNode= domNode.childNodes().item(index);
  7617. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  7618. index,this);
  7619. children[index]= childItem;
  7620. return childItem;
  7621. }
  7622. return NULL;
  7623. }
  7624. /*:616*/
  7625. #line 813 "./typica.w"
  7626. /*618:*/
  7627. #line 14334 "./typica.w"
  7628. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  7629. :QAbstractItemModel(parent)
  7630. {
  7631. document= AppInstance->deviceConfiguration();
  7632. QDomNodeList elements= document.elementsByTagName("devices");
  7633. if(elements.size()!=1)
  7634. {
  7635. qDebug()<<"Unexpected result when loading device map.";
  7636. }
  7637. treeRoot= elements.at(0);
  7638. root= new DeviceTreeModelNode(treeRoot,0);
  7639. elements= document.elementsByTagName("references");
  7640. if(elements.size()!=1)
  7641. {
  7642. qDebug()<<"No references section. Creating.";
  7643. referenceSection= document.createElement("references");
  7644. document.appendChild(referenceSection);
  7645. }
  7646. else
  7647. {
  7648. referenceSection= elements.at(0);
  7649. }
  7650. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  7651. AppInstance,SLOT(saveDeviceConfiguration()));
  7652. connect(this,SIGNAL(modelReset()),
  7653. AppInstance,SLOT(saveDeviceConfiguration()));
  7654. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7655. AppInstance,SLOT(saveDeviceConfiguration()));
  7656. }
  7657. /*:618*//*619:*/
  7658. #line 14369 "./typica.w"
  7659. int DeviceTreeModel::columnCount(const QModelIndex&)const
  7660. {
  7661. return 1;
  7662. }
  7663. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  7664. {
  7665. if(parent.column()> 0)
  7666. {
  7667. return 0;
  7668. }
  7669. /*620:*/
  7670. #line 14388 "./typica.w"
  7671. DeviceTreeModelNode*parentItem;
  7672. if(!parent.isValid())
  7673. {
  7674. parentItem= root;
  7675. }
  7676. else
  7677. {
  7678. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7679. }
  7680. /*:620*/
  7681. #line 14381 "./typica.w"
  7682. return parentItem->node().childNodes().count();
  7683. }
  7684. /*:619*//*621:*/
  7685. #line 14402 "./typica.w"
  7686. QModelIndex DeviceTreeModel::index(int row,int column,
  7687. const QModelIndex&parent)const
  7688. {
  7689. if(!hasIndex(row,column,parent))
  7690. {
  7691. return QModelIndex();
  7692. }
  7693. /*620:*/
  7694. #line 14388 "./typica.w"
  7695. DeviceTreeModelNode*parentItem;
  7696. if(!parent.isValid())
  7697. {
  7698. parentItem= root;
  7699. }
  7700. else
  7701. {
  7702. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7703. }
  7704. /*:620*/
  7705. #line 14410 "./typica.w"
  7706. DeviceTreeModelNode*childItem= parentItem->child(row);
  7707. if(childItem)
  7708. {
  7709. return createIndex(row,column,childItem);
  7710. }
  7711. return QModelIndex();
  7712. }
  7713. /*:621*//*622:*/
  7714. #line 14421 "./typica.w"
  7715. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  7716. {
  7717. if(!child.isValid())
  7718. {
  7719. return QModelIndex();
  7720. }
  7721. DeviceTreeModelNode*childItem=
  7722. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  7723. DeviceTreeModelNode*parentItem= childItem->parent();
  7724. if(!parentItem||parentItem==root)
  7725. {
  7726. return QModelIndex();
  7727. }
  7728. return createIndex(parentItem->row(),0,parentItem);
  7729. }
  7730. /*:622*//*623:*/
  7731. #line 14440 "./typica.w"
  7732. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  7733. {
  7734. if(!index.isValid())
  7735. {
  7736. return 0;
  7737. }
  7738. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  7739. }
  7740. /*:623*//*624:*/
  7741. #line 14455 "./typica.w"
  7742. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  7743. {
  7744. if(!index.isValid())
  7745. {
  7746. return QVariant();
  7747. }
  7748. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  7749. {
  7750. return QVariant();
  7751. }
  7752. DeviceTreeModelNode*item=
  7753. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7754. QDomNode node= item->node();
  7755. QDomElement element= node.toElement();
  7756. switch(role)
  7757. {
  7758. case Qt::DisplayRole:
  7759. case Qt::EditRole:
  7760. return QVariant(element.attribute("name"));
  7761. case Qt::UserRole:
  7762. return QVariant(element.attribute("reference"));
  7763. default:
  7764. return QVariant();
  7765. }
  7766. return QVariant();
  7767. }
  7768. /*:624*//*625:*/
  7769. #line 14487 "./typica.w"
  7770. bool DeviceTreeModel::setData(const QModelIndex&index,
  7771. const QVariant&value,int)
  7772. {
  7773. if(!index.isValid())
  7774. {
  7775. return false;
  7776. }
  7777. DeviceTreeModelNode*item=
  7778. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7779. QDomNode node= item->node();
  7780. QDomElement element= node.toElement();
  7781. element.setAttribute("name",value.toString());
  7782. emit dataChanged(index,index);
  7783. return true;
  7784. }
  7785. /*:625*//*626:*/
  7786. #line 14510 "./typica.w"
  7787. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  7788. const QModelIndex&parent)
  7789. {
  7790. QString referenceID= QUuid::createUuid().toString();
  7791. /*620:*/
  7792. #line 14388 "./typica.w"
  7793. DeviceTreeModelNode*parentItem;
  7794. if(!parent.isValid())
  7795. {
  7796. parentItem= root;
  7797. }
  7798. else
  7799. {
  7800. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7801. }
  7802. /*:620*/
  7803. #line 14515 "./typica.w"
  7804. QDomNode parentNode= parentItem->node();
  7805. int newRowNumber= rowCount(parent);
  7806. beginInsertRows(parent,newRowNumber,newRowNumber);
  7807. QDomElement deviceElement= document.createElement("node");
  7808. deviceElement.setAttribute("name",name);
  7809. deviceElement.setAttribute("reference",referenceID);
  7810. parentNode.appendChild(deviceElement);
  7811. QDomElement referenceElement= document.createElement("reference");
  7812. referenceElement.setAttribute("id",referenceID);
  7813. referenceElement.setAttribute("driver",driver);
  7814. referenceSection.appendChild(referenceElement);
  7815. endInsertRows();
  7816. }
  7817. /*:626*//*627:*/
  7818. #line 14533 "./typica.w"
  7819. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  7820. {
  7821. /*620:*/
  7822. #line 14388 "./typica.w"
  7823. DeviceTreeModelNode*parentItem;
  7824. if(!parent.isValid())
  7825. {
  7826. parentItem= root;
  7827. }
  7828. else
  7829. {
  7830. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7831. }
  7832. /*:620*/
  7833. #line 14536 "./typica.w"
  7834. QDomNode parentNode= parentItem->node();
  7835. QDomNodeList childNodes= parentNode.childNodes();
  7836. if(childNodes.size()<row+count)
  7837. {
  7838. return false;
  7839. }
  7840. beginRemoveRows(parent,row,row+count-1);
  7841. QList<QDomElement> removalList;
  7842. for(int i= row;i<row+count;i++)
  7843. {
  7844. removalList.append(childNodes.at(i).toElement());
  7845. }
  7846. QDomElement element;
  7847. QDomElement reference;
  7848. for(int i= 0;i<count;i++)
  7849. {
  7850. element= removalList.at(i);
  7851. if(element.hasAttribute("reference"))
  7852. {
  7853. reference= referenceElement(element.attribute("reference"));
  7854. if(!reference.isNull())
  7855. {
  7856. referenceSection.removeChild(reference);
  7857. }
  7858. }
  7859. parentNode.removeChild(element);
  7860. }
  7861. endRemoveRows();
  7862. beginResetModel();
  7863. delete root;
  7864. root= new DeviceTreeModelNode(treeRoot,0);
  7865. endResetModel();
  7866. return true;
  7867. }
  7868. /*:627*//*628:*/
  7869. #line 14575 "./typica.w"
  7870. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  7871. {
  7872. QDomNodeList childNodes= referenceSection.childNodes();
  7873. QDomElement element;
  7874. for(int i= 0;i<childNodes.size();i++)
  7875. {
  7876. element= childNodes.at(i).toElement();
  7877. if(element.hasAttribute("id"))
  7878. {
  7879. if(element.attribute("id")==id)
  7880. {
  7881. return element;
  7882. }
  7883. }
  7884. }
  7885. return QDomElement();
  7886. }
  7887. /*:628*//*629:*/
  7888. #line 14596 "./typica.w"
  7889. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  7890. {
  7891. return QVariant();
  7892. }
  7893. /*:629*//*630:*/
  7894. #line 14605 "./typica.w"
  7895. DeviceTreeModel::~DeviceTreeModel()
  7896. {
  7897. delete root;
  7898. }
  7899. /*:630*/
  7900. #line 814 "./typica.w"
  7901. /*657:*/
  7902. #line 15095 "./typica.w"
  7903. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  7904. DeviceTreeModel*model,const QModelIndex&index)
  7905. :QWidget(NULL),deviceModel(model),currentNode(index)
  7906. {
  7907. }
  7908. /*:657*//*658:*/
  7909. #line 15107 "./typica.w"
  7910. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  7911. const QString&value)
  7912. {
  7913. QDomElement referenceElement= deviceModel->referenceElement(
  7914. deviceModel->data(currentNode,Qt::UserRole).toString());
  7915. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7916. QDomElement node;
  7917. bool found= false;
  7918. for(int i= 0;i<configData.size();i++)
  7919. {
  7920. node= configData.at(i).toElement();
  7921. if(node.attribute("name")==name)
  7922. {
  7923. node.setAttribute("value",value);
  7924. found= true;
  7925. break;
  7926. }
  7927. }
  7928. if(!found)
  7929. {
  7930. node= AppInstance->deviceConfiguration().createElement("attribute");
  7931. node.setAttribute("name",name);
  7932. node.setAttribute("value",value);
  7933. referenceElement.appendChild(node);
  7934. }
  7935. AppInstance->saveDeviceConfiguration();
  7936. }
  7937. /*:658*//*659:*/
  7938. #line 15141 "./typica.w"
  7939. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  7940. const QString&driver)
  7941. {
  7942. deviceModel->newNode(name,driver,currentNode);
  7943. }
  7944. /*:659*/
  7945. #line 815 "./typica.w"
  7946. /*648:*/
  7947. #line 14945 "./typica.w"
  7948. DeviceConfigurationWindow::DeviceConfigurationWindow():QMainWindow(NULL),
  7949. view(new QTreeView),configArea(new QScrollArea)
  7950. {
  7951. QSplitter*splitter= new QSplitter;
  7952. QWidget*leftWidget= new QWidget;
  7953. leftWidget->setMinimumWidth(200);
  7954. QVBoxLayout*left= new QVBoxLayout;
  7955. view->setAnimated(true);
  7956. view->setSelectionMode(QAbstractItemView::SingleSelection);
  7957. document= AppInstance->deviceConfiguration();
  7958. model= new DeviceTreeModel;
  7959. view->setModel(model);
  7960. view->setTextElideMode(Qt::ElideNone);
  7961. view->expandAll();
  7962. view->resizeColumnToContents(0);
  7963. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  7964. QHBoxLayout*treeButtons= new QHBoxLayout;
  7965. QToolButton*addDeviceButton= new QToolButton;
  7966. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  7967. addDeviceButton->setToolTip(tr("New Roaster"));
  7968. connect(addDeviceButton,SIGNAL(clicked()),
  7969. this,SLOT(addDevice()));
  7970. QToolButton*removeNodeButton= new QToolButton;
  7971. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  7972. removeNodeButton->setToolTip(tr("Delete Selection"));
  7973. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  7974. treeButtons->addWidget(addDeviceButton);
  7975. treeButtons->addWidget(removeNodeButton);
  7976. left->addWidget(view);
  7977. left->addLayout(treeButtons);
  7978. leftWidget->setLayout(left);
  7979. splitter->addWidget(leftWidget);
  7980. configArea->setMinimumWidth(580);
  7981. configArea->setMinimumHeight(460);
  7982. splitter->addWidget(configArea);
  7983. setCentralWidget(splitter);
  7984. connect(view,SIGNAL(activated(QModelIndex)),
  7985. this,SLOT(newSelection(QModelIndex)));
  7986. connect(view,SIGNAL(clicked(QModelIndex)),
  7987. this,SLOT(newSelection(QModelIndex)));
  7988. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7989. view,SLOT(expand(QModelIndex)));
  7990. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7991. this,SLOT(resizeColumn()));
  7992. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  7993. this,SLOT(resizeColumn()));
  7994. }
  7995. /*:648*//*649:*/
  7996. #line 14997 "./typica.w"
  7997. void DeviceConfigurationWindow::addDevice()
  7998. {
  7999. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  8000. }
  8001. /*:649*//*650:*/
  8002. #line 15005 "./typica.w"
  8003. void DeviceConfigurationWindow::removeNode()
  8004. {
  8005. QModelIndex index= view->currentIndex();
  8006. if(index.isValid())
  8007. {
  8008. int row= index.row();
  8009. QModelIndex parent= index.parent();
  8010. model->removeRow(row,parent);
  8011. }
  8012. }
  8013. /*:650*//*651:*/
  8014. #line 15021 "./typica.w"
  8015. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  8016. {
  8017. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  8018. if(editor)
  8019. {
  8020. configArea->setWidget(editor);
  8021. editor->show();
  8022. }
  8023. }
  8024. /*:651*//*652:*/
  8025. #line 15038 "./typica.w"
  8026. void DeviceConfigurationWindow::resizeColumn()
  8027. {
  8028. view->resizeColumnToContents(0);
  8029. }
  8030. /*:652*/
  8031. #line 816 "./typica.w"
  8032. /*672:*/
  8033. #line 15443 "./typica.w"
  8034. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  8035. const QModelIndex&index):
  8036. BasicDeviceConfigurationWidget(model,index)
  8037. {
  8038. QFormLayout*layout= new QFormLayout;
  8039. QLineEdit*columnName= new QLineEdit;
  8040. layout->addRow(tr("Column Name:"),columnName);
  8041. QComboBox*typeSelector= new QComboBox;
  8042. typeSelector->addItem("J");
  8043. typeSelector->addItem("K");
  8044. typeSelector->addItem("T");
  8045. typeSelector->addItem("B");
  8046. typeSelector->addItem("E");
  8047. typeSelector->addItem("N");
  8048. typeSelector->addItem("R");
  8049. typeSelector->addItem("S");
  8050. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8051. setLayout(layout);
  8052. /*662:*/
  8053. #line 15253 "./typica.w"
  8054. QDomElement referenceElement=
  8055. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8056. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8057. QDomElement node;
  8058. /*:662*/
  8059. #line 15462 "./typica.w"
  8060. for(int i= 0;i<configData.size();i++)
  8061. {
  8062. node= configData.at(i).toElement();
  8063. if(node.attribute("name")=="type")
  8064. {
  8065. typeSelector->setCurrentIndex(
  8066. typeSelector->findText(node.attribute("value")));
  8067. }
  8068. else if(node.attribute("name")=="columnname")
  8069. {
  8070. columnName->setText(node.attribute("value"));
  8071. }
  8072. }
  8073. updateThermocoupleType(typeSelector->currentText());
  8074. updateColumnName(columnName->text());
  8075. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  8076. this,SLOT(updateThermocoupleType(QString)));
  8077. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8078. }
  8079. /*:672*//*673:*/
  8080. #line 15486 "./typica.w"
  8081. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  8082. {
  8083. updateAttribute("type",type);
  8084. }
  8085. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  8086. {
  8087. updateAttribute("columnname",name);
  8088. }
  8089. /*:673*/
  8090. #line 817 "./typica.w"
  8091. /*668:*/
  8092. #line 15358 "./typica.w"
  8093. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  8094. const QModelIndex&index)
  8095. :BasicDeviceConfigurationWidget(model,index)
  8096. {
  8097. QVBoxLayout*layout= new QVBoxLayout;
  8098. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8099. QLabel*label= new QLabel(tr("Device ID:"));
  8100. QLineEdit*deviceId= new QLineEdit;
  8101. deviceIdLayout->addWidget(label);
  8102. deviceIdLayout->addWidget(deviceId);
  8103. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8104. layout->addLayout(deviceIdLayout);
  8105. layout->addWidget(addChannelButton);
  8106. /*662:*/
  8107. #line 15253 "./typica.w"
  8108. QDomElement referenceElement=
  8109. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8110. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8111. QDomElement node;
  8112. /*:662*/
  8113. #line 15372 "./typica.w"
  8114. for(int i= 0;i<configData.size();i++)
  8115. {
  8116. node= configData.at(i).toElement();
  8117. if(node.attribute("name")=="deviceID")
  8118. {
  8119. deviceId->setText(node.attribute("value","Dev1"));
  8120. break;
  8121. }
  8122. }
  8123. updateDeviceId(deviceId->text());
  8124. connect(addChannelButton,SIGNAL(clicked()),
  8125. this,SLOT(addChannel()));
  8126. connect(deviceId,SIGNAL(textEdited(QString)),
  8127. this,SLOT(updateDeviceId(QString)));
  8128. setLayout(layout);
  8129. }
  8130. /*:668*//*669:*/
  8131. #line 15394 "./typica.w"
  8132. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  8133. {
  8134. updateAttribute("deviceID",newId);
  8135. }
  8136. /*:669*//*670:*/
  8137. #line 15402 "./typica.w"
  8138. void NiDaqMxBase9211ConfWidget::addChannel()
  8139. {
  8140. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8141. }
  8142. /*:670*/
  8143. #line 818 "./typica.w"
  8144. /*666:*/
  8145. #line 15309 "./typica.w"
  8146. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  8147. DeviceTreeModel*model,const QModelIndex&index):
  8148. BasicDeviceConfigurationWidget(model,index)
  8149. {
  8150. QHBoxLayout*layout= new QHBoxLayout;
  8151. QToolButton*addDeviceButton= new QToolButton;
  8152. addDeviceButton->setText(tr("Add Device"));
  8153. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  8154. "nidaqmxbase9211series");
  8155. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8156. "nidaqmxbase9211series");
  8157. connect(add9211,SIGNAL(triggered(QString,QString)),
  8158. this,SLOT(insertChildNode(QString,QString)));
  8159. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8160. this,SLOT(insertChildNode(QString,QString)));
  8161. QMenu*deviceMenu= new QMenu;
  8162. deviceMenu->addAction(add9211);
  8163. deviceMenu->addAction(add9211a);
  8164. addDeviceButton->setMenu(deviceMenu);
  8165. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8166. layout->addWidget(addDeviceButton);
  8167. setLayout(layout);
  8168. }
  8169. /*:666*/
  8170. #line 819 "./typica.w"
  8171. /*554:*/
  8172. #line 12870 "./typica.w"
  8173. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  8174. QObject*parent):
  8175. QAction(reportName,parent),reportFile(fileName)
  8176. {
  8177. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  8178. }
  8179. /*:554*//*555:*/
  8180. #line 12886 "./typica.w"
  8181. void ReportAction::createReport()
  8182. {
  8183. QFile file(reportFile);
  8184. QDomDocument document;
  8185. if(file.open(QIODevice::ReadOnly))
  8186. {
  8187. document.setContent(&file,true);
  8188. QDomElement element= document.documentElement();
  8189. QScriptEngine*engine= AppInstance->engine;
  8190. QScriptContext*context= engine->pushContext();
  8191. QScriptValue object;
  8192. QString targetID= reportFile;
  8193. /*166:*/
  8194. #line 3934 "./typica.w"
  8195. ScriptQMainWindow*window= new ScriptQMainWindow;
  8196. window->setObjectName(targetID);
  8197. object= engine->newQObject(window);
  8198. setQMainWindowProperties(object,engine);
  8199. QWidget*central= new(QWidget);
  8200. central->setParent(window);
  8201. central->setObjectName("centralWidget");
  8202. window->setCentralWidget(central);
  8203. if(element.hasChildNodes())
  8204. {
  8205. /*167:*/
  8206. #line 3969 "./typica.w"
  8207. QStack<QWidget*> widgetStack;
  8208. QStack<QLayout*> layoutStack;
  8209. QString windowScript;
  8210. widgetStack.push(central);
  8211. QDomNodeList windowChildren= element.childNodes();
  8212. int i= 0;
  8213. while(i<windowChildren.count())
  8214. {
  8215. QDomNode current;
  8216. QDomElement element;
  8217. current= windowChildren.at(i);
  8218. if(current.isElement())
  8219. {
  8220. element= current.toElement();
  8221. if(element.tagName()=="program")
  8222. {
  8223. windowScript.append(element.text());
  8224. }
  8225. else if(element.tagName()=="layout")
  8226. {
  8227. addLayoutToWidget(element,&widgetStack,&layoutStack);
  8228. }
  8229. else if(element.tagName()=="menu")
  8230. {
  8231. /*168:*/
  8232. #line 4016 "./typica.w"
  8233. QMenuBar*bar= window->menuBar();
  8234. bar->setParent(window);
  8235. bar->setObjectName("menuBar");
  8236. if(element.hasAttribute("name"))
  8237. {
  8238. QMenu*menu= bar->addMenu(element.attribute("name"));
  8239. menu->setParent(bar);
  8240. if(element.hasAttribute("type"))
  8241. {
  8242. if(element.attribute("type")=="reports")
  8243. {
  8244. if(element.hasAttribute("src"))
  8245. {
  8246. /*552:*/
  8247. #line 12833 "./typica.w"
  8248. QSettings settings;
  8249. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  8250. arg(element.attribute("src")));
  8251. directory.setFilter(QDir::Files);
  8252. directory.setSorting(QDir::Name);
  8253. QStringList nameFilter;
  8254. nameFilter<<"*.xml";
  8255. directory.setNameFilters(nameFilter);
  8256. QFileInfoList reportFiles= directory.entryInfoList();
  8257. for(int i= 0;i<reportFiles.size();i++)
  8258. {
  8259. QFileInfo reportFile= reportFiles.at(i);
  8260. /*556:*/
  8261. #line 12910 "./typica.w"
  8262. QString path= reportFile.absoluteFilePath();
  8263. QFile file(path);
  8264. if(file.open(QIODevice::ReadOnly))
  8265. {
  8266. QDomDocument document;
  8267. document.setContent(&file,true);
  8268. QDomElement root= document.documentElement();
  8269. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  8270. if(!titleNode.isNull())
  8271. {
  8272. QDomElement titleElement= titleNode.toElement();
  8273. QString title= titleElement.text();
  8274. if(!title.isEmpty())
  8275. {
  8276. QStringList hierarchy= title.split(":->");
  8277. QMenu*insertionPoint= menu;
  8278. /*557:*/
  8279. #line 12937 "./typica.w"
  8280. for(int j= 0;j<hierarchy.size()-1;j++)
  8281. {
  8282. QObjectList menuList= insertionPoint->children();
  8283. bool menuFound= false;
  8284. for(int k= 0;k<menuList.size();k++)
  8285. {
  8286. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  8287. if(currentItem)
  8288. {
  8289. if(currentItem->title()==hierarchy.at(j))
  8290. {
  8291. menuFound= true;
  8292. insertionPoint= currentItem;
  8293. break;
  8294. }
  8295. }
  8296. }
  8297. if(!menuFound)
  8298. {
  8299. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  8300. }
  8301. }
  8302. /*:557*/
  8303. #line 12927 "./typica.w"
  8304. ReportAction*action= new ReportAction(path,hierarchy.last());
  8305. insertionPoint->addAction(action);
  8306. }
  8307. }
  8308. }
  8309. /*:556*/
  8310. #line 12846 "./typica.w"
  8311. }
  8312. /*:552*/
  8313. #line 4030 "./typica.w"
  8314. }
  8315. }
  8316. }
  8317. if(element.hasChildNodes())
  8318. {
  8319. /*169:*/
  8320. #line 4043 "./typica.w"
  8321. QDomNodeList menuItems= element.childNodes();
  8322. int j= 0;
  8323. while(j<menuItems.count())
  8324. {
  8325. QDomNode item= menuItems.at(j);
  8326. if(item.isElement())
  8327. {
  8328. QDomElement itemElement= item.toElement();
  8329. if(itemElement.tagName()=="item")
  8330. {
  8331. QAction*itemAction= new QAction(itemElement.text(),menu);
  8332. if(itemElement.hasAttribute("id"))
  8333. {
  8334. itemAction->setObjectName(itemElement.attribute("id"));
  8335. }
  8336. if(itemElement.hasAttribute("shortcut"))
  8337. {
  8338. itemAction->setShortcut(itemElement.attribute("shortcut"));
  8339. }
  8340. menu->addAction(itemAction);
  8341. }
  8342. else if(itemElement.tagName()=="separator")
  8343. {
  8344. menu->addSeparator();
  8345. }
  8346. }
  8347. j++;
  8348. }
  8349. #line 1 "./helpmenu.w"
  8350. /*:169*/
  8351. #line 4036 "./typica.w"
  8352. }
  8353. }
  8354. /*:168*/
  8355. #line 3994 "./typica.w"
  8356. }
  8357. }
  8358. i++;
  8359. }
  8360. QScriptValue oldThis= context->thisObject();
  8361. context->setThisObject(object);
  8362. QScriptValue result= engine->evaluate(windowScript);
  8363. /*161:*/
  8364. #line 3783 "./typica.w"
  8365. if(engine->hasUncaughtException())
  8366. {
  8367. int line= engine->uncaughtExceptionLineNumber();
  8368. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  8369. result.toString();
  8370. QString trace;
  8371. foreach(trace,engine->uncaughtExceptionBacktrace())
  8372. {
  8373. qDebug()<<trace;
  8374. }
  8375. }
  8376. /*:161*/
  8377. #line 4002 "./typica.w"
  8378. context->setThisObject(oldThis);
  8379. /*:167*/
  8380. #line 3945 "./typica.w"
  8381. }
  8382. /*170:*/
  8383. #line 9 "./helpmenu.w"
  8384. HelpMenu*helpMenu= new HelpMenu();
  8385. window->menuBar()->addMenu(helpMenu);
  8386. /*:170*/
  8387. #line 3947 "./typica.w"
  8388. window->show();
  8389. /*:166*/
  8390. #line 12899 "./typica.w"
  8391. file.close();
  8392. engine->popContext();
  8393. }
  8394. }
  8395. /*:555*/
  8396. #line 820 "./typica.w"
  8397. /*202:*/
  8398. #line 5091 "./typica.w"
  8399. NumericDelegate::NumericDelegate(QObject*parent):
  8400. QItemDelegate(parent)
  8401. {
  8402. }
  8403. /*:202*//*203:*/
  8404. #line 5103 "./typica.w"
  8405. void NumericDelegate::setEditorData(QWidget*editor,
  8406. const QModelIndex&index)const
  8407. {
  8408. QString value= index.model()->data(index,Qt::EditRole).toString();
  8409. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8410. line->setText(value);
  8411. }
  8412. /*:203*//*204:*/
  8413. #line 5118 "./typica.w"
  8414. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  8415. const QModelIndex&index)const
  8416. {
  8417. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8418. model->setData(index,line->text(),Qt::EditRole);
  8419. QScriptEngine*engine= AppInstance->engine;
  8420. engine->pushContext();
  8421. QString script= QString("Number(%1)").arg(line->text());
  8422. QScriptValue result= engine->evaluate(line->text());
  8423. if(result.isNumber())
  8424. {
  8425. model->setData(index,result.toVariant(),Qt::DisplayRole);
  8426. }
  8427. else
  8428. {
  8429. model->setData(index,QVariant(),Qt::DisplayRole);
  8430. }
  8431. engine->popContext();
  8432. }
  8433. /*:204*//*205:*/
  8434. #line 5141 "./typica.w"
  8435. QWidget*NumericDelegate::createEditor(QWidget*parent,
  8436. const QStyleOptionViewItem&,
  8437. const QModelIndex&)const
  8438. {
  8439. return(new QLineEdit(parent));
  8440. }
  8441. /*:205*//*206:*/
  8442. #line 5152 "./typica.w"
  8443. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  8444. const QStyleOptionViewItem&option,
  8445. const QModelIndex&)const
  8446. {
  8447. editor->setGeometry(option.rect);
  8448. }
  8449. /*:206*/
  8450. #line 821 "./typica.w"
  8451. /*677:*/
  8452. #line 15540 "./typica.w"
  8453. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  8454. const QModelIndex&index)
  8455. :BasicDeviceConfigurationWidget(model,index)
  8456. {
  8457. QHBoxLayout*layout= new QHBoxLayout;
  8458. QToolButton*addDeviceButton= new QToolButton;
  8459. addDeviceButton->setText(tr("Add Device"));
  8460. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8461. "nidaqmx9211series");
  8462. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  8463. "nidaqmxtc01");
  8464. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8465. this,SLOT(insertChildNode(QString,QString)));
  8466. connect(addtc01,SIGNAL(triggered(QString,QString)),
  8467. this,SLOT(insertChildNode(QString,QString)));
  8468. QMenu*deviceMenu= new QMenu;
  8469. deviceMenu->addAction(add9211a);
  8470. deviceMenu->addAction(addtc01);
  8471. addDeviceButton->setMenu(deviceMenu);
  8472. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8473. layout->addWidget(addDeviceButton);
  8474. setLayout(layout);
  8475. }
  8476. /*:677*/
  8477. #line 822 "./typica.w"
  8478. /*679:*/
  8479. #line 15589 "./typica.w"
  8480. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  8481. const QModelIndex&index)
  8482. :BasicDeviceConfigurationWidget(model,index)
  8483. {
  8484. QVBoxLayout*layout= new QVBoxLayout;
  8485. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8486. QLabel*label= new QLabel(tr("Device ID:"));
  8487. QLineEdit*deviceId= new QLineEdit;
  8488. deviceIdLayout->addWidget(label);
  8489. deviceIdLayout->addWidget(deviceId);
  8490. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8491. layout->addLayout(deviceIdLayout);
  8492. layout->addWidget(addChannelButton);
  8493. /*662:*/
  8494. #line 15253 "./typica.w"
  8495. QDomElement referenceElement=
  8496. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8497. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8498. QDomElement node;
  8499. /*:662*/
  8500. #line 15603 "./typica.w"
  8501. for(int i= 0;i<configData.size();i++)
  8502. {
  8503. node= configData.at(i).toElement();
  8504. if(node.attribute("name")=="deviceID")
  8505. {
  8506. deviceId->setText(node.attribute("value","Dev1"));
  8507. break;
  8508. }
  8509. }
  8510. updateDeviceId(deviceId->text());
  8511. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  8512. connect(deviceId,SIGNAL(textEdited(QString)),
  8513. this,SLOT(updateDeviceId(QString)));
  8514. setLayout(layout);
  8515. }
  8516. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  8517. {
  8518. updateAttribute("deviceID",newId);
  8519. }
  8520. void NiDaqMx9211ConfWidget::addChannel()
  8521. {
  8522. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8523. }
  8524. /*:679*/
  8525. #line 823 "./typica.w"
  8526. /*681:*/
  8527. #line 15653 "./typica.w"
  8528. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  8529. const QModelIndex&index)
  8530. :BasicDeviceConfigurationWidget(model,index)
  8531. {
  8532. QFormLayout*layout= new QFormLayout;
  8533. QLineEdit*deviceId= new QLineEdit;
  8534. layout->addRow(tr("Device ID:"),deviceId);
  8535. QLineEdit*columnName= new QLineEdit;
  8536. layout->addRow(tr("Column Name:"),columnName);
  8537. QComboBox*typeSelector= new QComboBox;
  8538. typeSelector->addItem("J");
  8539. typeSelector->addItem("K");
  8540. typeSelector->addItem("T");
  8541. typeSelector->addItem("B");
  8542. typeSelector->addItem("E");
  8543. typeSelector->addItem("N");
  8544. typeSelector->addItem("R");
  8545. typeSelector->addItem("S");
  8546. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8547. /*662:*/
  8548. #line 15253 "./typica.w"
  8549. QDomElement referenceElement=
  8550. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8551. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8552. QDomElement node;
  8553. /*:662*/
  8554. #line 15673 "./typica.w"
  8555. for(int i= 0;i<configData.size();i++)
  8556. {
  8557. node= configData.at(i).toElement();
  8558. if(node.attribute("name")=="deviceID")
  8559. {
  8560. deviceId->setText(node.attribute("value"));
  8561. }
  8562. else if(node.attribute("name")=="type")
  8563. {
  8564. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  8565. }
  8566. else if(node.attribute("name")=="columnname")
  8567. {
  8568. columnName->setText(node.attribute("value"));
  8569. }
  8570. }
  8571. updateDeviceId(deviceId->text());
  8572. updateThermocoupleType(typeSelector->currentText());
  8573. updateColumnName(columnName->text());
  8574. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  8575. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  8576. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8577. setLayout(layout);
  8578. }
  8579. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  8580. {
  8581. updateAttribute("deviceID",newId);
  8582. }
  8583. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  8584. {
  8585. updateAttribute("type",type);
  8586. }
  8587. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  8588. {
  8589. updateAttribute("columnname",name);
  8590. }
  8591. /*:681*/
  8592. #line 824 "./typica.w"
  8593. /*699:*/
  8594. #line 16074 "./typica.w"
  8595. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  8596. const QModelIndex&index)
  8597. :BasicDeviceConfigurationWidget(model,index)
  8598. {
  8599. QFormLayout*layout= new QFormLayout;
  8600. QToolButton*addDeviceButton= new QToolButton;
  8601. addDeviceButton->setText(tr("Add Device"));
  8602. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  8603. "Modbus RTU Device",
  8604. "modbusrtudevice");
  8605. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  8606. this,SLOT(insertChildNode(QString,QString)));
  8607. QMenu*deviceMenu= new QMenu;
  8608. deviceMenu->addAction(addModbusRtuDevice);
  8609. addDeviceButton->setMenu(deviceMenu);
  8610. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8611. layout->addRow(QString(),addDeviceButton);
  8612. PortSelector*port= new PortSelector;
  8613. layout->addRow(tr("Port:"),port);
  8614. connect(port,SIGNAL(currentIndexChanged(QString)),
  8615. this,SLOT(updatePort(QString)));
  8616. connect(port,SIGNAL(editTextChanged(QString)),
  8617. this,SLOT(updatePort(QString)));
  8618. BaudSelector*rate= new BaudSelector;
  8619. layout->addRow(tr("Baud:"),rate);
  8620. connect(rate,SIGNAL(currentIndexChanged(QString)),
  8621. this,SLOT(updateBaudRate(QString)));
  8622. ParitySelector*parity= new ParitySelector;
  8623. layout->addRow(tr("Parity:"),parity);
  8624. connect(parity,SIGNAL(currentIndexChanged(QString)),
  8625. this,SLOT(updateParity(QString)));
  8626. FlowSelector*flow= new FlowSelector;
  8627. layout->addRow(tr("Flow Control:"),flow);
  8628. connect(flow,SIGNAL(currentIndexChanged(QString)),
  8629. this,SLOT(updateFlowControl(QString)));
  8630. StopSelector*stop= new StopSelector;
  8631. layout->addRow(tr("Stop Bits:"),stop);
  8632. connect(stop,SIGNAL(currentIndexChanged(QString)),
  8633. this,SLOT(updateStopBits(QString)));
  8634. /*662:*/
  8635. #line 15253 "./typica.w"
  8636. QDomElement referenceElement=
  8637. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8638. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8639. QDomElement node;
  8640. /*:662*/
  8641. #line 16114 "./typica.w"
  8642. for(int i= 0;i<configData.size();i++)
  8643. {
  8644. node= configData.at(i).toElement();
  8645. if(node.attribute("name")=="port")
  8646. {
  8647. int j= port->findText(node.attribute("value"));
  8648. if(j>=0)
  8649. {
  8650. port->setCurrentIndex(j);
  8651. }
  8652. else
  8653. {
  8654. port->insertItem(0,node.attribute("value"));
  8655. port->setCurrentIndex(0);
  8656. }
  8657. }
  8658. else if(node.attribute("name")=="baudrate")
  8659. {
  8660. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  8661. }
  8662. else if(node.attribute("name")=="parity")
  8663. {
  8664. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  8665. }
  8666. else if(node.attribute("name")=="flowcontrol")
  8667. {
  8668. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  8669. }
  8670. else if(node.attribute("name")=="stopbits")
  8671. {
  8672. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  8673. }
  8674. }
  8675. updatePort(port->currentText());
  8676. updateBaudRate(rate->currentText());
  8677. updateParity(parity->currentText());
  8678. updateFlowControl(flow->currentText());
  8679. updateStopBits(stop->currentText());
  8680. setLayout(layout);
  8681. }
  8682. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  8683. {
  8684. updateAttribute("port",newPort);
  8685. }
  8686. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  8687. {
  8688. updateAttribute("baudrate",newRate);
  8689. }
  8690. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  8691. {
  8692. updateAttribute("parity",newParity);
  8693. }
  8694. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  8695. {
  8696. updateAttribute("flowcontrol",newFlow);
  8697. }
  8698. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  8699. {
  8700. updateAttribute("stopbits",newStopBits);
  8701. }
  8702. /*:699*/
  8703. #line 825 "./typica.w"
  8704. /*701:*/
  8705. #line 16237 "./typica.w"
  8706. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  8707. const QModelIndex&index)
  8708. :BasicDeviceConfigurationWidget(model,index),
  8709. unitSpecificationLayout(new QStackedLayout),
  8710. decimalSpecificationLayout(new QStackedLayout)
  8711. {
  8712. QVBoxLayout*layout= new QVBoxLayout;
  8713. QToolButton*addChannelButton= new QToolButton;
  8714. addChannelButton->setText(tr("Add Channel"));
  8715. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  8716. "Temperature Process Value",
  8717. "modbustemperaturepv");
  8718. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  8719. "Temperature Set Value",
  8720. "modbustemperaturesv");
  8721. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  8722. this,SLOT(insertChildNode(QString,QString)));
  8723. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  8724. this,SLOT(insertChildNode(QString,QString)));
  8725. QMenu*channelMenu= new QMenu;
  8726. channelMenu->addAction(addTemperaturePV);
  8727. channelMenu->addAction(addTemperatureSV);
  8728. addChannelButton->setMenu(channelMenu);
  8729. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  8730. layout->addWidget(addChannelButton);
  8731. QHBoxLayout*stationLayout= new QHBoxLayout;
  8732. QLabel*stationLabel= new QLabel(tr("Station:"));
  8733. QSpinBox*stationNumber= new QSpinBox;
  8734. stationNumber->setMinimum(0);
  8735. stationNumber->setMaximum(255);
  8736. stationLayout->addWidget(stationLabel);
  8737. stationLayout->addWidget(stationNumber);
  8738. layout->addLayout(stationLayout);
  8739. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  8740. layout->addWidget(fixedUnit);
  8741. QWidget*fixedUnitPlaceholder= new QWidget(this);
  8742. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  8743. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  8744. QComboBox*fixedUnitSelector= new QComboBox;
  8745. fixedUnitSelector->addItem("Fahrenheit");
  8746. fixedUnitSelector->addItem("Celsius");
  8747. fixedUnitLayout->addWidget(fixedUnitLabel);
  8748. fixedUnitLayout->addWidget(fixedUnitSelector);
  8749. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  8750. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  8751. QWidget*queriedUnitPlaceholder= new QWidget(this);
  8752. QFormLayout*queriedUnitLayout= new QFormLayout;
  8753. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  8754. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  8755. QSpinBox*valueF= new QSpinBox;
  8756. valueF->setMinimum(0);
  8757. valueF->setMaximum(65535);
  8758. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  8759. QSpinBox*valueC= new QSpinBox;
  8760. valueC->setMinimum(0);
  8761. valueC->setMaximum(65535);
  8762. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  8763. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  8764. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  8765. layout->addLayout(unitSpecificationLayout);
  8766. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  8767. layout->addWidget(fixedPrecision);
  8768. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  8769. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  8770. QSpinBox*fixedPrecisionValue= new QSpinBox;
  8771. fixedPrecisionValue->setMinimum(0);
  8772. fixedPrecisionValue->setMaximum(9);
  8773. fixedPrecisionLayout->addRow("Places after the decimal point:",
  8774. fixedPrecisionValue);
  8775. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  8776. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  8777. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  8778. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  8779. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  8780. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  8781. precisionAddress);
  8782. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  8783. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  8784. layout->addLayout(decimalSpecificationLayout);
  8785. /*662:*/
  8786. #line 15253 "./typica.w"
  8787. QDomElement referenceElement=
  8788. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8789. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8790. QDomElement node;
  8791. /*:662*/
  8792. #line 16317 "./typica.w"
  8793. for(int i= 0;i<configData.size();i++)
  8794. {
  8795. node= configData.at(i).toElement();
  8796. if(node.attribute("name")=="station")
  8797. {
  8798. stationNumber->setValue(node.attribute("value").toInt());
  8799. }
  8800. else if(node.attribute("name")=="fixedunit")
  8801. {
  8802. if(node.attribute("value")=="true")
  8803. {
  8804. fixedUnit->setCheckState(Qt::Checked);
  8805. }
  8806. else if(node.attribute("value")=="false")
  8807. {
  8808. fixedUnit->setCheckState(Qt::Unchecked);
  8809. }
  8810. }
  8811. else if(node.attribute("name")=="fixedprecision")
  8812. {
  8813. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8814. }
  8815. else if(node.attribute("name")=="unit")
  8816. {
  8817. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  8818. }
  8819. else if(node.attribute("name")=="unitaddress")
  8820. {
  8821. unitAddress->setValue(node.attribute("value").toInt());
  8822. }
  8823. else if(node.attribute("name")=="fvalue")
  8824. {
  8825. valueF->setValue(node.attribute("value").toInt());
  8826. }
  8827. else if(node.attribute("name")=="cvalue")
  8828. {
  8829. valueC->setValue(node.attribute("value").toInt());
  8830. }
  8831. else if(node.attribute("name")=="precisionaddress")
  8832. {
  8833. precisionAddress->setValue(node.attribute("value").toInt());
  8834. }
  8835. else if(node.attribute("name")=="precision")
  8836. {
  8837. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8838. }
  8839. }
  8840. updateStationNumber(stationNumber->value());
  8841. updateFixedUnit(fixedUnit->isChecked());
  8842. updateFixedDecimal(fixedPrecision->isChecked());
  8843. updateUnit(fixedUnitSelector->currentText());
  8844. updateUnitAddress(unitAddress->value());
  8845. updateValueF(valueF->value());
  8846. updateValueC(valueC->value());
  8847. updatePrecisionAddress(precisionAddress->value());
  8848. updatePrecisionValue(fixedPrecisionValue->value());
  8849. connect(stationNumber,SIGNAL(valueChanged(int)),
  8850. this,SLOT(updateStationNumber(int)));
  8851. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  8852. this,SLOT(updateUnit(QString)));
  8853. connect(unitAddress,SIGNAL(valueChanged(int)),
  8854. this,SLOT(updateUnitAddress(int)));
  8855. connect(valueF,SIGNAL(valueChanged(int)),
  8856. this,SLOT(updateValueF(int)));
  8857. connect(valueC,SIGNAL(valueChanged(int)),
  8858. this,SLOT(updateValueC(int)));
  8859. connect(fixedUnit,SIGNAL(toggled(bool)),
  8860. this,SLOT(updateFixedUnit(bool)));
  8861. connect(fixedPrecision,SIGNAL(toggled(bool)),
  8862. this,SLOT(updateFixedDecimal(bool)));
  8863. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  8864. this,SLOT(updatePrecisionValue(int)));
  8865. connect(precisionAddress,SIGNAL(valueChanged(int)),
  8866. this,SLOT(updatePrecisionAddress(int)));
  8867. setLayout(layout);
  8868. }
  8869. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  8870. {
  8871. updateAttribute("station",QString("%1").arg(newStation));
  8872. }
  8873. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  8874. {
  8875. if(newFixed)
  8876. {
  8877. unitSpecificationLayout->setCurrentIndex(0);
  8878. updateAttribute("fixedunit","true");
  8879. }
  8880. else
  8881. {
  8882. unitSpecificationLayout->setCurrentIndex(1);
  8883. updateAttribute("fixedunit","false");
  8884. }
  8885. }
  8886. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  8887. {
  8888. if(newFixed)
  8889. {
  8890. decimalSpecificationLayout->setCurrentIndex(0);
  8891. updateAttribute("fixedprecision","true");
  8892. }
  8893. else
  8894. {
  8895. decimalSpecificationLayout->setCurrentIndex(1);
  8896. updateAttribute("fixedprecision","false");
  8897. }
  8898. }
  8899. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  8900. {
  8901. updateAttribute("unit",newUnit);
  8902. }
  8903. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  8904. {
  8905. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  8906. }
  8907. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  8908. {
  8909. updateAttribute("fvalue",QString("%1").arg(newValue));
  8910. }
  8911. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  8912. {
  8913. updateAttribute("cvalue",QString("%1").arg(newValue));
  8914. }
  8915. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  8916. {
  8917. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  8918. }
  8919. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  8920. {
  8921. updateAttribute("precision",QString("%1").arg(newValue));
  8922. }
  8923. /*:701*/
  8924. #line 826 "./typica.w"
  8925. /*703:*/
  8926. #line 16480 "./typica.w"
  8927. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  8928. const QModelIndex&index)
  8929. :BasicDeviceConfigurationWidget(model,index)
  8930. {
  8931. QFormLayout*layout= new QFormLayout;
  8932. ShortHexSpinBox*address= new ShortHexSpinBox;
  8933. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  8934. /*662:*/
  8935. #line 15253 "./typica.w"
  8936. QDomElement referenceElement=
  8937. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8938. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8939. QDomElement node;
  8940. /*:662*/
  8941. #line 16488 "./typica.w"
  8942. for(int i= 0;i<configData.size();i++)
  8943. {
  8944. node= configData.at(i).toElement();
  8945. if(node.attribute("name")=="address")
  8946. {
  8947. address->setValue(node.attribute("value").toInt());
  8948. break;
  8949. }
  8950. }
  8951. updateAddress(address->value());
  8952. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  8953. setLayout(layout);
  8954. }
  8955. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  8956. {
  8957. updateAttribute("address",QString("%1").arg(newAddress));
  8958. }
  8959. /*:703*/
  8960. #line 827 "./typica.w"
  8961. /*705:*/
  8962. #line 16536 "./typica.w"
  8963. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  8964. const QModelIndex&index)
  8965. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  8966. {
  8967. QVBoxLayout*layout= new QVBoxLayout;
  8968. QFormLayout*addressLayout= new QFormLayout;
  8969. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  8970. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  8971. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  8972. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  8973. layout->addLayout(addressLayout);
  8974. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  8975. layout->addWidget(fixedRange);
  8976. QWidget*queriedRangePlaceholder= new QWidget(this);
  8977. QFormLayout*queriedRangeLayout= new QFormLayout;
  8978. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  8979. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  8980. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  8981. lowerAddress);
  8982. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  8983. upperAddress);
  8984. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  8985. boundsLayout->addWidget(queriedRangePlaceholder);
  8986. QWidget*fixedRangePlaceholder= new QWidget(this);
  8987. QFormLayout*fixedRangeLayout= new QFormLayout;
  8988. QLineEdit*fixedLower= new QLineEdit;
  8989. QLineEdit*fixedUpper= new QLineEdit;
  8990. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  8991. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  8992. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  8993. boundsLayout->addWidget(fixedRangePlaceholder);
  8994. layout->addLayout(boundsLayout);
  8995. /*662:*/
  8996. #line 15253 "./typica.w"
  8997. QDomElement referenceElement=
  8998. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8999. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9000. QDomElement node;
  9001. /*:662*/
  9002. #line 16569 "./typica.w"
  9003. for(int i= 0;i<configData.size();i++)
  9004. {
  9005. node= configData.at(i).toElement();
  9006. if(node.attribute("name")=="readaddress")
  9007. {
  9008. readAddress->setValue(node.attribute("value").toInt());
  9009. }
  9010. else if(node.attribute("name")=="writeaddress")
  9011. {
  9012. writeAddress->setValue(node.attribute("value").toInt());
  9013. }
  9014. else if(node.attribute("name")=="fixedrange")
  9015. {
  9016. if(node.attribute("value")=="true")
  9017. {
  9018. fixedRange->setCheckState(Qt::Checked);
  9019. }
  9020. else if(node.attribute("value")=="false")
  9021. {
  9022. fixedRange->setCheckState(Qt::Unchecked);
  9023. }
  9024. }
  9025. else if(node.attribute("name")=="fixedlower")
  9026. {
  9027. fixedLower->setText(node.attribute("value"));
  9028. }
  9029. else if(node.attribute("name")=="fixedupper")
  9030. {
  9031. fixedUpper->setText(node.attribute("value"));
  9032. }
  9033. else if(node.attribute("name")=="loweraddress")
  9034. {
  9035. lowerAddress->setValue(node.attribute("value").toInt());
  9036. }
  9037. else if(node.attribute("name")=="upperaddress")
  9038. {
  9039. upperAddress->setValue(node.attribute("value").toInt());
  9040. }
  9041. }
  9042. updateReadAddress(readAddress->value());
  9043. updateWriteAddress(writeAddress->value());
  9044. updateFixedRange(fixedRange->isChecked());
  9045. updateLower(fixedLower->text());
  9046. updateUpper(fixedUpper->text());
  9047. updateLowerAddress(lowerAddress->value());
  9048. updateUpperAddress(upperAddress->value());
  9049. connect(readAddress,SIGNAL(valueChanged(int)),
  9050. this,SLOT(updateReadAddress(int)));
  9051. connect(writeAddress,SIGNAL(valueChanged(int)),
  9052. this,SLOT(updateWriteAddress(int)));
  9053. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  9054. connect(fixedLower,SIGNAL(textChanged(QString)),
  9055. this,SLOT(updateLower(QString)));
  9056. connect(fixedUpper,SIGNAL(textChanged(QString)),
  9057. this,SLOT(updateUpper(QString)));
  9058. connect(lowerAddress,SIGNAL(valueChanged(int)),
  9059. this,SLOT(updateLowerAddress(int)));
  9060. connect(upperAddress,SIGNAL(valueChanged(int)),
  9061. this,SLOT(updateUpperAddress(int)));
  9062. setLayout(layout);
  9063. }
  9064. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  9065. {
  9066. updateAttribute("readaddress",QString("%1").arg(newAddress));
  9067. }
  9068. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  9069. {
  9070. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  9071. }
  9072. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  9073. {
  9074. if(fixed)
  9075. {
  9076. updateAttribute("fixedrange","true");
  9077. boundsLayout->setCurrentIndex(1);
  9078. }
  9079. else
  9080. {
  9081. updateAttribute("fixedrange","false");
  9082. boundsLayout->setCurrentIndex(0);
  9083. }
  9084. }
  9085. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  9086. {
  9087. updateAttribute("fixedlower",lower);
  9088. }
  9089. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  9090. {
  9091. updateAttribute("fixedupper",upper);
  9092. }
  9093. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  9094. {
  9095. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  9096. }
  9097. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  9098. {
  9099. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  9100. }
  9101. /*:705*/
  9102. #line 828 "./typica.w"
  9103. /*661:*/
  9104. #line 15177 "./typica.w"
  9105. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9106. :BasicDeviceConfigurationWidget(model,index)
  9107. {
  9108. QVBoxLayout*layout= new QVBoxLayout;
  9109. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  9110. QMenu*deviceMenu= new QMenu;
  9111. NodeInserter*insertAction;
  9112. foreach(insertAction,AppInstance->topLevelNodeInserters)
  9113. {
  9114. connect(insertAction,SIGNAL(triggered(QString,QString)),
  9115. this,SLOT(insertChildNode(QString,QString)));
  9116. deviceMenu->addAction(insertAction);
  9117. }
  9118. addDeviceButton->setMenu(deviceMenu);
  9119. layout->addWidget(addDeviceButton);
  9120. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  9121. QMenu*annotationMenu= new QMenu;
  9122. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  9123. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  9124. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  9125. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  9126. tr("Free Text"),
  9127. "freeannotation");
  9128. annotationMenu->addAction(basicButtonInserter);
  9129. annotationMenu->addAction(countingButtonInserter);
  9130. annotationMenu->addAction(spinBoxInserter);
  9131. annotationMenu->addAction(freeAnnotationInserter);
  9132. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  9133. this,SLOT(insertChildNode(QString,QString)));
  9134. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  9135. this,SLOT(insertChildNode(QString,QString)));
  9136. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  9137. this,SLOT(insertChildNode(QString,QString)));
  9138. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  9139. this,SLOT(insertChildNode(QString,QString)));
  9140. addAnnotationControlButton->setMenu(annotationMenu);
  9141. layout->addWidget(addAnnotationControlButton);
  9142. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  9143. QMenu*advancedMenu= new QMenu;
  9144. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  9145. advancedMenu->addAction(linearsplineinserter);
  9146. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  9147. advancedMenu->addAction(translationinserter);
  9148. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9149. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9150. advancedButton->setMenu(advancedMenu);
  9151. layout->addWidget(advancedButton);
  9152. QHBoxLayout*idLayout= new QHBoxLayout;
  9153. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  9154. idLayout->addWidget(idLabel);
  9155. QSpinBox*id= new QSpinBox;
  9156. idLayout->addWidget(id);
  9157. layout->addLayout(idLayout);
  9158. /*662:*/
  9159. #line 15253 "./typica.w"
  9160. QDomElement referenceElement=
  9161. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9162. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9163. QDomElement node;
  9164. /*:662*/
  9165. #line 15231 "./typica.w"
  9166. for(int i= 0;i<configData.size();i++)
  9167. {
  9168. node= configData.at(i).toElement();
  9169. if(node.attribute("name")=="databaseid")
  9170. {
  9171. id->setValue(node.attribute("value").toInt());
  9172. break;
  9173. }
  9174. }
  9175. updateRoasterId(id->value());
  9176. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  9177. setLayout(layout);
  9178. }
  9179. /*:661*//*663:*/
  9180. #line 15263 "./typica.w"
  9181. void RoasterConfWidget::updateRoasterId(int id)
  9182. {
  9183. updateAttribute("databaseid",QString("%1").arg(id));
  9184. }
  9185. /*:663*/
  9186. #line 829 "./typica.w"
  9187. /*709:*/
  9188. #line 16719 "./typica.w"
  9189. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9190. :BasicDeviceConfigurationWidget(model,index)
  9191. {
  9192. QFormLayout*layout= new QFormLayout;
  9193. QLineEdit*buttonTextEdit= new QLineEdit;
  9194. QLineEdit*annotationTextEdit= new QLineEdit;
  9195. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9196. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9197. /*662:*/
  9198. #line 15253 "./typica.w"
  9199. QDomElement referenceElement=
  9200. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9201. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9202. QDomElement node;
  9203. /*:662*/
  9204. #line 16728 "./typica.w"
  9205. for(int i= 0;i<configData.size();i++)
  9206. {
  9207. node= configData.at(i).toElement();
  9208. if(node.attribute("name")=="buttontext")
  9209. {
  9210. buttonTextEdit->setText(node.attribute("value"));
  9211. }
  9212. else if(node.attribute("name")=="annotationtext")
  9213. {
  9214. annotationTextEdit->setText(node.attribute("value"));
  9215. }
  9216. }
  9217. updateButtonText(buttonTextEdit->text());
  9218. updateAnnotationText(annotationTextEdit->text());
  9219. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9220. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9221. setLayout(layout);
  9222. }
  9223. /*:709*//*710:*/
  9224. #line 16750 "./typica.w"
  9225. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  9226. {
  9227. updateAttribute("buttontext",text);
  9228. }
  9229. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9230. {
  9231. updateAttribute("annotationtext",text);
  9232. }
  9233. /*:710*//*713:*/
  9234. #line 16788 "./typica.w"
  9235. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9236. :BasicDeviceConfigurationWidget(model,index)
  9237. {
  9238. QFormLayout*layout= new QFormLayout;
  9239. QLineEdit*buttonTextEdit= new QLineEdit;
  9240. QLineEdit*annotationTextEdit= new QLineEdit;
  9241. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9242. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9243. /*662:*/
  9244. #line 15253 "./typica.w"
  9245. QDomElement referenceElement=
  9246. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9247. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9248. QDomElement node;
  9249. /*:662*/
  9250. #line 16797 "./typica.w"
  9251. for(int i= 0;i<configData.size();i++)
  9252. {
  9253. node= configData.at(i).toElement();
  9254. if(node.attribute("name")=="buttontext")
  9255. {
  9256. buttonTextEdit->setText(node.attribute("value"));
  9257. }
  9258. else if(node.attribute("name")=="annotationtext")
  9259. {
  9260. annotationTextEdit->setText(node.attribute("value"));
  9261. }
  9262. }
  9263. updateButtonText(buttonTextEdit->text());
  9264. updateAnnotationText(annotationTextEdit->text());
  9265. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9266. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9267. QTextEdit*documentation= new QTextEdit;
  9268. 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."));
  9269. documentation->setReadOnly(true);
  9270. layout->addRow("",documentation);
  9271. setLayout(layout);
  9272. }
  9273. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  9274. {
  9275. updateAttribute("buttontext",text);
  9276. }
  9277. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9278. {
  9279. updateAttribute("annotationtext",text);
  9280. }
  9281. /*:713*/
  9282. #line 830 "./typica.w"
  9283. /*716:*/
  9284. #line 16865 "./typica.w"
  9285. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9286. :BasicDeviceConfigurationWidget(model,index)
  9287. {
  9288. QFormLayout*layout= new QFormLayout;
  9289. QLineEdit*labelEdit= new QLineEdit;
  9290. layout->addRow(tr("Control Label: "),labelEdit);
  9291. QLineEdit*minimumEdit= new QLineEdit;
  9292. layout->addRow(tr("Minimum Value: "),minimumEdit);
  9293. QLineEdit*maximumEdit= new QLineEdit;
  9294. layout->addRow(tr("Maximum Value: "),maximumEdit);
  9295. QSpinBox*precisionEdit= new QSpinBox;
  9296. precisionEdit->setMinimum(0);
  9297. precisionEdit->setMaximum(9);
  9298. layout->addRow(tr("Precision"),precisionEdit);
  9299. QLineEdit*pretext= new QLineEdit;
  9300. layout->addRow(tr("Prefix text"),pretext);
  9301. QLineEdit*posttext= new QLineEdit;
  9302. layout->addRow(tr("Suffix text"),posttext);
  9303. /*662:*/
  9304. #line 15253 "./typica.w"
  9305. QDomElement referenceElement=
  9306. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9307. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9308. QDomElement node;
  9309. /*:662*/
  9310. #line 16884 "./typica.w"
  9311. for(int i= 0;i<configData.size();i++)
  9312. {
  9313. node= configData.at(i).toElement();
  9314. if(node.attribute("name")=="label")
  9315. {
  9316. labelEdit->setText(node.attribute("value"));
  9317. }
  9318. else if(node.attribute("name")=="minimum")
  9319. {
  9320. minimumEdit->setText(node.attribute("value"));
  9321. }
  9322. else if(node.attribute("name")=="maximum")
  9323. {
  9324. maximumEdit->setText(node.attribute("value"));
  9325. }
  9326. else if(node.attribute("name")=="precision")
  9327. {
  9328. precisionEdit->setValue(node.attribute("value").toInt());
  9329. }
  9330. else if(node.attribute("name")=="pretext")
  9331. {
  9332. pretext->setText(node.attribute("value"));
  9333. }
  9334. else if(node.attribute("name")=="posttext")
  9335. {
  9336. posttext->setText(node.attribute("value"));
  9337. }
  9338. }
  9339. updateLabel(labelEdit->text());
  9340. updateMinimum(minimumEdit->text());
  9341. updateMaximum(maximumEdit->text());
  9342. updatePrecision(precisionEdit->value());
  9343. updatePretext(pretext->text());
  9344. updatePosttext(posttext->text());
  9345. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  9346. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  9347. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  9348. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  9349. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  9350. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  9351. setLayout(layout);
  9352. }
  9353. void NoteSpinConfWidget::updateLabel(const QString&text)
  9354. {
  9355. updateAttribute("label",text);
  9356. }
  9357. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  9358. {
  9359. updateAttribute("minimum",minimum);
  9360. }
  9361. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  9362. {
  9363. updateAttribute("maximum",maximum);
  9364. }
  9365. void NoteSpinConfWidget::updatePrecision(int precision)
  9366. {
  9367. updateAttribute("precision",QString("%1").arg(precision));
  9368. }
  9369. void NoteSpinConfWidget::updatePretext(const QString&text)
  9370. {
  9371. updateAttribute("pretext",text);
  9372. }
  9373. void NoteSpinConfWidget::updatePosttext(const QString&text)
  9374. {
  9375. updateAttribute("posttext",text);
  9376. }
  9377. /*:716*/
  9378. #line 831 "./typica.w"
  9379. /*274:*/
  9380. #line 6890 "./typica.w"
  9381. LinearCalibrator::LinearCalibrator(QObject*parent):
  9382. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  9383. {
  9384. }
  9385. /*:274*//*275:*/
  9386. #line 6904 "./typica.w"
  9387. void LinearCalibrator::newMeasurement(Measurement measure)
  9388. {
  9389. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  9390. if(clamp)
  9391. {
  9392. if(outval<Lo1)
  9393. {
  9394. outval= Lo1;
  9395. }
  9396. else if(outval> Up1)
  9397. {
  9398. outval= Up1;
  9399. }
  9400. }
  9401. if(sensitivitySetting>=0.05)
  9402. {
  9403. int temp= qRound(outval/sensitivitySetting);
  9404. outval= temp*sensitivitySetting;
  9405. }
  9406. Measurement adjusted(outval,measure.time(),measure.scale());
  9407. emit measurement(adjusted);
  9408. }
  9409. /*:275*//*276:*/
  9410. #line 6930 "./typica.w"
  9411. double LinearCalibrator::measuredLower()
  9412. {
  9413. return Lo2;
  9414. }
  9415. double LinearCalibrator::measuredUpper()
  9416. {
  9417. return Up2;
  9418. }
  9419. double LinearCalibrator::mappedLower()
  9420. {
  9421. return Lo1;
  9422. }
  9423. double LinearCalibrator::mappedUpper()
  9424. {
  9425. return Up1;
  9426. }
  9427. bool LinearCalibrator::isClosedRange()
  9428. {
  9429. return clamp;
  9430. }
  9431. void LinearCalibrator::setMeasuredLower(double lower)
  9432. {
  9433. Lo2= lower;
  9434. }
  9435. void LinearCalibrator::setMeasuredUpper(double upper)
  9436. {
  9437. Up2= upper;
  9438. }
  9439. void LinearCalibrator::setMappedLower(double lower)
  9440. {
  9441. Lo1= lower;
  9442. }
  9443. void LinearCalibrator::setMappedUpper(double upper)
  9444. {
  9445. Up1= upper;
  9446. }
  9447. void LinearCalibrator::setClosedRange(bool closed)
  9448. {
  9449. clamp= closed;
  9450. }
  9451. void LinearCalibrator::setSensitivity(double sensitivity)
  9452. {
  9453. sensitivitySetting= sensitivity;
  9454. }
  9455. double LinearCalibrator::sensitivity()
  9456. {
  9457. return sensitivitySetting;
  9458. }
  9459. /*:276*/
  9460. #line 832 "./typica.w"
  9461. /*281:*/
  9462. #line 7063 "./typica.w"
  9463. void LinearSplineInterpolator::add_pair(double source,double destination)
  9464. {
  9465. pairs->insert(source,destination);
  9466. make_interpolators();
  9467. }
  9468. void LinearSplineInterpolator::make_interpolators()
  9469. {
  9470. if(pairs->size()> 1)
  9471. {
  9472. while(interpolators->size()> 0)
  9473. {
  9474. LinearCalibrator*removed= interpolators->takeFirst();
  9475. removed->deleteLater();
  9476. }
  9477. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9478. QMap<double,double> ::const_iterator j= i+1;
  9479. while(j!=pairs->constEnd())
  9480. {
  9481. LinearCalibrator*segment= new LinearCalibrator();
  9482. segment->setMeasuredLower(i.key());
  9483. segment->setMappedLower(i.value());
  9484. segment->setMeasuredUpper(j.key());
  9485. segment->setMappedUpper(j.value());
  9486. segment->setClosedRange(false);
  9487. interpolators->append(segment);
  9488. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  9489. i++;
  9490. j++;
  9491. }
  9492. }
  9493. }
  9494. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  9495. QObject(parent),pairs(new QMap<double,double> ),
  9496. interpolators(new QList<LinearCalibrator*> )
  9497. {
  9498. }
  9499. void LinearSplineInterpolator::newMeasurement(Measurement measure)
  9500. {
  9501. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9502. int index= -1;
  9503. while(i!=pairs->constEnd())
  9504. {
  9505. if(measure.temperature()<=i.key())
  9506. {
  9507. break;
  9508. }
  9509. i++;
  9510. index++;
  9511. }
  9512. if(index<0)
  9513. {
  9514. index= 0;
  9515. }
  9516. if(index>=interpolators->size())
  9517. {
  9518. index= interpolators->size()-1;
  9519. }
  9520. if(interpolators->at(index)!=NULL)
  9521. {
  9522. interpolators->at(index)->newMeasurement(measure);
  9523. }
  9524. }
  9525. /*:281*/
  9526. #line 833 "./typica.w"
  9527. /*742:*/
  9528. #line 18168 "./typica.w"
  9529. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9530. :BasicDeviceConfigurationWidget(model,index),knotmodel(new SaltModel(2))
  9531. {
  9532. QFormLayout*layout= new QFormLayout;
  9533. QLineEdit*source= new QLineEdit;
  9534. layout->addRow(tr("Source column name:"),source);
  9535. QLineEdit*destination= new QLineEdit;
  9536. layout->addRow(tr("Destination column name:"),destination);
  9537. knotmodel->setHeaderData(0,Qt::Horizontal,"Input");
  9538. knotmodel->setHeaderData(1,Qt::Horizontal,"Output");
  9539. QTableView*mappingTable= new QTableView;
  9540. mappingTable->setModel(knotmodel);
  9541. NumericDelegate*delegate= new NumericDelegate;
  9542. mappingTable->setItemDelegate(delegate);
  9543. layout->addRow(tr("Mapping data:"),mappingTable);
  9544. /*662:*/
  9545. #line 15253 "./typica.w"
  9546. QDomElement referenceElement=
  9547. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9548. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9549. QDomElement node;
  9550. /*:662*/
  9551. #line 18184 "./typica.w"
  9552. for(int i= 0;i<configData.size();i++)
  9553. {
  9554. node= configData.at(i).toElement();
  9555. if(node.attribute("name")=="source")
  9556. {
  9557. source->setText(node.attribute("value"));
  9558. }
  9559. else if(node.attribute("name")=="destination")
  9560. {
  9561. destination->setText(node.attribute("value"));
  9562. }
  9563. else if(node.attribute("name")=="sourcevalues")
  9564. {
  9565. /*743:*/
  9566. #line 18223 "./typica.w"
  9567. QString data= node.attribute("value");
  9568. if(data.length()> 3)
  9569. {
  9570. data.chop(2);
  9571. data= data.remove(0,2);
  9572. }
  9573. QStringList itemList= data.split(",");
  9574. /*:743*/
  9575. #line 18198 "./typica.w"
  9576. int column= 0;
  9577. /*744:*/
  9578. #line 18235 "./typica.w"
  9579. for(int i= 0;i<itemList.size();i++)
  9580. {
  9581. knotmodel->setData(knotmodel->index(i,column),
  9582. QVariant(itemList.at(i).toDouble()),
  9583. Qt::DisplayRole);
  9584. }
  9585. /*:744*/
  9586. #line 18200 "./typica.w"
  9587. }
  9588. else if(node.attribute("name")=="destinationvalues")
  9589. {
  9590. /*743:*/
  9591. #line 18223 "./typica.w"
  9592. QString data= node.attribute("value");
  9593. if(data.length()> 3)
  9594. {
  9595. data.chop(2);
  9596. data= data.remove(0,2);
  9597. }
  9598. QStringList itemList= data.split(",");
  9599. /*:743*/
  9600. #line 18205 "./typica.w"
  9601. int column= 1;
  9602. /*744:*/
  9603. #line 18235 "./typica.w"
  9604. for(int i= 0;i<itemList.size();i++)
  9605. {
  9606. knotmodel->setData(knotmodel->index(i,column),
  9607. QVariant(itemList.at(i).toDouble()),
  9608. Qt::DisplayRole);
  9609. }
  9610. /*:744*/
  9611. #line 18207 "./typica.w"
  9612. }
  9613. }
  9614. updateSourceColumn(source->text());
  9615. updateDestinationColumn(destination->text());
  9616. updateKnots();
  9617. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  9618. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  9619. connect(knotmodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  9620. setLayout(layout);
  9621. }
  9622. /*:742*//*745:*/
  9623. #line 18246 "./typica.w"
  9624. void LinearSplineInterpolationConfWidget::updateKnots()
  9625. {
  9626. updateAttribute("sourcevalues",knotmodel->arrayLiteral(0,Qt::DisplayRole));
  9627. updateAttribute("destinationvalues",knotmodel->arrayLiteral(1,Qt::DisplayRole));
  9628. }
  9629. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  9630. {
  9631. updateAttribute("source",source);
  9632. }
  9633. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  9634. {
  9635. updateAttribute("destination",dest);
  9636. }
  9637. /*:745*/
  9638. #line 834 "./typica.w"
  9639. /*748:*/
  9640. #line 18289 "./typica.w"
  9641. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9642. :BasicDeviceConfigurationWidget(model,index),
  9643. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  9644. {
  9645. unitSelector->addItem("Fahrenheit");
  9646. unitSelector->addItem("Celsius");
  9647. temperatureValue->setMinimum(0);
  9648. temperatureValue->setMaximum(1000);
  9649. QFormLayout*layout= new QFormLayout;
  9650. QLineEdit*column= new QLineEdit;
  9651. layout->addRow(tr("Column to match:"),column);
  9652. layout->addRow(tr("Unit:"),unitSelector);
  9653. layout->addRow(tr("Value:"),temperatureValue);
  9654. /*662:*/
  9655. #line 15253 "./typica.w"
  9656. QDomElement referenceElement=
  9657. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9658. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9659. QDomElement node;
  9660. /*:662*/
  9661. #line 18303 "./typica.w"
  9662. for(int i= 0;i<configData.size();i++)
  9663. {
  9664. node= configData.at(i).toElement();
  9665. if(node.attribute("name")=="column")
  9666. {
  9667. column->setText(node.attribute("value"));
  9668. }
  9669. else if(node.attribute("name")=="unit")
  9670. {
  9671. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  9672. }
  9673. else if(node.attribute("name")=="value")
  9674. {
  9675. temperatureValue->setValue(node.attribute("value").toDouble());
  9676. }
  9677. }
  9678. updateMatchingColumn(column->text());
  9679. updateTemperature();
  9680. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  9681. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  9682. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  9683. setLayout(layout);
  9684. }
  9685. /*:748*//*749:*/
  9686. #line 18332 "./typica.w"
  9687. void TranslationConfWidget::updateTemperature()
  9688. {
  9689. updateAttribute("unit",unitSelector->currentText());
  9690. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  9691. if(unitSelector->currentText()=="Fahrenheit")
  9692. {
  9693. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  9694. }
  9695. else
  9696. {
  9697. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  9698. }
  9699. }
  9700. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  9701. {
  9702. updateAttribute("column",column);
  9703. }
  9704. /*:749*/
  9705. #line 835 "./typica.w"
  9706. /*719:*/
  9707. #line 24 "./freeannotation.w"
  9708. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  9709. const QModelIndex&index)
  9710. :BasicDeviceConfigurationWidget(model,index)
  9711. {
  9712. QFormLayout*layout= new QFormLayout;
  9713. QLineEdit*labelEdit= new QLineEdit;
  9714. layout->addRow(tr("Label Text:"),labelEdit);
  9715. /*662:*/
  9716. #line 15253 "./typica.w"
  9717. QDomElement referenceElement=
  9718. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9719. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9720. QDomElement node;
  9721. /*:662*/
  9722. #line 32 "./freeannotation.w"
  9723. for(int i= 0;i<configData.size();i++)
  9724. {
  9725. node= configData.at(i).toElement();
  9726. if(node.attribute("name")=="labeltext")
  9727. {
  9728. labelEdit->setText(node.attribute("value"));
  9729. }
  9730. }
  9731. updateLabel(labelEdit->text());
  9732. connect(labelEdit,SIGNAL(textEdited(QString)),
  9733. this,SLOT(updateLabel(QString)));
  9734. setLayout(layout);
  9735. }
  9736. /*:719*//*720:*/
  9737. #line 49 "./freeannotation.w"
  9738. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  9739. {
  9740. updateAttribute("labeltext",text);
  9741. }
  9742. /*:720*/
  9743. #line 836 "./typica.w"
  9744. /*:17*/
  9745. #line 763 "./typica.w"
  9746. /*21:*/
  9747. #line 896 "./typica.w"
  9748. template<class TYPE> TYPE getself(QScriptContext*context)
  9749. {
  9750. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  9751. return self;
  9752. }
  9753. template<> QTime getself(QScriptContext*context)
  9754. {
  9755. QTime self= context->thisObject().toVariant().toTime();
  9756. return self;
  9757. }
  9758. template<> SqlQueryConnection*getself(QScriptContext*context)
  9759. {
  9760. SqlQueryConnection*self=
  9761. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  9762. return self;
  9763. }
  9764. template<> QXmlQuery*getself(QScriptContext*context)
  9765. {
  9766. QXmlQuery*self=
  9767. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  9768. return self;
  9769. }
  9770. template<> QXmlStreamWriter*getself(QScriptContext*context)
  9771. {
  9772. QXmlStreamWriter*self=
  9773. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  9774. return self;
  9775. }
  9776. template<> QXmlStreamReader*getself(QScriptContext*context)
  9777. {
  9778. QXmlStreamReader*self=
  9779. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  9780. return self;
  9781. }
  9782. /*:21*//*22:*/
  9783. #line 941 "./typica.w"
  9784. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  9785. {
  9786. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  9787. return argument;
  9788. }
  9789. template<> QString argument(int arg,QScriptContext*context)
  9790. {
  9791. return context->argument(arg).toString();
  9792. }
  9793. template<> QVariant argument(int arg,QScriptContext*context)
  9794. {
  9795. return context->argument(arg).toVariant();
  9796. }
  9797. template<> int argument(int arg,QScriptContext*context)
  9798. {
  9799. return context->argument(arg).toInt32();
  9800. }
  9801. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  9802. {
  9803. return(SqlQueryConnection*)
  9804. qscriptvalue_cast<void*> (context->argument(arg));
  9805. }
  9806. template<> QModelIndex argument(int arg,QScriptContext*context)
  9807. {
  9808. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  9809. }
  9810. /*:22*//*26:*/
  9811. #line 1018 "./typica.w"
  9812. void setQObjectProperties(QScriptValue,QScriptEngine*)
  9813. {
  9814. }
  9815. /*:26*//*28:*/
  9816. #line 1032 "./typica.w"
  9817. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  9818. {
  9819. }
  9820. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  9821. {
  9822. }
  9823. /*:28*//*31:*/
  9824. #line 1071 "./typica.w"
  9825. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  9826. {
  9827. QScriptValue object= engine->newQObject(new QWidget);
  9828. setQWidgetProperties(object,engine);
  9829. return object;
  9830. }
  9831. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  9832. {
  9833. setQObjectProperties(value,engine);
  9834. setQPaintDeviceProperties(value,engine);
  9835. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  9836. value.setProperty("activateWindow",
  9837. engine->newFunction(QWidget_activateWindow));
  9838. }
  9839. /*:31*//*32:*/
  9840. #line 1093 "./typica.w"
  9841. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  9842. {
  9843. if(context->argumentCount()==1)
  9844. {
  9845. QWidget*self= getself<QWidget*> (context);
  9846. QLayout*layout= argument<QLayout*> (0,context);
  9847. if(layout)
  9848. {
  9849. self->setLayout(layout);
  9850. }
  9851. else
  9852. {
  9853. context->throwError("Incorrect argument type passed to "
  9854. "QWidget::setLayout(). This method requires "
  9855. "a QLayout.");
  9856. }
  9857. }
  9858. else
  9859. {
  9860. context->throwError("Incorrect number of arguments passed to "
  9861. "QWidget::setLayout(). This method takes one "
  9862. "QLayout as an argument.");
  9863. }
  9864. return QScriptValue();
  9865. }
  9866. QScriptValue QWidget_activateWindow(QScriptContext*context,
  9867. QScriptEngine*)
  9868. {
  9869. QWidget*self= getself<QWidget*> (context);
  9870. self->activateWindow();
  9871. return QScriptValue();
  9872. }
  9873. /*:32*//*34:*/
  9874. #line 1167 "./typica.w"
  9875. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL)
  9876. {
  9877. }
  9878. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  9879. {
  9880. QSettings settings;
  9881. settings.beginGroup(key);
  9882. settings.setValue("pos",pos());
  9883. settings.setValue("size",size());
  9884. settings.endGroup();
  9885. }
  9886. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  9887. {
  9888. QSettings settings;
  9889. settings.beginGroup(key);
  9890. if(settings.contains("size"))
  9891. {
  9892. resize(settings.value("size").toSize());
  9893. }
  9894. if(settings.contains("pos"))
  9895. {
  9896. move(settings.value("pos").toPoint());
  9897. }
  9898. settings.endGroup();
  9899. }
  9900. void ScriptQMainWindow::displayStatus(const QString&message)
  9901. {
  9902. statusBar()->showMessage(message);
  9903. }
  9904. void ScriptQMainWindow::showEvent(QShowEvent*event)
  9905. {
  9906. if(!event->spontaneous())
  9907. {
  9908. /*36:*/
  9909. #line 1241 "./typica.w"
  9910. QSettings settings;
  9911. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  9912. toByteArray());
  9913. /*:36*/
  9914. #line 1206 "./typica.w"
  9915. event->accept();
  9916. }
  9917. else
  9918. {
  9919. event->ignore();
  9920. }
  9921. }
  9922. void ScriptQMainWindow::show()
  9923. {
  9924. QMainWindow::show();
  9925. }
  9926. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  9927. {
  9928. emit aboutToClose();
  9929. /*35:*/
  9930. #line 1235 "./typica.w"
  9931. QSettings settings;
  9932. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  9933. /*:35*/
  9934. #line 1223 "./typica.w"
  9935. event->accept();
  9936. }
  9937. /*:34*//*39:*/
  9938. #line 1269 "./typica.w"
  9939. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  9940. {
  9941. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  9942. setQMainWindowProperties(object,engine);
  9943. return object;
  9944. }
  9945. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  9946. {
  9947. setQWidgetProperties(value,engine);
  9948. value.setProperty("setCentralWidget",
  9949. engine->newFunction(QMainWindow_setCentralWidget));
  9950. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  9951. }
  9952. /*:39*//*40:*/
  9953. #line 1291 "./typica.w"
  9954. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  9955. QScriptEngine*)
  9956. {
  9957. if(context->argumentCount()==1)
  9958. {
  9959. QMainWindow*self= getself<QMainWindow*> (context);
  9960. QWidget*widget= argument<QWidget*> (0,context);
  9961. if(widget)
  9962. {
  9963. self->setCentralWidget(widget);
  9964. }
  9965. else
  9966. {
  9967. context->throwError("Incorrect argument type passed to "
  9968. "QMainWindow::setCentralWidget(). This "
  9969. "method requires a QWidget.");
  9970. }
  9971. }
  9972. else
  9973. {
  9974. context->throwError("Incorrect number of arguments passed to "
  9975. "QMainWindow::setCentralWidget(). This method "
  9976. "takes one QWidget as an argument.");
  9977. }
  9978. return QScriptValue();
  9979. }
  9980. /*:40*//*41:*/
  9981. #line 1325 "./typica.w"
  9982. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  9983. {
  9984. QScriptValue object;
  9985. if(context->argumentCount()==0)
  9986. {
  9987. QMainWindow*self= getself<QMainWindow*> (context);
  9988. QMenuBar*bar= self->menuBar();
  9989. object= engine->newQObject(bar);
  9990. setQMenuBarProperties(object,engine);
  9991. }
  9992. else
  9993. {
  9994. context->throwError("Incorrect number of arguments passed to "
  9995. "QMainWindow::menuBar(). This method takes no "
  9996. "arguments.");
  9997. }
  9998. return object;
  9999. }
  10000. /*:41*//*43:*/
  10001. #line 1355 "./typica.w"
  10002. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  10003. {
  10004. setQWidgetProperties(value,engine);
  10005. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  10006. }
  10007. /*:43*//*44:*/
  10008. #line 1370 "./typica.w"
  10009. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  10010. {
  10011. QScriptValue object;
  10012. if(context->argumentCount()==1)
  10013. {
  10014. QMenuBar*self= getself<QMenuBar*> (context);
  10015. QString title= argument<QString> (0,context);
  10016. object= engine->newQObject(self->addMenu(title));
  10017. setQMenuProperties(object,engine);
  10018. }
  10019. else
  10020. {
  10021. context->throwError("Incorrect number of arguments passed to "
  10022. "QMenuBar::addMenu(). This method takes one "
  10023. "string as an argument.");
  10024. }
  10025. return object;
  10026. }
  10027. /*:44*//*46:*/
  10028. #line 1400 "./typica.w"
  10029. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  10030. {
  10031. setQWidgetProperties(value,engine);
  10032. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  10033. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  10034. }
  10035. /*:46*//*47:*/
  10036. #line 1410 "./typica.w"
  10037. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  10038. {
  10039. if(context->argumentCount()==1)
  10040. {
  10041. QMenu*self= getself<QMenu*> (context);
  10042. QAction*action= argument<QAction*> (0,context);
  10043. if(action)
  10044. {
  10045. self->addAction(action);
  10046. }
  10047. else
  10048. {
  10049. context->throwError("Incorrect argument type passed to "
  10050. "QMenu::addAction(). This method requires a "
  10051. "QAction.");
  10052. }
  10053. }
  10054. else
  10055. {
  10056. context->throwError("Incorrect number of arguments passed to "
  10057. "QMenu::addAction(). This method takes one "
  10058. "QAction as an argument.");
  10059. }
  10060. return QScriptValue();
  10061. }
  10062. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  10063. {
  10064. if(context->argumentCount()==0)
  10065. {
  10066. QMenu*self= getself<QMenu*> (context);
  10067. self->addSeparator();
  10068. }
  10069. else
  10070. {
  10071. context->throwError("Incorrect number of arguments passed to "
  10072. "QMenu::addSeparator(). This method takes no "
  10073. "arguments.");
  10074. }
  10075. return QScriptValue();
  10076. }
  10077. /*:47*//*50:*/
  10078. #line 1472 "./typica.w"
  10079. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  10080. {
  10081. QScriptValue object= engine->newQObject(new QFrame);
  10082. setQFrameProperties(object,engine);
  10083. return object;
  10084. }
  10085. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  10086. {
  10087. setQWidgetProperties(value,engine);
  10088. }
  10089. /*:50*//*53:*/
  10090. #line 1506 "./typica.w"
  10091. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  10092. {
  10093. QString text;
  10094. if(context->argumentCount()==1)
  10095. {
  10096. text= argument<QString> (0,context);
  10097. }
  10098. QScriptValue object= engine->newQObject(new QLabel(text));
  10099. setQLabelProperties(object,engine);
  10100. return object;
  10101. }
  10102. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  10103. {
  10104. setQFrameProperties(value,engine);
  10105. }
  10106. /*:53*//*56:*/
  10107. #line 1543 "./typica.w"
  10108. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  10109. {
  10110. QScriptValue object= engine->newQObject(new QLineEdit());
  10111. setQLineEditProperties(object,engine);
  10112. return object;
  10113. }
  10114. /*:56*//*57:*/
  10115. #line 1554 "./typica.w"
  10116. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  10117. {
  10118. setQWidgetProperties(value,engine);
  10119. }
  10120. /*:57*//*60:*/
  10121. #line 1588 "./typica.w"
  10122. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  10123. {
  10124. QScriptValue object= engine->newQObject(new QSplitter);
  10125. setQSplitterProperties(object,engine);
  10126. return object;
  10127. }
  10128. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  10129. {
  10130. setQFrameProperties(value,engine);
  10131. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  10132. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  10133. value.setProperty("restoreState",
  10134. engine->newFunction(QSplitter_restoreState));
  10135. }
  10136. /*:60*//*61:*/
  10137. #line 1608 "./typica.w"
  10138. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  10139. {
  10140. if(context->argumentCount()==1)
  10141. {
  10142. QSplitter*self= getself<QSplitter*> (context);
  10143. QWidget*widget= argument<QWidget*> (0,context);
  10144. if(widget)
  10145. {
  10146. self->addWidget(widget);
  10147. }
  10148. else
  10149. {
  10150. context->throwError("Incorrect argument type passed to "
  10151. "QSplitter::addWidget(). This method "
  10152. "requires a QWidget.");
  10153. }
  10154. }
  10155. else
  10156. {
  10157. context->throwError("Incorrect number of arguments passed to "
  10158. "QSplitter::addWidget(). This method takes one "
  10159. "QWidget as an argument.");
  10160. }
  10161. return QScriptValue();
  10162. }
  10163. /*:61*//*62:*/
  10164. #line 1641 "./typica.w"
  10165. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  10166. {
  10167. if(context->argumentCount()==1)
  10168. {
  10169. QSplitter*self= getself<QSplitter*> (context);
  10170. QString key= argument<QString> (0,context);
  10171. QSettings settings;
  10172. settings.setValue(key,self->saveState());
  10173. }
  10174. else
  10175. {
  10176. context->throwError("Incorrect number of arguments passed to "
  10177. "QSplitter::saveState(). This method takes one "
  10178. "string as an argument.");
  10179. }
  10180. return QScriptValue();
  10181. }
  10182. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  10183. {
  10184. if(context->argumentCount()==1)
  10185. {
  10186. QSplitter*self= getself<QSplitter*> (context);
  10187. QString key= argument<QString> (0,context);
  10188. QSettings settings;
  10189. self->restoreState(settings.value(key).toByteArray());
  10190. }
  10191. else
  10192. {
  10193. context->throwError("Incorrect number of arguments passed to "
  10194. "QSplitter::restoreState(). This method takes "
  10195. "one string as an argument.");
  10196. }
  10197. return QScriptValue();
  10198. }
  10199. /*:62*//*64:*/
  10200. #line 1694 "./typica.w"
  10201. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10202. {
  10203. setQLayoutItemProperties(value,engine);
  10204. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  10205. }
  10206. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10207. {
  10208. if(context->argumentCount()==1)
  10209. {
  10210. QLayout*self= getself<QLayout*> (context);
  10211. QWidget*widget= argument<QWidget*> (0,context);
  10212. if(widget)
  10213. {
  10214. self->addWidget(widget);
  10215. }
  10216. else
  10217. {
  10218. context->throwError("Incorrect argument type passed to "
  10219. "QLayout::addWidget(). This method requires "
  10220. "a QWidget.");
  10221. }
  10222. }
  10223. else
  10224. {
  10225. context->throwError("Incorrect number of arguments passed to "
  10226. "QLayout::addWidget(). This method takes one "
  10227. "QWidget as an argument.");
  10228. }
  10229. return QScriptValue();
  10230. }
  10231. /*:64*//*67:*/
  10232. #line 1761 "./typica.w"
  10233. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  10234. {
  10235. QScriptValue object=
  10236. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  10237. setQBoxLayoutProperties(object,engine);
  10238. return object;
  10239. }
  10240. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10241. {
  10242. setQLayoutProperties(value,engine);
  10243. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  10244. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  10245. }
  10246. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  10247. {
  10248. if(context->argumentCount()> 0&&context->argumentCount()<3)
  10249. {
  10250. QBoxLayout*self= getself<QBoxLayout*> (context);
  10251. QLayout*layout= argument<QLayout*> (0,context);
  10252. int stretch= 0;
  10253. if(context->argumentCount()==2)
  10254. {
  10255. stretch= argument<int> (1,context);
  10256. }
  10257. if(layout)
  10258. {
  10259. self->addLayout(layout,stretch);
  10260. }
  10261. else
  10262. {
  10263. context->throwError("Incorrect argument type passed to "
  10264. "QLayout::addLayout(). This method requires "
  10265. "a QLayout.");
  10266. }
  10267. }
  10268. else
  10269. {
  10270. context->throwError("Incorrect number of arguments passed to "
  10271. "QLayout::addLayout(). This method takes one "
  10272. "QLayout as an argument and optionally one integer.");
  10273. }
  10274. return QScriptValue();
  10275. }
  10276. /*:67*//*68:*/
  10277. #line 1812 "./typica.w"
  10278. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10279. {
  10280. if(context->argumentCount()> 0&&context->argumentCount()<4)
  10281. {
  10282. QBoxLayout*self= getself<QBoxLayout*> (context);
  10283. QWidget*widget= argument<QWidget*> (0,context);
  10284. int stretch= 0;
  10285. Qt::Alignment alignment= 0;
  10286. if(context->argumentCount()> 1)
  10287. {
  10288. stretch= argument<int> (1,context);
  10289. }
  10290. if(context->argumentCount()> 2)
  10291. {
  10292. alignment= (Qt::Alignment)(argument<int> (2,context));
  10293. }
  10294. if(widget)
  10295. {
  10296. self->addWidget(widget,stretch,alignment);
  10297. }
  10298. else
  10299. {
  10300. context->throwError("Incorrect argument type passed to "
  10301. "QBoxLayout::addWidget(). This method requires "
  10302. "a QWidget.");
  10303. }
  10304. }
  10305. else
  10306. {
  10307. context->throwError("Incorrect number of arguments passed to "
  10308. "QBoxLayout::addWidget(). This method takes one "
  10309. "QWidget and optionally up to two integers as "
  10310. "arguments.");
  10311. }
  10312. return QScriptValue();
  10313. }
  10314. /*:68*//*71:*/
  10315. #line 1876 "./typica.w"
  10316. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  10317. {
  10318. QScriptValue object= engine->newQObject(new QAction(NULL));
  10319. setQActionProperties(object,engine);
  10320. return object;
  10321. }
  10322. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  10323. {
  10324. setQObjectProperties(value,engine);
  10325. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  10326. }
  10327. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  10328. {
  10329. if(context->argumentCount()==1)
  10330. {
  10331. QAction*self= getself<QAction*> (context);
  10332. self->setShortcut(argument<QString> (0,context));
  10333. }
  10334. else
  10335. {
  10336. context->throwError("Incorrect number of arguments passed to "
  10337. "QAction::setShortcut(). This method takes one "
  10338. "string as an argument.");
  10339. }
  10340. return QScriptValue();
  10341. }
  10342. /*:71*//*74:*/
  10343. #line 1934 "./typica.w"
  10344. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  10345. QScriptEngine*engine)
  10346. {
  10347. QScriptValue retval;
  10348. if(context->argumentCount()==3)
  10349. {
  10350. QWidget*widget= argument<QWidget*> (0,context);
  10351. if(widget)
  10352. {
  10353. QString caption= argument<QString> (1,context);
  10354. QString dir= argument<QString> (2,context);
  10355. retval= QScriptValue(engine,
  10356. QFileDialog::getOpenFileName(widget,caption,
  10357. dir,"",0,0));
  10358. setQFileDialogProperties(retval,engine);
  10359. }
  10360. else
  10361. {
  10362. context->throwError("Incorrect argument type passed to "
  10363. "QFileDialog::getOpenFileName(). The first "
  10364. "argument to this method must be a QWidget.");
  10365. }
  10366. }
  10367. else
  10368. {
  10369. context->throwError("Incorrect number of arguments passed to "
  10370. "QFileDialog::getOpenFileName(). This method "
  10371. "takes one QWidget followed by two strings for a "
  10372. "total of three arguments.");
  10373. }
  10374. return retval;
  10375. }
  10376. /*:74*//*75:*/
  10377. #line 1970 "./typica.w"
  10378. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  10379. QScriptEngine*engine)
  10380. {
  10381. QScriptValue retval;
  10382. if(context->argumentCount()==3)
  10383. {
  10384. QWidget*widget= argument<QWidget*> (0,context);
  10385. if(widget)
  10386. {
  10387. QString caption= argument<QString> (1,context);
  10388. QString dir= argument<QString> (2,context);
  10389. retval= QScriptValue(engine,
  10390. QFileDialog::getSaveFileName(widget,caption,
  10391. dir,"",0,0));
  10392. setQFileDialogProperties(retval,engine);
  10393. }
  10394. else
  10395. {
  10396. context->throwError("Incorrect argument type passed to "
  10397. "QFileDialog::getSaveFileName(). The first "
  10398. "argument to this method must be a QWidget.");
  10399. }
  10400. }
  10401. else
  10402. {
  10403. context->throwError("Incorrect number of arguments passed to "
  10404. "QFileDialog::getSaveFileName(). This method "
  10405. "takes one QWidget followed by two strings for a "
  10406. "total of three arguments.");
  10407. }
  10408. return retval;
  10409. }
  10410. /*:75*//*76:*/
  10411. #line 2007 "./typica.w"
  10412. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  10413. {
  10414. setQDialogProperties(value,engine);
  10415. }
  10416. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  10417. {
  10418. setQWidgetProperties(value,engine);
  10419. }
  10420. /*:76*//*79:*/
  10421. #line 2042 "./typica.w"
  10422. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  10423. {
  10424. QScriptValue object=
  10425. engine->newQObject(new QFile(argument<QString> (0,context)));
  10426. setQFileProperties(object,engine);
  10427. return object;
  10428. }
  10429. /*:79*//*80:*/
  10430. #line 2053 "./typica.w"
  10431. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  10432. {
  10433. setQIODeviceProperties(value,engine);
  10434. value.setProperty("remove",engine->newFunction(QFile_remove));
  10435. }
  10436. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  10437. {
  10438. QFile*self= getself<QFile*> (context);
  10439. bool retval= self->remove();
  10440. return QScriptValue(engine,retval);
  10441. }
  10442. /*:80*//*81:*/
  10443. #line 2075 "./typica.w"
  10444. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  10445. {
  10446. setQObjectProperties(value,engine);
  10447. value.setProperty("open",engine->newFunction(QIODevice_open));
  10448. value.setProperty("close",engine->newFunction(QIODevice_close));
  10449. value.setProperty("readToString",
  10450. engine->newFunction(QIODevice_readToString));
  10451. }
  10452. /*:81*//*82:*/
  10453. #line 2090 "./typica.w"
  10454. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  10455. {
  10456. QIODevice*self= getself<QIODevice*> (context);
  10457. if(context->argumentCount()==1)
  10458. {
  10459. switch(argument<int> (0,context))
  10460. {
  10461. case 1:
  10462. self->open(QIODevice::ReadOnly);
  10463. break;
  10464. case 2:
  10465. self->open(QIODevice::WriteOnly);
  10466. break;
  10467. case 3:
  10468. self->open(QIODevice::ReadWrite);
  10469. break;
  10470. default:
  10471. break;
  10472. }
  10473. }
  10474. else
  10475. {
  10476. self->open(QIODevice::ReadWrite);
  10477. }
  10478. return QScriptValue();
  10479. }
  10480. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  10481. {
  10482. QIODevice*self= getself<QIODevice*> (context);
  10483. self->close();
  10484. return QScriptValue();
  10485. }
  10486. /*:82*//*83:*/
  10487. #line 2129 "./typica.w"
  10488. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  10489. {
  10490. QIODevice*self= getself<QIODevice*> (context);
  10491. self->reset();
  10492. return QScriptValue(QString(self->readAll()));
  10493. }
  10494. /*:83*//*86:*/
  10495. #line 2159 "./typica.w"
  10496. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  10497. {
  10498. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  10499. QScriptValue object= engine->newQObject(new QBuffer(array));
  10500. setQBufferProperties(object,engine);
  10501. return object;
  10502. }
  10503. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  10504. {
  10505. setQIODeviceProperties(value,engine);
  10506. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  10507. }
  10508. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  10509. {
  10510. QBuffer*self= getself<QBuffer*> (context);
  10511. self->setData(argument<QString> (0,context).toAscii());
  10512. return QScriptValue();
  10513. }
  10514. /*:86*//*89:*/
  10515. #line 2207 "./typica.w"
  10516. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  10517. {
  10518. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  10519. setXQueryProperties(object,engine);
  10520. return object;
  10521. }
  10522. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  10523. {
  10524. value.setProperty("bind",engine->newFunction(XQuery_bind));
  10525. value.setProperty("exec",engine->newFunction(XQuery_exec));
  10526. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  10527. }
  10528. /*:89*//*90:*/
  10529. #line 2225 "./typica.w"
  10530. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  10531. {
  10532. QXmlQuery*self= getself<QXmlQuery*> (context);
  10533. QIODevice*buffer= argument<QIODevice*> (1,context);
  10534. self->bindVariable(argument<QString> (0,context),buffer);
  10535. return QScriptValue();
  10536. }
  10537. /*:90*//*91:*/
  10538. #line 2236 "./typica.w"
  10539. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  10540. {
  10541. QXmlQuery*self= getself<QXmlQuery*> (context);
  10542. self->setQuery(argument<QString> (0,context));
  10543. return QScriptValue();
  10544. }
  10545. /*:91*//*92:*/
  10546. #line 2246 "./typica.w"
  10547. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  10548. {
  10549. QXmlQuery*self= getself<QXmlQuery*> (context);
  10550. QString result;
  10551. self->evaluateTo(&result);
  10552. return QScriptValue(result);
  10553. }
  10554. /*:92*//*95:*/
  10555. #line 2301 "./typica.w"
  10556. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  10557. {
  10558. QXmlStreamWriter*retval;
  10559. if(context->argumentCount()==1)
  10560. {
  10561. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  10562. }
  10563. else
  10564. {
  10565. retval= new QXmlStreamWriter;
  10566. }
  10567. QScriptValue object= engine->toScriptValue<void*> (retval);
  10568. setXmlWriterProperties(object,engine);
  10569. return object;
  10570. }
  10571. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  10572. {
  10573. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  10574. value.setProperty("writeAttribute",
  10575. engine->newFunction(XmlWriter_writeAttribute));
  10576. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  10577. value.setProperty("writeCharacters",
  10578. engine->newFunction(XmlWriter_writeCharacters));
  10579. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  10580. value.setProperty("writeEmptyElement",
  10581. engine->newFunction(XmlWriter_writeEmptyElement));
  10582. value.setProperty("writeEndDocument",
  10583. engine->newFunction(XmlWriter_writeEndDocument));
  10584. value.setProperty("writeEndElement",
  10585. engine->newFunction(XmlWriter_writeEndElement));
  10586. value.setProperty("writeEntityReference",
  10587. engine->newFunction(XmlWriter_writeEntityReference));
  10588. value.setProperty("writeProcessingInstruction",
  10589. engine->newFunction(XmlWriter_writeProcessingInstruction));
  10590. value.setProperty("writeStartDocument",
  10591. engine->newFunction(XmlWriter_writeStartDocument));
  10592. value.setProperty("writeStartElement",
  10593. engine->newFunction(XmlWriter_writeStartElement));
  10594. value.setProperty("writeTextElement",
  10595. engine->newFunction(XmlWriter_writeTextElement));
  10596. }
  10597. /*:95*//*96:*/
  10598. #line 2348 "./typica.w"
  10599. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  10600. {
  10601. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10602. QIODevice*device= argument<QIODevice*> (0,context);
  10603. self->setDevice(device);
  10604. return QScriptValue();
  10605. }
  10606. /*:96*//*97:*/
  10607. #line 2362 "./typica.w"
  10608. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  10609. QScriptEngine*)
  10610. {
  10611. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10612. self->writeStartDocument(argument<QString> (0,context));
  10613. return QScriptValue();
  10614. }
  10615. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  10616. QScriptEngine*)
  10617. {
  10618. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10619. self->writeEndDocument();
  10620. return QScriptValue();
  10621. }
  10622. /*:97*//*98:*/
  10623. #line 2381 "./typica.w"
  10624. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  10625. {
  10626. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10627. self->writeDTD(argument<QString> (0,context));
  10628. return QScriptValue();
  10629. }
  10630. /*:98*//*99:*/
  10631. #line 2392 "./typica.w"
  10632. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  10633. QScriptEngine*)
  10634. {
  10635. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10636. self->writeStartElement(argument<QString> (0,context));
  10637. return QScriptValue();
  10638. }
  10639. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  10640. {
  10641. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10642. self->writeAttribute(argument<QString> (0,context),
  10643. argument<QString> (1,context));
  10644. return QScriptValue();
  10645. }
  10646. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  10647. {
  10648. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10649. self->writeCharacters(argument<QString> (0,context));
  10650. return QScriptValue();
  10651. }
  10652. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  10653. {
  10654. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10655. self->writeEndElement();
  10656. return QScriptValue();
  10657. }
  10658. /*:99*//*100:*/
  10659. #line 2428 "./typica.w"
  10660. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  10661. QScriptEngine*)
  10662. {
  10663. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10664. self->writeEmptyElement(argument<QString> (0,context));
  10665. return QScriptValue();
  10666. }
  10667. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  10668. QScriptEngine*)
  10669. {
  10670. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10671. self->writeTextElement(argument<QString> (0,context),
  10672. argument<QString> (1,context));
  10673. return QScriptValue();
  10674. }
  10675. /*:100*//*101:*/
  10676. #line 2449 "./typica.w"
  10677. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  10678. {
  10679. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10680. self->writeCDATA(argument<QString> (0,context));
  10681. return QScriptValue();
  10682. }
  10683. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  10684. QScriptEngine*)
  10685. {
  10686. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10687. self->writeEntityReference(argument<QString> (0,context));
  10688. return QScriptValue();
  10689. }
  10690. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  10691. QScriptEngine*)
  10692. {
  10693. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10694. self->writeProcessingInstruction(argument<QString> (0,context),
  10695. argument<QString> (1,context));
  10696. return QScriptValue();
  10697. }
  10698. /*:101*//*104:*/
  10699. #line 2508 "./typica.w"
  10700. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  10701. {
  10702. QXmlStreamReader*retval=
  10703. new QXmlStreamReader(argument<QIODevice*> (0,context));
  10704. QScriptValue object= engine->toScriptValue<void*> (retval);
  10705. setXmlReaderProperties(object,engine);
  10706. return object;
  10707. }
  10708. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  10709. {
  10710. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  10711. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  10712. value.setProperty("hasAttribute",
  10713. engine->newFunction(XmlReader_hasAttribute));
  10714. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  10715. value.setProperty("isStartElement",
  10716. engine->newFunction(XmlReader_isStartElement));
  10717. value.setProperty("name",engine->newFunction(XmlReader_name));
  10718. value.setProperty("readElementText",
  10719. engine->newFunction(XmlReader_readElementText));
  10720. value.setProperty("readNext",
  10721. engine->newFunction(XmlReader_readNext));
  10722. value.setProperty("text",engine->newFunction(XmlReader_text));
  10723. }
  10724. /*:104*//*105:*/
  10725. #line 2538 "./typica.w"
  10726. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  10727. {
  10728. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10729. QString retval=
  10730. self->attributes().value(argument<QString> (0,context)).toString();
  10731. return QScriptValue(retval);
  10732. }
  10733. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  10734. {
  10735. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10736. bool retval=
  10737. self->attributes().hasAttribute(argument<QString> (0,context));
  10738. return QScriptValue(retval);
  10739. }
  10740. /*:105*//*106:*/
  10741. #line 2558 "./typica.w"
  10742. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  10743. {
  10744. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10745. return QScriptValue(self->atEnd());
  10746. }
  10747. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  10748. {
  10749. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10750. return QScriptValue(self->isDTD());
  10751. }
  10752. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  10753. {
  10754. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10755. return QScriptValue(self->isStartElement());
  10756. }
  10757. /*:106*//*107:*/
  10758. #line 2579 "./typica.w"
  10759. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  10760. {
  10761. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10762. self->readNext();
  10763. return QScriptValue();
  10764. }
  10765. /*:107*//*108:*/
  10766. #line 2589 "./typica.w"
  10767. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  10768. {
  10769. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10770. return QScriptValue(self->name().toString());
  10771. }
  10772. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  10773. {
  10774. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10775. return QScriptValue(self->readElementText());
  10776. }
  10777. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  10778. {
  10779. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10780. return QScriptValue(self->text().toString());
  10781. }
  10782. /*:108*//*111:*/
  10783. #line 2631 "./typica.w"
  10784. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  10785. {
  10786. setQObjectProperties(value,engine);
  10787. value.setProperty("value",engine->newFunction(QSettings_value));
  10788. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  10789. }
  10790. /*:111*//*112:*/
  10791. #line 2643 "./typica.w"
  10792. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  10793. {
  10794. QScriptValue object;
  10795. if(context->argumentCount()==1||context->argumentCount()==2)
  10796. {
  10797. QSettings settings;
  10798. QString key= argument<QString> (0,context);
  10799. QVariant value;
  10800. QVariant retval;
  10801. if(context->argumentCount()> 1)
  10802. {
  10803. value= argument<QVariant> (1,context);
  10804. retval= settings.value(key,value);
  10805. }
  10806. else
  10807. {
  10808. retval= settings.value(key);
  10809. }
  10810. object= engine->newVariant(retval);
  10811. }
  10812. else
  10813. {
  10814. context->throwError("Incorrect number of arguments passed to "
  10815. "QSettings::value(). This method takes one "
  10816. "string and one optional variant type.");
  10817. }
  10818. return object;
  10819. }
  10820. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  10821. {
  10822. if(context->argumentCount()==2)
  10823. {
  10824. QSettings settings;
  10825. QString key= argument<QString> (0,context);
  10826. QVariant value= argument<QVariant> (1,context);
  10827. settings.setValue(key,value);
  10828. }
  10829. else
  10830. {
  10831. context->throwError("Incorrect number of arguments passed to "
  10832. "QSettings::setValue(). This method takes one "
  10833. "string and one variant type for a total of two "
  10834. "arguments.");
  10835. }
  10836. return QScriptValue();
  10837. }
  10838. /*:112*//*115:*/
  10839. #line 2712 "./typica.w"
  10840. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  10841. {
  10842. QScriptValue object= engine->newQObject(new QLCDNumber());
  10843. setQLCDNumberProperties(object,engine);
  10844. return object;
  10845. }
  10846. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  10847. {
  10848. setQFrameProperties(value,engine);
  10849. }
  10850. /*:115*//*118:*/
  10851. #line 2770 "./typica.w"
  10852. QScriptValue constructQTime(QScriptContext*context,
  10853. QScriptEngine*engine)
  10854. {
  10855. QScriptValue object;
  10856. if(context->argumentCount()==0||
  10857. (context->argumentCount()>=2&&context->argumentCount()<=4))
  10858. {
  10859. int arg1= 0;
  10860. int arg2= 0;
  10861. int arg3= 0;
  10862. int arg4= 0;
  10863. switch(context->argumentCount())
  10864. {
  10865. case 4:
  10866. arg4= argument<int> (3,context);
  10867. case 3:
  10868. arg3= argument<int> (2,context);
  10869. case 2:
  10870. arg2= argument<int> (1,context);
  10871. arg1= argument<int> (0,context);
  10872. default:
  10873. break;
  10874. }
  10875. if(context->argumentCount())
  10876. {
  10877. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  10878. arg4));
  10879. }
  10880. else
  10881. {
  10882. object= engine->toScriptValue<QTime> (QTime());
  10883. }
  10884. setQTimeProperties(object,engine);
  10885. }
  10886. else
  10887. {
  10888. context->throwError("Incorrect number of arguments passed to "
  10889. "QTime::QTime(). This method takes zero, two, "
  10890. "three, or four integer arguments.");
  10891. }
  10892. return object;
  10893. }
  10894. /*:118*//*119:*/
  10895. #line 2818 "./typica.w"
  10896. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  10897. {
  10898. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  10899. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  10900. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  10901. value.setProperty("hour",engine->newFunction(QTime_hour));
  10902. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  10903. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  10904. value.setProperty("minute",engine->newFunction(QTime_minute));
  10905. value.setProperty("msec",engine->newFunction(QTime_msec));
  10906. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  10907. value.setProperty("restart",engine->newFunction(QTime_restart));
  10908. value.setProperty("second",engine->newFunction(QTime_second));
  10909. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  10910. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  10911. value.setProperty("start",engine->newFunction(QTime_start));
  10912. value.setProperty("toString",engine->newFunction(QTime_toString));
  10913. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  10914. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  10915. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  10916. }
  10917. /*:119*//*120:*/
  10918. #line 2847 "./typica.w"
  10919. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  10920. {
  10921. QTime self= getself<QTime> (context);
  10922. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  10923. (self.second()*1000)+self.msec();
  10924. return QScriptValue(retval);
  10925. }
  10926. /*:120*//*121:*/
  10927. #line 2861 "./typica.w"
  10928. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  10929. {
  10930. QTime time;
  10931. QScriptValue retval;
  10932. if(context->argumentCount()==1)
  10933. {
  10934. QTime self= getself<QTime> (context);
  10935. time= self.addMSecs(argument<int> (0,context));
  10936. retval= engine->toScriptValue<QTime> (time);
  10937. setQTimeProperties(retval,engine);
  10938. }
  10939. else
  10940. {
  10941. context->throwError("Incorrect number of arguments passed to "
  10942. "QTime::addMSecs(). This method takes one "
  10943. "integer as an argument.");
  10944. }
  10945. return retval;
  10946. }
  10947. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  10948. {
  10949. QTime time;
  10950. QScriptValue retval;
  10951. if(context->argumentCount()==1)
  10952. {
  10953. QTime self= getself<QTime> (context);
  10954. time= self.addSecs(argument<int> (0,context));
  10955. retval= engine->toScriptValue<QTime> (time);
  10956. setQTimeProperties(retval,engine);
  10957. }
  10958. else
  10959. {
  10960. context->throwError("Incorrect number of arguments passed to "
  10961. "QTime::addSecs(). This method takes one "
  10962. "integer as an argument.");
  10963. }
  10964. return retval;
  10965. }
  10966. /*:121*//*122:*/
  10967. #line 2904 "./typica.w"
  10968. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  10969. {
  10970. QScriptValue retval;
  10971. if(context->argumentCount()==0)
  10972. {
  10973. QTime self= getself<QTime> (context);
  10974. retval= QScriptValue(engine,self.elapsed());
  10975. }
  10976. else
  10977. {
  10978. context->throwError("Incorrect number of arguments passed to "
  10979. "QTime::elapsed(). This method takes no "
  10980. "arguments.");
  10981. }
  10982. return retval;
  10983. }
  10984. /*:122*//*123:*/
  10985. #line 2925 "./typica.w"
  10986. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  10987. {
  10988. QScriptValue retval;
  10989. if(context->argumentCount()==0)
  10990. {
  10991. QTime self= getself<QTime> (context);
  10992. retval= QScriptValue(engine,self.hour());
  10993. }
  10994. else
  10995. {
  10996. context->throwError("Incorrect number of arguments passed to "
  10997. "QTime::hour(). This method takes no "
  10998. "arguments.");
  10999. }
  11000. return retval;
  11001. }
  11002. /*:123*//*124:*/
  11003. #line 2945 "./typica.w"
  11004. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  11005. {
  11006. QScriptValue retval;
  11007. if(context->argumentCount()==0)
  11008. {
  11009. QTime self= getself<QTime> (context);
  11010. retval= QScriptValue(engine,self.minute());
  11011. }
  11012. else
  11013. {
  11014. context->throwError("Incorrect number of arguments passed to "
  11015. "QTime::minute(). This method takes no "
  11016. "arguments.");
  11017. }
  11018. return retval;
  11019. }
  11020. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  11021. {
  11022. QScriptValue retval;
  11023. if(context->argumentCount()==0)
  11024. {
  11025. QTime self= getself<QTime> (context);
  11026. retval= QScriptValue(engine,self.second());
  11027. }
  11028. else
  11029. {
  11030. context->throwError("Incorrect number of arguments passed to "
  11031. "QTime::second(). This method takes no "
  11032. "arguments.");
  11033. }
  11034. return retval;
  11035. }
  11036. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  11037. {
  11038. QScriptValue retval;
  11039. if(context->argumentCount()==0)
  11040. {
  11041. QTime self= getself<QTime> (context);
  11042. retval= QScriptValue(engine,self.msec());
  11043. }
  11044. else
  11045. {
  11046. context->throwError("Incorrect number of arguments passed to "
  11047. "QTime::msec(). This method takes no "
  11048. "arguments.");
  11049. }
  11050. return retval;
  11051. }
  11052. /*:124*//*125:*/
  11053. #line 3001 "./typica.w"
  11054. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  11055. {
  11056. QScriptValue retval;
  11057. if(context->argumentCount()==0)
  11058. {
  11059. QTime self= getself<QTime> (context);
  11060. retval= QScriptValue(engine,self.isNull());
  11061. }
  11062. else
  11063. {
  11064. context->throwError("Incorrect number of arguments passed to "
  11065. "QTime::isNull(). This method takes no "
  11066. "arguments.");
  11067. }
  11068. return retval;
  11069. }
  11070. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  11071. {
  11072. QScriptValue retval;
  11073. if(context->argumentCount()==0)
  11074. {
  11075. QTime self= getself<QTime> (context);
  11076. retval= QScriptValue(engine,self.isValid());
  11077. }
  11078. else
  11079. {
  11080. context->throwError("Incorrect number of arguments passed to "
  11081. "QTime::isValid(). This method takes no "
  11082. "arguments.");
  11083. }
  11084. return retval;
  11085. }
  11086. /*:125*//*126:*/
  11087. #line 3039 "./typica.w"
  11088. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  11089. {
  11090. QScriptValue retval;
  11091. if(context->argumentCount()==1)
  11092. {
  11093. QTime self= getself<QTime> (context);
  11094. QTime arg= argument<QVariant> (0,context).toTime();
  11095. retval= QScriptValue(engine,self.msecsTo(arg));
  11096. }
  11097. else
  11098. {
  11099. context->throwError("Incorrect number of arguments passed to "
  11100. "QTime::msecsTo(). This method takes one QTime.");
  11101. }
  11102. return retval;
  11103. }
  11104. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  11105. {
  11106. QScriptValue retval;
  11107. if(context->argumentCount()==1)
  11108. {
  11109. QTime self= getself<QTime> (context);
  11110. QTime arg= argument<QVariant> (0,context).toTime();
  11111. retval= QScriptValue(engine,self.secsTo(arg));
  11112. }
  11113. else
  11114. {
  11115. context->throwError("Incorrect number of arguments passed to "
  11116. "QTime::secsTo(). This method takes one QTime.");
  11117. }
  11118. return retval;
  11119. }
  11120. /*:126*//*127:*/
  11121. #line 3078 "./typica.w"
  11122. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  11123. {
  11124. QScriptValue retval;
  11125. if(context->argumentCount()==0)
  11126. {
  11127. QTime self= getself<QTime> (context);
  11128. retval= QScriptValue(engine,self.restart());
  11129. }
  11130. else
  11131. {
  11132. context->throwError("Incorrect number of arguments passed to "
  11133. "QTime::restart(). This method takes no "
  11134. "arguments.");
  11135. }
  11136. return retval;
  11137. }
  11138. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  11139. {
  11140. if(context->argumentCount()==0)
  11141. {
  11142. QTime self= getself<QTime> (context);
  11143. self.start();
  11144. }
  11145. else
  11146. {
  11147. context->throwError("Incorrect number of arguments passed to "
  11148. "QTime::start(). This method takes no arguments.");
  11149. }
  11150. return QScriptValue();
  11151. }
  11152. /*:127*//*128:*/
  11153. #line 3114 "./typica.w"
  11154. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  11155. {
  11156. QScriptValue retval;
  11157. if(context->argumentCount()==3||context->argumentCount()==4)
  11158. {
  11159. QTime self= getself<QTime> (context);
  11160. int arg1= 0;
  11161. int arg2= 0;
  11162. int arg3= 0;
  11163. int arg4= 0;
  11164. switch(context->argumentCount())
  11165. {
  11166. case 4:
  11167. arg4= argument<int> (3,context);
  11168. case 3:
  11169. arg3= argument<int> (2,context);
  11170. arg2= argument<int> (1,context);
  11171. arg1= argument<int> (0,context);
  11172. default:
  11173. break;
  11174. }
  11175. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  11176. }
  11177. else
  11178. {
  11179. context->throwError("Incorrect number of arguments passed to "
  11180. "QTime::setHMS(). This method takes three or "
  11181. "four integer arguments.");
  11182. }
  11183. return retval;
  11184. }
  11185. /*:128*//*129:*/
  11186. #line 3150 "./typica.w"
  11187. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  11188. {
  11189. QScriptValue retval;
  11190. if(context->argumentCount()==1)
  11191. {
  11192. QTime self= getself<QTime> (context);
  11193. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  11194. }
  11195. else
  11196. {
  11197. context->throwError("Incorrect number of arguments passed to "
  11198. "QTime::toString(). This method takes one QString "
  11199. "as an argument.");
  11200. }
  11201. return retval;
  11202. }
  11203. /*:129*//*130:*/
  11204. #line 3171 "./typica.w"
  11205. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  11206. {
  11207. QScriptValue object;
  11208. object= engine->toScriptValue<QTime> (QTime::currentTime());
  11209. setQTimeProperties(object,engine);
  11210. return object;
  11211. }
  11212. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  11213. {
  11214. QScriptValue object;
  11215. if(context->argumentCount()==2)
  11216. {
  11217. QString time= argument<QString> (0,context);
  11218. QString format= argument<QString> (1,context);
  11219. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  11220. setQTimeProperties(object,engine);
  11221. }
  11222. else
  11223. {
  11224. context->throwError("Incorrect number of arguments passed to "
  11225. "QTime::fromString(). This method takes two "
  11226. "string arguments.");
  11227. }
  11228. return object;
  11229. }
  11230. /*:130*//*132:*/
  11231. #line 3211 "./typica.w"
  11232. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  11233. {
  11234. setQFrameProperties(value,engine);
  11235. }
  11236. /*:132*//*134:*/
  11237. #line 3225 "./typica.w"
  11238. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  11239. {
  11240. setQAbstractScrollAreaProperties(value,engine);
  11241. }
  11242. /*:134*//*136:*/
  11243. #line 3239 "./typica.w"
  11244. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  11245. {
  11246. setQAbstractScrollAreaProperties(value,engine);
  11247. }
  11248. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  11249. {
  11250. setQAbstractItemViewProperties(value,engine);
  11251. }
  11252. /*:136*//*139:*/
  11253. #line 3272 "./typica.w"
  11254. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  11255. {
  11256. QScriptValue object= engine->newQObject(new QPushButton());
  11257. setQPushButtonProperties(object,engine);
  11258. return object;
  11259. }
  11260. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  11261. {
  11262. setQAbstractButtonProperties(value,engine);
  11263. }
  11264. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  11265. {
  11266. setQWidgetProperties(value,engine);
  11267. }
  11268. /*:139*//*146:*/
  11269. #line 3384 "./typica.w"
  11270. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  11271. {
  11272. QScriptValue object=
  11273. engine->toScriptValue<void*> (new SqlQueryConnection());
  11274. setQSqlQueryProperties(object,engine);
  11275. return object;
  11276. }
  11277. /*:146*//*147:*/
  11278. #line 3396 "./typica.w"
  11279. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  11280. {
  11281. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  11282. value.setProperty("bindFileData",
  11283. engine->newFunction(QSqlQuery_bindFileData));
  11284. value.setProperty("bindDeviceData",
  11285. engine->newFunction(QSqlQuery_bindDeviceData));
  11286. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  11287. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  11288. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  11289. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  11290. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  11291. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  11292. }
  11293. /*:147*//*148:*/
  11294. #line 3414 "./typica.w"
  11295. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  11296. {
  11297. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11298. QScriptValue retval;
  11299. if(context->argumentCount()==1)
  11300. {
  11301. retval= QScriptValue(engine,
  11302. query->exec(argument<QString> (0,context)));
  11303. }
  11304. else
  11305. {
  11306. retval= QScriptValue(engine,query->exec());
  11307. }
  11308. if(query->lastError().isValid())
  11309. {
  11310. qDebug()<<query->lastQuery();
  11311. qDebug()<<query->lastError().text();
  11312. }
  11313. return retval;
  11314. }
  11315. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  11316. {
  11317. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11318. return QScriptValue(query->lastQuery());
  11319. }
  11320. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  11321. {
  11322. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11323. return QScriptValue(engine,query->next());
  11324. }
  11325. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  11326. {
  11327. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11328. return QScriptValue(engine,
  11329. query->value(argument<int> (0,context)).toString());
  11330. }
  11331. /*:148*//*149:*/
  11332. #line 3458 "./typica.w"
  11333. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  11334. {
  11335. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11336. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  11337. }
  11338. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  11339. {
  11340. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11341. query->bindValue(argument<QString> (0,context),
  11342. argument<QVariant> (1,context));
  11343. return QScriptValue();
  11344. }
  11345. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  11346. QScriptEngine*)
  11347. {
  11348. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11349. QString placeholder= argument<QString> (0,context);
  11350. QString filename= argument<QString> (1,context);
  11351. QFile file(filename);
  11352. QByteArray data;
  11353. if(file.open(QIODevice::ReadOnly))
  11354. {
  11355. data= file.readAll();
  11356. file.close();
  11357. }
  11358. query->bindValue(placeholder,data);
  11359. return QScriptValue();
  11360. }
  11361. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  11362. QScriptEngine*)
  11363. {
  11364. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11365. QString placeholder= argument<QString> (0,context);
  11366. QIODevice*device= argument<QIODevice*> (1,context);
  11367. device->reset();
  11368. QByteArray data;
  11369. data= device->readAll();
  11370. query->bindValue(placeholder,data);
  11371. return QScriptValue();
  11372. }
  11373. /*:149*//*150:*/
  11374. #line 3510 "./typica.w"
  11375. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  11376. {
  11377. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11378. delete query;
  11379. return QScriptValue::UndefinedValue;
  11380. }
  11381. /*:150*//*153:*/
  11382. #line 3551 "./typica.w"
  11383. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  11384. {
  11385. QFileInfo info(argument<QString> (0,context));
  11386. QScriptValue retval(engine,info.baseName());
  11387. return retval;
  11388. }
  11389. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  11390. {
  11391. QFileInfo info(argument<QString> (0,context));
  11392. QDir dir= info.dir();
  11393. QScriptValue retval(engine,dir.path());
  11394. return retval;
  11395. }
  11396. /*:153*//*154:*/
  11397. #line 3570 "./typica.w"
  11398. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  11399. {
  11400. QString source= argument<QString> (0,context);
  11401. source.remove(0,1);
  11402. source.chop(1);
  11403. QStringList elements= source.split(",");
  11404. QString element;
  11405. QScriptValue dest= engine->newArray(elements.size());
  11406. int i= 0;
  11407. foreach(element,elements)
  11408. {
  11409. if(element.startsWith("\"")&&element.endsWith("\""))
  11410. {
  11411. element.chop(1);
  11412. element= element.remove(0,1);
  11413. }
  11414. dest.setProperty(i,QScriptValue(engine,element));
  11415. i++;
  11416. }
  11417. return dest;
  11418. }
  11419. /*:154*//*155:*/
  11420. #line 3596 "./typica.w"
  11421. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  11422. {
  11423. QString font= argument<QString> (0,context);
  11424. QString classname;
  11425. if(context->argumentCount()> 1)
  11426. {
  11427. classname= argument<QString> (1,context);
  11428. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  11429. }
  11430. else
  11431. {
  11432. QApplication::setFont(QFont(font));
  11433. }
  11434. return QScriptValue();
  11435. }
  11436. /*:155*//*156:*/
  11437. #line 3616 "./typica.w"
  11438. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  11439. {
  11440. SqlQueryConnection query;
  11441. QString q= "SELECT file FROM files WHERE id = :file";
  11442. query.prepare(q);
  11443. query.bindValue(":file",argument<int> (0,context));
  11444. query.exec();
  11445. query.next();
  11446. QByteArray array= query.value(0).toByteArray();
  11447. QBuffer buffer(&array);
  11448. buffer.open(QIODevice::ReadOnly);
  11449. QXmlQuery xquery;
  11450. xquery.bindVariable("profile",&buffer);
  11451. QString xq;
  11452. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  11453. xquery.setQuery(xq);
  11454. QString result;
  11455. xquery.evaluateTo(&result);
  11456. return QScriptValue(result);
  11457. }
  11458. /*:156*//*157:*/
  11459. #line 3642 "./typica.w"
  11460. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  11461. {
  11462. QWidget::setTabOrder(argument<QWidget*> (0,context),
  11463. argument<QWidget*> (1,context));
  11464. return QScriptValue();
  11465. }
  11466. /*:157*//*164:*/
  11467. #line 3881 "./typica.w"
  11468. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  11469. {
  11470. QString targetID= argument<QString> (0,context);
  11471. QDomNode element;
  11472. QScriptValue object;
  11473. /*165:*/
  11474. #line 3902 "./typica.w"
  11475. QDomNodeList windows=
  11476. AppInstance->configuration()->documentElement().elementsByTagName("window");
  11477. QDomNode nullNode;
  11478. int i= 0;
  11479. element= nullNode;
  11480. while(i<windows.count())
  11481. {
  11482. element= windows.at(i);
  11483. QDomNamedNodeMap attributes= element.attributes();
  11484. if(attributes.contains("id"))
  11485. {
  11486. if(attributes.namedItem("id").toAttr().value()==targetID)
  11487. {
  11488. break;
  11489. }
  11490. }
  11491. element= nullNode;
  11492. i++;
  11493. }
  11494. /*:165*/
  11495. #line 3887 "./typica.w"
  11496. if(!element.isNull())
  11497. {
  11498. /*166:*/
  11499. #line 3934 "./typica.w"
  11500. ScriptQMainWindow*window= new ScriptQMainWindow;
  11501. window->setObjectName(targetID);
  11502. object= engine->newQObject(window);
  11503. setQMainWindowProperties(object,engine);
  11504. QWidget*central= new(QWidget);
  11505. central->setParent(window);
  11506. central->setObjectName("centralWidget");
  11507. window->setCentralWidget(central);
  11508. if(element.hasChildNodes())
  11509. {
  11510. /*167:*/
  11511. #line 3969 "./typica.w"
  11512. QStack<QWidget*> widgetStack;
  11513. QStack<QLayout*> layoutStack;
  11514. QString windowScript;
  11515. widgetStack.push(central);
  11516. QDomNodeList windowChildren= element.childNodes();
  11517. int i= 0;
  11518. while(i<windowChildren.count())
  11519. {
  11520. QDomNode current;
  11521. QDomElement element;
  11522. current= windowChildren.at(i);
  11523. if(current.isElement())
  11524. {
  11525. element= current.toElement();
  11526. if(element.tagName()=="program")
  11527. {
  11528. windowScript.append(element.text());
  11529. }
  11530. else if(element.tagName()=="layout")
  11531. {
  11532. addLayoutToWidget(element,&widgetStack,&layoutStack);
  11533. }
  11534. else if(element.tagName()=="menu")
  11535. {
  11536. /*168:*/
  11537. #line 4016 "./typica.w"
  11538. QMenuBar*bar= window->menuBar();
  11539. bar->setParent(window);
  11540. bar->setObjectName("menuBar");
  11541. if(element.hasAttribute("name"))
  11542. {
  11543. QMenu*menu= bar->addMenu(element.attribute("name"));
  11544. menu->setParent(bar);
  11545. if(element.hasAttribute("type"))
  11546. {
  11547. if(element.attribute("type")=="reports")
  11548. {
  11549. if(element.hasAttribute("src"))
  11550. {
  11551. /*552:*/
  11552. #line 12833 "./typica.w"
  11553. QSettings settings;
  11554. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  11555. arg(element.attribute("src")));
  11556. directory.setFilter(QDir::Files);
  11557. directory.setSorting(QDir::Name);
  11558. QStringList nameFilter;
  11559. nameFilter<<"*.xml";
  11560. directory.setNameFilters(nameFilter);
  11561. QFileInfoList reportFiles= directory.entryInfoList();
  11562. for(int i= 0;i<reportFiles.size();i++)
  11563. {
  11564. QFileInfo reportFile= reportFiles.at(i);
  11565. /*556:*/
  11566. #line 12910 "./typica.w"
  11567. QString path= reportFile.absoluteFilePath();
  11568. QFile file(path);
  11569. if(file.open(QIODevice::ReadOnly))
  11570. {
  11571. QDomDocument document;
  11572. document.setContent(&file,true);
  11573. QDomElement root= document.documentElement();
  11574. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  11575. if(!titleNode.isNull())
  11576. {
  11577. QDomElement titleElement= titleNode.toElement();
  11578. QString title= titleElement.text();
  11579. if(!title.isEmpty())
  11580. {
  11581. QStringList hierarchy= title.split(":->");
  11582. QMenu*insertionPoint= menu;
  11583. /*557:*/
  11584. #line 12937 "./typica.w"
  11585. for(int j= 0;j<hierarchy.size()-1;j++)
  11586. {
  11587. QObjectList menuList= insertionPoint->children();
  11588. bool menuFound= false;
  11589. for(int k= 0;k<menuList.size();k++)
  11590. {
  11591. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  11592. if(currentItem)
  11593. {
  11594. if(currentItem->title()==hierarchy.at(j))
  11595. {
  11596. menuFound= true;
  11597. insertionPoint= currentItem;
  11598. break;
  11599. }
  11600. }
  11601. }
  11602. if(!menuFound)
  11603. {
  11604. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  11605. }
  11606. }
  11607. /*:557*/
  11608. #line 12927 "./typica.w"
  11609. ReportAction*action= new ReportAction(path,hierarchy.last());
  11610. insertionPoint->addAction(action);
  11611. }
  11612. }
  11613. }
  11614. /*:556*/
  11615. #line 12846 "./typica.w"
  11616. }
  11617. /*:552*/
  11618. #line 4030 "./typica.w"
  11619. }
  11620. }
  11621. }
  11622. if(element.hasChildNodes())
  11623. {
  11624. /*169:*/
  11625. #line 4043 "./typica.w"
  11626. QDomNodeList menuItems= element.childNodes();
  11627. int j= 0;
  11628. while(j<menuItems.count())
  11629. {
  11630. QDomNode item= menuItems.at(j);
  11631. if(item.isElement())
  11632. {
  11633. QDomElement itemElement= item.toElement();
  11634. if(itemElement.tagName()=="item")
  11635. {
  11636. QAction*itemAction= new QAction(itemElement.text(),menu);
  11637. if(itemElement.hasAttribute("id"))
  11638. {
  11639. itemAction->setObjectName(itemElement.attribute("id"));
  11640. }
  11641. if(itemElement.hasAttribute("shortcut"))
  11642. {
  11643. itemAction->setShortcut(itemElement.attribute("shortcut"));
  11644. }
  11645. menu->addAction(itemAction);
  11646. }
  11647. else if(itemElement.tagName()=="separator")
  11648. {
  11649. menu->addSeparator();
  11650. }
  11651. }
  11652. j++;
  11653. }
  11654. #line 1 "./helpmenu.w"
  11655. /*:169*/
  11656. #line 4036 "./typica.w"
  11657. }
  11658. }
  11659. /*:168*/
  11660. #line 3994 "./typica.w"
  11661. }
  11662. }
  11663. i++;
  11664. }
  11665. QScriptValue oldThis= context->thisObject();
  11666. context->setThisObject(object);
  11667. QScriptValue result= engine->evaluate(windowScript);
  11668. /*161:*/
  11669. #line 3783 "./typica.w"
  11670. if(engine->hasUncaughtException())
  11671. {
  11672. int line= engine->uncaughtExceptionLineNumber();
  11673. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  11674. result.toString();
  11675. QString trace;
  11676. foreach(trace,engine->uncaughtExceptionBacktrace())
  11677. {
  11678. qDebug()<<trace;
  11679. }
  11680. }
  11681. /*:161*/
  11682. #line 4002 "./typica.w"
  11683. context->setThisObject(oldThis);
  11684. /*:167*/
  11685. #line 3945 "./typica.w"
  11686. }
  11687. /*170:*/
  11688. #line 9 "./helpmenu.w"
  11689. HelpMenu*helpMenu= new HelpMenu();
  11690. window->menuBar()->addMenu(helpMenu);
  11691. /*:170*/
  11692. #line 3947 "./typica.w"
  11693. window->show();
  11694. /*:166*/
  11695. #line 3890 "./typica.w"
  11696. }
  11697. return object;
  11698. }
  11699. /*:164*//*175:*/
  11700. #line 4085 "./typica.w"
  11701. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  11702. QStack<QLayout*> *layoutStack)
  11703. {
  11704. if(element.hasAttribute("type"))
  11705. {
  11706. /*176:*/
  11707. #line 4106 "./typica.w"
  11708. QLayout*layout;
  11709. QString layoutType= element.attribute("type");
  11710. if(layoutType=="horizontal")
  11711. {
  11712. layout= new QHBoxLayout;
  11713. layoutStack->push(layout);
  11714. populateBoxLayout(element,widgetStack,layoutStack);
  11715. }
  11716. else if(layoutType=="vertical")
  11717. {
  11718. layout= new QVBoxLayout;
  11719. layoutStack->push(layout);
  11720. populateBoxLayout(element,widgetStack,layoutStack);
  11721. }
  11722. else if(layoutType=="grid")
  11723. {
  11724. layout= new QGridLayout;
  11725. layoutStack->push(layout);
  11726. populateGridLayout(element,widgetStack,layoutStack);
  11727. }
  11728. else if(layoutType=="stack")
  11729. {
  11730. layout= new QStackedLayout;
  11731. layoutStack->push(layout);
  11732. populateStackedLayout(element,widgetStack,layoutStack);
  11733. }
  11734. if(element.hasAttribute("id"))
  11735. {
  11736. layout->setObjectName(element.attribute("id"));
  11737. }
  11738. /*:176*/
  11739. #line 4091 "./typica.w"
  11740. QWidget*widget= widgetStack->top();
  11741. if(layout)
  11742. {
  11743. widget->setLayout(layout);
  11744. }
  11745. layoutStack->pop();
  11746. }
  11747. }
  11748. /*:175*//*177:*/
  11749. #line 4144 "./typica.w"
  11750. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11751. QStack<QLayout*> *layoutStack)
  11752. {
  11753. QDomNodeList children= element.childNodes();
  11754. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  11755. for(int i= 0;i<children.count();i++)
  11756. {
  11757. QDomNode current;
  11758. QDomElement currentElement;
  11759. current= children.at(i);
  11760. if(current.isElement())
  11761. {
  11762. currentElement= current.toElement();
  11763. if(currentElement.tagName()=="page")
  11764. {
  11765. QWidget*widget= new QWidget;
  11766. layout->addWidget(widget);
  11767. widgetStack->push(widget);
  11768. populateWidget(currentElement,widgetStack,layoutStack);
  11769. widgetStack->pop();
  11770. }
  11771. }
  11772. }
  11773. }
  11774. /*:177*//*178:*/
  11775. #line 4176 "./typica.w"
  11776. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11777. QStack<QLayout*> *layoutStack)
  11778. {
  11779. QDomNodeList children= element.childNodes();
  11780. int row= -1;
  11781. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  11782. for(int i= 0;i<children.count();i++)
  11783. {
  11784. QDomNode current;
  11785. QDomElement currentElement;
  11786. current= children.at(i);
  11787. if(current.isElement())
  11788. {
  11789. currentElement= current.toElement();
  11790. if(currentElement.tagName()=="row")
  11791. {
  11792. row++;
  11793. if(currentElement.hasAttribute("height"))
  11794. {
  11795. layout->setRowMinimumHeight(row,
  11796. currentElement.attribute("height").toInt());
  11797. }
  11798. if(currentElement.hasAttribute("stretch"))
  11799. {
  11800. layout->setRowStretch(row,
  11801. currentElement.attribute("stretch").toInt());
  11802. }
  11803. /*179:*/
  11804. #line 4232 "./typica.w"
  11805. int column= -1;
  11806. QDomNodeList rowChildren= currentElement.childNodes();
  11807. for(int j= 0;j<rowChildren.count();j++)
  11808. {
  11809. QDomNode columnNode;
  11810. QDomElement columnElement;
  11811. columnNode= rowChildren.at(j);
  11812. if(columnNode.isElement())
  11813. {
  11814. columnElement= columnNode.toElement();
  11815. if(columnElement.tagName()=="column")
  11816. {
  11817. column++;
  11818. if(columnElement.hasAttribute("column"))
  11819. {
  11820. column= columnElement.attribute("column").toInt();
  11821. }
  11822. if(columnElement.hasAttribute("width"))
  11823. {
  11824. layout->setColumnMinimumWidth(column,
  11825. columnElement.attribute("width").toInt());
  11826. }
  11827. if(columnElement.hasAttribute("stretch"))
  11828. {
  11829. layout->setColumnStretch(column,
  11830. columnElement.attribute("stretch").toInt());
  11831. }
  11832. int hspan= 1;
  11833. int vspan= 1;
  11834. if(columnElement.hasAttribute("rowspan"))
  11835. {
  11836. vspan= columnElement.attribute("rowspan").toInt();
  11837. }
  11838. if(columnElement.hasAttribute("colspan"))
  11839. {
  11840. hspan= columnElement.attribute("colspan").toInt();
  11841. }
  11842. QHBoxLayout*cell= new QHBoxLayout;
  11843. layout->addLayout(cell,row,column,vspan,hspan);
  11844. layoutStack->push(cell);
  11845. populateBoxLayout(columnElement,widgetStack,layoutStack);
  11846. layoutStack->pop();
  11847. }
  11848. }
  11849. }
  11850. /*:179*/
  11851. #line 4204 "./typica.w"
  11852. }
  11853. }
  11854. }
  11855. }
  11856. /*:178*//*180:*/
  11857. #line 4282 "./typica.w"
  11858. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11859. QStack<QLayout*> *layoutStack)
  11860. {
  11861. QDomNodeList children= element.childNodes();
  11862. for(int i= 0;i<children.count();i++)
  11863. {
  11864. QDomNode current;
  11865. QDomElement currentElement;
  11866. current= children.at(i);
  11867. if(current.isElement())
  11868. {
  11869. currentElement= current.toElement();
  11870. if(currentElement.tagName()=="button")
  11871. {
  11872. addButtonToLayout(currentElement,widgetStack,layoutStack);
  11873. }
  11874. else if(currentElement.tagName()=="calendar")
  11875. {
  11876. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  11877. }
  11878. else if(currentElement.tagName()=="decoration")
  11879. {
  11880. addDecorationToLayout(currentElement,widgetStack,
  11881. layoutStack);
  11882. }
  11883. else if(currentElement.tagName()=="layout")
  11884. {
  11885. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  11886. }
  11887. else if(currentElement.tagName()=="splitter")
  11888. {
  11889. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  11890. }
  11891. else if(currentElement.tagName()=="label")
  11892. {
  11893. QBoxLayout*layout=
  11894. qobject_cast<QBoxLayout*> (layoutStack->top());
  11895. QLabel*label= new QLabel(currentElement.text());
  11896. layout->addWidget(label);
  11897. }
  11898. else if(currentElement.tagName()=="lcdtemperature")
  11899. {
  11900. addTemperatureDisplayToLayout(currentElement,widgetStack,
  11901. layoutStack);
  11902. }
  11903. else if(currentElement.tagName()=="lcdtimer")
  11904. {
  11905. addTimerDisplayToLayout(currentElement,widgetStack,
  11906. layoutStack);
  11907. }
  11908. else if(currentElement.tagName()=="line")
  11909. {
  11910. addLineToLayout(currentElement,widgetStack,layoutStack);
  11911. }
  11912. else if(currentElement.tagName()=="report")
  11913. {
  11914. addReportToLayout(currentElement,widgetStack,layoutStack);
  11915. }
  11916. else if(currentElement.tagName()=="sqldrop")
  11917. {
  11918. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  11919. }
  11920. else if(currentElement.tagName()=="sqltablearray")
  11921. {
  11922. addSaltToLayout(currentElement,widgetStack,layoutStack);
  11923. }
  11924. else if(currentElement.tagName()=="sqlview")
  11925. {
  11926. addSqlQueryViewToLayout(currentElement,widgetStack,
  11927. layoutStack);
  11928. }
  11929. else if(currentElement.tagName()=="textarea")
  11930. {
  11931. addTextToLayout(currentElement,widgetStack,layoutStack);
  11932. }
  11933. else if(currentElement.tagName()=="spinbox")
  11934. {
  11935. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  11936. }
  11937. else if(currentElement.tagName()=="formarray")
  11938. {
  11939. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  11940. }
  11941. else if(currentElement.tagName()=="hscale")
  11942. {
  11943. addScaleControlToLayout(currentElement,widgetStack,
  11944. layoutStack);
  11945. }
  11946. else if(currentElement.tagName()=="vscale")
  11947. {
  11948. addIntensityControlToLayout(currentElement,widgetStack,
  11949. layoutStack);
  11950. }
  11951. else if(currentElement.tagName()=="webview")
  11952. {
  11953. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  11954. }
  11955. else if(currentElement.tagName()=="stretch")
  11956. {
  11957. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11958. layout->addStretch();
  11959. }
  11960. }
  11961. }
  11962. }
  11963. /*:180*//*181:*/
  11964. #line 4392 "./typica.w"
  11965. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11966. QStack<QLayout*> *layoutStack)
  11967. {
  11968. QLayout*targetLayout= layoutStack->pop();
  11969. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  11970. if(element.hasAttribute("type"))
  11971. {
  11972. /*176:*/
  11973. #line 4106 "./typica.w"
  11974. QLayout*layout;
  11975. QString layoutType= element.attribute("type");
  11976. if(layoutType=="horizontal")
  11977. {
  11978. layout= new QHBoxLayout;
  11979. layoutStack->push(layout);
  11980. populateBoxLayout(element,widgetStack,layoutStack);
  11981. }
  11982. else if(layoutType=="vertical")
  11983. {
  11984. layout= new QVBoxLayout;
  11985. layoutStack->push(layout);
  11986. populateBoxLayout(element,widgetStack,layoutStack);
  11987. }
  11988. else if(layoutType=="grid")
  11989. {
  11990. layout= new QGridLayout;
  11991. layoutStack->push(layout);
  11992. populateGridLayout(element,widgetStack,layoutStack);
  11993. }
  11994. else if(layoutType=="stack")
  11995. {
  11996. layout= new QStackedLayout;
  11997. layoutStack->push(layout);
  11998. populateStackedLayout(element,widgetStack,layoutStack);
  11999. }
  12000. if(element.hasAttribute("id"))
  12001. {
  12002. layout->setObjectName(element.attribute("id"));
  12003. }
  12004. /*:176*/
  12005. #line 4400 "./typica.w"
  12006. boxLayout->addLayout(layout);
  12007. layoutStack->pop();
  12008. }
  12009. layoutStack->push(targetLayout);
  12010. }
  12011. /*:181*//*182:*/
  12012. #line 4411 "./typica.w"
  12013. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  12014. QStack<QLayout*> *layoutStack)
  12015. {
  12016. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12017. QSplitter*splitter= new(QSplitter);
  12018. layout->addWidget(splitter);
  12019. /*183:*/
  12020. #line 4424 "./typica.w"
  12021. QString orientation= element.attribute("type");
  12022. if(orientation=="horizontal")
  12023. {
  12024. splitter->setOrientation(Qt::Horizontal);
  12025. }
  12026. else if(orientation=="vertical")
  12027. {
  12028. splitter->setOrientation(Qt::Vertical);
  12029. }
  12030. QString id= element.attribute("id");
  12031. if(!id.isEmpty())
  12032. {
  12033. splitter->setObjectName(id);
  12034. }
  12035. if(element.hasChildNodes())
  12036. {
  12037. widgetStack->push(splitter);
  12038. populateSplitter(element,widgetStack,layoutStack);
  12039. widgetStack->pop();
  12040. }
  12041. /*:183*/
  12042. #line 4418 "./typica.w"
  12043. }
  12044. /*:182*//*184:*/
  12045. #line 4450 "./typica.w"
  12046. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12047. QStack<QLayout*> *layoutStack)
  12048. {
  12049. QDomNodeList children= element.childNodes();
  12050. for(int i= 0;i<children.count();i++)
  12051. {
  12052. QDomNode current;
  12053. QDomElement currentElement;
  12054. current= children.at(i);
  12055. if(current.isElement())
  12056. {
  12057. currentElement= current.toElement();
  12058. if(currentElement.tagName()=="decoration")
  12059. {
  12060. addDecorationToSplitter(currentElement,widgetStack,
  12061. layoutStack);
  12062. }
  12063. else if(currentElement.tagName()=="graph")
  12064. {
  12065. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  12066. }
  12067. else if(currentElement.tagName()=="splitter")
  12068. {
  12069. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  12070. }
  12071. else if(currentElement.tagName()=="lcdtemperature")
  12072. {
  12073. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  12074. layoutStack);
  12075. }
  12076. else if(currentElement.tagName()=="lcdtimer")
  12077. {
  12078. addTimerDisplayToSplitter(currentElement,widgetStack,
  12079. layoutStack);
  12080. }
  12081. else if(currentElement.tagName()=="measurementtable")
  12082. {
  12083. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  12084. }
  12085. else if(currentElement.tagName()=="widget")
  12086. {
  12087. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  12088. }
  12089. }
  12090. }
  12091. }
  12092. /*:184*//*185:*/
  12093. #line 4500 "./typica.w"
  12094. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12095. QStack<QLayout*> *layoutStack)
  12096. {
  12097. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  12098. QSplitter*splitter= new(QSplitter);
  12099. splitter->setParent(parent);
  12100. parent->addWidget(splitter);
  12101. /*183:*/
  12102. #line 4424 "./typica.w"
  12103. QString orientation= element.attribute("type");
  12104. if(orientation=="horizontal")
  12105. {
  12106. splitter->setOrientation(Qt::Horizontal);
  12107. }
  12108. else if(orientation=="vertical")
  12109. {
  12110. splitter->setOrientation(Qt::Vertical);
  12111. }
  12112. QString id= element.attribute("id");
  12113. if(!id.isEmpty())
  12114. {
  12115. splitter->setObjectName(id);
  12116. }
  12117. if(element.hasChildNodes())
  12118. {
  12119. widgetStack->push(splitter);
  12120. populateSplitter(element,widgetStack,layoutStack);
  12121. widgetStack->pop();
  12122. }
  12123. /*:183*/
  12124. #line 4508 "./typica.w"
  12125. }
  12126. /*:185*//*186:*/
  12127. #line 4517 "./typica.w"
  12128. void addTemperatureDisplayToSplitter(QDomElement element,
  12129. QStack<QWidget*> *widgetStack,
  12130. QStack<QLayout*> *)
  12131. {
  12132. TemperatureDisplay*display= new(TemperatureDisplay);
  12133. if(element.hasAttribute("id"))
  12134. {
  12135. display->setObjectName(element.attribute("id"));
  12136. }
  12137. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12138. splitter->addWidget(display);
  12139. }
  12140. void addTemperatureDisplayToLayout(QDomElement element,
  12141. QStack<QWidget*> *,
  12142. QStack<QLayout*> *layoutStack)
  12143. {
  12144. TemperatureDisplay*display= new(TemperatureDisplay);
  12145. if(element.hasAttribute("id"))
  12146. {
  12147. display->setObjectName(element.attribute("id"));
  12148. }
  12149. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12150. layout->addWidget(display);
  12151. }
  12152. /*:186*//*187:*/
  12153. #line 4548 "./typica.w"
  12154. void addTimerDisplayToSplitter(QDomElement element,
  12155. QStack<QWidget*> *widgetStack,
  12156. QStack<QLayout*> *)
  12157. {
  12158. TimerDisplay*display= new(TimerDisplay);
  12159. if(element.hasAttribute("id"))
  12160. {
  12161. display->setObjectName(element.attribute("id"));
  12162. }
  12163. if(element.hasAttribute("format"))
  12164. {
  12165. display->setDisplayFormat(element.attribute("format"));
  12166. }
  12167. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12168. splitter->addWidget(display);
  12169. }
  12170. void addTimerDisplayToLayout(QDomElement element,
  12171. QStack<QWidget*> *,
  12172. QStack<QLayout*> *layoutStack)
  12173. {
  12174. TimerDisplay*display= new(TimerDisplay);
  12175. if(element.hasAttribute("id"))
  12176. {
  12177. display->setObjectName(element.attribute("id"));
  12178. }
  12179. if(element.hasAttribute("format"))
  12180. {
  12181. display->setDisplayFormat(element.attribute("format"));
  12182. }
  12183. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12184. layout->addWidget(display);
  12185. }
  12186. /*:187*//*188:*/
  12187. #line 4586 "./typica.w"
  12188. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  12189. QStack<QLayout*> *layoutStack)
  12190. {
  12191. /*189:*/
  12192. #line 4607 "./typica.w"
  12193. QString labelText= element.attribute("name");
  12194. Qt::Orientations orientation= Qt::Horizontal;
  12195. if(element.hasAttribute("type"))
  12196. {
  12197. if(element.attribute("type")=="horizontal")
  12198. {
  12199. orientation= Qt::Horizontal;
  12200. }
  12201. else if(element.attribute("type")=="vertical")
  12202. {
  12203. orientation= Qt::Vertical;
  12204. }
  12205. }
  12206. /*190:*/
  12207. #line 4632 "./typica.w"
  12208. QWidget*theWidget= NULL;
  12209. QDomNodeList children= element.childNodes();
  12210. for(int i= 0;i<children.count();i++)
  12211. {
  12212. QDomNode item= children.at(i);
  12213. if(item.isElement())
  12214. {
  12215. QDomElement itemElement= item.toElement();
  12216. if(itemElement.tagName()=="lcdtemperature")
  12217. {
  12218. TemperatureDisplay*display= new TemperatureDisplay;
  12219. if(itemElement.hasAttribute("id"))
  12220. {
  12221. display->setObjectName(itemElement.attribute("id"));
  12222. }
  12223. theWidget= display;
  12224. }
  12225. else if(itemElement.tagName()=="lcdtimer")
  12226. {
  12227. TimerDisplay*display= new TimerDisplay;
  12228. if(itemElement.hasAttribute("id"))
  12229. {
  12230. display->setObjectName(itemElement.attribute("id"));
  12231. }
  12232. if(itemElement.hasAttribute("format"))
  12233. {
  12234. display->setDisplayFormat(itemElement.attribute("format"));
  12235. }
  12236. theWidget= display;
  12237. }
  12238. }
  12239. }
  12240. /*:190*/
  12241. #line 4621 "./typica.w"
  12242. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12243. orientation);
  12244. if(element.hasAttribute("id"))
  12245. {
  12246. decoration->setObjectName(element.attribute("id"));
  12247. }
  12248. /*:189*/
  12249. #line 4590 "./typica.w"
  12250. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12251. layout->addWidget(decoration);
  12252. }
  12253. void addDecorationToSplitter(QDomElement element,
  12254. QStack<QWidget*> *widgetStack,
  12255. QStack<QLayout*> *)
  12256. {
  12257. /*189:*/
  12258. #line 4607 "./typica.w"
  12259. QString labelText= element.attribute("name");
  12260. Qt::Orientations orientation= Qt::Horizontal;
  12261. if(element.hasAttribute("type"))
  12262. {
  12263. if(element.attribute("type")=="horizontal")
  12264. {
  12265. orientation= Qt::Horizontal;
  12266. }
  12267. else if(element.attribute("type")=="vertical")
  12268. {
  12269. orientation= Qt::Vertical;
  12270. }
  12271. }
  12272. /*190:*/
  12273. #line 4632 "./typica.w"
  12274. QWidget*theWidget= NULL;
  12275. QDomNodeList children= element.childNodes();
  12276. for(int i= 0;i<children.count();i++)
  12277. {
  12278. QDomNode item= children.at(i);
  12279. if(item.isElement())
  12280. {
  12281. QDomElement itemElement= item.toElement();
  12282. if(itemElement.tagName()=="lcdtemperature")
  12283. {
  12284. TemperatureDisplay*display= new TemperatureDisplay;
  12285. if(itemElement.hasAttribute("id"))
  12286. {
  12287. display->setObjectName(itemElement.attribute("id"));
  12288. }
  12289. theWidget= display;
  12290. }
  12291. else if(itemElement.tagName()=="lcdtimer")
  12292. {
  12293. TimerDisplay*display= new TimerDisplay;
  12294. if(itemElement.hasAttribute("id"))
  12295. {
  12296. display->setObjectName(itemElement.attribute("id"));
  12297. }
  12298. if(itemElement.hasAttribute("format"))
  12299. {
  12300. display->setDisplayFormat(itemElement.attribute("format"));
  12301. }
  12302. theWidget= display;
  12303. }
  12304. }
  12305. }
  12306. /*:190*/
  12307. #line 4621 "./typica.w"
  12308. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12309. orientation);
  12310. if(element.hasAttribute("id"))
  12311. {
  12312. decoration->setObjectName(element.attribute("id"));
  12313. }
  12314. /*:189*/
  12315. #line 4599 "./typica.w"
  12316. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12317. splitter->addWidget(decoration);
  12318. }
  12319. /*:188*//*191:*/
  12320. #line 4671 "./typica.w"
  12321. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12322. QStack<QLayout*> *layoutStack)
  12323. {
  12324. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12325. QWidget*widget= new QWidget;
  12326. if(element.hasAttribute("id"))
  12327. {
  12328. widget->setObjectName(element.attribute("id"));
  12329. }
  12330. splitter->addWidget(widget);
  12331. if(element.hasChildNodes())
  12332. {
  12333. widgetStack->push(widget);
  12334. populateWidget(element,widgetStack,layoutStack);
  12335. widgetStack->pop();
  12336. }
  12337. }
  12338. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  12339. QStack<QLayout*> *layoutStack)
  12340. {
  12341. QDomNodeList children= element.childNodes();
  12342. for(int i= 0;i<children.count();i++)
  12343. {
  12344. QDomNode current;
  12345. QDomElement currentElement;
  12346. current= children.at(i);
  12347. if(current.isElement())
  12348. {
  12349. currentElement= current.toElement();
  12350. if(currentElement.tagName()=="layout")
  12351. {
  12352. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  12353. }
  12354. }
  12355. }
  12356. }
  12357. /*:191*//*192:*/
  12358. #line 4714 "./typica.w"
  12359. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  12360. QStack<QLayout*> *layoutStack)
  12361. {
  12362. QAbstractButton*button= NULL;
  12363. QString text= element.attribute("name");
  12364. if(element.hasAttribute("type"))
  12365. {
  12366. QString type= element.attribute("type");
  12367. if(type=="annotation")
  12368. {
  12369. AnnotationButton*abutton= new AnnotationButton(text);
  12370. if(element.hasAttribute("annotation"))
  12371. {
  12372. abutton->setAnnotation(element.attribute("annotation"));
  12373. }
  12374. if(element.hasAttribute("series"))
  12375. {
  12376. abutton->setTemperatureColumn(element.attribute("series").
  12377. toInt());
  12378. }
  12379. if(element.hasAttribute("column"))
  12380. {
  12381. abutton->setAnnotationColumn(element.attribute("column").
  12382. toInt());
  12383. }
  12384. button= abutton;
  12385. }
  12386. else if(type=="check")
  12387. {
  12388. button= new QCheckBox(text);
  12389. }
  12390. else if(type=="push")
  12391. {
  12392. button= new QPushButton(text);
  12393. }
  12394. }
  12395. if(element.hasAttribute("id"))
  12396. {
  12397. button->setObjectName(element.attribute("id"));
  12398. }
  12399. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12400. layout->addWidget(button);
  12401. }
  12402. /*:192*//*193:*/
  12403. #line 4766 "./typica.w"
  12404. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  12405. QStack<QLayout*> *layoutStack)
  12406. {
  12407. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  12408. if(element.hasAttribute("pretext"))
  12409. {
  12410. box->setPretext(element.attribute("pretext"));
  12411. }
  12412. if(element.hasAttribute("posttext"))
  12413. {
  12414. box->setPosttext(element.attribute("posttext"));
  12415. }
  12416. if(element.hasAttribute("series"))
  12417. {
  12418. box->setTemperatureColumn(element.attribute("series").toInt());
  12419. }
  12420. if(element.hasAttribute("column"))
  12421. {
  12422. box->setAnnotationColumn(element.attribute("column").toInt());
  12423. }
  12424. if(element.hasAttribute("min"))
  12425. {
  12426. box->setMinimum(element.attribute("min").toDouble());
  12427. }
  12428. if(element.hasAttribute("max"))
  12429. {
  12430. box->setMaximum(element.attribute("max").toDouble());
  12431. }
  12432. if(element.hasAttribute("decimals"))
  12433. {
  12434. box->setDecimals(element.attribute("decimals").toInt());
  12435. }
  12436. if(element.hasAttribute("step"))
  12437. {
  12438. box->setSingleStep(element.attribute("step").toDouble());
  12439. }
  12440. if(element.hasAttribute("id"))
  12441. {
  12442. box->setObjectName(element.attribute("id"));
  12443. }
  12444. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12445. layout->addWidget(box);
  12446. }
  12447. /*:193*//*194:*/
  12448. #line 4822 "./typica.w"
  12449. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12450. QStack<QLayout*> *)
  12451. {
  12452. ZoomLog*widget= new ZoomLog;
  12453. if(!widget)
  12454. {
  12455. qDebug()<<"Error constructing widget!";
  12456. }
  12457. if(element.hasAttribute("id"))
  12458. {
  12459. widget->setObjectName(element.attribute("id"));
  12460. }
  12461. if(element.hasChildNodes())
  12462. {
  12463. QDomNodeList children= element.childNodes();
  12464. int column= 0;
  12465. for(int i= 0;i<children.count();i++)
  12466. {
  12467. QDomNode current;
  12468. QDomElement currentElement;
  12469. current= children.at(i);
  12470. if(current.isElement())
  12471. {
  12472. currentElement= current.toElement();
  12473. if(currentElement.tagName()=="column")
  12474. {
  12475. QString text= currentElement.text();
  12476. widget->setHeaderData(column,text);
  12477. column++;
  12478. }
  12479. }
  12480. }
  12481. }
  12482. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12483. if(splitter)
  12484. {
  12485. splitter->addWidget(widget);
  12486. }
  12487. else
  12488. {
  12489. qDebug()<<"Splitter not found at top of widget stack!";
  12490. }
  12491. }
  12492. /*:194*//*195:*/
  12493. #line 4870 "./typica.w"
  12494. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12495. QStack<QLayout*> *)
  12496. {
  12497. GraphView*view= new GraphView;
  12498. if(element.hasAttribute("id"))
  12499. {
  12500. view->setObjectName(element.attribute("id"));
  12501. }
  12502. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12503. splitter->addWidget(view);
  12504. }
  12505. /*:195*//*196:*/
  12506. #line 4887 "./typica.w"
  12507. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  12508. QStack<QLayout*> *layoutStack)
  12509. {
  12510. SqlComboBox*box= new SqlComboBox();
  12511. if(element.hasAttribute("data"))
  12512. {
  12513. box->setDataColumn(element.attribute("data").toInt());
  12514. }
  12515. if(element.hasAttribute("display"))
  12516. {
  12517. box->setDisplayColumn(element.attribute("display").toInt());
  12518. }
  12519. if(element.hasAttribute("showdata"))
  12520. {
  12521. if(element.attribute("showdata")=="true")
  12522. {
  12523. box->showData(true);
  12524. }
  12525. }
  12526. if(element.hasAttribute("editable"))
  12527. {
  12528. if(element.attribute("editable")=="true")
  12529. {
  12530. box->setEditable(true);
  12531. }
  12532. }
  12533. if(element.hasChildNodes())
  12534. {
  12535. QDomNodeList children= element.childNodes();
  12536. for(int i= 0;i<children.count();i++)
  12537. {
  12538. QDomNode current;
  12539. QDomElement currentElement;
  12540. current= children.at(i);
  12541. if(current.isElement())
  12542. {
  12543. currentElement= current.toElement();
  12544. if(currentElement.tagName()=="null")
  12545. {
  12546. box->addNullOption();
  12547. }
  12548. else if(currentElement.tagName()=="query")
  12549. {
  12550. box->addSqlOptions(currentElement.text());
  12551. }
  12552. }
  12553. }
  12554. }
  12555. if(element.hasAttribute("id"))
  12556. {
  12557. box->setObjectName(element.attribute("id"));
  12558. }
  12559. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12560. layout->addWidget(box);
  12561. }
  12562. /*:196*//*197:*/
  12563. #line 4966 "./typica.w"
  12564. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  12565. QStack<QLayout*> *layoutStack)
  12566. {
  12567. QTableView*view= new QTableView;
  12568. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  12569. SaltModel*model= new SaltModel(element.childNodes().count());
  12570. if(element.hasAttribute("id"))
  12571. {
  12572. view->setObjectName(element.attribute("id"));
  12573. }
  12574. if(element.hasChildNodes())
  12575. {
  12576. QDomNodeList children= element.childNodes();
  12577. int currentColumn= 0;
  12578. for(int i= 0;i<children.count();i++)
  12579. {
  12580. QDomNode current;
  12581. QDomElement currentElement;
  12582. current= children.at(i);
  12583. if(current.isElement())
  12584. {
  12585. currentElement= current.toElement();
  12586. if(currentElement.tagName()=="column")
  12587. {
  12588. if(currentElement.hasAttribute("name"))
  12589. {
  12590. model->setHeaderData(currentColumn,Qt::Horizontal,
  12591. currentElement.attribute("name"));
  12592. }
  12593. if(currentElement.hasAttribute("delegate"))
  12594. {
  12595. /*198:*/
  12596. #line 5014 "./typica.w"
  12597. if(currentElement.attribute("delegate")=="sql")
  12598. {
  12599. /*199:*/
  12600. #line 5030 "./typica.w"
  12601. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  12602. SqlComboBox*widget= new SqlComboBox();
  12603. if(currentElement.hasAttribute("null"))
  12604. {
  12605. if(currentElement.attribute("null")=="true")
  12606. {
  12607. widget->addNullOption();
  12608. }
  12609. }
  12610. if(currentElement.hasAttribute("showdata"))
  12611. {
  12612. if(currentElement.attribute("showdata")=="true")
  12613. {
  12614. widget->showData(true);
  12615. }
  12616. }
  12617. if(currentElement.hasAttribute("data"))
  12618. {
  12619. widget->setDataColumn(currentElement.attribute("data").toInt());
  12620. }
  12621. if(currentElement.hasAttribute("display"))
  12622. {
  12623. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  12624. }
  12625. widget->addSqlOptions(currentElement.text());
  12626. delegate->setWidget(widget);
  12627. view->setItemDelegateForColumn(currentColumn,delegate);
  12628. /*:199*/
  12629. #line 5017 "./typica.w"
  12630. }
  12631. else if(currentElement.attribute("delegate")=="numeric")
  12632. {
  12633. /*200:*/
  12634. #line 5063 "./typica.w"
  12635. NumericDelegate*delegate= new NumericDelegate;
  12636. view->setItemDelegateForColumn(currentColumn,delegate);
  12637. /*:200*/
  12638. #line 5021 "./typica.w"
  12639. }
  12640. /*:198*/
  12641. #line 4998 "./typica.w"
  12642. }
  12643. currentColumn++;
  12644. }
  12645. }
  12646. }
  12647. }
  12648. view->setModel(model);
  12649. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12650. layout->addWidget(view);
  12651. }
  12652. /*:197*//*207:*/
  12653. #line 5173 "./typica.w"
  12654. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  12655. QStack<QLayout*> *layoutStack)
  12656. {
  12657. QLineEdit*widget= new QLineEdit(element.text());
  12658. if(element.hasAttribute("id"))
  12659. {
  12660. widget->setObjectName(element.attribute("id"));
  12661. }
  12662. if(element.hasAttribute("writable"))
  12663. {
  12664. if(element.attribute("writable")=="false")
  12665. {
  12666. widget->setReadOnly(true);
  12667. }
  12668. }
  12669. if(element.hasAttribute("validator"))
  12670. {
  12671. if(element.attribute("validator")=="numeric")
  12672. {
  12673. widget->setValidator(new QDoubleValidator(NULL));
  12674. }
  12675. else if(element.attribute("validator")=="integer")
  12676. {
  12677. widget->setValidator(new QIntValidator(NULL));
  12678. }
  12679. else if(element.attribute("validator")=="expression"&&
  12680. element.hasAttribute("expression"))
  12681. {
  12682. widget->setValidator(new QRegExpValidator(
  12683. QRegExp(element.attribute("expression")),
  12684. NULL));
  12685. }
  12686. }
  12687. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12688. layout->addWidget(widget);
  12689. }
  12690. /*:207*//*208:*/
  12691. #line 5214 "./typica.w"
  12692. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  12693. QStack<QLayout*> *layoutStack)
  12694. {
  12695. QTextEdit*widget= new QTextEdit;
  12696. if(element.hasAttribute("id"))
  12697. {
  12698. widget->setObjectName(element.attribute("id"));
  12699. }
  12700. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12701. layout->addWidget(widget);
  12702. }
  12703. /*:208*//*209:*/
  12704. #line 5231 "./typica.w"
  12705. void addSqlQueryViewToLayout(QDomElement element,
  12706. QStack<QWidget*> *,
  12707. QStack<QLayout*> *layoutStack)
  12708. {
  12709. SqlQueryView*view= new SqlQueryView;
  12710. if(element.hasAttribute("id"))
  12711. {
  12712. view->setObjectName(element.attribute("id"));
  12713. }
  12714. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12715. layout->addWidget(view);
  12716. }
  12717. /*:209*//*210:*/
  12718. #line 5248 "./typica.w"
  12719. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  12720. QStack<QLayout*> *layoutStack)
  12721. {
  12722. QDateEdit*widget= new QDateEdit;
  12723. widget->setCalendarPopup(true);
  12724. if(element.hasAttribute("id"))
  12725. {
  12726. widget->setObjectName(element.attribute("id"));
  12727. }
  12728. widget->setDate(QDate::currentDate());
  12729. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12730. layout->addWidget(widget);
  12731. }
  12732. /*:210*//*211:*/
  12733. #line 5266 "./typica.w"
  12734. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  12735. {
  12736. setQDateTimeEditProperties(value,engine);
  12737. }
  12738. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  12739. {
  12740. setQAbstractSpinBoxProperties(value,engine);
  12741. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  12742. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  12743. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  12744. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  12745. }
  12746. /*:211*//*212:*/
  12747. #line 5286 "./typica.w"
  12748. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  12749. {
  12750. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12751. if(context->argumentCount()==3)
  12752. {
  12753. self->setDate(QDate(argument<int> (0,context),
  12754. argument<int> (1,context),
  12755. argument<int> (2,context)));
  12756. }
  12757. else
  12758. {
  12759. context->throwError("Incorrect number of arguments passed to "
  12760. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  12761. "specifying the year, month, and day.");
  12762. }
  12763. return QScriptValue();
  12764. }
  12765. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  12766. {
  12767. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12768. return QScriptValue(self->date().day());
  12769. }
  12770. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  12771. {
  12772. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12773. return QScriptValue(self->date().month());
  12774. }
  12775. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  12776. {
  12777. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12778. return QScriptValue(self->date().year());
  12779. }
  12780. /*:212*//*216:*/
  12781. #line 5353 "./typica.w"
  12782. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  12783. {
  12784. QObject*parent= argument<QObject*> (0,context);
  12785. QString name= argument<QString> (1,context);
  12786. QObject*object= parent->findChild<QObject*> (name);
  12787. QScriptValue value;
  12788. if(object)
  12789. {
  12790. value= engine->newQObject(object);
  12791. QString className= object->metaObject()->className();
  12792. /*217:*/
  12793. #line 5371 "./typica.w"
  12794. if(className=="TemperatureDisplay")
  12795. {
  12796. setTemperatureDisplayProperties(value,engine);
  12797. }
  12798. else if(className=="TimerDisplay")
  12799. {
  12800. setTimerDisplayProperties(value,engine);
  12801. }
  12802. else if(className=="QAction")
  12803. {
  12804. setQActionProperties(value,engine);
  12805. }
  12806. else if(className=="QBoxLayout")
  12807. {
  12808. setQBoxLayoutProperties(value,engine);
  12809. }
  12810. else if(className=="QDateEdit")
  12811. {
  12812. setQDateEditProperties(value,engine);
  12813. }
  12814. else if(className=="QFrame")
  12815. {
  12816. setQFrameProperties(value,engine);
  12817. }
  12818. else if(className=="QHBoxLayout")
  12819. {
  12820. setQBoxLayoutProperties(value,engine);
  12821. }
  12822. else if(className=="QLCDNumber")
  12823. {
  12824. setQLCDNumberProperties(value,engine);
  12825. }
  12826. else if(className=="QMenu")
  12827. {
  12828. setQMenuProperties(value,engine);
  12829. }
  12830. else if(className=="QMenuBar")
  12831. {
  12832. setQMenuBarProperties(value,engine);
  12833. }
  12834. else if(className=="QPushButton")
  12835. {
  12836. setQPushButtonProperties(value,engine);
  12837. }
  12838. else if(className=="QSplitter")
  12839. {
  12840. setQSplitterProperties(value,engine);
  12841. }
  12842. else if(className=="QTableView")
  12843. {
  12844. if(object->property("tabletype").isValid())
  12845. {
  12846. if(object->property("tabletype").toString()=="SaltTable")
  12847. {
  12848. setSaltTableProperties(value,engine);
  12849. }
  12850. }
  12851. }
  12852. else if(className=="QVBoxLayout")
  12853. {
  12854. setQBoxLayoutProperties(value,engine);
  12855. }
  12856. else if(className=="QWidget")
  12857. {
  12858. setQWidgetProperties(value,engine);
  12859. }
  12860. else if(className=="ScriptQMainWindow")
  12861. {
  12862. setQMainWindowProperties(value,engine);
  12863. }
  12864. else if(className=="SqlComboBox")
  12865. {
  12866. setSqlComboBoxProperties(value,engine);
  12867. }
  12868. else if(className=="SqlQueryView")
  12869. {
  12870. setSqlQueryViewProperties(value,engine);
  12871. }
  12872. else if(className=="ZoomLog")
  12873. {
  12874. setZoomLogProperties(value,engine);
  12875. }
  12876. else if(className=="QTextEdit")
  12877. {
  12878. setQTextEditProperties(value,engine);
  12879. }
  12880. else if(className=="QWebView")
  12881. {
  12882. setQWebViewProperties(value,engine);
  12883. }
  12884. else if(className=="QLineEdit")
  12885. {
  12886. setQLineEditProperties(value,engine);
  12887. }
  12888. /*:217*/
  12889. #line 5364 "./typica.w"
  12890. }
  12891. return value;
  12892. }
  12893. /*:216*//*219:*/
  12894. #line 5493 "./typica.w"
  12895. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  12896. {
  12897. QTableView*self= getself<QTableView*> (context);
  12898. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12899. QString datum;
  12900. double total= 0.0;
  12901. int column= argument<int> (0,context);
  12902. int role= argument<int> (1,context);
  12903. for(int i= 0;i<model->rowCount();i++)
  12904. {
  12905. datum= model->data(model->index(i,column),role).toString();
  12906. if(!datum.isEmpty())
  12907. {
  12908. total+= datum.toDouble();
  12909. }
  12910. }
  12911. return QScriptValue(engine,total);
  12912. }
  12913. /*:219*//*220:*/
  12914. #line 5517 "./typica.w"
  12915. QScriptValue SaltTable_columnArray(QScriptContext*context,
  12916. QScriptEngine*engine)
  12917. {
  12918. QTableView*self= getself<QTableView*> (context);
  12919. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12920. int column= argument<int> (0,context);
  12921. int role= argument<int> (1,context);
  12922. QString literal= model->arrayLiteral(column,role);
  12923. return QScriptValue(engine,literal);
  12924. }
  12925. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  12926. QScriptEngine*engine)
  12927. {
  12928. QTableView*self= getself<QTableView*> (context);
  12929. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12930. int column= argument<int> (0,context);
  12931. int role= argument<int> (1,context);
  12932. QString literal= model->quotedArrayLiteral(column,role);
  12933. return QScriptValue(engine,literal);
  12934. }
  12935. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  12936. QScriptEngine*engine)
  12937. {
  12938. QTableView*self= getself<QTableView*> (context);
  12939. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12940. int column= argument<int> (0,context);
  12941. int role= argument<int> (1,context);
  12942. QString literal= model->arrayLiteral(column,role);
  12943. literal.chop(1);
  12944. literal= literal.remove(0,1);
  12945. return QScriptValue(engine,literal);
  12946. }
  12947. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  12948. QScriptEngine*engine)
  12949. {
  12950. QTableView*self= getself<QTableView*> (context);
  12951. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12952. int column= argument<int> (0,context);
  12953. int role= argument<int> (1,context);
  12954. QString literal= model->quotedArrayLiteral(column,role);
  12955. literal.chop(1);
  12956. literal= literal.remove(0,1);
  12957. return QScriptValue(engine,literal);
  12958. }
  12959. /*:220*//*221:*/
  12960. #line 5569 "./typica.w"
  12961. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  12962. {
  12963. QTableView*self= getself<QTableView*> (context);
  12964. QScriptValue value= engine->newQObject(self->model());
  12965. return value;
  12966. }
  12967. /*:221*//*222:*/
  12968. #line 5583 "./typica.w"
  12969. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  12970. {
  12971. QTableView*self= getself<QTableView*> (context);
  12972. int row= argument<int> (0,context);
  12973. int column= argument<int> (1,context);
  12974. QVariant value= argument<QVariant> (2,context);
  12975. int role= argument<int> (3,context);
  12976. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12977. QModelIndex cell= model->index(row,column);
  12978. model->setData(cell,value,role);
  12979. self->update(cell);
  12980. return QScriptValue();
  12981. }
  12982. /*:222*//*223:*/
  12983. #line 5601 "./typica.w"
  12984. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  12985. {
  12986. QTableView*self= getself<QTableView*> (context);
  12987. int row= argument<int> (0,context);
  12988. int column= argument<int> (1,context);
  12989. int role= argument<int> (2,context);
  12990. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12991. QModelIndex cell= model->index(row,column);
  12992. QVariant value= model->data(cell,role);
  12993. QScriptValue retval= engine->newVariant(value);
  12994. retval.setProperty("value",QScriptValue(value.toString()));
  12995. return retval;
  12996. }
  12997. /*:223*//*224:*/
  12998. #line 5619 "./typica.w"
  12999. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  13000. {
  13001. setQWidgetProperties(value,engine);
  13002. value.setProperty("columnArray",
  13003. engine->newFunction(SaltTable_columnArray));
  13004. value.setProperty("quotedColumnArray",
  13005. engine->newFunction(SaltTable_quotedColumnArray));
  13006. value.setProperty("bindableColumnArray",
  13007. engine->newFunction(SaltTable_bindableColumnArray));
  13008. value.setProperty("bindableQuotedColumnArray",
  13009. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  13010. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  13011. value.setProperty("data",engine->newFunction(SaltTable_data));
  13012. value.setProperty("model",engine->newFunction(SaltTable_model));
  13013. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  13014. }
  13015. /*:224*//*226:*/
  13016. #line 5652 "./typica.w"
  13017. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  13018. {
  13019. setQComboBoxProperties(value,engine);
  13020. }
  13021. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  13022. {
  13023. setQWidgetProperties(value,engine);
  13024. value.setProperty("currentData",
  13025. engine->newFunction(QComboBox_currentData));
  13026. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  13027. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  13028. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  13029. }
  13030. QScriptValue QComboBox_currentData(QScriptContext*context,
  13031. QScriptEngine*engine)
  13032. {
  13033. QComboBox*self= getself<QComboBox*> (context);
  13034. return QScriptValue(engine,
  13035. self->itemData(self->currentIndex()).toString());
  13036. }
  13037. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  13038. {
  13039. QComboBox*self= getself<QComboBox*> (context);
  13040. self->addItem(argument<QString> (0,context));
  13041. return QScriptValue();
  13042. }
  13043. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  13044. {
  13045. QComboBox*self= getself<QComboBox*> (context);
  13046. self->setModel(argument<QAbstractItemModel*> (0,context));
  13047. return QScriptValue();
  13048. }
  13049. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  13050. {
  13051. QComboBox*self= getself<QComboBox*> (context);
  13052. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  13053. }
  13054. #line 1 "./abouttypica.w"
  13055. /*:226*//*259:*/
  13056. #line 6536 "./typica.w"
  13057. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  13058. {
  13059. QScriptValue object;
  13060. if(context->argumentCount()==1)
  13061. {
  13062. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  13063. QScriptEngine::ScriptOwnership);
  13064. setDAQProperties(object,engine);
  13065. }
  13066. else if(context->argumentCount()==2)
  13067. {
  13068. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  13069. argument<QString> (1,context)),
  13070. QScriptEngine::ScriptOwnership);
  13071. setDAQProperties(object,engine);
  13072. }
  13073. else
  13074. {
  13075. context->throwError("Incorrect number of arguments passed to DAQ"
  13076. "constructor. The DAQ constructor takes one"
  13077. "string as an argument specifying a device name."
  13078. "Example: Dev1");
  13079. }
  13080. return object;
  13081. }
  13082. /*:259*//*260:*/
  13083. #line 6566 "./typica.w"
  13084. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  13085. {
  13086. setQObjectProperties(value,engine);
  13087. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  13088. }
  13089. /*:260*//*261:*/
  13090. #line 6576 "./typica.w"
  13091. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  13092. {
  13093. DAQ*self= getself<DAQ*> (context);
  13094. QScriptValue object;
  13095. if(self)
  13096. {
  13097. object=
  13098. engine->newQObject(self->newChannel(argument<int> (0,context),
  13099. argument<int> (1,context)));
  13100. setChannelProperties(object,engine);
  13101. }
  13102. return object;
  13103. }
  13104. /*:261*//*268:*/
  13105. #line 6732 "./typica.w"
  13106. QScriptValue constructFakeDAQ(QScriptContext*context,
  13107. QScriptEngine*engine)
  13108. {
  13109. QScriptValue object;
  13110. if(context->argumentCount()==1)
  13111. {
  13112. object=
  13113. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  13114. QScriptEngine::ScriptOwnership);
  13115. setFakeDAQProperties(object,engine);
  13116. }
  13117. else
  13118. {
  13119. context->throwError("Incorrect number of arguments passed to DAQ"
  13120. "constructor. The DAQ constructor takes one"
  13121. "string as an argument specifying a device name."
  13122. "Example: Dev1");
  13123. }
  13124. return object;
  13125. }
  13126. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  13127. {
  13128. setQObjectProperties(value,engine);
  13129. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  13130. }
  13131. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  13132. {
  13133. FakeDAQ*self= getself<FakeDAQ*> (context);
  13134. QScriptValue object;
  13135. if(self)
  13136. {
  13137. object=
  13138. engine->newQObject(self->newChannel(argument<int> (0,context),
  13139. argument<int> (1,context)));
  13140. setChannelProperties(object,engine);
  13141. }
  13142. return object;
  13143. }
  13144. /*:268*//*272:*/
  13145. #line 6823 "./typica.w"
  13146. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  13147. {
  13148. setQObjectProperties(value,engine);
  13149. }
  13150. /*:272*//*279:*/
  13151. #line 7009 "./typica.w"
  13152. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  13153. {
  13154. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  13155. setLinearCalibratorProperties(object,engine);
  13156. return object;
  13157. }
  13158. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  13159. {
  13160. setQObjectProperties(value,engine);
  13161. }
  13162. /*:279*//*284:*/
  13163. #line 7146 "./typica.w"
  13164. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  13165. {
  13166. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  13167. setLinearSplineInterpolatorProperties(object,engine);
  13168. return object;
  13169. }
  13170. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  13171. {
  13172. setQObjectProperties(value,engine);
  13173. }
  13174. /*:284*//*293:*/
  13175. #line 7330 "./typica.w"
  13176. QScriptValue constructTemperatureDisplay(QScriptContext*,
  13177. QScriptEngine*engine)
  13178. {
  13179. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  13180. setTemperatureDisplayProperties(object,engine);
  13181. return object;
  13182. }
  13183. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13184. {
  13185. setQLCDNumberProperties(value,engine);
  13186. }
  13187. /*:293*//*300:*/
  13188. #line 7471 "./typica.w"
  13189. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  13190. QScriptEngine*engine)
  13191. {
  13192. QScriptValue object=
  13193. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  13194. setMeasurementTimeOffsetProperties(object,engine);
  13195. return object;
  13196. }
  13197. void setMeasurementTimeOffsetProperties(QScriptValue value,
  13198. QScriptEngine*engine)
  13199. {
  13200. setQObjectProperties(value,engine);
  13201. }
  13202. /*:300*//*305:*/
  13203. #line 7580 "./typica.w"
  13204. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  13205. {
  13206. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  13207. return object;
  13208. }
  13209. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  13210. {
  13211. setQObjectProperties(value,engine);
  13212. }
  13213. /*:305*//*310:*/
  13214. #line 7676 "./typica.w"
  13215. QScriptValue constructZeroEmitter(QScriptContext*context,
  13216. QScriptEngine*engine)
  13217. {
  13218. QScriptValue object=
  13219. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  13220. setZeroEmitterProperties(object,engine);
  13221. return object;
  13222. }
  13223. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  13224. {
  13225. setQObjectProperties(value,engine);
  13226. }
  13227. /*:310*//*315:*/
  13228. #line 7756 "./typica.w"
  13229. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  13230. QScriptEngine*engine)
  13231. {
  13232. QScriptValue object=
  13233. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  13234. setMeasurementAdapterProperties(object,engine);
  13235. return object;
  13236. }
  13237. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  13238. {
  13239. setQObjectProperties(value,engine);
  13240. }
  13241. /*:315*//*330:*/
  13242. #line 8104 "./typica.w"
  13243. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  13244. {
  13245. QScriptValue object= engine->newQObject(new GraphView);
  13246. setGraphViewProperties(object,engine);
  13247. return object;
  13248. }
  13249. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  13250. {
  13251. setQGraphicsViewProperties(value,engine);
  13252. }
  13253. /*:330*//*353:*/
  13254. #line 8711 "./typica.w"
  13255. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  13256. {
  13257. QScriptValue object= engine->newQObject(new ZoomLog);
  13258. setZoomLogProperties(object,engine);
  13259. return object;
  13260. }
  13261. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  13262. {
  13263. setQTableViewProperties(value,engine);
  13264. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  13265. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  13266. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  13267. value.setProperty("restoreState",
  13268. engine->newFunction(ZoomLog_restoreState));
  13269. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  13270. value.setProperty("saveTemporary",
  13271. engine->newFunction(ZoomLog_saveTemporary));
  13272. }
  13273. /*:353*//*354:*/
  13274. #line 8737 "./typica.w"
  13275. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  13276. {
  13277. ZoomLog*self= getself<ZoomLog*> (context);
  13278. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  13279. return QScriptValue(engine,retval);
  13280. }
  13281. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  13282. {
  13283. ZoomLog*self= getself<ZoomLog*> (context);
  13284. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  13285. return QScriptValue(engine,retval);
  13286. }
  13287. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  13288. QScriptEngine*engine)
  13289. {
  13290. ZoomLog*self= getself<ZoomLog*> (context);
  13291. QString filename= QDir::tempPath();
  13292. filename.append("/");
  13293. filename.append(QUuid::createUuid().toString());
  13294. filename.append(".xml");
  13295. QFile*file= new QFile(filename);
  13296. self->saveXML(file);
  13297. file->close();
  13298. delete file;
  13299. return QScriptValue(engine,filename);
  13300. }
  13301. /*:354*//*355:*/
  13302. #line 8785 "./typica.w"
  13303. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  13304. {
  13305. ZoomLog*self= getself<ZoomLog*> (context);
  13306. QString key= argument<QString> (0,context);
  13307. int columns= argument<int> (1,context);
  13308. QSettings settings;
  13309. for(int i= 0;i<columns;i++)
  13310. {
  13311. if(self->columnWidth(i))
  13312. {
  13313. settings.beginGroup(key);
  13314. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  13315. settings.endGroup();
  13316. }
  13317. }
  13318. return QScriptValue();
  13319. }
  13320. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  13321. {
  13322. ZoomLog*self= getself<ZoomLog*> (context);
  13323. QString key= argument<QString> (0,context);
  13324. int columns= argument<int> (1,context);
  13325. QSettings settings;
  13326. for(int i= 0;i<columns;i++)
  13327. {
  13328. settings.beginGroup(key);
  13329. self->setColumnWidth(i,
  13330. settings.value(QString("%1").arg(i),80).toInt());
  13331. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  13332. {
  13333. self->setColumnWidth(i,80);
  13334. }
  13335. settings.endGroup();
  13336. }
  13337. return QScriptValue();
  13338. }
  13339. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  13340. {
  13341. ZoomLog*self= getself<ZoomLog*> (context);
  13342. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  13343. }
  13344. /*:355*//*390:*/
  13345. #line 9629 "./typica.w"
  13346. QScriptValue constructAnnotationButton(QScriptContext*context,
  13347. QScriptEngine*engine)
  13348. {
  13349. QScriptValue object=
  13350. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  13351. setAnnotationButtonProperties(object,engine);
  13352. return object;
  13353. }
  13354. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  13355. {
  13356. setQPushButtonProperties(value,engine);
  13357. }
  13358. /*:390*//*398:*/
  13359. #line 9772 "./typica.w"
  13360. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  13361. QScriptEngine*engine)
  13362. {
  13363. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  13364. argument<QString> (0,context),argument<QString> (1,context)));
  13365. setAnnotationSpinBoxProperties(object,engine);
  13366. return object;
  13367. }
  13368. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13369. {
  13370. setQDoubleSpinBoxProperties(value,engine);
  13371. }
  13372. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13373. {
  13374. setQAbstractSpinBoxProperties(value,engine);
  13375. }
  13376. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13377. {
  13378. setQWidgetProperties(value,engine);
  13379. }
  13380. /*:398*//*419:*/
  13381. #line 10191 "./typica.w"
  13382. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  13383. {
  13384. QScriptValue object= engine->newQObject(new TimerDisplay);
  13385. setTimerDisplayProperties(object,engine);
  13386. return object;
  13387. }
  13388. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13389. {
  13390. setQLCDNumberProperties(value,engine);
  13391. }
  13392. /*:419*//*446:*/
  13393. #line 10686 "./typica.w"
  13394. QScriptValue constructWidgetDecorator(QScriptContext*context,
  13395. QScriptEngine*engine)
  13396. {
  13397. QWidget*widget= argument<QWidget*> (0,context);
  13398. QString text= argument<QString> (1,context);
  13399. Qt::Orientations orientation;
  13400. switch(argument<int> (2,context))
  13401. {
  13402. case 2:
  13403. orientation= Qt::Vertical;
  13404. break;
  13405. default:
  13406. orientation= Qt::Horizontal;
  13407. break;
  13408. }
  13409. QScriptValue object=
  13410. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  13411. setWidgetDecoratorProperties(object,engine);
  13412. return object;
  13413. }
  13414. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  13415. {
  13416. setQWidgetProperties(value,engine);
  13417. }
  13418. /*:446*//*459:*/
  13419. #line 10967 "./typica.w"
  13420. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  13421. {
  13422. QScriptValue object= engine->newQObject(new LogEditWindow);
  13423. return object;
  13424. }
  13425. /*:459*//*478:*/
  13426. #line 11441 "./typica.w"
  13427. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  13428. {
  13429. QIODevice*device= argument<QIODevice*> (0,context);
  13430. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  13431. argument<int> (1,context)));
  13432. object.setProperty("input",engine->newFunction(XMLInput_input));
  13433. return object;
  13434. }
  13435. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  13436. {
  13437. XMLInput*self= getself<XMLInput*> (context);
  13438. self->input();
  13439. return QScriptValue();
  13440. }
  13441. /*:478*//*485:*/
  13442. #line 11609 "./typica.w"
  13443. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  13444. {
  13445. QScriptValue object= engine->newQObject(new QWebView());
  13446. setQWebViewProperties(object,engine);
  13447. return object;
  13448. }
  13449. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  13450. {
  13451. setQWidgetProperties(value,engine);
  13452. value.setProperty("load",engine->newFunction(WebView_load));
  13453. value.setProperty("print",engine->newFunction(WebView_print));
  13454. value.setProperty("setHtml",engine->newFunction(WebView_setHtml));
  13455. value.setProperty("setContent",engine->newFunction(WebView_setContent));
  13456. value.setProperty("saveXml",engine->newFunction(WebView_saveXml));
  13457. }
  13458. /*:485*//*486:*/
  13459. #line 11630 "./typica.w"
  13460. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*)
  13461. {
  13462. QWebView*self= getself<QWebView*> (context);
  13463. QString file= argument<QString> (0,context);
  13464. self->load(QUrl(file));
  13465. return QScriptValue();
  13466. }
  13467. /*:486*//*487:*/
  13468. #line 11643 "./typica.w"
  13469. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*)
  13470. {
  13471. QWebView*self= getself<QWebView*> (context);
  13472. QPrinter*printer= new QPrinter(QPrinter::HighResolution);
  13473. QPrintDialog printDialog(printer,NULL);
  13474. if(printDialog.exec()==QDialog::Accepted)
  13475. {
  13476. self->print(printer);
  13477. }
  13478. return QScriptValue();
  13479. }
  13480. /*:487*//*488:*/
  13481. #line 11659 "./typica.w"
  13482. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*)
  13483. {
  13484. QWebView*self= getself<QWebView*> (context);
  13485. QString content= argument<QString> (0,context);
  13486. self->setHtml(content);
  13487. return QScriptValue();
  13488. }
  13489. /*:488*//*489:*/
  13490. #line 11672 "./typica.w"
  13491. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*)
  13492. {
  13493. QWebView*self= getself<QWebView*> (context);
  13494. QIODevice*device= argument<QIODevice*> (0,context);
  13495. device->reset();
  13496. QByteArray content= device->readAll();
  13497. self->setContent(content,"application/xhtml+xml");
  13498. return QScriptValue();
  13499. }
  13500. /*:489*//*490:*/
  13501. #line 11686 "./typica.w"
  13502. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*)
  13503. {
  13504. QWebView*self= getself<QWebView*> (context);
  13505. return QScriptValue(self->page()->currentFrame()->documentElement().toOuterXml());
  13506. }
  13507. /*:490*//*491:*/
  13508. #line 11696 "./typica.w"
  13509. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  13510. QStack<QLayout*> *layoutStack)
  13511. {
  13512. QWebView*view= new QWebView;
  13513. if(element.hasAttribute("id"))
  13514. {
  13515. view->setObjectName(element.attribute("id"));
  13516. }
  13517. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13518. layout->addWidget(view);
  13519. }
  13520. /*:491*//*550:*/
  13521. #line 12759 "./typica.w"
  13522. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  13523. {
  13524. QScriptValue object= engine->newQObject(new SqlQueryView);
  13525. setSqlQueryViewProperties(object,engine);
  13526. return object;
  13527. }
  13528. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  13529. {
  13530. setQTableViewProperties(value,engine);
  13531. value.setProperty("setHeaderData",
  13532. engine->newFunction(SqlQueryView_setHeaderData));
  13533. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  13534. }
  13535. /*:550*//*551:*/
  13536. #line 12777 "./typica.w"
  13537. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  13538. {
  13539. SqlQueryView*self= getself<SqlQueryView*> (context);
  13540. QString query= argument<QString> (0,context);
  13541. self->setQuery(query);
  13542. self->reset();
  13543. return QScriptValue();
  13544. }
  13545. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  13546. QScriptEngine*)
  13547. {
  13548. SqlQueryView*self= getself<SqlQueryView*> (context);
  13549. int section= argument<int> (0,context);
  13550. QString data= argument<QString> (1,context);
  13551. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  13552. return QScriptValue();
  13553. }
  13554. /*:551*//*559:*/
  13555. #line 12976 "./typica.w"
  13556. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  13557. QStack<QLayout*> *layoutStack)
  13558. {
  13559. QTextEdit*widget= new QTextEdit;
  13560. if(element.hasAttribute("id"))
  13561. {
  13562. widget->setObjectName(element.attribute("id"));
  13563. }
  13564. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13565. layout->addWidget(widget);
  13566. QTextDocument*document= new QTextDocument;
  13567. QFont defaultFont;
  13568. defaultFont.setPointSize(11);
  13569. document->setDefaultFont(defaultFont);
  13570. QTextCursor cursor(document);
  13571. /*560:*/
  13572. #line 12999 "./typica.w"
  13573. QDomNodeList children= element.childNodes();
  13574. for(int i= 0;i<children.count();i++)
  13575. {
  13576. QDomNode current;
  13577. QDomElement currentElement;
  13578. current= children.at(i);
  13579. if(current.isElement())
  13580. {
  13581. currentElement= current.toElement();
  13582. /*561:*/
  13583. #line 13016 "./typica.w"
  13584. if(currentElement.tagName()=="style")
  13585. {
  13586. document->setDefaultStyleSheet(currentElement.text());
  13587. }
  13588. /*:561*//*562:*/
  13589. #line 13027 "./typica.w"
  13590. if(currentElement.tagName()=="html")
  13591. {
  13592. cursor.insertHtml(currentElement.text());
  13593. }
  13594. /*:562*//*563:*/
  13595. #line 13037 "./typica.w"
  13596. if(currentElement.tagName()=="text")
  13597. {
  13598. cursor.insertText(currentElement.text());
  13599. }
  13600. /*:563*//*564:*/
  13601. #line 13047 "./typica.w"
  13602. if(currentElement.tagName()=="table")
  13603. {
  13604. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  13605. ReportTable*table= new ReportTable(frame,currentElement);
  13606. table->setParent(widget);
  13607. if(currentElement.hasAttribute("id"))
  13608. {
  13609. table->setObjectName(currentElement.attribute("id"));
  13610. }
  13611. }
  13612. /*:564*/
  13613. #line 13009 "./typica.w"
  13614. }
  13615. }
  13616. /*:560*/
  13617. #line 12992 "./typica.w"
  13618. widget->setDocument(document);
  13619. }
  13620. /*:559*//*575:*/
  13621. #line 13259 "./typica.w"
  13622. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  13623. {
  13624. QTextEdit*self= getself<QTextEdit*> (context);
  13625. QTextDocument*document= self->document();
  13626. QPrinter printer;
  13627. QPrintDialog printwindow(&printer,self);
  13628. if(printwindow.exec()!=QDialog::Accepted)
  13629. {
  13630. return QScriptValue();
  13631. }
  13632. document->print(&printer);
  13633. return QScriptValue();
  13634. }
  13635. /*:575*//*576:*/
  13636. #line 13277 "./typica.w"
  13637. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  13638. {
  13639. setQAbstractScrollAreaProperties(value,engine);
  13640. value.setProperty("print",engine->newFunction(QTextEdit_print));
  13641. }
  13642. /*:576*//*585:*/
  13643. #line 13455 "./typica.w"
  13644. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  13645. QStack<QLayout*> *layoutStack)
  13646. {
  13647. FormArray*widget= new FormArray(element);
  13648. if(element.hasAttribute("id"))
  13649. {
  13650. widget->setObjectName(element.attribute("id"));
  13651. }
  13652. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13653. layout->addWidget(widget);
  13654. }
  13655. /*:585*//*606:*/
  13656. #line 14042 "./typica.w"
  13657. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  13658. QStack<QLayout*> *layoutStack)
  13659. {
  13660. ScaleControl*scale= new ScaleControl;
  13661. if(element.hasAttribute("id"))
  13662. {
  13663. scale->setObjectName(element.attribute("id"));
  13664. }
  13665. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13666. layout->addWidget(scale);
  13667. }
  13668. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  13669. QStack<QLayout*> *layoutStack)
  13670. {
  13671. IntensityControl*scale= new IntensityControl;
  13672. if(element.hasAttribute("id"))
  13673. {
  13674. scale->setObjectName(element.attribute("id"));
  13675. }
  13676. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13677. layout->addWidget(scale);
  13678. }
  13679. /*:606*//*632:*/
  13680. #line 14632 "./typica.w"
  13681. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  13682. {
  13683. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  13684. setDeviceTreeModelProperties(object,engine);
  13685. return object;
  13686. }
  13687. /*:632*//*634:*/
  13688. #line 14655 "./typica.w"
  13689. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  13690. {
  13691. setQAbstractItemModelProperties(value,engine);
  13692. value.setProperty("referenceElement",
  13693. engine->newFunction(DeviceTreeModel_referenceElement));
  13694. }
  13695. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  13696. {
  13697. setQObjectProperties(value,engine);
  13698. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  13699. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  13700. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  13701. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  13702. }
  13703. /*:634*//*635:*/
  13704. #line 14682 "./typica.w"
  13705. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  13706. QScriptEngine*engine)
  13707. {
  13708. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  13709. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  13710. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13711. QDomElement node;
  13712. QVariantMap retval;
  13713. retval.insert("driver",referenceElement.attribute("driver"));
  13714. for(int i= 0;i<configData.size();i++)
  13715. {
  13716. node= configData.at(i).toElement();
  13717. retval.insert(node.attribute("name"),node.attribute("value"));
  13718. }
  13719. return engine->toScriptValue(retval);
  13720. }
  13721. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  13722. {
  13723. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13724. QModelIndex index= argument<QModelIndex> (0,context);
  13725. int role= argument<int> (1,context);
  13726. return engine->toScriptValue(model->data(index,role));
  13727. }
  13728. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  13729. {
  13730. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13731. int row= 0;
  13732. int column= 0;
  13733. QModelIndex index;
  13734. if(context->argumentCount()> 1)
  13735. {
  13736. row= argument<int> (0,context);
  13737. column= argument<int> (1,context);
  13738. }
  13739. if(context->argumentCount()> 2)
  13740. {
  13741. index= argument<QModelIndex> (2,context);
  13742. }
  13743. QModelIndex retval= model->index(row,column,index);
  13744. return engine->toScriptValue(retval);
  13745. }
  13746. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  13747. QScriptEngine*)
  13748. {
  13749. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13750. QModelIndex index;
  13751. if(context->argumentCount()==1)
  13752. {
  13753. index= argument<QModelIndex> (0,context);
  13754. }
  13755. return QScriptValue(model->rowCount(index));
  13756. }
  13757. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  13758. QScriptEngine*engine)
  13759. {
  13760. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13761. QModelIndex index;
  13762. if(context->argumentCount()==1)
  13763. {
  13764. index= argument<QModelIndex> (0,context);
  13765. }
  13766. return QScriptValue(engine,model->hasChildren(index));
  13767. }
  13768. /*:635*//*638:*/
  13769. #line 14766 "./typica.w"
  13770. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  13771. {
  13772. QVariant var;
  13773. var.setValue(index);
  13774. QScriptValue object= engine->newVariant(var);
  13775. return object;
  13776. }
  13777. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  13778. {
  13779. index= value.toVariant().value<QModelIndex> ();
  13780. }
  13781. /*:638*//*654:*/
  13782. #line 15054 "./typica.w"
  13783. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  13784. QScriptEngine*engine)
  13785. {
  13786. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  13787. return object;
  13788. }
  13789. /*:654*//*734:*/
  13790. #line 17567 "./typica.w"
  13791. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  13792. {
  13793. QScriptValue object;
  13794. if(context->argumentCount()==2)
  13795. {
  13796. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  13797. argument<QModelIndex> (1,context)),
  13798. QScriptEngine::ScriptOwnership);
  13799. setModbusRTUDeviceProperties(object,engine);
  13800. }
  13801. else
  13802. {
  13803. context->throwError("Incorrect number of arguments passed to "
  13804. "ModbusRTUDevice constructor. This takes the configuration model "
  13805. "and an index.");
  13806. }
  13807. return object;
  13808. }
  13809. /*:734*//*735:*/
  13810. #line 17589 "./typica.w"
  13811. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  13812. {
  13813. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13814. QScriptValue object;
  13815. if(self)
  13816. {
  13817. if(self->channels.size()> 0)
  13818. {
  13819. object= engine->newQObject(self->channels.at(0));
  13820. setChannelProperties(object,engine);
  13821. }
  13822. }
  13823. return object;
  13824. }
  13825. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  13826. {
  13827. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13828. QScriptValue object;
  13829. if(self)
  13830. {
  13831. if(self->channels.size()> 1)
  13832. {
  13833. object= engine->newQObject(self->channels.at(1));
  13834. setChannelProperties(object,engine);
  13835. }
  13836. }
  13837. return object;
  13838. }
  13839. /*:735*//*736:*/
  13840. #line 17622 "./typica.w"
  13841. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  13842. {
  13843. setQObjectProperties(value,engine);
  13844. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  13845. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  13846. }
  13847. /*:736*/
  13848. #line 764 "./typica.w"
  13849. /*529:*/
  13850. #line 12408 "./typica.w"
  13851. int main(int argc,char**argv)
  13852. {
  13853. int*c= &argc;
  13854. Application app(*c,argv);
  13855. /*530:*/
  13856. #line 12434 "./typica.w"
  13857. QStringList themeSearchPath= QIcon::themeSearchPaths();
  13858. themeSearchPath.append(":/resources/icons/tango");
  13859. QIcon::setThemeSearchPaths(themeSearchPath);
  13860. QIcon::setThemeName(":/resources/icons/tango");
  13861. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  13862. /*:530*/
  13863. #line 12413 "./typica.w"
  13864. /*531:*/
  13865. #line 12444 "./typica.w"
  13866. QFile entypo(":/resources/fonts/entypo.ttf");
  13867. entypo.open(QIODevice::ReadOnly);
  13868. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  13869. entypo.close();
  13870. /*:531*/
  13871. #line 12414 "./typica.w"
  13872. QSettings settings;
  13873. /*664:*/
  13874. #line 15272 "./typica.w"
  13875. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  13876. /*:664*//*674:*/
  13877. #line 15500 "./typica.w"
  13878. app.registerDeviceConfigurationWidget("nidaqmxbase",
  13879. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  13880. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  13881. NiDaqMxBase9211ConfWidget::staticMetaObject);
  13882. app.registerDeviceConfigurationWidget("ni9211seriestc",
  13883. Ni9211TcConfWidget::staticMetaObject);
  13884. /*:674*//*682:*/
  13885. #line 15717 "./typica.w"
  13886. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  13887. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  13888. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  13889. /*:682*//*706:*/
  13890. #line 16678 "./typica.w"
  13891. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  13892. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  13893. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  13894. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  13895. /*:706*//*711:*/
  13896. #line 16763 "./typica.w"
  13897. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  13898. /*:711*//*714:*/
  13899. #line 16833 "./typica.w"
  13900. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  13901. /*:714*//*717:*/
  13902. #line 16960 "./typica.w"
  13903. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  13904. #line 1 "./freeannotation.w"
  13905. /*:717*//*721:*/
  13906. #line 57 "./freeannotation.w"
  13907. app.registerDeviceConfigurationWidget("freeannotation",
  13908. FreeAnnotationConfWidget::staticMetaObject);
  13909. #line 16964 "./typica.w"
  13910. /*:721*//*739:*/
  13911. #line 18135 "./typica.w"
  13912. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  13913. /*:739*//*746:*/
  13914. #line 18265 "./typica.w"
  13915. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  13916. /*:746*//*750:*/
  13917. #line 18354 "./typica.w"
  13918. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  13919. /*:750*/
  13920. #line 12418 "./typica.w"
  13921. /*532:*/
  13922. #line 12456 "./typica.w"
  13923. if(settings.value("database/exists","false").toString()=="true")
  13924. {
  13925. /*537:*/
  13926. #line 12577 "./typica.w"
  13927. QSqlDatabase database=
  13928. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  13929. database.setConnectOptions("application_name=Typica");
  13930. database.setHostName(settings.value("database/hostname").toString());
  13931. database.setDatabaseName(settings.value("database/dbname").toString());
  13932. database.setUserName(settings.value("database/user").toString());
  13933. database.setPassword(settings.value("database/password").toString());
  13934. if(!database.open())
  13935. {
  13936. settings.setValue("database/exists","false");
  13937. }
  13938. /*:537*/
  13939. #line 12459 "./typica.w"
  13940. }
  13941. if(settings.value("database/exists","false").toString()=="false")
  13942. {
  13943. /*536:*/
  13944. #line 12568 "./typica.w"
  13945. SqlConnectionSetup dialog;
  13946. dialog.exec();
  13947. /*:536*/
  13948. #line 12463 "./typica.w"
  13949. }
  13950. /*:532*/
  13951. #line 12419 "./typica.w"
  13952. /*158:*/
  13953. #line 3676 "./typica.w"
  13954. QStringList arguments= QCoreApplication::arguments();
  13955. int position= arguments.indexOf("-c");
  13956. QString filename= QString();
  13957. if(position!=-1)
  13958. {
  13959. if(arguments.size()>=position+1)
  13960. {
  13961. filename= arguments.at(position+1);
  13962. }
  13963. }
  13964. if(filename.isEmpty())
  13965. {
  13966. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  13967. settings.value("config","").toString());
  13968. }
  13969. QDir directory;
  13970. if(!filename.isEmpty())
  13971. {
  13972. QFile file(filename);
  13973. QFileInfo info(filename);
  13974. directory= info.dir();
  13975. settings.setValue("config",directory.path());
  13976. if(file.open(QIODevice::ReadOnly))
  13977. {
  13978. app.configuration()->setContent(&file,true);
  13979. }
  13980. }
  13981. /*159:*/
  13982. #line 3710 "./typica.w"
  13983. QDomElement root= app.configuration()->documentElement();
  13984. QDomNodeList children= root.childNodes();
  13985. QString replacementDoc;
  13986. QDomDocument includedDoc;
  13987. QDomDocumentFragment fragment;
  13988. for(int i= 0;i<children.size();i++)
  13989. {
  13990. QDomNode currentNode= children.at(i);
  13991. QDomElement currentElement;
  13992. if(currentNode.nodeName()=="include")
  13993. {
  13994. currentElement= currentNode.toElement();
  13995. if(currentElement.hasAttribute("src"))
  13996. {
  13997. replacementDoc= directory.path();
  13998. replacementDoc.append('/');
  13999. replacementDoc.append(currentElement.attribute("src"));
  14000. QFile doc(replacementDoc);
  14001. if(doc.open(QIODevice::ReadOnly))
  14002. {
  14003. includedDoc.setContent(&doc,true);
  14004. fragment= includedDoc.createDocumentFragment();
  14005. fragment.appendChild(includedDoc.documentElement());
  14006. root.replaceChild(fragment,currentNode);
  14007. doc.close();
  14008. }
  14009. }
  14010. }
  14011. }
  14012. /*:159*/
  14013. #line 3704 "./typica.w"
  14014. /*:158*/
  14015. #line 12420 "./typica.w"
  14016. /*20:*/
  14017. #line 884 "./typica.w"
  14018. QScriptEngine*engine= new QScriptEngine;
  14019. QScriptValue constructor;
  14020. QScriptValue value;
  14021. /*:20*//*30:*/
  14022. #line 1060 "./typica.w"
  14023. constructor= engine->newFunction(constructQWidget);
  14024. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  14025. engine->globalObject().setProperty("QWidget",value);
  14026. /*:30*//*38:*/
  14027. #line 1260 "./typica.w"
  14028. constructor= engine->newFunction(constructQMainWindow);
  14029. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  14030. constructor);
  14031. engine->globalObject().setProperty("QMainWindow",value);
  14032. /*:38*//*49:*/
  14033. #line 1465 "./typica.w"
  14034. constructor= engine->newFunction(constructQFrame);
  14035. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  14036. engine->globalObject().setProperty("QFrame",value);
  14037. /*:49*//*52:*/
  14038. #line 1498 "./typica.w"
  14039. constructor= engine->newFunction(constructQLabel);
  14040. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  14041. engine->globalObject().setProperty("QLabel",value);
  14042. /*:52*//*55:*/
  14043. #line 1536 "./typica.w"
  14044. constructor= engine->newFunction(constructQLineEdit);
  14045. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  14046. engine->globalObject().setProperty("QLineEdit",value);
  14047. /*:55*//*59:*/
  14048. #line 1581 "./typica.w"
  14049. constructor= engine->newFunction(constructQSplitter);
  14050. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  14051. engine->globalObject().setProperty("QSplitter",value);
  14052. /*:59*//*66:*/
  14053. #line 1752 "./typica.w"
  14054. constructor= engine->newFunction(constructQBoxLayout);
  14055. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  14056. engine->globalObject().setProperty("QBoxLayout",value);
  14057. /*:66*//*70:*/
  14058. #line 1864 "./typica.w"
  14059. constructor= engine->newFunction(constructQAction);
  14060. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  14061. engine->globalObject().setProperty("QAction",value);
  14062. /*:70*//*73:*/
  14063. #line 1923 "./typica.w"
  14064. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  14065. value.setProperty("getOpenFileName",
  14066. engine->newFunction(QFileDialog_getOpenFileName));
  14067. value.setProperty("getSaveFileName",
  14068. engine->newFunction(QFileDialog_getSaveFileName));
  14069. engine->globalObject().setProperty("QFileDialog",value);
  14070. /*:73*//*78:*/
  14071. #line 2035 "./typica.w"
  14072. constructor= engine->newFunction(constructQFile);
  14073. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  14074. engine->globalObject().setProperty("QFile",value);
  14075. /*:78*//*85:*/
  14076. #line 2152 "./typica.w"
  14077. constructor= engine->newFunction(constructQBuffer);
  14078. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  14079. engine->globalObject().setProperty("QBuffer",value);
  14080. /*:85*//*88:*/
  14081. #line 2200 "./typica.w"
  14082. constructor= engine->newFunction(constructXQuery);
  14083. engine->globalObject().setProperty("XQuery",constructor);
  14084. /*:88*//*94:*/
  14085. #line 2294 "./typica.w"
  14086. constructor= engine->newFunction(constructXmlWriter);
  14087. engine->globalObject().setProperty("XmlWriter",constructor);
  14088. /*:94*//*103:*/
  14089. #line 2500 "./typica.w"
  14090. constructor= engine->newFunction(constructXmlReader);
  14091. engine->globalObject().setProperty("XmlReader",constructor);
  14092. /*:103*//*110:*/
  14093. #line 2624 "./typica.w"
  14094. value= engine->newQObject(&settings);
  14095. setQSettingsProperties(value,engine);
  14096. engine->globalObject().setProperty("QSettings",value);
  14097. /*:110*//*114:*/
  14098. #line 2705 "./typica.w"
  14099. constructor= engine->newFunction(constructQLCDNumber);
  14100. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  14101. engine->globalObject().setProperty("QLCDNumber",value);
  14102. /*:114*//*117:*/
  14103. #line 2761 "./typica.w"
  14104. constructor= engine->newFunction(constructQTime);
  14105. engine->globalObject().setProperty("QTime",constructor);
  14106. /*:117*//*138:*/
  14107. #line 3265 "./typica.w"
  14108. constructor= engine->newFunction(constructQPushButton);
  14109. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  14110. engine->globalObject().setProperty("QPushButton",value);
  14111. /*:138*//*145:*/
  14112. #line 3376 "./typica.w"
  14113. constructor= engine->newFunction(constructQSqlQuery);
  14114. engine->globalObject().setProperty("QSqlQuery",constructor);
  14115. /*:145*//*152:*/
  14116. #line 3537 "./typica.w"
  14117. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  14118. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  14119. engine->globalObject().setProperty("sqlToArray",
  14120. engine->newFunction(sqlToArray));
  14121. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  14122. engine->globalObject().setProperty("annotationFromRecord",
  14123. engine->newFunction(annotationFromRecord));
  14124. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  14125. /*:152*//*163:*/
  14126. #line 3873 "./typica.w"
  14127. engine->globalObject().setProperty("createWindow",
  14128. engine->newFunction(createWindow));
  14129. /*:163*//*215:*/
  14130. #line 5345 "./typica.w"
  14131. engine->globalObject().setProperty("findChildObject",
  14132. engine->newFunction(findChildObject));
  14133. /*:215*//*258:*/
  14134. #line 6526 "./typica.w"
  14135. constructor= engine->newFunction(constructDAQ);
  14136. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  14137. engine->globalObject().setProperty("DAQ",value);
  14138. /*:258*//*267:*/
  14139. #line 6724 "./typica.w"
  14140. constructor= engine->newFunction(constructFakeDAQ);
  14141. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  14142. engine->globalObject().setProperty("FakeDAQ",value);
  14143. /*:267*//*278:*/
  14144. #line 7001 "./typica.w"
  14145. constructor= engine->newFunction(constructLinearCalibrator);
  14146. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  14147. constructor);
  14148. engine->globalObject().setProperty("LinearCalibrator",value);
  14149. /*:278*//*283:*/
  14150. #line 7139 "./typica.w"
  14151. constructor= engine->newFunction(constructLinearSplineInterpolator);
  14152. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  14153. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  14154. /*:283*//*292:*/
  14155. #line 7322 "./typica.w"
  14156. constructor= engine->newFunction(constructTemperatureDisplay);
  14157. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  14158. constructor);
  14159. engine->globalObject().setProperty("TemperatureDisplay",value);
  14160. /*:292*//*299:*/
  14161. #line 7460 "./typica.w"
  14162. constructor= engine->newFunction(constructMeasurementTimeOffset);
  14163. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  14164. constructor);
  14165. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  14166. /*:299*//*304:*/
  14167. #line 7571 "./typica.w"
  14168. constructor= engine->newFunction(constructThresholdDetector);
  14169. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  14170. engine->globalObject().setProperty("ThresholdDetector",value);
  14171. /*:304*//*309:*/
  14172. #line 7669 "./typica.w"
  14173. constructor= engine->newFunction(constructZeroEmitter);
  14174. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  14175. engine->globalObject().setProperty("ZeroEmitter",value);
  14176. /*:309*//*314:*/
  14177. #line 7748 "./typica.w"
  14178. constructor= engine->newFunction(constructMeasurementAdapter);
  14179. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  14180. constructor);
  14181. engine->globalObject().setProperty("MeasurementAdapter",value);
  14182. /*:314*//*329:*/
  14183. #line 8097 "./typica.w"
  14184. constructor= engine->newFunction(constructGraphView);
  14185. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  14186. engine->globalObject().setProperty("GraphView",value);
  14187. /*:329*//*352:*/
  14188. #line 8703 "./typica.w"
  14189. constructor= engine->newFunction(constructZoomLog);
  14190. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  14191. engine->globalObject().setProperty("ZoomLog",value);
  14192. /*:352*//*389:*/
  14193. #line 9621 "./typica.w"
  14194. constructor= engine->newFunction(constructAnnotationButton);
  14195. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  14196. constructor);
  14197. engine->globalObject().setProperty("AnnotationButton",value);
  14198. /*:389*//*397:*/
  14199. #line 9763 "./typica.w"
  14200. constructor= engine->newFunction(constructAnnotationSpinBox);
  14201. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  14202. constructor);
  14203. engine->globalObject().setProperty("AnnotationSpinBox",value);
  14204. /*:397*//*418:*/
  14205. #line 10184 "./typica.w"
  14206. constructor= engine->newFunction(constructTimerDisplay);
  14207. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  14208. engine->globalObject().setProperty("TimerDisplay",value);
  14209. /*:418*//*445:*/
  14210. #line 10678 "./typica.w"
  14211. constructor= engine->newFunction(constructWidgetDecorator);
  14212. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  14213. engine->globalObject().setProperty("WidgetDecorator",value);
  14214. /*:445*//*458:*/
  14215. #line 10960 "./typica.w"
  14216. constructor= engine->newFunction(constructLogEditWindow);
  14217. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  14218. engine->globalObject().setProperty("LogEditWindow",value);
  14219. /*:458*//*477:*/
  14220. #line 11434 "./typica.w"
  14221. constructor= engine->newFunction(constructXMLInput);
  14222. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  14223. engine->globalObject().setProperty("XMLInput",value);
  14224. /*:477*//*484:*/
  14225. #line 11601 "./typica.w"
  14226. constructor= engine->newFunction(constructWebView);
  14227. value= engine->newQMetaObject(&QWebView::staticMetaObject,constructor);
  14228. engine->globalObject().setProperty("WebView",value);
  14229. /*:484*//*497:*/
  14230. #line 11793 "./typica.w"
  14231. value= engine->newQObject(AppInstance);
  14232. engine->globalObject().setProperty("Application",value);
  14233. /*:497*//*549:*/
  14234. #line 12751 "./typica.w"
  14235. constructor= engine->newFunction(constructSqlQueryView);
  14236. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  14237. engine->globalObject().setProperty("SqlQueryView",value);
  14238. /*:549*//*633:*/
  14239. #line 14642 "./typica.w"
  14240. constructor= engine->newFunction(constructDeviceTreeModel);
  14241. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  14242. constructor);
  14243. engine->globalObject().setProperty("DeviceTreeModel",value);
  14244. /*:633*//*639:*/
  14245. #line 14782 "./typica.w"
  14246. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  14247. /*:639*//*655:*/
  14248. #line 15064 "./typica.w"
  14249. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  14250. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  14251. constructor);
  14252. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  14253. /*:655*//*733:*/
  14254. #line 17558 "./typica.w"
  14255. constructor= engine->newFunction(constructModbusRTUDevice);
  14256. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  14257. engine->globalObject().setProperty("ModbusRTUDevice",value);
  14258. /*:733*/
  14259. #line 12421 "./typica.w"
  14260. app.engine= engine;
  14261. /*160:*/
  14262. #line 3758 "./typica.w"
  14263. QString styleText;
  14264. QString programText;
  14265. QDomElement currentElement;
  14266. for(int i= 0;i<children.size();i++)
  14267. {
  14268. QDomNode currentNode= children.at(i);
  14269. if(currentNode.nodeName()=="style")
  14270. {
  14271. currentElement= currentNode.toElement();
  14272. styleText.append(currentElement.text());
  14273. }
  14274. else if(currentNode.nodeName()=="program")
  14275. {
  14276. currentElement= currentNode.toElement();
  14277. programText.append(currentElement.text());
  14278. }
  14279. }
  14280. app.setStyleSheet(styleText);
  14281. QScriptValue result= engine->evaluate(programText);
  14282. /*161:*/
  14283. #line 3783 "./typica.w"
  14284. if(engine->hasUncaughtException())
  14285. {
  14286. int line= engine->uncaughtExceptionLineNumber();
  14287. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14288. result.toString();
  14289. QString trace;
  14290. foreach(trace,engine->uncaughtExceptionBacktrace())
  14291. {
  14292. qDebug()<<trace;
  14293. }
  14294. }
  14295. /*:161*/
  14296. #line 3778 "./typica.w"
  14297. /*:160*/
  14298. #line 12423 "./typica.w"
  14299. int retval= app.exec();
  14300. delete engine;
  14301. return retval;
  14302. }
  14303. /*:529*/
  14304. #line 765 "./typica.w"
  14305. #include "moc_typica.cpp"
  14306. /*:16*/