Typica is a free program for professional coffee roasters. https://typica.us
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

typica.cpp 361KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347
  1. #define PROGRAM_NAME "Typica" \
  2. #define FULLTIMETOINT(t) (t.msec() +(t.second() *1000) +(t.minute() *60*1000) ) \
  3. #define TIMETOINT(t) ((t.hour() *60*60) +(t.minute() *60) +(t.second() ) ) \
  4. #define TIMESUBTRACT(t1,t2) (t1.addSecs(-(TIMETOINT(t2) ) ) .addMSecs(-t2.msec() ) ) \
  5. #define AppInstance (qobject_cast<Application*> (qApp) ) \
  6. /*15:*/
  7. #line 753 "./typica.w"
  8. /*17:*/
  9. #line 834 "./typica.w"
  10. #include <QtCore>
  11. #include <QtGui>
  12. #include <QtScript>
  13. #include <QtScriptTools>
  14. #include <QtXml>
  15. #include <QtSql>
  16. #include <QtDebug>
  17. #include <QtXmlPatterns>
  18. #include <QtWebKit>
  19. /*:17*//*18:*/
  20. #line 849 "./typica.w"
  21. #include "helpmenu.h"
  22. /*:18*//*676:*/
  23. #line 15655 "./typica.w"
  24. #include "qextserialport.h"
  25. #include "qextserialenumerator.h"
  26. /*:676*/
  27. #line 754 "./typica.w"
  28. /*32:*/
  29. #line 1140 "./typica.w"
  30. class ScriptQMainWindow:public QMainWindow
  31. {
  32. Q_OBJECT
  33. public:
  34. ScriptQMainWindow();
  35. public slots:
  36. void show();
  37. void saveSizeAndPosition(const QString&key);
  38. void restoreSizeAndPosition(const QString&key);
  39. void displayStatus(const QString&message= QString());
  40. protected:
  41. void closeEvent(QCloseEvent*event);
  42. void showEvent(QShowEvent*event);
  43. signals:
  44. void aboutToClose(void);
  45. };
  46. /*:32*//*135:*/
  47. #line 3259 "./typica.w"
  48. class SqlQueryConnection:public QSqlQuery
  49. {
  50. public:
  51. SqlQueryConnection(const QString&query= QString());
  52. ~SqlQueryConnection();
  53. QSqlQuery*operator->();
  54. private:
  55. QString connection;
  56. QSqlQuery*q;
  57. };
  58. /*:135*//*196:*/
  59. #line 5029 "./typica.w"
  60. class NumericDelegate:public QItemDelegate
  61. {
  62. Q_OBJECT
  63. public:
  64. NumericDelegate(QObject*parent= NULL);
  65. QWidget*createEditor(QWidget*parent,
  66. const QStyleOptionViewItem&option,
  67. const QModelIndex&index)const;
  68. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  69. void setModelData(QWidget*editor,QAbstractItemModel*model,
  70. const QModelIndex&index)const;
  71. void updateEditorGeometry(QWidget*editor,
  72. const QStyleOptionViewItem&option,
  73. const QModelIndex&index)const;
  74. };
  75. /*:196*//*225:*/
  76. #line 5669 "./typica.w"
  77. class Measurement
  78. {
  79. public:
  80. enum TemperatureUnits
  81. {
  82. Fahrenheit= 10144,
  83. Celsius= 10143,
  84. Kelvin= 10325,
  85. Rankine= 10145
  86. };
  87. private:
  88. double theTemperature;
  89. QTime theTime;
  90. TemperatureUnits unit;
  91. public:
  92. Measurement(double temperature= 0,QTime time= QTime(),
  93. TemperatureUnits sc= Fahrenheit);
  94. Measurement(double temperature);
  95. Measurement(const Measurement&x);
  96. Measurement&operator= (Measurement&x);
  97. ~Measurement();
  98. double temperature()const;
  99. QTime time()const;
  100. void setTemperature(double temperature);
  101. void setTime(QTime time);
  102. void setUnit(TemperatureUnits scale);
  103. TemperatureUnits scale();
  104. Measurement toFahrenheit();
  105. Measurement toCelsius();
  106. Measurement toKelvin();
  107. Measurement toRankine();
  108. };
  109. /*:225*//*237:*/
  110. #line 5971 "./typica.w"
  111. class Channel;
  112. class DAQImplementation;
  113. class DAQ:public QObject
  114. {
  115. Q_OBJECT
  116. Q_ENUMS(TemperatureUnits)
  117. Q_ENUMS(ThermocoupleType)
  118. DAQImplementation*imp;
  119. private slots:
  120. void threadFinished();
  121. public:
  122. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  123. ~DAQ();
  124. Channel*newChannel(int units,int thermocouple);
  125. Q_INVOKABLE void setClockRate(double Hz);
  126. Q_INVOKABLE void start();
  127. Q_INVOKABLE void stop();
  128. enum TemperatureUnits
  129. {
  130. Fahrenheit= 10144,
  131. Celsius= 10143,
  132. Kelvin= 10325,
  133. Rankine= 10145
  134. };
  135. enum ThermocoupleType
  136. {
  137. TypeJ= 10072,
  138. TypeK= 10073,
  139. TypeN= 10077,
  140. TypeR= 10082,
  141. TypeS= 10085,
  142. TypeT= 10086,
  143. TypeB= 10047,
  144. TypeE= 10055
  145. };
  146. };
  147. /*:237*//*238:*/
  148. #line 6017 "./typica.w"
  149. class DAQImplementation:public QThread
  150. {
  151. Q_OBJECT
  152. public:
  153. DAQImplementation(const QString&driverinfo);
  154. ~DAQImplementation();
  155. void run();
  156. void measure();
  157. /*239:*/
  158. #line 6037 "./typica.w"
  159. typedef int(*daqfp)(...);
  160. daqfp read;
  161. daqfp errorInfo;
  162. daqfp startTask;
  163. daqfp createTask;
  164. daqfp createChannel;
  165. daqfp setClock;
  166. daqfp stopTask;
  167. daqfp clearTask;
  168. daqfp resetDevice;
  169. daqfp waitForMeasurement;
  170. /*:239*/
  171. #line 6026 "./typica.w"
  172. /*240:*/
  173. #line 6053 "./typica.w"
  174. bool useBase;
  175. QString device;
  176. QVector<Channel*> channelMap;
  177. unsigned int handle;
  178. int error;
  179. int channels;
  180. bool ready;
  181. QLibrary driver;
  182. QVector<Measurement::TemperatureUnits> unitMap;
  183. /*:240*/
  184. #line 6027 "./typica.w"
  185. };
  186. /*:238*//*256:*/
  187. #line 6550 "./typica.w"
  188. class FakeDAQImplementation:public QThread
  189. {
  190. Q_OBJECT
  191. public:
  192. FakeDAQImplementation();
  193. ~FakeDAQImplementation();
  194. void run();
  195. void measure();
  196. QVector<Channel*> channelMap;
  197. int channels;
  198. bool ready;
  199. double clockRate;
  200. };
  201. class FakeDAQ:public QObject
  202. {
  203. Q_OBJECT
  204. FakeDAQImplementation*imp;
  205. public:
  206. FakeDAQ(QString device);
  207. ~FakeDAQ();
  208. Channel*newChannel(int units,int thermocouple);
  209. Q_INVOKABLE void setClockRate(double Hz);
  210. Q_INVOKABLE void start();
  211. };
  212. /*:256*//*263:*/
  213. #line 6737 "./typica.w"
  214. class Channel:public QObject
  215. {
  216. Q_OBJECT
  217. public:
  218. Channel();
  219. ~Channel();
  220. public slots:
  221. void input(Measurement measurement);
  222. signals:
  223. void newData(Measurement);
  224. };
  225. /*:263*//*267:*/
  226. #line 6800 "./typica.w"
  227. class LinearCalibrator:public QObject
  228. {
  229. Q_OBJECT
  230. Q_PROPERTY(double measuredLower READ measuredLower
  231. WRITE setMeasuredLower)
  232. Q_PROPERTY(double measuredUpper READ measuredUpper
  233. WRITE setMeasuredUpper)
  234. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  235. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  236. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  237. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  238. public:
  239. LinearCalibrator(QObject*parent= NULL);
  240. double measuredLower();
  241. double measuredUpper();
  242. double mappedLower();
  243. double mappedUpper();
  244. bool isClosedRange();
  245. double sensitivity();
  246. public slots:
  247. void setMeasuredLower(double lower);
  248. void setMeasuredUpper(double upper);
  249. void setMappedLower(double lower);
  250. void setMappedUpper(double upper);
  251. void setClosedRange(bool closed);
  252. void setSensitivity(double sensitivity);
  253. void newMeasurement(Measurement measure);
  254. signals:
  255. void measurement(Measurement measure);
  256. private:
  257. double Lo1;
  258. double Lo2;
  259. double Up1;
  260. double Up2;
  261. double sensitivitySetting;
  262. bool clamp;
  263. };
  264. /*:267*//*274:*/
  265. #line 6994 "./typica.w"
  266. class LinearSplineInterpolator:public QObject
  267. {
  268. Q_OBJECT
  269. public:
  270. LinearSplineInterpolator(QObject*parent= NULL);
  271. Q_INVOKABLE void add_pair(double source,double destination);
  272. public slots:
  273. void newMeasurement(Measurement measure);
  274. signals:
  275. void newData(Measurement measure);
  276. private:
  277. void make_interpolators();
  278. QMap<double,double> *pairs;
  279. QList<LinearCalibrator*> *interpolators;
  280. };
  281. /*:274*//*279:*/
  282. #line 7129 "./typica.w"
  283. class TemperatureDisplay:public QLCDNumber
  284. {
  285. Q_OBJECT
  286. Q_ENUMS(DisplayUnits)
  287. int unit;
  288. public:
  289. enum DisplayUnits
  290. {
  291. Auto= -1,
  292. Fahrenheit= 10144,
  293. Celsius= 10143,
  294. Kelvin= 10325,
  295. Rankine= 10145
  296. };
  297. TemperatureDisplay(QWidget*parent= NULL);
  298. ~TemperatureDisplay();
  299. public slots:
  300. void setValue(Measurement temperature);
  301. void invalidate();
  302. void setDisplayUnits(DisplayUnits scale);
  303. };
  304. /*:279*//*288:*/
  305. #line 7305 "./typica.w"
  306. class MeasurementTimeOffset:public QObject
  307. {
  308. Q_OBJECT
  309. QTime epoch;
  310. QTime previous;
  311. bool hasPrevious;
  312. public:
  313. MeasurementTimeOffset(QTime zero);
  314. QTime zeroTime();
  315. public slots:
  316. void newMeasurement(Measurement measure);
  317. void setZeroTime(QTime zero);
  318. signals:
  319. void measurement(Measurement measure);
  320. };
  321. /*:288*//*295:*/
  322. #line 7455 "./typica.w"
  323. class ThresholdDetector:public QObject
  324. {
  325. Q_OBJECT
  326. Q_ENUMS(EdgeDirection)
  327. public:
  328. enum EdgeDirection{
  329. Ascending,Descending
  330. };
  331. ThresholdDetector(double value);
  332. public slots:
  333. void newMeasurement(Measurement measure);
  334. void setThreshold(double value);
  335. void setEdgeDirection(EdgeDirection direction);
  336. signals:
  337. void timeForValue(double);
  338. private:
  339. double previousValue;
  340. double threshold;
  341. EdgeDirection currentDirection;
  342. };
  343. /*:295*//*300:*/
  344. #line 7561 "./typica.w"
  345. class ZeroEmitter:public QObject
  346. {
  347. Q_OBJECT
  348. int col;
  349. double temp;
  350. public:
  351. ZeroEmitter(int tempcolumn);
  352. int column();
  353. double lastTemperature();
  354. public slots:
  355. void newMeasurement(Measurement measure);
  356. void setColumn(int column);
  357. void emitZero();
  358. signals:
  359. void measurement(Measurement measure,int tempcolumn);
  360. };
  361. /*:300*//*305:*/
  362. #line 7654 "./typica.w"
  363. class MeasurementAdapter:public QObject
  364. {
  365. Q_OBJECT
  366. int col;
  367. public:
  368. MeasurementAdapter(int tempcolumn);
  369. int column();
  370. public slots:
  371. void newMeasurement(Measurement measure);
  372. void setColumn(int column);
  373. signals:
  374. void measurement(Measurement measure,int tempcolumn);
  375. };
  376. /*:305*//*310:*/
  377. #line 7743 "./typica.w"
  378. class GraphView:public QGraphicsView
  379. {
  380. Q_OBJECT
  381. QGraphicsScene*theScene;
  382. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  383. QMap<int,QPointF> *prevPoints;
  384. QMap<int,double> *translations;
  385. QList<QGraphicsItem*> *gridLinesF;
  386. QList<QGraphicsItem*> *gridLinesC;
  387. public:
  388. GraphView(QWidget*parent= NULL);
  389. void removeSeries(int column);
  390. protected:
  391. void resizeEvent(QResizeEvent*event);
  392. public slots:
  393. void newMeasurement(Measurement measure,int tempcolumn);
  394. void setSeriesTranslation(int column,double offset);
  395. void clear();
  396. void showF();
  397. void showC();
  398. };
  399. /*:310*//*325:*/
  400. #line 8094 "./typica.w"
  401. class MeasurementModel;
  402. class ZoomLog:public QTableView
  403. {
  404. Q_OBJECT
  405. /*326:*/
  406. #line 8142 "./typica.w"
  407. MeasurementModel*model_ms;
  408. MeasurementModel*model_1s;
  409. MeasurementModel*model_5s;
  410. MeasurementModel*model_10s;
  411. MeasurementModel*model_15s;
  412. MeasurementModel*model_30s;
  413. MeasurementModel*model_1m;
  414. QList<MeasurementModel*> modelSet;
  415. QHash<int,Measurement> lastMeasurement;
  416. MeasurementModel*currentModel;
  417. QList<int> saveTempCols;
  418. QList<int> saveNoteCols;
  419. QList<int> currentColumnSet;
  420. /*:326*/
  421. #line 8099 "./typica.w"
  422. void switchLOD(MeasurementModel*m);
  423. private slots:
  424. void centerOn(int row);
  425. void persistColumnResize(int column,int oldsize,int newsize);
  426. void restoreColumnWidths();
  427. public:
  428. ZoomLog();
  429. QVariant data(int row,int column)const;
  430. int rowCount();
  431. bool saveXML(QIODevice*device);
  432. bool saveCSV(QIODevice*device);
  433. QString lastTime(int series);
  434. Q_INVOKABLE int displayUnits();
  435. public slots:
  436. void setVisible(bool visibility);
  437. void setHeaderData(int section,QString text);
  438. void LOD_ms();
  439. void LOD_1s();
  440. void LOD_5s();
  441. void LOD_10s();
  442. void LOD_15s();
  443. void LOD_30s();
  444. void LOD_1m();
  445. void newMeasurement(Measurement measure,int tempcolumn);
  446. void newAnnotation(QString annotation,int tempcolumn,
  447. int annotationcolumn);
  448. void clear();
  449. void addOutputTemperatureColumn(int column);
  450. void addOutputAnnotationColumn(int column);
  451. void clearOutputColumns();
  452. void setDisplayUnits(int scale);
  453. void addToCurrentColumnSet(int column);
  454. void clearCurrentColumnSet();
  455. protected:
  456. virtual void showEvent(QShowEvent*event);
  457. };
  458. /*:325*//*350:*/
  459. #line 8788 "./typica.w"
  460. class MeasurementList;
  461. class MeasurementModel:public QAbstractItemModel
  462. {
  463. Q_OBJECT
  464. Q_ENUMS(DisplayUnits);
  465. int unit;
  466. QList<MeasurementList*> *entries;
  467. QStringList*hData;
  468. int colcount;
  469. QHash<int,int> *lastTemperature;
  470. QList<MeasurementList*> ::iterator lastInsertion;
  471. public:
  472. enum DisplayUnits
  473. {
  474. Auto= -1,
  475. Fahrenheit= 10144,
  476. Celsius= 10143,
  477. Kelvin= 10325,
  478. Rankine= 10145
  479. };
  480. MeasurementModel(QObject*parent= NULL);
  481. ~MeasurementModel();
  482. int rowCount(const QModelIndex&parent= QModelIndex())const;
  483. int columnCount(const QModelIndex&parent= QModelIndex())const;
  484. bool setHeaderData(int section,Qt::Orientation orientation,
  485. const QVariant&value,int role= Qt::DisplayRole);
  486. QVariant data(const QModelIndex&index,int role)const;
  487. bool setData(const QModelIndex&index,const QVariant&value,
  488. int role= Qt::EditRole);
  489. Qt::ItemFlags flags(const QModelIndex&index)const;
  490. QVariant headerData(int section,Qt::Orientation orientation,
  491. int role= Qt::DisplayRole)const;
  492. QModelIndex index(int row,int column,
  493. const QModelIndex&parent= QModelIndex())const;
  494. QModelIndex parent(const QModelIndex&index)const;
  495. int displayUnits();
  496. public slots:
  497. void newMeasurement(Measurement measure,int tempcolumn);
  498. void newAnnotation(QString annotation,int tempcolumn,
  499. int annotationColumn);
  500. void clear();
  501. void setDisplayUnits(int scale);
  502. signals:
  503. void rowChanged(int);
  504. };
  505. /*:350*//*351:*/
  506. #line 8840 "./typica.w"
  507. class MeasurementList:public QVariantList
  508. {
  509. public:
  510. bool operator<(const MeasurementList&other)const;
  511. bool operator==(const MeasurementList&other)const;
  512. };
  513. /*:351*//*377:*/
  514. #line 9477 "./typica.w"
  515. class AnnotationButton:public QPushButton
  516. {
  517. Q_OBJECT
  518. QString note;
  519. int tc;
  520. int ac;
  521. int count;
  522. public:
  523. AnnotationButton(const QString&text,QWidget*parent= NULL);
  524. public slots:
  525. void setAnnotation(const QString&annotation);
  526. void setTemperatureColumn(int tempcolumn);
  527. void setAnnotationColumn(int annotationcolumn);
  528. void annotate();
  529. void resetCount();
  530. signals:
  531. void annotation(QString annotation,int tempcolumn,
  532. int notecolumn);
  533. };
  534. /*:377*//*385:*/
  535. #line 9602 "./typica.w"
  536. class AnnotationSpinBox:public QDoubleSpinBox
  537. {
  538. Q_OBJECT
  539. QString pretext;
  540. QString posttext;
  541. int tc;
  542. int ac;
  543. bool change;
  544. public:
  545. AnnotationSpinBox(const QString&pret,const QString&postt,
  546. QWidget*parent= NULL);
  547. public slots:
  548. void setPretext(const QString&pret);
  549. void setPosttext(const QString&postt);
  550. void setTemperatureColumn(int tempcolumn);
  551. void setAnnotationColumn(int annotationcolumn);
  552. void annotate();
  553. void resetChange();
  554. signals:
  555. void annotation(QString annotation,int tempcolumn,
  556. int notecolumn);
  557. };
  558. /*:385*//*393:*/
  559. #line 9761 "./typica.w"
  560. class TimerDisplay:public QLCDNumber
  561. {
  562. Q_OBJECT
  563. /*394:*/
  564. #line 9811 "./typica.w"
  565. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  566. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  567. Q_PROPERTY(bool running READ isRunning)
  568. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  569. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  570. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  571. /*:394*/
  572. #line 9765 "./typica.w"
  573. private slots:
  574. void updateTime();
  575. void setCountUpMode();
  576. void setCountDownMode();
  577. void setClockMode();
  578. public:
  579. TimerDisplay(QWidget*parent= NULL);
  580. ~TimerDisplay();
  581. enum TimerMode
  582. {
  583. CountUp,
  584. CountDown,
  585. Clock
  586. };
  587. QString value();
  588. QTime seconds();
  589. TimerMode mode();
  590. bool isRunning();
  591. QTime resetValue();
  592. QString displayFormat();
  593. bool autoReset();
  594. public slots:
  595. void setTimer(QTime value= QTime(0,0,0));
  596. void setMode(TimerMode mode);
  597. void startTimer();
  598. void stopTimer();
  599. void copyTimer();
  600. void setResetValue(QTime value= QTime(0,0,0));
  601. void reset();
  602. void setDisplayFormat(QString format);
  603. void setAutoReset(bool reset);
  604. void updateDisplay();
  605. signals:
  606. void valueChanged(QTime);
  607. void runStateChanged(bool);
  608. private:
  609. /*395:*/
  610. #line 9821 "./typica.w"
  611. QTime s;
  612. QTime r;
  613. QTimer clock;
  614. TimerDisplay::TimerMode m;
  615. bool running;
  616. bool ar;
  617. QAction*startAction;
  618. QAction*stopAction;
  619. QAction*resetAction;
  620. QString f;
  621. QTime relative;
  622. QTime base;
  623. /*:395*/
  624. #line 9802 "./typica.w"
  625. };
  626. /*:393*//*415:*/
  627. #line 10180 "./typica.w"
  628. class PackLayout:public QLayout
  629. {
  630. int doLayout(const QRect&rect,bool testOnly)const;
  631. QList<QLayoutItem*> itemList;
  632. Qt::Orientations orientation;
  633. public:
  634. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  635. PackLayout(int spacing= -1);
  636. ~PackLayout();
  637. void addItem(QLayoutItem*item);
  638. Qt::Orientations expandingDirections()const;
  639. bool hasHeightForWidth()const;
  640. int heightForWidth(int width)const;
  641. int count()const;
  642. QLayoutItem*itemAt(int index)const;
  643. QSize minimumSize()const;
  644. void setGeometry(const QRect&rect);
  645. void setOrientation(Qt::Orientations direction);
  646. QSize sizeHint()const;
  647. QLayoutItem*takeAt(int index);
  648. };
  649. /*:415*//*428:*/
  650. #line 10458 "./typica.w"
  651. class SceneButton:public QGraphicsScene
  652. {
  653. Q_OBJECT
  654. public:
  655. SceneButton();
  656. ~SceneButton();
  657. protected:
  658. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  659. signals:
  660. void clicked(QPoint pos);
  661. };
  662. /*:428*//*430:*/
  663. #line 10500 "./typica.w"
  664. class WidgetDecorator:public QWidget
  665. {
  666. Q_OBJECT
  667. PackLayout*layout;
  668. QGraphicsView*label;
  669. QGraphicsTextItem*text;
  670. SceneButton*scene;
  671. public:
  672. WidgetDecorator(QWidget*widget,const QString&labeltext,
  673. Qt::Orientations orientation= Qt::Horizontal,
  674. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  675. ~WidgetDecorator();
  676. void setBackgroundBrush(QBrush background);
  677. void setTextColor(QColor color);
  678. };
  679. /*:430*//*441:*/
  680. #line 10675 "./typica.w"
  681. class LogEditWindow:public QMainWindow
  682. {
  683. Q_OBJECT
  684. QWidget*centralWidget;
  685. PackLayout*mainLayout;
  686. QHBoxLayout*addRowsLayout;
  687. QLabel*startTimeLabel;
  688. QTimeEdit*startTime;
  689. QLabel*endTimeLabel;
  690. QTimeEdit*endTime;
  691. QLabel*intervalLabel;
  692. QSpinBox*interval;
  693. QPushButton*addRows;
  694. QAction*saveXml;
  695. QAction*saveCsv;
  696. QAction*openXml;
  697. MeasurementModel*model;
  698. QTableView*log;
  699. private slots:
  700. void addTheRows();
  701. void saveXML();
  702. void saveCSV();
  703. void openXML();
  704. protected:
  705. void closeEvent(QCloseEvent*event);
  706. public:
  707. LogEditWindow();
  708. };
  709. /*:441*//*455:*/
  710. #line 10983 "./typica.w"
  711. class XMLOutput:public QObject
  712. {
  713. Q_OBJECT
  714. MeasurementModel*data;
  715. QIODevice*out;
  716. int time;
  717. QMap<int,QString> temperatureColumns;
  718. QMap<int,QString> annotationColumns;
  719. public:
  720. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  721. void addTemperatureColumn(const QString&series,int column);
  722. void addAnnotationColumn(const QString&series,int column);
  723. void setModel(MeasurementModel*model);
  724. void setTimeColumn(int column);
  725. void setDevice(QIODevice*device);
  726. bool output();
  727. };
  728. /*:455*//*462:*/
  729. #line 11179 "./typica.w"
  730. class XMLInput:public QObject
  731. {
  732. Q_OBJECT
  733. int firstc;
  734. QIODevice*in;
  735. public:
  736. XMLInput(QIODevice*input,int c);
  737. void setFirstColumn(int column);
  738. void setDevice(QIODevice*device);
  739. bool input();
  740. signals:
  741. void measure(Measurement,int);
  742. void annotation(QString,int,int);
  743. void newTemperatureColumn(int,QString);
  744. void newAnnotationColumn(int,QString);
  745. void lastColumn(int);
  746. };
  747. /*:462*//*473:*/
  748. #line 11420 "./typica.w"
  749. class CSVOutput
  750. {
  751. MeasurementModel*data;
  752. QIODevice*out;
  753. int time;
  754. QMap<int,QString> temperatureColumns;
  755. QMap<int,QString> annotationColumns;
  756. public:
  757. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  758. void addTemperatureColumn(const QString&series,int column);
  759. void addAnnotationColumn(const QString&series,int column);
  760. void setModel(MeasurementModel*model);
  761. void setTimeColumn(int column);
  762. void setDevice(QIODevice*device);
  763. bool output();
  764. };
  765. /*:473*//*487:*/
  766. #line 11681 "./typica.w"
  767. class NodeInserter;
  768. class DeviceTreeModel;
  769. class Application:public QApplication
  770. {
  771. Q_OBJECT
  772. public:
  773. Application(int&argc,char**argv);
  774. QDomDocument*configuration();
  775. /*601:*/
  776. #line 14066 "./typica.w"
  777. QDomDocument deviceConfiguration();
  778. /*:601*//*634:*/
  779. #line 14739 "./typica.w"
  780. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  781. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  782. const QModelIndex&index);
  783. /*:634*//*639:*/
  784. #line 14843 "./typica.w"
  785. QList<NodeInserter*> topLevelNodeInserters;
  786. /*:639*/
  787. #line 11690 "./typica.w"
  788. QSqlDatabase database();
  789. QScriptEngine*engine;
  790. public slots:
  791. /*602:*/
  792. #line 14073 "./typica.w"
  793. void saveDeviceConfiguration();
  794. /*:602*/
  795. #line 11694 "./typica.w"
  796. private:
  797. /*600:*/
  798. #line 14057 "./typica.w"
  799. QDomDocument deviceConfigurationDocument;
  800. /*:600*//*633:*/
  801. #line 14733 "./typica.w"
  802. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  803. /*:633*/
  804. #line 11696 "./typica.w"
  805. QDomDocument conf;
  806. };
  807. /*:487*//*495:*/
  808. #line 11820 "./typica.w"
  809. class SaltModel:public QAbstractItemModel
  810. {
  811. Q_OBJECT
  812. QList<QList<QMap<int,QVariant> > > modelData;
  813. QStringList hData;
  814. int colcount;
  815. public:
  816. SaltModel(int columns);
  817. ~SaltModel();
  818. int rowCount(const QModelIndex&parent= QModelIndex())const;
  819. int columnCount(const QModelIndex&parent= QModelIndex())const;
  820. bool setHeaderData(int section,Qt::Orientation orientation,
  821. const QVariant&value,int role= Qt::DisplayRole);
  822. QVariant data(const QModelIndex&index,int role)const;
  823. bool setData(const QModelIndex&index,const QVariant&value,
  824. int role= Qt::EditRole);
  825. Qt::ItemFlags flags(const QModelIndex&index)const;
  826. QVariant headerData(int section,Qt::Orientation orientation,
  827. int role= Qt::DisplayRole)const;
  828. QModelIndex index(int row,int column,
  829. const QModelIndex&parent= QModelIndex())const;
  830. QModelIndex parent(const QModelIndex&index)const;
  831. QString arrayLiteral(int column,int role)const;
  832. QString quotedArrayLiteral(int column,int role)const;
  833. };
  834. /*:495*//*508:*/
  835. #line 12133 "./typica.w"
  836. class SqlComboBox:public QComboBox
  837. {
  838. Q_OBJECT
  839. int dataColumn;
  840. int displayColumn;
  841. bool dataColumnShown;
  842. public:
  843. SqlComboBox();
  844. ~SqlComboBox();
  845. SqlComboBox*clone(QWidget*parent);
  846. public slots:
  847. void addNullOption();
  848. void addSqlOptions(QString query);
  849. void setDataColumn(int column);
  850. void setDisplayColumn(int column);
  851. void showData(bool show);
  852. };
  853. /*:508*//*515:*/
  854. #line 12255 "./typica.w"
  855. class SqlComboBoxDelegate:public QItemDelegate
  856. {
  857. Q_OBJECT
  858. SqlComboBox*delegate;
  859. public:
  860. SqlComboBoxDelegate(QObject*parent= NULL);
  861. QWidget*createEditor(QWidget*parent,
  862. const QStyleOptionViewItem&option,
  863. const QModelIndex&index)const;
  864. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  865. void setModelData(QWidget*editor,QAbstractItemModel*model,
  866. const QModelIndex&index)const;
  867. void setWidget(SqlComboBox*widget);
  868. virtual QSize sizeHint()const;
  869. void updateEditorGeometry(QWidget*editor,
  870. const QStyleOptionViewItem&option,
  871. const QModelIndex&index)const;
  872. };
  873. /*:515*//*526:*/
  874. #line 12414 "./typica.w"
  875. class SqlConnectionSetup:public QDialog
  876. {
  877. Q_OBJECT
  878. public:
  879. SqlConnectionSetup();
  880. ~SqlConnectionSetup();
  881. public slots:
  882. void testConnection();
  883. private:
  884. QFormLayout*formLayout;
  885. QComboBox*driver;
  886. QLineEdit*hostname;
  887. QLineEdit*dbname;
  888. QLineEdit*user;
  889. QLineEdit*password;
  890. QVBoxLayout*layout;
  891. QHBoxLayout*buttons;
  892. QPushButton*cancelButton;
  893. QPushButton*connectButton;
  894. };
  895. /*:526*//*531:*/
  896. #line 12542 "./typica.w"
  897. class SqlQueryView:public QTableView
  898. {
  899. Q_OBJECT
  900. public:
  901. SqlQueryView(QWidget*parent= NULL);
  902. void setQuery(const QString&query);
  903. bool setHeaderData(int section,Qt::Orientation orientation,
  904. const QVariant&value,int role);
  905. Q_INVOKABLE QVariant data(int row,int column,
  906. int role= Qt::DisplayRole);
  907. signals:
  908. void openEntry(QString key);
  909. void openEntryRow(int row);
  910. protected:
  911. virtual void showEvent(QShowEvent*event);
  912. private slots:
  913. void openRow(const QModelIndex&index);
  914. void persistColumnResize(int column,int oldsize,int newsize);
  915. };
  916. /*:531*//*546:*/
  917. #line 12790 "./typica.w"
  918. class ReportAction:public QAction
  919. {
  920. Q_OBJECT
  921. public:
  922. ReportAction(const QString&fileName,const QString&reportName,
  923. QObject*parent= NULL);
  924. private slots:
  925. void createReport();
  926. private:
  927. QString reportFile;
  928. };
  929. /*:546*//*558:*/
  930. #line 12999 "./typica.w"
  931. class ReportTable:public QObject
  932. {
  933. Q_OBJECT
  934. QTextFrame*area;
  935. QDomElement configuration;
  936. QMap<QString,QVariant> bindings;
  937. public:
  938. ReportTable(QTextFrame*frame,QDomElement description);
  939. ~ReportTable();
  940. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  941. public slots:
  942. void refresh();
  943. };
  944. /*:558*//*570:*/
  945. #line 13235 "./typica.w"
  946. class FormArray:public QScrollArea
  947. {
  948. Q_OBJECT
  949. QDomElement configuration;
  950. QWidget itemContainer;
  951. QVBoxLayout itemLayout;
  952. int maxwidth;
  953. int maxheight;
  954. public:
  955. FormArray(QDomElement description);
  956. Q_INVOKABLE QWidget*elementAt(int index);
  957. Q_INVOKABLE int elements();
  958. public slots:
  959. void addElements(int copies= 1);
  960. void removeAllElements();
  961. void setMaximumElementWidth(int width);
  962. void setMaximumElementHeight(int height);
  963. };
  964. /*:570*//*580:*/
  965. #line 13451 "./typica.w"
  966. class ScaleControl:public QGraphicsView
  967. {
  968. Q_OBJECT
  969. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  970. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  971. /*581:*/
  972. #line 13477 "./typica.w"
  973. QGraphicsScene scene;
  974. QGraphicsPolygonItem initialDecrement;
  975. QGraphicsPolygonItem initialIncrement;
  976. QGraphicsPolygonItem finalDecrement;
  977. QGraphicsPolygonItem finalIncrement;
  978. QGraphicsPolygonItem initialIndicator;
  979. QGraphicsPolygonItem finalIndicator;
  980. QGraphicsPathItem scaleLine;
  981. QPolygonF left;
  982. QPolygonF right;
  983. QPolygonF down;
  984. QPolygonF up;
  985. QPainterPath scalePath;
  986. QBrush initialBrush;
  987. QBrush finalBrush;
  988. double nonScoredValue;
  989. double scoredValue;
  990. bool initialSet;
  991. bool finalSet;
  992. bool scaleDown;
  993. /*:581*/
  994. #line 13457 "./typica.w"
  995. public:
  996. ScaleControl();
  997. double initialValue(void);
  998. double finalValue(void);
  999. virtual QSize sizeHint()const;
  1000. public slots:
  1001. void setInitialValue(double value);
  1002. void setFinalValue(double value);
  1003. signals:
  1004. void initialChanged(double);
  1005. void finalChanged(double);
  1006. protected:
  1007. virtual void mousePressEvent(QMouseEvent*event);
  1008. virtual void mouseReleaseEvent(QMouseEvent*event);
  1009. };
  1010. /*:580*//*592:*/
  1011. #line 13774 "./typica.w"
  1012. class IntensityControl:public QGraphicsView
  1013. {
  1014. Q_OBJECT
  1015. Q_PROPERTY(double value READ value WRITE setValue)
  1016. QGraphicsScene scene;
  1017. QGraphicsPolygonItem decrement;
  1018. QGraphicsPolygonItem increment;
  1019. QGraphicsPolygonItem indicator;
  1020. QGraphicsPathItem scaleLine;
  1021. QPolygonF left;
  1022. QPolygonF up;
  1023. QPolygonF down;
  1024. QPainterPath scalePath;
  1025. QBrush theBrush;
  1026. double theValue;
  1027. bool valueSet;
  1028. bool scaleDown;
  1029. public:
  1030. IntensityControl();
  1031. double value();
  1032. virtual QSize sizeHint()const;
  1033. public slots:
  1034. void setValue(double val);
  1035. signals:
  1036. void valueChanged(double);
  1037. protected:
  1038. virtual void mousePressEvent(QMouseEvent*event);
  1039. virtual void mouseReleaseEvent(QMouseEvent*event);
  1040. };
  1041. /*:592*//*608:*/
  1042. #line 14162 "./typica.w"
  1043. class DeviceTreeModelNode
  1044. {
  1045. public:
  1046. DeviceTreeModelNode(QDomNode&node,int row,
  1047. DeviceTreeModelNode*parent= NULL);
  1048. ~DeviceTreeModelNode();
  1049. DeviceTreeModelNode*child(int index);
  1050. DeviceTreeModelNode*parent();
  1051. QDomNode node()const;
  1052. int row();
  1053. private:
  1054. QDomNode domNode;
  1055. QHash<int,DeviceTreeModelNode*> children;
  1056. int rowNumber;
  1057. DeviceTreeModelNode*parentItem;
  1058. };
  1059. /*:608*//*610:*/
  1060. #line 14237 "./typica.w"
  1061. class DeviceTreeModel:public QAbstractItemModel
  1062. {
  1063. Q_OBJECT
  1064. public:
  1065. DeviceTreeModel(QObject*parent= NULL);
  1066. ~DeviceTreeModel();
  1067. QVariant data(const QModelIndex&index,int role)const;
  1068. Qt::ItemFlags flags(const QModelIndex&index)const;
  1069. QVariant headerData(int section,Qt::Orientation orientation,
  1070. int role= Qt::DisplayRole)const;
  1071. QModelIndex index(int row,int column,
  1072. const QModelIndex&parent= QModelIndex())const;
  1073. QModelIndex parent(const QModelIndex&child)const;
  1074. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1075. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1076. bool setData(const QModelIndex&index,const QVariant&value,
  1077. int role);
  1078. bool removeRows(int row,int count,const QModelIndex&parent);
  1079. QDomElement referenceElement(const QString&id);
  1080. public slots:
  1081. void newNode(const QString&name,const QString&driver,
  1082. const QModelIndex&parent);
  1083. private:
  1084. QDomDocument document;
  1085. DeviceTreeModelNode*root;
  1086. QDomNode referenceSection;
  1087. QDomNode treeRoot;
  1088. };
  1089. /*:610*//*629:*/
  1090. #line 14691 "./typica.w"
  1091. Q_DECLARE_METATYPE(QModelIndex)
  1092. /*:629*//*637:*/
  1093. #line 14798 "./typica.w"
  1094. class NodeInserter:public QAction
  1095. {
  1096. Q_OBJECT
  1097. public:
  1098. NodeInserter(const QString&title,const QString&name,
  1099. const QString&driver,QObject*parent= NULL);
  1100. signals:
  1101. void triggered(QString name,QString driver);
  1102. private slots:
  1103. void onTriggered();
  1104. private:
  1105. QString defaultNodeName;
  1106. QString driverString;
  1107. };
  1108. /*:637*//*640:*/
  1109. #line 14849 "./typica.w"
  1110. class DeviceConfigurationWindow:public QMainWindow
  1111. {
  1112. Q_OBJECT
  1113. public:
  1114. DeviceConfigurationWindow();
  1115. public slots:
  1116. void addDevice();
  1117. void removeNode();
  1118. void newSelection(const QModelIndex&index);
  1119. private:
  1120. QDomDocument document;
  1121. DeviceTreeModel*model;
  1122. QTreeView*view;
  1123. QScrollArea*configArea;
  1124. };
  1125. /*:640*//*648:*/
  1126. #line 14993 "./typica.w"
  1127. class BasicDeviceConfigurationWidget:public QWidget
  1128. {
  1129. Q_OBJECT
  1130. public:
  1131. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1132. const QModelIndex&index);
  1133. public slots:
  1134. void insertChildNode(const QString&name,const QString&driver);
  1135. void updateAttribute(const QString&name,const QString&value);
  1136. protected:
  1137. DeviceTreeModel*deviceModel;
  1138. QModelIndex currentNode;
  1139. };
  1140. /*:648*//*652:*/
  1141. #line 15078 "./typica.w"
  1142. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1143. {
  1144. Q_OBJECT
  1145. public:
  1146. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1147. const QModelIndex&index);
  1148. private slots:
  1149. void updateRoasterId(int id);
  1150. };
  1151. /*:652*//*657:*/
  1152. #line 15205 "./typica.w"
  1153. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1154. {
  1155. Q_OBJECT
  1156. public:
  1157. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1158. const QModelIndex&index);
  1159. };
  1160. /*:657*//*659:*/
  1161. #line 15251 "./typica.w"
  1162. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1163. {
  1164. Q_OBJECT
  1165. public:
  1166. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1167. const QModelIndex&index);
  1168. private slots:
  1169. void addChannel();
  1170. void updateDeviceId(const QString&newId);
  1171. };
  1172. /*:659*//*663:*/
  1173. #line 15337 "./typica.w"
  1174. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1175. {
  1176. Q_OBJECT
  1177. public:
  1178. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1179. const QModelIndex&index);
  1180. private slots:
  1181. void updateThermocoupleType(const QString&type);
  1182. void updateColumnName(const QString&name);
  1183. };
  1184. /*:663*//*668:*/
  1185. #line 15439 "./typica.w"
  1186. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1187. {
  1188. Q_OBJECT
  1189. public:
  1190. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1191. const QModelIndex&index);
  1192. };
  1193. /*:668*//*670:*/
  1194. #line 15480 "./typica.w"
  1195. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1196. {
  1197. Q_OBJECT
  1198. public:
  1199. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1200. const QModelIndex&index);
  1201. private slots:
  1202. void addChannel();
  1203. void updateDeviceId(const QString&newId);
  1204. };
  1205. /*:670*//*672:*/
  1206. #line 15549 "./typica.w"
  1207. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1208. {
  1209. Q_OBJECT
  1210. public:
  1211. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1212. const QModelIndex&index);
  1213. private slots:
  1214. void updateDeviceId(const QString&newId);
  1215. void updateThermocoupleType(const QString&type);
  1216. void updateColumnName(const QString&name);
  1217. };
  1218. /*:672*//*677:*/
  1219. #line 15666 "./typica.w"
  1220. class PortSelector:public QComboBox
  1221. {
  1222. Q_OBJECT
  1223. public:
  1224. PortSelector(QWidget*parent= NULL);
  1225. private slots:
  1226. void addDevice(QextPortInfo port);
  1227. private:
  1228. QextSerialEnumerator*lister;
  1229. };
  1230. /*:677*//*679:*/
  1231. #line 15710 "./typica.w"
  1232. class BaudSelector:public QComboBox
  1233. {
  1234. Q_OBJECT
  1235. Q_ENUMS(BaudRateType)
  1236. public:
  1237. BaudSelector(QWidget*parent= NULL);
  1238. enum BaudRateType
  1239. {
  1240. #if defined(Q_OS_UNIX) || defined(qdoc)
  1241. BAUD50= 50,
  1242. BAUD75= 75,
  1243. BAUD134= 134,
  1244. BAUD150= 150,
  1245. BAUD200= 200,
  1246. BAUD1800= 1800,
  1247. #if defined(B76800) || defined(qdoc)
  1248. BAUD76800= 76800,
  1249. #endif
  1250. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1251. BAUD230400= 230400,
  1252. BAUD460800= 460800,
  1253. BAUD500000= 500000,
  1254. BAUD576000= 576000,
  1255. BAUD921600= 921600,
  1256. BAUD1000000= 1000000,
  1257. BAUD1152000= 1152000,
  1258. BAUD1500000= 1500000,
  1259. BAUD2000000= 2000000,
  1260. BAUD2500000= 2500000,
  1261. BAUD3000000= 3000000,
  1262. BAUD3500000= 3500000,
  1263. BAUD4000000= 4000000,
  1264. #endif
  1265. #endif
  1266. #if defined(Q_OS_WIN) || defined(qdoc)
  1267. BAUD14400= 14400,
  1268. BAUD56000= 56000,
  1269. BAUD128000= 128000,
  1270. BAUD256000= 256000,
  1271. #endif
  1272. BAUD110= 110,
  1273. BAUD300= 300,
  1274. BAUD600= 600,
  1275. BAUD1200= 1200,
  1276. BAUD2400= 2400,
  1277. BAUD4800= 4800,
  1278. BAUD9600= 9600,
  1279. BAUD19200= 19200,
  1280. BAUD38400= 38400,
  1281. BAUD57600= 57600,
  1282. BAUD115200= 115200
  1283. };
  1284. };
  1285. /*:679*//*681:*/
  1286. #line 15781 "./typica.w"
  1287. class ParitySelector:public QComboBox
  1288. {
  1289. Q_OBJECT
  1290. Q_ENUMS(ParityType)
  1291. public:
  1292. ParitySelector(QWidget*parent= NULL);
  1293. enum ParityType
  1294. {
  1295. PAR_NONE,
  1296. PAR_ODD,
  1297. PAR_EVEN,
  1298. #if defined(Q_OS_WIN) || defined(qdoc)
  1299. PAR_MARK,
  1300. #endif
  1301. PAR_SPACE
  1302. };
  1303. };
  1304. /*:681*//*683:*/
  1305. #line 15819 "./typica.w"
  1306. class FlowSelector:public QComboBox
  1307. {
  1308. Q_OBJECT
  1309. Q_ENUMS(FlowType)
  1310. public:
  1311. FlowSelector(QWidget*parent= NULL);
  1312. enum FlowType
  1313. {
  1314. FLOW_OFF,
  1315. FLOW_HARDWARE,
  1316. FLOW_XONXOFF
  1317. };
  1318. };
  1319. /*:683*//*685:*/
  1320. #line 15852 "./typica.w"
  1321. class StopSelector:public QComboBox
  1322. {
  1323. Q_OBJECT
  1324. Q_ENUMS(StopBitsType)
  1325. public:
  1326. StopSelector(QWidget*parent= NULL);
  1327. enum StopBitsType
  1328. {
  1329. STOP_1,
  1330. #if defined(Q_OS_WIN) || defined(qdoc)
  1331. STOP_1_5,
  1332. #endif
  1333. STOP_2
  1334. };
  1335. };
  1336. /*:685*//*688:*/
  1337. #line 15905 "./typica.w"
  1338. class ShortHexSpinBox:public QSpinBox
  1339. {
  1340. Q_OBJECT
  1341. public:
  1342. ShortHexSpinBox(QWidget*parent= NULL);
  1343. virtual QValidator::State validate(QString&input,int&pos)const;
  1344. protected:
  1345. virtual int valueFromText(const QString&text)const;
  1346. virtual QString textFromValue(int value)const;
  1347. };
  1348. /*:688*//*690:*/
  1349. #line 15967 "./typica.w"
  1350. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1351. {
  1352. Q_OBJECT
  1353. public:
  1354. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1355. const QModelIndex&index);
  1356. private slots:
  1357. void updatePort(const QString&newPort);
  1358. void updateBaudRate(const QString&newRate);
  1359. void updateParity(const QString&newParity);
  1360. void updateFlowControl(const QString&newFlow);
  1361. void updateStopBits(const QString&newStopBits);
  1362. };
  1363. /*:690*//*692:*/
  1364. #line 16118 "./typica.w"
  1365. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1366. {
  1367. Q_OBJECT
  1368. public:
  1369. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1370. const QModelIndex&index);
  1371. private slots:
  1372. void updateStationNumber(int newStation);
  1373. void updateFixedUnit(bool newFixed);
  1374. void updateFixedDecimal(bool newFixed);
  1375. void updateUnit(const QString&newUnit);
  1376. void updateUnitAddress(int newAddress);
  1377. void updateValueF(int newValue);
  1378. void updateValueC(int newValue);
  1379. void updatePrecisionAddress(int newAddress);
  1380. void updatePrecisionValue(int newValue);
  1381. private:
  1382. QStackedLayout*unitSpecificationLayout;
  1383. QStackedLayout*decimalSpecificationLayout;
  1384. };
  1385. /*:692*//*694:*/
  1386. #line 16377 "./typica.w"
  1387. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1388. {
  1389. Q_OBJECT
  1390. public:
  1391. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1392. const QModelIndex&index);
  1393. private slots:
  1394. void updateAddress(int newAddress);
  1395. };
  1396. /*:694*//*696:*/
  1397. #line 16423 "./typica.w"
  1398. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1399. {
  1400. Q_OBJECT
  1401. public:
  1402. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1403. const QModelIndex&index);
  1404. private slots:
  1405. void updateReadAddress(int newAddress);
  1406. void updateWriteAddress(int newAddress);
  1407. void updateFixedRange(bool fixed);
  1408. void updateLower(const QString&lower);
  1409. void updateUpper(const QString&upper);
  1410. void updateLowerAddress(int newAddress);
  1411. void updateUpperAddress(int newAddress);
  1412. private:
  1413. QStackedLayout*boundsLayout;
  1414. };
  1415. /*:696*//*700:*/
  1416. #line 16617 "./typica.w"
  1417. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1418. {
  1419. Q_OBJECT
  1420. public:
  1421. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1422. private slots:
  1423. void updateButtonText(const QString&text);
  1424. void updateAnnotationText(const QString&text);
  1425. };
  1426. /*:700*//*704:*/
  1427. #line 16685 "./typica.w"
  1428. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1429. {
  1430. Q_OBJECT
  1431. public:
  1432. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1433. private slots:
  1434. void updateButtonText(const QString&text);
  1435. void updateAnnotationText(const QString&text);
  1436. };
  1437. /*:704*//*707:*/
  1438. #line 16759 "./typica.w"
  1439. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1440. {
  1441. Q_OBJECT
  1442. public:
  1443. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1444. private slots:
  1445. void updateLabel(const QString&text);
  1446. void updateMinimum(const QString&minimum);
  1447. void updateMaximum(const QString&maximum);
  1448. void updatePrecision(int precision);
  1449. void updatePretext(const QString&text);
  1450. void updatePosttext(const QString&text);
  1451. };
  1452. /*:707*//*710:*/
  1453. #line 16880 "./typica.w"
  1454. class ModbusRTUDevice:public QObject
  1455. {
  1456. Q_OBJECT
  1457. public:
  1458. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1459. ~ModbusRTUDevice();
  1460. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1461. Q_INVOKABLE double SVLower();
  1462. Q_INVOKABLE double SVUpper();
  1463. Q_INVOKABLE int decimals();
  1464. QList<Channel*> channels;
  1465. public slots:
  1466. void outputSV(double sv);
  1467. signals:
  1468. void SVLowerChanged(double);
  1469. void SVUpperChanged(double);
  1470. void SVDecimalChanged(int);
  1471. void queueEmpty();
  1472. private slots:
  1473. void dataAvailable();
  1474. void sendNextMessage();
  1475. void decimalResponse(QByteArray response);
  1476. void unitResponse(QByteArray response);
  1477. void svlResponse(QByteArray response);
  1478. void svuResponse(QByteArray response);
  1479. void requestMeasurement();
  1480. void mResponse(QByteArray response);
  1481. void ignore(QByteArray response);
  1482. private:
  1483. QextSerialPort*port;
  1484. QByteArray responseBuffer;
  1485. QList<QByteArray> messageQueue;
  1486. QList<QObject*> retObjQueue;
  1487. QList<char*> callbackQueue;
  1488. quint16 calculateCRC(QByteArray data);
  1489. QTimer*messageDelayTimer;
  1490. int delayTime;
  1491. char station;
  1492. int decimalPosition;
  1493. int valueF;
  1494. int valueC;
  1495. bool unitIsF;
  1496. double outputSVLower;
  1497. double outputSVUpper;
  1498. QByteArray outputSVStub;
  1499. QByteArray pvStub;
  1500. QByteArray svStub;
  1501. QByteArray mStub;
  1502. quint16 pvaddress;
  1503. quint16 svaddress;
  1504. bool svenabled;
  1505. bool readingsv;
  1506. double savedpv;
  1507. bool waiting;
  1508. };
  1509. /*:710*//*725:*/
  1510. #line 17552 "./typica.w"
  1511. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1512. {
  1513. Q_OBJECT
  1514. public:
  1515. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1516. private slots:
  1517. void updatePort(const QString&newPort);
  1518. void updateBaudRate(const QString&newRate);
  1519. void updateParity(const QString&newParity);
  1520. void updateFlowControl(const QString&newFlow);
  1521. void updateStopBits(const QString&newStopBits);
  1522. void updateStation(int station);
  1523. void updateFixedDecimal(bool fixed);
  1524. void updateDecimalAddress(int address);
  1525. void updateDecimalPosition(int position);
  1526. void updateFixedUnit(bool fixed);
  1527. void updateUnitAddress(int address);
  1528. void updateValueForF(int value);
  1529. void updateValueForC(int value);
  1530. void updateUnit(const QString&newUnit);
  1531. void updatePVAddress(int address);
  1532. void updateSVEnabled(bool enabled);
  1533. void updateSVReadAddress(int address);
  1534. void updateDeviceLimit(bool query);
  1535. void updateSVLowerAddress(int address);
  1536. void updateSVUpperAddress(int address);
  1537. void updateSVLower(double value);
  1538. void updateSVUpper(double value);
  1539. void updateSVWritable(bool canWriteSV);
  1540. void updateSVWriteAddress(int address);
  1541. void updatePVColumnName(const QString&name);
  1542. void updateSVColumnName(const QString&name);
  1543. private:
  1544. PortSelector*port;
  1545. BaudSelector*baud;
  1546. ParitySelector*parity;
  1547. FlowSelector*flow;
  1548. StopSelector*stop;
  1549. QSpinBox*station;
  1550. QCheckBox*decimalQuery;
  1551. ShortHexSpinBox*decimalAddress;
  1552. QSpinBox*decimalPosition;
  1553. QCheckBox*unitQuery;
  1554. ShortHexSpinBox*unitAddress;
  1555. QSpinBox*valueF;
  1556. QSpinBox*valueC;
  1557. QComboBox*fixedUnit;
  1558. ShortHexSpinBox*pVAddress;
  1559. QCheckBox*sVEnabled;
  1560. ShortHexSpinBox*sVReadAddress;
  1561. QCheckBox*deviceLimit;
  1562. ShortHexSpinBox*sVLowerAddr;
  1563. ShortHexSpinBox*sVUpperAddr;
  1564. QDoubleSpinBox*sVLower;
  1565. QDoubleSpinBox*sVUpper;
  1566. QCheckBox*sVWritable;
  1567. ShortHexSpinBox*sVOutputAddr;
  1568. QLineEdit*pVColumnName;
  1569. QLineEdit*sVColumnName;
  1570. };
  1571. /*:725*//*729:*/
  1572. #line 18058 "./typica.w"
  1573. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1574. {
  1575. Q_OBJECT
  1576. public:
  1577. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1578. const QModelIndex&index);
  1579. private slots:
  1580. void updateSourceColumn(const QString&source);
  1581. void updateDestinationColumn(const QString&dest);
  1582. void updateKnots();
  1583. private:
  1584. SaltModel*knotmodel;
  1585. };
  1586. /*:729*//*735:*/
  1587. #line 18182 "./typica.w"
  1588. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1589. {
  1590. Q_OBJECT
  1591. public:
  1592. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1593. private slots:
  1594. void updateMatchingColumn(const QString&column);
  1595. void updateTemperature();
  1596. private:
  1597. QDoubleSpinBox*temperatureValue;
  1598. QComboBox*unitSelector;
  1599. };
  1600. /*:735*/
  1601. #line 755 "./typica.w"
  1602. /*24:*/
  1603. #line 1004 "./typica.w"
  1604. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1605. /*:24*//*26:*/
  1606. #line 1019 "./typica.w"
  1607. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1608. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1609. /*:26*//*28:*/
  1610. #line 1044 "./typica.w"
  1611. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1612. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1613. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1614. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1615. QScriptEngine*engine);
  1616. /*:28*//*36:*/
  1617. #line 1242 "./typica.w"
  1618. QScriptValue constructQMainWindow(QScriptContext*context,
  1619. QScriptEngine*engine);
  1620. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1621. QScriptEngine*engine);
  1622. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1623. QScriptEngine*engine);
  1624. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1625. /*:36*//*41:*/
  1626. #line 1341 "./typica.w"
  1627. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1628. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1629. /*:41*//*44:*/
  1630. #line 1386 "./typica.w"
  1631. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1632. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1633. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1634. /*:44*//*47:*/
  1635. #line 1452 "./typica.w"
  1636. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1637. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1638. /*:47*//*50:*/
  1639. #line 1485 "./typica.w"
  1640. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1641. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1642. /*:50*//*53:*/
  1643. #line 1526 "./typica.w"
  1644. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1645. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1646. QScriptEngine*engine);
  1647. QScriptValue QSplitter_saveState(QScriptContext*context,
  1648. QScriptEngine*engine);
  1649. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1650. QScriptEngine*engine);
  1651. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1652. /*:53*//*58:*/
  1653. #line 1645 "./typica.w"
  1654. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1655. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1656. /*:58*//*60:*/
  1657. #line 1700 "./typica.w"
  1658. QScriptValue constructQBoxLayout(QScriptContext*context,
  1659. QScriptEngine*engine);
  1660. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1661. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1662. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1663. /*:60*//*64:*/
  1664. #line 1813 "./typica.w"
  1665. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1666. QScriptValue QAction_setShortcut(QScriptContext*context,
  1667. QScriptEngine*engine);
  1668. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1669. /*:64*//*67:*/
  1670. #line 1869 "./typica.w"
  1671. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  1672. QScriptEngine*engine);
  1673. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  1674. QScriptEngine*engine);
  1675. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  1676. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  1677. /*:67*//*72:*/
  1678. #line 1980 "./typica.w"
  1679. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  1680. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  1681. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  1682. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  1683. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  1684. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  1685. QScriptValue QIODevice_readToString(QScriptContext*context,
  1686. QScriptEngine*engine);
  1687. /*:72*//*79:*/
  1688. #line 2102 "./typica.w"
  1689. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  1690. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  1691. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  1692. /*:79*//*82:*/
  1693. #line 2147 "./typica.w"
  1694. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  1695. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1696. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  1697. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  1698. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  1699. /*:82*//*88:*/
  1700. #line 2220 "./typica.w"
  1701. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  1702. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  1703. QScriptEngine*engine);
  1704. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  1705. QScriptEngine*engine);
  1706. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  1707. QScriptEngine*engine);
  1708. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  1709. QScriptEngine*engine);
  1710. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  1711. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  1712. QScriptEngine*engine);
  1713. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  1714. QScriptEngine*engine);
  1715. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  1716. QScriptEngine*engine);
  1717. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  1718. QScriptEngine*engine);
  1719. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  1720. QScriptEngine*engine);
  1721. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  1722. QScriptEngine*engine);
  1723. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  1724. QScriptEngine*engine);
  1725. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  1726. QScriptEngine*engine);
  1727. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  1728. /*:88*//*97:*/
  1729. #line 2438 "./typica.w"
  1730. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  1731. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  1732. QScriptValue XmlReader_attribute(QScriptContext*context,
  1733. QScriptEngine*engine);
  1734. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  1735. QScriptEngine*engine);
  1736. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  1737. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  1738. QScriptEngine*engine);
  1739. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  1740. QScriptValue XmlReader_readElementText(QScriptContext*context,
  1741. QScriptEngine*engine);
  1742. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  1743. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  1744. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  1745. /*:97*//*104:*/
  1746. #line 2573 "./typica.w"
  1747. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  1748. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  1749. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  1750. /*:104*//*108:*/
  1751. #line 2655 "./typica.w"
  1752. QScriptValue constructQLCDNumber(QScriptContext*context,
  1753. QScriptEngine*engine);
  1754. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  1755. /*:108*//*111:*/
  1756. #line 2693 "./typica.w"
  1757. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  1758. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  1759. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  1760. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  1761. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  1762. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  1763. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  1764. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  1765. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  1766. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  1767. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  1768. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  1769. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  1770. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  1771. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  1772. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  1773. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  1774. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  1775. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  1776. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  1777. /*:111*//*126:*/
  1778. #line 3162 "./typica.w"
  1779. void setQAbstractScrollAreaProperties(QScriptValue value,
  1780. QScriptEngine*engine);
  1781. /*:126*//*128:*/
  1782. #line 3177 "./typica.w"
  1783. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  1784. /*:128*//*130:*/
  1785. #line 3190 "./typica.w"
  1786. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  1787. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  1788. /*:130*//*132:*/
  1789. #line 3214 "./typica.w"
  1790. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  1791. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  1792. QScriptValue constructQPushButton(QScriptContext*context,
  1793. QScriptEngine*engine);
  1794. /*:132*//*139:*/
  1795. #line 3313 "./typica.w"
  1796. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  1797. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  1798. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1799. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  1800. QScriptEngine*engine);
  1801. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  1802. QScriptEngine*engine);
  1803. QScriptValue QSqlQuery_exec(QScriptContext*context,
  1804. QScriptEngine*engine);
  1805. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  1806. QScriptEngine*engine);
  1807. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  1808. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  1809. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  1810. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  1811. /*:139*//*146:*/
  1812. #line 3483 "./typica.w"
  1813. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  1814. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  1815. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  1816. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  1817. QScriptValue annotationFromRecord(QScriptContext*context,
  1818. QScriptEngine*engine);
  1819. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  1820. /*:146*//*157:*/
  1821. #line 3766 "./typica.w"
  1822. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  1823. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1824. QStack<QLayout*> *layoutStack);
  1825. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1826. QStack<QLayout*> *layoutStack);
  1827. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1828. QStack<QLayout*> *layoutStack);
  1829. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1830. QStack<QLayout*> *layoutStack);
  1831. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1832. QStack<QLayout*> *layoutStack);
  1833. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1834. QStack<QLayout*> *layoutStack);
  1835. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1836. QStack<QLayout*> *layoutStack);
  1837. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1838. QStack<QLayout*> *layoutStack);
  1839. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1840. QStack<QLayout*> *layoutStack);
  1841. void addTemperatureDisplayToSplitter(QDomElement element,
  1842. QStack<QWidget*> *widgetStack,
  1843. QStack<QLayout*> *layoutStack);
  1844. void addTemperatureDisplayToLayout(QDomElement element,
  1845. QStack<QWidget*> *widgetStack,
  1846. QStack<QLayout*> *layoutStack);
  1847. void addTimerDisplayToSplitter(QDomElement element,
  1848. QStack<QWidget*> *widgetStack,
  1849. QStack<QLayout*> *layoutStack);
  1850. void addTimerDisplayToLayout(QDomElement element,
  1851. QStack<QWidget*> *widgetStack,
  1852. QStack<QLayout*> *layoutStack);
  1853. void addDecorationToSplitter(QDomElement element,
  1854. QStack<QWidget*> *widgetStack,
  1855. QStack<QLayout*> *layoutStack);
  1856. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1857. QStack<QLayout*> *layoutStack);
  1858. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1859. QStack<QLayout*> *layoutStack);
  1860. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1861. QStack<QLayout*> *layoutStack);
  1862. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1863. QStack<QLayout*> *layoutStack);
  1864. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1865. QStack<QLayout*> *layoutStack);
  1866. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1867. QStack<QLayout*> *layoutStack);
  1868. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1869. QStack<QLayout*> *layoutStack);
  1870. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1871. QStack<QLayout*> *layoutStack);
  1872. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1873. QStack<QLayout*> *layoutStack);
  1874. void addSqlQueryViewToLayout(QDomElement element,
  1875. QStack<QWidget*> *widgetStack,
  1876. QStack<QLayout*> *layoutStack);
  1877. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1878. QStack<QLayout*> *layoutStack);
  1879. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1880. QStack<QLayout*> *layoutStack);
  1881. /*:157*//*208:*/
  1882. #line 5282 "./typica.w"
  1883. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  1884. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  1885. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  1886. QScriptEngine*engine);
  1887. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  1888. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  1889. QScriptEngine*engine);
  1890. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  1891. /*:208*//*209:*/
  1892. #line 5297 "./typica.w"
  1893. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  1894. /*:209*//*213:*/
  1895. #line 5424 "./typica.w"
  1896. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  1897. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  1898. QScriptEngine*engine);
  1899. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  1900. QScriptEngine*engine);
  1901. QScriptValue SaltTable_columnSum(QScriptContext*context,
  1902. QScriptEngine*engine);
  1903. QScriptValue SaltTable_columnArray(QScriptContext*context,
  1904. QScriptEngine*engine);
  1905. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  1906. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  1907. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  1908. QScriptEngine*engine);
  1909. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  1910. /*:213*//*220:*/
  1911. #line 5594 "./typica.w"
  1912. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1913. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1914. QScriptValue QComboBox_currentData(QScriptContext*context,
  1915. QScriptEngine*engine);
  1916. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  1917. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  1918. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  1919. /*:220*//*251:*/
  1920. #line 6472 "./typica.w"
  1921. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  1922. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1923. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  1924. /*:251*//*260:*/
  1925. #line 6670 "./typica.w"
  1926. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  1927. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1928. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  1929. /*:260*//*265:*/
  1930. #line 6771 "./typica.w"
  1931. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  1932. /*:265*//*271:*/
  1933. #line 6947 "./typica.w"
  1934. QScriptValue constructLinearCalibrator(QScriptContext*context,
  1935. QScriptEngine*engine);
  1936. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  1937. /*:271*//*276:*/
  1938. #line 7086 "./typica.w"
  1939. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  1940. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  1941. /*:276*//*285:*/
  1942. #line 7268 "./typica.w"
  1943. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  1944. QScriptEngine*engine);
  1945. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1946. /*:285*//*292:*/
  1947. #line 7405 "./typica.w"
  1948. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  1949. QScriptEngine*engine);
  1950. void setMeasurementTimeOffsetProperties(QScriptValue value,
  1951. QScriptEngine*engine);
  1952. /*:292*//*297:*/
  1953. #line 7518 "./typica.w"
  1954. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  1955. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  1956. /*:297*//*302:*/
  1957. #line 7615 "./typica.w"
  1958. QScriptValue constructZeroEmitter(QScriptContext*context,
  1959. QScriptEngine*engine);
  1960. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  1961. /*:302*//*307:*/
  1962. #line 7694 "./typica.w"
  1963. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  1964. QScriptEngine*engine);
  1965. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  1966. /*:307*//*322:*/
  1967. #line 8044 "./typica.w"
  1968. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  1969. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  1970. /*:322*//*345:*/
  1971. #line 8639 "./typica.w"
  1972. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  1973. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  1974. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  1975. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  1976. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  1977. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  1978. QScriptEngine*engine);
  1979. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  1980. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  1981. QScriptEngine*engnie);
  1982. /*:345*//*382:*/
  1983. #line 9564 "./typica.w"
  1984. QScriptValue constructAnnotationButton(QScriptContext*context,
  1985. QScriptEngine*engine);
  1986. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  1987. /*:382*//*390:*/
  1988. #line 9704 "./typica.w"
  1989. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  1990. QScriptEngine*engine);
  1991. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1992. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1993. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1994. /*:390*//*411:*/
  1995. #line 10127 "./typica.w"
  1996. QScriptValue constructTimerDisplay(QScriptContext*context,
  1997. QScriptEngine*engine);
  1998. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1999. /*:411*//*438:*/
  2000. #line 10621 "./typica.w"
  2001. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2002. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2003. QScriptEngine*engine);
  2004. /*:438*//*451:*/
  2005. #line 10904 "./typica.w"
  2006. QScriptValue constructLogEditWindow(QScriptContext*context,
  2007. QScriptEngine*engine);
  2008. /*:451*//*470:*/
  2009. #line 11378 "./typica.w"
  2010. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2011. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2012. /*:470*//*486:*/
  2013. #line 11661 "./typica.w"
  2014. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2015. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*engine);
  2016. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*engine);
  2017. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*engine);
  2018. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*engine);
  2019. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*);
  2020. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2021. QStack<QLayout*> *layoutStack);
  2022. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2023. /*:486*//*541:*/
  2024. #line 12677 "./typica.w"
  2025. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2026. QScriptValue constructSqlQueryView(QScriptContext*context,
  2027. QScriptEngine*engine);
  2028. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2029. QScriptEngine*engine);
  2030. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2031. QScriptEngine*engine);
  2032. /*:541*//*551:*/
  2033. #line 12906 "./typica.w"
  2034. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2035. QStack<QLayout*> *layoutStack);
  2036. /*:551*//*567:*/
  2037. #line 13190 "./typica.w"
  2038. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2039. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2040. /*:567*//*577:*/
  2041. #line 13385 "./typica.w"
  2042. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2043. QStack<QLayout*> *layoutStack);
  2044. /*:577*//*598:*/
  2045. #line 13969 "./typica.w"
  2046. void addScaleControlToLayout(QDomElement element,
  2047. QStack<QWidget*> *widgetStack,
  2048. QStack<QLayout*> *layoutStack);
  2049. void addIntensityControlToLayout(QDomElement element,
  2050. QStack<QWidget*> *widgetStack,
  2051. QStack<QLayout*> *layoutStack);
  2052. /*:598*//*624:*/
  2053. #line 14555 "./typica.w"
  2054. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2055. QScriptEngine*engine);
  2056. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2057. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2058. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2059. QScriptEngine*engine);
  2060. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2061. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2062. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2063. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2064. /*:624*//*630:*/
  2065. #line 14697 "./typica.w"
  2066. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2067. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2068. /*:630*//*645:*/
  2069. #line 14965 "./typica.w"
  2070. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2071. QScriptEngine*engine);
  2072. /*:645*//*720:*/
  2073. #line 17459 "./typica.w"
  2074. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2075. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2076. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2077. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2078. /*:720*/
  2079. #line 756 "./typica.w"
  2080. /*16:*/
  2081. #line 764 "./typica.w"
  2082. /*638:*/
  2083. #line 14818 "./typica.w"
  2084. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2085. const QString&driver,QObject*parent):
  2086. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2087. {
  2088. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2089. }
  2090. void NodeInserter::onTriggered()
  2091. {
  2092. emit triggered(defaultNodeName,driverString);
  2093. }
  2094. /*:638*/
  2095. #line 765 "./typica.w"
  2096. /*226:*/
  2097. #line 5709 "./typica.w"
  2098. Measurement::Measurement(double temperature,QTime time,
  2099. TemperatureUnits sc):
  2100. theTemperature(temperature),theTime(time),unit(sc)
  2101. {
  2102. }
  2103. Measurement::Measurement(double temperature):
  2104. theTemperature(temperature),theTime(QTime::currentTime()),
  2105. unit(Fahrenheit)
  2106. {
  2107. }
  2108. /*:226*//*228:*/
  2109. #line 5737 "./typica.w"
  2110. Measurement::Measurement(const Measurement&x):
  2111. theTemperature(x.temperature()),theTime(x.time()),
  2112. unit(x.unit)
  2113. {
  2114. }
  2115. Measurement::~Measurement()
  2116. {
  2117. }
  2118. /*:228*//*229:*/
  2119. #line 5753 "./typica.w"
  2120. Measurement&Measurement::operator= (Measurement&x)
  2121. {
  2122. theTemperature= x.temperature();
  2123. theTime= x.time();
  2124. unit= x.unit;
  2125. return*this;
  2126. }
  2127. /*:229*//*230:*/
  2128. #line 5767 "./typica.w"
  2129. double Measurement::temperature()const
  2130. {
  2131. return theTemperature;
  2132. }
  2133. QTime Measurement::time()const
  2134. {
  2135. return theTime;
  2136. }
  2137. void Measurement::setTemperature(double temperature)
  2138. {
  2139. theTemperature= temperature;
  2140. }
  2141. void Measurement::setTime(QTime time)
  2142. {
  2143. theTime= time;
  2144. }
  2145. /*:230*//*231:*/
  2146. #line 5793 "./typica.w"
  2147. void Measurement::setUnit(TemperatureUnits scale)
  2148. {
  2149. unit= scale;
  2150. }
  2151. Measurement::TemperatureUnits Measurement::scale()
  2152. {
  2153. return unit;
  2154. }
  2155. /*:231*//*232:*/
  2156. #line 5813 "./typica.w"
  2157. Measurement Measurement::toFahrenheit()
  2158. {
  2159. switch(unit)
  2160. {
  2161. case Celsius:
  2162. return Measurement(this->temperature()*9/5+32,this->time(),
  2163. Fahrenheit);
  2164. break;
  2165. case Kelvin:
  2166. return Measurement(this->temperature()*5/9-459.67,
  2167. this->time(),Fahrenheit);
  2168. break;
  2169. case Rankine:
  2170. return Measurement(this->temperature()-459.67,this->time(),
  2171. Fahrenheit);
  2172. break;
  2173. default:
  2174. return Measurement(this->temperature(),this->time(),Fahrenheit);
  2175. break;
  2176. }
  2177. }
  2178. /*:232*//*233:*/
  2179. #line 5838 "./typica.w"
  2180. Measurement Measurement::toCelsius()
  2181. {
  2182. switch(unit)
  2183. {
  2184. case Fahrenheit:
  2185. return Measurement((this->temperature()-32)*5/9,this->time(),
  2186. Celsius);
  2187. break;
  2188. case Kelvin:
  2189. return Measurement(this->temperature()-273.15,this->time(),
  2190. Celsius);
  2191. break;
  2192. case Rankine:
  2193. return Measurement((this->temperature()-491.67)*5/9,
  2194. this->time(),Celsius);
  2195. break;
  2196. default:
  2197. return Measurement(this->temperature(),this->time(),Celsius);
  2198. break;
  2199. }
  2200. }
  2201. /*:233*//*234:*/
  2202. #line 5864 "./typica.w"
  2203. Measurement Measurement::toKelvin()
  2204. {
  2205. switch(unit)
  2206. {
  2207. case Fahrenheit:
  2208. return Measurement((this->temperature()+459.67)*5/9,
  2209. this->time(),Kelvin);
  2210. break;
  2211. case Celsius:
  2212. return Measurement(this->temperature()+273.15,this->time(),
  2213. Kelvin);
  2214. break;
  2215. case Rankine:
  2216. return Measurement(this->temperature()*5/9,this->time(),
  2217. Kelvin);
  2218. break;
  2219. default:
  2220. return Measurement(this->temperature(),this->time(),Kelvin);
  2221. break;
  2222. }
  2223. }
  2224. /*:234*//*235:*/
  2225. #line 5889 "./typica.w"
  2226. Measurement Measurement::toRankine()
  2227. {
  2228. switch(unit)
  2229. {
  2230. case Fahrenheit:
  2231. return Measurement(this->temperature()+459.67,this->time(),
  2232. Rankine);
  2233. break;
  2234. case Celsius:
  2235. return Measurement((this->temperature()+273.15)*9/5,
  2236. this->time(),Rankine);
  2237. break;
  2238. case Kelvin:
  2239. return Measurement(this->temperature()*9/5,this->time(),
  2240. Rankine);
  2241. break;
  2242. default:
  2243. return Measurement(this->temperature(),this->time(),Rankine);
  2244. break;
  2245. }
  2246. }
  2247. /*:235*/
  2248. #line 766 "./typica.w"
  2249. /*241:*/
  2250. #line 6078 "./typica.w"
  2251. void DAQImplementation::measure()
  2252. {
  2253. int samplesRead= 0;
  2254. double buffer[channels];
  2255. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2256. (unsigned long)(0),buffer,(unsigned long)(channels),
  2257. &samplesRead,(signed long)(0));
  2258. if(error)
  2259. {
  2260. ready= false;
  2261. }
  2262. else
  2263. {
  2264. if(samplesRead)
  2265. {
  2266. QTime time= QTime::currentTime();
  2267. for(int i= 0;i<samplesRead;i++)
  2268. {
  2269. for(int j= 0;j<channels;j++)
  2270. {
  2271. Measurement measure(buffer[j+(i*channels)],time,
  2272. unitMap[j]);
  2273. channelMap[j]->input(measure);
  2274. }
  2275. }
  2276. }
  2277. }
  2278. }
  2279. /*:241*//*242:*/
  2280. #line 6120 "./typica.w"
  2281. void DAQImplementation::run()
  2282. {
  2283. setPriority(QThread::TimeCriticalPriority);
  2284. while(ready)
  2285. {
  2286. measure();
  2287. }
  2288. }
  2289. /*:242*//*243:*/
  2290. #line 6136 "./typica.w"
  2291. void DAQ::threadFinished()
  2292. {
  2293. if(imp->error)
  2294. {
  2295. /*244:*/
  2296. #line 6187 "./typica.w"
  2297. imp->ready= false;
  2298. QMessageBox warning;
  2299. warning.setStandardButtons(QMessageBox::Cancel);
  2300. warning.setIcon(QMessageBox::Warning);
  2301. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2302. unsigned long bytes= imp->errorInfo(NULL,0);
  2303. char string[bytes];
  2304. imp->errorInfo(string,bytes);
  2305. warning.setInformativeText(QString(string));
  2306. warning.setWindowTitle(QString(PROGRAM_NAME));
  2307. warning.exec();
  2308. /*:244*/
  2309. #line 6141 "./typica.w"
  2310. }
  2311. }
  2312. /*:243*//*245:*/
  2313. #line 6212 "./typica.w"
  2314. void DAQ::start()
  2315. {
  2316. if(imp->ready)
  2317. {
  2318. imp->error= imp->startTask(imp->handle);
  2319. if(imp->error)
  2320. {
  2321. /*244:*/
  2322. #line 6187 "./typica.w"
  2323. imp->ready= false;
  2324. QMessageBox warning;
  2325. warning.setStandardButtons(QMessageBox::Cancel);
  2326. warning.setIcon(QMessageBox::Warning);
  2327. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2328. unsigned long bytes= imp->errorInfo(NULL,0);
  2329. char string[bytes];
  2330. imp->errorInfo(string,bytes);
  2331. warning.setInformativeText(QString(string));
  2332. warning.setWindowTitle(QString(PROGRAM_NAME));
  2333. warning.exec();
  2334. /*:244*/
  2335. #line 6220 "./typica.w"
  2336. }
  2337. else
  2338. {
  2339. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2340. imp->start();
  2341. }
  2342. }
  2343. }
  2344. void DAQ::stop()
  2345. {
  2346. if(imp->useBase)
  2347. {
  2348. imp->ready= false;
  2349. imp->wait(ULONG_MAX);
  2350. imp->stopTask(imp->handle);
  2351. }
  2352. else
  2353. {
  2354. imp->ready= false;
  2355. imp->error= imp->stopTask(imp->handle);
  2356. if(imp->error)
  2357. {
  2358. /*244:*/
  2359. #line 6187 "./typica.w"
  2360. imp->ready= false;
  2361. QMessageBox warning;
  2362. warning.setStandardButtons(QMessageBox::Cancel);
  2363. warning.setIcon(QMessageBox::Warning);
  2364. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2365. unsigned long bytes= imp->errorInfo(NULL,0);
  2366. char string[bytes];
  2367. imp->errorInfo(string,bytes);
  2368. warning.setInformativeText(QString(string));
  2369. warning.setWindowTitle(QString(PROGRAM_NAME));
  2370. warning.exec();
  2371. /*:244*/
  2372. #line 6244 "./typica.w"
  2373. }
  2374. imp->error= imp->clearTask(imp->handle);
  2375. if(imp->error)
  2376. {
  2377. /*244:*/
  2378. #line 6187 "./typica.w"
  2379. imp->ready= false;
  2380. QMessageBox warning;
  2381. warning.setStandardButtons(QMessageBox::Cancel);
  2382. warning.setIcon(QMessageBox::Warning);
  2383. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2384. unsigned long bytes= imp->errorInfo(NULL,0);
  2385. char string[bytes];
  2386. imp->errorInfo(string,bytes);
  2387. warning.setInformativeText(QString(string));
  2388. warning.setWindowTitle(QString(PROGRAM_NAME));
  2389. warning.exec();
  2390. /*:244*/
  2391. #line 6249 "./typica.w"
  2392. }
  2393. }
  2394. }
  2395. /*:245*//*246:*/
  2396. #line 6259 "./typica.w"
  2397. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2398. {
  2399. imp->device= device;
  2400. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2401. if(imp->error)
  2402. {
  2403. /*244:*/
  2404. #line 6187 "./typica.w"
  2405. imp->ready= false;
  2406. QMessageBox warning;
  2407. warning.setStandardButtons(QMessageBox::Cancel);
  2408. warning.setIcon(QMessageBox::Warning);
  2409. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2410. unsigned long bytes= imp->errorInfo(NULL,0);
  2411. char string[bytes];
  2412. imp->errorInfo(string,bytes);
  2413. warning.setInformativeText(QString(string));
  2414. warning.setWindowTitle(QString(PROGRAM_NAME));
  2415. warning.exec();
  2416. /*:244*/
  2417. #line 6266 "./typica.w"
  2418. }
  2419. else
  2420. {
  2421. imp->ready= true;
  2422. }
  2423. }
  2424. /*:246*//*247:*/
  2425. #line 6280 "./typica.w"
  2426. Channel*DAQ::newChannel(int units,int thermocouple)
  2427. {
  2428. Channel*retval= new Channel();
  2429. imp->channelMap[imp->channels]= retval;
  2430. imp->unitMap[imp->channels]= (Measurement::TemperatureUnits)units;
  2431. imp->channels++;
  2432. if(imp->ready)
  2433. {
  2434. if(imp->useBase)
  2435. {
  2436. imp->error= imp->createChannel(imp->handle,
  2437. QString("%1/ai%2").arg(imp->device).
  2438. arg(imp->channels-1).
  2439. toAscii().data(),
  2440. "",(double)(-1.0),(double)(100.0),
  2441. (signed long)(units),
  2442. (signed long)(thermocouple),
  2443. (signed long)(10200),(double)(0),
  2444. "");
  2445. }
  2446. else
  2447. {
  2448. imp->error= imp->createChannel(imp->handle,
  2449. QString("%1/ai%2").arg(imp->device).
  2450. arg(imp->channels-1).
  2451. toAscii().data(),
  2452. "",(double)(50.0),(double)(500.0),
  2453. (signed long)(units),
  2454. (signed long)(thermocouple),
  2455. (signed long)(10200),(double)(0),
  2456. "");
  2457. }
  2458. if(imp->error)
  2459. {
  2460. /*244:*/
  2461. #line 6187 "./typica.w"
  2462. imp->ready= false;
  2463. QMessageBox warning;
  2464. warning.setStandardButtons(QMessageBox::Cancel);
  2465. warning.setIcon(QMessageBox::Warning);
  2466. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2467. unsigned long bytes= imp->errorInfo(NULL,0);
  2468. char string[bytes];
  2469. imp->errorInfo(string,bytes);
  2470. warning.setInformativeText(QString(string));
  2471. warning.setWindowTitle(QString(PROGRAM_NAME));
  2472. warning.exec();
  2473. /*:244*/
  2474. #line 6315 "./typica.w"
  2475. }
  2476. }
  2477. return retval;
  2478. }
  2479. /*:247*//*248:*/
  2480. #line 6329 "./typica.w"
  2481. void DAQ::setClockRate(double Hz)
  2482. {
  2483. if(imp->ready)
  2484. {
  2485. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2486. (signed long)(10280),(signed long)(10123),
  2487. (unsigned long long)(1));
  2488. if(imp->error)
  2489. {
  2490. /*244:*/
  2491. #line 6187 "./typica.w"
  2492. imp->ready= false;
  2493. QMessageBox warning;
  2494. warning.setStandardButtons(QMessageBox::Cancel);
  2495. warning.setIcon(QMessageBox::Warning);
  2496. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2497. unsigned long bytes= imp->errorInfo(NULL,0);
  2498. char string[bytes];
  2499. imp->errorInfo(string,bytes);
  2500. warning.setInformativeText(QString(string));
  2501. warning.setWindowTitle(QString(PROGRAM_NAME));
  2502. warning.exec();
  2503. /*:244*/
  2504. #line 6339 "./typica.w"
  2505. }
  2506. }
  2507. }
  2508. /*:248*//*249:*/
  2509. #line 6349 "./typica.w"
  2510. DAQ::~DAQ()
  2511. {
  2512. if(imp->useBase)
  2513. {
  2514. imp->resetDevice(imp->device.toAscii().data());
  2515. imp->clearTask(imp->handle);
  2516. }
  2517. else
  2518. {
  2519. if(imp->ready)
  2520. {
  2521. imp->ready= false;
  2522. imp->wait(ULONG_MAX);
  2523. imp->stopTask(imp->handle);
  2524. imp->resetDevice(imp->device.toAscii().data());
  2525. imp->clearTask(imp->handle);
  2526. }
  2527. }
  2528. delete imp;
  2529. }
  2530. /*:249*//*250:*/
  2531. #line 6380 "./typica.w"
  2532. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2533. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2534. unitMap(4)
  2535. {
  2536. if(driverinfo=="nidaqmxbase")
  2537. {
  2538. useBase= true;
  2539. }
  2540. else
  2541. {
  2542. useBase= false;
  2543. }
  2544. if(useBase)
  2545. {
  2546. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2547. if(!driver.load())
  2548. {
  2549. driver.setFileName("nidaqmxbase");
  2550. if(!driver.load())
  2551. {
  2552. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2553. tr("Failed to find nidaqmxbase. Please install it."));
  2554. QApplication::quit();
  2555. }
  2556. }
  2557. }
  2558. else
  2559. {
  2560. driver.setFileName("nicaiu");
  2561. if(!driver.load())
  2562. {
  2563. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2564. tr("Failed to find nidaqmx. Please install it."));
  2565. QApplication::quit();
  2566. }
  2567. }
  2568. if(useBase)
  2569. {
  2570. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2571. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2572. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2573. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2574. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2575. ==0||
  2576. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2577. 0||
  2578. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2579. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2580. 0||
  2581. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2582. {
  2583. waitForMeasurement= NULL;
  2584. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2585. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2586. QApplication::quit();
  2587. }
  2588. }
  2589. else
  2590. {
  2591. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2592. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2593. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2594. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2595. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2596. ==0||
  2597. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2598. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2599. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2600. 0||
  2601. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2602. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2603. {
  2604. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2605. tr("Failed to link a required symbol in NI-DAQmx."));
  2606. QApplication::quit();
  2607. }
  2608. }
  2609. }
  2610. DAQImplementation::~DAQImplementation()
  2611. {
  2612. driver.unload();
  2613. }
  2614. /*:250*/
  2615. #line 767 "./typica.w"
  2616. /*257:*/
  2617. #line 6582 "./typica.w"
  2618. void FakeDAQImplementation::measure()
  2619. {
  2620. msleep((int)(1000/clockRate));
  2621. QTime time= QTime::currentTime();
  2622. for(int i= 0;i<channels;i++)
  2623. {
  2624. Measurement measure(qrand()%500,time);
  2625. channelMap[i]->input(measure);
  2626. }
  2627. }
  2628. /*:257*//*258:*/
  2629. #line 6596 "./typica.w"
  2630. void FakeDAQImplementation::run()
  2631. {
  2632. setPriority(QThread::TimeCriticalPriority);
  2633. while(ready)
  2634. {
  2635. measure();
  2636. }
  2637. }
  2638. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  2639. channels(0),ready(false),clockRate(1)
  2640. {
  2641. }
  2642. FakeDAQImplementation::~FakeDAQImplementation()
  2643. {
  2644. }
  2645. /*:258*//*259:*/
  2646. #line 6621 "./typica.w"
  2647. void FakeDAQ::start()
  2648. {
  2649. if(imp->ready)
  2650. {
  2651. imp->start();
  2652. }
  2653. }
  2654. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  2655. {
  2656. imp->ready= true;
  2657. }
  2658. Channel*FakeDAQ::newChannel(int,int)
  2659. {
  2660. Channel*retval;
  2661. if(imp->ready)
  2662. {
  2663. retval= new Channel();
  2664. imp->channelMap[imp->channels]= retval;
  2665. imp->channels++;
  2666. }
  2667. else
  2668. {
  2669. return NULL;
  2670. }
  2671. return retval;
  2672. }
  2673. void FakeDAQ::setClockRate(double Hz)
  2674. {
  2675. if(imp->ready)
  2676. {
  2677. imp->clockRate= Hz;
  2678. }
  2679. }
  2680. FakeDAQ::~FakeDAQ()
  2681. {
  2682. imp->ready= false;
  2683. imp->wait(ULONG_MAX);
  2684. delete imp;
  2685. }
  2686. /*:259*/
  2687. #line 768 "./typica.w"
  2688. /*264:*/
  2689. #line 6752 "./typica.w"
  2690. Channel::Channel():QObject(NULL)
  2691. {
  2692. }
  2693. Channel::~Channel()
  2694. {
  2695. }
  2696. void Channel::input(Measurement measurement)
  2697. {
  2698. emit newData(measurement);
  2699. }
  2700. /*:264*/
  2701. #line 769 "./typica.w"
  2702. /*280:*/
  2703. #line 7163 "./typica.w"
  2704. void TemperatureDisplay::setValue(Measurement temperature)
  2705. {
  2706. QString number;
  2707. switch(unit)
  2708. {
  2709. case Auto:
  2710. switch(temperature.scale())
  2711. {
  2712. case Fahrenheit:
  2713. display(QString("%1'F").
  2714. arg(number.setNum(temperature.temperature(),'f',2)));
  2715. break;
  2716. case Celsius:
  2717. display(QString("%1'C").
  2718. arg(number.setNum(temperature.temperature(),'f',2)));
  2719. break;
  2720. case Kelvin:
  2721. display(QString("%1").
  2722. arg(number.setNum(temperature.temperature(),'f',2)));
  2723. break;
  2724. case Rankine:
  2725. display(QString("%1'r").
  2726. arg(number.setNum(temperature.temperature(),'f',2)));
  2727. break;
  2728. }
  2729. break;
  2730. case Fahrenheit:
  2731. display(QString("%1'F").
  2732. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  2733. 2)));
  2734. break;
  2735. case Celsius:
  2736. display(QString("%1'C").
  2737. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  2738. 2)));
  2739. break;
  2740. case Kelvin:
  2741. display(QString("%1").
  2742. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  2743. 2)));
  2744. break;
  2745. case Rankine:
  2746. display(QString("%1'r").
  2747. arg(number.setNum(temperature.toRankine().temperature(),'f',
  2748. 2)));
  2749. break;
  2750. }
  2751. }
  2752. /*:280*//*281:*/
  2753. #line 7223 "./typica.w"
  2754. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  2755. QLCDNumber(8,parent),unit(Auto)
  2756. {
  2757. setSegmentStyle(Filled);
  2758. display("---.--'F");
  2759. }
  2760. /*:281*//*282:*/
  2761. #line 7239 "./typica.w"
  2762. void TemperatureDisplay::invalidate()
  2763. {
  2764. display("---.--'F");
  2765. }
  2766. /*:282*//*283:*/
  2767. #line 7251 "./typica.w"
  2768. void TemperatureDisplay::setDisplayUnits(DisplayUnits scale)
  2769. {
  2770. unit= scale;
  2771. }
  2772. /*:283*//*284:*/
  2773. #line 7259 "./typica.w"
  2774. TemperatureDisplay::~TemperatureDisplay()
  2775. {
  2776. }
  2777. /*:284*/
  2778. #line 770 "./typica.w"
  2779. /*289:*/
  2780. #line 7339 "./typica.w"
  2781. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  2782. {
  2783. if(measure.time()<epoch)
  2784. {
  2785. if(hasPrevious)
  2786. {
  2787. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  2788. epoch.msec());
  2789. QTime jitComp(epoch.hour(),measure.time().minute(),
  2790. measure.time().second(),measure.time().msec());
  2791. int relTime= jitBase.msecsTo(jitComp);
  2792. /*290:*/
  2793. #line 7372 "./typica.w"
  2794. QTime newTime(0,0,0,0);
  2795. newTime= newTime.addMSecs(relTime);
  2796. if(newTime.hour()> 0)
  2797. {
  2798. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2799. }
  2800. Measurement rel(measure.temperature(),newTime);
  2801. emit measurement(rel);
  2802. /*:290*/
  2803. #line 7351 "./typica.w"
  2804. }
  2805. else
  2806. {
  2807. Measurement rel(measure.temperature(),QTime(0,0,0,0));
  2808. emit measurement(rel);
  2809. }
  2810. }
  2811. else
  2812. {
  2813. int relTime= epoch.msecsTo(measure.time());
  2814. /*290:*/
  2815. #line 7372 "./typica.w"
  2816. QTime newTime(0,0,0,0);
  2817. newTime= newTime.addMSecs(relTime);
  2818. if(newTime.hour()> 0)
  2819. {
  2820. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2821. }
  2822. Measurement rel(measure.temperature(),newTime);
  2823. emit measurement(rel);
  2824. /*:290*/
  2825. #line 7362 "./typica.w"
  2826. }
  2827. hasPrevious= true;
  2828. previous= measure.time();
  2829. }
  2830. /*:289*//*291:*/
  2831. #line 7384 "./typica.w"
  2832. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  2833. previous(0,0,0,0),hasPrevious(false)
  2834. {
  2835. }
  2836. QTime MeasurementTimeOffset::zeroTime()
  2837. {
  2838. return epoch;
  2839. }
  2840. void MeasurementTimeOffset::setZeroTime(QTime zero)
  2841. {
  2842. epoch= zero;
  2843. hasPrevious= false;
  2844. }
  2845. /*:291*/
  2846. #line 771 "./typica.w"
  2847. /*301:*/
  2848. #line 7581 "./typica.w"
  2849. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn),
  2850. temp(0)
  2851. {
  2852. }
  2853. int ZeroEmitter::column()
  2854. {
  2855. return col;
  2856. }
  2857. double ZeroEmitter::lastTemperature()
  2858. {
  2859. return temp;
  2860. }
  2861. void ZeroEmitter::newMeasurement(Measurement measure)
  2862. {
  2863. temp= measure.temperature();
  2864. }
  2865. void ZeroEmitter::setColumn(int column)
  2866. {
  2867. col= column;
  2868. }
  2869. void ZeroEmitter::emitZero()
  2870. {
  2871. emit measurement(Measurement(temp,QTime(0,0,0,0)),col);
  2872. }
  2873. /*:301*/
  2874. #line 772 "./typica.w"
  2875. /*306:*/
  2876. #line 7671 "./typica.w"
  2877. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  2878. {
  2879. }
  2880. int MeasurementAdapter::column()
  2881. {
  2882. return col;
  2883. }
  2884. void MeasurementAdapter::newMeasurement(Measurement measure)
  2885. {
  2886. emit measurement(measure,col);
  2887. }
  2888. void MeasurementAdapter::setColumn(int column)
  2889. {
  2890. col= column;
  2891. }
  2892. /*:306*/
  2893. #line 773 "./typica.w"
  2894. /*311:*/
  2895. #line 7787 "./typica.w"
  2896. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  2897. theScene(new QGraphicsScene),
  2898. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  2899. prevPoints(new QMap<int,QPointF> ),
  2900. translations(new QMap<int,double> ),
  2901. gridLinesF(new QList<QGraphicsItem*> ),
  2902. gridLinesC(new QList<QGraphicsItem*> )
  2903. {
  2904. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2905. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2906. setScene(theScene);
  2907. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  2908. /*312:*/
  2909. #line 7815 "./typica.w"
  2910. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  2911. tempaxis->setLine(-10,-500,-10,0);
  2912. theScene->addItem(tempaxis);
  2913. QGraphicsLineItem*gridLine;
  2914. QGraphicsTextItem*label;
  2915. for(int y= -100;y> -600;y-= 100)
  2916. {
  2917. gridLine= new QGraphicsLineItem;
  2918. gridLine->setLine(0,y,1200,y);
  2919. theScene->addItem(gridLine);
  2920. label= new QGraphicsTextItem;
  2921. label->setHtml(QString("%1&deg;F").arg(-y));
  2922. label->setPos(-55,y-(label->boundingRect().height()/2));
  2923. theScene->addItem(label);
  2924. gridLinesF->append(gridLine);
  2925. gridLinesF->append(label);
  2926. }
  2927. for(int degC= 50;degC<=250;degC+= 50)
  2928. {
  2929. gridLine= new QGraphicsLineItem;
  2930. int y= -(degC*(9.0/5.0)+32);
  2931. gridLine->setLine(0,y,1200,y);
  2932. gridLine->hide();
  2933. theScene->addItem(gridLine);
  2934. gridLinesC->append(gridLine);
  2935. label= new QGraphicsTextItem;
  2936. label->setHtml(QString("%1&deg;C").arg(degC));
  2937. label->setPos(-55,y-(label->boundingRect().height()/2));
  2938. label->hide();
  2939. theScene->addItem(label);
  2940. gridLinesC->append(label);
  2941. }
  2942. /*:312*/
  2943. #line 7800 "./typica.w"
  2944. ;
  2945. /*314:*/
  2946. #line 7881 "./typica.w"
  2947. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  2948. timeaxis->setLine(0,10,1200,10);
  2949. theScene->addItem(timeaxis);
  2950. for(int x= 0;x<1201;x+= 120)
  2951. {
  2952. QGraphicsLineItem*tick= new QGraphicsLineItem;
  2953. tick->setLine(x,0,x,20);
  2954. theScene->addItem(tick);
  2955. QGraphicsTextItem*label= new QGraphicsTextItem;
  2956. label->setPlainText(QString("%1").arg(x/60));
  2957. label->setPos(x-(label->boundingRect().width()/2),20);
  2958. theScene->addItem(label);
  2959. }
  2960. /*:314*/
  2961. #line 7801 "./typica.w"
  2962. ;
  2963. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2964. }
  2965. /*:311*//*313:*/
  2966. #line 7851 "./typica.w"
  2967. void GraphView::showF()
  2968. {
  2969. for(int i= 0;i<gridLinesF->size();i++)
  2970. {
  2971. gridLinesF->at(i)->show();
  2972. }
  2973. for(int i= 0;i<gridLinesC->size();i++)
  2974. {
  2975. gridLinesC->at(i)->hide();
  2976. }
  2977. }
  2978. void GraphView::showC()
  2979. {
  2980. for(int i= 0;i<gridLinesF->size();i++)
  2981. {
  2982. gridLinesF->at(i)->hide();
  2983. }
  2984. for(int i= 0;i<gridLinesC->size();i++)
  2985. {
  2986. gridLinesC->at(i)->show();
  2987. }
  2988. }
  2989. /*:313*//*315:*/
  2990. #line 7900 "./typica.w"
  2991. void GraphView::resizeEvent(QResizeEvent*)
  2992. {
  2993. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2994. }
  2995. /*:315*//*316:*/
  2996. #line 7911 "./typica.w"
  2997. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  2998. {
  2999. double offset= 0;
  3000. if(translations->contains(tempcolumn))
  3001. {
  3002. offset= translations->value(tempcolumn);
  3003. }
  3004. if(prevPoints->contains(tempcolumn))
  3005. {
  3006. /*318:*/
  3007. #line 7970 "./typica.w"
  3008. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3009. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3010. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3011. -(prevPoints->value(tempcolumn).y()),
  3012. nextPoint.x()+offset,-(nextPoint.y()));
  3013. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3014. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3015. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3016. Qt::darkYellow};
  3017. segment->setPen(p[tempcolumn%12]);
  3018. theScene->addItem(segment);
  3019. prevPoints->insert(tempcolumn,nextPoint);
  3020. /*:318*/
  3021. #line 7921 "./typica.w"
  3022. if(graphLines->contains(tempcolumn))
  3023. {
  3024. graphLines->value(tempcolumn)->append(segment);
  3025. }
  3026. else
  3027. {
  3028. QList<QGraphicsLineItem*> *newLine=
  3029. new QList<QGraphicsLineItem*> ;
  3030. newLine->append(segment);
  3031. graphLines->insert(tempcolumn,newLine);
  3032. }
  3033. }
  3034. else
  3035. {
  3036. /*317:*/
  3037. #line 7959 "./typica.w"
  3038. int x= FULLTIMETOINT(measure.time())/1000;
  3039. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3040. /*:317*/
  3041. #line 7938 "./typica.w"
  3042. }
  3043. }
  3044. /*:316*//*319:*/
  3045. #line 7987 "./typica.w"
  3046. void GraphView::clear()
  3047. {
  3048. int i;
  3049. foreach(i,prevPoints->keys())
  3050. {
  3051. removeSeries(i);
  3052. }
  3053. translations->clear();
  3054. }
  3055. /*:319*//*320:*/
  3056. #line 8001 "./typica.w"
  3057. void GraphView::removeSeries(int column)
  3058. {
  3059. if(graphLines->contains(column))
  3060. {
  3061. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3062. QGraphicsLineItem*segment;
  3063. foreach(segment,*series)
  3064. {
  3065. theScene->removeItem(segment);
  3066. }
  3067. qDeleteAll(*series);
  3068. }
  3069. graphLines->remove(column);
  3070. prevPoints->remove(column);
  3071. }
  3072. /*:320*//*321:*/
  3073. #line 8020 "./typica.w"
  3074. void GraphView::setSeriesTranslation(int column,double offset)
  3075. {
  3076. if(graphLines->contains(column))
  3077. {
  3078. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3079. QGraphicsLineItem*segment;
  3080. foreach(segment,*series)
  3081. {
  3082. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3083. }
  3084. }
  3085. if(translations->contains(column))
  3086. {
  3087. translations->insert(column,offset+translations->value(column));
  3088. }
  3089. else
  3090. {
  3091. translations->insert(column,offset);
  3092. }
  3093. }
  3094. /*:321*/
  3095. #line 774 "./typica.w"
  3096. /*327:*/
  3097. #line 8170 "./typica.w"
  3098. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3099. {
  3100. /*329:*/
  3101. #line 8241 "./typica.w"
  3102. if(lastMeasurement[tempcolumn].time()<measure.time()
  3103. {
  3104. QList<QTime> timelist;
  3105. for(QTime i= lastMeasurement[tempcolumn].addSecs(1);i<measure.time();i= i.addSecs(1))
  3106. {
  3107. timelist.append(i);
  3108. }
  3109. for(int i= 0;i<timelist.size();i++)
  3110. {
  3111. newMeasurement(Measurement(measure.temperature(),timelist[i],measure.scale()),tempcolumn);
  3112. }
  3113. }
  3114. /*:329*/
  3115. #line 8173 "./typica.w"
  3116. model_ms->newMeasurement(measure,tempcolumn);
  3117. if(lastMeasurement.contains(tempcolumn))
  3118. {
  3119. if(measure.time().second()!=
  3120. lastMeasurement.value(tempcolumn).time().second())
  3121. {
  3122. Measurement adjusted(measure.temperature(),
  3123. QTime(0,measure.time().minute(),
  3124. measure.time().second(),0));
  3125. model_1s->newMeasurement(adjusted,tempcolumn);
  3126. if(adjusted.time().second()%5==0)
  3127. {
  3128. model_5s->newMeasurement(adjusted,tempcolumn);
  3129. if(adjusted.time().second()%10==0)
  3130. {
  3131. model_10s->newMeasurement(adjusted,tempcolumn);
  3132. }
  3133. if(adjusted.time().second()%15==0)
  3134. {
  3135. model_15s->newMeasurement(adjusted,tempcolumn);
  3136. if(adjusted.time().second()%30==0)
  3137. {
  3138. model_30s->newMeasurement(adjusted,tempcolumn);
  3139. if(adjusted.time().second()==0)
  3140. {
  3141. model_1m->newMeasurement(adjusted,tempcolumn);
  3142. }
  3143. }
  3144. }
  3145. }
  3146. }
  3147. /*331:*/
  3148. #line 8280 "./typica.w"
  3149. if(currentColumnSet.contains(tempcolumn))
  3150. {
  3151. int replicationcolumn;
  3152. foreach(replicationcolumn,currentColumnSet)
  3153. {
  3154. if(replicationcolumn!=tempcolumn)
  3155. {
  3156. if(lastMeasurement.contains(replicationcolumn))
  3157. {
  3158. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3159. {
  3160. Measurement synthetic(lastMeasurement.value(replicationcolumn).temperature(),
  3161. measure.time());
  3162. model_ms->newMeasurement(synthetic,replicationcolumn);
  3163. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3164. {
  3165. Measurement adjusted(synthetic.temperature(),QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3166. model_1s->newMeasurement(adjusted,replicationcolumn);
  3167. if(adjusted.time().second()%5==0)
  3168. {
  3169. model_5s->newMeasurement(adjusted,replicationcolumn);
  3170. if(adjusted.time().second()%10==0)
  3171. {
  3172. model_10s->newMeasurement(adjusted,replicationcolumn);
  3173. }
  3174. if(adjusted.time().second()%15==0)
  3175. {
  3176. model_15s->newMeasurement(adjusted,replicationcolumn);
  3177. if(adjusted.time().second()%30==0)
  3178. {
  3179. model_30s->newMeasurement(adjusted,replicationcolumn);
  3180. if(adjusted.time().second()==0)
  3181. {
  3182. model_1m->newMeasurement(adjusted,replicationcolumn);
  3183. }
  3184. }
  3185. }
  3186. }
  3187. }
  3188. lastMeasurement[replicationcolumn]= synthetic;
  3189. }
  3190. }
  3191. }
  3192. }
  3193. }
  3194. /*:331*/
  3195. #line 8205 "./typica.w"
  3196. }
  3197. else
  3198. {
  3199. /*328:*/
  3200. #line 8217 "./typica.w"
  3201. MeasurementModel*m;
  3202. foreach(m,modelSet)
  3203. {
  3204. m->newMeasurement(measure,tempcolumn);
  3205. }
  3206. /*:328*/
  3207. #line 8209 "./typica.w"
  3208. }
  3209. lastMeasurement[tempcolumn]= measure;
  3210. }
  3211. /*:327*//*330:*/
  3212. #line 8266 "./typica.w"
  3213. void ZoomLog::addToCurrentColumnSet(int column)
  3214. {
  3215. currentColumnSet.append(column);
  3216. }
  3217. void ZoomLog::clearCurrentColumnSet()
  3218. {
  3219. currentColumnSet.clear();
  3220. }
  3221. /*:330*//*332:*/
  3222. #line 8349 "./typica.w"
  3223. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3224. int annotationcolumn)
  3225. {
  3226. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3227. MeasurementModel*m;
  3228. if(lastMeasurement.contains(tempcolumn))
  3229. {
  3230. foreach(m,modelSet)
  3231. {
  3232. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3233. }
  3234. }
  3235. foreach(m,modelSet)
  3236. {
  3237. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3238. }
  3239. }
  3240. /*:332*//*333:*/
  3241. #line 8373 "./typica.w"
  3242. void ZoomLog::centerOn(int row)
  3243. {
  3244. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  3245. }
  3246. /*:333*//*334:*/
  3247. #line 8383 "./typica.w"
  3248. void ZoomLog::clear()
  3249. {
  3250. MeasurementModel*m;
  3251. foreach(m,modelSet)
  3252. {
  3253. m->clear();
  3254. }
  3255. lastMeasurement.clear();
  3256. saveTempCols.clear();
  3257. saveNoteCols.clear();
  3258. }
  3259. /*:334*//*335:*/
  3260. #line 8400 "./typica.w"
  3261. QVariant ZoomLog::data(int row,int column)const
  3262. {
  3263. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  3264. Qt::DisplayRole);
  3265. }
  3266. int ZoomLog::rowCount()
  3267. {
  3268. return model_ms->rowCount();
  3269. }
  3270. /*:335*//*336:*/
  3271. #line 8423 "./typica.w"
  3272. bool ZoomLog::saveXML(QIODevice*device)
  3273. {
  3274. int prevUnits= model_ms->displayUnits();
  3275. if(prevUnits!=10144)
  3276. {
  3277. model_ms->setDisplayUnits(10144);
  3278. }
  3279. XMLOutput writer(model_ms,device,0);
  3280. int c;
  3281. foreach(c,saveTempCols)
  3282. {
  3283. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3284. toString(),c);
  3285. }
  3286. foreach(c,saveNoteCols)
  3287. {
  3288. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3289. toString(),c);
  3290. }
  3291. bool retval= writer.output();
  3292. if(prevUnits!=10144)
  3293. {
  3294. model_ms->setDisplayUnits(prevUnits);
  3295. }
  3296. return retval;
  3297. }
  3298. /*:336*//*337:*/
  3299. #line 8454 "./typica.w"
  3300. bool ZoomLog::saveCSV(QIODevice*device)
  3301. {
  3302. CSVOutput writer(currentModel,device,0);
  3303. int c;
  3304. foreach(c,saveTempCols)
  3305. {
  3306. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3307. toString(),c);
  3308. }
  3309. foreach(c,saveNoteCols)
  3310. {
  3311. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3312. toString(),c);
  3313. }
  3314. return writer.output();
  3315. }
  3316. /*:337*//*338:*/
  3317. #line 8478 "./typica.w"
  3318. void ZoomLog::switchLOD(MeasurementModel*m)
  3319. {
  3320. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  3321. setModel(m);
  3322. currentModel= m;
  3323. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3324. }
  3325. void ZoomLog::LOD_ms()
  3326. {
  3327. switchLOD(model_ms);
  3328. }
  3329. void ZoomLog::LOD_1s()
  3330. {
  3331. switchLOD(model_1s);
  3332. }
  3333. void ZoomLog::LOD_5s()
  3334. {
  3335. switchLOD(model_5s);
  3336. }
  3337. void ZoomLog::LOD_10s()
  3338. {
  3339. switchLOD(model_10s);
  3340. }
  3341. void ZoomLog::LOD_15s()
  3342. {
  3343. switchLOD(model_15s);
  3344. }
  3345. void ZoomLog::LOD_30s()
  3346. {
  3347. switchLOD(model_30s);
  3348. }
  3349. void ZoomLog::LOD_1m()
  3350. {
  3351. switchLOD(model_1m);
  3352. }
  3353. /*:338*//*339:*/
  3354. #line 8526 "./typica.w"
  3355. void ZoomLog::setDisplayUnits(int scale)
  3356. {
  3357. model_ms->setDisplayUnits(scale);
  3358. model_1s->setDisplayUnits(scale);
  3359. model_5s->setDisplayUnits(scale);
  3360. model_10s->setDisplayUnits(scale);
  3361. model_15s->setDisplayUnits(scale);
  3362. model_30s->setDisplayUnits(scale);
  3363. model_1m->setDisplayUnits(scale);
  3364. }
  3365. int ZoomLog::displayUnits()
  3366. {
  3367. return model_ms->displayUnits();
  3368. }
  3369. /*:339*//*340:*/
  3370. #line 8546 "./typica.w"
  3371. QString ZoomLog::lastTime(int series)
  3372. {
  3373. Measurement measure= lastMeasurement.value(series);
  3374. QTime time= measure.time();
  3375. return time.toString("h:mm:ss.zzz");
  3376. }
  3377. /*:340*//*341:*/
  3378. #line 8556 "./typica.w"
  3379. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  3380. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  3381. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  3382. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  3383. {
  3384. setEditTriggers(QAbstractItemView::NoEditTriggers);
  3385. setSelectionMode(QAbstractItemView::NoSelection);
  3386. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  3387. model_30s<<model_1m;
  3388. currentModel= model_30s;
  3389. setModel(currentModel);
  3390. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3391. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  3392. this,SLOT(persistColumnResize(int,int,int)));
  3393. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  3394. this,SLOT(restoreColumnWidths()));
  3395. }
  3396. /*:341*//*342:*/
  3397. #line 8579 "./typica.w"
  3398. void ZoomLog::setHeaderData(int section,QString text)
  3399. {
  3400. MeasurementModel*m;
  3401. foreach(m,modelSet)
  3402. {
  3403. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  3404. }
  3405. }
  3406. /*:342*//*343:*/
  3407. #line 8593 "./typica.w"
  3408. void ZoomLog::addOutputTemperatureColumn(int column)
  3409. {
  3410. saveTempCols.append(column);
  3411. }
  3412. void ZoomLog::addOutputAnnotationColumn(int column)
  3413. {
  3414. saveNoteCols.append(column);
  3415. }
  3416. void ZoomLog::clearOutputColumns()
  3417. {
  3418. saveTempCols.clear();
  3419. saveNoteCols.clear();
  3420. }
  3421. /*:343*//*344:*/
  3422. #line 8613 "./typica.w"
  3423. void ZoomLog::persistColumnResize(int column,int,int newsize)
  3424. {
  3425. /*534:*/
  3426. #line 12591 "./typica.w"
  3427. QSettings settings;
  3428. /*535:*/
  3429. #line 12604 "./typica.w"
  3430. QWidget*topLevelWidget= this;
  3431. while(topLevelWidget->parentWidget())
  3432. {
  3433. topLevelWidget= topLevelWidget->parentWidget();
  3434. }
  3435. /*:535*/
  3436. #line 12593 "./typica.w"
  3437. settings.setValue(QString("columnWidths/%1/%2/%3").
  3438. arg(topLevelWidget->objectName()).
  3439. arg(objectName()).arg(column),
  3440. QVariant(newsize));
  3441. /*:534*/
  3442. #line 8616 "./typica.w"
  3443. }
  3444. void ZoomLog::restoreColumnWidths()
  3445. {
  3446. /*537:*/
  3447. #line 12624 "./typica.w"
  3448. QSettings settings;
  3449. /*535:*/
  3450. #line 12604 "./typica.w"
  3451. QWidget*topLevelWidget= this;
  3452. while(topLevelWidget->parentWidget())
  3453. {
  3454. topLevelWidget= topLevelWidget->parentWidget();
  3455. }
  3456. /*:535*/
  3457. #line 12626 "./typica.w"
  3458. QString baseKey=
  3459. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3460. arg(objectName());
  3461. for(int i= 0;i<model()->columnCount();i++)
  3462. {
  3463. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3464. if(settings.contains(key))
  3465. {
  3466. setColumnWidth(i,settings.value(key).toInt());
  3467. }
  3468. }
  3469. /*:537*/
  3470. #line 8621 "./typica.w"
  3471. }
  3472. void ZoomLog::setVisible(bool visibility)
  3473. {
  3474. QTableView::setVisible(visibility);
  3475. }
  3476. void ZoomLog::showEvent(QShowEvent*)
  3477. {
  3478. /*537:*/
  3479. #line 12624 "./typica.w"
  3480. QSettings settings;
  3481. /*535:*/
  3482. #line 12604 "./typica.w"
  3483. QWidget*topLevelWidget= this;
  3484. while(topLevelWidget->parentWidget())
  3485. {
  3486. topLevelWidget= topLevelWidget->parentWidget();
  3487. }
  3488. /*:535*/
  3489. #line 12626 "./typica.w"
  3490. QString baseKey=
  3491. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3492. arg(objectName());
  3493. for(int i= 0;i<model()->columnCount();i++)
  3494. {
  3495. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3496. if(settings.contains(key))
  3497. {
  3498. setColumnWidth(i,settings.value(key).toInt());
  3499. }
  3500. }
  3501. /*:537*/
  3502. #line 8631 "./typica.w"
  3503. }
  3504. /*:344*/
  3505. #line 775 "./typica.w"
  3506. /*352:*/
  3507. #line 8853 "./typica.w"
  3508. bool MeasurementList::operator<(const MeasurementList&other)const
  3509. {
  3510. return this->first().toTime()<other.first().toTime();
  3511. }
  3512. bool MeasurementList::operator==(const MeasurementList&other)const
  3513. {
  3514. return this->first().toTime()==other.first().toTime();
  3515. }
  3516. /*:352*//*353:*/
  3517. #line 8869 "./typica.w"
  3518. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  3519. {
  3520. return QModelIndex();
  3521. }
  3522. /*:353*//*354:*/
  3523. #line 8879 "./typica.w"
  3524. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  3525. {
  3526. MeasurementList*temp;
  3527. temp= new MeasurementList;
  3528. temp->append(QVariant(measure.time()));
  3529. /*355:*/
  3530. #line 8930 "./typica.w"
  3531. /*356:*/
  3532. #line 8975 "./typica.w"
  3533. QList<MeasurementList*> ::iterator i= lastInsertion;
  3534. bool quickscan= false;
  3535. if(entries->size()> 5)
  3536. {
  3537. if(**i<*temp)
  3538. {
  3539. i+= 1;
  3540. for(int j= 10;j> 0;j--)
  3541. {
  3542. if(i!=entries->end())
  3543. {
  3544. if(**i<*temp)
  3545. {
  3546. i+= 1;
  3547. }
  3548. else
  3549. {
  3550. quickscan= true;
  3551. break;
  3552. }
  3553. }
  3554. else
  3555. {
  3556. quickscan= true;
  3557. break;
  3558. }
  3559. }
  3560. }
  3561. else
  3562. {
  3563. if(**i==*temp)
  3564. {
  3565. quickscan= true;
  3566. }
  3567. }
  3568. }
  3569. /*:356*/
  3570. #line 8931 "./typica.w"
  3571. if(quickscan==false)
  3572. {
  3573. i= entries->begin();
  3574. QList<MeasurementList*> ::iterator u= entries->end();
  3575. QList<MeasurementList*> ::iterator midpoint;
  3576. int n= u-i;
  3577. int rA;
  3578. while(n> 0)
  3579. {
  3580. rA= n>>1;
  3581. midpoint= i+rA;
  3582. if(**midpoint<*temp)
  3583. {
  3584. i= midpoint+1;
  3585. n-= rA+1;
  3586. }
  3587. else
  3588. {
  3589. n= rA;
  3590. }
  3591. }
  3592. }
  3593. /*:355*/
  3594. #line 8885 "./typica.w"
  3595. MeasurementList*newEntry;
  3596. int insertion;
  3597. if(i!=entries->end())
  3598. {
  3599. insertion= entries->indexOf(*i);
  3600. if((*i)->first().toTime()==measure.time())
  3601. {
  3602. /*357:*/
  3603. #line 9017 "./typica.w"
  3604. if((*i)->size()<tempcolumn+1)
  3605. {
  3606. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  3607. {
  3608. (*i)->append(QVariant());
  3609. }
  3610. }
  3611. (*i)->replace(tempcolumn,measure.temperature());
  3612. lastInsertion= i;
  3613. emit dataChanged(createIndex(insertion,tempcolumn),
  3614. createIndex(insertion,tempcolumn));
  3615. lastTemperature->insert(tempcolumn,insertion);
  3616. /*:357*/
  3617. #line 8893 "./typica.w"
  3618. }
  3619. else
  3620. {
  3621. /*358:*/
  3622. #line 9035 "./typica.w"
  3623. beginInsertRows(QModelIndex(),insertion,insertion);
  3624. newEntry= new MeasurementList;
  3625. newEntry->append(QVariant(measure.time()));
  3626. for(int j= 0;j<tempcolumn+1;j++)
  3627. {
  3628. newEntry->append(QVariant());
  3629. }
  3630. newEntry->replace(tempcolumn,measure.temperature());
  3631. lastInsertion= entries->insert(i,newEntry);
  3632. endInsertRows();
  3633. lastTemperature->insert(tempcolumn,insertion);
  3634. /*:358*/
  3635. #line 8897 "./typica.w"
  3636. }
  3637. }
  3638. else
  3639. {
  3640. /*359:*/
  3641. #line 9053 "./typica.w"
  3642. insertion= entries->size();
  3643. /*358:*/
  3644. #line 9035 "./typica.w"
  3645. beginInsertRows(QModelIndex(),insertion,insertion);
  3646. newEntry= new MeasurementList;
  3647. newEntry->append(QVariant(measure.time()));
  3648. for(int j= 0;j<tempcolumn+1;j++)
  3649. {
  3650. newEntry->append(QVariant());
  3651. }
  3652. newEntry->replace(tempcolumn,measure.temperature());
  3653. lastInsertion= entries->insert(i,newEntry);
  3654. endInsertRows();
  3655. lastTemperature->insert(tempcolumn,insertion);
  3656. /*:358*/
  3657. #line 9055 "./typica.w"
  3658. /*:359*/
  3659. #line 8902 "./typica.w"
  3660. }
  3661. if(tempcolumn>=colcount)
  3662. {
  3663. colcount= tempcolumn+1;
  3664. }
  3665. emit rowChanged(insertion);
  3666. delete temp;
  3667. }
  3668. /*:354*//*360:*/
  3669. #line 9064 "./typica.w"
  3670. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  3671. int annotationColumn)
  3672. {
  3673. int r;
  3674. if(lastTemperature->contains(tempcolumn))
  3675. {
  3676. r= lastTemperature->value(tempcolumn);
  3677. }
  3678. else
  3679. {
  3680. r= 0;
  3681. }
  3682. if(r==0&&entries->size()==0)
  3683. {
  3684. /*361:*/
  3685. #line 9102 "./typica.w"
  3686. beginInsertRows(QModelIndex(),0,0);
  3687. MeasurementList*newEntry= new MeasurementList;
  3688. newEntry->append(QVariant(QTime(0,0,0,0)));
  3689. entries->append(newEntry);
  3690. endInsertRows();
  3691. /*:361*/
  3692. #line 9079 "./typica.w"
  3693. }
  3694. MeasurementList*row= entries->at(r);
  3695. if(row->size()<=annotationColumn)
  3696. {
  3697. for(int i= row->size()-1;i<annotationColumn+1;i++)
  3698. {
  3699. row->append(QVariant());
  3700. }
  3701. }
  3702. row->replace(annotationColumn,annotation);
  3703. emit dataChanged(createIndex(r,annotationColumn),
  3704. createIndex(r,annotationColumn));
  3705. emit rowChanged(r);
  3706. if(annotationColumn> colcount-1)
  3707. {
  3708. colcount= annotationColumn+1;
  3709. }
  3710. }
  3711. /*:360*//*362:*/
  3712. #line 9113 "./typica.w"
  3713. void MeasurementModel::clear()
  3714. {
  3715. beginRemoveRows(QModelIndex(),0,entries->size());
  3716. while(entries->size()!=0)
  3717. {
  3718. MeasurementList*row= entries->takeFirst();
  3719. delete row;
  3720. }
  3721. endRemoveRows();
  3722. colcount= hData->size();
  3723. lastTemperature->clear();
  3724. reset();
  3725. }
  3726. /*:362*//*363:*/
  3727. #line 9139 "./typica.w"
  3728. bool MeasurementModel::setData(const QModelIndex&index,
  3729. const QVariant&value,int role)
  3730. {
  3731. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  3732. {
  3733. return false;
  3734. }
  3735. /*364:*/
  3736. #line 9171 "./typica.w"
  3737. bool valid= false;
  3738. if(index.isValid())
  3739. {
  3740. if(index.row()<entries->size())
  3741. {
  3742. if(index.column()<colcount)
  3743. {
  3744. valid= true;
  3745. }
  3746. }
  3747. }
  3748. /*:364*/
  3749. #line 9147 "./typica.w"
  3750. if(!valid)
  3751. {
  3752. return false;
  3753. }
  3754. MeasurementList*row= entries->at(index.row());
  3755. if(index.column()>=row->size())
  3756. {
  3757. /*365:*/
  3758. #line 9188 "./typica.w"
  3759. for(int i= row->size()-1;i<index.column();i++)
  3760. {
  3761. row->append(QVariant());
  3762. }
  3763. /*:365*/
  3764. #line 9155 "./typica.w"
  3765. }
  3766. if(index.column()==0)
  3767. {
  3768. /*366:*/
  3769. #line 9203 "./typica.w"
  3770. QTime time;
  3771. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  3772. {
  3773. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  3774. {
  3775. return false;
  3776. }
  3777. }
  3778. row= entries->takeAt(index.row());
  3779. row->replace(index.column(),QVariant(time));
  3780. MeasurementList*temp= row;
  3781. /*355:*/
  3782. #line 8930 "./typica.w"
  3783. /*356:*/
  3784. #line 8975 "./typica.w"
  3785. QList<MeasurementList*> ::iterator i= lastInsertion;
  3786. bool quickscan= false;
  3787. if(entries->size()> 5)
  3788. {
  3789. if(**i<*temp)
  3790. {
  3791. i+= 1;
  3792. for(int j= 10;j> 0;j--)
  3793. {
  3794. if(i!=entries->end())
  3795. {
  3796. if(**i<*temp)
  3797. {
  3798. i+= 1;
  3799. }
  3800. else
  3801. {
  3802. quickscan= true;
  3803. break;
  3804. }
  3805. }
  3806. else
  3807. {
  3808. quickscan= true;
  3809. break;
  3810. }
  3811. }
  3812. }
  3813. else
  3814. {
  3815. if(**i==*temp)
  3816. {
  3817. quickscan= true;
  3818. }
  3819. }
  3820. }
  3821. /*:356*/
  3822. #line 8931 "./typica.w"
  3823. if(quickscan==false)
  3824. {
  3825. i= entries->begin();
  3826. QList<MeasurementList*> ::iterator u= entries->end();
  3827. QList<MeasurementList*> ::iterator midpoint;
  3828. int n= u-i;
  3829. int rA;
  3830. while(n> 0)
  3831. {
  3832. rA= n>>1;
  3833. midpoint= i+rA;
  3834. if(**midpoint<*temp)
  3835. {
  3836. i= midpoint+1;
  3837. n-= rA+1;
  3838. }
  3839. else
  3840. {
  3841. n= rA;
  3842. }
  3843. }
  3844. }
  3845. /*:355*/
  3846. #line 9215 "./typica.w"
  3847. entries->insert(i,row);
  3848. int newRow= entries->indexOf(*i);
  3849. if(newRow<index.row())
  3850. {
  3851. emit dataChanged(createIndex(newRow,index.column()),index);
  3852. }
  3853. else
  3854. {
  3855. emit dataChanged(index,createIndex(newRow,index.column()));
  3856. }
  3857. /*:366*/
  3858. #line 9159 "./typica.w"
  3859. }
  3860. else
  3861. {
  3862. /*367:*/
  3863. #line 9229 "./typica.w"
  3864. row->replace(index.column(),value);
  3865. emit dataChanged(index,index);
  3866. /*:367*/
  3867. #line 9163 "./typica.w"
  3868. }
  3869. return true;
  3870. }
  3871. /*:363*//*368:*/
  3872. #line 9237 "./typica.w"
  3873. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  3874. unit(Fahrenheit),hData(new QStringList),
  3875. lastTemperature(new QHash<int,int> )
  3876. {
  3877. colcount= 1;
  3878. entries= new QList<MeasurementList*> ;
  3879. lastInsertion= entries->begin();
  3880. hData->append(tr("Time"));
  3881. }
  3882. /*:368*//*369:*/
  3883. #line 9250 "./typica.w"
  3884. MeasurementModel::~MeasurementModel()
  3885. {
  3886. clear();
  3887. delete entries;
  3888. delete hData;
  3889. }
  3890. /*:369*//*370:*/
  3891. #line 9262 "./typica.w"
  3892. int MeasurementModel::rowCount(const QModelIndex&parent)const
  3893. {
  3894. if(parent==QModelIndex())
  3895. {
  3896. return entries->size();
  3897. }
  3898. return 0;
  3899. }
  3900. int MeasurementModel::columnCount(const QModelIndex&parent)const
  3901. {
  3902. if(parent==QModelIndex())
  3903. {
  3904. return colcount;
  3905. }
  3906. return 0;
  3907. }
  3908. /*:370*//*371:*/
  3909. #line 9289 "./typica.w"
  3910. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  3911. const QVariant&value,int)
  3912. {
  3913. if(orientation==Qt::Horizontal)
  3914. {
  3915. if(hData->size()<section+1)
  3916. {
  3917. for(int i= hData->size();i<section+1;i++)
  3918. {
  3919. if(colcount<i)
  3920. {
  3921. beginInsertColumns(QModelIndex(),i,i);
  3922. }
  3923. hData->append(QString());
  3924. if(colcount<i)
  3925. {
  3926. endInsertColumns();
  3927. }
  3928. }
  3929. }
  3930. hData->replace(section,value.toString());
  3931. emit headerDataChanged(orientation,section,section);
  3932. if(colcount<section+1)
  3933. {
  3934. colcount= section+1;
  3935. }
  3936. return true;
  3937. }
  3938. return false;
  3939. }
  3940. /*:371*//*372:*/
  3941. #line 9329 "./typica.w"
  3942. void MeasurementModel::setDisplayUnits(int scale)
  3943. {
  3944. beginResetModel();
  3945. unit= scale;
  3946. endResetModel();
  3947. }
  3948. int MeasurementModel::displayUnits()
  3949. {
  3950. return unit;
  3951. }
  3952. /*:372*//*373:*/
  3953. #line 9353 "./typica.w"
  3954. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  3955. {
  3956. /*364:*/
  3957. #line 9171 "./typica.w"
  3958. bool valid= false;
  3959. if(index.isValid())
  3960. {
  3961. if(index.row()<entries->size())
  3962. {
  3963. if(index.column()<colcount)
  3964. {
  3965. valid= true;
  3966. }
  3967. }
  3968. }
  3969. /*:364*/
  3970. #line 9356 "./typica.w"
  3971. if(!valid)
  3972. {
  3973. return QVariant();
  3974. }
  3975. if(role==Qt::DisplayRole||role==Qt::EditRole)
  3976. {
  3977. MeasurementList*row= entries->at(index.row());
  3978. if(index.column()> row->size())
  3979. {
  3980. return QVariant();
  3981. }
  3982. else
  3983. {
  3984. if(index.column()==0)
  3985. {
  3986. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  3987. }
  3988. else if(lastTemperature->contains(index.column()))
  3989. {
  3990. if(row->at(index.column()).toString().isEmpty())
  3991. {
  3992. return QVariant();
  3993. }
  3994. switch(unit)
  3995. {
  3996. case Auto:
  3997. case Fahrenheit:
  3998. return QVariant(row->at(index.column()).toString());
  3999. break;
  4000. case Celsius:
  4001. return QVariant((row->at(index.column()).toDouble()-
  4002. 32)*5/9);
  4003. break;
  4004. case Kelvin:
  4005. return QVariant((row->at(index.column()).toDouble()+
  4006. 459.67)*5/9);
  4007. break;
  4008. case Rankine:
  4009. return QVariant(row->at(index.column()).toDouble()+
  4010. 459.67);
  4011. break;
  4012. default:
  4013. break;
  4014. }
  4015. }
  4016. return QVariant(row->at(index.column()).toString());
  4017. }
  4018. }
  4019. return QVariant();
  4020. }
  4021. /*:373*//*374:*/
  4022. #line 9410 "./typica.w"
  4023. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4024. int role)const
  4025. {
  4026. if(orientation==Qt::Horizontal)
  4027. {
  4028. if(role==Qt::DisplayRole)
  4029. {
  4030. if(section<hData->size())
  4031. {
  4032. return QVariant(hData->at(section));
  4033. }
  4034. }
  4035. }
  4036. return QVariant();
  4037. }
  4038. /*:374*//*375:*/
  4039. #line 9437 "./typica.w"
  4040. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4041. {
  4042. /*364:*/
  4043. #line 9171 "./typica.w"
  4044. bool valid= false;
  4045. if(index.isValid())
  4046. {
  4047. if(index.row()<entries->size())
  4048. {
  4049. if(index.column()<colcount)
  4050. {
  4051. valid= true;
  4052. }
  4053. }
  4054. }
  4055. /*:364*/
  4056. #line 9440 "./typica.w"
  4057. if(valid)
  4058. {
  4059. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4060. }
  4061. return 0;
  4062. }
  4063. /*:375*//*376:*/
  4064. #line 9452 "./typica.w"
  4065. QModelIndex MeasurementModel::index(int row,int column,
  4066. const QModelIndex&parent)const
  4067. {
  4068. if(parent==QModelIndex())
  4069. {
  4070. if(row<entries->size()&&entries->isEmpty()==false)
  4071. {
  4072. if(column<entries->at(row)->size())
  4073. {
  4074. return createIndex(row,column);
  4075. }
  4076. }
  4077. }
  4078. return QModelIndex();
  4079. }
  4080. /*:376*/
  4081. #line 776 "./typica.w"
  4082. /*378:*/
  4083. #line 9503 "./typica.w"
  4084. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4085. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4086. {
  4087. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4088. }
  4089. /*:378*//*379:*/
  4090. #line 9518 "./typica.w"
  4091. void AnnotationButton::annotate()
  4092. {
  4093. if(note.contains("%1"))
  4094. {
  4095. count++;
  4096. emit annotation(note.arg(count),tc,ac);
  4097. }
  4098. else
  4099. {
  4100. emit annotation(note,tc,ac);
  4101. }
  4102. }
  4103. /*:379*//*380:*/
  4104. #line 9536 "./typica.w"
  4105. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4106. {
  4107. tc= tempcolumn;
  4108. }
  4109. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4110. {
  4111. ac= annotationcolumn;
  4112. }
  4113. void AnnotationButton::setAnnotation(const QString&annotation)
  4114. {
  4115. note= annotation;
  4116. }
  4117. /*:380*//*381:*/
  4118. #line 9555 "./typica.w"
  4119. void AnnotationButton::resetCount()
  4120. {
  4121. count= 0;
  4122. }
  4123. /*:381*/
  4124. #line 777 "./typica.w"
  4125. /*386:*/
  4126. #line 9638 "./typica.w"
  4127. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4128. const QString&postt,
  4129. QWidget*parent)
  4130. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4131. {
  4132. resetChange();
  4133. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4134. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4135. }
  4136. /*:386*//*387:*/
  4137. #line 9655 "./typica.w"
  4138. void AnnotationSpinBox::resetChange()
  4139. {
  4140. change= true;
  4141. }
  4142. /*:387*//*388:*/
  4143. #line 9666 "./typica.w"
  4144. void AnnotationSpinBox::annotate()
  4145. {
  4146. if(change)
  4147. {
  4148. change= false;
  4149. emit annotation(QString("%1%2%3").arg(pretext).
  4150. arg(value()).arg(posttext),tc,ac);
  4151. }
  4152. }
  4153. /*:388*//*389:*/
  4154. #line 9679 "./typica.w"
  4155. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4156. {
  4157. tc= tempcolumn;
  4158. }
  4159. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4160. {
  4161. ac= annotationcolumn;
  4162. }
  4163. void AnnotationSpinBox::setPretext(const QString&pret)
  4164. {
  4165. pretext= pret;
  4166. }
  4167. void AnnotationSpinBox::setPosttext(const QString&postt)
  4168. {
  4169. posttext= postt;
  4170. }
  4171. /*:389*/
  4172. #line 778 "./typica.w"
  4173. /*396:*/
  4174. #line 9847 "./typica.w"
  4175. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4176. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4177. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4178. stopAction(new QAction(tr("Stop"),NULL)),
  4179. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4180. relative(QTime::currentTime()),base(QTime(0,0,0))
  4181. {
  4182. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4183. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4184. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4185. clock.setInterval(500);
  4186. clock.setSingleShot(false);
  4187. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4188. setSegmentStyle(Filled);
  4189. updateDisplay();
  4190. }
  4191. /*:396*//*397:*/
  4192. #line 9868 "./typica.w"
  4193. void TimerDisplay::updateTime()
  4194. {
  4195. QTime time;
  4196. int cseconds= 0;
  4197. int oseconds= 0;
  4198. int r= 0;
  4199. QTime nt= QTime(0,0,0);
  4200. int n= 0;
  4201. int bseconds= 0;
  4202. switch(m)
  4203. {
  4204. case TimerDisplay::CountUp:
  4205. /*398:*/
  4206. #line 9900 "./typica.w"
  4207. /*399:*/
  4208. #line 9915 "./typica.w"
  4209. time= QTime::currentTime();
  4210. cseconds= TIMETOINT(time);
  4211. oseconds= TIMETOINT(relative);
  4212. r= cseconds-oseconds;
  4213. /*:399*/
  4214. #line 9901 "./typica.w"
  4215. nt= nt.addSecs(r);
  4216. if(nt!=s)
  4217. {
  4218. s= nt;
  4219. emit valueChanged(s);
  4220. }
  4221. /*:398*/
  4222. #line 9881 "./typica.w"
  4223. ;
  4224. break;
  4225. case TimerDisplay::CountDown:
  4226. /*400:*/
  4227. #line 9925 "./typica.w"
  4228. if(s> QTime(0,0,0))
  4229. {
  4230. /*399:*/
  4231. #line 9915 "./typica.w"
  4232. time= QTime::currentTime();
  4233. cseconds= TIMETOINT(time);
  4234. oseconds= TIMETOINT(relative);
  4235. r= cseconds-oseconds;
  4236. /*:399*/
  4237. #line 9928 "./typica.w"
  4238. bseconds= TIMETOINT(base);
  4239. n= bseconds-r;
  4240. nt= nt.addSecs(n);
  4241. if(nt!=s)
  4242. {
  4243. s= nt;
  4244. emit valueChanged(s);
  4245. }
  4246. }
  4247. /*:400*/
  4248. #line 9884 "./typica.w"
  4249. ;
  4250. break;
  4251. case TimerDisplay::Clock:
  4252. /*401:*/
  4253. #line 9942 "./typica.w"
  4254. time= QTime::currentTime();
  4255. if(time!=s)
  4256. {
  4257. s= time;
  4258. emit valueChanged(s);
  4259. }
  4260. /*:401*/
  4261. #line 9887 "./typica.w"
  4262. ;
  4263. break;
  4264. default:
  4265. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  4266. break;
  4267. }
  4268. updateDisplay();
  4269. }
  4270. /*:397*//*402:*/
  4271. #line 9956 "./typica.w"
  4272. void TimerDisplay::startTimer()
  4273. {
  4274. if(!running)
  4275. {
  4276. relative= QTime::currentTime();
  4277. if(ar)
  4278. {
  4279. reset();
  4280. }
  4281. else
  4282. {
  4283. relative= TIMESUBTRACT(relative,s);
  4284. }
  4285. if(m==Clock)
  4286. {
  4287. updateTime();
  4288. }
  4289. base= s;
  4290. clock.start();
  4291. running= true;
  4292. emit runStateChanged(true);
  4293. }
  4294. }
  4295. /*:402*//*403:*/
  4296. #line 9984 "./typica.w"
  4297. void TimerDisplay::stopTimer()
  4298. {
  4299. if(running)
  4300. {
  4301. clock.stop();
  4302. running= false;
  4303. emit runStateChanged(false);
  4304. }
  4305. }
  4306. /*:403*//*404:*/
  4307. #line 9997 "./typica.w"
  4308. TimerDisplay::~TimerDisplay()
  4309. {
  4310. clock.stop();
  4311. }
  4312. /*:404*//*405:*/
  4313. #line 10006 "./typica.w"
  4314. void TimerDisplay::setCountUpMode()
  4315. {
  4316. m= TimerDisplay::CountUp;
  4317. }
  4318. void TimerDisplay::setCountDownMode()
  4319. {
  4320. m= TimerDisplay::CountDown;
  4321. }
  4322. void TimerDisplay::setClockMode()
  4323. {
  4324. m= TimerDisplay::Clock;
  4325. }
  4326. /*:405*//*406:*/
  4327. #line 10024 "./typica.w"
  4328. QString TimerDisplay::value()
  4329. {
  4330. return s.toString(f);
  4331. }
  4332. QTime TimerDisplay::seconds()
  4333. {
  4334. return s;
  4335. }
  4336. TimerDisplay::TimerMode TimerDisplay::mode()
  4337. {
  4338. return m;
  4339. }
  4340. bool TimerDisplay::isRunning()
  4341. {
  4342. return running;
  4343. }
  4344. QTime TimerDisplay::resetValue()
  4345. {
  4346. return r;
  4347. }
  4348. QString TimerDisplay::displayFormat()
  4349. {
  4350. return f;
  4351. }
  4352. bool TimerDisplay::autoReset()
  4353. {
  4354. return ar;
  4355. }
  4356. /*:406*//*407:*/
  4357. #line 10062 "./typica.w"
  4358. void TimerDisplay::setTimer(QTime value)
  4359. {
  4360. if(value.isValid())
  4361. {
  4362. s= value;
  4363. updateDisplay();
  4364. emit valueChanged(value);
  4365. }
  4366. }
  4367. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  4368. {
  4369. m= mode;
  4370. }
  4371. void TimerDisplay::setResetValue(QTime value)
  4372. {
  4373. r= value;
  4374. }
  4375. void TimerDisplay::setDisplayFormat(QString format)
  4376. {
  4377. f= format;
  4378. setNumDigits(format.length());
  4379. }
  4380. void TimerDisplay::setAutoReset(bool reset)
  4381. {
  4382. ar= reset;
  4383. }
  4384. /*:407*//*408:*/
  4385. #line 10097 "./typica.w"
  4386. void TimerDisplay::copyTimer()
  4387. {
  4388. QApplication::clipboard()->setText(value());
  4389. }
  4390. /*:408*//*409:*/
  4391. #line 10106 "./typica.w"
  4392. void TimerDisplay::reset()
  4393. {
  4394. if(!running)
  4395. {
  4396. s= r;
  4397. updateDisplay();
  4398. }
  4399. }
  4400. /*:409*//*410:*/
  4401. #line 10119 "./typica.w"
  4402. void TimerDisplay::updateDisplay()
  4403. {
  4404. display(value());
  4405. }
  4406. /*:410*/
  4407. #line 779 "./typica.w"
  4408. /*416:*/
  4409. #line 10213 "./typica.w"
  4410. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  4411. {
  4412. int x= rect.x();
  4413. int y= rect.y();
  4414. QLayoutItem*item;
  4415. if(orientation==Qt::Horizontal)
  4416. {
  4417. /*417:*/
  4418. #line 10237 "./typica.w"
  4419. foreach(item,itemList)
  4420. {
  4421. int nextX= x+item->sizeHint().width()+spacing();
  4422. int right= x+item->sizeHint().width();
  4423. if(item==itemList.last())
  4424. {
  4425. right= rect.right();
  4426. }
  4427. int bottom= rect.bottom();
  4428. if(!testOnly)
  4429. {
  4430. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4431. }
  4432. x= nextX;
  4433. }
  4434. /*:417*/
  4435. #line 10221 "./typica.w"
  4436. }
  4437. else
  4438. {
  4439. /*418:*/
  4440. #line 10256 "./typica.w"
  4441. foreach(item,itemList)
  4442. {
  4443. int nextY= y+item->sizeHint().height()+spacing();
  4444. int bottom= y+item->sizeHint().height();
  4445. if(item==itemList.last())
  4446. {
  4447. bottom= rect.bottom();
  4448. }
  4449. int right= rect.right();
  4450. if(!testOnly)
  4451. {
  4452. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4453. }
  4454. y= nextY;
  4455. }
  4456. /*:418*/
  4457. #line 10225 "./typica.w"
  4458. }
  4459. return y;
  4460. }
  4461. /*:416*//*419:*/
  4462. #line 10280 "./typica.w"
  4463. QSize PackLayout::minimumSize()const
  4464. {
  4465. QSize size;
  4466. QLayoutItem*item;
  4467. foreach(item,itemList)
  4468. {
  4469. if(orientation==Qt::Horizontal)
  4470. {
  4471. size+= QSize(item->minimumSize().width(),0);
  4472. if(size.height()<item->minimumSize().height())
  4473. {
  4474. size.setHeight(item->minimumSize().height());
  4475. }
  4476. }
  4477. else
  4478. {
  4479. size+= QSize(0,item->minimumSize().height());
  4480. if(size.width()<item->minimumSize().width())
  4481. {
  4482. size.setWidth(item->minimumSize().width());
  4483. }
  4484. }
  4485. }
  4486. size+= QSize(2*margin(),2*margin());
  4487. return size;
  4488. }
  4489. /*:419*//*420:*/
  4490. #line 10312 "./typica.w"
  4491. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  4492. QLayout(parent)
  4493. {
  4494. setMargin(margin);
  4495. setSpacing(spacing);
  4496. setOrientation(Qt::Horizontal);
  4497. }
  4498. PackLayout::PackLayout(int spacing)
  4499. {
  4500. setSpacing(spacing);
  4501. setOrientation(Qt::Horizontal);
  4502. }
  4503. /*:420*//*421:*/
  4504. #line 10330 "./typica.w"
  4505. PackLayout::~PackLayout()
  4506. {
  4507. QLayoutItem*item;
  4508. while((item= takeAt(0)))
  4509. {
  4510. delete item;
  4511. }
  4512. }
  4513. /*:421*//*422:*/
  4514. #line 10344 "./typica.w"
  4515. QLayoutItem*PackLayout::takeAt(int index)
  4516. {
  4517. if(index>=0&&index<itemList.size())
  4518. {
  4519. return itemList.takeAt(index);
  4520. }
  4521. else
  4522. {
  4523. return NULL;
  4524. }
  4525. }
  4526. /*:422*//*423:*/
  4527. #line 10360 "./typica.w"
  4528. QLayoutItem*PackLayout::itemAt(int index)const
  4529. {
  4530. if(index>=0&&index<itemList.size())
  4531. {
  4532. return itemList.at(index);
  4533. }
  4534. else
  4535. {
  4536. return NULL;
  4537. }
  4538. }
  4539. /*:423*//*424:*/
  4540. #line 10383 "./typica.w"
  4541. void PackLayout::addItem(QLayoutItem*item)
  4542. {
  4543. itemList.append(item);
  4544. }
  4545. /*:424*//*425:*/
  4546. #line 10391 "./typica.w"
  4547. int PackLayout::count()const
  4548. {
  4549. return itemList.size();
  4550. }
  4551. /*:425*//*426:*/
  4552. #line 10403 "./typica.w"
  4553. Qt::Orientations PackLayout::expandingDirections()const
  4554. {
  4555. return Qt::Vertical|Qt::Horizontal;
  4556. }
  4557. bool PackLayout::hasHeightForWidth()const
  4558. {
  4559. return false;
  4560. }
  4561. int PackLayout::heightForWidth(int width)const
  4562. {
  4563. return doLayout(QRect(0,0,width,0),true);
  4564. }
  4565. void PackLayout::setGeometry(const QRect&rect)
  4566. {
  4567. QLayout::setGeometry(rect);
  4568. doLayout(rect,false);
  4569. }
  4570. QSize PackLayout::sizeHint()const
  4571. {
  4572. return minimumSize();
  4573. }
  4574. /*:426*//*427:*/
  4575. #line 10434 "./typica.w"
  4576. void PackLayout::setOrientation(Qt::Orientations direction)
  4577. {
  4578. orientation= direction;
  4579. doLayout(geometry(),false);
  4580. }
  4581. /*:427*/
  4582. #line 780 "./typica.w"
  4583. /*429:*/
  4584. #line 10473 "./typica.w"
  4585. SceneButton::SceneButton():QGraphicsScene()
  4586. {
  4587. }
  4588. SceneButton::~SceneButton()
  4589. {
  4590. }
  4591. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  4592. {
  4593. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  4594. }
  4595. /*:429*/
  4596. #line 781 "./typica.w"
  4597. /*431:*/
  4598. #line 10519 "./typica.w"
  4599. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  4600. Qt::Orientations orientation,
  4601. QWidget*parent,Qt::WindowFlags f):
  4602. QWidget(parent,f),label(new QGraphicsView()),
  4603. scene(new SceneButton())
  4604. {
  4605. layout= new PackLayout(this);
  4606. layout->setOrientation(orientation);
  4607. /*432:*/
  4608. #line 10539 "./typica.w"
  4609. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4610. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4611. label->setFrameShape(QFrame::NoFrame);
  4612. label->setInteractive(true);
  4613. /*:432*/
  4614. #line 10528 "./typica.w"
  4615. /*433:*/
  4616. #line 10550 "./typica.w"
  4617. scene->setBackgroundBrush(Qt::cyan);
  4618. text= scene->addText(labeltext);
  4619. if(orientation==Qt::Horizontal)
  4620. {
  4621. text->rotate(270.0);
  4622. }
  4623. label->setScene(scene);
  4624. /*:433*/
  4625. #line 10529 "./typica.w"
  4626. /*434:*/
  4627. #line 10568 "./typica.w"
  4628. if(orientation==Qt::Horizontal)
  4629. {
  4630. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  4631. }
  4632. else
  4633. {
  4634. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  4635. }
  4636. label->centerOn(text);
  4637. /*:434*/
  4638. #line 10530 "./typica.w"
  4639. /*435:*/
  4640. #line 10583 "./typica.w"
  4641. layout->addWidget(label);
  4642. layout->addWidget(widget);
  4643. if(orientation==Qt::Horizontal)
  4644. {
  4645. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  4646. widget->sizeHint().height());
  4647. }
  4648. else
  4649. {
  4650. setMinimumSize(widget->sizeHint().width(),
  4651. widget->sizeHint().height()+label->sizeHint().height());
  4652. }
  4653. /*:435*/
  4654. #line 10531 "./typica.w"
  4655. }
  4656. /*:431*//*436:*/
  4657. #line 10600 "./typica.w"
  4658. void WidgetDecorator::setBackgroundBrush(QBrush background)
  4659. {
  4660. scene->setBackgroundBrush(background);
  4661. }
  4662. void WidgetDecorator::setTextColor(QColor color)
  4663. {
  4664. text->setDefaultTextColor(color);
  4665. }
  4666. /*:436*//*437:*/
  4667. #line 10613 "./typica.w"
  4668. WidgetDecorator::~WidgetDecorator()
  4669. {
  4670. }
  4671. /*:437*/
  4672. #line 782 "./typica.w"
  4673. /*442:*/
  4674. #line 10712 "./typica.w"
  4675. void LogEditWindow::addTheRows()
  4676. {
  4677. QTime s= startTime->time();
  4678. while(s<endTime->time())
  4679. {
  4680. model->newMeasurement(Measurement(0,s),1);
  4681. s= s.addSecs(interval->value());
  4682. }
  4683. model->newMeasurement(Measurement(0,endTime->time()),1);
  4684. }
  4685. /*:442*//*443:*/
  4686. #line 10726 "./typica.w"
  4687. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  4688. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  4689. addRowsLayout(new QHBoxLayout(NULL)),
  4690. startTimeLabel(new QLabel("Start Time")),
  4691. startTime(new QTimeEdit(QTime(0,0,0,0))),
  4692. endTimeLabel(new QLabel("End Time")),
  4693. endTime(new QTimeEdit(QTime(0,20,0,0))),
  4694. intervalLabel(new QLabel("Interval (seconds)")),
  4695. interval(new QSpinBox()),
  4696. addRows(new QPushButton("Add Rows")),
  4697. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  4698. saveCsv(new QAction(tr("Export CSV"),NULL)),
  4699. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  4700. model(new MeasurementModel()),
  4701. log(new QTableView())
  4702. {
  4703. /*444:*/
  4704. #line 10763 "./typica.w"
  4705. QSettings settings;
  4706. resize(settings.value("logSize",QSize(620,400)).toSize());
  4707. move(settings.value("logPos",QPoint(200,60)).toPoint());
  4708. /*:444*/
  4709. #line 10743 "./typica.w"
  4710. /*445:*/
  4711. #line 10776 "./typica.w"
  4712. mainLayout->setOrientation(Qt::Vertical);
  4713. addRowsLayout->addSpacing(10);
  4714. addRowsLayout->addWidget(startTimeLabel);
  4715. addRowsLayout->addWidget(startTime);
  4716. addRowsLayout->addSpacing(10);
  4717. startTime->setDisplayFormat("mm:ss");
  4718. addRowsLayout->addWidget(endTimeLabel);
  4719. addRowsLayout->addWidget(endTime);
  4720. addRowsLayout->addSpacing(10);
  4721. endTime->setDisplayFormat("mm:ss");
  4722. addRowsLayout->addWidget(intervalLabel);
  4723. addRowsLayout->addWidget(interval);
  4724. addRowsLayout->addSpacing(10);
  4725. interval->setRange(0,60);
  4726. interval->setValue(30);
  4727. addRowsLayout->addWidget(addRows);
  4728. addRowsLayout->addSpacing(10);
  4729. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  4730. /*:445*/
  4731. #line 10744 "./typica.w"
  4732. /*446:*/
  4733. #line 10799 "./typica.w"
  4734. model->setHeaderData(0,Qt::Horizontal,"Time");
  4735. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  4736. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  4737. model->clear();
  4738. /*:446*/
  4739. #line 10745 "./typica.w"
  4740. /*447:*/
  4741. #line 10808 "./typica.w"
  4742. log->setModel(model);
  4743. log->setColumnWidth(0,100);
  4744. log->setColumnWidth(1,100);
  4745. log->setColumnWidth(2,100);
  4746. /*:447*/
  4747. #line 10746 "./typica.w"
  4748. mainLayout->addItem(addRowsLayout);
  4749. mainLayout->addWidget(log);
  4750. centralWidget->setLayout(mainLayout);
  4751. setCentralWidget(centralWidget);
  4752. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  4753. fileMenu->addAction(openXml);
  4754. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  4755. fileMenu->addAction(saveXml);
  4756. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  4757. fileMenu->addAction(saveCsv);
  4758. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  4759. }
  4760. /*:443*//*448:*/
  4761. #line 10819 "./typica.w"
  4762. void LogEditWindow::saveXML()
  4763. {
  4764. QSettings settings;
  4765. QString lastDir= settings.value("lastDirectory").toString();
  4766. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  4767. lastDir,"",0);
  4768. QFile file(filename);
  4769. XMLOutput writer(model,&file,0);
  4770. writer.addTemperatureColumn("Temperature",1);
  4771. writer.addAnnotationColumn("Annotation",2);
  4772. if(writer.output())
  4773. {
  4774. QFileInfo info(filename);
  4775. QDir directory= info.dir();
  4776. lastDir= directory.path();
  4777. settings.setValue("lastDirectory",lastDir);
  4778. }
  4779. }
  4780. void LogEditWindow::saveCSV()
  4781. {
  4782. QSettings settings;
  4783. QString lastDir= settings.value("lastDirectory").toString();
  4784. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  4785. lastDir,"",0);
  4786. QFile file(filename);
  4787. CSVOutput writer(model,&file,0);
  4788. writer.addTemperatureColumn("Temperature",1);
  4789. writer.addAnnotationColumn("Annotation",2);
  4790. if(writer.output())
  4791. {
  4792. QFileInfo info(filename);
  4793. QDir directory= info.dir();
  4794. lastDir= directory.path();
  4795. settings.setValue("lastDirectory",lastDir);
  4796. }
  4797. }
  4798. /*:448*//*449:*/
  4799. #line 10862 "./typica.w"
  4800. void LogEditWindow::openXML()
  4801. {
  4802. QSettings settings;
  4803. QString lastDir= settings.value("lastDirectory").toString();
  4804. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  4805. lastDir,"",0);
  4806. if(filename.isNull())
  4807. {
  4808. return;
  4809. }
  4810. QFile file(filename);
  4811. XMLInput reader(&file,1);
  4812. connect(&reader,SIGNAL(measure(Measurement,int)),
  4813. model,SLOT(newMeasurement(Measurement,int)));
  4814. connect(&reader,SIGNAL(annotation(QString,int,int)),
  4815. model,SLOT(newAnnotation(QString,int,int)));
  4816. if(reader.input())
  4817. {
  4818. QFileInfo info(filename);
  4819. setWindowTitle(QString(tr("%1 - %2")).
  4820. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  4821. QDir directory= info.dir();
  4822. lastDir= directory.path();
  4823. settings.setValue("lastDirectory",lastDir);
  4824. }
  4825. }
  4826. /*:449*//*450:*/
  4827. #line 10893 "./typica.w"
  4828. void LogEditWindow::closeEvent(QCloseEvent*event)
  4829. {
  4830. QSettings settings;
  4831. settings.setValue("logSize",size());
  4832. settings.setValue("logPos",pos());
  4833. event->accept();
  4834. }
  4835. /*:450*/
  4836. #line 783 "./typica.w"
  4837. /*456:*/
  4838. #line 11006 "./typica.w"
  4839. bool XMLOutput::output()
  4840. {
  4841. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  4842. {
  4843. return false;
  4844. }
  4845. QXmlStreamWriter xmlout(out);
  4846. xmlout.writeStartDocument("1.0");
  4847. xmlout.writeDTD("<!DOCTYPE roastlog2.0>");
  4848. xmlout.writeStartElement("roastlog");
  4849. /*457:*/
  4850. #line 11039 "./typica.w"
  4851. foreach(int c,temperatureColumns.keys())
  4852. {
  4853. xmlout.writeStartElement("tempseries");
  4854. xmlout.writeAttribute("name",temperatureColumns.value(c));
  4855. xmlout.writeEndElement();
  4856. }
  4857. foreach(int c,annotationColumns.keys())
  4858. {
  4859. xmlout.writeStartElement("noteseries");
  4860. xmlout.writeAttribute("name",annotationColumns.value(c));
  4861. xmlout.writeEndElement();
  4862. }
  4863. /*:457*/
  4864. #line 11017 "./typica.w"
  4865. xmlout.writeStartElement("roast");
  4866. bool oresult;
  4867. for(int i= 0;i<data->rowCount();i++)
  4868. {
  4869. /*458:*/
  4870. #line 11058 "./typica.w"
  4871. oresult= false;
  4872. foreach(int c,temperatureColumns.keys())
  4873. {
  4874. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4875. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4876. {
  4877. oresult= true;
  4878. break;
  4879. }
  4880. }
  4881. if(oresult==false)
  4882. {
  4883. foreach(int c,annotationColumns.keys())
  4884. {
  4885. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4886. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  4887. isEmpty()))
  4888. {
  4889. oresult= true;
  4890. break;
  4891. }
  4892. }
  4893. }
  4894. /*:458*/
  4895. #line 11022 "./typica.w"
  4896. if(oresult)
  4897. {
  4898. /*459:*/
  4899. #line 11088 "./typica.w"
  4900. xmlout.writeStartElement("tuple");
  4901. xmlout.writeTextElement("time",data->data(data->index(i,time),
  4902. Qt::DisplayRole).toString());
  4903. foreach(int c,temperatureColumns.keys())
  4904. {
  4905. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4906. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4907. {
  4908. xmlout.writeStartElement("temperature");
  4909. xmlout.writeAttribute("series",temperatureColumns.value(c));
  4910. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4911. toString());
  4912. xmlout.writeEndElement();
  4913. }
  4914. }
  4915. foreach(int c,annotationColumns.keys())
  4916. {
  4917. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4918. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4919. {
  4920. xmlout.writeStartElement("annotation");
  4921. xmlout.writeAttribute("series",annotationColumns.value(c));
  4922. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4923. toString());
  4924. xmlout.writeEndElement();
  4925. }
  4926. }
  4927. xmlout.writeEndElement();
  4928. /*:459*/
  4929. #line 11025 "./typica.w"
  4930. }
  4931. }
  4932. xmlout.writeEndElement();
  4933. xmlout.writeEndElement();
  4934. xmlout.writeEndDocument();
  4935. out->close();
  4936. return true;
  4937. }
  4938. /*:456*//*460:*/
  4939. #line 11120 "./typica.w"
  4940. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  4941. :QObject(NULL),data(model),out(device),time(timec)
  4942. {
  4943. }
  4944. void XMLOutput::setModel(MeasurementModel*model)
  4945. {
  4946. data= model;
  4947. }
  4948. void XMLOutput::setTimeColumn(int column)
  4949. {
  4950. time= column;
  4951. }
  4952. void XMLOutput::setDevice(QIODevice*device)
  4953. {
  4954. out= device;
  4955. }
  4956. /*:460*//*461:*/
  4957. #line 11149 "./typica.w"
  4958. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  4959. {
  4960. temperatureColumns.insert(column,series);
  4961. }
  4962. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  4963. {
  4964. annotationColumns.insert(column,series);
  4965. }
  4966. /*:461*/
  4967. #line 784 "./typica.w"
  4968. /*463:*/
  4969. #line 11201 "./typica.w"
  4970. bool XMLInput::input()
  4971. {
  4972. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  4973. {
  4974. return false;
  4975. }
  4976. QXmlStreamReader xmlin(in);
  4977. QMap<QString,int> temperatureColumns;
  4978. QMap<QString,int> annotationColumns;
  4979. int nextColumn= firstc;
  4980. /*464:*/
  4981. #line 11232 "./typica.w"
  4982. while(!xmlin.isDTD())
  4983. {
  4984. xmlin.readNext();
  4985. }
  4986. if(xmlin.isDTD())
  4987. {
  4988. if(xmlin.text()=="<!DOCTYPE roastlog>")
  4989. {
  4990. /*465:*/
  4991. #line 11254 "./typica.w"
  4992. emit newTemperatureColumn(firstc,"Bean");
  4993. emit newAnnotationColumn(firstc+1,"Note");
  4994. emit lastColumn(firstc+1);
  4995. /*:465*/
  4996. #line 11241 "./typica.w"
  4997. }
  4998. else
  4999. {
  5000. xmlin.readNext();
  5001. /*466:*/
  5002. #line 11263 "./typica.w"
  5003. while(xmlin.name()!="roast")
  5004. {
  5005. if(xmlin.isStartElement())
  5006. {
  5007. if(xmlin.name()=="tempseries")
  5008. {
  5009. temperatureColumns.insert(xmlin.attributes().value("name").
  5010. toString(),
  5011. nextColumn);
  5012. emit newTemperatureColumn(nextColumn,
  5013. xmlin.attributes().value("name").
  5014. toString());
  5015. nextColumn++;
  5016. }
  5017. else if(xmlin.name()=="noteseries")
  5018. {
  5019. annotationColumns.insert(xmlin.attributes().value("name").
  5020. toString(),nextColumn);
  5021. emit newAnnotationColumn(nextColumn,
  5022. xmlin.attributes().value("name").
  5023. toString());
  5024. nextColumn++;
  5025. }
  5026. }
  5027. xmlin.readNext();
  5028. }
  5029. emit lastColumn(nextColumn-1);
  5030. /*:466*/
  5031. #line 11246 "./typica.w"
  5032. }
  5033. }
  5034. /*:464*/
  5035. #line 11212 "./typica.w"
  5036. QTime timeval= QTime();
  5037. double tempval= 0;
  5038. QString noteval= QString();
  5039. int column;
  5040. int counter= 0;
  5041. while(!xmlin.atEnd())
  5042. {
  5043. /*467:*/
  5044. #line 11304 "./typica.w"
  5045. xmlin.readNext();
  5046. if(xmlin.isStartElement())
  5047. {
  5048. /*468:*/
  5049. #line 11330 "./typica.w"
  5050. if(xmlin.name()=="time")
  5051. {
  5052. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5053. }
  5054. else if(xmlin.name()=="temperature")
  5055. {
  5056. column= xmlin.attributes().value("series").toString().isEmpty()?
  5057. firstc:temperatureColumns.value(xmlin.attributes().
  5058. value("series").toString());
  5059. tempval= xmlin.readElementText().toDouble();
  5060. Measurement measurement(tempval,timeval);
  5061. emit measure(measurement,column);
  5062. }
  5063. else if(xmlin.name()=="annotation")
  5064. {
  5065. column= xmlin.attributes().value("series").toString().isEmpty()?
  5066. firstc+1:annotationColumns.value(xmlin.attributes().
  5067. value("series").toString());
  5068. noteval= xmlin.readElementText();
  5069. if(!noteval.isEmpty())
  5070. {
  5071. emit annotation(noteval,firstc,column);
  5072. }
  5073. }
  5074. /*:468*/
  5075. #line 11308 "./typica.w"
  5076. }
  5077. counter++;
  5078. if(counter%100==0)
  5079. {
  5080. QCoreApplication::processEvents();
  5081. }
  5082. /*:467*/
  5083. #line 11220 "./typica.w"
  5084. }
  5085. return true;
  5086. }
  5087. /*:463*//*469:*/
  5088. #line 11358 "./typica.w"
  5089. XMLInput::XMLInput(QIODevice*input,int c):
  5090. firstc(c),in(input)
  5091. {
  5092. }
  5093. void XMLInput::setFirstColumn(int column)
  5094. {
  5095. firstc= column;
  5096. }
  5097. void XMLInput::setDevice(QIODevice*device)
  5098. {
  5099. in= device;
  5100. }
  5101. /*:469*/
  5102. #line 785 "./typica.w"
  5103. /*474:*/
  5104. #line 11447 "./typica.w"
  5105. bool CSVOutput::output()
  5106. {
  5107. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5108. {
  5109. return false;
  5110. }
  5111. QTextStream output(out);
  5112. /*475:*/
  5113. #line 11471 "./typica.w"
  5114. output<<"Time";
  5115. foreach(int c,temperatureColumns.keys())
  5116. {
  5117. output<<','<<temperatureColumns.value(c);
  5118. }
  5119. foreach(int c,annotationColumns.keys())
  5120. {
  5121. output<<','<<annotationColumns.value(c);
  5122. }
  5123. output<<'\n';
  5124. /*:475*/
  5125. #line 11455 "./typica.w"
  5126. bool oresult;
  5127. for(int i= 0;i<data->rowCount();i++)
  5128. {
  5129. /*458:*/
  5130. #line 11058 "./typica.w"
  5131. oresult= false;
  5132. foreach(int c,temperatureColumns.keys())
  5133. {
  5134. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5135. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5136. {
  5137. oresult= true;
  5138. break;
  5139. }
  5140. }
  5141. if(oresult==false)
  5142. {
  5143. foreach(int c,annotationColumns.keys())
  5144. {
  5145. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5146. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5147. isEmpty()))
  5148. {
  5149. oresult= true;
  5150. break;
  5151. }
  5152. }
  5153. }
  5154. /*:458*/
  5155. #line 11459 "./typica.w"
  5156. if(oresult)
  5157. {
  5158. /*476:*/
  5159. #line 11492 "./typica.w"
  5160. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  5161. foreach(int c,temperatureColumns.keys())
  5162. {
  5163. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5164. }
  5165. foreach(int c,annotationColumns.keys())
  5166. {
  5167. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5168. }
  5169. output<<'\n';
  5170. /*:476*/
  5171. #line 11462 "./typica.w"
  5172. }
  5173. }
  5174. out->close();
  5175. return true;
  5176. }
  5177. /*:474*//*477:*/
  5178. #line 11507 "./typica.w"
  5179. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  5180. data(model),out(device),time(timec)
  5181. {
  5182. }
  5183. void CSVOutput::setModel(MeasurementModel*model)
  5184. {
  5185. data= model;
  5186. }
  5187. void CSVOutput::setTimeColumn(int column)
  5188. {
  5189. time= column;
  5190. }
  5191. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  5192. {
  5193. temperatureColumns.insert(column,series);
  5194. }
  5195. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  5196. {
  5197. annotationColumns.insert(column,series);
  5198. }
  5199. void CSVOutput::setDevice(QIODevice*device)
  5200. {
  5201. out= device;
  5202. }
  5203. /*:477*/
  5204. #line 786 "./typica.w"
  5205. /*496:*/
  5206. #line 11889 "./typica.w"
  5207. QString SaltModel::arrayLiteral(int column,int role)const
  5208. {
  5209. QString literal= "'{";
  5210. for(int i= 0;i<rowCount();i++)
  5211. {
  5212. QString datum= data(index(i,column),role).toString();
  5213. if(!datum.isEmpty())
  5214. {
  5215. literal.append(datum);
  5216. literal.append(", ");
  5217. }
  5218. }
  5219. if(literal.size()> 2)
  5220. {
  5221. literal.chop(2);
  5222. }
  5223. literal.append("}'");
  5224. return literal;
  5225. }
  5226. QString SaltModel::quotedArrayLiteral(int column,int role)const
  5227. {
  5228. QString literal= "'{";
  5229. for(int i= 0;i<rowCount();i++)
  5230. {
  5231. QString datum= data(index(i,column),role).toString();
  5232. if(!datum.isEmpty())
  5233. {
  5234. literal.append("\"");
  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. /*:496*//*497:*/
  5247. #line 11933 "./typica.w"
  5248. QModelIndex SaltModel::parent(const QModelIndex&)const
  5249. {
  5250. return QModelIndex();
  5251. }
  5252. /*:497*//*498:*/
  5253. #line 11952 "./typica.w"
  5254. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  5255. int role)
  5256. {
  5257. /*499:*/
  5258. #line 11983 "./typica.w"
  5259. bool valid= false;
  5260. if(index.isValid())
  5261. {
  5262. if(index.row()<modelData.size())
  5263. {
  5264. if(index.column()<colcount)
  5265. {
  5266. valid= true;
  5267. }
  5268. }
  5269. }
  5270. /*:499*/
  5271. #line 11956 "./typica.w"
  5272. if(!valid)
  5273. {
  5274. return false;
  5275. }
  5276. if(index.row()==modelData.size()-1)
  5277. {
  5278. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  5279. /*500:*/
  5280. #line 11999 "./typica.w"
  5281. QList<QMap<int,QVariant> > newRow;
  5282. QMap<int,QVariant> defaults;
  5283. for(int i= 0;i<colcount;i++)
  5284. {
  5285. newRow.append(defaults);
  5286. }
  5287. modelData.append(newRow);
  5288. /*:500*/
  5289. #line 11964 "./typica.w"
  5290. endInsertRows();
  5291. }
  5292. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5293. QMap<int,QVariant> cell= row.at(index.column());
  5294. cell.insert(role,value);
  5295. if(role==Qt::EditRole)
  5296. {
  5297. cell.insert(Qt::DisplayRole,value);
  5298. }
  5299. row.replace(index.column(),cell);
  5300. modelData.replace(index.row(),row);
  5301. emit dataChanged(index,index);
  5302. return true;
  5303. }
  5304. /*:498*//*501:*/
  5305. #line 12010 "./typica.w"
  5306. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  5307. {
  5308. for(int i= 0;i<columns;i++)
  5309. {
  5310. hData<<"";
  5311. }
  5312. /*500:*/
  5313. #line 11999 "./typica.w"
  5314. QList<QMap<int,QVariant> > newRow;
  5315. QMap<int,QVariant> defaults;
  5316. for(int i= 0;i<colcount;i++)
  5317. {
  5318. newRow.append(defaults);
  5319. }
  5320. modelData.append(newRow);
  5321. /*:500*/
  5322. #line 12017 "./typica.w"
  5323. }
  5324. /*:501*//*502:*/
  5325. #line 12022 "./typica.w"
  5326. SaltModel::~SaltModel()
  5327. {
  5328. }
  5329. /*:502*//*503:*/
  5330. #line 12032 "./typica.w"
  5331. int SaltModel::rowCount(const QModelIndex&parent)const
  5332. {
  5333. return(parent==QModelIndex()?modelData.size():0);
  5334. }
  5335. int SaltModel::columnCount(const QModelIndex&parent)const
  5336. {
  5337. return(parent==QModelIndex()?colcount:0);
  5338. }
  5339. /*:503*//*504:*/
  5340. #line 12045 "./typica.w"
  5341. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  5342. const QVariant&value,int)
  5343. {
  5344. if(orientation==Qt::Horizontal&&section<colcount)
  5345. {
  5346. hData.replace(section,value.toString());
  5347. emit headerDataChanged(orientation,section,section);
  5348. return true;
  5349. }
  5350. return false;
  5351. }
  5352. /*:504*//*505:*/
  5353. #line 12060 "./typica.w"
  5354. QVariant SaltModel::data(const QModelIndex&index,int role)const
  5355. {
  5356. /*499:*/
  5357. #line 11983 "./typica.w"
  5358. bool valid= false;
  5359. if(index.isValid())
  5360. {
  5361. if(index.row()<modelData.size())
  5362. {
  5363. if(index.column()<colcount)
  5364. {
  5365. valid= true;
  5366. }
  5367. }
  5368. }
  5369. /*:499*/
  5370. #line 12063 "./typica.w"
  5371. if(!valid)
  5372. {
  5373. return QVariant();
  5374. }
  5375. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5376. QMap<int,QVariant> cell= row.at(index.column());
  5377. return cell.value(role,QVariant());
  5378. }
  5379. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  5380. int role)const
  5381. {
  5382. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  5383. section<colcount)
  5384. {
  5385. return QVariant(hData.at(section));
  5386. }
  5387. return QVariant();
  5388. }
  5389. /*:505*//*506:*/
  5390. #line 12087 "./typica.w"
  5391. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  5392. {
  5393. /*499:*/
  5394. #line 11983 "./typica.w"
  5395. bool valid= false;
  5396. if(index.isValid())
  5397. {
  5398. if(index.row()<modelData.size())
  5399. {
  5400. if(index.column()<colcount)
  5401. {
  5402. valid= true;
  5403. }
  5404. }
  5405. }
  5406. /*:499*/
  5407. #line 12090 "./typica.w"
  5408. if(valid)
  5409. {
  5410. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5411. }
  5412. return 0;
  5413. }
  5414. /*:506*//*507:*/
  5415. #line 12101 "./typica.w"
  5416. QModelIndex SaltModel::index(int row,int column,
  5417. const QModelIndex&parent)const
  5418. {
  5419. if(parent==QModelIndex())
  5420. {
  5421. if(row<modelData.size()&&column<colcount)
  5422. {
  5423. return createIndex(row,column);
  5424. }
  5425. }
  5426. return QModelIndex();
  5427. }
  5428. /*:507*/
  5429. #line 787 "./typica.w"
  5430. /*509:*/
  5431. #line 12156 "./typica.w"
  5432. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  5433. {
  5434. SqlComboBox*widget= new SqlComboBox();
  5435. widget->setParent(parent);
  5436. for(int i= 0;i<count();i++)
  5437. {
  5438. widget->addItem(itemText(i),itemData(i));
  5439. }
  5440. return widget;
  5441. }
  5442. /*:509*//*510:*/
  5443. #line 12173 "./typica.w"
  5444. void SqlComboBox::showData(bool show)
  5445. {
  5446. dataColumnShown= show;
  5447. }
  5448. /*:510*//*511:*/
  5449. #line 12184 "./typica.w"
  5450. void SqlComboBox::addNullOption()
  5451. {
  5452. addItem(tr("Unknown"),QVariant(QVariant::String));
  5453. }
  5454. /*:511*//*512:*/
  5455. #line 12197 "./typica.w"
  5456. void SqlComboBox::setDataColumn(int column)
  5457. {
  5458. dataColumn= column;
  5459. }
  5460. void SqlComboBox::setDisplayColumn(int column)
  5461. {
  5462. displayColumn= column;
  5463. }
  5464. /*:512*//*513:*/
  5465. #line 12211 "./typica.w"
  5466. void SqlComboBox::addSqlOptions(QString query)
  5467. {
  5468. SqlQueryConnection*dbquery= new SqlQueryConnection;
  5469. if(!dbquery->exec(query))
  5470. {
  5471. QSqlError error= dbquery->lastError();
  5472. qDebug()<<error.databaseText();
  5473. qDebug()<<error.driverText();
  5474. qDebug()<<error.text();
  5475. qDebug()<<dbquery->lastQuery();
  5476. }
  5477. while(dbquery->next())
  5478. {
  5479. QString displayValue(dbquery->value(displayColumn).toString());
  5480. QString dataValue(dbquery->value(dataColumn).toString());
  5481. if(dataColumnShown)
  5482. {
  5483. displayValue.append(QString(" (%1)").arg(dataValue));
  5484. }
  5485. addItem(displayValue,dataValue);
  5486. }
  5487. delete dbquery;
  5488. }
  5489. /*:513*//*514:*/
  5490. #line 12240 "./typica.w"
  5491. SqlComboBox::SqlComboBox():
  5492. dataColumn(0),displayColumn(0),dataColumnShown(false)
  5493. {
  5494. }
  5495. SqlComboBox::~SqlComboBox()
  5496. {
  5497. }
  5498. /*:514*/
  5499. #line 788 "./typica.w"
  5500. /*516:*/
  5501. #line 12278 "./typica.w"
  5502. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  5503. {
  5504. delegate= widget;
  5505. }
  5506. /*:516*//*517:*/
  5507. #line 12287 "./typica.w"
  5508. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  5509. const QStyleOptionViewItem&,
  5510. const QModelIndex&)const
  5511. {
  5512. return delegate->clone(parent);
  5513. }
  5514. /*:517*//*518:*/
  5515. #line 12298 "./typica.w"
  5516. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  5517. const QModelIndex&index)const
  5518. {
  5519. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5520. self->setCurrentIndex(self->findData(
  5521. index.model()->data(index,
  5522. Qt::UserRole).toString()));
  5523. }
  5524. /*:518*//*519:*/
  5525. #line 12311 "./typica.w"
  5526. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  5527. QAbstractItemModel*model,
  5528. const QModelIndex&index)const
  5529. {
  5530. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5531. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  5532. Qt::UserRole);
  5533. model->setData(index,self->currentText(),Qt::DisplayRole);
  5534. }
  5535. /*:519*//*520:*/
  5536. #line 12324 "./typica.w"
  5537. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  5538. const QStyleOptionViewItem&option,
  5539. const QModelIndex&)const
  5540. {
  5541. editor->setGeometry(option.rect);
  5542. }
  5543. /*:520*//*521:*/
  5544. #line 12335 "./typica.w"
  5545. QSize SqlComboBoxDelegate::sizeHint()const
  5546. {
  5547. return delegate->sizeHint();
  5548. }
  5549. /*:521*//*522:*/
  5550. #line 12343 "./typica.w"
  5551. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  5552. :QItemDelegate(parent)
  5553. {
  5554. }
  5555. /*:522*/
  5556. #line 789 "./typica.w"
  5557. /*488:*/
  5558. #line 11703 "./typica.w"
  5559. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  5560. {
  5561. /*489:*/
  5562. #line 11718 "./typica.w"
  5563. setOrganizationName("Wilson's Coffee & Tea");
  5564. setOrganizationDomain("wilsonscoffee.com");
  5565. setApplicationName(PROGRAM_NAME);
  5566. /*:489*/
  5567. #line 11706 "./typica.w"
  5568. /*490:*/
  5569. #line 11727 "./typica.w"
  5570. QTranslator base;
  5571. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  5572. {
  5573. installTranslator(&base);
  5574. }
  5575. QTranslator app;
  5576. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  5577. {
  5578. installTranslator(&app);
  5579. }
  5580. /*:490*/
  5581. #line 11707 "./typica.w"
  5582. /*227:*/
  5583. #line 5730 "./typica.w"
  5584. qRegisterMetaType<Measurement> ("Measurement");
  5585. /*:227*/
  5586. #line 11708 "./typica.w"
  5587. /*667:*/
  5588. #line 15423 "./typica.w"
  5589. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  5590. tr("NI DAQmx Base"),
  5591. "nidaqmxbase",NULL);
  5592. topLevelNodeInserters.append(inserter);
  5593. /*:667*//*675:*/
  5594. #line 15640 "./typica.w"
  5595. #ifdef Q_OS_WIN32
  5596. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  5597. topLevelNodeInserters.append(inserter);
  5598. #endif
  5599. /*:675*//*699:*/
  5600. #line 16599 "./typica.w"
  5601. #if 0
  5602. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  5603. topLevelNodeInserters.append(inserter);
  5604. #endif
  5605. /*:699*//*728:*/
  5606. #line 18049 "./typica.w"
  5607. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  5608. topLevelNodeInserters.append(inserter);
  5609. /*:728*/
  5610. #line 11709 "./typica.w"
  5611. }
  5612. /*:488*//*492:*/
  5613. #line 11750 "./typica.w"
  5614. QDomDocument*Application::configuration()
  5615. {
  5616. return&conf;
  5617. }
  5618. /*:492*//*493:*/
  5619. #line 11759 "./typica.w"
  5620. QSqlDatabase Application::database()
  5621. {
  5622. QString connectionName;
  5623. QSqlDatabase connection= QSqlDatabase::database();
  5624. do
  5625. {
  5626. connectionName= QUuid::createUuid().toString();
  5627. }while(QSqlDatabase::connectionNames().contains(connectionName));
  5628. return QSqlDatabase::cloneDatabase(connection,connectionName);
  5629. }
  5630. /*:493*//*603:*/
  5631. #line 14078 "./typica.w"
  5632. void Application::saveDeviceConfiguration()
  5633. {
  5634. QSettings settings;
  5635. settings.setValue("DeviceConfiguration",
  5636. QVariant(deviceConfigurationDocument.toByteArray()));
  5637. }
  5638. /*:603*//*604:*/
  5639. #line 14090 "./typica.w"
  5640. QDomDocument Application::deviceConfiguration()
  5641. {
  5642. if(deviceConfigurationDocument.isNull())
  5643. {
  5644. /*605:*/
  5645. #line 14104 "./typica.w"
  5646. QSettings settings;
  5647. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  5648. QString etext;
  5649. int eline;
  5650. int ecol;
  5651. if(document.length()==0)
  5652. {
  5653. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  5654. /*606:*/
  5655. #line 14128 "./typica.w"
  5656. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5657. emptyDocument.open(QIODevice::ReadOnly);
  5658. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5659. &etext,&eline,&ecol))
  5660. {
  5661. /*607:*/
  5662. #line 14145 "./typica.w"
  5663. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5664. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5665. qDebug()<<etext;
  5666. /*:607*/
  5667. #line 14134 "./typica.w"
  5668. }
  5669. else
  5670. {
  5671. saveDeviceConfiguration();
  5672. }
  5673. /*:606*/
  5674. #line 14113 "./typica.w"
  5675. }
  5676. else
  5677. {
  5678. if(!deviceConfigurationDocument.setContent(document,false,
  5679. &etext,&eline,&ecol))
  5680. {
  5681. /*607:*/
  5682. #line 14145 "./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. /*:607*/
  5687. #line 14120 "./typica.w"
  5688. /*606:*/
  5689. #line 14128 "./typica.w"
  5690. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5691. emptyDocument.open(QIODevice::ReadOnly);
  5692. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5693. &etext,&eline,&ecol))
  5694. {
  5695. /*607:*/
  5696. #line 14145 "./typica.w"
  5697. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5698. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5699. qDebug()<<etext;
  5700. /*:607*/
  5701. #line 14134 "./typica.w"
  5702. }
  5703. else
  5704. {
  5705. saveDeviceConfiguration();
  5706. }
  5707. /*:606*/
  5708. #line 14121 "./typica.w"
  5709. }
  5710. }
  5711. /*:605*/
  5712. #line 14095 "./typica.w"
  5713. }
  5714. return deviceConfigurationDocument;
  5715. }
  5716. /*:604*//*635:*/
  5717. #line 14746 "./typica.w"
  5718. void Application::registerDeviceConfigurationWidget(QString driver,
  5719. QMetaObject widget)
  5720. {
  5721. deviceConfigurationWidgets.insert(driver,widget);
  5722. }
  5723. /*:635*//*636:*/
  5724. #line 14762 "./typica.w"
  5725. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  5726. const QModelIndex&index)
  5727. {
  5728. QVariant nodeReference= index.data(Qt::UserRole);
  5729. QDomElement referenceElement= model->referenceElement(
  5730. model->data(index,Qt::UserRole).toString());
  5731. QMetaObject metaObject=
  5732. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  5733. QWidget::staticMetaObject);
  5734. QWidget*editor;
  5735. if(metaObject.className()==QWidget::staticMetaObject.className())
  5736. {
  5737. editor= NULL;
  5738. }
  5739. else
  5740. {
  5741. editor= qobject_cast<QWidget*> (
  5742. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  5743. Q_ARG(QModelIndex,index)));
  5744. }
  5745. return editor;
  5746. }
  5747. /*:636*/
  5748. #line 790 "./typica.w"
  5749. /*527:*/
  5750. #line 12438 "./typica.w"
  5751. SqlConnectionSetup::SqlConnectionSetup():
  5752. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  5753. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  5754. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  5755. cancelButton(new QPushButton(tr("Cancel"))),
  5756. connectButton(new QPushButton(tr("Connect")))
  5757. {
  5758. driver->addItem("PostgreSQL","QPSQL");
  5759. formLayout->addRow(tr("Database driver:"),driver);
  5760. formLayout->addRow(tr("Host name:"),hostname);
  5761. formLayout->addRow(tr("Database name:"),dbname);
  5762. formLayout->addRow(tr("User name:"),user);
  5763. password->setEchoMode(QLineEdit::Password);
  5764. formLayout->addRow(tr("Password:"),password);
  5765. layout->addLayout(formLayout);
  5766. buttons->addStretch(1);
  5767. buttons->addWidget(cancelButton);
  5768. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  5769. buttons->addWidget(connectButton);
  5770. layout->addLayout(buttons);
  5771. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  5772. setLayout(layout);
  5773. setModal(true);
  5774. }
  5775. SqlConnectionSetup::~SqlConnectionSetup()
  5776. {
  5777. }
  5778. /*:527*//*528:*/
  5779. #line 12472 "./typica.w"
  5780. void SqlConnectionSetup::testConnection()
  5781. {
  5782. QSqlDatabase database=
  5783. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  5784. toString());
  5785. database.setHostName(hostname->text());
  5786. database.setDatabaseName(dbname->text());
  5787. database.setUserName(user->text());
  5788. database.setPassword(password->text());
  5789. if(database.open())
  5790. {
  5791. QSettings settings;
  5792. settings.setValue("database/exists","true");
  5793. settings.setValue("database/driver",
  5794. driver->itemData(driver->currentIndex()).toString());
  5795. settings.setValue("database/hostname",hostname->text());
  5796. settings.setValue("database/dbname",dbname->text());
  5797. settings.setValue("database/user",user->text());
  5798. settings.setValue("database/password",password->text());
  5799. accept();
  5800. }
  5801. else
  5802. {
  5803. QMessageBox::information(this,tr("Database connection failed"),
  5804. tr("Failed to connect to database."));
  5805. }
  5806. }
  5807. /*:528*/
  5808. #line 791 "./typica.w"
  5809. /*532:*/
  5810. #line 12567 "./typica.w"
  5811. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  5812. {
  5813. setModel(new QSqlQueryModel);
  5814. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  5815. this,SLOT(openRow(QModelIndex)));
  5816. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  5817. this,SLOT(persistColumnResize(int,int,int)));
  5818. }
  5819. /*:532*//*533:*/
  5820. #line 12582 "./typica.w"
  5821. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  5822. {
  5823. /*534:*/
  5824. #line 12591 "./typica.w"
  5825. QSettings settings;
  5826. /*535:*/
  5827. #line 12604 "./typica.w"
  5828. QWidget*topLevelWidget= this;
  5829. while(topLevelWidget->parentWidget())
  5830. {
  5831. topLevelWidget= topLevelWidget->parentWidget();
  5832. }
  5833. /*:535*/
  5834. #line 12593 "./typica.w"
  5835. settings.setValue(QString("columnWidths/%1/%2/%3").
  5836. arg(topLevelWidget->objectName()).
  5837. arg(objectName()).arg(column),
  5838. QVariant(newsize));
  5839. /*:534*/
  5840. #line 12585 "./typica.w"
  5841. }
  5842. /*:533*//*536:*/
  5843. #line 12614 "./typica.w"
  5844. void SqlQueryView::showEvent(QShowEvent*event)
  5845. {
  5846. /*537:*/
  5847. #line 12624 "./typica.w"
  5848. QSettings settings;
  5849. /*535:*/
  5850. #line 12604 "./typica.w"
  5851. QWidget*topLevelWidget= this;
  5852. while(topLevelWidget->parentWidget())
  5853. {
  5854. topLevelWidget= topLevelWidget->parentWidget();
  5855. }
  5856. /*:535*/
  5857. #line 12626 "./typica.w"
  5858. QString baseKey=
  5859. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5860. arg(objectName());
  5861. for(int i= 0;i<model()->columnCount();i++)
  5862. {
  5863. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5864. if(settings.contains(key))
  5865. {
  5866. setColumnWidth(i,settings.value(key).toInt());
  5867. }
  5868. }
  5869. /*:537*/
  5870. #line 12617 "./typica.w"
  5871. event->accept();
  5872. }
  5873. /*:536*//*538:*/
  5874. #line 12641 "./typica.w"
  5875. void SqlQueryView::openRow(const QModelIndex&index)
  5876. {
  5877. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  5878. emit openEntryRow(index.row());
  5879. }
  5880. /*:538*//*539:*/
  5881. #line 12652 "./typica.w"
  5882. void SqlQueryView::setQuery(const QString&query)
  5883. {
  5884. QSqlDatabase database= AppInstance->database();
  5885. database.open();
  5886. QSqlQuery q(query,database);
  5887. ((QSqlQueryModel*)model())->setQuery(q);
  5888. }
  5889. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  5890. const QVariant&value,int role)
  5891. {
  5892. return model()->setHeaderData(section,orientation,value,role);
  5893. }
  5894. /*:539*//*540:*/
  5895. #line 12669 "./typica.w"
  5896. QVariant SqlQueryView::data(int row,int column,int role)
  5897. {
  5898. return model()->data(model()->index(row,column),role);
  5899. }
  5900. /*:540*/
  5901. #line 792 "./typica.w"
  5902. /*136:*/
  5903. #line 3277 "./typica.w"
  5904. SqlQueryConnection::SqlQueryConnection(const QString&query)
  5905. {
  5906. QSqlDatabase database= AppInstance->database();
  5907. database.open();
  5908. q= new QSqlQuery(query,database);
  5909. connection= database.connectionName();
  5910. }
  5911. /*:136*//*137:*/
  5912. #line 3290 "./typica.w"
  5913. SqlQueryConnection::~SqlQueryConnection()
  5914. {
  5915. delete q;
  5916. {
  5917. QSqlDatabase database= QSqlDatabase::database(connection);
  5918. database.close();
  5919. }
  5920. QSqlDatabase::removeDatabase(connection);
  5921. }
  5922. /*:137*//*138:*/
  5923. #line 3304 "./typica.w"
  5924. QSqlQuery*SqlQueryConnection::operator->()
  5925. {
  5926. return q;
  5927. }
  5928. /*:138*/
  5929. #line 793 "./typica.w"
  5930. /*559:*/
  5931. #line 13018 "./typica.w"
  5932. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  5933. area(frame),configuration(description)
  5934. {
  5935. refresh();
  5936. }
  5937. ReportTable::~ReportTable()
  5938. {
  5939. }
  5940. /*:559*//*560:*/
  5941. #line 13034 "./typica.w"
  5942. void ReportTable::bind(QString placeholder,QVariant value)
  5943. {
  5944. bindings.insert(placeholder,value);
  5945. }
  5946. /*:560*//*561:*/
  5947. #line 13044 "./typica.w"
  5948. void ReportTable::refresh()
  5949. {
  5950. /*562:*/
  5951. #line 13065 "./typica.w"
  5952. QTextCursor cursor= area->firstCursorPosition();
  5953. while(cursor<area->lastCursorPosition())
  5954. {
  5955. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  5956. }
  5957. cursor.removeSelectedText();
  5958. /*:562*/
  5959. #line 13047 "./typica.w"
  5960. int rows= 1;
  5961. int columns= 1;
  5962. int currentRow= 0;
  5963. QTextTable*table= cursor.insertTable(rows,columns);
  5964. /*563:*/
  5965. #line 13078 "./typica.w"
  5966. QTextTableFormat format= table->format();
  5967. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  5968. if(configuration.hasAttribute("align"))
  5969. {
  5970. if(configuration.attribute("align")=="center")
  5971. {
  5972. format.setAlignment(Qt::AlignHCenter);
  5973. }
  5974. }
  5975. table->setFormat(format);
  5976. /*:563*/
  5977. #line 13052 "./typica.w"
  5978. /*564:*/
  5979. #line 13092 "./typica.w"
  5980. QDomNodeList children= configuration.childNodes();
  5981. for(int i= 0;i<children.count();i++)
  5982. {
  5983. QDomNode current;
  5984. QDomElement currentElement;
  5985. current= children.at(i);
  5986. if(current.isElement())
  5987. {
  5988. currentElement= current.toElement();
  5989. if(currentElement.tagName()=="query")
  5990. {
  5991. /*565:*/
  5992. #line 13119 "./typica.w"
  5993. SqlQueryConnection query;
  5994. query.prepare(currentElement.text());
  5995. foreach(QString key,bindings.uniqueKeys())
  5996. {
  5997. if(currentElement.text().contains(key))
  5998. {
  5999. query.bindValue(key,bindings.value(key));
  6000. }
  6001. }
  6002. query.exec();
  6003. if(!query.next())
  6004. {
  6005. continue;
  6006. }
  6007. if(query.record().count()> columns)
  6008. {
  6009. table->appendColumns(query.record().count()-columns);
  6010. }
  6011. do
  6012. {
  6013. table->appendRows(1);
  6014. rows++;
  6015. currentRow++;
  6016. for(int j= 0;j<query.record().count();j++)
  6017. {
  6018. QTextTableCell cell= table->cellAt(currentRow,j);
  6019. cursor= cell.firstCursorPosition();
  6020. cursor.insertText(query.value(j).toString());
  6021. }
  6022. }while(query.next());
  6023. /*:565*/
  6024. #line 13104 "./typica.w"
  6025. }
  6026. else if(currentElement.tagName()=="row")
  6027. {
  6028. /*566:*/
  6029. #line 13158 "./typica.w"
  6030. table->appendRows(1);
  6031. currentRow++;
  6032. rows++;
  6033. QDomNodeList rowChildren= currentElement.childNodes();
  6034. int currentColumn= 0;
  6035. for(int j= 0;j<rowChildren.count();j++)
  6036. {
  6037. QDomNode node;
  6038. QDomElement nodeElement;
  6039. node= rowChildren.at(j);
  6040. if(node.isElement())
  6041. {
  6042. nodeElement= node.toElement();
  6043. if(nodeElement.tagName()=="cell")
  6044. {
  6045. if(currentColumn==columns)
  6046. {
  6047. table->appendColumns(1);
  6048. columns++;
  6049. }
  6050. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  6051. cursor= cell.firstCursorPosition();
  6052. cursor.insertText(nodeElement.text());
  6053. currentColumn++;
  6054. }
  6055. }
  6056. }
  6057. /*:566*/
  6058. #line 13108 "./typica.w"
  6059. }
  6060. }
  6061. }
  6062. /*:564*/
  6063. #line 13053 "./typica.w"
  6064. if(rows> 1)
  6065. {
  6066. table->removeRows(0,1);
  6067. }
  6068. }
  6069. /*:561*/
  6070. #line 794 "./typica.w"
  6071. /*571:*/
  6072. #line 13260 "./typica.w"
  6073. FormArray::FormArray(QDomElement description):configuration(description),
  6074. maxwidth(-1),maxheight(-1)
  6075. {
  6076. setWidget(&itemContainer);
  6077. itemContainer.setLayout(&itemLayout);
  6078. }
  6079. /*:571*//*572:*/
  6080. #line 13277 "./typica.w"
  6081. void FormArray::addElements(int copies)
  6082. {
  6083. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  6084. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  6085. QWidget*widget;
  6086. for(int i= 0;i<copies;i++)
  6087. {
  6088. widget= new QWidget;
  6089. if(maxwidth> -1)
  6090. {
  6091. widget->setMaximumWidth(maxwidth);
  6092. }
  6093. if(maxheight> -1)
  6094. {
  6095. widget->setMaximumHeight(maxheight);
  6096. }
  6097. if(configuration.hasChildNodes())
  6098. {
  6099. widgetStack->push(widget);
  6100. populateWidget(configuration,widgetStack,layoutStack);
  6101. widgetStack->pop();
  6102. widget->setMinimumHeight(widget->sizeHint().height());
  6103. itemLayout.addWidget(widget);
  6104. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  6105. {
  6106. itemContainer.setMinimumHeight(maxheight*elements()+50);
  6107. }
  6108. else
  6109. {
  6110. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  6111. +widget->sizeHint().height());
  6112. }
  6113. if(maxwidth> -1)
  6114. {
  6115. itemContainer.setMinimumWidth(maxwidth+50);
  6116. }
  6117. else
  6118. {
  6119. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  6120. }
  6121. }
  6122. }
  6123. }
  6124. /*:572*//*573:*/
  6125. #line 13327 "./typica.w"
  6126. QWidget*FormArray::elementAt(int index)
  6127. {
  6128. if(index<itemLayout.count())
  6129. {
  6130. QLayoutItem*item= itemLayout.itemAt(index);
  6131. return item->widget();
  6132. }
  6133. else
  6134. {
  6135. return NULL;
  6136. }
  6137. }
  6138. /*:573*//*574:*/
  6139. #line 13344 "./typica.w"
  6140. void FormArray::removeAllElements()
  6141. {
  6142. while(itemLayout.count()> 0)
  6143. {
  6144. QLayoutItem*item;
  6145. item= itemLayout.itemAt(0);
  6146. item->widget()->hide();
  6147. itemLayout.removeWidget(item->widget());
  6148. }
  6149. itemContainer.setMinimumHeight(0);
  6150. }
  6151. /*:574*//*575:*/
  6152. #line 13360 "./typica.w"
  6153. int FormArray::elements()
  6154. {
  6155. return itemLayout.count();
  6156. }
  6157. /*:575*//*576:*/
  6158. #line 13371 "./typica.w"
  6159. void FormArray::setMaximumElementWidth(int width)
  6160. {
  6161. maxwidth= width;
  6162. }
  6163. void FormArray::setMaximumElementHeight(int height)
  6164. {
  6165. maxheight= height;
  6166. }
  6167. /*:576*/
  6168. #line 795 "./typica.w"
  6169. /*582:*/
  6170. #line 13502 "./typica.w"
  6171. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  6172. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  6173. {
  6174. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  6175. QPointF(0,5);
  6176. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  6177. QPointF(10,5);
  6178. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  6179. QPointF(0,0);
  6180. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  6181. initialBrush.setColor(QColor(170,170,255));
  6182. initialBrush.setStyle(Qt::SolidPattern);
  6183. finalBrush.setColor(Qt::blue);
  6184. finalBrush.setStyle(Qt::SolidPattern);
  6185. initialDecrement.setPolygon(left);
  6186. initialDecrement.setBrush(initialBrush);
  6187. initialDecrement.setPos(0,0);
  6188. scene.addItem(&initialDecrement);
  6189. initialIncrement.setPolygon(right);
  6190. initialIncrement.setBrush(initialBrush);
  6191. initialIncrement.setPos(122,0);
  6192. scene.addItem(&initialIncrement);
  6193. finalDecrement.setPolygon(left);
  6194. finalDecrement.setBrush(finalBrush);
  6195. finalDecrement.setPos(0,12);
  6196. scene.addItem(&finalDecrement);
  6197. finalIncrement.setPolygon(right);
  6198. finalIncrement.setBrush(finalBrush);
  6199. finalIncrement.setPos(122,12);
  6200. scene.addItem(&finalIncrement);
  6201. scalePath.moveTo(0,10);
  6202. scalePath.lineTo(100,10);
  6203. scalePath.moveTo(0,0);
  6204. scalePath.lineTo(0,20);
  6205. scalePath.moveTo(10,5);
  6206. scalePath.lineTo(10,15);
  6207. scalePath.moveTo(20,5);
  6208. scalePath.lineTo(20,15);
  6209. scalePath.moveTo(30,5);
  6210. scalePath.lineTo(30,15);
  6211. scalePath.moveTo(40,5);
  6212. scalePath.lineTo(40,15);
  6213. scalePath.moveTo(50,0);
  6214. scalePath.lineTo(50,20);
  6215. scalePath.moveTo(60,5);
  6216. scalePath.lineTo(60,15);
  6217. scalePath.moveTo(70,5);
  6218. scalePath.lineTo(70,15);
  6219. scalePath.moveTo(80,5);
  6220. scalePath.lineTo(80,15);
  6221. scalePath.moveTo(90,5);
  6222. scalePath.lineTo(90,15);
  6223. scalePath.moveTo(100,0);
  6224. scalePath.lineTo(100,20);
  6225. scaleLine.setPath(scalePath);
  6226. scaleLine.setPos(16,1);
  6227. scene.addItem(&scaleLine);
  6228. setScene(&scene);
  6229. initialIndicator.setPolygon(down);
  6230. initialIndicator.setBrush(initialBrush);
  6231. finalIndicator.setPolygon(up);
  6232. finalIndicator.setBrush(finalBrush);
  6233. setMinimumSize(sizeHint());
  6234. setMaximumSize(sizeHint());
  6235. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6236. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6237. setMinimumSize(sizeHint());
  6238. }
  6239. /*:582*//*583:*/
  6240. #line 13575 "./typica.w"
  6241. QSize ScaleControl::sizeHint()const
  6242. {
  6243. return QSize(140,30);
  6244. }
  6245. /*:583*//*584:*/
  6246. #line 13584 "./typica.w"
  6247. void ScaleControl::setInitialValue(double value)
  6248. {
  6249. if(value>=0&&value<=10)
  6250. {
  6251. nonScoredValue= value;
  6252. if(!initialSet)
  6253. {
  6254. scene.addItem(&initialIndicator);
  6255. }
  6256. initialSet= true;
  6257. initialIndicator.setPos(value*10+16,10);
  6258. emit initialChanged(value);
  6259. if(!finalSet)
  6260. {
  6261. setFinalValue(value);
  6262. }
  6263. }
  6264. }
  6265. void ScaleControl::setFinalValue(double value)
  6266. {
  6267. if(value>=0&&value<=10)
  6268. {
  6269. scoredValue= value;
  6270. if(!finalSet)
  6271. {
  6272. scene.addItem(&finalIndicator);
  6273. }
  6274. finalSet= true;
  6275. finalIndicator.setPos(value*10+16,11);
  6276. emit finalChanged(value);
  6277. }
  6278. }
  6279. /*:584*//*585:*/
  6280. #line 13621 "./typica.w"
  6281. double ScaleControl::initialValue(void)
  6282. {
  6283. return nonScoredValue;
  6284. }
  6285. double ScaleControl::finalValue(void)
  6286. {
  6287. return scoredValue;
  6288. }
  6289. /*:585*//*586:*/
  6290. #line 13642 "./typica.w"
  6291. void ScaleControl::mousePressEvent(QMouseEvent*event)
  6292. {
  6293. /*587:*/
  6294. #line 13654 "./typica.w"
  6295. if(event->button()!=Qt::LeftButton)
  6296. {
  6297. event->ignore();
  6298. return;
  6299. }
  6300. /*:587*/
  6301. #line 13645 "./typica.w"
  6302. scaleDown= true;
  6303. event->accept();
  6304. }
  6305. /*:586*//*588:*/
  6306. #line 13665 "./typica.w"
  6307. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  6308. {
  6309. /*587:*/
  6310. #line 13654 "./typica.w"
  6311. if(event->button()!=Qt::LeftButton)
  6312. {
  6313. event->ignore();
  6314. return;
  6315. }
  6316. /*:587*/
  6317. #line 13668 "./typica.w"
  6318. if(!scaleDown)
  6319. {
  6320. event->ignore();
  6321. return;
  6322. }
  6323. scaleDown= false;
  6324. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6325. /*589:*/
  6326. #line 13690 "./typica.w"
  6327. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  6328. {
  6329. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6330. {
  6331. if(initialSet)
  6332. {
  6333. setInitialValue(nonScoredValue-0.05);
  6334. }
  6335. event->accept();
  6336. return;
  6337. }
  6338. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6339. {
  6340. if(finalSet)
  6341. {
  6342. setFinalValue(scoredValue-0.05);
  6343. event->accept();
  6344. return;
  6345. }
  6346. }
  6347. }
  6348. /*:589*/
  6349. #line 13676 "./typica.w"
  6350. /*590:*/
  6351. #line 13716 "./typica.w"
  6352. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  6353. {
  6354. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6355. {
  6356. if(initialSet)
  6357. {
  6358. setInitialValue(nonScoredValue+0.05);
  6359. event->accept();
  6360. return;
  6361. }
  6362. }
  6363. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6364. {
  6365. if(finalSet)
  6366. {
  6367. setFinalValue(scoredValue+0.05);
  6368. event->accept();
  6369. return;
  6370. }
  6371. }
  6372. }
  6373. /*:590*/
  6374. #line 13677 "./typica.w"
  6375. /*591:*/
  6376. #line 13742 "./typica.w"
  6377. double relativeX= sceneCoordinate.x()-16;
  6378. if(initialSet)
  6379. {
  6380. if(relativeX>=0&&relativeX<=100)
  6381. {
  6382. setFinalValue(relativeX/10.0);
  6383. event->accept();
  6384. return;
  6385. }
  6386. }
  6387. else
  6388. {
  6389. if(relativeX>=0&&relativeX<=100)
  6390. {
  6391. setInitialValue(relativeX/10.0);
  6392. event->accept();
  6393. return;
  6394. }
  6395. }
  6396. /*:591*/
  6397. #line 13678 "./typica.w"
  6398. event->ignore();
  6399. return;
  6400. }
  6401. /*:588*/
  6402. #line 796 "./typica.w"
  6403. /*593:*/
  6404. #line 13808 "./typica.w"
  6405. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  6406. valueSet(false),scaleDown(false)
  6407. {
  6408. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6409. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6410. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  6411. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  6412. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  6413. theBrush.setColor(Qt::blue);
  6414. theBrush.setStyle(Qt::SolidPattern);
  6415. increment.setPolygon(up);
  6416. increment.setBrush(theBrush);
  6417. increment.setPos(0,0);
  6418. scene.addItem(&increment);
  6419. decrement.setPolygon(down);
  6420. decrement.setBrush(theBrush);
  6421. decrement.setPos(0,122);
  6422. scene.addItem(&decrement);
  6423. scalePath.moveTo(5,0);
  6424. scalePath.lineTo(5,100);
  6425. scalePath.moveTo(0,0);
  6426. scalePath.lineTo(10,0);
  6427. scalePath.moveTo(0,10);
  6428. scalePath.lineTo(10,10);
  6429. scalePath.moveTo(0,20);
  6430. scalePath.lineTo(10,20);
  6431. scalePath.moveTo(0,30);
  6432. scalePath.lineTo(10,30);
  6433. scalePath.moveTo(0,40);
  6434. scalePath.lineTo(10,40);
  6435. scalePath.moveTo(0,50);
  6436. scalePath.lineTo(10,50);
  6437. scalePath.moveTo(0,60);
  6438. scalePath.lineTo(10,60);
  6439. scalePath.moveTo(0,70);
  6440. scalePath.lineTo(10,70);
  6441. scalePath.moveTo(0,80);
  6442. scalePath.lineTo(10,80);
  6443. scalePath.moveTo(0,90);
  6444. scalePath.lineTo(10,90);
  6445. scalePath.moveTo(0,100);
  6446. scalePath.lineTo(10,100);
  6447. scaleLine.setPath(scalePath);
  6448. scaleLine.setPos(0,16);
  6449. scene.addItem(&scaleLine);
  6450. setScene(&scene);
  6451. indicator.setPolygon(left);
  6452. indicator.setBrush(theBrush);
  6453. setMinimumSize(sizeHint());
  6454. setMaximumSize(sizeHint());
  6455. }
  6456. /*:593*//*594:*/
  6457. #line 13863 "./typica.w"
  6458. QSize IntensityControl::sizeHint()const
  6459. {
  6460. return QSize(25,160);
  6461. }
  6462. /*:594*//*595:*/
  6463. #line 13878 "./typica.w"
  6464. void IntensityControl::setValue(double val)
  6465. {
  6466. if(val>=0&&val<=10)
  6467. {
  6468. theValue= val;
  6469. if(!valueSet)
  6470. {
  6471. scene.addItem(&indicator);
  6472. }
  6473. valueSet= true;
  6474. indicator.setPos(6,(100-(val*10))+16);
  6475. emit(valueChanged(val));
  6476. }
  6477. else if(val<1)
  6478. {
  6479. setValue(0);
  6480. }
  6481. else
  6482. {
  6483. setValue(10);
  6484. }
  6485. }
  6486. double IntensityControl::value()
  6487. {
  6488. return theValue;
  6489. }
  6490. /*:595*//*596:*/
  6491. #line 13910 "./typica.w"
  6492. void IntensityControl::mousePressEvent(QMouseEvent*event)
  6493. {
  6494. /*587:*/
  6495. #line 13654 "./typica.w"
  6496. if(event->button()!=Qt::LeftButton)
  6497. {
  6498. event->ignore();
  6499. return;
  6500. }
  6501. /*:587*/
  6502. #line 13913 "./typica.w"
  6503. scaleDown= true;
  6504. event->accept();
  6505. }
  6506. /*:596*//*597:*/
  6507. #line 13924 "./typica.w"
  6508. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  6509. {
  6510. /*587:*/
  6511. #line 13654 "./typica.w"
  6512. if(event->button()!=Qt::LeftButton)
  6513. {
  6514. event->ignore();
  6515. return;
  6516. }
  6517. /*:587*/
  6518. #line 13927 "./typica.w"
  6519. if(!scaleDown)
  6520. {
  6521. event->ignore();
  6522. return;
  6523. }
  6524. scaleDown= false;
  6525. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6526. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  6527. {
  6528. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6529. {
  6530. if(valueSet)
  6531. {
  6532. setValue(theValue+0.05);
  6533. }
  6534. event->accept();
  6535. return;
  6536. }
  6537. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  6538. {
  6539. if(valueSet)
  6540. {
  6541. setValue(theValue-0.05);
  6542. }
  6543. event->accept();
  6544. return;
  6545. }
  6546. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  6547. {
  6548. setValue(10-((sceneCoordinate.y()-16)/10.0));
  6549. event->accept();
  6550. return;
  6551. }
  6552. }
  6553. }
  6554. /*:597*/
  6555. #line 797 "./typica.w"
  6556. /*296:*/
  6557. #line 7480 "./typica.w"
  6558. void ThresholdDetector::newMeasurement(Measurement measure)
  6559. {
  6560. if((currentDirection==Ascending&&previousValue<threshold&&
  6561. previousValue>=0)||(currentDirection==Descending&&
  6562. previousValue> threshold&&previousValue>=0))
  6563. {
  6564. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  6565. (currentDirection==Descending&&measure.temperature()<=threshold))
  6566. {
  6567. double offset= measure.time().hour()*60*60;
  6568. offset+= measure.time().minute()*60;
  6569. offset+= measure.time().second();
  6570. offset+= measure.time().msec()/1000;
  6571. emit timeForValue(offset);
  6572. }
  6573. }
  6574. previousValue= measure.temperature();
  6575. }
  6576. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  6577. previousValue(-1),threshold(value),currentDirection(Ascending)
  6578. {
  6579. }
  6580. void ThresholdDetector::setThreshold(double value)
  6581. {
  6582. threshold= value;
  6583. }
  6584. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  6585. {
  6586. currentDirection= direction;
  6587. }
  6588. /*:296*/
  6589. #line 798 "./typica.w"
  6590. /*678:*/
  6591. #line 15680 "./typica.w"
  6592. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  6593. lister(new QextSerialEnumerator)
  6594. {
  6595. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  6596. QextPortInfo port;
  6597. foreach(port,ports)
  6598. {
  6599. addItem(port.portName);
  6600. }
  6601. lister->setUpNotifications();
  6602. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  6603. this,SLOT(addDevice(QextPortInfo)));
  6604. setEditable(true);
  6605. }
  6606. void PortSelector::addDevice(QextPortInfo port)
  6607. {
  6608. addItem(port.portName);
  6609. }
  6610. /*:678*/
  6611. #line 799 "./typica.w"
  6612. /*680:*/
  6613. #line 15768 "./typica.w"
  6614. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  6615. {
  6616. QMetaObject meta= BaudSelector::staticMetaObject;
  6617. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  6618. for(int i= 0;i<type.keyCount();i++)
  6619. {
  6620. addItem(QString("%1").arg(type.value(i)));
  6621. }
  6622. }
  6623. /*:680*/
  6624. #line 800 "./typica.w"
  6625. /*682:*/
  6626. #line 15806 "./typica.w"
  6627. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  6628. {
  6629. QMetaObject meta= ParitySelector::staticMetaObject;
  6630. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  6631. for(int i= 0;i<type.keyCount();i++)
  6632. {
  6633. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6634. }
  6635. }
  6636. /*:682*/
  6637. #line 801 "./typica.w"
  6638. /*684:*/
  6639. #line 15836 "./typica.w"
  6640. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  6641. {
  6642. QMetaObject meta= FlowSelector::staticMetaObject;
  6643. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  6644. for(int i= 0;i<type.keyCount();i++)
  6645. {
  6646. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6647. }
  6648. }
  6649. /*:684*/
  6650. #line 802 "./typica.w"
  6651. /*686:*/
  6652. #line 15871 "./typica.w"
  6653. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  6654. {
  6655. QMetaObject meta= StopSelector::staticMetaObject;
  6656. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  6657. for(int i= 0;i<type.keyCount();i++)
  6658. {
  6659. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6660. }
  6661. }
  6662. /*:686*/
  6663. #line 803 "./typica.w"
  6664. /*726:*/
  6665. #line 17616 "./typica.w"
  6666. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  6667. :BasicDeviceConfigurationWidget(model,index),
  6668. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  6669. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  6670. decimalQuery(new QCheckBox(tr("Enable"))),
  6671. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  6672. unitQuery(new QCheckBox(tr("Enable"))),
  6673. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  6674. valueC(new QSpinBox),fixedUnit(new QComboBox),
  6675. pVAddress(new ShortHexSpinBox),
  6676. sVEnabled(new QCheckBox(tr("Enable"))),
  6677. sVReadAddress(new ShortHexSpinBox),
  6678. deviceLimit(new QCheckBox(tr("Enable"))),
  6679. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  6680. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  6681. sVWritable(new QCheckBox(tr("Enable"))),
  6682. sVOutputAddr(new ShortHexSpinBox),
  6683. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  6684. {
  6685. QHBoxLayout*layout= new QHBoxLayout;
  6686. QWidget*form= new QWidget;
  6687. QHBoxLayout*masterLayout= new QHBoxLayout;
  6688. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  6689. QVBoxLayout*seriesLayout= new QVBoxLayout;
  6690. QFormLayout*serialSection= new QFormLayout;
  6691. serialSection->addRow(QString(tr("Port:")),port);
  6692. serialSection->addRow(QString(tr("Baud rate:")),baud);
  6693. serialSection->addRow(QString(tr("Parity:")),parity);
  6694. serialSection->addRow(QString(tr("Flow control:")),flow);
  6695. serialSection->addRow(QString(tr("Stop bits:")),stop);
  6696. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  6697. serialSectionBox->setLayout(serialSection);
  6698. portAndDeviceLayout->addWidget(serialSectionBox);
  6699. QFormLayout*deviceSection= new QFormLayout;
  6700. station->setMinimum(1);
  6701. station->setMaximum(255);
  6702. decimalPosition->setMinimum(0);
  6703. decimalPosition->setMaximum(9);
  6704. valueF->setMinimum(0);
  6705. valueF->setMaximum(0xFFFF);
  6706. valueC->setMinimum(0);
  6707. valueC->setMaximum(0xFFFF);
  6708. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  6709. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  6710. deviceSection->addRow(tr("Station:"),station);
  6711. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  6712. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  6713. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  6714. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  6715. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  6716. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  6717. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  6718. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  6719. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  6720. deviceSectionBox->setLayout(deviceSection);
  6721. portAndDeviceLayout->addWidget(deviceSectionBox);
  6722. QFormLayout*pVSection= new QFormLayout;
  6723. pVSection->addRow(tr("Value relative address:"),pVAddress);
  6724. pVSection->addRow(tr("PV column name:"),pVColumnName);
  6725. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  6726. processValueBox->setLayout(pVSection);
  6727. seriesLayout->addWidget(processValueBox);
  6728. QFormLayout*sVSection= new QFormLayout;
  6729. sVLower->setDecimals(1);
  6730. sVLower->setMinimum(0.0);
  6731. sVLower->setMaximum(999.9);
  6732. sVUpper->setDecimals(1);
  6733. sVUpper->setMinimum(0.0);
  6734. sVUpper->setMaximum(999.9);
  6735. sVSection->addRow(tr("Set value:"),sVEnabled);
  6736. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  6737. sVSection->addRow(tr("SV column name:"),sVColumnName);
  6738. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  6739. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  6740. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  6741. sVSection->addRow(tr("Lower limit:"),sVLower);
  6742. sVSection->addRow(tr("Upper limit:"),sVUpper);
  6743. sVSection->addRow(tr("Output set value:"),sVWritable);
  6744. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  6745. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  6746. setValueBox->setLayout(sVSection);
  6747. seriesLayout->addWidget(setValueBox);
  6748. masterLayout->addLayout(portAndDeviceLayout);
  6749. masterLayout->addLayout(seriesLayout);
  6750. form->setLayout(masterLayout);
  6751. /*654:*/
  6752. #line 15164 "./typica.w"
  6753. QDomElement referenceElement=
  6754. model->referenceElement(model->data(index,Qt::UserRole).toString());
  6755. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  6756. QDomElement node;
  6757. /*:654*/
  6758. #line 17702 "./typica.w"
  6759. for(int i= 0;i<configData.size();i++)
  6760. {
  6761. node= configData.at(i).toElement();
  6762. if(node.attribute("name")=="port")
  6763. {
  6764. QString portname= node.attribute("value");
  6765. int idx= port->findText(portname);
  6766. if(idx>=0)
  6767. {
  6768. port->setCurrentIndex(idx);
  6769. }
  6770. else
  6771. {
  6772. port->addItem(portname);
  6773. }
  6774. }
  6775. else if(node.attribute("name")=="baud")
  6776. {
  6777. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  6778. }
  6779. else if(node.attribute("name")=="parity")
  6780. {
  6781. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  6782. }
  6783. else if(node.attribute("name")=="flow")
  6784. {
  6785. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  6786. }
  6787. else if(node.attribute("name")=="stop")
  6788. {
  6789. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  6790. }
  6791. else if(node.attribute("name")=="station")
  6792. {
  6793. station->setValue(node.attribute("value").toInt());
  6794. }
  6795. else if(node.attribute("name")=="decimalQuery")
  6796. {
  6797. if(node.attribute("value")=="true")
  6798. {
  6799. decimalQuery->setChecked(true);
  6800. }
  6801. else
  6802. {
  6803. decimalQuery->setChecked(false);
  6804. }
  6805. }
  6806. else if(node.attribute("name")=="decimalAddress")
  6807. {
  6808. decimalAddress->setValue(node.attribute("value").toInt());
  6809. }
  6810. else if(node.attribute("name")=="decimalPosition")
  6811. {
  6812. decimalPosition->setValue(node.attribute("value").toInt());
  6813. }
  6814. else if(node.attribute("name")=="unitQuery")
  6815. {
  6816. if(node.attribute("value")=="true")
  6817. {
  6818. unitQuery->setChecked(true);
  6819. }
  6820. else
  6821. {
  6822. unitQuery->setChecked(false);
  6823. }
  6824. }
  6825. else if(node.attribute("name")=="unitAddress")
  6826. {
  6827. unitAddress->setValue(node.attribute("value").toInt());
  6828. }
  6829. else if(node.attribute("name")=="valueF")
  6830. {
  6831. valueF->setValue(node.attribute("value").toInt());
  6832. }
  6833. else if(node.attribute("name")=="valueC")
  6834. {
  6835. valueC->setValue(node.attribute("value").toInt());
  6836. }
  6837. else if(node.attribute("name")=="fixedUnit")
  6838. {
  6839. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  6840. }
  6841. else if(node.attribute("name")=="pVAddress")
  6842. {
  6843. pVAddress->setValue(node.attribute("value").toInt());
  6844. }
  6845. else if(node.attribute("name")=="sVEnabled")
  6846. {
  6847. if(node.attribute("value")=="true")
  6848. {
  6849. sVEnabled->setChecked(true);
  6850. }
  6851. else
  6852. {
  6853. sVEnabled->setChecked(false);
  6854. }
  6855. }
  6856. else if(node.attribute("name")=="sVReadAddress")
  6857. {
  6858. sVReadAddress->setValue(node.attribute("value").toInt());
  6859. }
  6860. else if(node.attribute("name")=="deviceLimit")
  6861. {
  6862. if(node.attribute("value")=="true")
  6863. {
  6864. deviceLimit->setChecked(true);
  6865. }
  6866. else
  6867. {
  6868. deviceLimit->setChecked(false);
  6869. }
  6870. }
  6871. else if(node.attribute("name")=="sVLowerAddr")
  6872. {
  6873. sVLowerAddr->setValue(node.attribute("value").toInt());
  6874. }
  6875. else if(node.attribute("name")=="sVUpperAddr")
  6876. {
  6877. sVUpperAddr->setValue(node.attribute("value").toInt());
  6878. }
  6879. else if(node.attribute("name")=="sVLower")
  6880. {
  6881. sVLower->setValue(node.attribute("value").toDouble());
  6882. }
  6883. else if(node.attribute("name")=="sVUpper")
  6884. {
  6885. sVUpper->setValue(node.attribute("value").toDouble());
  6886. }
  6887. else if(node.attribute("name")=="sVWritable")
  6888. {
  6889. if(node.attribute("value")=="true")
  6890. {
  6891. sVWritable->setChecked(true);
  6892. }
  6893. else
  6894. {
  6895. sVWritable->setChecked(false);
  6896. }
  6897. }
  6898. else if(node.attribute("name")=="sVOutputAddr")
  6899. {
  6900. sVOutputAddr->setValue(node.attribute("value").toInt());
  6901. }
  6902. else if(node.attribute("name")=="pvcolname")
  6903. {
  6904. pVColumnName->setText(node.attribute("value"));
  6905. }
  6906. else if(node.attribute("name")=="svcolname")
  6907. {
  6908. sVColumnName->setText(node.attribute("value"));
  6909. }
  6910. }
  6911. updatePort(port->currentText());
  6912. updateBaudRate(baud->currentText());
  6913. updateParity(parity->itemData(parity->currentIndex()).toString());
  6914. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  6915. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  6916. updateStation(station->value());
  6917. updateFixedDecimal(decimalQuery->isChecked());
  6918. updateDecimalAddress(decimalAddress->value());
  6919. updateDecimalPosition(decimalPosition->value());
  6920. updateFixedUnit(unitQuery->isChecked());
  6921. updateUnitAddress(unitAddress->value());
  6922. updateValueForF(valueF->value());
  6923. updateValueForC(valueC->value());
  6924. updateUnit(fixedUnit->currentText());
  6925. updatePVAddress(pVAddress->value());
  6926. updateSVEnabled(sVEnabled->isChecked());
  6927. updateSVReadAddress(sVReadAddress->value());
  6928. updateDeviceLimit(deviceLimit->isChecked());
  6929. updateSVLowerAddress(sVLowerAddr->value());
  6930. updateSVUpperAddress(sVUpperAddr->value());
  6931. updateSVLower(sVLower->value());
  6932. updateSVUpper(sVUpper->value());
  6933. updateSVWritable(sVWritable->isChecked());
  6934. updateSVWriteAddress(sVOutputAddr->value());
  6935. updatePVColumnName(pVColumnName->text());
  6936. updateSVColumnName(sVColumnName->text());
  6937. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  6938. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  6939. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  6940. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  6941. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  6942. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  6943. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  6944. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  6945. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  6946. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  6947. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  6948. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  6949. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  6950. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  6951. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  6952. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  6953. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  6954. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  6955. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  6956. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  6957. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  6958. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  6959. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  6960. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  6961. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  6962. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  6963. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  6964. layout->addWidget(form);
  6965. setLayout(layout);
  6966. }
  6967. void ModbusConfigurator::updatePort(const QString&newPort)
  6968. {
  6969. updateAttribute("port",newPort);
  6970. }
  6971. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  6972. {
  6973. updateAttribute("baud",newRate);
  6974. }
  6975. void ModbusConfigurator::updateParity(const QString&)
  6976. {
  6977. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  6978. }
  6979. void ModbusConfigurator::updateFlowControl(const QString&)
  6980. {
  6981. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  6982. }
  6983. void ModbusConfigurator::updateStopBits(const QString&)
  6984. {
  6985. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  6986. }
  6987. void ModbusConfigurator::updateStation(int station)
  6988. {
  6989. updateAttribute("station",QString("%1").arg(station));
  6990. }
  6991. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  6992. {
  6993. updateAttribute("decimalQuery",fixed?"true":"false");
  6994. }
  6995. void ModbusConfigurator::updateDecimalAddress(int address)
  6996. {
  6997. updateAttribute("decimalAddress",QString("%1").arg(address));
  6998. }
  6999. void ModbusConfigurator::updateDecimalPosition(int position)
  7000. {
  7001. updateAttribute("decimalPosition",QString("%1").arg(position));
  7002. }
  7003. void ModbusConfigurator::updateFixedUnit(bool fixed)
  7004. {
  7005. updateAttribute("unitQuery",fixed?"true":"false");
  7006. }
  7007. void ModbusConfigurator::updateUnitAddress(int address)
  7008. {
  7009. updateAttribute("unitAddress",QString("%1").arg(address));
  7010. }
  7011. void ModbusConfigurator::updateValueForF(int value)
  7012. {
  7013. updateAttribute("valueF",QString("%1").arg(value));
  7014. }
  7015. void ModbusConfigurator::updateValueForC(int value)
  7016. {
  7017. updateAttribute("valueC",QString("%1").arg(value));
  7018. }
  7019. void ModbusConfigurator::updateUnit(const QString&newUnit)
  7020. {
  7021. updateAttribute("fixedUnit",newUnit);
  7022. }
  7023. void ModbusConfigurator::updatePVAddress(int address)
  7024. {
  7025. updateAttribute("pVAddress",QString("%1").arg(address));
  7026. }
  7027. void ModbusConfigurator::updateSVEnabled(bool enabled)
  7028. {
  7029. updateAttribute("sVEnabled",enabled?"true":"false");
  7030. }
  7031. void ModbusConfigurator::updateSVReadAddress(int address)
  7032. {
  7033. updateAttribute("sVReadAddress",QString("%1").arg(address));
  7034. }
  7035. void ModbusConfigurator::updateDeviceLimit(bool query)
  7036. {
  7037. updateAttribute("deviceLimit",query?"true":"false");
  7038. }
  7039. void ModbusConfigurator::updateSVLowerAddress(int address)
  7040. {
  7041. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  7042. }
  7043. void ModbusConfigurator::updateSVUpperAddress(int address)
  7044. {
  7045. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  7046. }
  7047. void ModbusConfigurator::updateSVLower(double value)
  7048. {
  7049. updateAttribute("sVLower",QString("%1").arg(value));
  7050. }
  7051. void ModbusConfigurator::updateSVUpper(double value)
  7052. {
  7053. updateAttribute("sVUpper",QString("%1").arg(value));
  7054. }
  7055. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  7056. {
  7057. updateAttribute("sVWritable",canWriteSV?"true":"false");
  7058. }
  7059. void ModbusConfigurator::updateSVWriteAddress(int address)
  7060. {
  7061. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  7062. }
  7063. void ModbusConfigurator::updatePVColumnName(const QString&name)
  7064. {
  7065. updateAttribute("pvcolname",name);
  7066. }
  7067. void ModbusConfigurator::updateSVColumnName(const QString&name)
  7068. {
  7069. updateAttribute("svcolname",name);
  7070. }
  7071. /*:726*/
  7072. #line 804 "./typica.w"
  7073. /*689:*/
  7074. #line 15920 "./typica.w"
  7075. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  7076. {
  7077. setMinimum(0);
  7078. setMaximum(0xFFFF);
  7079. setPrefix("0x");
  7080. setMinimumWidth(65);
  7081. }
  7082. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  7083. {
  7084. if(input.size()==2)
  7085. {
  7086. return QValidator::Intermediate;
  7087. }
  7088. bool okay;
  7089. input.toInt(&okay,16);
  7090. if(okay)
  7091. {
  7092. return QValidator::Acceptable;
  7093. }
  7094. return QValidator::Invalid;
  7095. }
  7096. int ShortHexSpinBox::valueFromText(const QString&text)const
  7097. {
  7098. return text.toInt(NULL,16);
  7099. }
  7100. QString ShortHexSpinBox::textFromValue(int value)const
  7101. {
  7102. QString retval;
  7103. retval.setNum(value,16);
  7104. while(retval.size()<4)
  7105. {
  7106. retval.prepend("0");
  7107. }
  7108. return retval.toUpper();
  7109. }
  7110. /*:689*/
  7111. #line 805 "./typica.w"
  7112. /*711:*/
  7113. #line 16946 "./typica.w"
  7114. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  7115. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  7116. waiting(false)
  7117. {
  7118. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  7119. Qt::UserRole).toString());
  7120. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  7121. QDomElement node;
  7122. QVariantMap attributes;
  7123. for(int i= 0;i<portConfigData.size();i++)
  7124. {
  7125. node= portConfigData.at(i).toElement();
  7126. attributes.insert(node.attribute("name"),node.attribute("value"));
  7127. }
  7128. port= new QextSerialPort(attributes.value("port").toString(),
  7129. QextSerialPort::EventDriven);
  7130. int baudRate= attributes.value("baud").toInt();
  7131. port->setBaudRate((BaudRateType)baudRate);
  7132. double temp= ((double)(1)/(double)(baudRate))*48;
  7133. delayTime= (int)(temp*3000);
  7134. messageDelayTimer->setSingleShot(true);
  7135. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  7136. port->setDataBits(DATA_8);
  7137. port->setParity((ParityType)attributes.value("parity").toInt());
  7138. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  7139. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  7140. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  7141. port->open(QIODevice::ReadWrite);
  7142. station= (char)attributes.value("station").toInt();
  7143. if(attributes.value("decimalQuery")=="true")
  7144. {
  7145. decimalPosition= 0;
  7146. QByteArray message;
  7147. message.append(station);
  7148. message.append((char)0x03);
  7149. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  7150. char*addressBytes= (char*)&address;
  7151. message.append(addressBytes[1]);
  7152. message.append(addressBytes[0]);
  7153. message.append((char)0x00);
  7154. message.append((char)0x01);
  7155. queueMessage(message,this,"decimalResponse(QByteArray)");
  7156. }
  7157. else
  7158. {
  7159. decimalPosition= attributes.value("decimalPosition").toInt();
  7160. }
  7161. valueF= attributes.value("valueF").toInt();
  7162. valueC= attributes.value("valueC").toInt();
  7163. if(attributes.value("unitQuery")=="true")
  7164. {
  7165. QByteArray message;
  7166. message.append(station);
  7167. message.append((char)0x03);
  7168. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  7169. char*addressBytes= (char*)&address;
  7170. message.append(addressBytes[1]);
  7171. message.append(addressBytes[0]);
  7172. message.append((char)0x00);
  7173. message.append((char)0x01);
  7174. queueMessage(message,this,"unitResponse(QByteArray)");
  7175. }
  7176. else
  7177. {
  7178. if(attributes.value("fixedUnit")=="Celsius")
  7179. {
  7180. unitIsF= false;
  7181. }
  7182. }
  7183. if(attributes.value("sVWritable")=="true")
  7184. {
  7185. if(attributes.value("deviceLimit")=="true")
  7186. {
  7187. QByteArray lmessage;
  7188. lmessage.append(station);
  7189. lmessage.append((char)0x03);
  7190. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  7191. char*addressBytes= (char*)&laddress;
  7192. lmessage.append(addressBytes[1]);
  7193. lmessage.append(addressBytes[0]);
  7194. lmessage.append((char)0x00);
  7195. lmessage.append((char)0x01);
  7196. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  7197. QByteArray umessage;
  7198. umessage.append(station);
  7199. umessage.append((char)0x03);
  7200. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  7201. addressBytes= (char*)&uaddress;
  7202. umessage.append(addressBytes[1]);
  7203. umessage.append(addressBytes[0]);
  7204. umessage.append((char)0x00);
  7205. umessage.append((char)0x01);
  7206. queueMessage(umessage,this,"svuResponse(QByteArray)");
  7207. }
  7208. else
  7209. {
  7210. outputSVLower= attributes.value("sVLower").toDouble();
  7211. outputSVUpper= attributes.value("sVUpper").toDouble();
  7212. }
  7213. outputSVStub.append(station);
  7214. outputSVStub.append((char)0x06);
  7215. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  7216. char*addressBytes= (char*)&address;
  7217. outputSVStub.append(addressBytes[1]);
  7218. outputSVStub.append(addressBytes[0]);
  7219. }
  7220. Channel*pv= new Channel;
  7221. channels.append(pv);
  7222. pvStub.append(station);
  7223. pvStub.append((char)0x04);
  7224. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  7225. char*pvac= (char*)&pvaddress;
  7226. pvStub.append(pvac[1]);
  7227. pvStub.append(pvac[0]);
  7228. pvStub.append((char)0x00);
  7229. pvStub.append((char)0x01);
  7230. svenabled= attributes.value("sVEnabled").toBool();
  7231. if(svenabled)
  7232. {
  7233. Channel*sv= new Channel;
  7234. channels.append(sv);
  7235. svStub.append(station);
  7236. svStub.append((char)0x04);
  7237. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  7238. char*svac= (char*)&svaddress;
  7239. svStub.append(svac[1]);
  7240. svStub.append(svac[0]);
  7241. svStub.append((char)0x00);
  7242. svStub.append((char)0x01);
  7243. if(svaddress-pvaddress==1)
  7244. {
  7245. mStub.append(station);
  7246. mStub.append((char)0x04);
  7247. mStub.append(pvac[1]);
  7248. mStub.append(pvac[0]);
  7249. mStub.append((char)0x00);
  7250. mStub.append((char)0x02);
  7251. }
  7252. }
  7253. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  7254. requestMeasurement();
  7255. }
  7256. double ModbusRTUDevice::SVLower()
  7257. {
  7258. return outputSVLower;
  7259. }
  7260. double ModbusRTUDevice::SVUpper()
  7261. {
  7262. return outputSVUpper;
  7263. }
  7264. int ModbusRTUDevice::decimals()
  7265. {
  7266. return decimalPosition;
  7267. }
  7268. void ModbusRTUDevice::decimalResponse(QByteArray response)
  7269. {
  7270. quint16 temp;
  7271. char*tchar= (char*)&temp;
  7272. tchar[1]= response.at(3);
  7273. tchar[0]= response.at(4);
  7274. decimalPosition= temp;
  7275. emit SVDecimalChanged(decimalPosition);
  7276. qDebug()<<"Received decimal response";
  7277. }
  7278. void ModbusRTUDevice::unitResponse(QByteArray response)
  7279. {
  7280. quint16 temp;
  7281. char*tchar= (char*)&temp;
  7282. tchar[1]= response.at(3);
  7283. tchar[0]= response.at(4);
  7284. int value= temp;
  7285. if(value==valueF)
  7286. {
  7287. unitIsF= true;
  7288. }
  7289. else
  7290. {
  7291. unitIsF= false;
  7292. }
  7293. }
  7294. void ModbusRTUDevice::svlResponse(QByteArray response)
  7295. {
  7296. quint16 temp;
  7297. char*tchar= (char*)&temp;
  7298. tchar[1]= response.at(3);
  7299. tchar[0]= response.at(4);
  7300. outputSVLower= (double)temp;
  7301. for(int i= 0;i<decimalPosition;i++)
  7302. {
  7303. outputSVLower/= 10;
  7304. }
  7305. emit SVLowerChanged(outputSVLower);
  7306. }
  7307. void ModbusRTUDevice::svuResponse(QByteArray response)
  7308. {
  7309. quint16 temp;
  7310. char*tchar= (char*)&temp;
  7311. tchar[1]= response.at(3);
  7312. tchar[0]= response.at(4);
  7313. outputSVUpper= (double)temp;
  7314. for(int i= 0;i<decimalPosition;i++)
  7315. {
  7316. outputSVUpper/= 10;
  7317. }
  7318. emit SVUpperChanged(outputSVUpper);
  7319. }
  7320. void ModbusRTUDevice::requestMeasurement()
  7321. {
  7322. if(mStub.length()> 0)
  7323. {
  7324. queueMessage(mStub,this,"mResponse(QByteArray)");
  7325. }
  7326. else
  7327. {
  7328. queueMessage(pvStub,this,"mResponse(QByteArray)");
  7329. if(svenabled)
  7330. {
  7331. queueMessage(svStub,this,"mResponse(QByteArray)");
  7332. }
  7333. }
  7334. }
  7335. void ModbusRTUDevice::mResponse(QByteArray response)
  7336. {
  7337. QTime time= QTime::currentTime();
  7338. if(response.at(2)==0x04)
  7339. {
  7340. /*712:*/
  7341. #line 17195 "./typica.w"
  7342. quint16 pv;
  7343. quint16 sv;
  7344. char*pvBytes= (char*)&pv;
  7345. char*svBytes= (char*)&sv;
  7346. pvBytes[1]= response.at(3);
  7347. pvBytes[0]= response.at(4);
  7348. svBytes[1]= response.at(5);
  7349. svBytes[0]= response.at(6);
  7350. double pvOut= (double)pv;
  7351. double svOut= (double)sv;
  7352. for(int i= 0;i<decimalPosition;i++)
  7353. {
  7354. pvOut/= 10;
  7355. svOut/= 10;
  7356. }
  7357. if(!unitIsF)
  7358. {
  7359. pvOut= pvOut*9/5+32;
  7360. svOut= svOut*9/5+32;
  7361. }
  7362. Measurement pvm(pvOut,time,Measurement::Fahrenheit);
  7363. Measurement svm(svOut,time,Measurement::Fahrenheit);
  7364. channels.at(0)->input(pvm);
  7365. channels.at(1)->input(svm);
  7366. /*:712*/
  7367. #line 17182 "./typica.w"
  7368. }
  7369. else
  7370. {
  7371. /*713:*/
  7372. #line 17225 "./typica.w"
  7373. quint16 value;
  7374. char*valueBytes= (char*)&value;
  7375. valueBytes[1]= response.at(3);
  7376. valueBytes[0]= response.at(4);
  7377. double valueOut= (double)value;
  7378. for(int i= 0;i<decimalPosition;i++)
  7379. {
  7380. valueOut/= 10;
  7381. }
  7382. if(!unitIsF)
  7383. {
  7384. valueOut= valueOut*9/5+32;
  7385. }
  7386. if(!svenabled)
  7387. {
  7388. Measurement vm(valueOut,time,Measurement::Fahrenheit);
  7389. channels.at(0)->input(vm);
  7390. }
  7391. else
  7392. {
  7393. if(readingsv)
  7394. {
  7395. Measurement pvm(savedpv,time,Measurement::Fahrenheit);
  7396. Measurement svm(valueOut,time,Measurement::Fahrenheit);
  7397. channels.at(0)->input(pvm);
  7398. channels.at(1)->input(svm);
  7399. readingsv= false;
  7400. }
  7401. else
  7402. {
  7403. savedpv= valueOut;
  7404. readingsv= true;
  7405. }
  7406. }
  7407. /*:713*/
  7408. #line 17186 "./typica.w"
  7409. }
  7410. }
  7411. /*:711*//*714:*/
  7412. #line 17263 "./typica.w"
  7413. ModbusRTUDevice::~ModbusRTUDevice()
  7414. {
  7415. messageDelayTimer->stop();
  7416. port->close();
  7417. }
  7418. /*:714*//*715:*/
  7419. #line 17285 "./typica.w"
  7420. void ModbusRTUDevice::dataAvailable()
  7421. {
  7422. if(messageDelayTimer->isActive())
  7423. {
  7424. messageDelayTimer->stop();
  7425. }
  7426. responseBuffer.append(port->readAll());
  7427. /*716:*/
  7428. #line 17330 "./typica.w"
  7429. if(responseBuffer.size()<5)
  7430. {
  7431. return;
  7432. }
  7433. switch(responseBuffer.at(1))
  7434. {
  7435. case 0x01:
  7436. case 0x02:
  7437. if(responseBuffer.size()<6)
  7438. {
  7439. return;
  7440. }
  7441. responseBuffer= responseBuffer.left(6);
  7442. break;
  7443. case 0x03:
  7444. case 0x04:
  7445. if(responseBuffer.size()<5+responseBuffer.at(2))
  7446. {
  7447. return;
  7448. }
  7449. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  7450. break;
  7451. case 0x05:
  7452. case 0x06:
  7453. case 0x10:
  7454. if(responseBuffer.size()<8)
  7455. {
  7456. return;
  7457. }
  7458. responseBuffer= responseBuffer.left(8);
  7459. break;
  7460. }
  7461. /*:716*/
  7462. #line 17293 "./typica.w"
  7463. if(calculateCRC(responseBuffer)==0)
  7464. {
  7465. QObject*object= retObjQueue.at(0);
  7466. char*method= callbackQueue.at(0);
  7467. QMetaMethod metamethod= object->metaObject()->
  7468. method(object->metaObject()->
  7469. indexOfMethod(QMetaObject::normalizedSignature(method)));
  7470. metamethod.invoke(object,Qt::QueuedConnection,
  7471. Q_ARG(QByteArray,responseBuffer));
  7472. messageQueue.removeAt(0);
  7473. retObjQueue.removeAt(0);
  7474. callbackQueue.removeAt(0);
  7475. messageDelayTimer->start(delayTime);
  7476. }
  7477. else
  7478. {
  7479. qDebug()<<"CRC failed";
  7480. }
  7481. waiting= false;
  7482. responseBuffer.clear();
  7483. }
  7484. /*:715*//*717:*/
  7485. #line 17372 "./typica.w"
  7486. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  7487. {
  7488. quint16 retval= 0xFFFF;
  7489. int i= 0;
  7490. while(i<data.size())
  7491. {
  7492. retval^= 0x00FF&(quint16)data.at(i);
  7493. for(int j= 0;j<8;j++)
  7494. {
  7495. if(retval&1)
  7496. {
  7497. retval= (retval>>1)^0xA001;
  7498. }
  7499. else
  7500. {
  7501. retval>>= 1;
  7502. }
  7503. }
  7504. i++;
  7505. }
  7506. return retval;
  7507. }
  7508. /*:717*//*718:*/
  7509. #line 17403 "./typica.w"
  7510. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  7511. const char*callback)
  7512. {
  7513. messageQueue.append(request);
  7514. retObjQueue.append(object);
  7515. callbackQueue.append(const_cast<char*> (callback));
  7516. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  7517. {
  7518. sendNextMessage();
  7519. }
  7520. }
  7521. void ModbusRTUDevice::sendNextMessage()
  7522. {
  7523. if(messageQueue.size()> 0&&!waiting)
  7524. {
  7525. QByteArray message= messageQueue.at(0);
  7526. quint16 crc= calculateCRC(message);
  7527. char*check= (char*)&crc;
  7528. message.append(check[0]);
  7529. message.append(check[1]);
  7530. port->write(message);
  7531. messageDelayTimer->start(delayTime);
  7532. waiting= true;
  7533. }
  7534. else
  7535. {
  7536. emit queueEmpty();
  7537. }
  7538. }
  7539. void ModbusRTUDevice::outputSV(double value)
  7540. {
  7541. for(int i= 0;i<decimalPosition;i++)
  7542. {
  7543. value*= 10;
  7544. }
  7545. quint16 outval= (quint16)value;
  7546. QByteArray message(outputSVStub);
  7547. char*valBytes= (char*)&outval;
  7548. message.append(valBytes[1]);
  7549. message.append(valBytes[0]);
  7550. queueMessage(message,this,"ignore(QByteArray)");
  7551. }
  7552. /*:718*//*719:*/
  7553. #line 17451 "./typica.w"
  7554. void ModbusRTUDevice::ignore(QByteArray)
  7555. {
  7556. return;
  7557. }
  7558. /*:719*/
  7559. #line 806 "./typica.w"
  7560. /*609:*/
  7561. #line 14182 "./typica.w"
  7562. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  7563. DeviceTreeModelNode*parent)
  7564. :domNode(node),rowNumber(row),parentItem(parent)
  7565. {
  7566. }
  7567. DeviceTreeModelNode::~DeviceTreeModelNode()
  7568. {
  7569. QHash<int,DeviceTreeModelNode*> ::iterator i;
  7570. for(i= children.begin();i!=children.end();i++)
  7571. {
  7572. delete i.value();
  7573. }
  7574. }
  7575. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  7576. {
  7577. return parentItem;
  7578. }
  7579. int DeviceTreeModelNode::row()
  7580. {
  7581. return rowNumber;
  7582. }
  7583. QDomNode DeviceTreeModelNode::node()const
  7584. {
  7585. return domNode;
  7586. }
  7587. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  7588. {
  7589. if(children.contains(index))
  7590. {
  7591. return children[index];
  7592. }
  7593. if(index>=0&&index<domNode.childNodes().count())
  7594. {
  7595. QDomNode childNode= domNode.childNodes().item(index);
  7596. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  7597. index,this);
  7598. children[index]= childItem;
  7599. return childItem;
  7600. }
  7601. return NULL;
  7602. }
  7603. /*:609*/
  7604. #line 807 "./typica.w"
  7605. /*611:*/
  7606. #line 14271 "./typica.w"
  7607. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  7608. :QAbstractItemModel(parent)
  7609. {
  7610. document= AppInstance->deviceConfiguration();
  7611. QDomNodeList elements= document.elementsByTagName("devices");
  7612. if(elements.size()!=1)
  7613. {
  7614. qDebug()<<"Unexpected result when loading device map.";
  7615. }
  7616. treeRoot= elements.at(0);
  7617. root= new DeviceTreeModelNode(treeRoot,0);
  7618. elements= document.elementsByTagName("references");
  7619. if(elements.size()!=1)
  7620. {
  7621. qDebug()<<"No references section. Creating.";
  7622. referenceSection= document.createElement("references");
  7623. document.appendChild(referenceSection);
  7624. }
  7625. else
  7626. {
  7627. referenceSection= elements.at(0);
  7628. }
  7629. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  7630. AppInstance,SLOT(saveDeviceConfiguration()));
  7631. connect(this,SIGNAL(modelReset()),
  7632. AppInstance,SLOT(saveDeviceConfiguration()));
  7633. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7634. AppInstance,SLOT(saveDeviceConfiguration()));
  7635. }
  7636. /*:611*//*612:*/
  7637. #line 14306 "./typica.w"
  7638. int DeviceTreeModel::columnCount(const QModelIndex&)const
  7639. {
  7640. return 1;
  7641. }
  7642. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  7643. {
  7644. if(parent.column()> 0)
  7645. {
  7646. return 0;
  7647. }
  7648. /*613:*/
  7649. #line 14325 "./typica.w"
  7650. DeviceTreeModelNode*parentItem;
  7651. if(!parent.isValid())
  7652. {
  7653. parentItem= root;
  7654. }
  7655. else
  7656. {
  7657. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7658. }
  7659. /*:613*/
  7660. #line 14318 "./typica.w"
  7661. return parentItem->node().childNodes().count();
  7662. }
  7663. /*:612*//*614:*/
  7664. #line 14339 "./typica.w"
  7665. QModelIndex DeviceTreeModel::index(int row,int column,
  7666. const QModelIndex&parent)const
  7667. {
  7668. if(!hasIndex(row,column,parent))
  7669. {
  7670. return QModelIndex();
  7671. }
  7672. /*613:*/
  7673. #line 14325 "./typica.w"
  7674. DeviceTreeModelNode*parentItem;
  7675. if(!parent.isValid())
  7676. {
  7677. parentItem= root;
  7678. }
  7679. else
  7680. {
  7681. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7682. }
  7683. /*:613*/
  7684. #line 14347 "./typica.w"
  7685. DeviceTreeModelNode*childItem= parentItem->child(row);
  7686. if(childItem)
  7687. {
  7688. return createIndex(row,column,childItem);
  7689. }
  7690. return QModelIndex();
  7691. }
  7692. /*:614*//*615:*/
  7693. #line 14358 "./typica.w"
  7694. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  7695. {
  7696. if(!child.isValid())
  7697. {
  7698. return QModelIndex();
  7699. }
  7700. DeviceTreeModelNode*childItem=
  7701. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  7702. DeviceTreeModelNode*parentItem= childItem->parent();
  7703. if(!parentItem||parentItem==root)
  7704. {
  7705. return QModelIndex();
  7706. }
  7707. return createIndex(parentItem->row(),0,parentItem);
  7708. }
  7709. /*:615*//*616:*/
  7710. #line 14377 "./typica.w"
  7711. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  7712. {
  7713. if(!index.isValid())
  7714. {
  7715. return 0;
  7716. }
  7717. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  7718. }
  7719. /*:616*//*617:*/
  7720. #line 14392 "./typica.w"
  7721. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  7722. {
  7723. if(!index.isValid())
  7724. {
  7725. return QVariant();
  7726. }
  7727. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  7728. {
  7729. return QVariant();
  7730. }
  7731. DeviceTreeModelNode*item=
  7732. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7733. QDomNode node= item->node();
  7734. QDomElement element= node.toElement();
  7735. switch(role)
  7736. {
  7737. case Qt::DisplayRole:
  7738. case Qt::EditRole:
  7739. return QVariant(element.attribute("name"));
  7740. case Qt::UserRole:
  7741. return QVariant(element.attribute("reference"));
  7742. default:
  7743. return QVariant();
  7744. }
  7745. return QVariant();
  7746. }
  7747. /*:617*//*618:*/
  7748. #line 14424 "./typica.w"
  7749. bool DeviceTreeModel::setData(const QModelIndex&index,
  7750. const QVariant&value,int)
  7751. {
  7752. if(!index.isValid())
  7753. {
  7754. return false;
  7755. }
  7756. DeviceTreeModelNode*item=
  7757. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7758. QDomNode node= item->node();
  7759. QDomElement element= node.toElement();
  7760. element.setAttribute("name",value.toString());
  7761. emit dataChanged(index,index);
  7762. return true;
  7763. }
  7764. /*:618*//*619:*/
  7765. #line 14447 "./typica.w"
  7766. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  7767. const QModelIndex&parent)
  7768. {
  7769. QString referenceID= QUuid::createUuid().toString();
  7770. /*613:*/
  7771. #line 14325 "./typica.w"
  7772. DeviceTreeModelNode*parentItem;
  7773. if(!parent.isValid())
  7774. {
  7775. parentItem= root;
  7776. }
  7777. else
  7778. {
  7779. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7780. }
  7781. /*:613*/
  7782. #line 14452 "./typica.w"
  7783. QDomNode parentNode= parentItem->node();
  7784. int newRowNumber= rowCount(parent);
  7785. beginInsertRows(parent,newRowNumber,newRowNumber);
  7786. QDomElement deviceElement= document.createElement("node");
  7787. deviceElement.setAttribute("name",name);
  7788. deviceElement.setAttribute("reference",referenceID);
  7789. parentNode.appendChild(deviceElement);
  7790. QDomElement referenceElement= document.createElement("reference");
  7791. referenceElement.setAttribute("id",referenceID);
  7792. referenceElement.setAttribute("driver",driver);
  7793. referenceSection.appendChild(referenceElement);
  7794. endInsertRows();
  7795. }
  7796. /*:619*//*620:*/
  7797. #line 14470 "./typica.w"
  7798. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  7799. {
  7800. /*613:*/
  7801. #line 14325 "./typica.w"
  7802. DeviceTreeModelNode*parentItem;
  7803. if(!parent.isValid())
  7804. {
  7805. parentItem= root;
  7806. }
  7807. else
  7808. {
  7809. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7810. }
  7811. /*:613*/
  7812. #line 14473 "./typica.w"
  7813. QDomNode parentNode= parentItem->node();
  7814. QDomNodeList childNodes= parentNode.childNodes();
  7815. if(childNodes.size()<row+count)
  7816. {
  7817. return false;
  7818. }
  7819. beginRemoveRows(parent,row,row+count-1);
  7820. QList<QDomElement> removalList;
  7821. for(int i= row;i<row+count;i++)
  7822. {
  7823. removalList.append(childNodes.at(i).toElement());
  7824. }
  7825. QDomElement element;
  7826. QDomElement reference;
  7827. for(int i= 0;i<count;i++)
  7828. {
  7829. element= removalList.at(i);
  7830. if(element.hasAttribute("reference"))
  7831. {
  7832. reference= referenceElement(element.attribute("reference"));
  7833. if(!reference.isNull())
  7834. {
  7835. referenceSection.removeChild(reference);
  7836. }
  7837. }
  7838. parentNode.removeChild(element);
  7839. }
  7840. endRemoveRows();
  7841. beginResetModel();
  7842. delete root;
  7843. root= new DeviceTreeModelNode(treeRoot,0);
  7844. endResetModel();
  7845. return true;
  7846. }
  7847. /*:620*//*621:*/
  7848. #line 14512 "./typica.w"
  7849. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  7850. {
  7851. QDomNodeList childNodes= referenceSection.childNodes();
  7852. QDomElement element;
  7853. for(int i= 0;i<childNodes.size();i++)
  7854. {
  7855. element= childNodes.at(i).toElement();
  7856. if(element.hasAttribute("id"))
  7857. {
  7858. if(element.attribute("id")==id)
  7859. {
  7860. return element;
  7861. }
  7862. }
  7863. }
  7864. return QDomElement();
  7865. }
  7866. /*:621*//*622:*/
  7867. #line 14533 "./typica.w"
  7868. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  7869. {
  7870. return QVariant();
  7871. }
  7872. /*:622*//*623:*/
  7873. #line 14542 "./typica.w"
  7874. DeviceTreeModel::~DeviceTreeModel()
  7875. {
  7876. delete root;
  7877. }
  7878. /*:623*/
  7879. #line 808 "./typica.w"
  7880. /*649:*/
  7881. #line 15012 "./typica.w"
  7882. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  7883. DeviceTreeModel*model,const QModelIndex&index)
  7884. :QWidget(NULL),deviceModel(model),currentNode(index)
  7885. {
  7886. }
  7887. /*:649*//*650:*/
  7888. #line 15024 "./typica.w"
  7889. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  7890. const QString&value)
  7891. {
  7892. QDomElement referenceElement= deviceModel->referenceElement(
  7893. deviceModel->data(currentNode,Qt::UserRole).toString());
  7894. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7895. QDomElement node;
  7896. bool found= false;
  7897. for(int i= 0;i<configData.size();i++)
  7898. {
  7899. node= configData.at(i).toElement();
  7900. if(node.attribute("name")==name)
  7901. {
  7902. node.setAttribute("value",value);
  7903. found= true;
  7904. break;
  7905. }
  7906. }
  7907. if(!found)
  7908. {
  7909. node= AppInstance->deviceConfiguration().createElement("attribute");
  7910. node.setAttribute("name",name);
  7911. node.setAttribute("value",value);
  7912. referenceElement.appendChild(node);
  7913. }
  7914. AppInstance->saveDeviceConfiguration();
  7915. }
  7916. /*:650*//*651:*/
  7917. #line 15058 "./typica.w"
  7918. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  7919. const QString&driver)
  7920. {
  7921. deviceModel->newNode(name,driver,currentNode);
  7922. }
  7923. /*:651*/
  7924. #line 809 "./typica.w"
  7925. /*641:*/
  7926. #line 14880 "./typica.w"
  7927. DeviceConfigurationWindow::DeviceConfigurationWindow():QMainWindow(NULL),
  7928. view(new QTreeView),configArea(new QScrollArea)
  7929. {
  7930. QSplitter*splitter= new QSplitter;
  7931. QWidget*leftWidget= new QWidget;
  7932. leftWidget->setMinimumWidth(200);
  7933. QVBoxLayout*left= new QVBoxLayout;
  7934. view->setAnimated(true);
  7935. view->setSelectionMode(QAbstractItemView::SingleSelection);
  7936. document= AppInstance->deviceConfiguration();
  7937. model= new DeviceTreeModel;
  7938. view->setModel(model);
  7939. view->expandAll();
  7940. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  7941. QHBoxLayout*treeButtons= new QHBoxLayout;
  7942. QToolButton*addDeviceButton= new QToolButton;
  7943. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  7944. addDeviceButton->setToolTip(tr("New Roaster"));
  7945. connect(addDeviceButton,SIGNAL(clicked()),
  7946. this,SLOT(addDevice()));
  7947. QToolButton*removeNodeButton= new QToolButton;
  7948. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  7949. removeNodeButton->setToolTip(tr("Delete Selection"));
  7950. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  7951. treeButtons->addWidget(addDeviceButton);
  7952. treeButtons->addWidget(removeNodeButton);
  7953. left->addWidget(view);
  7954. left->addLayout(treeButtons);
  7955. leftWidget->setLayout(left);
  7956. splitter->addWidget(leftWidget);
  7957. configArea->setMinimumWidth(580);
  7958. configArea->setMinimumHeight(460);
  7959. splitter->addWidget(configArea);
  7960. setCentralWidget(splitter);
  7961. connect(view,SIGNAL(activated(QModelIndex)),
  7962. this,SLOT(newSelection(QModelIndex)));
  7963. connect(view,SIGNAL(clicked(QModelIndex)),
  7964. this,SLOT(newSelection(QModelIndex)));
  7965. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7966. view,SLOT(expand(QModelIndex)));
  7967. }
  7968. /*:641*//*642:*/
  7969. #line 14926 "./typica.w"
  7970. void DeviceConfigurationWindow::addDevice()
  7971. {
  7972. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  7973. }
  7974. /*:642*//*643:*/
  7975. #line 14934 "./typica.w"
  7976. void DeviceConfigurationWindow::removeNode()
  7977. {
  7978. QModelIndex index= view->currentIndex();
  7979. if(index.isValid())
  7980. {
  7981. int row= index.row();
  7982. QModelIndex parent= index.parent();
  7983. model->removeRow(row,parent);
  7984. }
  7985. }
  7986. /*:643*//*644:*/
  7987. #line 14950 "./typica.w"
  7988. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  7989. {
  7990. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  7991. if(editor)
  7992. {
  7993. configArea->setWidget(editor);
  7994. editor->show();
  7995. }
  7996. }
  7997. /*:644*/
  7998. #line 810 "./typica.w"
  7999. /*664:*/
  8000. #line 15354 "./typica.w"
  8001. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  8002. const QModelIndex&index):
  8003. BasicDeviceConfigurationWidget(model,index)
  8004. {
  8005. QFormLayout*layout= new QFormLayout;
  8006. QLineEdit*columnName= new QLineEdit;
  8007. layout->addRow(tr("Column Name:"),columnName);
  8008. QComboBox*typeSelector= new QComboBox;
  8009. typeSelector->addItem("J");
  8010. typeSelector->addItem("K");
  8011. typeSelector->addItem("T");
  8012. typeSelector->addItem("B");
  8013. typeSelector->addItem("E");
  8014. typeSelector->addItem("N");
  8015. typeSelector->addItem("R");
  8016. typeSelector->addItem("S");
  8017. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8018. setLayout(layout);
  8019. /*654:*/
  8020. #line 15164 "./typica.w"
  8021. QDomElement referenceElement=
  8022. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8023. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8024. QDomElement node;
  8025. /*:654*/
  8026. #line 15373 "./typica.w"
  8027. for(int i= 0;i<configData.size();i++)
  8028. {
  8029. node= configData.at(i).toElement();
  8030. if(node.attribute("name")=="type")
  8031. {
  8032. typeSelector->setCurrentIndex(
  8033. typeSelector->findText(node.attribute("value")));
  8034. }
  8035. else if(node.attribute("name")=="columnname")
  8036. {
  8037. columnName->setText(node.attribute("value"));
  8038. }
  8039. }
  8040. updateThermocoupleType(typeSelector->currentText());
  8041. updateColumnName(columnName->text());
  8042. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  8043. this,SLOT(updateThermocoupleType(QString)));
  8044. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8045. }
  8046. /*:664*//*665:*/
  8047. #line 15397 "./typica.w"
  8048. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  8049. {
  8050. updateAttribute("type",type);
  8051. }
  8052. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  8053. {
  8054. updateAttribute("columnname",name);
  8055. }
  8056. /*:665*/
  8057. #line 811 "./typica.w"
  8058. /*660:*/
  8059. #line 15269 "./typica.w"
  8060. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  8061. const QModelIndex&index)
  8062. :BasicDeviceConfigurationWidget(model,index)
  8063. {
  8064. QVBoxLayout*layout= new QVBoxLayout;
  8065. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8066. QLabel*label= new QLabel(tr("Device ID:"));
  8067. QLineEdit*deviceId= new QLineEdit;
  8068. deviceIdLayout->addWidget(label);
  8069. deviceIdLayout->addWidget(deviceId);
  8070. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8071. layout->addLayout(deviceIdLayout);
  8072. layout->addWidget(addChannelButton);
  8073. /*654:*/
  8074. #line 15164 "./typica.w"
  8075. QDomElement referenceElement=
  8076. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8077. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8078. QDomElement node;
  8079. /*:654*/
  8080. #line 15283 "./typica.w"
  8081. for(int i= 0;i<configData.size();i++)
  8082. {
  8083. node= configData.at(i).toElement();
  8084. if(node.attribute("name")=="deviceID")
  8085. {
  8086. deviceId->setText(node.attribute("value","Dev1"));
  8087. break;
  8088. }
  8089. }
  8090. updateDeviceId(deviceId->text());
  8091. connect(addChannelButton,SIGNAL(clicked()),
  8092. this,SLOT(addChannel()));
  8093. connect(deviceId,SIGNAL(textEdited(QString)),
  8094. this,SLOT(updateDeviceId(QString)));
  8095. setLayout(layout);
  8096. }
  8097. /*:660*//*661:*/
  8098. #line 15305 "./typica.w"
  8099. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  8100. {
  8101. updateAttribute("deviceID",newId);
  8102. }
  8103. /*:661*//*662:*/
  8104. #line 15313 "./typica.w"
  8105. void NiDaqMxBase9211ConfWidget::addChannel()
  8106. {
  8107. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8108. }
  8109. /*:662*/
  8110. #line 812 "./typica.w"
  8111. /*658:*/
  8112. #line 15220 "./typica.w"
  8113. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  8114. DeviceTreeModel*model,const QModelIndex&index):
  8115. BasicDeviceConfigurationWidget(model,index)
  8116. {
  8117. QHBoxLayout*layout= new QHBoxLayout;
  8118. QToolButton*addDeviceButton= new QToolButton;
  8119. addDeviceButton->setText(tr("Add Device"));
  8120. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  8121. "nidaqmxbase9211series");
  8122. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8123. "nidaqmxbase9211series");
  8124. connect(add9211,SIGNAL(triggered(QString,QString)),
  8125. this,SLOT(insertChildNode(QString,QString)));
  8126. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8127. this,SLOT(insertChildNode(QString,QString)));
  8128. QMenu*deviceMenu= new QMenu;
  8129. deviceMenu->addAction(add9211);
  8130. deviceMenu->addAction(add9211a);
  8131. addDeviceButton->setMenu(deviceMenu);
  8132. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8133. layout->addWidget(addDeviceButton);
  8134. setLayout(layout);
  8135. }
  8136. /*:658*/
  8137. #line 813 "./typica.w"
  8138. /*547:*/
  8139. #line 12807 "./typica.w"
  8140. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  8141. QObject*parent):
  8142. QAction(reportName,parent),reportFile(fileName)
  8143. {
  8144. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  8145. }
  8146. /*:547*//*548:*/
  8147. #line 12823 "./typica.w"
  8148. void ReportAction::createReport()
  8149. {
  8150. QFile file(reportFile);
  8151. QDomDocument document;
  8152. if(file.open(QIODevice::ReadOnly))
  8153. {
  8154. document.setContent(&file,true);
  8155. QDomElement element= document.documentElement();
  8156. QScriptEngine*engine= AppInstance->engine;
  8157. QScriptContext*context= engine->pushContext();
  8158. QScriptValue object;
  8159. QString targetID= reportFile;
  8160. /*161:*/
  8161. #line 3891 "./typica.w"
  8162. ScriptQMainWindow*window= new ScriptQMainWindow;
  8163. window->setObjectName(targetID);
  8164. object= engine->newQObject(window);
  8165. setQMainWindowProperties(object,engine);
  8166. QWidget*central= new(QWidget);
  8167. central->setParent(window);
  8168. central->setObjectName("centralWidget");
  8169. window->setCentralWidget(central);
  8170. if(element.hasChildNodes())
  8171. {
  8172. /*162:*/
  8173. #line 3926 "./typica.w"
  8174. QStack<QWidget*> widgetStack;
  8175. QStack<QLayout*> layoutStack;
  8176. QString windowScript;
  8177. widgetStack.push(central);
  8178. QDomNodeList windowChildren= element.childNodes();
  8179. int i= 0;
  8180. while(i<windowChildren.count())
  8181. {
  8182. QDomNode current;
  8183. QDomElement element;
  8184. current= windowChildren.at(i);
  8185. if(current.isElement())
  8186. {
  8187. element= current.toElement();
  8188. if(element.tagName()=="program")
  8189. {
  8190. windowScript.append(element.text());
  8191. }
  8192. else if(element.tagName()=="layout")
  8193. {
  8194. addLayoutToWidget(element,&widgetStack,&layoutStack);
  8195. }
  8196. else if(element.tagName()=="menu")
  8197. {
  8198. /*163:*/
  8199. #line 3973 "./typica.w"
  8200. QMenuBar*bar= window->menuBar();
  8201. bar->setParent(window);
  8202. bar->setObjectName("menuBar");
  8203. if(element.hasAttribute("name"))
  8204. {
  8205. QMenu*menu= bar->addMenu(element.attribute("name"));
  8206. menu->setParent(bar);
  8207. if(element.hasAttribute("type"))
  8208. {
  8209. if(element.attribute("type")=="reports")
  8210. {
  8211. if(element.hasAttribute("src"))
  8212. {
  8213. /*545:*/
  8214. #line 12770 "./typica.w"
  8215. QSettings settings;
  8216. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  8217. arg(element.attribute("src")));
  8218. directory.setFilter(QDir::Files);
  8219. directory.setSorting(QDir::Name);
  8220. QStringList nameFilter;
  8221. nameFilter<<"*.xml";
  8222. directory.setNameFilters(nameFilter);
  8223. QFileInfoList reportFiles= directory.entryInfoList();
  8224. for(int i= 0;i<reportFiles.size();i++)
  8225. {
  8226. QFileInfo reportFile= reportFiles.at(i);
  8227. /*549:*/
  8228. #line 12847 "./typica.w"
  8229. QString path= reportFile.absoluteFilePath();
  8230. QFile file(path);
  8231. if(file.open(QIODevice::ReadOnly))
  8232. {
  8233. QDomDocument document;
  8234. document.setContent(&file,true);
  8235. QDomElement root= document.documentElement();
  8236. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  8237. if(!titleNode.isNull())
  8238. {
  8239. QDomElement titleElement= titleNode.toElement();
  8240. QString title= titleElement.text();
  8241. if(!title.isEmpty())
  8242. {
  8243. QStringList hierarchy= title.split(":->");
  8244. QMenu*insertionPoint= menu;
  8245. /*550:*/
  8246. #line 12874 "./typica.w"
  8247. for(int j= 0;j<hierarchy.size()-1;j++)
  8248. {
  8249. QObjectList menuList= insertionPoint->children();
  8250. bool menuFound= false;
  8251. for(int k= 0;k<menuList.size();k++)
  8252. {
  8253. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  8254. if(currentItem)
  8255. {
  8256. if(currentItem->title()==hierarchy.at(j))
  8257. {
  8258. menuFound= true;
  8259. insertionPoint= currentItem;
  8260. break;
  8261. }
  8262. }
  8263. }
  8264. if(!menuFound)
  8265. {
  8266. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  8267. }
  8268. }
  8269. /*:550*/
  8270. #line 12864 "./typica.w"
  8271. ReportAction*action= new ReportAction(path,hierarchy.last());
  8272. insertionPoint->addAction(action);
  8273. }
  8274. }
  8275. }
  8276. /*:549*/
  8277. #line 12783 "./typica.w"
  8278. }
  8279. /*:545*/
  8280. #line 3987 "./typica.w"
  8281. }
  8282. }
  8283. }
  8284. if(element.hasChildNodes())
  8285. {
  8286. /*164:*/
  8287. #line 4000 "./typica.w"
  8288. QDomNodeList menuItems= element.childNodes();
  8289. int j= 0;
  8290. while(j<menuItems.count())
  8291. {
  8292. QDomNode item= menuItems.at(j);
  8293. if(item.isElement())
  8294. {
  8295. QDomElement itemElement= item.toElement();
  8296. if(itemElement.tagName()=="item")
  8297. {
  8298. QAction*itemAction= new QAction(itemElement.text(),menu);
  8299. if(itemElement.hasAttribute("id"))
  8300. {
  8301. itemAction->setObjectName(itemElement.attribute("id"));
  8302. }
  8303. if(itemElement.hasAttribute("shortcut"))
  8304. {
  8305. itemAction->setShortcut(itemElement.attribute("shortcut"));
  8306. }
  8307. menu->addAction(itemAction);
  8308. }
  8309. else if(itemElement.tagName()=="separator")
  8310. {
  8311. menu->addSeparator();
  8312. }
  8313. }
  8314. j++;
  8315. }
  8316. #line 1 "./helpmenu.w"
  8317. /*:164*/
  8318. #line 3993 "./typica.w"
  8319. }
  8320. }
  8321. /*:163*/
  8322. #line 3951 "./typica.w"
  8323. }
  8324. }
  8325. i++;
  8326. }
  8327. QScriptValue oldThis= context->thisObject();
  8328. context->setThisObject(object);
  8329. QScriptValue result= engine->evaluate(windowScript);
  8330. /*156:*/
  8331. #line 3740 "./typica.w"
  8332. if(engine->hasUncaughtException())
  8333. {
  8334. int line= engine->uncaughtExceptionLineNumber();
  8335. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  8336. result.toString();
  8337. QString trace;
  8338. foreach(trace,engine->uncaughtExceptionBacktrace())
  8339. {
  8340. qDebug()<<trace;
  8341. }
  8342. }
  8343. /*:156*/
  8344. #line 3959 "./typica.w"
  8345. context->setThisObject(oldThis);
  8346. /*:162*/
  8347. #line 3902 "./typica.w"
  8348. }
  8349. /*165:*/
  8350. #line 9 "./helpmenu.w"
  8351. HelpMenu*helpMenu= new HelpMenu();
  8352. window->menuBar()->addMenu(helpMenu);
  8353. /*:165*/
  8354. #line 3904 "./typica.w"
  8355. window->show();
  8356. /*:161*/
  8357. #line 12836 "./typica.w"
  8358. file.close();
  8359. engine->popContext();
  8360. }
  8361. }
  8362. /*:548*/
  8363. #line 814 "./typica.w"
  8364. /*197:*/
  8365. #line 5048 "./typica.w"
  8366. NumericDelegate::NumericDelegate(QObject*parent):
  8367. QItemDelegate(parent)
  8368. {
  8369. }
  8370. /*:197*//*198:*/
  8371. #line 5060 "./typica.w"
  8372. void NumericDelegate::setEditorData(QWidget*editor,
  8373. const QModelIndex&index)const
  8374. {
  8375. QString value= index.model()->data(index,Qt::EditRole).toString();
  8376. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8377. line->setText(value);
  8378. }
  8379. /*:198*//*199:*/
  8380. #line 5075 "./typica.w"
  8381. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  8382. const QModelIndex&index)const
  8383. {
  8384. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8385. model->setData(index,line->text(),Qt::EditRole);
  8386. QScriptEngine*engine= AppInstance->engine;
  8387. engine->pushContext();
  8388. QString script= QString("Number(%1)").arg(line->text());
  8389. QScriptValue result= engine->evaluate(line->text());
  8390. if(result.isNumber())
  8391. {
  8392. model->setData(index,result.toVariant(),Qt::DisplayRole);
  8393. }
  8394. else
  8395. {
  8396. model->setData(index,QVariant(),Qt::DisplayRole);
  8397. }
  8398. engine->popContext();
  8399. }
  8400. /*:199*//*200:*/
  8401. #line 5098 "./typica.w"
  8402. QWidget*NumericDelegate::createEditor(QWidget*parent,
  8403. const QStyleOptionViewItem&,
  8404. const QModelIndex&)const
  8405. {
  8406. return(new QLineEdit(parent));
  8407. }
  8408. /*:200*//*201:*/
  8409. #line 5109 "./typica.w"
  8410. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  8411. const QStyleOptionViewItem&option,
  8412. const QModelIndex&)const
  8413. {
  8414. editor->setGeometry(option.rect);
  8415. }
  8416. /*:201*/
  8417. #line 815 "./typica.w"
  8418. /*669:*/
  8419. #line 15451 "./typica.w"
  8420. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  8421. const QModelIndex&index)
  8422. :BasicDeviceConfigurationWidget(model,index)
  8423. {
  8424. QHBoxLayout*layout= new QHBoxLayout;
  8425. QToolButton*addDeviceButton= new QToolButton;
  8426. addDeviceButton->setText(tr("Add Device"));
  8427. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8428. "nidaqmx9211series");
  8429. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  8430. "nidaqmxtc01");
  8431. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8432. this,SLOT(insertChildNode(QString,QString)));
  8433. connect(addtc01,SIGNAL(triggered(QString,QString)),
  8434. this,SLOT(insertChildNode(QString,QString)));
  8435. QMenu*deviceMenu= new QMenu;
  8436. deviceMenu->addAction(add9211a);
  8437. deviceMenu->addAction(addtc01);
  8438. addDeviceButton->setMenu(deviceMenu);
  8439. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8440. layout->addWidget(addDeviceButton);
  8441. setLayout(layout);
  8442. }
  8443. /*:669*/
  8444. #line 816 "./typica.w"
  8445. /*671:*/
  8446. #line 15500 "./typica.w"
  8447. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  8448. const QModelIndex&index)
  8449. :BasicDeviceConfigurationWidget(model,index)
  8450. {
  8451. QVBoxLayout*layout= new QVBoxLayout;
  8452. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8453. QLabel*label= new QLabel(tr("Device ID:"));
  8454. QLineEdit*deviceId= new QLineEdit;
  8455. deviceIdLayout->addWidget(label);
  8456. deviceIdLayout->addWidget(deviceId);
  8457. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8458. layout->addLayout(deviceIdLayout);
  8459. layout->addWidget(addChannelButton);
  8460. /*654:*/
  8461. #line 15164 "./typica.w"
  8462. QDomElement referenceElement=
  8463. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8464. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8465. QDomElement node;
  8466. /*:654*/
  8467. #line 15514 "./typica.w"
  8468. for(int i= 0;i<configData.size();i++)
  8469. {
  8470. node= configData.at(i).toElement();
  8471. if(node.attribute("name")=="deviceID")
  8472. {
  8473. deviceId->setText(node.attribute("value","Dev1"));
  8474. break;
  8475. }
  8476. }
  8477. updateDeviceId(deviceId->text());
  8478. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  8479. connect(deviceId,SIGNAL(textEdited(QString)),
  8480. this,SLOT(updateDeviceId(QString)));
  8481. setLayout(layout);
  8482. }
  8483. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  8484. {
  8485. updateAttribute("deviceID",newId);
  8486. }
  8487. void NiDaqMx9211ConfWidget::addChannel()
  8488. {
  8489. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8490. }
  8491. /*:671*/
  8492. #line 817 "./typica.w"
  8493. /*673:*/
  8494. #line 15564 "./typica.w"
  8495. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  8496. const QModelIndex&index)
  8497. :BasicDeviceConfigurationWidget(model,index)
  8498. {
  8499. QFormLayout*layout= new QFormLayout;
  8500. QLineEdit*deviceId= new QLineEdit;
  8501. layout->addRow(tr("Device ID:"),deviceId);
  8502. QLineEdit*columnName= new QLineEdit;
  8503. layout->addRow(tr("Column Name:"),columnName);
  8504. QComboBox*typeSelector= new QComboBox;
  8505. typeSelector->addItem("J");
  8506. typeSelector->addItem("K");
  8507. typeSelector->addItem("T");
  8508. typeSelector->addItem("B");
  8509. typeSelector->addItem("E");
  8510. typeSelector->addItem("N");
  8511. typeSelector->addItem("R");
  8512. typeSelector->addItem("S");
  8513. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8514. /*654:*/
  8515. #line 15164 "./typica.w"
  8516. QDomElement referenceElement=
  8517. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8518. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8519. QDomElement node;
  8520. /*:654*/
  8521. #line 15584 "./typica.w"
  8522. for(int i= 0;i<configData.size();i++)
  8523. {
  8524. node= configData.at(i).toElement();
  8525. if(node.attribute("name")=="deviceID")
  8526. {
  8527. deviceId->setText(node.attribute("value"));
  8528. }
  8529. else if(node.attribute("name")=="type")
  8530. {
  8531. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  8532. }
  8533. else if(node.attribute("name")=="columnname")
  8534. {
  8535. columnName->setText(node.attribute("value"));
  8536. }
  8537. }
  8538. updateDeviceId(deviceId->text());
  8539. updateThermocoupleType(typeSelector->currentText());
  8540. updateColumnName(columnName->text());
  8541. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  8542. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  8543. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8544. setLayout(layout);
  8545. }
  8546. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  8547. {
  8548. updateAttribute("deviceID",newId);
  8549. }
  8550. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  8551. {
  8552. updateAttribute("type",type);
  8553. }
  8554. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  8555. {
  8556. updateAttribute("columnname",name);
  8557. }
  8558. /*:673*/
  8559. #line 818 "./typica.w"
  8560. /*691:*/
  8561. #line 15985 "./typica.w"
  8562. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  8563. const QModelIndex&index)
  8564. :BasicDeviceConfigurationWidget(model,index)
  8565. {
  8566. QFormLayout*layout= new QFormLayout;
  8567. QToolButton*addDeviceButton= new QToolButton;
  8568. addDeviceButton->setText(tr("Add Device"));
  8569. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  8570. "Modbus RTU Device",
  8571. "modbusrtudevice");
  8572. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  8573. this,SLOT(insertChildNode(QString,QString)));
  8574. QMenu*deviceMenu= new QMenu;
  8575. deviceMenu->addAction(addModbusRtuDevice);
  8576. addDeviceButton->setMenu(deviceMenu);
  8577. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8578. layout->addRow(QString(),addDeviceButton);
  8579. PortSelector*port= new PortSelector;
  8580. layout->addRow(tr("Port:"),port);
  8581. connect(port,SIGNAL(currentIndexChanged(QString)),
  8582. this,SLOT(updatePort(QString)));
  8583. connect(port,SIGNAL(editTextChanged(QString)),
  8584. this,SLOT(updatePort(QString)));
  8585. BaudSelector*rate= new BaudSelector;
  8586. layout->addRow(tr("Baud:"),rate);
  8587. connect(rate,SIGNAL(currentIndexChanged(QString)),
  8588. this,SLOT(updateBaudRate(QString)));
  8589. ParitySelector*parity= new ParitySelector;
  8590. layout->addRow(tr("Parity:"),parity);
  8591. connect(parity,SIGNAL(currentIndexChanged(QString)),
  8592. this,SLOT(updateParity(QString)));
  8593. FlowSelector*flow= new FlowSelector;
  8594. layout->addRow(tr("Flow Control:"),flow);
  8595. connect(flow,SIGNAL(currentIndexChanged(QString)),
  8596. this,SLOT(updateFlowControl(QString)));
  8597. StopSelector*stop= new StopSelector;
  8598. layout->addRow(tr("Stop Bits:"),stop);
  8599. connect(stop,SIGNAL(currentIndexChanged(QString)),
  8600. this,SLOT(updateStopBits(QString)));
  8601. /*654:*/
  8602. #line 15164 "./typica.w"
  8603. QDomElement referenceElement=
  8604. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8605. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8606. QDomElement node;
  8607. /*:654*/
  8608. #line 16025 "./typica.w"
  8609. for(int i= 0;i<configData.size();i++)
  8610. {
  8611. node= configData.at(i).toElement();
  8612. if(node.attribute("name")=="port")
  8613. {
  8614. int j= port->findText(node.attribute("value"));
  8615. if(j>=0)
  8616. {
  8617. port->setCurrentIndex(j);
  8618. }
  8619. else
  8620. {
  8621. port->insertItem(0,node.attribute("value"));
  8622. port->setCurrentIndex(0);
  8623. }
  8624. }
  8625. else if(node.attribute("name")=="baudrate")
  8626. {
  8627. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  8628. }
  8629. else if(node.attribute("name")=="parity")
  8630. {
  8631. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  8632. }
  8633. else if(node.attribute("name")=="flowcontrol")
  8634. {
  8635. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  8636. }
  8637. else if(node.attribute("name")=="stopbits")
  8638. {
  8639. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  8640. }
  8641. }
  8642. updatePort(port->currentText());
  8643. updateBaudRate(rate->currentText());
  8644. updateParity(parity->currentText());
  8645. updateFlowControl(flow->currentText());
  8646. updateStopBits(stop->currentText());
  8647. setLayout(layout);
  8648. }
  8649. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  8650. {
  8651. updateAttribute("port",newPort);
  8652. }
  8653. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  8654. {
  8655. updateAttribute("baudrate",newRate);
  8656. }
  8657. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  8658. {
  8659. updateAttribute("parity",newParity);
  8660. }
  8661. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  8662. {
  8663. updateAttribute("flowcontrol",newFlow);
  8664. }
  8665. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  8666. {
  8667. updateAttribute("stopbits",newStopBits);
  8668. }
  8669. /*:691*/
  8670. #line 819 "./typica.w"
  8671. /*693:*/
  8672. #line 16148 "./typica.w"
  8673. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  8674. const QModelIndex&index)
  8675. :BasicDeviceConfigurationWidget(model,index),
  8676. unitSpecificationLayout(new QStackedLayout),
  8677. decimalSpecificationLayout(new QStackedLayout)
  8678. {
  8679. QVBoxLayout*layout= new QVBoxLayout;
  8680. QToolButton*addChannelButton= new QToolButton;
  8681. addChannelButton->setText(tr("Add Channel"));
  8682. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  8683. "Temperature Process Value",
  8684. "modbustemperaturepv");
  8685. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  8686. "Temperature Set Value",
  8687. "modbustemperaturesv");
  8688. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  8689. this,SLOT(insertChildNode(QString,QString)));
  8690. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  8691. this,SLOT(insertChildNode(QString,QString)));
  8692. QMenu*channelMenu= new QMenu;
  8693. channelMenu->addAction(addTemperaturePV);
  8694. channelMenu->addAction(addTemperatureSV);
  8695. addChannelButton->setMenu(channelMenu);
  8696. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  8697. layout->addWidget(addChannelButton);
  8698. QHBoxLayout*stationLayout= new QHBoxLayout;
  8699. QLabel*stationLabel= new QLabel(tr("Station:"));
  8700. QSpinBox*stationNumber= new QSpinBox;
  8701. stationNumber->setMinimum(0);
  8702. stationNumber->setMaximum(255);
  8703. stationLayout->addWidget(stationLabel);
  8704. stationLayout->addWidget(stationNumber);
  8705. layout->addLayout(stationLayout);
  8706. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  8707. layout->addWidget(fixedUnit);
  8708. QWidget*fixedUnitPlaceholder= new QWidget(this);
  8709. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  8710. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  8711. QComboBox*fixedUnitSelector= new QComboBox;
  8712. fixedUnitSelector->addItem("Fahrenheit");
  8713. fixedUnitSelector->addItem("Celsius");
  8714. fixedUnitLayout->addWidget(fixedUnitLabel);
  8715. fixedUnitLayout->addWidget(fixedUnitSelector);
  8716. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  8717. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  8718. QWidget*queriedUnitPlaceholder= new QWidget(this);
  8719. QFormLayout*queriedUnitLayout= new QFormLayout;
  8720. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  8721. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  8722. QSpinBox*valueF= new QSpinBox;
  8723. valueF->setMinimum(0);
  8724. valueF->setMaximum(65535);
  8725. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  8726. QSpinBox*valueC= new QSpinBox;
  8727. valueC->setMinimum(0);
  8728. valueC->setMaximum(65535);
  8729. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  8730. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  8731. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  8732. layout->addLayout(unitSpecificationLayout);
  8733. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  8734. layout->addWidget(fixedPrecision);
  8735. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  8736. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  8737. QSpinBox*fixedPrecisionValue= new QSpinBox;
  8738. fixedPrecisionValue->setMinimum(0);
  8739. fixedPrecisionValue->setMaximum(9);
  8740. fixedPrecisionLayout->addRow("Places after the decimal point:",
  8741. fixedPrecisionValue);
  8742. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  8743. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  8744. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  8745. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  8746. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  8747. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  8748. precisionAddress);
  8749. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  8750. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  8751. layout->addLayout(decimalSpecificationLayout);
  8752. /*654:*/
  8753. #line 15164 "./typica.w"
  8754. QDomElement referenceElement=
  8755. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8756. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8757. QDomElement node;
  8758. /*:654*/
  8759. #line 16228 "./typica.w"
  8760. for(int i= 0;i<configData.size();i++)
  8761. {
  8762. node= configData.at(i).toElement();
  8763. if(node.attribute("name")=="station")
  8764. {
  8765. stationNumber->setValue(node.attribute("value").toInt());
  8766. }
  8767. else if(node.attribute("name")=="fixedunit")
  8768. {
  8769. if(node.attribute("value")=="true")
  8770. {
  8771. fixedUnit->setCheckState(Qt::Checked);
  8772. }
  8773. else if(node.attribute("value")=="false")
  8774. {
  8775. fixedUnit->setCheckState(Qt::Unchecked);
  8776. }
  8777. }
  8778. else if(node.attribute("name")=="fixedprecision")
  8779. {
  8780. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8781. }
  8782. else if(node.attribute("name")=="unit")
  8783. {
  8784. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  8785. }
  8786. else if(node.attribute("name")=="unitaddress")
  8787. {
  8788. unitAddress->setValue(node.attribute("value").toInt());
  8789. }
  8790. else if(node.attribute("name")=="fvalue")
  8791. {
  8792. valueF->setValue(node.attribute("value").toInt());
  8793. }
  8794. else if(node.attribute("name")=="cvalue")
  8795. {
  8796. valueC->setValue(node.attribute("value").toInt());
  8797. }
  8798. else if(node.attribute("name")=="precisionaddress")
  8799. {
  8800. precisionAddress->setValue(node.attribute("value").toInt());
  8801. }
  8802. else if(node.attribute("name")=="precision")
  8803. {
  8804. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8805. }
  8806. }
  8807. updateStationNumber(stationNumber->value());
  8808. updateFixedUnit(fixedUnit->isChecked());
  8809. updateFixedDecimal(fixedPrecision->isChecked());
  8810. updateUnit(fixedUnitSelector->currentText());
  8811. updateUnitAddress(unitAddress->value());
  8812. updateValueF(valueF->value());
  8813. updateValueC(valueC->value());
  8814. updatePrecisionAddress(precisionAddress->value());
  8815. updatePrecisionValue(fixedPrecisionValue->value());
  8816. connect(stationNumber,SIGNAL(valueChanged(int)),
  8817. this,SLOT(updateStationNumber(int)));
  8818. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  8819. this,SLOT(updateUnit(QString)));
  8820. connect(unitAddress,SIGNAL(valueChanged(int)),
  8821. this,SLOT(updateUnitAddress(int)));
  8822. connect(valueF,SIGNAL(valueChanged(int)),
  8823. this,SLOT(updateValueF(int)));
  8824. connect(valueC,SIGNAL(valueChanged(int)),
  8825. this,SLOT(updateValueC(int)));
  8826. connect(fixedUnit,SIGNAL(toggled(bool)),
  8827. this,SLOT(updateFixedUnit(bool)));
  8828. connect(fixedPrecision,SIGNAL(toggled(bool)),
  8829. this,SLOT(updateFixedDecimal(bool)));
  8830. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  8831. this,SLOT(updatePrecisionValue(int)));
  8832. connect(precisionAddress,SIGNAL(valueChanged(int)),
  8833. this,SLOT(updatePrecisionAddress(int)));
  8834. setLayout(layout);
  8835. }
  8836. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  8837. {
  8838. updateAttribute("station",QString("%1").arg(newStation));
  8839. }
  8840. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  8841. {
  8842. if(newFixed)
  8843. {
  8844. unitSpecificationLayout->setCurrentIndex(0);
  8845. updateAttribute("fixedunit","true");
  8846. }
  8847. else
  8848. {
  8849. unitSpecificationLayout->setCurrentIndex(1);
  8850. updateAttribute("fixedunit","false");
  8851. }
  8852. }
  8853. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  8854. {
  8855. if(newFixed)
  8856. {
  8857. decimalSpecificationLayout->setCurrentIndex(0);
  8858. updateAttribute("fixedprecision","true");
  8859. }
  8860. else
  8861. {
  8862. decimalSpecificationLayout->setCurrentIndex(1);
  8863. updateAttribute("fixedprecision","false");
  8864. }
  8865. }
  8866. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  8867. {
  8868. updateAttribute("unit",newUnit);
  8869. }
  8870. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  8871. {
  8872. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  8873. }
  8874. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  8875. {
  8876. updateAttribute("fvalue",QString("%1").arg(newValue));
  8877. }
  8878. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  8879. {
  8880. updateAttribute("cvalue",QString("%1").arg(newValue));
  8881. }
  8882. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  8883. {
  8884. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  8885. }
  8886. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  8887. {
  8888. updateAttribute("precision",QString("%1").arg(newValue));
  8889. }
  8890. /*:693*/
  8891. #line 820 "./typica.w"
  8892. /*695:*/
  8893. #line 16391 "./typica.w"
  8894. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  8895. const QModelIndex&index)
  8896. :BasicDeviceConfigurationWidget(model,index)
  8897. {
  8898. QFormLayout*layout= new QFormLayout;
  8899. ShortHexSpinBox*address= new ShortHexSpinBox;
  8900. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  8901. /*654:*/
  8902. #line 15164 "./typica.w"
  8903. QDomElement referenceElement=
  8904. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8905. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8906. QDomElement node;
  8907. /*:654*/
  8908. #line 16399 "./typica.w"
  8909. for(int i= 0;i<configData.size();i++)
  8910. {
  8911. node= configData.at(i).toElement();
  8912. if(node.attribute("name")=="address")
  8913. {
  8914. address->setValue(node.attribute("value").toInt());
  8915. break;
  8916. }
  8917. }
  8918. updateAddress(address->value());
  8919. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  8920. setLayout(layout);
  8921. }
  8922. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  8923. {
  8924. updateAttribute("address",QString("%1").arg(newAddress));
  8925. }
  8926. /*:695*/
  8927. #line 821 "./typica.w"
  8928. /*697:*/
  8929. #line 16447 "./typica.w"
  8930. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  8931. const QModelIndex&index)
  8932. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  8933. {
  8934. QVBoxLayout*layout= new QVBoxLayout;
  8935. QFormLayout*addressLayout= new QFormLayout;
  8936. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  8937. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  8938. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  8939. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  8940. layout->addLayout(addressLayout);
  8941. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  8942. layout->addWidget(fixedRange);
  8943. QWidget*queriedRangePlaceholder= new QWidget(this);
  8944. QFormLayout*queriedRangeLayout= new QFormLayout;
  8945. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  8946. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  8947. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  8948. lowerAddress);
  8949. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  8950. upperAddress);
  8951. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  8952. boundsLayout->addWidget(queriedRangePlaceholder);
  8953. QWidget*fixedRangePlaceholder= new QWidget(this);
  8954. QFormLayout*fixedRangeLayout= new QFormLayout;
  8955. QLineEdit*fixedLower= new QLineEdit;
  8956. QLineEdit*fixedUpper= new QLineEdit;
  8957. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  8958. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  8959. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  8960. boundsLayout->addWidget(fixedRangePlaceholder);
  8961. layout->addLayout(boundsLayout);
  8962. /*654:*/
  8963. #line 15164 "./typica.w"
  8964. QDomElement referenceElement=
  8965. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8966. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8967. QDomElement node;
  8968. /*:654*/
  8969. #line 16480 "./typica.w"
  8970. for(int i= 0;i<configData.size();i++)
  8971. {
  8972. node= configData.at(i).toElement();
  8973. if(node.attribute("name")=="readaddress")
  8974. {
  8975. readAddress->setValue(node.attribute("value").toInt());
  8976. }
  8977. else if(node.attribute("name")=="writeaddress")
  8978. {
  8979. writeAddress->setValue(node.attribute("value").toInt());
  8980. }
  8981. else if(node.attribute("name")=="fixedrange")
  8982. {
  8983. if(node.attribute("value")=="true")
  8984. {
  8985. fixedRange->setCheckState(Qt::Checked);
  8986. }
  8987. else if(node.attribute("value")=="false")
  8988. {
  8989. fixedRange->setCheckState(Qt::Unchecked);
  8990. }
  8991. }
  8992. else if(node.attribute("name")=="fixedlower")
  8993. {
  8994. fixedLower->setText(node.attribute("value"));
  8995. }
  8996. else if(node.attribute("name")=="fixedupper")
  8997. {
  8998. fixedUpper->setText(node.attribute("value"));
  8999. }
  9000. else if(node.attribute("name")=="loweraddress")
  9001. {
  9002. lowerAddress->setValue(node.attribute("value").toInt());
  9003. }
  9004. else if(node.attribute("name")=="upperaddress")
  9005. {
  9006. upperAddress->setValue(node.attribute("value").toInt());
  9007. }
  9008. }
  9009. updateReadAddress(readAddress->value());
  9010. updateWriteAddress(writeAddress->value());
  9011. updateFixedRange(fixedRange->isChecked());
  9012. updateLower(fixedLower->text());
  9013. updateUpper(fixedUpper->text());
  9014. updateLowerAddress(lowerAddress->value());
  9015. updateUpperAddress(upperAddress->value());
  9016. connect(readAddress,SIGNAL(valueChanged(int)),
  9017. this,SLOT(updateReadAddress(int)));
  9018. connect(writeAddress,SIGNAL(valueChanged(int)),
  9019. this,SLOT(updateWriteAddress(int)));
  9020. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  9021. connect(fixedLower,SIGNAL(textChanged(QString)),
  9022. this,SLOT(updateLower(QString)));
  9023. connect(fixedUpper,SIGNAL(textChanged(QString)),
  9024. this,SLOT(updateUpper(QString)));
  9025. connect(lowerAddress,SIGNAL(valueChanged(int)),
  9026. this,SLOT(updateLowerAddress(int)));
  9027. connect(upperAddress,SIGNAL(valueChanged(int)),
  9028. this,SLOT(updateUpperAddress(int)));
  9029. setLayout(layout);
  9030. }
  9031. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  9032. {
  9033. updateAttribute("readaddress",QString("%1").arg(newAddress));
  9034. }
  9035. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  9036. {
  9037. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  9038. }
  9039. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  9040. {
  9041. if(fixed)
  9042. {
  9043. updateAttribute("fixedrange","true");
  9044. boundsLayout->setCurrentIndex(1);
  9045. }
  9046. else
  9047. {
  9048. updateAttribute("fixedrange","false");
  9049. boundsLayout->setCurrentIndex(0);
  9050. }
  9051. }
  9052. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  9053. {
  9054. updateAttribute("fixedlower",lower);
  9055. }
  9056. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  9057. {
  9058. updateAttribute("fixedupper",upper);
  9059. }
  9060. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  9061. {
  9062. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  9063. }
  9064. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  9065. {
  9066. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  9067. }
  9068. /*:697*/
  9069. #line 822 "./typica.w"
  9070. /*653:*/
  9071. #line 15094 "./typica.w"
  9072. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9073. :BasicDeviceConfigurationWidget(model,index)
  9074. {
  9075. QVBoxLayout*layout= new QVBoxLayout;
  9076. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  9077. QMenu*deviceMenu= new QMenu;
  9078. NodeInserter*insertAction;
  9079. foreach(insertAction,AppInstance->topLevelNodeInserters)
  9080. {
  9081. connect(insertAction,SIGNAL(triggered(QString,QString)),
  9082. this,SLOT(insertChildNode(QString,QString)));
  9083. deviceMenu->addAction(insertAction);
  9084. }
  9085. addDeviceButton->setMenu(deviceMenu);
  9086. layout->addWidget(addDeviceButton);
  9087. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  9088. QMenu*annotationMenu= new QMenu;
  9089. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  9090. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  9091. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  9092. annotationMenu->addAction(basicButtonInserter);
  9093. annotationMenu->addAction(countingButtonInserter);
  9094. annotationMenu->addAction(spinBoxInserter);
  9095. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  9096. this,SLOT(insertChildNode(QString,QString)));
  9097. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  9098. this,SLOT(insertChildNode(QString,QString)));
  9099. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  9100. this,SLOT(insertChildNode(QString,QString)));
  9101. addAnnotationControlButton->setMenu(annotationMenu);
  9102. layout->addWidget(addAnnotationControlButton);
  9103. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  9104. QMenu*advancedMenu= new QMenu;
  9105. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  9106. advancedMenu->addAction(linearsplineinserter);
  9107. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  9108. advancedMenu->addAction(translationinserter);
  9109. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9110. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9111. advancedButton->setMenu(advancedMenu);
  9112. layout->addWidget(advancedButton);
  9113. QHBoxLayout*idLayout= new QHBoxLayout;
  9114. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  9115. idLayout->addWidget(idLabel);
  9116. QSpinBox*id= new QSpinBox;
  9117. idLayout->addWidget(id);
  9118. layout->addLayout(idLayout);
  9119. /*654:*/
  9120. #line 15164 "./typica.w"
  9121. QDomElement referenceElement=
  9122. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9123. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9124. QDomElement node;
  9125. /*:654*/
  9126. #line 15142 "./typica.w"
  9127. for(int i= 0;i<configData.size();i++)
  9128. {
  9129. node= configData.at(i).toElement();
  9130. if(node.attribute("name")=="databaseid")
  9131. {
  9132. id->setValue(node.attribute("value").toInt());
  9133. break;
  9134. }
  9135. }
  9136. updateRoasterId(id->value());
  9137. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  9138. setLayout(layout);
  9139. }
  9140. /*:653*//*655:*/
  9141. #line 15174 "./typica.w"
  9142. void RoasterConfWidget::updateRoasterId(int id)
  9143. {
  9144. updateAttribute("databaseid",QString("%1").arg(id));
  9145. }
  9146. /*:655*/
  9147. #line 823 "./typica.w"
  9148. /*701:*/
  9149. #line 16630 "./typica.w"
  9150. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9151. :BasicDeviceConfigurationWidget(model,index)
  9152. {
  9153. QFormLayout*layout= new QFormLayout;
  9154. QLineEdit*buttonTextEdit= new QLineEdit;
  9155. QLineEdit*annotationTextEdit= new QLineEdit;
  9156. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9157. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9158. /*654:*/
  9159. #line 15164 "./typica.w"
  9160. QDomElement referenceElement=
  9161. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9162. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9163. QDomElement node;
  9164. /*:654*/
  9165. #line 16639 "./typica.w"
  9166. for(int i= 0;i<configData.size();i++)
  9167. {
  9168. node= configData.at(i).toElement();
  9169. if(node.attribute("name")=="buttontext")
  9170. {
  9171. buttonTextEdit->setText(node.attribute("value"));
  9172. }
  9173. else if(node.attribute("name")=="annotationtext")
  9174. {
  9175. annotationTextEdit->setText(node.attribute("value"));
  9176. }
  9177. }
  9178. updateButtonText(buttonTextEdit->text());
  9179. updateAnnotationText(annotationTextEdit->text());
  9180. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9181. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9182. setLayout(layout);
  9183. }
  9184. /*:701*//*702:*/
  9185. #line 16661 "./typica.w"
  9186. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  9187. {
  9188. updateAttribute("buttontext",text);
  9189. }
  9190. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9191. {
  9192. updateAttribute("annotationtext",text);
  9193. }
  9194. /*:702*//*705:*/
  9195. #line 16699 "./typica.w"
  9196. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9197. :BasicDeviceConfigurationWidget(model,index)
  9198. {
  9199. QFormLayout*layout= new QFormLayout;
  9200. QLineEdit*buttonTextEdit= new QLineEdit;
  9201. QLineEdit*annotationTextEdit= new QLineEdit;
  9202. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9203. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9204. /*654:*/
  9205. #line 15164 "./typica.w"
  9206. QDomElement referenceElement=
  9207. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9208. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9209. QDomElement node;
  9210. /*:654*/
  9211. #line 16708 "./typica.w"
  9212. for(int i= 0;i<configData.size();i++)
  9213. {
  9214. node= configData.at(i).toElement();
  9215. if(node.attribute("name")=="buttontext")
  9216. {
  9217. buttonTextEdit->setText(node.attribute("value"));
  9218. }
  9219. else if(node.attribute("name")=="annotationtext")
  9220. {
  9221. annotationTextEdit->setText(node.attribute("value"));
  9222. }
  9223. }
  9224. updateButtonText(buttonTextEdit->text());
  9225. updateAnnotationText(annotationTextEdit->text());
  9226. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9227. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9228. QTextEdit*documentation= new QTextEdit;
  9229. 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."));
  9230. documentation->setReadOnly(true);
  9231. layout->addRow("",documentation);
  9232. setLayout(layout);
  9233. }
  9234. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  9235. {
  9236. updateAttribute("buttontext",text);
  9237. }
  9238. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9239. {
  9240. updateAttribute("annotationtext",text);
  9241. }
  9242. /*:705*/
  9243. #line 824 "./typica.w"
  9244. /*708:*/
  9245. #line 16776 "./typica.w"
  9246. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9247. :BasicDeviceConfigurationWidget(model,index)
  9248. {
  9249. QFormLayout*layout= new QFormLayout;
  9250. QLineEdit*labelEdit= new QLineEdit;
  9251. layout->addRow(tr("Control Label: "),labelEdit);
  9252. QLineEdit*minimumEdit= new QLineEdit;
  9253. layout->addRow(tr("Minimum Value: "),minimumEdit);
  9254. QLineEdit*maximumEdit= new QLineEdit;
  9255. layout->addRow(tr("Maximum Value: "),maximumEdit);
  9256. QSpinBox*precisionEdit= new QSpinBox;
  9257. precisionEdit->setMinimum(0);
  9258. precisionEdit->setMaximum(9);
  9259. layout->addRow(tr("Precision"),precisionEdit);
  9260. QLineEdit*pretext= new QLineEdit;
  9261. layout->addRow(tr("Prefix text"),pretext);
  9262. QLineEdit*posttext= new QLineEdit;
  9263. layout->addRow(tr("Suffix text"),posttext);
  9264. /*654:*/
  9265. #line 15164 "./typica.w"
  9266. QDomElement referenceElement=
  9267. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9268. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9269. QDomElement node;
  9270. /*:654*/
  9271. #line 16795 "./typica.w"
  9272. for(int i= 0;i<configData.size();i++)
  9273. {
  9274. node= configData.at(i).toElement();
  9275. if(node.attribute("name")=="label")
  9276. {
  9277. labelEdit->setText(node.attribute("value"));
  9278. }
  9279. else if(node.attribute("name")=="minimum")
  9280. {
  9281. minimumEdit->setText(node.attribute("value"));
  9282. }
  9283. else if(node.attribute("name")=="maximum")
  9284. {
  9285. maximumEdit->setText(node.attribute("value"));
  9286. }
  9287. else if(node.attribute("name")=="precision")
  9288. {
  9289. precisionEdit->setValue(node.attribute("value").toInt());
  9290. }
  9291. else if(node.attribute("name")=="pretext")
  9292. {
  9293. pretext->setText(node.attribute("value"));
  9294. }
  9295. else if(node.attribute("name")=="posttext")
  9296. {
  9297. posttext->setText(node.attribute("value"));
  9298. }
  9299. }
  9300. updateLabel(labelEdit->text());
  9301. updateMinimum(minimumEdit->text());
  9302. updateMaximum(maximumEdit->text());
  9303. updatePrecision(precisionEdit->value());
  9304. updatePretext(pretext->text());
  9305. updatePosttext(posttext->text());
  9306. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  9307. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  9308. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  9309. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  9310. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  9311. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  9312. setLayout(layout);
  9313. }
  9314. void NoteSpinConfWidget::updateLabel(const QString&text)
  9315. {
  9316. updateAttribute("label",text);
  9317. }
  9318. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  9319. {
  9320. updateAttribute("minimum",minimum);
  9321. }
  9322. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  9323. {
  9324. updateAttribute("maximum",maximum);
  9325. }
  9326. void NoteSpinConfWidget::updatePrecision(int precision)
  9327. {
  9328. updateAttribute("precision",QString("%1").arg(precision));
  9329. }
  9330. void NoteSpinConfWidget::updatePretext(const QString&text)
  9331. {
  9332. updateAttribute("pretext",text);
  9333. }
  9334. void NoteSpinConfWidget::updatePosttext(const QString&text)
  9335. {
  9336. updateAttribute("posttext",text);
  9337. }
  9338. /*:708*/
  9339. #line 825 "./typica.w"
  9340. /*268:*/
  9341. #line 6843 "./typica.w"
  9342. LinearCalibrator::LinearCalibrator(QObject*parent):
  9343. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  9344. {
  9345. }
  9346. /*:268*//*269:*/
  9347. #line 6857 "./typica.w"
  9348. void LinearCalibrator::newMeasurement(Measurement measure)
  9349. {
  9350. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  9351. if(clamp)
  9352. {
  9353. if(outval<Lo1)
  9354. {
  9355. outval= Lo1;
  9356. }
  9357. else if(outval> Up1)
  9358. {
  9359. outval= Up1;
  9360. }
  9361. }
  9362. if(sensitivitySetting>=0.05)
  9363. {
  9364. int temp= qRound(outval/sensitivitySetting);
  9365. outval= temp*sensitivitySetting;
  9366. }
  9367. Measurement adjusted(outval,measure.time(),measure.scale());
  9368. emit measurement(adjusted);
  9369. }
  9370. /*:269*//*270:*/
  9371. #line 6883 "./typica.w"
  9372. double LinearCalibrator::measuredLower()
  9373. {
  9374. return Lo2;
  9375. }
  9376. double LinearCalibrator::measuredUpper()
  9377. {
  9378. return Up2;
  9379. }
  9380. double LinearCalibrator::mappedLower()
  9381. {
  9382. return Lo1;
  9383. }
  9384. double LinearCalibrator::mappedUpper()
  9385. {
  9386. return Up1;
  9387. }
  9388. bool LinearCalibrator::isClosedRange()
  9389. {
  9390. return clamp;
  9391. }
  9392. void LinearCalibrator::setMeasuredLower(double lower)
  9393. {
  9394. Lo2= lower;
  9395. }
  9396. void LinearCalibrator::setMeasuredUpper(double upper)
  9397. {
  9398. Up2= upper;
  9399. }
  9400. void LinearCalibrator::setMappedLower(double lower)
  9401. {
  9402. Lo1= lower;
  9403. }
  9404. void LinearCalibrator::setMappedUpper(double upper)
  9405. {
  9406. Up1= upper;
  9407. }
  9408. void LinearCalibrator::setClosedRange(bool closed)
  9409. {
  9410. clamp= closed;
  9411. }
  9412. void LinearCalibrator::setSensitivity(double sensitivity)
  9413. {
  9414. sensitivitySetting= sensitivity;
  9415. }
  9416. double LinearCalibrator::sensitivity()
  9417. {
  9418. return sensitivitySetting;
  9419. }
  9420. /*:270*/
  9421. #line 826 "./typica.w"
  9422. /*275:*/
  9423. #line 7016 "./typica.w"
  9424. void LinearSplineInterpolator::add_pair(double source,double destination)
  9425. {
  9426. pairs->insert(source,destination);
  9427. make_interpolators();
  9428. }
  9429. void LinearSplineInterpolator::make_interpolators()
  9430. {
  9431. if(pairs->size()> 1)
  9432. {
  9433. while(interpolators->size()> 0)
  9434. {
  9435. LinearCalibrator*removed= interpolators->takeFirst();
  9436. removed->deleteLater();
  9437. }
  9438. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9439. QMap<double,double> ::const_iterator j= i+1;
  9440. while(j!=pairs->constEnd())
  9441. {
  9442. LinearCalibrator*segment= new LinearCalibrator();
  9443. segment->setMeasuredLower(i.key());
  9444. segment->setMappedLower(i.value());
  9445. segment->setMeasuredUpper(j.key());
  9446. segment->setMappedUpper(j.value());
  9447. segment->setClosedRange(false);
  9448. interpolators->append(segment);
  9449. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  9450. i++;
  9451. j++;
  9452. }
  9453. }
  9454. }
  9455. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  9456. QObject(parent),pairs(new QMap<double,double> ),
  9457. interpolators(new QList<LinearCalibrator*> )
  9458. {
  9459. }
  9460. void LinearSplineInterpolator::newMeasurement(Measurement measure)
  9461. {
  9462. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9463. int index= -1;
  9464. while(i!=pairs->constEnd())
  9465. {
  9466. if(measure.temperature()<=i.key())
  9467. {
  9468. break;
  9469. }
  9470. i++;
  9471. index++;
  9472. }
  9473. if(index<0)
  9474. {
  9475. index= 0;
  9476. }
  9477. if(index>=interpolators->size())
  9478. {
  9479. index= interpolators->size()-1;
  9480. }
  9481. if(interpolators->at(index)!=NULL)
  9482. {
  9483. interpolators->at(index)->newMeasurement(measure);
  9484. }
  9485. }
  9486. /*:275*/
  9487. #line 827 "./typica.w"
  9488. /*730:*/
  9489. #line 18077 "./typica.w"
  9490. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9491. :BasicDeviceConfigurationWidget(model,index),knotmodel(new SaltModel(2))
  9492. {
  9493. QFormLayout*layout= new QFormLayout;
  9494. QLineEdit*source= new QLineEdit;
  9495. layout->addRow(tr("Source column name:"),source);
  9496. QLineEdit*destination= new QLineEdit;
  9497. layout->addRow(tr("Destination column name:"),destination);
  9498. knotmodel->setHeaderData(0,Qt::Horizontal,"Input");
  9499. knotmodel->setHeaderData(1,Qt::Horizontal,"Output");
  9500. QTableView*mappingTable= new QTableView;
  9501. mappingTable->setModel(knotmodel);
  9502. NumericDelegate*delegate= new NumericDelegate;
  9503. mappingTable->setItemDelegate(delegate);
  9504. layout->addRow(tr("Mapping data:"),mappingTable);
  9505. /*654:*/
  9506. #line 15164 "./typica.w"
  9507. QDomElement referenceElement=
  9508. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9509. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9510. QDomElement node;
  9511. /*:654*/
  9512. #line 18093 "./typica.w"
  9513. for(int i= 0;i<configData.size();i++)
  9514. {
  9515. node= configData.at(i).toElement();
  9516. if(node.attribute("name")=="source")
  9517. {
  9518. source->setText(node.attribute("value"));
  9519. }
  9520. else if(node.attribute("name")=="destination")
  9521. {
  9522. destination->setText(node.attribute("value"));
  9523. }
  9524. else if(node.attribute("name")=="sourcevalues")
  9525. {
  9526. /*731:*/
  9527. #line 18132 "./typica.w"
  9528. QString data= node.attribute("value");
  9529. if(data.length()> 3)
  9530. {
  9531. data.chop(2);
  9532. data= data.remove(0,2);
  9533. }
  9534. QStringList itemList= data.split(",");
  9535. /*:731*/
  9536. #line 18107 "./typica.w"
  9537. int column= 0;
  9538. /*732:*/
  9539. #line 18144 "./typica.w"
  9540. for(int i= 0;i<itemList.size();i++)
  9541. {
  9542. knotmodel->setData(knotmodel->index(i,column),
  9543. QVariant(itemList.at(i).toDouble()),
  9544. Qt::DisplayRole);
  9545. }
  9546. /*:732*/
  9547. #line 18109 "./typica.w"
  9548. }
  9549. else if(node.attribute("name")=="destinationvalues")
  9550. {
  9551. /*731:*/
  9552. #line 18132 "./typica.w"
  9553. QString data= node.attribute("value");
  9554. if(data.length()> 3)
  9555. {
  9556. data.chop(2);
  9557. data= data.remove(0,2);
  9558. }
  9559. QStringList itemList= data.split(",");
  9560. /*:731*/
  9561. #line 18114 "./typica.w"
  9562. int column= 1;
  9563. /*732:*/
  9564. #line 18144 "./typica.w"
  9565. for(int i= 0;i<itemList.size();i++)
  9566. {
  9567. knotmodel->setData(knotmodel->index(i,column),
  9568. QVariant(itemList.at(i).toDouble()),
  9569. Qt::DisplayRole);
  9570. }
  9571. /*:732*/
  9572. #line 18116 "./typica.w"
  9573. }
  9574. }
  9575. updateSourceColumn(source->text());
  9576. updateDestinationColumn(destination->text());
  9577. updateKnots();
  9578. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  9579. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  9580. connect(knotmodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  9581. setLayout(layout);
  9582. }
  9583. /*:730*//*733:*/
  9584. #line 18155 "./typica.w"
  9585. void LinearSplineInterpolationConfWidget::updateKnots()
  9586. {
  9587. updateAttribute("sourcevalues",knotmodel->arrayLiteral(0,Qt::DisplayRole));
  9588. updateAttribute("destinationvalues",knotmodel->arrayLiteral(1,Qt::DisplayRole));
  9589. }
  9590. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  9591. {
  9592. updateAttribute("source",source);
  9593. }
  9594. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  9595. {
  9596. updateAttribute("destination",dest);
  9597. }
  9598. /*:733*/
  9599. #line 828 "./typica.w"
  9600. /*736:*/
  9601. #line 18198 "./typica.w"
  9602. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9603. :BasicDeviceConfigurationWidget(model,index),
  9604. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  9605. {
  9606. unitSelector->addItem("Fahrenheit");
  9607. unitSelector->addItem("Celsius");
  9608. temperatureValue->setMinimum(0);
  9609. temperatureValue->setMaximum(1000);
  9610. QFormLayout*layout= new QFormLayout;
  9611. QLineEdit*column= new QLineEdit;
  9612. layout->addRow(tr("Column to match:"),column);
  9613. layout->addRow(tr("Unit:"),unitSelector);
  9614. layout->addRow(tr("Value:"),temperatureValue);
  9615. /*654:*/
  9616. #line 15164 "./typica.w"
  9617. QDomElement referenceElement=
  9618. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9619. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9620. QDomElement node;
  9621. /*:654*/
  9622. #line 18212 "./typica.w"
  9623. for(int i= 0;i<configData.size();i++)
  9624. {
  9625. node= configData.at(i).toElement();
  9626. if(node.attribute("name")=="column")
  9627. {
  9628. column->setText(node.attribute("value"));
  9629. }
  9630. else if(node.attribute("name")=="unit")
  9631. {
  9632. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  9633. }
  9634. else if(node.attribute("name")=="value")
  9635. {
  9636. temperatureValue->setValue(node.attribute("value").toDouble());
  9637. }
  9638. }
  9639. updateMatchingColumn(column->text());
  9640. updateTemperature();
  9641. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  9642. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  9643. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  9644. setLayout(layout);
  9645. }
  9646. /*:736*//*737:*/
  9647. #line 18241 "./typica.w"
  9648. void TranslationConfWidget::updateTemperature()
  9649. {
  9650. updateAttribute("unit",unitSelector->currentText());
  9651. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  9652. if(unitSelector->currentText()=="Fahrenheit")
  9653. {
  9654. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  9655. }
  9656. else
  9657. {
  9658. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  9659. }
  9660. }
  9661. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  9662. {
  9663. updateAttribute("column",column);
  9664. }
  9665. /*:737*/
  9666. #line 829 "./typica.w"
  9667. /*:16*/
  9668. #line 757 "./typica.w"
  9669. /*20:*/
  9670. #line 889 "./typica.w"
  9671. template<class TYPE> TYPE getself(QScriptContext*context)
  9672. {
  9673. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  9674. return self;
  9675. }
  9676. template<> QTime getself(QScriptContext*context)
  9677. {
  9678. QTime self= context->thisObject().toVariant().toTime();
  9679. return self;
  9680. }
  9681. template<> SqlQueryConnection*getself(QScriptContext*context)
  9682. {
  9683. SqlQueryConnection*self=
  9684. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  9685. return self;
  9686. }
  9687. template<> QXmlQuery*getself(QScriptContext*context)
  9688. {
  9689. QXmlQuery*self=
  9690. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  9691. return self;
  9692. }
  9693. template<> QXmlStreamWriter*getself(QScriptContext*context)
  9694. {
  9695. QXmlStreamWriter*self=
  9696. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  9697. return self;
  9698. }
  9699. template<> QXmlStreamReader*getself(QScriptContext*context)
  9700. {
  9701. QXmlStreamReader*self=
  9702. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  9703. return self;
  9704. }
  9705. /*:20*//*21:*/
  9706. #line 934 "./typica.w"
  9707. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  9708. {
  9709. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  9710. return argument;
  9711. }
  9712. template<> QString argument(int arg,QScriptContext*context)
  9713. {
  9714. return context->argument(arg).toString();
  9715. }
  9716. template<> QVariant argument(int arg,QScriptContext*context)
  9717. {
  9718. return context->argument(arg).toVariant();
  9719. }
  9720. template<> int argument(int arg,QScriptContext*context)
  9721. {
  9722. return context->argument(arg).toInt32();
  9723. }
  9724. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  9725. {
  9726. return(SqlQueryConnection*)
  9727. qscriptvalue_cast<void*> (context->argument(arg));
  9728. }
  9729. template<> QModelIndex argument(int arg,QScriptContext*context)
  9730. {
  9731. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  9732. }
  9733. /*:21*//*25:*/
  9734. #line 1011 "./typica.w"
  9735. void setQObjectProperties(QScriptValue,QScriptEngine*)
  9736. {
  9737. }
  9738. /*:25*//*27:*/
  9739. #line 1025 "./typica.w"
  9740. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  9741. {
  9742. }
  9743. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  9744. {
  9745. }
  9746. /*:27*//*30:*/
  9747. #line 1064 "./typica.w"
  9748. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  9749. {
  9750. QScriptValue object= engine->newQObject(new QWidget);
  9751. setQWidgetProperties(object,engine);
  9752. return object;
  9753. }
  9754. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  9755. {
  9756. setQObjectProperties(value,engine);
  9757. setQPaintDeviceProperties(value,engine);
  9758. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  9759. value.setProperty("activateWindow",
  9760. engine->newFunction(QWidget_activateWindow));
  9761. }
  9762. /*:30*//*31:*/
  9763. #line 1086 "./typica.w"
  9764. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  9765. {
  9766. if(context->argumentCount()==1)
  9767. {
  9768. QWidget*self= getself<QWidget*> (context);
  9769. QLayout*layout= argument<QLayout*> (0,context);
  9770. if(layout)
  9771. {
  9772. self->setLayout(layout);
  9773. }
  9774. else
  9775. {
  9776. context->throwError("Incorrect argument type passed to "
  9777. "QWidget::setLayout(). This method requires "
  9778. "a QLayout.");
  9779. }
  9780. }
  9781. else
  9782. {
  9783. context->throwError("Incorrect number of arguments passed to "
  9784. "QWidget::setLayout(). This method takes one "
  9785. "QLayout as an argument.");
  9786. }
  9787. return QScriptValue();
  9788. }
  9789. QScriptValue QWidget_activateWindow(QScriptContext*context,
  9790. QScriptEngine*)
  9791. {
  9792. QWidget*self= getself<QWidget*> (context);
  9793. self->activateWindow();
  9794. return QScriptValue();
  9795. }
  9796. /*:31*//*33:*/
  9797. #line 1160 "./typica.w"
  9798. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL)
  9799. {
  9800. }
  9801. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  9802. {
  9803. QSettings settings;
  9804. settings.beginGroup(key);
  9805. settings.setValue("pos",pos());
  9806. settings.setValue("size",size());
  9807. settings.endGroup();
  9808. }
  9809. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  9810. {
  9811. QSettings settings;
  9812. settings.beginGroup(key);
  9813. if(settings.contains("size"))
  9814. {
  9815. resize(settings.value("size").toSize());
  9816. }
  9817. if(settings.contains("pos"))
  9818. {
  9819. move(settings.value("pos").toPoint());
  9820. }
  9821. settings.endGroup();
  9822. }
  9823. void ScriptQMainWindow::displayStatus(const QString&message)
  9824. {
  9825. statusBar()->showMessage(message);
  9826. }
  9827. void ScriptQMainWindow::showEvent(QShowEvent*event)
  9828. {
  9829. if(!event->spontaneous())
  9830. {
  9831. /*35:*/
  9832. #line 1234 "./typica.w"
  9833. QSettings settings;
  9834. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  9835. toByteArray());
  9836. /*:35*/
  9837. #line 1199 "./typica.w"
  9838. event->accept();
  9839. }
  9840. else
  9841. {
  9842. event->ignore();
  9843. }
  9844. }
  9845. void ScriptQMainWindow::show()
  9846. {
  9847. QMainWindow::show();
  9848. }
  9849. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  9850. {
  9851. emit aboutToClose();
  9852. /*34:*/
  9853. #line 1228 "./typica.w"
  9854. QSettings settings;
  9855. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  9856. /*:34*/
  9857. #line 1216 "./typica.w"
  9858. event->accept();
  9859. }
  9860. /*:33*//*38:*/
  9861. #line 1262 "./typica.w"
  9862. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  9863. {
  9864. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  9865. setQMainWindowProperties(object,engine);
  9866. return object;
  9867. }
  9868. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  9869. {
  9870. setQWidgetProperties(value,engine);
  9871. value.setProperty("setCentralWidget",
  9872. engine->newFunction(QMainWindow_setCentralWidget));
  9873. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  9874. }
  9875. /*:38*//*39:*/
  9876. #line 1284 "./typica.w"
  9877. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  9878. QScriptEngine*)
  9879. {
  9880. if(context->argumentCount()==1)
  9881. {
  9882. QMainWindow*self= getself<QMainWindow*> (context);
  9883. QWidget*widget= argument<QWidget*> (0,context);
  9884. if(widget)
  9885. {
  9886. self->setCentralWidget(widget);
  9887. }
  9888. else
  9889. {
  9890. context->throwError("Incorrect argument type passed to "
  9891. "QMainWindow::setCentralWidget(). This "
  9892. "method requires a QWidget.");
  9893. }
  9894. }
  9895. else
  9896. {
  9897. context->throwError("Incorrect number of arguments passed to "
  9898. "QMainWindow::setCentralWidget(). This method "
  9899. "takes one QWidget as an argument.");
  9900. }
  9901. return QScriptValue();
  9902. }
  9903. /*:39*//*40:*/
  9904. #line 1318 "./typica.w"
  9905. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  9906. {
  9907. QScriptValue object;
  9908. if(context->argumentCount()==0)
  9909. {
  9910. QMainWindow*self= getself<QMainWindow*> (context);
  9911. QMenuBar*bar= self->menuBar();
  9912. object= engine->newQObject(bar);
  9913. setQMenuBarProperties(object,engine);
  9914. }
  9915. else
  9916. {
  9917. context->throwError("Incorrect number of arguments passed to "
  9918. "QMainWindow::menuBar(). This method takes no "
  9919. "arguments.");
  9920. }
  9921. return object;
  9922. }
  9923. /*:40*//*42:*/
  9924. #line 1348 "./typica.w"
  9925. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  9926. {
  9927. setQWidgetProperties(value,engine);
  9928. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  9929. }
  9930. /*:42*//*43:*/
  9931. #line 1363 "./typica.w"
  9932. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  9933. {
  9934. QScriptValue object;
  9935. if(context->argumentCount()==1)
  9936. {
  9937. QMenuBar*self= getself<QMenuBar*> (context);
  9938. QString title= argument<QString> (0,context);
  9939. object= engine->newQObject(self->addMenu(title));
  9940. setQMenuProperties(object,engine);
  9941. }
  9942. else
  9943. {
  9944. context->throwError("Incorrect number of arguments passed to "
  9945. "QMenuBar::addMenu(). This method takes one "
  9946. "string as an argument.");
  9947. }
  9948. return object;
  9949. }
  9950. /*:43*//*45:*/
  9951. #line 1393 "./typica.w"
  9952. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  9953. {
  9954. setQWidgetProperties(value,engine);
  9955. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  9956. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  9957. }
  9958. /*:45*//*46:*/
  9959. #line 1403 "./typica.w"
  9960. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  9961. {
  9962. if(context->argumentCount()==1)
  9963. {
  9964. QMenu*self= getself<QMenu*> (context);
  9965. QAction*action= argument<QAction*> (0,context);
  9966. if(action)
  9967. {
  9968. self->addAction(action);
  9969. }
  9970. else
  9971. {
  9972. context->throwError("Incorrect argument type passed to "
  9973. "QMenu::addAction(). This method requires a "
  9974. "QAction.");
  9975. }
  9976. }
  9977. else
  9978. {
  9979. context->throwError("Incorrect number of arguments passed to "
  9980. "QMenu::addAction(). This method takes one "
  9981. "QAction as an argument.");
  9982. }
  9983. return QScriptValue();
  9984. }
  9985. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  9986. {
  9987. if(context->argumentCount()==0)
  9988. {
  9989. QMenu*self= getself<QMenu*> (context);
  9990. self->addSeparator();
  9991. }
  9992. else
  9993. {
  9994. context->throwError("Incorrect number of arguments passed to "
  9995. "QMenu::addSeparator(). This method takes no "
  9996. "arguments.");
  9997. }
  9998. return QScriptValue();
  9999. }
  10000. /*:46*//*49:*/
  10001. #line 1465 "./typica.w"
  10002. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  10003. {
  10004. QScriptValue object= engine->newQObject(new QFrame);
  10005. setQFrameProperties(object,engine);
  10006. return object;
  10007. }
  10008. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  10009. {
  10010. setQWidgetProperties(value,engine);
  10011. }
  10012. /*:49*//*52:*/
  10013. #line 1499 "./typica.w"
  10014. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  10015. {
  10016. QString text;
  10017. if(context->argumentCount()==1)
  10018. {
  10019. text= argument<QString> (0,context);
  10020. }
  10021. QScriptValue object= engine->newQObject(new QLabel(text));
  10022. setQLabelProperties(object,engine);
  10023. return object;
  10024. }
  10025. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  10026. {
  10027. setQFrameProperties(value,engine);
  10028. }
  10029. /*:52*//*55:*/
  10030. #line 1545 "./typica.w"
  10031. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  10032. {
  10033. QScriptValue object= engine->newQObject(new QSplitter);
  10034. setQSplitterProperties(object,engine);
  10035. return object;
  10036. }
  10037. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  10038. {
  10039. setQFrameProperties(value,engine);
  10040. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  10041. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  10042. value.setProperty("restoreState",
  10043. engine->newFunction(QSplitter_restoreState));
  10044. }
  10045. /*:55*//*56:*/
  10046. #line 1565 "./typica.w"
  10047. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  10048. {
  10049. if(context->argumentCount()==1)
  10050. {
  10051. QSplitter*self= getself<QSplitter*> (context);
  10052. QWidget*widget= argument<QWidget*> (0,context);
  10053. if(widget)
  10054. {
  10055. self->addWidget(widget);
  10056. }
  10057. else
  10058. {
  10059. context->throwError("Incorrect argument type passed to "
  10060. "QSplitter::addWidget(). This method "
  10061. "requires a QWidget.");
  10062. }
  10063. }
  10064. else
  10065. {
  10066. context->throwError("Incorrect number of arguments passed to "
  10067. "QSplitter::addWidget(). This method takes one "
  10068. "QWidget as an argument.");
  10069. }
  10070. return QScriptValue();
  10071. }
  10072. /*:56*//*57:*/
  10073. #line 1598 "./typica.w"
  10074. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  10075. {
  10076. if(context->argumentCount()==1)
  10077. {
  10078. QSplitter*self= getself<QSplitter*> (context);
  10079. QString key= argument<QString> (0,context);
  10080. QSettings settings;
  10081. settings.setValue(key,self->saveState());
  10082. }
  10083. else
  10084. {
  10085. context->throwError("Incorrect number of arguments passed to "
  10086. "QSplitter::saveState(). This method takes one "
  10087. "string as an argument.");
  10088. }
  10089. return QScriptValue();
  10090. }
  10091. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  10092. {
  10093. if(context->argumentCount()==1)
  10094. {
  10095. QSplitter*self= getself<QSplitter*> (context);
  10096. QString key= argument<QString> (0,context);
  10097. QSettings settings;
  10098. self->restoreState(settings.value(key).toByteArray());
  10099. }
  10100. else
  10101. {
  10102. context->throwError("Incorrect number of arguments passed to "
  10103. "QSplitter::restoreState(). This method takes "
  10104. "one string as an argument.");
  10105. }
  10106. return QScriptValue();
  10107. }
  10108. /*:57*//*59:*/
  10109. #line 1651 "./typica.w"
  10110. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10111. {
  10112. setQLayoutItemProperties(value,engine);
  10113. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  10114. }
  10115. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10116. {
  10117. if(context->argumentCount()==1)
  10118. {
  10119. QLayout*self= getself<QLayout*> (context);
  10120. QWidget*widget= argument<QWidget*> (0,context);
  10121. if(widget)
  10122. {
  10123. self->addWidget(widget);
  10124. }
  10125. else
  10126. {
  10127. context->throwError("Incorrect argument type passed to "
  10128. "QLayout::addWidget(). This method requires "
  10129. "a QWidget.");
  10130. }
  10131. }
  10132. else
  10133. {
  10134. context->throwError("Incorrect number of arguments passed to "
  10135. "QLayout::addWidget(). This method takes one "
  10136. "QWidget as an argument.");
  10137. }
  10138. return QScriptValue();
  10139. }
  10140. /*:59*//*62:*/
  10141. #line 1718 "./typica.w"
  10142. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  10143. {
  10144. QScriptValue object=
  10145. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  10146. setQBoxLayoutProperties(object,engine);
  10147. return object;
  10148. }
  10149. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10150. {
  10151. setQLayoutProperties(value,engine);
  10152. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  10153. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  10154. }
  10155. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  10156. {
  10157. if(context->argumentCount()> 0&&context->argumentCount()<3)
  10158. {
  10159. QBoxLayout*self= getself<QBoxLayout*> (context);
  10160. QLayout*layout= argument<QLayout*> (0,context);
  10161. int stretch= 0;
  10162. if(context->argumentCount()==2)
  10163. {
  10164. stretch= argument<int> (1,context);
  10165. }
  10166. if(layout)
  10167. {
  10168. self->addLayout(layout,stretch);
  10169. }
  10170. else
  10171. {
  10172. context->throwError("Incorrect argument type passed to "
  10173. "QLayout::addLayout(). This method requires "
  10174. "a QLayout.");
  10175. }
  10176. }
  10177. else
  10178. {
  10179. context->throwError("Incorrect number of arguments passed to "
  10180. "QLayout::addLayout(). This method takes one "
  10181. "QLayout as an argument and optionally one integer.");
  10182. }
  10183. return QScriptValue();
  10184. }
  10185. /*:62*//*63:*/
  10186. #line 1769 "./typica.w"
  10187. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10188. {
  10189. if(context->argumentCount()> 0&&context->argumentCount()<4)
  10190. {
  10191. QBoxLayout*self= getself<QBoxLayout*> (context);
  10192. QWidget*widget= argument<QWidget*> (0,context);
  10193. int stretch= 0;
  10194. Qt::Alignment alignment= 0;
  10195. if(context->argumentCount()> 1)
  10196. {
  10197. stretch= argument<int> (1,context);
  10198. }
  10199. if(context->argumentCount()> 2)
  10200. {
  10201. alignment= (Qt::Alignment)(argument<int> (2,context));
  10202. }
  10203. if(widget)
  10204. {
  10205. self->addWidget(widget,stretch,alignment);
  10206. }
  10207. else
  10208. {
  10209. context->throwError("Incorrect argument type passed to "
  10210. "QBoxLayout::addWidget(). This method requires "
  10211. "a QWidget.");
  10212. }
  10213. }
  10214. else
  10215. {
  10216. context->throwError("Incorrect number of arguments passed to "
  10217. "QBoxLayout::addWidget(). This method takes one "
  10218. "QWidget and optionally up to two integers as "
  10219. "arguments.");
  10220. }
  10221. return QScriptValue();
  10222. }
  10223. /*:63*//*66:*/
  10224. #line 1833 "./typica.w"
  10225. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  10226. {
  10227. QScriptValue object= engine->newQObject(new QAction(NULL));
  10228. setQActionProperties(object,engine);
  10229. return object;
  10230. }
  10231. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  10232. {
  10233. setQObjectProperties(value,engine);
  10234. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  10235. }
  10236. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  10237. {
  10238. if(context->argumentCount()==1)
  10239. {
  10240. QAction*self= getself<QAction*> (context);
  10241. self->setShortcut(argument<QString> (0,context));
  10242. }
  10243. else
  10244. {
  10245. context->throwError("Incorrect number of arguments passed to "
  10246. "QAction::setShortcut(). This method takes one "
  10247. "string as an argument.");
  10248. }
  10249. return QScriptValue();
  10250. }
  10251. /*:66*//*69:*/
  10252. #line 1891 "./typica.w"
  10253. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  10254. QScriptEngine*engine)
  10255. {
  10256. QScriptValue retval;
  10257. if(context->argumentCount()==3)
  10258. {
  10259. QWidget*widget= argument<QWidget*> (0,context);
  10260. if(widget)
  10261. {
  10262. QString caption= argument<QString> (1,context);
  10263. QString dir= argument<QString> (2,context);
  10264. retval= QScriptValue(engine,
  10265. QFileDialog::getOpenFileName(widget,caption,
  10266. dir,"",0,0));
  10267. setQFileDialogProperties(retval,engine);
  10268. }
  10269. else
  10270. {
  10271. context->throwError("Incorrect argument type passed to "
  10272. "QFileDialog::getOpenFileName(). The first "
  10273. "argument to this method must be a QWidget.");
  10274. }
  10275. }
  10276. else
  10277. {
  10278. context->throwError("Incorrect number of arguments passed to "
  10279. "QFileDialog::getOpenFileName(). This method "
  10280. "takes one QWidget followed by two strings for a "
  10281. "total of three arguments.");
  10282. }
  10283. return retval;
  10284. }
  10285. /*:69*//*70:*/
  10286. #line 1927 "./typica.w"
  10287. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  10288. QScriptEngine*engine)
  10289. {
  10290. QScriptValue retval;
  10291. if(context->argumentCount()==3)
  10292. {
  10293. QWidget*widget= argument<QWidget*> (0,context);
  10294. if(widget)
  10295. {
  10296. QString caption= argument<QString> (1,context);
  10297. QString dir= argument<QString> (2,context);
  10298. retval= QScriptValue(engine,
  10299. QFileDialog::getSaveFileName(widget,caption,
  10300. dir,"",0,0));
  10301. setQFileDialogProperties(retval,engine);
  10302. }
  10303. else
  10304. {
  10305. context->throwError("Incorrect argument type passed to "
  10306. "QFileDialog::getSaveFileName(). The first "
  10307. "argument to this method must be a QWidget.");
  10308. }
  10309. }
  10310. else
  10311. {
  10312. context->throwError("Incorrect number of arguments passed to "
  10313. "QFileDialog::getSaveFileName(). This method "
  10314. "takes one QWidget followed by two strings for a "
  10315. "total of three arguments.");
  10316. }
  10317. return retval;
  10318. }
  10319. /*:70*//*71:*/
  10320. #line 1964 "./typica.w"
  10321. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  10322. {
  10323. setQDialogProperties(value,engine);
  10324. }
  10325. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  10326. {
  10327. setQWidgetProperties(value,engine);
  10328. }
  10329. /*:71*//*74:*/
  10330. #line 1999 "./typica.w"
  10331. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  10332. {
  10333. QScriptValue object=
  10334. engine->newQObject(new QFile(argument<QString> (0,context)));
  10335. setQFileProperties(object,engine);
  10336. return object;
  10337. }
  10338. /*:74*//*75:*/
  10339. #line 2010 "./typica.w"
  10340. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  10341. {
  10342. setQIODeviceProperties(value,engine);
  10343. value.setProperty("remove",engine->newFunction(QFile_remove));
  10344. }
  10345. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  10346. {
  10347. QFile*self= getself<QFile*> (context);
  10348. bool retval= self->remove();
  10349. return QScriptValue(engine,retval);
  10350. }
  10351. /*:75*//*76:*/
  10352. #line 2032 "./typica.w"
  10353. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  10354. {
  10355. setQObjectProperties(value,engine);
  10356. value.setProperty("open",engine->newFunction(QIODevice_open));
  10357. value.setProperty("close",engine->newFunction(QIODevice_close));
  10358. value.setProperty("readToString",
  10359. engine->newFunction(QIODevice_readToString));
  10360. }
  10361. /*:76*//*77:*/
  10362. #line 2047 "./typica.w"
  10363. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  10364. {
  10365. QIODevice*self= getself<QIODevice*> (context);
  10366. if(context->argumentCount()==1)
  10367. {
  10368. switch(argument<int> (0,context))
  10369. {
  10370. case 1:
  10371. self->open(QIODevice::ReadOnly);
  10372. break;
  10373. case 2:
  10374. self->open(QIODevice::WriteOnly);
  10375. break;
  10376. case 3:
  10377. self->open(QIODevice::ReadWrite);
  10378. break;
  10379. default:
  10380. break;
  10381. }
  10382. }
  10383. else
  10384. {
  10385. self->open(QIODevice::ReadWrite);
  10386. }
  10387. return QScriptValue();
  10388. }
  10389. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  10390. {
  10391. QIODevice*self= getself<QIODevice*> (context);
  10392. self->close();
  10393. return QScriptValue();
  10394. }
  10395. /*:77*//*78:*/
  10396. #line 2086 "./typica.w"
  10397. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  10398. {
  10399. QIODevice*self= getself<QIODevice*> (context);
  10400. self->reset();
  10401. return QScriptValue(QString(self->readAll()));
  10402. }
  10403. /*:78*//*81:*/
  10404. #line 2116 "./typica.w"
  10405. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  10406. {
  10407. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  10408. QScriptValue object= engine->newQObject(new QBuffer(array));
  10409. setQBufferProperties(object,engine);
  10410. return object;
  10411. }
  10412. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  10413. {
  10414. setQIODeviceProperties(value,engine);
  10415. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  10416. }
  10417. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  10418. {
  10419. QBuffer*self= getself<QBuffer*> (context);
  10420. self->setData(argument<QString> (0,context).toAscii());
  10421. return QScriptValue();
  10422. }
  10423. /*:81*//*84:*/
  10424. #line 2164 "./typica.w"
  10425. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  10426. {
  10427. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  10428. setXQueryProperties(object,engine);
  10429. return object;
  10430. }
  10431. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  10432. {
  10433. value.setProperty("bind",engine->newFunction(XQuery_bind));
  10434. value.setProperty("exec",engine->newFunction(XQuery_exec));
  10435. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  10436. }
  10437. /*:84*//*85:*/
  10438. #line 2182 "./typica.w"
  10439. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  10440. {
  10441. QXmlQuery*self= getself<QXmlQuery*> (context);
  10442. QIODevice*buffer= argument<QIODevice*> (1,context);
  10443. self->bindVariable(argument<QString> (0,context),buffer);
  10444. return QScriptValue();
  10445. }
  10446. /*:85*//*86:*/
  10447. #line 2193 "./typica.w"
  10448. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  10449. {
  10450. QXmlQuery*self= getself<QXmlQuery*> (context);
  10451. self->setQuery(argument<QString> (0,context));
  10452. return QScriptValue();
  10453. }
  10454. /*:86*//*87:*/
  10455. #line 2203 "./typica.w"
  10456. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  10457. {
  10458. QXmlQuery*self= getself<QXmlQuery*> (context);
  10459. QString result;
  10460. self->evaluateTo(&result);
  10461. return QScriptValue(result);
  10462. }
  10463. /*:87*//*90:*/
  10464. #line 2258 "./typica.w"
  10465. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  10466. {
  10467. QXmlStreamWriter*retval;
  10468. if(context->argumentCount()==1)
  10469. {
  10470. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  10471. }
  10472. else
  10473. {
  10474. retval= new QXmlStreamWriter;
  10475. }
  10476. QScriptValue object= engine->toScriptValue<void*> (retval);
  10477. setXmlWriterProperties(object,engine);
  10478. return object;
  10479. }
  10480. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  10481. {
  10482. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  10483. value.setProperty("writeAttribute",
  10484. engine->newFunction(XmlWriter_writeAttribute));
  10485. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  10486. value.setProperty("writeCharacters",
  10487. engine->newFunction(XmlWriter_writeCharacters));
  10488. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  10489. value.setProperty("writeEmptyElement",
  10490. engine->newFunction(XmlWriter_writeEmptyElement));
  10491. value.setProperty("writeEndDocument",
  10492. engine->newFunction(XmlWriter_writeEndDocument));
  10493. value.setProperty("writeEndElement",
  10494. engine->newFunction(XmlWriter_writeEndElement));
  10495. value.setProperty("writeEntityReference",
  10496. engine->newFunction(XmlWriter_writeEntityReference));
  10497. value.setProperty("writeProcessingInstruction",
  10498. engine->newFunction(XmlWriter_writeProcessingInstruction));
  10499. value.setProperty("writeStartDocument",
  10500. engine->newFunction(XmlWriter_writeStartDocument));
  10501. value.setProperty("writeStartElement",
  10502. engine->newFunction(XmlWriter_writeStartElement));
  10503. value.setProperty("writeTextElement",
  10504. engine->newFunction(XmlWriter_writeTextElement));
  10505. }
  10506. /*:90*//*91:*/
  10507. #line 2305 "./typica.w"
  10508. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  10509. {
  10510. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10511. QIODevice*device= argument<QIODevice*> (0,context);
  10512. self->setDevice(device);
  10513. return QScriptValue();
  10514. }
  10515. /*:91*//*92:*/
  10516. #line 2319 "./typica.w"
  10517. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  10518. QScriptEngine*)
  10519. {
  10520. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10521. self->writeStartDocument(argument<QString> (0,context));
  10522. return QScriptValue();
  10523. }
  10524. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  10525. QScriptEngine*)
  10526. {
  10527. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10528. self->writeEndDocument();
  10529. return QScriptValue();
  10530. }
  10531. /*:92*//*93:*/
  10532. #line 2338 "./typica.w"
  10533. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  10534. {
  10535. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10536. self->writeDTD(argument<QString> (0,context));
  10537. return QScriptValue();
  10538. }
  10539. /*:93*//*94:*/
  10540. #line 2349 "./typica.w"
  10541. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  10542. QScriptEngine*)
  10543. {
  10544. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10545. self->writeStartElement(argument<QString> (0,context));
  10546. return QScriptValue();
  10547. }
  10548. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  10549. {
  10550. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10551. self->writeAttribute(argument<QString> (0,context),
  10552. argument<QString> (1,context));
  10553. return QScriptValue();
  10554. }
  10555. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  10556. {
  10557. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10558. self->writeCharacters(argument<QString> (0,context));
  10559. return QScriptValue();
  10560. }
  10561. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  10562. {
  10563. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10564. self->writeEndElement();
  10565. return QScriptValue();
  10566. }
  10567. /*:94*//*95:*/
  10568. #line 2385 "./typica.w"
  10569. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  10570. QScriptEngine*)
  10571. {
  10572. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10573. self->writeEmptyElement(argument<QString> (0,context));
  10574. return QScriptValue();
  10575. }
  10576. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  10577. QScriptEngine*)
  10578. {
  10579. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10580. self->writeTextElement(argument<QString> (0,context),
  10581. argument<QString> (1,context));
  10582. return QScriptValue();
  10583. }
  10584. /*:95*//*96:*/
  10585. #line 2406 "./typica.w"
  10586. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  10587. {
  10588. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10589. self->writeCDATA(argument<QString> (0,context));
  10590. return QScriptValue();
  10591. }
  10592. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  10593. QScriptEngine*)
  10594. {
  10595. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10596. self->writeEntityReference(argument<QString> (0,context));
  10597. return QScriptValue();
  10598. }
  10599. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  10600. QScriptEngine*)
  10601. {
  10602. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10603. self->writeProcessingInstruction(argument<QString> (0,context),
  10604. argument<QString> (1,context));
  10605. return QScriptValue();
  10606. }
  10607. /*:96*//*99:*/
  10608. #line 2465 "./typica.w"
  10609. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  10610. {
  10611. QXmlStreamReader*retval=
  10612. new QXmlStreamReader(argument<QIODevice*> (0,context));
  10613. QScriptValue object= engine->toScriptValue<void*> (retval);
  10614. setXmlReaderProperties(object,engine);
  10615. return object;
  10616. }
  10617. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  10618. {
  10619. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  10620. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  10621. value.setProperty("hasAttribute",
  10622. engine->newFunction(XmlReader_hasAttribute));
  10623. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  10624. value.setProperty("isStartElement",
  10625. engine->newFunction(XmlReader_isStartElement));
  10626. value.setProperty("name",engine->newFunction(XmlReader_name));
  10627. value.setProperty("readElementText",
  10628. engine->newFunction(XmlReader_readElementText));
  10629. value.setProperty("readNext",
  10630. engine->newFunction(XmlReader_readNext));
  10631. value.setProperty("text",engine->newFunction(XmlReader_text));
  10632. }
  10633. /*:99*//*100:*/
  10634. #line 2495 "./typica.w"
  10635. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  10636. {
  10637. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10638. QString retval=
  10639. self->attributes().value(argument<QString> (0,context)).toString();
  10640. return QScriptValue(retval);
  10641. }
  10642. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  10643. {
  10644. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10645. bool retval=
  10646. self->attributes().hasAttribute(argument<QString> (0,context));
  10647. return QScriptValue(retval);
  10648. }
  10649. /*:100*//*101:*/
  10650. #line 2515 "./typica.w"
  10651. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  10652. {
  10653. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10654. return QScriptValue(self->atEnd());
  10655. }
  10656. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  10657. {
  10658. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10659. return QScriptValue(self->isDTD());
  10660. }
  10661. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  10662. {
  10663. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10664. return QScriptValue(self->isStartElement());
  10665. }
  10666. /*:101*//*102:*/
  10667. #line 2536 "./typica.w"
  10668. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  10669. {
  10670. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10671. self->readNext();
  10672. return QScriptValue();
  10673. }
  10674. /*:102*//*103:*/
  10675. #line 2546 "./typica.w"
  10676. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  10677. {
  10678. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10679. return QScriptValue(self->name().toString());
  10680. }
  10681. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  10682. {
  10683. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10684. return QScriptValue(self->readElementText());
  10685. }
  10686. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  10687. {
  10688. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10689. return QScriptValue(self->text().toString());
  10690. }
  10691. /*:103*//*106:*/
  10692. #line 2588 "./typica.w"
  10693. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  10694. {
  10695. setQObjectProperties(value,engine);
  10696. value.setProperty("value",engine->newFunction(QSettings_value));
  10697. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  10698. }
  10699. /*:106*//*107:*/
  10700. #line 2600 "./typica.w"
  10701. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  10702. {
  10703. QScriptValue object;
  10704. if(context->argumentCount()==1||context->argumentCount()==2)
  10705. {
  10706. QSettings settings;
  10707. QString key= argument<QString> (0,context);
  10708. QVariant value;
  10709. QVariant retval;
  10710. if(context->argumentCount()> 1)
  10711. {
  10712. value= argument<QVariant> (1,context);
  10713. retval= settings.value(key,value);
  10714. }
  10715. else
  10716. {
  10717. retval= settings.value(key);
  10718. }
  10719. object= engine->newVariant(retval);
  10720. }
  10721. else
  10722. {
  10723. context->throwError("Incorrect number of arguments passed to "
  10724. "QSettings::value(). This method takes one "
  10725. "string and one optional variant type.");
  10726. }
  10727. return object;
  10728. }
  10729. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  10730. {
  10731. if(context->argumentCount()==2)
  10732. {
  10733. QSettings settings;
  10734. QString key= argument<QString> (0,context);
  10735. QVariant value= argument<QVariant> (1,context);
  10736. settings.setValue(key,value);
  10737. }
  10738. else
  10739. {
  10740. context->throwError("Incorrect number of arguments passed to "
  10741. "QSettings::setValue(). This method takes one "
  10742. "string and one variant type for a total of two "
  10743. "arguments.");
  10744. }
  10745. return QScriptValue();
  10746. }
  10747. /*:107*//*110:*/
  10748. #line 2669 "./typica.w"
  10749. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  10750. {
  10751. QScriptValue object= engine->newQObject(new QLCDNumber());
  10752. setQLCDNumberProperties(object,engine);
  10753. return object;
  10754. }
  10755. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  10756. {
  10757. setQFrameProperties(value,engine);
  10758. }
  10759. /*:110*//*113:*/
  10760. #line 2727 "./typica.w"
  10761. QScriptValue constructQTime(QScriptContext*context,
  10762. QScriptEngine*engine)
  10763. {
  10764. QScriptValue object;
  10765. if(context->argumentCount()==0||
  10766. (context->argumentCount()>=2&&context->argumentCount()<=4))
  10767. {
  10768. int arg1= 0;
  10769. int arg2= 0;
  10770. int arg3= 0;
  10771. int arg4= 0;
  10772. switch(context->argumentCount())
  10773. {
  10774. case 4:
  10775. arg4= argument<int> (3,context);
  10776. case 3:
  10777. arg3= argument<int> (2,context);
  10778. case 2:
  10779. arg2= argument<int> (1,context);
  10780. arg1= argument<int> (0,context);
  10781. default:
  10782. break;
  10783. }
  10784. if(context->argumentCount())
  10785. {
  10786. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  10787. arg4));
  10788. }
  10789. else
  10790. {
  10791. object= engine->toScriptValue<QTime> (QTime());
  10792. }
  10793. setQTimeProperties(object,engine);
  10794. }
  10795. else
  10796. {
  10797. context->throwError("Incorrect number of arguments passed to "
  10798. "QTime::QTime(). This method takes zero, two, "
  10799. "three, or four integer arguments.");
  10800. }
  10801. return object;
  10802. }
  10803. /*:113*//*114:*/
  10804. #line 2775 "./typica.w"
  10805. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  10806. {
  10807. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  10808. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  10809. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  10810. value.setProperty("hour",engine->newFunction(QTime_hour));
  10811. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  10812. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  10813. value.setProperty("minute",engine->newFunction(QTime_minute));
  10814. value.setProperty("msec",engine->newFunction(QTime_msec));
  10815. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  10816. value.setProperty("restart",engine->newFunction(QTime_restart));
  10817. value.setProperty("second",engine->newFunction(QTime_second));
  10818. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  10819. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  10820. value.setProperty("start",engine->newFunction(QTime_start));
  10821. value.setProperty("toString",engine->newFunction(QTime_toString));
  10822. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  10823. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  10824. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  10825. }
  10826. /*:114*//*115:*/
  10827. #line 2804 "./typica.w"
  10828. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  10829. {
  10830. QTime self= getself<QTime> (context);
  10831. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  10832. (self.second()*1000)+self.msec();
  10833. return QScriptValue(retval);
  10834. }
  10835. /*:115*//*116:*/
  10836. #line 2818 "./typica.w"
  10837. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  10838. {
  10839. QTime time;
  10840. QScriptValue retval;
  10841. if(context->argumentCount()==1)
  10842. {
  10843. QTime self= getself<QTime> (context);
  10844. time= self.addMSecs(argument<int> (0,context));
  10845. retval= engine->toScriptValue<QTime> (time);
  10846. setQTimeProperties(retval,engine);
  10847. }
  10848. else
  10849. {
  10850. context->throwError("Incorrect number of arguments passed to "
  10851. "QTime::addMSecs(). This method takes one "
  10852. "integer as an argument.");
  10853. }
  10854. return retval;
  10855. }
  10856. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  10857. {
  10858. QTime time;
  10859. QScriptValue retval;
  10860. if(context->argumentCount()==1)
  10861. {
  10862. QTime self= getself<QTime> (context);
  10863. time= self.addSecs(argument<int> (0,context));
  10864. retval= engine->toScriptValue<QTime> (time);
  10865. setQTimeProperties(retval,engine);
  10866. }
  10867. else
  10868. {
  10869. context->throwError("Incorrect number of arguments passed to "
  10870. "QTime::addSecs(). This method takes one "
  10871. "integer as an argument.");
  10872. }
  10873. return retval;
  10874. }
  10875. /*:116*//*117:*/
  10876. #line 2861 "./typica.w"
  10877. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  10878. {
  10879. QScriptValue retval;
  10880. if(context->argumentCount()==0)
  10881. {
  10882. QTime self= getself<QTime> (context);
  10883. retval= QScriptValue(engine,self.elapsed());
  10884. }
  10885. else
  10886. {
  10887. context->throwError("Incorrect number of arguments passed to "
  10888. "QTime::elapsed(). This method takes no "
  10889. "arguments.");
  10890. }
  10891. return retval;
  10892. }
  10893. /*:117*//*118:*/
  10894. #line 2882 "./typica.w"
  10895. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  10896. {
  10897. QScriptValue retval;
  10898. if(context->argumentCount()==0)
  10899. {
  10900. QTime self= getself<QTime> (context);
  10901. retval= QScriptValue(engine,self.hour());
  10902. }
  10903. else
  10904. {
  10905. context->throwError("Incorrect number of arguments passed to "
  10906. "QTime::hour(). This method takes no "
  10907. "arguments.");
  10908. }
  10909. return retval;
  10910. }
  10911. /*:118*//*119:*/
  10912. #line 2902 "./typica.w"
  10913. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  10914. {
  10915. QScriptValue retval;
  10916. if(context->argumentCount()==0)
  10917. {
  10918. QTime self= getself<QTime> (context);
  10919. retval= QScriptValue(engine,self.minute());
  10920. }
  10921. else
  10922. {
  10923. context->throwError("Incorrect number of arguments passed to "
  10924. "QTime::minute(). This method takes no "
  10925. "arguments.");
  10926. }
  10927. return retval;
  10928. }
  10929. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  10930. {
  10931. QScriptValue retval;
  10932. if(context->argumentCount()==0)
  10933. {
  10934. QTime self= getself<QTime> (context);
  10935. retval= QScriptValue(engine,self.second());
  10936. }
  10937. else
  10938. {
  10939. context->throwError("Incorrect number of arguments passed to "
  10940. "QTime::second(). This method takes no "
  10941. "arguments.");
  10942. }
  10943. return retval;
  10944. }
  10945. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  10946. {
  10947. QScriptValue retval;
  10948. if(context->argumentCount()==0)
  10949. {
  10950. QTime self= getself<QTime> (context);
  10951. retval= QScriptValue(engine,self.msec());
  10952. }
  10953. else
  10954. {
  10955. context->throwError("Incorrect number of arguments passed to "
  10956. "QTime::msec(). This method takes no "
  10957. "arguments.");
  10958. }
  10959. return retval;
  10960. }
  10961. /*:119*//*120:*/
  10962. #line 2958 "./typica.w"
  10963. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  10964. {
  10965. QScriptValue retval;
  10966. if(context->argumentCount()==0)
  10967. {
  10968. QTime self= getself<QTime> (context);
  10969. retval= QScriptValue(engine,self.isNull());
  10970. }
  10971. else
  10972. {
  10973. context->throwError("Incorrect number of arguments passed to "
  10974. "QTime::isNull(). This method takes no "
  10975. "arguments.");
  10976. }
  10977. return retval;
  10978. }
  10979. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  10980. {
  10981. QScriptValue retval;
  10982. if(context->argumentCount()==0)
  10983. {
  10984. QTime self= getself<QTime> (context);
  10985. retval= QScriptValue(engine,self.isValid());
  10986. }
  10987. else
  10988. {
  10989. context->throwError("Incorrect number of arguments passed to "
  10990. "QTime::isValid(). This method takes no "
  10991. "arguments.");
  10992. }
  10993. return retval;
  10994. }
  10995. /*:120*//*121:*/
  10996. #line 2996 "./typica.w"
  10997. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  10998. {
  10999. QScriptValue retval;
  11000. if(context->argumentCount()==1)
  11001. {
  11002. QTime self= getself<QTime> (context);
  11003. QTime arg= argument<QVariant> (0,context).toTime();
  11004. retval= QScriptValue(engine,self.msecsTo(arg));
  11005. }
  11006. else
  11007. {
  11008. context->throwError("Incorrect number of arguments passed to "
  11009. "QTime::msecsTo(). This method takes one QTime.");
  11010. }
  11011. return retval;
  11012. }
  11013. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  11014. {
  11015. QScriptValue retval;
  11016. if(context->argumentCount()==1)
  11017. {
  11018. QTime self= getself<QTime> (context);
  11019. QTime arg= argument<QVariant> (0,context).toTime();
  11020. retval= QScriptValue(engine,self.secsTo(arg));
  11021. }
  11022. else
  11023. {
  11024. context->throwError("Incorrect number of arguments passed to "
  11025. "QTime::secsTo(). This method takes one QTime.");
  11026. }
  11027. return retval;
  11028. }
  11029. /*:121*//*122:*/
  11030. #line 3035 "./typica.w"
  11031. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  11032. {
  11033. QScriptValue retval;
  11034. if(context->argumentCount()==0)
  11035. {
  11036. QTime self= getself<QTime> (context);
  11037. retval= QScriptValue(engine,self.restart());
  11038. }
  11039. else
  11040. {
  11041. context->throwError("Incorrect number of arguments passed to "
  11042. "QTime::restart(). This method takes no "
  11043. "arguments.");
  11044. }
  11045. return retval;
  11046. }
  11047. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  11048. {
  11049. if(context->argumentCount()==0)
  11050. {
  11051. QTime self= getself<QTime> (context);
  11052. self.start();
  11053. }
  11054. else
  11055. {
  11056. context->throwError("Incorrect number of arguments passed to "
  11057. "QTime::start(). This method takes no arguments.");
  11058. }
  11059. return QScriptValue();
  11060. }
  11061. /*:122*//*123:*/
  11062. #line 3071 "./typica.w"
  11063. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  11064. {
  11065. QScriptValue retval;
  11066. if(context->argumentCount()==3||context->argumentCount()==4)
  11067. {
  11068. QTime self= getself<QTime> (context);
  11069. int arg1= 0;
  11070. int arg2= 0;
  11071. int arg3= 0;
  11072. int arg4= 0;
  11073. switch(context->argumentCount())
  11074. {
  11075. case 4:
  11076. arg4= argument<int> (3,context);
  11077. case 3:
  11078. arg3= argument<int> (2,context);
  11079. arg2= argument<int> (1,context);
  11080. arg1= argument<int> (0,context);
  11081. default:
  11082. break;
  11083. }
  11084. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  11085. }
  11086. else
  11087. {
  11088. context->throwError("Incorrect number of arguments passed to "
  11089. "QTime::setHMS(). This method takes three or "
  11090. "four integer arguments.");
  11091. }
  11092. return retval;
  11093. }
  11094. /*:123*//*124:*/
  11095. #line 3107 "./typica.w"
  11096. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  11097. {
  11098. QScriptValue retval;
  11099. if(context->argumentCount()==1)
  11100. {
  11101. QTime self= getself<QTime> (context);
  11102. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  11103. }
  11104. else
  11105. {
  11106. context->throwError("Incorrect number of arguments passed to "
  11107. "QTime::toString(). This method takes one QString "
  11108. "as an argument.");
  11109. }
  11110. return retval;
  11111. }
  11112. /*:124*//*125:*/
  11113. #line 3128 "./typica.w"
  11114. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  11115. {
  11116. QScriptValue object;
  11117. object= engine->toScriptValue<QTime> (QTime::currentTime());
  11118. setQTimeProperties(object,engine);
  11119. return object;
  11120. }
  11121. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  11122. {
  11123. QScriptValue object;
  11124. if(context->argumentCount()==2)
  11125. {
  11126. QString time= argument<QString> (0,context);
  11127. QString format= argument<QString> (1,context);
  11128. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  11129. setQTimeProperties(object,engine);
  11130. }
  11131. else
  11132. {
  11133. context->throwError("Incorrect number of arguments passed to "
  11134. "QTime::fromString(). This method takes two "
  11135. "string arguments.");
  11136. }
  11137. return object;
  11138. }
  11139. /*:125*//*127:*/
  11140. #line 3168 "./typica.w"
  11141. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  11142. {
  11143. setQFrameProperties(value,engine);
  11144. }
  11145. /*:127*//*129:*/
  11146. #line 3182 "./typica.w"
  11147. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  11148. {
  11149. setQAbstractScrollAreaProperties(value,engine);
  11150. }
  11151. /*:129*//*131:*/
  11152. #line 3196 "./typica.w"
  11153. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  11154. {
  11155. setQAbstractScrollAreaProperties(value,engine);
  11156. }
  11157. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  11158. {
  11159. setQAbstractItemViewProperties(value,engine);
  11160. }
  11161. /*:131*//*134:*/
  11162. #line 3229 "./typica.w"
  11163. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  11164. {
  11165. QScriptValue object= engine->newQObject(new QPushButton());
  11166. setQPushButtonProperties(object,engine);
  11167. return object;
  11168. }
  11169. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  11170. {
  11171. setQAbstractButtonProperties(value,engine);
  11172. }
  11173. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  11174. {
  11175. setQWidgetProperties(value,engine);
  11176. }
  11177. /*:134*//*141:*/
  11178. #line 3341 "./typica.w"
  11179. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  11180. {
  11181. QScriptValue object=
  11182. engine->toScriptValue<void*> (new SqlQueryConnection());
  11183. setQSqlQueryProperties(object,engine);
  11184. return object;
  11185. }
  11186. /*:141*//*142:*/
  11187. #line 3353 "./typica.w"
  11188. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  11189. {
  11190. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  11191. value.setProperty("bindFileData",
  11192. engine->newFunction(QSqlQuery_bindFileData));
  11193. value.setProperty("bindDeviceData",
  11194. engine->newFunction(QSqlQuery_bindDeviceData));
  11195. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  11196. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  11197. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  11198. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  11199. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  11200. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  11201. }
  11202. /*:142*//*143:*/
  11203. #line 3371 "./typica.w"
  11204. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  11205. {
  11206. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11207. QScriptValue retval;
  11208. if(context->argumentCount()==1)
  11209. {
  11210. retval= QScriptValue(engine,
  11211. query->exec(argument<QString> (0,context)));
  11212. }
  11213. else
  11214. {
  11215. retval= QScriptValue(engine,query->exec());
  11216. }
  11217. if(query->lastError().isValid())
  11218. {
  11219. qDebug()<<query->lastQuery();
  11220. qDebug()<<query->lastError().text();
  11221. }
  11222. return retval;
  11223. }
  11224. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  11225. {
  11226. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11227. return QScriptValue(query->lastQuery());
  11228. }
  11229. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  11230. {
  11231. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11232. return QScriptValue(engine,query->next());
  11233. }
  11234. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  11235. {
  11236. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11237. return QScriptValue(engine,
  11238. query->value(argument<int> (0,context)).toString());
  11239. }
  11240. /*:143*//*144:*/
  11241. #line 3415 "./typica.w"
  11242. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  11243. {
  11244. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11245. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  11246. }
  11247. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  11248. {
  11249. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11250. query->bindValue(argument<QString> (0,context),
  11251. argument<QVariant> (1,context));
  11252. return QScriptValue();
  11253. }
  11254. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  11255. QScriptEngine*)
  11256. {
  11257. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11258. QString placeholder= argument<QString> (0,context);
  11259. QString filename= argument<QString> (1,context);
  11260. QFile file(filename);
  11261. QByteArray data;
  11262. if(file.open(QIODevice::ReadOnly))
  11263. {
  11264. data= file.readAll();
  11265. file.close();
  11266. }
  11267. query->bindValue(placeholder,data);
  11268. return QScriptValue();
  11269. }
  11270. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  11271. QScriptEngine*)
  11272. {
  11273. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11274. QString placeholder= argument<QString> (0,context);
  11275. QIODevice*device= argument<QIODevice*> (1,context);
  11276. device->reset();
  11277. QByteArray data;
  11278. data= device->readAll();
  11279. query->bindValue(placeholder,data);
  11280. return QScriptValue();
  11281. }
  11282. /*:144*//*145:*/
  11283. #line 3467 "./typica.w"
  11284. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  11285. {
  11286. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11287. delete query;
  11288. return QScriptValue::UndefinedValue;
  11289. }
  11290. /*:145*//*148:*/
  11291. #line 3508 "./typica.w"
  11292. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  11293. {
  11294. QFileInfo info(argument<QString> (0,context));
  11295. QScriptValue retval(engine,info.baseName());
  11296. return retval;
  11297. }
  11298. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  11299. {
  11300. QFileInfo info(argument<QString> (0,context));
  11301. QDir dir= info.dir();
  11302. QScriptValue retval(engine,dir.path());
  11303. return retval;
  11304. }
  11305. /*:148*//*149:*/
  11306. #line 3527 "./typica.w"
  11307. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  11308. {
  11309. QString source= argument<QString> (0,context);
  11310. source.remove(0,1);
  11311. source.chop(1);
  11312. QStringList elements= source.split(",");
  11313. QString element;
  11314. QScriptValue dest= engine->newArray(elements.size());
  11315. int i= 0;
  11316. foreach(element,elements)
  11317. {
  11318. if(element.startsWith("\"")&&element.endsWith("\""))
  11319. {
  11320. element.chop(1);
  11321. element= element.remove(0,1);
  11322. }
  11323. dest.setProperty(i,QScriptValue(engine,element));
  11324. i++;
  11325. }
  11326. return dest;
  11327. }
  11328. /*:149*//*150:*/
  11329. #line 3553 "./typica.w"
  11330. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  11331. {
  11332. QString font= argument<QString> (0,context);
  11333. QString classname;
  11334. if(context->argumentCount()> 1)
  11335. {
  11336. classname= argument<QString> (1,context);
  11337. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  11338. }
  11339. else
  11340. {
  11341. QApplication::setFont(QFont(font));
  11342. }
  11343. return QScriptValue();
  11344. }
  11345. /*:150*//*151:*/
  11346. #line 3573 "./typica.w"
  11347. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  11348. {
  11349. SqlQueryConnection query;
  11350. QString q= "SELECT file FROM files WHERE id = :file";
  11351. query.prepare(q);
  11352. query.bindValue(":file",argument<int> (0,context));
  11353. query.exec();
  11354. query.next();
  11355. QByteArray array= query.value(0).toByteArray();
  11356. QBuffer buffer(&array);
  11357. buffer.open(QIODevice::ReadOnly);
  11358. QXmlQuery xquery;
  11359. xquery.bindVariable("profile",&buffer);
  11360. QString xq;
  11361. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  11362. xquery.setQuery(xq);
  11363. QString result;
  11364. xquery.evaluateTo(&result);
  11365. return QScriptValue(result);
  11366. }
  11367. /*:151*//*152:*/
  11368. #line 3599 "./typica.w"
  11369. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  11370. {
  11371. QWidget::setTabOrder(argument<QWidget*> (0,context),
  11372. argument<QWidget*> (1,context));
  11373. return QScriptValue();
  11374. }
  11375. /*:152*//*159:*/
  11376. #line 3838 "./typica.w"
  11377. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  11378. {
  11379. QString targetID= argument<QString> (0,context);
  11380. QDomNode element;
  11381. QScriptValue object;
  11382. /*160:*/
  11383. #line 3859 "./typica.w"
  11384. QDomNodeList windows=
  11385. AppInstance->configuration()->documentElement().elementsByTagName("window");
  11386. QDomNode nullNode;
  11387. int i= 0;
  11388. element= nullNode;
  11389. while(i<windows.count())
  11390. {
  11391. element= windows.at(i);
  11392. QDomNamedNodeMap attributes= element.attributes();
  11393. if(attributes.contains("id"))
  11394. {
  11395. if(attributes.namedItem("id").toAttr().value()==targetID)
  11396. {
  11397. break;
  11398. }
  11399. }
  11400. element= nullNode;
  11401. i++;
  11402. }
  11403. /*:160*/
  11404. #line 3844 "./typica.w"
  11405. if(!element.isNull())
  11406. {
  11407. /*161:*/
  11408. #line 3891 "./typica.w"
  11409. ScriptQMainWindow*window= new ScriptQMainWindow;
  11410. window->setObjectName(targetID);
  11411. object= engine->newQObject(window);
  11412. setQMainWindowProperties(object,engine);
  11413. QWidget*central= new(QWidget);
  11414. central->setParent(window);
  11415. central->setObjectName("centralWidget");
  11416. window->setCentralWidget(central);
  11417. if(element.hasChildNodes())
  11418. {
  11419. /*162:*/
  11420. #line 3926 "./typica.w"
  11421. QStack<QWidget*> widgetStack;
  11422. QStack<QLayout*> layoutStack;
  11423. QString windowScript;
  11424. widgetStack.push(central);
  11425. QDomNodeList windowChildren= element.childNodes();
  11426. int i= 0;
  11427. while(i<windowChildren.count())
  11428. {
  11429. QDomNode current;
  11430. QDomElement element;
  11431. current= windowChildren.at(i);
  11432. if(current.isElement())
  11433. {
  11434. element= current.toElement();
  11435. if(element.tagName()=="program")
  11436. {
  11437. windowScript.append(element.text());
  11438. }
  11439. else if(element.tagName()=="layout")
  11440. {
  11441. addLayoutToWidget(element,&widgetStack,&layoutStack);
  11442. }
  11443. else if(element.tagName()=="menu")
  11444. {
  11445. /*163:*/
  11446. #line 3973 "./typica.w"
  11447. QMenuBar*bar= window->menuBar();
  11448. bar->setParent(window);
  11449. bar->setObjectName("menuBar");
  11450. if(element.hasAttribute("name"))
  11451. {
  11452. QMenu*menu= bar->addMenu(element.attribute("name"));
  11453. menu->setParent(bar);
  11454. if(element.hasAttribute("type"))
  11455. {
  11456. if(element.attribute("type")=="reports")
  11457. {
  11458. if(element.hasAttribute("src"))
  11459. {
  11460. /*545:*/
  11461. #line 12770 "./typica.w"
  11462. QSettings settings;
  11463. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  11464. arg(element.attribute("src")));
  11465. directory.setFilter(QDir::Files);
  11466. directory.setSorting(QDir::Name);
  11467. QStringList nameFilter;
  11468. nameFilter<<"*.xml";
  11469. directory.setNameFilters(nameFilter);
  11470. QFileInfoList reportFiles= directory.entryInfoList();
  11471. for(int i= 0;i<reportFiles.size();i++)
  11472. {
  11473. QFileInfo reportFile= reportFiles.at(i);
  11474. /*549:*/
  11475. #line 12847 "./typica.w"
  11476. QString path= reportFile.absoluteFilePath();
  11477. QFile file(path);
  11478. if(file.open(QIODevice::ReadOnly))
  11479. {
  11480. QDomDocument document;
  11481. document.setContent(&file,true);
  11482. QDomElement root= document.documentElement();
  11483. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  11484. if(!titleNode.isNull())
  11485. {
  11486. QDomElement titleElement= titleNode.toElement();
  11487. QString title= titleElement.text();
  11488. if(!title.isEmpty())
  11489. {
  11490. QStringList hierarchy= title.split(":->");
  11491. QMenu*insertionPoint= menu;
  11492. /*550:*/
  11493. #line 12874 "./typica.w"
  11494. for(int j= 0;j<hierarchy.size()-1;j++)
  11495. {
  11496. QObjectList menuList= insertionPoint->children();
  11497. bool menuFound= false;
  11498. for(int k= 0;k<menuList.size();k++)
  11499. {
  11500. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  11501. if(currentItem)
  11502. {
  11503. if(currentItem->title()==hierarchy.at(j))
  11504. {
  11505. menuFound= true;
  11506. insertionPoint= currentItem;
  11507. break;
  11508. }
  11509. }
  11510. }
  11511. if(!menuFound)
  11512. {
  11513. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  11514. }
  11515. }
  11516. /*:550*/
  11517. #line 12864 "./typica.w"
  11518. ReportAction*action= new ReportAction(path,hierarchy.last());
  11519. insertionPoint->addAction(action);
  11520. }
  11521. }
  11522. }
  11523. /*:549*/
  11524. #line 12783 "./typica.w"
  11525. }
  11526. /*:545*/
  11527. #line 3987 "./typica.w"
  11528. }
  11529. }
  11530. }
  11531. if(element.hasChildNodes())
  11532. {
  11533. /*164:*/
  11534. #line 4000 "./typica.w"
  11535. QDomNodeList menuItems= element.childNodes();
  11536. int j= 0;
  11537. while(j<menuItems.count())
  11538. {
  11539. QDomNode item= menuItems.at(j);
  11540. if(item.isElement())
  11541. {
  11542. QDomElement itemElement= item.toElement();
  11543. if(itemElement.tagName()=="item")
  11544. {
  11545. QAction*itemAction= new QAction(itemElement.text(),menu);
  11546. if(itemElement.hasAttribute("id"))
  11547. {
  11548. itemAction->setObjectName(itemElement.attribute("id"));
  11549. }
  11550. if(itemElement.hasAttribute("shortcut"))
  11551. {
  11552. itemAction->setShortcut(itemElement.attribute("shortcut"));
  11553. }
  11554. menu->addAction(itemAction);
  11555. }
  11556. else if(itemElement.tagName()=="separator")
  11557. {
  11558. menu->addSeparator();
  11559. }
  11560. }
  11561. j++;
  11562. }
  11563. #line 1 "./helpmenu.w"
  11564. /*:164*/
  11565. #line 3993 "./typica.w"
  11566. }
  11567. }
  11568. /*:163*/
  11569. #line 3951 "./typica.w"
  11570. }
  11571. }
  11572. i++;
  11573. }
  11574. QScriptValue oldThis= context->thisObject();
  11575. context->setThisObject(object);
  11576. QScriptValue result= engine->evaluate(windowScript);
  11577. /*156:*/
  11578. #line 3740 "./typica.w"
  11579. if(engine->hasUncaughtException())
  11580. {
  11581. int line= engine->uncaughtExceptionLineNumber();
  11582. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  11583. result.toString();
  11584. QString trace;
  11585. foreach(trace,engine->uncaughtExceptionBacktrace())
  11586. {
  11587. qDebug()<<trace;
  11588. }
  11589. }
  11590. /*:156*/
  11591. #line 3959 "./typica.w"
  11592. context->setThisObject(oldThis);
  11593. /*:162*/
  11594. #line 3902 "./typica.w"
  11595. }
  11596. /*165:*/
  11597. #line 9 "./helpmenu.w"
  11598. HelpMenu*helpMenu= new HelpMenu();
  11599. window->menuBar()->addMenu(helpMenu);
  11600. /*:165*/
  11601. #line 3904 "./typica.w"
  11602. window->show();
  11603. /*:161*/
  11604. #line 3847 "./typica.w"
  11605. }
  11606. return object;
  11607. }
  11608. /*:159*//*170:*/
  11609. #line 4042 "./typica.w"
  11610. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  11611. QStack<QLayout*> *layoutStack)
  11612. {
  11613. if(element.hasAttribute("type"))
  11614. {
  11615. /*171:*/
  11616. #line 4063 "./typica.w"
  11617. QLayout*layout;
  11618. QString layoutType= element.attribute("type");
  11619. if(layoutType=="horizontal")
  11620. {
  11621. layout= new QHBoxLayout;
  11622. layoutStack->push(layout);
  11623. populateBoxLayout(element,widgetStack,layoutStack);
  11624. }
  11625. else if(layoutType=="vertical")
  11626. {
  11627. layout= new QVBoxLayout;
  11628. layoutStack->push(layout);
  11629. populateBoxLayout(element,widgetStack,layoutStack);
  11630. }
  11631. else if(layoutType=="grid")
  11632. {
  11633. layout= new QGridLayout;
  11634. layoutStack->push(layout);
  11635. populateGridLayout(element,widgetStack,layoutStack);
  11636. }
  11637. else if(layoutType=="stack")
  11638. {
  11639. layout= new QStackedLayout;
  11640. layoutStack->push(layout);
  11641. populateStackedLayout(element,widgetStack,layoutStack);
  11642. }
  11643. if(element.hasAttribute("id"))
  11644. {
  11645. layout->setObjectName(element.attribute("id"));
  11646. }
  11647. /*:171*/
  11648. #line 4048 "./typica.w"
  11649. QWidget*widget= widgetStack->top();
  11650. if(layout)
  11651. {
  11652. widget->setLayout(layout);
  11653. }
  11654. layoutStack->pop();
  11655. }
  11656. }
  11657. /*:170*//*172:*/
  11658. #line 4101 "./typica.w"
  11659. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11660. QStack<QLayout*> *layoutStack)
  11661. {
  11662. QDomNodeList children= element.childNodes();
  11663. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  11664. for(int i= 0;i<children.count();i++)
  11665. {
  11666. QDomNode current;
  11667. QDomElement currentElement;
  11668. current= children.at(i);
  11669. if(current.isElement())
  11670. {
  11671. currentElement= current.toElement();
  11672. if(currentElement.tagName()=="page")
  11673. {
  11674. QWidget*widget= new QWidget;
  11675. layout->addWidget(widget);
  11676. widgetStack->push(widget);
  11677. populateWidget(currentElement,widgetStack,layoutStack);
  11678. widgetStack->pop();
  11679. }
  11680. }
  11681. }
  11682. }
  11683. /*:172*//*173:*/
  11684. #line 4133 "./typica.w"
  11685. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11686. QStack<QLayout*> *layoutStack)
  11687. {
  11688. QDomNodeList children= element.childNodes();
  11689. int row= -1;
  11690. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  11691. for(int i= 0;i<children.count();i++)
  11692. {
  11693. QDomNode current;
  11694. QDomElement currentElement;
  11695. current= children.at(i);
  11696. if(current.isElement())
  11697. {
  11698. currentElement= current.toElement();
  11699. if(currentElement.tagName()=="row")
  11700. {
  11701. row++;
  11702. if(currentElement.hasAttribute("height"))
  11703. {
  11704. layout->setRowMinimumHeight(row,
  11705. currentElement.attribute("height").toInt());
  11706. }
  11707. if(currentElement.hasAttribute("stretch"))
  11708. {
  11709. layout->setRowStretch(row,
  11710. currentElement.attribute("stretch").toInt());
  11711. }
  11712. /*174:*/
  11713. #line 4189 "./typica.w"
  11714. int column= -1;
  11715. QDomNodeList rowChildren= currentElement.childNodes();
  11716. for(int j= 0;j<rowChildren.count();j++)
  11717. {
  11718. QDomNode columnNode;
  11719. QDomElement columnElement;
  11720. columnNode= rowChildren.at(j);
  11721. if(columnNode.isElement())
  11722. {
  11723. columnElement= columnNode.toElement();
  11724. if(columnElement.tagName()=="column")
  11725. {
  11726. column++;
  11727. if(columnElement.hasAttribute("column"))
  11728. {
  11729. column= columnElement.attribute("column").toInt();
  11730. }
  11731. if(columnElement.hasAttribute("width"))
  11732. {
  11733. layout->setColumnMinimumWidth(column,
  11734. columnElement.attribute("width").toInt());
  11735. }
  11736. if(columnElement.hasAttribute("stretch"))
  11737. {
  11738. layout->setColumnStretch(column,
  11739. columnElement.attribute("stretch").toInt());
  11740. }
  11741. int hspan= 1;
  11742. int vspan= 1;
  11743. if(columnElement.hasAttribute("rowspan"))
  11744. {
  11745. vspan= columnElement.attribute("rowspan").toInt();
  11746. }
  11747. if(columnElement.hasAttribute("colspan"))
  11748. {
  11749. hspan= columnElement.attribute("colspan").toInt();
  11750. }
  11751. QHBoxLayout*cell= new QHBoxLayout;
  11752. layout->addLayout(cell,row,column,vspan,hspan);
  11753. layoutStack->push(cell);
  11754. populateBoxLayout(columnElement,widgetStack,layoutStack);
  11755. layoutStack->pop();
  11756. }
  11757. }
  11758. }
  11759. /*:174*/
  11760. #line 4161 "./typica.w"
  11761. }
  11762. }
  11763. }
  11764. }
  11765. /*:173*//*175:*/
  11766. #line 4239 "./typica.w"
  11767. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11768. QStack<QLayout*> *layoutStack)
  11769. {
  11770. QDomNodeList children= element.childNodes();
  11771. for(int i= 0;i<children.count();i++)
  11772. {
  11773. QDomNode current;
  11774. QDomElement currentElement;
  11775. current= children.at(i);
  11776. if(current.isElement())
  11777. {
  11778. currentElement= current.toElement();
  11779. if(currentElement.tagName()=="button")
  11780. {
  11781. addButtonToLayout(currentElement,widgetStack,layoutStack);
  11782. }
  11783. else if(currentElement.tagName()=="calendar")
  11784. {
  11785. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  11786. }
  11787. else if(currentElement.tagName()=="decoration")
  11788. {
  11789. addDecorationToLayout(currentElement,widgetStack,
  11790. layoutStack);
  11791. }
  11792. else if(currentElement.tagName()=="layout")
  11793. {
  11794. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  11795. }
  11796. else if(currentElement.tagName()=="splitter")
  11797. {
  11798. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  11799. }
  11800. else if(currentElement.tagName()=="label")
  11801. {
  11802. QBoxLayout*layout=
  11803. qobject_cast<QBoxLayout*> (layoutStack->top());
  11804. QLabel*label= new QLabel(currentElement.text());
  11805. layout->addWidget(label);
  11806. }
  11807. else if(currentElement.tagName()=="lcdtemperature")
  11808. {
  11809. addTemperatureDisplayToLayout(currentElement,widgetStack,
  11810. layoutStack);
  11811. }
  11812. else if(currentElement.tagName()=="lcdtimer")
  11813. {
  11814. addTimerDisplayToLayout(currentElement,widgetStack,
  11815. layoutStack);
  11816. }
  11817. else if(currentElement.tagName()=="line")
  11818. {
  11819. addLineToLayout(currentElement,widgetStack,layoutStack);
  11820. }
  11821. else if(currentElement.tagName()=="report")
  11822. {
  11823. addReportToLayout(currentElement,widgetStack,layoutStack);
  11824. }
  11825. else if(currentElement.tagName()=="sqldrop")
  11826. {
  11827. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  11828. }
  11829. else if(currentElement.tagName()=="sqltablearray")
  11830. {
  11831. addSaltToLayout(currentElement,widgetStack,layoutStack);
  11832. }
  11833. else if(currentElement.tagName()=="sqlview")
  11834. {
  11835. addSqlQueryViewToLayout(currentElement,widgetStack,
  11836. layoutStack);
  11837. }
  11838. else if(currentElement.tagName()=="textarea")
  11839. {
  11840. addTextToLayout(currentElement,widgetStack,layoutStack);
  11841. }
  11842. else if(currentElement.tagName()=="spinbox")
  11843. {
  11844. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  11845. }
  11846. else if(currentElement.tagName()=="formarray")
  11847. {
  11848. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  11849. }
  11850. else if(currentElement.tagName()=="hscale")
  11851. {
  11852. addScaleControlToLayout(currentElement,widgetStack,
  11853. layoutStack);
  11854. }
  11855. else if(currentElement.tagName()=="vscale")
  11856. {
  11857. addIntensityControlToLayout(currentElement,widgetStack,
  11858. layoutStack);
  11859. }
  11860. else if(currentElement.tagName()=="webview")
  11861. {
  11862. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  11863. }
  11864. else if(currentElement.tagName()=="stretch")
  11865. {
  11866. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11867. layout->addStretch();
  11868. }
  11869. }
  11870. }
  11871. }
  11872. /*:175*//*176:*/
  11873. #line 4349 "./typica.w"
  11874. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11875. QStack<QLayout*> *layoutStack)
  11876. {
  11877. QLayout*targetLayout= layoutStack->pop();
  11878. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  11879. if(element.hasAttribute("type"))
  11880. {
  11881. /*171:*/
  11882. #line 4063 "./typica.w"
  11883. QLayout*layout;
  11884. QString layoutType= element.attribute("type");
  11885. if(layoutType=="horizontal")
  11886. {
  11887. layout= new QHBoxLayout;
  11888. layoutStack->push(layout);
  11889. populateBoxLayout(element,widgetStack,layoutStack);
  11890. }
  11891. else if(layoutType=="vertical")
  11892. {
  11893. layout= new QVBoxLayout;
  11894. layoutStack->push(layout);
  11895. populateBoxLayout(element,widgetStack,layoutStack);
  11896. }
  11897. else if(layoutType=="grid")
  11898. {
  11899. layout= new QGridLayout;
  11900. layoutStack->push(layout);
  11901. populateGridLayout(element,widgetStack,layoutStack);
  11902. }
  11903. else if(layoutType=="stack")
  11904. {
  11905. layout= new QStackedLayout;
  11906. layoutStack->push(layout);
  11907. populateStackedLayout(element,widgetStack,layoutStack);
  11908. }
  11909. if(element.hasAttribute("id"))
  11910. {
  11911. layout->setObjectName(element.attribute("id"));
  11912. }
  11913. /*:171*/
  11914. #line 4357 "./typica.w"
  11915. boxLayout->addLayout(layout);
  11916. layoutStack->pop();
  11917. }
  11918. layoutStack->push(targetLayout);
  11919. }
  11920. /*:176*//*177:*/
  11921. #line 4368 "./typica.w"
  11922. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11923. QStack<QLayout*> *layoutStack)
  11924. {
  11925. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11926. QSplitter*splitter= new(QSplitter);
  11927. layout->addWidget(splitter);
  11928. /*178:*/
  11929. #line 4381 "./typica.w"
  11930. QString orientation= element.attribute("type");
  11931. if(orientation=="horizontal")
  11932. {
  11933. splitter->setOrientation(Qt::Horizontal);
  11934. }
  11935. else if(orientation=="vertical")
  11936. {
  11937. splitter->setOrientation(Qt::Vertical);
  11938. }
  11939. QString id= element.attribute("id");
  11940. if(!id.isEmpty())
  11941. {
  11942. splitter->setObjectName(id);
  11943. }
  11944. if(element.hasChildNodes())
  11945. {
  11946. widgetStack->push(splitter);
  11947. populateSplitter(element,widgetStack,layoutStack);
  11948. widgetStack->pop();
  11949. }
  11950. /*:178*/
  11951. #line 4375 "./typica.w"
  11952. }
  11953. /*:177*//*179:*/
  11954. #line 4407 "./typica.w"
  11955. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  11956. QStack<QLayout*> *layoutStack)
  11957. {
  11958. QDomNodeList children= element.childNodes();
  11959. for(int i= 0;i<children.count();i++)
  11960. {
  11961. QDomNode current;
  11962. QDomElement currentElement;
  11963. current= children.at(i);
  11964. if(current.isElement())
  11965. {
  11966. currentElement= current.toElement();
  11967. if(currentElement.tagName()=="decoration")
  11968. {
  11969. addDecorationToSplitter(currentElement,widgetStack,
  11970. layoutStack);
  11971. }
  11972. else if(currentElement.tagName()=="graph")
  11973. {
  11974. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  11975. }
  11976. else if(currentElement.tagName()=="splitter")
  11977. {
  11978. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  11979. }
  11980. else if(currentElement.tagName()=="lcdtemperature")
  11981. {
  11982. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  11983. layoutStack);
  11984. }
  11985. else if(currentElement.tagName()=="lcdtimer")
  11986. {
  11987. addTimerDisplayToSplitter(currentElement,widgetStack,
  11988. layoutStack);
  11989. }
  11990. else if(currentElement.tagName()=="measurementtable")
  11991. {
  11992. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  11993. }
  11994. else if(currentElement.tagName()=="widget")
  11995. {
  11996. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  11997. }
  11998. }
  11999. }
  12000. }
  12001. /*:179*//*180:*/
  12002. #line 4457 "./typica.w"
  12003. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12004. QStack<QLayout*> *layoutStack)
  12005. {
  12006. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  12007. QSplitter*splitter= new(QSplitter);
  12008. splitter->setParent(parent);
  12009. parent->addWidget(splitter);
  12010. /*178:*/
  12011. #line 4381 "./typica.w"
  12012. QString orientation= element.attribute("type");
  12013. if(orientation=="horizontal")
  12014. {
  12015. splitter->setOrientation(Qt::Horizontal);
  12016. }
  12017. else if(orientation=="vertical")
  12018. {
  12019. splitter->setOrientation(Qt::Vertical);
  12020. }
  12021. QString id= element.attribute("id");
  12022. if(!id.isEmpty())
  12023. {
  12024. splitter->setObjectName(id);
  12025. }
  12026. if(element.hasChildNodes())
  12027. {
  12028. widgetStack->push(splitter);
  12029. populateSplitter(element,widgetStack,layoutStack);
  12030. widgetStack->pop();
  12031. }
  12032. /*:178*/
  12033. #line 4465 "./typica.w"
  12034. }
  12035. /*:180*//*181:*/
  12036. #line 4474 "./typica.w"
  12037. void addTemperatureDisplayToSplitter(QDomElement element,
  12038. QStack<QWidget*> *widgetStack,
  12039. QStack<QLayout*> *)
  12040. {
  12041. TemperatureDisplay*display= new(TemperatureDisplay);
  12042. if(element.hasAttribute("id"))
  12043. {
  12044. display->setObjectName(element.attribute("id"));
  12045. }
  12046. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12047. splitter->addWidget(display);
  12048. }
  12049. void addTemperatureDisplayToLayout(QDomElement element,
  12050. QStack<QWidget*> *,
  12051. QStack<QLayout*> *layoutStack)
  12052. {
  12053. TemperatureDisplay*display= new(TemperatureDisplay);
  12054. if(element.hasAttribute("id"))
  12055. {
  12056. display->setObjectName(element.attribute("id"));
  12057. }
  12058. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12059. layout->addWidget(display);
  12060. }
  12061. /*:181*//*182:*/
  12062. #line 4505 "./typica.w"
  12063. void addTimerDisplayToSplitter(QDomElement element,
  12064. QStack<QWidget*> *widgetStack,
  12065. QStack<QLayout*> *)
  12066. {
  12067. TimerDisplay*display= new(TimerDisplay);
  12068. if(element.hasAttribute("id"))
  12069. {
  12070. display->setObjectName(element.attribute("id"));
  12071. }
  12072. if(element.hasAttribute("format"))
  12073. {
  12074. display->setDisplayFormat(element.attribute("format"));
  12075. }
  12076. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12077. splitter->addWidget(display);
  12078. }
  12079. void addTimerDisplayToLayout(QDomElement element,
  12080. QStack<QWidget*> *,
  12081. QStack<QLayout*> *layoutStack)
  12082. {
  12083. TimerDisplay*display= new(TimerDisplay);
  12084. if(element.hasAttribute("id"))
  12085. {
  12086. display->setObjectName(element.attribute("id"));
  12087. }
  12088. if(element.hasAttribute("format"))
  12089. {
  12090. display->setDisplayFormat(element.attribute("format"));
  12091. }
  12092. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12093. layout->addWidget(display);
  12094. }
  12095. /*:182*//*183:*/
  12096. #line 4543 "./typica.w"
  12097. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  12098. QStack<QLayout*> *layoutStack)
  12099. {
  12100. /*184:*/
  12101. #line 4564 "./typica.w"
  12102. QString labelText= element.attribute("name");
  12103. Qt::Orientations orientation= Qt::Horizontal;
  12104. if(element.hasAttribute("type"))
  12105. {
  12106. if(element.attribute("type")=="horizontal")
  12107. {
  12108. orientation= Qt::Horizontal;
  12109. }
  12110. else if(element.attribute("type")=="vertical")
  12111. {
  12112. orientation= Qt::Vertical;
  12113. }
  12114. }
  12115. /*185:*/
  12116. #line 4589 "./typica.w"
  12117. QWidget*theWidget= NULL;
  12118. QDomNodeList children= element.childNodes();
  12119. for(int i= 0;i<children.count();i++)
  12120. {
  12121. QDomNode item= children.at(i);
  12122. if(item.isElement())
  12123. {
  12124. QDomElement itemElement= item.toElement();
  12125. if(itemElement.tagName()=="lcdtemperature")
  12126. {
  12127. TemperatureDisplay*display= new TemperatureDisplay;
  12128. if(itemElement.hasAttribute("id"))
  12129. {
  12130. display->setObjectName(itemElement.attribute("id"));
  12131. }
  12132. theWidget= display;
  12133. }
  12134. else if(itemElement.tagName()=="lcdtimer")
  12135. {
  12136. TimerDisplay*display= new TimerDisplay;
  12137. if(itemElement.hasAttribute("id"))
  12138. {
  12139. display->setObjectName(itemElement.attribute("id"));
  12140. }
  12141. if(itemElement.hasAttribute("format"))
  12142. {
  12143. display->setDisplayFormat(itemElement.attribute("format"));
  12144. }
  12145. theWidget= display;
  12146. }
  12147. }
  12148. }
  12149. /*:185*/
  12150. #line 4578 "./typica.w"
  12151. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12152. orientation);
  12153. if(element.hasAttribute("id"))
  12154. {
  12155. decoration->setObjectName(element.attribute("id"));
  12156. }
  12157. /*:184*/
  12158. #line 4547 "./typica.w"
  12159. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12160. layout->addWidget(decoration);
  12161. }
  12162. void addDecorationToSplitter(QDomElement element,
  12163. QStack<QWidget*> *widgetStack,
  12164. QStack<QLayout*> *)
  12165. {
  12166. /*184:*/
  12167. #line 4564 "./typica.w"
  12168. QString labelText= element.attribute("name");
  12169. Qt::Orientations orientation= Qt::Horizontal;
  12170. if(element.hasAttribute("type"))
  12171. {
  12172. if(element.attribute("type")=="horizontal")
  12173. {
  12174. orientation= Qt::Horizontal;
  12175. }
  12176. else if(element.attribute("type")=="vertical")
  12177. {
  12178. orientation= Qt::Vertical;
  12179. }
  12180. }
  12181. /*185:*/
  12182. #line 4589 "./typica.w"
  12183. QWidget*theWidget= NULL;
  12184. QDomNodeList children= element.childNodes();
  12185. for(int i= 0;i<children.count();i++)
  12186. {
  12187. QDomNode item= children.at(i);
  12188. if(item.isElement())
  12189. {
  12190. QDomElement itemElement= item.toElement();
  12191. if(itemElement.tagName()=="lcdtemperature")
  12192. {
  12193. TemperatureDisplay*display= new TemperatureDisplay;
  12194. if(itemElement.hasAttribute("id"))
  12195. {
  12196. display->setObjectName(itemElement.attribute("id"));
  12197. }
  12198. theWidget= display;
  12199. }
  12200. else if(itemElement.tagName()=="lcdtimer")
  12201. {
  12202. TimerDisplay*display= new TimerDisplay;
  12203. if(itemElement.hasAttribute("id"))
  12204. {
  12205. display->setObjectName(itemElement.attribute("id"));
  12206. }
  12207. if(itemElement.hasAttribute("format"))
  12208. {
  12209. display->setDisplayFormat(itemElement.attribute("format"));
  12210. }
  12211. theWidget= display;
  12212. }
  12213. }
  12214. }
  12215. /*:185*/
  12216. #line 4578 "./typica.w"
  12217. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12218. orientation);
  12219. if(element.hasAttribute("id"))
  12220. {
  12221. decoration->setObjectName(element.attribute("id"));
  12222. }
  12223. /*:184*/
  12224. #line 4556 "./typica.w"
  12225. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12226. splitter->addWidget(decoration);
  12227. }
  12228. /*:183*//*186:*/
  12229. #line 4628 "./typica.w"
  12230. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12231. QStack<QLayout*> *layoutStack)
  12232. {
  12233. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12234. QWidget*widget= new QWidget;
  12235. if(element.hasAttribute("id"))
  12236. {
  12237. widget->setObjectName(element.attribute("id"));
  12238. }
  12239. splitter->addWidget(widget);
  12240. if(element.hasChildNodes())
  12241. {
  12242. widgetStack->push(widget);
  12243. populateWidget(element,widgetStack,layoutStack);
  12244. widgetStack->pop();
  12245. }
  12246. }
  12247. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  12248. QStack<QLayout*> *layoutStack)
  12249. {
  12250. QDomNodeList children= element.childNodes();
  12251. for(int i= 0;i<children.count();i++)
  12252. {
  12253. QDomNode current;
  12254. QDomElement currentElement;
  12255. current= children.at(i);
  12256. if(current.isElement())
  12257. {
  12258. currentElement= current.toElement();
  12259. if(currentElement.tagName()=="layout")
  12260. {
  12261. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  12262. }
  12263. }
  12264. }
  12265. }
  12266. /*:186*//*187:*/
  12267. #line 4671 "./typica.w"
  12268. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  12269. QStack<QLayout*> *layoutStack)
  12270. {
  12271. QAbstractButton*button= NULL;
  12272. QString text= element.attribute("name");
  12273. if(element.hasAttribute("type"))
  12274. {
  12275. QString type= element.attribute("type");
  12276. if(type=="annotation")
  12277. {
  12278. AnnotationButton*abutton= new AnnotationButton(text);
  12279. if(element.hasAttribute("annotation"))
  12280. {
  12281. abutton->setAnnotation(element.attribute("annotation"));
  12282. }
  12283. if(element.hasAttribute("series"))
  12284. {
  12285. abutton->setTemperatureColumn(element.attribute("series").
  12286. toInt());
  12287. }
  12288. if(element.hasAttribute("column"))
  12289. {
  12290. abutton->setAnnotationColumn(element.attribute("column").
  12291. toInt());
  12292. }
  12293. button= abutton;
  12294. }
  12295. else if(type=="check")
  12296. {
  12297. button= new QCheckBox(text);
  12298. }
  12299. else if(type=="push")
  12300. {
  12301. button= new QPushButton(text);
  12302. }
  12303. }
  12304. if(element.hasAttribute("id"))
  12305. {
  12306. button->setObjectName(element.attribute("id"));
  12307. }
  12308. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12309. layout->addWidget(button);
  12310. }
  12311. /*:187*//*188:*/
  12312. #line 4723 "./typica.w"
  12313. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  12314. QStack<QLayout*> *layoutStack)
  12315. {
  12316. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  12317. if(element.hasAttribute("pretext"))
  12318. {
  12319. box->setPretext(element.attribute("pretext"));
  12320. }
  12321. if(element.hasAttribute("posttext"))
  12322. {
  12323. box->setPosttext(element.attribute("posttext"));
  12324. }
  12325. if(element.hasAttribute("series"))
  12326. {
  12327. box->setTemperatureColumn(element.attribute("series").toInt());
  12328. }
  12329. if(element.hasAttribute("column"))
  12330. {
  12331. box->setAnnotationColumn(element.attribute("column").toInt());
  12332. }
  12333. if(element.hasAttribute("min"))
  12334. {
  12335. box->setMinimum(element.attribute("min").toDouble());
  12336. }
  12337. if(element.hasAttribute("max"))
  12338. {
  12339. box->setMaximum(element.attribute("max").toDouble());
  12340. }
  12341. if(element.hasAttribute("decimals"))
  12342. {
  12343. box->setDecimals(element.attribute("decimals").toInt());
  12344. }
  12345. if(element.hasAttribute("step"))
  12346. {
  12347. box->setSingleStep(element.attribute("step").toDouble());
  12348. }
  12349. if(element.hasAttribute("id"))
  12350. {
  12351. box->setObjectName(element.attribute("id"));
  12352. }
  12353. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12354. layout->addWidget(box);
  12355. }
  12356. /*:188*//*189:*/
  12357. #line 4779 "./typica.w"
  12358. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12359. QStack<QLayout*> *)
  12360. {
  12361. ZoomLog*widget= new ZoomLog;
  12362. if(!widget)
  12363. {
  12364. qDebug()<<"Error constructing widget!";
  12365. }
  12366. if(element.hasAttribute("id"))
  12367. {
  12368. widget->setObjectName(element.attribute("id"));
  12369. }
  12370. if(element.hasChildNodes())
  12371. {
  12372. QDomNodeList children= element.childNodes();
  12373. int column= 0;
  12374. for(int i= 0;i<children.count();i++)
  12375. {
  12376. QDomNode current;
  12377. QDomElement currentElement;
  12378. current= children.at(i);
  12379. if(current.isElement())
  12380. {
  12381. currentElement= current.toElement();
  12382. if(currentElement.tagName()=="column")
  12383. {
  12384. QString text= currentElement.text();
  12385. widget->setHeaderData(column,text);
  12386. column++;
  12387. }
  12388. }
  12389. }
  12390. }
  12391. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12392. if(splitter)
  12393. {
  12394. splitter->addWidget(widget);
  12395. }
  12396. else
  12397. {
  12398. qDebug()<<"Splitter not found at top of widget stack!";
  12399. }
  12400. }
  12401. /*:189*//*190:*/
  12402. #line 4827 "./typica.w"
  12403. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12404. QStack<QLayout*> *)
  12405. {
  12406. GraphView*view= new GraphView;
  12407. if(element.hasAttribute("id"))
  12408. {
  12409. view->setObjectName(element.attribute("id"));
  12410. }
  12411. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12412. splitter->addWidget(view);
  12413. }
  12414. /*:190*//*191:*/
  12415. #line 4844 "./typica.w"
  12416. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  12417. QStack<QLayout*> *layoutStack)
  12418. {
  12419. SqlComboBox*box= new SqlComboBox();
  12420. if(element.hasAttribute("data"))
  12421. {
  12422. box->setDataColumn(element.attribute("data").toInt());
  12423. }
  12424. if(element.hasAttribute("display"))
  12425. {
  12426. box->setDisplayColumn(element.attribute("display").toInt());
  12427. }
  12428. if(element.hasAttribute("showdata"))
  12429. {
  12430. if(element.attribute("showdata")=="true")
  12431. {
  12432. box->showData(true);
  12433. }
  12434. }
  12435. if(element.hasAttribute("editable"))
  12436. {
  12437. if(element.attribute("editable")=="true")
  12438. {
  12439. box->setEditable(true);
  12440. }
  12441. }
  12442. if(element.hasChildNodes())
  12443. {
  12444. QDomNodeList children= element.childNodes();
  12445. for(int i= 0;i<children.count();i++)
  12446. {
  12447. QDomNode current;
  12448. QDomElement currentElement;
  12449. current= children.at(i);
  12450. if(current.isElement())
  12451. {
  12452. currentElement= current.toElement();
  12453. if(currentElement.tagName()=="null")
  12454. {
  12455. box->addNullOption();
  12456. }
  12457. else if(currentElement.tagName()=="query")
  12458. {
  12459. box->addSqlOptions(currentElement.text());
  12460. }
  12461. }
  12462. }
  12463. }
  12464. if(element.hasAttribute("id"))
  12465. {
  12466. box->setObjectName(element.attribute("id"));
  12467. }
  12468. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12469. layout->addWidget(box);
  12470. }
  12471. /*:191*//*192:*/
  12472. #line 4923 "./typica.w"
  12473. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  12474. QStack<QLayout*> *layoutStack)
  12475. {
  12476. QTableView*view= new QTableView;
  12477. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  12478. SaltModel*model= new SaltModel(element.childNodes().count());
  12479. if(element.hasAttribute("id"))
  12480. {
  12481. view->setObjectName(element.attribute("id"));
  12482. }
  12483. if(element.hasChildNodes())
  12484. {
  12485. QDomNodeList children= element.childNodes();
  12486. int currentColumn= 0;
  12487. for(int i= 0;i<children.count();i++)
  12488. {
  12489. QDomNode current;
  12490. QDomElement currentElement;
  12491. current= children.at(i);
  12492. if(current.isElement())
  12493. {
  12494. currentElement= current.toElement();
  12495. if(currentElement.tagName()=="column")
  12496. {
  12497. if(currentElement.hasAttribute("name"))
  12498. {
  12499. model->setHeaderData(currentColumn,Qt::Horizontal,
  12500. currentElement.attribute("name"));
  12501. }
  12502. if(currentElement.hasAttribute("delegate"))
  12503. {
  12504. /*193:*/
  12505. #line 4971 "./typica.w"
  12506. if(currentElement.attribute("delegate")=="sql")
  12507. {
  12508. /*194:*/
  12509. #line 4987 "./typica.w"
  12510. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  12511. SqlComboBox*widget= new SqlComboBox();
  12512. if(currentElement.hasAttribute("null"))
  12513. {
  12514. if(currentElement.attribute("null")=="true")
  12515. {
  12516. widget->addNullOption();
  12517. }
  12518. }
  12519. if(currentElement.hasAttribute("showdata"))
  12520. {
  12521. if(currentElement.attribute("showdata")=="true")
  12522. {
  12523. widget->showData(true);
  12524. }
  12525. }
  12526. if(currentElement.hasAttribute("data"))
  12527. {
  12528. widget->setDataColumn(currentElement.attribute("data").toInt());
  12529. }
  12530. if(currentElement.hasAttribute("display"))
  12531. {
  12532. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  12533. }
  12534. widget->addSqlOptions(currentElement.text());
  12535. delegate->setWidget(widget);
  12536. view->setItemDelegateForColumn(currentColumn,delegate);
  12537. /*:194*/
  12538. #line 4974 "./typica.w"
  12539. }
  12540. else if(currentElement.attribute("delegate")=="numeric")
  12541. {
  12542. /*195:*/
  12543. #line 5020 "./typica.w"
  12544. NumericDelegate*delegate= new NumericDelegate;
  12545. view->setItemDelegateForColumn(currentColumn,delegate);
  12546. /*:195*/
  12547. #line 4978 "./typica.w"
  12548. }
  12549. /*:193*/
  12550. #line 4955 "./typica.w"
  12551. }
  12552. currentColumn++;
  12553. }
  12554. }
  12555. }
  12556. }
  12557. view->setModel(model);
  12558. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12559. layout->addWidget(view);
  12560. }
  12561. /*:192*//*202:*/
  12562. #line 5130 "./typica.w"
  12563. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  12564. QStack<QLayout*> *layoutStack)
  12565. {
  12566. QLineEdit*widget= new QLineEdit(element.text());
  12567. if(element.hasAttribute("id"))
  12568. {
  12569. widget->setObjectName(element.attribute("id"));
  12570. }
  12571. if(element.hasAttribute("writable"))
  12572. {
  12573. if(element.attribute("writable")=="false")
  12574. {
  12575. widget->setReadOnly(true);
  12576. }
  12577. }
  12578. if(element.hasAttribute("validator"))
  12579. {
  12580. if(element.attribute("validator")=="numeric")
  12581. {
  12582. widget->setValidator(new QDoubleValidator(NULL));
  12583. }
  12584. else if(element.attribute("validator")=="integer")
  12585. {
  12586. widget->setValidator(new QIntValidator(NULL));
  12587. }
  12588. else if(element.attribute("validator")=="expression"&&
  12589. element.hasAttribute("expression"))
  12590. {
  12591. widget->setValidator(new QRegExpValidator(
  12592. QRegExp(element.attribute("expression")),
  12593. NULL));
  12594. }
  12595. }
  12596. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12597. layout->addWidget(widget);
  12598. }
  12599. /*:202*//*203:*/
  12600. #line 5171 "./typica.w"
  12601. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  12602. QStack<QLayout*> *layoutStack)
  12603. {
  12604. QTextEdit*widget= new QTextEdit;
  12605. if(element.hasAttribute("id"))
  12606. {
  12607. widget->setObjectName(element.attribute("id"));
  12608. }
  12609. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12610. layout->addWidget(widget);
  12611. }
  12612. /*:203*//*204:*/
  12613. #line 5188 "./typica.w"
  12614. void addSqlQueryViewToLayout(QDomElement element,
  12615. QStack<QWidget*> *,
  12616. QStack<QLayout*> *layoutStack)
  12617. {
  12618. SqlQueryView*view= new SqlQueryView;
  12619. if(element.hasAttribute("id"))
  12620. {
  12621. view->setObjectName(element.attribute("id"));
  12622. }
  12623. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12624. layout->addWidget(view);
  12625. }
  12626. /*:204*//*205:*/
  12627. #line 5205 "./typica.w"
  12628. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  12629. QStack<QLayout*> *layoutStack)
  12630. {
  12631. QDateEdit*widget= new QDateEdit;
  12632. widget->setCalendarPopup(true);
  12633. if(element.hasAttribute("id"))
  12634. {
  12635. widget->setObjectName(element.attribute("id"));
  12636. }
  12637. widget->setDate(QDate::currentDate());
  12638. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12639. layout->addWidget(widget);
  12640. }
  12641. /*:205*//*206:*/
  12642. #line 5223 "./typica.w"
  12643. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  12644. {
  12645. setQDateTimeEditProperties(value,engine);
  12646. }
  12647. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  12648. {
  12649. setQAbstractSpinBoxProperties(value,engine);
  12650. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  12651. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  12652. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  12653. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  12654. }
  12655. /*:206*//*207:*/
  12656. #line 5243 "./typica.w"
  12657. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  12658. {
  12659. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12660. if(context->argumentCount()==3)
  12661. {
  12662. self->setDate(QDate(argument<int> (0,context),
  12663. argument<int> (1,context),
  12664. argument<int> (2,context)));
  12665. }
  12666. else
  12667. {
  12668. context->throwError("Incorrect number of arguments passed to "
  12669. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  12670. "specifying the year, month, and day.");
  12671. }
  12672. return QScriptValue();
  12673. }
  12674. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  12675. {
  12676. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12677. return QScriptValue(self->date().day());
  12678. }
  12679. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  12680. {
  12681. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12682. return QScriptValue(self->date().month());
  12683. }
  12684. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  12685. {
  12686. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12687. return QScriptValue(self->date().year());
  12688. }
  12689. /*:207*//*211:*/
  12690. #line 5310 "./typica.w"
  12691. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  12692. {
  12693. QObject*parent= argument<QObject*> (0,context);
  12694. QString name= argument<QString> (1,context);
  12695. QObject*object= parent->findChild<QObject*> (name);
  12696. QScriptValue value;
  12697. if(object)
  12698. {
  12699. value= engine->newQObject(object);
  12700. QString className= object->metaObject()->className();
  12701. /*212:*/
  12702. #line 5328 "./typica.w"
  12703. if(className=="TemperatureDisplay")
  12704. {
  12705. setTemperatureDisplayProperties(value,engine);
  12706. }
  12707. else if(className=="TimerDisplay")
  12708. {
  12709. setTimerDisplayProperties(value,engine);
  12710. }
  12711. else if(className=="QAction")
  12712. {
  12713. setQActionProperties(value,engine);
  12714. }
  12715. else if(className=="QBoxLayout")
  12716. {
  12717. setQBoxLayoutProperties(value,engine);
  12718. }
  12719. else if(className=="QDateEdit")
  12720. {
  12721. setQDateEditProperties(value,engine);
  12722. }
  12723. else if(className=="QFrame")
  12724. {
  12725. setQFrameProperties(value,engine);
  12726. }
  12727. else if(className=="QHBoxLayout")
  12728. {
  12729. setQBoxLayoutProperties(value,engine);
  12730. }
  12731. else if(className=="QLCDNumber")
  12732. {
  12733. setQLCDNumberProperties(value,engine);
  12734. }
  12735. else if(className=="QMenu")
  12736. {
  12737. setQMenuProperties(value,engine);
  12738. }
  12739. else if(className=="QMenuBar")
  12740. {
  12741. setQMenuBarProperties(value,engine);
  12742. }
  12743. else if(className=="QPushButton")
  12744. {
  12745. setQPushButtonProperties(value,engine);
  12746. }
  12747. else if(className=="QSplitter")
  12748. {
  12749. setQSplitterProperties(value,engine);
  12750. }
  12751. else if(className=="QTableView")
  12752. {
  12753. if(object->property("tabletype").isValid())
  12754. {
  12755. if(object->property("tabletype").toString()=="SaltTable")
  12756. {
  12757. setSaltTableProperties(value,engine);
  12758. }
  12759. }
  12760. }
  12761. else if(className=="QVBoxLayout")
  12762. {
  12763. setQBoxLayoutProperties(value,engine);
  12764. }
  12765. else if(className=="QWidget")
  12766. {
  12767. setQWidgetProperties(value,engine);
  12768. }
  12769. else if(className=="ScriptQMainWindow")
  12770. {
  12771. setQMainWindowProperties(value,engine);
  12772. }
  12773. else if(className=="SqlComboBox")
  12774. {
  12775. setSqlComboBoxProperties(value,engine);
  12776. }
  12777. else if(className=="SqlQueryView")
  12778. {
  12779. setSqlQueryViewProperties(value,engine);
  12780. }
  12781. else if(className=="ZoomLog")
  12782. {
  12783. setZoomLogProperties(value,engine);
  12784. }
  12785. else if(className=="QTextEdit")
  12786. {
  12787. setQTextEditProperties(value,engine);
  12788. }
  12789. else if(className=="QWebView")
  12790. {
  12791. setQWebViewProperties(value,engine);
  12792. }
  12793. /*:212*/
  12794. #line 5321 "./typica.w"
  12795. }
  12796. return value;
  12797. }
  12798. /*:211*//*214:*/
  12799. #line 5446 "./typica.w"
  12800. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  12801. {
  12802. QTableView*self= getself<QTableView*> (context);
  12803. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12804. QString datum;
  12805. double total= 0.0;
  12806. int column= argument<int> (0,context);
  12807. int role= argument<int> (1,context);
  12808. for(int i= 0;i<model->rowCount();i++)
  12809. {
  12810. datum= model->data(model->index(i,column),role).toString();
  12811. if(!datum.isEmpty())
  12812. {
  12813. total+= datum.toDouble();
  12814. }
  12815. }
  12816. return QScriptValue(engine,total);
  12817. }
  12818. /*:214*//*215:*/
  12819. #line 5470 "./typica.w"
  12820. QScriptValue SaltTable_columnArray(QScriptContext*context,
  12821. QScriptEngine*engine)
  12822. {
  12823. QTableView*self= getself<QTableView*> (context);
  12824. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12825. int column= argument<int> (0,context);
  12826. int role= argument<int> (1,context);
  12827. QString literal= model->arrayLiteral(column,role);
  12828. return QScriptValue(engine,literal);
  12829. }
  12830. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  12831. QScriptEngine*engine)
  12832. {
  12833. QTableView*self= getself<QTableView*> (context);
  12834. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12835. int column= argument<int> (0,context);
  12836. int role= argument<int> (1,context);
  12837. QString literal= model->quotedArrayLiteral(column,role);
  12838. return QScriptValue(engine,literal);
  12839. }
  12840. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  12841. QScriptEngine*engine)
  12842. {
  12843. QTableView*self= getself<QTableView*> (context);
  12844. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12845. int column= argument<int> (0,context);
  12846. int role= argument<int> (1,context);
  12847. QString literal= model->arrayLiteral(column,role);
  12848. literal.chop(1);
  12849. literal= literal.remove(0,1);
  12850. return QScriptValue(engine,literal);
  12851. }
  12852. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  12853. QScriptEngine*engine)
  12854. {
  12855. QTableView*self= getself<QTableView*> (context);
  12856. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12857. int column= argument<int> (0,context);
  12858. int role= argument<int> (1,context);
  12859. QString literal= model->quotedArrayLiteral(column,role);
  12860. literal.chop(1);
  12861. literal= literal.remove(0,1);
  12862. return QScriptValue(engine,literal);
  12863. }
  12864. /*:215*//*216:*/
  12865. #line 5522 "./typica.w"
  12866. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  12867. {
  12868. QTableView*self= getself<QTableView*> (context);
  12869. QScriptValue value= engine->newQObject(self->model());
  12870. return value;
  12871. }
  12872. /*:216*//*217:*/
  12873. #line 5536 "./typica.w"
  12874. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  12875. {
  12876. QTableView*self= getself<QTableView*> (context);
  12877. int row= argument<int> (0,context);
  12878. int column= argument<int> (1,context);
  12879. QVariant value= argument<QVariant> (2,context);
  12880. int role= argument<int> (3,context);
  12881. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12882. QModelIndex cell= model->index(row,column);
  12883. model->setData(cell,value,role);
  12884. self->update(cell);
  12885. return QScriptValue();
  12886. }
  12887. /*:217*//*218:*/
  12888. #line 5554 "./typica.w"
  12889. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  12890. {
  12891. QTableView*self= getself<QTableView*> (context);
  12892. int row= argument<int> (0,context);
  12893. int column= argument<int> (1,context);
  12894. int role= argument<int> (2,context);
  12895. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12896. QModelIndex cell= model->index(row,column);
  12897. QVariant value= model->data(cell,role);
  12898. QScriptValue retval= engine->newVariant(value);
  12899. retval.setProperty("value",QScriptValue(value.toString()));
  12900. return retval;
  12901. }
  12902. /*:218*//*219:*/
  12903. #line 5572 "./typica.w"
  12904. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  12905. {
  12906. setQWidgetProperties(value,engine);
  12907. value.setProperty("columnArray",
  12908. engine->newFunction(SaltTable_columnArray));
  12909. value.setProperty("quotedColumnArray",
  12910. engine->newFunction(SaltTable_quotedColumnArray));
  12911. value.setProperty("bindableColumnArray",
  12912. engine->newFunction(SaltTable_bindableColumnArray));
  12913. value.setProperty("bindableQuotedColumnArray",
  12914. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  12915. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  12916. value.setProperty("data",engine->newFunction(SaltTable_data));
  12917. value.setProperty("model",engine->newFunction(SaltTable_model));
  12918. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  12919. }
  12920. /*:219*//*221:*/
  12921. #line 5605 "./typica.w"
  12922. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12923. {
  12924. setQComboBoxProperties(value,engine);
  12925. }
  12926. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12927. {
  12928. setQWidgetProperties(value,engine);
  12929. value.setProperty("currentData",
  12930. engine->newFunction(QComboBox_currentData));
  12931. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  12932. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  12933. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  12934. }
  12935. QScriptValue QComboBox_currentData(QScriptContext*context,
  12936. QScriptEngine*engine)
  12937. {
  12938. QComboBox*self= getself<QComboBox*> (context);
  12939. return QScriptValue(engine,
  12940. self->itemData(self->currentIndex()).toString());
  12941. }
  12942. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  12943. {
  12944. QComboBox*self= getself<QComboBox*> (context);
  12945. self->addItem(argument<QString> (0,context));
  12946. return QScriptValue();
  12947. }
  12948. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  12949. {
  12950. QComboBox*self= getself<QComboBox*> (context);
  12951. self->setModel(argument<QAbstractItemModel*> (0,context));
  12952. return QScriptValue();
  12953. }
  12954. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  12955. {
  12956. QComboBox*self= getself<QComboBox*> (context);
  12957. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  12958. }
  12959. #line 1 "./abouttypica.w"
  12960. /*:221*//*253:*/
  12961. #line 6489 "./typica.w"
  12962. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  12963. {
  12964. QScriptValue object;
  12965. if(context->argumentCount()==1)
  12966. {
  12967. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  12968. QScriptEngine::ScriptOwnership);
  12969. setDAQProperties(object,engine);
  12970. }
  12971. else if(context->argumentCount()==2)
  12972. {
  12973. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  12974. argument<QString> (1,context)),
  12975. QScriptEngine::ScriptOwnership);
  12976. setDAQProperties(object,engine);
  12977. }
  12978. else
  12979. {
  12980. context->throwError("Incorrect number of arguments passed to DAQ"
  12981. "constructor. The DAQ constructor takes one"
  12982. "string as an argument specifying a device name."
  12983. "Example: Dev1");
  12984. }
  12985. return object;
  12986. }
  12987. /*:253*//*254:*/
  12988. #line 6519 "./typica.w"
  12989. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  12990. {
  12991. setQObjectProperties(value,engine);
  12992. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  12993. }
  12994. /*:254*//*255:*/
  12995. #line 6529 "./typica.w"
  12996. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  12997. {
  12998. DAQ*self= getself<DAQ*> (context);
  12999. QScriptValue object;
  13000. if(self)
  13001. {
  13002. object=
  13003. engine->newQObject(self->newChannel(argument<int> (0,context),
  13004. argument<int> (1,context)));
  13005. setChannelProperties(object,engine);
  13006. }
  13007. return object;
  13008. }
  13009. /*:255*//*262:*/
  13010. #line 6685 "./typica.w"
  13011. QScriptValue constructFakeDAQ(QScriptContext*context,
  13012. QScriptEngine*engine)
  13013. {
  13014. QScriptValue object;
  13015. if(context->argumentCount()==1)
  13016. {
  13017. object=
  13018. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  13019. QScriptEngine::ScriptOwnership);
  13020. setFakeDAQProperties(object,engine);
  13021. }
  13022. else
  13023. {
  13024. context->throwError("Incorrect number of arguments passed to DAQ"
  13025. "constructor. The DAQ constructor takes one"
  13026. "string as an argument specifying a device name."
  13027. "Example: Dev1");
  13028. }
  13029. return object;
  13030. }
  13031. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  13032. {
  13033. setQObjectProperties(value,engine);
  13034. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  13035. }
  13036. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  13037. {
  13038. FakeDAQ*self= getself<FakeDAQ*> (context);
  13039. QScriptValue object;
  13040. if(self)
  13041. {
  13042. object=
  13043. engine->newQObject(self->newChannel(argument<int> (0,context),
  13044. argument<int> (1,context)));
  13045. setChannelProperties(object,engine);
  13046. }
  13047. return object;
  13048. }
  13049. /*:262*//*266:*/
  13050. #line 6776 "./typica.w"
  13051. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  13052. {
  13053. setQObjectProperties(value,engine);
  13054. }
  13055. /*:266*//*273:*/
  13056. #line 6962 "./typica.w"
  13057. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  13058. {
  13059. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  13060. setLinearCalibratorProperties(object,engine);
  13061. return object;
  13062. }
  13063. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  13064. {
  13065. setQObjectProperties(value,engine);
  13066. }
  13067. /*:273*//*278:*/
  13068. #line 7099 "./typica.w"
  13069. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  13070. {
  13071. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  13072. setLinearSplineInterpolatorProperties(object,engine);
  13073. return object;
  13074. }
  13075. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  13076. {
  13077. setQObjectProperties(value,engine);
  13078. }
  13079. /*:278*//*287:*/
  13080. #line 7283 "./typica.w"
  13081. QScriptValue constructTemperatureDisplay(QScriptContext*,
  13082. QScriptEngine*engine)
  13083. {
  13084. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  13085. setTemperatureDisplayProperties(object,engine);
  13086. return object;
  13087. }
  13088. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13089. {
  13090. setQLCDNumberProperties(value,engine);
  13091. }
  13092. /*:287*//*294:*/
  13093. #line 7424 "./typica.w"
  13094. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  13095. QScriptEngine*engine)
  13096. {
  13097. QScriptValue object=
  13098. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  13099. setMeasurementTimeOffsetProperties(object,engine);
  13100. return object;
  13101. }
  13102. void setMeasurementTimeOffsetProperties(QScriptValue value,
  13103. QScriptEngine*engine)
  13104. {
  13105. setQObjectProperties(value,engine);
  13106. }
  13107. /*:294*//*299:*/
  13108. #line 7533 "./typica.w"
  13109. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  13110. {
  13111. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  13112. return object;
  13113. }
  13114. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  13115. {
  13116. setQObjectProperties(value,engine);
  13117. }
  13118. /*:299*//*304:*/
  13119. #line 7629 "./typica.w"
  13120. QScriptValue constructZeroEmitter(QScriptContext*context,
  13121. QScriptEngine*engine)
  13122. {
  13123. QScriptValue object=
  13124. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  13125. setZeroEmitterProperties(object,engine);
  13126. return object;
  13127. }
  13128. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  13129. {
  13130. setQObjectProperties(value,engine);
  13131. }
  13132. /*:304*//*309:*/
  13133. #line 7709 "./typica.w"
  13134. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  13135. QScriptEngine*engine)
  13136. {
  13137. QScriptValue object=
  13138. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  13139. setMeasurementAdapterProperties(object,engine);
  13140. return object;
  13141. }
  13142. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  13143. {
  13144. setQObjectProperties(value,engine);
  13145. }
  13146. /*:309*//*324:*/
  13147. #line 8057 "./typica.w"
  13148. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  13149. {
  13150. QScriptValue object= engine->newQObject(new GraphView);
  13151. setGraphViewProperties(object,engine);
  13152. return object;
  13153. }
  13154. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  13155. {
  13156. setQGraphicsViewProperties(value,engine);
  13157. }
  13158. /*:324*//*347:*/
  13159. #line 8661 "./typica.w"
  13160. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  13161. {
  13162. QScriptValue object= engine->newQObject(new ZoomLog);
  13163. setZoomLogProperties(object,engine);
  13164. return object;
  13165. }
  13166. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  13167. {
  13168. setQTableViewProperties(value,engine);
  13169. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  13170. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  13171. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  13172. value.setProperty("restoreState",
  13173. engine->newFunction(ZoomLog_restoreState));
  13174. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  13175. value.setProperty("saveTemporary",
  13176. engine->newFunction(ZoomLog_saveTemporary));
  13177. }
  13178. /*:347*//*348:*/
  13179. #line 8687 "./typica.w"
  13180. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  13181. {
  13182. ZoomLog*self= getself<ZoomLog*> (context);
  13183. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  13184. return QScriptValue(engine,retval);
  13185. }
  13186. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  13187. {
  13188. ZoomLog*self= getself<ZoomLog*> (context);
  13189. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  13190. return QScriptValue(engine,retval);
  13191. }
  13192. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  13193. QScriptEngine*engine)
  13194. {
  13195. ZoomLog*self= getself<ZoomLog*> (context);
  13196. QString filename= QDir::tempPath();
  13197. filename.append("/");
  13198. filename.append(QUuid::createUuid().toString());
  13199. filename.append(".xml");
  13200. QFile*file= new QFile(filename);
  13201. self->saveXML(file);
  13202. file->close();
  13203. delete file;
  13204. return QScriptValue(engine,filename);
  13205. }
  13206. /*:348*//*349:*/
  13207. #line 8735 "./typica.w"
  13208. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  13209. {
  13210. ZoomLog*self= getself<ZoomLog*> (context);
  13211. QString key= argument<QString> (0,context);
  13212. int columns= argument<int> (1,context);
  13213. QSettings settings;
  13214. for(int i= 0;i<columns;i++)
  13215. {
  13216. if(self->columnWidth(i))
  13217. {
  13218. settings.beginGroup(key);
  13219. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  13220. settings.endGroup();
  13221. }
  13222. }
  13223. return QScriptValue();
  13224. }
  13225. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  13226. {
  13227. ZoomLog*self= getself<ZoomLog*> (context);
  13228. QString key= argument<QString> (0,context);
  13229. int columns= argument<int> (1,context);
  13230. QSettings settings;
  13231. for(int i= 0;i<columns;i++)
  13232. {
  13233. settings.beginGroup(key);
  13234. self->setColumnWidth(i,
  13235. settings.value(QString("%1").arg(i),80).toInt());
  13236. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  13237. {
  13238. self->setColumnWidth(i,80);
  13239. }
  13240. settings.endGroup();
  13241. }
  13242. return QScriptValue();
  13243. }
  13244. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  13245. {
  13246. ZoomLog*self= getself<ZoomLog*> (context);
  13247. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  13248. }
  13249. /*:349*//*384:*/
  13250. #line 9579 "./typica.w"
  13251. QScriptValue constructAnnotationButton(QScriptContext*context,
  13252. QScriptEngine*engine)
  13253. {
  13254. QScriptValue object=
  13255. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  13256. setAnnotationButtonProperties(object,engine);
  13257. return object;
  13258. }
  13259. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  13260. {
  13261. setQPushButtonProperties(value,engine);
  13262. }
  13263. /*:384*//*392:*/
  13264. #line 9722 "./typica.w"
  13265. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  13266. QScriptEngine*engine)
  13267. {
  13268. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  13269. argument<QString> (0,context),argument<QString> (1,context)));
  13270. setAnnotationSpinBoxProperties(object,engine);
  13271. return object;
  13272. }
  13273. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13274. {
  13275. setQDoubleSpinBoxProperties(value,engine);
  13276. }
  13277. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13278. {
  13279. setQAbstractSpinBoxProperties(value,engine);
  13280. }
  13281. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13282. {
  13283. setQWidgetProperties(value,engine);
  13284. }
  13285. /*:392*//*413:*/
  13286. #line 10141 "./typica.w"
  13287. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  13288. {
  13289. QScriptValue object= engine->newQObject(new TimerDisplay);
  13290. setTimerDisplayProperties(object,engine);
  13291. return object;
  13292. }
  13293. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13294. {
  13295. setQLCDNumberProperties(value,engine);
  13296. }
  13297. /*:413*//*440:*/
  13298. #line 10636 "./typica.w"
  13299. QScriptValue constructWidgetDecorator(QScriptContext*context,
  13300. QScriptEngine*engine)
  13301. {
  13302. QWidget*widget= argument<QWidget*> (0,context);
  13303. QString text= argument<QString> (1,context);
  13304. Qt::Orientations orientation;
  13305. switch(argument<int> (2,context))
  13306. {
  13307. case 2:
  13308. orientation= Qt::Vertical;
  13309. break;
  13310. default:
  13311. orientation= Qt::Horizontal;
  13312. break;
  13313. }
  13314. QScriptValue object=
  13315. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  13316. setWidgetDecoratorProperties(object,engine);
  13317. return object;
  13318. }
  13319. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  13320. {
  13321. setQWidgetProperties(value,engine);
  13322. }
  13323. /*:440*//*453:*/
  13324. #line 10917 "./typica.w"
  13325. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  13326. {
  13327. QScriptValue object= engine->newQObject(new LogEditWindow);
  13328. return object;
  13329. }
  13330. /*:453*//*472:*/
  13331. #line 11391 "./typica.w"
  13332. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  13333. {
  13334. QIODevice*device= argument<QIODevice*> (0,context);
  13335. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  13336. argument<int> (1,context)));
  13337. object.setProperty("input",engine->newFunction(XMLInput_input));
  13338. return object;
  13339. }
  13340. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  13341. {
  13342. XMLInput*self= getself<XMLInput*> (context);
  13343. self->input();
  13344. return QScriptValue();
  13345. }
  13346. /*:472*//*479:*/
  13347. #line 11559 "./typica.w"
  13348. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  13349. {
  13350. QScriptValue object= engine->newQObject(new QWebView());
  13351. setQWebViewProperties(object,engine);
  13352. return object;
  13353. }
  13354. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  13355. {
  13356. setQWidgetProperties(value,engine);
  13357. value.setProperty("load",engine->newFunction(WebView_load));
  13358. value.setProperty("print",engine->newFunction(WebView_print));
  13359. value.setProperty("setHtml",engine->newFunction(WebView_setHtml));
  13360. value.setProperty("setContent",engine->newFunction(WebView_setContent));
  13361. value.setProperty("saveXml",engine->newFunction(WebView_saveXml));
  13362. }
  13363. /*:479*//*480:*/
  13364. #line 11580 "./typica.w"
  13365. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*)
  13366. {
  13367. QWebView*self= getself<QWebView*> (context);
  13368. QString file= argument<QString> (0,context);
  13369. self->load(QUrl(file));
  13370. return QScriptValue();
  13371. }
  13372. /*:480*//*481:*/
  13373. #line 11593 "./typica.w"
  13374. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*)
  13375. {
  13376. QWebView*self= getself<QWebView*> (context);
  13377. QPrinter*printer= new QPrinter(QPrinter::HighResolution);
  13378. QPrintDialog printDialog(printer,NULL);
  13379. if(printDialog.exec()==QDialog::Accepted)
  13380. {
  13381. self->print(printer);
  13382. }
  13383. return QScriptValue();
  13384. }
  13385. /*:481*//*482:*/
  13386. #line 11609 "./typica.w"
  13387. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*)
  13388. {
  13389. QWebView*self= getself<QWebView*> (context);
  13390. QString content= argument<QString> (0,context);
  13391. self->setHtml(content);
  13392. return QScriptValue();
  13393. }
  13394. /*:482*//*483:*/
  13395. #line 11622 "./typica.w"
  13396. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*)
  13397. {
  13398. QWebView*self= getself<QWebView*> (context);
  13399. QIODevice*device= argument<QIODevice*> (0,context);
  13400. device->reset();
  13401. QByteArray content= device->readAll();
  13402. self->setContent(content,"application/xhtml+xml");
  13403. return QScriptValue();
  13404. }
  13405. /*:483*//*484:*/
  13406. #line 11636 "./typica.w"
  13407. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*)
  13408. {
  13409. QWebView*self= getself<QWebView*> (context);
  13410. return QScriptValue(self->page()->currentFrame()->documentElement().toOuterXml());
  13411. }
  13412. /*:484*//*485:*/
  13413. #line 11646 "./typica.w"
  13414. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  13415. QStack<QLayout*> *layoutStack)
  13416. {
  13417. QWebView*view= new QWebView;
  13418. if(element.hasAttribute("id"))
  13419. {
  13420. view->setObjectName(element.attribute("id"));
  13421. }
  13422. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13423. layout->addWidget(view);
  13424. }
  13425. /*:485*//*543:*/
  13426. #line 12696 "./typica.w"
  13427. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  13428. {
  13429. QScriptValue object= engine->newQObject(new SqlQueryView);
  13430. setSqlQueryViewProperties(object,engine);
  13431. return object;
  13432. }
  13433. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  13434. {
  13435. setQTableViewProperties(value,engine);
  13436. value.setProperty("setHeaderData",
  13437. engine->newFunction(SqlQueryView_setHeaderData));
  13438. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  13439. }
  13440. /*:543*//*544:*/
  13441. #line 12714 "./typica.w"
  13442. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  13443. {
  13444. SqlQueryView*self= getself<SqlQueryView*> (context);
  13445. QString query= argument<QString> (0,context);
  13446. self->setQuery(query);
  13447. self->reset();
  13448. return QScriptValue();
  13449. }
  13450. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  13451. QScriptEngine*)
  13452. {
  13453. SqlQueryView*self= getself<SqlQueryView*> (context);
  13454. int section= argument<int> (0,context);
  13455. QString data= argument<QString> (1,context);
  13456. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  13457. return QScriptValue();
  13458. }
  13459. /*:544*//*552:*/
  13460. #line 12913 "./typica.w"
  13461. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  13462. QStack<QLayout*> *layoutStack)
  13463. {
  13464. QTextEdit*widget= new QTextEdit;
  13465. if(element.hasAttribute("id"))
  13466. {
  13467. widget->setObjectName(element.attribute("id"));
  13468. }
  13469. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13470. layout->addWidget(widget);
  13471. QTextDocument*document= new QTextDocument;
  13472. QFont defaultFont;
  13473. defaultFont.setPointSize(11);
  13474. document->setDefaultFont(defaultFont);
  13475. QTextCursor cursor(document);
  13476. /*553:*/
  13477. #line 12936 "./typica.w"
  13478. QDomNodeList children= element.childNodes();
  13479. for(int i= 0;i<children.count();i++)
  13480. {
  13481. QDomNode current;
  13482. QDomElement currentElement;
  13483. current= children.at(i);
  13484. if(current.isElement())
  13485. {
  13486. currentElement= current.toElement();
  13487. /*554:*/
  13488. #line 12953 "./typica.w"
  13489. if(currentElement.tagName()=="style")
  13490. {
  13491. document->setDefaultStyleSheet(currentElement.text());
  13492. }
  13493. /*:554*//*555:*/
  13494. #line 12964 "./typica.w"
  13495. if(currentElement.tagName()=="html")
  13496. {
  13497. cursor.insertHtml(currentElement.text());
  13498. }
  13499. /*:555*//*556:*/
  13500. #line 12974 "./typica.w"
  13501. if(currentElement.tagName()=="text")
  13502. {
  13503. cursor.insertText(currentElement.text());
  13504. }
  13505. /*:556*//*557:*/
  13506. #line 12984 "./typica.w"
  13507. if(currentElement.tagName()=="table")
  13508. {
  13509. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  13510. ReportTable*table= new ReportTable(frame,currentElement);
  13511. table->setParent(widget);
  13512. if(currentElement.hasAttribute("id"))
  13513. {
  13514. table->setObjectName(currentElement.attribute("id"));
  13515. }
  13516. }
  13517. /*:557*/
  13518. #line 12946 "./typica.w"
  13519. }
  13520. }
  13521. /*:553*/
  13522. #line 12929 "./typica.w"
  13523. widget->setDocument(document);
  13524. }
  13525. /*:552*//*568:*/
  13526. #line 13196 "./typica.w"
  13527. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  13528. {
  13529. QTextEdit*self= getself<QTextEdit*> (context);
  13530. QTextDocument*document= self->document();
  13531. QPrinter printer;
  13532. QPrintDialog printwindow(&printer,self);
  13533. if(printwindow.exec()!=QDialog::Accepted)
  13534. {
  13535. return QScriptValue();
  13536. }
  13537. document->print(&printer);
  13538. return QScriptValue();
  13539. }
  13540. /*:568*//*569:*/
  13541. #line 13214 "./typica.w"
  13542. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  13543. {
  13544. setQAbstractScrollAreaProperties(value,engine);
  13545. value.setProperty("print",engine->newFunction(QTextEdit_print));
  13546. }
  13547. /*:569*//*578:*/
  13548. #line 13392 "./typica.w"
  13549. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  13550. QStack<QLayout*> *layoutStack)
  13551. {
  13552. FormArray*widget= new FormArray(element);
  13553. if(element.hasAttribute("id"))
  13554. {
  13555. widget->setObjectName(element.attribute("id"));
  13556. }
  13557. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13558. layout->addWidget(widget);
  13559. }
  13560. /*:578*//*599:*/
  13561. #line 13979 "./typica.w"
  13562. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  13563. QStack<QLayout*> *layoutStack)
  13564. {
  13565. ScaleControl*scale= new ScaleControl;
  13566. if(element.hasAttribute("id"))
  13567. {
  13568. scale->setObjectName(element.attribute("id"));
  13569. }
  13570. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13571. layout->addWidget(scale);
  13572. }
  13573. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  13574. QStack<QLayout*> *layoutStack)
  13575. {
  13576. IntensityControl*scale= new IntensityControl;
  13577. if(element.hasAttribute("id"))
  13578. {
  13579. scale->setObjectName(element.attribute("id"));
  13580. }
  13581. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13582. layout->addWidget(scale);
  13583. }
  13584. /*:599*//*625:*/
  13585. #line 14569 "./typica.w"
  13586. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  13587. {
  13588. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  13589. setDeviceTreeModelProperties(object,engine);
  13590. return object;
  13591. }
  13592. /*:625*//*627:*/
  13593. #line 14592 "./typica.w"
  13594. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  13595. {
  13596. setQAbstractItemModelProperties(value,engine);
  13597. value.setProperty("referenceElement",
  13598. engine->newFunction(DeviceTreeModel_referenceElement));
  13599. }
  13600. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  13601. {
  13602. setQObjectProperties(value,engine);
  13603. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  13604. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  13605. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  13606. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  13607. }
  13608. /*:627*//*628:*/
  13609. #line 14619 "./typica.w"
  13610. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  13611. QScriptEngine*engine)
  13612. {
  13613. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  13614. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  13615. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13616. QDomElement node;
  13617. QVariantMap retval;
  13618. retval.insert("driver",referenceElement.attribute("driver"));
  13619. for(int i= 0;i<configData.size();i++)
  13620. {
  13621. node= configData.at(i).toElement();
  13622. retval.insert(node.attribute("name"),node.attribute("value"));
  13623. }
  13624. return engine->toScriptValue(retval);
  13625. }
  13626. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  13627. {
  13628. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13629. QModelIndex index= argument<QModelIndex> (0,context);
  13630. int role= argument<int> (1,context);
  13631. return engine->toScriptValue(model->data(index,role));
  13632. }
  13633. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  13634. {
  13635. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13636. int row= 0;
  13637. int column= 0;
  13638. QModelIndex index;
  13639. if(context->argumentCount()> 1)
  13640. {
  13641. row= argument<int> (0,context);
  13642. column= argument<int> (1,context);
  13643. }
  13644. if(context->argumentCount()> 2)
  13645. {
  13646. index= argument<QModelIndex> (2,context);
  13647. }
  13648. QModelIndex retval= model->index(row,column,index);
  13649. return engine->toScriptValue(retval);
  13650. }
  13651. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  13652. QScriptEngine*)
  13653. {
  13654. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13655. QModelIndex index;
  13656. if(context->argumentCount()==1)
  13657. {
  13658. index= argument<QModelIndex> (0,context);
  13659. }
  13660. return QScriptValue(model->rowCount(index));
  13661. }
  13662. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  13663. QScriptEngine*engine)
  13664. {
  13665. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13666. QModelIndex index;
  13667. if(context->argumentCount()==1)
  13668. {
  13669. index= argument<QModelIndex> (0,context);
  13670. }
  13671. return QScriptValue(engine,model->hasChildren(index));
  13672. }
  13673. /*:628*//*631:*/
  13674. #line 14703 "./typica.w"
  13675. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  13676. {
  13677. QVariant var;
  13678. var.setValue(index);
  13679. QScriptValue object= engine->newVariant(var);
  13680. return object;
  13681. }
  13682. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  13683. {
  13684. index= value.toVariant().value<QModelIndex> ();
  13685. }
  13686. /*:631*//*646:*/
  13687. #line 14971 "./typica.w"
  13688. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  13689. QScriptEngine*engine)
  13690. {
  13691. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  13692. return object;
  13693. }
  13694. /*:646*//*722:*/
  13695. #line 17476 "./typica.w"
  13696. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  13697. {
  13698. QScriptValue object;
  13699. if(context->argumentCount()==2)
  13700. {
  13701. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  13702. argument<QModelIndex> (1,context)),
  13703. QScriptEngine::ScriptOwnership);
  13704. setModbusRTUDeviceProperties(object,engine);
  13705. }
  13706. else
  13707. {
  13708. context->throwError("Incorrect number of arguments passed to "
  13709. "ModbusRTUDevice constructor. This takes the configuration model "
  13710. "and an index.");
  13711. }
  13712. return object;
  13713. }
  13714. /*:722*//*723:*/
  13715. #line 17498 "./typica.w"
  13716. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  13717. {
  13718. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13719. QScriptValue object;
  13720. if(self)
  13721. {
  13722. if(self->channels.size()> 0)
  13723. {
  13724. object= engine->newQObject(self->channels.at(0));
  13725. setChannelProperties(object,engine);
  13726. }
  13727. }
  13728. return object;
  13729. }
  13730. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  13731. {
  13732. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13733. QScriptValue object;
  13734. if(self)
  13735. {
  13736. if(self->channels.size()> 1)
  13737. {
  13738. object= engine->newQObject(self->channels.at(1));
  13739. setChannelProperties(object,engine);
  13740. }
  13741. }
  13742. return object;
  13743. }
  13744. /*:723*//*724:*/
  13745. #line 17531 "./typica.w"
  13746. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  13747. {
  13748. setQObjectProperties(value,engine);
  13749. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  13750. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  13751. }
  13752. /*:724*/
  13753. #line 758 "./typica.w"
  13754. /*523:*/
  13755. #line 12358 "./typica.w"
  13756. int main(int argc,char**argv)
  13757. {
  13758. int*c= &argc;
  13759. Application app(*c,argv);
  13760. /*524:*/
  13761. #line 12382 "./typica.w"
  13762. QStringList themeSearchPath= QIcon::themeSearchPaths();
  13763. themeSearchPath.append(":/resources/icons/tango");
  13764. QIcon::setThemeSearchPaths(themeSearchPath);
  13765. QIcon::setThemeName(":/resources/icons/tango");
  13766. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  13767. /*:524*/
  13768. #line 12363 "./typica.w"
  13769. QSettings settings;
  13770. /*656:*/
  13771. #line 15183 "./typica.w"
  13772. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  13773. /*:656*//*666:*/
  13774. #line 15411 "./typica.w"
  13775. app.registerDeviceConfigurationWidget("nidaqmxbase",
  13776. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  13777. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  13778. NiDaqMxBase9211ConfWidget::staticMetaObject);
  13779. app.registerDeviceConfigurationWidget("ni9211seriestc",
  13780. Ni9211TcConfWidget::staticMetaObject);
  13781. /*:666*//*674:*/
  13782. #line 15628 "./typica.w"
  13783. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  13784. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  13785. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  13786. /*:674*//*698:*/
  13787. #line 16589 "./typica.w"
  13788. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  13789. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  13790. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  13791. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  13792. /*:698*//*703:*/
  13793. #line 16674 "./typica.w"
  13794. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  13795. /*:703*//*706:*/
  13796. #line 16744 "./typica.w"
  13797. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  13798. /*:706*//*709:*/
  13799. #line 16871 "./typica.w"
  13800. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  13801. /*:709*//*727:*/
  13802. #line 18044 "./typica.w"
  13803. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  13804. /*:727*//*734:*/
  13805. #line 18174 "./typica.w"
  13806. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  13807. /*:734*//*738:*/
  13808. #line 18263 "./typica.w"
  13809. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  13810. /*:738*/
  13811. #line 12366 "./typica.w"
  13812. /*525:*/
  13813. #line 12395 "./typica.w"
  13814. if(settings.value("database/exists","false").toString()=="true")
  13815. {
  13816. /*530:*/
  13817. #line 12515 "./typica.w"
  13818. QSqlDatabase database=
  13819. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  13820. database.setHostName(settings.value("database/hostname").toString());
  13821. database.setDatabaseName(settings.value("database/dbname").toString());
  13822. database.setUserName(settings.value("database/user").toString());
  13823. database.setPassword(settings.value("database/password").toString());
  13824. if(!database.open())
  13825. {
  13826. settings.setValue("database/exists","false");
  13827. }
  13828. /*:530*/
  13829. #line 12398 "./typica.w"
  13830. }
  13831. if(settings.value("database/exists","false").toString()=="false")
  13832. {
  13833. /*529:*/
  13834. #line 12506 "./typica.w"
  13835. SqlConnectionSetup dialog;
  13836. dialog.exec();
  13837. /*:529*/
  13838. #line 12402 "./typica.w"
  13839. }
  13840. /*:525*/
  13841. #line 12367 "./typica.w"
  13842. /*153:*/
  13843. #line 3633 "./typica.w"
  13844. QStringList arguments= QCoreApplication::arguments();
  13845. int position= arguments.indexOf("-c");
  13846. QString filename= QString();
  13847. if(position!=-1)
  13848. {
  13849. if(arguments.size()>=position+1)
  13850. {
  13851. filename= arguments.at(position+1);
  13852. }
  13853. }
  13854. if(filename.isEmpty())
  13855. {
  13856. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  13857. settings.value("config","").toString());
  13858. }
  13859. QDir directory;
  13860. if(!filename.isEmpty())
  13861. {
  13862. QFile file(filename);
  13863. QFileInfo info(filename);
  13864. directory= info.dir();
  13865. settings.setValue("config",directory.path());
  13866. if(file.open(QIODevice::ReadOnly))
  13867. {
  13868. app.configuration()->setContent(&file,true);
  13869. }
  13870. }
  13871. /*154:*/
  13872. #line 3667 "./typica.w"
  13873. QDomElement root= app.configuration()->documentElement();
  13874. QDomNodeList children= root.childNodes();
  13875. QString replacementDoc;
  13876. QDomDocument includedDoc;
  13877. QDomDocumentFragment fragment;
  13878. for(int i= 0;i<children.size();i++)
  13879. {
  13880. QDomNode currentNode= children.at(i);
  13881. QDomElement currentElement;
  13882. if(currentNode.nodeName()=="include")
  13883. {
  13884. currentElement= currentNode.toElement();
  13885. if(currentElement.hasAttribute("src"))
  13886. {
  13887. replacementDoc= directory.path();
  13888. replacementDoc.append('/');
  13889. replacementDoc.append(currentElement.attribute("src"));
  13890. QFile doc(replacementDoc);
  13891. if(doc.open(QIODevice::ReadOnly))
  13892. {
  13893. includedDoc.setContent(&doc,true);
  13894. fragment= includedDoc.createDocumentFragment();
  13895. fragment.appendChild(includedDoc.documentElement());
  13896. root.replaceChild(fragment,currentNode);
  13897. doc.close();
  13898. }
  13899. }
  13900. }
  13901. }
  13902. /*:154*/
  13903. #line 3661 "./typica.w"
  13904. /*:153*/
  13905. #line 12368 "./typica.w"
  13906. /*19:*/
  13907. #line 877 "./typica.w"
  13908. QScriptEngine*engine= new QScriptEngine;
  13909. QScriptValue constructor;
  13910. QScriptValue value;
  13911. /*:19*//*29:*/
  13912. #line 1053 "./typica.w"
  13913. constructor= engine->newFunction(constructQWidget);
  13914. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  13915. engine->globalObject().setProperty("QWidget",value);
  13916. /*:29*//*37:*/
  13917. #line 1253 "./typica.w"
  13918. constructor= engine->newFunction(constructQMainWindow);
  13919. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  13920. constructor);
  13921. engine->globalObject().setProperty("QMainWindow",value);
  13922. /*:37*//*48:*/
  13923. #line 1458 "./typica.w"
  13924. constructor= engine->newFunction(constructQFrame);
  13925. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  13926. engine->globalObject().setProperty("QFrame",value);
  13927. /*:48*//*51:*/
  13928. #line 1491 "./typica.w"
  13929. constructor= engine->newFunction(constructQLabel);
  13930. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  13931. engine->globalObject().setProperty("QLabel",value);
  13932. /*:51*//*54:*/
  13933. #line 1538 "./typica.w"
  13934. constructor= engine->newFunction(constructQSplitter);
  13935. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  13936. engine->globalObject().setProperty("QSplitter",value);
  13937. /*:54*//*61:*/
  13938. #line 1709 "./typica.w"
  13939. constructor= engine->newFunction(constructQBoxLayout);
  13940. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  13941. engine->globalObject().setProperty("QBoxLayout",value);
  13942. /*:61*//*65:*/
  13943. #line 1821 "./typica.w"
  13944. constructor= engine->newFunction(constructQAction);
  13945. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  13946. engine->globalObject().setProperty("QAction",value);
  13947. /*:65*//*68:*/
  13948. #line 1880 "./typica.w"
  13949. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  13950. value.setProperty("getOpenFileName",
  13951. engine->newFunction(QFileDialog_getOpenFileName));
  13952. value.setProperty("getSaveFileName",
  13953. engine->newFunction(QFileDialog_getSaveFileName));
  13954. engine->globalObject().setProperty("QFileDialog",value);
  13955. /*:68*//*73:*/
  13956. #line 1992 "./typica.w"
  13957. constructor= engine->newFunction(constructQFile);
  13958. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  13959. engine->globalObject().setProperty("QFile",value);
  13960. /*:73*//*80:*/
  13961. #line 2109 "./typica.w"
  13962. constructor= engine->newFunction(constructQBuffer);
  13963. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  13964. engine->globalObject().setProperty("QBuffer",value);
  13965. /*:80*//*83:*/
  13966. #line 2157 "./typica.w"
  13967. constructor= engine->newFunction(constructXQuery);
  13968. engine->globalObject().setProperty("XQuery",constructor);
  13969. /*:83*//*89:*/
  13970. #line 2251 "./typica.w"
  13971. constructor= engine->newFunction(constructXmlWriter);
  13972. engine->globalObject().setProperty("XmlWriter",constructor);
  13973. /*:89*//*98:*/
  13974. #line 2457 "./typica.w"
  13975. constructor= engine->newFunction(constructXmlReader);
  13976. engine->globalObject().setProperty("XmlReader",constructor);
  13977. /*:98*//*105:*/
  13978. #line 2581 "./typica.w"
  13979. value= engine->newQObject(&settings);
  13980. setQSettingsProperties(value,engine);
  13981. engine->globalObject().setProperty("QSettings",value);
  13982. /*:105*//*109:*/
  13983. #line 2662 "./typica.w"
  13984. constructor= engine->newFunction(constructQLCDNumber);
  13985. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  13986. engine->globalObject().setProperty("QLCDNumber",value);
  13987. /*:109*//*112:*/
  13988. #line 2718 "./typica.w"
  13989. constructor= engine->newFunction(constructQTime);
  13990. engine->globalObject().setProperty("QTime",constructor);
  13991. /*:112*//*133:*/
  13992. #line 3222 "./typica.w"
  13993. constructor= engine->newFunction(constructQPushButton);
  13994. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  13995. engine->globalObject().setProperty("QPushButton",value);
  13996. /*:133*//*140:*/
  13997. #line 3333 "./typica.w"
  13998. constructor= engine->newFunction(constructQSqlQuery);
  13999. engine->globalObject().setProperty("QSqlQuery",constructor);
  14000. /*:140*//*147:*/
  14001. #line 3494 "./typica.w"
  14002. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  14003. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  14004. engine->globalObject().setProperty("sqlToArray",
  14005. engine->newFunction(sqlToArray));
  14006. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  14007. engine->globalObject().setProperty("annotationFromRecord",
  14008. engine->newFunction(annotationFromRecord));
  14009. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  14010. /*:147*//*158:*/
  14011. #line 3830 "./typica.w"
  14012. engine->globalObject().setProperty("createWindow",
  14013. engine->newFunction(createWindow));
  14014. /*:158*//*210:*/
  14015. #line 5302 "./typica.w"
  14016. engine->globalObject().setProperty("findChildObject",
  14017. engine->newFunction(findChildObject));
  14018. /*:210*//*252:*/
  14019. #line 6479 "./typica.w"
  14020. constructor= engine->newFunction(constructDAQ);
  14021. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  14022. engine->globalObject().setProperty("DAQ",value);
  14023. /*:252*//*261:*/
  14024. #line 6677 "./typica.w"
  14025. constructor= engine->newFunction(constructFakeDAQ);
  14026. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  14027. engine->globalObject().setProperty("FakeDAQ",value);
  14028. /*:261*//*272:*/
  14029. #line 6954 "./typica.w"
  14030. constructor= engine->newFunction(constructLinearCalibrator);
  14031. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  14032. constructor);
  14033. engine->globalObject().setProperty("LinearCalibrator",value);
  14034. /*:272*//*277:*/
  14035. #line 7092 "./typica.w"
  14036. constructor= engine->newFunction(constructLinearSplineInterpolator);
  14037. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  14038. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  14039. /*:277*//*286:*/
  14040. #line 7275 "./typica.w"
  14041. constructor= engine->newFunction(constructTemperatureDisplay);
  14042. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  14043. constructor);
  14044. engine->globalObject().setProperty("TemperatureDisplay",value);
  14045. /*:286*//*293:*/
  14046. #line 7413 "./typica.w"
  14047. constructor= engine->newFunction(constructMeasurementTimeOffset);
  14048. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  14049. constructor);
  14050. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  14051. /*:293*//*298:*/
  14052. #line 7524 "./typica.w"
  14053. constructor= engine->newFunction(constructThresholdDetector);
  14054. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  14055. engine->globalObject().setProperty("ThresholdDetector",value);
  14056. /*:298*//*303:*/
  14057. #line 7622 "./typica.w"
  14058. constructor= engine->newFunction(constructZeroEmitter);
  14059. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  14060. engine->globalObject().setProperty("ZeroEmitter",value);
  14061. /*:303*//*308:*/
  14062. #line 7701 "./typica.w"
  14063. constructor= engine->newFunction(constructMeasurementAdapter);
  14064. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  14065. constructor);
  14066. engine->globalObject().setProperty("MeasurementAdapter",value);
  14067. /*:308*//*323:*/
  14068. #line 8050 "./typica.w"
  14069. constructor= engine->newFunction(constructGraphView);
  14070. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  14071. engine->globalObject().setProperty("GraphView",value);
  14072. /*:323*//*346:*/
  14073. #line 8653 "./typica.w"
  14074. constructor= engine->newFunction(constructZoomLog);
  14075. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  14076. engine->globalObject().setProperty("ZoomLog",value);
  14077. /*:346*//*383:*/
  14078. #line 9571 "./typica.w"
  14079. constructor= engine->newFunction(constructAnnotationButton);
  14080. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  14081. constructor);
  14082. engine->globalObject().setProperty("AnnotationButton",value);
  14083. /*:383*//*391:*/
  14084. #line 9713 "./typica.w"
  14085. constructor= engine->newFunction(constructAnnotationSpinBox);
  14086. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  14087. constructor);
  14088. engine->globalObject().setProperty("AnnotationSpinBox",value);
  14089. /*:391*//*412:*/
  14090. #line 10134 "./typica.w"
  14091. constructor= engine->newFunction(constructTimerDisplay);
  14092. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  14093. engine->globalObject().setProperty("TimerDisplay",value);
  14094. /*:412*//*439:*/
  14095. #line 10628 "./typica.w"
  14096. constructor= engine->newFunction(constructWidgetDecorator);
  14097. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  14098. engine->globalObject().setProperty("WidgetDecorator",value);
  14099. /*:439*//*452:*/
  14100. #line 10910 "./typica.w"
  14101. constructor= engine->newFunction(constructLogEditWindow);
  14102. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  14103. engine->globalObject().setProperty("LogEditWindow",value);
  14104. /*:452*//*471:*/
  14105. #line 11384 "./typica.w"
  14106. constructor= engine->newFunction(constructXMLInput);
  14107. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  14108. engine->globalObject().setProperty("XMLInput",value);
  14109. /*:471*//*478:*/
  14110. #line 11551 "./typica.w"
  14111. constructor= engine->newFunction(constructWebView);
  14112. value= engine->newQMetaObject(&QWebView::staticMetaObject,constructor);
  14113. engine->globalObject().setProperty("WebView",value);
  14114. /*:478*//*491:*/
  14115. #line 11743 "./typica.w"
  14116. value= engine->newQObject(AppInstance);
  14117. engine->globalObject().setProperty("Application",value);
  14118. /*:491*//*542:*/
  14119. #line 12688 "./typica.w"
  14120. constructor= engine->newFunction(constructSqlQueryView);
  14121. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  14122. engine->globalObject().setProperty("SqlQueryView",value);
  14123. /*:542*//*626:*/
  14124. #line 14579 "./typica.w"
  14125. constructor= engine->newFunction(constructDeviceTreeModel);
  14126. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  14127. constructor);
  14128. engine->globalObject().setProperty("DeviceTreeModel",value);
  14129. /*:626*//*632:*/
  14130. #line 14719 "./typica.w"
  14131. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  14132. /*:632*//*647:*/
  14133. #line 14981 "./typica.w"
  14134. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  14135. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  14136. constructor);
  14137. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  14138. /*:647*//*721:*/
  14139. #line 17467 "./typica.w"
  14140. constructor= engine->newFunction(constructModbusRTUDevice);
  14141. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  14142. engine->globalObject().setProperty("ModbusRTUDevice",value);
  14143. /*:721*/
  14144. #line 12369 "./typica.w"
  14145. app.engine= engine;
  14146. /*155:*/
  14147. #line 3715 "./typica.w"
  14148. QString styleText;
  14149. QString programText;
  14150. QDomElement currentElement;
  14151. for(int i= 0;i<children.size();i++)
  14152. {
  14153. QDomNode currentNode= children.at(i);
  14154. if(currentNode.nodeName()=="style")
  14155. {
  14156. currentElement= currentNode.toElement();
  14157. styleText.append(currentElement.text());
  14158. }
  14159. else if(currentNode.nodeName()=="program")
  14160. {
  14161. currentElement= currentNode.toElement();
  14162. programText.append(currentElement.text());
  14163. }
  14164. }
  14165. app.setStyleSheet(styleText);
  14166. QScriptValue result= engine->evaluate(programText);
  14167. /*156:*/
  14168. #line 3740 "./typica.w"
  14169. if(engine->hasUncaughtException())
  14170. {
  14171. int line= engine->uncaughtExceptionLineNumber();
  14172. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14173. result.toString();
  14174. QString trace;
  14175. foreach(trace,engine->uncaughtExceptionBacktrace())
  14176. {
  14177. qDebug()<<trace;
  14178. }
  14179. }
  14180. /*:156*/
  14181. #line 3735 "./typica.w"
  14182. /*:155*/
  14183. #line 12371 "./typica.w"
  14184. int retval= app.exec();
  14185. delete engine;
  14186. return retval;
  14187. }
  14188. /*:523*/
  14189. #line 759 "./typica.w"
  14190. #include "moc_typica.cpp"
  14191. /*:15*/