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

typica.cpp 361KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316
  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*//*666:*/
  20. #line 15618 "./typica.w"
  21. #include "qextserialport.h"
  22. #include "qextserialenumerator.h"
  23. /*:666*/
  24. #line 754 "./typica.w"
  25. /*31:*/
  26. #line 1133 "./typica.w"
  27. class ScriptQMainWindow:public QMainWindow
  28. {
  29. Q_OBJECT
  30. public:
  31. ScriptQMainWindow();
  32. public slots:
  33. void show();
  34. void saveSizeAndPosition(const QString&key);
  35. void restoreSizeAndPosition(const QString&key);
  36. void displayStatus(const QString&message= QString());
  37. protected:
  38. void closeEvent(QCloseEvent*event);
  39. void showEvent(QShowEvent*event);
  40. signals:
  41. void aboutToClose(void);
  42. };
  43. /*:31*//*134:*/
  44. #line 3252 "./typica.w"
  45. class SqlQueryConnection:public QSqlQuery
  46. {
  47. public:
  48. SqlQueryConnection(const QString&query= QString());
  49. ~SqlQueryConnection();
  50. QSqlQuery*operator->();
  51. private:
  52. QString connection;
  53. QSqlQuery*q;
  54. };
  55. /*:134*//*190:*/
  56. #line 5026 "./typica.w"
  57. class NumericDelegate:public QItemDelegate
  58. {
  59. Q_OBJECT
  60. public:
  61. NumericDelegate(QObject*parent= NULL);
  62. QWidget*createEditor(QWidget*parent,
  63. const QStyleOptionViewItem&option,
  64. const QModelIndex&index)const;
  65. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  66. void setModelData(QWidget*editor,QAbstractItemModel*model,
  67. const QModelIndex&index)const;
  68. void updateEditorGeometry(QWidget*editor,
  69. const QStyleOptionViewItem&option,
  70. const QModelIndex&index)const;
  71. };
  72. /*:190*//*216:*/
  73. #line 5664 "./typica.w"
  74. class Measurement
  75. {
  76. public:
  77. enum TemperatureUnits
  78. {
  79. Fahrenheit= 10144,
  80. Celsius= 10143,
  81. Kelvin= 10325,
  82. Rankine= 10145
  83. };
  84. private:
  85. double theTemperature;
  86. QTime theTime;
  87. TemperatureUnits unit;
  88. public:
  89. Measurement(double temperature= 0,QTime time= QTime(),
  90. TemperatureUnits sc= Fahrenheit);
  91. Measurement(double temperature);
  92. Measurement(const Measurement&x);
  93. Measurement&operator= (Measurement&x);
  94. ~Measurement();
  95. double temperature()const;
  96. QTime time()const;
  97. void setTemperature(double temperature);
  98. void setTime(QTime time);
  99. void setUnit(TemperatureUnits scale);
  100. TemperatureUnits scale();
  101. Measurement toFahrenheit();
  102. Measurement toCelsius();
  103. Measurement toKelvin();
  104. Measurement toRankine();
  105. };
  106. /*:216*//*228:*/
  107. #line 5966 "./typica.w"
  108. class Channel;
  109. class DAQImplementation;
  110. class DAQ:public QObject
  111. {
  112. Q_OBJECT
  113. Q_ENUMS(TemperatureUnits)
  114. Q_ENUMS(ThermocoupleType)
  115. DAQImplementation*imp;
  116. private slots:
  117. void threadFinished();
  118. public:
  119. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  120. ~DAQ();
  121. Channel*newChannel(int units,int thermocouple);
  122. Q_INVOKABLE void setClockRate(double Hz);
  123. Q_INVOKABLE void start();
  124. Q_INVOKABLE void stop();
  125. enum TemperatureUnits
  126. {
  127. Fahrenheit= 10144,
  128. Celsius= 10143,
  129. Kelvin= 10325,
  130. Rankine= 10145
  131. };
  132. enum ThermocoupleType
  133. {
  134. TypeJ= 10072,
  135. TypeK= 10073,
  136. TypeN= 10077,
  137. TypeR= 10082,
  138. TypeS= 10085,
  139. TypeT= 10086,
  140. TypeB= 10047,
  141. TypeE= 10055
  142. };
  143. };
  144. /*:228*//*229:*/
  145. #line 6012 "./typica.w"
  146. class DAQImplementation:public QThread
  147. {
  148. Q_OBJECT
  149. public:
  150. DAQImplementation(const QString&driverinfo);
  151. ~DAQImplementation();
  152. void run();
  153. void measure();
  154. /*230:*/
  155. #line 6032 "./typica.w"
  156. typedef int(*daqfp)(...);
  157. daqfp read;
  158. daqfp errorInfo;
  159. daqfp startTask;
  160. daqfp createTask;
  161. daqfp createChannel;
  162. daqfp setClock;
  163. daqfp stopTask;
  164. daqfp clearTask;
  165. daqfp resetDevice;
  166. daqfp waitForMeasurement;
  167. /*:230*/
  168. #line 6021 "./typica.w"
  169. /*231:*/
  170. #line 6048 "./typica.w"
  171. bool useBase;
  172. QString device;
  173. QVector<Channel*> channelMap;
  174. unsigned int handle;
  175. int error;
  176. int channels;
  177. bool ready;
  178. QLibrary driver;
  179. QVector<Measurement::TemperatureUnits> unitMap;
  180. /*:231*/
  181. #line 6022 "./typica.w"
  182. };
  183. /*:229*//*247:*/
  184. #line 6545 "./typica.w"
  185. class FakeDAQImplementation:public QThread
  186. {
  187. Q_OBJECT
  188. public:
  189. FakeDAQImplementation();
  190. ~FakeDAQImplementation();
  191. void run();
  192. void measure();
  193. QVector<Channel*> channelMap;
  194. int channels;
  195. bool ready;
  196. double clockRate;
  197. };
  198. class FakeDAQ:public QObject
  199. {
  200. Q_OBJECT
  201. FakeDAQImplementation*imp;
  202. public:
  203. FakeDAQ(QString device);
  204. ~FakeDAQ();
  205. Channel*newChannel(int units,int thermocouple);
  206. Q_INVOKABLE void setClockRate(double Hz);
  207. Q_INVOKABLE void start();
  208. };
  209. /*:247*//*254:*/
  210. #line 6732 "./typica.w"
  211. class Channel:public QObject
  212. {
  213. Q_OBJECT
  214. public:
  215. Channel();
  216. ~Channel();
  217. public slots:
  218. void input(Measurement measurement);
  219. signals:
  220. void newData(Measurement);
  221. };
  222. /*:254*//*258:*/
  223. #line 6795 "./typica.w"
  224. class LinearCalibrator:public QObject
  225. {
  226. Q_OBJECT
  227. Q_PROPERTY(double measuredLower READ measuredLower
  228. WRITE setMeasuredLower)
  229. Q_PROPERTY(double measuredUpper READ measuredUpper
  230. WRITE setMeasuredUpper)
  231. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  232. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  233. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  234. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  235. public:
  236. LinearCalibrator(QObject*parent= NULL);
  237. double measuredLower();
  238. double measuredUpper();
  239. double mappedLower();
  240. double mappedUpper();
  241. bool isClosedRange();
  242. double sensitivity();
  243. public slots:
  244. void setMeasuredLower(double lower);
  245. void setMeasuredUpper(double upper);
  246. void setMappedLower(double lower);
  247. void setMappedUpper(double upper);
  248. void setClosedRange(bool closed);
  249. void setSensitivity(double sensitivity);
  250. void newMeasurement(Measurement measure);
  251. signals:
  252. void measurement(Measurement measure);
  253. private:
  254. double Lo1;
  255. double Lo2;
  256. double Up1;
  257. double Up2;
  258. double sensitivitySetting;
  259. bool clamp;
  260. };
  261. /*:258*//*265:*/
  262. #line 6989 "./typica.w"
  263. class LinearSplineInterpolator:public QObject
  264. {
  265. Q_OBJECT
  266. public:
  267. LinearSplineInterpolator(QObject*parent= NULL);
  268. Q_INVOKABLE void add_pair(double source,double destination);
  269. public slots:
  270. void newMeasurement(Measurement measure);
  271. signals:
  272. void newData(Measurement measure);
  273. private:
  274. void make_interpolators();
  275. QMap<double,double> *pairs;
  276. QList<LinearCalibrator*> *interpolators;
  277. };
  278. /*:265*//*270:*/
  279. #line 7124 "./typica.w"
  280. class TemperatureDisplay:public QLCDNumber
  281. {
  282. Q_OBJECT
  283. Q_ENUMS(DisplayUnits)
  284. int unit;
  285. public:
  286. enum DisplayUnits
  287. {
  288. Auto= -1,
  289. Fahrenheit= 10144,
  290. Celsius= 10143,
  291. Kelvin= 10325,
  292. Rankine= 10145
  293. };
  294. TemperatureDisplay(QWidget*parent= NULL);
  295. ~TemperatureDisplay();
  296. public slots:
  297. void setValue(Measurement temperature);
  298. void invalidate();
  299. void setDisplayUnits(DisplayUnits scale);
  300. };
  301. /*:270*//*279:*/
  302. #line 7300 "./typica.w"
  303. class MeasurementTimeOffset:public QObject
  304. {
  305. Q_OBJECT
  306. QTime epoch;
  307. QTime previous;
  308. bool hasPrevious;
  309. public:
  310. MeasurementTimeOffset(QTime zero);
  311. QTime zeroTime();
  312. public slots:
  313. void newMeasurement(Measurement measure);
  314. void setZeroTime(QTime zero);
  315. signals:
  316. void measurement(Measurement measure);
  317. };
  318. /*:279*//*286:*/
  319. #line 7450 "./typica.w"
  320. class ThresholdDetector:public QObject
  321. {
  322. Q_OBJECT
  323. Q_ENUMS(EdgeDirection)
  324. public:
  325. enum EdgeDirection{
  326. Ascending,Descending
  327. };
  328. ThresholdDetector(double value);
  329. public slots:
  330. void newMeasurement(Measurement measure);
  331. void setThreshold(double value);
  332. void setEdgeDirection(EdgeDirection direction);
  333. signals:
  334. void timeForValue(double);
  335. private:
  336. double previousValue;
  337. double threshold;
  338. EdgeDirection currentDirection;
  339. };
  340. /*:286*//*291:*/
  341. #line 7556 "./typica.w"
  342. class ZeroEmitter:public QObject
  343. {
  344. Q_OBJECT
  345. int col;
  346. double temp;
  347. public:
  348. ZeroEmitter(int tempcolumn);
  349. int column();
  350. double lastTemperature();
  351. public slots:
  352. void newMeasurement(Measurement measure);
  353. void setColumn(int column);
  354. void emitZero();
  355. signals:
  356. void measurement(Measurement measure,int tempcolumn);
  357. };
  358. /*:291*//*296:*/
  359. #line 7649 "./typica.w"
  360. class MeasurementAdapter:public QObject
  361. {
  362. Q_OBJECT
  363. int col;
  364. public:
  365. MeasurementAdapter(int tempcolumn);
  366. int column();
  367. public slots:
  368. void newMeasurement(Measurement measure);
  369. void setColumn(int column);
  370. signals:
  371. void measurement(Measurement measure,int tempcolumn);
  372. };
  373. /*:296*//*301:*/
  374. #line 7738 "./typica.w"
  375. class GraphView:public QGraphicsView
  376. {
  377. Q_OBJECT
  378. QGraphicsScene*theScene;
  379. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  380. QMap<int,QPointF> *prevPoints;
  381. QMap<int,double> *translations;
  382. QList<QGraphicsItem*> *gridLinesF;
  383. QList<QGraphicsItem*> *gridLinesC;
  384. public:
  385. GraphView(QWidget*parent= NULL);
  386. void removeSeries(int column);
  387. protected:
  388. void resizeEvent(QResizeEvent*event);
  389. public slots:
  390. void newMeasurement(Measurement measure,int tempcolumn);
  391. void setSeriesTranslation(int column,double offset);
  392. void clear();
  393. void showF();
  394. void showC();
  395. };
  396. /*:301*//*316:*/
  397. #line 8089 "./typica.w"
  398. class MeasurementModel;
  399. class ZoomLog:public QTableView
  400. {
  401. Q_OBJECT
  402. /*317:*/
  403. #line 8137 "./typica.w"
  404. MeasurementModel*model_ms;
  405. MeasurementModel*model_1s;
  406. MeasurementModel*model_5s;
  407. MeasurementModel*model_10s;
  408. MeasurementModel*model_15s;
  409. MeasurementModel*model_30s;
  410. MeasurementModel*model_1m;
  411. QList<MeasurementModel*> modelSet;
  412. QHash<int,Measurement> lastMeasurement;
  413. MeasurementModel*currentModel;
  414. QList<int> saveTempCols;
  415. QList<int> saveNoteCols;
  416. QList<int> currentColumnSet;
  417. /*:317*/
  418. #line 8094 "./typica.w"
  419. void switchLOD(MeasurementModel*m);
  420. private slots:
  421. void centerOn(int row);
  422. void persistColumnResize(int column,int oldsize,int newsize);
  423. void restoreColumnWidths();
  424. public:
  425. ZoomLog();
  426. QVariant data(int row,int column)const;
  427. int rowCount();
  428. bool saveXML(QIODevice*device);
  429. bool saveCSV(QIODevice*device);
  430. QString lastTime(int series);
  431. Q_INVOKABLE int displayUnits();
  432. public slots:
  433. void setVisible(bool visibility);
  434. void setHeaderData(int section,QString text);
  435. void LOD_ms();
  436. void LOD_1s();
  437. void LOD_5s();
  438. void LOD_10s();
  439. void LOD_15s();
  440. void LOD_30s();
  441. void LOD_1m();
  442. void newMeasurement(Measurement measure,int tempcolumn);
  443. void newAnnotation(QString annotation,int tempcolumn,
  444. int annotationcolumn);
  445. void clear();
  446. void addOutputTemperatureColumn(int column);
  447. void addOutputAnnotationColumn(int column);
  448. void clearOutputColumns();
  449. void setDisplayUnits(int scale);
  450. void addToCurrentColumnSet(int column);
  451. void clearCurrentColumnSet();
  452. protected:
  453. virtual void showEvent(QShowEvent*event);
  454. };
  455. /*:316*//*340:*/
  456. #line 8751 "./typica.w"
  457. class MeasurementList;
  458. class MeasurementModel:public QAbstractItemModel
  459. {
  460. Q_OBJECT
  461. Q_ENUMS(DisplayUnits);
  462. int unit;
  463. QList<MeasurementList*> *entries;
  464. QStringList*hData;
  465. int colcount;
  466. QHash<int,int> *lastTemperature;
  467. QList<MeasurementList*> ::iterator lastInsertion;
  468. public:
  469. enum DisplayUnits
  470. {
  471. Auto= -1,
  472. Fahrenheit= 10144,
  473. Celsius= 10143,
  474. Kelvin= 10325,
  475. Rankine= 10145
  476. };
  477. MeasurementModel(QObject*parent= NULL);
  478. ~MeasurementModel();
  479. int rowCount(const QModelIndex&parent= QModelIndex())const;
  480. int columnCount(const QModelIndex&parent= QModelIndex())const;
  481. bool setHeaderData(int section,Qt::Orientation orientation,
  482. const QVariant&value,int role= Qt::DisplayRole);
  483. QVariant data(const QModelIndex&index,int role)const;
  484. bool setData(const QModelIndex&index,const QVariant&value,
  485. int role= Qt::EditRole);
  486. Qt::ItemFlags flags(const QModelIndex&index)const;
  487. QVariant headerData(int section,Qt::Orientation orientation,
  488. int role= Qt::DisplayRole)const;
  489. QModelIndex index(int row,int column,
  490. const QModelIndex&parent= QModelIndex())const;
  491. QModelIndex parent(const QModelIndex&index)const;
  492. int displayUnits();
  493. public slots:
  494. void newMeasurement(Measurement measure,int tempcolumn);
  495. void newAnnotation(QString annotation,int tempcolumn,
  496. int annotationColumn);
  497. void clear();
  498. void setDisplayUnits(int scale);
  499. signals:
  500. void rowChanged(int);
  501. };
  502. /*:340*//*341:*/
  503. #line 8803 "./typica.w"
  504. class MeasurementList:public QVariantList
  505. {
  506. public:
  507. bool operator<(const MeasurementList&other)const;
  508. bool operator==(const MeasurementList&other)const;
  509. };
  510. /*:341*//*367:*/
  511. #line 9440 "./typica.w"
  512. class AnnotationButton:public QPushButton
  513. {
  514. Q_OBJECT
  515. QString note;
  516. int tc;
  517. int ac;
  518. int count;
  519. public:
  520. AnnotationButton(const QString&text,QWidget*parent= NULL);
  521. public slots:
  522. void setAnnotation(const QString&annotation);
  523. void setTemperatureColumn(int tempcolumn);
  524. void setAnnotationColumn(int annotationcolumn);
  525. void annotate();
  526. void resetCount();
  527. signals:
  528. void annotation(QString annotation,int tempcolumn,
  529. int notecolumn);
  530. };
  531. /*:367*//*375:*/
  532. #line 9565 "./typica.w"
  533. class AnnotationSpinBox:public QDoubleSpinBox
  534. {
  535. Q_OBJECT
  536. QString pretext;
  537. QString posttext;
  538. int tc;
  539. int ac;
  540. bool change;
  541. public:
  542. AnnotationSpinBox(const QString&pret,const QString&postt,
  543. QWidget*parent= NULL);
  544. public slots:
  545. void setPretext(const QString&pret);
  546. void setPosttext(const QString&postt);
  547. void setTemperatureColumn(int tempcolumn);
  548. void setAnnotationColumn(int annotationcolumn);
  549. void annotate();
  550. void resetChange();
  551. signals:
  552. void annotation(QString annotation,int tempcolumn,
  553. int notecolumn);
  554. };
  555. /*:375*//*383:*/
  556. #line 9724 "./typica.w"
  557. class TimerDisplay:public QLCDNumber
  558. {
  559. Q_OBJECT
  560. /*384:*/
  561. #line 9774 "./typica.w"
  562. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  563. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  564. Q_PROPERTY(bool running READ isRunning)
  565. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  566. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  567. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  568. /*:384*/
  569. #line 9728 "./typica.w"
  570. private slots:
  571. void updateTime();
  572. void setCountUpMode();
  573. void setCountDownMode();
  574. void setClockMode();
  575. public:
  576. TimerDisplay(QWidget*parent= NULL);
  577. ~TimerDisplay();
  578. enum TimerMode
  579. {
  580. CountUp,
  581. CountDown,
  582. Clock
  583. };
  584. QString value();
  585. QTime seconds();
  586. TimerMode mode();
  587. bool isRunning();
  588. QTime resetValue();
  589. QString displayFormat();
  590. bool autoReset();
  591. public slots:
  592. void setTimer(QTime value= QTime(0,0,0));
  593. void setMode(TimerMode mode);
  594. void startTimer();
  595. void stopTimer();
  596. void copyTimer();
  597. void setResetValue(QTime value= QTime(0,0,0));
  598. void reset();
  599. void setDisplayFormat(QString format);
  600. void setAutoReset(bool reset);
  601. void updateDisplay();
  602. signals:
  603. void valueChanged(QTime);
  604. void runStateChanged(bool);
  605. private:
  606. /*385:*/
  607. #line 9784 "./typica.w"
  608. QTime s;
  609. QTime r;
  610. QTimer clock;
  611. TimerDisplay::TimerMode m;
  612. bool running;
  613. bool ar;
  614. QAction*startAction;
  615. QAction*stopAction;
  616. QAction*resetAction;
  617. QString f;
  618. QTime relative;
  619. QTime base;
  620. /*:385*/
  621. #line 9765 "./typica.w"
  622. };
  623. /*:383*//*405:*/
  624. #line 10143 "./typica.w"
  625. class PackLayout:public QLayout
  626. {
  627. int doLayout(const QRect&rect,bool testOnly)const;
  628. QList<QLayoutItem*> itemList;
  629. Qt::Orientations orientation;
  630. public:
  631. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  632. PackLayout(int spacing= -1);
  633. ~PackLayout();
  634. void addItem(QLayoutItem*item);
  635. Qt::Orientations expandingDirections()const;
  636. bool hasHeightForWidth()const;
  637. int heightForWidth(int width)const;
  638. int count()const;
  639. QLayoutItem*itemAt(int index)const;
  640. QSize minimumSize()const;
  641. void setGeometry(const QRect&rect);
  642. void setOrientation(Qt::Orientations direction);
  643. QSize sizeHint()const;
  644. QLayoutItem*takeAt(int index);
  645. };
  646. /*:405*//*418:*/
  647. #line 10421 "./typica.w"
  648. class SceneButton:public QGraphicsScene
  649. {
  650. Q_OBJECT
  651. public:
  652. SceneButton();
  653. ~SceneButton();
  654. protected:
  655. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  656. signals:
  657. void clicked(QPoint pos);
  658. };
  659. /*:418*//*420:*/
  660. #line 10463 "./typica.w"
  661. class WidgetDecorator:public QWidget
  662. {
  663. Q_OBJECT
  664. PackLayout*layout;
  665. QGraphicsView*label;
  666. QGraphicsTextItem*text;
  667. SceneButton*scene;
  668. public:
  669. WidgetDecorator(QWidget*widget,const QString&labeltext,
  670. Qt::Orientations orientation= Qt::Horizontal,
  671. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  672. ~WidgetDecorator();
  673. void setBackgroundBrush(QBrush background);
  674. void setTextColor(QColor color);
  675. };
  676. /*:420*//*431:*/
  677. #line 10638 "./typica.w"
  678. class LogEditWindow:public QMainWindow
  679. {
  680. Q_OBJECT
  681. QWidget*centralWidget;
  682. PackLayout*mainLayout;
  683. QHBoxLayout*addRowsLayout;
  684. QLabel*startTimeLabel;
  685. QTimeEdit*startTime;
  686. QLabel*endTimeLabel;
  687. QTimeEdit*endTime;
  688. QLabel*intervalLabel;
  689. QSpinBox*interval;
  690. QPushButton*addRows;
  691. QAction*saveXml;
  692. QAction*saveCsv;
  693. QAction*openXml;
  694. MeasurementModel*model;
  695. QTableView*log;
  696. private slots:
  697. void addTheRows();
  698. void saveXML();
  699. void saveCSV();
  700. void openXML();
  701. protected:
  702. void closeEvent(QCloseEvent*event);
  703. public:
  704. LogEditWindow();
  705. };
  706. /*:431*//*445:*/
  707. #line 10946 "./typica.w"
  708. class XMLOutput:public QObject
  709. {
  710. Q_OBJECT
  711. MeasurementModel*data;
  712. QIODevice*out;
  713. int time;
  714. QMap<int,QString> temperatureColumns;
  715. QMap<int,QString> annotationColumns;
  716. public:
  717. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  718. void addTemperatureColumn(const QString&series,int column);
  719. void addAnnotationColumn(const QString&series,int column);
  720. void setModel(MeasurementModel*model);
  721. void setTimeColumn(int column);
  722. void setDevice(QIODevice*device);
  723. bool output();
  724. };
  725. /*:445*//*452:*/
  726. #line 11142 "./typica.w"
  727. class XMLInput:public QObject
  728. {
  729. Q_OBJECT
  730. int firstc;
  731. QIODevice*in;
  732. public:
  733. XMLInput(QIODevice*input,int c);
  734. void setFirstColumn(int column);
  735. void setDevice(QIODevice*device);
  736. bool input();
  737. signals:
  738. void measure(Measurement,int);
  739. void annotation(QString,int,int);
  740. void newTemperatureColumn(int,QString);
  741. void newAnnotationColumn(int,QString);
  742. void lastColumn(int);
  743. };
  744. /*:452*//*463:*/
  745. #line 11383 "./typica.w"
  746. class CSVOutput
  747. {
  748. MeasurementModel*data;
  749. QIODevice*out;
  750. int time;
  751. QMap<int,QString> temperatureColumns;
  752. QMap<int,QString> annotationColumns;
  753. public:
  754. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  755. void addTemperatureColumn(const QString&series,int column);
  756. void addAnnotationColumn(const QString&series,int column);
  757. void setModel(MeasurementModel*model);
  758. void setTimeColumn(int column);
  759. void setDevice(QIODevice*device);
  760. bool output();
  761. };
  762. /*:463*//*477:*/
  763. #line 11644 "./typica.w"
  764. class NodeInserter;
  765. class DeviceTreeModel;
  766. class Application:public QApplication
  767. {
  768. Q_OBJECT
  769. public:
  770. Application(int&argc,char**argv);
  771. QDomDocument*configuration();
  772. /*591:*/
  773. #line 14029 "./typica.w"
  774. QDomDocument deviceConfiguration();
  775. /*:591*//*624:*/
  776. #line 14702 "./typica.w"
  777. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  778. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  779. const QModelIndex&index);
  780. /*:624*//*629:*/
  781. #line 14806 "./typica.w"
  782. QList<NodeInserter*> topLevelNodeInserters;
  783. /*:629*/
  784. #line 11653 "./typica.w"
  785. QSqlDatabase database();
  786. QScriptEngine*engine;
  787. public slots:
  788. /*592:*/
  789. #line 14036 "./typica.w"
  790. void saveDeviceConfiguration();
  791. /*:592*/
  792. #line 11657 "./typica.w"
  793. private:
  794. /*590:*/
  795. #line 14020 "./typica.w"
  796. QDomDocument deviceConfigurationDocument;
  797. /*:590*//*623:*/
  798. #line 14696 "./typica.w"
  799. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  800. /*:623*/
  801. #line 11659 "./typica.w"
  802. QDomDocument conf;
  803. };
  804. /*:477*//*485:*/
  805. #line 11783 "./typica.w"
  806. class SaltModel:public QAbstractItemModel
  807. {
  808. Q_OBJECT
  809. QList<QList<QMap<int,QVariant> > > modelData;
  810. QStringList hData;
  811. int colcount;
  812. public:
  813. SaltModel(int columns);
  814. ~SaltModel();
  815. int rowCount(const QModelIndex&parent= QModelIndex())const;
  816. int columnCount(const QModelIndex&parent= QModelIndex())const;
  817. bool setHeaderData(int section,Qt::Orientation orientation,
  818. const QVariant&value,int role= Qt::DisplayRole);
  819. QVariant data(const QModelIndex&index,int role)const;
  820. bool setData(const QModelIndex&index,const QVariant&value,
  821. int role= Qt::EditRole);
  822. Qt::ItemFlags flags(const QModelIndex&index)const;
  823. QVariant headerData(int section,Qt::Orientation orientation,
  824. int role= Qt::DisplayRole)const;
  825. QModelIndex index(int row,int column,
  826. const QModelIndex&parent= QModelIndex())const;
  827. QModelIndex parent(const QModelIndex&index)const;
  828. QString arrayLiteral(int column,int role)const;
  829. QString quotedArrayLiteral(int column,int role)const;
  830. };
  831. /*:485*//*498:*/
  832. #line 12096 "./typica.w"
  833. class SqlComboBox:public QComboBox
  834. {
  835. Q_OBJECT
  836. int dataColumn;
  837. int displayColumn;
  838. bool dataColumnShown;
  839. public:
  840. SqlComboBox();
  841. ~SqlComboBox();
  842. SqlComboBox*clone(QWidget*parent);
  843. public slots:
  844. void addNullOption();
  845. void addSqlOptions(QString query);
  846. void setDataColumn(int column);
  847. void setDisplayColumn(int column);
  848. void showData(bool show);
  849. };
  850. /*:498*//*505:*/
  851. #line 12218 "./typica.w"
  852. class SqlComboBoxDelegate:public QItemDelegate
  853. {
  854. Q_OBJECT
  855. SqlComboBox*delegate;
  856. public:
  857. SqlComboBoxDelegate(QObject*parent= NULL);
  858. QWidget*createEditor(QWidget*parent,
  859. const QStyleOptionViewItem&option,
  860. const QModelIndex&index)const;
  861. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  862. void setModelData(QWidget*editor,QAbstractItemModel*model,
  863. const QModelIndex&index)const;
  864. void setWidget(SqlComboBox*widget);
  865. virtual QSize sizeHint()const;
  866. void updateEditorGeometry(QWidget*editor,
  867. const QStyleOptionViewItem&option,
  868. const QModelIndex&index)const;
  869. };
  870. /*:505*//*516:*/
  871. #line 12377 "./typica.w"
  872. class SqlConnectionSetup:public QDialog
  873. {
  874. Q_OBJECT
  875. public:
  876. SqlConnectionSetup();
  877. ~SqlConnectionSetup();
  878. public slots:
  879. void testConnection();
  880. private:
  881. QFormLayout*formLayout;
  882. QComboBox*driver;
  883. QLineEdit*hostname;
  884. QLineEdit*dbname;
  885. QLineEdit*user;
  886. QLineEdit*password;
  887. QVBoxLayout*layout;
  888. QHBoxLayout*buttons;
  889. QPushButton*cancelButton;
  890. QPushButton*connectButton;
  891. };
  892. /*:516*//*521:*/
  893. #line 12505 "./typica.w"
  894. class SqlQueryView:public QTableView
  895. {
  896. Q_OBJECT
  897. public:
  898. SqlQueryView(QWidget*parent= NULL);
  899. void setQuery(const QString&query);
  900. bool setHeaderData(int section,Qt::Orientation orientation,
  901. const QVariant&value,int role);
  902. Q_INVOKABLE QVariant data(int row,int column,
  903. int role= Qt::DisplayRole);
  904. signals:
  905. void openEntry(QString key);
  906. void openEntryRow(int row);
  907. protected:
  908. virtual void showEvent(QShowEvent*event);
  909. private slots:
  910. void openRow(const QModelIndex&index);
  911. void persistColumnResize(int column,int oldsize,int newsize);
  912. };
  913. /*:521*//*536:*/
  914. #line 12753 "./typica.w"
  915. class ReportAction:public QAction
  916. {
  917. Q_OBJECT
  918. public:
  919. ReportAction(const QString&fileName,const QString&reportName,
  920. QObject*parent= NULL);
  921. private slots:
  922. void createReport();
  923. private:
  924. QString reportFile;
  925. };
  926. /*:536*//*548:*/
  927. #line 12962 "./typica.w"
  928. class ReportTable:public QObject
  929. {
  930. Q_OBJECT
  931. QTextFrame*area;
  932. QDomElement configuration;
  933. QMap<QString,QVariant> bindings;
  934. public:
  935. ReportTable(QTextFrame*frame,QDomElement description);
  936. ~ReportTable();
  937. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  938. public slots:
  939. void refresh();
  940. };
  941. /*:548*//*560:*/
  942. #line 13198 "./typica.w"
  943. class FormArray:public QScrollArea
  944. {
  945. Q_OBJECT
  946. QDomElement configuration;
  947. QWidget itemContainer;
  948. QVBoxLayout itemLayout;
  949. int maxwidth;
  950. int maxheight;
  951. public:
  952. FormArray(QDomElement description);
  953. Q_INVOKABLE QWidget*elementAt(int index);
  954. Q_INVOKABLE int elements();
  955. public slots:
  956. void addElements(int copies= 1);
  957. void removeAllElements();
  958. void setMaximumElementWidth(int width);
  959. void setMaximumElementHeight(int height);
  960. };
  961. /*:560*//*570:*/
  962. #line 13414 "./typica.w"
  963. class ScaleControl:public QGraphicsView
  964. {
  965. Q_OBJECT
  966. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  967. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  968. /*571:*/
  969. #line 13440 "./typica.w"
  970. QGraphicsScene scene;
  971. QGraphicsPolygonItem initialDecrement;
  972. QGraphicsPolygonItem initialIncrement;
  973. QGraphicsPolygonItem finalDecrement;
  974. QGraphicsPolygonItem finalIncrement;
  975. QGraphicsPolygonItem initialIndicator;
  976. QGraphicsPolygonItem finalIndicator;
  977. QGraphicsPathItem scaleLine;
  978. QPolygonF left;
  979. QPolygonF right;
  980. QPolygonF down;
  981. QPolygonF up;
  982. QPainterPath scalePath;
  983. QBrush initialBrush;
  984. QBrush finalBrush;
  985. double nonScoredValue;
  986. double scoredValue;
  987. bool initialSet;
  988. bool finalSet;
  989. bool scaleDown;
  990. /*:571*/
  991. #line 13420 "./typica.w"
  992. public:
  993. ScaleControl();
  994. double initialValue(void);
  995. double finalValue(void);
  996. virtual QSize sizeHint()const;
  997. public slots:
  998. void setInitialValue(double value);
  999. void setFinalValue(double value);
  1000. signals:
  1001. void initialChanged(double);
  1002. void finalChanged(double);
  1003. protected:
  1004. virtual void mousePressEvent(QMouseEvent*event);
  1005. virtual void mouseReleaseEvent(QMouseEvent*event);
  1006. };
  1007. /*:570*//*582:*/
  1008. #line 13737 "./typica.w"
  1009. class IntensityControl:public QGraphicsView
  1010. {
  1011. Q_OBJECT
  1012. Q_PROPERTY(double value READ value WRITE setValue)
  1013. QGraphicsScene scene;
  1014. QGraphicsPolygonItem decrement;
  1015. QGraphicsPolygonItem increment;
  1016. QGraphicsPolygonItem indicator;
  1017. QGraphicsPathItem scaleLine;
  1018. QPolygonF left;
  1019. QPolygonF up;
  1020. QPolygonF down;
  1021. QPainterPath scalePath;
  1022. QBrush theBrush;
  1023. double theValue;
  1024. bool valueSet;
  1025. bool scaleDown;
  1026. public:
  1027. IntensityControl();
  1028. double value();
  1029. virtual QSize sizeHint()const;
  1030. public slots:
  1031. void setValue(double val);
  1032. signals:
  1033. void valueChanged(double);
  1034. protected:
  1035. virtual void mousePressEvent(QMouseEvent*event);
  1036. virtual void mouseReleaseEvent(QMouseEvent*event);
  1037. };
  1038. /*:582*//*598:*/
  1039. #line 14125 "./typica.w"
  1040. class DeviceTreeModelNode
  1041. {
  1042. public:
  1043. DeviceTreeModelNode(QDomNode&node,int row,
  1044. DeviceTreeModelNode*parent= NULL);
  1045. ~DeviceTreeModelNode();
  1046. DeviceTreeModelNode*child(int index);
  1047. DeviceTreeModelNode*parent();
  1048. QDomNode node()const;
  1049. int row();
  1050. private:
  1051. QDomNode domNode;
  1052. QHash<int,DeviceTreeModelNode*> children;
  1053. int rowNumber;
  1054. DeviceTreeModelNode*parentItem;
  1055. };
  1056. /*:598*//*600:*/
  1057. #line 14200 "./typica.w"
  1058. class DeviceTreeModel:public QAbstractItemModel
  1059. {
  1060. Q_OBJECT
  1061. public:
  1062. DeviceTreeModel(QObject*parent= NULL);
  1063. ~DeviceTreeModel();
  1064. QVariant data(const QModelIndex&index,int role)const;
  1065. Qt::ItemFlags flags(const QModelIndex&index)const;
  1066. QVariant headerData(int section,Qt::Orientation orientation,
  1067. int role= Qt::DisplayRole)const;
  1068. QModelIndex index(int row,int column,
  1069. const QModelIndex&parent= QModelIndex())const;
  1070. QModelIndex parent(const QModelIndex&child)const;
  1071. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1072. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1073. bool setData(const QModelIndex&index,const QVariant&value,
  1074. int role);
  1075. bool removeRows(int row,int count,const QModelIndex&parent);
  1076. QDomElement referenceElement(const QString&id);
  1077. public slots:
  1078. void newNode(const QString&name,const QString&driver,
  1079. const QModelIndex&parent);
  1080. private:
  1081. QDomDocument document;
  1082. DeviceTreeModelNode*root;
  1083. QDomNode referenceSection;
  1084. QDomNode treeRoot;
  1085. };
  1086. /*:600*//*619:*/
  1087. #line 14654 "./typica.w"
  1088. Q_DECLARE_METATYPE(QModelIndex)
  1089. /*:619*//*627:*/
  1090. #line 14761 "./typica.w"
  1091. class NodeInserter:public QAction
  1092. {
  1093. Q_OBJECT
  1094. public:
  1095. NodeInserter(const QString&title,const QString&name,
  1096. const QString&driver,QObject*parent= NULL);
  1097. signals:
  1098. void triggered(QString name,QString driver);
  1099. private slots:
  1100. void onTriggered();
  1101. private:
  1102. QString defaultNodeName;
  1103. QString driverString;
  1104. };
  1105. /*:627*//*630:*/
  1106. #line 14812 "./typica.w"
  1107. class DeviceConfigurationWindow:public QMainWindow
  1108. {
  1109. Q_OBJECT
  1110. public:
  1111. DeviceConfigurationWindow();
  1112. public slots:
  1113. void addDevice();
  1114. void removeNode();
  1115. void newSelection(const QModelIndex&index);
  1116. private:
  1117. QDomDocument document;
  1118. DeviceTreeModel*model;
  1119. QTreeView*view;
  1120. QScrollArea*configArea;
  1121. };
  1122. /*:630*//*638:*/
  1123. #line 14956 "./typica.w"
  1124. class BasicDeviceConfigurationWidget:public QWidget
  1125. {
  1126. Q_OBJECT
  1127. public:
  1128. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1129. const QModelIndex&index);
  1130. public slots:
  1131. void insertChildNode(const QString&name,const QString&driver);
  1132. void updateAttribute(const QString&name,const QString&value);
  1133. protected:
  1134. DeviceTreeModel*deviceModel;
  1135. QModelIndex currentNode;
  1136. };
  1137. /*:638*//*642:*/
  1138. #line 15041 "./typica.w"
  1139. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1140. {
  1141. Q_OBJECT
  1142. public:
  1143. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1144. const QModelIndex&index);
  1145. private slots:
  1146. void updateRoasterId(int id);
  1147. };
  1148. /*:642*//*647:*/
  1149. #line 15168 "./typica.w"
  1150. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1151. {
  1152. Q_OBJECT
  1153. public:
  1154. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1155. const QModelIndex&index);
  1156. };
  1157. /*:647*//*649:*/
  1158. #line 15214 "./typica.w"
  1159. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1160. {
  1161. Q_OBJECT
  1162. public:
  1163. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1164. const QModelIndex&index);
  1165. private slots:
  1166. void addChannel();
  1167. void updateDeviceId(const QString&newId);
  1168. };
  1169. /*:649*//*653:*/
  1170. #line 15300 "./typica.w"
  1171. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1172. {
  1173. Q_OBJECT
  1174. public:
  1175. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1176. const QModelIndex&index);
  1177. private slots:
  1178. void updateThermocoupleType(const QString&type);
  1179. void updateColumnName(const QString&name);
  1180. };
  1181. /*:653*//*658:*/
  1182. #line 15402 "./typica.w"
  1183. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1184. {
  1185. Q_OBJECT
  1186. public:
  1187. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1188. const QModelIndex&index);
  1189. };
  1190. /*:658*//*660:*/
  1191. #line 15443 "./typica.w"
  1192. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1193. {
  1194. Q_OBJECT
  1195. public:
  1196. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1197. const QModelIndex&index);
  1198. private slots:
  1199. void addChannel();
  1200. void updateDeviceId(const QString&newId);
  1201. };
  1202. /*:660*//*662:*/
  1203. #line 15512 "./typica.w"
  1204. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1205. {
  1206. Q_OBJECT
  1207. public:
  1208. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1209. const QModelIndex&index);
  1210. private slots:
  1211. void updateDeviceId(const QString&newId);
  1212. void updateThermocoupleType(const QString&type);
  1213. void updateColumnName(const QString&name);
  1214. };
  1215. /*:662*//*667:*/
  1216. #line 15629 "./typica.w"
  1217. class PortSelector:public QComboBox
  1218. {
  1219. Q_OBJECT
  1220. public:
  1221. PortSelector(QWidget*parent= NULL);
  1222. private slots:
  1223. void addDevice(QextPortInfo port);
  1224. private:
  1225. QextSerialEnumerator*lister;
  1226. };
  1227. /*:667*//*669:*/
  1228. #line 15673 "./typica.w"
  1229. class BaudSelector:public QComboBox
  1230. {
  1231. Q_OBJECT
  1232. Q_ENUMS(BaudRateType)
  1233. public:
  1234. BaudSelector(QWidget*parent= NULL);
  1235. enum BaudRateType
  1236. {
  1237. #if defined(Q_OS_UNIX) || defined(qdoc)
  1238. BAUD50= 50,
  1239. BAUD75= 75,
  1240. BAUD134= 134,
  1241. BAUD150= 150,
  1242. BAUD200= 200,
  1243. BAUD1800= 1800,
  1244. #if defined(B76800) || defined(qdoc)
  1245. BAUD76800= 76800,
  1246. #endif
  1247. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1248. BAUD230400= 230400,
  1249. BAUD460800= 460800,
  1250. BAUD500000= 500000,
  1251. BAUD576000= 576000,
  1252. BAUD921600= 921600,
  1253. BAUD1000000= 1000000,
  1254. BAUD1152000= 1152000,
  1255. BAUD1500000= 1500000,
  1256. BAUD2000000= 2000000,
  1257. BAUD2500000= 2500000,
  1258. BAUD3000000= 3000000,
  1259. BAUD3500000= 3500000,
  1260. BAUD4000000= 4000000,
  1261. #endif
  1262. #endif
  1263. #if defined(Q_OS_WIN) || defined(qdoc)
  1264. BAUD14400= 14400,
  1265. BAUD56000= 56000,
  1266. BAUD128000= 128000,
  1267. BAUD256000= 256000,
  1268. #endif
  1269. BAUD110= 110,
  1270. BAUD300= 300,
  1271. BAUD600= 600,
  1272. BAUD1200= 1200,
  1273. BAUD2400= 2400,
  1274. BAUD4800= 4800,
  1275. BAUD9600= 9600,
  1276. BAUD19200= 19200,
  1277. BAUD38400= 38400,
  1278. BAUD57600= 57600,
  1279. BAUD115200= 115200
  1280. };
  1281. };
  1282. /*:669*//*671:*/
  1283. #line 15744 "./typica.w"
  1284. class ParitySelector:public QComboBox
  1285. {
  1286. Q_OBJECT
  1287. Q_ENUMS(ParityType)
  1288. public:
  1289. ParitySelector(QWidget*parent= NULL);
  1290. enum ParityType
  1291. {
  1292. PAR_NONE,
  1293. PAR_ODD,
  1294. PAR_EVEN,
  1295. #if defined(Q_OS_WIN) || defined(qdoc)
  1296. PAR_MARK,
  1297. #endif
  1298. PAR_SPACE
  1299. };
  1300. };
  1301. /*:671*//*673:*/
  1302. #line 15782 "./typica.w"
  1303. class FlowSelector:public QComboBox
  1304. {
  1305. Q_OBJECT
  1306. Q_ENUMS(FlowType)
  1307. public:
  1308. FlowSelector(QWidget*parent= NULL);
  1309. enum FlowType
  1310. {
  1311. FLOW_OFF,
  1312. FLOW_HARDWARE,
  1313. FLOW_XONXOFF
  1314. };
  1315. };
  1316. /*:673*//*675:*/
  1317. #line 15815 "./typica.w"
  1318. class StopSelector:public QComboBox
  1319. {
  1320. Q_OBJECT
  1321. Q_ENUMS(StopBitsType)
  1322. public:
  1323. StopSelector(QWidget*parent= NULL);
  1324. enum StopBitsType
  1325. {
  1326. STOP_1,
  1327. #if defined(Q_OS_WIN) || defined(qdoc)
  1328. STOP_1_5,
  1329. #endif
  1330. STOP_2
  1331. };
  1332. };
  1333. /*:675*//*678:*/
  1334. #line 15868 "./typica.w"
  1335. class ShortHexSpinBox:public QSpinBox
  1336. {
  1337. Q_OBJECT
  1338. public:
  1339. ShortHexSpinBox(QWidget*parent= NULL);
  1340. virtual QValidator::State validate(QString&input,int&pos)const;
  1341. protected:
  1342. virtual int valueFromText(const QString&text)const;
  1343. virtual QString textFromValue(int value)const;
  1344. };
  1345. /*:678*//*680:*/
  1346. #line 15930 "./typica.w"
  1347. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1348. {
  1349. Q_OBJECT
  1350. public:
  1351. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1352. const QModelIndex&index);
  1353. private slots:
  1354. void updatePort(const QString&newPort);
  1355. void updateBaudRate(const QString&newRate);
  1356. void updateParity(const QString&newParity);
  1357. void updateFlowControl(const QString&newFlow);
  1358. void updateStopBits(const QString&newStopBits);
  1359. };
  1360. /*:680*//*682:*/
  1361. #line 16081 "./typica.w"
  1362. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1363. {
  1364. Q_OBJECT
  1365. public:
  1366. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1367. const QModelIndex&index);
  1368. private slots:
  1369. void updateStationNumber(int newStation);
  1370. void updateFixedUnit(bool newFixed);
  1371. void updateFixedDecimal(bool newFixed);
  1372. void updateUnit(const QString&newUnit);
  1373. void updateUnitAddress(int newAddress);
  1374. void updateValueF(int newValue);
  1375. void updateValueC(int newValue);
  1376. void updatePrecisionAddress(int newAddress);
  1377. void updatePrecisionValue(int newValue);
  1378. private:
  1379. QStackedLayout*unitSpecificationLayout;
  1380. QStackedLayout*decimalSpecificationLayout;
  1381. };
  1382. /*:682*//*684:*/
  1383. #line 16340 "./typica.w"
  1384. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1385. {
  1386. Q_OBJECT
  1387. public:
  1388. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1389. const QModelIndex&index);
  1390. private slots:
  1391. void updateAddress(int newAddress);
  1392. };
  1393. /*:684*//*686:*/
  1394. #line 16386 "./typica.w"
  1395. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1396. {
  1397. Q_OBJECT
  1398. public:
  1399. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1400. const QModelIndex&index);
  1401. private slots:
  1402. void updateReadAddress(int newAddress);
  1403. void updateWriteAddress(int newAddress);
  1404. void updateFixedRange(bool fixed);
  1405. void updateLower(const QString&lower);
  1406. void updateUpper(const QString&upper);
  1407. void updateLowerAddress(int newAddress);
  1408. void updateUpperAddress(int newAddress);
  1409. private:
  1410. QStackedLayout*boundsLayout;
  1411. };
  1412. /*:686*//*690:*/
  1413. #line 16580 "./typica.w"
  1414. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1415. {
  1416. Q_OBJECT
  1417. public:
  1418. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1419. private slots:
  1420. void updateButtonText(const QString&text);
  1421. void updateAnnotationText(const QString&text);
  1422. };
  1423. /*:690*//*694:*/
  1424. #line 16648 "./typica.w"
  1425. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1426. {
  1427. Q_OBJECT
  1428. public:
  1429. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1430. private slots:
  1431. void updateButtonText(const QString&text);
  1432. void updateAnnotationText(const QString&text);
  1433. };
  1434. /*:694*//*697:*/
  1435. #line 16722 "./typica.w"
  1436. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1437. {
  1438. Q_OBJECT
  1439. public:
  1440. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1441. private slots:
  1442. void updateLabel(const QString&text);
  1443. void updateMinimum(const QString&minimum);
  1444. void updateMaximum(const QString&maximum);
  1445. void updatePrecision(int precision);
  1446. void updatePretext(const QString&text);
  1447. void updatePosttext(const QString&text);
  1448. };
  1449. /*:697*//*700:*/
  1450. #line 16843 "./typica.w"
  1451. class ModbusRTUDevice:public QObject
  1452. {
  1453. Q_OBJECT
  1454. public:
  1455. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1456. ~ModbusRTUDevice();
  1457. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1458. Q_INVOKABLE double SVLower();
  1459. Q_INVOKABLE double SVUpper();
  1460. Q_INVOKABLE int decimals();
  1461. QList<Channel*> channels;
  1462. public slots:
  1463. void outputSV(double sv);
  1464. signals:
  1465. void SVLowerChanged(double);
  1466. void SVUpperChanged(double);
  1467. void SVDecimalChanged(int);
  1468. void queueEmpty();
  1469. private slots:
  1470. void dataAvailable();
  1471. void sendNextMessage();
  1472. void decimalResponse(QByteArray response);
  1473. void unitResponse(QByteArray response);
  1474. void svlResponse(QByteArray response);
  1475. void svuResponse(QByteArray response);
  1476. void requestMeasurement();
  1477. void mResponse(QByteArray response);
  1478. void ignore(QByteArray response);
  1479. private:
  1480. QextSerialPort*port;
  1481. QByteArray responseBuffer;
  1482. QList<QByteArray> messageQueue;
  1483. QList<QObject*> retObjQueue;
  1484. QList<char*> callbackQueue;
  1485. quint16 calculateCRC(QByteArray data);
  1486. QTimer*messageDelayTimer;
  1487. int delayTime;
  1488. char station;
  1489. int decimalPosition;
  1490. int valueF;
  1491. int valueC;
  1492. bool unitIsF;
  1493. double outputSVLower;
  1494. double outputSVUpper;
  1495. QByteArray outputSVStub;
  1496. QByteArray pvStub;
  1497. QByteArray svStub;
  1498. QByteArray mStub;
  1499. quint16 pvaddress;
  1500. quint16 svaddress;
  1501. bool svenabled;
  1502. bool readingsv;
  1503. double savedpv;
  1504. bool waiting;
  1505. };
  1506. /*:700*//*715:*/
  1507. #line 17515 "./typica.w"
  1508. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1509. {
  1510. Q_OBJECT
  1511. public:
  1512. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1513. private slots:
  1514. void updatePort(const QString&newPort);
  1515. void updateBaudRate(const QString&newRate);
  1516. void updateParity(const QString&newParity);
  1517. void updateFlowControl(const QString&newFlow);
  1518. void updateStopBits(const QString&newStopBits);
  1519. void updateStation(int station);
  1520. void updateFixedDecimal(bool fixed);
  1521. void updateDecimalAddress(int address);
  1522. void updateDecimalPosition(int position);
  1523. void updateFixedUnit(bool fixed);
  1524. void updateUnitAddress(int address);
  1525. void updateValueForF(int value);
  1526. void updateValueForC(int value);
  1527. void updateUnit(const QString&newUnit);
  1528. void updatePVAddress(int address);
  1529. void updateSVEnabled(bool enabled);
  1530. void updateSVReadAddress(int address);
  1531. void updateDeviceLimit(bool query);
  1532. void updateSVLowerAddress(int address);
  1533. void updateSVUpperAddress(int address);
  1534. void updateSVLower(double value);
  1535. void updateSVUpper(double value);
  1536. void updateSVWritable(bool canWriteSV);
  1537. void updateSVWriteAddress(int address);
  1538. void updatePVColumnName(const QString&name);
  1539. void updateSVColumnName(const QString&name);
  1540. private:
  1541. PortSelector*port;
  1542. BaudSelector*baud;
  1543. ParitySelector*parity;
  1544. FlowSelector*flow;
  1545. StopSelector*stop;
  1546. QSpinBox*station;
  1547. QCheckBox*decimalQuery;
  1548. ShortHexSpinBox*decimalAddress;
  1549. QSpinBox*decimalPosition;
  1550. QCheckBox*unitQuery;
  1551. ShortHexSpinBox*unitAddress;
  1552. QSpinBox*valueF;
  1553. QSpinBox*valueC;
  1554. QComboBox*fixedUnit;
  1555. ShortHexSpinBox*pVAddress;
  1556. QCheckBox*sVEnabled;
  1557. ShortHexSpinBox*sVReadAddress;
  1558. QCheckBox*deviceLimit;
  1559. ShortHexSpinBox*sVLowerAddr;
  1560. ShortHexSpinBox*sVUpperAddr;
  1561. QDoubleSpinBox*sVLower;
  1562. QDoubleSpinBox*sVUpper;
  1563. QCheckBox*sVWritable;
  1564. ShortHexSpinBox*sVOutputAddr;
  1565. QLineEdit*pVColumnName;
  1566. QLineEdit*sVColumnName;
  1567. };
  1568. /*:715*//*719:*/
  1569. #line 18021 "./typica.w"
  1570. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1571. {
  1572. Q_OBJECT
  1573. public:
  1574. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1575. const QModelIndex&index);
  1576. private slots:
  1577. void updateSourceColumn(const QString&source);
  1578. void updateDestinationColumn(const QString&dest);
  1579. void updateKnots();
  1580. private:
  1581. SaltModel*knotmodel;
  1582. };
  1583. /*:719*//*725:*/
  1584. #line 18145 "./typica.w"
  1585. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1586. {
  1587. Q_OBJECT
  1588. public:
  1589. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1590. private slots:
  1591. void updateMatchingColumn(const QString&column);
  1592. void updateTemperature();
  1593. private:
  1594. QDoubleSpinBox*temperatureValue;
  1595. QComboBox*unitSelector;
  1596. };
  1597. /*:725*/
  1598. #line 755 "./typica.w"
  1599. /*23:*/
  1600. #line 997 "./typica.w"
  1601. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1602. /*:23*//*25:*/
  1603. #line 1012 "./typica.w"
  1604. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1605. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1606. /*:25*//*27:*/
  1607. #line 1037 "./typica.w"
  1608. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1609. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1610. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1611. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1612. QScriptEngine*engine);
  1613. /*:27*//*35:*/
  1614. #line 1235 "./typica.w"
  1615. QScriptValue constructQMainWindow(QScriptContext*context,
  1616. QScriptEngine*engine);
  1617. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1618. QScriptEngine*engine);
  1619. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1620. QScriptEngine*engine);
  1621. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1622. /*:35*//*40:*/
  1623. #line 1334 "./typica.w"
  1624. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1625. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1626. /*:40*//*43:*/
  1627. #line 1379 "./typica.w"
  1628. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1629. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1630. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1631. /*:43*//*46:*/
  1632. #line 1445 "./typica.w"
  1633. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1634. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1635. /*:46*//*49:*/
  1636. #line 1478 "./typica.w"
  1637. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1638. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1639. /*:49*//*52:*/
  1640. #line 1519 "./typica.w"
  1641. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1642. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1643. QScriptEngine*engine);
  1644. QScriptValue QSplitter_saveState(QScriptContext*context,
  1645. QScriptEngine*engine);
  1646. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1647. QScriptEngine*engine);
  1648. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1649. /*:52*//*57:*/
  1650. #line 1638 "./typica.w"
  1651. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1652. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1653. /*:57*//*59:*/
  1654. #line 1693 "./typica.w"
  1655. QScriptValue constructQBoxLayout(QScriptContext*context,
  1656. QScriptEngine*engine);
  1657. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1658. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1659. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1660. /*:59*//*63:*/
  1661. #line 1806 "./typica.w"
  1662. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1663. QScriptValue QAction_setShortcut(QScriptContext*context,
  1664. QScriptEngine*engine);
  1665. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1666. /*:63*//*66:*/
  1667. #line 1862 "./typica.w"
  1668. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  1669. QScriptEngine*engine);
  1670. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  1671. QScriptEngine*engine);
  1672. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  1673. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  1674. /*:66*//*71:*/
  1675. #line 1973 "./typica.w"
  1676. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  1677. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  1678. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  1679. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  1680. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  1681. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  1682. QScriptValue QIODevice_readToString(QScriptContext*context,
  1683. QScriptEngine*engine);
  1684. /*:71*//*78:*/
  1685. #line 2095 "./typica.w"
  1686. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  1687. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  1688. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  1689. /*:78*//*81:*/
  1690. #line 2140 "./typica.w"
  1691. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  1692. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1693. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  1694. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  1695. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  1696. /*:81*//*87:*/
  1697. #line 2213 "./typica.w"
  1698. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  1699. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  1700. QScriptEngine*engine);
  1701. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  1702. QScriptEngine*engine);
  1703. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  1704. QScriptEngine*engine);
  1705. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  1706. QScriptEngine*engine);
  1707. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  1708. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  1709. QScriptEngine*engine);
  1710. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  1711. QScriptEngine*engine);
  1712. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  1713. QScriptEngine*engine);
  1714. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  1715. QScriptEngine*engine);
  1716. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  1717. QScriptEngine*engine);
  1718. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  1719. QScriptEngine*engine);
  1720. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  1721. QScriptEngine*engine);
  1722. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  1723. QScriptEngine*engine);
  1724. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  1725. /*:87*//*96:*/
  1726. #line 2431 "./typica.w"
  1727. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  1728. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  1729. QScriptValue XmlReader_attribute(QScriptContext*context,
  1730. QScriptEngine*engine);
  1731. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  1732. QScriptEngine*engine);
  1733. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  1734. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  1735. QScriptEngine*engine);
  1736. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  1737. QScriptValue XmlReader_readElementText(QScriptContext*context,
  1738. QScriptEngine*engine);
  1739. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  1740. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  1741. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  1742. /*:96*//*103:*/
  1743. #line 2566 "./typica.w"
  1744. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  1745. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  1746. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  1747. /*:103*//*107:*/
  1748. #line 2648 "./typica.w"
  1749. QScriptValue constructQLCDNumber(QScriptContext*context,
  1750. QScriptEngine*engine);
  1751. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  1752. /*:107*//*110:*/
  1753. #line 2686 "./typica.w"
  1754. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  1755. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  1756. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  1757. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  1758. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  1759. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  1760. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  1761. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  1762. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  1763. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  1764. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  1765. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  1766. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  1767. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  1768. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  1769. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  1770. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  1771. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  1772. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  1773. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  1774. /*:110*//*125:*/
  1775. #line 3155 "./typica.w"
  1776. void setQAbstractScrollAreaProperties(QScriptValue value,
  1777. QScriptEngine*engine);
  1778. /*:125*//*127:*/
  1779. #line 3170 "./typica.w"
  1780. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  1781. /*:127*//*129:*/
  1782. #line 3183 "./typica.w"
  1783. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  1784. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  1785. /*:129*//*131:*/
  1786. #line 3207 "./typica.w"
  1787. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  1788. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  1789. QScriptValue constructQPushButton(QScriptContext*context,
  1790. QScriptEngine*engine);
  1791. /*:131*//*138:*/
  1792. #line 3306 "./typica.w"
  1793. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  1794. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  1795. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  1796. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  1797. QScriptEngine*engine);
  1798. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  1799. QScriptEngine*engine);
  1800. QScriptValue QSqlQuery_exec(QScriptContext*context,
  1801. QScriptEngine*engine);
  1802. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  1803. QScriptEngine*engine);
  1804. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  1805. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  1806. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  1807. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  1808. /*:138*//*145:*/
  1809. #line 3476 "./typica.w"
  1810. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  1811. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  1812. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  1813. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  1814. QScriptValue annotationFromRecord(QScriptContext*context,
  1815. QScriptEngine*engine);
  1816. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  1817. /*:145*//*156:*/
  1818. #line 3759 "./typica.w"
  1819. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  1820. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1821. QStack<QLayout*> *layoutStack);
  1822. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1823. QStack<QLayout*> *layoutStack);
  1824. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1825. QStack<QLayout*> *layoutStack);
  1826. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1827. QStack<QLayout*> *layoutStack);
  1828. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1829. QStack<QLayout*> *layoutStack);
  1830. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1831. QStack<QLayout*> *layoutStack);
  1832. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1833. QStack<QLayout*> *layoutStack);
  1834. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  1835. QStack<QLayout*> *layoutStack);
  1836. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1837. QStack<QLayout*> *layoutStack);
  1838. void addTemperatureDisplayToSplitter(QDomElement element,
  1839. QStack<QWidget*> *widgetStack,
  1840. QStack<QLayout*> *layoutStack);
  1841. void addTemperatureDisplayToLayout(QDomElement element,
  1842. QStack<QWidget*> *widgetStack,
  1843. QStack<QLayout*> *layoutStack);
  1844. void addTimerDisplayToSplitter(QDomElement element,
  1845. QStack<QWidget*> *widgetStack,
  1846. QStack<QLayout*> *layoutStack);
  1847. void addTimerDisplayToLayout(QDomElement element,
  1848. QStack<QWidget*> *widgetStack,
  1849. QStack<QLayout*> *layoutStack);
  1850. void addDecorationToSplitter(QDomElement element,
  1851. QStack<QWidget*> *widgetStack,
  1852. QStack<QLayout*> *layoutStack);
  1853. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1854. QStack<QLayout*> *layoutStack);
  1855. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1856. QStack<QLayout*> *layoutStack);
  1857. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1858. QStack<QLayout*> *layoutStack);
  1859. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1860. QStack<QLayout*> *layoutStack);
  1861. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  1862. QStack<QLayout*> *layoutStack);
  1863. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1864. QStack<QLayout*> *layoutStack);
  1865. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1866. QStack<QLayout*> *layoutStack);
  1867. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1868. QStack<QLayout*> *layoutStack);
  1869. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1870. QStack<QLayout*> *layoutStack);
  1871. void addSqlQueryViewToLayout(QDomElement element,
  1872. QStack<QWidget*> *widgetStack,
  1873. QStack<QLayout*> *layoutStack);
  1874. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1875. QStack<QLayout*> *layoutStack);
  1876. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  1877. QStack<QLayout*> *layoutStack);
  1878. /*:156*//*202:*/
  1879. #line 5279 "./typica.w"
  1880. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  1881. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  1882. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  1883. QScriptEngine*engine);
  1884. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  1885. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  1886. QScriptEngine*engine);
  1887. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  1888. /*:202*//*203:*/
  1889. #line 5294 "./typica.w"
  1890. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  1891. /*:203*//*207:*/
  1892. #line 5421 "./typica.w"
  1893. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  1894. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  1895. QScriptEngine*engine);
  1896. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  1897. QScriptEngine*engine);
  1898. QScriptValue SaltTable_columnSum(QScriptContext*context,
  1899. QScriptEngine*engine);
  1900. QScriptValue SaltTable_columnArray(QScriptContext*context,
  1901. QScriptEngine*engine);
  1902. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  1903. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  1904. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  1905. QScriptEngine*engine);
  1906. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  1907. /*:207*//*214:*/
  1908. #line 5591 "./typica.w"
  1909. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1910. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  1911. QScriptValue QComboBox_currentData(QScriptContext*context,
  1912. QScriptEngine*engine);
  1913. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  1914. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  1915. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  1916. /*:214*//*242:*/
  1917. #line 6467 "./typica.w"
  1918. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  1919. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1920. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  1921. /*:242*//*251:*/
  1922. #line 6665 "./typica.w"
  1923. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  1924. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  1925. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  1926. /*:251*//*256:*/
  1927. #line 6766 "./typica.w"
  1928. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  1929. /*:256*//*262:*/
  1930. #line 6942 "./typica.w"
  1931. QScriptValue constructLinearCalibrator(QScriptContext*context,
  1932. QScriptEngine*engine);
  1933. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  1934. /*:262*//*267:*/
  1935. #line 7081 "./typica.w"
  1936. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  1937. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  1938. /*:267*//*276:*/
  1939. #line 7263 "./typica.w"
  1940. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  1941. QScriptEngine*engine);
  1942. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1943. /*:276*//*283:*/
  1944. #line 7400 "./typica.w"
  1945. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  1946. QScriptEngine*engine);
  1947. void setMeasurementTimeOffsetProperties(QScriptValue value,
  1948. QScriptEngine*engine);
  1949. /*:283*//*288:*/
  1950. #line 7513 "./typica.w"
  1951. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  1952. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  1953. /*:288*//*293:*/
  1954. #line 7610 "./typica.w"
  1955. QScriptValue constructZeroEmitter(QScriptContext*context,
  1956. QScriptEngine*engine);
  1957. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  1958. /*:293*//*298:*/
  1959. #line 7689 "./typica.w"
  1960. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  1961. QScriptEngine*engine);
  1962. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  1963. /*:298*//*313:*/
  1964. #line 8039 "./typica.w"
  1965. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  1966. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  1967. /*:313*//*335:*/
  1968. #line 8602 "./typica.w"
  1969. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  1970. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  1971. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  1972. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  1973. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  1974. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  1975. QScriptEngine*engine);
  1976. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  1977. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  1978. QScriptEngine*engnie);
  1979. /*:335*//*372:*/
  1980. #line 9527 "./typica.w"
  1981. QScriptValue constructAnnotationButton(QScriptContext*context,
  1982. QScriptEngine*engine);
  1983. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  1984. /*:372*//*380:*/
  1985. #line 9667 "./typica.w"
  1986. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  1987. QScriptEngine*engine);
  1988. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1989. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1990. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  1991. /*:380*//*401:*/
  1992. #line 10090 "./typica.w"
  1993. QScriptValue constructTimerDisplay(QScriptContext*context,
  1994. QScriptEngine*engine);
  1995. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  1996. /*:401*//*428:*/
  1997. #line 10584 "./typica.w"
  1998. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  1999. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2000. QScriptEngine*engine);
  2001. /*:428*//*441:*/
  2002. #line 10867 "./typica.w"
  2003. QScriptValue constructLogEditWindow(QScriptContext*context,
  2004. QScriptEngine*engine);
  2005. /*:441*//*460:*/
  2006. #line 11341 "./typica.w"
  2007. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2008. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2009. /*:460*//*476:*/
  2010. #line 11624 "./typica.w"
  2011. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2012. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*engine);
  2013. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*engine);
  2014. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*engine);
  2015. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*engine);
  2016. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*);
  2017. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2018. QStack<QLayout*> *layoutStack);
  2019. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2020. /*:476*//*531:*/
  2021. #line 12640 "./typica.w"
  2022. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2023. QScriptValue constructSqlQueryView(QScriptContext*context,
  2024. QScriptEngine*engine);
  2025. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2026. QScriptEngine*engine);
  2027. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2028. QScriptEngine*engine);
  2029. /*:531*//*541:*/
  2030. #line 12869 "./typica.w"
  2031. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2032. QStack<QLayout*> *layoutStack);
  2033. /*:541*//*557:*/
  2034. #line 13153 "./typica.w"
  2035. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2036. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2037. /*:557*//*567:*/
  2038. #line 13348 "./typica.w"
  2039. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2040. QStack<QLayout*> *layoutStack);
  2041. /*:567*//*588:*/
  2042. #line 13932 "./typica.w"
  2043. void addScaleControlToLayout(QDomElement element,
  2044. QStack<QWidget*> *widgetStack,
  2045. QStack<QLayout*> *layoutStack);
  2046. void addIntensityControlToLayout(QDomElement element,
  2047. QStack<QWidget*> *widgetStack,
  2048. QStack<QLayout*> *layoutStack);
  2049. /*:588*//*614:*/
  2050. #line 14518 "./typica.w"
  2051. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2052. QScriptEngine*engine);
  2053. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2054. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2055. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2056. QScriptEngine*engine);
  2057. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2058. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2059. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2060. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2061. /*:614*//*620:*/
  2062. #line 14660 "./typica.w"
  2063. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2064. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2065. /*:620*//*635:*/
  2066. #line 14928 "./typica.w"
  2067. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2068. QScriptEngine*engine);
  2069. /*:635*//*710:*/
  2070. #line 17422 "./typica.w"
  2071. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2072. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2073. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2074. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2075. /*:710*/
  2076. #line 756 "./typica.w"
  2077. /*16:*/
  2078. #line 764 "./typica.w"
  2079. /*628:*/
  2080. #line 14781 "./typica.w"
  2081. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2082. const QString&driver,QObject*parent):
  2083. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2084. {
  2085. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2086. }
  2087. void NodeInserter::onTriggered()
  2088. {
  2089. emit triggered(defaultNodeName,driverString);
  2090. }
  2091. /*:628*/
  2092. #line 765 "./typica.w"
  2093. /*217:*/
  2094. #line 5704 "./typica.w"
  2095. Measurement::Measurement(double temperature,QTime time,
  2096. TemperatureUnits sc):
  2097. theTemperature(temperature),theTime(time),unit(sc)
  2098. {
  2099. }
  2100. Measurement::Measurement(double temperature):
  2101. theTemperature(temperature),theTime(QTime::currentTime()),
  2102. unit(Fahrenheit)
  2103. {
  2104. }
  2105. /*:217*//*219:*/
  2106. #line 5732 "./typica.w"
  2107. Measurement::Measurement(const Measurement&x):
  2108. theTemperature(x.temperature()),theTime(x.time()),
  2109. unit(x.unit)
  2110. {
  2111. }
  2112. Measurement::~Measurement()
  2113. {
  2114. }
  2115. /*:219*//*220:*/
  2116. #line 5748 "./typica.w"
  2117. Measurement&Measurement::operator= (Measurement&x)
  2118. {
  2119. theTemperature= x.temperature();
  2120. theTime= x.time();
  2121. unit= x.unit;
  2122. return*this;
  2123. }
  2124. /*:220*//*221:*/
  2125. #line 5762 "./typica.w"
  2126. double Measurement::temperature()const
  2127. {
  2128. return theTemperature;
  2129. }
  2130. QTime Measurement::time()const
  2131. {
  2132. return theTime;
  2133. }
  2134. void Measurement::setTemperature(double temperature)
  2135. {
  2136. theTemperature= temperature;
  2137. }
  2138. void Measurement::setTime(QTime time)
  2139. {
  2140. theTime= time;
  2141. }
  2142. /*:221*//*222:*/
  2143. #line 5788 "./typica.w"
  2144. void Measurement::setUnit(TemperatureUnits scale)
  2145. {
  2146. unit= scale;
  2147. }
  2148. Measurement::TemperatureUnits Measurement::scale()
  2149. {
  2150. return unit;
  2151. }
  2152. /*:222*//*223:*/
  2153. #line 5808 "./typica.w"
  2154. Measurement Measurement::toFahrenheit()
  2155. {
  2156. switch(unit)
  2157. {
  2158. case Celsius:
  2159. return Measurement(this->temperature()*9/5+32,this->time(),
  2160. Fahrenheit);
  2161. break;
  2162. case Kelvin:
  2163. return Measurement(this->temperature()*5/9-459.67,
  2164. this->time(),Fahrenheit);
  2165. break;
  2166. case Rankine:
  2167. return Measurement(this->temperature()-459.67,this->time(),
  2168. Fahrenheit);
  2169. break;
  2170. default:
  2171. return Measurement(this->temperature(),this->time(),Fahrenheit);
  2172. break;
  2173. }
  2174. }
  2175. /*:223*//*224:*/
  2176. #line 5833 "./typica.w"
  2177. Measurement Measurement::toCelsius()
  2178. {
  2179. switch(unit)
  2180. {
  2181. case Fahrenheit:
  2182. return Measurement((this->temperature()-32)*5/9,this->time(),
  2183. Celsius);
  2184. break;
  2185. case Kelvin:
  2186. return Measurement(this->temperature()-273.15,this->time(),
  2187. Celsius);
  2188. break;
  2189. case Rankine:
  2190. return Measurement((this->temperature()-491.67)*5/9,
  2191. this->time(),Celsius);
  2192. break;
  2193. default:
  2194. return Measurement(this->temperature(),this->time(),Celsius);
  2195. break;
  2196. }
  2197. }
  2198. /*:224*//*225:*/
  2199. #line 5859 "./typica.w"
  2200. Measurement Measurement::toKelvin()
  2201. {
  2202. switch(unit)
  2203. {
  2204. case Fahrenheit:
  2205. return Measurement((this->temperature()+459.67)*5/9,
  2206. this->time(),Kelvin);
  2207. break;
  2208. case Celsius:
  2209. return Measurement(this->temperature()+273.15,this->time(),
  2210. Kelvin);
  2211. break;
  2212. case Rankine:
  2213. return Measurement(this->temperature()*5/9,this->time(),
  2214. Kelvin);
  2215. break;
  2216. default:
  2217. return Measurement(this->temperature(),this->time(),Kelvin);
  2218. break;
  2219. }
  2220. }
  2221. /*:225*//*226:*/
  2222. #line 5884 "./typica.w"
  2223. Measurement Measurement::toRankine()
  2224. {
  2225. switch(unit)
  2226. {
  2227. case Fahrenheit:
  2228. return Measurement(this->temperature()+459.67,this->time(),
  2229. Rankine);
  2230. break;
  2231. case Celsius:
  2232. return Measurement((this->temperature()+273.15)*9/5,
  2233. this->time(),Rankine);
  2234. break;
  2235. case Kelvin:
  2236. return Measurement(this->temperature()*9/5,this->time(),
  2237. Rankine);
  2238. break;
  2239. default:
  2240. return Measurement(this->temperature(),this->time(),Rankine);
  2241. break;
  2242. }
  2243. }
  2244. /*:226*/
  2245. #line 766 "./typica.w"
  2246. /*232:*/
  2247. #line 6073 "./typica.w"
  2248. void DAQImplementation::measure()
  2249. {
  2250. int samplesRead= 0;
  2251. double buffer[channels];
  2252. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2253. (unsigned long)(0),buffer,(unsigned long)(channels),
  2254. &samplesRead,(signed long)(0));
  2255. if(error)
  2256. {
  2257. ready= false;
  2258. }
  2259. else
  2260. {
  2261. if(samplesRead)
  2262. {
  2263. QTime time= QTime::currentTime();
  2264. for(int i= 0;i<samplesRead;i++)
  2265. {
  2266. for(int j= 0;j<channels;j++)
  2267. {
  2268. Measurement measure(buffer[j+(i*channels)],time,
  2269. unitMap[j]);
  2270. channelMap[j]->input(measure);
  2271. }
  2272. }
  2273. }
  2274. }
  2275. }
  2276. /*:232*//*233:*/
  2277. #line 6115 "./typica.w"
  2278. void DAQImplementation::run()
  2279. {
  2280. setPriority(QThread::TimeCriticalPriority);
  2281. while(ready)
  2282. {
  2283. measure();
  2284. }
  2285. }
  2286. /*:233*//*234:*/
  2287. #line 6131 "./typica.w"
  2288. void DAQ::threadFinished()
  2289. {
  2290. if(imp->error)
  2291. {
  2292. /*235:*/
  2293. #line 6182 "./typica.w"
  2294. imp->ready= false;
  2295. QMessageBox warning;
  2296. warning.setStandardButtons(QMessageBox::Cancel);
  2297. warning.setIcon(QMessageBox::Warning);
  2298. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2299. unsigned long bytes= imp->errorInfo(NULL,0);
  2300. char string[bytes];
  2301. imp->errorInfo(string,bytes);
  2302. warning.setInformativeText(QString(string));
  2303. warning.setWindowTitle(QString(PROGRAM_NAME));
  2304. warning.exec();
  2305. /*:235*/
  2306. #line 6136 "./typica.w"
  2307. }
  2308. }
  2309. /*:234*//*236:*/
  2310. #line 6207 "./typica.w"
  2311. void DAQ::start()
  2312. {
  2313. if(imp->ready)
  2314. {
  2315. imp->error= imp->startTask(imp->handle);
  2316. if(imp->error)
  2317. {
  2318. /*235:*/
  2319. #line 6182 "./typica.w"
  2320. imp->ready= false;
  2321. QMessageBox warning;
  2322. warning.setStandardButtons(QMessageBox::Cancel);
  2323. warning.setIcon(QMessageBox::Warning);
  2324. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2325. unsigned long bytes= imp->errorInfo(NULL,0);
  2326. char string[bytes];
  2327. imp->errorInfo(string,bytes);
  2328. warning.setInformativeText(QString(string));
  2329. warning.setWindowTitle(QString(PROGRAM_NAME));
  2330. warning.exec();
  2331. /*:235*/
  2332. #line 6215 "./typica.w"
  2333. }
  2334. else
  2335. {
  2336. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2337. imp->start();
  2338. }
  2339. }
  2340. }
  2341. void DAQ::stop()
  2342. {
  2343. if(imp->useBase)
  2344. {
  2345. imp->ready= false;
  2346. imp->wait(ULONG_MAX);
  2347. imp->stopTask(imp->handle);
  2348. }
  2349. else
  2350. {
  2351. imp->ready= false;
  2352. imp->error= imp->stopTask(imp->handle);
  2353. if(imp->error)
  2354. {
  2355. /*235:*/
  2356. #line 6182 "./typica.w"
  2357. imp->ready= false;
  2358. QMessageBox warning;
  2359. warning.setStandardButtons(QMessageBox::Cancel);
  2360. warning.setIcon(QMessageBox::Warning);
  2361. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2362. unsigned long bytes= imp->errorInfo(NULL,0);
  2363. char string[bytes];
  2364. imp->errorInfo(string,bytes);
  2365. warning.setInformativeText(QString(string));
  2366. warning.setWindowTitle(QString(PROGRAM_NAME));
  2367. warning.exec();
  2368. /*:235*/
  2369. #line 6239 "./typica.w"
  2370. }
  2371. imp->error= imp->clearTask(imp->handle);
  2372. if(imp->error)
  2373. {
  2374. /*235:*/
  2375. #line 6182 "./typica.w"
  2376. imp->ready= false;
  2377. QMessageBox warning;
  2378. warning.setStandardButtons(QMessageBox::Cancel);
  2379. warning.setIcon(QMessageBox::Warning);
  2380. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2381. unsigned long bytes= imp->errorInfo(NULL,0);
  2382. char string[bytes];
  2383. imp->errorInfo(string,bytes);
  2384. warning.setInformativeText(QString(string));
  2385. warning.setWindowTitle(QString(PROGRAM_NAME));
  2386. warning.exec();
  2387. /*:235*/
  2388. #line 6244 "./typica.w"
  2389. }
  2390. }
  2391. }
  2392. /*:236*//*237:*/
  2393. #line 6254 "./typica.w"
  2394. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2395. {
  2396. imp->device= device;
  2397. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2398. if(imp->error)
  2399. {
  2400. /*235:*/
  2401. #line 6182 "./typica.w"
  2402. imp->ready= false;
  2403. QMessageBox warning;
  2404. warning.setStandardButtons(QMessageBox::Cancel);
  2405. warning.setIcon(QMessageBox::Warning);
  2406. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2407. unsigned long bytes= imp->errorInfo(NULL,0);
  2408. char string[bytes];
  2409. imp->errorInfo(string,bytes);
  2410. warning.setInformativeText(QString(string));
  2411. warning.setWindowTitle(QString(PROGRAM_NAME));
  2412. warning.exec();
  2413. /*:235*/
  2414. #line 6261 "./typica.w"
  2415. }
  2416. else
  2417. {
  2418. imp->ready= true;
  2419. }
  2420. }
  2421. /*:237*//*238:*/
  2422. #line 6275 "./typica.w"
  2423. Channel*DAQ::newChannel(int units,int thermocouple)
  2424. {
  2425. Channel*retval= new Channel();
  2426. imp->channelMap[imp->channels]= retval;
  2427. imp->unitMap[imp->channels]= (Measurement::TemperatureUnits)units;
  2428. imp->channels++;
  2429. if(imp->ready)
  2430. {
  2431. if(imp->useBase)
  2432. {
  2433. imp->error= imp->createChannel(imp->handle,
  2434. QString("%1/ai%2").arg(imp->device).
  2435. arg(imp->channels-1).
  2436. toAscii().data(),
  2437. "",(double)(-1.0),(double)(100.0),
  2438. (signed long)(units),
  2439. (signed long)(thermocouple),
  2440. (signed long)(10200),(double)(0),
  2441. "");
  2442. }
  2443. else
  2444. {
  2445. imp->error= imp->createChannel(imp->handle,
  2446. QString("%1/ai%2").arg(imp->device).
  2447. arg(imp->channels-1).
  2448. toAscii().data(),
  2449. "",(double)(50.0),(double)(500.0),
  2450. (signed long)(units),
  2451. (signed long)(thermocouple),
  2452. (signed long)(10200),(double)(0),
  2453. "");
  2454. }
  2455. if(imp->error)
  2456. {
  2457. /*235:*/
  2458. #line 6182 "./typica.w"
  2459. imp->ready= false;
  2460. QMessageBox warning;
  2461. warning.setStandardButtons(QMessageBox::Cancel);
  2462. warning.setIcon(QMessageBox::Warning);
  2463. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2464. unsigned long bytes= imp->errorInfo(NULL,0);
  2465. char string[bytes];
  2466. imp->errorInfo(string,bytes);
  2467. warning.setInformativeText(QString(string));
  2468. warning.setWindowTitle(QString(PROGRAM_NAME));
  2469. warning.exec();
  2470. /*:235*/
  2471. #line 6310 "./typica.w"
  2472. }
  2473. }
  2474. return retval;
  2475. }
  2476. /*:238*//*239:*/
  2477. #line 6324 "./typica.w"
  2478. void DAQ::setClockRate(double Hz)
  2479. {
  2480. if(imp->ready)
  2481. {
  2482. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2483. (signed long)(10280),(signed long)(10123),
  2484. (unsigned long long)(1));
  2485. if(imp->error)
  2486. {
  2487. /*235:*/
  2488. #line 6182 "./typica.w"
  2489. imp->ready= false;
  2490. QMessageBox warning;
  2491. warning.setStandardButtons(QMessageBox::Cancel);
  2492. warning.setIcon(QMessageBox::Warning);
  2493. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2494. unsigned long bytes= imp->errorInfo(NULL,0);
  2495. char string[bytes];
  2496. imp->errorInfo(string,bytes);
  2497. warning.setInformativeText(QString(string));
  2498. warning.setWindowTitle(QString(PROGRAM_NAME));
  2499. warning.exec();
  2500. /*:235*/
  2501. #line 6334 "./typica.w"
  2502. }
  2503. }
  2504. }
  2505. /*:239*//*240:*/
  2506. #line 6344 "./typica.w"
  2507. DAQ::~DAQ()
  2508. {
  2509. if(imp->useBase)
  2510. {
  2511. imp->resetDevice(imp->device.toAscii().data());
  2512. imp->clearTask(imp->handle);
  2513. }
  2514. else
  2515. {
  2516. if(imp->ready)
  2517. {
  2518. imp->ready= false;
  2519. imp->wait(ULONG_MAX);
  2520. imp->stopTask(imp->handle);
  2521. imp->resetDevice(imp->device.toAscii().data());
  2522. imp->clearTask(imp->handle);
  2523. }
  2524. }
  2525. delete imp;
  2526. }
  2527. /*:240*//*241:*/
  2528. #line 6375 "./typica.w"
  2529. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2530. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2531. unitMap(4)
  2532. {
  2533. if(driverinfo=="nidaqmxbase")
  2534. {
  2535. useBase= true;
  2536. }
  2537. else
  2538. {
  2539. useBase= false;
  2540. }
  2541. if(useBase)
  2542. {
  2543. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2544. if(!driver.load())
  2545. {
  2546. driver.setFileName("nidaqmxbase");
  2547. if(!driver.load())
  2548. {
  2549. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2550. tr("Failed to find nidaqmxbase. Please install it."));
  2551. QApplication::quit();
  2552. }
  2553. }
  2554. }
  2555. else
  2556. {
  2557. driver.setFileName("nicaiu");
  2558. if(!driver.load())
  2559. {
  2560. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2561. tr("Failed to find nidaqmx. Please install it."));
  2562. QApplication::quit();
  2563. }
  2564. }
  2565. if(useBase)
  2566. {
  2567. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2568. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2569. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2570. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2571. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2572. ==0||
  2573. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2574. 0||
  2575. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2576. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2577. 0||
  2578. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2579. {
  2580. waitForMeasurement= NULL;
  2581. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2582. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2583. QApplication::quit();
  2584. }
  2585. }
  2586. else
  2587. {
  2588. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2589. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2590. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2591. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2592. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2593. ==0||
  2594. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2595. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2596. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2597. 0||
  2598. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2599. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2600. {
  2601. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2602. tr("Failed to link a required symbol in NI-DAQmx."));
  2603. QApplication::quit();
  2604. }
  2605. }
  2606. }
  2607. DAQImplementation::~DAQImplementation()
  2608. {
  2609. driver.unload();
  2610. }
  2611. /*:241*/
  2612. #line 767 "./typica.w"
  2613. /*248:*/
  2614. #line 6577 "./typica.w"
  2615. void FakeDAQImplementation::measure()
  2616. {
  2617. msleep((int)(1000/clockRate));
  2618. QTime time= QTime::currentTime();
  2619. for(int i= 0;i<channels;i++)
  2620. {
  2621. Measurement measure(qrand()%500,time);
  2622. channelMap[i]->input(measure);
  2623. }
  2624. }
  2625. /*:248*//*249:*/
  2626. #line 6591 "./typica.w"
  2627. void FakeDAQImplementation::run()
  2628. {
  2629. setPriority(QThread::TimeCriticalPriority);
  2630. while(ready)
  2631. {
  2632. measure();
  2633. }
  2634. }
  2635. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  2636. channels(0),ready(false),clockRate(1)
  2637. {
  2638. }
  2639. FakeDAQImplementation::~FakeDAQImplementation()
  2640. {
  2641. }
  2642. /*:249*//*250:*/
  2643. #line 6616 "./typica.w"
  2644. void FakeDAQ::start()
  2645. {
  2646. if(imp->ready)
  2647. {
  2648. imp->start();
  2649. }
  2650. }
  2651. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  2652. {
  2653. imp->ready= true;
  2654. }
  2655. Channel*FakeDAQ::newChannel(int,int)
  2656. {
  2657. Channel*retval;
  2658. if(imp->ready)
  2659. {
  2660. retval= new Channel();
  2661. imp->channelMap[imp->channels]= retval;
  2662. imp->channels++;
  2663. }
  2664. else
  2665. {
  2666. return NULL;
  2667. }
  2668. return retval;
  2669. }
  2670. void FakeDAQ::setClockRate(double Hz)
  2671. {
  2672. if(imp->ready)
  2673. {
  2674. imp->clockRate= Hz;
  2675. }
  2676. }
  2677. FakeDAQ::~FakeDAQ()
  2678. {
  2679. imp->ready= false;
  2680. imp->wait(ULONG_MAX);
  2681. delete imp;
  2682. }
  2683. /*:250*/
  2684. #line 768 "./typica.w"
  2685. /*255:*/
  2686. #line 6747 "./typica.w"
  2687. Channel::Channel():QObject(NULL)
  2688. {
  2689. }
  2690. Channel::~Channel()
  2691. {
  2692. }
  2693. void Channel::input(Measurement measurement)
  2694. {
  2695. emit newData(measurement);
  2696. }
  2697. /*:255*/
  2698. #line 769 "./typica.w"
  2699. /*271:*/
  2700. #line 7158 "./typica.w"
  2701. void TemperatureDisplay::setValue(Measurement temperature)
  2702. {
  2703. QString number;
  2704. switch(unit)
  2705. {
  2706. case Auto:
  2707. switch(temperature.scale())
  2708. {
  2709. case Fahrenheit:
  2710. display(QString("%1'F").
  2711. arg(number.setNum(temperature.temperature(),'f',2)));
  2712. break;
  2713. case Celsius:
  2714. display(QString("%1'C").
  2715. arg(number.setNum(temperature.temperature(),'f',2)));
  2716. break;
  2717. case Kelvin:
  2718. display(QString("%1").
  2719. arg(number.setNum(temperature.temperature(),'f',2)));
  2720. break;
  2721. case Rankine:
  2722. display(QString("%1'r").
  2723. arg(number.setNum(temperature.temperature(),'f',2)));
  2724. break;
  2725. }
  2726. break;
  2727. case Fahrenheit:
  2728. display(QString("%1'F").
  2729. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  2730. 2)));
  2731. break;
  2732. case Celsius:
  2733. display(QString("%1'C").
  2734. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  2735. 2)));
  2736. break;
  2737. case Kelvin:
  2738. display(QString("%1").
  2739. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  2740. 2)));
  2741. break;
  2742. case Rankine:
  2743. display(QString("%1'r").
  2744. arg(number.setNum(temperature.toRankine().temperature(),'f',
  2745. 2)));
  2746. break;
  2747. }
  2748. }
  2749. /*:271*//*272:*/
  2750. #line 7218 "./typica.w"
  2751. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  2752. QLCDNumber(8,parent),unit(Auto)
  2753. {
  2754. setSegmentStyle(Filled);
  2755. display("---.--'F");
  2756. }
  2757. /*:272*//*273:*/
  2758. #line 7234 "./typica.w"
  2759. void TemperatureDisplay::invalidate()
  2760. {
  2761. display("---.--'F");
  2762. }
  2763. /*:273*//*274:*/
  2764. #line 7246 "./typica.w"
  2765. void TemperatureDisplay::setDisplayUnits(DisplayUnits scale)
  2766. {
  2767. unit= scale;
  2768. }
  2769. /*:274*//*275:*/
  2770. #line 7254 "./typica.w"
  2771. TemperatureDisplay::~TemperatureDisplay()
  2772. {
  2773. }
  2774. /*:275*/
  2775. #line 770 "./typica.w"
  2776. /*280:*/
  2777. #line 7334 "./typica.w"
  2778. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  2779. {
  2780. if(measure.time()<epoch)
  2781. {
  2782. if(hasPrevious)
  2783. {
  2784. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  2785. epoch.msec());
  2786. QTime jitComp(epoch.hour(),measure.time().minute(),
  2787. measure.time().second(),measure.time().msec());
  2788. int relTime= jitBase.msecsTo(jitComp);
  2789. /*281:*/
  2790. #line 7367 "./typica.w"
  2791. QTime newTime(0,0,0,0);
  2792. newTime= newTime.addMSecs(relTime);
  2793. if(newTime.hour()> 0)
  2794. {
  2795. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2796. }
  2797. Measurement rel(measure.temperature(),newTime);
  2798. emit measurement(rel);
  2799. /*:281*/
  2800. #line 7346 "./typica.w"
  2801. }
  2802. else
  2803. {
  2804. Measurement rel(measure.temperature(),QTime(0,0,0,0));
  2805. emit measurement(rel);
  2806. }
  2807. }
  2808. else
  2809. {
  2810. int relTime= epoch.msecsTo(measure.time());
  2811. /*281:*/
  2812. #line 7367 "./typica.w"
  2813. QTime newTime(0,0,0,0);
  2814. newTime= newTime.addMSecs(relTime);
  2815. if(newTime.hour()> 0)
  2816. {
  2817. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  2818. }
  2819. Measurement rel(measure.temperature(),newTime);
  2820. emit measurement(rel);
  2821. /*:281*/
  2822. #line 7357 "./typica.w"
  2823. }
  2824. hasPrevious= true;
  2825. previous= measure.time();
  2826. }
  2827. /*:280*//*282:*/
  2828. #line 7379 "./typica.w"
  2829. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  2830. previous(0,0,0,0),hasPrevious(false)
  2831. {
  2832. }
  2833. QTime MeasurementTimeOffset::zeroTime()
  2834. {
  2835. return epoch;
  2836. }
  2837. void MeasurementTimeOffset::setZeroTime(QTime zero)
  2838. {
  2839. epoch= zero;
  2840. hasPrevious= false;
  2841. }
  2842. /*:282*/
  2843. #line 771 "./typica.w"
  2844. /*292:*/
  2845. #line 7576 "./typica.w"
  2846. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn),
  2847. temp(0)
  2848. {
  2849. }
  2850. int ZeroEmitter::column()
  2851. {
  2852. return col;
  2853. }
  2854. double ZeroEmitter::lastTemperature()
  2855. {
  2856. return temp;
  2857. }
  2858. void ZeroEmitter::newMeasurement(Measurement measure)
  2859. {
  2860. temp= measure.temperature();
  2861. }
  2862. void ZeroEmitter::setColumn(int column)
  2863. {
  2864. col= column;
  2865. }
  2866. void ZeroEmitter::emitZero()
  2867. {
  2868. emit measurement(Measurement(temp,QTime(0,0,0,0)),col);
  2869. }
  2870. /*:292*/
  2871. #line 772 "./typica.w"
  2872. /*297:*/
  2873. #line 7666 "./typica.w"
  2874. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  2875. {
  2876. }
  2877. int MeasurementAdapter::column()
  2878. {
  2879. return col;
  2880. }
  2881. void MeasurementAdapter::newMeasurement(Measurement measure)
  2882. {
  2883. emit measurement(measure,col);
  2884. }
  2885. void MeasurementAdapter::setColumn(int column)
  2886. {
  2887. col= column;
  2888. }
  2889. /*:297*/
  2890. #line 773 "./typica.w"
  2891. /*302:*/
  2892. #line 7782 "./typica.w"
  2893. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  2894. theScene(new QGraphicsScene),
  2895. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  2896. prevPoints(new QMap<int,QPointF> ),
  2897. translations(new QMap<int,double> ),
  2898. gridLinesF(new QList<QGraphicsItem*> ),
  2899. gridLinesC(new QList<QGraphicsItem*> )
  2900. {
  2901. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2902. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  2903. setScene(theScene);
  2904. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  2905. /*303:*/
  2906. #line 7810 "./typica.w"
  2907. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  2908. tempaxis->setLine(-10,-500,-10,0);
  2909. theScene->addItem(tempaxis);
  2910. QGraphicsLineItem*gridLine;
  2911. QGraphicsTextItem*label;
  2912. for(int y= -100;y> -600;y-= 100)
  2913. {
  2914. gridLine= new QGraphicsLineItem;
  2915. gridLine->setLine(0,y,1200,y);
  2916. theScene->addItem(gridLine);
  2917. label= new QGraphicsTextItem;
  2918. label->setHtml(QString("%1&deg;F").arg(-y));
  2919. label->setPos(-55,y-(label->boundingRect().height()/2));
  2920. theScene->addItem(label);
  2921. gridLinesF->append(gridLine);
  2922. gridLinesF->append(label);
  2923. }
  2924. for(int degC= 50;degC<=250;degC+= 50)
  2925. {
  2926. gridLine= new QGraphicsLineItem;
  2927. int y= -(degC*(9.0/5.0)+32);
  2928. gridLine->setLine(0,y,1200,y);
  2929. gridLine->hide();
  2930. theScene->addItem(gridLine);
  2931. gridLinesC->append(gridLine);
  2932. label= new QGraphicsTextItem;
  2933. label->setHtml(QString("%1&deg;C").arg(degC));
  2934. label->setPos(-55,y-(label->boundingRect().height()/2));
  2935. label->hide();
  2936. theScene->addItem(label);
  2937. gridLinesC->append(label);
  2938. }
  2939. /*:303*/
  2940. #line 7795 "./typica.w"
  2941. ;
  2942. /*305:*/
  2943. #line 7876 "./typica.w"
  2944. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  2945. timeaxis->setLine(0,10,1200,10);
  2946. theScene->addItem(timeaxis);
  2947. for(int x= 0;x<1201;x+= 120)
  2948. {
  2949. QGraphicsLineItem*tick= new QGraphicsLineItem;
  2950. tick->setLine(x,0,x,20);
  2951. theScene->addItem(tick);
  2952. QGraphicsTextItem*label= new QGraphicsTextItem;
  2953. label->setPlainText(QString("%1").arg(x/60));
  2954. label->setPos(x-(label->boundingRect().width()/2),20);
  2955. theScene->addItem(label);
  2956. }
  2957. /*:305*/
  2958. #line 7796 "./typica.w"
  2959. ;
  2960. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2961. }
  2962. /*:302*//*304:*/
  2963. #line 7846 "./typica.w"
  2964. void GraphView::showF()
  2965. {
  2966. for(int i= 0;i<gridLinesF->size();i++)
  2967. {
  2968. gridLinesF->at(i)->show();
  2969. }
  2970. for(int i= 0;i<gridLinesC->size();i++)
  2971. {
  2972. gridLinesC->at(i)->hide();
  2973. }
  2974. }
  2975. void GraphView::showC()
  2976. {
  2977. for(int i= 0;i<gridLinesF->size();i++)
  2978. {
  2979. gridLinesF->at(i)->hide();
  2980. }
  2981. for(int i= 0;i<gridLinesC->size();i++)
  2982. {
  2983. gridLinesC->at(i)->show();
  2984. }
  2985. }
  2986. /*:304*//*306:*/
  2987. #line 7895 "./typica.w"
  2988. void GraphView::resizeEvent(QResizeEvent*)
  2989. {
  2990. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  2991. }
  2992. /*:306*//*307:*/
  2993. #line 7906 "./typica.w"
  2994. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  2995. {
  2996. double offset= 0;
  2997. if(translations->contains(tempcolumn))
  2998. {
  2999. offset= translations->value(tempcolumn);
  3000. }
  3001. if(prevPoints->contains(tempcolumn))
  3002. {
  3003. /*309:*/
  3004. #line 7965 "./typica.w"
  3005. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3006. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3007. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3008. -(prevPoints->value(tempcolumn).y()),
  3009. nextPoint.x()+offset,-(nextPoint.y()));
  3010. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3011. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3012. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3013. Qt::darkYellow};
  3014. segment->setPen(p[tempcolumn%12]);
  3015. theScene->addItem(segment);
  3016. prevPoints->insert(tempcolumn,nextPoint);
  3017. /*:309*/
  3018. #line 7916 "./typica.w"
  3019. if(graphLines->contains(tempcolumn))
  3020. {
  3021. graphLines->value(tempcolumn)->append(segment);
  3022. }
  3023. else
  3024. {
  3025. QList<QGraphicsLineItem*> *newLine=
  3026. new QList<QGraphicsLineItem*> ;
  3027. newLine->append(segment);
  3028. graphLines->insert(tempcolumn,newLine);
  3029. }
  3030. }
  3031. else
  3032. {
  3033. /*308:*/
  3034. #line 7954 "./typica.w"
  3035. int x= FULLTIMETOINT(measure.time())/1000;
  3036. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3037. /*:308*/
  3038. #line 7933 "./typica.w"
  3039. }
  3040. }
  3041. /*:307*//*310:*/
  3042. #line 7982 "./typica.w"
  3043. void GraphView::clear()
  3044. {
  3045. int i;
  3046. foreach(i,prevPoints->keys())
  3047. {
  3048. removeSeries(i);
  3049. }
  3050. translations->clear();
  3051. }
  3052. /*:310*//*311:*/
  3053. #line 7996 "./typica.w"
  3054. void GraphView::removeSeries(int column)
  3055. {
  3056. if(graphLines->contains(column))
  3057. {
  3058. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3059. QGraphicsLineItem*segment;
  3060. foreach(segment,*series)
  3061. {
  3062. theScene->removeItem(segment);
  3063. }
  3064. qDeleteAll(*series);
  3065. }
  3066. graphLines->remove(column);
  3067. prevPoints->remove(column);
  3068. }
  3069. /*:311*//*312:*/
  3070. #line 8015 "./typica.w"
  3071. void GraphView::setSeriesTranslation(int column,double offset)
  3072. {
  3073. if(graphLines->contains(column))
  3074. {
  3075. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3076. QGraphicsLineItem*segment;
  3077. foreach(segment,*series)
  3078. {
  3079. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3080. }
  3081. }
  3082. if(translations->contains(column))
  3083. {
  3084. translations->insert(column,offset+translations->value(column));
  3085. }
  3086. else
  3087. {
  3088. translations->insert(column,offset);
  3089. }
  3090. }
  3091. /*:312*/
  3092. #line 774 "./typica.w"
  3093. /*318:*/
  3094. #line 8165 "./typica.w"
  3095. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3096. {
  3097. model_ms->newMeasurement(measure,tempcolumn);
  3098. if(lastMeasurement.contains(tempcolumn))
  3099. {
  3100. if(measure.time().second()!=
  3101. lastMeasurement.value(tempcolumn).time().second())
  3102. {
  3103. Measurement adjusted(measure.temperature(),
  3104. QTime(0,measure.time().minute(),
  3105. measure.time().second(),0));
  3106. model_1s->newMeasurement(adjusted,tempcolumn);
  3107. if(adjusted.time().second()%5==0)
  3108. {
  3109. model_5s->newMeasurement(adjusted,tempcolumn);
  3110. if(adjusted.time().second()%10==0)
  3111. {
  3112. model_10s->newMeasurement(adjusted,tempcolumn);
  3113. }
  3114. if(adjusted.time().second()%15==0)
  3115. {
  3116. model_15s->newMeasurement(adjusted,tempcolumn);
  3117. if(adjusted.time().second()%30==0)
  3118. {
  3119. model_30s->newMeasurement(adjusted,tempcolumn);
  3120. if(adjusted.time().second()==0)
  3121. {
  3122. model_1m->newMeasurement(adjusted,tempcolumn);
  3123. }
  3124. }
  3125. }
  3126. }
  3127. }
  3128. /*321:*/
  3129. #line 8243 "./typica.w"
  3130. if(currentColumnSet.contains(tempcolumn))
  3131. {
  3132. int replicationcolumn;
  3133. foreach(replicationcolumn,currentColumnSet)
  3134. {
  3135. if(replicationcolumn!=tempcolumn)
  3136. {
  3137. if(lastMeasurement.contains(replicationcolumn))
  3138. {
  3139. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3140. {
  3141. Measurement synthetic(lastMeasurement.value(replicationcolumn).temperature(),
  3142. measure.time());
  3143. model_ms->newMeasurement(synthetic,replicationcolumn);
  3144. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3145. {
  3146. Measurement adjusted(synthetic.temperature(),QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3147. model_1s->newMeasurement(adjusted,replicationcolumn);
  3148. if(adjusted.time().second()%5==0)
  3149. {
  3150. model_5s->newMeasurement(adjusted,replicationcolumn);
  3151. if(adjusted.time().second()%10==0)
  3152. {
  3153. model_10s->newMeasurement(adjusted,replicationcolumn);
  3154. }
  3155. if(adjusted.time().second()%15==0)
  3156. {
  3157. model_15s->newMeasurement(adjusted,replicationcolumn);
  3158. if(adjusted.time().second()%30==0)
  3159. {
  3160. model_30s->newMeasurement(adjusted,replicationcolumn);
  3161. if(adjusted.time().second()==0)
  3162. {
  3163. model_1m->newMeasurement(adjusted,replicationcolumn);
  3164. }
  3165. }
  3166. }
  3167. }
  3168. }
  3169. lastMeasurement[replicationcolumn]= synthetic;
  3170. }
  3171. }
  3172. }
  3173. }
  3174. }
  3175. /*:321*/
  3176. #line 8199 "./typica.w"
  3177. }
  3178. else
  3179. {
  3180. /*319:*/
  3181. #line 8211 "./typica.w"
  3182. MeasurementModel*m;
  3183. foreach(m,modelSet)
  3184. {
  3185. m->newMeasurement(measure,tempcolumn);
  3186. }
  3187. /*:319*/
  3188. #line 8203 "./typica.w"
  3189. }
  3190. lastMeasurement[tempcolumn]= measure;
  3191. }
  3192. /*:318*//*320:*/
  3193. #line 8229 "./typica.w"
  3194. void ZoomLog::addToCurrentColumnSet(int column)
  3195. {
  3196. currentColumnSet.append(column);
  3197. }
  3198. void ZoomLog::clearCurrentColumnSet()
  3199. {
  3200. currentColumnSet.clear();
  3201. }
  3202. /*:320*//*322:*/
  3203. #line 8312 "./typica.w"
  3204. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3205. int annotationcolumn)
  3206. {
  3207. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3208. MeasurementModel*m;
  3209. if(lastMeasurement.contains(tempcolumn))
  3210. {
  3211. foreach(m,modelSet)
  3212. {
  3213. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3214. }
  3215. }
  3216. foreach(m,modelSet)
  3217. {
  3218. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3219. }
  3220. }
  3221. /*:322*//*323:*/
  3222. #line 8336 "./typica.w"
  3223. void ZoomLog::centerOn(int row)
  3224. {
  3225. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  3226. }
  3227. /*:323*//*324:*/
  3228. #line 8346 "./typica.w"
  3229. void ZoomLog::clear()
  3230. {
  3231. MeasurementModel*m;
  3232. foreach(m,modelSet)
  3233. {
  3234. m->clear();
  3235. }
  3236. lastMeasurement.clear();
  3237. saveTempCols.clear();
  3238. saveNoteCols.clear();
  3239. }
  3240. /*:324*//*325:*/
  3241. #line 8363 "./typica.w"
  3242. QVariant ZoomLog::data(int row,int column)const
  3243. {
  3244. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  3245. Qt::DisplayRole);
  3246. }
  3247. int ZoomLog::rowCount()
  3248. {
  3249. return model_ms->rowCount();
  3250. }
  3251. /*:325*//*326:*/
  3252. #line 8386 "./typica.w"
  3253. bool ZoomLog::saveXML(QIODevice*device)
  3254. {
  3255. int prevUnits= model_ms->displayUnits();
  3256. if(prevUnits!=10144)
  3257. {
  3258. model_ms->setDisplayUnits(10144);
  3259. }
  3260. XMLOutput writer(model_ms,device,0);
  3261. int c;
  3262. foreach(c,saveTempCols)
  3263. {
  3264. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3265. toString(),c);
  3266. }
  3267. foreach(c,saveNoteCols)
  3268. {
  3269. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3270. toString(),c);
  3271. }
  3272. bool retval= writer.output();
  3273. if(prevUnits!=10144)
  3274. {
  3275. model_ms->setDisplayUnits(prevUnits);
  3276. }
  3277. return retval;
  3278. }
  3279. /*:326*//*327:*/
  3280. #line 8417 "./typica.w"
  3281. bool ZoomLog::saveCSV(QIODevice*device)
  3282. {
  3283. CSVOutput writer(currentModel,device,0);
  3284. int c;
  3285. foreach(c,saveTempCols)
  3286. {
  3287. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  3288. toString(),c);
  3289. }
  3290. foreach(c,saveNoteCols)
  3291. {
  3292. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  3293. toString(),c);
  3294. }
  3295. return writer.output();
  3296. }
  3297. /*:327*//*328:*/
  3298. #line 8441 "./typica.w"
  3299. void ZoomLog::switchLOD(MeasurementModel*m)
  3300. {
  3301. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  3302. setModel(m);
  3303. currentModel= m;
  3304. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3305. }
  3306. void ZoomLog::LOD_ms()
  3307. {
  3308. switchLOD(model_ms);
  3309. }
  3310. void ZoomLog::LOD_1s()
  3311. {
  3312. switchLOD(model_1s);
  3313. }
  3314. void ZoomLog::LOD_5s()
  3315. {
  3316. switchLOD(model_5s);
  3317. }
  3318. void ZoomLog::LOD_10s()
  3319. {
  3320. switchLOD(model_10s);
  3321. }
  3322. void ZoomLog::LOD_15s()
  3323. {
  3324. switchLOD(model_15s);
  3325. }
  3326. void ZoomLog::LOD_30s()
  3327. {
  3328. switchLOD(model_30s);
  3329. }
  3330. void ZoomLog::LOD_1m()
  3331. {
  3332. switchLOD(model_1m);
  3333. }
  3334. /*:328*//*329:*/
  3335. #line 8489 "./typica.w"
  3336. void ZoomLog::setDisplayUnits(int scale)
  3337. {
  3338. model_ms->setDisplayUnits(scale);
  3339. model_1s->setDisplayUnits(scale);
  3340. model_5s->setDisplayUnits(scale);
  3341. model_10s->setDisplayUnits(scale);
  3342. model_15s->setDisplayUnits(scale);
  3343. model_30s->setDisplayUnits(scale);
  3344. model_1m->setDisplayUnits(scale);
  3345. }
  3346. int ZoomLog::displayUnits()
  3347. {
  3348. return model_ms->displayUnits();
  3349. }
  3350. /*:329*//*330:*/
  3351. #line 8509 "./typica.w"
  3352. QString ZoomLog::lastTime(int series)
  3353. {
  3354. Measurement measure= lastMeasurement.value(series);
  3355. QTime time= measure.time();
  3356. return time.toString("h:mm:ss.zzz");
  3357. }
  3358. /*:330*//*331:*/
  3359. #line 8519 "./typica.w"
  3360. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  3361. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  3362. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  3363. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  3364. {
  3365. setEditTriggers(QAbstractItemView::NoEditTriggers);
  3366. setSelectionMode(QAbstractItemView::NoSelection);
  3367. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  3368. model_30s<<model_1m;
  3369. currentModel= model_30s;
  3370. setModel(currentModel);
  3371. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  3372. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  3373. this,SLOT(persistColumnResize(int,int,int)));
  3374. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  3375. this,SLOT(restoreColumnWidths()));
  3376. }
  3377. /*:331*//*332:*/
  3378. #line 8542 "./typica.w"
  3379. void ZoomLog::setHeaderData(int section,QString text)
  3380. {
  3381. MeasurementModel*m;
  3382. foreach(m,modelSet)
  3383. {
  3384. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  3385. }
  3386. }
  3387. /*:332*//*333:*/
  3388. #line 8556 "./typica.w"
  3389. void ZoomLog::addOutputTemperatureColumn(int column)
  3390. {
  3391. saveTempCols.append(column);
  3392. }
  3393. void ZoomLog::addOutputAnnotationColumn(int column)
  3394. {
  3395. saveNoteCols.append(column);
  3396. }
  3397. void ZoomLog::clearOutputColumns()
  3398. {
  3399. saveTempCols.clear();
  3400. saveNoteCols.clear();
  3401. }
  3402. /*:333*//*334:*/
  3403. #line 8576 "./typica.w"
  3404. void ZoomLog::persistColumnResize(int column,int,int newsize)
  3405. {
  3406. /*524:*/
  3407. #line 12554 "./typica.w"
  3408. QSettings settings;
  3409. /*525:*/
  3410. #line 12567 "./typica.w"
  3411. QWidget*topLevelWidget= this;
  3412. while(topLevelWidget->parentWidget())
  3413. {
  3414. topLevelWidget= topLevelWidget->parentWidget();
  3415. }
  3416. /*:525*/
  3417. #line 12556 "./typica.w"
  3418. settings.setValue(QString("columnWidths/%1/%2/%3").
  3419. arg(topLevelWidget->objectName()).
  3420. arg(objectName()).arg(column),
  3421. QVariant(newsize));
  3422. /*:524*/
  3423. #line 8579 "./typica.w"
  3424. }
  3425. void ZoomLog::restoreColumnWidths()
  3426. {
  3427. /*527:*/
  3428. #line 12587 "./typica.w"
  3429. QSettings settings;
  3430. /*525:*/
  3431. #line 12567 "./typica.w"
  3432. QWidget*topLevelWidget= this;
  3433. while(topLevelWidget->parentWidget())
  3434. {
  3435. topLevelWidget= topLevelWidget->parentWidget();
  3436. }
  3437. /*:525*/
  3438. #line 12589 "./typica.w"
  3439. QString baseKey=
  3440. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3441. arg(objectName());
  3442. for(int i= 0;i<model()->columnCount();i++)
  3443. {
  3444. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3445. if(settings.contains(key))
  3446. {
  3447. setColumnWidth(i,settings.value(key).toInt());
  3448. }
  3449. }
  3450. /*:527*/
  3451. #line 8584 "./typica.w"
  3452. }
  3453. void ZoomLog::setVisible(bool visibility)
  3454. {
  3455. QTableView::setVisible(visibility);
  3456. }
  3457. void ZoomLog::showEvent(QShowEvent*)
  3458. {
  3459. /*527:*/
  3460. #line 12587 "./typica.w"
  3461. QSettings settings;
  3462. /*525:*/
  3463. #line 12567 "./typica.w"
  3464. QWidget*topLevelWidget= this;
  3465. while(topLevelWidget->parentWidget())
  3466. {
  3467. topLevelWidget= topLevelWidget->parentWidget();
  3468. }
  3469. /*:525*/
  3470. #line 12589 "./typica.w"
  3471. QString baseKey=
  3472. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  3473. arg(objectName());
  3474. for(int i= 0;i<model()->columnCount();i++)
  3475. {
  3476. QString key= QString("%1/%2").arg(baseKey).arg(i);
  3477. if(settings.contains(key))
  3478. {
  3479. setColumnWidth(i,settings.value(key).toInt());
  3480. }
  3481. }
  3482. /*:527*/
  3483. #line 8594 "./typica.w"
  3484. }
  3485. /*:334*/
  3486. #line 775 "./typica.w"
  3487. /*342:*/
  3488. #line 8816 "./typica.w"
  3489. bool MeasurementList::operator<(const MeasurementList&other)const
  3490. {
  3491. return this->first().toTime()<other.first().toTime();
  3492. }
  3493. bool MeasurementList::operator==(const MeasurementList&other)const
  3494. {
  3495. return this->first().toTime()==other.first().toTime();
  3496. }
  3497. /*:342*//*343:*/
  3498. #line 8832 "./typica.w"
  3499. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  3500. {
  3501. return QModelIndex();
  3502. }
  3503. /*:343*//*344:*/
  3504. #line 8842 "./typica.w"
  3505. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  3506. {
  3507. MeasurementList*temp;
  3508. temp= new MeasurementList;
  3509. temp->append(QVariant(measure.time()));
  3510. /*345:*/
  3511. #line 8893 "./typica.w"
  3512. /*346:*/
  3513. #line 8938 "./typica.w"
  3514. QList<MeasurementList*> ::iterator i= lastInsertion;
  3515. bool quickscan= false;
  3516. if(entries->size()> 5)
  3517. {
  3518. if(**i<*temp)
  3519. {
  3520. i+= 1;
  3521. for(int j= 10;j> 0;j--)
  3522. {
  3523. if(i!=entries->end())
  3524. {
  3525. if(**i<*temp)
  3526. {
  3527. i+= 1;
  3528. }
  3529. else
  3530. {
  3531. quickscan= true;
  3532. break;
  3533. }
  3534. }
  3535. else
  3536. {
  3537. quickscan= true;
  3538. break;
  3539. }
  3540. }
  3541. }
  3542. else
  3543. {
  3544. if(**i==*temp)
  3545. {
  3546. quickscan= true;
  3547. }
  3548. }
  3549. }
  3550. /*:346*/
  3551. #line 8894 "./typica.w"
  3552. if(quickscan==false)
  3553. {
  3554. i= entries->begin();
  3555. QList<MeasurementList*> ::iterator u= entries->end();
  3556. QList<MeasurementList*> ::iterator midpoint;
  3557. int n= u-i;
  3558. int rA;
  3559. while(n> 0)
  3560. {
  3561. rA= n>>1;
  3562. midpoint= i+rA;
  3563. if(**midpoint<*temp)
  3564. {
  3565. i= midpoint+1;
  3566. n-= rA+1;
  3567. }
  3568. else
  3569. {
  3570. n= rA;
  3571. }
  3572. }
  3573. }
  3574. /*:345*/
  3575. #line 8848 "./typica.w"
  3576. MeasurementList*newEntry;
  3577. int insertion;
  3578. if(i!=entries->end())
  3579. {
  3580. insertion= entries->indexOf(*i);
  3581. if((*i)->first().toTime()==measure.time())
  3582. {
  3583. /*347:*/
  3584. #line 8980 "./typica.w"
  3585. if((*i)->size()<tempcolumn+1)
  3586. {
  3587. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  3588. {
  3589. (*i)->append(QVariant());
  3590. }
  3591. }
  3592. (*i)->replace(tempcolumn,measure.temperature());
  3593. lastInsertion= i;
  3594. emit dataChanged(createIndex(insertion,tempcolumn),
  3595. createIndex(insertion,tempcolumn));
  3596. lastTemperature->insert(tempcolumn,insertion);
  3597. /*:347*/
  3598. #line 8856 "./typica.w"
  3599. }
  3600. else
  3601. {
  3602. /*348:*/
  3603. #line 8998 "./typica.w"
  3604. beginInsertRows(QModelIndex(),insertion,insertion);
  3605. newEntry= new MeasurementList;
  3606. newEntry->append(QVariant(measure.time()));
  3607. for(int j= 0;j<tempcolumn+1;j++)
  3608. {
  3609. newEntry->append(QVariant());
  3610. }
  3611. newEntry->replace(tempcolumn,measure.temperature());
  3612. lastInsertion= entries->insert(i,newEntry);
  3613. endInsertRows();
  3614. lastTemperature->insert(tempcolumn,insertion);
  3615. /*:348*/
  3616. #line 8860 "./typica.w"
  3617. }
  3618. }
  3619. else
  3620. {
  3621. /*349:*/
  3622. #line 9016 "./typica.w"
  3623. insertion= entries->size();
  3624. /*348:*/
  3625. #line 8998 "./typica.w"
  3626. beginInsertRows(QModelIndex(),insertion,insertion);
  3627. newEntry= new MeasurementList;
  3628. newEntry->append(QVariant(measure.time()));
  3629. for(int j= 0;j<tempcolumn+1;j++)
  3630. {
  3631. newEntry->append(QVariant());
  3632. }
  3633. newEntry->replace(tempcolumn,measure.temperature());
  3634. lastInsertion= entries->insert(i,newEntry);
  3635. endInsertRows();
  3636. lastTemperature->insert(tempcolumn,insertion);
  3637. /*:348*/
  3638. #line 9018 "./typica.w"
  3639. /*:349*/
  3640. #line 8865 "./typica.w"
  3641. }
  3642. if(tempcolumn>=colcount)
  3643. {
  3644. colcount= tempcolumn+1;
  3645. }
  3646. emit rowChanged(insertion);
  3647. delete temp;
  3648. }
  3649. /*:344*//*350:*/
  3650. #line 9027 "./typica.w"
  3651. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  3652. int annotationColumn)
  3653. {
  3654. int r;
  3655. if(lastTemperature->contains(tempcolumn))
  3656. {
  3657. r= lastTemperature->value(tempcolumn);
  3658. }
  3659. else
  3660. {
  3661. r= 0;
  3662. }
  3663. if(r==0&&entries->size()==0)
  3664. {
  3665. /*351:*/
  3666. #line 9065 "./typica.w"
  3667. beginInsertRows(QModelIndex(),0,0);
  3668. MeasurementList*newEntry= new MeasurementList;
  3669. newEntry->append(QVariant(QTime(0,0,0,0)));
  3670. entries->append(newEntry);
  3671. endInsertRows();
  3672. /*:351*/
  3673. #line 9042 "./typica.w"
  3674. }
  3675. MeasurementList*row= entries->at(r);
  3676. if(row->size()<=annotationColumn)
  3677. {
  3678. for(int i= row->size()-1;i<annotationColumn+1;i++)
  3679. {
  3680. row->append(QVariant());
  3681. }
  3682. }
  3683. row->replace(annotationColumn,annotation);
  3684. emit dataChanged(createIndex(r,annotationColumn),
  3685. createIndex(r,annotationColumn));
  3686. emit rowChanged(r);
  3687. if(annotationColumn> colcount-1)
  3688. {
  3689. colcount= annotationColumn+1;
  3690. }
  3691. }
  3692. /*:350*//*352:*/
  3693. #line 9076 "./typica.w"
  3694. void MeasurementModel::clear()
  3695. {
  3696. beginRemoveRows(QModelIndex(),0,entries->size());
  3697. while(entries->size()!=0)
  3698. {
  3699. MeasurementList*row= entries->takeFirst();
  3700. delete row;
  3701. }
  3702. endRemoveRows();
  3703. colcount= hData->size();
  3704. lastTemperature->clear();
  3705. reset();
  3706. }
  3707. /*:352*//*353:*/
  3708. #line 9102 "./typica.w"
  3709. bool MeasurementModel::setData(const QModelIndex&index,
  3710. const QVariant&value,int role)
  3711. {
  3712. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  3713. {
  3714. return false;
  3715. }
  3716. /*354:*/
  3717. #line 9134 "./typica.w"
  3718. bool valid= false;
  3719. if(index.isValid())
  3720. {
  3721. if(index.row()<entries->size())
  3722. {
  3723. if(index.column()<colcount)
  3724. {
  3725. valid= true;
  3726. }
  3727. }
  3728. }
  3729. /*:354*/
  3730. #line 9110 "./typica.w"
  3731. if(!valid)
  3732. {
  3733. return false;
  3734. }
  3735. MeasurementList*row= entries->at(index.row());
  3736. if(index.column()>=row->size())
  3737. {
  3738. /*355:*/
  3739. #line 9151 "./typica.w"
  3740. for(int i= row->size()-1;i<index.column();i++)
  3741. {
  3742. row->append(QVariant());
  3743. }
  3744. /*:355*/
  3745. #line 9118 "./typica.w"
  3746. }
  3747. if(index.column()==0)
  3748. {
  3749. /*356:*/
  3750. #line 9166 "./typica.w"
  3751. QTime time;
  3752. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  3753. {
  3754. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  3755. {
  3756. return false;
  3757. }
  3758. }
  3759. row= entries->takeAt(index.row());
  3760. row->replace(index.column(),QVariant(time));
  3761. MeasurementList*temp= row;
  3762. /*345:*/
  3763. #line 8893 "./typica.w"
  3764. /*346:*/
  3765. #line 8938 "./typica.w"
  3766. QList<MeasurementList*> ::iterator i= lastInsertion;
  3767. bool quickscan= false;
  3768. if(entries->size()> 5)
  3769. {
  3770. if(**i<*temp)
  3771. {
  3772. i+= 1;
  3773. for(int j= 10;j> 0;j--)
  3774. {
  3775. if(i!=entries->end())
  3776. {
  3777. if(**i<*temp)
  3778. {
  3779. i+= 1;
  3780. }
  3781. else
  3782. {
  3783. quickscan= true;
  3784. break;
  3785. }
  3786. }
  3787. else
  3788. {
  3789. quickscan= true;
  3790. break;
  3791. }
  3792. }
  3793. }
  3794. else
  3795. {
  3796. if(**i==*temp)
  3797. {
  3798. quickscan= true;
  3799. }
  3800. }
  3801. }
  3802. /*:346*/
  3803. #line 8894 "./typica.w"
  3804. if(quickscan==false)
  3805. {
  3806. i= entries->begin();
  3807. QList<MeasurementList*> ::iterator u= entries->end();
  3808. QList<MeasurementList*> ::iterator midpoint;
  3809. int n= u-i;
  3810. int rA;
  3811. while(n> 0)
  3812. {
  3813. rA= n>>1;
  3814. midpoint= i+rA;
  3815. if(**midpoint<*temp)
  3816. {
  3817. i= midpoint+1;
  3818. n-= rA+1;
  3819. }
  3820. else
  3821. {
  3822. n= rA;
  3823. }
  3824. }
  3825. }
  3826. /*:345*/
  3827. #line 9178 "./typica.w"
  3828. entries->insert(i,row);
  3829. int newRow= entries->indexOf(*i);
  3830. if(newRow<index.row())
  3831. {
  3832. emit dataChanged(createIndex(newRow,index.column()),index);
  3833. }
  3834. else
  3835. {
  3836. emit dataChanged(index,createIndex(newRow,index.column()));
  3837. }
  3838. /*:356*/
  3839. #line 9122 "./typica.w"
  3840. }
  3841. else
  3842. {
  3843. /*357:*/
  3844. #line 9192 "./typica.w"
  3845. row->replace(index.column(),value);
  3846. emit dataChanged(index,index);
  3847. /*:357*/
  3848. #line 9126 "./typica.w"
  3849. }
  3850. return true;
  3851. }
  3852. /*:353*//*358:*/
  3853. #line 9200 "./typica.w"
  3854. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  3855. unit(Fahrenheit),hData(new QStringList),
  3856. lastTemperature(new QHash<int,int> )
  3857. {
  3858. colcount= 1;
  3859. entries= new QList<MeasurementList*> ;
  3860. lastInsertion= entries->begin();
  3861. hData->append(tr("Time"));
  3862. }
  3863. /*:358*//*359:*/
  3864. #line 9213 "./typica.w"
  3865. MeasurementModel::~MeasurementModel()
  3866. {
  3867. clear();
  3868. delete entries;
  3869. delete hData;
  3870. }
  3871. /*:359*//*360:*/
  3872. #line 9225 "./typica.w"
  3873. int MeasurementModel::rowCount(const QModelIndex&parent)const
  3874. {
  3875. if(parent==QModelIndex())
  3876. {
  3877. return entries->size();
  3878. }
  3879. return 0;
  3880. }
  3881. int MeasurementModel::columnCount(const QModelIndex&parent)const
  3882. {
  3883. if(parent==QModelIndex())
  3884. {
  3885. return colcount;
  3886. }
  3887. return 0;
  3888. }
  3889. /*:360*//*361:*/
  3890. #line 9252 "./typica.w"
  3891. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  3892. const QVariant&value,int)
  3893. {
  3894. if(orientation==Qt::Horizontal)
  3895. {
  3896. if(hData->size()<section+1)
  3897. {
  3898. for(int i= hData->size();i<section+1;i++)
  3899. {
  3900. if(colcount<i)
  3901. {
  3902. beginInsertColumns(QModelIndex(),i,i);
  3903. }
  3904. hData->append(QString());
  3905. if(colcount<i)
  3906. {
  3907. endInsertColumns();
  3908. }
  3909. }
  3910. }
  3911. hData->replace(section,value.toString());
  3912. emit headerDataChanged(orientation,section,section);
  3913. if(colcount<section+1)
  3914. {
  3915. colcount= section+1;
  3916. }
  3917. return true;
  3918. }
  3919. return false;
  3920. }
  3921. /*:361*//*362:*/
  3922. #line 9292 "./typica.w"
  3923. void MeasurementModel::setDisplayUnits(int scale)
  3924. {
  3925. beginResetModel();
  3926. unit= scale;
  3927. endResetModel();
  3928. }
  3929. int MeasurementModel::displayUnits()
  3930. {
  3931. return unit;
  3932. }
  3933. /*:362*//*363:*/
  3934. #line 9316 "./typica.w"
  3935. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  3936. {
  3937. /*354:*/
  3938. #line 9134 "./typica.w"
  3939. bool valid= false;
  3940. if(index.isValid())
  3941. {
  3942. if(index.row()<entries->size())
  3943. {
  3944. if(index.column()<colcount)
  3945. {
  3946. valid= true;
  3947. }
  3948. }
  3949. }
  3950. /*:354*/
  3951. #line 9319 "./typica.w"
  3952. if(!valid)
  3953. {
  3954. return QVariant();
  3955. }
  3956. if(role==Qt::DisplayRole||role==Qt::EditRole)
  3957. {
  3958. MeasurementList*row= entries->at(index.row());
  3959. if(index.column()> row->size())
  3960. {
  3961. return QVariant();
  3962. }
  3963. else
  3964. {
  3965. if(index.column()==0)
  3966. {
  3967. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  3968. }
  3969. else if(lastTemperature->contains(index.column()))
  3970. {
  3971. if(row->at(index.column()).toString().isEmpty())
  3972. {
  3973. return QVariant();
  3974. }
  3975. switch(unit)
  3976. {
  3977. case Auto:
  3978. case Fahrenheit:
  3979. return QVariant(row->at(index.column()).toString());
  3980. break;
  3981. case Celsius:
  3982. return QVariant((row->at(index.column()).toDouble()-
  3983. 32)*5/9);
  3984. break;
  3985. case Kelvin:
  3986. return QVariant((row->at(index.column()).toDouble()+
  3987. 459.67)*5/9);
  3988. break;
  3989. case Rankine:
  3990. return QVariant(row->at(index.column()).toDouble()+
  3991. 459.67);
  3992. break;
  3993. default:
  3994. break;
  3995. }
  3996. }
  3997. return QVariant(row->at(index.column()).toString());
  3998. }
  3999. }
  4000. return QVariant();
  4001. }
  4002. /*:363*//*364:*/
  4003. #line 9373 "./typica.w"
  4004. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4005. int role)const
  4006. {
  4007. if(orientation==Qt::Horizontal)
  4008. {
  4009. if(role==Qt::DisplayRole)
  4010. {
  4011. if(section<hData->size())
  4012. {
  4013. return QVariant(hData->at(section));
  4014. }
  4015. }
  4016. }
  4017. return QVariant();
  4018. }
  4019. /*:364*//*365:*/
  4020. #line 9400 "./typica.w"
  4021. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4022. {
  4023. /*354:*/
  4024. #line 9134 "./typica.w"
  4025. bool valid= false;
  4026. if(index.isValid())
  4027. {
  4028. if(index.row()<entries->size())
  4029. {
  4030. if(index.column()<colcount)
  4031. {
  4032. valid= true;
  4033. }
  4034. }
  4035. }
  4036. /*:354*/
  4037. #line 9403 "./typica.w"
  4038. if(valid)
  4039. {
  4040. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4041. }
  4042. return 0;
  4043. }
  4044. /*:365*//*366:*/
  4045. #line 9415 "./typica.w"
  4046. QModelIndex MeasurementModel::index(int row,int column,
  4047. const QModelIndex&parent)const
  4048. {
  4049. if(parent==QModelIndex())
  4050. {
  4051. if(row<entries->size()&&entries->isEmpty()==false)
  4052. {
  4053. if(column<entries->at(row)->size())
  4054. {
  4055. return createIndex(row,column);
  4056. }
  4057. }
  4058. }
  4059. return QModelIndex();
  4060. }
  4061. /*:366*/
  4062. #line 776 "./typica.w"
  4063. /*368:*/
  4064. #line 9466 "./typica.w"
  4065. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4066. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4067. {
  4068. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4069. }
  4070. /*:368*//*369:*/
  4071. #line 9481 "./typica.w"
  4072. void AnnotationButton::annotate()
  4073. {
  4074. if(note.contains("%1"))
  4075. {
  4076. count++;
  4077. emit annotation(note.arg(count),tc,ac);
  4078. }
  4079. else
  4080. {
  4081. emit annotation(note,tc,ac);
  4082. }
  4083. }
  4084. /*:369*//*370:*/
  4085. #line 9499 "./typica.w"
  4086. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4087. {
  4088. tc= tempcolumn;
  4089. }
  4090. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4091. {
  4092. ac= annotationcolumn;
  4093. }
  4094. void AnnotationButton::setAnnotation(const QString&annotation)
  4095. {
  4096. note= annotation;
  4097. }
  4098. /*:370*//*371:*/
  4099. #line 9518 "./typica.w"
  4100. void AnnotationButton::resetCount()
  4101. {
  4102. count= 0;
  4103. }
  4104. /*:371*/
  4105. #line 777 "./typica.w"
  4106. /*376:*/
  4107. #line 9601 "./typica.w"
  4108. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4109. const QString&postt,
  4110. QWidget*parent)
  4111. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4112. {
  4113. resetChange();
  4114. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4115. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4116. }
  4117. /*:376*//*377:*/
  4118. #line 9618 "./typica.w"
  4119. void AnnotationSpinBox::resetChange()
  4120. {
  4121. change= true;
  4122. }
  4123. /*:377*//*378:*/
  4124. #line 9629 "./typica.w"
  4125. void AnnotationSpinBox::annotate()
  4126. {
  4127. if(change)
  4128. {
  4129. change= false;
  4130. emit annotation(QString("%1%2%3").arg(pretext).
  4131. arg(value()).arg(posttext),tc,ac);
  4132. }
  4133. }
  4134. /*:378*//*379:*/
  4135. #line 9642 "./typica.w"
  4136. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4137. {
  4138. tc= tempcolumn;
  4139. }
  4140. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4141. {
  4142. ac= annotationcolumn;
  4143. }
  4144. void AnnotationSpinBox::setPretext(const QString&pret)
  4145. {
  4146. pretext= pret;
  4147. }
  4148. void AnnotationSpinBox::setPosttext(const QString&postt)
  4149. {
  4150. posttext= postt;
  4151. }
  4152. /*:379*/
  4153. #line 778 "./typica.w"
  4154. /*386:*/
  4155. #line 9810 "./typica.w"
  4156. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4157. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4158. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4159. stopAction(new QAction(tr("Stop"),NULL)),
  4160. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4161. relative(QTime::currentTime()),base(QTime(0,0,0))
  4162. {
  4163. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4164. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4165. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4166. clock.setInterval(500);
  4167. clock.setSingleShot(false);
  4168. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4169. setSegmentStyle(Filled);
  4170. updateDisplay();
  4171. }
  4172. /*:386*//*387:*/
  4173. #line 9831 "./typica.w"
  4174. void TimerDisplay::updateTime()
  4175. {
  4176. QTime time;
  4177. int cseconds= 0;
  4178. int oseconds= 0;
  4179. int r= 0;
  4180. QTime nt= QTime(0,0,0);
  4181. int n= 0;
  4182. int bseconds= 0;
  4183. switch(m)
  4184. {
  4185. case TimerDisplay::CountUp:
  4186. /*388:*/
  4187. #line 9863 "./typica.w"
  4188. /*389:*/
  4189. #line 9878 "./typica.w"
  4190. time= QTime::currentTime();
  4191. cseconds= TIMETOINT(time);
  4192. oseconds= TIMETOINT(relative);
  4193. r= cseconds-oseconds;
  4194. /*:389*/
  4195. #line 9864 "./typica.w"
  4196. nt= nt.addSecs(r);
  4197. if(nt!=s)
  4198. {
  4199. s= nt;
  4200. emit valueChanged(s);
  4201. }
  4202. /*:388*/
  4203. #line 9844 "./typica.w"
  4204. ;
  4205. break;
  4206. case TimerDisplay::CountDown:
  4207. /*390:*/
  4208. #line 9888 "./typica.w"
  4209. if(s> QTime(0,0,0))
  4210. {
  4211. /*389:*/
  4212. #line 9878 "./typica.w"
  4213. time= QTime::currentTime();
  4214. cseconds= TIMETOINT(time);
  4215. oseconds= TIMETOINT(relative);
  4216. r= cseconds-oseconds;
  4217. /*:389*/
  4218. #line 9891 "./typica.w"
  4219. bseconds= TIMETOINT(base);
  4220. n= bseconds-r;
  4221. nt= nt.addSecs(n);
  4222. if(nt!=s)
  4223. {
  4224. s= nt;
  4225. emit valueChanged(s);
  4226. }
  4227. }
  4228. /*:390*/
  4229. #line 9847 "./typica.w"
  4230. ;
  4231. break;
  4232. case TimerDisplay::Clock:
  4233. /*391:*/
  4234. #line 9905 "./typica.w"
  4235. time= QTime::currentTime();
  4236. if(time!=s)
  4237. {
  4238. s= time;
  4239. emit valueChanged(s);
  4240. }
  4241. /*:391*/
  4242. #line 9850 "./typica.w"
  4243. ;
  4244. break;
  4245. default:
  4246. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  4247. break;
  4248. }
  4249. updateDisplay();
  4250. }
  4251. /*:387*//*392:*/
  4252. #line 9919 "./typica.w"
  4253. void TimerDisplay::startTimer()
  4254. {
  4255. if(!running)
  4256. {
  4257. relative= QTime::currentTime();
  4258. if(ar)
  4259. {
  4260. reset();
  4261. }
  4262. else
  4263. {
  4264. relative= TIMESUBTRACT(relative,s);
  4265. }
  4266. if(m==Clock)
  4267. {
  4268. updateTime();
  4269. }
  4270. base= s;
  4271. clock.start();
  4272. running= true;
  4273. emit runStateChanged(true);
  4274. }
  4275. }
  4276. /*:392*//*393:*/
  4277. #line 9947 "./typica.w"
  4278. void TimerDisplay::stopTimer()
  4279. {
  4280. if(running)
  4281. {
  4282. clock.stop();
  4283. running= false;
  4284. emit runStateChanged(false);
  4285. }
  4286. }
  4287. /*:393*//*394:*/
  4288. #line 9960 "./typica.w"
  4289. TimerDisplay::~TimerDisplay()
  4290. {
  4291. clock.stop();
  4292. }
  4293. /*:394*//*395:*/
  4294. #line 9969 "./typica.w"
  4295. void TimerDisplay::setCountUpMode()
  4296. {
  4297. m= TimerDisplay::CountUp;
  4298. }
  4299. void TimerDisplay::setCountDownMode()
  4300. {
  4301. m= TimerDisplay::CountDown;
  4302. }
  4303. void TimerDisplay::setClockMode()
  4304. {
  4305. m= TimerDisplay::Clock;
  4306. }
  4307. /*:395*//*396:*/
  4308. #line 9987 "./typica.w"
  4309. QString TimerDisplay::value()
  4310. {
  4311. return s.toString(f);
  4312. }
  4313. QTime TimerDisplay::seconds()
  4314. {
  4315. return s;
  4316. }
  4317. TimerDisplay::TimerMode TimerDisplay::mode()
  4318. {
  4319. return m;
  4320. }
  4321. bool TimerDisplay::isRunning()
  4322. {
  4323. return running;
  4324. }
  4325. QTime TimerDisplay::resetValue()
  4326. {
  4327. return r;
  4328. }
  4329. QString TimerDisplay::displayFormat()
  4330. {
  4331. return f;
  4332. }
  4333. bool TimerDisplay::autoReset()
  4334. {
  4335. return ar;
  4336. }
  4337. /*:396*//*397:*/
  4338. #line 10025 "./typica.w"
  4339. void TimerDisplay::setTimer(QTime value)
  4340. {
  4341. if(value.isValid())
  4342. {
  4343. s= value;
  4344. updateDisplay();
  4345. emit valueChanged(value);
  4346. }
  4347. }
  4348. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  4349. {
  4350. m= mode;
  4351. }
  4352. void TimerDisplay::setResetValue(QTime value)
  4353. {
  4354. r= value;
  4355. }
  4356. void TimerDisplay::setDisplayFormat(QString format)
  4357. {
  4358. f= format;
  4359. setNumDigits(format.length());
  4360. }
  4361. void TimerDisplay::setAutoReset(bool reset)
  4362. {
  4363. ar= reset;
  4364. }
  4365. /*:397*//*398:*/
  4366. #line 10060 "./typica.w"
  4367. void TimerDisplay::copyTimer()
  4368. {
  4369. QApplication::clipboard()->setText(value());
  4370. }
  4371. /*:398*//*399:*/
  4372. #line 10069 "./typica.w"
  4373. void TimerDisplay::reset()
  4374. {
  4375. if(!running)
  4376. {
  4377. s= r;
  4378. updateDisplay();
  4379. }
  4380. }
  4381. /*:399*//*400:*/
  4382. #line 10082 "./typica.w"
  4383. void TimerDisplay::updateDisplay()
  4384. {
  4385. display(value());
  4386. }
  4387. /*:400*/
  4388. #line 779 "./typica.w"
  4389. /*406:*/
  4390. #line 10176 "./typica.w"
  4391. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  4392. {
  4393. int x= rect.x();
  4394. int y= rect.y();
  4395. QLayoutItem*item;
  4396. if(orientation==Qt::Horizontal)
  4397. {
  4398. /*407:*/
  4399. #line 10200 "./typica.w"
  4400. foreach(item,itemList)
  4401. {
  4402. int nextX= x+item->sizeHint().width()+spacing();
  4403. int right= x+item->sizeHint().width();
  4404. if(item==itemList.last())
  4405. {
  4406. right= rect.right();
  4407. }
  4408. int bottom= rect.bottom();
  4409. if(!testOnly)
  4410. {
  4411. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4412. }
  4413. x= nextX;
  4414. }
  4415. /*:407*/
  4416. #line 10184 "./typica.w"
  4417. }
  4418. else
  4419. {
  4420. /*408:*/
  4421. #line 10219 "./typica.w"
  4422. foreach(item,itemList)
  4423. {
  4424. int nextY= y+item->sizeHint().height()+spacing();
  4425. int bottom= y+item->sizeHint().height();
  4426. if(item==itemList.last())
  4427. {
  4428. bottom= rect.bottom();
  4429. }
  4430. int right= rect.right();
  4431. if(!testOnly)
  4432. {
  4433. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  4434. }
  4435. y= nextY;
  4436. }
  4437. /*:408*/
  4438. #line 10188 "./typica.w"
  4439. }
  4440. return y;
  4441. }
  4442. /*:406*//*409:*/
  4443. #line 10243 "./typica.w"
  4444. QSize PackLayout::minimumSize()const
  4445. {
  4446. QSize size;
  4447. QLayoutItem*item;
  4448. foreach(item,itemList)
  4449. {
  4450. if(orientation==Qt::Horizontal)
  4451. {
  4452. size+= QSize(item->minimumSize().width(),0);
  4453. if(size.height()<item->minimumSize().height())
  4454. {
  4455. size.setHeight(item->minimumSize().height());
  4456. }
  4457. }
  4458. else
  4459. {
  4460. size+= QSize(0,item->minimumSize().height());
  4461. if(size.width()<item->minimumSize().width())
  4462. {
  4463. size.setWidth(item->minimumSize().width());
  4464. }
  4465. }
  4466. }
  4467. size+= QSize(2*margin(),2*margin());
  4468. return size;
  4469. }
  4470. /*:409*//*410:*/
  4471. #line 10275 "./typica.w"
  4472. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  4473. QLayout(parent)
  4474. {
  4475. setMargin(margin);
  4476. setSpacing(spacing);
  4477. setOrientation(Qt::Horizontal);
  4478. }
  4479. PackLayout::PackLayout(int spacing)
  4480. {
  4481. setSpacing(spacing);
  4482. setOrientation(Qt::Horizontal);
  4483. }
  4484. /*:410*//*411:*/
  4485. #line 10293 "./typica.w"
  4486. PackLayout::~PackLayout()
  4487. {
  4488. QLayoutItem*item;
  4489. while((item= takeAt(0)))
  4490. {
  4491. delete item;
  4492. }
  4493. }
  4494. /*:411*//*412:*/
  4495. #line 10307 "./typica.w"
  4496. QLayoutItem*PackLayout::takeAt(int index)
  4497. {
  4498. if(index>=0&&index<itemList.size())
  4499. {
  4500. return itemList.takeAt(index);
  4501. }
  4502. else
  4503. {
  4504. return NULL;
  4505. }
  4506. }
  4507. /*:412*//*413:*/
  4508. #line 10323 "./typica.w"
  4509. QLayoutItem*PackLayout::itemAt(int index)const
  4510. {
  4511. if(index>=0&&index<itemList.size())
  4512. {
  4513. return itemList.at(index);
  4514. }
  4515. else
  4516. {
  4517. return NULL;
  4518. }
  4519. }
  4520. /*:413*//*414:*/
  4521. #line 10346 "./typica.w"
  4522. void PackLayout::addItem(QLayoutItem*item)
  4523. {
  4524. itemList.append(item);
  4525. }
  4526. /*:414*//*415:*/
  4527. #line 10354 "./typica.w"
  4528. int PackLayout::count()const
  4529. {
  4530. return itemList.size();
  4531. }
  4532. /*:415*//*416:*/
  4533. #line 10366 "./typica.w"
  4534. Qt::Orientations PackLayout::expandingDirections()const
  4535. {
  4536. return Qt::Vertical|Qt::Horizontal;
  4537. }
  4538. bool PackLayout::hasHeightForWidth()const
  4539. {
  4540. return false;
  4541. }
  4542. int PackLayout::heightForWidth(int width)const
  4543. {
  4544. return doLayout(QRect(0,0,width,0),true);
  4545. }
  4546. void PackLayout::setGeometry(const QRect&rect)
  4547. {
  4548. QLayout::setGeometry(rect);
  4549. doLayout(rect,false);
  4550. }
  4551. QSize PackLayout::sizeHint()const
  4552. {
  4553. return minimumSize();
  4554. }
  4555. /*:416*//*417:*/
  4556. #line 10397 "./typica.w"
  4557. void PackLayout::setOrientation(Qt::Orientations direction)
  4558. {
  4559. orientation= direction;
  4560. doLayout(geometry(),false);
  4561. }
  4562. /*:417*/
  4563. #line 780 "./typica.w"
  4564. /*419:*/
  4565. #line 10436 "./typica.w"
  4566. SceneButton::SceneButton():QGraphicsScene()
  4567. {
  4568. }
  4569. SceneButton::~SceneButton()
  4570. {
  4571. }
  4572. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  4573. {
  4574. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  4575. }
  4576. /*:419*/
  4577. #line 781 "./typica.w"
  4578. /*421:*/
  4579. #line 10482 "./typica.w"
  4580. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  4581. Qt::Orientations orientation,
  4582. QWidget*parent,Qt::WindowFlags f):
  4583. QWidget(parent,f),label(new QGraphicsView()),
  4584. scene(new SceneButton())
  4585. {
  4586. layout= new PackLayout(this);
  4587. layout->setOrientation(orientation);
  4588. /*422:*/
  4589. #line 10502 "./typica.w"
  4590. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4591. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4592. label->setFrameShape(QFrame::NoFrame);
  4593. label->setInteractive(true);
  4594. /*:422*/
  4595. #line 10491 "./typica.w"
  4596. /*423:*/
  4597. #line 10513 "./typica.w"
  4598. scene->setBackgroundBrush(Qt::cyan);
  4599. text= scene->addText(labeltext);
  4600. if(orientation==Qt::Horizontal)
  4601. {
  4602. text->rotate(270.0);
  4603. }
  4604. label->setScene(scene);
  4605. /*:423*/
  4606. #line 10492 "./typica.w"
  4607. /*424:*/
  4608. #line 10531 "./typica.w"
  4609. if(orientation==Qt::Horizontal)
  4610. {
  4611. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  4612. }
  4613. else
  4614. {
  4615. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  4616. }
  4617. label->centerOn(text);
  4618. /*:424*/
  4619. #line 10493 "./typica.w"
  4620. /*425:*/
  4621. #line 10546 "./typica.w"
  4622. layout->addWidget(label);
  4623. layout->addWidget(widget);
  4624. if(orientation==Qt::Horizontal)
  4625. {
  4626. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  4627. widget->sizeHint().height());
  4628. }
  4629. else
  4630. {
  4631. setMinimumSize(widget->sizeHint().width(),
  4632. widget->sizeHint().height()+label->sizeHint().height());
  4633. }
  4634. /*:425*/
  4635. #line 10494 "./typica.w"
  4636. }
  4637. /*:421*//*426:*/
  4638. #line 10563 "./typica.w"
  4639. void WidgetDecorator::setBackgroundBrush(QBrush background)
  4640. {
  4641. scene->setBackgroundBrush(background);
  4642. }
  4643. void WidgetDecorator::setTextColor(QColor color)
  4644. {
  4645. text->setDefaultTextColor(color);
  4646. }
  4647. /*:426*//*427:*/
  4648. #line 10576 "./typica.w"
  4649. WidgetDecorator::~WidgetDecorator()
  4650. {
  4651. }
  4652. /*:427*/
  4653. #line 782 "./typica.w"
  4654. /*432:*/
  4655. #line 10675 "./typica.w"
  4656. void LogEditWindow::addTheRows()
  4657. {
  4658. QTime s= startTime->time();
  4659. while(s<endTime->time())
  4660. {
  4661. model->newMeasurement(Measurement(0,s),1);
  4662. s= s.addSecs(interval->value());
  4663. }
  4664. model->newMeasurement(Measurement(0,endTime->time()),1);
  4665. }
  4666. /*:432*//*433:*/
  4667. #line 10689 "./typica.w"
  4668. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  4669. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  4670. addRowsLayout(new QHBoxLayout(NULL)),
  4671. startTimeLabel(new QLabel("Start Time")),
  4672. startTime(new QTimeEdit(QTime(0,0,0,0))),
  4673. endTimeLabel(new QLabel("End Time")),
  4674. endTime(new QTimeEdit(QTime(0,20,0,0))),
  4675. intervalLabel(new QLabel("Interval (seconds)")),
  4676. interval(new QSpinBox()),
  4677. addRows(new QPushButton("Add Rows")),
  4678. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  4679. saveCsv(new QAction(tr("Export CSV"),NULL)),
  4680. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  4681. model(new MeasurementModel()),
  4682. log(new QTableView())
  4683. {
  4684. /*434:*/
  4685. #line 10726 "./typica.w"
  4686. QSettings settings;
  4687. resize(settings.value("logSize",QSize(620,400)).toSize());
  4688. move(settings.value("logPos",QPoint(200,60)).toPoint());
  4689. /*:434*/
  4690. #line 10706 "./typica.w"
  4691. /*435:*/
  4692. #line 10739 "./typica.w"
  4693. mainLayout->setOrientation(Qt::Vertical);
  4694. addRowsLayout->addSpacing(10);
  4695. addRowsLayout->addWidget(startTimeLabel);
  4696. addRowsLayout->addWidget(startTime);
  4697. addRowsLayout->addSpacing(10);
  4698. startTime->setDisplayFormat("mm:ss");
  4699. addRowsLayout->addWidget(endTimeLabel);
  4700. addRowsLayout->addWidget(endTime);
  4701. addRowsLayout->addSpacing(10);
  4702. endTime->setDisplayFormat("mm:ss");
  4703. addRowsLayout->addWidget(intervalLabel);
  4704. addRowsLayout->addWidget(interval);
  4705. addRowsLayout->addSpacing(10);
  4706. interval->setRange(0,60);
  4707. interval->setValue(30);
  4708. addRowsLayout->addWidget(addRows);
  4709. addRowsLayout->addSpacing(10);
  4710. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  4711. /*:435*/
  4712. #line 10707 "./typica.w"
  4713. /*436:*/
  4714. #line 10762 "./typica.w"
  4715. model->setHeaderData(0,Qt::Horizontal,"Time");
  4716. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  4717. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  4718. model->clear();
  4719. /*:436*/
  4720. #line 10708 "./typica.w"
  4721. /*437:*/
  4722. #line 10771 "./typica.w"
  4723. log->setModel(model);
  4724. log->setColumnWidth(0,100);
  4725. log->setColumnWidth(1,100);
  4726. log->setColumnWidth(2,100);
  4727. /*:437*/
  4728. #line 10709 "./typica.w"
  4729. mainLayout->addItem(addRowsLayout);
  4730. mainLayout->addWidget(log);
  4731. centralWidget->setLayout(mainLayout);
  4732. setCentralWidget(centralWidget);
  4733. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  4734. fileMenu->addAction(openXml);
  4735. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  4736. fileMenu->addAction(saveXml);
  4737. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  4738. fileMenu->addAction(saveCsv);
  4739. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  4740. }
  4741. /*:433*//*438:*/
  4742. #line 10782 "./typica.w"
  4743. void LogEditWindow::saveXML()
  4744. {
  4745. QSettings settings;
  4746. QString lastDir= settings.value("lastDirectory").toString();
  4747. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  4748. lastDir,"",0);
  4749. QFile file(filename);
  4750. XMLOutput writer(model,&file,0);
  4751. writer.addTemperatureColumn("Temperature",1);
  4752. writer.addAnnotationColumn("Annotation",2);
  4753. if(writer.output())
  4754. {
  4755. QFileInfo info(filename);
  4756. QDir directory= info.dir();
  4757. lastDir= directory.path();
  4758. settings.setValue("lastDirectory",lastDir);
  4759. }
  4760. }
  4761. void LogEditWindow::saveCSV()
  4762. {
  4763. QSettings settings;
  4764. QString lastDir= settings.value("lastDirectory").toString();
  4765. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  4766. lastDir,"",0);
  4767. QFile file(filename);
  4768. CSVOutput writer(model,&file,0);
  4769. writer.addTemperatureColumn("Temperature",1);
  4770. writer.addAnnotationColumn("Annotation",2);
  4771. if(writer.output())
  4772. {
  4773. QFileInfo info(filename);
  4774. QDir directory= info.dir();
  4775. lastDir= directory.path();
  4776. settings.setValue("lastDirectory",lastDir);
  4777. }
  4778. }
  4779. /*:438*//*439:*/
  4780. #line 10825 "./typica.w"
  4781. void LogEditWindow::openXML()
  4782. {
  4783. QSettings settings;
  4784. QString lastDir= settings.value("lastDirectory").toString();
  4785. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  4786. lastDir,"",0);
  4787. if(filename.isNull())
  4788. {
  4789. return;
  4790. }
  4791. QFile file(filename);
  4792. XMLInput reader(&file,1);
  4793. connect(&reader,SIGNAL(measure(Measurement,int)),
  4794. model,SLOT(newMeasurement(Measurement,int)));
  4795. connect(&reader,SIGNAL(annotation(QString,int,int)),
  4796. model,SLOT(newAnnotation(QString,int,int)));
  4797. if(reader.input())
  4798. {
  4799. QFileInfo info(filename);
  4800. setWindowTitle(QString(tr("%1 - %2")).
  4801. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  4802. QDir directory= info.dir();
  4803. lastDir= directory.path();
  4804. settings.setValue("lastDirectory",lastDir);
  4805. }
  4806. }
  4807. /*:439*//*440:*/
  4808. #line 10856 "./typica.w"
  4809. void LogEditWindow::closeEvent(QCloseEvent*event)
  4810. {
  4811. QSettings settings;
  4812. settings.setValue("logSize",size());
  4813. settings.setValue("logPos",pos());
  4814. event->accept();
  4815. }
  4816. /*:440*/
  4817. #line 783 "./typica.w"
  4818. /*446:*/
  4819. #line 10969 "./typica.w"
  4820. bool XMLOutput::output()
  4821. {
  4822. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  4823. {
  4824. return false;
  4825. }
  4826. QXmlStreamWriter xmlout(out);
  4827. xmlout.writeStartDocument("1.0");
  4828. xmlout.writeDTD("<!DOCTYPE roastlog2.0>");
  4829. xmlout.writeStartElement("roastlog");
  4830. /*447:*/
  4831. #line 11002 "./typica.w"
  4832. foreach(int c,temperatureColumns.keys())
  4833. {
  4834. xmlout.writeStartElement("tempseries");
  4835. xmlout.writeAttribute("name",temperatureColumns.value(c));
  4836. xmlout.writeEndElement();
  4837. }
  4838. foreach(int c,annotationColumns.keys())
  4839. {
  4840. xmlout.writeStartElement("noteseries");
  4841. xmlout.writeAttribute("name",annotationColumns.value(c));
  4842. xmlout.writeEndElement();
  4843. }
  4844. /*:447*/
  4845. #line 10980 "./typica.w"
  4846. xmlout.writeStartElement("roast");
  4847. bool oresult;
  4848. for(int i= 0;i<data->rowCount();i++)
  4849. {
  4850. /*448:*/
  4851. #line 11021 "./typica.w"
  4852. oresult= false;
  4853. foreach(int c,temperatureColumns.keys())
  4854. {
  4855. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4856. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4857. {
  4858. oresult= true;
  4859. break;
  4860. }
  4861. }
  4862. if(oresult==false)
  4863. {
  4864. foreach(int c,annotationColumns.keys())
  4865. {
  4866. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4867. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  4868. isEmpty()))
  4869. {
  4870. oresult= true;
  4871. break;
  4872. }
  4873. }
  4874. }
  4875. /*:448*/
  4876. #line 10985 "./typica.w"
  4877. if(oresult)
  4878. {
  4879. /*449:*/
  4880. #line 11051 "./typica.w"
  4881. xmlout.writeStartElement("tuple");
  4882. xmlout.writeTextElement("time",data->data(data->index(i,time),
  4883. Qt::DisplayRole).toString());
  4884. foreach(int c,temperatureColumns.keys())
  4885. {
  4886. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4887. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4888. {
  4889. xmlout.writeStartElement("temperature");
  4890. xmlout.writeAttribute("series",temperatureColumns.value(c));
  4891. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4892. toString());
  4893. xmlout.writeEndElement();
  4894. }
  4895. }
  4896. foreach(int c,annotationColumns.keys())
  4897. {
  4898. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  4899. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  4900. {
  4901. xmlout.writeStartElement("annotation");
  4902. xmlout.writeAttribute("series",annotationColumns.value(c));
  4903. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  4904. toString());
  4905. xmlout.writeEndElement();
  4906. }
  4907. }
  4908. xmlout.writeEndElement();
  4909. /*:449*/
  4910. #line 10988 "./typica.w"
  4911. }
  4912. }
  4913. xmlout.writeEndElement();
  4914. xmlout.writeEndElement();
  4915. xmlout.writeEndDocument();
  4916. out->close();
  4917. return true;
  4918. }
  4919. /*:446*//*450:*/
  4920. #line 11083 "./typica.w"
  4921. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  4922. :QObject(NULL),data(model),out(device),time(timec)
  4923. {
  4924. }
  4925. void XMLOutput::setModel(MeasurementModel*model)
  4926. {
  4927. data= model;
  4928. }
  4929. void XMLOutput::setTimeColumn(int column)
  4930. {
  4931. time= column;
  4932. }
  4933. void XMLOutput::setDevice(QIODevice*device)
  4934. {
  4935. out= device;
  4936. }
  4937. /*:450*//*451:*/
  4938. #line 11112 "./typica.w"
  4939. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  4940. {
  4941. temperatureColumns.insert(column,series);
  4942. }
  4943. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  4944. {
  4945. annotationColumns.insert(column,series);
  4946. }
  4947. /*:451*/
  4948. #line 784 "./typica.w"
  4949. /*453:*/
  4950. #line 11164 "./typica.w"
  4951. bool XMLInput::input()
  4952. {
  4953. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  4954. {
  4955. return false;
  4956. }
  4957. QXmlStreamReader xmlin(in);
  4958. QMap<QString,int> temperatureColumns;
  4959. QMap<QString,int> annotationColumns;
  4960. int nextColumn= firstc;
  4961. /*454:*/
  4962. #line 11195 "./typica.w"
  4963. while(!xmlin.isDTD())
  4964. {
  4965. xmlin.readNext();
  4966. }
  4967. if(xmlin.isDTD())
  4968. {
  4969. if(xmlin.text()=="<!DOCTYPE roastlog>")
  4970. {
  4971. /*455:*/
  4972. #line 11217 "./typica.w"
  4973. emit newTemperatureColumn(firstc,"Bean");
  4974. emit newAnnotationColumn(firstc+1,"Note");
  4975. emit lastColumn(firstc+1);
  4976. /*:455*/
  4977. #line 11204 "./typica.w"
  4978. }
  4979. else
  4980. {
  4981. xmlin.readNext();
  4982. /*456:*/
  4983. #line 11226 "./typica.w"
  4984. while(xmlin.name()!="roast")
  4985. {
  4986. if(xmlin.isStartElement())
  4987. {
  4988. if(xmlin.name()=="tempseries")
  4989. {
  4990. temperatureColumns.insert(xmlin.attributes().value("name").
  4991. toString(),
  4992. nextColumn);
  4993. emit newTemperatureColumn(nextColumn,
  4994. xmlin.attributes().value("name").
  4995. toString());
  4996. nextColumn++;
  4997. }
  4998. else if(xmlin.name()=="noteseries")
  4999. {
  5000. annotationColumns.insert(xmlin.attributes().value("name").
  5001. toString(),nextColumn);
  5002. emit newAnnotationColumn(nextColumn,
  5003. xmlin.attributes().value("name").
  5004. toString());
  5005. nextColumn++;
  5006. }
  5007. }
  5008. xmlin.readNext();
  5009. }
  5010. emit lastColumn(nextColumn-1);
  5011. /*:456*/
  5012. #line 11209 "./typica.w"
  5013. }
  5014. }
  5015. /*:454*/
  5016. #line 11175 "./typica.w"
  5017. QTime timeval= QTime();
  5018. double tempval= 0;
  5019. QString noteval= QString();
  5020. int column;
  5021. int counter= 0;
  5022. while(!xmlin.atEnd())
  5023. {
  5024. /*457:*/
  5025. #line 11267 "./typica.w"
  5026. xmlin.readNext();
  5027. if(xmlin.isStartElement())
  5028. {
  5029. /*458:*/
  5030. #line 11293 "./typica.w"
  5031. if(xmlin.name()=="time")
  5032. {
  5033. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5034. }
  5035. else if(xmlin.name()=="temperature")
  5036. {
  5037. column= xmlin.attributes().value("series").toString().isEmpty()?
  5038. firstc:temperatureColumns.value(xmlin.attributes().
  5039. value("series").toString());
  5040. tempval= xmlin.readElementText().toDouble();
  5041. Measurement measurement(tempval,timeval);
  5042. emit measure(measurement,column);
  5043. }
  5044. else if(xmlin.name()=="annotation")
  5045. {
  5046. column= xmlin.attributes().value("series").toString().isEmpty()?
  5047. firstc+1:annotationColumns.value(xmlin.attributes().
  5048. value("series").toString());
  5049. noteval= xmlin.readElementText();
  5050. if(!noteval.isEmpty())
  5051. {
  5052. emit annotation(noteval,firstc,column);
  5053. }
  5054. }
  5055. /*:458*/
  5056. #line 11271 "./typica.w"
  5057. }
  5058. counter++;
  5059. if(counter%100==0)
  5060. {
  5061. QCoreApplication::processEvents();
  5062. }
  5063. /*:457*/
  5064. #line 11183 "./typica.w"
  5065. }
  5066. return true;
  5067. }
  5068. /*:453*//*459:*/
  5069. #line 11321 "./typica.w"
  5070. XMLInput::XMLInput(QIODevice*input,int c):
  5071. firstc(c),in(input)
  5072. {
  5073. }
  5074. void XMLInput::setFirstColumn(int column)
  5075. {
  5076. firstc= column;
  5077. }
  5078. void XMLInput::setDevice(QIODevice*device)
  5079. {
  5080. in= device;
  5081. }
  5082. /*:459*/
  5083. #line 785 "./typica.w"
  5084. /*464:*/
  5085. #line 11410 "./typica.w"
  5086. bool CSVOutput::output()
  5087. {
  5088. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5089. {
  5090. return false;
  5091. }
  5092. QTextStream output(out);
  5093. /*465:*/
  5094. #line 11434 "./typica.w"
  5095. output<<"Time";
  5096. foreach(int c,temperatureColumns.keys())
  5097. {
  5098. output<<','<<temperatureColumns.value(c);
  5099. }
  5100. foreach(int c,annotationColumns.keys())
  5101. {
  5102. output<<','<<annotationColumns.value(c);
  5103. }
  5104. output<<'\n';
  5105. /*:465*/
  5106. #line 11418 "./typica.w"
  5107. bool oresult;
  5108. for(int i= 0;i<data->rowCount();i++)
  5109. {
  5110. /*448:*/
  5111. #line 11021 "./typica.w"
  5112. oresult= false;
  5113. foreach(int c,temperatureColumns.keys())
  5114. {
  5115. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5116. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5117. {
  5118. oresult= true;
  5119. break;
  5120. }
  5121. }
  5122. if(oresult==false)
  5123. {
  5124. foreach(int c,annotationColumns.keys())
  5125. {
  5126. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5127. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5128. isEmpty()))
  5129. {
  5130. oresult= true;
  5131. break;
  5132. }
  5133. }
  5134. }
  5135. /*:448*/
  5136. #line 11422 "./typica.w"
  5137. if(oresult)
  5138. {
  5139. /*466:*/
  5140. #line 11455 "./typica.w"
  5141. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  5142. foreach(int c,temperatureColumns.keys())
  5143. {
  5144. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5145. }
  5146. foreach(int c,annotationColumns.keys())
  5147. {
  5148. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  5149. }
  5150. output<<'\n';
  5151. /*:466*/
  5152. #line 11425 "./typica.w"
  5153. }
  5154. }
  5155. out->close();
  5156. return true;
  5157. }
  5158. /*:464*//*467:*/
  5159. #line 11470 "./typica.w"
  5160. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  5161. data(model),out(device),time(timec)
  5162. {
  5163. }
  5164. void CSVOutput::setModel(MeasurementModel*model)
  5165. {
  5166. data= model;
  5167. }
  5168. void CSVOutput::setTimeColumn(int column)
  5169. {
  5170. time= column;
  5171. }
  5172. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  5173. {
  5174. temperatureColumns.insert(column,series);
  5175. }
  5176. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  5177. {
  5178. annotationColumns.insert(column,series);
  5179. }
  5180. void CSVOutput::setDevice(QIODevice*device)
  5181. {
  5182. out= device;
  5183. }
  5184. /*:467*/
  5185. #line 786 "./typica.w"
  5186. /*486:*/
  5187. #line 11852 "./typica.w"
  5188. QString SaltModel::arrayLiteral(int column,int role)const
  5189. {
  5190. QString literal= "'{";
  5191. for(int i= 0;i<rowCount();i++)
  5192. {
  5193. QString datum= data(index(i,column),role).toString();
  5194. if(!datum.isEmpty())
  5195. {
  5196. literal.append(datum);
  5197. literal.append(", ");
  5198. }
  5199. }
  5200. if(literal.size()> 2)
  5201. {
  5202. literal.chop(2);
  5203. }
  5204. literal.append("}'");
  5205. return literal;
  5206. }
  5207. QString SaltModel::quotedArrayLiteral(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("\"");
  5216. literal.append(datum);
  5217. literal.append("\", ");
  5218. }
  5219. }
  5220. if(literal.size()> 2)
  5221. {
  5222. literal.chop(2);
  5223. }
  5224. literal.append("}'");
  5225. return literal;
  5226. }
  5227. /*:486*//*487:*/
  5228. #line 11896 "./typica.w"
  5229. QModelIndex SaltModel::parent(const QModelIndex&)const
  5230. {
  5231. return QModelIndex();
  5232. }
  5233. /*:487*//*488:*/
  5234. #line 11915 "./typica.w"
  5235. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  5236. int role)
  5237. {
  5238. /*489:*/
  5239. #line 11946 "./typica.w"
  5240. bool valid= false;
  5241. if(index.isValid())
  5242. {
  5243. if(index.row()<modelData.size())
  5244. {
  5245. if(index.column()<colcount)
  5246. {
  5247. valid= true;
  5248. }
  5249. }
  5250. }
  5251. /*:489*/
  5252. #line 11919 "./typica.w"
  5253. if(!valid)
  5254. {
  5255. return false;
  5256. }
  5257. if(index.row()==modelData.size()-1)
  5258. {
  5259. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  5260. /*490:*/
  5261. #line 11962 "./typica.w"
  5262. QList<QMap<int,QVariant> > newRow;
  5263. QMap<int,QVariant> defaults;
  5264. for(int i= 0;i<colcount;i++)
  5265. {
  5266. newRow.append(defaults);
  5267. }
  5268. modelData.append(newRow);
  5269. /*:490*/
  5270. #line 11927 "./typica.w"
  5271. endInsertRows();
  5272. }
  5273. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5274. QMap<int,QVariant> cell= row.at(index.column());
  5275. cell.insert(role,value);
  5276. if(role==Qt::EditRole)
  5277. {
  5278. cell.insert(Qt::DisplayRole,value);
  5279. }
  5280. row.replace(index.column(),cell);
  5281. modelData.replace(index.row(),row);
  5282. emit dataChanged(index,index);
  5283. return true;
  5284. }
  5285. /*:488*//*491:*/
  5286. #line 11973 "./typica.w"
  5287. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  5288. {
  5289. for(int i= 0;i<columns;i++)
  5290. {
  5291. hData<<"";
  5292. }
  5293. /*490:*/
  5294. #line 11962 "./typica.w"
  5295. QList<QMap<int,QVariant> > newRow;
  5296. QMap<int,QVariant> defaults;
  5297. for(int i= 0;i<colcount;i++)
  5298. {
  5299. newRow.append(defaults);
  5300. }
  5301. modelData.append(newRow);
  5302. /*:490*/
  5303. #line 11980 "./typica.w"
  5304. }
  5305. /*:491*//*492:*/
  5306. #line 11985 "./typica.w"
  5307. SaltModel::~SaltModel()
  5308. {
  5309. }
  5310. /*:492*//*493:*/
  5311. #line 11995 "./typica.w"
  5312. int SaltModel::rowCount(const QModelIndex&parent)const
  5313. {
  5314. return(parent==QModelIndex()?modelData.size():0);
  5315. }
  5316. int SaltModel::columnCount(const QModelIndex&parent)const
  5317. {
  5318. return(parent==QModelIndex()?colcount:0);
  5319. }
  5320. /*:493*//*494:*/
  5321. #line 12008 "./typica.w"
  5322. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  5323. const QVariant&value,int)
  5324. {
  5325. if(orientation==Qt::Horizontal&&section<colcount)
  5326. {
  5327. hData.replace(section,value.toString());
  5328. emit headerDataChanged(orientation,section,section);
  5329. return true;
  5330. }
  5331. return false;
  5332. }
  5333. /*:494*//*495:*/
  5334. #line 12023 "./typica.w"
  5335. QVariant SaltModel::data(const QModelIndex&index,int role)const
  5336. {
  5337. /*489:*/
  5338. #line 11946 "./typica.w"
  5339. bool valid= false;
  5340. if(index.isValid())
  5341. {
  5342. if(index.row()<modelData.size())
  5343. {
  5344. if(index.column()<colcount)
  5345. {
  5346. valid= true;
  5347. }
  5348. }
  5349. }
  5350. /*:489*/
  5351. #line 12026 "./typica.w"
  5352. if(!valid)
  5353. {
  5354. return QVariant();
  5355. }
  5356. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  5357. QMap<int,QVariant> cell= row.at(index.column());
  5358. return cell.value(role,QVariant());
  5359. }
  5360. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  5361. int role)const
  5362. {
  5363. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  5364. section<colcount)
  5365. {
  5366. return QVariant(hData.at(section));
  5367. }
  5368. return QVariant();
  5369. }
  5370. /*:495*//*496:*/
  5371. #line 12050 "./typica.w"
  5372. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  5373. {
  5374. /*489:*/
  5375. #line 11946 "./typica.w"
  5376. bool valid= false;
  5377. if(index.isValid())
  5378. {
  5379. if(index.row()<modelData.size())
  5380. {
  5381. if(index.column()<colcount)
  5382. {
  5383. valid= true;
  5384. }
  5385. }
  5386. }
  5387. /*:489*/
  5388. #line 12053 "./typica.w"
  5389. if(valid)
  5390. {
  5391. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5392. }
  5393. return 0;
  5394. }
  5395. /*:496*//*497:*/
  5396. #line 12064 "./typica.w"
  5397. QModelIndex SaltModel::index(int row,int column,
  5398. const QModelIndex&parent)const
  5399. {
  5400. if(parent==QModelIndex())
  5401. {
  5402. if(row<modelData.size()&&column<colcount)
  5403. {
  5404. return createIndex(row,column);
  5405. }
  5406. }
  5407. return QModelIndex();
  5408. }
  5409. /*:497*/
  5410. #line 787 "./typica.w"
  5411. /*499:*/
  5412. #line 12119 "./typica.w"
  5413. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  5414. {
  5415. SqlComboBox*widget= new SqlComboBox();
  5416. widget->setParent(parent);
  5417. for(int i= 0;i<count();i++)
  5418. {
  5419. widget->addItem(itemText(i),itemData(i));
  5420. }
  5421. return widget;
  5422. }
  5423. /*:499*//*500:*/
  5424. #line 12136 "./typica.w"
  5425. void SqlComboBox::showData(bool show)
  5426. {
  5427. dataColumnShown= show;
  5428. }
  5429. /*:500*//*501:*/
  5430. #line 12147 "./typica.w"
  5431. void SqlComboBox::addNullOption()
  5432. {
  5433. addItem(tr("Unknown"),QVariant(QVariant::String));
  5434. }
  5435. /*:501*//*502:*/
  5436. #line 12160 "./typica.w"
  5437. void SqlComboBox::setDataColumn(int column)
  5438. {
  5439. dataColumn= column;
  5440. }
  5441. void SqlComboBox::setDisplayColumn(int column)
  5442. {
  5443. displayColumn= column;
  5444. }
  5445. /*:502*//*503:*/
  5446. #line 12174 "./typica.w"
  5447. void SqlComboBox::addSqlOptions(QString query)
  5448. {
  5449. SqlQueryConnection*dbquery= new SqlQueryConnection;
  5450. if(!dbquery->exec(query))
  5451. {
  5452. QSqlError error= dbquery->lastError();
  5453. qDebug()<<error.databaseText();
  5454. qDebug()<<error.driverText();
  5455. qDebug()<<error.text();
  5456. qDebug()<<dbquery->lastQuery();
  5457. }
  5458. while(dbquery->next())
  5459. {
  5460. QString displayValue(dbquery->value(displayColumn).toString());
  5461. QString dataValue(dbquery->value(dataColumn).toString());
  5462. if(dataColumnShown)
  5463. {
  5464. displayValue.append(QString(" (%1)").arg(dataValue));
  5465. }
  5466. addItem(displayValue,dataValue);
  5467. }
  5468. delete dbquery;
  5469. }
  5470. /*:503*//*504:*/
  5471. #line 12203 "./typica.w"
  5472. SqlComboBox::SqlComboBox():
  5473. dataColumn(0),displayColumn(0),dataColumnShown(false)
  5474. {
  5475. }
  5476. SqlComboBox::~SqlComboBox()
  5477. {
  5478. }
  5479. /*:504*/
  5480. #line 788 "./typica.w"
  5481. /*506:*/
  5482. #line 12241 "./typica.w"
  5483. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  5484. {
  5485. delegate= widget;
  5486. }
  5487. /*:506*//*507:*/
  5488. #line 12250 "./typica.w"
  5489. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  5490. const QStyleOptionViewItem&,
  5491. const QModelIndex&)const
  5492. {
  5493. return delegate->clone(parent);
  5494. }
  5495. /*:507*//*508:*/
  5496. #line 12261 "./typica.w"
  5497. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  5498. const QModelIndex&index)const
  5499. {
  5500. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5501. self->setCurrentIndex(self->findData(
  5502. index.model()->data(index,
  5503. Qt::UserRole).toString()));
  5504. }
  5505. /*:508*//*509:*/
  5506. #line 12274 "./typica.w"
  5507. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  5508. QAbstractItemModel*model,
  5509. const QModelIndex&index)const
  5510. {
  5511. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  5512. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  5513. Qt::UserRole);
  5514. model->setData(index,self->currentText(),Qt::DisplayRole);
  5515. }
  5516. /*:509*//*510:*/
  5517. #line 12287 "./typica.w"
  5518. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  5519. const QStyleOptionViewItem&option,
  5520. const QModelIndex&)const
  5521. {
  5522. editor->setGeometry(option.rect);
  5523. }
  5524. /*:510*//*511:*/
  5525. #line 12298 "./typica.w"
  5526. QSize SqlComboBoxDelegate::sizeHint()const
  5527. {
  5528. return delegate->sizeHint();
  5529. }
  5530. /*:511*//*512:*/
  5531. #line 12306 "./typica.w"
  5532. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  5533. :QItemDelegate(parent)
  5534. {
  5535. }
  5536. /*:512*/
  5537. #line 789 "./typica.w"
  5538. /*478:*/
  5539. #line 11666 "./typica.w"
  5540. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  5541. {
  5542. /*479:*/
  5543. #line 11681 "./typica.w"
  5544. setOrganizationName("Wilson's Coffee & Tea");
  5545. setOrganizationDomain("wilsonscoffee.com");
  5546. setApplicationName(PROGRAM_NAME);
  5547. /*:479*/
  5548. #line 11669 "./typica.w"
  5549. /*480:*/
  5550. #line 11690 "./typica.w"
  5551. QTranslator base;
  5552. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  5553. {
  5554. installTranslator(&base);
  5555. }
  5556. QTranslator app;
  5557. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  5558. {
  5559. installTranslator(&app);
  5560. }
  5561. /*:480*/
  5562. #line 11670 "./typica.w"
  5563. /*218:*/
  5564. #line 5725 "./typica.w"
  5565. qRegisterMetaType<Measurement> ("Measurement");
  5566. /*:218*/
  5567. #line 11671 "./typica.w"
  5568. /*657:*/
  5569. #line 15386 "./typica.w"
  5570. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  5571. tr("NI DAQmx Base"),
  5572. "nidaqmxbase",NULL);
  5573. topLevelNodeInserters.append(inserter);
  5574. /*:657*//*665:*/
  5575. #line 15603 "./typica.w"
  5576. #ifdef Q_OS_WIN32
  5577. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  5578. topLevelNodeInserters.append(inserter);
  5579. #endif
  5580. /*:665*//*689:*/
  5581. #line 16562 "./typica.w"
  5582. #if 0
  5583. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  5584. topLevelNodeInserters.append(inserter);
  5585. #endif
  5586. /*:689*//*718:*/
  5587. #line 18012 "./typica.w"
  5588. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  5589. topLevelNodeInserters.append(inserter);
  5590. /*:718*/
  5591. #line 11672 "./typica.w"
  5592. }
  5593. /*:478*//*482:*/
  5594. #line 11713 "./typica.w"
  5595. QDomDocument*Application::configuration()
  5596. {
  5597. return&conf;
  5598. }
  5599. /*:482*//*483:*/
  5600. #line 11722 "./typica.w"
  5601. QSqlDatabase Application::database()
  5602. {
  5603. QString connectionName;
  5604. QSqlDatabase connection= QSqlDatabase::database();
  5605. do
  5606. {
  5607. connectionName= QUuid::createUuid().toString();
  5608. }while(QSqlDatabase::connectionNames().contains(connectionName));
  5609. return QSqlDatabase::cloneDatabase(connection,connectionName);
  5610. }
  5611. /*:483*//*593:*/
  5612. #line 14041 "./typica.w"
  5613. void Application::saveDeviceConfiguration()
  5614. {
  5615. QSettings settings;
  5616. settings.setValue("DeviceConfiguration",
  5617. QVariant(deviceConfigurationDocument.toByteArray()));
  5618. }
  5619. /*:593*//*594:*/
  5620. #line 14053 "./typica.w"
  5621. QDomDocument Application::deviceConfiguration()
  5622. {
  5623. if(deviceConfigurationDocument.isNull())
  5624. {
  5625. /*595:*/
  5626. #line 14067 "./typica.w"
  5627. QSettings settings;
  5628. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  5629. QString etext;
  5630. int eline;
  5631. int ecol;
  5632. if(document.length()==0)
  5633. {
  5634. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  5635. /*596:*/
  5636. #line 14091 "./typica.w"
  5637. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5638. emptyDocument.open(QIODevice::ReadOnly);
  5639. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5640. &etext,&eline,&ecol))
  5641. {
  5642. /*597:*/
  5643. #line 14108 "./typica.w"
  5644. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5645. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5646. qDebug()<<etext;
  5647. /*:597*/
  5648. #line 14097 "./typica.w"
  5649. }
  5650. else
  5651. {
  5652. saveDeviceConfiguration();
  5653. }
  5654. /*:596*/
  5655. #line 14076 "./typica.w"
  5656. }
  5657. else
  5658. {
  5659. if(!deviceConfigurationDocument.setContent(document,false,
  5660. &etext,&eline,&ecol))
  5661. {
  5662. /*597:*/
  5663. #line 14108 "./typica.w"
  5664. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5665. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5666. qDebug()<<etext;
  5667. /*:597*/
  5668. #line 14083 "./typica.w"
  5669. /*596:*/
  5670. #line 14091 "./typica.w"
  5671. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  5672. emptyDocument.open(QIODevice::ReadOnly);
  5673. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  5674. &etext,&eline,&ecol))
  5675. {
  5676. /*597:*/
  5677. #line 14108 "./typica.w"
  5678. qDebug()<<QString(tr("An error occurred loading device configuration."));
  5679. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  5680. qDebug()<<etext;
  5681. /*:597*/
  5682. #line 14097 "./typica.w"
  5683. }
  5684. else
  5685. {
  5686. saveDeviceConfiguration();
  5687. }
  5688. /*:596*/
  5689. #line 14084 "./typica.w"
  5690. }
  5691. }
  5692. /*:595*/
  5693. #line 14058 "./typica.w"
  5694. }
  5695. return deviceConfigurationDocument;
  5696. }
  5697. /*:594*//*625:*/
  5698. #line 14709 "./typica.w"
  5699. void Application::registerDeviceConfigurationWidget(QString driver,
  5700. QMetaObject widget)
  5701. {
  5702. deviceConfigurationWidgets.insert(driver,widget);
  5703. }
  5704. /*:625*//*626:*/
  5705. #line 14725 "./typica.w"
  5706. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  5707. const QModelIndex&index)
  5708. {
  5709. QVariant nodeReference= index.data(Qt::UserRole);
  5710. QDomElement referenceElement= model->referenceElement(
  5711. model->data(index,Qt::UserRole).toString());
  5712. QMetaObject metaObject=
  5713. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  5714. QWidget::staticMetaObject);
  5715. QWidget*editor;
  5716. if(metaObject.className()==QWidget::staticMetaObject.className())
  5717. {
  5718. editor= NULL;
  5719. }
  5720. else
  5721. {
  5722. editor= qobject_cast<QWidget*> (
  5723. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  5724. Q_ARG(QModelIndex,index)));
  5725. }
  5726. return editor;
  5727. }
  5728. /*:626*/
  5729. #line 790 "./typica.w"
  5730. /*517:*/
  5731. #line 12401 "./typica.w"
  5732. SqlConnectionSetup::SqlConnectionSetup():
  5733. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  5734. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  5735. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  5736. cancelButton(new QPushButton(tr("Cancel"))),
  5737. connectButton(new QPushButton(tr("Connect")))
  5738. {
  5739. driver->addItem("PostgreSQL","QPSQL");
  5740. formLayout->addRow(tr("Database driver:"),driver);
  5741. formLayout->addRow(tr("Host name:"),hostname);
  5742. formLayout->addRow(tr("Database name:"),dbname);
  5743. formLayout->addRow(tr("User name:"),user);
  5744. password->setEchoMode(QLineEdit::Password);
  5745. formLayout->addRow(tr("Password:"),password);
  5746. layout->addLayout(formLayout);
  5747. buttons->addStretch(1);
  5748. buttons->addWidget(cancelButton);
  5749. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  5750. buttons->addWidget(connectButton);
  5751. layout->addLayout(buttons);
  5752. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  5753. setLayout(layout);
  5754. setModal(true);
  5755. }
  5756. SqlConnectionSetup::~SqlConnectionSetup()
  5757. {
  5758. }
  5759. /*:517*//*518:*/
  5760. #line 12435 "./typica.w"
  5761. void SqlConnectionSetup::testConnection()
  5762. {
  5763. QSqlDatabase database=
  5764. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  5765. toString());
  5766. database.setHostName(hostname->text());
  5767. database.setDatabaseName(dbname->text());
  5768. database.setUserName(user->text());
  5769. database.setPassword(password->text());
  5770. if(database.open())
  5771. {
  5772. QSettings settings;
  5773. settings.setValue("database/exists","true");
  5774. settings.setValue("database/driver",
  5775. driver->itemData(driver->currentIndex()).toString());
  5776. settings.setValue("database/hostname",hostname->text());
  5777. settings.setValue("database/dbname",dbname->text());
  5778. settings.setValue("database/user",user->text());
  5779. settings.setValue("database/password",password->text());
  5780. accept();
  5781. }
  5782. else
  5783. {
  5784. QMessageBox::information(this,tr("Database connection failed"),
  5785. tr("Failed to connect to database."));
  5786. }
  5787. }
  5788. /*:518*/
  5789. #line 791 "./typica.w"
  5790. /*522:*/
  5791. #line 12530 "./typica.w"
  5792. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  5793. {
  5794. setModel(new QSqlQueryModel);
  5795. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  5796. this,SLOT(openRow(QModelIndex)));
  5797. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  5798. this,SLOT(persistColumnResize(int,int,int)));
  5799. }
  5800. /*:522*//*523:*/
  5801. #line 12545 "./typica.w"
  5802. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  5803. {
  5804. /*524:*/
  5805. #line 12554 "./typica.w"
  5806. QSettings settings;
  5807. /*525:*/
  5808. #line 12567 "./typica.w"
  5809. QWidget*topLevelWidget= this;
  5810. while(topLevelWidget->parentWidget())
  5811. {
  5812. topLevelWidget= topLevelWidget->parentWidget();
  5813. }
  5814. /*:525*/
  5815. #line 12556 "./typica.w"
  5816. settings.setValue(QString("columnWidths/%1/%2/%3").
  5817. arg(topLevelWidget->objectName()).
  5818. arg(objectName()).arg(column),
  5819. QVariant(newsize));
  5820. /*:524*/
  5821. #line 12548 "./typica.w"
  5822. }
  5823. /*:523*//*526:*/
  5824. #line 12577 "./typica.w"
  5825. void SqlQueryView::showEvent(QShowEvent*event)
  5826. {
  5827. /*527:*/
  5828. #line 12587 "./typica.w"
  5829. QSettings settings;
  5830. /*525:*/
  5831. #line 12567 "./typica.w"
  5832. QWidget*topLevelWidget= this;
  5833. while(topLevelWidget->parentWidget())
  5834. {
  5835. topLevelWidget= topLevelWidget->parentWidget();
  5836. }
  5837. /*:525*/
  5838. #line 12589 "./typica.w"
  5839. QString baseKey=
  5840. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5841. arg(objectName());
  5842. for(int i= 0;i<model()->columnCount();i++)
  5843. {
  5844. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5845. if(settings.contains(key))
  5846. {
  5847. setColumnWidth(i,settings.value(key).toInt());
  5848. }
  5849. }
  5850. /*:527*/
  5851. #line 12580 "./typica.w"
  5852. event->accept();
  5853. }
  5854. /*:526*//*528:*/
  5855. #line 12604 "./typica.w"
  5856. void SqlQueryView::openRow(const QModelIndex&index)
  5857. {
  5858. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  5859. emit openEntryRow(index.row());
  5860. }
  5861. /*:528*//*529:*/
  5862. #line 12615 "./typica.w"
  5863. void SqlQueryView::setQuery(const QString&query)
  5864. {
  5865. QSqlDatabase database= AppInstance->database();
  5866. database.open();
  5867. QSqlQuery q(query,database);
  5868. ((QSqlQueryModel*)model())->setQuery(q);
  5869. }
  5870. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  5871. const QVariant&value,int role)
  5872. {
  5873. return model()->setHeaderData(section,orientation,value,role);
  5874. }
  5875. /*:529*//*530:*/
  5876. #line 12632 "./typica.w"
  5877. QVariant SqlQueryView::data(int row,int column,int role)
  5878. {
  5879. return model()->data(model()->index(row,column),role);
  5880. }
  5881. /*:530*/
  5882. #line 792 "./typica.w"
  5883. /*135:*/
  5884. #line 3270 "./typica.w"
  5885. SqlQueryConnection::SqlQueryConnection(const QString&query)
  5886. {
  5887. QSqlDatabase database= AppInstance->database();
  5888. database.open();
  5889. q= new QSqlQuery(query,database);
  5890. connection= database.connectionName();
  5891. }
  5892. /*:135*//*136:*/
  5893. #line 3283 "./typica.w"
  5894. SqlQueryConnection::~SqlQueryConnection()
  5895. {
  5896. delete q;
  5897. {
  5898. QSqlDatabase database= QSqlDatabase::database(connection);
  5899. database.close();
  5900. }
  5901. QSqlDatabase::removeDatabase(connection);
  5902. }
  5903. /*:136*//*137:*/
  5904. #line 3297 "./typica.w"
  5905. QSqlQuery*SqlQueryConnection::operator->()
  5906. {
  5907. return q;
  5908. }
  5909. /*:137*/
  5910. #line 793 "./typica.w"
  5911. /*549:*/
  5912. #line 12981 "./typica.w"
  5913. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  5914. area(frame),configuration(description)
  5915. {
  5916. refresh();
  5917. }
  5918. ReportTable::~ReportTable()
  5919. {
  5920. }
  5921. /*:549*//*550:*/
  5922. #line 12997 "./typica.w"
  5923. void ReportTable::bind(QString placeholder,QVariant value)
  5924. {
  5925. bindings.insert(placeholder,value);
  5926. }
  5927. /*:550*//*551:*/
  5928. #line 13007 "./typica.w"
  5929. void ReportTable::refresh()
  5930. {
  5931. /*552:*/
  5932. #line 13028 "./typica.w"
  5933. QTextCursor cursor= area->firstCursorPosition();
  5934. while(cursor<area->lastCursorPosition())
  5935. {
  5936. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  5937. }
  5938. cursor.removeSelectedText();
  5939. /*:552*/
  5940. #line 13010 "./typica.w"
  5941. int rows= 1;
  5942. int columns= 1;
  5943. int currentRow= 0;
  5944. QTextTable*table= cursor.insertTable(rows,columns);
  5945. /*553:*/
  5946. #line 13041 "./typica.w"
  5947. QTextTableFormat format= table->format();
  5948. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  5949. if(configuration.hasAttribute("align"))
  5950. {
  5951. if(configuration.attribute("align")=="center")
  5952. {
  5953. format.setAlignment(Qt::AlignHCenter);
  5954. }
  5955. }
  5956. table->setFormat(format);
  5957. /*:553*/
  5958. #line 13015 "./typica.w"
  5959. /*554:*/
  5960. #line 13055 "./typica.w"
  5961. QDomNodeList children= configuration.childNodes();
  5962. for(int i= 0;i<children.count();i++)
  5963. {
  5964. QDomNode current;
  5965. QDomElement currentElement;
  5966. current= children.at(i);
  5967. if(current.isElement())
  5968. {
  5969. currentElement= current.toElement();
  5970. if(currentElement.tagName()=="query")
  5971. {
  5972. /*555:*/
  5973. #line 13082 "./typica.w"
  5974. SqlQueryConnection query;
  5975. query.prepare(currentElement.text());
  5976. foreach(QString key,bindings.uniqueKeys())
  5977. {
  5978. if(currentElement.text().contains(key))
  5979. {
  5980. query.bindValue(key,bindings.value(key));
  5981. }
  5982. }
  5983. query.exec();
  5984. if(!query.next())
  5985. {
  5986. continue;
  5987. }
  5988. if(query.record().count()> columns)
  5989. {
  5990. table->appendColumns(query.record().count()-columns);
  5991. }
  5992. do
  5993. {
  5994. table->appendRows(1);
  5995. rows++;
  5996. currentRow++;
  5997. for(int j= 0;j<query.record().count();j++)
  5998. {
  5999. QTextTableCell cell= table->cellAt(currentRow,j);
  6000. cursor= cell.firstCursorPosition();
  6001. cursor.insertText(query.value(j).toString());
  6002. }
  6003. }while(query.next());
  6004. /*:555*/
  6005. #line 13067 "./typica.w"
  6006. }
  6007. else if(currentElement.tagName()=="row")
  6008. {
  6009. /*556:*/
  6010. #line 13121 "./typica.w"
  6011. table->appendRows(1);
  6012. currentRow++;
  6013. rows++;
  6014. QDomNodeList rowChildren= currentElement.childNodes();
  6015. int currentColumn= 0;
  6016. for(int j= 0;j<rowChildren.count();j++)
  6017. {
  6018. QDomNode node;
  6019. QDomElement nodeElement;
  6020. node= rowChildren.at(j);
  6021. if(node.isElement())
  6022. {
  6023. nodeElement= node.toElement();
  6024. if(nodeElement.tagName()=="cell")
  6025. {
  6026. if(currentColumn==columns)
  6027. {
  6028. table->appendColumns(1);
  6029. columns++;
  6030. }
  6031. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  6032. cursor= cell.firstCursorPosition();
  6033. cursor.insertText(nodeElement.text());
  6034. currentColumn++;
  6035. }
  6036. }
  6037. }
  6038. /*:556*/
  6039. #line 13071 "./typica.w"
  6040. }
  6041. }
  6042. }
  6043. /*:554*/
  6044. #line 13016 "./typica.w"
  6045. if(rows> 1)
  6046. {
  6047. table->removeRows(0,1);
  6048. }
  6049. }
  6050. /*:551*/
  6051. #line 794 "./typica.w"
  6052. /*561:*/
  6053. #line 13223 "./typica.w"
  6054. FormArray::FormArray(QDomElement description):configuration(description),
  6055. maxwidth(-1),maxheight(-1)
  6056. {
  6057. setWidget(&itemContainer);
  6058. itemContainer.setLayout(&itemLayout);
  6059. }
  6060. /*:561*//*562:*/
  6061. #line 13240 "./typica.w"
  6062. void FormArray::addElements(int copies)
  6063. {
  6064. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  6065. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  6066. QWidget*widget;
  6067. for(int i= 0;i<copies;i++)
  6068. {
  6069. widget= new QWidget;
  6070. if(maxwidth> -1)
  6071. {
  6072. widget->setMaximumWidth(maxwidth);
  6073. }
  6074. if(maxheight> -1)
  6075. {
  6076. widget->setMaximumHeight(maxheight);
  6077. }
  6078. if(configuration.hasChildNodes())
  6079. {
  6080. widgetStack->push(widget);
  6081. populateWidget(configuration,widgetStack,layoutStack);
  6082. widgetStack->pop();
  6083. widget->setMinimumHeight(widget->sizeHint().height());
  6084. itemLayout.addWidget(widget);
  6085. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  6086. {
  6087. itemContainer.setMinimumHeight(maxheight*elements()+50);
  6088. }
  6089. else
  6090. {
  6091. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  6092. +widget->sizeHint().height());
  6093. }
  6094. if(maxwidth> -1)
  6095. {
  6096. itemContainer.setMinimumWidth(maxwidth+50);
  6097. }
  6098. else
  6099. {
  6100. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  6101. }
  6102. }
  6103. }
  6104. }
  6105. /*:562*//*563:*/
  6106. #line 13290 "./typica.w"
  6107. QWidget*FormArray::elementAt(int index)
  6108. {
  6109. if(index<itemLayout.count())
  6110. {
  6111. QLayoutItem*item= itemLayout.itemAt(index);
  6112. return item->widget();
  6113. }
  6114. else
  6115. {
  6116. return NULL;
  6117. }
  6118. }
  6119. /*:563*//*564:*/
  6120. #line 13307 "./typica.w"
  6121. void FormArray::removeAllElements()
  6122. {
  6123. while(itemLayout.count()> 0)
  6124. {
  6125. QLayoutItem*item;
  6126. item= itemLayout.itemAt(0);
  6127. item->widget()->hide();
  6128. itemLayout.removeWidget(item->widget());
  6129. }
  6130. itemContainer.setMinimumHeight(0);
  6131. }
  6132. /*:564*//*565:*/
  6133. #line 13323 "./typica.w"
  6134. int FormArray::elements()
  6135. {
  6136. return itemLayout.count();
  6137. }
  6138. /*:565*//*566:*/
  6139. #line 13334 "./typica.w"
  6140. void FormArray::setMaximumElementWidth(int width)
  6141. {
  6142. maxwidth= width;
  6143. }
  6144. void FormArray::setMaximumElementHeight(int height)
  6145. {
  6146. maxheight= height;
  6147. }
  6148. /*:566*/
  6149. #line 795 "./typica.w"
  6150. /*572:*/
  6151. #line 13465 "./typica.w"
  6152. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  6153. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  6154. {
  6155. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  6156. QPointF(0,5);
  6157. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  6158. QPointF(10,5);
  6159. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  6160. QPointF(0,0);
  6161. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  6162. initialBrush.setColor(QColor(170,170,255));
  6163. initialBrush.setStyle(Qt::SolidPattern);
  6164. finalBrush.setColor(Qt::blue);
  6165. finalBrush.setStyle(Qt::SolidPattern);
  6166. initialDecrement.setPolygon(left);
  6167. initialDecrement.setBrush(initialBrush);
  6168. initialDecrement.setPos(0,0);
  6169. scene.addItem(&initialDecrement);
  6170. initialIncrement.setPolygon(right);
  6171. initialIncrement.setBrush(initialBrush);
  6172. initialIncrement.setPos(122,0);
  6173. scene.addItem(&initialIncrement);
  6174. finalDecrement.setPolygon(left);
  6175. finalDecrement.setBrush(finalBrush);
  6176. finalDecrement.setPos(0,12);
  6177. scene.addItem(&finalDecrement);
  6178. finalIncrement.setPolygon(right);
  6179. finalIncrement.setBrush(finalBrush);
  6180. finalIncrement.setPos(122,12);
  6181. scene.addItem(&finalIncrement);
  6182. scalePath.moveTo(0,10);
  6183. scalePath.lineTo(100,10);
  6184. scalePath.moveTo(0,0);
  6185. scalePath.lineTo(0,20);
  6186. scalePath.moveTo(10,5);
  6187. scalePath.lineTo(10,15);
  6188. scalePath.moveTo(20,5);
  6189. scalePath.lineTo(20,15);
  6190. scalePath.moveTo(30,5);
  6191. scalePath.lineTo(30,15);
  6192. scalePath.moveTo(40,5);
  6193. scalePath.lineTo(40,15);
  6194. scalePath.moveTo(50,0);
  6195. scalePath.lineTo(50,20);
  6196. scalePath.moveTo(60,5);
  6197. scalePath.lineTo(60,15);
  6198. scalePath.moveTo(70,5);
  6199. scalePath.lineTo(70,15);
  6200. scalePath.moveTo(80,5);
  6201. scalePath.lineTo(80,15);
  6202. scalePath.moveTo(90,5);
  6203. scalePath.lineTo(90,15);
  6204. scalePath.moveTo(100,0);
  6205. scalePath.lineTo(100,20);
  6206. scaleLine.setPath(scalePath);
  6207. scaleLine.setPos(16,1);
  6208. scene.addItem(&scaleLine);
  6209. setScene(&scene);
  6210. initialIndicator.setPolygon(down);
  6211. initialIndicator.setBrush(initialBrush);
  6212. finalIndicator.setPolygon(up);
  6213. finalIndicator.setBrush(finalBrush);
  6214. setMinimumSize(sizeHint());
  6215. setMaximumSize(sizeHint());
  6216. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6217. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6218. setMinimumSize(sizeHint());
  6219. }
  6220. /*:572*//*573:*/
  6221. #line 13538 "./typica.w"
  6222. QSize ScaleControl::sizeHint()const
  6223. {
  6224. return QSize(140,30);
  6225. }
  6226. /*:573*//*574:*/
  6227. #line 13547 "./typica.w"
  6228. void ScaleControl::setInitialValue(double value)
  6229. {
  6230. if(value>=0&&value<=10)
  6231. {
  6232. nonScoredValue= value;
  6233. if(!initialSet)
  6234. {
  6235. scene.addItem(&initialIndicator);
  6236. }
  6237. initialSet= true;
  6238. initialIndicator.setPos(value*10+16,10);
  6239. emit initialChanged(value);
  6240. if(!finalSet)
  6241. {
  6242. setFinalValue(value);
  6243. }
  6244. }
  6245. }
  6246. void ScaleControl::setFinalValue(double value)
  6247. {
  6248. if(value>=0&&value<=10)
  6249. {
  6250. scoredValue= value;
  6251. if(!finalSet)
  6252. {
  6253. scene.addItem(&finalIndicator);
  6254. }
  6255. finalSet= true;
  6256. finalIndicator.setPos(value*10+16,11);
  6257. emit finalChanged(value);
  6258. }
  6259. }
  6260. /*:574*//*575:*/
  6261. #line 13584 "./typica.w"
  6262. double ScaleControl::initialValue(void)
  6263. {
  6264. return nonScoredValue;
  6265. }
  6266. double ScaleControl::finalValue(void)
  6267. {
  6268. return scoredValue;
  6269. }
  6270. /*:575*//*576:*/
  6271. #line 13605 "./typica.w"
  6272. void ScaleControl::mousePressEvent(QMouseEvent*event)
  6273. {
  6274. /*577:*/
  6275. #line 13617 "./typica.w"
  6276. if(event->button()!=Qt::LeftButton)
  6277. {
  6278. event->ignore();
  6279. return;
  6280. }
  6281. /*:577*/
  6282. #line 13608 "./typica.w"
  6283. scaleDown= true;
  6284. event->accept();
  6285. }
  6286. /*:576*//*578:*/
  6287. #line 13628 "./typica.w"
  6288. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  6289. {
  6290. /*577:*/
  6291. #line 13617 "./typica.w"
  6292. if(event->button()!=Qt::LeftButton)
  6293. {
  6294. event->ignore();
  6295. return;
  6296. }
  6297. /*:577*/
  6298. #line 13631 "./typica.w"
  6299. if(!scaleDown)
  6300. {
  6301. event->ignore();
  6302. return;
  6303. }
  6304. scaleDown= false;
  6305. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6306. /*579:*/
  6307. #line 13653 "./typica.w"
  6308. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  6309. {
  6310. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6311. {
  6312. if(initialSet)
  6313. {
  6314. setInitialValue(nonScoredValue-0.05);
  6315. }
  6316. event->accept();
  6317. return;
  6318. }
  6319. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6320. {
  6321. if(finalSet)
  6322. {
  6323. setFinalValue(scoredValue-0.05);
  6324. event->accept();
  6325. return;
  6326. }
  6327. }
  6328. }
  6329. /*:579*/
  6330. #line 13639 "./typica.w"
  6331. /*580:*/
  6332. #line 13679 "./typica.w"
  6333. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  6334. {
  6335. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6336. {
  6337. if(initialSet)
  6338. {
  6339. setInitialValue(nonScoredValue+0.05);
  6340. event->accept();
  6341. return;
  6342. }
  6343. }
  6344. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  6345. {
  6346. if(finalSet)
  6347. {
  6348. setFinalValue(scoredValue+0.05);
  6349. event->accept();
  6350. return;
  6351. }
  6352. }
  6353. }
  6354. /*:580*/
  6355. #line 13640 "./typica.w"
  6356. /*581:*/
  6357. #line 13705 "./typica.w"
  6358. double relativeX= sceneCoordinate.x()-16;
  6359. if(initialSet)
  6360. {
  6361. if(relativeX>=0&&relativeX<=100)
  6362. {
  6363. setFinalValue(relativeX/10.0);
  6364. event->accept();
  6365. return;
  6366. }
  6367. }
  6368. else
  6369. {
  6370. if(relativeX>=0&&relativeX<=100)
  6371. {
  6372. setInitialValue(relativeX/10.0);
  6373. event->accept();
  6374. return;
  6375. }
  6376. }
  6377. /*:581*/
  6378. #line 13641 "./typica.w"
  6379. event->ignore();
  6380. return;
  6381. }
  6382. /*:578*/
  6383. #line 796 "./typica.w"
  6384. /*583:*/
  6385. #line 13771 "./typica.w"
  6386. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  6387. valueSet(false),scaleDown(false)
  6388. {
  6389. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6390. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6391. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  6392. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  6393. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  6394. theBrush.setColor(Qt::blue);
  6395. theBrush.setStyle(Qt::SolidPattern);
  6396. increment.setPolygon(up);
  6397. increment.setBrush(theBrush);
  6398. increment.setPos(0,0);
  6399. scene.addItem(&increment);
  6400. decrement.setPolygon(down);
  6401. decrement.setBrush(theBrush);
  6402. decrement.setPos(0,122);
  6403. scene.addItem(&decrement);
  6404. scalePath.moveTo(5,0);
  6405. scalePath.lineTo(5,100);
  6406. scalePath.moveTo(0,0);
  6407. scalePath.lineTo(10,0);
  6408. scalePath.moveTo(0,10);
  6409. scalePath.lineTo(10,10);
  6410. scalePath.moveTo(0,20);
  6411. scalePath.lineTo(10,20);
  6412. scalePath.moveTo(0,30);
  6413. scalePath.lineTo(10,30);
  6414. scalePath.moveTo(0,40);
  6415. scalePath.lineTo(10,40);
  6416. scalePath.moveTo(0,50);
  6417. scalePath.lineTo(10,50);
  6418. scalePath.moveTo(0,60);
  6419. scalePath.lineTo(10,60);
  6420. scalePath.moveTo(0,70);
  6421. scalePath.lineTo(10,70);
  6422. scalePath.moveTo(0,80);
  6423. scalePath.lineTo(10,80);
  6424. scalePath.moveTo(0,90);
  6425. scalePath.lineTo(10,90);
  6426. scalePath.moveTo(0,100);
  6427. scalePath.lineTo(10,100);
  6428. scaleLine.setPath(scalePath);
  6429. scaleLine.setPos(0,16);
  6430. scene.addItem(&scaleLine);
  6431. setScene(&scene);
  6432. indicator.setPolygon(left);
  6433. indicator.setBrush(theBrush);
  6434. setMinimumSize(sizeHint());
  6435. setMaximumSize(sizeHint());
  6436. }
  6437. /*:583*//*584:*/
  6438. #line 13826 "./typica.w"
  6439. QSize IntensityControl::sizeHint()const
  6440. {
  6441. return QSize(25,160);
  6442. }
  6443. /*:584*//*585:*/
  6444. #line 13841 "./typica.w"
  6445. void IntensityControl::setValue(double val)
  6446. {
  6447. if(val>=0&&val<=10)
  6448. {
  6449. theValue= val;
  6450. if(!valueSet)
  6451. {
  6452. scene.addItem(&indicator);
  6453. }
  6454. valueSet= true;
  6455. indicator.setPos(6,(100-(val*10))+16);
  6456. emit(valueChanged(val));
  6457. }
  6458. else if(val<1)
  6459. {
  6460. setValue(0);
  6461. }
  6462. else
  6463. {
  6464. setValue(10);
  6465. }
  6466. }
  6467. double IntensityControl::value()
  6468. {
  6469. return theValue;
  6470. }
  6471. /*:585*//*586:*/
  6472. #line 13873 "./typica.w"
  6473. void IntensityControl::mousePressEvent(QMouseEvent*event)
  6474. {
  6475. /*577:*/
  6476. #line 13617 "./typica.w"
  6477. if(event->button()!=Qt::LeftButton)
  6478. {
  6479. event->ignore();
  6480. return;
  6481. }
  6482. /*:577*/
  6483. #line 13876 "./typica.w"
  6484. scaleDown= true;
  6485. event->accept();
  6486. }
  6487. /*:586*//*587:*/
  6488. #line 13887 "./typica.w"
  6489. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  6490. {
  6491. /*577:*/
  6492. #line 13617 "./typica.w"
  6493. if(event->button()!=Qt::LeftButton)
  6494. {
  6495. event->ignore();
  6496. return;
  6497. }
  6498. /*:577*/
  6499. #line 13890 "./typica.w"
  6500. if(!scaleDown)
  6501. {
  6502. event->ignore();
  6503. return;
  6504. }
  6505. scaleDown= false;
  6506. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  6507. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  6508. {
  6509. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  6510. {
  6511. if(valueSet)
  6512. {
  6513. setValue(theValue+0.05);
  6514. }
  6515. event->accept();
  6516. return;
  6517. }
  6518. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  6519. {
  6520. if(valueSet)
  6521. {
  6522. setValue(theValue-0.05);
  6523. }
  6524. event->accept();
  6525. return;
  6526. }
  6527. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  6528. {
  6529. setValue(10-((sceneCoordinate.y()-16)/10.0));
  6530. event->accept();
  6531. return;
  6532. }
  6533. }
  6534. }
  6535. /*:587*/
  6536. #line 797 "./typica.w"
  6537. /*287:*/
  6538. #line 7475 "./typica.w"
  6539. void ThresholdDetector::newMeasurement(Measurement measure)
  6540. {
  6541. if((currentDirection==Ascending&&previousValue<threshold&&
  6542. previousValue>=0)||(currentDirection==Descending&&
  6543. previousValue> threshold&&previousValue>=0))
  6544. {
  6545. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  6546. (currentDirection==Descending&&measure.temperature()<=threshold))
  6547. {
  6548. double offset= measure.time().hour()*60*60;
  6549. offset+= measure.time().minute()*60;
  6550. offset+= measure.time().second();
  6551. offset+= measure.time().msec()/1000;
  6552. emit timeForValue(offset);
  6553. }
  6554. }
  6555. previousValue= measure.temperature();
  6556. }
  6557. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  6558. previousValue(-1),threshold(value),currentDirection(Ascending)
  6559. {
  6560. }
  6561. void ThresholdDetector::setThreshold(double value)
  6562. {
  6563. threshold= value;
  6564. }
  6565. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  6566. {
  6567. currentDirection= direction;
  6568. }
  6569. /*:287*/
  6570. #line 798 "./typica.w"
  6571. /*668:*/
  6572. #line 15643 "./typica.w"
  6573. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  6574. lister(new QextSerialEnumerator)
  6575. {
  6576. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  6577. QextPortInfo port;
  6578. foreach(port,ports)
  6579. {
  6580. addItem(port.portName);
  6581. }
  6582. lister->setUpNotifications();
  6583. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  6584. this,SLOT(addDevice(QextPortInfo)));
  6585. setEditable(true);
  6586. }
  6587. void PortSelector::addDevice(QextPortInfo port)
  6588. {
  6589. addItem(port.portName);
  6590. }
  6591. /*:668*/
  6592. #line 799 "./typica.w"
  6593. /*670:*/
  6594. #line 15731 "./typica.w"
  6595. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  6596. {
  6597. QMetaObject meta= BaudSelector::staticMetaObject;
  6598. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  6599. for(int i= 0;i<type.keyCount();i++)
  6600. {
  6601. addItem(QString("%1").arg(type.value(i)));
  6602. }
  6603. }
  6604. /*:670*/
  6605. #line 800 "./typica.w"
  6606. /*672:*/
  6607. #line 15769 "./typica.w"
  6608. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  6609. {
  6610. QMetaObject meta= ParitySelector::staticMetaObject;
  6611. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  6612. for(int i= 0;i<type.keyCount();i++)
  6613. {
  6614. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6615. }
  6616. }
  6617. /*:672*/
  6618. #line 801 "./typica.w"
  6619. /*674:*/
  6620. #line 15799 "./typica.w"
  6621. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  6622. {
  6623. QMetaObject meta= FlowSelector::staticMetaObject;
  6624. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  6625. for(int i= 0;i<type.keyCount();i++)
  6626. {
  6627. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6628. }
  6629. }
  6630. /*:674*/
  6631. #line 802 "./typica.w"
  6632. /*676:*/
  6633. #line 15834 "./typica.w"
  6634. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  6635. {
  6636. QMetaObject meta= StopSelector::staticMetaObject;
  6637. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  6638. for(int i= 0;i<type.keyCount();i++)
  6639. {
  6640. addItem(QString(type.key(i)),QVariant(type.value(i)));
  6641. }
  6642. }
  6643. /*:676*/
  6644. #line 803 "./typica.w"
  6645. /*716:*/
  6646. #line 17579 "./typica.w"
  6647. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  6648. :BasicDeviceConfigurationWidget(model,index),
  6649. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  6650. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  6651. decimalQuery(new QCheckBox(tr("Enable"))),
  6652. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  6653. unitQuery(new QCheckBox(tr("Enable"))),
  6654. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  6655. valueC(new QSpinBox),fixedUnit(new QComboBox),
  6656. pVAddress(new ShortHexSpinBox),
  6657. sVEnabled(new QCheckBox(tr("Enable"))),
  6658. sVReadAddress(new ShortHexSpinBox),
  6659. deviceLimit(new QCheckBox(tr("Enable"))),
  6660. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  6661. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  6662. sVWritable(new QCheckBox(tr("Enable"))),
  6663. sVOutputAddr(new ShortHexSpinBox),
  6664. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  6665. {
  6666. QHBoxLayout*layout= new QHBoxLayout;
  6667. QWidget*form= new QWidget;
  6668. QHBoxLayout*masterLayout= new QHBoxLayout;
  6669. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  6670. QVBoxLayout*seriesLayout= new QVBoxLayout;
  6671. QFormLayout*serialSection= new QFormLayout;
  6672. serialSection->addRow(QString(tr("Port:")),port);
  6673. serialSection->addRow(QString(tr("Baud rate:")),baud);
  6674. serialSection->addRow(QString(tr("Parity:")),parity);
  6675. serialSection->addRow(QString(tr("Flow control:")),flow);
  6676. serialSection->addRow(QString(tr("Stop bits:")),stop);
  6677. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  6678. serialSectionBox->setLayout(serialSection);
  6679. portAndDeviceLayout->addWidget(serialSectionBox);
  6680. QFormLayout*deviceSection= new QFormLayout;
  6681. station->setMinimum(1);
  6682. station->setMaximum(255);
  6683. decimalPosition->setMinimum(0);
  6684. decimalPosition->setMaximum(9);
  6685. valueF->setMinimum(0);
  6686. valueF->setMaximum(0xFFFF);
  6687. valueC->setMinimum(0);
  6688. valueC->setMaximum(0xFFFF);
  6689. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  6690. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  6691. deviceSection->addRow(tr("Station:"),station);
  6692. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  6693. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  6694. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  6695. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  6696. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  6697. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  6698. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  6699. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  6700. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  6701. deviceSectionBox->setLayout(deviceSection);
  6702. portAndDeviceLayout->addWidget(deviceSectionBox);
  6703. QFormLayout*pVSection= new QFormLayout;
  6704. pVSection->addRow(tr("Value relative address:"),pVAddress);
  6705. pVSection->addRow(tr("PV column name:"),pVColumnName);
  6706. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  6707. processValueBox->setLayout(pVSection);
  6708. seriesLayout->addWidget(processValueBox);
  6709. QFormLayout*sVSection= new QFormLayout;
  6710. sVLower->setDecimals(1);
  6711. sVLower->setMinimum(0.0);
  6712. sVLower->setMaximum(999.9);
  6713. sVUpper->setDecimals(1);
  6714. sVUpper->setMinimum(0.0);
  6715. sVUpper->setMaximum(999.9);
  6716. sVSection->addRow(tr("Set value:"),sVEnabled);
  6717. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  6718. sVSection->addRow(tr("SV column name:"),sVColumnName);
  6719. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  6720. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  6721. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  6722. sVSection->addRow(tr("Lower limit:"),sVLower);
  6723. sVSection->addRow(tr("Upper limit:"),sVUpper);
  6724. sVSection->addRow(tr("Output set value:"),sVWritable);
  6725. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  6726. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  6727. setValueBox->setLayout(sVSection);
  6728. seriesLayout->addWidget(setValueBox);
  6729. masterLayout->addLayout(portAndDeviceLayout);
  6730. masterLayout->addLayout(seriesLayout);
  6731. form->setLayout(masterLayout);
  6732. /*644:*/
  6733. #line 15127 "./typica.w"
  6734. QDomElement referenceElement=
  6735. model->referenceElement(model->data(index,Qt::UserRole).toString());
  6736. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  6737. QDomElement node;
  6738. /*:644*/
  6739. #line 17665 "./typica.w"
  6740. for(int i= 0;i<configData.size();i++)
  6741. {
  6742. node= configData.at(i).toElement();
  6743. if(node.attribute("name")=="port")
  6744. {
  6745. QString portname= node.attribute("value");
  6746. int idx= port->findText(portname);
  6747. if(idx>=0)
  6748. {
  6749. port->setCurrentIndex(idx);
  6750. }
  6751. else
  6752. {
  6753. port->addItem(portname);
  6754. }
  6755. }
  6756. else if(node.attribute("name")=="baud")
  6757. {
  6758. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  6759. }
  6760. else if(node.attribute("name")=="parity")
  6761. {
  6762. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  6763. }
  6764. else if(node.attribute("name")=="flow")
  6765. {
  6766. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  6767. }
  6768. else if(node.attribute("name")=="stop")
  6769. {
  6770. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  6771. }
  6772. else if(node.attribute("name")=="station")
  6773. {
  6774. station->setValue(node.attribute("value").toInt());
  6775. }
  6776. else if(node.attribute("name")=="decimalQuery")
  6777. {
  6778. if(node.attribute("value")=="true")
  6779. {
  6780. decimalQuery->setChecked(true);
  6781. }
  6782. else
  6783. {
  6784. decimalQuery->setChecked(false);
  6785. }
  6786. }
  6787. else if(node.attribute("name")=="decimalAddress")
  6788. {
  6789. decimalAddress->setValue(node.attribute("value").toInt());
  6790. }
  6791. else if(node.attribute("name")=="decimalPosition")
  6792. {
  6793. decimalPosition->setValue(node.attribute("value").toInt());
  6794. }
  6795. else if(node.attribute("name")=="unitQuery")
  6796. {
  6797. if(node.attribute("value")=="true")
  6798. {
  6799. unitQuery->setChecked(true);
  6800. }
  6801. else
  6802. {
  6803. unitQuery->setChecked(false);
  6804. }
  6805. }
  6806. else if(node.attribute("name")=="unitAddress")
  6807. {
  6808. unitAddress->setValue(node.attribute("value").toInt());
  6809. }
  6810. else if(node.attribute("name")=="valueF")
  6811. {
  6812. valueF->setValue(node.attribute("value").toInt());
  6813. }
  6814. else if(node.attribute("name")=="valueC")
  6815. {
  6816. valueC->setValue(node.attribute("value").toInt());
  6817. }
  6818. else if(node.attribute("name")=="fixedUnit")
  6819. {
  6820. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  6821. }
  6822. else if(node.attribute("name")=="pVAddress")
  6823. {
  6824. pVAddress->setValue(node.attribute("value").toInt());
  6825. }
  6826. else if(node.attribute("name")=="sVEnabled")
  6827. {
  6828. if(node.attribute("value")=="true")
  6829. {
  6830. sVEnabled->setChecked(true);
  6831. }
  6832. else
  6833. {
  6834. sVEnabled->setChecked(false);
  6835. }
  6836. }
  6837. else if(node.attribute("name")=="sVReadAddress")
  6838. {
  6839. sVReadAddress->setValue(node.attribute("value").toInt());
  6840. }
  6841. else if(node.attribute("name")=="deviceLimit")
  6842. {
  6843. if(node.attribute("value")=="true")
  6844. {
  6845. deviceLimit->setChecked(true);
  6846. }
  6847. else
  6848. {
  6849. deviceLimit->setChecked(false);
  6850. }
  6851. }
  6852. else if(node.attribute("name")=="sVLowerAddr")
  6853. {
  6854. sVLowerAddr->setValue(node.attribute("value").toInt());
  6855. }
  6856. else if(node.attribute("name")=="sVUpperAddr")
  6857. {
  6858. sVUpperAddr->setValue(node.attribute("value").toInt());
  6859. }
  6860. else if(node.attribute("name")=="sVLower")
  6861. {
  6862. sVLower->setValue(node.attribute("value").toDouble());
  6863. }
  6864. else if(node.attribute("name")=="sVUpper")
  6865. {
  6866. sVUpper->setValue(node.attribute("value").toDouble());
  6867. }
  6868. else if(node.attribute("name")=="sVWritable")
  6869. {
  6870. if(node.attribute("value")=="true")
  6871. {
  6872. sVWritable->setChecked(true);
  6873. }
  6874. else
  6875. {
  6876. sVWritable->setChecked(false);
  6877. }
  6878. }
  6879. else if(node.attribute("name")=="sVOutputAddr")
  6880. {
  6881. sVOutputAddr->setValue(node.attribute("value").toInt());
  6882. }
  6883. else if(node.attribute("name")=="pvcolname")
  6884. {
  6885. pVColumnName->setText(node.attribute("value"));
  6886. }
  6887. else if(node.attribute("name")=="svcolname")
  6888. {
  6889. sVColumnName->setText(node.attribute("value"));
  6890. }
  6891. }
  6892. updatePort(port->currentText());
  6893. updateBaudRate(baud->currentText());
  6894. updateParity(parity->itemData(parity->currentIndex()).toString());
  6895. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  6896. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  6897. updateStation(station->value());
  6898. updateFixedDecimal(decimalQuery->isChecked());
  6899. updateDecimalAddress(decimalAddress->value());
  6900. updateDecimalPosition(decimalPosition->value());
  6901. updateFixedUnit(unitQuery->isChecked());
  6902. updateUnitAddress(unitAddress->value());
  6903. updateValueForF(valueF->value());
  6904. updateValueForC(valueC->value());
  6905. updateUnit(fixedUnit->currentText());
  6906. updatePVAddress(pVAddress->value());
  6907. updateSVEnabled(sVEnabled->isChecked());
  6908. updateSVReadAddress(sVReadAddress->value());
  6909. updateDeviceLimit(deviceLimit->isChecked());
  6910. updateSVLowerAddress(sVLowerAddr->value());
  6911. updateSVUpperAddress(sVUpperAddr->value());
  6912. updateSVLower(sVLower->value());
  6913. updateSVUpper(sVUpper->value());
  6914. updateSVWritable(sVWritable->isChecked());
  6915. updateSVWriteAddress(sVOutputAddr->value());
  6916. updatePVColumnName(pVColumnName->text());
  6917. updateSVColumnName(sVColumnName->text());
  6918. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  6919. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  6920. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  6921. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  6922. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  6923. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  6924. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  6925. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  6926. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  6927. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  6928. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  6929. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  6930. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  6931. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  6932. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  6933. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  6934. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  6935. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  6936. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  6937. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  6938. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  6939. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  6940. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  6941. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  6942. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  6943. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  6944. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  6945. layout->addWidget(form);
  6946. setLayout(layout);
  6947. }
  6948. void ModbusConfigurator::updatePort(const QString&newPort)
  6949. {
  6950. updateAttribute("port",newPort);
  6951. }
  6952. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  6953. {
  6954. updateAttribute("baud",newRate);
  6955. }
  6956. void ModbusConfigurator::updateParity(const QString&)
  6957. {
  6958. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  6959. }
  6960. void ModbusConfigurator::updateFlowControl(const QString&)
  6961. {
  6962. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  6963. }
  6964. void ModbusConfigurator::updateStopBits(const QString&)
  6965. {
  6966. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  6967. }
  6968. void ModbusConfigurator::updateStation(int station)
  6969. {
  6970. updateAttribute("station",QString("%1").arg(station));
  6971. }
  6972. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  6973. {
  6974. updateAttribute("decimalQuery",fixed?"true":"false");
  6975. }
  6976. void ModbusConfigurator::updateDecimalAddress(int address)
  6977. {
  6978. updateAttribute("decimalAddress",QString("%1").arg(address));
  6979. }
  6980. void ModbusConfigurator::updateDecimalPosition(int position)
  6981. {
  6982. updateAttribute("decimalPosition",QString("%1").arg(position));
  6983. }
  6984. void ModbusConfigurator::updateFixedUnit(bool fixed)
  6985. {
  6986. updateAttribute("unitQuery",fixed?"true":"false");
  6987. }
  6988. void ModbusConfigurator::updateUnitAddress(int address)
  6989. {
  6990. updateAttribute("unitAddress",QString("%1").arg(address));
  6991. }
  6992. void ModbusConfigurator::updateValueForF(int value)
  6993. {
  6994. updateAttribute("valueF",QString("%1").arg(value));
  6995. }
  6996. void ModbusConfigurator::updateValueForC(int value)
  6997. {
  6998. updateAttribute("valueC",QString("%1").arg(value));
  6999. }
  7000. void ModbusConfigurator::updateUnit(const QString&newUnit)
  7001. {
  7002. updateAttribute("fixedUnit",newUnit);
  7003. }
  7004. void ModbusConfigurator::updatePVAddress(int address)
  7005. {
  7006. updateAttribute("pVAddress",QString("%1").arg(address));
  7007. }
  7008. void ModbusConfigurator::updateSVEnabled(bool enabled)
  7009. {
  7010. updateAttribute("sVEnabled",enabled?"true":"false");
  7011. }
  7012. void ModbusConfigurator::updateSVReadAddress(int address)
  7013. {
  7014. updateAttribute("sVReadAddress",QString("%1").arg(address));
  7015. }
  7016. void ModbusConfigurator::updateDeviceLimit(bool query)
  7017. {
  7018. updateAttribute("deviceLimit",query?"true":"false");
  7019. }
  7020. void ModbusConfigurator::updateSVLowerAddress(int address)
  7021. {
  7022. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  7023. }
  7024. void ModbusConfigurator::updateSVUpperAddress(int address)
  7025. {
  7026. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  7027. }
  7028. void ModbusConfigurator::updateSVLower(double value)
  7029. {
  7030. updateAttribute("sVLower",QString("%1").arg(value));
  7031. }
  7032. void ModbusConfigurator::updateSVUpper(double value)
  7033. {
  7034. updateAttribute("sVUpper",QString("%1").arg(value));
  7035. }
  7036. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  7037. {
  7038. updateAttribute("sVWritable",canWriteSV?"true":"false");
  7039. }
  7040. void ModbusConfigurator::updateSVWriteAddress(int address)
  7041. {
  7042. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  7043. }
  7044. void ModbusConfigurator::updatePVColumnName(const QString&name)
  7045. {
  7046. updateAttribute("pvcolname",name);
  7047. }
  7048. void ModbusConfigurator::updateSVColumnName(const QString&name)
  7049. {
  7050. updateAttribute("svcolname",name);
  7051. }
  7052. /*:716*/
  7053. #line 804 "./typica.w"
  7054. /*679:*/
  7055. #line 15883 "./typica.w"
  7056. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  7057. {
  7058. setMinimum(0);
  7059. setMaximum(0xFFFF);
  7060. setPrefix("0x");
  7061. setMinimumWidth(65);
  7062. }
  7063. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  7064. {
  7065. if(input.size()==2)
  7066. {
  7067. return QValidator::Intermediate;
  7068. }
  7069. bool okay;
  7070. input.toInt(&okay,16);
  7071. if(okay)
  7072. {
  7073. return QValidator::Acceptable;
  7074. }
  7075. return QValidator::Invalid;
  7076. }
  7077. int ShortHexSpinBox::valueFromText(const QString&text)const
  7078. {
  7079. return text.toInt(NULL,16);
  7080. }
  7081. QString ShortHexSpinBox::textFromValue(int value)const
  7082. {
  7083. QString retval;
  7084. retval.setNum(value,16);
  7085. while(retval.size()<4)
  7086. {
  7087. retval.prepend("0");
  7088. }
  7089. return retval.toUpper();
  7090. }
  7091. /*:679*/
  7092. #line 805 "./typica.w"
  7093. /*701:*/
  7094. #line 16909 "./typica.w"
  7095. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  7096. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  7097. waiting(false)
  7098. {
  7099. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  7100. Qt::UserRole).toString());
  7101. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  7102. QDomElement node;
  7103. QVariantMap attributes;
  7104. for(int i= 0;i<portConfigData.size();i++)
  7105. {
  7106. node= portConfigData.at(i).toElement();
  7107. attributes.insert(node.attribute("name"),node.attribute("value"));
  7108. }
  7109. port= new QextSerialPort(attributes.value("port").toString(),
  7110. QextSerialPort::EventDriven);
  7111. int baudRate= attributes.value("baud").toInt();
  7112. port->setBaudRate((BaudRateType)baudRate);
  7113. double temp= ((double)(1)/(double)(baudRate))*48;
  7114. delayTime= (int)(temp*3000);
  7115. messageDelayTimer->setSingleShot(true);
  7116. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  7117. port->setDataBits(DATA_8);
  7118. port->setParity((ParityType)attributes.value("parity").toInt());
  7119. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  7120. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  7121. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  7122. port->open(QIODevice::ReadWrite);
  7123. station= (char)attributes.value("station").toInt();
  7124. if(attributes.value("decimalQuery")=="true")
  7125. {
  7126. decimalPosition= 0;
  7127. QByteArray message;
  7128. message.append(station);
  7129. message.append((char)0x03);
  7130. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  7131. char*addressBytes= (char*)&address;
  7132. message.append(addressBytes[1]);
  7133. message.append(addressBytes[0]);
  7134. message.append((char)0x00);
  7135. message.append((char)0x01);
  7136. queueMessage(message,this,"decimalResponse(QByteArray)");
  7137. }
  7138. else
  7139. {
  7140. decimalPosition= attributes.value("decimalPosition").toInt();
  7141. }
  7142. valueF= attributes.value("valueF").toInt();
  7143. valueC= attributes.value("valueC").toInt();
  7144. if(attributes.value("unitQuery")=="true")
  7145. {
  7146. QByteArray message;
  7147. message.append(station);
  7148. message.append((char)0x03);
  7149. quint16 address= (quint16)attributes.value("unitAddress").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,"unitResponse(QByteArray)");
  7156. }
  7157. else
  7158. {
  7159. if(attributes.value("fixedUnit")=="Celsius")
  7160. {
  7161. unitIsF= false;
  7162. }
  7163. }
  7164. if(attributes.value("sVWritable")=="true")
  7165. {
  7166. if(attributes.value("deviceLimit")=="true")
  7167. {
  7168. QByteArray lmessage;
  7169. lmessage.append(station);
  7170. lmessage.append((char)0x03);
  7171. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  7172. char*addressBytes= (char*)&laddress;
  7173. lmessage.append(addressBytes[1]);
  7174. lmessage.append(addressBytes[0]);
  7175. lmessage.append((char)0x00);
  7176. lmessage.append((char)0x01);
  7177. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  7178. QByteArray umessage;
  7179. umessage.append(station);
  7180. umessage.append((char)0x03);
  7181. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  7182. addressBytes= (char*)&uaddress;
  7183. umessage.append(addressBytes[1]);
  7184. umessage.append(addressBytes[0]);
  7185. umessage.append((char)0x00);
  7186. umessage.append((char)0x01);
  7187. queueMessage(umessage,this,"svuResponse(QByteArray)");
  7188. }
  7189. else
  7190. {
  7191. outputSVLower= attributes.value("sVLower").toDouble();
  7192. outputSVUpper= attributes.value("sVUpper").toDouble();
  7193. }
  7194. outputSVStub.append(station);
  7195. outputSVStub.append((char)0x06);
  7196. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  7197. char*addressBytes= (char*)&address;
  7198. outputSVStub.append(addressBytes[1]);
  7199. outputSVStub.append(addressBytes[0]);
  7200. }
  7201. Channel*pv= new Channel;
  7202. channels.append(pv);
  7203. pvStub.append(station);
  7204. pvStub.append((char)0x04);
  7205. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  7206. char*pvac= (char*)&pvaddress;
  7207. pvStub.append(pvac[1]);
  7208. pvStub.append(pvac[0]);
  7209. pvStub.append((char)0x00);
  7210. pvStub.append((char)0x01);
  7211. svenabled= attributes.value("sVEnabled").toBool();
  7212. if(svenabled)
  7213. {
  7214. Channel*sv= new Channel;
  7215. channels.append(sv);
  7216. svStub.append(station);
  7217. svStub.append((char)0x04);
  7218. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  7219. char*svac= (char*)&svaddress;
  7220. svStub.append(svac[1]);
  7221. svStub.append(svac[0]);
  7222. svStub.append((char)0x00);
  7223. svStub.append((char)0x01);
  7224. if(svaddress-pvaddress==1)
  7225. {
  7226. mStub.append(station);
  7227. mStub.append((char)0x04);
  7228. mStub.append(pvac[1]);
  7229. mStub.append(pvac[0]);
  7230. mStub.append((char)0x00);
  7231. mStub.append((char)0x02);
  7232. }
  7233. }
  7234. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  7235. requestMeasurement();
  7236. }
  7237. double ModbusRTUDevice::SVLower()
  7238. {
  7239. return outputSVLower;
  7240. }
  7241. double ModbusRTUDevice::SVUpper()
  7242. {
  7243. return outputSVUpper;
  7244. }
  7245. int ModbusRTUDevice::decimals()
  7246. {
  7247. return decimalPosition;
  7248. }
  7249. void ModbusRTUDevice::decimalResponse(QByteArray response)
  7250. {
  7251. quint16 temp;
  7252. char*tchar= (char*)&temp;
  7253. tchar[1]= response.at(3);
  7254. tchar[0]= response.at(4);
  7255. decimalPosition= temp;
  7256. emit SVDecimalChanged(decimalPosition);
  7257. qDebug()<<"Received decimal response";
  7258. }
  7259. void ModbusRTUDevice::unitResponse(QByteArray response)
  7260. {
  7261. quint16 temp;
  7262. char*tchar= (char*)&temp;
  7263. tchar[1]= response.at(3);
  7264. tchar[0]= response.at(4);
  7265. int value= temp;
  7266. if(value==valueF)
  7267. {
  7268. unitIsF= true;
  7269. }
  7270. else
  7271. {
  7272. unitIsF= false;
  7273. }
  7274. }
  7275. void ModbusRTUDevice::svlResponse(QByteArray response)
  7276. {
  7277. quint16 temp;
  7278. char*tchar= (char*)&temp;
  7279. tchar[1]= response.at(3);
  7280. tchar[0]= response.at(4);
  7281. outputSVLower= (double)temp;
  7282. for(int i= 0;i<decimalPosition;i++)
  7283. {
  7284. outputSVLower/= 10;
  7285. }
  7286. emit SVLowerChanged(outputSVLower);
  7287. }
  7288. void ModbusRTUDevice::svuResponse(QByteArray response)
  7289. {
  7290. quint16 temp;
  7291. char*tchar= (char*)&temp;
  7292. tchar[1]= response.at(3);
  7293. tchar[0]= response.at(4);
  7294. outputSVUpper= (double)temp;
  7295. for(int i= 0;i<decimalPosition;i++)
  7296. {
  7297. outputSVUpper/= 10;
  7298. }
  7299. emit SVUpperChanged(outputSVUpper);
  7300. }
  7301. void ModbusRTUDevice::requestMeasurement()
  7302. {
  7303. if(mStub.length()> 0)
  7304. {
  7305. queueMessage(mStub,this,"mResponse(QByteArray)");
  7306. }
  7307. else
  7308. {
  7309. queueMessage(pvStub,this,"mResponse(QByteArray)");
  7310. if(svenabled)
  7311. {
  7312. queueMessage(svStub,this,"mResponse(QByteArray)");
  7313. }
  7314. }
  7315. }
  7316. void ModbusRTUDevice::mResponse(QByteArray response)
  7317. {
  7318. QTime time= QTime::currentTime();
  7319. if(response.at(2)==0x04)
  7320. {
  7321. /*702:*/
  7322. #line 17158 "./typica.w"
  7323. quint16 pv;
  7324. quint16 sv;
  7325. char*pvBytes= (char*)&pv;
  7326. char*svBytes= (char*)&sv;
  7327. pvBytes[1]= response.at(3);
  7328. pvBytes[0]= response.at(4);
  7329. svBytes[1]= response.at(5);
  7330. svBytes[0]= response.at(6);
  7331. double pvOut= (double)pv;
  7332. double svOut= (double)sv;
  7333. for(int i= 0;i<decimalPosition;i++)
  7334. {
  7335. pvOut/= 10;
  7336. svOut/= 10;
  7337. }
  7338. if(!unitIsF)
  7339. {
  7340. pvOut= pvOut*9/5+32;
  7341. svOut= svOut*9/5+32;
  7342. }
  7343. Measurement pvm(pvOut,time,Measurement::Fahrenheit);
  7344. Measurement svm(svOut,time,Measurement::Fahrenheit);
  7345. channels.at(0)->input(pvm);
  7346. channels.at(1)->input(svm);
  7347. /*:702*/
  7348. #line 17145 "./typica.w"
  7349. }
  7350. else
  7351. {
  7352. /*703:*/
  7353. #line 17188 "./typica.w"
  7354. quint16 value;
  7355. char*valueBytes= (char*)&value;
  7356. valueBytes[1]= response.at(3);
  7357. valueBytes[0]= response.at(4);
  7358. double valueOut= (double)value;
  7359. for(int i= 0;i<decimalPosition;i++)
  7360. {
  7361. valueOut/= 10;
  7362. }
  7363. if(!unitIsF)
  7364. {
  7365. valueOut= valueOut*9/5+32;
  7366. }
  7367. if(!svenabled)
  7368. {
  7369. Measurement vm(valueOut,time,Measurement::Fahrenheit);
  7370. channels.at(0)->input(vm);
  7371. }
  7372. else
  7373. {
  7374. if(readingsv)
  7375. {
  7376. Measurement pvm(savedpv,time,Measurement::Fahrenheit);
  7377. Measurement svm(valueOut,time,Measurement::Fahrenheit);
  7378. channels.at(0)->input(pvm);
  7379. channels.at(1)->input(svm);
  7380. readingsv= false;
  7381. }
  7382. else
  7383. {
  7384. savedpv= valueOut;
  7385. readingsv= true;
  7386. }
  7387. }
  7388. /*:703*/
  7389. #line 17149 "./typica.w"
  7390. }
  7391. }
  7392. /*:701*//*704:*/
  7393. #line 17226 "./typica.w"
  7394. ModbusRTUDevice::~ModbusRTUDevice()
  7395. {
  7396. messageDelayTimer->stop();
  7397. port->close();
  7398. }
  7399. /*:704*//*705:*/
  7400. #line 17248 "./typica.w"
  7401. void ModbusRTUDevice::dataAvailable()
  7402. {
  7403. if(messageDelayTimer->isActive())
  7404. {
  7405. messageDelayTimer->stop();
  7406. }
  7407. responseBuffer.append(port->readAll());
  7408. /*706:*/
  7409. #line 17293 "./typica.w"
  7410. if(responseBuffer.size()<5)
  7411. {
  7412. return;
  7413. }
  7414. switch(responseBuffer.at(1))
  7415. {
  7416. case 0x01:
  7417. case 0x02:
  7418. if(responseBuffer.size()<6)
  7419. {
  7420. return;
  7421. }
  7422. responseBuffer= responseBuffer.left(6);
  7423. break;
  7424. case 0x03:
  7425. case 0x04:
  7426. if(responseBuffer.size()<5+responseBuffer.at(2))
  7427. {
  7428. return;
  7429. }
  7430. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  7431. break;
  7432. case 0x05:
  7433. case 0x06:
  7434. case 0x10:
  7435. if(responseBuffer.size()<8)
  7436. {
  7437. return;
  7438. }
  7439. responseBuffer= responseBuffer.left(8);
  7440. break;
  7441. }
  7442. /*:706*/
  7443. #line 17256 "./typica.w"
  7444. if(calculateCRC(responseBuffer)==0)
  7445. {
  7446. QObject*object= retObjQueue.at(0);
  7447. char*method= callbackQueue.at(0);
  7448. QMetaMethod metamethod= object->metaObject()->
  7449. method(object->metaObject()->
  7450. indexOfMethod(QMetaObject::normalizedSignature(method)));
  7451. metamethod.invoke(object,Qt::QueuedConnection,
  7452. Q_ARG(QByteArray,responseBuffer));
  7453. messageQueue.removeAt(0);
  7454. retObjQueue.removeAt(0);
  7455. callbackQueue.removeAt(0);
  7456. messageDelayTimer->start(delayTime);
  7457. }
  7458. else
  7459. {
  7460. qDebug()<<"CRC failed";
  7461. }
  7462. waiting= false;
  7463. responseBuffer.clear();
  7464. }
  7465. /*:705*//*707:*/
  7466. #line 17335 "./typica.w"
  7467. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  7468. {
  7469. quint16 retval= 0xFFFF;
  7470. int i= 0;
  7471. while(i<data.size())
  7472. {
  7473. retval^= 0x00FF&(quint16)data.at(i);
  7474. for(int j= 0;j<8;j++)
  7475. {
  7476. if(retval&1)
  7477. {
  7478. retval= (retval>>1)^0xA001;
  7479. }
  7480. else
  7481. {
  7482. retval>>= 1;
  7483. }
  7484. }
  7485. i++;
  7486. }
  7487. return retval;
  7488. }
  7489. /*:707*//*708:*/
  7490. #line 17366 "./typica.w"
  7491. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  7492. const char*callback)
  7493. {
  7494. messageQueue.append(request);
  7495. retObjQueue.append(object);
  7496. callbackQueue.append(const_cast<char*> (callback));
  7497. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  7498. {
  7499. sendNextMessage();
  7500. }
  7501. }
  7502. void ModbusRTUDevice::sendNextMessage()
  7503. {
  7504. if(messageQueue.size()> 0&&!waiting)
  7505. {
  7506. QByteArray message= messageQueue.at(0);
  7507. quint16 crc= calculateCRC(message);
  7508. char*check= (char*)&crc;
  7509. message.append(check[0]);
  7510. message.append(check[1]);
  7511. port->write(message);
  7512. messageDelayTimer->start(delayTime);
  7513. waiting= true;
  7514. }
  7515. else
  7516. {
  7517. emit queueEmpty();
  7518. }
  7519. }
  7520. void ModbusRTUDevice::outputSV(double value)
  7521. {
  7522. for(int i= 0;i<decimalPosition;i++)
  7523. {
  7524. value*= 10;
  7525. }
  7526. quint16 outval= (quint16)value;
  7527. QByteArray message(outputSVStub);
  7528. char*valBytes= (char*)&outval;
  7529. message.append(valBytes[1]);
  7530. message.append(valBytes[0]);
  7531. queueMessage(message,this,"ignore(QByteArray)");
  7532. }
  7533. /*:708*//*709:*/
  7534. #line 17414 "./typica.w"
  7535. void ModbusRTUDevice::ignore(QByteArray)
  7536. {
  7537. return;
  7538. }
  7539. /*:709*/
  7540. #line 806 "./typica.w"
  7541. /*599:*/
  7542. #line 14145 "./typica.w"
  7543. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  7544. DeviceTreeModelNode*parent)
  7545. :domNode(node),rowNumber(row),parentItem(parent)
  7546. {
  7547. }
  7548. DeviceTreeModelNode::~DeviceTreeModelNode()
  7549. {
  7550. QHash<int,DeviceTreeModelNode*> ::iterator i;
  7551. for(i= children.begin();i!=children.end();i++)
  7552. {
  7553. delete i.value();
  7554. }
  7555. }
  7556. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  7557. {
  7558. return parentItem;
  7559. }
  7560. int DeviceTreeModelNode::row()
  7561. {
  7562. return rowNumber;
  7563. }
  7564. QDomNode DeviceTreeModelNode::node()const
  7565. {
  7566. return domNode;
  7567. }
  7568. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  7569. {
  7570. if(children.contains(index))
  7571. {
  7572. return children[index];
  7573. }
  7574. if(index>=0&&index<domNode.childNodes().count())
  7575. {
  7576. QDomNode childNode= domNode.childNodes().item(index);
  7577. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  7578. index,this);
  7579. children[index]= childItem;
  7580. return childItem;
  7581. }
  7582. return NULL;
  7583. }
  7584. /*:599*/
  7585. #line 807 "./typica.w"
  7586. /*601:*/
  7587. #line 14234 "./typica.w"
  7588. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  7589. :QAbstractItemModel(parent)
  7590. {
  7591. document= AppInstance->deviceConfiguration();
  7592. QDomNodeList elements= document.elementsByTagName("devices");
  7593. if(elements.size()!=1)
  7594. {
  7595. qDebug()<<"Unexpected result when loading device map.";
  7596. }
  7597. treeRoot= elements.at(0);
  7598. root= new DeviceTreeModelNode(treeRoot,0);
  7599. elements= document.elementsByTagName("references");
  7600. if(elements.size()!=1)
  7601. {
  7602. qDebug()<<"No references section. Creating.";
  7603. referenceSection= document.createElement("references");
  7604. document.appendChild(referenceSection);
  7605. }
  7606. else
  7607. {
  7608. referenceSection= elements.at(0);
  7609. }
  7610. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  7611. AppInstance,SLOT(saveDeviceConfiguration()));
  7612. connect(this,SIGNAL(modelReset()),
  7613. AppInstance,SLOT(saveDeviceConfiguration()));
  7614. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7615. AppInstance,SLOT(saveDeviceConfiguration()));
  7616. }
  7617. /*:601*//*602:*/
  7618. #line 14269 "./typica.w"
  7619. int DeviceTreeModel::columnCount(const QModelIndex&)const
  7620. {
  7621. return 1;
  7622. }
  7623. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  7624. {
  7625. if(parent.column()> 0)
  7626. {
  7627. return 0;
  7628. }
  7629. /*603:*/
  7630. #line 14288 "./typica.w"
  7631. DeviceTreeModelNode*parentItem;
  7632. if(!parent.isValid())
  7633. {
  7634. parentItem= root;
  7635. }
  7636. else
  7637. {
  7638. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7639. }
  7640. /*:603*/
  7641. #line 14281 "./typica.w"
  7642. return parentItem->node().childNodes().count();
  7643. }
  7644. /*:602*//*604:*/
  7645. #line 14302 "./typica.w"
  7646. QModelIndex DeviceTreeModel::index(int row,int column,
  7647. const QModelIndex&parent)const
  7648. {
  7649. if(!hasIndex(row,column,parent))
  7650. {
  7651. return QModelIndex();
  7652. }
  7653. /*603:*/
  7654. #line 14288 "./typica.w"
  7655. DeviceTreeModelNode*parentItem;
  7656. if(!parent.isValid())
  7657. {
  7658. parentItem= root;
  7659. }
  7660. else
  7661. {
  7662. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7663. }
  7664. /*:603*/
  7665. #line 14310 "./typica.w"
  7666. DeviceTreeModelNode*childItem= parentItem->child(row);
  7667. if(childItem)
  7668. {
  7669. return createIndex(row,column,childItem);
  7670. }
  7671. return QModelIndex();
  7672. }
  7673. /*:604*//*605:*/
  7674. #line 14321 "./typica.w"
  7675. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  7676. {
  7677. if(!child.isValid())
  7678. {
  7679. return QModelIndex();
  7680. }
  7681. DeviceTreeModelNode*childItem=
  7682. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  7683. DeviceTreeModelNode*parentItem= childItem->parent();
  7684. if(!parentItem||parentItem==root)
  7685. {
  7686. return QModelIndex();
  7687. }
  7688. return createIndex(parentItem->row(),0,parentItem);
  7689. }
  7690. /*:605*//*606:*/
  7691. #line 14340 "./typica.w"
  7692. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  7693. {
  7694. if(!index.isValid())
  7695. {
  7696. return 0;
  7697. }
  7698. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  7699. }
  7700. /*:606*//*607:*/
  7701. #line 14355 "./typica.w"
  7702. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  7703. {
  7704. if(!index.isValid())
  7705. {
  7706. return QVariant();
  7707. }
  7708. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  7709. {
  7710. return QVariant();
  7711. }
  7712. DeviceTreeModelNode*item=
  7713. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7714. QDomNode node= item->node();
  7715. QDomElement element= node.toElement();
  7716. switch(role)
  7717. {
  7718. case Qt::DisplayRole:
  7719. case Qt::EditRole:
  7720. return QVariant(element.attribute("name"));
  7721. case Qt::UserRole:
  7722. return QVariant(element.attribute("reference"));
  7723. default:
  7724. return QVariant();
  7725. }
  7726. return QVariant();
  7727. }
  7728. /*:607*//*608:*/
  7729. #line 14387 "./typica.w"
  7730. bool DeviceTreeModel::setData(const QModelIndex&index,
  7731. const QVariant&value,int)
  7732. {
  7733. if(!index.isValid())
  7734. {
  7735. return false;
  7736. }
  7737. DeviceTreeModelNode*item=
  7738. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  7739. QDomNode node= item->node();
  7740. QDomElement element= node.toElement();
  7741. element.setAttribute("name",value.toString());
  7742. emit dataChanged(index,index);
  7743. return true;
  7744. }
  7745. /*:608*//*609:*/
  7746. #line 14410 "./typica.w"
  7747. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  7748. const QModelIndex&parent)
  7749. {
  7750. QString referenceID= QUuid::createUuid().toString();
  7751. /*603:*/
  7752. #line 14288 "./typica.w"
  7753. DeviceTreeModelNode*parentItem;
  7754. if(!parent.isValid())
  7755. {
  7756. parentItem= root;
  7757. }
  7758. else
  7759. {
  7760. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7761. }
  7762. /*:603*/
  7763. #line 14415 "./typica.w"
  7764. QDomNode parentNode= parentItem->node();
  7765. int newRowNumber= rowCount(parent);
  7766. beginInsertRows(parent,newRowNumber,newRowNumber);
  7767. QDomElement deviceElement= document.createElement("node");
  7768. deviceElement.setAttribute("name",name);
  7769. deviceElement.setAttribute("reference",referenceID);
  7770. parentNode.appendChild(deviceElement);
  7771. QDomElement referenceElement= document.createElement("reference");
  7772. referenceElement.setAttribute("id",referenceID);
  7773. referenceElement.setAttribute("driver",driver);
  7774. referenceSection.appendChild(referenceElement);
  7775. endInsertRows();
  7776. }
  7777. /*:609*//*610:*/
  7778. #line 14433 "./typica.w"
  7779. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  7780. {
  7781. /*603:*/
  7782. #line 14288 "./typica.w"
  7783. DeviceTreeModelNode*parentItem;
  7784. if(!parent.isValid())
  7785. {
  7786. parentItem= root;
  7787. }
  7788. else
  7789. {
  7790. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  7791. }
  7792. /*:603*/
  7793. #line 14436 "./typica.w"
  7794. QDomNode parentNode= parentItem->node();
  7795. QDomNodeList childNodes= parentNode.childNodes();
  7796. if(childNodes.size()<row+count)
  7797. {
  7798. return false;
  7799. }
  7800. beginRemoveRows(parent,row,row+count-1);
  7801. QList<QDomElement> removalList;
  7802. for(int i= row;i<row+count;i++)
  7803. {
  7804. removalList.append(childNodes.at(i).toElement());
  7805. }
  7806. QDomElement element;
  7807. QDomElement reference;
  7808. for(int i= 0;i<count;i++)
  7809. {
  7810. element= removalList.at(i);
  7811. if(element.hasAttribute("reference"))
  7812. {
  7813. reference= referenceElement(element.attribute("reference"));
  7814. if(!reference.isNull())
  7815. {
  7816. referenceSection.removeChild(reference);
  7817. }
  7818. }
  7819. parentNode.removeChild(element);
  7820. }
  7821. endRemoveRows();
  7822. beginResetModel();
  7823. delete root;
  7824. root= new DeviceTreeModelNode(treeRoot,0);
  7825. endResetModel();
  7826. return true;
  7827. }
  7828. /*:610*//*611:*/
  7829. #line 14475 "./typica.w"
  7830. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  7831. {
  7832. QDomNodeList childNodes= referenceSection.childNodes();
  7833. QDomElement element;
  7834. for(int i= 0;i<childNodes.size();i++)
  7835. {
  7836. element= childNodes.at(i).toElement();
  7837. if(element.hasAttribute("id"))
  7838. {
  7839. if(element.attribute("id")==id)
  7840. {
  7841. return element;
  7842. }
  7843. }
  7844. }
  7845. return QDomElement();
  7846. }
  7847. /*:611*//*612:*/
  7848. #line 14496 "./typica.w"
  7849. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  7850. {
  7851. return QVariant();
  7852. }
  7853. /*:612*//*613:*/
  7854. #line 14505 "./typica.w"
  7855. DeviceTreeModel::~DeviceTreeModel()
  7856. {
  7857. delete root;
  7858. }
  7859. /*:613*/
  7860. #line 808 "./typica.w"
  7861. /*639:*/
  7862. #line 14975 "./typica.w"
  7863. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  7864. DeviceTreeModel*model,const QModelIndex&index)
  7865. :QWidget(NULL),deviceModel(model),currentNode(index)
  7866. {
  7867. }
  7868. /*:639*//*640:*/
  7869. #line 14987 "./typica.w"
  7870. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  7871. const QString&value)
  7872. {
  7873. QDomElement referenceElement= deviceModel->referenceElement(
  7874. deviceModel->data(currentNode,Qt::UserRole).toString());
  7875. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7876. QDomElement node;
  7877. bool found= false;
  7878. for(int i= 0;i<configData.size();i++)
  7879. {
  7880. node= configData.at(i).toElement();
  7881. if(node.attribute("name")==name)
  7882. {
  7883. node.setAttribute("value",value);
  7884. found= true;
  7885. break;
  7886. }
  7887. }
  7888. if(!found)
  7889. {
  7890. node= AppInstance->deviceConfiguration().createElement("attribute");
  7891. node.setAttribute("name",name);
  7892. node.setAttribute("value",value);
  7893. referenceElement.appendChild(node);
  7894. }
  7895. AppInstance->saveDeviceConfiguration();
  7896. }
  7897. /*:640*//*641:*/
  7898. #line 15021 "./typica.w"
  7899. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  7900. const QString&driver)
  7901. {
  7902. deviceModel->newNode(name,driver,currentNode);
  7903. }
  7904. /*:641*/
  7905. #line 809 "./typica.w"
  7906. /*631:*/
  7907. #line 14843 "./typica.w"
  7908. DeviceConfigurationWindow::DeviceConfigurationWindow():QMainWindow(NULL),
  7909. view(new QTreeView),configArea(new QScrollArea)
  7910. {
  7911. QSplitter*splitter= new QSplitter;
  7912. QWidget*leftWidget= new QWidget;
  7913. leftWidget->setMinimumWidth(200);
  7914. QVBoxLayout*left= new QVBoxLayout;
  7915. view->setAnimated(true);
  7916. view->setSelectionMode(QAbstractItemView::SingleSelection);
  7917. document= AppInstance->deviceConfiguration();
  7918. model= new DeviceTreeModel;
  7919. view->setModel(model);
  7920. view->expandAll();
  7921. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  7922. QHBoxLayout*treeButtons= new QHBoxLayout;
  7923. QToolButton*addDeviceButton= new QToolButton;
  7924. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  7925. addDeviceButton->setToolTip(tr("New Roaster"));
  7926. connect(addDeviceButton,SIGNAL(clicked()),
  7927. this,SLOT(addDevice()));
  7928. QToolButton*removeNodeButton= new QToolButton;
  7929. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  7930. removeNodeButton->setToolTip(tr("Delete Selection"));
  7931. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  7932. treeButtons->addWidget(addDeviceButton);
  7933. treeButtons->addWidget(removeNodeButton);
  7934. left->addWidget(view);
  7935. left->addLayout(treeButtons);
  7936. leftWidget->setLayout(left);
  7937. splitter->addWidget(leftWidget);
  7938. configArea->setMinimumWidth(580);
  7939. configArea->setMinimumHeight(460);
  7940. splitter->addWidget(configArea);
  7941. setCentralWidget(splitter);
  7942. connect(view,SIGNAL(activated(QModelIndex)),
  7943. this,SLOT(newSelection(QModelIndex)));
  7944. connect(view,SIGNAL(clicked(QModelIndex)),
  7945. this,SLOT(newSelection(QModelIndex)));
  7946. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  7947. view,SLOT(expand(QModelIndex)));
  7948. }
  7949. /*:631*//*632:*/
  7950. #line 14889 "./typica.w"
  7951. void DeviceConfigurationWindow::addDevice()
  7952. {
  7953. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  7954. }
  7955. /*:632*//*633:*/
  7956. #line 14897 "./typica.w"
  7957. void DeviceConfigurationWindow::removeNode()
  7958. {
  7959. QModelIndex index= view->currentIndex();
  7960. if(index.isValid())
  7961. {
  7962. int row= index.row();
  7963. QModelIndex parent= index.parent();
  7964. model->removeRow(row,parent);
  7965. }
  7966. }
  7967. /*:633*//*634:*/
  7968. #line 14913 "./typica.w"
  7969. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  7970. {
  7971. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  7972. if(editor)
  7973. {
  7974. configArea->setWidget(editor);
  7975. editor->show();
  7976. }
  7977. }
  7978. /*:634*/
  7979. #line 810 "./typica.w"
  7980. /*654:*/
  7981. #line 15317 "./typica.w"
  7982. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  7983. const QModelIndex&index):
  7984. BasicDeviceConfigurationWidget(model,index)
  7985. {
  7986. QFormLayout*layout= new QFormLayout;
  7987. QLineEdit*columnName= new QLineEdit;
  7988. layout->addRow(tr("Column Name:"),columnName);
  7989. QComboBox*typeSelector= new QComboBox;
  7990. typeSelector->addItem("J");
  7991. typeSelector->addItem("K");
  7992. typeSelector->addItem("T");
  7993. typeSelector->addItem("B");
  7994. typeSelector->addItem("E");
  7995. typeSelector->addItem("N");
  7996. typeSelector->addItem("R");
  7997. typeSelector->addItem("S");
  7998. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  7999. setLayout(layout);
  8000. /*644:*/
  8001. #line 15127 "./typica.w"
  8002. QDomElement referenceElement=
  8003. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8004. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8005. QDomElement node;
  8006. /*:644*/
  8007. #line 15336 "./typica.w"
  8008. for(int i= 0;i<configData.size();i++)
  8009. {
  8010. node= configData.at(i).toElement();
  8011. if(node.attribute("name")=="type")
  8012. {
  8013. typeSelector->setCurrentIndex(
  8014. typeSelector->findText(node.attribute("value")));
  8015. }
  8016. else if(node.attribute("name")=="columnname")
  8017. {
  8018. columnName->setText(node.attribute("value"));
  8019. }
  8020. }
  8021. updateThermocoupleType(typeSelector->currentText());
  8022. updateColumnName(columnName->text());
  8023. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  8024. this,SLOT(updateThermocoupleType(QString)));
  8025. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8026. }
  8027. /*:654*//*655:*/
  8028. #line 15360 "./typica.w"
  8029. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  8030. {
  8031. updateAttribute("type",type);
  8032. }
  8033. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  8034. {
  8035. updateAttribute("columnname",name);
  8036. }
  8037. /*:655*/
  8038. #line 811 "./typica.w"
  8039. /*650:*/
  8040. #line 15232 "./typica.w"
  8041. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  8042. const QModelIndex&index)
  8043. :BasicDeviceConfigurationWidget(model,index)
  8044. {
  8045. QVBoxLayout*layout= new QVBoxLayout;
  8046. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8047. QLabel*label= new QLabel(tr("Device ID:"));
  8048. QLineEdit*deviceId= new QLineEdit;
  8049. deviceIdLayout->addWidget(label);
  8050. deviceIdLayout->addWidget(deviceId);
  8051. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8052. layout->addLayout(deviceIdLayout);
  8053. layout->addWidget(addChannelButton);
  8054. /*644:*/
  8055. #line 15127 "./typica.w"
  8056. QDomElement referenceElement=
  8057. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8058. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8059. QDomElement node;
  8060. /*:644*/
  8061. #line 15246 "./typica.w"
  8062. for(int i= 0;i<configData.size();i++)
  8063. {
  8064. node= configData.at(i).toElement();
  8065. if(node.attribute("name")=="deviceID")
  8066. {
  8067. deviceId->setText(node.attribute("value","Dev1"));
  8068. break;
  8069. }
  8070. }
  8071. updateDeviceId(deviceId->text());
  8072. connect(addChannelButton,SIGNAL(clicked()),
  8073. this,SLOT(addChannel()));
  8074. connect(deviceId,SIGNAL(textEdited(QString)),
  8075. this,SLOT(updateDeviceId(QString)));
  8076. setLayout(layout);
  8077. }
  8078. /*:650*//*651:*/
  8079. #line 15268 "./typica.w"
  8080. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  8081. {
  8082. updateAttribute("deviceID",newId);
  8083. }
  8084. /*:651*//*652:*/
  8085. #line 15276 "./typica.w"
  8086. void NiDaqMxBase9211ConfWidget::addChannel()
  8087. {
  8088. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8089. }
  8090. /*:652*/
  8091. #line 812 "./typica.w"
  8092. /*648:*/
  8093. #line 15183 "./typica.w"
  8094. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  8095. DeviceTreeModel*model,const QModelIndex&index):
  8096. BasicDeviceConfigurationWidget(model,index)
  8097. {
  8098. QHBoxLayout*layout= new QHBoxLayout;
  8099. QToolButton*addDeviceButton= new QToolButton;
  8100. addDeviceButton->setText(tr("Add Device"));
  8101. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  8102. "nidaqmxbase9211series");
  8103. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8104. "nidaqmxbase9211series");
  8105. connect(add9211,SIGNAL(triggered(QString,QString)),
  8106. this,SLOT(insertChildNode(QString,QString)));
  8107. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8108. this,SLOT(insertChildNode(QString,QString)));
  8109. QMenu*deviceMenu= new QMenu;
  8110. deviceMenu->addAction(add9211);
  8111. deviceMenu->addAction(add9211a);
  8112. addDeviceButton->setMenu(deviceMenu);
  8113. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8114. layout->addWidget(addDeviceButton);
  8115. setLayout(layout);
  8116. }
  8117. /*:648*/
  8118. #line 813 "./typica.w"
  8119. /*537:*/
  8120. #line 12770 "./typica.w"
  8121. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  8122. QObject*parent):
  8123. QAction(reportName,parent),reportFile(fileName)
  8124. {
  8125. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  8126. }
  8127. /*:537*//*538:*/
  8128. #line 12786 "./typica.w"
  8129. void ReportAction::createReport()
  8130. {
  8131. QFile file(reportFile);
  8132. QDomDocument document;
  8133. if(file.open(QIODevice::ReadOnly))
  8134. {
  8135. document.setContent(&file,true);
  8136. QDomElement element= document.documentElement();
  8137. QScriptEngine*engine= AppInstance->engine;
  8138. QScriptContext*context= engine->pushContext();
  8139. QScriptValue object;
  8140. QString targetID= reportFile;
  8141. /*160:*/
  8142. #line 3884 "./typica.w"
  8143. ScriptQMainWindow*window= new ScriptQMainWindow;
  8144. window->setObjectName(targetID);
  8145. object= engine->newQObject(window);
  8146. setQMainWindowProperties(object,engine);
  8147. QWidget*central= new(QWidget);
  8148. central->setParent(window);
  8149. central->setObjectName("centralWidget");
  8150. window->setCentralWidget(central);
  8151. if(element.hasChildNodes())
  8152. {
  8153. /*161:*/
  8154. #line 3925 "./typica.w"
  8155. QStack<QWidget*> widgetStack;
  8156. QStack<QLayout*> layoutStack;
  8157. QString windowScript;
  8158. widgetStack.push(central);
  8159. QDomNodeList windowChildren= element.childNodes();
  8160. int i= 0;
  8161. while(i<windowChildren.count())
  8162. {
  8163. QDomNode current;
  8164. QDomElement element;
  8165. current= windowChildren.at(i);
  8166. if(current.isElement())
  8167. {
  8168. element= current.toElement();
  8169. if(element.tagName()=="program")
  8170. {
  8171. windowScript.append(element.text());
  8172. }
  8173. else if(element.tagName()=="layout")
  8174. {
  8175. addLayoutToWidget(element,&widgetStack,&layoutStack);
  8176. }
  8177. else if(element.tagName()=="menu")
  8178. {
  8179. /*162:*/
  8180. #line 3972 "./typica.w"
  8181. QMenuBar*bar= window->menuBar();
  8182. bar->setParent(window);
  8183. bar->setObjectName("menuBar");
  8184. if(element.hasAttribute("name"))
  8185. {
  8186. QMenu*menu= bar->addMenu(element.attribute("name"));
  8187. menu->setParent(bar);
  8188. if(element.hasAttribute("type"))
  8189. {
  8190. if(element.attribute("type")=="reports")
  8191. {
  8192. if(element.hasAttribute("src"))
  8193. {
  8194. /*535:*/
  8195. #line 12733 "./typica.w"
  8196. QSettings settings;
  8197. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  8198. arg(element.attribute("src")));
  8199. directory.setFilter(QDir::Files);
  8200. directory.setSorting(QDir::Name);
  8201. QStringList nameFilter;
  8202. nameFilter<<"*.xml";
  8203. directory.setNameFilters(nameFilter);
  8204. QFileInfoList reportFiles= directory.entryInfoList();
  8205. for(int i= 0;i<reportFiles.size();i++)
  8206. {
  8207. QFileInfo reportFile= reportFiles.at(i);
  8208. /*539:*/
  8209. #line 12810 "./typica.w"
  8210. QString path= reportFile.absoluteFilePath();
  8211. QFile file(path);
  8212. if(file.open(QIODevice::ReadOnly))
  8213. {
  8214. QDomDocument document;
  8215. document.setContent(&file,true);
  8216. QDomElement root= document.documentElement();
  8217. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  8218. if(!titleNode.isNull())
  8219. {
  8220. QDomElement titleElement= titleNode.toElement();
  8221. QString title= titleElement.text();
  8222. if(!title.isEmpty())
  8223. {
  8224. QStringList hierarchy= title.split(":->");
  8225. QMenu*insertionPoint= menu;
  8226. /*540:*/
  8227. #line 12837 "./typica.w"
  8228. for(int j= 0;j<hierarchy.size()-1;j++)
  8229. {
  8230. QObjectList menuList= insertionPoint->children();
  8231. bool menuFound= false;
  8232. for(int k= 0;k<menuList.size();k++)
  8233. {
  8234. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  8235. if(currentItem)
  8236. {
  8237. if(currentItem->title()==hierarchy.at(j))
  8238. {
  8239. menuFound= true;
  8240. insertionPoint= currentItem;
  8241. break;
  8242. }
  8243. }
  8244. }
  8245. if(!menuFound)
  8246. {
  8247. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  8248. }
  8249. }
  8250. /*:540*/
  8251. #line 12827 "./typica.w"
  8252. ReportAction*action= new ReportAction(path,hierarchy.last());
  8253. insertionPoint->addAction(action);
  8254. }
  8255. }
  8256. }
  8257. /*:539*/
  8258. #line 12746 "./typica.w"
  8259. }
  8260. /*:535*/
  8261. #line 3986 "./typica.w"
  8262. }
  8263. }
  8264. }
  8265. if(element.hasChildNodes())
  8266. {
  8267. /*163:*/
  8268. #line 3999 "./typica.w"
  8269. QDomNodeList menuItems= element.childNodes();
  8270. int j= 0;
  8271. while(j<menuItems.count())
  8272. {
  8273. QDomNode item= menuItems.at(j);
  8274. if(item.isElement())
  8275. {
  8276. QDomElement itemElement= item.toElement();
  8277. if(itemElement.tagName()=="item")
  8278. {
  8279. QAction*itemAction= new QAction(itemElement.text(),menu);
  8280. if(itemElement.hasAttribute("id"))
  8281. {
  8282. itemAction->setObjectName(itemElement.attribute("id"));
  8283. }
  8284. if(itemElement.hasAttribute("shortcut"))
  8285. {
  8286. itemAction->setShortcut(itemElement.attribute("shortcut"));
  8287. }
  8288. menu->addAction(itemAction);
  8289. }
  8290. else if(itemElement.tagName()=="separator")
  8291. {
  8292. menu->addSeparator();
  8293. }
  8294. }
  8295. j++;
  8296. }
  8297. /*:163*/
  8298. #line 3992 "./typica.w"
  8299. }
  8300. }
  8301. /*:162*/
  8302. #line 3950 "./typica.w"
  8303. }
  8304. }
  8305. i++;
  8306. }
  8307. QScriptValue oldThis= context->thisObject();
  8308. context->setThisObject(object);
  8309. QScriptValue result= engine->evaluate(windowScript);
  8310. /*155:*/
  8311. #line 3733 "./typica.w"
  8312. if(engine->hasUncaughtException())
  8313. {
  8314. int line= engine->uncaughtExceptionLineNumber();
  8315. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  8316. result.toString();
  8317. QString trace;
  8318. foreach(trace,engine->uncaughtExceptionBacktrace())
  8319. {
  8320. qDebug()<<trace;
  8321. }
  8322. }
  8323. /*:155*/
  8324. #line 3958 "./typica.w"
  8325. context->setThisObject(oldThis);
  8326. /*:161*/
  8327. #line 3895 "./typica.w"
  8328. }
  8329. if(window)
  8330. {
  8331. window->show();
  8332. }
  8333. else
  8334. {
  8335. qDebug()<<"Error! Window invalidated";
  8336. }
  8337. /*:160*/
  8338. #line 12799 "./typica.w"
  8339. file.close();
  8340. engine->popContext();
  8341. }
  8342. }
  8343. /*:538*/
  8344. #line 814 "./typica.w"
  8345. /*191:*/
  8346. #line 5045 "./typica.w"
  8347. NumericDelegate::NumericDelegate(QObject*parent):
  8348. QItemDelegate(parent)
  8349. {
  8350. }
  8351. /*:191*//*192:*/
  8352. #line 5057 "./typica.w"
  8353. void NumericDelegate::setEditorData(QWidget*editor,
  8354. const QModelIndex&index)const
  8355. {
  8356. QString value= index.model()->data(index,Qt::EditRole).toString();
  8357. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8358. line->setText(value);
  8359. }
  8360. /*:192*//*193:*/
  8361. #line 5072 "./typica.w"
  8362. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  8363. const QModelIndex&index)const
  8364. {
  8365. QLineEdit*line= static_cast<QLineEdit*> (editor);
  8366. model->setData(index,line->text(),Qt::EditRole);
  8367. QScriptEngine*engine= AppInstance->engine;
  8368. engine->pushContext();
  8369. QString script= QString("Number(%1)").arg(line->text());
  8370. QScriptValue result= engine->evaluate(line->text());
  8371. if(result.isNumber())
  8372. {
  8373. model->setData(index,result.toVariant(),Qt::DisplayRole);
  8374. }
  8375. else
  8376. {
  8377. model->setData(index,QVariant(),Qt::DisplayRole);
  8378. }
  8379. engine->popContext();
  8380. }
  8381. /*:193*//*194:*/
  8382. #line 5095 "./typica.w"
  8383. QWidget*NumericDelegate::createEditor(QWidget*parent,
  8384. const QStyleOptionViewItem&,
  8385. const QModelIndex&)const
  8386. {
  8387. return(new QLineEdit(parent));
  8388. }
  8389. /*:194*//*195:*/
  8390. #line 5106 "./typica.w"
  8391. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  8392. const QStyleOptionViewItem&option,
  8393. const QModelIndex&)const
  8394. {
  8395. editor->setGeometry(option.rect);
  8396. }
  8397. /*:195*/
  8398. #line 815 "./typica.w"
  8399. /*659:*/
  8400. #line 15414 "./typica.w"
  8401. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  8402. const QModelIndex&index)
  8403. :BasicDeviceConfigurationWidget(model,index)
  8404. {
  8405. QHBoxLayout*layout= new QHBoxLayout;
  8406. QToolButton*addDeviceButton= new QToolButton;
  8407. addDeviceButton->setText(tr("Add Device"));
  8408. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  8409. "nidaqmx9211series");
  8410. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  8411. "nidaqmxtc01");
  8412. connect(add9211a,SIGNAL(triggered(QString,QString)),
  8413. this,SLOT(insertChildNode(QString,QString)));
  8414. connect(addtc01,SIGNAL(triggered(QString,QString)),
  8415. this,SLOT(insertChildNode(QString,QString)));
  8416. QMenu*deviceMenu= new QMenu;
  8417. deviceMenu->addAction(add9211a);
  8418. deviceMenu->addAction(addtc01);
  8419. addDeviceButton->setMenu(deviceMenu);
  8420. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8421. layout->addWidget(addDeviceButton);
  8422. setLayout(layout);
  8423. }
  8424. /*:659*/
  8425. #line 816 "./typica.w"
  8426. /*661:*/
  8427. #line 15463 "./typica.w"
  8428. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  8429. const QModelIndex&index)
  8430. :BasicDeviceConfigurationWidget(model,index)
  8431. {
  8432. QVBoxLayout*layout= new QVBoxLayout;
  8433. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  8434. QLabel*label= new QLabel(tr("Device ID:"));
  8435. QLineEdit*deviceId= new QLineEdit;
  8436. deviceIdLayout->addWidget(label);
  8437. deviceIdLayout->addWidget(deviceId);
  8438. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  8439. layout->addLayout(deviceIdLayout);
  8440. layout->addWidget(addChannelButton);
  8441. /*644:*/
  8442. #line 15127 "./typica.w"
  8443. QDomElement referenceElement=
  8444. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8445. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8446. QDomElement node;
  8447. /*:644*/
  8448. #line 15477 "./typica.w"
  8449. for(int i= 0;i<configData.size();i++)
  8450. {
  8451. node= configData.at(i).toElement();
  8452. if(node.attribute("name")=="deviceID")
  8453. {
  8454. deviceId->setText(node.attribute("value","Dev1"));
  8455. break;
  8456. }
  8457. }
  8458. updateDeviceId(deviceId->text());
  8459. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  8460. connect(deviceId,SIGNAL(textEdited(QString)),
  8461. this,SLOT(updateDeviceId(QString)));
  8462. setLayout(layout);
  8463. }
  8464. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  8465. {
  8466. updateAttribute("deviceID",newId);
  8467. }
  8468. void NiDaqMx9211ConfWidget::addChannel()
  8469. {
  8470. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  8471. }
  8472. /*:661*/
  8473. #line 817 "./typica.w"
  8474. /*663:*/
  8475. #line 15527 "./typica.w"
  8476. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  8477. const QModelIndex&index)
  8478. :BasicDeviceConfigurationWidget(model,index)
  8479. {
  8480. QFormLayout*layout= new QFormLayout;
  8481. QLineEdit*deviceId= new QLineEdit;
  8482. layout->addRow(tr("Device ID:"),deviceId);
  8483. QLineEdit*columnName= new QLineEdit;
  8484. layout->addRow(tr("Column Name:"),columnName);
  8485. QComboBox*typeSelector= new QComboBox;
  8486. typeSelector->addItem("J");
  8487. typeSelector->addItem("K");
  8488. typeSelector->addItem("T");
  8489. typeSelector->addItem("B");
  8490. typeSelector->addItem("E");
  8491. typeSelector->addItem("N");
  8492. typeSelector->addItem("R");
  8493. typeSelector->addItem("S");
  8494. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  8495. /*644:*/
  8496. #line 15127 "./typica.w"
  8497. QDomElement referenceElement=
  8498. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8499. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8500. QDomElement node;
  8501. /*:644*/
  8502. #line 15547 "./typica.w"
  8503. for(int i= 0;i<configData.size();i++)
  8504. {
  8505. node= configData.at(i).toElement();
  8506. if(node.attribute("name")=="deviceID")
  8507. {
  8508. deviceId->setText(node.attribute("value"));
  8509. }
  8510. else if(node.attribute("name")=="type")
  8511. {
  8512. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  8513. }
  8514. else if(node.attribute("name")=="columnname")
  8515. {
  8516. columnName->setText(node.attribute("value"));
  8517. }
  8518. }
  8519. updateDeviceId(deviceId->text());
  8520. updateThermocoupleType(typeSelector->currentText());
  8521. updateColumnName(columnName->text());
  8522. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  8523. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  8524. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  8525. setLayout(layout);
  8526. }
  8527. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  8528. {
  8529. updateAttribute("deviceID",newId);
  8530. }
  8531. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  8532. {
  8533. updateAttribute("type",type);
  8534. }
  8535. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  8536. {
  8537. updateAttribute("columnname",name);
  8538. }
  8539. /*:663*/
  8540. #line 818 "./typica.w"
  8541. /*681:*/
  8542. #line 15948 "./typica.w"
  8543. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  8544. const QModelIndex&index)
  8545. :BasicDeviceConfigurationWidget(model,index)
  8546. {
  8547. QFormLayout*layout= new QFormLayout;
  8548. QToolButton*addDeviceButton= new QToolButton;
  8549. addDeviceButton->setText(tr("Add Device"));
  8550. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  8551. "Modbus RTU Device",
  8552. "modbusrtudevice");
  8553. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  8554. this,SLOT(insertChildNode(QString,QString)));
  8555. QMenu*deviceMenu= new QMenu;
  8556. deviceMenu->addAction(addModbusRtuDevice);
  8557. addDeviceButton->setMenu(deviceMenu);
  8558. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  8559. layout->addRow(QString(),addDeviceButton);
  8560. PortSelector*port= new PortSelector;
  8561. layout->addRow(tr("Port:"),port);
  8562. connect(port,SIGNAL(currentIndexChanged(QString)),
  8563. this,SLOT(updatePort(QString)));
  8564. connect(port,SIGNAL(editTextChanged(QString)),
  8565. this,SLOT(updatePort(QString)));
  8566. BaudSelector*rate= new BaudSelector;
  8567. layout->addRow(tr("Baud:"),rate);
  8568. connect(rate,SIGNAL(currentIndexChanged(QString)),
  8569. this,SLOT(updateBaudRate(QString)));
  8570. ParitySelector*parity= new ParitySelector;
  8571. layout->addRow(tr("Parity:"),parity);
  8572. connect(parity,SIGNAL(currentIndexChanged(QString)),
  8573. this,SLOT(updateParity(QString)));
  8574. FlowSelector*flow= new FlowSelector;
  8575. layout->addRow(tr("Flow Control:"),flow);
  8576. connect(flow,SIGNAL(currentIndexChanged(QString)),
  8577. this,SLOT(updateFlowControl(QString)));
  8578. StopSelector*stop= new StopSelector;
  8579. layout->addRow(tr("Stop Bits:"),stop);
  8580. connect(stop,SIGNAL(currentIndexChanged(QString)),
  8581. this,SLOT(updateStopBits(QString)));
  8582. /*644:*/
  8583. #line 15127 "./typica.w"
  8584. QDomElement referenceElement=
  8585. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8586. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8587. QDomElement node;
  8588. /*:644*/
  8589. #line 15988 "./typica.w"
  8590. for(int i= 0;i<configData.size();i++)
  8591. {
  8592. node= configData.at(i).toElement();
  8593. if(node.attribute("name")=="port")
  8594. {
  8595. int j= port->findText(node.attribute("value"));
  8596. if(j>=0)
  8597. {
  8598. port->setCurrentIndex(j);
  8599. }
  8600. else
  8601. {
  8602. port->insertItem(0,node.attribute("value"));
  8603. port->setCurrentIndex(0);
  8604. }
  8605. }
  8606. else if(node.attribute("name")=="baudrate")
  8607. {
  8608. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  8609. }
  8610. else if(node.attribute("name")=="parity")
  8611. {
  8612. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  8613. }
  8614. else if(node.attribute("name")=="flowcontrol")
  8615. {
  8616. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  8617. }
  8618. else if(node.attribute("name")=="stopbits")
  8619. {
  8620. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  8621. }
  8622. }
  8623. updatePort(port->currentText());
  8624. updateBaudRate(rate->currentText());
  8625. updateParity(parity->currentText());
  8626. updateFlowControl(flow->currentText());
  8627. updateStopBits(stop->currentText());
  8628. setLayout(layout);
  8629. }
  8630. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  8631. {
  8632. updateAttribute("port",newPort);
  8633. }
  8634. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  8635. {
  8636. updateAttribute("baudrate",newRate);
  8637. }
  8638. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  8639. {
  8640. updateAttribute("parity",newParity);
  8641. }
  8642. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  8643. {
  8644. updateAttribute("flowcontrol",newFlow);
  8645. }
  8646. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  8647. {
  8648. updateAttribute("stopbits",newStopBits);
  8649. }
  8650. /*:681*/
  8651. #line 819 "./typica.w"
  8652. /*683:*/
  8653. #line 16111 "./typica.w"
  8654. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  8655. const QModelIndex&index)
  8656. :BasicDeviceConfigurationWidget(model,index),
  8657. unitSpecificationLayout(new QStackedLayout),
  8658. decimalSpecificationLayout(new QStackedLayout)
  8659. {
  8660. QVBoxLayout*layout= new QVBoxLayout;
  8661. QToolButton*addChannelButton= new QToolButton;
  8662. addChannelButton->setText(tr("Add Channel"));
  8663. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  8664. "Temperature Process Value",
  8665. "modbustemperaturepv");
  8666. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  8667. "Temperature Set Value",
  8668. "modbustemperaturesv");
  8669. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  8670. this,SLOT(insertChildNode(QString,QString)));
  8671. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  8672. this,SLOT(insertChildNode(QString,QString)));
  8673. QMenu*channelMenu= new QMenu;
  8674. channelMenu->addAction(addTemperaturePV);
  8675. channelMenu->addAction(addTemperatureSV);
  8676. addChannelButton->setMenu(channelMenu);
  8677. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  8678. layout->addWidget(addChannelButton);
  8679. QHBoxLayout*stationLayout= new QHBoxLayout;
  8680. QLabel*stationLabel= new QLabel(tr("Station:"));
  8681. QSpinBox*stationNumber= new QSpinBox;
  8682. stationNumber->setMinimum(0);
  8683. stationNumber->setMaximum(255);
  8684. stationLayout->addWidget(stationLabel);
  8685. stationLayout->addWidget(stationNumber);
  8686. layout->addLayout(stationLayout);
  8687. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  8688. layout->addWidget(fixedUnit);
  8689. QWidget*fixedUnitPlaceholder= new QWidget(this);
  8690. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  8691. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  8692. QComboBox*fixedUnitSelector= new QComboBox;
  8693. fixedUnitSelector->addItem("Fahrenheit");
  8694. fixedUnitSelector->addItem("Celsius");
  8695. fixedUnitLayout->addWidget(fixedUnitLabel);
  8696. fixedUnitLayout->addWidget(fixedUnitSelector);
  8697. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  8698. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  8699. QWidget*queriedUnitPlaceholder= new QWidget(this);
  8700. QFormLayout*queriedUnitLayout= new QFormLayout;
  8701. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  8702. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  8703. QSpinBox*valueF= new QSpinBox;
  8704. valueF->setMinimum(0);
  8705. valueF->setMaximum(65535);
  8706. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  8707. QSpinBox*valueC= new QSpinBox;
  8708. valueC->setMinimum(0);
  8709. valueC->setMaximum(65535);
  8710. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  8711. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  8712. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  8713. layout->addLayout(unitSpecificationLayout);
  8714. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  8715. layout->addWidget(fixedPrecision);
  8716. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  8717. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  8718. QSpinBox*fixedPrecisionValue= new QSpinBox;
  8719. fixedPrecisionValue->setMinimum(0);
  8720. fixedPrecisionValue->setMaximum(9);
  8721. fixedPrecisionLayout->addRow("Places after the decimal point:",
  8722. fixedPrecisionValue);
  8723. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  8724. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  8725. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  8726. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  8727. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  8728. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  8729. precisionAddress);
  8730. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  8731. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  8732. layout->addLayout(decimalSpecificationLayout);
  8733. /*644:*/
  8734. #line 15127 "./typica.w"
  8735. QDomElement referenceElement=
  8736. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8737. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8738. QDomElement node;
  8739. /*:644*/
  8740. #line 16191 "./typica.w"
  8741. for(int i= 0;i<configData.size();i++)
  8742. {
  8743. node= configData.at(i).toElement();
  8744. if(node.attribute("name")=="station")
  8745. {
  8746. stationNumber->setValue(node.attribute("value").toInt());
  8747. }
  8748. else if(node.attribute("name")=="fixedunit")
  8749. {
  8750. if(node.attribute("value")=="true")
  8751. {
  8752. fixedUnit->setCheckState(Qt::Checked);
  8753. }
  8754. else if(node.attribute("value")=="false")
  8755. {
  8756. fixedUnit->setCheckState(Qt::Unchecked);
  8757. }
  8758. }
  8759. else if(node.attribute("name")=="fixedprecision")
  8760. {
  8761. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8762. }
  8763. else if(node.attribute("name")=="unit")
  8764. {
  8765. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  8766. }
  8767. else if(node.attribute("name")=="unitaddress")
  8768. {
  8769. unitAddress->setValue(node.attribute("value").toInt());
  8770. }
  8771. else if(node.attribute("name")=="fvalue")
  8772. {
  8773. valueF->setValue(node.attribute("value").toInt());
  8774. }
  8775. else if(node.attribute("name")=="cvalue")
  8776. {
  8777. valueC->setValue(node.attribute("value").toInt());
  8778. }
  8779. else if(node.attribute("name")=="precisionaddress")
  8780. {
  8781. precisionAddress->setValue(node.attribute("value").toInt());
  8782. }
  8783. else if(node.attribute("name")=="precision")
  8784. {
  8785. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  8786. }
  8787. }
  8788. updateStationNumber(stationNumber->value());
  8789. updateFixedUnit(fixedUnit->isChecked());
  8790. updateFixedDecimal(fixedPrecision->isChecked());
  8791. updateUnit(fixedUnitSelector->currentText());
  8792. updateUnitAddress(unitAddress->value());
  8793. updateValueF(valueF->value());
  8794. updateValueC(valueC->value());
  8795. updatePrecisionAddress(precisionAddress->value());
  8796. updatePrecisionValue(fixedPrecisionValue->value());
  8797. connect(stationNumber,SIGNAL(valueChanged(int)),
  8798. this,SLOT(updateStationNumber(int)));
  8799. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  8800. this,SLOT(updateUnit(QString)));
  8801. connect(unitAddress,SIGNAL(valueChanged(int)),
  8802. this,SLOT(updateUnitAddress(int)));
  8803. connect(valueF,SIGNAL(valueChanged(int)),
  8804. this,SLOT(updateValueF(int)));
  8805. connect(valueC,SIGNAL(valueChanged(int)),
  8806. this,SLOT(updateValueC(int)));
  8807. connect(fixedUnit,SIGNAL(toggled(bool)),
  8808. this,SLOT(updateFixedUnit(bool)));
  8809. connect(fixedPrecision,SIGNAL(toggled(bool)),
  8810. this,SLOT(updateFixedDecimal(bool)));
  8811. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  8812. this,SLOT(updatePrecisionValue(int)));
  8813. connect(precisionAddress,SIGNAL(valueChanged(int)),
  8814. this,SLOT(updatePrecisionAddress(int)));
  8815. setLayout(layout);
  8816. }
  8817. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  8818. {
  8819. updateAttribute("station",QString("%1").arg(newStation));
  8820. }
  8821. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  8822. {
  8823. if(newFixed)
  8824. {
  8825. unitSpecificationLayout->setCurrentIndex(0);
  8826. updateAttribute("fixedunit","true");
  8827. }
  8828. else
  8829. {
  8830. unitSpecificationLayout->setCurrentIndex(1);
  8831. updateAttribute("fixedunit","false");
  8832. }
  8833. }
  8834. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  8835. {
  8836. if(newFixed)
  8837. {
  8838. decimalSpecificationLayout->setCurrentIndex(0);
  8839. updateAttribute("fixedprecision","true");
  8840. }
  8841. else
  8842. {
  8843. decimalSpecificationLayout->setCurrentIndex(1);
  8844. updateAttribute("fixedprecision","false");
  8845. }
  8846. }
  8847. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  8848. {
  8849. updateAttribute("unit",newUnit);
  8850. }
  8851. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  8852. {
  8853. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  8854. }
  8855. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  8856. {
  8857. updateAttribute("fvalue",QString("%1").arg(newValue));
  8858. }
  8859. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  8860. {
  8861. updateAttribute("cvalue",QString("%1").arg(newValue));
  8862. }
  8863. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  8864. {
  8865. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  8866. }
  8867. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  8868. {
  8869. updateAttribute("precision",QString("%1").arg(newValue));
  8870. }
  8871. /*:683*/
  8872. #line 820 "./typica.w"
  8873. /*685:*/
  8874. #line 16354 "./typica.w"
  8875. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  8876. const QModelIndex&index)
  8877. :BasicDeviceConfigurationWidget(model,index)
  8878. {
  8879. QFormLayout*layout= new QFormLayout;
  8880. ShortHexSpinBox*address= new ShortHexSpinBox;
  8881. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  8882. /*644:*/
  8883. #line 15127 "./typica.w"
  8884. QDomElement referenceElement=
  8885. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8886. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8887. QDomElement node;
  8888. /*:644*/
  8889. #line 16362 "./typica.w"
  8890. for(int i= 0;i<configData.size();i++)
  8891. {
  8892. node= configData.at(i).toElement();
  8893. if(node.attribute("name")=="address")
  8894. {
  8895. address->setValue(node.attribute("value").toInt());
  8896. break;
  8897. }
  8898. }
  8899. updateAddress(address->value());
  8900. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  8901. setLayout(layout);
  8902. }
  8903. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  8904. {
  8905. updateAttribute("address",QString("%1").arg(newAddress));
  8906. }
  8907. /*:685*/
  8908. #line 821 "./typica.w"
  8909. /*687:*/
  8910. #line 16410 "./typica.w"
  8911. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  8912. const QModelIndex&index)
  8913. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  8914. {
  8915. QVBoxLayout*layout= new QVBoxLayout;
  8916. QFormLayout*addressLayout= new QFormLayout;
  8917. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  8918. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  8919. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  8920. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  8921. layout->addLayout(addressLayout);
  8922. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  8923. layout->addWidget(fixedRange);
  8924. QWidget*queriedRangePlaceholder= new QWidget(this);
  8925. QFormLayout*queriedRangeLayout= new QFormLayout;
  8926. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  8927. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  8928. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  8929. lowerAddress);
  8930. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  8931. upperAddress);
  8932. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  8933. boundsLayout->addWidget(queriedRangePlaceholder);
  8934. QWidget*fixedRangePlaceholder= new QWidget(this);
  8935. QFormLayout*fixedRangeLayout= new QFormLayout;
  8936. QLineEdit*fixedLower= new QLineEdit;
  8937. QLineEdit*fixedUpper= new QLineEdit;
  8938. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  8939. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  8940. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  8941. boundsLayout->addWidget(fixedRangePlaceholder);
  8942. layout->addLayout(boundsLayout);
  8943. /*644:*/
  8944. #line 15127 "./typica.w"
  8945. QDomElement referenceElement=
  8946. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8947. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8948. QDomElement node;
  8949. /*:644*/
  8950. #line 16443 "./typica.w"
  8951. for(int i= 0;i<configData.size();i++)
  8952. {
  8953. node= configData.at(i).toElement();
  8954. if(node.attribute("name")=="readaddress")
  8955. {
  8956. readAddress->setValue(node.attribute("value").toInt());
  8957. }
  8958. else if(node.attribute("name")=="writeaddress")
  8959. {
  8960. writeAddress->setValue(node.attribute("value").toInt());
  8961. }
  8962. else if(node.attribute("name")=="fixedrange")
  8963. {
  8964. if(node.attribute("value")=="true")
  8965. {
  8966. fixedRange->setCheckState(Qt::Checked);
  8967. }
  8968. else if(node.attribute("value")=="false")
  8969. {
  8970. fixedRange->setCheckState(Qt::Unchecked);
  8971. }
  8972. }
  8973. else if(node.attribute("name")=="fixedlower")
  8974. {
  8975. fixedLower->setText(node.attribute("value"));
  8976. }
  8977. else if(node.attribute("name")=="fixedupper")
  8978. {
  8979. fixedUpper->setText(node.attribute("value"));
  8980. }
  8981. else if(node.attribute("name")=="loweraddress")
  8982. {
  8983. lowerAddress->setValue(node.attribute("value").toInt());
  8984. }
  8985. else if(node.attribute("name")=="upperaddress")
  8986. {
  8987. upperAddress->setValue(node.attribute("value").toInt());
  8988. }
  8989. }
  8990. updateReadAddress(readAddress->value());
  8991. updateWriteAddress(writeAddress->value());
  8992. updateFixedRange(fixedRange->isChecked());
  8993. updateLower(fixedLower->text());
  8994. updateUpper(fixedUpper->text());
  8995. updateLowerAddress(lowerAddress->value());
  8996. updateUpperAddress(upperAddress->value());
  8997. connect(readAddress,SIGNAL(valueChanged(int)),
  8998. this,SLOT(updateReadAddress(int)));
  8999. connect(writeAddress,SIGNAL(valueChanged(int)),
  9000. this,SLOT(updateWriteAddress(int)));
  9001. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  9002. connect(fixedLower,SIGNAL(textChanged(QString)),
  9003. this,SLOT(updateLower(QString)));
  9004. connect(fixedUpper,SIGNAL(textChanged(QString)),
  9005. this,SLOT(updateUpper(QString)));
  9006. connect(lowerAddress,SIGNAL(valueChanged(int)),
  9007. this,SLOT(updateLowerAddress(int)));
  9008. connect(upperAddress,SIGNAL(valueChanged(int)),
  9009. this,SLOT(updateUpperAddress(int)));
  9010. setLayout(layout);
  9011. }
  9012. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  9013. {
  9014. updateAttribute("readaddress",QString("%1").arg(newAddress));
  9015. }
  9016. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  9017. {
  9018. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  9019. }
  9020. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  9021. {
  9022. if(fixed)
  9023. {
  9024. updateAttribute("fixedrange","true");
  9025. boundsLayout->setCurrentIndex(1);
  9026. }
  9027. else
  9028. {
  9029. updateAttribute("fixedrange","false");
  9030. boundsLayout->setCurrentIndex(0);
  9031. }
  9032. }
  9033. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  9034. {
  9035. updateAttribute("fixedlower",lower);
  9036. }
  9037. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  9038. {
  9039. updateAttribute("fixedupper",upper);
  9040. }
  9041. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  9042. {
  9043. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  9044. }
  9045. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  9046. {
  9047. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  9048. }
  9049. /*:687*/
  9050. #line 822 "./typica.w"
  9051. /*643:*/
  9052. #line 15057 "./typica.w"
  9053. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9054. :BasicDeviceConfigurationWidget(model,index)
  9055. {
  9056. QVBoxLayout*layout= new QVBoxLayout;
  9057. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  9058. QMenu*deviceMenu= new QMenu;
  9059. NodeInserter*insertAction;
  9060. foreach(insertAction,AppInstance->topLevelNodeInserters)
  9061. {
  9062. connect(insertAction,SIGNAL(triggered(QString,QString)),
  9063. this,SLOT(insertChildNode(QString,QString)));
  9064. deviceMenu->addAction(insertAction);
  9065. }
  9066. addDeviceButton->setMenu(deviceMenu);
  9067. layout->addWidget(addDeviceButton);
  9068. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  9069. QMenu*annotationMenu= new QMenu;
  9070. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  9071. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  9072. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  9073. annotationMenu->addAction(basicButtonInserter);
  9074. annotationMenu->addAction(countingButtonInserter);
  9075. annotationMenu->addAction(spinBoxInserter);
  9076. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  9077. this,SLOT(insertChildNode(QString,QString)));
  9078. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  9079. this,SLOT(insertChildNode(QString,QString)));
  9080. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  9081. this,SLOT(insertChildNode(QString,QString)));
  9082. addAnnotationControlButton->setMenu(annotationMenu);
  9083. layout->addWidget(addAnnotationControlButton);
  9084. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  9085. QMenu*advancedMenu= new QMenu;
  9086. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  9087. advancedMenu->addAction(linearsplineinserter);
  9088. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  9089. advancedMenu->addAction(translationinserter);
  9090. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9091. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  9092. advancedButton->setMenu(advancedMenu);
  9093. layout->addWidget(advancedButton);
  9094. QHBoxLayout*idLayout= new QHBoxLayout;
  9095. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  9096. idLayout->addWidget(idLabel);
  9097. QSpinBox*id= new QSpinBox;
  9098. idLayout->addWidget(id);
  9099. layout->addLayout(idLayout);
  9100. /*644:*/
  9101. #line 15127 "./typica.w"
  9102. QDomElement referenceElement=
  9103. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9104. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9105. QDomElement node;
  9106. /*:644*/
  9107. #line 15105 "./typica.w"
  9108. for(int i= 0;i<configData.size();i++)
  9109. {
  9110. node= configData.at(i).toElement();
  9111. if(node.attribute("name")=="databaseid")
  9112. {
  9113. id->setValue(node.attribute("value").toInt());
  9114. break;
  9115. }
  9116. }
  9117. updateRoasterId(id->value());
  9118. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  9119. setLayout(layout);
  9120. }
  9121. /*:643*//*645:*/
  9122. #line 15137 "./typica.w"
  9123. void RoasterConfWidget::updateRoasterId(int id)
  9124. {
  9125. updateAttribute("databaseid",QString("%1").arg(id));
  9126. }
  9127. /*:645*/
  9128. #line 823 "./typica.w"
  9129. /*691:*/
  9130. #line 16593 "./typica.w"
  9131. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9132. :BasicDeviceConfigurationWidget(model,index)
  9133. {
  9134. QFormLayout*layout= new QFormLayout;
  9135. QLineEdit*buttonTextEdit= new QLineEdit;
  9136. QLineEdit*annotationTextEdit= new QLineEdit;
  9137. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9138. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9139. /*644:*/
  9140. #line 15127 "./typica.w"
  9141. QDomElement referenceElement=
  9142. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9143. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9144. QDomElement node;
  9145. /*:644*/
  9146. #line 16602 "./typica.w"
  9147. for(int i= 0;i<configData.size();i++)
  9148. {
  9149. node= configData.at(i).toElement();
  9150. if(node.attribute("name")=="buttontext")
  9151. {
  9152. buttonTextEdit->setText(node.attribute("value"));
  9153. }
  9154. else if(node.attribute("name")=="annotationtext")
  9155. {
  9156. annotationTextEdit->setText(node.attribute("value"));
  9157. }
  9158. }
  9159. updateButtonText(buttonTextEdit->text());
  9160. updateAnnotationText(annotationTextEdit->text());
  9161. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9162. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9163. setLayout(layout);
  9164. }
  9165. /*:691*//*692:*/
  9166. #line 16624 "./typica.w"
  9167. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  9168. {
  9169. updateAttribute("buttontext",text);
  9170. }
  9171. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9172. {
  9173. updateAttribute("annotationtext",text);
  9174. }
  9175. /*:692*//*695:*/
  9176. #line 16662 "./typica.w"
  9177. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9178. :BasicDeviceConfigurationWidget(model,index)
  9179. {
  9180. QFormLayout*layout= new QFormLayout;
  9181. QLineEdit*buttonTextEdit= new QLineEdit;
  9182. QLineEdit*annotationTextEdit= new QLineEdit;
  9183. layout->addRow(tr("Button Text:"),buttonTextEdit);
  9184. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  9185. /*644:*/
  9186. #line 15127 "./typica.w"
  9187. QDomElement referenceElement=
  9188. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9189. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9190. QDomElement node;
  9191. /*:644*/
  9192. #line 16671 "./typica.w"
  9193. for(int i= 0;i<configData.size();i++)
  9194. {
  9195. node= configData.at(i).toElement();
  9196. if(node.attribute("name")=="buttontext")
  9197. {
  9198. buttonTextEdit->setText(node.attribute("value"));
  9199. }
  9200. else if(node.attribute("name")=="annotationtext")
  9201. {
  9202. annotationTextEdit->setText(node.attribute("value"));
  9203. }
  9204. }
  9205. updateButtonText(buttonTextEdit->text());
  9206. updateAnnotationText(annotationTextEdit->text());
  9207. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  9208. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  9209. QTextEdit*documentation= new QTextEdit;
  9210. 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."));
  9211. documentation->setReadOnly(true);
  9212. layout->addRow("",documentation);
  9213. setLayout(layout);
  9214. }
  9215. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  9216. {
  9217. updateAttribute("buttontext",text);
  9218. }
  9219. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  9220. {
  9221. updateAttribute("annotationtext",text);
  9222. }
  9223. /*:695*/
  9224. #line 824 "./typica.w"
  9225. /*698:*/
  9226. #line 16739 "./typica.w"
  9227. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9228. :BasicDeviceConfigurationWidget(model,index)
  9229. {
  9230. QFormLayout*layout= new QFormLayout;
  9231. QLineEdit*labelEdit= new QLineEdit;
  9232. layout->addRow(tr("Control Label: "),labelEdit);
  9233. QLineEdit*minimumEdit= new QLineEdit;
  9234. layout->addRow(tr("Minimum Value: "),minimumEdit);
  9235. QLineEdit*maximumEdit= new QLineEdit;
  9236. layout->addRow(tr("Maximum Value: "),maximumEdit);
  9237. QSpinBox*precisionEdit= new QSpinBox;
  9238. precisionEdit->setMinimum(0);
  9239. precisionEdit->setMaximum(9);
  9240. layout->addRow(tr("Precision"),precisionEdit);
  9241. QLineEdit*pretext= new QLineEdit;
  9242. layout->addRow(tr("Prefix text"),pretext);
  9243. QLineEdit*posttext= new QLineEdit;
  9244. layout->addRow(tr("Suffix text"),posttext);
  9245. /*644:*/
  9246. #line 15127 "./typica.w"
  9247. QDomElement referenceElement=
  9248. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9249. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9250. QDomElement node;
  9251. /*:644*/
  9252. #line 16758 "./typica.w"
  9253. for(int i= 0;i<configData.size();i++)
  9254. {
  9255. node= configData.at(i).toElement();
  9256. if(node.attribute("name")=="label")
  9257. {
  9258. labelEdit->setText(node.attribute("value"));
  9259. }
  9260. else if(node.attribute("name")=="minimum")
  9261. {
  9262. minimumEdit->setText(node.attribute("value"));
  9263. }
  9264. else if(node.attribute("name")=="maximum")
  9265. {
  9266. maximumEdit->setText(node.attribute("value"));
  9267. }
  9268. else if(node.attribute("name")=="precision")
  9269. {
  9270. precisionEdit->setValue(node.attribute("value").toInt());
  9271. }
  9272. else if(node.attribute("name")=="pretext")
  9273. {
  9274. pretext->setText(node.attribute("value"));
  9275. }
  9276. else if(node.attribute("name")=="posttext")
  9277. {
  9278. posttext->setText(node.attribute("value"));
  9279. }
  9280. }
  9281. updateLabel(labelEdit->text());
  9282. updateMinimum(minimumEdit->text());
  9283. updateMaximum(maximumEdit->text());
  9284. updatePrecision(precisionEdit->value());
  9285. updatePretext(pretext->text());
  9286. updatePosttext(posttext->text());
  9287. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  9288. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  9289. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  9290. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  9291. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  9292. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  9293. setLayout(layout);
  9294. }
  9295. void NoteSpinConfWidget::updateLabel(const QString&text)
  9296. {
  9297. updateAttribute("label",text);
  9298. }
  9299. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  9300. {
  9301. updateAttribute("minimum",minimum);
  9302. }
  9303. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  9304. {
  9305. updateAttribute("maximum",maximum);
  9306. }
  9307. void NoteSpinConfWidget::updatePrecision(int precision)
  9308. {
  9309. updateAttribute("precision",QString("%1").arg(precision));
  9310. }
  9311. void NoteSpinConfWidget::updatePretext(const QString&text)
  9312. {
  9313. updateAttribute("pretext",text);
  9314. }
  9315. void NoteSpinConfWidget::updatePosttext(const QString&text)
  9316. {
  9317. updateAttribute("posttext",text);
  9318. }
  9319. /*:698*/
  9320. #line 825 "./typica.w"
  9321. /*259:*/
  9322. #line 6838 "./typica.w"
  9323. LinearCalibrator::LinearCalibrator(QObject*parent):
  9324. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  9325. {
  9326. }
  9327. /*:259*//*260:*/
  9328. #line 6852 "./typica.w"
  9329. void LinearCalibrator::newMeasurement(Measurement measure)
  9330. {
  9331. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  9332. if(clamp)
  9333. {
  9334. if(outval<Lo1)
  9335. {
  9336. outval= Lo1;
  9337. }
  9338. else if(outval> Up1)
  9339. {
  9340. outval= Up1;
  9341. }
  9342. }
  9343. if(sensitivitySetting>=0.05)
  9344. {
  9345. int temp= qRound(outval/sensitivitySetting);
  9346. outval= temp*sensitivitySetting;
  9347. }
  9348. Measurement adjusted(outval,measure.time(),measure.scale());
  9349. emit measurement(adjusted);
  9350. }
  9351. /*:260*//*261:*/
  9352. #line 6878 "./typica.w"
  9353. double LinearCalibrator::measuredLower()
  9354. {
  9355. return Lo2;
  9356. }
  9357. double LinearCalibrator::measuredUpper()
  9358. {
  9359. return Up2;
  9360. }
  9361. double LinearCalibrator::mappedLower()
  9362. {
  9363. return Lo1;
  9364. }
  9365. double LinearCalibrator::mappedUpper()
  9366. {
  9367. return Up1;
  9368. }
  9369. bool LinearCalibrator::isClosedRange()
  9370. {
  9371. return clamp;
  9372. }
  9373. void LinearCalibrator::setMeasuredLower(double lower)
  9374. {
  9375. Lo2= lower;
  9376. }
  9377. void LinearCalibrator::setMeasuredUpper(double upper)
  9378. {
  9379. Up2= upper;
  9380. }
  9381. void LinearCalibrator::setMappedLower(double lower)
  9382. {
  9383. Lo1= lower;
  9384. }
  9385. void LinearCalibrator::setMappedUpper(double upper)
  9386. {
  9387. Up1= upper;
  9388. }
  9389. void LinearCalibrator::setClosedRange(bool closed)
  9390. {
  9391. clamp= closed;
  9392. }
  9393. void LinearCalibrator::setSensitivity(double sensitivity)
  9394. {
  9395. sensitivitySetting= sensitivity;
  9396. }
  9397. double LinearCalibrator::sensitivity()
  9398. {
  9399. return sensitivitySetting;
  9400. }
  9401. /*:261*/
  9402. #line 826 "./typica.w"
  9403. /*266:*/
  9404. #line 7011 "./typica.w"
  9405. void LinearSplineInterpolator::add_pair(double source,double destination)
  9406. {
  9407. pairs->insert(source,destination);
  9408. make_interpolators();
  9409. }
  9410. void LinearSplineInterpolator::make_interpolators()
  9411. {
  9412. if(pairs->size()> 1)
  9413. {
  9414. while(interpolators->size()> 0)
  9415. {
  9416. LinearCalibrator*removed= interpolators->takeFirst();
  9417. removed->deleteLater();
  9418. }
  9419. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9420. QMap<double,double> ::const_iterator j= i+1;
  9421. while(j!=pairs->constEnd())
  9422. {
  9423. LinearCalibrator*segment= new LinearCalibrator();
  9424. segment->setMeasuredLower(i.key());
  9425. segment->setMappedLower(i.value());
  9426. segment->setMeasuredUpper(j.key());
  9427. segment->setMappedUpper(j.value());
  9428. segment->setClosedRange(false);
  9429. interpolators->append(segment);
  9430. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  9431. i++;
  9432. j++;
  9433. }
  9434. }
  9435. }
  9436. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  9437. QObject(parent),pairs(new QMap<double,double> ),
  9438. interpolators(new QList<LinearCalibrator*> )
  9439. {
  9440. }
  9441. void LinearSplineInterpolator::newMeasurement(Measurement measure)
  9442. {
  9443. QMap<double,double> ::const_iterator i= pairs->constBegin();
  9444. int index= -1;
  9445. while(i!=pairs->constEnd())
  9446. {
  9447. if(measure.temperature()<=i.key())
  9448. {
  9449. break;
  9450. }
  9451. i++;
  9452. index++;
  9453. }
  9454. if(index<0)
  9455. {
  9456. index= 0;
  9457. }
  9458. if(index>=interpolators->size())
  9459. {
  9460. index= interpolators->size()-1;
  9461. }
  9462. if(interpolators->at(index)!=NULL)
  9463. {
  9464. interpolators->at(index)->newMeasurement(measure);
  9465. }
  9466. }
  9467. /*:266*/
  9468. #line 827 "./typica.w"
  9469. /*720:*/
  9470. #line 18040 "./typica.w"
  9471. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9472. :BasicDeviceConfigurationWidget(model,index),knotmodel(new SaltModel(2))
  9473. {
  9474. QFormLayout*layout= new QFormLayout;
  9475. QLineEdit*source= new QLineEdit;
  9476. layout->addRow(tr("Source column name:"),source);
  9477. QLineEdit*destination= new QLineEdit;
  9478. layout->addRow(tr("Destination column name:"),destination);
  9479. knotmodel->setHeaderData(0,Qt::Horizontal,"Input");
  9480. knotmodel->setHeaderData(1,Qt::Horizontal,"Output");
  9481. QTableView*mappingTable= new QTableView;
  9482. mappingTable->setModel(knotmodel);
  9483. NumericDelegate*delegate= new NumericDelegate;
  9484. mappingTable->setItemDelegate(delegate);
  9485. layout->addRow(tr("Mapping data:"),mappingTable);
  9486. /*644:*/
  9487. #line 15127 "./typica.w"
  9488. QDomElement referenceElement=
  9489. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9490. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9491. QDomElement node;
  9492. /*:644*/
  9493. #line 18056 "./typica.w"
  9494. for(int i= 0;i<configData.size();i++)
  9495. {
  9496. node= configData.at(i).toElement();
  9497. if(node.attribute("name")=="source")
  9498. {
  9499. source->setText(node.attribute("value"));
  9500. }
  9501. else if(node.attribute("name")=="destination")
  9502. {
  9503. destination->setText(node.attribute("value"));
  9504. }
  9505. else if(node.attribute("name")=="sourcevalues")
  9506. {
  9507. /*721:*/
  9508. #line 18095 "./typica.w"
  9509. QString data= node.attribute("value");
  9510. if(data.length()> 3)
  9511. {
  9512. data.chop(2);
  9513. data= data.remove(0,2);
  9514. }
  9515. QStringList itemList= data.split(",");
  9516. /*:721*/
  9517. #line 18070 "./typica.w"
  9518. int column= 0;
  9519. /*722:*/
  9520. #line 18107 "./typica.w"
  9521. for(int i= 0;i<itemList.size();i++)
  9522. {
  9523. knotmodel->setData(knotmodel->index(i,column),
  9524. QVariant(itemList.at(i).toDouble()),
  9525. Qt::DisplayRole);
  9526. }
  9527. /*:722*/
  9528. #line 18072 "./typica.w"
  9529. }
  9530. else if(node.attribute("name")=="destinationvalues")
  9531. {
  9532. /*721:*/
  9533. #line 18095 "./typica.w"
  9534. QString data= node.attribute("value");
  9535. if(data.length()> 3)
  9536. {
  9537. data.chop(2);
  9538. data= data.remove(0,2);
  9539. }
  9540. QStringList itemList= data.split(",");
  9541. /*:721*/
  9542. #line 18077 "./typica.w"
  9543. int column= 1;
  9544. /*722:*/
  9545. #line 18107 "./typica.w"
  9546. for(int i= 0;i<itemList.size();i++)
  9547. {
  9548. knotmodel->setData(knotmodel->index(i,column),
  9549. QVariant(itemList.at(i).toDouble()),
  9550. Qt::DisplayRole);
  9551. }
  9552. /*:722*/
  9553. #line 18079 "./typica.w"
  9554. }
  9555. }
  9556. updateSourceColumn(source->text());
  9557. updateDestinationColumn(destination->text());
  9558. updateKnots();
  9559. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  9560. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  9561. connect(knotmodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  9562. setLayout(layout);
  9563. }
  9564. /*:720*//*723:*/
  9565. #line 18118 "./typica.w"
  9566. void LinearSplineInterpolationConfWidget::updateKnots()
  9567. {
  9568. updateAttribute("sourcevalues",knotmodel->arrayLiteral(0,Qt::DisplayRole));
  9569. updateAttribute("destinationvalues",knotmodel->arrayLiteral(1,Qt::DisplayRole));
  9570. }
  9571. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  9572. {
  9573. updateAttribute("source",source);
  9574. }
  9575. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  9576. {
  9577. updateAttribute("destination",dest);
  9578. }
  9579. /*:723*/
  9580. #line 828 "./typica.w"
  9581. /*726:*/
  9582. #line 18161 "./typica.w"
  9583. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  9584. :BasicDeviceConfigurationWidget(model,index),
  9585. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  9586. {
  9587. unitSelector->addItem("Fahrenheit");
  9588. unitSelector->addItem("Celsius");
  9589. temperatureValue->setMinimum(0);
  9590. temperatureValue->setMaximum(1000);
  9591. QFormLayout*layout= new QFormLayout;
  9592. QLineEdit*column= new QLineEdit;
  9593. layout->addRow(tr("Column to match:"),column);
  9594. layout->addRow(tr("Unit:"),unitSelector);
  9595. layout->addRow(tr("Value:"),temperatureValue);
  9596. /*644:*/
  9597. #line 15127 "./typica.w"
  9598. QDomElement referenceElement=
  9599. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9600. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9601. QDomElement node;
  9602. /*:644*/
  9603. #line 18175 "./typica.w"
  9604. for(int i= 0;i<configData.size();i++)
  9605. {
  9606. node= configData.at(i).toElement();
  9607. if(node.attribute("name")=="column")
  9608. {
  9609. column->setText(node.attribute("value"));
  9610. }
  9611. else if(node.attribute("name")=="unit")
  9612. {
  9613. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  9614. }
  9615. else if(node.attribute("name")=="value")
  9616. {
  9617. temperatureValue->setValue(node.attribute("value").toDouble());
  9618. }
  9619. }
  9620. updateMatchingColumn(column->text());
  9621. updateTemperature();
  9622. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  9623. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  9624. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  9625. setLayout(layout);
  9626. }
  9627. /*:726*//*727:*/
  9628. #line 18204 "./typica.w"
  9629. void TranslationConfWidget::updateTemperature()
  9630. {
  9631. updateAttribute("unit",unitSelector->currentText());
  9632. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  9633. if(unitSelector->currentText()=="Fahrenheit")
  9634. {
  9635. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  9636. }
  9637. else
  9638. {
  9639. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  9640. }
  9641. }
  9642. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  9643. {
  9644. updateAttribute("column",column);
  9645. }
  9646. /*:727*/
  9647. #line 829 "./typica.w"
  9648. /*:16*/
  9649. #line 757 "./typica.w"
  9650. /*19:*/
  9651. #line 882 "./typica.w"
  9652. template<class TYPE> TYPE getself(QScriptContext*context)
  9653. {
  9654. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  9655. return self;
  9656. }
  9657. template<> QTime getself(QScriptContext*context)
  9658. {
  9659. QTime self= context->thisObject().toVariant().toTime();
  9660. return self;
  9661. }
  9662. template<> SqlQueryConnection*getself(QScriptContext*context)
  9663. {
  9664. SqlQueryConnection*self=
  9665. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  9666. return self;
  9667. }
  9668. template<> QXmlQuery*getself(QScriptContext*context)
  9669. {
  9670. QXmlQuery*self=
  9671. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  9672. return self;
  9673. }
  9674. template<> QXmlStreamWriter*getself(QScriptContext*context)
  9675. {
  9676. QXmlStreamWriter*self=
  9677. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  9678. return self;
  9679. }
  9680. template<> QXmlStreamReader*getself(QScriptContext*context)
  9681. {
  9682. QXmlStreamReader*self=
  9683. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  9684. return self;
  9685. }
  9686. /*:19*//*20:*/
  9687. #line 927 "./typica.w"
  9688. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  9689. {
  9690. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  9691. return argument;
  9692. }
  9693. template<> QString argument(int arg,QScriptContext*context)
  9694. {
  9695. return context->argument(arg).toString();
  9696. }
  9697. template<> QVariant argument(int arg,QScriptContext*context)
  9698. {
  9699. return context->argument(arg).toVariant();
  9700. }
  9701. template<> int argument(int arg,QScriptContext*context)
  9702. {
  9703. return context->argument(arg).toInt32();
  9704. }
  9705. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  9706. {
  9707. return(SqlQueryConnection*)
  9708. qscriptvalue_cast<void*> (context->argument(arg));
  9709. }
  9710. template<> QModelIndex argument(int arg,QScriptContext*context)
  9711. {
  9712. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  9713. }
  9714. /*:20*//*24:*/
  9715. #line 1004 "./typica.w"
  9716. void setQObjectProperties(QScriptValue,QScriptEngine*)
  9717. {
  9718. }
  9719. /*:24*//*26:*/
  9720. #line 1018 "./typica.w"
  9721. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  9722. {
  9723. }
  9724. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  9725. {
  9726. }
  9727. /*:26*//*29:*/
  9728. #line 1057 "./typica.w"
  9729. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  9730. {
  9731. QScriptValue object= engine->newQObject(new QWidget);
  9732. setQWidgetProperties(object,engine);
  9733. return object;
  9734. }
  9735. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  9736. {
  9737. setQObjectProperties(value,engine);
  9738. setQPaintDeviceProperties(value,engine);
  9739. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  9740. value.setProperty("activateWindow",
  9741. engine->newFunction(QWidget_activateWindow));
  9742. }
  9743. /*:29*//*30:*/
  9744. #line 1079 "./typica.w"
  9745. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  9746. {
  9747. if(context->argumentCount()==1)
  9748. {
  9749. QWidget*self= getself<QWidget*> (context);
  9750. QLayout*layout= argument<QLayout*> (0,context);
  9751. if(layout)
  9752. {
  9753. self->setLayout(layout);
  9754. }
  9755. else
  9756. {
  9757. context->throwError("Incorrect argument type passed to "
  9758. "QWidget::setLayout(). This method requires "
  9759. "a QLayout.");
  9760. }
  9761. }
  9762. else
  9763. {
  9764. context->throwError("Incorrect number of arguments passed to "
  9765. "QWidget::setLayout(). This method takes one "
  9766. "QLayout as an argument.");
  9767. }
  9768. return QScriptValue();
  9769. }
  9770. QScriptValue QWidget_activateWindow(QScriptContext*context,
  9771. QScriptEngine*)
  9772. {
  9773. QWidget*self= getself<QWidget*> (context);
  9774. self->activateWindow();
  9775. return QScriptValue();
  9776. }
  9777. /*:30*//*32:*/
  9778. #line 1153 "./typica.w"
  9779. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL)
  9780. {
  9781. }
  9782. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  9783. {
  9784. QSettings settings;
  9785. settings.beginGroup(key);
  9786. settings.setValue("pos",pos());
  9787. settings.setValue("size",size());
  9788. settings.endGroup();
  9789. }
  9790. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  9791. {
  9792. QSettings settings;
  9793. settings.beginGroup(key);
  9794. if(settings.contains("size"))
  9795. {
  9796. resize(settings.value("size").toSize());
  9797. }
  9798. if(settings.contains("pos"))
  9799. {
  9800. move(settings.value("pos").toPoint());
  9801. }
  9802. settings.endGroup();
  9803. }
  9804. void ScriptQMainWindow::displayStatus(const QString&message)
  9805. {
  9806. statusBar()->showMessage(message);
  9807. }
  9808. void ScriptQMainWindow::showEvent(QShowEvent*event)
  9809. {
  9810. if(!event->spontaneous())
  9811. {
  9812. /*34:*/
  9813. #line 1227 "./typica.w"
  9814. QSettings settings;
  9815. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  9816. toByteArray());
  9817. /*:34*/
  9818. #line 1192 "./typica.w"
  9819. event->accept();
  9820. }
  9821. else
  9822. {
  9823. event->ignore();
  9824. }
  9825. }
  9826. void ScriptQMainWindow::show()
  9827. {
  9828. QMainWindow::show();
  9829. }
  9830. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  9831. {
  9832. emit aboutToClose();
  9833. /*33:*/
  9834. #line 1221 "./typica.w"
  9835. QSettings settings;
  9836. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  9837. /*:33*/
  9838. #line 1209 "./typica.w"
  9839. event->accept();
  9840. }
  9841. /*:32*//*37:*/
  9842. #line 1255 "./typica.w"
  9843. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  9844. {
  9845. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  9846. setQMainWindowProperties(object,engine);
  9847. return object;
  9848. }
  9849. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  9850. {
  9851. setQWidgetProperties(value,engine);
  9852. value.setProperty("setCentralWidget",
  9853. engine->newFunction(QMainWindow_setCentralWidget));
  9854. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  9855. }
  9856. /*:37*//*38:*/
  9857. #line 1277 "./typica.w"
  9858. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  9859. QScriptEngine*)
  9860. {
  9861. if(context->argumentCount()==1)
  9862. {
  9863. QMainWindow*self= getself<QMainWindow*> (context);
  9864. QWidget*widget= argument<QWidget*> (0,context);
  9865. if(widget)
  9866. {
  9867. self->setCentralWidget(widget);
  9868. }
  9869. else
  9870. {
  9871. context->throwError("Incorrect argument type passed to "
  9872. "QMainWindow::setCentralWidget(). This "
  9873. "method requires a QWidget.");
  9874. }
  9875. }
  9876. else
  9877. {
  9878. context->throwError("Incorrect number of arguments passed to "
  9879. "QMainWindow::setCentralWidget(). This method "
  9880. "takes one QWidget as an argument.");
  9881. }
  9882. return QScriptValue();
  9883. }
  9884. /*:38*//*39:*/
  9885. #line 1311 "./typica.w"
  9886. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  9887. {
  9888. QScriptValue object;
  9889. if(context->argumentCount()==0)
  9890. {
  9891. QMainWindow*self= getself<QMainWindow*> (context);
  9892. QMenuBar*bar= self->menuBar();
  9893. object= engine->newQObject(bar);
  9894. setQMenuBarProperties(object,engine);
  9895. }
  9896. else
  9897. {
  9898. context->throwError("Incorrect number of arguments passed to "
  9899. "QMainWindow::menuBar(). This method takes no "
  9900. "arguments.");
  9901. }
  9902. return object;
  9903. }
  9904. /*:39*//*41:*/
  9905. #line 1341 "./typica.w"
  9906. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  9907. {
  9908. setQWidgetProperties(value,engine);
  9909. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  9910. }
  9911. /*:41*//*42:*/
  9912. #line 1356 "./typica.w"
  9913. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  9914. {
  9915. QScriptValue object;
  9916. if(context->argumentCount()==1)
  9917. {
  9918. QMenuBar*self= getself<QMenuBar*> (context);
  9919. QString title= argument<QString> (0,context);
  9920. object= engine->newQObject(self->addMenu(title));
  9921. setQMenuProperties(object,engine);
  9922. }
  9923. else
  9924. {
  9925. context->throwError("Incorrect number of arguments passed to "
  9926. "QMenuBar::addMenu(). This method takes one "
  9927. "string as an argument.");
  9928. }
  9929. return object;
  9930. }
  9931. /*:42*//*44:*/
  9932. #line 1386 "./typica.w"
  9933. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  9934. {
  9935. setQWidgetProperties(value,engine);
  9936. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  9937. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  9938. }
  9939. /*:44*//*45:*/
  9940. #line 1396 "./typica.w"
  9941. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  9942. {
  9943. if(context->argumentCount()==1)
  9944. {
  9945. QMenu*self= getself<QMenu*> (context);
  9946. QAction*action= argument<QAction*> (0,context);
  9947. if(action)
  9948. {
  9949. self->addAction(action);
  9950. }
  9951. else
  9952. {
  9953. context->throwError("Incorrect argument type passed to "
  9954. "QMenu::addAction(). This method requires a "
  9955. "QAction.");
  9956. }
  9957. }
  9958. else
  9959. {
  9960. context->throwError("Incorrect number of arguments passed to "
  9961. "QMenu::addAction(). This method takes one "
  9962. "QAction as an argument.");
  9963. }
  9964. return QScriptValue();
  9965. }
  9966. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  9967. {
  9968. if(context->argumentCount()==0)
  9969. {
  9970. QMenu*self= getself<QMenu*> (context);
  9971. self->addSeparator();
  9972. }
  9973. else
  9974. {
  9975. context->throwError("Incorrect number of arguments passed to "
  9976. "QMenu::addSeparator(). This method takes no "
  9977. "arguments.");
  9978. }
  9979. return QScriptValue();
  9980. }
  9981. /*:45*//*48:*/
  9982. #line 1458 "./typica.w"
  9983. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  9984. {
  9985. QScriptValue object= engine->newQObject(new QFrame);
  9986. setQFrameProperties(object,engine);
  9987. return object;
  9988. }
  9989. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  9990. {
  9991. setQWidgetProperties(value,engine);
  9992. }
  9993. /*:48*//*51:*/
  9994. #line 1492 "./typica.w"
  9995. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  9996. {
  9997. QString text;
  9998. if(context->argumentCount()==1)
  9999. {
  10000. text= argument<QString> (0,context);
  10001. }
  10002. QScriptValue object= engine->newQObject(new QLabel(text));
  10003. setQLabelProperties(object,engine);
  10004. return object;
  10005. }
  10006. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  10007. {
  10008. setQFrameProperties(value,engine);
  10009. }
  10010. /*:51*//*54:*/
  10011. #line 1538 "./typica.w"
  10012. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  10013. {
  10014. QScriptValue object= engine->newQObject(new QSplitter);
  10015. setQSplitterProperties(object,engine);
  10016. return object;
  10017. }
  10018. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  10019. {
  10020. setQFrameProperties(value,engine);
  10021. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  10022. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  10023. value.setProperty("restoreState",
  10024. engine->newFunction(QSplitter_restoreState));
  10025. }
  10026. /*:54*//*55:*/
  10027. #line 1558 "./typica.w"
  10028. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  10029. {
  10030. if(context->argumentCount()==1)
  10031. {
  10032. QSplitter*self= getself<QSplitter*> (context);
  10033. QWidget*widget= argument<QWidget*> (0,context);
  10034. if(widget)
  10035. {
  10036. self->addWidget(widget);
  10037. }
  10038. else
  10039. {
  10040. context->throwError("Incorrect argument type passed to "
  10041. "QSplitter::addWidget(). This method "
  10042. "requires a QWidget.");
  10043. }
  10044. }
  10045. else
  10046. {
  10047. context->throwError("Incorrect number of arguments passed to "
  10048. "QSplitter::addWidget(). This method takes one "
  10049. "QWidget as an argument.");
  10050. }
  10051. return QScriptValue();
  10052. }
  10053. /*:55*//*56:*/
  10054. #line 1591 "./typica.w"
  10055. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  10056. {
  10057. if(context->argumentCount()==1)
  10058. {
  10059. QSplitter*self= getself<QSplitter*> (context);
  10060. QString key= argument<QString> (0,context);
  10061. QSettings settings;
  10062. settings.setValue(key,self->saveState());
  10063. }
  10064. else
  10065. {
  10066. context->throwError("Incorrect number of arguments passed to "
  10067. "QSplitter::saveState(). This method takes one "
  10068. "string as an argument.");
  10069. }
  10070. return QScriptValue();
  10071. }
  10072. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  10073. {
  10074. if(context->argumentCount()==1)
  10075. {
  10076. QSplitter*self= getself<QSplitter*> (context);
  10077. QString key= argument<QString> (0,context);
  10078. QSettings settings;
  10079. self->restoreState(settings.value(key).toByteArray());
  10080. }
  10081. else
  10082. {
  10083. context->throwError("Incorrect number of arguments passed to "
  10084. "QSplitter::restoreState(). This method takes "
  10085. "one string as an argument.");
  10086. }
  10087. return QScriptValue();
  10088. }
  10089. /*:56*//*58:*/
  10090. #line 1644 "./typica.w"
  10091. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10092. {
  10093. setQLayoutItemProperties(value,engine);
  10094. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  10095. }
  10096. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10097. {
  10098. if(context->argumentCount()==1)
  10099. {
  10100. QLayout*self= getself<QLayout*> (context);
  10101. QWidget*widget= argument<QWidget*> (0,context);
  10102. if(widget)
  10103. {
  10104. self->addWidget(widget);
  10105. }
  10106. else
  10107. {
  10108. context->throwError("Incorrect argument type passed to "
  10109. "QLayout::addWidget(). This method requires "
  10110. "a QWidget.");
  10111. }
  10112. }
  10113. else
  10114. {
  10115. context->throwError("Incorrect number of arguments passed to "
  10116. "QLayout::addWidget(). This method takes one "
  10117. "QWidget as an argument.");
  10118. }
  10119. return QScriptValue();
  10120. }
  10121. /*:58*//*61:*/
  10122. #line 1711 "./typica.w"
  10123. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  10124. {
  10125. QScriptValue object=
  10126. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  10127. setQBoxLayoutProperties(object,engine);
  10128. return object;
  10129. }
  10130. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  10131. {
  10132. setQLayoutProperties(value,engine);
  10133. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  10134. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  10135. }
  10136. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  10137. {
  10138. if(context->argumentCount()> 0&&context->argumentCount()<3)
  10139. {
  10140. QBoxLayout*self= getself<QBoxLayout*> (context);
  10141. QLayout*layout= argument<QLayout*> (0,context);
  10142. int stretch= 0;
  10143. if(context->argumentCount()==2)
  10144. {
  10145. stretch= argument<int> (1,context);
  10146. }
  10147. if(layout)
  10148. {
  10149. self->addLayout(layout,stretch);
  10150. }
  10151. else
  10152. {
  10153. context->throwError("Incorrect argument type passed to "
  10154. "QLayout::addLayout(). This method requires "
  10155. "a QLayout.");
  10156. }
  10157. }
  10158. else
  10159. {
  10160. context->throwError("Incorrect number of arguments passed to "
  10161. "QLayout::addLayout(). This method takes one "
  10162. "QLayout as an argument and optionally one integer.");
  10163. }
  10164. return QScriptValue();
  10165. }
  10166. /*:61*//*62:*/
  10167. #line 1762 "./typica.w"
  10168. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  10169. {
  10170. if(context->argumentCount()> 0&&context->argumentCount()<4)
  10171. {
  10172. QBoxLayout*self= getself<QBoxLayout*> (context);
  10173. QWidget*widget= argument<QWidget*> (0,context);
  10174. int stretch= 0;
  10175. Qt::Alignment alignment= 0;
  10176. if(context->argumentCount()> 1)
  10177. {
  10178. stretch= argument<int> (1,context);
  10179. }
  10180. if(context->argumentCount()> 2)
  10181. {
  10182. alignment= (Qt::Alignment)(argument<int> (2,context));
  10183. }
  10184. if(widget)
  10185. {
  10186. self->addWidget(widget,stretch,alignment);
  10187. }
  10188. else
  10189. {
  10190. context->throwError("Incorrect argument type passed to "
  10191. "QBoxLayout::addWidget(). This method requires "
  10192. "a QWidget.");
  10193. }
  10194. }
  10195. else
  10196. {
  10197. context->throwError("Incorrect number of arguments passed to "
  10198. "QBoxLayout::addWidget(). This method takes one "
  10199. "QWidget and optionally up to two integers as "
  10200. "arguments.");
  10201. }
  10202. return QScriptValue();
  10203. }
  10204. /*:62*//*65:*/
  10205. #line 1826 "./typica.w"
  10206. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  10207. {
  10208. QScriptValue object= engine->newQObject(new QAction(NULL));
  10209. setQActionProperties(object,engine);
  10210. return object;
  10211. }
  10212. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  10213. {
  10214. setQObjectProperties(value,engine);
  10215. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  10216. }
  10217. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  10218. {
  10219. if(context->argumentCount()==1)
  10220. {
  10221. QAction*self= getself<QAction*> (context);
  10222. self->setShortcut(argument<QString> (0,context));
  10223. }
  10224. else
  10225. {
  10226. context->throwError("Incorrect number of arguments passed to "
  10227. "QAction::setShortcut(). This method takes one "
  10228. "string as an argument.");
  10229. }
  10230. return QScriptValue();
  10231. }
  10232. /*:65*//*68:*/
  10233. #line 1884 "./typica.w"
  10234. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  10235. QScriptEngine*engine)
  10236. {
  10237. QScriptValue retval;
  10238. if(context->argumentCount()==3)
  10239. {
  10240. QWidget*widget= argument<QWidget*> (0,context);
  10241. if(widget)
  10242. {
  10243. QString caption= argument<QString> (1,context);
  10244. QString dir= argument<QString> (2,context);
  10245. retval= QScriptValue(engine,
  10246. QFileDialog::getOpenFileName(widget,caption,
  10247. dir,"",0,0));
  10248. setQFileDialogProperties(retval,engine);
  10249. }
  10250. else
  10251. {
  10252. context->throwError("Incorrect argument type passed to "
  10253. "QFileDialog::getOpenFileName(). The first "
  10254. "argument to this method must be a QWidget.");
  10255. }
  10256. }
  10257. else
  10258. {
  10259. context->throwError("Incorrect number of arguments passed to "
  10260. "QFileDialog::getOpenFileName(). This method "
  10261. "takes one QWidget followed by two strings for a "
  10262. "total of three arguments.");
  10263. }
  10264. return retval;
  10265. }
  10266. /*:68*//*69:*/
  10267. #line 1920 "./typica.w"
  10268. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  10269. QScriptEngine*engine)
  10270. {
  10271. QScriptValue retval;
  10272. if(context->argumentCount()==3)
  10273. {
  10274. QWidget*widget= argument<QWidget*> (0,context);
  10275. if(widget)
  10276. {
  10277. QString caption= argument<QString> (1,context);
  10278. QString dir= argument<QString> (2,context);
  10279. retval= QScriptValue(engine,
  10280. QFileDialog::getSaveFileName(widget,caption,
  10281. dir,"",0,0));
  10282. setQFileDialogProperties(retval,engine);
  10283. }
  10284. else
  10285. {
  10286. context->throwError("Incorrect argument type passed to "
  10287. "QFileDialog::getSaveFileName(). The first "
  10288. "argument to this method must be a QWidget.");
  10289. }
  10290. }
  10291. else
  10292. {
  10293. context->throwError("Incorrect number of arguments passed to "
  10294. "QFileDialog::getSaveFileName(). This method "
  10295. "takes one QWidget followed by two strings for a "
  10296. "total of three arguments.");
  10297. }
  10298. return retval;
  10299. }
  10300. /*:69*//*70:*/
  10301. #line 1957 "./typica.w"
  10302. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  10303. {
  10304. setQDialogProperties(value,engine);
  10305. }
  10306. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  10307. {
  10308. setQWidgetProperties(value,engine);
  10309. }
  10310. /*:70*//*73:*/
  10311. #line 1992 "./typica.w"
  10312. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  10313. {
  10314. QScriptValue object=
  10315. engine->newQObject(new QFile(argument<QString> (0,context)));
  10316. setQFileProperties(object,engine);
  10317. return object;
  10318. }
  10319. /*:73*//*74:*/
  10320. #line 2003 "./typica.w"
  10321. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  10322. {
  10323. setQIODeviceProperties(value,engine);
  10324. value.setProperty("remove",engine->newFunction(QFile_remove));
  10325. }
  10326. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  10327. {
  10328. QFile*self= getself<QFile*> (context);
  10329. bool retval= self->remove();
  10330. return QScriptValue(engine,retval);
  10331. }
  10332. /*:74*//*75:*/
  10333. #line 2025 "./typica.w"
  10334. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  10335. {
  10336. setQObjectProperties(value,engine);
  10337. value.setProperty("open",engine->newFunction(QIODevice_open));
  10338. value.setProperty("close",engine->newFunction(QIODevice_close));
  10339. value.setProperty("readToString",
  10340. engine->newFunction(QIODevice_readToString));
  10341. }
  10342. /*:75*//*76:*/
  10343. #line 2040 "./typica.w"
  10344. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  10345. {
  10346. QIODevice*self= getself<QIODevice*> (context);
  10347. if(context->argumentCount()==1)
  10348. {
  10349. switch(argument<int> (0,context))
  10350. {
  10351. case 1:
  10352. self->open(QIODevice::ReadOnly);
  10353. break;
  10354. case 2:
  10355. self->open(QIODevice::WriteOnly);
  10356. break;
  10357. case 3:
  10358. self->open(QIODevice::ReadWrite);
  10359. break;
  10360. default:
  10361. break;
  10362. }
  10363. }
  10364. else
  10365. {
  10366. self->open(QIODevice::ReadWrite);
  10367. }
  10368. return QScriptValue();
  10369. }
  10370. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  10371. {
  10372. QIODevice*self= getself<QIODevice*> (context);
  10373. self->close();
  10374. return QScriptValue();
  10375. }
  10376. /*:76*//*77:*/
  10377. #line 2079 "./typica.w"
  10378. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  10379. {
  10380. QIODevice*self= getself<QIODevice*> (context);
  10381. self->reset();
  10382. return QScriptValue(QString(self->readAll()));
  10383. }
  10384. /*:77*//*80:*/
  10385. #line 2109 "./typica.w"
  10386. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  10387. {
  10388. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  10389. QScriptValue object= engine->newQObject(new QBuffer(array));
  10390. setQBufferProperties(object,engine);
  10391. return object;
  10392. }
  10393. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  10394. {
  10395. setQIODeviceProperties(value,engine);
  10396. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  10397. }
  10398. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  10399. {
  10400. QBuffer*self= getself<QBuffer*> (context);
  10401. self->setData(argument<QString> (0,context).toAscii());
  10402. return QScriptValue();
  10403. }
  10404. /*:80*//*83:*/
  10405. #line 2157 "./typica.w"
  10406. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  10407. {
  10408. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  10409. setXQueryProperties(object,engine);
  10410. return object;
  10411. }
  10412. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  10413. {
  10414. value.setProperty("bind",engine->newFunction(XQuery_bind));
  10415. value.setProperty("exec",engine->newFunction(XQuery_exec));
  10416. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  10417. }
  10418. /*:83*//*84:*/
  10419. #line 2175 "./typica.w"
  10420. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  10421. {
  10422. QXmlQuery*self= getself<QXmlQuery*> (context);
  10423. QIODevice*buffer= argument<QIODevice*> (1,context);
  10424. self->bindVariable(argument<QString> (0,context),buffer);
  10425. return QScriptValue();
  10426. }
  10427. /*:84*//*85:*/
  10428. #line 2186 "./typica.w"
  10429. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  10430. {
  10431. QXmlQuery*self= getself<QXmlQuery*> (context);
  10432. self->setQuery(argument<QString> (0,context));
  10433. return QScriptValue();
  10434. }
  10435. /*:85*//*86:*/
  10436. #line 2196 "./typica.w"
  10437. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  10438. {
  10439. QXmlQuery*self= getself<QXmlQuery*> (context);
  10440. QString result;
  10441. self->evaluateTo(&result);
  10442. return QScriptValue(result);
  10443. }
  10444. /*:86*//*89:*/
  10445. #line 2251 "./typica.w"
  10446. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  10447. {
  10448. QXmlStreamWriter*retval;
  10449. if(context->argumentCount()==1)
  10450. {
  10451. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  10452. }
  10453. else
  10454. {
  10455. retval= new QXmlStreamWriter;
  10456. }
  10457. QScriptValue object= engine->toScriptValue<void*> (retval);
  10458. setXmlWriterProperties(object,engine);
  10459. return object;
  10460. }
  10461. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  10462. {
  10463. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  10464. value.setProperty("writeAttribute",
  10465. engine->newFunction(XmlWriter_writeAttribute));
  10466. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  10467. value.setProperty("writeCharacters",
  10468. engine->newFunction(XmlWriter_writeCharacters));
  10469. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  10470. value.setProperty("writeEmptyElement",
  10471. engine->newFunction(XmlWriter_writeEmptyElement));
  10472. value.setProperty("writeEndDocument",
  10473. engine->newFunction(XmlWriter_writeEndDocument));
  10474. value.setProperty("writeEndElement",
  10475. engine->newFunction(XmlWriter_writeEndElement));
  10476. value.setProperty("writeEntityReference",
  10477. engine->newFunction(XmlWriter_writeEntityReference));
  10478. value.setProperty("writeProcessingInstruction",
  10479. engine->newFunction(XmlWriter_writeProcessingInstruction));
  10480. value.setProperty("writeStartDocument",
  10481. engine->newFunction(XmlWriter_writeStartDocument));
  10482. value.setProperty("writeStartElement",
  10483. engine->newFunction(XmlWriter_writeStartElement));
  10484. value.setProperty("writeTextElement",
  10485. engine->newFunction(XmlWriter_writeTextElement));
  10486. }
  10487. /*:89*//*90:*/
  10488. #line 2298 "./typica.w"
  10489. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  10490. {
  10491. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10492. QIODevice*device= argument<QIODevice*> (0,context);
  10493. self->setDevice(device);
  10494. return QScriptValue();
  10495. }
  10496. /*:90*//*91:*/
  10497. #line 2312 "./typica.w"
  10498. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  10499. QScriptEngine*)
  10500. {
  10501. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10502. self->writeStartDocument(argument<QString> (0,context));
  10503. return QScriptValue();
  10504. }
  10505. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  10506. QScriptEngine*)
  10507. {
  10508. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10509. self->writeEndDocument();
  10510. return QScriptValue();
  10511. }
  10512. /*:91*//*92:*/
  10513. #line 2331 "./typica.w"
  10514. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  10515. {
  10516. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10517. self->writeDTD(argument<QString> (0,context));
  10518. return QScriptValue();
  10519. }
  10520. /*:92*//*93:*/
  10521. #line 2342 "./typica.w"
  10522. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  10523. QScriptEngine*)
  10524. {
  10525. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10526. self->writeStartElement(argument<QString> (0,context));
  10527. return QScriptValue();
  10528. }
  10529. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  10530. {
  10531. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10532. self->writeAttribute(argument<QString> (0,context),
  10533. argument<QString> (1,context));
  10534. return QScriptValue();
  10535. }
  10536. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  10537. {
  10538. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10539. self->writeCharacters(argument<QString> (0,context));
  10540. return QScriptValue();
  10541. }
  10542. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  10543. {
  10544. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10545. self->writeEndElement();
  10546. return QScriptValue();
  10547. }
  10548. /*:93*//*94:*/
  10549. #line 2378 "./typica.w"
  10550. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  10551. QScriptEngine*)
  10552. {
  10553. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10554. self->writeEmptyElement(argument<QString> (0,context));
  10555. return QScriptValue();
  10556. }
  10557. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  10558. QScriptEngine*)
  10559. {
  10560. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10561. self->writeTextElement(argument<QString> (0,context),
  10562. argument<QString> (1,context));
  10563. return QScriptValue();
  10564. }
  10565. /*:94*//*95:*/
  10566. #line 2399 "./typica.w"
  10567. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  10568. {
  10569. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10570. self->writeCDATA(argument<QString> (0,context));
  10571. return QScriptValue();
  10572. }
  10573. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  10574. QScriptEngine*)
  10575. {
  10576. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10577. self->writeEntityReference(argument<QString> (0,context));
  10578. return QScriptValue();
  10579. }
  10580. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  10581. QScriptEngine*)
  10582. {
  10583. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  10584. self->writeProcessingInstruction(argument<QString> (0,context),
  10585. argument<QString> (1,context));
  10586. return QScriptValue();
  10587. }
  10588. /*:95*//*98:*/
  10589. #line 2458 "./typica.w"
  10590. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  10591. {
  10592. QXmlStreamReader*retval=
  10593. new QXmlStreamReader(argument<QIODevice*> (0,context));
  10594. QScriptValue object= engine->toScriptValue<void*> (retval);
  10595. setXmlReaderProperties(object,engine);
  10596. return object;
  10597. }
  10598. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  10599. {
  10600. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  10601. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  10602. value.setProperty("hasAttribute",
  10603. engine->newFunction(XmlReader_hasAttribute));
  10604. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  10605. value.setProperty("isStartElement",
  10606. engine->newFunction(XmlReader_isStartElement));
  10607. value.setProperty("name",engine->newFunction(XmlReader_name));
  10608. value.setProperty("readElementText",
  10609. engine->newFunction(XmlReader_readElementText));
  10610. value.setProperty("readNext",
  10611. engine->newFunction(XmlReader_readNext));
  10612. value.setProperty("text",engine->newFunction(XmlReader_text));
  10613. }
  10614. /*:98*//*99:*/
  10615. #line 2488 "./typica.w"
  10616. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  10617. {
  10618. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10619. QString retval=
  10620. self->attributes().value(argument<QString> (0,context)).toString();
  10621. return QScriptValue(retval);
  10622. }
  10623. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  10624. {
  10625. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10626. bool retval=
  10627. self->attributes().hasAttribute(argument<QString> (0,context));
  10628. return QScriptValue(retval);
  10629. }
  10630. /*:99*//*100:*/
  10631. #line 2508 "./typica.w"
  10632. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  10633. {
  10634. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10635. return QScriptValue(self->atEnd());
  10636. }
  10637. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  10638. {
  10639. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10640. return QScriptValue(self->isDTD());
  10641. }
  10642. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  10643. {
  10644. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10645. return QScriptValue(self->isStartElement());
  10646. }
  10647. /*:100*//*101:*/
  10648. #line 2529 "./typica.w"
  10649. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  10650. {
  10651. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10652. self->readNext();
  10653. return QScriptValue();
  10654. }
  10655. /*:101*//*102:*/
  10656. #line 2539 "./typica.w"
  10657. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  10658. {
  10659. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10660. return QScriptValue(self->name().toString());
  10661. }
  10662. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  10663. {
  10664. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10665. return QScriptValue(self->readElementText());
  10666. }
  10667. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  10668. {
  10669. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  10670. return QScriptValue(self->text().toString());
  10671. }
  10672. /*:102*//*105:*/
  10673. #line 2581 "./typica.w"
  10674. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  10675. {
  10676. setQObjectProperties(value,engine);
  10677. value.setProperty("value",engine->newFunction(QSettings_value));
  10678. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  10679. }
  10680. /*:105*//*106:*/
  10681. #line 2593 "./typica.w"
  10682. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  10683. {
  10684. QScriptValue object;
  10685. if(context->argumentCount()==1||context->argumentCount()==2)
  10686. {
  10687. QSettings settings;
  10688. QString key= argument<QString> (0,context);
  10689. QVariant value;
  10690. QVariant retval;
  10691. if(context->argumentCount()> 1)
  10692. {
  10693. value= argument<QVariant> (1,context);
  10694. retval= settings.value(key,value);
  10695. }
  10696. else
  10697. {
  10698. retval= settings.value(key);
  10699. }
  10700. object= engine->newVariant(retval);
  10701. }
  10702. else
  10703. {
  10704. context->throwError("Incorrect number of arguments passed to "
  10705. "QSettings::value(). This method takes one "
  10706. "string and one optional variant type.");
  10707. }
  10708. return object;
  10709. }
  10710. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  10711. {
  10712. if(context->argumentCount()==2)
  10713. {
  10714. QSettings settings;
  10715. QString key= argument<QString> (0,context);
  10716. QVariant value= argument<QVariant> (1,context);
  10717. settings.setValue(key,value);
  10718. }
  10719. else
  10720. {
  10721. context->throwError("Incorrect number of arguments passed to "
  10722. "QSettings::setValue(). This method takes one "
  10723. "string and one variant type for a total of two "
  10724. "arguments.");
  10725. }
  10726. return QScriptValue();
  10727. }
  10728. /*:106*//*109:*/
  10729. #line 2662 "./typica.w"
  10730. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  10731. {
  10732. QScriptValue object= engine->newQObject(new QLCDNumber());
  10733. setQLCDNumberProperties(object,engine);
  10734. return object;
  10735. }
  10736. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  10737. {
  10738. setQFrameProperties(value,engine);
  10739. }
  10740. /*:109*//*112:*/
  10741. #line 2720 "./typica.w"
  10742. QScriptValue constructQTime(QScriptContext*context,
  10743. QScriptEngine*engine)
  10744. {
  10745. QScriptValue object;
  10746. if(context->argumentCount()==0||
  10747. (context->argumentCount()>=2&&context->argumentCount()<=4))
  10748. {
  10749. int arg1= 0;
  10750. int arg2= 0;
  10751. int arg3= 0;
  10752. int arg4= 0;
  10753. switch(context->argumentCount())
  10754. {
  10755. case 4:
  10756. arg4= argument<int> (3,context);
  10757. case 3:
  10758. arg3= argument<int> (2,context);
  10759. case 2:
  10760. arg2= argument<int> (1,context);
  10761. arg1= argument<int> (0,context);
  10762. default:
  10763. break;
  10764. }
  10765. if(context->argumentCount())
  10766. {
  10767. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  10768. arg4));
  10769. }
  10770. else
  10771. {
  10772. object= engine->toScriptValue<QTime> (QTime());
  10773. }
  10774. setQTimeProperties(object,engine);
  10775. }
  10776. else
  10777. {
  10778. context->throwError("Incorrect number of arguments passed to "
  10779. "QTime::QTime(). This method takes zero, two, "
  10780. "three, or four integer arguments.");
  10781. }
  10782. return object;
  10783. }
  10784. /*:112*//*113:*/
  10785. #line 2768 "./typica.w"
  10786. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  10787. {
  10788. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  10789. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  10790. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  10791. value.setProperty("hour",engine->newFunction(QTime_hour));
  10792. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  10793. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  10794. value.setProperty("minute",engine->newFunction(QTime_minute));
  10795. value.setProperty("msec",engine->newFunction(QTime_msec));
  10796. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  10797. value.setProperty("restart",engine->newFunction(QTime_restart));
  10798. value.setProperty("second",engine->newFunction(QTime_second));
  10799. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  10800. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  10801. value.setProperty("start",engine->newFunction(QTime_start));
  10802. value.setProperty("toString",engine->newFunction(QTime_toString));
  10803. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  10804. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  10805. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  10806. }
  10807. /*:113*//*114:*/
  10808. #line 2797 "./typica.w"
  10809. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine)
  10810. {
  10811. QTime self= getself<QTime> (context);
  10812. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  10813. (self.second()*1000)+self.msec();
  10814. return QScriptValue(retval);
  10815. }
  10816. /*:114*//*115:*/
  10817. #line 2811 "./typica.w"
  10818. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  10819. {
  10820. QTime time;
  10821. QScriptValue retval;
  10822. if(context->argumentCount()==1)
  10823. {
  10824. QTime self= getself<QTime> (context);
  10825. time= self.addMSecs(argument<int> (0,context));
  10826. retval= engine->toScriptValue<QTime> (time);
  10827. setQTimeProperties(retval,engine);
  10828. }
  10829. else
  10830. {
  10831. context->throwError("Incorrect number of arguments passed to "
  10832. "QTime::addMSecs(). This method takes one "
  10833. "integer as an argument.");
  10834. }
  10835. return retval;
  10836. }
  10837. QScriptValue QTime_addSecs(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.addSecs(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::addSecs(). This method takes one "
  10852. "integer as an argument.");
  10853. }
  10854. return retval;
  10855. }
  10856. /*:115*//*116:*/
  10857. #line 2854 "./typica.w"
  10858. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  10859. {
  10860. QScriptValue retval;
  10861. if(context->argumentCount()==0)
  10862. {
  10863. QTime self= getself<QTime> (context);
  10864. retval= QScriptValue(engine,self.elapsed());
  10865. }
  10866. else
  10867. {
  10868. context->throwError("Incorrect number of arguments passed to "
  10869. "QTime::elapsed(). This method takes no "
  10870. "arguments.");
  10871. }
  10872. return retval;
  10873. }
  10874. /*:116*//*117:*/
  10875. #line 2875 "./typica.w"
  10876. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  10877. {
  10878. QScriptValue retval;
  10879. if(context->argumentCount()==0)
  10880. {
  10881. QTime self= getself<QTime> (context);
  10882. retval= QScriptValue(engine,self.hour());
  10883. }
  10884. else
  10885. {
  10886. context->throwError("Incorrect number of arguments passed to "
  10887. "QTime::hour(). This method takes no "
  10888. "arguments.");
  10889. }
  10890. return retval;
  10891. }
  10892. /*:117*//*118:*/
  10893. #line 2895 "./typica.w"
  10894. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  10895. {
  10896. QScriptValue retval;
  10897. if(context->argumentCount()==0)
  10898. {
  10899. QTime self= getself<QTime> (context);
  10900. retval= QScriptValue(engine,self.minute());
  10901. }
  10902. else
  10903. {
  10904. context->throwError("Incorrect number of arguments passed to "
  10905. "QTime::minute(). This method takes no "
  10906. "arguments.");
  10907. }
  10908. return retval;
  10909. }
  10910. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  10911. {
  10912. QScriptValue retval;
  10913. if(context->argumentCount()==0)
  10914. {
  10915. QTime self= getself<QTime> (context);
  10916. retval= QScriptValue(engine,self.second());
  10917. }
  10918. else
  10919. {
  10920. context->throwError("Incorrect number of arguments passed to "
  10921. "QTime::second(). This method takes no "
  10922. "arguments.");
  10923. }
  10924. return retval;
  10925. }
  10926. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  10927. {
  10928. QScriptValue retval;
  10929. if(context->argumentCount()==0)
  10930. {
  10931. QTime self= getself<QTime> (context);
  10932. retval= QScriptValue(engine,self.msec());
  10933. }
  10934. else
  10935. {
  10936. context->throwError("Incorrect number of arguments passed to "
  10937. "QTime::msec(). This method takes no "
  10938. "arguments.");
  10939. }
  10940. return retval;
  10941. }
  10942. /*:118*//*119:*/
  10943. #line 2951 "./typica.w"
  10944. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  10945. {
  10946. QScriptValue retval;
  10947. if(context->argumentCount()==0)
  10948. {
  10949. QTime self= getself<QTime> (context);
  10950. retval= QScriptValue(engine,self.isNull());
  10951. }
  10952. else
  10953. {
  10954. context->throwError("Incorrect number of arguments passed to "
  10955. "QTime::isNull(). This method takes no "
  10956. "arguments.");
  10957. }
  10958. return retval;
  10959. }
  10960. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  10961. {
  10962. QScriptValue retval;
  10963. if(context->argumentCount()==0)
  10964. {
  10965. QTime self= getself<QTime> (context);
  10966. retval= QScriptValue(engine,self.isValid());
  10967. }
  10968. else
  10969. {
  10970. context->throwError("Incorrect number of arguments passed to "
  10971. "QTime::isValid(). This method takes no "
  10972. "arguments.");
  10973. }
  10974. return retval;
  10975. }
  10976. /*:119*//*120:*/
  10977. #line 2989 "./typica.w"
  10978. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  10979. {
  10980. QScriptValue retval;
  10981. if(context->argumentCount()==1)
  10982. {
  10983. QTime self= getself<QTime> (context);
  10984. QTime arg= argument<QVariant> (0,context).toTime();
  10985. retval= QScriptValue(engine,self.msecsTo(arg));
  10986. }
  10987. else
  10988. {
  10989. context->throwError("Incorrect number of arguments passed to "
  10990. "QTime::msecsTo(). This method takes one QTime.");
  10991. }
  10992. return retval;
  10993. }
  10994. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  10995. {
  10996. QScriptValue retval;
  10997. if(context->argumentCount()==1)
  10998. {
  10999. QTime self= getself<QTime> (context);
  11000. QTime arg= argument<QVariant> (0,context).toTime();
  11001. retval= QScriptValue(engine,self.secsTo(arg));
  11002. }
  11003. else
  11004. {
  11005. context->throwError("Incorrect number of arguments passed to "
  11006. "QTime::secsTo(). This method takes one QTime.");
  11007. }
  11008. return retval;
  11009. }
  11010. /*:120*//*121:*/
  11011. #line 3028 "./typica.w"
  11012. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  11013. {
  11014. QScriptValue retval;
  11015. if(context->argumentCount()==0)
  11016. {
  11017. QTime self= getself<QTime> (context);
  11018. retval= QScriptValue(engine,self.restart());
  11019. }
  11020. else
  11021. {
  11022. context->throwError("Incorrect number of arguments passed to "
  11023. "QTime::restart(). This method takes no "
  11024. "arguments.");
  11025. }
  11026. return retval;
  11027. }
  11028. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  11029. {
  11030. if(context->argumentCount()==0)
  11031. {
  11032. QTime self= getself<QTime> (context);
  11033. self.start();
  11034. }
  11035. else
  11036. {
  11037. context->throwError("Incorrect number of arguments passed to "
  11038. "QTime::start(). This method takes no arguments.");
  11039. }
  11040. return QScriptValue();
  11041. }
  11042. /*:121*//*122:*/
  11043. #line 3064 "./typica.w"
  11044. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  11045. {
  11046. QScriptValue retval;
  11047. if(context->argumentCount()==3||context->argumentCount()==4)
  11048. {
  11049. QTime self= getself<QTime> (context);
  11050. int arg1= 0;
  11051. int arg2= 0;
  11052. int arg3= 0;
  11053. int arg4= 0;
  11054. switch(context->argumentCount())
  11055. {
  11056. case 4:
  11057. arg4= argument<int> (3,context);
  11058. case 3:
  11059. arg3= argument<int> (2,context);
  11060. arg2= argument<int> (1,context);
  11061. arg1= argument<int> (0,context);
  11062. default:
  11063. break;
  11064. }
  11065. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  11066. }
  11067. else
  11068. {
  11069. context->throwError("Incorrect number of arguments passed to "
  11070. "QTime::setHMS(). This method takes three or "
  11071. "four integer arguments.");
  11072. }
  11073. return retval;
  11074. }
  11075. /*:122*//*123:*/
  11076. #line 3100 "./typica.w"
  11077. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  11078. {
  11079. QScriptValue retval;
  11080. if(context->argumentCount()==1)
  11081. {
  11082. QTime self= getself<QTime> (context);
  11083. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  11084. }
  11085. else
  11086. {
  11087. context->throwError("Incorrect number of arguments passed to "
  11088. "QTime::toString(). This method takes one QString "
  11089. "as an argument.");
  11090. }
  11091. return retval;
  11092. }
  11093. /*:123*//*124:*/
  11094. #line 3121 "./typica.w"
  11095. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  11096. {
  11097. QScriptValue object;
  11098. object= engine->toScriptValue<QTime> (QTime::currentTime());
  11099. setQTimeProperties(object,engine);
  11100. return object;
  11101. }
  11102. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  11103. {
  11104. QScriptValue object;
  11105. if(context->argumentCount()==2)
  11106. {
  11107. QString time= argument<QString> (0,context);
  11108. QString format= argument<QString> (1,context);
  11109. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  11110. setQTimeProperties(object,engine);
  11111. }
  11112. else
  11113. {
  11114. context->throwError("Incorrect number of arguments passed to "
  11115. "QTime::fromString(). This method takes two "
  11116. "string arguments.");
  11117. }
  11118. return object;
  11119. }
  11120. /*:124*//*126:*/
  11121. #line 3161 "./typica.w"
  11122. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  11123. {
  11124. setQFrameProperties(value,engine);
  11125. }
  11126. /*:126*//*128:*/
  11127. #line 3175 "./typica.w"
  11128. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  11129. {
  11130. setQAbstractScrollAreaProperties(value,engine);
  11131. }
  11132. /*:128*//*130:*/
  11133. #line 3189 "./typica.w"
  11134. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  11135. {
  11136. setQAbstractScrollAreaProperties(value,engine);
  11137. }
  11138. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  11139. {
  11140. setQAbstractItemViewProperties(value,engine);
  11141. }
  11142. /*:130*//*133:*/
  11143. #line 3222 "./typica.w"
  11144. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  11145. {
  11146. QScriptValue object= engine->newQObject(new QPushButton());
  11147. setQPushButtonProperties(object,engine);
  11148. return object;
  11149. }
  11150. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  11151. {
  11152. setQAbstractButtonProperties(value,engine);
  11153. }
  11154. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  11155. {
  11156. setQWidgetProperties(value,engine);
  11157. }
  11158. /*:133*//*140:*/
  11159. #line 3334 "./typica.w"
  11160. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  11161. {
  11162. QScriptValue object=
  11163. engine->toScriptValue<void*> (new SqlQueryConnection());
  11164. setQSqlQueryProperties(object,engine);
  11165. return object;
  11166. }
  11167. /*:140*//*141:*/
  11168. #line 3346 "./typica.w"
  11169. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  11170. {
  11171. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  11172. value.setProperty("bindFileData",
  11173. engine->newFunction(QSqlQuery_bindFileData));
  11174. value.setProperty("bindDeviceData",
  11175. engine->newFunction(QSqlQuery_bindDeviceData));
  11176. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  11177. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  11178. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  11179. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  11180. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  11181. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  11182. }
  11183. /*:141*//*142:*/
  11184. #line 3364 "./typica.w"
  11185. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  11186. {
  11187. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11188. QScriptValue retval;
  11189. if(context->argumentCount()==1)
  11190. {
  11191. retval= QScriptValue(engine,
  11192. query->exec(argument<QString> (0,context)));
  11193. }
  11194. else
  11195. {
  11196. retval= QScriptValue(engine,query->exec());
  11197. }
  11198. if(query->lastError().isValid())
  11199. {
  11200. qDebug()<<query->lastQuery();
  11201. qDebug()<<query->lastError().text();
  11202. }
  11203. return retval;
  11204. }
  11205. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  11206. {
  11207. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11208. return QScriptValue(query->lastQuery());
  11209. }
  11210. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  11211. {
  11212. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11213. return QScriptValue(engine,query->next());
  11214. }
  11215. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  11216. {
  11217. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11218. return QScriptValue(engine,
  11219. query->value(argument<int> (0,context)).toString());
  11220. }
  11221. /*:142*//*143:*/
  11222. #line 3408 "./typica.w"
  11223. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  11224. {
  11225. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11226. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  11227. }
  11228. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  11229. {
  11230. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11231. query->bindValue(argument<QString> (0,context),
  11232. argument<QVariant> (1,context));
  11233. return QScriptValue();
  11234. }
  11235. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  11236. QScriptEngine*)
  11237. {
  11238. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11239. QString placeholder= argument<QString> (0,context);
  11240. QString filename= argument<QString> (1,context);
  11241. QFile file(filename);
  11242. QByteArray data;
  11243. if(file.open(QIODevice::ReadOnly))
  11244. {
  11245. data= file.readAll();
  11246. file.close();
  11247. }
  11248. query->bindValue(placeholder,data);
  11249. return QScriptValue();
  11250. }
  11251. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  11252. QScriptEngine*)
  11253. {
  11254. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11255. QString placeholder= argument<QString> (0,context);
  11256. QIODevice*device= argument<QIODevice*> (1,context);
  11257. device->reset();
  11258. QByteArray data;
  11259. data= device->readAll();
  11260. query->bindValue(placeholder,data);
  11261. return QScriptValue();
  11262. }
  11263. /*:143*//*144:*/
  11264. #line 3460 "./typica.w"
  11265. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  11266. {
  11267. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  11268. delete query;
  11269. return QScriptValue::UndefinedValue;
  11270. }
  11271. /*:144*//*147:*/
  11272. #line 3501 "./typica.w"
  11273. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  11274. {
  11275. QFileInfo info(argument<QString> (0,context));
  11276. QScriptValue retval(engine,info.baseName());
  11277. return retval;
  11278. }
  11279. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  11280. {
  11281. QFileInfo info(argument<QString> (0,context));
  11282. QDir dir= info.dir();
  11283. QScriptValue retval(engine,dir.path());
  11284. return retval;
  11285. }
  11286. /*:147*//*148:*/
  11287. #line 3520 "./typica.w"
  11288. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  11289. {
  11290. QString source= argument<QString> (0,context);
  11291. source.remove(0,1);
  11292. source.chop(1);
  11293. QStringList elements= source.split(",");
  11294. QString element;
  11295. QScriptValue dest= engine->newArray(elements.size());
  11296. int i= 0;
  11297. foreach(element,elements)
  11298. {
  11299. if(element.startsWith("\"")&&element.endsWith("\""))
  11300. {
  11301. element.chop(1);
  11302. element= element.remove(0,1);
  11303. }
  11304. dest.setProperty(i,QScriptValue(engine,element));
  11305. i++;
  11306. }
  11307. return dest;
  11308. }
  11309. /*:148*//*149:*/
  11310. #line 3546 "./typica.w"
  11311. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  11312. {
  11313. QString font= argument<QString> (0,context);
  11314. QString classname;
  11315. if(context->argumentCount()> 1)
  11316. {
  11317. classname= argument<QString> (1,context);
  11318. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  11319. }
  11320. else
  11321. {
  11322. QApplication::setFont(QFont(font));
  11323. }
  11324. return QScriptValue();
  11325. }
  11326. /*:149*//*150:*/
  11327. #line 3566 "./typica.w"
  11328. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  11329. {
  11330. SqlQueryConnection query;
  11331. QString q= "SELECT file FROM files WHERE id = :file";
  11332. query.prepare(q);
  11333. query.bindValue(":file",argument<int> (0,context));
  11334. query.exec();
  11335. query.next();
  11336. QByteArray array= query.value(0).toByteArray();
  11337. QBuffer buffer(&array);
  11338. buffer.open(QIODevice::ReadOnly);
  11339. QXmlQuery xquery;
  11340. xquery.bindVariable("profile",&buffer);
  11341. QString xq;
  11342. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  11343. xquery.setQuery(xq);
  11344. QString result;
  11345. xquery.evaluateTo(&result);
  11346. return QScriptValue(result);
  11347. }
  11348. /*:150*//*151:*/
  11349. #line 3592 "./typica.w"
  11350. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  11351. {
  11352. QWidget::setTabOrder(argument<QWidget*> (0,context),
  11353. argument<QWidget*> (1,context));
  11354. return QScriptValue();
  11355. }
  11356. /*:151*//*158:*/
  11357. #line 3831 "./typica.w"
  11358. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  11359. {
  11360. QString targetID= argument<QString> (0,context);
  11361. QDomNode element;
  11362. QScriptValue object;
  11363. /*159:*/
  11364. #line 3852 "./typica.w"
  11365. QDomNodeList windows=
  11366. AppInstance->configuration()->documentElement().elementsByTagName("window");
  11367. QDomNode nullNode;
  11368. int i= 0;
  11369. element= nullNode;
  11370. while(i<windows.count())
  11371. {
  11372. element= windows.at(i);
  11373. QDomNamedNodeMap attributes= element.attributes();
  11374. if(attributes.contains("id"))
  11375. {
  11376. if(attributes.namedItem("id").toAttr().value()==targetID)
  11377. {
  11378. break;
  11379. }
  11380. }
  11381. element= nullNode;
  11382. i++;
  11383. }
  11384. /*:159*/
  11385. #line 3837 "./typica.w"
  11386. if(!element.isNull())
  11387. {
  11388. /*160:*/
  11389. #line 3884 "./typica.w"
  11390. ScriptQMainWindow*window= new ScriptQMainWindow;
  11391. window->setObjectName(targetID);
  11392. object= engine->newQObject(window);
  11393. setQMainWindowProperties(object,engine);
  11394. QWidget*central= new(QWidget);
  11395. central->setParent(window);
  11396. central->setObjectName("centralWidget");
  11397. window->setCentralWidget(central);
  11398. if(element.hasChildNodes())
  11399. {
  11400. /*161:*/
  11401. #line 3925 "./typica.w"
  11402. QStack<QWidget*> widgetStack;
  11403. QStack<QLayout*> layoutStack;
  11404. QString windowScript;
  11405. widgetStack.push(central);
  11406. QDomNodeList windowChildren= element.childNodes();
  11407. int i= 0;
  11408. while(i<windowChildren.count())
  11409. {
  11410. QDomNode current;
  11411. QDomElement element;
  11412. current= windowChildren.at(i);
  11413. if(current.isElement())
  11414. {
  11415. element= current.toElement();
  11416. if(element.tagName()=="program")
  11417. {
  11418. windowScript.append(element.text());
  11419. }
  11420. else if(element.tagName()=="layout")
  11421. {
  11422. addLayoutToWidget(element,&widgetStack,&layoutStack);
  11423. }
  11424. else if(element.tagName()=="menu")
  11425. {
  11426. /*162:*/
  11427. #line 3972 "./typica.w"
  11428. QMenuBar*bar= window->menuBar();
  11429. bar->setParent(window);
  11430. bar->setObjectName("menuBar");
  11431. if(element.hasAttribute("name"))
  11432. {
  11433. QMenu*menu= bar->addMenu(element.attribute("name"));
  11434. menu->setParent(bar);
  11435. if(element.hasAttribute("type"))
  11436. {
  11437. if(element.attribute("type")=="reports")
  11438. {
  11439. if(element.hasAttribute("src"))
  11440. {
  11441. /*535:*/
  11442. #line 12733 "./typica.w"
  11443. QSettings settings;
  11444. QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
  11445. arg(element.attribute("src")));
  11446. directory.setFilter(QDir::Files);
  11447. directory.setSorting(QDir::Name);
  11448. QStringList nameFilter;
  11449. nameFilter<<"*.xml";
  11450. directory.setNameFilters(nameFilter);
  11451. QFileInfoList reportFiles= directory.entryInfoList();
  11452. for(int i= 0;i<reportFiles.size();i++)
  11453. {
  11454. QFileInfo reportFile= reportFiles.at(i);
  11455. /*539:*/
  11456. #line 12810 "./typica.w"
  11457. QString path= reportFile.absoluteFilePath();
  11458. QFile file(path);
  11459. if(file.open(QIODevice::ReadOnly))
  11460. {
  11461. QDomDocument document;
  11462. document.setContent(&file,true);
  11463. QDomElement root= document.documentElement();
  11464. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  11465. if(!titleNode.isNull())
  11466. {
  11467. QDomElement titleElement= titleNode.toElement();
  11468. QString title= titleElement.text();
  11469. if(!title.isEmpty())
  11470. {
  11471. QStringList hierarchy= title.split(":->");
  11472. QMenu*insertionPoint= menu;
  11473. /*540:*/
  11474. #line 12837 "./typica.w"
  11475. for(int j= 0;j<hierarchy.size()-1;j++)
  11476. {
  11477. QObjectList menuList= insertionPoint->children();
  11478. bool menuFound= false;
  11479. for(int k= 0;k<menuList.size();k++)
  11480. {
  11481. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  11482. if(currentItem)
  11483. {
  11484. if(currentItem->title()==hierarchy.at(j))
  11485. {
  11486. menuFound= true;
  11487. insertionPoint= currentItem;
  11488. break;
  11489. }
  11490. }
  11491. }
  11492. if(!menuFound)
  11493. {
  11494. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  11495. }
  11496. }
  11497. /*:540*/
  11498. #line 12827 "./typica.w"
  11499. ReportAction*action= new ReportAction(path,hierarchy.last());
  11500. insertionPoint->addAction(action);
  11501. }
  11502. }
  11503. }
  11504. /*:539*/
  11505. #line 12746 "./typica.w"
  11506. }
  11507. /*:535*/
  11508. #line 3986 "./typica.w"
  11509. }
  11510. }
  11511. }
  11512. if(element.hasChildNodes())
  11513. {
  11514. /*163:*/
  11515. #line 3999 "./typica.w"
  11516. QDomNodeList menuItems= element.childNodes();
  11517. int j= 0;
  11518. while(j<menuItems.count())
  11519. {
  11520. QDomNode item= menuItems.at(j);
  11521. if(item.isElement())
  11522. {
  11523. QDomElement itemElement= item.toElement();
  11524. if(itemElement.tagName()=="item")
  11525. {
  11526. QAction*itemAction= new QAction(itemElement.text(),menu);
  11527. if(itemElement.hasAttribute("id"))
  11528. {
  11529. itemAction->setObjectName(itemElement.attribute("id"));
  11530. }
  11531. if(itemElement.hasAttribute("shortcut"))
  11532. {
  11533. itemAction->setShortcut(itemElement.attribute("shortcut"));
  11534. }
  11535. menu->addAction(itemAction);
  11536. }
  11537. else if(itemElement.tagName()=="separator")
  11538. {
  11539. menu->addSeparator();
  11540. }
  11541. }
  11542. j++;
  11543. }
  11544. /*:163*/
  11545. #line 3992 "./typica.w"
  11546. }
  11547. }
  11548. /*:162*/
  11549. #line 3950 "./typica.w"
  11550. }
  11551. }
  11552. i++;
  11553. }
  11554. QScriptValue oldThis= context->thisObject();
  11555. context->setThisObject(object);
  11556. QScriptValue result= engine->evaluate(windowScript);
  11557. /*155:*/
  11558. #line 3733 "./typica.w"
  11559. if(engine->hasUncaughtException())
  11560. {
  11561. int line= engine->uncaughtExceptionLineNumber();
  11562. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  11563. result.toString();
  11564. QString trace;
  11565. foreach(trace,engine->uncaughtExceptionBacktrace())
  11566. {
  11567. qDebug()<<trace;
  11568. }
  11569. }
  11570. /*:155*/
  11571. #line 3958 "./typica.w"
  11572. context->setThisObject(oldThis);
  11573. /*:161*/
  11574. #line 3895 "./typica.w"
  11575. }
  11576. if(window)
  11577. {
  11578. window->show();
  11579. }
  11580. else
  11581. {
  11582. qDebug()<<"Error! Window invalidated";
  11583. }
  11584. /*:160*/
  11585. #line 3840 "./typica.w"
  11586. }
  11587. return object;
  11588. }
  11589. /*:158*//*164:*/
  11590. #line 4039 "./typica.w"
  11591. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  11592. QStack<QLayout*> *layoutStack)
  11593. {
  11594. if(element.hasAttribute("type"))
  11595. {
  11596. /*165:*/
  11597. #line 4060 "./typica.w"
  11598. QLayout*layout;
  11599. QString layoutType= element.attribute("type");
  11600. if(layoutType=="horizontal")
  11601. {
  11602. layout= new QHBoxLayout;
  11603. layoutStack->push(layout);
  11604. populateBoxLayout(element,widgetStack,layoutStack);
  11605. }
  11606. else if(layoutType=="vertical")
  11607. {
  11608. layout= new QVBoxLayout;
  11609. layoutStack->push(layout);
  11610. populateBoxLayout(element,widgetStack,layoutStack);
  11611. }
  11612. else if(layoutType=="grid")
  11613. {
  11614. layout= new QGridLayout;
  11615. layoutStack->push(layout);
  11616. populateGridLayout(element,widgetStack,layoutStack);
  11617. }
  11618. else if(layoutType=="stack")
  11619. {
  11620. layout= new QStackedLayout;
  11621. layoutStack->push(layout);
  11622. populateStackedLayout(element,widgetStack,layoutStack);
  11623. }
  11624. if(element.hasAttribute("id"))
  11625. {
  11626. layout->setObjectName(element.attribute("id"));
  11627. }
  11628. /*:165*/
  11629. #line 4045 "./typica.w"
  11630. QWidget*widget= widgetStack->top();
  11631. if(layout)
  11632. {
  11633. widget->setLayout(layout);
  11634. }
  11635. layoutStack->pop();
  11636. }
  11637. }
  11638. /*:164*//*166:*/
  11639. #line 4098 "./typica.w"
  11640. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11641. QStack<QLayout*> *layoutStack)
  11642. {
  11643. QDomNodeList children= element.childNodes();
  11644. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  11645. for(int i= 0;i<children.count();i++)
  11646. {
  11647. QDomNode current;
  11648. QDomElement currentElement;
  11649. current= children.at(i);
  11650. if(current.isElement())
  11651. {
  11652. currentElement= current.toElement();
  11653. if(currentElement.tagName()=="page")
  11654. {
  11655. QWidget*widget= new QWidget;
  11656. layout->addWidget(widget);
  11657. widgetStack->push(widget);
  11658. populateWidget(currentElement,widgetStack,layoutStack);
  11659. widgetStack->pop();
  11660. }
  11661. }
  11662. }
  11663. }
  11664. /*:166*//*167:*/
  11665. #line 4130 "./typica.w"
  11666. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11667. QStack<QLayout*> *layoutStack)
  11668. {
  11669. QDomNodeList children= element.childNodes();
  11670. int row= -1;
  11671. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  11672. for(int i= 0;i<children.count();i++)
  11673. {
  11674. QDomNode current;
  11675. QDomElement currentElement;
  11676. current= children.at(i);
  11677. if(current.isElement())
  11678. {
  11679. currentElement= current.toElement();
  11680. if(currentElement.tagName()=="row")
  11681. {
  11682. row++;
  11683. if(currentElement.hasAttribute("height"))
  11684. {
  11685. layout->setRowMinimumHeight(row,
  11686. currentElement.attribute("height").toInt());
  11687. }
  11688. if(currentElement.hasAttribute("stretch"))
  11689. {
  11690. layout->setRowStretch(row,
  11691. currentElement.attribute("stretch").toInt());
  11692. }
  11693. /*168:*/
  11694. #line 4186 "./typica.w"
  11695. int column= -1;
  11696. QDomNodeList rowChildren= currentElement.childNodes();
  11697. for(int j= 0;j<rowChildren.count();j++)
  11698. {
  11699. QDomNode columnNode;
  11700. QDomElement columnElement;
  11701. columnNode= rowChildren.at(j);
  11702. if(columnNode.isElement())
  11703. {
  11704. columnElement= columnNode.toElement();
  11705. if(columnElement.tagName()=="column")
  11706. {
  11707. column++;
  11708. if(columnElement.hasAttribute("column"))
  11709. {
  11710. column= columnElement.attribute("column").toInt();
  11711. }
  11712. if(columnElement.hasAttribute("width"))
  11713. {
  11714. layout->setColumnMinimumWidth(column,
  11715. columnElement.attribute("width").toInt());
  11716. }
  11717. if(columnElement.hasAttribute("stretch"))
  11718. {
  11719. layout->setColumnStretch(column,
  11720. columnElement.attribute("stretch").toInt());
  11721. }
  11722. int hspan= 1;
  11723. int vspan= 1;
  11724. if(columnElement.hasAttribute("rowspan"))
  11725. {
  11726. vspan= columnElement.attribute("rowspan").toInt();
  11727. }
  11728. if(columnElement.hasAttribute("colspan"))
  11729. {
  11730. hspan= columnElement.attribute("colspan").toInt();
  11731. }
  11732. QHBoxLayout*cell= new QHBoxLayout;
  11733. layout->addLayout(cell,row,column,vspan,hspan);
  11734. layoutStack->push(cell);
  11735. populateBoxLayout(columnElement,widgetStack,layoutStack);
  11736. layoutStack->pop();
  11737. }
  11738. }
  11739. }
  11740. /*:168*/
  11741. #line 4158 "./typica.w"
  11742. }
  11743. }
  11744. }
  11745. }
  11746. /*:167*//*169:*/
  11747. #line 4236 "./typica.w"
  11748. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11749. QStack<QLayout*> *layoutStack)
  11750. {
  11751. QDomNodeList children= element.childNodes();
  11752. for(int i= 0;i<children.count();i++)
  11753. {
  11754. QDomNode current;
  11755. QDomElement currentElement;
  11756. current= children.at(i);
  11757. if(current.isElement())
  11758. {
  11759. currentElement= current.toElement();
  11760. if(currentElement.tagName()=="button")
  11761. {
  11762. addButtonToLayout(currentElement,widgetStack,layoutStack);
  11763. }
  11764. else if(currentElement.tagName()=="calendar")
  11765. {
  11766. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  11767. }
  11768. else if(currentElement.tagName()=="decoration")
  11769. {
  11770. addDecorationToLayout(currentElement,widgetStack,
  11771. layoutStack);
  11772. }
  11773. else if(currentElement.tagName()=="layout")
  11774. {
  11775. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  11776. }
  11777. else if(currentElement.tagName()=="splitter")
  11778. {
  11779. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  11780. }
  11781. else if(currentElement.tagName()=="label")
  11782. {
  11783. QBoxLayout*layout=
  11784. qobject_cast<QBoxLayout*> (layoutStack->top());
  11785. QLabel*label= new QLabel(currentElement.text());
  11786. layout->addWidget(label);
  11787. }
  11788. else if(currentElement.tagName()=="lcdtemperature")
  11789. {
  11790. addTemperatureDisplayToLayout(currentElement,widgetStack,
  11791. layoutStack);
  11792. }
  11793. else if(currentElement.tagName()=="lcdtimer")
  11794. {
  11795. addTimerDisplayToLayout(currentElement,widgetStack,
  11796. layoutStack);
  11797. }
  11798. else if(currentElement.tagName()=="line")
  11799. {
  11800. addLineToLayout(currentElement,widgetStack,layoutStack);
  11801. }
  11802. else if(currentElement.tagName()=="report")
  11803. {
  11804. addReportToLayout(currentElement,widgetStack,layoutStack);
  11805. }
  11806. else if(currentElement.tagName()=="sqldrop")
  11807. {
  11808. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  11809. }
  11810. else if(currentElement.tagName()=="sqltablearray")
  11811. {
  11812. addSaltToLayout(currentElement,widgetStack,layoutStack);
  11813. }
  11814. else if(currentElement.tagName()=="sqlview")
  11815. {
  11816. addSqlQueryViewToLayout(currentElement,widgetStack,
  11817. layoutStack);
  11818. }
  11819. else if(currentElement.tagName()=="textarea")
  11820. {
  11821. addTextToLayout(currentElement,widgetStack,layoutStack);
  11822. }
  11823. else if(currentElement.tagName()=="spinbox")
  11824. {
  11825. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  11826. }
  11827. else if(currentElement.tagName()=="formarray")
  11828. {
  11829. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  11830. }
  11831. else if(currentElement.tagName()=="hscale")
  11832. {
  11833. addScaleControlToLayout(currentElement,widgetStack,
  11834. layoutStack);
  11835. }
  11836. else if(currentElement.tagName()=="vscale")
  11837. {
  11838. addIntensityControlToLayout(currentElement,widgetStack,
  11839. layoutStack);
  11840. }
  11841. else if(currentElement.tagName()=="webview")
  11842. {
  11843. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  11844. }
  11845. else if(currentElement.tagName()=="stretch")
  11846. {
  11847. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11848. layout->addStretch();
  11849. }
  11850. }
  11851. }
  11852. }
  11853. /*:169*//*170:*/
  11854. #line 4346 "./typica.w"
  11855. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11856. QStack<QLayout*> *layoutStack)
  11857. {
  11858. QLayout*targetLayout= layoutStack->pop();
  11859. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  11860. if(element.hasAttribute("type"))
  11861. {
  11862. /*165:*/
  11863. #line 4060 "./typica.w"
  11864. QLayout*layout;
  11865. QString layoutType= element.attribute("type");
  11866. if(layoutType=="horizontal")
  11867. {
  11868. layout= new QHBoxLayout;
  11869. layoutStack->push(layout);
  11870. populateBoxLayout(element,widgetStack,layoutStack);
  11871. }
  11872. else if(layoutType=="vertical")
  11873. {
  11874. layout= new QVBoxLayout;
  11875. layoutStack->push(layout);
  11876. populateBoxLayout(element,widgetStack,layoutStack);
  11877. }
  11878. else if(layoutType=="grid")
  11879. {
  11880. layout= new QGridLayout;
  11881. layoutStack->push(layout);
  11882. populateGridLayout(element,widgetStack,layoutStack);
  11883. }
  11884. else if(layoutType=="stack")
  11885. {
  11886. layout= new QStackedLayout;
  11887. layoutStack->push(layout);
  11888. populateStackedLayout(element,widgetStack,layoutStack);
  11889. }
  11890. if(element.hasAttribute("id"))
  11891. {
  11892. layout->setObjectName(element.attribute("id"));
  11893. }
  11894. /*:165*/
  11895. #line 4354 "./typica.w"
  11896. boxLayout->addLayout(layout);
  11897. layoutStack->pop();
  11898. }
  11899. layoutStack->push(targetLayout);
  11900. }
  11901. /*:170*//*171:*/
  11902. #line 4365 "./typica.w"
  11903. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  11904. QStack<QLayout*> *layoutStack)
  11905. {
  11906. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  11907. QSplitter*splitter= new(QSplitter);
  11908. layout->addWidget(splitter);
  11909. /*172:*/
  11910. #line 4378 "./typica.w"
  11911. QString orientation= element.attribute("type");
  11912. if(orientation=="horizontal")
  11913. {
  11914. splitter->setOrientation(Qt::Horizontal);
  11915. }
  11916. else if(orientation=="vertical")
  11917. {
  11918. splitter->setOrientation(Qt::Vertical);
  11919. }
  11920. QString id= element.attribute("id");
  11921. if(!id.isEmpty())
  11922. {
  11923. splitter->setObjectName(id);
  11924. }
  11925. if(element.hasChildNodes())
  11926. {
  11927. widgetStack->push(splitter);
  11928. populateSplitter(element,widgetStack,layoutStack);
  11929. widgetStack->pop();
  11930. }
  11931. /*:172*/
  11932. #line 4372 "./typica.w"
  11933. }
  11934. /*:171*//*173:*/
  11935. #line 4404 "./typica.w"
  11936. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  11937. QStack<QLayout*> *layoutStack)
  11938. {
  11939. QDomNodeList children= element.childNodes();
  11940. for(int i= 0;i<children.count();i++)
  11941. {
  11942. QDomNode current;
  11943. QDomElement currentElement;
  11944. current= children.at(i);
  11945. if(current.isElement())
  11946. {
  11947. currentElement= current.toElement();
  11948. if(currentElement.tagName()=="decoration")
  11949. {
  11950. addDecorationToSplitter(currentElement,widgetStack,
  11951. layoutStack);
  11952. }
  11953. else if(currentElement.tagName()=="graph")
  11954. {
  11955. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  11956. }
  11957. else if(currentElement.tagName()=="splitter")
  11958. {
  11959. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  11960. }
  11961. else if(currentElement.tagName()=="lcdtemperature")
  11962. {
  11963. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  11964. layoutStack);
  11965. }
  11966. else if(currentElement.tagName()=="lcdtimer")
  11967. {
  11968. addTimerDisplayToSplitter(currentElement,widgetStack,
  11969. layoutStack);
  11970. }
  11971. else if(currentElement.tagName()=="measurementtable")
  11972. {
  11973. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  11974. }
  11975. else if(currentElement.tagName()=="widget")
  11976. {
  11977. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  11978. }
  11979. }
  11980. }
  11981. }
  11982. /*:173*//*174:*/
  11983. #line 4454 "./typica.w"
  11984. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  11985. QStack<QLayout*> *layoutStack)
  11986. {
  11987. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  11988. QSplitter*splitter= new(QSplitter);
  11989. splitter->setParent(parent);
  11990. parent->addWidget(splitter);
  11991. /*172:*/
  11992. #line 4378 "./typica.w"
  11993. QString orientation= element.attribute("type");
  11994. if(orientation=="horizontal")
  11995. {
  11996. splitter->setOrientation(Qt::Horizontal);
  11997. }
  11998. else if(orientation=="vertical")
  11999. {
  12000. splitter->setOrientation(Qt::Vertical);
  12001. }
  12002. QString id= element.attribute("id");
  12003. if(!id.isEmpty())
  12004. {
  12005. splitter->setObjectName(id);
  12006. }
  12007. if(element.hasChildNodes())
  12008. {
  12009. widgetStack->push(splitter);
  12010. populateSplitter(element,widgetStack,layoutStack);
  12011. widgetStack->pop();
  12012. }
  12013. /*:172*/
  12014. #line 4462 "./typica.w"
  12015. }
  12016. /*:174*//*175:*/
  12017. #line 4471 "./typica.w"
  12018. void addTemperatureDisplayToSplitter(QDomElement element,
  12019. QStack<QWidget*> *widgetStack,
  12020. QStack<QLayout*> *)
  12021. {
  12022. TemperatureDisplay*display= new(TemperatureDisplay);
  12023. if(element.hasAttribute("id"))
  12024. {
  12025. display->setObjectName(element.attribute("id"));
  12026. }
  12027. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12028. splitter->addWidget(display);
  12029. }
  12030. void addTemperatureDisplayToLayout(QDomElement element,
  12031. QStack<QWidget*> *,
  12032. QStack<QLayout*> *layoutStack)
  12033. {
  12034. TemperatureDisplay*display= new(TemperatureDisplay);
  12035. if(element.hasAttribute("id"))
  12036. {
  12037. display->setObjectName(element.attribute("id"));
  12038. }
  12039. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12040. layout->addWidget(display);
  12041. }
  12042. /*:175*//*176:*/
  12043. #line 4502 "./typica.w"
  12044. void addTimerDisplayToSplitter(QDomElement element,
  12045. QStack<QWidget*> *widgetStack,
  12046. QStack<QLayout*> *)
  12047. {
  12048. TimerDisplay*display= new(TimerDisplay);
  12049. if(element.hasAttribute("id"))
  12050. {
  12051. display->setObjectName(element.attribute("id"));
  12052. }
  12053. if(element.hasAttribute("format"))
  12054. {
  12055. display->setDisplayFormat(element.attribute("format"));
  12056. }
  12057. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12058. splitter->addWidget(display);
  12059. }
  12060. void addTimerDisplayToLayout(QDomElement element,
  12061. QStack<QWidget*> *,
  12062. QStack<QLayout*> *layoutStack)
  12063. {
  12064. TimerDisplay*display= new(TimerDisplay);
  12065. if(element.hasAttribute("id"))
  12066. {
  12067. display->setObjectName(element.attribute("id"));
  12068. }
  12069. if(element.hasAttribute("format"))
  12070. {
  12071. display->setDisplayFormat(element.attribute("format"));
  12072. }
  12073. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12074. layout->addWidget(display);
  12075. }
  12076. /*:176*//*177:*/
  12077. #line 4540 "./typica.w"
  12078. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  12079. QStack<QLayout*> *layoutStack)
  12080. {
  12081. /*178:*/
  12082. #line 4561 "./typica.w"
  12083. QString labelText= element.attribute("name");
  12084. Qt::Orientations orientation= Qt::Horizontal;
  12085. if(element.hasAttribute("type"))
  12086. {
  12087. if(element.attribute("type")=="horizontal")
  12088. {
  12089. orientation= Qt::Horizontal;
  12090. }
  12091. else if(element.attribute("type")=="vertical")
  12092. {
  12093. orientation= Qt::Vertical;
  12094. }
  12095. }
  12096. /*179:*/
  12097. #line 4586 "./typica.w"
  12098. QWidget*theWidget= NULL;
  12099. QDomNodeList children= element.childNodes();
  12100. for(int i= 0;i<children.count();i++)
  12101. {
  12102. QDomNode item= children.at(i);
  12103. if(item.isElement())
  12104. {
  12105. QDomElement itemElement= item.toElement();
  12106. if(itemElement.tagName()=="lcdtemperature")
  12107. {
  12108. TemperatureDisplay*display= new TemperatureDisplay;
  12109. if(itemElement.hasAttribute("id"))
  12110. {
  12111. display->setObjectName(itemElement.attribute("id"));
  12112. }
  12113. theWidget= display;
  12114. }
  12115. else if(itemElement.tagName()=="lcdtimer")
  12116. {
  12117. TimerDisplay*display= new TimerDisplay;
  12118. if(itemElement.hasAttribute("id"))
  12119. {
  12120. display->setObjectName(itemElement.attribute("id"));
  12121. }
  12122. if(itemElement.hasAttribute("format"))
  12123. {
  12124. display->setDisplayFormat(itemElement.attribute("format"));
  12125. }
  12126. theWidget= display;
  12127. }
  12128. }
  12129. }
  12130. /*:179*/
  12131. #line 4575 "./typica.w"
  12132. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12133. orientation);
  12134. if(element.hasAttribute("id"))
  12135. {
  12136. decoration->setObjectName(element.attribute("id"));
  12137. }
  12138. /*:178*/
  12139. #line 4544 "./typica.w"
  12140. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12141. layout->addWidget(decoration);
  12142. }
  12143. void addDecorationToSplitter(QDomElement element,
  12144. QStack<QWidget*> *widgetStack,
  12145. QStack<QLayout*> *)
  12146. {
  12147. /*178:*/
  12148. #line 4561 "./typica.w"
  12149. QString labelText= element.attribute("name");
  12150. Qt::Orientations orientation= Qt::Horizontal;
  12151. if(element.hasAttribute("type"))
  12152. {
  12153. if(element.attribute("type")=="horizontal")
  12154. {
  12155. orientation= Qt::Horizontal;
  12156. }
  12157. else if(element.attribute("type")=="vertical")
  12158. {
  12159. orientation= Qt::Vertical;
  12160. }
  12161. }
  12162. /*179:*/
  12163. #line 4586 "./typica.w"
  12164. QWidget*theWidget= NULL;
  12165. QDomNodeList children= element.childNodes();
  12166. for(int i= 0;i<children.count();i++)
  12167. {
  12168. QDomNode item= children.at(i);
  12169. if(item.isElement())
  12170. {
  12171. QDomElement itemElement= item.toElement();
  12172. if(itemElement.tagName()=="lcdtemperature")
  12173. {
  12174. TemperatureDisplay*display= new TemperatureDisplay;
  12175. if(itemElement.hasAttribute("id"))
  12176. {
  12177. display->setObjectName(itemElement.attribute("id"));
  12178. }
  12179. theWidget= display;
  12180. }
  12181. else if(itemElement.tagName()=="lcdtimer")
  12182. {
  12183. TimerDisplay*display= new TimerDisplay;
  12184. if(itemElement.hasAttribute("id"))
  12185. {
  12186. display->setObjectName(itemElement.attribute("id"));
  12187. }
  12188. if(itemElement.hasAttribute("format"))
  12189. {
  12190. display->setDisplayFormat(itemElement.attribute("format"));
  12191. }
  12192. theWidget= display;
  12193. }
  12194. }
  12195. }
  12196. /*:179*/
  12197. #line 4575 "./typica.w"
  12198. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  12199. orientation);
  12200. if(element.hasAttribute("id"))
  12201. {
  12202. decoration->setObjectName(element.attribute("id"));
  12203. }
  12204. /*:178*/
  12205. #line 4553 "./typica.w"
  12206. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12207. splitter->addWidget(decoration);
  12208. }
  12209. /*:177*//*180:*/
  12210. #line 4625 "./typica.w"
  12211. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12212. QStack<QLayout*> *layoutStack)
  12213. {
  12214. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12215. QWidget*widget= new QWidget;
  12216. if(element.hasAttribute("id"))
  12217. {
  12218. widget->setObjectName(element.attribute("id"));
  12219. }
  12220. splitter->addWidget(widget);
  12221. if(element.hasChildNodes())
  12222. {
  12223. widgetStack->push(widget);
  12224. populateWidget(element,widgetStack,layoutStack);
  12225. widgetStack->pop();
  12226. }
  12227. }
  12228. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  12229. QStack<QLayout*> *layoutStack)
  12230. {
  12231. QDomNodeList children= element.childNodes();
  12232. for(int i= 0;i<children.count();i++)
  12233. {
  12234. QDomNode current;
  12235. QDomElement currentElement;
  12236. current= children.at(i);
  12237. if(current.isElement())
  12238. {
  12239. currentElement= current.toElement();
  12240. if(currentElement.tagName()=="layout")
  12241. {
  12242. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  12243. }
  12244. }
  12245. }
  12246. }
  12247. /*:180*//*181:*/
  12248. #line 4668 "./typica.w"
  12249. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  12250. QStack<QLayout*> *layoutStack)
  12251. {
  12252. QAbstractButton*button= NULL;
  12253. QString text= element.attribute("name");
  12254. if(element.hasAttribute("type"))
  12255. {
  12256. QString type= element.attribute("type");
  12257. if(type=="annotation")
  12258. {
  12259. AnnotationButton*abutton= new AnnotationButton(text);
  12260. if(element.hasAttribute("annotation"))
  12261. {
  12262. abutton->setAnnotation(element.attribute("annotation"));
  12263. }
  12264. if(element.hasAttribute("series"))
  12265. {
  12266. abutton->setTemperatureColumn(element.attribute("series").
  12267. toInt());
  12268. }
  12269. if(element.hasAttribute("column"))
  12270. {
  12271. abutton->setAnnotationColumn(element.attribute("column").
  12272. toInt());
  12273. }
  12274. button= abutton;
  12275. }
  12276. else if(type=="check")
  12277. {
  12278. button= new QCheckBox(text);
  12279. }
  12280. else if(type=="push")
  12281. {
  12282. button= new QPushButton(text);
  12283. }
  12284. }
  12285. if(element.hasAttribute("id"))
  12286. {
  12287. button->setObjectName(element.attribute("id"));
  12288. }
  12289. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12290. layout->addWidget(button);
  12291. }
  12292. /*:181*//*182:*/
  12293. #line 4720 "./typica.w"
  12294. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  12295. QStack<QLayout*> *layoutStack)
  12296. {
  12297. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  12298. if(element.hasAttribute("pretext"))
  12299. {
  12300. box->setPretext(element.attribute("pretext"));
  12301. }
  12302. if(element.hasAttribute("posttext"))
  12303. {
  12304. box->setPosttext(element.attribute("posttext"));
  12305. }
  12306. if(element.hasAttribute("series"))
  12307. {
  12308. box->setTemperatureColumn(element.attribute("series").toInt());
  12309. }
  12310. if(element.hasAttribute("column"))
  12311. {
  12312. box->setAnnotationColumn(element.attribute("column").toInt());
  12313. }
  12314. if(element.hasAttribute("min"))
  12315. {
  12316. box->setMinimum(element.attribute("min").toDouble());
  12317. }
  12318. if(element.hasAttribute("max"))
  12319. {
  12320. box->setMaximum(element.attribute("max").toDouble());
  12321. }
  12322. if(element.hasAttribute("decimals"))
  12323. {
  12324. box->setDecimals(element.attribute("decimals").toInt());
  12325. }
  12326. if(element.hasAttribute("step"))
  12327. {
  12328. box->setSingleStep(element.attribute("step").toDouble());
  12329. }
  12330. if(element.hasAttribute("id"))
  12331. {
  12332. box->setObjectName(element.attribute("id"));
  12333. }
  12334. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12335. layout->addWidget(box);
  12336. }
  12337. /*:182*//*183:*/
  12338. #line 4776 "./typica.w"
  12339. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12340. QStack<QLayout*> *)
  12341. {
  12342. ZoomLog*widget= new ZoomLog;
  12343. if(!widget)
  12344. {
  12345. qDebug()<<"Error constructing widget!";
  12346. }
  12347. if(element.hasAttribute("id"))
  12348. {
  12349. widget->setObjectName(element.attribute("id"));
  12350. }
  12351. if(element.hasChildNodes())
  12352. {
  12353. QDomNodeList children= element.childNodes();
  12354. int column= 0;
  12355. for(int i= 0;i<children.count();i++)
  12356. {
  12357. QDomNode current;
  12358. QDomElement currentElement;
  12359. current= children.at(i);
  12360. if(current.isElement())
  12361. {
  12362. currentElement= current.toElement();
  12363. if(currentElement.tagName()=="column")
  12364. {
  12365. QString text= currentElement.text();
  12366. widget->setHeaderData(column,text);
  12367. column++;
  12368. }
  12369. }
  12370. }
  12371. }
  12372. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12373. if(splitter)
  12374. {
  12375. splitter->addWidget(widget);
  12376. }
  12377. else
  12378. {
  12379. qDebug()<<"Splitter not found at top of widget stack!";
  12380. }
  12381. }
  12382. /*:183*//*184:*/
  12383. #line 4824 "./typica.w"
  12384. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  12385. QStack<QLayout*> *)
  12386. {
  12387. GraphView*view= new GraphView;
  12388. if(element.hasAttribute("id"))
  12389. {
  12390. view->setObjectName(element.attribute("id"));
  12391. }
  12392. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  12393. splitter->addWidget(view);
  12394. }
  12395. /*:184*//*185:*/
  12396. #line 4841 "./typica.w"
  12397. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  12398. QStack<QLayout*> *layoutStack)
  12399. {
  12400. SqlComboBox*box= new SqlComboBox();
  12401. if(element.hasAttribute("data"))
  12402. {
  12403. box->setDataColumn(element.attribute("data").toInt());
  12404. }
  12405. if(element.hasAttribute("display"))
  12406. {
  12407. box->setDisplayColumn(element.attribute("display").toInt());
  12408. }
  12409. if(element.hasAttribute("showdata"))
  12410. {
  12411. if(element.attribute("showdata")=="true")
  12412. {
  12413. box->showData(true);
  12414. }
  12415. }
  12416. if(element.hasAttribute("editable"))
  12417. {
  12418. if(element.attribute("editable")=="true")
  12419. {
  12420. box->setEditable(true);
  12421. }
  12422. }
  12423. if(element.hasChildNodes())
  12424. {
  12425. QDomNodeList children= element.childNodes();
  12426. for(int i= 0;i<children.count();i++)
  12427. {
  12428. QDomNode current;
  12429. QDomElement currentElement;
  12430. current= children.at(i);
  12431. if(current.isElement())
  12432. {
  12433. currentElement= current.toElement();
  12434. if(currentElement.tagName()=="null")
  12435. {
  12436. box->addNullOption();
  12437. }
  12438. else if(currentElement.tagName()=="query")
  12439. {
  12440. box->addSqlOptions(currentElement.text());
  12441. }
  12442. }
  12443. }
  12444. }
  12445. if(element.hasAttribute("id"))
  12446. {
  12447. box->setObjectName(element.attribute("id"));
  12448. }
  12449. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12450. layout->addWidget(box);
  12451. }
  12452. /*:185*//*186:*/
  12453. #line 4920 "./typica.w"
  12454. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  12455. QStack<QLayout*> *layoutStack)
  12456. {
  12457. QTableView*view= new QTableView;
  12458. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  12459. SaltModel*model= new SaltModel(element.childNodes().count());
  12460. if(element.hasAttribute("id"))
  12461. {
  12462. view->setObjectName(element.attribute("id"));
  12463. }
  12464. if(element.hasChildNodes())
  12465. {
  12466. QDomNodeList children= element.childNodes();
  12467. int currentColumn= 0;
  12468. for(int i= 0;i<children.count();i++)
  12469. {
  12470. QDomNode current;
  12471. QDomElement currentElement;
  12472. current= children.at(i);
  12473. if(current.isElement())
  12474. {
  12475. currentElement= current.toElement();
  12476. if(currentElement.tagName()=="column")
  12477. {
  12478. if(currentElement.hasAttribute("name"))
  12479. {
  12480. model->setHeaderData(currentColumn,Qt::Horizontal,
  12481. currentElement.attribute("name"));
  12482. }
  12483. if(currentElement.hasAttribute("delegate"))
  12484. {
  12485. /*187:*/
  12486. #line 4968 "./typica.w"
  12487. if(currentElement.attribute("delegate")=="sql")
  12488. {
  12489. /*188:*/
  12490. #line 4984 "./typica.w"
  12491. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  12492. SqlComboBox*widget= new SqlComboBox();
  12493. if(currentElement.hasAttribute("null"))
  12494. {
  12495. if(currentElement.attribute("null")=="true")
  12496. {
  12497. widget->addNullOption();
  12498. }
  12499. }
  12500. if(currentElement.hasAttribute("showdata"))
  12501. {
  12502. if(currentElement.attribute("showdata")=="true")
  12503. {
  12504. widget->showData(true);
  12505. }
  12506. }
  12507. if(currentElement.hasAttribute("data"))
  12508. {
  12509. widget->setDataColumn(currentElement.attribute("data").toInt());
  12510. }
  12511. if(currentElement.hasAttribute("display"))
  12512. {
  12513. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  12514. }
  12515. widget->addSqlOptions(currentElement.text());
  12516. delegate->setWidget(widget);
  12517. view->setItemDelegateForColumn(currentColumn,delegate);
  12518. /*:188*/
  12519. #line 4971 "./typica.w"
  12520. }
  12521. else if(currentElement.attribute("delegate")=="numeric")
  12522. {
  12523. /*189:*/
  12524. #line 5017 "./typica.w"
  12525. NumericDelegate*delegate= new NumericDelegate;
  12526. view->setItemDelegateForColumn(currentColumn,delegate);
  12527. /*:189*/
  12528. #line 4975 "./typica.w"
  12529. }
  12530. /*:187*/
  12531. #line 4952 "./typica.w"
  12532. }
  12533. currentColumn++;
  12534. }
  12535. }
  12536. }
  12537. }
  12538. view->setModel(model);
  12539. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12540. layout->addWidget(view);
  12541. }
  12542. /*:186*//*196:*/
  12543. #line 5127 "./typica.w"
  12544. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  12545. QStack<QLayout*> *layoutStack)
  12546. {
  12547. QLineEdit*widget= new QLineEdit(element.text());
  12548. if(element.hasAttribute("id"))
  12549. {
  12550. widget->setObjectName(element.attribute("id"));
  12551. }
  12552. if(element.hasAttribute("writable"))
  12553. {
  12554. if(element.attribute("writable")=="false")
  12555. {
  12556. widget->setReadOnly(true);
  12557. }
  12558. }
  12559. if(element.hasAttribute("validator"))
  12560. {
  12561. if(element.attribute("validator")=="numeric")
  12562. {
  12563. widget->setValidator(new QDoubleValidator(NULL));
  12564. }
  12565. else if(element.attribute("validator")=="integer")
  12566. {
  12567. widget->setValidator(new QIntValidator(NULL));
  12568. }
  12569. else if(element.attribute("validator")=="expression"&&
  12570. element.hasAttribute("expression"))
  12571. {
  12572. widget->setValidator(new QRegExpValidator(
  12573. QRegExp(element.attribute("expression")),
  12574. NULL));
  12575. }
  12576. }
  12577. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12578. layout->addWidget(widget);
  12579. }
  12580. /*:196*//*197:*/
  12581. #line 5168 "./typica.w"
  12582. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  12583. QStack<QLayout*> *layoutStack)
  12584. {
  12585. QTextEdit*widget= new QTextEdit;
  12586. if(element.hasAttribute("id"))
  12587. {
  12588. widget->setObjectName(element.attribute("id"));
  12589. }
  12590. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12591. layout->addWidget(widget);
  12592. }
  12593. /*:197*//*198:*/
  12594. #line 5185 "./typica.w"
  12595. void addSqlQueryViewToLayout(QDomElement element,
  12596. QStack<QWidget*> *,
  12597. QStack<QLayout*> *layoutStack)
  12598. {
  12599. SqlQueryView*view= new SqlQueryView;
  12600. if(element.hasAttribute("id"))
  12601. {
  12602. view->setObjectName(element.attribute("id"));
  12603. }
  12604. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12605. layout->addWidget(view);
  12606. }
  12607. /*:198*//*199:*/
  12608. #line 5202 "./typica.w"
  12609. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  12610. QStack<QLayout*> *layoutStack)
  12611. {
  12612. QDateEdit*widget= new QDateEdit;
  12613. widget->setCalendarPopup(true);
  12614. if(element.hasAttribute("id"))
  12615. {
  12616. widget->setObjectName(element.attribute("id"));
  12617. }
  12618. widget->setDate(QDate::currentDate());
  12619. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  12620. layout->addWidget(widget);
  12621. }
  12622. /*:199*//*200:*/
  12623. #line 5220 "./typica.w"
  12624. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  12625. {
  12626. setQDateTimeEditProperties(value,engine);
  12627. }
  12628. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  12629. {
  12630. setQAbstractSpinBoxProperties(value,engine);
  12631. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  12632. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  12633. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  12634. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  12635. }
  12636. /*:200*//*201:*/
  12637. #line 5240 "./typica.w"
  12638. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  12639. {
  12640. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12641. if(context->argumentCount()==3)
  12642. {
  12643. self->setDate(QDate(argument<int> (0,context),
  12644. argument<int> (1,context),
  12645. argument<int> (2,context)));
  12646. }
  12647. else
  12648. {
  12649. context->throwError("Incorrect number of arguments passed to "
  12650. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  12651. "specifying the year, month, and day.");
  12652. }
  12653. return QScriptValue();
  12654. }
  12655. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  12656. {
  12657. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12658. return QScriptValue(self->date().day());
  12659. }
  12660. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  12661. {
  12662. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12663. return QScriptValue(self->date().month());
  12664. }
  12665. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  12666. {
  12667. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  12668. return QScriptValue(self->date().year());
  12669. }
  12670. /*:201*//*205:*/
  12671. #line 5307 "./typica.w"
  12672. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  12673. {
  12674. QObject*parent= argument<QObject*> (0,context);
  12675. QString name= argument<QString> (1,context);
  12676. QObject*object= parent->findChild<QObject*> (name);
  12677. QScriptValue value;
  12678. if(object)
  12679. {
  12680. value= engine->newQObject(object);
  12681. QString className= object->metaObject()->className();
  12682. /*206:*/
  12683. #line 5325 "./typica.w"
  12684. if(className=="TemperatureDisplay")
  12685. {
  12686. setTemperatureDisplayProperties(value,engine);
  12687. }
  12688. else if(className=="TimerDisplay")
  12689. {
  12690. setTimerDisplayProperties(value,engine);
  12691. }
  12692. else if(className=="QAction")
  12693. {
  12694. setQActionProperties(value,engine);
  12695. }
  12696. else if(className=="QBoxLayout")
  12697. {
  12698. setQBoxLayoutProperties(value,engine);
  12699. }
  12700. else if(className=="QDateEdit")
  12701. {
  12702. setQDateEditProperties(value,engine);
  12703. }
  12704. else if(className=="QFrame")
  12705. {
  12706. setQFrameProperties(value,engine);
  12707. }
  12708. else if(className=="QHBoxLayout")
  12709. {
  12710. setQBoxLayoutProperties(value,engine);
  12711. }
  12712. else if(className=="QLCDNumber")
  12713. {
  12714. setQLCDNumberProperties(value,engine);
  12715. }
  12716. else if(className=="QMenu")
  12717. {
  12718. setQMenuProperties(value,engine);
  12719. }
  12720. else if(className=="QMenuBar")
  12721. {
  12722. setQMenuBarProperties(value,engine);
  12723. }
  12724. else if(className=="QPushButton")
  12725. {
  12726. setQPushButtonProperties(value,engine);
  12727. }
  12728. else if(className=="QSplitter")
  12729. {
  12730. setQSplitterProperties(value,engine);
  12731. }
  12732. else if(className=="QTableView")
  12733. {
  12734. if(object->property("tabletype").isValid())
  12735. {
  12736. if(object->property("tabletype").toString()=="SaltTable")
  12737. {
  12738. setSaltTableProperties(value,engine);
  12739. }
  12740. }
  12741. }
  12742. else if(className=="QVBoxLayout")
  12743. {
  12744. setQBoxLayoutProperties(value,engine);
  12745. }
  12746. else if(className=="QWidget")
  12747. {
  12748. setQWidgetProperties(value,engine);
  12749. }
  12750. else if(className=="ScriptQMainWindow")
  12751. {
  12752. setQMainWindowProperties(value,engine);
  12753. }
  12754. else if(className=="SqlComboBox")
  12755. {
  12756. setSqlComboBoxProperties(value,engine);
  12757. }
  12758. else if(className=="SqlQueryView")
  12759. {
  12760. setSqlQueryViewProperties(value,engine);
  12761. }
  12762. else if(className=="ZoomLog")
  12763. {
  12764. setZoomLogProperties(value,engine);
  12765. }
  12766. else if(className=="QTextEdit")
  12767. {
  12768. setQTextEditProperties(value,engine);
  12769. }
  12770. else if(className=="QWebView")
  12771. {
  12772. setQWebViewProperties(value,engine);
  12773. }
  12774. /*:206*/
  12775. #line 5318 "./typica.w"
  12776. }
  12777. return value;
  12778. }
  12779. /*:205*//*208:*/
  12780. #line 5443 "./typica.w"
  12781. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  12782. {
  12783. QTableView*self= getself<QTableView*> (context);
  12784. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12785. QString datum;
  12786. double total= 0.0;
  12787. int column= argument<int> (0,context);
  12788. int role= argument<int> (1,context);
  12789. for(int i= 0;i<model->rowCount();i++)
  12790. {
  12791. datum= model->data(model->index(i,column),role).toString();
  12792. if(!datum.isEmpty())
  12793. {
  12794. total+= datum.toDouble();
  12795. }
  12796. }
  12797. return QScriptValue(engine,total);
  12798. }
  12799. /*:208*//*209:*/
  12800. #line 5467 "./typica.w"
  12801. QScriptValue SaltTable_columnArray(QScriptContext*context,
  12802. QScriptEngine*engine)
  12803. {
  12804. QTableView*self= getself<QTableView*> (context);
  12805. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12806. int column= argument<int> (0,context);
  12807. int role= argument<int> (1,context);
  12808. QString literal= model->arrayLiteral(column,role);
  12809. return QScriptValue(engine,literal);
  12810. }
  12811. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  12812. QScriptEngine*engine)
  12813. {
  12814. QTableView*self= getself<QTableView*> (context);
  12815. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12816. int column= argument<int> (0,context);
  12817. int role= argument<int> (1,context);
  12818. QString literal= model->quotedArrayLiteral(column,role);
  12819. return QScriptValue(engine,literal);
  12820. }
  12821. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  12822. QScriptEngine*engine)
  12823. {
  12824. QTableView*self= getself<QTableView*> (context);
  12825. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12826. int column= argument<int> (0,context);
  12827. int role= argument<int> (1,context);
  12828. QString literal= model->arrayLiteral(column,role);
  12829. literal.chop(1);
  12830. literal= literal.remove(0,1);
  12831. return QScriptValue(engine,literal);
  12832. }
  12833. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  12834. QScriptEngine*engine)
  12835. {
  12836. QTableView*self= getself<QTableView*> (context);
  12837. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12838. int column= argument<int> (0,context);
  12839. int role= argument<int> (1,context);
  12840. QString literal= model->quotedArrayLiteral(column,role);
  12841. literal.chop(1);
  12842. literal= literal.remove(0,1);
  12843. return QScriptValue(engine,literal);
  12844. }
  12845. /*:209*//*210:*/
  12846. #line 5519 "./typica.w"
  12847. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  12848. {
  12849. QTableView*self= getself<QTableView*> (context);
  12850. QScriptValue value= engine->newQObject(self->model());
  12851. return value;
  12852. }
  12853. /*:210*//*211:*/
  12854. #line 5533 "./typica.w"
  12855. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  12856. {
  12857. QTableView*self= getself<QTableView*> (context);
  12858. int row= argument<int> (0,context);
  12859. int column= argument<int> (1,context);
  12860. QVariant value= argument<QVariant> (2,context);
  12861. int role= argument<int> (3,context);
  12862. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12863. QModelIndex cell= model->index(row,column);
  12864. model->setData(cell,value,role);
  12865. self->update(cell);
  12866. return QScriptValue();
  12867. }
  12868. /*:211*//*212:*/
  12869. #line 5551 "./typica.w"
  12870. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  12871. {
  12872. QTableView*self= getself<QTableView*> (context);
  12873. int row= argument<int> (0,context);
  12874. int column= argument<int> (1,context);
  12875. int role= argument<int> (2,context);
  12876. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  12877. QModelIndex cell= model->index(row,column);
  12878. QVariant value= model->data(cell,role);
  12879. QScriptValue retval= engine->newVariant(value);
  12880. retval.setProperty("value",QScriptValue(value.toString()));
  12881. return retval;
  12882. }
  12883. /*:212*//*213:*/
  12884. #line 5569 "./typica.w"
  12885. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  12886. {
  12887. setQWidgetProperties(value,engine);
  12888. value.setProperty("columnArray",
  12889. engine->newFunction(SaltTable_columnArray));
  12890. value.setProperty("quotedColumnArray",
  12891. engine->newFunction(SaltTable_quotedColumnArray));
  12892. value.setProperty("bindableColumnArray",
  12893. engine->newFunction(SaltTable_bindableColumnArray));
  12894. value.setProperty("bindableQuotedColumnArray",
  12895. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  12896. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  12897. value.setProperty("data",engine->newFunction(SaltTable_data));
  12898. value.setProperty("model",engine->newFunction(SaltTable_model));
  12899. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  12900. }
  12901. /*:213*//*215:*/
  12902. #line 5602 "./typica.w"
  12903. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12904. {
  12905. setQComboBoxProperties(value,engine);
  12906. }
  12907. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  12908. {
  12909. setQWidgetProperties(value,engine);
  12910. value.setProperty("currentData",
  12911. engine->newFunction(QComboBox_currentData));
  12912. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  12913. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  12914. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  12915. }
  12916. QScriptValue QComboBox_currentData(QScriptContext*context,
  12917. QScriptEngine*engine)
  12918. {
  12919. QComboBox*self= getself<QComboBox*> (context);
  12920. return QScriptValue(engine,
  12921. self->itemData(self->currentIndex()).toString());
  12922. }
  12923. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  12924. {
  12925. QComboBox*self= getself<QComboBox*> (context);
  12926. self->addItem(argument<QString> (0,context));
  12927. return QScriptValue();
  12928. }
  12929. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  12930. {
  12931. QComboBox*self= getself<QComboBox*> (context);
  12932. self->setModel(argument<QAbstractItemModel*> (0,context));
  12933. return QScriptValue();
  12934. }
  12935. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  12936. {
  12937. QComboBox*self= getself<QComboBox*> (context);
  12938. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  12939. }
  12940. /*:215*//*244:*/
  12941. #line 6484 "./typica.w"
  12942. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  12943. {
  12944. QScriptValue object;
  12945. if(context->argumentCount()==1)
  12946. {
  12947. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  12948. QScriptEngine::ScriptOwnership);
  12949. setDAQProperties(object,engine);
  12950. }
  12951. else if(context->argumentCount()==2)
  12952. {
  12953. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  12954. argument<QString> (1,context)),
  12955. QScriptEngine::ScriptOwnership);
  12956. setDAQProperties(object,engine);
  12957. }
  12958. else
  12959. {
  12960. context->throwError("Incorrect number of arguments passed to DAQ"
  12961. "constructor. The DAQ constructor takes one"
  12962. "string as an argument specifying a device name."
  12963. "Example: Dev1");
  12964. }
  12965. return object;
  12966. }
  12967. /*:244*//*245:*/
  12968. #line 6514 "./typica.w"
  12969. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  12970. {
  12971. setQObjectProperties(value,engine);
  12972. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  12973. }
  12974. /*:245*//*246:*/
  12975. #line 6524 "./typica.w"
  12976. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  12977. {
  12978. DAQ*self= getself<DAQ*> (context);
  12979. QScriptValue object;
  12980. if(self)
  12981. {
  12982. object=
  12983. engine->newQObject(self->newChannel(argument<int> (0,context),
  12984. argument<int> (1,context)));
  12985. setChannelProperties(object,engine);
  12986. }
  12987. return object;
  12988. }
  12989. /*:246*//*253:*/
  12990. #line 6680 "./typica.w"
  12991. QScriptValue constructFakeDAQ(QScriptContext*context,
  12992. QScriptEngine*engine)
  12993. {
  12994. QScriptValue object;
  12995. if(context->argumentCount()==1)
  12996. {
  12997. object=
  12998. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  12999. QScriptEngine::ScriptOwnership);
  13000. setFakeDAQProperties(object,engine);
  13001. }
  13002. else
  13003. {
  13004. context->throwError("Incorrect number of arguments passed to DAQ"
  13005. "constructor. The DAQ constructor takes one"
  13006. "string as an argument specifying a device name."
  13007. "Example: Dev1");
  13008. }
  13009. return object;
  13010. }
  13011. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  13012. {
  13013. setQObjectProperties(value,engine);
  13014. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  13015. }
  13016. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  13017. {
  13018. FakeDAQ*self= getself<FakeDAQ*> (context);
  13019. QScriptValue object;
  13020. if(self)
  13021. {
  13022. object=
  13023. engine->newQObject(self->newChannel(argument<int> (0,context),
  13024. argument<int> (1,context)));
  13025. setChannelProperties(object,engine);
  13026. }
  13027. return object;
  13028. }
  13029. /*:253*//*257:*/
  13030. #line 6771 "./typica.w"
  13031. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  13032. {
  13033. setQObjectProperties(value,engine);
  13034. }
  13035. /*:257*//*264:*/
  13036. #line 6957 "./typica.w"
  13037. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  13038. {
  13039. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  13040. setLinearCalibratorProperties(object,engine);
  13041. return object;
  13042. }
  13043. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  13044. {
  13045. setQObjectProperties(value,engine);
  13046. }
  13047. /*:264*//*269:*/
  13048. #line 7094 "./typica.w"
  13049. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  13050. {
  13051. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  13052. setLinearSplineInterpolatorProperties(object,engine);
  13053. return object;
  13054. }
  13055. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  13056. {
  13057. setQObjectProperties(value,engine);
  13058. }
  13059. /*:269*//*278:*/
  13060. #line 7278 "./typica.w"
  13061. QScriptValue constructTemperatureDisplay(QScriptContext*,
  13062. QScriptEngine*engine)
  13063. {
  13064. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  13065. setTemperatureDisplayProperties(object,engine);
  13066. return object;
  13067. }
  13068. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13069. {
  13070. setQLCDNumberProperties(value,engine);
  13071. }
  13072. /*:278*//*285:*/
  13073. #line 7419 "./typica.w"
  13074. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  13075. QScriptEngine*engine)
  13076. {
  13077. QScriptValue object=
  13078. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  13079. setMeasurementTimeOffsetProperties(object,engine);
  13080. return object;
  13081. }
  13082. void setMeasurementTimeOffsetProperties(QScriptValue value,
  13083. QScriptEngine*engine)
  13084. {
  13085. setQObjectProperties(value,engine);
  13086. }
  13087. /*:285*//*290:*/
  13088. #line 7528 "./typica.w"
  13089. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  13090. {
  13091. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  13092. return object;
  13093. }
  13094. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  13095. {
  13096. setQObjectProperties(value,engine);
  13097. }
  13098. /*:290*//*295:*/
  13099. #line 7624 "./typica.w"
  13100. QScriptValue constructZeroEmitter(QScriptContext*context,
  13101. QScriptEngine*engine)
  13102. {
  13103. QScriptValue object=
  13104. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  13105. setZeroEmitterProperties(object,engine);
  13106. return object;
  13107. }
  13108. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  13109. {
  13110. setQObjectProperties(value,engine);
  13111. }
  13112. /*:295*//*300:*/
  13113. #line 7704 "./typica.w"
  13114. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  13115. QScriptEngine*engine)
  13116. {
  13117. QScriptValue object=
  13118. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  13119. setMeasurementAdapterProperties(object,engine);
  13120. return object;
  13121. }
  13122. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  13123. {
  13124. setQObjectProperties(value,engine);
  13125. }
  13126. /*:300*//*315:*/
  13127. #line 8052 "./typica.w"
  13128. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  13129. {
  13130. QScriptValue object= engine->newQObject(new GraphView);
  13131. setGraphViewProperties(object,engine);
  13132. return object;
  13133. }
  13134. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  13135. {
  13136. setQGraphicsViewProperties(value,engine);
  13137. }
  13138. /*:315*//*337:*/
  13139. #line 8624 "./typica.w"
  13140. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  13141. {
  13142. QScriptValue object= engine->newQObject(new ZoomLog);
  13143. setZoomLogProperties(object,engine);
  13144. return object;
  13145. }
  13146. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  13147. {
  13148. setQTableViewProperties(value,engine);
  13149. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  13150. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  13151. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  13152. value.setProperty("restoreState",
  13153. engine->newFunction(ZoomLog_restoreState));
  13154. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  13155. value.setProperty("saveTemporary",
  13156. engine->newFunction(ZoomLog_saveTemporary));
  13157. }
  13158. /*:337*//*338:*/
  13159. #line 8650 "./typica.w"
  13160. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  13161. {
  13162. ZoomLog*self= getself<ZoomLog*> (context);
  13163. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  13164. return QScriptValue(engine,retval);
  13165. }
  13166. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  13167. {
  13168. ZoomLog*self= getself<ZoomLog*> (context);
  13169. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  13170. return QScriptValue(engine,retval);
  13171. }
  13172. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  13173. QScriptEngine*engine)
  13174. {
  13175. ZoomLog*self= getself<ZoomLog*> (context);
  13176. QString filename= QDir::tempPath();
  13177. filename.append("/");
  13178. filename.append(QUuid::createUuid().toString());
  13179. filename.append(".xml");
  13180. QFile*file= new QFile(filename);
  13181. self->saveXML(file);
  13182. file->close();
  13183. delete file;
  13184. return QScriptValue(engine,filename);
  13185. }
  13186. /*:338*//*339:*/
  13187. #line 8698 "./typica.w"
  13188. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  13189. {
  13190. ZoomLog*self= getself<ZoomLog*> (context);
  13191. QString key= argument<QString> (0,context);
  13192. int columns= argument<int> (1,context);
  13193. QSettings settings;
  13194. for(int i= 0;i<columns;i++)
  13195. {
  13196. if(self->columnWidth(i))
  13197. {
  13198. settings.beginGroup(key);
  13199. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  13200. settings.endGroup();
  13201. }
  13202. }
  13203. return QScriptValue();
  13204. }
  13205. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  13206. {
  13207. ZoomLog*self= getself<ZoomLog*> (context);
  13208. QString key= argument<QString> (0,context);
  13209. int columns= argument<int> (1,context);
  13210. QSettings settings;
  13211. for(int i= 0;i<columns;i++)
  13212. {
  13213. settings.beginGroup(key);
  13214. self->setColumnWidth(i,
  13215. settings.value(QString("%1").arg(i),80).toInt());
  13216. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  13217. {
  13218. self->setColumnWidth(i,80);
  13219. }
  13220. settings.endGroup();
  13221. }
  13222. return QScriptValue();
  13223. }
  13224. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  13225. {
  13226. ZoomLog*self= getself<ZoomLog*> (context);
  13227. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  13228. }
  13229. /*:339*//*374:*/
  13230. #line 9542 "./typica.w"
  13231. QScriptValue constructAnnotationButton(QScriptContext*context,
  13232. QScriptEngine*engine)
  13233. {
  13234. QScriptValue object=
  13235. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  13236. setAnnotationButtonProperties(object,engine);
  13237. return object;
  13238. }
  13239. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  13240. {
  13241. setQPushButtonProperties(value,engine);
  13242. }
  13243. /*:374*//*382:*/
  13244. #line 9685 "./typica.w"
  13245. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  13246. QScriptEngine*engine)
  13247. {
  13248. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  13249. argument<QString> (0,context),argument<QString> (1,context)));
  13250. setAnnotationSpinBoxProperties(object,engine);
  13251. return object;
  13252. }
  13253. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13254. {
  13255. setQDoubleSpinBoxProperties(value,engine);
  13256. }
  13257. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13258. {
  13259. setQAbstractSpinBoxProperties(value,engine);
  13260. }
  13261. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  13262. {
  13263. setQWidgetProperties(value,engine);
  13264. }
  13265. /*:382*//*403:*/
  13266. #line 10104 "./typica.w"
  13267. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  13268. {
  13269. QScriptValue object= engine->newQObject(new TimerDisplay);
  13270. setTimerDisplayProperties(object,engine);
  13271. return object;
  13272. }
  13273. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  13274. {
  13275. setQLCDNumberProperties(value,engine);
  13276. }
  13277. /*:403*//*430:*/
  13278. #line 10599 "./typica.w"
  13279. QScriptValue constructWidgetDecorator(QScriptContext*context,
  13280. QScriptEngine*engine)
  13281. {
  13282. QWidget*widget= argument<QWidget*> (0,context);
  13283. QString text= argument<QString> (1,context);
  13284. Qt::Orientations orientation;
  13285. switch(argument<int> (2,context))
  13286. {
  13287. case 2:
  13288. orientation= Qt::Vertical;
  13289. break;
  13290. default:
  13291. orientation= Qt::Horizontal;
  13292. break;
  13293. }
  13294. QScriptValue object=
  13295. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  13296. setWidgetDecoratorProperties(object,engine);
  13297. return object;
  13298. }
  13299. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  13300. {
  13301. setQWidgetProperties(value,engine);
  13302. }
  13303. /*:430*//*443:*/
  13304. #line 10880 "./typica.w"
  13305. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  13306. {
  13307. QScriptValue object= engine->newQObject(new LogEditWindow);
  13308. return object;
  13309. }
  13310. /*:443*//*462:*/
  13311. #line 11354 "./typica.w"
  13312. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  13313. {
  13314. QIODevice*device= argument<QIODevice*> (0,context);
  13315. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  13316. argument<int> (1,context)));
  13317. object.setProperty("input",engine->newFunction(XMLInput_input));
  13318. return object;
  13319. }
  13320. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  13321. {
  13322. XMLInput*self= getself<XMLInput*> (context);
  13323. self->input();
  13324. return QScriptValue();
  13325. }
  13326. /*:462*//*469:*/
  13327. #line 11522 "./typica.w"
  13328. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  13329. {
  13330. QScriptValue object= engine->newQObject(new QWebView());
  13331. setQWebViewProperties(object,engine);
  13332. return object;
  13333. }
  13334. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  13335. {
  13336. setQWidgetProperties(value,engine);
  13337. value.setProperty("load",engine->newFunction(WebView_load));
  13338. value.setProperty("print",engine->newFunction(WebView_print));
  13339. value.setProperty("setHtml",engine->newFunction(WebView_setHtml));
  13340. value.setProperty("setContent",engine->newFunction(WebView_setContent));
  13341. value.setProperty("saveXml",engine->newFunction(WebView_saveXml));
  13342. }
  13343. /*:469*//*470:*/
  13344. #line 11543 "./typica.w"
  13345. QScriptValue WebView_load(QScriptContext*context,QScriptEngine*)
  13346. {
  13347. QWebView*self= getself<QWebView*> (context);
  13348. QString file= argument<QString> (0,context);
  13349. self->load(QUrl(file));
  13350. return QScriptValue();
  13351. }
  13352. /*:470*//*471:*/
  13353. #line 11556 "./typica.w"
  13354. QScriptValue WebView_print(QScriptContext*context,QScriptEngine*)
  13355. {
  13356. QWebView*self= getself<QWebView*> (context);
  13357. QPrinter*printer= new QPrinter(QPrinter::HighResolution);
  13358. QPrintDialog printDialog(printer,NULL);
  13359. if(printDialog.exec()==QDialog::Accepted)
  13360. {
  13361. self->print(printer);
  13362. }
  13363. return QScriptValue();
  13364. }
  13365. /*:471*//*472:*/
  13366. #line 11572 "./typica.w"
  13367. QScriptValue WebView_setHtml(QScriptContext*context,QScriptEngine*)
  13368. {
  13369. QWebView*self= getself<QWebView*> (context);
  13370. QString content= argument<QString> (0,context);
  13371. self->setHtml(content);
  13372. return QScriptValue();
  13373. }
  13374. /*:472*//*473:*/
  13375. #line 11585 "./typica.w"
  13376. QScriptValue WebView_setContent(QScriptContext*context,QScriptEngine*)
  13377. {
  13378. QWebView*self= getself<QWebView*> (context);
  13379. QIODevice*device= argument<QIODevice*> (0,context);
  13380. device->reset();
  13381. QByteArray content= device->readAll();
  13382. self->setContent(content,"application/xhtml+xml");
  13383. return QScriptValue();
  13384. }
  13385. /*:473*//*474:*/
  13386. #line 11599 "./typica.w"
  13387. QScriptValue WebView_saveXml(QScriptContext*context,QScriptEngine*)
  13388. {
  13389. QWebView*self= getself<QWebView*> (context);
  13390. return QScriptValue(self->page()->currentFrame()->documentElement().toOuterXml());
  13391. }
  13392. /*:474*//*475:*/
  13393. #line 11609 "./typica.w"
  13394. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  13395. QStack<QLayout*> *layoutStack)
  13396. {
  13397. QWebView*view= new QWebView;
  13398. if(element.hasAttribute("id"))
  13399. {
  13400. view->setObjectName(element.attribute("id"));
  13401. }
  13402. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13403. layout->addWidget(view);
  13404. }
  13405. /*:475*//*533:*/
  13406. #line 12659 "./typica.w"
  13407. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  13408. {
  13409. QScriptValue object= engine->newQObject(new SqlQueryView);
  13410. setSqlQueryViewProperties(object,engine);
  13411. return object;
  13412. }
  13413. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  13414. {
  13415. setQTableViewProperties(value,engine);
  13416. value.setProperty("setHeaderData",
  13417. engine->newFunction(SqlQueryView_setHeaderData));
  13418. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  13419. }
  13420. /*:533*//*534:*/
  13421. #line 12677 "./typica.w"
  13422. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  13423. {
  13424. SqlQueryView*self= getself<SqlQueryView*> (context);
  13425. QString query= argument<QString> (0,context);
  13426. self->setQuery(query);
  13427. self->reset();
  13428. return QScriptValue();
  13429. }
  13430. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  13431. QScriptEngine*)
  13432. {
  13433. SqlQueryView*self= getself<SqlQueryView*> (context);
  13434. int section= argument<int> (0,context);
  13435. QString data= argument<QString> (1,context);
  13436. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  13437. return QScriptValue();
  13438. }
  13439. /*:534*//*542:*/
  13440. #line 12876 "./typica.w"
  13441. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  13442. QStack<QLayout*> *layoutStack)
  13443. {
  13444. QTextEdit*widget= new QTextEdit;
  13445. if(element.hasAttribute("id"))
  13446. {
  13447. widget->setObjectName(element.attribute("id"));
  13448. }
  13449. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13450. layout->addWidget(widget);
  13451. QTextDocument*document= new QTextDocument;
  13452. QFont defaultFont;
  13453. defaultFont.setPointSize(11);
  13454. document->setDefaultFont(defaultFont);
  13455. QTextCursor cursor(document);
  13456. /*543:*/
  13457. #line 12899 "./typica.w"
  13458. QDomNodeList children= element.childNodes();
  13459. for(int i= 0;i<children.count();i++)
  13460. {
  13461. QDomNode current;
  13462. QDomElement currentElement;
  13463. current= children.at(i);
  13464. if(current.isElement())
  13465. {
  13466. currentElement= current.toElement();
  13467. /*544:*/
  13468. #line 12916 "./typica.w"
  13469. if(currentElement.tagName()=="style")
  13470. {
  13471. document->setDefaultStyleSheet(currentElement.text());
  13472. }
  13473. /*:544*//*545:*/
  13474. #line 12927 "./typica.w"
  13475. if(currentElement.tagName()=="html")
  13476. {
  13477. cursor.insertHtml(currentElement.text());
  13478. }
  13479. /*:545*//*546:*/
  13480. #line 12937 "./typica.w"
  13481. if(currentElement.tagName()=="text")
  13482. {
  13483. cursor.insertText(currentElement.text());
  13484. }
  13485. /*:546*//*547:*/
  13486. #line 12947 "./typica.w"
  13487. if(currentElement.tagName()=="table")
  13488. {
  13489. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  13490. ReportTable*table= new ReportTable(frame,currentElement);
  13491. table->setParent(widget);
  13492. if(currentElement.hasAttribute("id"))
  13493. {
  13494. table->setObjectName(currentElement.attribute("id"));
  13495. }
  13496. }
  13497. /*:547*/
  13498. #line 12909 "./typica.w"
  13499. }
  13500. }
  13501. /*:543*/
  13502. #line 12892 "./typica.w"
  13503. widget->setDocument(document);
  13504. }
  13505. /*:542*//*558:*/
  13506. #line 13159 "./typica.w"
  13507. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  13508. {
  13509. QTextEdit*self= getself<QTextEdit*> (context);
  13510. QTextDocument*document= self->document();
  13511. QPrinter printer;
  13512. QPrintDialog printwindow(&printer,self);
  13513. if(printwindow.exec()!=QDialog::Accepted)
  13514. {
  13515. return QScriptValue();
  13516. }
  13517. document->print(&printer);
  13518. return QScriptValue();
  13519. }
  13520. /*:558*//*559:*/
  13521. #line 13177 "./typica.w"
  13522. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  13523. {
  13524. setQAbstractScrollAreaProperties(value,engine);
  13525. value.setProperty("print",engine->newFunction(QTextEdit_print));
  13526. }
  13527. /*:559*//*568:*/
  13528. #line 13355 "./typica.w"
  13529. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  13530. QStack<QLayout*> *layoutStack)
  13531. {
  13532. FormArray*widget= new FormArray(element);
  13533. if(element.hasAttribute("id"))
  13534. {
  13535. widget->setObjectName(element.attribute("id"));
  13536. }
  13537. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13538. layout->addWidget(widget);
  13539. }
  13540. /*:568*//*589:*/
  13541. #line 13942 "./typica.w"
  13542. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  13543. QStack<QLayout*> *layoutStack)
  13544. {
  13545. ScaleControl*scale= new ScaleControl;
  13546. if(element.hasAttribute("id"))
  13547. {
  13548. scale->setObjectName(element.attribute("id"));
  13549. }
  13550. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13551. layout->addWidget(scale);
  13552. }
  13553. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  13554. QStack<QLayout*> *layoutStack)
  13555. {
  13556. IntensityControl*scale= new IntensityControl;
  13557. if(element.hasAttribute("id"))
  13558. {
  13559. scale->setObjectName(element.attribute("id"));
  13560. }
  13561. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13562. layout->addWidget(scale);
  13563. }
  13564. /*:589*//*615:*/
  13565. #line 14532 "./typica.w"
  13566. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  13567. {
  13568. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  13569. setDeviceTreeModelProperties(object,engine);
  13570. return object;
  13571. }
  13572. /*:615*//*617:*/
  13573. #line 14555 "./typica.w"
  13574. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  13575. {
  13576. setQAbstractItemModelProperties(value,engine);
  13577. value.setProperty("referenceElement",
  13578. engine->newFunction(DeviceTreeModel_referenceElement));
  13579. }
  13580. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  13581. {
  13582. setQObjectProperties(value,engine);
  13583. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  13584. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  13585. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  13586. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  13587. }
  13588. /*:617*//*618:*/
  13589. #line 14582 "./typica.w"
  13590. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  13591. QScriptEngine*engine)
  13592. {
  13593. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  13594. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  13595. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13596. QDomElement node;
  13597. QVariantMap retval;
  13598. retval.insert("driver",referenceElement.attribute("driver"));
  13599. for(int i= 0;i<configData.size();i++)
  13600. {
  13601. node= configData.at(i).toElement();
  13602. retval.insert(node.attribute("name"),node.attribute("value"));
  13603. }
  13604. return engine->toScriptValue(retval);
  13605. }
  13606. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  13607. {
  13608. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13609. QModelIndex index= argument<QModelIndex> (0,context);
  13610. int role= argument<int> (1,context);
  13611. return engine->toScriptValue(model->data(index,role));
  13612. }
  13613. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  13614. {
  13615. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13616. int row= 0;
  13617. int column= 0;
  13618. QModelIndex index;
  13619. if(context->argumentCount()> 1)
  13620. {
  13621. row= argument<int> (0,context);
  13622. column= argument<int> (1,context);
  13623. }
  13624. if(context->argumentCount()> 2)
  13625. {
  13626. index= argument<QModelIndex> (2,context);
  13627. }
  13628. QModelIndex retval= model->index(row,column,index);
  13629. return engine->toScriptValue(retval);
  13630. }
  13631. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  13632. QScriptEngine*)
  13633. {
  13634. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13635. QModelIndex index;
  13636. if(context->argumentCount()==1)
  13637. {
  13638. index= argument<QModelIndex> (0,context);
  13639. }
  13640. return QScriptValue(model->rowCount(index));
  13641. }
  13642. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  13643. QScriptEngine*engine)
  13644. {
  13645. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  13646. QModelIndex index;
  13647. if(context->argumentCount()==1)
  13648. {
  13649. index= argument<QModelIndex> (0,context);
  13650. }
  13651. return QScriptValue(engine,model->hasChildren(index));
  13652. }
  13653. /*:618*//*621:*/
  13654. #line 14666 "./typica.w"
  13655. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  13656. {
  13657. QVariant var;
  13658. var.setValue(index);
  13659. QScriptValue object= engine->newVariant(var);
  13660. return object;
  13661. }
  13662. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  13663. {
  13664. index= value.toVariant().value<QModelIndex> ();
  13665. }
  13666. /*:621*//*636:*/
  13667. #line 14934 "./typica.w"
  13668. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  13669. QScriptEngine*engine)
  13670. {
  13671. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  13672. return object;
  13673. }
  13674. /*:636*//*712:*/
  13675. #line 17439 "./typica.w"
  13676. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  13677. {
  13678. QScriptValue object;
  13679. if(context->argumentCount()==2)
  13680. {
  13681. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  13682. argument<QModelIndex> (1,context)),
  13683. QScriptEngine::ScriptOwnership);
  13684. setModbusRTUDeviceProperties(object,engine);
  13685. }
  13686. else
  13687. {
  13688. context->throwError("Incorrect number of arguments passed to "
  13689. "ModbusRTUDevice constructor. This takes the configuration model "
  13690. "and an index.");
  13691. }
  13692. return object;
  13693. }
  13694. /*:712*//*713:*/
  13695. #line 17461 "./typica.w"
  13696. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  13697. {
  13698. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13699. QScriptValue object;
  13700. if(self)
  13701. {
  13702. if(self->channels.size()> 0)
  13703. {
  13704. object= engine->newQObject(self->channels.at(0));
  13705. setChannelProperties(object,engine);
  13706. }
  13707. }
  13708. return object;
  13709. }
  13710. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  13711. {
  13712. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  13713. QScriptValue object;
  13714. if(self)
  13715. {
  13716. if(self->channels.size()> 1)
  13717. {
  13718. object= engine->newQObject(self->channels.at(1));
  13719. setChannelProperties(object,engine);
  13720. }
  13721. }
  13722. return object;
  13723. }
  13724. /*:713*//*714:*/
  13725. #line 17494 "./typica.w"
  13726. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  13727. {
  13728. setQObjectProperties(value,engine);
  13729. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  13730. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  13731. }
  13732. /*:714*/
  13733. #line 758 "./typica.w"
  13734. /*513:*/
  13735. #line 12321 "./typica.w"
  13736. int main(int argc,char**argv)
  13737. {
  13738. int*c= &argc;
  13739. Application app(*c,argv);
  13740. /*514:*/
  13741. #line 12345 "./typica.w"
  13742. QStringList themeSearchPath= QIcon::themeSearchPaths();
  13743. themeSearchPath.append(":/resources/icons/tango");
  13744. QIcon::setThemeSearchPaths(themeSearchPath);
  13745. QIcon::setThemeName(":/resources/icons/tango");
  13746. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  13747. /*:514*/
  13748. #line 12326 "./typica.w"
  13749. QSettings settings;
  13750. /*646:*/
  13751. #line 15146 "./typica.w"
  13752. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  13753. /*:646*//*656:*/
  13754. #line 15374 "./typica.w"
  13755. app.registerDeviceConfigurationWidget("nidaqmxbase",
  13756. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  13757. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  13758. NiDaqMxBase9211ConfWidget::staticMetaObject);
  13759. app.registerDeviceConfigurationWidget("ni9211seriestc",
  13760. Ni9211TcConfWidget::staticMetaObject);
  13761. /*:656*//*664:*/
  13762. #line 15591 "./typica.w"
  13763. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  13764. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  13765. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  13766. /*:664*//*688:*/
  13767. #line 16552 "./typica.w"
  13768. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  13769. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  13770. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  13771. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  13772. /*:688*//*693:*/
  13773. #line 16637 "./typica.w"
  13774. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  13775. /*:693*//*696:*/
  13776. #line 16707 "./typica.w"
  13777. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  13778. /*:696*//*699:*/
  13779. #line 16834 "./typica.w"
  13780. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  13781. /*:699*//*717:*/
  13782. #line 18007 "./typica.w"
  13783. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  13784. /*:717*//*724:*/
  13785. #line 18137 "./typica.w"
  13786. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  13787. /*:724*//*728:*/
  13788. #line 18226 "./typica.w"
  13789. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  13790. /*:728*/
  13791. #line 12329 "./typica.w"
  13792. /*515:*/
  13793. #line 12358 "./typica.w"
  13794. if(settings.value("database/exists","false").toString()=="true")
  13795. {
  13796. /*520:*/
  13797. #line 12478 "./typica.w"
  13798. QSqlDatabase database=
  13799. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  13800. database.setHostName(settings.value("database/hostname").toString());
  13801. database.setDatabaseName(settings.value("database/dbname").toString());
  13802. database.setUserName(settings.value("database/user").toString());
  13803. database.setPassword(settings.value("database/password").toString());
  13804. if(!database.open())
  13805. {
  13806. settings.setValue("database/exists","false");
  13807. }
  13808. /*:520*/
  13809. #line 12361 "./typica.w"
  13810. }
  13811. if(settings.value("database/exists","false").toString()=="false")
  13812. {
  13813. /*519:*/
  13814. #line 12469 "./typica.w"
  13815. SqlConnectionSetup dialog;
  13816. dialog.exec();
  13817. /*:519*/
  13818. #line 12365 "./typica.w"
  13819. }
  13820. /*:515*/
  13821. #line 12330 "./typica.w"
  13822. /*152:*/
  13823. #line 3626 "./typica.w"
  13824. QStringList arguments= QCoreApplication::arguments();
  13825. int position= arguments.indexOf("-c");
  13826. QString filename= QString();
  13827. if(position!=-1)
  13828. {
  13829. if(arguments.size()>=position+1)
  13830. {
  13831. filename= arguments.at(position+1);
  13832. }
  13833. }
  13834. if(filename.isEmpty())
  13835. {
  13836. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  13837. settings.value("config","").toString());
  13838. }
  13839. QDir directory;
  13840. if(!filename.isEmpty())
  13841. {
  13842. QFile file(filename);
  13843. QFileInfo info(filename);
  13844. directory= info.dir();
  13845. settings.setValue("config",directory.path());
  13846. if(file.open(QIODevice::ReadOnly))
  13847. {
  13848. app.configuration()->setContent(&file,true);
  13849. }
  13850. }
  13851. /*153:*/
  13852. #line 3660 "./typica.w"
  13853. QDomElement root= app.configuration()->documentElement();
  13854. QDomNodeList children= root.childNodes();
  13855. QString replacementDoc;
  13856. QDomDocument includedDoc;
  13857. QDomDocumentFragment fragment;
  13858. for(int i= 0;i<children.size();i++)
  13859. {
  13860. QDomNode currentNode= children.at(i);
  13861. QDomElement currentElement;
  13862. if(currentNode.nodeName()=="include")
  13863. {
  13864. currentElement= currentNode.toElement();
  13865. if(currentElement.hasAttribute("src"))
  13866. {
  13867. replacementDoc= directory.path();
  13868. replacementDoc.append('/');
  13869. replacementDoc.append(currentElement.attribute("src"));
  13870. QFile doc(replacementDoc);
  13871. if(doc.open(QIODevice::ReadOnly))
  13872. {
  13873. includedDoc.setContent(&doc,true);
  13874. fragment= includedDoc.createDocumentFragment();
  13875. fragment.appendChild(includedDoc.documentElement());
  13876. root.replaceChild(fragment,currentNode);
  13877. doc.close();
  13878. }
  13879. }
  13880. }
  13881. }
  13882. /*:153*/
  13883. #line 3654 "./typica.w"
  13884. /*:152*/
  13885. #line 12331 "./typica.w"
  13886. /*18:*/
  13887. #line 870 "./typica.w"
  13888. QScriptEngine*engine= new QScriptEngine;
  13889. QScriptValue constructor;
  13890. QScriptValue value;
  13891. /*:18*//*28:*/
  13892. #line 1046 "./typica.w"
  13893. constructor= engine->newFunction(constructQWidget);
  13894. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  13895. engine->globalObject().setProperty("QWidget",value);
  13896. /*:28*//*36:*/
  13897. #line 1246 "./typica.w"
  13898. constructor= engine->newFunction(constructQMainWindow);
  13899. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  13900. constructor);
  13901. engine->globalObject().setProperty("QMainWindow",value);
  13902. /*:36*//*47:*/
  13903. #line 1451 "./typica.w"
  13904. constructor= engine->newFunction(constructQFrame);
  13905. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  13906. engine->globalObject().setProperty("QFrame",value);
  13907. /*:47*//*50:*/
  13908. #line 1484 "./typica.w"
  13909. constructor= engine->newFunction(constructQLabel);
  13910. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  13911. engine->globalObject().setProperty("QLabel",value);
  13912. /*:50*//*53:*/
  13913. #line 1531 "./typica.w"
  13914. constructor= engine->newFunction(constructQSplitter);
  13915. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  13916. engine->globalObject().setProperty("QSplitter",value);
  13917. /*:53*//*60:*/
  13918. #line 1702 "./typica.w"
  13919. constructor= engine->newFunction(constructQBoxLayout);
  13920. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  13921. engine->globalObject().setProperty("QBoxLayout",value);
  13922. /*:60*//*64:*/
  13923. #line 1814 "./typica.w"
  13924. constructor= engine->newFunction(constructQAction);
  13925. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  13926. engine->globalObject().setProperty("QAction",value);
  13927. /*:64*//*67:*/
  13928. #line 1873 "./typica.w"
  13929. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  13930. value.setProperty("getOpenFileName",
  13931. engine->newFunction(QFileDialog_getOpenFileName));
  13932. value.setProperty("getSaveFileName",
  13933. engine->newFunction(QFileDialog_getSaveFileName));
  13934. engine->globalObject().setProperty("QFileDialog",value);
  13935. /*:67*//*72:*/
  13936. #line 1985 "./typica.w"
  13937. constructor= engine->newFunction(constructQFile);
  13938. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  13939. engine->globalObject().setProperty("QFile",value);
  13940. /*:72*//*79:*/
  13941. #line 2102 "./typica.w"
  13942. constructor= engine->newFunction(constructQBuffer);
  13943. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  13944. engine->globalObject().setProperty("QBuffer",value);
  13945. /*:79*//*82:*/
  13946. #line 2150 "./typica.w"
  13947. constructor= engine->newFunction(constructXQuery);
  13948. engine->globalObject().setProperty("XQuery",constructor);
  13949. /*:82*//*88:*/
  13950. #line 2244 "./typica.w"
  13951. constructor= engine->newFunction(constructXmlWriter);
  13952. engine->globalObject().setProperty("XmlWriter",constructor);
  13953. /*:88*//*97:*/
  13954. #line 2450 "./typica.w"
  13955. constructor= engine->newFunction(constructXmlReader);
  13956. engine->globalObject().setProperty("XmlReader",constructor);
  13957. /*:97*//*104:*/
  13958. #line 2574 "./typica.w"
  13959. value= engine->newQObject(&settings);
  13960. setQSettingsProperties(value,engine);
  13961. engine->globalObject().setProperty("QSettings",value);
  13962. /*:104*//*108:*/
  13963. #line 2655 "./typica.w"
  13964. constructor= engine->newFunction(constructQLCDNumber);
  13965. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  13966. engine->globalObject().setProperty("QLCDNumber",value);
  13967. /*:108*//*111:*/
  13968. #line 2711 "./typica.w"
  13969. constructor= engine->newFunction(constructQTime);
  13970. engine->globalObject().setProperty("QTime",constructor);
  13971. /*:111*//*132:*/
  13972. #line 3215 "./typica.w"
  13973. constructor= engine->newFunction(constructQPushButton);
  13974. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  13975. engine->globalObject().setProperty("QPushButton",value);
  13976. /*:132*//*139:*/
  13977. #line 3326 "./typica.w"
  13978. constructor= engine->newFunction(constructQSqlQuery);
  13979. engine->globalObject().setProperty("QSqlQuery",constructor);
  13980. /*:139*//*146:*/
  13981. #line 3487 "./typica.w"
  13982. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  13983. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  13984. engine->globalObject().setProperty("sqlToArray",
  13985. engine->newFunction(sqlToArray));
  13986. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  13987. engine->globalObject().setProperty("annotationFromRecord",
  13988. engine->newFunction(annotationFromRecord));
  13989. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  13990. /*:146*//*157:*/
  13991. #line 3823 "./typica.w"
  13992. engine->globalObject().setProperty("createWindow",
  13993. engine->newFunction(createWindow));
  13994. /*:157*//*204:*/
  13995. #line 5299 "./typica.w"
  13996. engine->globalObject().setProperty("findChildObject",
  13997. engine->newFunction(findChildObject));
  13998. /*:204*//*243:*/
  13999. #line 6474 "./typica.w"
  14000. constructor= engine->newFunction(constructDAQ);
  14001. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  14002. engine->globalObject().setProperty("DAQ",value);
  14003. /*:243*//*252:*/
  14004. #line 6672 "./typica.w"
  14005. constructor= engine->newFunction(constructFakeDAQ);
  14006. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  14007. engine->globalObject().setProperty("FakeDAQ",value);
  14008. /*:252*//*263:*/
  14009. #line 6949 "./typica.w"
  14010. constructor= engine->newFunction(constructLinearCalibrator);
  14011. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  14012. constructor);
  14013. engine->globalObject().setProperty("LinearCalibrator",value);
  14014. /*:263*//*268:*/
  14015. #line 7087 "./typica.w"
  14016. constructor= engine->newFunction(constructLinearSplineInterpolator);
  14017. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  14018. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  14019. /*:268*//*277:*/
  14020. #line 7270 "./typica.w"
  14021. constructor= engine->newFunction(constructTemperatureDisplay);
  14022. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  14023. constructor);
  14024. engine->globalObject().setProperty("TemperatureDisplay",value);
  14025. /*:277*//*284:*/
  14026. #line 7408 "./typica.w"
  14027. constructor= engine->newFunction(constructMeasurementTimeOffset);
  14028. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  14029. constructor);
  14030. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  14031. /*:284*//*289:*/
  14032. #line 7519 "./typica.w"
  14033. constructor= engine->newFunction(constructThresholdDetector);
  14034. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  14035. engine->globalObject().setProperty("ThresholdDetector",value);
  14036. /*:289*//*294:*/
  14037. #line 7617 "./typica.w"
  14038. constructor= engine->newFunction(constructZeroEmitter);
  14039. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  14040. engine->globalObject().setProperty("ZeroEmitter",value);
  14041. /*:294*//*299:*/
  14042. #line 7696 "./typica.w"
  14043. constructor= engine->newFunction(constructMeasurementAdapter);
  14044. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  14045. constructor);
  14046. engine->globalObject().setProperty("MeasurementAdapter",value);
  14047. /*:299*//*314:*/
  14048. #line 8045 "./typica.w"
  14049. constructor= engine->newFunction(constructGraphView);
  14050. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  14051. engine->globalObject().setProperty("GraphView",value);
  14052. /*:314*//*336:*/
  14053. #line 8616 "./typica.w"
  14054. constructor= engine->newFunction(constructZoomLog);
  14055. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  14056. engine->globalObject().setProperty("ZoomLog",value);
  14057. /*:336*//*373:*/
  14058. #line 9534 "./typica.w"
  14059. constructor= engine->newFunction(constructAnnotationButton);
  14060. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  14061. constructor);
  14062. engine->globalObject().setProperty("AnnotationButton",value);
  14063. /*:373*//*381:*/
  14064. #line 9676 "./typica.w"
  14065. constructor= engine->newFunction(constructAnnotationSpinBox);
  14066. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  14067. constructor);
  14068. engine->globalObject().setProperty("AnnotationSpinBox",value);
  14069. /*:381*//*402:*/
  14070. #line 10097 "./typica.w"
  14071. constructor= engine->newFunction(constructTimerDisplay);
  14072. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  14073. engine->globalObject().setProperty("TimerDisplay",value);
  14074. /*:402*//*429:*/
  14075. #line 10591 "./typica.w"
  14076. constructor= engine->newFunction(constructWidgetDecorator);
  14077. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  14078. engine->globalObject().setProperty("WidgetDecorator",value);
  14079. /*:429*//*442:*/
  14080. #line 10873 "./typica.w"
  14081. constructor= engine->newFunction(constructLogEditWindow);
  14082. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  14083. engine->globalObject().setProperty("LogEditWindow",value);
  14084. /*:442*//*461:*/
  14085. #line 11347 "./typica.w"
  14086. constructor= engine->newFunction(constructXMLInput);
  14087. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  14088. engine->globalObject().setProperty("XMLInput",value);
  14089. /*:461*//*468:*/
  14090. #line 11514 "./typica.w"
  14091. constructor= engine->newFunction(constructWebView);
  14092. value= engine->newQMetaObject(&QWebView::staticMetaObject,constructor);
  14093. engine->globalObject().setProperty("WebView",value);
  14094. /*:468*//*481:*/
  14095. #line 11706 "./typica.w"
  14096. value= engine->newQObject(AppInstance);
  14097. engine->globalObject().setProperty("Application",value);
  14098. /*:481*//*532:*/
  14099. #line 12651 "./typica.w"
  14100. constructor= engine->newFunction(constructSqlQueryView);
  14101. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  14102. engine->globalObject().setProperty("SqlQueryView",value);
  14103. /*:532*//*616:*/
  14104. #line 14542 "./typica.w"
  14105. constructor= engine->newFunction(constructDeviceTreeModel);
  14106. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  14107. constructor);
  14108. engine->globalObject().setProperty("DeviceTreeModel",value);
  14109. /*:616*//*622:*/
  14110. #line 14682 "./typica.w"
  14111. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  14112. /*:622*//*637:*/
  14113. #line 14944 "./typica.w"
  14114. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  14115. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  14116. constructor);
  14117. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  14118. /*:637*//*711:*/
  14119. #line 17430 "./typica.w"
  14120. constructor= engine->newFunction(constructModbusRTUDevice);
  14121. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  14122. engine->globalObject().setProperty("ModbusRTUDevice",value);
  14123. /*:711*/
  14124. #line 12332 "./typica.w"
  14125. app.engine= engine;
  14126. /*154:*/
  14127. #line 3708 "./typica.w"
  14128. QString styleText;
  14129. QString programText;
  14130. QDomElement currentElement;
  14131. for(int i= 0;i<children.size();i++)
  14132. {
  14133. QDomNode currentNode= children.at(i);
  14134. if(currentNode.nodeName()=="style")
  14135. {
  14136. currentElement= currentNode.toElement();
  14137. styleText.append(currentElement.text());
  14138. }
  14139. else if(currentNode.nodeName()=="program")
  14140. {
  14141. currentElement= currentNode.toElement();
  14142. programText.append(currentElement.text());
  14143. }
  14144. }
  14145. app.setStyleSheet(styleText);
  14146. QScriptValue result= engine->evaluate(programText);
  14147. /*155:*/
  14148. #line 3733 "./typica.w"
  14149. if(engine->hasUncaughtException())
  14150. {
  14151. int line= engine->uncaughtExceptionLineNumber();
  14152. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14153. result.toString();
  14154. QString trace;
  14155. foreach(trace,engine->uncaughtExceptionBacktrace())
  14156. {
  14157. qDebug()<<trace;
  14158. }
  14159. }
  14160. /*:155*/
  14161. #line 3728 "./typica.w"
  14162. /*:154*/
  14163. #line 12334 "./typica.w"
  14164. int retval= app.exec();
  14165. delete engine;
  14166. return retval;
  14167. }
  14168. /*:513*/
  14169. #line 759 "./typica.w"
  14170. #include "moc_typica.cpp"
  14171. /*:15*/