Typica is a free program for professional coffee roasters. https://typica.us
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

typica.cpp 558KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065
  1. /*3:*/
  2. #line 522 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*5:*/
  5. #line 619 "./typica.w"
  6. #include <QtCore>
  7. #include <QtGui>
  8. #include <QtScript>
  9. #include <QtScriptTools>
  10. #include <QtXml>
  11. #include <QtSql>
  12. #include <QtDebug>
  13. #include <QtXmlPatterns>
  14. #include <QtWebKit>
  15. #include <QtSvg>
  16. /*:5*//*6:*/
  17. #line 635 "./typica.w"
  18. #include "helpmenu.h"
  19. /*:6*//*303:*/
  20. #line 6814 "./typica.w"
  21. #include "units.h"
  22. #line 1 "./measurement.w"
  23. /*:303*//*574:*/
  24. #line 212 "./webview.w"
  25. #include "webview.h"
  26. /*:574*//*587:*/
  27. #line 390 "./webview.w"
  28. #include "webelement.h"
  29. #line 12802 "./typica.w"
  30. #line 1 "./printerselector.w"
  31. /*:587*//*589:*/
  32. #line 40 "./printerselector.w"
  33. #include "printerselector.h"
  34. /*:589*//*713:*/
  35. #line 489 "./daterangeselector.w"
  36. #include "daterangeselector.h"
  37. #line 14537 "./typica.w"
  38. /*:713*//*821:*/
  39. #line 17108 "./typica.w"
  40. #include "qextserialport.h"
  41. #include "qextserialenumerator.h"
  42. /*:821*//*1015:*/
  43. #line 124 "./dataqsdk.w"
  44. #ifdef Q_OS_WIN32
  45. #include <windef.h>
  46. #else
  47. #define PASCAL
  48. #endif
  49. /*:1015*//*1039:*/
  50. #line 862 "./dataqsdk.w"
  51. #include <limits>
  52. /*:1039*//*1054:*/
  53. #line 62 "./scales.w"
  54. #include "draglabel.h"
  55. /*:1054*//*1069:*/
  56. #line 361 "./scales.w"
  57. #include "scale.h"
  58. /*:1069*/
  59. #line 525 "./typica.w"
  60. /*26:*/
  61. #line 1051 "./typica.w"
  62. class ScriptQMainWindow:public QMainWindow
  63. {
  64. Q_OBJECT
  65. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  66. public:
  67. ScriptQMainWindow();
  68. QString closePrompt();
  69. public slots:
  70. void show();
  71. void saveSizeAndPosition(const QString&key);
  72. void restoreSizeAndPosition(const QString&key);
  73. void displayStatus(const QString&message= QString());
  74. void setClosePrompt(QString prompt);
  75. void setupFinished();
  76. signals:
  77. void aboutToClose(void);
  78. void windowReady(void);
  79. protected:
  80. void closeEvent(QCloseEvent*event);
  81. void showEvent(QShowEvent*event);
  82. private:
  83. QString cprompt;
  84. };
  85. /*:26*//*172:*/
  86. #line 3982 "./typica.w"
  87. class SqlQueryConnection:public QSqlQuery
  88. {
  89. public:
  90. SqlQueryConnection(const QString&query= QString());
  91. ~SqlQueryConnection();
  92. QSqlQuery*operator->()const;
  93. private:
  94. QString connection;
  95. QSqlQuery*q;
  96. };
  97. /*:172*//*249:*/
  98. #line 5971 "./typica.w"
  99. class NumericDelegate:public QItemDelegate
  100. {
  101. Q_OBJECT
  102. public:
  103. NumericDelegate(QObject*parent= NULL);
  104. QWidget*createEditor(QWidget*parent,
  105. const QStyleOptionViewItem&option,
  106. const QModelIndex&index)const;
  107. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  108. void setModelData(QWidget*editor,QAbstractItemModel*model,
  109. const QModelIndex&index)const;
  110. void updateEditorGeometry(QWidget*editor,
  111. const QStyleOptionViewItem&option,
  112. const QModelIndex&index)const;
  113. };
  114. /*:249*//*255:*/
  115. #line 6064 "./typica.w"
  116. class ScriptValidator:public QValidator
  117. {
  118. Q_OBJECT
  119. public:
  120. ScriptValidator(QValidator*validator,QObject*parent= NULL);
  121. void fixup(QString&input)const;
  122. QValidator::State validate(QString&input,int&pos)const;
  123. private:
  124. QValidator*v;
  125. };
  126. /*:255*//*299:*/
  127. #line 438 "./units.w"
  128. Q_DECLARE_METATYPE(Units::Unit)
  129. /*:299*//*304:*/
  130. #line 19 "./measurement.w"
  131. class Measurement:public QVariantMap
  132. {
  133. public:
  134. Measurement(double temperature= 0,QTime time= QTime(),
  135. Units::Unit sc= Units::Fahrenheit);
  136. Measurement(double temperature);
  137. double temperature()const;
  138. QTime time()const;
  139. void setTemperature(double temperature);
  140. void setTime(QTime time);
  141. void setUnit(Units::Unit scale);
  142. Units::Unit scale()const;
  143. Measurement toFahrenheit();
  144. Measurement toCelsius();
  145. Measurement toKelvin();
  146. Measurement toRankine();
  147. };
  148. /*:304*//*308:*/
  149. #line 128 "./measurement.w"
  150. Q_DECLARE_METATYPE(Measurement)
  151. /*:308*//*315:*/
  152. #line 6878 "./typica.w"
  153. class Channel;
  154. class DAQImplementation;
  155. class DAQ:public QObject
  156. {
  157. Q_OBJECT
  158. Q_ENUMS(ThermocoupleType)
  159. DAQImplementation*imp;
  160. private slots:
  161. void threadFinished();
  162. public:
  163. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  164. ~DAQ();
  165. Channel*newChannel(int units,int thermocouple);
  166. Q_INVOKABLE void setClockRate(double Hz);
  167. Q_INVOKABLE void start();
  168. Q_INVOKABLE void stop();
  169. enum ThermocoupleType
  170. {
  171. TypeJ= 10072,
  172. TypeK= 10073,
  173. TypeN= 10077,
  174. TypeR= 10082,
  175. TypeS= 10085,
  176. TypeT= 10086,
  177. TypeB= 10047,
  178. TypeE= 10055
  179. };
  180. };
  181. /*:315*//*316:*/
  182. #line 6916 "./typica.w"
  183. class DAQImplementation:public QThread
  184. {
  185. Q_OBJECT
  186. public:
  187. DAQImplementation(const QString&driverinfo);
  188. ~DAQImplementation();
  189. void run();
  190. void measure();
  191. /*317:*/
  192. #line 6936 "./typica.w"
  193. typedef int(*daqfp)(...);
  194. daqfp read;
  195. daqfp errorInfo;
  196. daqfp startTask;
  197. daqfp createTask;
  198. daqfp createChannel;
  199. daqfp setClock;
  200. daqfp stopTask;
  201. daqfp clearTask;
  202. daqfp resetDevice;
  203. daqfp waitForMeasurement;
  204. /*:317*/
  205. #line 6925 "./typica.w"
  206. /*318:*/
  207. #line 6952 "./typica.w"
  208. bool useBase;
  209. QString device;
  210. QVector<Channel*> channelMap;
  211. unsigned int handle;
  212. int error;
  213. int channels;
  214. bool ready;
  215. QLibrary driver;
  216. QVector<Units::Unit> unitMap;
  217. /*:318*/
  218. #line 6926 "./typica.w"
  219. };
  220. /*:316*//*334:*/
  221. #line 7457 "./typica.w"
  222. class FakeDAQImplementation:public QThread
  223. {
  224. Q_OBJECT
  225. public:
  226. FakeDAQImplementation();
  227. ~FakeDAQImplementation();
  228. void run();
  229. void measure();
  230. QVector<Channel*> channelMap;
  231. int channels;
  232. bool ready;
  233. double clockRate;
  234. };
  235. class FakeDAQ:public QObject
  236. {
  237. Q_OBJECT
  238. FakeDAQImplementation*imp;
  239. public:
  240. FakeDAQ(QString device);
  241. ~FakeDAQ();
  242. Channel*newChannel(int units,int thermocouple);
  243. Q_INVOKABLE void setClockRate(double Hz);
  244. Q_INVOKABLE void start();
  245. };
  246. /*:334*//*341:*/
  247. #line 7644 "./typica.w"
  248. class Channel:public QObject
  249. {
  250. Q_OBJECT
  251. public:
  252. Channel();
  253. ~Channel();
  254. public slots:
  255. void input(Measurement measurement);
  256. signals:
  257. void newData(Measurement);
  258. };
  259. /*:341*//*345:*/
  260. #line 7711 "./typica.w"
  261. class LinearCalibrator:public QObject
  262. {
  263. Q_OBJECT
  264. Q_PROPERTY(double measuredLower READ measuredLower
  265. WRITE setMeasuredLower)
  266. Q_PROPERTY(double measuredUpper READ measuredUpper
  267. WRITE setMeasuredUpper)
  268. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  269. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  270. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  271. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  272. public:
  273. LinearCalibrator(QObject*parent= NULL);
  274. double measuredLower();
  275. double measuredUpper();
  276. double mappedLower();
  277. double mappedUpper();
  278. bool isClosedRange();
  279. double sensitivity();
  280. public slots:
  281. void setMeasuredLower(double lower);
  282. void setMeasuredUpper(double upper);
  283. void setMappedLower(double lower);
  284. void setMappedUpper(double upper);
  285. void setClosedRange(bool closed);
  286. void setSensitivity(double sensitivity);
  287. Measurement newMeasurement(Measurement measure);
  288. signals:
  289. void measurement(Measurement measure);
  290. void newData(Measurement measure);
  291. private:
  292. double Lo1;
  293. double Lo2;
  294. double Up1;
  295. double Up2;
  296. double sensitivitySetting;
  297. bool clamp;
  298. };
  299. /*:345*//*352:*/
  300. #line 7907 "./typica.w"
  301. class LinearSplineInterpolator:public QObject
  302. {
  303. Q_OBJECT
  304. public:
  305. LinearSplineInterpolator(QObject*parent= NULL);
  306. Q_INVOKABLE void add_pair(double source,double destination);
  307. public slots:
  308. Measurement newMeasurement(Measurement measure);
  309. signals:
  310. void newData(Measurement measure);
  311. private:
  312. void make_interpolators();
  313. QMap<double,double> *pairs;
  314. QList<LinearCalibrator*> *interpolators;
  315. };
  316. /*:352*//*357:*/
  317. #line 8043 "./typica.w"
  318. class TemperatureDisplay:public QLCDNumber
  319. {
  320. Q_OBJECT
  321. int unit;
  322. bool r;
  323. public:
  324. TemperatureDisplay(QWidget*parent= NULL);
  325. ~TemperatureDisplay();
  326. public slots:
  327. void setValue(Measurement temperature);
  328. void invalidate();
  329. void setDisplayUnits(Units::Unit scale);
  330. void setRelativeMode(bool relative);
  331. };
  332. /*:357*//*368:*/
  333. #line 8262 "./typica.w"
  334. class MeasurementTimeOffset:public QObject
  335. {
  336. Q_OBJECT
  337. QTime epoch;
  338. QTime previous;
  339. bool hasPrevious;
  340. public:
  341. MeasurementTimeOffset(QTime zero);
  342. QTime zeroTime();
  343. public slots:
  344. void newMeasurement(Measurement measure);
  345. void setZeroTime(QTime zero);
  346. signals:
  347. void measurement(Measurement measure);
  348. };
  349. /*:368*//*375:*/
  350. #line 8414 "./typica.w"
  351. class ThresholdDetector:public QObject
  352. {
  353. Q_OBJECT
  354. Q_ENUMS(EdgeDirection)
  355. public:
  356. enum EdgeDirection{
  357. Ascending,Descending
  358. };
  359. ThresholdDetector(double value);
  360. public slots:
  361. void newMeasurement(Measurement measure);
  362. void setThreshold(double value);
  363. void setEdgeDirection(EdgeDirection direction);
  364. signals:
  365. void timeForValue(double);
  366. private:
  367. bool previousValueValid;
  368. double previousValue;
  369. double threshold;
  370. EdgeDirection currentDirection;
  371. };
  372. /*:375*//*380:*/
  373. #line 8530 "./typica.w"
  374. class ZeroEmitter:public QObject
  375. {
  376. Q_OBJECT
  377. Q_PROPERTY(int column READ column WRITE setColumn)
  378. Measurement cache;
  379. int col;
  380. public:
  381. ZeroEmitter(int tempcolumn= 1);
  382. int column();
  383. double lastTemperature();
  384. public slots:
  385. void newMeasurement(Measurement measure);
  386. void setColumn(int column);
  387. void emitZero();
  388. signals:
  389. void measurement(Measurement measure,int tempcolumn);
  390. };
  391. /*:380*//*385:*/
  392. #line 8624 "./typica.w"
  393. class MeasurementAdapter:public QObject
  394. {
  395. Q_OBJECT
  396. int col;
  397. public:
  398. MeasurementAdapter(int tempcolumn);
  399. int column();
  400. public slots:
  401. void newMeasurement(Measurement measure);
  402. void setColumn(int column);
  403. signals:
  404. void measurement(Measurement measure,int tempcolumn);
  405. };
  406. /*:385*//*390:*/
  407. #line 8713 "./typica.w"
  408. class GraphView:public QGraphicsView
  409. {
  410. Q_OBJECT
  411. QGraphicsScene*theScene;
  412. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  413. QMap<int,QPointF> *prevPoints;
  414. QMap<int,double> *translations;
  415. QList<QGraphicsItem*> *gridLinesF;
  416. QList<QGraphicsItem*> *gridLinesC;
  417. QList<QGraphicsItem*> *relativeGridLines;
  418. bool relativeEnabled;
  419. bool timeIndicatorEnabled;
  420. QGraphicsLineItem*timeLine;
  421. LinearSplineInterpolator*relativeAdjuster;
  422. public:
  423. GraphView(QWidget*parent= NULL);
  424. void removeSeries(int column);
  425. protected:
  426. void resizeEvent(QResizeEvent*event);
  427. public slots:
  428. void newMeasurement(Measurement measure,int tempcolumn);
  429. void setSeriesTranslation(int column,double offset);
  430. void setTimeIndicatorEnabled(bool enabled);
  431. void clear();
  432. void showF();
  433. void showC();
  434. };
  435. /*:390*//*407:*/
  436. #line 9181 "./typica.w"
  437. class MeasurementModel;
  438. class ZoomLog:public QTableView
  439. {
  440. Q_OBJECT
  441. /*408:*/
  442. #line 9230 "./typica.w"
  443. MeasurementModel*model_ms;
  444. MeasurementModel*model_1s;
  445. MeasurementModel*model_5s;
  446. MeasurementModel*model_10s;
  447. MeasurementModel*model_15s;
  448. MeasurementModel*model_30s;
  449. MeasurementModel*model_1m;
  450. QList<MeasurementModel*> modelSet;
  451. QHash<int,Measurement> lastMeasurement;
  452. MeasurementModel*currentModel;
  453. QList<int> saveTempCols;
  454. QList<int> saveControlCols;
  455. QList<int> saveNoteCols;
  456. QList<int> currentColumnSet;
  457. /*:408*/
  458. #line 9186 "./typica.w"
  459. void switchLOD(MeasurementModel*m);
  460. private slots:
  461. void centerOn(int row);
  462. void persistColumnResize(int column,int oldsize,int newsize);
  463. void restoreColumnWidths();
  464. public:
  465. ZoomLog();
  466. QVariant data(int row,int column)const;
  467. Q_INVOKABLE int rowCount();
  468. bool saveXML(QIODevice*device);
  469. bool saveCSV(QIODevice*device);
  470. QString lastTime(int series);
  471. Q_INVOKABLE Units::Unit displayUnits();
  472. public slots:
  473. void setVisible(bool visibility);
  474. void setHeaderData(int section,QString text);
  475. void LOD_ms();
  476. void LOD_1s();
  477. void LOD_5s();
  478. void LOD_10s();
  479. void LOD_15s();
  480. void LOD_30s();
  481. void LOD_1m();
  482. void newMeasurement(Measurement measure,int tempcolumn);
  483. void newAnnotation(QString annotation,int tempcolumn,
  484. int annotationcolumn);
  485. void clear();
  486. void addOutputTemperatureColumn(int column);
  487. void addOutputControlColumn(int column);
  488. void addOutputAnnotationColumn(int column);
  489. void clearOutputColumns();
  490. void setDisplayUnits(Units::Unit scale);
  491. void addToCurrentColumnSet(int column);
  492. void clearCurrentColumnSet();
  493. protected:
  494. virtual void showEvent(QShowEvent*event);
  495. };
  496. /*:407*//*433:*/
  497. #line 9935 "./typica.w"
  498. class MeasurementList;
  499. class MeasurementModel:public QAbstractItemModel
  500. {
  501. Q_OBJECT
  502. Units::Unit unit;
  503. QList<MeasurementList*> *entries;
  504. QStringList*hData;
  505. int colcount;
  506. QHash<int,int> *lastTemperature;
  507. QList<MeasurementList*> ::iterator lastInsertion;
  508. QHash<int,bool> *controlColumns;
  509. public:
  510. MeasurementModel(QObject*parent= NULL);
  511. ~MeasurementModel();
  512. int rowCount(const QModelIndex&parent= QModelIndex())const;
  513. int columnCount(const QModelIndex&parent= QModelIndex())const;
  514. bool setHeaderData(int section,Qt::Orientation orientation,
  515. const QVariant&value,int role= Qt::DisplayRole);
  516. QVariant data(const QModelIndex&index,int role)const;
  517. bool setData(const QModelIndex&index,const QVariant&value,
  518. int role= Qt::EditRole);
  519. Qt::ItemFlags flags(const QModelIndex&index)const;
  520. QVariant headerData(int section,Qt::Orientation orientation,
  521. int role= Qt::DisplayRole)const;
  522. QModelIndex index(int row,int column,
  523. const QModelIndex&parent= QModelIndex())const;
  524. QModelIndex parent(const QModelIndex&index)const;
  525. Units::Unit displayUnits();
  526. public slots:
  527. void newMeasurement(Measurement measure,int tempcolumn);
  528. void newAnnotation(QString annotation,int tempcolumn,
  529. int annotationColumn);
  530. void clear();
  531. void setDisplayUnits(Units::Unit scale);
  532. signals:
  533. void rowChanged(int);
  534. };
  535. /*:433*//*434:*/
  536. #line 9979 "./typica.w"
  537. class MeasurementList:public QVariantList
  538. {
  539. public:
  540. bool operator<(const MeasurementList&other)const;
  541. bool operator==(const MeasurementList&other)const;
  542. };
  543. /*:434*//*460:*/
  544. #line 10637 "./typica.w"
  545. class AnnotationButton:public QPushButton
  546. {
  547. Q_OBJECT
  548. QString note;
  549. int tc;
  550. int ac;
  551. int count;
  552. public:
  553. AnnotationButton(const QString&text,QWidget*parent= NULL);
  554. public slots:
  555. void setAnnotation(const QString&annotation);
  556. void setTemperatureColumn(int tempcolumn);
  557. void setAnnotationColumn(int annotationcolumn);
  558. void annotate();
  559. void resetCount();
  560. signals:
  561. void annotation(QString annotation,int tempcolumn,
  562. int notecolumn);
  563. };
  564. /*:460*//*468:*/
  565. #line 10762 "./typica.w"
  566. class AnnotationSpinBox:public QDoubleSpinBox
  567. {
  568. Q_OBJECT
  569. QString pretext;
  570. QString posttext;
  571. int tc;
  572. int ac;
  573. bool change;
  574. public:
  575. AnnotationSpinBox(const QString&pret,const QString&postt,
  576. QWidget*parent= NULL);
  577. public slots:
  578. void setPretext(const QString&pret);
  579. void setPosttext(const QString&postt);
  580. void setTemperatureColumn(int tempcolumn);
  581. void setAnnotationColumn(int annotationcolumn);
  582. void annotate();
  583. void resetChange();
  584. signals:
  585. void annotation(QString annotation,int tempcolumn,
  586. int notecolumn);
  587. };
  588. /*:468*//*476:*/
  589. #line 10921 "./typica.w"
  590. class TimerDisplay:public QLCDNumber
  591. {
  592. Q_OBJECT
  593. /*477:*/
  594. #line 10971 "./typica.w"
  595. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  596. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  597. Q_PROPERTY(bool running READ isRunning)
  598. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  599. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  600. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  601. Q_PROPERTY(QString value READ value)
  602. /*:477*/
  603. #line 10925 "./typica.w"
  604. private slots:
  605. void updateTime();
  606. void setCountUpMode();
  607. void setCountDownMode();
  608. void setClockMode();
  609. public:
  610. TimerDisplay(QWidget*parent= NULL);
  611. ~TimerDisplay();
  612. enum TimerMode
  613. {
  614. CountUp,
  615. CountDown,
  616. Clock
  617. };
  618. QString value();
  619. QTime seconds();
  620. TimerMode mode();
  621. bool isRunning();
  622. QTime resetValue();
  623. QString displayFormat();
  624. bool autoReset();
  625. public slots:
  626. void setTimer(QTime value= QTime(0,0,0));
  627. void setMode(TimerMode mode);
  628. void startTimer();
  629. void stopTimer();
  630. void copyTimer();
  631. void setResetValue(QTime value= QTime(0,0,0));
  632. void reset();
  633. void setDisplayFormat(QString format);
  634. void setAutoReset(bool reset);
  635. void updateDisplay();
  636. signals:
  637. void valueChanged(QTime);
  638. void runStateChanged(bool);
  639. private:
  640. /*478:*/
  641. #line 10982 "./typica.w"
  642. QTime s;
  643. QTime r;
  644. QTimer clock;
  645. TimerDisplay::TimerMode m;
  646. bool running;
  647. bool ar;
  648. QAction*startAction;
  649. QAction*stopAction;
  650. QAction*resetAction;
  651. QString f;
  652. QTime relative;
  653. QTime base;
  654. /*:478*/
  655. #line 10962 "./typica.w"
  656. };
  657. /*:476*//*499:*/
  658. #line 11374 "./typica.w"
  659. class PackLayout:public QLayout
  660. {
  661. int doLayout(const QRect&rect,bool testOnly)const;
  662. QList<QLayoutItem*> itemList;
  663. Qt::Orientations orientation;
  664. public:
  665. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  666. PackLayout(int spacing= -1);
  667. ~PackLayout();
  668. void addItem(QLayoutItem*item);
  669. Qt::Orientations expandingDirections()const;
  670. bool hasHeightForWidth()const;
  671. int heightForWidth(int width)const;
  672. int count()const;
  673. QLayoutItem*itemAt(int index)const;
  674. QSize minimumSize()const;
  675. void setGeometry(const QRect&rect);
  676. void setOrientation(Qt::Orientations direction);
  677. QSize sizeHint()const;
  678. QLayoutItem*takeAt(int index);
  679. };
  680. /*:499*//*512:*/
  681. #line 11652 "./typica.w"
  682. class SceneButton:public QGraphicsScene
  683. {
  684. Q_OBJECT
  685. public:
  686. SceneButton();
  687. ~SceneButton();
  688. protected:
  689. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  690. signals:
  691. void clicked(QPoint pos);
  692. };
  693. /*:512*//*514:*/
  694. #line 11694 "./typica.w"
  695. class WidgetDecorator:public QWidget
  696. {
  697. Q_OBJECT
  698. PackLayout*layout;
  699. QGraphicsView*label;
  700. QGraphicsTextItem*text;
  701. SceneButton*scene;
  702. public:
  703. WidgetDecorator(QWidget*widget,const QString&labeltext,
  704. Qt::Orientations orientation= Qt::Horizontal,
  705. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  706. ~WidgetDecorator();
  707. void setBackgroundBrush(QBrush background);
  708. void setTextColor(QColor color);
  709. };
  710. /*:514*//*525:*/
  711. #line 11869 "./typica.w"
  712. class LogEditWindow:public QMainWindow
  713. {
  714. Q_OBJECT
  715. QWidget*centralWidget;
  716. PackLayout*mainLayout;
  717. QHBoxLayout*addRowsLayout;
  718. QLabel*startTimeLabel;
  719. QTimeEdit*startTime;
  720. QLabel*endTimeLabel;
  721. QTimeEdit*endTime;
  722. QLabel*intervalLabel;
  723. QSpinBox*interval;
  724. QPushButton*addRows;
  725. QAction*saveXml;
  726. QAction*saveCsv;
  727. QAction*openXml;
  728. MeasurementModel*model;
  729. QTableView*log;
  730. private slots:
  731. void addTheRows();
  732. void saveXML();
  733. void saveCSV();
  734. void openXML();
  735. protected:
  736. void closeEvent(QCloseEvent*event);
  737. public:
  738. LogEditWindow();
  739. };
  740. /*:525*//*539:*/
  741. #line 12177 "./typica.w"
  742. class XMLOutput:public QObject
  743. {
  744. Q_OBJECT
  745. MeasurementModel*data;
  746. QIODevice*out;
  747. int time;
  748. QMap<int,QString> temperatureColumns;
  749. QMap<int,QString> controlColumns;
  750. QMap<int,QString> annotationColumns;
  751. public:
  752. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  753. void addTemperatureColumn(const QString&series,int column);
  754. void addControlColumn(const QString&series,int column);
  755. void addAnnotationColumn(const QString&series,int column);
  756. void setModel(MeasurementModel*model);
  757. void setTimeColumn(int column);
  758. void setDevice(QIODevice*device);
  759. bool output();
  760. };
  761. /*:539*//*546:*/
  762. #line 12413 "./typica.w"
  763. class XMLInput:public QObject
  764. {
  765. Q_OBJECT
  766. int firstc;
  767. QIODevice*in;
  768. public:
  769. XMLInput(QIODevice*input,int c);
  770. void setFirstColumn(int column);
  771. void setDevice(QIODevice*device);
  772. bool input();
  773. signals:
  774. void measure(Measurement,int);
  775. void annotation(QString,int,int);
  776. void newTemperatureColumn(int,QString);
  777. void newAnnotationColumn(int,QString);
  778. void lastColumn(int);
  779. };
  780. /*:546*//*557:*/
  781. #line 12667 "./typica.w"
  782. class CSVOutput
  783. {
  784. MeasurementModel*data;
  785. QIODevice*out;
  786. int time;
  787. QMap<int,QString> temperatureColumns;
  788. QMap<int,QString> controlColumns;
  789. QMap<int,QString> annotationColumns;
  790. public:
  791. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  792. void addTemperatureColumn(const QString&series,int column);
  793. void addControlColumn(const QString&series,int column);
  794. void addAnnotationColumn(const QString&series,int column);
  795. void setModel(MeasurementModel*model);
  796. void setTimeColumn(int column);
  797. void setDevice(QIODevice*device);
  798. bool output();
  799. };
  800. /*:557*//*597:*/
  801. #line 12812 "./typica.w"
  802. #define AppInstance (qobject_cast<Application *> (qApp))
  803. class NodeInserter;
  804. class DeviceTreeModel;
  805. class Application:public QApplication
  806. {
  807. Q_OBJECT
  808. public:
  809. Application(int&argc,char**argv);
  810. QDomDocument*configuration();
  811. /*745:*/
  812. #line 15383 "./typica.w"
  813. QDomDocument deviceConfiguration();
  814. /*:745*//*778:*/
  815. #line 16056 "./typica.w"
  816. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  817. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  818. const QModelIndex&index);
  819. /*:778*//*783:*/
  820. #line 16160 "./typica.w"
  821. QList<NodeInserter*> topLevelNodeInserters;
  822. /*:783*/
  823. #line 12823 "./typica.w"
  824. QSqlDatabase database();
  825. QScriptEngine*engine;
  826. public slots:
  827. /*746:*/
  828. #line 15390 "./typica.w"
  829. void saveDeviceConfiguration();
  830. /*:746*/
  831. #line 12827 "./typica.w"
  832. private:
  833. /*744:*/
  834. #line 15374 "./typica.w"
  835. QDomDocument deviceConfigurationDocument;
  836. /*:744*//*777:*/
  837. #line 16050 "./typica.w"
  838. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  839. /*:777*/
  840. #line 12829 "./typica.w"
  841. QDomDocument conf;
  842. };
  843. /*:597*//*605:*/
  844. #line 12954 "./typica.w"
  845. class SaltModel:public QAbstractItemModel
  846. {
  847. Q_OBJECT
  848. QList<QList<QMap<int,QVariant> > > modelData;
  849. QStringList hData;
  850. int colcount;
  851. public:
  852. SaltModel(int columns);
  853. ~SaltModel();
  854. int rowCount(const QModelIndex&parent= QModelIndex())const;
  855. int columnCount(const QModelIndex&parent= QModelIndex())const;
  856. bool setHeaderData(int section,Qt::Orientation orientation,
  857. const QVariant&value,int role= Qt::DisplayRole);
  858. QVariant data(const QModelIndex&index,int role)const;
  859. bool setData(const QModelIndex&index,const QVariant&value,
  860. int role= Qt::EditRole);
  861. Qt::ItemFlags flags(const QModelIndex&index)const;
  862. QVariant headerData(int section,Qt::Orientation orientation,
  863. int role= Qt::DisplayRole)const;
  864. QModelIndex index(int row,int column,
  865. const QModelIndex&parent= QModelIndex())const;
  866. QModelIndex parent(const QModelIndex&index)const;
  867. QString arrayLiteral(int column,int role)const;
  868. QString quotedArrayLiteral(int column,int role)const;
  869. void clear();
  870. bool removeRows(int row,int count,
  871. const QModelIndex&parent= QModelIndex());
  872. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  873. };
  874. /*:605*//*621:*/
  875. #line 13339 "./typica.w"
  876. class SqlComboBox:public QComboBox
  877. {
  878. Q_OBJECT
  879. int dataColumn;
  880. int displayColumn;
  881. bool dataColumnShown;
  882. QString specialNullText;
  883. QVariant specialNullData;
  884. public:
  885. SqlComboBox();
  886. ~SqlComboBox();
  887. SqlComboBox*clone(QWidget*parent);
  888. public slots:
  889. void addNullOption();
  890. void addSqlOptions(QString query);
  891. void setDataColumn(int column);
  892. void setDisplayColumn(int column);
  893. void showData(bool show);
  894. void setNullText(QString nullText);
  895. void setNullData(QVariant nullData);
  896. };
  897. /*:621*//*628:*/
  898. #line 13486 "./typica.w"
  899. class SqlComboBoxDelegate:public QItemDelegate
  900. {
  901. Q_OBJECT
  902. SqlComboBox*delegate;
  903. public:
  904. SqlComboBoxDelegate(QObject*parent= NULL);
  905. QWidget*createEditor(QWidget*parent,
  906. const QStyleOptionViewItem&option,
  907. const QModelIndex&index)const;
  908. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  909. void setModelData(QWidget*editor,QAbstractItemModel*model,
  910. const QModelIndex&index)const;
  911. void setWidget(SqlComboBox*widget);
  912. virtual QSize sizeHint()const;
  913. void updateEditorGeometry(QWidget*editor,
  914. const QStyleOptionViewItem&option,
  915. const QModelIndex&index)const;
  916. };
  917. /*:628*//*643:*/
  918. #line 13697 "./typica.w"
  919. class SqlConnectionSetup:public QDialog
  920. {
  921. Q_OBJECT
  922. public:
  923. SqlConnectionSetup();
  924. ~SqlConnectionSetup();
  925. public slots:
  926. void testConnection();
  927. private:
  928. QFormLayout*formLayout;
  929. QComboBox*driver;
  930. QLineEdit*hostname;
  931. QLineEdit*portnumber;
  932. QLineEdit*dbname;
  933. QLineEdit*user;
  934. QLineEdit*password;
  935. QVBoxLayout*layout;
  936. QHBoxLayout*buttons;
  937. QPushButton*cancelButton;
  938. QPushButton*connectButton;
  939. };
  940. /*:643*//*648:*/
  941. #line 13845 "./typica.w"
  942. class SqlQueryView:public QTableView
  943. {
  944. Q_OBJECT
  945. public:
  946. SqlQueryView(QWidget*parent= NULL);
  947. void setQuery(const QString&query);
  948. bool setHeaderData(int section,Qt::Orientation orientation,
  949. const QVariant&value,int role);
  950. Q_INVOKABLE QVariant data(int row,int column,
  951. int role= Qt::DisplayRole);
  952. signals:
  953. void openEntry(QString key);
  954. void openEntryRow(int row);
  955. protected:
  956. virtual void showEvent(QShowEvent*event);
  957. private slots:
  958. void openRow(const QModelIndex&index);
  959. void persistColumnResize(int column,int oldsize,int newsize);
  960. };
  961. /*:648*//*663:*/
  962. #line 14100 "./typica.w"
  963. class ReportAction:public QAction
  964. {
  965. Q_OBJECT
  966. public:
  967. ReportAction(const QString&fileName,const QString&reportName,
  968. QObject*parent= NULL);
  969. private slots:
  970. void createReport();
  971. private:
  972. QString reportFile;
  973. };
  974. /*:663*//*675:*/
  975. #line 14311 "./typica.w"
  976. class ReportTable:public QObject
  977. {
  978. Q_OBJECT
  979. QTextFrame*area;
  980. QDomElement configuration;
  981. QMap<QString,QVariant> bindings;
  982. public:
  983. ReportTable(QTextFrame*frame,QDomElement description);
  984. ~ReportTable();
  985. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  986. public slots:
  987. void refresh();
  988. };
  989. /*:675*//*688:*/
  990. #line 63 "./plugins.w"
  991. class PluginAction:public QAction
  992. {
  993. Q_OBJECT
  994. Q_PROPERTY(QString preRun READ preRun WRITE setPreRun);
  995. Q_PROPERTY(QString postRun READ postRun WRITE setPostRun);
  996. public:
  997. PluginAction(const QFileInfo&info,QObject*parent);
  998. QString preRun();
  999. QString postRun();
  1000. public slots:
  1001. void setPreRun(const QString&script);
  1002. void setPostRun(const QString&script);
  1003. private slots:
  1004. void runScript();
  1005. private:
  1006. QString pluginFile;
  1007. QString preRunScript;
  1008. QString postRunScript;
  1009. };
  1010. /*:688*//*691:*/
  1011. #line 155 "./plugins.w"
  1012. Q_DECLARE_METATYPE(QScriptValue)
  1013. /*:691*//*714:*/
  1014. #line 14552 "./typica.w"
  1015. class FormArray:public QScrollArea
  1016. {
  1017. Q_OBJECT
  1018. QDomElement configuration;
  1019. QWidget itemContainer;
  1020. QVBoxLayout itemLayout;
  1021. int maxwidth;
  1022. int maxheight;
  1023. public:
  1024. FormArray(QDomElement description);
  1025. Q_INVOKABLE QWidget*elementAt(int index);
  1026. Q_INVOKABLE int elements();
  1027. public slots:
  1028. void addElements(int copies= 1);
  1029. void removeAllElements();
  1030. void setMaximumElementWidth(int width);
  1031. void setMaximumElementHeight(int height);
  1032. };
  1033. /*:714*//*724:*/
  1034. #line 14768 "./typica.w"
  1035. class ScaleControl:public QGraphicsView
  1036. {
  1037. Q_OBJECT
  1038. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  1039. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  1040. /*725:*/
  1041. #line 14794 "./typica.w"
  1042. QGraphicsScene scene;
  1043. QGraphicsPolygonItem initialDecrement;
  1044. QGraphicsPolygonItem initialIncrement;
  1045. QGraphicsPolygonItem finalDecrement;
  1046. QGraphicsPolygonItem finalIncrement;
  1047. QGraphicsPolygonItem initialIndicator;
  1048. QGraphicsPolygonItem finalIndicator;
  1049. QGraphicsPathItem scaleLine;
  1050. QPolygonF left;
  1051. QPolygonF right;
  1052. QPolygonF down;
  1053. QPolygonF up;
  1054. QPainterPath scalePath;
  1055. QBrush initialBrush;
  1056. QBrush finalBrush;
  1057. double nonScoredValue;
  1058. double scoredValue;
  1059. bool initialSet;
  1060. bool finalSet;
  1061. bool scaleDown;
  1062. /*:725*/
  1063. #line 14774 "./typica.w"
  1064. public:
  1065. ScaleControl();
  1066. double initialValue(void);
  1067. double finalValue(void);
  1068. virtual QSize sizeHint()const;
  1069. public slots:
  1070. void setInitialValue(double value);
  1071. void setFinalValue(double value);
  1072. signals:
  1073. void initialChanged(double);
  1074. void finalChanged(double);
  1075. protected:
  1076. virtual void mousePressEvent(QMouseEvent*event);
  1077. virtual void mouseReleaseEvent(QMouseEvent*event);
  1078. };
  1079. /*:724*//*736:*/
  1080. #line 15091 "./typica.w"
  1081. class IntensityControl:public QGraphicsView
  1082. {
  1083. Q_OBJECT
  1084. Q_PROPERTY(double value READ value WRITE setValue)
  1085. QGraphicsScene scene;
  1086. QGraphicsPolygonItem decrement;
  1087. QGraphicsPolygonItem increment;
  1088. QGraphicsPolygonItem indicator;
  1089. QGraphicsPathItem scaleLine;
  1090. QPolygonF left;
  1091. QPolygonF up;
  1092. QPolygonF down;
  1093. QPainterPath scalePath;
  1094. QBrush theBrush;
  1095. double theValue;
  1096. bool valueSet;
  1097. bool scaleDown;
  1098. public:
  1099. IntensityControl();
  1100. double value();
  1101. virtual QSize sizeHint()const;
  1102. public slots:
  1103. void setValue(double val);
  1104. signals:
  1105. void valueChanged(double);
  1106. protected:
  1107. virtual void mousePressEvent(QMouseEvent*event);
  1108. virtual void mouseReleaseEvent(QMouseEvent*event);
  1109. };
  1110. /*:736*//*752:*/
  1111. #line 15479 "./typica.w"
  1112. class DeviceTreeModelNode
  1113. {
  1114. public:
  1115. DeviceTreeModelNode(QDomNode&node,int row,
  1116. DeviceTreeModelNode*parent= NULL);
  1117. ~DeviceTreeModelNode();
  1118. DeviceTreeModelNode*child(int index);
  1119. DeviceTreeModelNode*parent();
  1120. QDomNode node()const;
  1121. int row();
  1122. private:
  1123. QDomNode domNode;
  1124. QHash<int,DeviceTreeModelNode*> children;
  1125. int rowNumber;
  1126. DeviceTreeModelNode*parentItem;
  1127. };
  1128. /*:752*//*754:*/
  1129. #line 15554 "./typica.w"
  1130. class DeviceTreeModel:public QAbstractItemModel
  1131. {
  1132. Q_OBJECT
  1133. public:
  1134. DeviceTreeModel(QObject*parent= NULL);
  1135. ~DeviceTreeModel();
  1136. QVariant data(const QModelIndex&index,int role)const;
  1137. Qt::ItemFlags flags(const QModelIndex&index)const;
  1138. QVariant headerData(int section,Qt::Orientation orientation,
  1139. int role= Qt::DisplayRole)const;
  1140. QModelIndex index(int row,int column,
  1141. const QModelIndex&parent= QModelIndex())const;
  1142. QModelIndex parent(const QModelIndex&child)const;
  1143. Q_INVOKABLE int rowCount(const QModelIndex&parent= QModelIndex())const;
  1144. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1145. bool setData(const QModelIndex&index,const QVariant&value,
  1146. int role);
  1147. bool removeRows(int row,int count,const QModelIndex&parent);
  1148. QDomElement referenceElement(const QString&id);
  1149. public slots:
  1150. void newNode(const QString&name,const QString&driver,
  1151. const QModelIndex&parent);
  1152. private:
  1153. QDomDocument document;
  1154. DeviceTreeModelNode*root;
  1155. QDomNode referenceSection;
  1156. QDomNode treeRoot;
  1157. };
  1158. /*:754*//*773:*/
  1159. #line 16008 "./typica.w"
  1160. Q_DECLARE_METATYPE(QModelIndex)
  1161. /*:773*//*781:*/
  1162. #line 16115 "./typica.w"
  1163. class NodeInserter:public QAction
  1164. {
  1165. Q_OBJECT
  1166. public:
  1167. NodeInserter(const QString&title,const QString&name,
  1168. const QString&driver,QObject*parent= NULL);
  1169. signals:
  1170. void triggered(QString name,QString driver);
  1171. private slots:
  1172. void onTriggered();
  1173. private:
  1174. QString defaultNodeName;
  1175. QString driverString;
  1176. };
  1177. /*:781*//*784:*/
  1178. #line 16170 "./typica.w"
  1179. class DeviceConfigurationWindow:public QWidget
  1180. {
  1181. Q_OBJECT
  1182. public:
  1183. DeviceConfigurationWindow();
  1184. public slots:
  1185. void addDevice();
  1186. void removeNode();
  1187. void newSelection(const QModelIndex&index);
  1188. private slots:
  1189. void resizeColumn();
  1190. private:
  1191. QDomDocument document;
  1192. DeviceTreeModel*model;
  1193. QTreeView*view;
  1194. QScrollArea*configArea;
  1195. };
  1196. /*:784*//*793:*/
  1197. #line 16340 "./typica.w"
  1198. class BasicDeviceConfigurationWidget:public QWidget
  1199. {
  1200. Q_OBJECT
  1201. public:
  1202. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1203. const QModelIndex&index);
  1204. public slots:
  1205. void insertChildNode(const QString&name,const QString&driver);
  1206. void updateAttribute(const QString&name,const QString&value);
  1207. protected:
  1208. DeviceTreeModel*deviceModel;
  1209. QModelIndex currentNode;
  1210. };
  1211. /*:793*//*797:*/
  1212. #line 16425 "./typica.w"
  1213. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1214. {
  1215. Q_OBJECT
  1216. public:
  1217. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1218. const QModelIndex&index);
  1219. private slots:
  1220. void updateRoasterId(int id);
  1221. void updateCapacityCheck(int value);
  1222. void updateCapacity(const QString&value);
  1223. void updateCapacityUnit(const QString&value);
  1224. };
  1225. /*:797*//*802:*/
  1226. #line 16630 "./typica.w"
  1227. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1228. {
  1229. Q_OBJECT
  1230. public:
  1231. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1232. const QModelIndex&index);
  1233. };
  1234. /*:802*//*804:*/
  1235. #line 16676 "./typica.w"
  1236. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1237. {
  1238. Q_OBJECT
  1239. public:
  1240. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1241. const QModelIndex&index);
  1242. private slots:
  1243. void addChannel();
  1244. void updateDeviceId(const QString&newId);
  1245. };
  1246. /*:804*//*808:*/
  1247. #line 16762 "./typica.w"
  1248. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1249. {
  1250. Q_OBJECT
  1251. public:
  1252. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1253. const QModelIndex&index);
  1254. private slots:
  1255. void updateThermocoupleType(const QString&type);
  1256. void updateColumnName(const QString&name);
  1257. void updateHidden(bool hidden);
  1258. };
  1259. /*:808*//*813:*/
  1260. #line 16878 "./typica.w"
  1261. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1262. {
  1263. Q_OBJECT
  1264. public:
  1265. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1266. const QModelIndex&index);
  1267. };
  1268. /*:813*//*815:*/
  1269. #line 16919 "./typica.w"
  1270. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1271. {
  1272. Q_OBJECT
  1273. public:
  1274. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1275. const QModelIndex&index);
  1276. private slots:
  1277. void addChannel();
  1278. void updateDeviceId(const QString&newId);
  1279. };
  1280. /*:815*//*817:*/
  1281. #line 16988 "./typica.w"
  1282. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1283. {
  1284. Q_OBJECT
  1285. public:
  1286. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1287. const QModelIndex&index);
  1288. private slots:
  1289. void updateDeviceId(const QString&newId);
  1290. void updateThermocoupleType(const QString&type);
  1291. void updateColumnName(const QString&name);
  1292. void updateHidden(bool hidden);
  1293. };
  1294. /*:817*//*822:*/
  1295. #line 17119 "./typica.w"
  1296. class PortSelector:public QComboBox
  1297. {
  1298. Q_OBJECT
  1299. public:
  1300. PortSelector(QWidget*parent= NULL);
  1301. private slots:
  1302. void addDevice(QextPortInfo port);
  1303. private:
  1304. QextSerialEnumerator*lister;
  1305. };
  1306. /*:822*//*824:*/
  1307. #line 17167 "./typica.w"
  1308. class BaudSelector:public QComboBox
  1309. {
  1310. Q_OBJECT
  1311. Q_ENUMS(BaudRateType)
  1312. public:
  1313. BaudSelector(QWidget*parent= NULL);
  1314. enum BaudRateType
  1315. {
  1316. #if defined(Q_OS_UNIX) || defined(qdoc)
  1317. BAUD50= 50,
  1318. BAUD75= 75,
  1319. BAUD134= 134,
  1320. BAUD150= 150,
  1321. BAUD200= 200,
  1322. BAUD1800= 1800,
  1323. #if defined(B76800) || defined(qdoc)
  1324. BAUD76800= 76800,
  1325. #endif
  1326. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1327. BAUD230400= 230400,
  1328. BAUD460800= 460800,
  1329. BAUD500000= 500000,
  1330. BAUD576000= 576000,
  1331. BAUD921600= 921600,
  1332. BAUD1000000= 1000000,
  1333. BAUD1152000= 1152000,
  1334. BAUD1500000= 1500000,
  1335. BAUD2000000= 2000000,
  1336. BAUD2500000= 2500000,
  1337. BAUD3000000= 3000000,
  1338. BAUD3500000= 3500000,
  1339. BAUD4000000= 4000000,
  1340. #endif
  1341. #endif
  1342. #if defined(Q_OS_WIN) || defined(qdoc)
  1343. BAUD14400= 14400,
  1344. BAUD56000= 56000,
  1345. BAUD128000= 128000,
  1346. BAUD256000= 256000,
  1347. #endif
  1348. BAUD110= 110,
  1349. BAUD300= 300,
  1350. BAUD600= 600,
  1351. BAUD1200= 1200,
  1352. BAUD2400= 2400,
  1353. BAUD4800= 4800,
  1354. BAUD9600= 9600,
  1355. BAUD19200= 19200,
  1356. BAUD38400= 38400,
  1357. BAUD57600= 57600,
  1358. BAUD115200= 115200
  1359. };
  1360. };
  1361. /*:824*//*826:*/
  1362. #line 17238 "./typica.w"
  1363. class ParitySelector:public QComboBox
  1364. {
  1365. Q_OBJECT
  1366. Q_ENUMS(ParityType)
  1367. public:
  1368. ParitySelector(QWidget*parent= NULL);
  1369. enum ParityType
  1370. {
  1371. PAR_NONE,
  1372. PAR_ODD,
  1373. PAR_EVEN,
  1374. #if defined(Q_OS_WIN) || defined(qdoc)
  1375. PAR_MARK,
  1376. #endif
  1377. PAR_SPACE
  1378. };
  1379. };
  1380. /*:826*//*828:*/
  1381. #line 17276 "./typica.w"
  1382. class FlowSelector:public QComboBox
  1383. {
  1384. Q_OBJECT
  1385. Q_ENUMS(FlowType)
  1386. public:
  1387. FlowSelector(QWidget*parent= NULL);
  1388. enum FlowType
  1389. {
  1390. FLOW_OFF,
  1391. FLOW_HARDWARE,
  1392. FLOW_XONXOFF
  1393. };
  1394. };
  1395. /*:828*//*830:*/
  1396. #line 17309 "./typica.w"
  1397. class StopSelector:public QComboBox
  1398. {
  1399. Q_OBJECT
  1400. Q_ENUMS(StopBitsType)
  1401. public:
  1402. StopSelector(QWidget*parent= NULL);
  1403. enum StopBitsType
  1404. {
  1405. STOP_1,
  1406. #if defined(Q_OS_WIN) || defined(qdoc)
  1407. STOP_1_5,
  1408. #endif
  1409. STOP_2
  1410. };
  1411. };
  1412. /*:830*//*833:*/
  1413. #line 17366 "./typica.w"
  1414. class ShortHexSpinBox:public QSpinBox
  1415. {
  1416. Q_OBJECT
  1417. public:
  1418. ShortHexSpinBox(QWidget*parent= NULL);
  1419. virtual QValidator::State validate(QString&input,int&pos)const;
  1420. protected:
  1421. virtual int valueFromText(const QString&text)const;
  1422. virtual QString textFromValue(int value)const;
  1423. };
  1424. /*:833*//*835:*/
  1425. #line 17428 "./typica.w"
  1426. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1427. {
  1428. Q_OBJECT
  1429. public:
  1430. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1431. const QModelIndex&index);
  1432. private slots:
  1433. void updatePort(const QString&newPort);
  1434. void updateBaudRate(const QString&newRate);
  1435. void updateParity(const QString&newParity);
  1436. void updateFlowControl(const QString&newFlow);
  1437. void updateStopBits(const QString&newStopBits);
  1438. };
  1439. /*:835*//*837:*/
  1440. #line 17579 "./typica.w"
  1441. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1442. {
  1443. Q_OBJECT
  1444. public:
  1445. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1446. const QModelIndex&index);
  1447. private slots:
  1448. void updateStationNumber(int newStation);
  1449. void updateFixedUnit(bool newFixed);
  1450. void updateFixedDecimal(bool newFixed);
  1451. void updateUnit(const QString&newUnit);
  1452. void updateUnitAddress(int newAddress);
  1453. void updateValueF(int newValue);
  1454. void updateValueC(int newValue);
  1455. void updatePrecisionAddress(int newAddress);
  1456. void updatePrecisionValue(int newValue);
  1457. private:
  1458. QStackedLayout*unitSpecificationLayout;
  1459. QStackedLayout*decimalSpecificationLayout;
  1460. };
  1461. /*:837*//*839:*/
  1462. #line 17838 "./typica.w"
  1463. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1464. {
  1465. Q_OBJECT
  1466. public:
  1467. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1468. const QModelIndex&index);
  1469. private slots:
  1470. void updateAddress(int newAddress);
  1471. };
  1472. /*:839*//*841:*/
  1473. #line 17884 "./typica.w"
  1474. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1475. {
  1476. Q_OBJECT
  1477. public:
  1478. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1479. const QModelIndex&index);
  1480. private slots:
  1481. void updateReadAddress(int newAddress);
  1482. void updateWriteAddress(int newAddress);
  1483. void updateFixedRange(bool fixed);
  1484. void updateLower(const QString&lower);
  1485. void updateUpper(const QString&upper);
  1486. void updateLowerAddress(int newAddress);
  1487. void updateUpperAddress(int newAddress);
  1488. private:
  1489. QStackedLayout*boundsLayout;
  1490. };
  1491. /*:841*//*845:*/
  1492. #line 18078 "./typica.w"
  1493. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1494. {
  1495. Q_OBJECT
  1496. public:
  1497. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1498. private slots:
  1499. void updateButtonText(const QString&text);
  1500. void updateAnnotationText(const QString&text);
  1501. };
  1502. /*:845*//*849:*/
  1503. #line 18146 "./typica.w"
  1504. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1505. {
  1506. Q_OBJECT
  1507. public:
  1508. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1509. private slots:
  1510. void updateButtonText(const QString&text);
  1511. void updateAnnotationText(const QString&text);
  1512. };
  1513. /*:849*//*852:*/
  1514. #line 18220 "./typica.w"
  1515. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1516. {
  1517. Q_OBJECT
  1518. public:
  1519. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1520. private slots:
  1521. void updateLabel(const QString&text);
  1522. void updateMinimum(const QString&minimum);
  1523. void updateMaximum(const QString&maximum);
  1524. void updatePrecision(int precision);
  1525. void updatePretext(const QString&text);
  1526. void updatePosttext(const QString&text);
  1527. };
  1528. /*:852*//*855:*/
  1529. #line 12 "./freeannotation.w"
  1530. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1531. {
  1532. Q_OBJECT
  1533. public:
  1534. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1535. private slots:
  1536. void updateLabel(const QString&text);
  1537. };
  1538. /*:855*//*859:*/
  1539. #line 11 "./settings.w"
  1540. class SettingsWindow:public QMainWindow
  1541. {
  1542. Q_OBJECT
  1543. public:
  1544. SettingsWindow();
  1545. };
  1546. /*:859*//*864:*/
  1547. #line 8 "./graphsettings.w"
  1548. class GraphSettingsWidget:public QWidget
  1549. {
  1550. Q_OBJECT
  1551. public:
  1552. GraphSettingsWidget();
  1553. };
  1554. /*:864*//*866:*/
  1555. #line 46 "./graphsettings.w"
  1556. class GraphSettingsRelativeTab:public QWidget
  1557. {
  1558. Q_OBJECT
  1559. public:
  1560. GraphSettingsRelativeTab();
  1561. public slots:
  1562. void updateEnableSetting(bool enable);
  1563. void updateColorSetting(const QString&color);
  1564. void updateAxisSetting(const QString&gridList);
  1565. void updateUnit(int unit);
  1566. void showColorPicker();
  1567. private:
  1568. QLineEdit*colorEdit;
  1569. };
  1570. /*:866*//*870:*/
  1571. #line 7 "./advancedsettings.w"
  1572. class AdvancedSettingsWidget:public QWidget
  1573. {
  1574. Q_OBJECT
  1575. public:
  1576. AdvancedSettingsWidget();
  1577. public slots:
  1578. void enableDiagnosticLogging(bool enabled);
  1579. };
  1580. /*:870*//*874:*/
  1581. #line 18345 "./typica.w"
  1582. class ModbusRTUDevice:public QObject
  1583. {
  1584. Q_OBJECT
  1585. public:
  1586. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1587. ~ModbusRTUDevice();
  1588. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1589. Q_INVOKABLE double SVLower();
  1590. Q_INVOKABLE double SVUpper();
  1591. Q_INVOKABLE int decimals();
  1592. QList<Channel*> channels;
  1593. public slots:
  1594. void outputSV(double sv);
  1595. signals:
  1596. void SVLowerChanged(double);
  1597. void SVUpperChanged(double);
  1598. void SVDecimalChanged(int);
  1599. void queueEmpty();
  1600. private slots:
  1601. void dataAvailable();
  1602. void sendNextMessage();
  1603. void decimalResponse(QByteArray response);
  1604. void unitResponse(QByteArray response);
  1605. void svlResponse(QByteArray response);
  1606. void svuResponse(QByteArray response);
  1607. void requestMeasurement();
  1608. void mResponse(QByteArray response);
  1609. void ignore(QByteArray response);
  1610. void timeout();
  1611. private:
  1612. QextSerialPort*port;
  1613. QByteArray responseBuffer;
  1614. QList<QByteArray> messageQueue;
  1615. QList<QObject*> retObjQueue;
  1616. QList<char*> callbackQueue;
  1617. quint16 calculateCRC(QByteArray data);
  1618. QTimer*messageDelayTimer;
  1619. QTimer*commTimeout;
  1620. int delayTime;
  1621. char station;
  1622. int decimalPosition;
  1623. int valueF;
  1624. int valueC;
  1625. bool unitIsF;
  1626. double outputSVLower;
  1627. double outputSVUpper;
  1628. QByteArray outputSVStub;
  1629. QByteArray pvStub;
  1630. QByteArray svStub;
  1631. QByteArray mStub;
  1632. quint16 pvaddress;
  1633. quint16 svaddress;
  1634. bool svenabled;
  1635. bool readingsv;
  1636. double savedpv;
  1637. bool waiting;
  1638. };
  1639. /*:874*//*890:*/
  1640. #line 19048 "./typica.w"
  1641. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1642. {
  1643. Q_OBJECT
  1644. public:
  1645. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1646. private slots:
  1647. void updatePort(const QString&newPort);
  1648. void updateBaudRate(const QString&newRate);
  1649. void updateParity(const QString&newParity);
  1650. void updateFlowControl(const QString&newFlow);
  1651. void updateStopBits(const QString&newStopBits);
  1652. void updateStation(int station);
  1653. void updateFixedDecimal(bool fixed);
  1654. void updateDecimalAddress(int address);
  1655. void updateDecimalPosition(int position);
  1656. void updateFixedUnit(bool fixed);
  1657. void updateUnitAddress(int address);
  1658. void updateValueForF(int value);
  1659. void updateValueForC(int value);
  1660. void updateUnit(const QString&newUnit);
  1661. void updatePVAddress(int address);
  1662. void updateSVEnabled(bool enabled);
  1663. void updateSVReadAddress(int address);
  1664. void updateDeviceLimit(bool query);
  1665. void updateSVLowerAddress(int address);
  1666. void updateSVUpperAddress(int address);
  1667. void updateSVLower(double value);
  1668. void updateSVUpper(double value);
  1669. void updateSVWritable(bool canWriteSV);
  1670. void updateSVWriteAddress(int address);
  1671. void updatePVColumnName(const QString&name);
  1672. void updateSVColumnName(const QString&name);
  1673. void updatePVHidden(bool hidden);
  1674. void updateSVHidden(bool hidden);
  1675. private:
  1676. PortSelector*port;
  1677. BaudSelector*baud;
  1678. ParitySelector*parity;
  1679. FlowSelector*flow;
  1680. StopSelector*stop;
  1681. QSpinBox*station;
  1682. QCheckBox*decimalQuery;
  1683. ShortHexSpinBox*decimalAddress;
  1684. QSpinBox*decimalPosition;
  1685. QCheckBox*unitQuery;
  1686. ShortHexSpinBox*unitAddress;
  1687. QSpinBox*valueF;
  1688. QSpinBox*valueC;
  1689. QComboBox*fixedUnit;
  1690. ShortHexSpinBox*pVAddress;
  1691. QCheckBox*sVEnabled;
  1692. ShortHexSpinBox*sVReadAddress;
  1693. QCheckBox*deviceLimit;
  1694. ShortHexSpinBox*sVLowerAddr;
  1695. ShortHexSpinBox*sVUpperAddr;
  1696. QDoubleSpinBox*sVLower;
  1697. QDoubleSpinBox*sVUpper;
  1698. QCheckBox*sVWritable;
  1699. ShortHexSpinBox*sVOutputAddr;
  1700. QLineEdit*pVColumnName;
  1701. QLineEdit*sVColumnName;
  1702. };
  1703. /*:890*//*894:*/
  1704. #line 22 "./modbus.w"
  1705. class ModbusNGConfWidget:public BasicDeviceConfigurationWidget
  1706. {
  1707. Q_OBJECT
  1708. public:
  1709. Q_INVOKABLE ModbusNGConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1710. private slots:
  1711. void updatePort(const QString&value);
  1712. void updateBaudRate(const QString&value);
  1713. void updateParity(int value);
  1714. void updateFlowControl(int value);
  1715. void updateStopBits(int value);
  1716. void addInput();
  1717. private:
  1718. ParitySelector*m_parity;
  1719. FlowSelector*m_flow;
  1720. StopSelector*m_stop;
  1721. };
  1722. /*:894*//*896:*/
  1723. #line 144 "./modbus.w"
  1724. class ModbusNGInputConfWidget:public BasicDeviceConfigurationWidget
  1725. {
  1726. Q_OBJECT
  1727. public:
  1728. Q_INVOKABLE ModbusNGInputConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1729. private slots:
  1730. void updateStation(int value);
  1731. void updateAddress(int value);
  1732. void updateFunction(int value);
  1733. void updateFormat(int value);
  1734. void updateDecimals(int value);
  1735. void updateUnit(int value);
  1736. void updateColumnName(const QString&value);
  1737. void updateHidden(bool value);
  1738. };
  1739. /*:896*//*900:*/
  1740. #line 342 "./modbus.w"
  1741. enum ModbusDataFormat
  1742. {
  1743. Int16,
  1744. FloatHL,
  1745. FloatLH
  1746. };
  1747. struct ModbusScanItem
  1748. {
  1749. QByteArray request;
  1750. ModbusDataFormat format;
  1751. int decimalPosition;
  1752. Units::Unit unit;
  1753. mutable double lastValue;
  1754. };
  1755. /*:900*//*901:*/
  1756. #line 362 "./modbus.w"
  1757. class ModbusNG:public QObject
  1758. {
  1759. Q_OBJECT
  1760. public:
  1761. ModbusNG(DeviceTreeModel*model,const QModelIndex&index);
  1762. ~ModbusNG();
  1763. Q_INVOKABLE int channelCount();
  1764. Channel*getChannel(int);
  1765. Q_INVOKABLE QString channelColumnName(int);
  1766. Q_INVOKABLE QString channelIndicatorText(int);
  1767. Q_INVOKABLE bool isChannelHidden(int);
  1768. Q_INVOKABLE QString channelType(int);
  1769. private slots:
  1770. void sendNextMessage();
  1771. void timeout();
  1772. void dataAvailable();
  1773. void rateLimitTimeout();
  1774. private:
  1775. quint16 calculateCRC(QByteArray data);
  1776. QextSerialPort*port;
  1777. int delayTime;
  1778. QTimer*messageDelayTimer;
  1779. QTimer*commTimeout;
  1780. QTimer*rateLimiter;
  1781. int scanPosition;
  1782. bool waiting;
  1783. QByteArray responseBuffer;
  1784. QList<Channel*> channels;
  1785. QList<ModbusScanItem> scanList;
  1786. QList<QString> channelNames;
  1787. QList<QString> channelLabels;
  1788. QList<bool> hiddenStates;
  1789. QList<QString> channelTypeList;
  1790. QVector<double> lastMeasurement;
  1791. };
  1792. /*:901*//*906:*/
  1793. #line 36 "./unsupportedserial.w"
  1794. class UnsupportedSerialDeviceConfWidget:public BasicDeviceConfigurationWidget
  1795. {
  1796. Q_OBJECT
  1797. public:
  1798. Q_INVOKABLE UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  1799. const QModelIndex&index);
  1800. private slots:
  1801. void updateConfiguration();
  1802. void saveScript();
  1803. void addChannel();
  1804. private:
  1805. SaltModel*deviceSettingsModel;
  1806. QTextEdit*scriptEditor;
  1807. };
  1808. /*:906*//*911:*/
  1809. #line 166 "./unsupportedserial.w"
  1810. class UnsupportedDeviceChannelConfWidget:public BasicDeviceConfigurationWidget
  1811. {
  1812. Q_OBJECT
  1813. public:
  1814. Q_INVOKABLE UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  1815. const QModelIndex&index);
  1816. private slots:
  1817. void updateColumnName(const QString&value);
  1818. void updateHidden(bool hidden);
  1819. void updateConfiguration();
  1820. private:
  1821. SaltModel*channelSettingsModel;
  1822. };
  1823. /*:911*//*916:*/
  1824. #line 298 "./unsupportedserial.w"
  1825. class JavaScriptDevice:public QObject
  1826. {
  1827. Q_OBJECT
  1828. public:
  1829. Q_INVOKABLE JavaScriptDevice(const QModelIndex&deviceIndex,
  1830. QScriptEngine*engine);
  1831. Q_INVOKABLE int channelCount();
  1832. Channel*getChannel(int channel);
  1833. Q_INVOKABLE bool isChannelHidden(int channel);
  1834. Q_INVOKABLE Units::Unit expectedChannelUnit(int channel);
  1835. Q_INVOKABLE QString channelColumnName(int channel);
  1836. Q_INVOKABLE QString channelIndicatorText(int channel);
  1837. public slots:
  1838. void setTemperatureColumn(int tcol);
  1839. void setAnnotationColumn(int ncol);
  1840. void start();
  1841. void stop();
  1842. signals:
  1843. void annotation(QString note,int tcol,int ncol);
  1844. void triggerStartBatch();
  1845. void triggerStopBatch();
  1846. void deviceStopRequested();
  1847. private:
  1848. QVariantMap deviceSettings;
  1849. QString deviceScript;
  1850. QList<Channel*> channelList;
  1851. QList<bool> hiddenState;
  1852. QList<Units::Unit> channelUnits;
  1853. QList<QString> columnNames;
  1854. QList<QString> indicatorTexts;
  1855. QList<QVariantMap> channelSettings;
  1856. int annotationTemperatureColumn;
  1857. int annotationNoteColumn;
  1858. QScriptEngine*scriptengine;
  1859. };
  1860. /*:916*//*938:*/
  1861. #line 11 "./phidgets.w"
  1862. class PhidgetsTemperatureSensorConfWidget:public BasicDeviceConfigurationWidget
  1863. {
  1864. Q_OBJECT
  1865. public:
  1866. Q_INVOKABLE PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  1867. const QModelIndex&index);
  1868. private slots:
  1869. void addChannel();
  1870. void updateRate(int ms);
  1871. };
  1872. /*:938*//*942:*/
  1873. #line 82 "./phidgets.w"
  1874. class PhidgetTemperatureSensorChannelConfWidget:public BasicDeviceConfigurationWidget
  1875. {
  1876. Q_OBJECT
  1877. public:
  1878. Q_INVOKABLE PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel*model,
  1879. const QModelIndex&index);
  1880. private slots:
  1881. void updateColumnName(const QString&value);
  1882. void updateHidden(bool hidden);
  1883. void updateTC(int index);
  1884. void updateChannel(int channel);
  1885. private:
  1886. QComboBox*tcType;
  1887. };
  1888. /*:942*//*947:*/
  1889. #line 213 "./phidgets.w"
  1890. class PhidgetsTemperatureSensor:public QObject
  1891. {
  1892. Q_OBJECT
  1893. public:
  1894. Q_INVOKABLE PhidgetsTemperatureSensor(const QModelIndex&deviceIndex);
  1895. Q_INVOKABLE int channelCount();
  1896. Channel*getChannel(int channel);
  1897. Q_INVOKABLE bool isChannelHidden(int channel);
  1898. Q_INVOKABLE QString channelColumnName(int channel);
  1899. Q_INVOKABLE QString channelIndicatorText(int channel);
  1900. public slots:
  1901. void start();
  1902. void stop();
  1903. private slots:
  1904. void getMeasurements();
  1905. private:
  1906. QList<int> channelIndices;
  1907. QList<int> tctypes;
  1908. QList<Channel*> channelList;
  1909. QMap<int,Channel*> channelMap;
  1910. QList<bool> hiddenState;
  1911. QList<QString> columnNames;
  1912. QList<QString> indicatorTexts;
  1913. QLibrary driver;
  1914. QTimer sampleTimer;
  1915. void*device;
  1916. /*951:*/
  1917. #line 349 "./phidgets.w"
  1918. #ifdef _WIN32
  1919. typedef int(__stdcall*PhidgetHandleOnly)(void*);
  1920. typedef int(__stdcall*PhidgetHandleInt)(void*,int);
  1921. typedef int(__stdcall*PhidgetHandleIntInt)(void*,int,int);
  1922. typedef int(__stdcall*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1923. #else
  1924. typedef int(*PhidgetHandleOnly)(void*);
  1925. typedef int(*PhidgetHandleInt)(void*,int);
  1926. typedef int(*PhidgetHandleIntInt)(void*,int,int);
  1927. typedef int(*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1928. #endif
  1929. PhidgetHandleOnly createDevice;
  1930. PhidgetHandleInt openDevice;
  1931. PhidgetHandleInt waitForOpen;
  1932. PhidgetHandleIntInt setTCType;
  1933. PhidgetHandleIntDoubleOut getTemperature;
  1934. PhidgetHandleOnly closeDevice;
  1935. PhidgetHandleOnly deleteDevice;
  1936. /*:951*/
  1937. #line 240 "./phidgets.w"
  1938. };
  1939. /*:947*//*960:*/
  1940. #line 19588 "./typica.w"
  1941. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1942. {
  1943. Q_OBJECT
  1944. public:
  1945. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1946. const QModelIndex&index);
  1947. private slots:
  1948. void updateSourceColumn(const QString&source);
  1949. void updateDestinationColumn(const QString&dest);
  1950. void updateKnots();
  1951. private:
  1952. SaltModel*tablemodel;
  1953. };
  1954. /*:960*//*966:*/
  1955. #line 19718 "./typica.w"
  1956. class CoolingTimerConfWidget:public BasicDeviceConfigurationWidget
  1957. {
  1958. Q_OBJECT
  1959. public:
  1960. Q_INVOKABLE CoolingTimerConfWidget(DeviceTreeModel*model,
  1961. const QModelIndex&index);
  1962. private slots:
  1963. void updateResetTime(QTime time);
  1964. };
  1965. /*:966*//*970:*/
  1966. #line 19784 "./typica.w"
  1967. class RangeTimerConfWidget:public BasicDeviceConfigurationWidget
  1968. {
  1969. Q_OBJECT
  1970. public:
  1971. Q_INVOKABLE RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1972. private slots:
  1973. void updateStartButtonText(const QString&text);
  1974. void updateStopButtonText(const QString&text);
  1975. void updateStartColumnName(const QString&text);
  1976. void updateStopColumnName(const QString&text);
  1977. void updateStartValue(const QString&text);
  1978. void updateStopValue(const QString&text);
  1979. void updateStartTrigger(int option);
  1980. void updateStopTrigger(int option);
  1981. };
  1982. /*:970*//*975:*/
  1983. #line 20036 "./typica.w"
  1984. class MultiRangeTimerConfWidget:public BasicDeviceConfigurationWidget
  1985. {
  1986. Q_OBJECT
  1987. public:
  1988. Q_INVOKABLE MultiRangeTimerConfWidget(DeviceTreeModel*model,
  1989. const QModelIndex&index);
  1990. private slots:
  1991. void updateColumnName(const QString&text);
  1992. void updateRangeData();
  1993. private:
  1994. SaltModel*tablemodel;
  1995. };
  1996. /*:975*//*980:*/
  1997. #line 20138 "./typica.w"
  1998. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1999. {
  2000. Q_OBJECT
  2001. public:
  2002. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  2003. private slots:
  2004. void updateMatchingColumn(const QString&column);
  2005. void updateTemperature();
  2006. void updateDelay();
  2007. private:
  2008. QDoubleSpinBox*temperatureValue;
  2009. QComboBox*unitSelector;
  2010. QSpinBox*delaySelector;
  2011. };
  2012. /*:980*//*984:*/
  2013. #line 16 "./rate.w"
  2014. class RateOfChange:public QObject
  2015. {
  2016. Q_OBJECT
  2017. public:
  2018. RateOfChange(int cachetime= 1,int scaletime= 1);
  2019. public slots:
  2020. void newMeasurement(Measurement measure);
  2021. void setCacheTime(int seconds);
  2022. void setScaleTime(int seconds);
  2023. signals:
  2024. void newData(Measurement measure);
  2025. private:
  2026. int ct;
  2027. int st;
  2028. QList<Measurement> cache;
  2029. };
  2030. /*:984*//*992:*/
  2031. #line 177 "./rate.w"
  2032. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  2033. {
  2034. Q_OBJECT
  2035. public:
  2036. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  2037. private slots:
  2038. void updateColumn(const QString&column);
  2039. void updateCacheTime(const QString&seconds);
  2040. void updateScaleTime(const QString&seconds);
  2041. };
  2042. /*:992*//*998:*/
  2043. #line 15 "./mergeseries.w"
  2044. class MergeSeries:public QObject
  2045. {
  2046. Q_OBJECT
  2047. public:
  2048. MergeSeries();
  2049. public slots:
  2050. void in1(Measurement measure);
  2051. void in2(Measurement measure);
  2052. signals:
  2053. void newData(Measurement measure);
  2054. protected:
  2055. virtual void calculate(Measurement m1,Measurement m2)= 0;
  2056. private:
  2057. Measurement last1;
  2058. Measurement last2;
  2059. bool received1;
  2060. bool received2;
  2061. };
  2062. class DifferenceSeries:public MergeSeries
  2063. {
  2064. Q_OBJECT
  2065. public:
  2066. DifferenceSeries();
  2067. protected:
  2068. void calculate(Measurement m1,Measurement m2);
  2069. };
  2070. class MeanSeries:public MergeSeries
  2071. {
  2072. Q_OBJECT
  2073. public:
  2074. MeanSeries();
  2075. protected:
  2076. void calculate(Measurement m1,Measurement m2);
  2077. };
  2078. /*:998*//*1006:*/
  2079. #line 167 "./mergeseries.w"
  2080. class MergeSeriesConfWidget:public BasicDeviceConfigurationWidget
  2081. {
  2082. Q_OBJECT
  2083. public:
  2084. Q_INVOKABLE MergeSeriesConfWidget(DeviceTreeModel*model,
  2085. const QModelIndex&index);
  2086. private slots:
  2087. void updateColumn1(const QString&column);
  2088. void updateColumn2(const QString&column);
  2089. void updateOutput(const QString&column);
  2090. void updateType(int type);
  2091. };
  2092. /*:1006*//*1012:*/
  2093. #line 19 "./dataqsdk.w"
  2094. class DataqSdkDeviceImplementation;
  2095. class DataqSdkDevice:public QObject
  2096. {
  2097. Q_OBJECT
  2098. DataqSdkDeviceImplementation*imp;
  2099. private slots:
  2100. void threadFinished();
  2101. public:
  2102. DataqSdkDevice(QString device);
  2103. ~DataqSdkDevice();
  2104. Channel*newChannel(Units::Unit scale);
  2105. Q_INVOKABLE void setClockRate(double Hz);
  2106. Q_INVOKABLE void start();
  2107. static QStringList detectPorts();
  2108. static QStringList detectHardware();
  2109. };
  2110. /*:1012*//*1013:*/
  2111. #line 49 "./dataqsdk.w"
  2112. class DataqSdkDeviceImplementation:public QThread
  2113. {
  2114. Q_OBJECT
  2115. public:
  2116. DataqSdkDeviceImplementation();
  2117. ~DataqSdkDeviceImplementation();
  2118. void run();
  2119. /*1014:*/
  2120. #line 70 "./dataqsdk.w"
  2121. typedef struct di_inlist_struct{
  2122. unsigned short chan;
  2123. unsigned short diff;
  2124. unsigned short gain;
  2125. unsigned short unipolar;
  2126. unsigned short dig_out_enable;
  2127. unsigned short dig_out;
  2128. unsigned short ave;
  2129. unsigned short counter;
  2130. }DI_INLIST_STRUCT;
  2131. typedef int(PASCAL*FPDIOPEN)(unsigned);
  2132. typedef int(PASCAL*FPDICLOSE)(void);
  2133. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  2134. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  2135. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  2136. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  2137. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  2138. typedef int(PASCAL*FPDISTARTSCAN)(void);
  2139. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  2140. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  2141. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  2142. typedef int(PASCAL*FPDISTOPSCAN)(void);
  2143. FPDIOPEN di_open;
  2144. FPDICLOSE di_close;
  2145. FPDISAMPLERATE di_sample_rate;
  2146. FPDIMAXIMUMRATE di_maximum_rate;
  2147. FPDILISTLENGTH di_list_length;
  2148. FPDIINLIST di_inlist;
  2149. FPDIBUFFERALLOC di_buffer_alloc;
  2150. FPDISTARTSCAN di_start_scan;
  2151. FPDISTATUSREAD di_status_read;
  2152. FPDIBUFFERSTATUS di_buffer_status;
  2153. FPDIBURSTRATE di_burst_rate;
  2154. FPDISTOPSCAN di_stop_scan;
  2155. /*:1014*/
  2156. #line 57 "./dataqsdk.w"
  2157. /*1016:*/
  2158. #line 134 "./dataqsdk.w"
  2159. bool isOpen;
  2160. double sampleRate;
  2161. long oversample;
  2162. long burstDivisor;
  2163. QString device;
  2164. unsigned deviceNumber;
  2165. QVector<Channel*> channelMap;
  2166. int error;
  2167. int channels;
  2168. bool ready;
  2169. QLibrary*driver;
  2170. QVector<Units::Unit> unitMap;
  2171. int*input_buffer;
  2172. QTimer*eventClock;
  2173. QMultiMap<int,double> smoother;
  2174. /*:1016*/
  2175. #line 58 "./dataqsdk.w"
  2176. public slots:
  2177. void measure();
  2178. private:
  2179. qint16*buffer;
  2180. };
  2181. /*:1013*//*1033:*/
  2182. #line 663 "./dataqsdk.w"
  2183. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  2184. {
  2185. Q_OBJECT
  2186. public:
  2187. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  2188. const QModelIndex&index);
  2189. private slots:
  2190. void updateAutoSelect(bool automatic);
  2191. void updateDeviceNumber(int deviceNumber);
  2192. void updatePort(QString portId);
  2193. void addChannel();
  2194. private:
  2195. QStackedWidget*deviceIdStack;
  2196. };
  2197. /*:1033*//*1038:*/
  2198. #line 808 "./dataqsdk.w"
  2199. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  2200. {
  2201. Q_OBJECT
  2202. public:
  2203. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  2204. const QModelIndex&index);
  2205. private slots:
  2206. void updateUnits(const QString&unit);
  2207. void updateColumnName(const QString&value);
  2208. void updateMeasuredLower(const QString&value);
  2209. void updateMeasuredUpper(const QString&value);
  2210. void updateMappedLower(const QString&value);
  2211. void updateMappedUpper(const QString&value);
  2212. void updateClosedInterval(bool closed);
  2213. void updateSmoothingEnabled(bool enabled);
  2214. void updateSensitivity(const QString&value);
  2215. void startCalibration();
  2216. void stopCalibration();
  2217. void resetCalibration();
  2218. void updateInput(Measurement measure);
  2219. void updateOutput(Measurement measure);
  2220. void updateHidden(bool hidden);
  2221. private:
  2222. QPushButton*startButton;
  2223. QPushButton*resetButton;
  2224. QPushButton*stopButton;
  2225. /*1043:*/
  2226. #line 1098 "./dataqsdk.w"
  2227. bool autoSelect;
  2228. QString deviceID;
  2229. unsigned int channelOfInterest;
  2230. /*:1043*/
  2231. #line 835 "./dataqsdk.w"
  2232. DataqSdkDevice*calibrationDevice;
  2233. LinearCalibrator*calibrator;
  2234. QLineEdit*currentMeasurement;
  2235. QLineEdit*minimumMeasurement;
  2236. QLineEdit*maximumMeasurement;
  2237. QLineEdit*averageMeasurement;
  2238. QLineEdit*currentMapped;
  2239. QLineEdit*minimumMapped;
  2240. QLineEdit*maximumMapped;
  2241. QLineEdit*averageMapped;
  2242. int rmCount;
  2243. int cmCount;
  2244. double rmin;
  2245. double rmax;
  2246. double rmean;
  2247. double cmin;
  2248. double cmax;
  2249. double cmean;
  2250. };
  2251. /*:1038*//*1065:*/
  2252. #line 273 "./scales.w"
  2253. Q_DECLARE_METATYPE(BaudRateType)
  2254. Q_DECLARE_METATYPE(DataBitsType)
  2255. Q_DECLARE_METATYPE(ParityType)
  2256. Q_DECLARE_METATYPE(StopBitsType)
  2257. Q_DECLARE_METATYPE(FlowType)
  2258. /*:1065*//*1072:*/
  2259. #line 396 "./scales.w"
  2260. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  2261. {
  2262. Q_OBJECT
  2263. public:
  2264. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  2265. const QModelIndex&index);
  2266. private slots:
  2267. void updatePort(const QString&newPort);
  2268. void updateBaudRate(const QString&rate);
  2269. void updateParity(int index);
  2270. void updateFlowControl(int index);
  2271. void updateStopBits(int index);
  2272. void updateWeighCommand(const QString&command);
  2273. void updateCommandTerminator(const QString&terminator);
  2274. private:
  2275. PortSelector*port;
  2276. BaudSelector*baud;
  2277. ParitySelector*parity;
  2278. FlowSelector*flow;
  2279. StopSelector*stop;
  2280. QLineEdit*weighcommand;
  2281. QComboBox*commandterminator;
  2282. };
  2283. /*:1072*//*1077:*/
  2284. #line 14 "./valueannotation.w"
  2285. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  2286. {
  2287. Q_OBJECT
  2288. public:
  2289. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  2290. const QModelIndex&index);
  2291. private slots:
  2292. void updateSourceColumn(const QString&source);
  2293. void updateAnnotations();
  2294. void updateStart(bool noteOnStart);
  2295. private:
  2296. SaltModel*tablemodel;
  2297. };
  2298. /*:1077*//*1085:*/
  2299. #line 165 "./valueannotation.w"
  2300. class ValueAnnotation:public QObject
  2301. {
  2302. Q_OBJECT
  2303. public:
  2304. ValueAnnotation();
  2305. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  2306. public slots:
  2307. void newMeasurement(Measurement measure);
  2308. void annotate();
  2309. void setAnnotationColumn(int column);
  2310. void setTemperatureColumn(int column);
  2311. void setTolerance(double epsilon);
  2312. signals:
  2313. void annotation(QString annotation,int tempcolumn,int notecolumn);
  2314. private:
  2315. int lastIndex;
  2316. int annotationColumn;
  2317. int measurementColumn;
  2318. QList<double> values;
  2319. QStringList annotations;
  2320. double tolerance;
  2321. };
  2322. /*:1085*//*1094:*/
  2323. #line 14 "./thresholdannotation.w"
  2324. class ThresholdAnnotationConfWidget:public BasicDeviceConfigurationWidget
  2325. {
  2326. Q_OBJECT
  2327. public:
  2328. Q_INVOKABLE ThresholdAnnotationConfWidget(DeviceTreeModel*model,
  2329. const QModelIndex&index);
  2330. private slots:
  2331. void updateSourceColumn(const QString&source);
  2332. void updateThreshold(double value);
  2333. void updateDirection(int index);
  2334. void updateAnnotation(const QString&note);
  2335. };
  2336. /*:1094*//*1099:*/
  2337. #line 127 "./thresholdannotation.w"
  2338. class Annotator:public QObject
  2339. {
  2340. Q_OBJECT
  2341. QString note;
  2342. int tc;
  2343. int ac;
  2344. QTimer t;
  2345. public:
  2346. Annotator(const QString&text);
  2347. public slots:
  2348. void setAnnotation(const QString&annotation);
  2349. void setTemperatureColumn(int tempcolumn);
  2350. void setAnnotationColumn(int annotationcolumn);
  2351. void annotate();
  2352. private slots:
  2353. void catchTimer();
  2354. signals:
  2355. void annotation(QString annotation,int tempcolumn,int notecolumn);
  2356. };
  2357. /*:1099*/
  2358. #line 526 "./typica.w"
  2359. /*12:*/
  2360. #line 811 "./typica.w"
  2361. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  2362. QScriptValue QObject_setProperty(QScriptContext*context,QScriptEngine*engine);
  2363. /*:12*//*14:*/
  2364. #line 836 "./typica.w"
  2365. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2366. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  2367. /*:14*//*19:*/
  2368. #line 896 "./typica.w"
  2369. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2370. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  2371. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  2372. QScriptValue QWidget_activateWindow(QScriptContext*context,
  2373. QScriptEngine*engine);
  2374. /*:19*//*23:*/
  2375. #line 986 "./typica.w"
  2376. QScriptValue displayWarning(QScriptContext*context,QScriptEngine*engine);
  2377. QScriptValue displayError(QScriptContext*context,QScriptEngine*engine);
  2378. /*:23*//*33:*/
  2379. #line 1203 "./typica.w"
  2380. QScriptValue constructQMainWindow(QScriptContext*context,
  2381. QScriptEngine*engine);
  2382. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  2383. QScriptEngine*engine);
  2384. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  2385. QScriptEngine*engine);
  2386. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  2387. /*:33*//*38:*/
  2388. #line 1302 "./typica.w"
  2389. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  2390. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  2391. /*:38*//*41:*/
  2392. #line 1347 "./typica.w"
  2393. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  2394. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  2395. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  2396. /*:41*//*44:*/
  2397. #line 1413 "./typica.w"
  2398. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  2399. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  2400. /*:44*//*47:*/
  2401. #line 1446 "./typica.w"
  2402. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  2403. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  2404. /*:47*//*50:*/
  2405. #line 1484 "./typica.w"
  2406. void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2407. QScriptValue constructQSvgWidget(QScriptContext*context,
  2408. QScriptEngine*engine);
  2409. QScriptValue QSvgWidget_loadDevice(QScriptContext*context,
  2410. QScriptEngine*engine);
  2411. void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2412. QStack<QLayout*> *layoutStack);
  2413. /*:50*//*56:*/
  2414. #line 1571 "./typica.w"
  2415. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  2416. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  2417. /*:56*//*60:*/
  2418. #line 1610 "./typica.w"
  2419. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  2420. QScriptValue QSplitter_addWidget(QScriptContext*context,
  2421. QScriptEngine*engine);
  2422. QScriptValue QSplitter_saveState(QScriptContext*context,
  2423. QScriptEngine*engine);
  2424. QScriptValue QSplitter_restoreState(QScriptContext*context,
  2425. QScriptEngine*engine);
  2426. QScriptValue QSplitter_count(QScriptContext*context,
  2427. QScriptEngine*engine);
  2428. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  2429. /*:60*//*66:*/
  2430. #line 1749 "./typica.w"
  2431. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2432. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2433. /*:66*//*68:*/
  2434. #line 1804 "./typica.w"
  2435. QScriptValue constructQBoxLayout(QScriptContext*context,
  2436. QScriptEngine*engine);
  2437. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2438. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  2439. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2440. /*:68*//*72:*/
  2441. #line 1917 "./typica.w"
  2442. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  2443. QScriptValue QAction_setShortcut(QScriptContext*context,
  2444. QScriptEngine*engine);
  2445. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  2446. /*:72*//*75:*/
  2447. #line 1973 "./typica.w"
  2448. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  2449. QScriptEngine*engine);
  2450. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  2451. QScriptEngine*engine);
  2452. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2453. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2454. /*:75*//*80:*/
  2455. #line 2084 "./typica.w"
  2456. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2457. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2458. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2459. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2460. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2461. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2462. QScriptValue QIODevice_readToString(QScriptContext*context,
  2463. QScriptEngine*engine);
  2464. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*engine);
  2465. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*engine);
  2466. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*engine);
  2467. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine);
  2468. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine);
  2469. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine);
  2470. /*:80*//*91:*/
  2471. #line 2310 "./typica.w"
  2472. QScriptValue constructQProcess(QScriptContext*context,QScriptEngine*engine);
  2473. void setQProcessProperties(QScriptValue value,QScriptEngine*engine);
  2474. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*engine);
  2475. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*engine);
  2476. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*engine);
  2477. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*engine);
  2478. /*:91*//*99:*/
  2479. #line 2428 "./typica.w"
  2480. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes);
  2481. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes);
  2482. QScriptValue constructQByteArray(QScriptContext*context,QScriptEngine*engine);
  2483. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine);
  2484. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine);
  2485. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*engine);
  2486. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*engine);
  2487. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine);
  2488. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine);
  2489. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*engine);
  2490. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine);
  2491. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine);
  2492. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine);
  2493. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*engine);
  2494. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine);
  2495. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*engine);
  2496. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*engine);
  2497. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*engine);
  2498. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*engine);
  2499. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*engine);
  2500. /*:99*//*112:*/
  2501. #line 2702 "./typica.w"
  2502. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine);
  2503. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine);
  2504. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine);
  2505. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine);
  2506. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine);
  2507. /*:112*//*115:*/
  2508. #line 2807 "./typica.w"
  2509. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2510. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2511. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2512. /*:115*//*118:*/
  2513. #line 2852 "./typica.w"
  2514. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2515. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2516. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2517. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2518. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2519. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2520. /*:118*//*124:*/
  2521. #line 2934 "./typica.w"
  2522. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2523. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2524. QScriptEngine*engine);
  2525. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2526. QScriptEngine*engine);
  2527. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2528. QScriptEngine*engine);
  2529. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2530. QScriptEngine*engine);
  2531. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2532. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2533. QScriptEngine*engine);
  2534. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2535. QScriptEngine*engine);
  2536. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2537. QScriptEngine*engine);
  2538. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2539. QScriptEngine*engine);
  2540. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2541. QScriptEngine*engine);
  2542. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2543. QScriptEngine*engine);
  2544. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2545. QScriptEngine*engine);
  2546. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2547. QScriptEngine*engine);
  2548. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2549. /*:124*//*133:*/
  2550. #line 3152 "./typica.w"
  2551. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2552. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2553. QScriptValue XmlReader_attribute(QScriptContext*context,
  2554. QScriptEngine*engine);
  2555. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2556. QScriptEngine*engine);
  2557. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2558. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2559. QScriptEngine*engine);
  2560. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2561. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2562. QScriptEngine*engine);
  2563. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2564. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2565. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2566. /*:133*//*140:*/
  2567. #line 3287 "./typica.w"
  2568. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2569. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2570. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2571. /*:140*//*144:*/
  2572. #line 3369 "./typica.w"
  2573. QScriptValue constructQLCDNumber(QScriptContext*context,
  2574. QScriptEngine*engine);
  2575. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2576. /*:144*//*147:*/
  2577. #line 3407 "./typica.w"
  2578. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2579. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2580. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2581. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2582. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2583. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2584. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2585. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2586. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2587. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2588. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2589. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2590. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2591. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2592. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2593. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2594. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2595. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2596. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2597. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2598. /*:147*//*163:*/
  2599. #line 3885 "./typica.w"
  2600. void setQAbstractScrollAreaProperties(QScriptValue value,
  2601. QScriptEngine*engine);
  2602. /*:163*//*165:*/
  2603. #line 3900 "./typica.w"
  2604. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2605. /*:165*//*167:*/
  2606. #line 3913 "./typica.w"
  2607. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2608. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2609. /*:167*//*169:*/
  2610. #line 3937 "./typica.w"
  2611. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2612. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2613. QScriptValue constructQPushButton(QScriptContext*context,
  2614. QScriptEngine*engine);
  2615. /*:169*//*176:*/
  2616. #line 4036 "./typica.w"
  2617. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2618. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2619. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2620. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2621. QScriptEngine*engine);
  2622. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2623. QScriptEngine*engine);
  2624. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2625. QScriptEngine*engine);
  2626. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2627. QScriptEngine*engine);
  2628. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2629. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2630. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2631. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2632. /*:176*//*183:*/
  2633. #line 4207 "./typica.w"
  2634. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2635. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2636. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2637. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2638. QScriptValue annotationFromRecord(QScriptContext*context,
  2639. QScriptEngine*engine);
  2640. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2641. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*engine);
  2642. QScriptValue scriptTr(QScriptContext*context,QScriptEngine*engine);
  2643. /*:183*//*196:*/
  2644. #line 4554 "./typica.w"
  2645. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2646. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2647. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2648. QStack<QLayout*> *layoutStack);
  2649. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2650. QStack<QLayout*> *layoutStack);
  2651. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2652. QStack<QLayout*> *layoutStack);
  2653. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2654. QStack<QLayout*> *layoutStack);
  2655. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2656. QStack<QLayout*> *layoutStack);
  2657. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2658. QStack<QLayout*> *layoutStack);
  2659. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2660. QStack<QLayout*> *layoutStack);
  2661. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2662. QStack<QLayout*> *layoutStack);
  2663. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2664. QStack<QLayout*> *layoutStack);
  2665. void addTemperatureDisplayToSplitter(QDomElement element,
  2666. QStack<QWidget*> *widgetStack,
  2667. QStack<QLayout*> *layoutStack);
  2668. void addTemperatureDisplayToLayout(QDomElement element,
  2669. QStack<QWidget*> *widgetStack,
  2670. QStack<QLayout*> *layoutStack);
  2671. void addTimerDisplayToSplitter(QDomElement element,
  2672. QStack<QWidget*> *widgetStack,
  2673. QStack<QLayout*> *layoutStack);
  2674. void addTimerDisplayToLayout(QDomElement element,
  2675. QStack<QWidget*> *widgetStack,
  2676. QStack<QLayout*> *layoutStack);
  2677. void addDecorationToSplitter(QDomElement element,
  2678. QStack<QWidget*> *widgetStack,
  2679. QStack<QLayout*> *layoutStack);
  2680. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2681. QStack<QLayout*> *layoutStack);
  2682. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2683. QStack<QLayout*> *layoutStack);
  2684. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2685. QStack<QLayout*> *layoutStack);
  2686. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2687. QStack<QLayout*> *layoutStack);
  2688. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2689. QStack<QLayout*> *layoutStack);
  2690. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2691. QStack<QLayout*> *layoutStack);
  2692. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2693. QStack<QLayout*> *layoutStack);
  2694. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2695. QStack<QLayout*> *layoutStack);
  2696. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2697. QStack<QLayout*> *layoutStack);
  2698. void addSqlQueryViewToLayout(QDomElement element,
  2699. QStack<QWidget*> *widgetStack,
  2700. QStack<QLayout*> *layoutStack);
  2701. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2702. QStack<QLayout*> *layoutStack);
  2703. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2704. QStack<QLayout*> *layoutStack);
  2705. void addTimeEditToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2706. QStack<QLayout*> *layoutStack);
  2707. /*:196*//*225:*/
  2708. #line 5035 "./typica.w"
  2709. QScriptValue constructQTabBar(QScriptContext*context,QScriptEngine*engine);
  2710. void setQTabBarProperties(QScriptValue value,QScriptEngine*engine);
  2711. QScriptValue QTabBar_addTab(QScriptContext*context,QScriptEngine*engine);
  2712. /*:225*//*266:*/
  2713. #line 6321 "./typica.w"
  2714. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2715. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2716. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2717. QScriptEngine*engine);
  2718. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2719. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2720. QScriptEngine*engine);
  2721. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2722. QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*engine);
  2723. /*:266*//*269:*/
  2724. #line 6366 "./typica.w"
  2725. void setQTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2726. /*:269*//*270:*/
  2727. #line 6374 "./typica.w"
  2728. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  2729. /*:270*//*274:*/
  2730. #line 6521 "./typica.w"
  2731. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  2732. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  2733. QScriptEngine*engine);
  2734. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  2735. QScriptEngine*engine);
  2736. QScriptValue SaltTable_columnSum(QScriptContext*context,
  2737. QScriptEngine*engine);
  2738. QScriptValue SaltTable_columnArray(QScriptContext*context,
  2739. QScriptEngine*engine);
  2740. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  2741. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  2742. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  2743. QScriptEngine*engine);
  2744. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  2745. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  2746. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  2747. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  2748. /*:274*//*284:*/
  2749. #line 6737 "./typica.w"
  2750. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2751. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2752. QScriptValue QComboBox_currentData(QScriptContext*context,
  2753. QScriptEngine*engine);
  2754. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  2755. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  2756. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  2757. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  2758. /*:284*//*296:*/
  2759. #line 379 "./units.w"
  2760. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  2761. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  2762. QScriptEngine*engine);
  2763. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  2764. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  2765. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  2766. /*:296*//*300:*/
  2767. #line 443 "./units.w"
  2768. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  2769. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  2770. /*:300*//*309:*/
  2771. #line 133 "./measurement.w"
  2772. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine);
  2773. void setMeasurementProperties(QScriptValue value,QScriptEngine*engine);
  2774. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement);
  2775. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement);
  2776. /*:309*//*329:*/
  2777. #line 7372 "./typica.w"
  2778. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  2779. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2780. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  2781. /*:329*//*338:*/
  2782. #line 7577 "./typica.w"
  2783. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  2784. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2785. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  2786. /*:338*//*343:*/
  2787. #line 7678 "./typica.w"
  2788. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  2789. /*:343*//*349:*/
  2790. #line 7860 "./typica.w"
  2791. QScriptValue constructLinearCalibrator(QScriptContext*context,
  2792. QScriptEngine*engine);
  2793. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  2794. /*:349*//*354:*/
  2795. #line 8000 "./typica.w"
  2796. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  2797. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  2798. /*:354*//*364:*/
  2799. #line 8205 "./typica.w"
  2800. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  2801. QScriptEngine*engine);
  2802. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2803. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  2804. QScriptEngine*engine);
  2805. /*:364*//*372:*/
  2806. #line 8364 "./typica.w"
  2807. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  2808. QScriptEngine*engine);
  2809. void setMeasurementTimeOffsetProperties(QScriptValue value,
  2810. QScriptEngine*engine);
  2811. /*:372*//*377:*/
  2812. #line 8487 "./typica.w"
  2813. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  2814. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  2815. /*:377*//*382:*/
  2816. #line 8585 "./typica.w"
  2817. QScriptValue constructZeroEmitter(QScriptContext*context,
  2818. QScriptEngine*engine);
  2819. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  2820. /*:382*//*387:*/
  2821. #line 8664 "./typica.w"
  2822. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  2823. QScriptEngine*engine);
  2824. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  2825. /*:387*//*404:*/
  2826. #line 9128 "./typica.w"
  2827. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  2828. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  2829. /*:404*//*427:*/
  2830. #line 9767 "./typica.w"
  2831. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  2832. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  2833. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  2834. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  2835. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  2836. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  2837. QScriptEngine*engine);
  2838. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  2839. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  2840. QScriptEngine*engnie);
  2841. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  2842. QScriptEngine*engine);
  2843. /*:427*//*465:*/
  2844. #line 10724 "./typica.w"
  2845. QScriptValue constructAnnotationButton(QScriptContext*context,
  2846. QScriptEngine*engine);
  2847. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2848. /*:465*//*473:*/
  2849. #line 10864 "./typica.w"
  2850. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2851. QScriptEngine*engine);
  2852. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2853. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2854. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2855. /*:473*//*494:*/
  2856. #line 11290 "./typica.w"
  2857. QScriptValue constructTimerDisplay(QScriptContext*context,
  2858. QScriptEngine*engine);
  2859. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2860. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*engine);
  2861. /*:494*//*522:*/
  2862. #line 11815 "./typica.w"
  2863. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2864. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2865. QScriptEngine*engine);
  2866. /*:522*//*535:*/
  2867. #line 12098 "./typica.w"
  2868. QScriptValue constructLogEditWindow(QScriptContext*context,
  2869. QScriptEngine*engine);
  2870. /*:535*//*554:*/
  2871. #line 12625 "./typica.w"
  2872. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2873. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2874. /*:554*//*573:*/
  2875. #line 204 "./webview.w"
  2876. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2877. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2878. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2879. QStack<QLayout*> *layoutStack);
  2880. /*:573*//*576:*/
  2881. #line 234 "./webview.w"
  2882. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  2883. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  2884. /*:576*//*580:*/
  2885. #line 292 "./webview.w"
  2886. QScriptValue constructWebElement(QScriptContext*context,
  2887. QScriptEngine*engine);
  2888. /*:580*//*592:*/
  2889. #line 67 "./printerselector.w"
  2890. QScriptValue constructPrinterSelector(QScriptContext*context,
  2891. QScriptEngine*engine);
  2892. void addPrinterSelectorToLayout(QDomElement element,
  2893. QStack<QWidget*> *widgetStack,
  2894. QStack<QLayout*> *layoutStack);
  2895. /*:592*//*658:*/
  2896. #line 13979 "./typica.w"
  2897. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2898. QScriptValue constructSqlQueryView(QScriptContext*context,
  2899. QScriptEngine*engine);
  2900. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2901. QScriptEngine*engine);
  2902. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2903. QScriptEngine*engine);
  2904. /*:658*//*668:*/
  2905. #line 14218 "./typica.w"
  2906. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2907. QStack<QLayout*> *layoutStack);
  2908. /*:668*//*684:*/
  2909. #line 14503 "./typica.w"
  2910. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2911. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2912. /*:684*//*712:*/
  2913. #line 482 "./daterangeselector.w"
  2914. void addDateRangeToLayout(QDomElement element,
  2915. QStack<QWidget*> *widgetStack,
  2916. QStack<QLayout*> *layoutStack);
  2917. /*:712*//*721:*/
  2918. #line 14702 "./typica.w"
  2919. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2920. QStack<QLayout*> *layoutStack);
  2921. /*:721*//*742:*/
  2922. #line 15286 "./typica.w"
  2923. void addScaleControlToLayout(QDomElement element,
  2924. QStack<QWidget*> *widgetStack,
  2925. QStack<QLayout*> *layoutStack);
  2926. void addIntensityControlToLayout(QDomElement element,
  2927. QStack<QWidget*> *widgetStack,
  2928. QStack<QLayout*> *layoutStack);
  2929. /*:742*//*768:*/
  2930. #line 15872 "./typica.w"
  2931. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2932. QScriptEngine*engine);
  2933. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2934. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2935. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2936. QScriptEngine*engine);
  2937. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2938. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2939. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2940. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2941. /*:768*//*774:*/
  2942. #line 16014 "./typica.w"
  2943. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2944. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2945. /*:774*//*790:*/
  2946. #line 16312 "./typica.w"
  2947. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2948. QScriptEngine*engine);
  2949. /*:790*//*861:*/
  2950. #line 42 "./settings.w"
  2951. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  2952. /*:861*//*885:*/
  2953. #line 18955 "./typica.w"
  2954. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2955. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2956. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2957. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2958. /*:885*//*903:*/
  2959. #line 698 "./modbus.w"
  2960. QScriptValue constructModbusNG(QScriptContext*context,QScriptEngine*engine);
  2961. void setModbusNGProperties(QScriptValue value,QScriptEngine*engine);
  2962. QScriptValue ModbusNG_getChannel(QScriptContext*context,QScriptEngine*engine);
  2963. /*:903*//*917:*/
  2964. #line 345 "./unsupportedserial.w"
  2965. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine);
  2966. /*:917*//*923:*/
  2967. #line 425 "./unsupportedserial.w"
  2968. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine);
  2969. /*:923*//*929:*/
  2970. #line 617 "./unsupportedserial.w"
  2971. QScriptValue getMeasurementTimestamp(QScriptContext*context,QScriptEngine*engine);
  2972. /*:929*//*933:*/
  2973. #line 651 "./unsupportedserial.w"
  2974. QScriptValue constructSerialPort(QScriptContext*context,QScriptEngine*engine);
  2975. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine);
  2976. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*engine);
  2977. /*:933*//*957:*/
  2978. #line 457 "./phidgets.w"
  2979. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine);
  2980. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine);
  2981. /*:957*//*989:*/
  2982. #line 138 "./rate.w"
  2983. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  2984. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  2985. /*:989*//*1003:*/
  2986. #line 129 "./mergeseries.w"
  2987. QScriptValue constructDifferenceSeries(QScriptContext*context,
  2988. QScriptEngine*engine);
  2989. QScriptValue constructMeanSeries(QScriptContext*context,
  2990. QScriptEngine*engine);
  2991. /*:1003*//*1028:*/
  2992. #line 597 "./dataqsdk.w"
  2993. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  2994. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  2995. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2996. /*:1028*//*1055:*/
  2997. #line 67 "./scales.w"
  2998. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  2999. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  3000. /*:1055*//*1063:*/
  3001. #line 259 "./scales.w"
  3002. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  3003. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  3004. /*:1063*//*1066:*/
  3005. #line 284 "./scales.w"
  3006. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  3007. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  3008. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  3009. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  3010. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  3011. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  3012. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  3013. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  3014. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  3015. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  3016. /*:1066*//*1091:*/
  3017. #line 265 "./valueannotation.w"
  3018. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  3019. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  3020. /*:1091*//*1102:*/
  3021. #line 194 "./thresholdannotation.w"
  3022. QScriptValue constructAnnotator(QScriptContext*context,
  3023. QScriptEngine*engine);
  3024. void setAnnotatorProperties(QScriptValue value,QScriptEngine*engine);
  3025. /*:1102*/
  3026. #line 527 "./typica.w"
  3027. /*638:*/
  3028. #line 13623 "./typica.w"
  3029. void messageFileOutput(QtMsgType type,const char*msg);
  3030. /*:638*/
  3031. #line 528 "./typica.w"
  3032. /*4:*/
  3033. #line 537 "./typica.w"
  3034. /*782:*/
  3035. #line 16135 "./typica.w"
  3036. NodeInserter::NodeInserter(const QString&title,const QString&name,
  3037. const QString&driver,QObject*parent):
  3038. QAction(title,parent),defaultNodeName(name),driverString(driver)
  3039. {
  3040. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  3041. }
  3042. void NodeInserter::onTriggered()
  3043. {
  3044. emit triggered(defaultNodeName,driverString);
  3045. }
  3046. /*:782*/
  3047. #line 538 "./typica.w"
  3048. /*305:*/
  3049. #line 40 "./measurement.w"
  3050. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  3051. {
  3052. insert("measurement",temperature);
  3053. insert("time",time);
  3054. insert("unit",sc);
  3055. }
  3056. Measurement::Measurement(double temperature)
  3057. {
  3058. insert("measurement",temperature);
  3059. insert("time",QTime::currentTime());
  3060. insert("unit",Units::Fahrenheit);
  3061. }
  3062. void Measurement::setTemperature(double temperature)
  3063. {
  3064. insert("measurement",temperature);
  3065. }
  3066. void Measurement::setTime(QTime time)
  3067. {
  3068. insert("time",time);
  3069. }
  3070. void Measurement::setUnit(Units::Unit scale)
  3071. {
  3072. insert("unit",scale);
  3073. }
  3074. double Measurement::temperature()const
  3075. {
  3076. return value("measurement").toDouble();
  3077. }
  3078. QTime Measurement::time()const
  3079. {
  3080. return value("time").toTime();
  3081. }
  3082. Units::Unit Measurement::scale()const
  3083. {
  3084. return(Units::Unit)(value("unit").toInt());
  3085. }
  3086. /*:305*//*306:*/
  3087. #line 88 "./measurement.w"
  3088. Measurement Measurement::toFahrenheit()
  3089. {
  3090. return Measurement(Units::convertTemperature(this->temperature(),
  3091. this->scale(),Units::Fahrenheit),
  3092. this->time(),Units::Fahrenheit);
  3093. }
  3094. Measurement Measurement::toCelsius()
  3095. {
  3096. return Measurement(Units::convertTemperature(this->temperature(),
  3097. this->scale(),Units::Celsius),
  3098. this->time(),Units::Celsius);
  3099. }
  3100. Measurement Measurement::toKelvin()
  3101. {
  3102. return Measurement(Units::convertTemperature(this->temperature(),
  3103. this->scale(),Units::Kelvin),
  3104. this->time(),Units::Kelvin);
  3105. }
  3106. Measurement Measurement::toRankine()
  3107. {
  3108. return Measurement(Units::convertTemperature(this->temperature(),
  3109. this->scale(),Units::Rankine),
  3110. this->time(),Units::Rankine);
  3111. }
  3112. /*:306*/
  3113. #line 539 "./typica.w"
  3114. /*319:*/
  3115. #line 6977 "./typica.w"
  3116. void DAQImplementation::measure()
  3117. {
  3118. int samplesRead= 0;
  3119. double buffer[channels];
  3120. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  3121. (unsigned long)(0),buffer,(unsigned long)(channels),
  3122. &samplesRead,(signed long)(0));
  3123. if(error)
  3124. {
  3125. ready= false;
  3126. }
  3127. else
  3128. {
  3129. if(samplesRead)
  3130. {
  3131. QTime time= QTime::currentTime();
  3132. for(int i= 0;i<samplesRead;i++)
  3133. {
  3134. for(int j= 0;j<channels;j++)
  3135. {
  3136. double measuredValue= buffer[j+(i*channels)];
  3137. Measurement measure(measuredValue,time,
  3138. unitMap[j]);
  3139. channelMap[j]->input(measure);
  3140. }
  3141. }
  3142. }
  3143. }
  3144. }
  3145. /*:319*//*320:*/
  3146. #line 7020 "./typica.w"
  3147. void DAQImplementation::run()
  3148. {
  3149. setPriority(QThread::TimeCriticalPriority);
  3150. while(ready)
  3151. {
  3152. measure();
  3153. }
  3154. }
  3155. /*:320*//*321:*/
  3156. #line 7036 "./typica.w"
  3157. void DAQ::threadFinished()
  3158. {
  3159. if(imp->error)
  3160. {
  3161. /*322:*/
  3162. #line 7087 "./typica.w"
  3163. imp->ready= false;
  3164. QMessageBox warning;
  3165. warning.setStandardButtons(QMessageBox::Cancel);
  3166. warning.setIcon(QMessageBox::Warning);
  3167. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3168. unsigned long bytes= imp->errorInfo(NULL,0);
  3169. char string[bytes];
  3170. imp->errorInfo(string,bytes);
  3171. warning.setInformativeText(QString(string));
  3172. warning.setWindowTitle(QString(PROGRAM_NAME));
  3173. warning.exec();
  3174. /*:322*/
  3175. #line 7041 "./typica.w"
  3176. }
  3177. }
  3178. /*:321*//*323:*/
  3179. #line 7112 "./typica.w"
  3180. void DAQ::start()
  3181. {
  3182. if(imp->ready)
  3183. {
  3184. imp->error= imp->startTask(imp->handle);
  3185. if(imp->error)
  3186. {
  3187. /*322:*/
  3188. #line 7087 "./typica.w"
  3189. imp->ready= false;
  3190. QMessageBox warning;
  3191. warning.setStandardButtons(QMessageBox::Cancel);
  3192. warning.setIcon(QMessageBox::Warning);
  3193. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3194. unsigned long bytes= imp->errorInfo(NULL,0);
  3195. char string[bytes];
  3196. imp->errorInfo(string,bytes);
  3197. warning.setInformativeText(QString(string));
  3198. warning.setWindowTitle(QString(PROGRAM_NAME));
  3199. warning.exec();
  3200. /*:322*/
  3201. #line 7120 "./typica.w"
  3202. }
  3203. else
  3204. {
  3205. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3206. imp->start();
  3207. }
  3208. }
  3209. }
  3210. void DAQ::stop()
  3211. {
  3212. if(imp->useBase)
  3213. {
  3214. imp->ready= false;
  3215. imp->wait(ULONG_MAX);
  3216. imp->stopTask(imp->handle);
  3217. }
  3218. else
  3219. {
  3220. imp->ready= false;
  3221. imp->error= imp->stopTask(imp->handle);
  3222. if(imp->error)
  3223. {
  3224. /*322:*/
  3225. #line 7087 "./typica.w"
  3226. imp->ready= false;
  3227. QMessageBox warning;
  3228. warning.setStandardButtons(QMessageBox::Cancel);
  3229. warning.setIcon(QMessageBox::Warning);
  3230. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3231. unsigned long bytes= imp->errorInfo(NULL,0);
  3232. char string[bytes];
  3233. imp->errorInfo(string,bytes);
  3234. warning.setInformativeText(QString(string));
  3235. warning.setWindowTitle(QString(PROGRAM_NAME));
  3236. warning.exec();
  3237. /*:322*/
  3238. #line 7144 "./typica.w"
  3239. }
  3240. imp->error= imp->clearTask(imp->handle);
  3241. if(imp->error)
  3242. {
  3243. /*322:*/
  3244. #line 7087 "./typica.w"
  3245. imp->ready= false;
  3246. QMessageBox warning;
  3247. warning.setStandardButtons(QMessageBox::Cancel);
  3248. warning.setIcon(QMessageBox::Warning);
  3249. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3250. unsigned long bytes= imp->errorInfo(NULL,0);
  3251. char string[bytes];
  3252. imp->errorInfo(string,bytes);
  3253. warning.setInformativeText(QString(string));
  3254. warning.setWindowTitle(QString(PROGRAM_NAME));
  3255. warning.exec();
  3256. /*:322*/
  3257. #line 7149 "./typica.w"
  3258. }
  3259. }
  3260. }
  3261. /*:323*//*324:*/
  3262. #line 7159 "./typica.w"
  3263. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  3264. {
  3265. imp->device= device;
  3266. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  3267. if(imp->error)
  3268. {
  3269. /*322:*/
  3270. #line 7087 "./typica.w"
  3271. imp->ready= false;
  3272. QMessageBox warning;
  3273. warning.setStandardButtons(QMessageBox::Cancel);
  3274. warning.setIcon(QMessageBox::Warning);
  3275. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3276. unsigned long bytes= imp->errorInfo(NULL,0);
  3277. char string[bytes];
  3278. imp->errorInfo(string,bytes);
  3279. warning.setInformativeText(QString(string));
  3280. warning.setWindowTitle(QString(PROGRAM_NAME));
  3281. warning.exec();
  3282. /*:322*/
  3283. #line 7166 "./typica.w"
  3284. }
  3285. else
  3286. {
  3287. imp->ready= true;
  3288. }
  3289. }
  3290. /*:324*//*325:*/
  3291. #line 7180 "./typica.w"
  3292. Channel*DAQ::newChannel(int units,int thermocouple)
  3293. {
  3294. Channel*retval= new Channel();
  3295. imp->channelMap[imp->channels]= retval;
  3296. imp->unitMap[imp->channels]= (Units::Unit)units;
  3297. imp->channels++;
  3298. if(imp->ready)
  3299. {
  3300. if(imp->useBase)
  3301. {
  3302. imp->error= imp->createChannel(imp->handle,
  3303. QString("%1/ai%2").arg(imp->device).
  3304. arg(imp->channels-1).
  3305. toAscii().data(),
  3306. "",(double)(-1.0),(double)(100.0),
  3307. (signed long)(units),
  3308. (signed long)(thermocouple),
  3309. (signed long)(10200),(double)(0),
  3310. "");
  3311. }
  3312. else
  3313. {
  3314. imp->error= imp->createChannel(imp->handle,
  3315. QString("%1/ai%2").arg(imp->device).
  3316. arg(imp->channels-1).
  3317. toAscii().data(),
  3318. "",(double)(50.0),(double)(500.0),
  3319. (signed long)(units),
  3320. (signed long)(thermocouple),
  3321. (signed long)(10200),(double)(0),
  3322. "");
  3323. }
  3324. if(imp->error)
  3325. {
  3326. /*322:*/
  3327. #line 7087 "./typica.w"
  3328. imp->ready= false;
  3329. QMessageBox warning;
  3330. warning.setStandardButtons(QMessageBox::Cancel);
  3331. warning.setIcon(QMessageBox::Warning);
  3332. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3333. unsigned long bytes= imp->errorInfo(NULL,0);
  3334. char string[bytes];
  3335. imp->errorInfo(string,bytes);
  3336. warning.setInformativeText(QString(string));
  3337. warning.setWindowTitle(QString(PROGRAM_NAME));
  3338. warning.exec();
  3339. /*:322*/
  3340. #line 7215 "./typica.w"
  3341. }
  3342. }
  3343. return retval;
  3344. }
  3345. /*:325*//*326:*/
  3346. #line 7229 "./typica.w"
  3347. void DAQ::setClockRate(double Hz)
  3348. {
  3349. if(imp->ready)
  3350. {
  3351. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  3352. (signed long)(10280),(signed long)(10123),
  3353. (unsigned long long)(1));
  3354. if(imp->error)
  3355. {
  3356. /*322:*/
  3357. #line 7087 "./typica.w"
  3358. imp->ready= false;
  3359. QMessageBox warning;
  3360. warning.setStandardButtons(QMessageBox::Cancel);
  3361. warning.setIcon(QMessageBox::Warning);
  3362. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3363. unsigned long bytes= imp->errorInfo(NULL,0);
  3364. char string[bytes];
  3365. imp->errorInfo(string,bytes);
  3366. warning.setInformativeText(QString(string));
  3367. warning.setWindowTitle(QString(PROGRAM_NAME));
  3368. warning.exec();
  3369. /*:322*/
  3370. #line 7239 "./typica.w"
  3371. }
  3372. }
  3373. }
  3374. /*:326*//*327:*/
  3375. #line 7249 "./typica.w"
  3376. DAQ::~DAQ()
  3377. {
  3378. if(imp->useBase)
  3379. {
  3380. imp->resetDevice(imp->device.toAscii().data());
  3381. imp->clearTask(imp->handle);
  3382. }
  3383. else
  3384. {
  3385. if(imp->ready)
  3386. {
  3387. imp->ready= false;
  3388. imp->wait(ULONG_MAX);
  3389. imp->stopTask(imp->handle);
  3390. imp->resetDevice(imp->device.toAscii().data());
  3391. imp->clearTask(imp->handle);
  3392. }
  3393. }
  3394. delete imp;
  3395. }
  3396. /*:327*//*328:*/
  3397. #line 7280 "./typica.w"
  3398. DAQImplementation::DAQImplementation(const QString&driverinfo)
  3399. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  3400. unitMap(4)
  3401. {
  3402. if(driverinfo=="nidaqmxbase")
  3403. {
  3404. useBase= true;
  3405. }
  3406. else
  3407. {
  3408. useBase= false;
  3409. }
  3410. if(useBase)
  3411. {
  3412. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  3413. if(!driver.load())
  3414. {
  3415. driver.setFileName("nidaqmxbase");
  3416. if(!driver.load())
  3417. {
  3418. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3419. tr("Failed to find nidaqmxbase. Please install it."));
  3420. QApplication::quit();
  3421. }
  3422. }
  3423. }
  3424. else
  3425. {
  3426. driver.setFileName("nicaiu");
  3427. if(!driver.load())
  3428. {
  3429. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3430. tr("Failed to find nidaqmx. Please install it."));
  3431. QApplication::quit();
  3432. }
  3433. }
  3434. if(useBase)
  3435. {
  3436. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  3437. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  3438. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  3439. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  3440. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  3441. ==0||
  3442. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  3443. 0||
  3444. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  3445. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  3446. 0||
  3447. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  3448. {
  3449. waitForMeasurement= NULL;
  3450. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3451. tr("Failed to link a required symbol in NI-DAQmxBase."));
  3452. QApplication::quit();
  3453. }
  3454. }
  3455. else
  3456. {
  3457. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  3458. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  3459. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  3460. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  3461. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  3462. ==0||
  3463. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  3464. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  3465. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  3466. 0||
  3467. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  3468. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  3469. {
  3470. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3471. tr("Failed to link a required symbol in NI-DAQmx."));
  3472. QApplication::quit();
  3473. }
  3474. }
  3475. }
  3476. DAQImplementation::~DAQImplementation()
  3477. {
  3478. driver.unload();
  3479. }
  3480. /*:328*/
  3481. #line 540 "./typica.w"
  3482. /*1017:*/
  3483. #line 197 "./dataqsdk.w"
  3484. void DataqSdkDeviceImplementation::measure()
  3485. {
  3486. unsigned count= channels*40;
  3487. di_status_read(buffer,count);
  3488. QTime time= QTime::currentTime();
  3489. for(unsigned int i= 0;i<count;i++)
  3490. {
  3491. buffer[i]= buffer[i]&0xFFFC;
  3492. }
  3493. QList<int> countList;
  3494. for(unsigned int i= 0;i<(unsigned)channels;i++)
  3495. {
  3496. QList<double> channelBuffer;
  3497. for(unsigned int j= 0;j<40;j++)
  3498. {
  3499. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  3500. if(i==0)
  3501. {
  3502. countList<<buffer[i+(channels*j)];
  3503. }
  3504. }
  3505. double value= 0.0;
  3506. for(unsigned int j= 0;j<40;j++)
  3507. {
  3508. value+= channelBuffer[j];
  3509. }
  3510. value/= 40.0;
  3511. if(i==0)
  3512. {
  3513. QList<double> smoothingList;
  3514. smoothingList<<value;
  3515. QList<int> smoothingKeys= smoother.uniqueKeys();
  3516. for(int j= 0;j<smoothingKeys.size();j++)
  3517. {
  3518. if(countList.contains(smoothingKeys[j]))
  3519. {
  3520. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  3521. for(int k= 0;k<keyValues.size();k++)
  3522. {
  3523. smoothingList<<keyValues[k];
  3524. }
  3525. }
  3526. else
  3527. {
  3528. smoother.remove(smoothingKeys[j]);
  3529. }
  3530. }
  3531. qSort(countList);
  3532. int lastCount= 0;
  3533. for(int j= 0;j<countList.size();j++)
  3534. {
  3535. if(j==0||countList[j]!=lastCount)
  3536. {
  3537. smoother.insert(countList[j],value);
  3538. lastCount= countList[j];
  3539. }
  3540. }
  3541. value= 0.0;
  3542. for(int j= 0;j<smoothingList.size();j++)
  3543. {
  3544. value+= smoothingList[j];
  3545. }
  3546. value/= smoothingList.size();
  3547. }
  3548. Measurement measure(value,time,unitMap[i]);
  3549. channelMap[i]->input(measure);
  3550. }
  3551. }
  3552. /*:1017*//*1018:*/
  3553. #line 290 "./dataqsdk.w"
  3554. void DataqSdkDeviceImplementation::run()
  3555. {
  3556. if(!ready)
  3557. {
  3558. error= 9;
  3559. return;
  3560. }
  3561. driver= new QLibrary(device);
  3562. if(!driver->load())
  3563. {
  3564. error= 1;
  3565. qDebug()<<"Failed to load driver: "<<device;
  3566. return;
  3567. }
  3568. di_open= (FPDIOPEN)driver->resolve("di_open");
  3569. di_close= (FPDICLOSE)driver->resolve("di_close");
  3570. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3571. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3572. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3573. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3574. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3575. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3576. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3577. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3578. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3579. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3580. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3581. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3582. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3583. (!di_burst_rate)||(!di_stop_scan))
  3584. {
  3585. error= 2;
  3586. return;
  3587. }
  3588. error= di_open(deviceNumber);
  3589. if(error)
  3590. {
  3591. di_close();
  3592. error= di_open(deviceNumber);
  3593. if(error)
  3594. {
  3595. error= 3;
  3596. di_close();
  3597. return;
  3598. }
  3599. }
  3600. isOpen= true;
  3601. di_maximum_rate(240.0);
  3602. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3603. &burstDivisor);
  3604. buffer= new qint16[(int)sampleRate];
  3605. di_inlist_struct inlist[16]= {{0,0,0,0,0,0,0,0}};
  3606. for(unsigned short i= 0;i<channels;i++)
  3607. {
  3608. inlist[i].chan= i;
  3609. inlist[i].gain= 0;
  3610. inlist[i].ave= 1;
  3611. inlist[i].counter= (oversample-1);
  3612. }
  3613. error= di_list_length(channels,0);
  3614. if(error)
  3615. {
  3616. error= 4;
  3617. return;
  3618. }
  3619. error= di_inlist(inlist);
  3620. if(error)
  3621. {
  3622. error= 5;
  3623. return;
  3624. }
  3625. input_buffer= di_buffer_alloc(0,4096);
  3626. if(input_buffer==NULL)
  3627. {
  3628. error= 6;
  3629. return;
  3630. }
  3631. error= di_start_scan();
  3632. if(error)
  3633. {
  3634. error= 7;
  3635. return;
  3636. }
  3637. while(ready)
  3638. {
  3639. measure();
  3640. }
  3641. }
  3642. /*:1018*//*1019:*/
  3643. #line 386 "./dataqsdk.w"
  3644. void DataqSdkDevice::threadFinished()
  3645. {
  3646. if(imp->error)
  3647. {
  3648. /*1020:*/
  3649. #line 400 "./dataqsdk.w"
  3650. imp->ready= false;
  3651. QMessageBox warning;
  3652. warning.setStandardButtons(QMessageBox::Cancel);
  3653. warning.setIcon(QMessageBox::Warning);
  3654. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3655. warning.setInformativeText(tr("An error occurred"));
  3656. warning.setWindowTitle(QString(PROGRAM_NAME));
  3657. warning.exec();
  3658. /*:1020*/
  3659. #line 391 "./dataqsdk.w"
  3660. }
  3661. }
  3662. /*:1019*//*1021:*/
  3663. #line 417 "./dataqsdk.w"
  3664. void DataqSdkDevice::start()
  3665. {
  3666. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3667. imp->start();
  3668. }
  3669. /*:1021*//*1022:*/
  3670. #line 428 "./dataqsdk.w"
  3671. QStringList DataqSdkDevice::detectHardware()
  3672. {
  3673. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3674. QSettings::NativeFormat);
  3675. QStringList keys= deviceLookup.childKeys();
  3676. QStringList devices;
  3677. for(int i= 0;i<keys.size();i++)
  3678. {
  3679. QString value= deviceLookup.value(keys.at(i)).toString();
  3680. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3681. {
  3682. devices.append(value.split("\\").at(2));
  3683. }
  3684. }
  3685. QStringList portList;
  3686. foreach(QString device,devices)
  3687. {
  3688. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3689. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3690. portList.append(deviceEntry.value("FriendlyName").toString());
  3691. }
  3692. return portList;
  3693. }
  3694. QStringList DataqSdkDevice::detectPorts()
  3695. {
  3696. QStringList friendlyNames= detectHardware();
  3697. QStringList portList;
  3698. foreach(QString name,friendlyNames)
  3699. {
  3700. name.remove(0,name.indexOf("COM"));
  3701. name.chop(1);
  3702. portList.append(name);
  3703. }
  3704. return portList;
  3705. }
  3706. /*:1022*//*1023:*/
  3707. #line 473 "./dataqsdk.w"
  3708. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3709. {
  3710. bool usesAuto= false;
  3711. int autoIndex= device.toInt(&usesAuto);
  3712. QString finalizedPort;
  3713. if(usesAuto)
  3714. {
  3715. QStringList portList= detectPorts();
  3716. if(autoIndex> 0&&autoIndex<=portList.size())
  3717. {
  3718. finalizedPort= portList.at(autoIndex-1);
  3719. }
  3720. else
  3721. {
  3722. imp->error= 8;
  3723. qDebug()<<"Failed to detect port.";
  3724. }
  3725. }
  3726. else
  3727. {
  3728. finalizedPort= device;
  3729. }
  3730. int rstart= finalizedPort.indexOf("COM");
  3731. finalizedPort.remove(0,rstart+3);
  3732. bool chopFinished= false;
  3733. int finalizedPortNumber= 0;
  3734. while(finalizedPort.size()> 0&&!chopFinished)
  3735. {
  3736. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  3737. if(!chopFinished)
  3738. {
  3739. finalizedPort.chop(1);
  3740. }
  3741. }
  3742. if(finalizedPortNumber<10)
  3743. {
  3744. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  3745. }
  3746. else
  3747. {
  3748. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  3749. }
  3750. imp->deviceNumber= 0x12C02D00;
  3751. imp->deviceNumber+= finalizedPortNumber;
  3752. imp->ready= true;
  3753. }
  3754. /*:1023*//*1024:*/
  3755. #line 523 "./dataqsdk.w"
  3756. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  3757. {
  3758. Channel*retval= NULL;
  3759. if(imp->ready)
  3760. {
  3761. retval= new Channel();
  3762. imp->channelMap[imp->channels]= retval;
  3763. imp->unitMap[imp->channels]= scale;
  3764. imp->channels++;
  3765. }
  3766. return retval;
  3767. }
  3768. /*:1024*//*1025:*/
  3769. #line 547 "./dataqsdk.w"
  3770. void DataqSdkDevice::setClockRate(double Hz)
  3771. {
  3772. imp->sampleRate= Hz;
  3773. }
  3774. /*:1025*//*1026:*/
  3775. #line 557 "./dataqsdk.w"
  3776. DataqSdkDevice::~DataqSdkDevice()
  3777. {
  3778. if(imp->ready)
  3779. {
  3780. imp->ready= false;
  3781. }
  3782. imp->wait(ULONG_MAX);
  3783. delete imp;
  3784. }
  3785. /*:1026*//*1027:*/
  3786. #line 575 "./dataqsdk.w"
  3787. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  3788. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  3789. {
  3790. }
  3791. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  3792. {
  3793. if(isOpen)
  3794. {
  3795. di_stop_scan();
  3796. di_close();
  3797. }
  3798. if(driver->isLoaded())
  3799. {
  3800. driver->unload();
  3801. }
  3802. }
  3803. /*:1027*/
  3804. #line 541 "./typica.w"
  3805. /*335:*/
  3806. #line 7489 "./typica.w"
  3807. void FakeDAQImplementation::measure()
  3808. {
  3809. msleep((int)(1000/clockRate));
  3810. QTime time= QTime::currentTime();
  3811. for(int i= 0;i<channels;i++)
  3812. {
  3813. Measurement measure(qrand()%500,time);
  3814. channelMap[i]->input(measure);
  3815. }
  3816. }
  3817. /*:335*//*336:*/
  3818. #line 7503 "./typica.w"
  3819. void FakeDAQImplementation::run()
  3820. {
  3821. setPriority(QThread::TimeCriticalPriority);
  3822. while(ready)
  3823. {
  3824. measure();
  3825. }
  3826. }
  3827. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  3828. channels(0),ready(false),clockRate(1)
  3829. {
  3830. }
  3831. FakeDAQImplementation::~FakeDAQImplementation()
  3832. {
  3833. }
  3834. /*:336*//*337:*/
  3835. #line 7528 "./typica.w"
  3836. void FakeDAQ::start()
  3837. {
  3838. if(imp->ready)
  3839. {
  3840. imp->start();
  3841. }
  3842. }
  3843. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  3844. {
  3845. imp->ready= true;
  3846. }
  3847. Channel*FakeDAQ::newChannel(int,int)
  3848. {
  3849. Channel*retval;
  3850. if(imp->ready)
  3851. {
  3852. retval= new Channel();
  3853. imp->channelMap[imp->channels]= retval;
  3854. imp->channels++;
  3855. }
  3856. else
  3857. {
  3858. return NULL;
  3859. }
  3860. return retval;
  3861. }
  3862. void FakeDAQ::setClockRate(double Hz)
  3863. {
  3864. if(imp->ready)
  3865. {
  3866. imp->clockRate= Hz;
  3867. }
  3868. }
  3869. FakeDAQ::~FakeDAQ()
  3870. {
  3871. imp->ready= false;
  3872. imp->wait(ULONG_MAX);
  3873. delete imp;
  3874. }
  3875. /*:337*/
  3876. #line 542 "./typica.w"
  3877. /*342:*/
  3878. #line 7659 "./typica.w"
  3879. Channel::Channel():QObject(NULL)
  3880. {
  3881. }
  3882. Channel::~Channel()
  3883. {
  3884. }
  3885. void Channel::input(Measurement measurement)
  3886. {
  3887. emit newData(measurement);
  3888. }
  3889. /*:342*/
  3890. #line 543 "./typica.w"
  3891. /*358:*/
  3892. #line 8064 "./typica.w"
  3893. void TemperatureDisplay::setRelativeMode(bool relative)
  3894. {
  3895. r= relative;
  3896. }
  3897. /*:358*//*359:*/
  3898. #line 8081 "./typica.w"
  3899. void TemperatureDisplay::setValue(Measurement temperature)
  3900. {
  3901. QString number;
  3902. switch(unit)
  3903. {
  3904. case Units::Fahrenheit:
  3905. display(QString("%1'F").
  3906. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  3907. 2)));
  3908. break;
  3909. case Units::Celsius:
  3910. if(!r){
  3911. display(QString("%1'C").
  3912. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  3913. 2)));
  3914. }else{
  3915. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3916. display(QString("%1'C").arg(number));
  3917. }
  3918. break;
  3919. case Units::Kelvin:
  3920. if(!r){
  3921. display(QString("%1").
  3922. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  3923. 2)));
  3924. }else{
  3925. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3926. display(QString("%1").arg(number));
  3927. }
  3928. break;
  3929. case Units::Rankine:
  3930. display(QString("%1'r").
  3931. arg(number.setNum(temperature.toRankine().temperature(),'f',
  3932. 2)));
  3933. break;
  3934. case Units::Unitless:
  3935. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3936. break;
  3937. default:
  3938. switch(temperature.scale())
  3939. {
  3940. case Units::Fahrenheit:
  3941. display(QString("%1'F").
  3942. arg(number.setNum(temperature.temperature(),'f',2)));
  3943. break;
  3944. case Units::Celsius:
  3945. display(QString("%1'C").
  3946. arg(number.setNum(temperature.temperature(),'f',2)));
  3947. break;
  3948. case Units::Kelvin:
  3949. display(QString("%1").
  3950. arg(number.setNum(temperature.temperature(),'f',2)));
  3951. break;
  3952. case Units::Rankine:
  3953. display(QString("%1'r").
  3954. arg(number.setNum(temperature.temperature(),'f',2)));
  3955. break;
  3956. case Units::Unitless:
  3957. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3958. break;
  3959. default:
  3960. qDebug()<<"Warning: Attempting to convert a non-temperature unit to a temperature unit";
  3961. break;
  3962. }
  3963. break;
  3964. }
  3965. }
  3966. /*:359*//*360:*/
  3967. #line 8160 "./typica.w"
  3968. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  3969. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  3970. {
  3971. setSegmentStyle(Filled);
  3972. display("---.--'F");
  3973. }
  3974. /*:360*//*361:*/
  3975. #line 8176 "./typica.w"
  3976. void TemperatureDisplay::invalidate()
  3977. {
  3978. display("---.--'F");
  3979. }
  3980. /*:361*//*362:*/
  3981. #line 8188 "./typica.w"
  3982. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  3983. {
  3984. unit= scale;
  3985. }
  3986. /*:362*//*363:*/
  3987. #line 8196 "./typica.w"
  3988. TemperatureDisplay::~TemperatureDisplay()
  3989. {
  3990. }
  3991. /*:363*/
  3992. #line 544 "./typica.w"
  3993. /*369:*/
  3994. #line 8296 "./typica.w"
  3995. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  3996. {
  3997. if(measure.time()<epoch)
  3998. {
  3999. if(hasPrevious)
  4000. {
  4001. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  4002. epoch.msec());
  4003. QTime jitComp(epoch.hour(),measure.time().minute(),
  4004. measure.time().second(),measure.time().msec());
  4005. int relTime= jitBase.msecsTo(jitComp);
  4006. /*370:*/
  4007. #line 8330 "./typica.w"
  4008. QTime newTime(0,0,0,0);
  4009. newTime= newTime.addMSecs(relTime);
  4010. if(newTime.hour()> 0)
  4011. {
  4012. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  4013. }
  4014. Measurement rel= measure;
  4015. rel.setTime(newTime);
  4016. emit measurement(rel);
  4017. /*:370*/
  4018. #line 8308 "./typica.w"
  4019. }
  4020. else
  4021. {
  4022. Measurement rel= measure;
  4023. rel.setTime(QTime(0,0,0,0));
  4024. emit measurement(rel);
  4025. }
  4026. }
  4027. else
  4028. {
  4029. int relTime= epoch.msecsTo(measure.time());
  4030. /*370:*/
  4031. #line 8330 "./typica.w"
  4032. QTime newTime(0,0,0,0);
  4033. newTime= newTime.addMSecs(relTime);
  4034. if(newTime.hour()> 0)
  4035. {
  4036. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  4037. }
  4038. Measurement rel= measure;
  4039. rel.setTime(newTime);
  4040. emit measurement(rel);
  4041. /*:370*/
  4042. #line 8320 "./typica.w"
  4043. }
  4044. hasPrevious= true;
  4045. previous= measure.time();
  4046. }
  4047. /*:369*//*371:*/
  4048. #line 8343 "./typica.w"
  4049. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  4050. previous(0,0,0,0),hasPrevious(false)
  4051. {
  4052. }
  4053. QTime MeasurementTimeOffset::zeroTime()
  4054. {
  4055. return epoch;
  4056. }
  4057. void MeasurementTimeOffset::setZeroTime(QTime zero)
  4058. {
  4059. epoch= zero;
  4060. hasPrevious= false;
  4061. }
  4062. /*:371*/
  4063. #line 545 "./typica.w"
  4064. /*381:*/
  4065. #line 8551 "./typica.w"
  4066. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  4067. {
  4068. }
  4069. int ZeroEmitter::column()
  4070. {
  4071. return col;
  4072. }
  4073. double ZeroEmitter::lastTemperature()
  4074. {
  4075. return cache.temperature();
  4076. }
  4077. void ZeroEmitter::newMeasurement(Measurement measure)
  4078. {
  4079. cache= measure;
  4080. }
  4081. void ZeroEmitter::setColumn(int column)
  4082. {
  4083. col= column;
  4084. }
  4085. void ZeroEmitter::emitZero()
  4086. {
  4087. cache.setTime(QTime(0,0,0,0));
  4088. emit measurement(cache,col);
  4089. }
  4090. /*:381*/
  4091. #line 546 "./typica.w"
  4092. /*386:*/
  4093. #line 8641 "./typica.w"
  4094. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  4095. {
  4096. }
  4097. int MeasurementAdapter::column()
  4098. {
  4099. return col;
  4100. }
  4101. void MeasurementAdapter::newMeasurement(Measurement measure)
  4102. {
  4103. emit measurement(measure,col);
  4104. }
  4105. void MeasurementAdapter::setColumn(int column)
  4106. {
  4107. col= column;
  4108. }
  4109. /*:386*/
  4110. #line 547 "./typica.w"
  4111. /*391:*/
  4112. #line 8763 "./typica.w"
  4113. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  4114. theScene(new QGraphicsScene),
  4115. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  4116. prevPoints(new QMap<int,QPointF> ),
  4117. translations(new QMap<int,double> ),
  4118. gridLinesF(new QList<QGraphicsItem*> ),
  4119. gridLinesC(new QList<QGraphicsItem*> ),
  4120. relativeGridLines(new QList<QGraphicsItem*> ),
  4121. relativeEnabled(false),
  4122. timeIndicatorEnabled(false),
  4123. timeLine(new QGraphicsLineItem),
  4124. relativeAdjuster(new LinearSplineInterpolator)
  4125. {
  4126. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4127. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4128. setScene(theScene);
  4129. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  4130. QPen timePen;
  4131. timePen.setColor(QColor(160,160,164,127));
  4132. timeLine->setPen(timePen);
  4133. timeLine->setLine(0,0,0,-500);
  4134. timeLine->hide();
  4135. theScene->addItem(timeLine);
  4136. /*392:*/
  4137. #line 8803 "./typica.w"
  4138. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  4139. tempaxis->setLine(-10,-500,-10,0);
  4140. theScene->addItem(tempaxis);
  4141. QGraphicsLineItem*gridLine;
  4142. QGraphicsTextItem*label;
  4143. for(int y= -100;y> -600;y-= 100)
  4144. {
  4145. gridLine= new QGraphicsLineItem;
  4146. gridLine->setLine(0,y,1200,y);
  4147. theScene->addItem(gridLine);
  4148. label= new QGraphicsTextItem;
  4149. label->setHtml(QString("%1&deg;F").arg(-y));
  4150. label->setPos(-55,y-(label->boundingRect().height()/2));
  4151. theScene->addItem(label);
  4152. gridLinesF->append(gridLine);
  4153. gridLinesF->append(label);
  4154. }
  4155. for(int degC= 50;degC<=250;degC+= 50)
  4156. {
  4157. gridLine= new QGraphicsLineItem;
  4158. int y= -(degC*(9.0/5.0)+32);
  4159. gridLine->setLine(0,y,1200,y);
  4160. gridLine->hide();
  4161. theScene->addItem(gridLine);
  4162. gridLinesC->append(gridLine);
  4163. label= new QGraphicsTextItem;
  4164. label->setHtml(QString("%1&deg;C").arg(degC));
  4165. label->setPos(-55,y-(label->boundingRect().height()/2));
  4166. label->hide();
  4167. theScene->addItem(label);
  4168. gridLinesC->append(label);
  4169. }
  4170. /*:392*/
  4171. #line 8787 "./typica.w"
  4172. ;
  4173. /*393:*/
  4174. #line 8844 "./typica.w"
  4175. QSettings settings;
  4176. if(settings.contains("settings/graph/relative/enable"))
  4177. {
  4178. if(settings.value("settings/graph/relative/enable").toBool())
  4179. {
  4180. relativeEnabled= true;
  4181. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  4182. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  4183. QMap<double,QString> relativeAxisPairs;
  4184. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  4185. foreach(QString item,relativeAxisLabels)
  4186. {
  4187. relativeAxisPairs.insert(item.toDouble(),item);
  4188. }
  4189. if(relativeAxisPairs.size()> 1)
  4190. {
  4191. double skip= 500.0/(relativeAxisPairs.size()-1);
  4192. double y= 0;
  4193. foreach(double key,relativeAxisPairs.keys())
  4194. {
  4195. gridLine= new QGraphicsLineItem;
  4196. gridLine->setLine(0,y,1205,y);
  4197. gridLine->setPen(QPen(relativeColor));
  4198. theScene->addItem(gridLine);
  4199. relativeGridLines->append(gridLine);
  4200. label= new QGraphicsTextItem;
  4201. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  4202. label->setPos(1210,y-(label->boundingRect().height()/2));
  4203. theScene->addItem(label);
  4204. relativeGridLines->append(label);
  4205. if(unit=="F")
  4206. {
  4207. relativeAdjuster->add_pair(key,-y);
  4208. }
  4209. else
  4210. {
  4211. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  4212. }
  4213. y-= skip;
  4214. }
  4215. }
  4216. }
  4217. }
  4218. /*:393*/
  4219. #line 8788 "./typica.w"
  4220. /*395:*/
  4221. #line 8921 "./typica.w"
  4222. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  4223. timeaxis->setLine(0,10,1200,10);
  4224. theScene->addItem(timeaxis);
  4225. for(int x= 0;x<1201;x+= 120)
  4226. {
  4227. QGraphicsLineItem*tick= new QGraphicsLineItem;
  4228. tick->setLine(x,0,x,20);
  4229. theScene->addItem(tick);
  4230. QGraphicsTextItem*label= new QGraphicsTextItem;
  4231. label->setPlainText(QString("%1").arg(x/60));
  4232. label->setPos(x-(label->boundingRect().width()/2),20);
  4233. theScene->addItem(label);
  4234. }
  4235. /*:395*/
  4236. #line 8789 "./typica.w"
  4237. ;
  4238. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  4239. }
  4240. /*:391*//*394:*/
  4241. #line 8891 "./typica.w"
  4242. void GraphView::showF()
  4243. {
  4244. for(int i= 0;i<gridLinesF->size();i++)
  4245. {
  4246. gridLinesF->at(i)->show();
  4247. }
  4248. for(int i= 0;i<gridLinesC->size();i++)
  4249. {
  4250. gridLinesC->at(i)->hide();
  4251. }
  4252. }
  4253. void GraphView::showC()
  4254. {
  4255. for(int i= 0;i<gridLinesF->size();i++)
  4256. {
  4257. gridLinesF->at(i)->hide();
  4258. }
  4259. for(int i= 0;i<gridLinesC->size();i++)
  4260. {
  4261. gridLinesC->at(i)->show();
  4262. }
  4263. }
  4264. /*:394*//*396:*/
  4265. #line 8940 "./typica.w"
  4266. void GraphView::resizeEvent(QResizeEvent*)
  4267. {
  4268. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  4269. }
  4270. /*:396*//*397:*/
  4271. #line 8954 "./typica.w"
  4272. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  4273. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  4274. {
  4275. double offset= 0;
  4276. if(measure.contains("relative"))
  4277. {
  4278. if(measure.value("relative").toBool())
  4279. {
  4280. if(relativeEnabled)
  4281. {
  4282. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  4283. }
  4284. else
  4285. {
  4286. return;
  4287. }
  4288. }
  4289. }
  4290. if(translations->contains(tempcolumn))
  4291. {
  4292. offset= translations->value(tempcolumn);
  4293. }
  4294. if(prevPoints->contains(tempcolumn))
  4295. {
  4296. /*399:*/
  4297. #line 9031 "./typica.w"
  4298. QGraphicsLineItem*segment= new QGraphicsLineItem;
  4299. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  4300. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  4301. -(prevPoints->value(tempcolumn).y()),
  4302. nextPoint.x()+offset,-(nextPoint.y()));
  4303. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  4304. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  4305. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  4306. Qt::darkYellow};
  4307. segment->setPen(p[tempcolumn%12]);
  4308. theScene->addItem(segment);
  4309. prevPoints->insert(tempcolumn,nextPoint);
  4310. if(timeIndicatorEnabled)
  4311. {
  4312. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  4313. }
  4314. /*:399*/
  4315. #line 8980 "./typica.w"
  4316. if(graphLines->contains(tempcolumn))
  4317. {
  4318. graphLines->value(tempcolumn)->append(segment);
  4319. }
  4320. else
  4321. {
  4322. QList<QGraphicsLineItem*> *newLine=
  4323. new QList<QGraphicsLineItem*> ;
  4324. newLine->append(segment);
  4325. graphLines->insert(tempcolumn,newLine);
  4326. }
  4327. }
  4328. else
  4329. {
  4330. /*398:*/
  4331. #line 9016 "./typica.w"
  4332. int x= FULLTIMETOINT(measure.time())/1000;
  4333. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  4334. if(timeIndicatorEnabled)
  4335. {
  4336. timeLine->setLine(x,0,x,-500);
  4337. }
  4338. /*:398*/
  4339. #line 8997 "./typica.w"
  4340. }
  4341. }
  4342. /*:397*//*400:*/
  4343. #line 9052 "./typica.w"
  4344. void GraphView::clear()
  4345. {
  4346. int i;
  4347. foreach(i,prevPoints->keys())
  4348. {
  4349. removeSeries(i);
  4350. }
  4351. translations->clear();
  4352. }
  4353. /*:400*//*401:*/
  4354. #line 9066 "./typica.w"
  4355. void GraphView::removeSeries(int column)
  4356. {
  4357. if(graphLines->contains(column))
  4358. {
  4359. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4360. QGraphicsLineItem*segment;
  4361. foreach(segment,*series)
  4362. {
  4363. theScene->removeItem(segment);
  4364. }
  4365. qDeleteAll(*series);
  4366. }
  4367. graphLines->remove(column);
  4368. prevPoints->remove(column);
  4369. }
  4370. /*:401*//*402:*/
  4371. #line 9085 "./typica.w"
  4372. void GraphView::setSeriesTranslation(int column,double offset)
  4373. {
  4374. if(graphLines->contains(column))
  4375. {
  4376. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4377. QGraphicsLineItem*segment;
  4378. foreach(segment,*series)
  4379. {
  4380. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  4381. }
  4382. }
  4383. if(translations->contains(column))
  4384. {
  4385. translations->insert(column,offset+translations->value(column));
  4386. }
  4387. else
  4388. {
  4389. translations->insert(column,offset);
  4390. }
  4391. }
  4392. /*:402*//*403:*/
  4393. #line 9112 "./typica.w"
  4394. void GraphView::setTimeIndicatorEnabled(bool enabled)
  4395. {
  4396. timeIndicatorEnabled= enabled;
  4397. if(enabled)
  4398. {
  4399. timeLine->show();
  4400. }
  4401. else
  4402. {
  4403. timeLine->hide();
  4404. }
  4405. }
  4406. /*:403*/
  4407. #line 548 "./typica.w"
  4408. /*409:*/
  4409. #line 9259 "./typica.w"
  4410. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  4411. {
  4412. if(measure.time()!=QTime(0,0,0,0))
  4413. {
  4414. /*411:*/
  4415. #line 9333 "./typica.w"
  4416. if(lastMeasurement.contains(tempcolumn))
  4417. {
  4418. if(lastMeasurement[tempcolumn].time()<measure.time())
  4419. {
  4420. QList<QTime> timelist;
  4421. QList<double> templist;
  4422. QTime z= QTime(0,0,0,0);
  4423. double ptime= (double)(z.secsTo(lastMeasurement[tempcolumn].time()));
  4424. double ptemp= lastMeasurement[tempcolumn].temperature();
  4425. double ctime= (double)(z.secsTo(measure.time()));
  4426. double ctemp= measure.temperature();
  4427. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  4428. {
  4429. timelist.append(i);
  4430. double v= ((ptemp*(ctime-z.secsTo(i)))+(ctemp*(z.secsTo(i)-ptime)))/(ctime-ptime);
  4431. templist.append(v);
  4432. }
  4433. for(int i= 0;i<timelist.size();i++)
  4434. {
  4435. Measurement synthesized= measure;
  4436. synthesized.setTime(timelist[i]);
  4437. synthesized.setTemperature(templist[i]);
  4438. newMeasurement(synthesized,tempcolumn);
  4439. }
  4440. }
  4441. }
  4442. /*:411*/
  4443. #line 9264 "./typica.w"
  4444. }
  4445. model_ms->newMeasurement(measure,tempcolumn);
  4446. if(lastMeasurement.contains(tempcolumn))
  4447. {
  4448. if(measure.time().second()!=
  4449. lastMeasurement.value(tempcolumn).time().second())
  4450. {
  4451. Measurement adjusted= measure;
  4452. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  4453. adjusted.setTime(adjtime);
  4454. model_1s->newMeasurement(adjusted,tempcolumn);
  4455. if(adjusted.time().second()%5==0)
  4456. {
  4457. model_5s->newMeasurement(adjusted,tempcolumn);
  4458. if(adjusted.time().second()%10==0)
  4459. {
  4460. model_10s->newMeasurement(adjusted,tempcolumn);
  4461. }
  4462. if(adjusted.time().second()%15==0)
  4463. {
  4464. model_15s->newMeasurement(adjusted,tempcolumn);
  4465. if(adjusted.time().second()%30==0)
  4466. {
  4467. model_30s->newMeasurement(adjusted,tempcolumn);
  4468. if(adjusted.time().second()==0)
  4469. {
  4470. model_1m->newMeasurement(adjusted,tempcolumn);
  4471. }
  4472. }
  4473. }
  4474. }
  4475. }
  4476. /*413:*/
  4477. #line 9386 "./typica.w"
  4478. if(currentColumnSet.contains(tempcolumn))
  4479. {
  4480. int replicationcolumn;
  4481. foreach(replicationcolumn,currentColumnSet)
  4482. {
  4483. if(replicationcolumn!=tempcolumn)
  4484. {
  4485. if(lastMeasurement.contains(replicationcolumn))
  4486. {
  4487. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  4488. {
  4489. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  4490. synthetic.setTime(measure.time());
  4491. model_ms->newMeasurement(synthetic,replicationcolumn);
  4492. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  4493. {
  4494. Measurement adjusted= synthetic;
  4495. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  4496. model_1s->newMeasurement(adjusted,replicationcolumn);
  4497. if(adjusted.time().second()%5==0)
  4498. {
  4499. model_5s->newMeasurement(adjusted,replicationcolumn);
  4500. if(adjusted.time().second()%10==0)
  4501. {
  4502. model_10s->newMeasurement(adjusted,replicationcolumn);
  4503. }
  4504. if(adjusted.time().second()%15==0)
  4505. {
  4506. model_15s->newMeasurement(adjusted,replicationcolumn);
  4507. if(adjusted.time().second()%30==0)
  4508. {
  4509. model_30s->newMeasurement(adjusted,replicationcolumn);
  4510. if(adjusted.time().second()==0)
  4511. {
  4512. model_1m->newMeasurement(adjusted,replicationcolumn);
  4513. }
  4514. }
  4515. }
  4516. }
  4517. }
  4518. lastMeasurement[replicationcolumn]= synthetic;
  4519. }
  4520. }
  4521. }
  4522. }
  4523. }
  4524. /*:413*/
  4525. #line 9297 "./typica.w"
  4526. }
  4527. else
  4528. {
  4529. /*410:*/
  4530. #line 9309 "./typica.w"
  4531. MeasurementModel*m;
  4532. foreach(m,modelSet)
  4533. {
  4534. m->newMeasurement(measure,tempcolumn);
  4535. }
  4536. /*:410*/
  4537. #line 9301 "./typica.w"
  4538. }
  4539. lastMeasurement.insert(tempcolumn,measure);
  4540. }
  4541. /*:409*//*412:*/
  4542. #line 9372 "./typica.w"
  4543. void ZoomLog::addToCurrentColumnSet(int column)
  4544. {
  4545. currentColumnSet.append(column);
  4546. }
  4547. void ZoomLog::clearCurrentColumnSet()
  4548. {
  4549. currentColumnSet.clear();
  4550. }
  4551. /*:412*//*414:*/
  4552. #line 9456 "./typica.w"
  4553. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  4554. int annotationcolumn)
  4555. {
  4556. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4557. MeasurementModel*m;
  4558. if(lastMeasurement.contains(tempcolumn))
  4559. {
  4560. foreach(m,modelSet)
  4561. {
  4562. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  4563. }
  4564. }
  4565. foreach(m,modelSet)
  4566. {
  4567. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4568. }
  4569. }
  4570. /*:414*//*415:*/
  4571. #line 9480 "./typica.w"
  4572. void ZoomLog::centerOn(int row)
  4573. {
  4574. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  4575. }
  4576. /*:415*//*416:*/
  4577. #line 9490 "./typica.w"
  4578. void ZoomLog::clear()
  4579. {
  4580. MeasurementModel*m;
  4581. foreach(m,modelSet)
  4582. {
  4583. m->clear();
  4584. }
  4585. lastMeasurement.clear();
  4586. saveTempCols.clear();
  4587. saveControlCols.clear();
  4588. saveNoteCols.clear();
  4589. }
  4590. /*:416*//*417:*/
  4591. #line 9508 "./typica.w"
  4592. QVariant ZoomLog::data(int row,int column)const
  4593. {
  4594. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4595. Qt::DisplayRole);
  4596. }
  4597. int ZoomLog::rowCount()
  4598. {
  4599. return model_ms->rowCount();
  4600. }
  4601. /*:417*//*418:*/
  4602. #line 9531 "./typica.w"
  4603. bool ZoomLog::saveXML(QIODevice*device)
  4604. {
  4605. Units::Unit prevUnits= model_ms->displayUnits();
  4606. if(prevUnits!=Units::Fahrenheit)
  4607. {
  4608. model_ms->setDisplayUnits(Units::Fahrenheit);
  4609. }
  4610. XMLOutput writer(model_ms,device,0);
  4611. int c;
  4612. foreach(c,saveTempCols)
  4613. {
  4614. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4615. toString(),c);
  4616. }
  4617. foreach(c,saveControlCols)
  4618. {
  4619. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4620. toString(),c);
  4621. }
  4622. foreach(c,saveNoteCols)
  4623. {
  4624. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4625. toString(),c);
  4626. }
  4627. bool retval= writer.output();
  4628. if(prevUnits!=Units::Fahrenheit)
  4629. {
  4630. model_ms->setDisplayUnits(prevUnits);
  4631. }
  4632. return retval;
  4633. }
  4634. /*:418*//*419:*/
  4635. #line 9567 "./typica.w"
  4636. bool ZoomLog::saveCSV(QIODevice*device)
  4637. {
  4638. CSVOutput writer(currentModel,device,0);
  4639. int c;
  4640. foreach(c,saveTempCols)
  4641. {
  4642. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4643. toString(),c);
  4644. }
  4645. foreach(c,saveControlCols)
  4646. {
  4647. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4648. toString(),c);
  4649. }
  4650. foreach(c,saveNoteCols)
  4651. {
  4652. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4653. toString(),c);
  4654. }
  4655. return writer.output();
  4656. }
  4657. /*:419*//*420:*/
  4658. #line 9596 "./typica.w"
  4659. void ZoomLog::switchLOD(MeasurementModel*m)
  4660. {
  4661. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4662. setModel(m);
  4663. currentModel= m;
  4664. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4665. }
  4666. void ZoomLog::LOD_ms()
  4667. {
  4668. switchLOD(model_ms);
  4669. }
  4670. void ZoomLog::LOD_1s()
  4671. {
  4672. switchLOD(model_1s);
  4673. }
  4674. void ZoomLog::LOD_5s()
  4675. {
  4676. switchLOD(model_5s);
  4677. }
  4678. void ZoomLog::LOD_10s()
  4679. {
  4680. switchLOD(model_10s);
  4681. }
  4682. void ZoomLog::LOD_15s()
  4683. {
  4684. switchLOD(model_15s);
  4685. }
  4686. void ZoomLog::LOD_30s()
  4687. {
  4688. switchLOD(model_30s);
  4689. }
  4690. void ZoomLog::LOD_1m()
  4691. {
  4692. switchLOD(model_1m);
  4693. }
  4694. /*:420*//*421:*/
  4695. #line 9644 "./typica.w"
  4696. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4697. {
  4698. model_ms->setDisplayUnits(scale);
  4699. model_1s->setDisplayUnits(scale);
  4700. model_5s->setDisplayUnits(scale);
  4701. model_10s->setDisplayUnits(scale);
  4702. model_15s->setDisplayUnits(scale);
  4703. model_30s->setDisplayUnits(scale);
  4704. model_1m->setDisplayUnits(scale);
  4705. }
  4706. Units::Unit ZoomLog::displayUnits()
  4707. {
  4708. return model_ms->displayUnits();
  4709. }
  4710. /*:421*//*422:*/
  4711. #line 9664 "./typica.w"
  4712. QString ZoomLog::lastTime(int series)
  4713. {
  4714. Measurement measure= lastMeasurement.value(series);
  4715. QTime time= measure.time();
  4716. return time.toString("h:mm:ss.zzz");
  4717. }
  4718. /*:422*//*423:*/
  4719. #line 9674 "./typica.w"
  4720. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  4721. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  4722. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  4723. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  4724. {
  4725. setEditTriggers(QAbstractItemView::NoEditTriggers);
  4726. setSelectionMode(QAbstractItemView::NoSelection);
  4727. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  4728. model_30s<<model_1m;
  4729. currentModel= model_30s;
  4730. setModel(currentModel);
  4731. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4732. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  4733. this,SLOT(persistColumnResize(int,int,int)));
  4734. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  4735. this,SLOT(restoreColumnWidths()));
  4736. }
  4737. /*:423*//*424:*/
  4738. #line 9697 "./typica.w"
  4739. void ZoomLog::setHeaderData(int section,QString text)
  4740. {
  4741. MeasurementModel*m;
  4742. foreach(m,modelSet)
  4743. {
  4744. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  4745. }
  4746. }
  4747. /*:424*//*425:*/
  4748. #line 9715 "./typica.w"
  4749. void ZoomLog::addOutputTemperatureColumn(int column)
  4750. {
  4751. saveTempCols.append(column);
  4752. }
  4753. void ZoomLog::addOutputControlColumn(int column)
  4754. {
  4755. saveControlCols.append(column);
  4756. }
  4757. void ZoomLog::addOutputAnnotationColumn(int column)
  4758. {
  4759. saveNoteCols.append(column);
  4760. }
  4761. void ZoomLog::clearOutputColumns()
  4762. {
  4763. saveTempCols.clear();
  4764. saveControlCols.clear();
  4765. saveNoteCols.clear();
  4766. }
  4767. /*:425*//*426:*/
  4768. #line 9741 "./typica.w"
  4769. void ZoomLog::persistColumnResize(int column,int,int newsize)
  4770. {
  4771. /*651:*/
  4772. #line 13894 "./typica.w"
  4773. QSettings settings;
  4774. /*652:*/
  4775. #line 13907 "./typica.w"
  4776. QWidget*topLevelWidget= this;
  4777. while(topLevelWidget->parentWidget())
  4778. {
  4779. topLevelWidget= topLevelWidget->parentWidget();
  4780. }
  4781. /*:652*/
  4782. #line 13896 "./typica.w"
  4783. settings.setValue(QString("columnWidths/%1/%2/%3").
  4784. arg(topLevelWidget->objectName()).
  4785. arg(objectName()).arg(column),
  4786. QVariant(newsize));
  4787. /*:651*/
  4788. #line 9744 "./typica.w"
  4789. }
  4790. void ZoomLog::restoreColumnWidths()
  4791. {
  4792. /*654:*/
  4793. #line 13927 "./typica.w"
  4794. QSettings settings;
  4795. /*652:*/
  4796. #line 13907 "./typica.w"
  4797. QWidget*topLevelWidget= this;
  4798. while(topLevelWidget->parentWidget())
  4799. {
  4800. topLevelWidget= topLevelWidget->parentWidget();
  4801. }
  4802. /*:652*/
  4803. #line 13929 "./typica.w"
  4804. QString baseKey=
  4805. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4806. arg(objectName());
  4807. for(int i= 0;i<model()->columnCount();i++)
  4808. {
  4809. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4810. if(settings.contains(key))
  4811. {
  4812. setColumnWidth(i,settings.value(key).toInt());
  4813. }
  4814. }
  4815. /*:654*/
  4816. #line 9749 "./typica.w"
  4817. }
  4818. void ZoomLog::setVisible(bool visibility)
  4819. {
  4820. QTableView::setVisible(visibility);
  4821. }
  4822. void ZoomLog::showEvent(QShowEvent*)
  4823. {
  4824. /*654:*/
  4825. #line 13927 "./typica.w"
  4826. QSettings settings;
  4827. /*652:*/
  4828. #line 13907 "./typica.w"
  4829. QWidget*topLevelWidget= this;
  4830. while(topLevelWidget->parentWidget())
  4831. {
  4832. topLevelWidget= topLevelWidget->parentWidget();
  4833. }
  4834. /*:652*/
  4835. #line 13929 "./typica.w"
  4836. QString baseKey=
  4837. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4838. arg(objectName());
  4839. for(int i= 0;i<model()->columnCount();i++)
  4840. {
  4841. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4842. if(settings.contains(key))
  4843. {
  4844. setColumnWidth(i,settings.value(key).toInt());
  4845. }
  4846. }
  4847. /*:654*/
  4848. #line 9759 "./typica.w"
  4849. }
  4850. /*:426*/
  4851. #line 549 "./typica.w"
  4852. /*435:*/
  4853. #line 9992 "./typica.w"
  4854. bool MeasurementList::operator<(const MeasurementList&other)const
  4855. {
  4856. return this->first().toTime()<other.first().toTime();
  4857. }
  4858. bool MeasurementList::operator==(const MeasurementList&other)const
  4859. {
  4860. return this->first().toTime()==other.first().toTime();
  4861. }
  4862. /*:435*//*436:*/
  4863. #line 10008 "./typica.w"
  4864. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  4865. {
  4866. return QModelIndex();
  4867. }
  4868. /*:436*//*437:*/
  4869. #line 10018 "./typica.w"
  4870. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  4871. {
  4872. if(measure.scale()==Units::Unitless)
  4873. {
  4874. controlColumns->insert(tempcolumn,true);
  4875. }
  4876. else
  4877. {
  4878. controlColumns->insert(tempcolumn,false);
  4879. }
  4880. MeasurementList*temp;
  4881. temp= new MeasurementList;
  4882. temp->append(QVariant(measure.time()));
  4883. /*438:*/
  4884. #line 10077 "./typica.w"
  4885. /*439:*/
  4886. #line 10122 "./typica.w"
  4887. QList<MeasurementList*> ::iterator i= lastInsertion;
  4888. bool quickscan= false;
  4889. if(entries->size()> 5)
  4890. {
  4891. if(**i<*temp)
  4892. {
  4893. i+= 1;
  4894. for(int j= 10;j> 0;j--)
  4895. {
  4896. if(i!=entries->end())
  4897. {
  4898. if(**i<*temp)
  4899. {
  4900. i+= 1;
  4901. }
  4902. else
  4903. {
  4904. quickscan= true;
  4905. break;
  4906. }
  4907. }
  4908. else
  4909. {
  4910. quickscan= true;
  4911. break;
  4912. }
  4913. }
  4914. }
  4915. else
  4916. {
  4917. if(**i==*temp)
  4918. {
  4919. quickscan= true;
  4920. }
  4921. }
  4922. }
  4923. /*:439*/
  4924. #line 10078 "./typica.w"
  4925. if(quickscan==false)
  4926. {
  4927. i= entries->begin();
  4928. QList<MeasurementList*> ::iterator u= entries->end();
  4929. QList<MeasurementList*> ::iterator midpoint;
  4930. int n= u-i;
  4931. int rA;
  4932. while(n> 0)
  4933. {
  4934. rA= n>>1;
  4935. midpoint= i+rA;
  4936. if(**midpoint<*temp)
  4937. {
  4938. i= midpoint+1;
  4939. n-= rA+1;
  4940. }
  4941. else
  4942. {
  4943. n= rA;
  4944. }
  4945. }
  4946. }
  4947. /*:438*/
  4948. #line 10032 "./typica.w"
  4949. MeasurementList*newEntry;
  4950. int insertion;
  4951. if(i!=entries->end())
  4952. {
  4953. insertion= entries->indexOf(*i);
  4954. if((*i)->first().toTime()==measure.time())
  4955. {
  4956. /*440:*/
  4957. #line 10164 "./typica.w"
  4958. if((*i)->size()<tempcolumn+1)
  4959. {
  4960. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  4961. {
  4962. (*i)->append(QVariant());
  4963. }
  4964. }
  4965. (*i)->replace(tempcolumn,measure);
  4966. lastInsertion= i;
  4967. emit dataChanged(createIndex(insertion,tempcolumn),
  4968. createIndex(insertion,tempcolumn));
  4969. lastTemperature->insert(tempcolumn,insertion);
  4970. /*:440*/
  4971. #line 10040 "./typica.w"
  4972. }
  4973. else
  4974. {
  4975. /*441:*/
  4976. #line 10182 "./typica.w"
  4977. beginInsertRows(QModelIndex(),insertion,insertion);
  4978. newEntry= new MeasurementList;
  4979. newEntry->append(QVariant(measure.time()));
  4980. for(int j= 0;j<tempcolumn+1;j++)
  4981. {
  4982. newEntry->append(QVariant());
  4983. }
  4984. newEntry->replace(tempcolumn,measure);
  4985. lastInsertion= entries->insert(i,newEntry);
  4986. endInsertRows();
  4987. lastTemperature->insert(tempcolumn,insertion);
  4988. /*:441*/
  4989. #line 10044 "./typica.w"
  4990. }
  4991. }
  4992. else
  4993. {
  4994. /*442:*/
  4995. #line 10200 "./typica.w"
  4996. insertion= entries->size();
  4997. /*441:*/
  4998. #line 10182 "./typica.w"
  4999. beginInsertRows(QModelIndex(),insertion,insertion);
  5000. newEntry= new MeasurementList;
  5001. newEntry->append(QVariant(measure.time()));
  5002. for(int j= 0;j<tempcolumn+1;j++)
  5003. {
  5004. newEntry->append(QVariant());
  5005. }
  5006. newEntry->replace(tempcolumn,measure);
  5007. lastInsertion= entries->insert(i,newEntry);
  5008. endInsertRows();
  5009. lastTemperature->insert(tempcolumn,insertion);
  5010. /*:441*/
  5011. #line 10202 "./typica.w"
  5012. /*:442*/
  5013. #line 10049 "./typica.w"
  5014. }
  5015. if(tempcolumn>=colcount)
  5016. {
  5017. colcount= tempcolumn+1;
  5018. }
  5019. emit rowChanged(insertion);
  5020. delete temp;
  5021. }
  5022. /*:437*//*443:*/
  5023. #line 10212 "./typica.w"
  5024. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  5025. int annotationColumn)
  5026. {
  5027. int r;
  5028. if(lastTemperature->contains(tempcolumn))
  5029. {
  5030. r= lastTemperature->value(tempcolumn);
  5031. }
  5032. else
  5033. {
  5034. r= 0;
  5035. }
  5036. if(r==0&&entries->size()==0)
  5037. {
  5038. /*444:*/
  5039. #line 10250 "./typica.w"
  5040. beginInsertRows(QModelIndex(),0,0);
  5041. MeasurementList*newEntry= new MeasurementList;
  5042. newEntry->append(QVariant(QTime(0,0,0,0)));
  5043. entries->append(newEntry);
  5044. endInsertRows();
  5045. /*:444*/
  5046. #line 10227 "./typica.w"
  5047. }
  5048. MeasurementList*row= entries->at(r);
  5049. if(row->size()<=annotationColumn)
  5050. {
  5051. for(int i= row->size()-1;i<annotationColumn+1;i++)
  5052. {
  5053. row->append(QVariant());
  5054. }
  5055. }
  5056. row->replace(annotationColumn,annotation);
  5057. emit dataChanged(createIndex(r,annotationColumn),
  5058. createIndex(r,annotationColumn));
  5059. emit rowChanged(r);
  5060. if(annotationColumn> colcount-1)
  5061. {
  5062. colcount= annotationColumn+1;
  5063. }
  5064. }
  5065. /*:443*//*445:*/
  5066. #line 10261 "./typica.w"
  5067. void MeasurementModel::clear()
  5068. {
  5069. beginRemoveRows(QModelIndex(),0,entries->size());
  5070. while(entries->size()!=0)
  5071. {
  5072. MeasurementList*row= entries->takeFirst();
  5073. delete row;
  5074. }
  5075. endRemoveRows();
  5076. colcount= hData->size();
  5077. lastTemperature->clear();
  5078. reset();
  5079. }
  5080. /*:445*//*446:*/
  5081. #line 10294 "./typica.w"
  5082. bool MeasurementModel::setData(const QModelIndex&index,
  5083. const QVariant&value,int role)
  5084. {
  5085. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  5086. {
  5087. return false;
  5088. }
  5089. /*447:*/
  5090. #line 10326 "./typica.w"
  5091. bool valid= false;
  5092. if(index.isValid())
  5093. {
  5094. if(index.row()<entries->size())
  5095. {
  5096. if(index.column()<colcount)
  5097. {
  5098. valid= true;
  5099. }
  5100. }
  5101. }
  5102. /*:447*/
  5103. #line 10302 "./typica.w"
  5104. if(!valid)
  5105. {
  5106. return false;
  5107. }
  5108. MeasurementList*row= entries->at(index.row());
  5109. if(index.column()>=row->size())
  5110. {
  5111. /*448:*/
  5112. #line 10343 "./typica.w"
  5113. for(int i= row->size()-1;i<index.column();i++)
  5114. {
  5115. row->append(QVariant());
  5116. }
  5117. /*:448*/
  5118. #line 10310 "./typica.w"
  5119. }
  5120. if(index.column()==0)
  5121. {
  5122. /*449:*/
  5123. #line 10358 "./typica.w"
  5124. QTime time;
  5125. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  5126. {
  5127. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  5128. {
  5129. return false;
  5130. }
  5131. }
  5132. row= entries->takeAt(index.row());
  5133. row->replace(index.column(),QVariant(time));
  5134. MeasurementList*temp= row;
  5135. /*438:*/
  5136. #line 10077 "./typica.w"
  5137. /*439:*/
  5138. #line 10122 "./typica.w"
  5139. QList<MeasurementList*> ::iterator i= lastInsertion;
  5140. bool quickscan= false;
  5141. if(entries->size()> 5)
  5142. {
  5143. if(**i<*temp)
  5144. {
  5145. i+= 1;
  5146. for(int j= 10;j> 0;j--)
  5147. {
  5148. if(i!=entries->end())
  5149. {
  5150. if(**i<*temp)
  5151. {
  5152. i+= 1;
  5153. }
  5154. else
  5155. {
  5156. quickscan= true;
  5157. break;
  5158. }
  5159. }
  5160. else
  5161. {
  5162. quickscan= true;
  5163. break;
  5164. }
  5165. }
  5166. }
  5167. else
  5168. {
  5169. if(**i==*temp)
  5170. {
  5171. quickscan= true;
  5172. }
  5173. }
  5174. }
  5175. /*:439*/
  5176. #line 10078 "./typica.w"
  5177. if(quickscan==false)
  5178. {
  5179. i= entries->begin();
  5180. QList<MeasurementList*> ::iterator u= entries->end();
  5181. QList<MeasurementList*> ::iterator midpoint;
  5182. int n= u-i;
  5183. int rA;
  5184. while(n> 0)
  5185. {
  5186. rA= n>>1;
  5187. midpoint= i+rA;
  5188. if(**midpoint<*temp)
  5189. {
  5190. i= midpoint+1;
  5191. n-= rA+1;
  5192. }
  5193. else
  5194. {
  5195. n= rA;
  5196. }
  5197. }
  5198. }
  5199. /*:438*/
  5200. #line 10370 "./typica.w"
  5201. entries->insert(i,row);
  5202. int newRow= entries->indexOf(*i);
  5203. if(newRow<index.row())
  5204. {
  5205. emit dataChanged(createIndex(newRow,index.column()),index);
  5206. }
  5207. else
  5208. {
  5209. emit dataChanged(index,createIndex(newRow,index.column()));
  5210. }
  5211. /*:449*/
  5212. #line 10314 "./typica.w"
  5213. }
  5214. else
  5215. {
  5216. /*450:*/
  5217. #line 10384 "./typica.w"
  5218. row->replace(index.column(),value);
  5219. emit dataChanged(index,index);
  5220. /*:450*/
  5221. #line 10318 "./typica.w"
  5222. }
  5223. return true;
  5224. }
  5225. /*:446*//*451:*/
  5226. #line 10392 "./typica.w"
  5227. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  5228. unit(Units::Fahrenheit),hData(new QStringList),
  5229. lastTemperature(new QHash<int,int> ),
  5230. controlColumns(new QHash<int,bool> )
  5231. {
  5232. colcount= 1;
  5233. entries= new QList<MeasurementList*> ;
  5234. lastInsertion= entries->begin();
  5235. hData->append(tr("Time"));
  5236. }
  5237. /*:451*//*452:*/
  5238. #line 10406 "./typica.w"
  5239. MeasurementModel::~MeasurementModel()
  5240. {
  5241. clear();
  5242. delete entries;
  5243. delete hData;
  5244. }
  5245. /*:452*//*453:*/
  5246. #line 10418 "./typica.w"
  5247. int MeasurementModel::rowCount(const QModelIndex&parent)const
  5248. {
  5249. if(parent==QModelIndex())
  5250. {
  5251. return entries->size();
  5252. }
  5253. return 0;
  5254. }
  5255. int MeasurementModel::columnCount(const QModelIndex&parent)const
  5256. {
  5257. if(parent==QModelIndex())
  5258. {
  5259. return colcount;
  5260. }
  5261. return 0;
  5262. }
  5263. /*:453*//*454:*/
  5264. #line 10445 "./typica.w"
  5265. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  5266. const QVariant&value,int)
  5267. {
  5268. if(orientation==Qt::Horizontal)
  5269. {
  5270. if(hData->size()<section+1)
  5271. {
  5272. for(int i= hData->size();i<section+1;i++)
  5273. {
  5274. if(colcount<i)
  5275. {
  5276. beginInsertColumns(QModelIndex(),i,i);
  5277. }
  5278. hData->append(QString());
  5279. if(colcount<i)
  5280. {
  5281. endInsertColumns();
  5282. }
  5283. }
  5284. }
  5285. hData->replace(section,value.toString());
  5286. emit headerDataChanged(orientation,section,section);
  5287. if(colcount<section+1)
  5288. {
  5289. colcount= section+1;
  5290. }
  5291. return true;
  5292. }
  5293. return false;
  5294. }
  5295. /*:454*//*455:*/
  5296. #line 10485 "./typica.w"
  5297. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  5298. {
  5299. beginResetModel();
  5300. unit= scale;
  5301. endResetModel();
  5302. }
  5303. Units::Unit MeasurementModel::displayUnits()
  5304. {
  5305. return unit;
  5306. }
  5307. /*:455*//*456:*/
  5308. #line 10511 "./typica.w"
  5309. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  5310. {
  5311. /*447:*/
  5312. #line 10326 "./typica.w"
  5313. bool valid= false;
  5314. if(index.isValid())
  5315. {
  5316. if(index.row()<entries->size())
  5317. {
  5318. if(index.column()<colcount)
  5319. {
  5320. valid= true;
  5321. }
  5322. }
  5323. }
  5324. /*:447*/
  5325. #line 10514 "./typica.w"
  5326. if(!valid)
  5327. {
  5328. return QVariant();
  5329. }
  5330. MeasurementList*row= entries->at(index.row());
  5331. if(role==Qt::UserRole)
  5332. {
  5333. return QVariant(row->at(index.column()));
  5334. }
  5335. if(role==Qt::DisplayRole||role==Qt::EditRole)
  5336. {
  5337. if(index.column()> row->size())
  5338. {
  5339. return QVariant();
  5340. }
  5341. else
  5342. {
  5343. if(index.column()==0)
  5344. {
  5345. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  5346. }
  5347. else if(lastTemperature->contains(index.column()))
  5348. {
  5349. QVariantMap v= row->at(index.column()).toMap();
  5350. if(!v.contains("measurement"))
  5351. {
  5352. return QVariant();
  5353. }
  5354. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  5355. {
  5356. return v.value("measurement");
  5357. }
  5358. else
  5359. {
  5360. if(v.contains("relative"))
  5361. {
  5362. if(v.value("relative").toBool())
  5363. {
  5364. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  5365. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  5366. }
  5367. }
  5368. return QVariant(QString("%1").
  5369. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  5370. (Units::Unit)(v.value("unit").toInt()),unit)));
  5371. }
  5372. }
  5373. return QVariant(row->at(index.column()).toString());
  5374. }
  5375. }
  5376. return QVariant();
  5377. }
  5378. /*:456*//*457:*/
  5379. #line 10570 "./typica.w"
  5380. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  5381. int role)const
  5382. {
  5383. if(orientation==Qt::Horizontal)
  5384. {
  5385. if(role==Qt::DisplayRole)
  5386. {
  5387. if(section<hData->size())
  5388. {
  5389. return QVariant(hData->at(section));
  5390. }
  5391. }
  5392. }
  5393. return QVariant();
  5394. }
  5395. /*:457*//*458:*/
  5396. #line 10597 "./typica.w"
  5397. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  5398. {
  5399. /*447:*/
  5400. #line 10326 "./typica.w"
  5401. bool valid= false;
  5402. if(index.isValid())
  5403. {
  5404. if(index.row()<entries->size())
  5405. {
  5406. if(index.column()<colcount)
  5407. {
  5408. valid= true;
  5409. }
  5410. }
  5411. }
  5412. /*:447*/
  5413. #line 10600 "./typica.w"
  5414. if(valid)
  5415. {
  5416. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5417. }
  5418. return 0;
  5419. }
  5420. /*:458*//*459:*/
  5421. #line 10612 "./typica.w"
  5422. QModelIndex MeasurementModel::index(int row,int column,
  5423. const QModelIndex&parent)const
  5424. {
  5425. if(parent==QModelIndex())
  5426. {
  5427. if(row<entries->size()&&entries->isEmpty()==false)
  5428. {
  5429. if(column<entries->at(row)->size())
  5430. {
  5431. return createIndex(row,column);
  5432. }
  5433. }
  5434. }
  5435. return QModelIndex();
  5436. }
  5437. /*:459*/
  5438. #line 550 "./typica.w"
  5439. /*461:*/
  5440. #line 10663 "./typica.w"
  5441. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  5442. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  5443. {
  5444. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  5445. }
  5446. /*:461*//*462:*/
  5447. #line 10678 "./typica.w"
  5448. void AnnotationButton::annotate()
  5449. {
  5450. if(note.contains("%1"))
  5451. {
  5452. count++;
  5453. emit annotation(note.arg(count),tc,ac);
  5454. }
  5455. else
  5456. {
  5457. emit annotation(note,tc,ac);
  5458. }
  5459. }
  5460. /*:462*//*463:*/
  5461. #line 10696 "./typica.w"
  5462. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  5463. {
  5464. tc= tempcolumn;
  5465. }
  5466. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  5467. {
  5468. ac= annotationcolumn;
  5469. }
  5470. void AnnotationButton::setAnnotation(const QString&annotation)
  5471. {
  5472. note= annotation;
  5473. }
  5474. /*:463*//*464:*/
  5475. #line 10715 "./typica.w"
  5476. void AnnotationButton::resetCount()
  5477. {
  5478. count= 0;
  5479. }
  5480. /*:464*/
  5481. #line 551 "./typica.w"
  5482. /*469:*/
  5483. #line 10798 "./typica.w"
  5484. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  5485. const QString&postt,
  5486. QWidget*parent)
  5487. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  5488. {
  5489. resetChange();
  5490. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  5491. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  5492. }
  5493. /*:469*//*470:*/
  5494. #line 10815 "./typica.w"
  5495. void AnnotationSpinBox::resetChange()
  5496. {
  5497. change= true;
  5498. }
  5499. /*:470*//*471:*/
  5500. #line 10826 "./typica.w"
  5501. void AnnotationSpinBox::annotate()
  5502. {
  5503. if(change)
  5504. {
  5505. change= false;
  5506. emit annotation(QString("%1%2%3").arg(pretext).
  5507. arg(value()).arg(posttext),tc,ac);
  5508. }
  5509. }
  5510. /*:471*//*472:*/
  5511. #line 10839 "./typica.w"
  5512. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  5513. {
  5514. tc= tempcolumn;
  5515. }
  5516. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  5517. {
  5518. ac= annotationcolumn;
  5519. }
  5520. void AnnotationSpinBox::setPretext(const QString&pret)
  5521. {
  5522. pretext= pret;
  5523. }
  5524. void AnnotationSpinBox::setPosttext(const QString&postt)
  5525. {
  5526. posttext= postt;
  5527. }
  5528. /*:472*/
  5529. #line 552 "./typica.w"
  5530. /*479:*/
  5531. #line 11008 "./typica.w"
  5532. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  5533. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  5534. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  5535. stopAction(new QAction(tr("Stop"),NULL)),
  5536. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  5537. relative(QTime::currentTime()),base(QTime(0,0,0))
  5538. {
  5539. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  5540. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  5541. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  5542. clock.setInterval(500);
  5543. clock.setSingleShot(false);
  5544. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  5545. setSegmentStyle(Filled);
  5546. updateDisplay();
  5547. }
  5548. /*:479*//*480:*/
  5549. #line 11029 "./typica.w"
  5550. void TimerDisplay::updateTime()
  5551. {
  5552. QTime time;
  5553. int cseconds= 0;
  5554. int oseconds= 0;
  5555. int r= 0;
  5556. QTime nt= QTime(0,0,0);
  5557. int n= 0;
  5558. int bseconds= 0;
  5559. switch(m)
  5560. {
  5561. case TimerDisplay::CountUp:
  5562. /*481:*/
  5563. #line 11061 "./typica.w"
  5564. /*482:*/
  5565. #line 11074 "./typica.w"
  5566. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5567. time= QTime::currentTime();
  5568. cseconds= TIMETOINT(time);
  5569. oseconds= TIMETOINT(relative);
  5570. r= cseconds-oseconds;
  5571. /*:482*/
  5572. #line 11062 "./typica.w"
  5573. nt= nt.addSecs(r);
  5574. if(nt!=s)
  5575. {
  5576. s= nt;
  5577. emit valueChanged(s);
  5578. }
  5579. /*:481*/
  5580. #line 11042 "./typica.w"
  5581. ;
  5582. break;
  5583. case TimerDisplay::CountDown:
  5584. /*483:*/
  5585. #line 11086 "./typica.w"
  5586. if(s> QTime(0,0,0))
  5587. {
  5588. /*482:*/
  5589. #line 11074 "./typica.w"
  5590. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5591. time= QTime::currentTime();
  5592. cseconds= TIMETOINT(time);
  5593. oseconds= TIMETOINT(relative);
  5594. r= cseconds-oseconds;
  5595. /*:482*/
  5596. #line 11089 "./typica.w"
  5597. bseconds= TIMETOINT(base);
  5598. n= bseconds-r;
  5599. nt= nt.addSecs(n);
  5600. if(nt!=s)
  5601. {
  5602. s= nt;
  5603. emit valueChanged(s);
  5604. }
  5605. }else{
  5606. stopTimer();
  5607. }
  5608. /*:483*/
  5609. #line 11045 "./typica.w"
  5610. ;
  5611. break;
  5612. case TimerDisplay::Clock:
  5613. /*484:*/
  5614. #line 11105 "./typica.w"
  5615. time= QTime::currentTime();
  5616. if(time!=s)
  5617. {
  5618. s= time;
  5619. emit valueChanged(s);
  5620. }
  5621. /*:484*/
  5622. #line 11048 "./typica.w"
  5623. ;
  5624. break;
  5625. default:
  5626. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5627. break;
  5628. }
  5629. updateDisplay();
  5630. }
  5631. /*:480*//*485:*/
  5632. #line 11117 "./typica.w"
  5633. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5634. void TimerDisplay::startTimer()
  5635. {
  5636. if(!running)
  5637. {
  5638. relative= QTime::currentTime();
  5639. if(ar)
  5640. {
  5641. reset();
  5642. }
  5643. else
  5644. {
  5645. relative= TIMESUBTRACT(relative,s);
  5646. }
  5647. if(m==Clock)
  5648. {
  5649. updateTime();
  5650. }
  5651. base= s;
  5652. clock.start();
  5653. running= true;
  5654. emit runStateChanged(true);
  5655. }
  5656. }
  5657. /*:485*//*486:*/
  5658. #line 11147 "./typica.w"
  5659. void TimerDisplay::stopTimer()
  5660. {
  5661. if(running)
  5662. {
  5663. clock.stop();
  5664. running= false;
  5665. emit runStateChanged(false);
  5666. }
  5667. }
  5668. /*:486*//*487:*/
  5669. #line 11160 "./typica.w"
  5670. TimerDisplay::~TimerDisplay()
  5671. {
  5672. clock.stop();
  5673. }
  5674. /*:487*//*488:*/
  5675. #line 11169 "./typica.w"
  5676. void TimerDisplay::setCountUpMode()
  5677. {
  5678. m= TimerDisplay::CountUp;
  5679. }
  5680. void TimerDisplay::setCountDownMode()
  5681. {
  5682. m= TimerDisplay::CountDown;
  5683. }
  5684. void TimerDisplay::setClockMode()
  5685. {
  5686. m= TimerDisplay::Clock;
  5687. }
  5688. /*:488*//*489:*/
  5689. #line 11187 "./typica.w"
  5690. QString TimerDisplay::value()
  5691. {
  5692. return s.toString(f);
  5693. }
  5694. QTime TimerDisplay::seconds()
  5695. {
  5696. return s;
  5697. }
  5698. TimerDisplay::TimerMode TimerDisplay::mode()
  5699. {
  5700. return m;
  5701. }
  5702. bool TimerDisplay::isRunning()
  5703. {
  5704. return running;
  5705. }
  5706. QTime TimerDisplay::resetValue()
  5707. {
  5708. return r;
  5709. }
  5710. QString TimerDisplay::displayFormat()
  5711. {
  5712. return f;
  5713. }
  5714. bool TimerDisplay::autoReset()
  5715. {
  5716. return ar;
  5717. }
  5718. /*:489*//*490:*/
  5719. #line 11225 "./typica.w"
  5720. void TimerDisplay::setTimer(QTime value)
  5721. {
  5722. if(value.isValid())
  5723. {
  5724. s= value;
  5725. updateDisplay();
  5726. emit valueChanged(value);
  5727. }
  5728. }
  5729. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  5730. {
  5731. m= mode;
  5732. }
  5733. void TimerDisplay::setResetValue(QTime value)
  5734. {
  5735. r= value;
  5736. }
  5737. void TimerDisplay::setDisplayFormat(QString format)
  5738. {
  5739. f= format;
  5740. setNumDigits(format.length());
  5741. }
  5742. void TimerDisplay::setAutoReset(bool reset)
  5743. {
  5744. ar= reset;
  5745. }
  5746. /*:490*//*491:*/
  5747. #line 11260 "./typica.w"
  5748. void TimerDisplay::copyTimer()
  5749. {
  5750. QApplication::clipboard()->setText(value());
  5751. }
  5752. /*:491*//*492:*/
  5753. #line 11269 "./typica.w"
  5754. void TimerDisplay::reset()
  5755. {
  5756. if(!running)
  5757. {
  5758. s= r;
  5759. updateDisplay();
  5760. }
  5761. }
  5762. /*:492*//*493:*/
  5763. #line 11282 "./typica.w"
  5764. void TimerDisplay::updateDisplay()
  5765. {
  5766. display(value());
  5767. }
  5768. /*:493*/
  5769. #line 553 "./typica.w"
  5770. /*500:*/
  5771. #line 11407 "./typica.w"
  5772. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  5773. {
  5774. int x= rect.x();
  5775. int y= rect.y();
  5776. QLayoutItem*item;
  5777. if(orientation==Qt::Horizontal)
  5778. {
  5779. /*501:*/
  5780. #line 11431 "./typica.w"
  5781. foreach(item,itemList)
  5782. {
  5783. int nextX= x+item->sizeHint().width()+spacing();
  5784. int right= x+item->sizeHint().width();
  5785. if(item==itemList.last())
  5786. {
  5787. right= rect.right();
  5788. }
  5789. int bottom= rect.bottom();
  5790. if(!testOnly)
  5791. {
  5792. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5793. }
  5794. x= nextX;
  5795. }
  5796. /*:501*/
  5797. #line 11415 "./typica.w"
  5798. }
  5799. else
  5800. {
  5801. /*502:*/
  5802. #line 11450 "./typica.w"
  5803. foreach(item,itemList)
  5804. {
  5805. int nextY= y+item->sizeHint().height()+spacing();
  5806. int bottom= y+item->sizeHint().height();
  5807. if(item==itemList.last())
  5808. {
  5809. bottom= rect.bottom();
  5810. }
  5811. int right= rect.right();
  5812. if(!testOnly)
  5813. {
  5814. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5815. }
  5816. y= nextY;
  5817. }
  5818. /*:502*/
  5819. #line 11419 "./typica.w"
  5820. }
  5821. return y;
  5822. }
  5823. /*:500*//*503:*/
  5824. #line 11474 "./typica.w"
  5825. QSize PackLayout::minimumSize()const
  5826. {
  5827. QSize size;
  5828. QLayoutItem*item;
  5829. foreach(item,itemList)
  5830. {
  5831. if(orientation==Qt::Horizontal)
  5832. {
  5833. size+= QSize(item->minimumSize().width(),0);
  5834. if(size.height()<item->minimumSize().height())
  5835. {
  5836. size.setHeight(item->minimumSize().height());
  5837. }
  5838. }
  5839. else
  5840. {
  5841. size+= QSize(0,item->minimumSize().height());
  5842. if(size.width()<item->minimumSize().width())
  5843. {
  5844. size.setWidth(item->minimumSize().width());
  5845. }
  5846. }
  5847. }
  5848. size+= QSize(2*margin(),2*margin());
  5849. return size;
  5850. }
  5851. /*:503*//*504:*/
  5852. #line 11506 "./typica.w"
  5853. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  5854. QLayout(parent)
  5855. {
  5856. setMargin(margin);
  5857. setSpacing(spacing);
  5858. setOrientation(Qt::Horizontal);
  5859. }
  5860. PackLayout::PackLayout(int spacing)
  5861. {
  5862. setSpacing(spacing);
  5863. setOrientation(Qt::Horizontal);
  5864. }
  5865. /*:504*//*505:*/
  5866. #line 11524 "./typica.w"
  5867. PackLayout::~PackLayout()
  5868. {
  5869. QLayoutItem*item;
  5870. while((item= takeAt(0)))
  5871. {
  5872. delete item;
  5873. }
  5874. }
  5875. /*:505*//*506:*/
  5876. #line 11538 "./typica.w"
  5877. QLayoutItem*PackLayout::takeAt(int index)
  5878. {
  5879. if(index>=0&&index<itemList.size())
  5880. {
  5881. return itemList.takeAt(index);
  5882. }
  5883. else
  5884. {
  5885. return NULL;
  5886. }
  5887. }
  5888. /*:506*//*507:*/
  5889. #line 11554 "./typica.w"
  5890. QLayoutItem*PackLayout::itemAt(int index)const
  5891. {
  5892. if(index>=0&&index<itemList.size())
  5893. {
  5894. return itemList.at(index);
  5895. }
  5896. else
  5897. {
  5898. return NULL;
  5899. }
  5900. }
  5901. /*:507*//*508:*/
  5902. #line 11577 "./typica.w"
  5903. void PackLayout::addItem(QLayoutItem*item)
  5904. {
  5905. itemList.append(item);
  5906. }
  5907. /*:508*//*509:*/
  5908. #line 11585 "./typica.w"
  5909. int PackLayout::count()const
  5910. {
  5911. return itemList.size();
  5912. }
  5913. /*:509*//*510:*/
  5914. #line 11597 "./typica.w"
  5915. Qt::Orientations PackLayout::expandingDirections()const
  5916. {
  5917. return Qt::Vertical|Qt::Horizontal;
  5918. }
  5919. bool PackLayout::hasHeightForWidth()const
  5920. {
  5921. return false;
  5922. }
  5923. int PackLayout::heightForWidth(int width)const
  5924. {
  5925. return doLayout(QRect(0,0,width,0),true);
  5926. }
  5927. void PackLayout::setGeometry(const QRect&rect)
  5928. {
  5929. QLayout::setGeometry(rect);
  5930. doLayout(rect,false);
  5931. }
  5932. QSize PackLayout::sizeHint()const
  5933. {
  5934. return minimumSize();
  5935. }
  5936. /*:510*//*511:*/
  5937. #line 11628 "./typica.w"
  5938. void PackLayout::setOrientation(Qt::Orientations direction)
  5939. {
  5940. orientation= direction;
  5941. doLayout(geometry(),false);
  5942. }
  5943. /*:511*/
  5944. #line 554 "./typica.w"
  5945. /*513:*/
  5946. #line 11667 "./typica.w"
  5947. SceneButton::SceneButton():QGraphicsScene()
  5948. {
  5949. }
  5950. SceneButton::~SceneButton()
  5951. {
  5952. }
  5953. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  5954. {
  5955. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  5956. }
  5957. /*:513*/
  5958. #line 555 "./typica.w"
  5959. /*515:*/
  5960. #line 11713 "./typica.w"
  5961. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  5962. Qt::Orientations orientation,
  5963. QWidget*parent,Qt::WindowFlags f):
  5964. QWidget(parent,f),label(new QGraphicsView()),
  5965. scene(new SceneButton())
  5966. {
  5967. layout= new PackLayout(this);
  5968. layout->setOrientation(orientation);
  5969. /*516:*/
  5970. #line 11733 "./typica.w"
  5971. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5972. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5973. label->setFrameShape(QFrame::NoFrame);
  5974. label->setInteractive(true);
  5975. /*:516*/
  5976. #line 11722 "./typica.w"
  5977. /*517:*/
  5978. #line 11744 "./typica.w"
  5979. scene->setBackgroundBrush(Qt::cyan);
  5980. text= scene->addText(labeltext);
  5981. if(orientation==Qt::Horizontal)
  5982. {
  5983. text->rotate(270.0);
  5984. }
  5985. label->setScene(scene);
  5986. /*:517*/
  5987. #line 11723 "./typica.w"
  5988. /*518:*/
  5989. #line 11762 "./typica.w"
  5990. if(orientation==Qt::Horizontal)
  5991. {
  5992. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  5993. }
  5994. else
  5995. {
  5996. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  5997. }
  5998. label->centerOn(text);
  5999. /*:518*/
  6000. #line 11724 "./typica.w"
  6001. /*519:*/
  6002. #line 11777 "./typica.w"
  6003. layout->addWidget(label);
  6004. layout->addWidget(widget);
  6005. if(orientation==Qt::Horizontal)
  6006. {
  6007. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  6008. widget->sizeHint().height());
  6009. }
  6010. else
  6011. {
  6012. setMinimumSize(widget->sizeHint().width(),
  6013. widget->sizeHint().height()+label->sizeHint().height());
  6014. }
  6015. /*:519*/
  6016. #line 11725 "./typica.w"
  6017. }
  6018. /*:515*//*520:*/
  6019. #line 11794 "./typica.w"
  6020. void WidgetDecorator::setBackgroundBrush(QBrush background)
  6021. {
  6022. scene->setBackgroundBrush(background);
  6023. }
  6024. void WidgetDecorator::setTextColor(QColor color)
  6025. {
  6026. text->setDefaultTextColor(color);
  6027. }
  6028. /*:520*//*521:*/
  6029. #line 11807 "./typica.w"
  6030. WidgetDecorator::~WidgetDecorator()
  6031. {
  6032. }
  6033. /*:521*/
  6034. #line 556 "./typica.w"
  6035. /*526:*/
  6036. #line 11906 "./typica.w"
  6037. void LogEditWindow::addTheRows()
  6038. {
  6039. QTime s= startTime->time();
  6040. while(s<endTime->time())
  6041. {
  6042. model->newMeasurement(Measurement(0,s),1);
  6043. s= s.addSecs(interval->value());
  6044. }
  6045. model->newMeasurement(Measurement(0,endTime->time()),1);
  6046. }
  6047. /*:526*//*527:*/
  6048. #line 11920 "./typica.w"
  6049. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  6050. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  6051. addRowsLayout(new QHBoxLayout(NULL)),
  6052. startTimeLabel(new QLabel("Start Time")),
  6053. startTime(new QTimeEdit(QTime(0,0,0,0))),
  6054. endTimeLabel(new QLabel("End Time")),
  6055. endTime(new QTimeEdit(QTime(0,20,0,0))),
  6056. intervalLabel(new QLabel("Interval (seconds)")),
  6057. interval(new QSpinBox()),
  6058. addRows(new QPushButton("Add Rows")),
  6059. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  6060. saveCsv(new QAction(tr("Export CSV"),NULL)),
  6061. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  6062. model(new MeasurementModel()),
  6063. log(new QTableView())
  6064. {
  6065. /*528:*/
  6066. #line 11957 "./typica.w"
  6067. QSettings settings;
  6068. resize(settings.value("logSize",QSize(620,400)).toSize());
  6069. move(settings.value("logPos",QPoint(200,60)).toPoint());
  6070. /*:528*/
  6071. #line 11937 "./typica.w"
  6072. /*529:*/
  6073. #line 11970 "./typica.w"
  6074. mainLayout->setOrientation(Qt::Vertical);
  6075. addRowsLayout->addSpacing(10);
  6076. addRowsLayout->addWidget(startTimeLabel);
  6077. addRowsLayout->addWidget(startTime);
  6078. addRowsLayout->addSpacing(10);
  6079. startTime->setDisplayFormat("mm:ss");
  6080. addRowsLayout->addWidget(endTimeLabel);
  6081. addRowsLayout->addWidget(endTime);
  6082. addRowsLayout->addSpacing(10);
  6083. endTime->setDisplayFormat("mm:ss");
  6084. addRowsLayout->addWidget(intervalLabel);
  6085. addRowsLayout->addWidget(interval);
  6086. addRowsLayout->addSpacing(10);
  6087. interval->setRange(0,60);
  6088. interval->setValue(30);
  6089. addRowsLayout->addWidget(addRows);
  6090. addRowsLayout->addSpacing(10);
  6091. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  6092. /*:529*/
  6093. #line 11938 "./typica.w"
  6094. /*530:*/
  6095. #line 11993 "./typica.w"
  6096. model->setHeaderData(0,Qt::Horizontal,"Time");
  6097. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  6098. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  6099. model->clear();
  6100. /*:530*/
  6101. #line 11939 "./typica.w"
  6102. /*531:*/
  6103. #line 12002 "./typica.w"
  6104. log->setModel(model);
  6105. log->setColumnWidth(0,100);
  6106. log->setColumnWidth(1,100);
  6107. log->setColumnWidth(2,100);
  6108. /*:531*/
  6109. #line 11940 "./typica.w"
  6110. mainLayout->addItem(addRowsLayout);
  6111. mainLayout->addWidget(log);
  6112. centralWidget->setLayout(mainLayout);
  6113. setCentralWidget(centralWidget);
  6114. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  6115. fileMenu->addAction(openXml);
  6116. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  6117. fileMenu->addAction(saveXml);
  6118. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  6119. fileMenu->addAction(saveCsv);
  6120. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  6121. }
  6122. /*:527*//*532:*/
  6123. #line 12013 "./typica.w"
  6124. void LogEditWindow::saveXML()
  6125. {
  6126. QSettings settings;
  6127. QString lastDir= settings.value("lastDirectory").toString();
  6128. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  6129. lastDir,"",0);
  6130. QFile file(filename);
  6131. XMLOutput writer(model,&file,0);
  6132. writer.addTemperatureColumn("Temperature",1);
  6133. writer.addAnnotationColumn("Annotation",2);
  6134. if(writer.output())
  6135. {
  6136. QFileInfo info(filename);
  6137. QDir directory= info.dir();
  6138. lastDir= directory.path();
  6139. settings.setValue("lastDirectory",lastDir);
  6140. }
  6141. }
  6142. void LogEditWindow::saveCSV()
  6143. {
  6144. QSettings settings;
  6145. QString lastDir= settings.value("lastDirectory").toString();
  6146. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  6147. lastDir,"",0);
  6148. QFile file(filename);
  6149. CSVOutput writer(model,&file,0);
  6150. writer.addTemperatureColumn("Temperature",1);
  6151. writer.addAnnotationColumn("Annotation",2);
  6152. if(writer.output())
  6153. {
  6154. QFileInfo info(filename);
  6155. QDir directory= info.dir();
  6156. lastDir= directory.path();
  6157. settings.setValue("lastDirectory",lastDir);
  6158. }
  6159. }
  6160. /*:532*//*533:*/
  6161. #line 12056 "./typica.w"
  6162. void LogEditWindow::openXML()
  6163. {
  6164. QSettings settings;
  6165. QString lastDir= settings.value("lastDirectory").toString();
  6166. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  6167. lastDir,"",0);
  6168. if(filename.isNull())
  6169. {
  6170. return;
  6171. }
  6172. QFile file(filename);
  6173. XMLInput reader(&file,1);
  6174. connect(&reader,SIGNAL(measure(Measurement,int)),
  6175. model,SLOT(newMeasurement(Measurement,int)));
  6176. connect(&reader,SIGNAL(annotation(QString,int,int)),
  6177. model,SLOT(newAnnotation(QString,int,int)));
  6178. if(reader.input())
  6179. {
  6180. QFileInfo info(filename);
  6181. setWindowTitle(QString(tr("%1 - %2")).
  6182. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  6183. QDir directory= info.dir();
  6184. lastDir= directory.path();
  6185. settings.setValue("lastDirectory",lastDir);
  6186. }
  6187. }
  6188. /*:533*//*534:*/
  6189. #line 12087 "./typica.w"
  6190. void LogEditWindow::closeEvent(QCloseEvent*event)
  6191. {
  6192. QSettings settings;
  6193. settings.setValue("logSize",size());
  6194. settings.setValue("logPos",pos());
  6195. event->accept();
  6196. }
  6197. /*:534*/
  6198. #line 557 "./typica.w"
  6199. /*540:*/
  6200. #line 12202 "./typica.w"
  6201. bool XMLOutput::output()
  6202. {
  6203. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6204. {
  6205. return false;
  6206. }
  6207. QXmlStreamWriter xmlout(out);
  6208. xmlout.writeStartDocument("1.0");
  6209. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  6210. xmlout.writeStartElement("roastlog");
  6211. /*541:*/
  6212. #line 12235 "./typica.w"
  6213. foreach(int c,temperatureColumns.keys())
  6214. {
  6215. xmlout.writeStartElement("tempseries");
  6216. xmlout.writeAttribute("name",temperatureColumns.value(c));
  6217. xmlout.writeEndElement();
  6218. }
  6219. foreach(int c,controlColumns.keys())
  6220. {
  6221. xmlout.writeStartElement("controlseries");
  6222. xmlout.writeAttribute("name",controlColumns.value(c));
  6223. xmlout.writeEndElement();
  6224. }
  6225. foreach(int c,annotationColumns.keys())
  6226. {
  6227. xmlout.writeStartElement("noteseries");
  6228. xmlout.writeAttribute("name",annotationColumns.value(c));
  6229. xmlout.writeEndElement();
  6230. }
  6231. /*:541*/
  6232. #line 12213 "./typica.w"
  6233. xmlout.writeStartElement("roast");
  6234. bool oresult;
  6235. for(int i= 0;i<data->rowCount();i++)
  6236. {
  6237. /*542:*/
  6238. #line 12260 "./typica.w"
  6239. oresult= false;
  6240. foreach(int c,temperatureColumns.keys())
  6241. {
  6242. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6243. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6244. {
  6245. oresult= true;
  6246. break;
  6247. }
  6248. }
  6249. foreach(int c,controlColumns.keys())
  6250. {
  6251. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6252. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6253. {
  6254. oresult= true;
  6255. break;
  6256. }
  6257. }
  6258. if(oresult==false)
  6259. {
  6260. foreach(int c,annotationColumns.keys())
  6261. {
  6262. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6263. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6264. isEmpty()))
  6265. {
  6266. oresult= true;
  6267. break;
  6268. }
  6269. }
  6270. }
  6271. /*:542*/
  6272. #line 12218 "./typica.w"
  6273. if(oresult)
  6274. {
  6275. /*543:*/
  6276. #line 12299 "./typica.w"
  6277. xmlout.writeStartElement("tuple");
  6278. xmlout.writeTextElement("time",data->data(data->index(i,time),
  6279. Qt::DisplayRole).toString());
  6280. foreach(int c,temperatureColumns.keys())
  6281. {
  6282. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6283. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6284. {
  6285. xmlout.writeStartElement("temperature");
  6286. xmlout.writeAttribute("series",temperatureColumns.value(c));
  6287. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  6288. {
  6289. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  6290. {
  6291. xmlout.writeAttribute("relative","true");
  6292. }
  6293. }
  6294. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6295. toString());
  6296. xmlout.writeEndElement();
  6297. }
  6298. }
  6299. foreach(int c,controlColumns.keys())
  6300. {
  6301. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6302. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6303. {
  6304. xmlout.writeStartElement("control");
  6305. xmlout.writeAttribute("series",controlColumns.value(c));
  6306. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  6307. xmlout.writeEndElement();
  6308. }
  6309. }
  6310. foreach(int c,annotationColumns.keys())
  6311. {
  6312. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6313. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6314. {
  6315. xmlout.writeStartElement("annotation");
  6316. xmlout.writeAttribute("series",annotationColumns.value(c));
  6317. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6318. toString());
  6319. xmlout.writeEndElement();
  6320. }
  6321. }
  6322. xmlout.writeEndElement();
  6323. /*:543*/
  6324. #line 12221 "./typica.w"
  6325. }
  6326. }
  6327. xmlout.writeEndElement();
  6328. xmlout.writeEndElement();
  6329. xmlout.writeEndDocument();
  6330. out->close();
  6331. return true;
  6332. }
  6333. /*:540*//*544:*/
  6334. #line 12349 "./typica.w"
  6335. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  6336. :QObject(NULL),data(model),out(device),time(timec)
  6337. {
  6338. }
  6339. void XMLOutput::setModel(MeasurementModel*model)
  6340. {
  6341. data= model;
  6342. }
  6343. void XMLOutput::setTimeColumn(int column)
  6344. {
  6345. time= column;
  6346. }
  6347. void XMLOutput::setDevice(QIODevice*device)
  6348. {
  6349. out= device;
  6350. }
  6351. /*:544*//*545:*/
  6352. #line 12378 "./typica.w"
  6353. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  6354. {
  6355. temperatureColumns.insert(column,series);
  6356. }
  6357. void XMLOutput::addControlColumn(const QString&series,int column)
  6358. {
  6359. controlColumns.insert(column,series);
  6360. }
  6361. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  6362. {
  6363. annotationColumns.insert(column,series);
  6364. }
  6365. /*:545*/
  6366. #line 558 "./typica.w"
  6367. /*547:*/
  6368. #line 12435 "./typica.w"
  6369. bool XMLInput::input()
  6370. {
  6371. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  6372. {
  6373. return false;
  6374. }
  6375. QXmlStreamReader xmlin(in);
  6376. QMap<QString,int> temperatureColumns;
  6377. QMap<QString,int> annotationColumns;
  6378. int nextColumn= firstc;
  6379. /*548:*/
  6380. #line 12466 "./typica.w"
  6381. while(!xmlin.isDTD())
  6382. {
  6383. xmlin.readNext();
  6384. }
  6385. if(xmlin.isDTD())
  6386. {
  6387. if(xmlin.text()=="<!DOCTYPE roastlog>")
  6388. {
  6389. /*549:*/
  6390. #line 12488 "./typica.w"
  6391. emit newTemperatureColumn(firstc,"Bean");
  6392. emit newAnnotationColumn(firstc+1,"Note");
  6393. emit lastColumn(firstc+1);
  6394. /*:549*/
  6395. #line 12475 "./typica.w"
  6396. }
  6397. else
  6398. {
  6399. xmlin.readNext();
  6400. /*550:*/
  6401. #line 12497 "./typica.w"
  6402. while(xmlin.name()!="roast")
  6403. {
  6404. if(xmlin.isStartElement())
  6405. {
  6406. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  6407. {
  6408. temperatureColumns.insert(xmlin.attributes().value("name").
  6409. toString(),
  6410. nextColumn);
  6411. emit newTemperatureColumn(nextColumn,
  6412. xmlin.attributes().value("name").
  6413. toString());
  6414. nextColumn++;
  6415. }
  6416. else if(xmlin.name()=="noteseries")
  6417. {
  6418. annotationColumns.insert(xmlin.attributes().value("name").
  6419. toString(),nextColumn);
  6420. emit newAnnotationColumn(nextColumn,
  6421. xmlin.attributes().value("name").
  6422. toString());
  6423. nextColumn++;
  6424. }
  6425. }
  6426. xmlin.readNext();
  6427. }
  6428. emit lastColumn(nextColumn-1);
  6429. /*:550*/
  6430. #line 12480 "./typica.w"
  6431. }
  6432. }
  6433. /*:548*/
  6434. #line 12446 "./typica.w"
  6435. QTime timeval= QTime();
  6436. double tempval= 0;
  6437. QString noteval= QString();
  6438. int column;
  6439. int counter= 0;
  6440. while(!xmlin.atEnd())
  6441. {
  6442. /*551:*/
  6443. #line 12538 "./typica.w"
  6444. xmlin.readNext();
  6445. if(xmlin.isStartElement())
  6446. {
  6447. /*552:*/
  6448. #line 12564 "./typica.w"
  6449. if(xmlin.name()=="time")
  6450. {
  6451. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  6452. }
  6453. else if(xmlin.name()=="temperature")
  6454. {
  6455. column= xmlin.attributes().hasAttribute("series")?
  6456. temperatureColumns.value(xmlin.attributes().value("series").toString()):firstc;
  6457. bool relative= (xmlin.attributes().value("relative")=="true");
  6458. tempval= xmlin.readElementText().toDouble();
  6459. Measurement measurement(tempval,timeval);
  6460. if(relative)
  6461. {
  6462. measurement.insert("relative",true);
  6463. }
  6464. emit measure(measurement,column);
  6465. }
  6466. else if(xmlin.name()=="control")
  6467. {
  6468. column= xmlin.attributes().value("series").toString().isEmpty()?
  6469. firstc:temperatureColumns.value(xmlin.attributes().
  6470. value("series").toString());
  6471. tempval= xmlin.readElementText().toDouble();
  6472. Measurement measurement(tempval,timeval,Units::Unitless);
  6473. emit measure(measurement,column);
  6474. }
  6475. else if(xmlin.name()=="annotation")
  6476. {
  6477. column= xmlin.attributes().value("series").toString().isEmpty()?
  6478. firstc+1:annotationColumns.value(xmlin.attributes().
  6479. value("series").toString());
  6480. noteval= xmlin.readElementText();
  6481. if(!noteval.isEmpty())
  6482. {
  6483. emit annotation(noteval,firstc,column);
  6484. }
  6485. }
  6486. /*:552*/
  6487. #line 12542 "./typica.w"
  6488. }
  6489. counter++;
  6490. if(counter%100==0)
  6491. {
  6492. QCoreApplication::processEvents();
  6493. }
  6494. /*:551*/
  6495. #line 12454 "./typica.w"
  6496. }
  6497. return true;
  6498. }
  6499. /*:547*//*553:*/
  6500. #line 12605 "./typica.w"
  6501. XMLInput::XMLInput(QIODevice*input,int c):
  6502. firstc(c),in(input)
  6503. {
  6504. }
  6505. void XMLInput::setFirstColumn(int column)
  6506. {
  6507. firstc= column;
  6508. }
  6509. void XMLInput::setDevice(QIODevice*device)
  6510. {
  6511. in= device;
  6512. }
  6513. /*:553*/
  6514. #line 559 "./typica.w"
  6515. /*558:*/
  6516. #line 12696 "./typica.w"
  6517. bool CSVOutput::output()
  6518. {
  6519. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6520. {
  6521. return false;
  6522. }
  6523. QTextStream output(out);
  6524. /*559:*/
  6525. #line 12720 "./typica.w"
  6526. output<<"Time";
  6527. foreach(int c,temperatureColumns.keys())
  6528. {
  6529. output<<','<<temperatureColumns.value(c);
  6530. }
  6531. foreach(int c,controlColumns.keys())
  6532. {
  6533. output<<','<<controlColumns.value(c);
  6534. }
  6535. foreach(int c,annotationColumns.keys())
  6536. {
  6537. output<<','<<annotationColumns.value(c);
  6538. }
  6539. output<<'\n';
  6540. /*:559*/
  6541. #line 12704 "./typica.w"
  6542. bool oresult;
  6543. for(int i= 0;i<data->rowCount();i++)
  6544. {
  6545. /*542:*/
  6546. #line 12260 "./typica.w"
  6547. oresult= false;
  6548. foreach(int c,temperatureColumns.keys())
  6549. {
  6550. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6551. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6552. {
  6553. oresult= true;
  6554. break;
  6555. }
  6556. }
  6557. foreach(int c,controlColumns.keys())
  6558. {
  6559. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6560. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6561. {
  6562. oresult= true;
  6563. break;
  6564. }
  6565. }
  6566. if(oresult==false)
  6567. {
  6568. foreach(int c,annotationColumns.keys())
  6569. {
  6570. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6571. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6572. isEmpty()))
  6573. {
  6574. oresult= true;
  6575. break;
  6576. }
  6577. }
  6578. }
  6579. /*:542*/
  6580. #line 12708 "./typica.w"
  6581. if(oresult)
  6582. {
  6583. /*560:*/
  6584. #line 12745 "./typica.w"
  6585. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6586. foreach(int c,temperatureColumns.keys())
  6587. {
  6588. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6589. }
  6590. foreach(int c,controlColumns.keys())
  6591. {
  6592. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6593. }
  6594. foreach(int c,annotationColumns.keys())
  6595. {
  6596. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6597. }
  6598. output<<'\n';
  6599. /*:560*/
  6600. #line 12711 "./typica.w"
  6601. }
  6602. }
  6603. out->close();
  6604. return true;
  6605. }
  6606. /*:558*//*561:*/
  6607. #line 12764 "./typica.w"
  6608. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6609. data(model),out(device),time(timec)
  6610. {
  6611. }
  6612. void CSVOutput::setModel(MeasurementModel*model)
  6613. {
  6614. data= model;
  6615. }
  6616. void CSVOutput::setTimeColumn(int column)
  6617. {
  6618. time= column;
  6619. }
  6620. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6621. {
  6622. temperatureColumns.insert(column,series);
  6623. }
  6624. void CSVOutput::addControlColumn(const QString&series,int column)
  6625. {
  6626. controlColumns.insert(column,series);
  6627. }
  6628. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6629. {
  6630. annotationColumns.insert(column,series);
  6631. }
  6632. void CSVOutput::setDevice(QIODevice*device)
  6633. {
  6634. out= device;
  6635. }
  6636. #line 1 "./webview.w"
  6637. /*:561*/
  6638. #line 560 "./typica.w"
  6639. /*606:*/
  6640. #line 13027 "./typica.w"
  6641. QString SaltModel::arrayLiteral(int column,int role)const
  6642. {
  6643. QString literal= "'{";
  6644. for(int i= 0;i<rowCount();i++)
  6645. {
  6646. QString datum= data(index(i,column),role).toString();
  6647. if(!datum.isEmpty())
  6648. {
  6649. literal.append(datum);
  6650. literal.append(", ");
  6651. }
  6652. }
  6653. if(literal.size()> 2)
  6654. {
  6655. literal.chop(2);
  6656. }
  6657. literal.append("}'");
  6658. return literal;
  6659. }
  6660. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6661. {
  6662. QString literal= "'{";
  6663. for(int i= 0;i<rowCount();i++)
  6664. {
  6665. QString datum= data(index(i,column),role).toString();
  6666. if(!datum.isEmpty())
  6667. {
  6668. literal.append("\"");
  6669. literal.append(datum);
  6670. literal.append("\", ");
  6671. }
  6672. }
  6673. if(literal.size()> 2)
  6674. {
  6675. literal.chop(2);
  6676. }
  6677. literal.append("}'");
  6678. return literal;
  6679. }
  6680. /*:606*//*607:*/
  6681. #line 13071 "./typica.w"
  6682. QModelIndex SaltModel::parent(const QModelIndex&)const
  6683. {
  6684. return QModelIndex();
  6685. }
  6686. /*:607*//*608:*/
  6687. #line 13090 "./typica.w"
  6688. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6689. int role)
  6690. {
  6691. /*609:*/
  6692. #line 13121 "./typica.w"
  6693. bool valid= false;
  6694. if(index.isValid())
  6695. {
  6696. if(index.row()<modelData.size())
  6697. {
  6698. if(index.column()<colcount)
  6699. {
  6700. valid= true;
  6701. }
  6702. }
  6703. }
  6704. /*:609*/
  6705. #line 13094 "./typica.w"
  6706. if(!valid)
  6707. {
  6708. return false;
  6709. }
  6710. if(index.row()==modelData.size()-1)
  6711. {
  6712. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6713. /*610:*/
  6714. #line 13137 "./typica.w"
  6715. QList<QMap<int,QVariant> > newRow;
  6716. QMap<int,QVariant> defaults;
  6717. for(int i= 0;i<colcount;i++)
  6718. {
  6719. newRow.append(defaults);
  6720. }
  6721. modelData.append(newRow);
  6722. /*:610*/
  6723. #line 13102 "./typica.w"
  6724. endInsertRows();
  6725. }
  6726. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6727. QMap<int,QVariant> cell= row.at(index.column());
  6728. cell.insert(role,value);
  6729. if(role==Qt::EditRole)
  6730. {
  6731. cell.insert(Qt::DisplayRole,value);
  6732. }
  6733. row.replace(index.column(),cell);
  6734. modelData.replace(index.row(),row);
  6735. emit dataChanged(index,index);
  6736. return true;
  6737. }
  6738. /*:608*//*611:*/
  6739. #line 13148 "./typica.w"
  6740. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  6741. {
  6742. for(int i= 0;i<columns;i++)
  6743. {
  6744. hData<<"";
  6745. }
  6746. /*610:*/
  6747. #line 13137 "./typica.w"
  6748. QList<QMap<int,QVariant> > newRow;
  6749. QMap<int,QVariant> defaults;
  6750. for(int i= 0;i<colcount;i++)
  6751. {
  6752. newRow.append(defaults);
  6753. }
  6754. modelData.append(newRow);
  6755. /*:610*/
  6756. #line 13155 "./typica.w"
  6757. }
  6758. /*:611*//*612:*/
  6759. #line 13160 "./typica.w"
  6760. SaltModel::~SaltModel()
  6761. {
  6762. }
  6763. /*:612*//*613:*/
  6764. #line 13170 "./typica.w"
  6765. int SaltModel::rowCount(const QModelIndex&parent)const
  6766. {
  6767. return(parent==QModelIndex()?modelData.size():0);
  6768. }
  6769. int SaltModel::columnCount(const QModelIndex&parent)const
  6770. {
  6771. return(parent==QModelIndex()?colcount:0);
  6772. }
  6773. /*:613*//*614:*/
  6774. #line 13183 "./typica.w"
  6775. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  6776. const QVariant&value,int)
  6777. {
  6778. if(orientation==Qt::Horizontal&&section<colcount)
  6779. {
  6780. hData.replace(section,value.toString());
  6781. emit headerDataChanged(orientation,section,section);
  6782. return true;
  6783. }
  6784. return false;
  6785. }
  6786. /*:614*//*615:*/
  6787. #line 13198 "./typica.w"
  6788. QVariant SaltModel::data(const QModelIndex&index,int role)const
  6789. {
  6790. /*609:*/
  6791. #line 13121 "./typica.w"
  6792. bool valid= false;
  6793. if(index.isValid())
  6794. {
  6795. if(index.row()<modelData.size())
  6796. {
  6797. if(index.column()<colcount)
  6798. {
  6799. valid= true;
  6800. }
  6801. }
  6802. }
  6803. /*:609*/
  6804. #line 13201 "./typica.w"
  6805. if(!valid)
  6806. {
  6807. return QVariant();
  6808. }
  6809. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6810. QMap<int,QVariant> cell= row.at(index.column());
  6811. return cell.value(role,QVariant());
  6812. }
  6813. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  6814. int role)const
  6815. {
  6816. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  6817. section<colcount)
  6818. {
  6819. return QVariant(hData.at(section));
  6820. }
  6821. return QVariant();
  6822. }
  6823. /*:615*//*616:*/
  6824. #line 13225 "./typica.w"
  6825. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  6826. {
  6827. /*609:*/
  6828. #line 13121 "./typica.w"
  6829. bool valid= false;
  6830. if(index.isValid())
  6831. {
  6832. if(index.row()<modelData.size())
  6833. {
  6834. if(index.column()<colcount)
  6835. {
  6836. valid= true;
  6837. }
  6838. }
  6839. }
  6840. /*:609*/
  6841. #line 13228 "./typica.w"
  6842. if(valid)
  6843. {
  6844. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  6845. }
  6846. return 0;
  6847. }
  6848. /*:616*//*617:*/
  6849. #line 13239 "./typica.w"
  6850. QModelIndex SaltModel::index(int row,int column,
  6851. const QModelIndex&parent)const
  6852. {
  6853. if(parent==QModelIndex())
  6854. {
  6855. if(row<modelData.size()&&column<colcount)
  6856. {
  6857. return createIndex(row,column);
  6858. }
  6859. }
  6860. return QModelIndex();
  6861. }
  6862. /*:617*//*618:*/
  6863. #line 13257 "./typica.w"
  6864. void SaltModel::clear()
  6865. {
  6866. beginResetModel();
  6867. modelData.clear();
  6868. /*610:*/
  6869. #line 13137 "./typica.w"
  6870. QList<QMap<int,QVariant> > newRow;
  6871. QMap<int,QVariant> defaults;
  6872. for(int i= 0;i<colcount;i++)
  6873. {
  6874. newRow.append(defaults);
  6875. }
  6876. modelData.append(newRow);
  6877. /*:610*/
  6878. #line 13262 "./typica.w"
  6879. endResetModel();
  6880. }
  6881. /*:618*//*619:*/
  6882. #line 13271 "./typica.w"
  6883. bool SaltModel::removeRows(int row,int count,
  6884. const QModelIndex&parent)
  6885. {
  6886. if(parent==QModelIndex())
  6887. {
  6888. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  6889. {
  6890. beginRemoveRows(parent,row,row+count-1);
  6891. for(int i= 0;i<count;i++)
  6892. {
  6893. modelData.removeAt(row);
  6894. }
  6895. endRemoveRows();
  6896. if(modelData.size()==0)
  6897. {
  6898. beginInsertRows(parent,0,0);
  6899. /*610:*/
  6900. #line 13137 "./typica.w"
  6901. QList<QMap<int,QVariant> > newRow;
  6902. QMap<int,QVariant> defaults;
  6903. for(int i= 0;i<colcount;i++)
  6904. {
  6905. newRow.append(defaults);
  6906. }
  6907. modelData.append(newRow);
  6908. /*:610*/
  6909. #line 13288 "./typica.w"
  6910. endInsertRows();
  6911. }
  6912. return true;
  6913. }
  6914. }
  6915. return false;
  6916. }
  6917. /*:619*//*620:*/
  6918. #line 13302 "./typica.w"
  6919. int SaltModel::findData(const QVariant&value,int column,int role)
  6920. {
  6921. for(int i= 0;i<modelData.size();i++)
  6922. {
  6923. if(modelData.at(i).size()> column)
  6924. {
  6925. if(modelData.at(i).at(column).contains(role))
  6926. {
  6927. if(modelData.at(i).at(column).value(role)==value)
  6928. {
  6929. return i;
  6930. }
  6931. }
  6932. }
  6933. }
  6934. return-1;
  6935. }
  6936. /*:620*/
  6937. #line 561 "./typica.w"
  6938. /*622:*/
  6939. #line 13366 "./typica.w"
  6940. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  6941. {
  6942. SqlComboBox*widget= new SqlComboBox();
  6943. widget->setParent(parent);
  6944. for(int i= 0;i<count();i++)
  6945. {
  6946. widget->addItem(itemText(i),itemData(i));
  6947. }
  6948. return widget;
  6949. }
  6950. /*:622*//*623:*/
  6951. #line 13383 "./typica.w"
  6952. void SqlComboBox::showData(bool show)
  6953. {
  6954. dataColumnShown= show;
  6955. }
  6956. /*:623*//*624:*/
  6957. #line 13397 "./typica.w"
  6958. void SqlComboBox::addNullOption()
  6959. {
  6960. addItem(specialNullText,specialNullData);
  6961. }
  6962. void SqlComboBox::setNullText(QString nullText)
  6963. {
  6964. specialNullText= nullText;
  6965. }
  6966. void SqlComboBox::setNullData(QVariant nullData)
  6967. {
  6968. specialNullData= nullData;
  6969. }
  6970. /*:624*//*625:*/
  6971. #line 13420 "./typica.w"
  6972. void SqlComboBox::setDataColumn(int column)
  6973. {
  6974. dataColumn= column;
  6975. }
  6976. void SqlComboBox::setDisplayColumn(int column)
  6977. {
  6978. displayColumn= column;
  6979. }
  6980. /*:625*//*626:*/
  6981. #line 13434 "./typica.w"
  6982. void SqlComboBox::addSqlOptions(QString query)
  6983. {
  6984. SqlQueryConnection h;
  6985. QSqlQuery*dbquery= h.operator->();
  6986. if(!dbquery->exec(query))
  6987. {
  6988. QSqlError error= dbquery->lastError();
  6989. qDebug()<<error.databaseText();
  6990. qDebug()<<error.driverText();
  6991. qDebug()<<error.text();
  6992. qDebug()<<dbquery->lastQuery();
  6993. }
  6994. while(dbquery->next())
  6995. {
  6996. QString displayValue(dbquery->value(displayColumn).toString());
  6997. QString dataValue(dbquery->value(dataColumn).toString());
  6998. if(dataColumnShown)
  6999. {
  7000. displayValue.append(QString(" (%1)").arg(dataValue));
  7001. }
  7002. addItem(displayValue,dataValue);
  7003. }
  7004. }
  7005. /*:626*//*627:*/
  7006. #line 13470 "./typica.w"
  7007. SqlComboBox::SqlComboBox():
  7008. dataColumn(0),displayColumn(0),dataColumnShown(false),
  7009. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  7010. {
  7011. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  7012. }
  7013. SqlComboBox::~SqlComboBox()
  7014. {
  7015. }
  7016. /*:627*/
  7017. #line 562 "./typica.w"
  7018. /*629:*/
  7019. #line 13509 "./typica.w"
  7020. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  7021. {
  7022. delegate= widget;
  7023. }
  7024. /*:629*//*630:*/
  7025. #line 13518 "./typica.w"
  7026. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  7027. const QStyleOptionViewItem&,
  7028. const QModelIndex&)const
  7029. {
  7030. return delegate->clone(parent);
  7031. }
  7032. /*:630*//*631:*/
  7033. #line 13529 "./typica.w"
  7034. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  7035. const QModelIndex&index)const
  7036. {
  7037. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  7038. self->setCurrentIndex(self->findData(
  7039. index.model()->data(index,
  7040. Qt::UserRole).toString()));
  7041. }
  7042. /*:631*//*632:*/
  7043. #line 13542 "./typica.w"
  7044. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  7045. QAbstractItemModel*model,
  7046. const QModelIndex&index)const
  7047. {
  7048. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  7049. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  7050. Qt::UserRole);
  7051. model->setData(index,self->currentText(),Qt::DisplayRole);
  7052. }
  7053. /*:632*//*633:*/
  7054. #line 13555 "./typica.w"
  7055. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  7056. const QStyleOptionViewItem&option,
  7057. const QModelIndex&)const
  7058. {
  7059. editor->setGeometry(option.rect);
  7060. }
  7061. /*:633*//*634:*/
  7062. #line 13566 "./typica.w"
  7063. QSize SqlComboBoxDelegate::sizeHint()const
  7064. {
  7065. return delegate->sizeHint();
  7066. }
  7067. /*:634*//*635:*/
  7068. #line 13574 "./typica.w"
  7069. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  7070. :QItemDelegate(parent)
  7071. {
  7072. }
  7073. /*:635*/
  7074. #line 563 "./typica.w"
  7075. /*598:*/
  7076. #line 12836 "./typica.w"
  7077. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  7078. {
  7079. /*599:*/
  7080. #line 12851 "./typica.w"
  7081. setOrganizationName("Wilson's Coffee & Tea");
  7082. setOrganizationDomain("wilsonscoffee.com");
  7083. setApplicationName(PROGRAM_NAME);
  7084. /*:599*/
  7085. #line 12839 "./typica.w"
  7086. /*600:*/
  7087. #line 12860 "./typica.w"
  7088. QTranslator*base= new QTranslator;
  7089. if(base->load(QString("qt_%1").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
  7090. {
  7091. installTranslator(base);
  7092. }
  7093. QTranslator*app= new QTranslator;
  7094. if(app->load(QString("%1_%2").arg("Typica").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
  7095. {
  7096. installTranslator(app);
  7097. }
  7098. /*:600*/
  7099. #line 12840 "./typica.w"
  7100. /*307:*/
  7101. #line 123 "./measurement.w"
  7102. qRegisterMetaType<Measurement> ("Measurement");
  7103. /*:307*/
  7104. #line 12841 "./typica.w"
  7105. /*812:*/
  7106. #line 16862 "./typica.w"
  7107. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  7108. tr("NI DAQmx Base"),
  7109. "nidaqmxbase",NULL);
  7110. topLevelNodeInserters.append(inserter);
  7111. /*:812*//*820:*/
  7112. #line 17093 "./typica.w"
  7113. #ifdef Q_OS_WIN32
  7114. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  7115. topLevelNodeInserters.append(inserter);
  7116. #endif
  7117. /*:820*//*844:*/
  7118. #line 18060 "./typica.w"
  7119. #if 0
  7120. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  7121. topLevelNodeInserters.append(inserter);
  7122. #endif
  7123. /*:844*//*893:*/
  7124. #line 19573 "./typica.w"
  7125. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  7126. topLevelNodeInserters.append(inserter);
  7127. #line 1 "./modbus.w"
  7128. /*:893*//*899:*/
  7129. #line 328 "./modbus.w"
  7130. inserter= new NodeInserter(tr("ModbusNG Port"),tr("Modbus RTU Port"),"modbusngport",NULL);
  7131. topLevelNodeInserters.append(inserter);
  7132. /*:899*//*915:*/
  7133. #line 272 "./unsupportedserial.w"
  7134. inserter= new NodeInserter(tr("Other Device"),tr("Other Device"),
  7135. "unsupporteddevice",NULL);
  7136. topLevelNodeInserters.append(inserter);
  7137. /*:915*//*946:*/
  7138. #line 190 "./phidgets.w"
  7139. QLibrary phidgetsCheck("phidget21");
  7140. if(phidgetsCheck.load())
  7141. {
  7142. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  7143. "phidgets1048",NULL);
  7144. topLevelNodeInserters.append(inserter);
  7145. phidgetsCheck.unload();
  7146. }
  7147. else
  7148. {
  7149. phidgetsCheck.setFileName("Phidget21.framework/Phidget21");
  7150. if(phidgetsCheck.load())
  7151. {
  7152. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  7153. "phidgets1048",NULL);
  7154. topLevelNodeInserters.append(inserter);
  7155. phidgetsCheck.unload();
  7156. }
  7157. }
  7158. /*:946*//*1051:*/
  7159. #line 1241 "./dataqsdk.w"
  7160. #ifdef Q_OS_WIN32
  7161. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  7162. "dataqsdk",NULL);
  7163. topLevelNodeInserters.append(inserter);
  7164. #endif
  7165. #line 20242 "./typica.w"
  7166. #line 1 "./scales.w"
  7167. /*:1051*//*1076:*/
  7168. #line 557 "./scales.w"
  7169. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  7170. topLevelNodeInserters.append(inserter);
  7171. #line 20244 "./typica.w"
  7172. #line 1 "./valueannotation.w"
  7173. /*:1076*/
  7174. #line 12842 "./typica.w"
  7175. }
  7176. /*:598*//*602:*/
  7177. #line 12883 "./typica.w"
  7178. QDomDocument*Application::configuration()
  7179. {
  7180. return&conf;
  7181. }
  7182. /*:602*//*603:*/
  7183. #line 12892 "./typica.w"
  7184. QSqlDatabase Application::database()
  7185. {
  7186. QString connectionName;
  7187. QSqlDatabase connection=
  7188. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  7189. do
  7190. {
  7191. connectionName= QUuid::createUuid().toString();
  7192. }while(QSqlDatabase::connectionNames().contains(connectionName));
  7193. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  7194. }
  7195. /*:603*//*747:*/
  7196. #line 15395 "./typica.w"
  7197. void Application::saveDeviceConfiguration()
  7198. {
  7199. QSettings settings;
  7200. settings.setValue("DeviceConfiguration",
  7201. QVariant(deviceConfigurationDocument.toByteArray()));
  7202. }
  7203. /*:747*//*748:*/
  7204. #line 15407 "./typica.w"
  7205. QDomDocument Application::deviceConfiguration()
  7206. {
  7207. if(deviceConfigurationDocument.isNull())
  7208. {
  7209. /*749:*/
  7210. #line 15421 "./typica.w"
  7211. QSettings settings;
  7212. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  7213. QString etext;
  7214. int eline;
  7215. int ecol;
  7216. if(document.length()==0)
  7217. {
  7218. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  7219. /*750:*/
  7220. #line 15445 "./typica.w"
  7221. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  7222. emptyDocument.open(QIODevice::ReadOnly);
  7223. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  7224. &etext,&eline,&ecol))
  7225. {
  7226. /*751:*/
  7227. #line 15462 "./typica.w"
  7228. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7229. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7230. qDebug()<<etext;
  7231. /*:751*/
  7232. #line 15451 "./typica.w"
  7233. }
  7234. else
  7235. {
  7236. saveDeviceConfiguration();
  7237. }
  7238. /*:750*/
  7239. #line 15430 "./typica.w"
  7240. }
  7241. else
  7242. {
  7243. if(!deviceConfigurationDocument.setContent(document,false,
  7244. &etext,&eline,&ecol))
  7245. {
  7246. /*751:*/
  7247. #line 15462 "./typica.w"
  7248. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7249. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7250. qDebug()<<etext;
  7251. /*:751*/
  7252. #line 15437 "./typica.w"
  7253. /*750:*/
  7254. #line 15445 "./typica.w"
  7255. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  7256. emptyDocument.open(QIODevice::ReadOnly);
  7257. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  7258. &etext,&eline,&ecol))
  7259. {
  7260. /*751:*/
  7261. #line 15462 "./typica.w"
  7262. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7263. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7264. qDebug()<<etext;
  7265. /*:751*/
  7266. #line 15451 "./typica.w"
  7267. }
  7268. else
  7269. {
  7270. saveDeviceConfiguration();
  7271. }
  7272. /*:750*/
  7273. #line 15438 "./typica.w"
  7274. }
  7275. }
  7276. /*:749*/
  7277. #line 15412 "./typica.w"
  7278. }
  7279. return deviceConfigurationDocument;
  7280. }
  7281. /*:748*//*779:*/
  7282. #line 16063 "./typica.w"
  7283. void Application::registerDeviceConfigurationWidget(QString driver,
  7284. QMetaObject widget)
  7285. {
  7286. deviceConfigurationWidgets.insert(driver,widget);
  7287. }
  7288. /*:779*//*780:*/
  7289. #line 16079 "./typica.w"
  7290. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  7291. const QModelIndex&index)
  7292. {
  7293. QVariant nodeReference= index.data(Qt::UserRole);
  7294. QDomElement referenceElement= model->referenceElement(
  7295. model->data(index,Qt::UserRole).toString());
  7296. QMetaObject metaObject=
  7297. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  7298. QWidget::staticMetaObject);
  7299. QWidget*editor;
  7300. if(metaObject.className()==QWidget::staticMetaObject.className())
  7301. {
  7302. editor= NULL;
  7303. }
  7304. else
  7305. {
  7306. editor= qobject_cast<QWidget*> (
  7307. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  7308. Q_ARG(QModelIndex,index)));
  7309. }
  7310. return editor;
  7311. }
  7312. /*:780*/
  7313. #line 564 "./typica.w"
  7314. /*644:*/
  7315. #line 13722 "./typica.w"
  7316. SqlConnectionSetup::SqlConnectionSetup():
  7317. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  7318. portnumber(new QLineEdit),
  7319. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  7320. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  7321. cancelButton(new QPushButton(tr("Cancel"))),
  7322. connectButton(new QPushButton(tr("Connect")))
  7323. {
  7324. QSettings settings;
  7325. driver->addItem("PostgreSQL","QPSQL");
  7326. formLayout->addRow(tr("Database driver:"),driver);
  7327. formLayout->addRow(tr("Host name:"),hostname);
  7328. hostname->setText(settings.value("database/hostname").toString());
  7329. formLayout->addRow(tr("Port number:"),portnumber);
  7330. portnumber->setText(settings.value("database/portnumber","5432").toString());
  7331. formLayout->addRow(tr("Database name:"),dbname);
  7332. dbname->setText(settings.value("database/dbname").toString());
  7333. formLayout->addRow(tr("User name:"),user);
  7334. user->setText(settings.value("database/user").toString());
  7335. password->setEchoMode(QLineEdit::Password);
  7336. formLayout->addRow(tr("Password:"),password);
  7337. password->setText(settings.value("database/password").toString());
  7338. layout->addLayout(formLayout);
  7339. buttons->addStretch(1);
  7340. buttons->addWidget(cancelButton);
  7341. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  7342. buttons->addWidget(connectButton);
  7343. layout->addLayout(buttons);
  7344. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  7345. connectButton->setDefault(true);
  7346. setLayout(layout);
  7347. setModal(true);
  7348. }
  7349. SqlConnectionSetup::~SqlConnectionSetup()
  7350. {
  7351. }
  7352. /*:644*//*645:*/
  7353. #line 13765 "./typica.w"
  7354. void SqlConnectionSetup::testConnection()
  7355. {
  7356. QSqlDatabase database=
  7357. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  7358. toString());
  7359. database.setConnectOptions("application_name=Typica");
  7360. database.setHostName(hostname->text());
  7361. database.setPort(portnumber->text().toInt());
  7362. database.setDatabaseName(dbname->text());
  7363. database.setUserName(user->text());
  7364. database.setPassword(password->text());
  7365. if(database.open())
  7366. {
  7367. QSettings settings;
  7368. settings.setValue("database/exists","true");
  7369. settings.setValue("database/driver",
  7370. driver->itemData(driver->currentIndex()).toString());
  7371. settings.setValue("database/hostname",hostname->text());
  7372. settings.setValue("database/portnumber",portnumber->text());
  7373. settings.setValue("database/dbname",dbname->text());
  7374. settings.setValue("database/user",user->text());
  7375. settings.setValue("database/password",password->text());
  7376. database.close();
  7377. accept();
  7378. }
  7379. else
  7380. {
  7381. QMessageBox::information(this,tr("Database connection failed"),
  7382. tr("Failed to connect to database."));
  7383. }
  7384. }
  7385. /*:645*/
  7386. #line 565 "./typica.w"
  7387. /*649:*/
  7388. #line 13870 "./typica.w"
  7389. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  7390. {
  7391. setModel(new QSqlQueryModel);
  7392. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  7393. this,SLOT(openRow(QModelIndex)));
  7394. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  7395. this,SLOT(persistColumnResize(int,int,int)));
  7396. }
  7397. /*:649*//*650:*/
  7398. #line 13885 "./typica.w"
  7399. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  7400. {
  7401. /*651:*/
  7402. #line 13894 "./typica.w"
  7403. QSettings settings;
  7404. /*652:*/
  7405. #line 13907 "./typica.w"
  7406. QWidget*topLevelWidget= this;
  7407. while(topLevelWidget->parentWidget())
  7408. {
  7409. topLevelWidget= topLevelWidget->parentWidget();
  7410. }
  7411. /*:652*/
  7412. #line 13896 "./typica.w"
  7413. settings.setValue(QString("columnWidths/%1/%2/%3").
  7414. arg(topLevelWidget->objectName()).
  7415. arg(objectName()).arg(column),
  7416. QVariant(newsize));
  7417. /*:651*/
  7418. #line 13888 "./typica.w"
  7419. }
  7420. /*:650*//*653:*/
  7421. #line 13917 "./typica.w"
  7422. void SqlQueryView::showEvent(QShowEvent*event)
  7423. {
  7424. /*654:*/
  7425. #line 13927 "./typica.w"
  7426. QSettings settings;
  7427. /*652:*/
  7428. #line 13907 "./typica.w"
  7429. QWidget*topLevelWidget= this;
  7430. while(topLevelWidget->parentWidget())
  7431. {
  7432. topLevelWidget= topLevelWidget->parentWidget();
  7433. }
  7434. /*:652*/
  7435. #line 13929 "./typica.w"
  7436. QString baseKey=
  7437. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  7438. arg(objectName());
  7439. for(int i= 0;i<model()->columnCount();i++)
  7440. {
  7441. QString key= QString("%1/%2").arg(baseKey).arg(i);
  7442. if(settings.contains(key))
  7443. {
  7444. setColumnWidth(i,settings.value(key).toInt());
  7445. }
  7446. }
  7447. /*:654*/
  7448. #line 13920 "./typica.w"
  7449. event->accept();
  7450. }
  7451. /*:653*//*655:*/
  7452. #line 13944 "./typica.w"
  7453. void SqlQueryView::openRow(const QModelIndex&index)
  7454. {
  7455. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  7456. emit openEntryRow(index.row());
  7457. }
  7458. /*:655*//*656:*/
  7459. #line 13953 "./typica.w"
  7460. void SqlQueryView::setQuery(const QString&query)
  7461. {
  7462. QSqlDatabase database= AppInstance->database();
  7463. database.open();
  7464. QSqlQuery q(query,database);
  7465. ((QSqlQueryModel*)model())->setQuery(q);
  7466. database.close();
  7467. }
  7468. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  7469. const QVariant&value,int role)
  7470. {
  7471. return model()->setHeaderData(section,orientation,value,role);
  7472. }
  7473. /*:656*//*657:*/
  7474. #line 13971 "./typica.w"
  7475. QVariant SqlQueryView::data(int row,int column,int role)
  7476. {
  7477. return model()->data(model()->index(row,column),role);
  7478. }
  7479. /*:657*/
  7480. #line 566 "./typica.w"
  7481. /*173:*/
  7482. #line 4000 "./typica.w"
  7483. SqlQueryConnection::SqlQueryConnection(const QString&query)
  7484. {
  7485. QSqlDatabase database= AppInstance->database();
  7486. database.open();
  7487. q= new QSqlQuery(query,database);
  7488. connection= database.connectionName();
  7489. }
  7490. /*:173*//*174:*/
  7491. #line 4013 "./typica.w"
  7492. SqlQueryConnection::~SqlQueryConnection()
  7493. {
  7494. delete q;
  7495. {
  7496. QSqlDatabase database= QSqlDatabase::database(connection);
  7497. database.close();
  7498. }
  7499. QSqlDatabase::removeDatabase(connection);
  7500. }
  7501. /*:174*//*175:*/
  7502. #line 4027 "./typica.w"
  7503. QSqlQuery*SqlQueryConnection::operator->()const
  7504. {
  7505. return q;
  7506. }
  7507. /*:175*/
  7508. #line 567 "./typica.w"
  7509. /*676:*/
  7510. #line 14330 "./typica.w"
  7511. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  7512. area(frame),configuration(description)
  7513. {
  7514. refresh();
  7515. }
  7516. ReportTable::~ReportTable()
  7517. {
  7518. }
  7519. /*:676*//*677:*/
  7520. #line 14346 "./typica.w"
  7521. void ReportTable::bind(QString placeholder,QVariant value)
  7522. {
  7523. bindings.insert(placeholder,value);
  7524. }
  7525. /*:677*//*678:*/
  7526. #line 14356 "./typica.w"
  7527. void ReportTable::refresh()
  7528. {
  7529. /*679:*/
  7530. #line 14377 "./typica.w"
  7531. QTextCursor cursor= area->firstCursorPosition();
  7532. while(cursor<area->lastCursorPosition())
  7533. {
  7534. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  7535. }
  7536. cursor.removeSelectedText();
  7537. /*:679*/
  7538. #line 14359 "./typica.w"
  7539. int rows= 1;
  7540. int columns= 1;
  7541. int currentRow= 0;
  7542. QTextTable*table= cursor.insertTable(rows,columns);
  7543. /*680:*/
  7544. #line 14390 "./typica.w"
  7545. QTextTableFormat format= table->format();
  7546. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  7547. if(configuration.hasAttribute("align"))
  7548. {
  7549. if(configuration.attribute("align")=="center")
  7550. {
  7551. format.setAlignment(Qt::AlignHCenter);
  7552. }
  7553. }
  7554. table->setFormat(format);
  7555. /*:680*/
  7556. #line 14364 "./typica.w"
  7557. /*681:*/
  7558. #line 14404 "./typica.w"
  7559. QDomNodeList children= configuration.childNodes();
  7560. for(int i= 0;i<children.count();i++)
  7561. {
  7562. QDomNode current;
  7563. QDomElement currentElement;
  7564. current= children.at(i);
  7565. if(current.isElement())
  7566. {
  7567. currentElement= current.toElement();
  7568. if(currentElement.tagName()=="query")
  7569. {
  7570. /*682:*/
  7571. #line 14431 "./typica.w"
  7572. SqlQueryConnection h;
  7573. QSqlQuery*query= h.operator->();
  7574. query->prepare(currentElement.text());
  7575. foreach(QString key,bindings.uniqueKeys())
  7576. {
  7577. if(currentElement.text().contains(key))
  7578. {
  7579. query->bindValue(key,bindings.value(key));
  7580. }
  7581. }
  7582. query->exec();
  7583. if(!query->next())
  7584. {
  7585. continue;
  7586. }
  7587. if(query->record().count()> columns)
  7588. {
  7589. table->appendColumns(query->record().count()-columns);
  7590. }
  7591. do
  7592. {
  7593. table->appendRows(1);
  7594. rows++;
  7595. currentRow++;
  7596. for(int j= 0;j<query->record().count();j++)
  7597. {
  7598. QTextTableCell cell= table->cellAt(currentRow,j);
  7599. cursor= cell.firstCursorPosition();
  7600. cursor.insertText(query->value(j).toString());
  7601. }
  7602. }while(query->next());
  7603. /*:682*/
  7604. #line 14416 "./typica.w"
  7605. }
  7606. else if(currentElement.tagName()=="row")
  7607. {
  7608. /*683:*/
  7609. #line 14471 "./typica.w"
  7610. table->appendRows(1);
  7611. currentRow++;
  7612. rows++;
  7613. QDomNodeList rowChildren= currentElement.childNodes();
  7614. int currentColumn= 0;
  7615. for(int j= 0;j<rowChildren.count();j++)
  7616. {
  7617. QDomNode node;
  7618. QDomElement nodeElement;
  7619. node= rowChildren.at(j);
  7620. if(node.isElement())
  7621. {
  7622. nodeElement= node.toElement();
  7623. if(nodeElement.tagName()=="cell")
  7624. {
  7625. if(currentColumn==columns)
  7626. {
  7627. table->appendColumns(1);
  7628. columns++;
  7629. }
  7630. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7631. cursor= cell.firstCursorPosition();
  7632. cursor.insertText(nodeElement.text());
  7633. currentColumn++;
  7634. }
  7635. }
  7636. }
  7637. /*:683*/
  7638. #line 14420 "./typica.w"
  7639. }
  7640. }
  7641. }
  7642. /*:681*/
  7643. #line 14365 "./typica.w"
  7644. if(rows> 1)
  7645. {
  7646. table->removeRows(0,1);
  7647. }
  7648. }
  7649. /*:678*/
  7650. #line 568 "./typica.w"
  7651. /*715:*/
  7652. #line 14577 "./typica.w"
  7653. FormArray::FormArray(QDomElement description):configuration(description),
  7654. maxwidth(-1),maxheight(-1)
  7655. {
  7656. setWidget(&itemContainer);
  7657. itemContainer.setLayout(&itemLayout);
  7658. }
  7659. /*:715*//*716:*/
  7660. #line 14594 "./typica.w"
  7661. void FormArray::addElements(int copies)
  7662. {
  7663. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  7664. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  7665. QWidget*widget;
  7666. for(int i= 0;i<copies;i++)
  7667. {
  7668. widget= new QWidget;
  7669. if(maxwidth> -1)
  7670. {
  7671. widget->setMaximumWidth(maxwidth);
  7672. }
  7673. if(maxheight> -1)
  7674. {
  7675. widget->setMaximumHeight(maxheight);
  7676. }
  7677. if(configuration.hasChildNodes())
  7678. {
  7679. widgetStack->push(widget);
  7680. populateWidget(configuration,widgetStack,layoutStack);
  7681. widgetStack->pop();
  7682. widget->setMinimumHeight(widget->sizeHint().height());
  7683. itemLayout.addWidget(widget);
  7684. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  7685. {
  7686. itemContainer.setMinimumHeight(maxheight*elements()+50);
  7687. }
  7688. else
  7689. {
  7690. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  7691. +widget->sizeHint().height());
  7692. }
  7693. if(maxwidth> -1)
  7694. {
  7695. itemContainer.setMinimumWidth(maxwidth+50);
  7696. }
  7697. else
  7698. {
  7699. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  7700. }
  7701. }
  7702. }
  7703. }
  7704. /*:716*//*717:*/
  7705. #line 14644 "./typica.w"
  7706. QWidget*FormArray::elementAt(int index)
  7707. {
  7708. if(index<itemLayout.count())
  7709. {
  7710. QLayoutItem*item= itemLayout.itemAt(index);
  7711. return item->widget();
  7712. }
  7713. else
  7714. {
  7715. return NULL;
  7716. }
  7717. }
  7718. /*:717*//*718:*/
  7719. #line 14661 "./typica.w"
  7720. void FormArray::removeAllElements()
  7721. {
  7722. while(itemLayout.count()> 0)
  7723. {
  7724. QLayoutItem*item;
  7725. item= itemLayout.itemAt(0);
  7726. item->widget()->hide();
  7727. itemLayout.removeWidget(item->widget());
  7728. }
  7729. itemContainer.setMinimumHeight(0);
  7730. }
  7731. /*:718*//*719:*/
  7732. #line 14677 "./typica.w"
  7733. int FormArray::elements()
  7734. {
  7735. return itemLayout.count();
  7736. }
  7737. /*:719*//*720:*/
  7738. #line 14688 "./typica.w"
  7739. void FormArray::setMaximumElementWidth(int width)
  7740. {
  7741. maxwidth= width;
  7742. }
  7743. void FormArray::setMaximumElementHeight(int height)
  7744. {
  7745. maxheight= height;
  7746. }
  7747. /*:720*/
  7748. #line 569 "./typica.w"
  7749. /*726:*/
  7750. #line 14819 "./typica.w"
  7751. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  7752. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  7753. {
  7754. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  7755. QPointF(0,5);
  7756. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  7757. QPointF(10,5);
  7758. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  7759. QPointF(0,0);
  7760. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  7761. initialBrush.setColor(QColor(170,170,255));
  7762. initialBrush.setStyle(Qt::SolidPattern);
  7763. finalBrush.setColor(Qt::blue);
  7764. finalBrush.setStyle(Qt::SolidPattern);
  7765. initialDecrement.setPolygon(left);
  7766. initialDecrement.setBrush(initialBrush);
  7767. initialDecrement.setPos(0,0);
  7768. scene.addItem(&initialDecrement);
  7769. initialIncrement.setPolygon(right);
  7770. initialIncrement.setBrush(initialBrush);
  7771. initialIncrement.setPos(122,0);
  7772. scene.addItem(&initialIncrement);
  7773. finalDecrement.setPolygon(left);
  7774. finalDecrement.setBrush(finalBrush);
  7775. finalDecrement.setPos(0,12);
  7776. scene.addItem(&finalDecrement);
  7777. finalIncrement.setPolygon(right);
  7778. finalIncrement.setBrush(finalBrush);
  7779. finalIncrement.setPos(122,12);
  7780. scene.addItem(&finalIncrement);
  7781. scalePath.moveTo(0,10);
  7782. scalePath.lineTo(100,10);
  7783. scalePath.moveTo(0,0);
  7784. scalePath.lineTo(0,20);
  7785. scalePath.moveTo(10,5);
  7786. scalePath.lineTo(10,15);
  7787. scalePath.moveTo(20,5);
  7788. scalePath.lineTo(20,15);
  7789. scalePath.moveTo(30,5);
  7790. scalePath.lineTo(30,15);
  7791. scalePath.moveTo(40,5);
  7792. scalePath.lineTo(40,15);
  7793. scalePath.moveTo(50,0);
  7794. scalePath.lineTo(50,20);
  7795. scalePath.moveTo(60,5);
  7796. scalePath.lineTo(60,15);
  7797. scalePath.moveTo(70,5);
  7798. scalePath.lineTo(70,15);
  7799. scalePath.moveTo(80,5);
  7800. scalePath.lineTo(80,15);
  7801. scalePath.moveTo(90,5);
  7802. scalePath.lineTo(90,15);
  7803. scalePath.moveTo(100,0);
  7804. scalePath.lineTo(100,20);
  7805. scaleLine.setPath(scalePath);
  7806. scaleLine.setPos(16,1);
  7807. scene.addItem(&scaleLine);
  7808. setScene(&scene);
  7809. initialIndicator.setPolygon(down);
  7810. initialIndicator.setBrush(initialBrush);
  7811. finalIndicator.setPolygon(up);
  7812. finalIndicator.setBrush(finalBrush);
  7813. setMinimumSize(sizeHint());
  7814. setMaximumSize(sizeHint());
  7815. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7816. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7817. setMinimumSize(sizeHint());
  7818. }
  7819. /*:726*//*727:*/
  7820. #line 14892 "./typica.w"
  7821. QSize ScaleControl::sizeHint()const
  7822. {
  7823. return QSize(140,30);
  7824. }
  7825. /*:727*//*728:*/
  7826. #line 14901 "./typica.w"
  7827. void ScaleControl::setInitialValue(double value)
  7828. {
  7829. if(value>=0&&value<=10)
  7830. {
  7831. nonScoredValue= value;
  7832. if(!initialSet)
  7833. {
  7834. scene.addItem(&initialIndicator);
  7835. }
  7836. initialSet= true;
  7837. initialIndicator.setPos(value*10+16,10);
  7838. emit initialChanged(value);
  7839. if(!finalSet)
  7840. {
  7841. setFinalValue(value);
  7842. }
  7843. }
  7844. }
  7845. void ScaleControl::setFinalValue(double value)
  7846. {
  7847. if(value>=0&&value<=10)
  7848. {
  7849. scoredValue= value;
  7850. if(!finalSet)
  7851. {
  7852. scene.addItem(&finalIndicator);
  7853. }
  7854. finalSet= true;
  7855. finalIndicator.setPos(value*10+16,11);
  7856. emit finalChanged(value);
  7857. }
  7858. }
  7859. /*:728*//*729:*/
  7860. #line 14938 "./typica.w"
  7861. double ScaleControl::initialValue(void)
  7862. {
  7863. return nonScoredValue;
  7864. }
  7865. double ScaleControl::finalValue(void)
  7866. {
  7867. return scoredValue;
  7868. }
  7869. /*:729*//*730:*/
  7870. #line 14959 "./typica.w"
  7871. void ScaleControl::mousePressEvent(QMouseEvent*event)
  7872. {
  7873. /*731:*/
  7874. #line 14971 "./typica.w"
  7875. if(event->button()!=Qt::LeftButton)
  7876. {
  7877. event->ignore();
  7878. return;
  7879. }
  7880. /*:731*/
  7881. #line 14962 "./typica.w"
  7882. scaleDown= true;
  7883. event->accept();
  7884. }
  7885. /*:730*//*732:*/
  7886. #line 14982 "./typica.w"
  7887. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  7888. {
  7889. /*731:*/
  7890. #line 14971 "./typica.w"
  7891. if(event->button()!=Qt::LeftButton)
  7892. {
  7893. event->ignore();
  7894. return;
  7895. }
  7896. /*:731*/
  7897. #line 14985 "./typica.w"
  7898. if(!scaleDown)
  7899. {
  7900. event->ignore();
  7901. return;
  7902. }
  7903. scaleDown= false;
  7904. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7905. /*733:*/
  7906. #line 15007 "./typica.w"
  7907. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  7908. {
  7909. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7910. {
  7911. if(initialSet)
  7912. {
  7913. setInitialValue(nonScoredValue-0.05);
  7914. }
  7915. event->accept();
  7916. return;
  7917. }
  7918. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7919. {
  7920. if(finalSet)
  7921. {
  7922. setFinalValue(scoredValue-0.05);
  7923. event->accept();
  7924. return;
  7925. }
  7926. }
  7927. }
  7928. /*:733*/
  7929. #line 14993 "./typica.w"
  7930. /*734:*/
  7931. #line 15033 "./typica.w"
  7932. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  7933. {
  7934. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7935. {
  7936. if(initialSet)
  7937. {
  7938. setInitialValue(nonScoredValue+0.05);
  7939. event->accept();
  7940. return;
  7941. }
  7942. }
  7943. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7944. {
  7945. if(finalSet)
  7946. {
  7947. setFinalValue(scoredValue+0.05);
  7948. event->accept();
  7949. return;
  7950. }
  7951. }
  7952. }
  7953. /*:734*/
  7954. #line 14994 "./typica.w"
  7955. /*735:*/
  7956. #line 15059 "./typica.w"
  7957. double relativeX= sceneCoordinate.x()-16;
  7958. if(initialSet)
  7959. {
  7960. if(relativeX>=0&&relativeX<=100)
  7961. {
  7962. setFinalValue(relativeX/10.0);
  7963. event->accept();
  7964. return;
  7965. }
  7966. }
  7967. else
  7968. {
  7969. if(relativeX>=0&&relativeX<=100)
  7970. {
  7971. setInitialValue(relativeX/10.0);
  7972. event->accept();
  7973. return;
  7974. }
  7975. }
  7976. /*:735*/
  7977. #line 14995 "./typica.w"
  7978. event->ignore();
  7979. return;
  7980. }
  7981. /*:732*/
  7982. #line 570 "./typica.w"
  7983. /*737:*/
  7984. #line 15125 "./typica.w"
  7985. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  7986. valueSet(false),scaleDown(false)
  7987. {
  7988. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7989. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7990. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  7991. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  7992. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  7993. theBrush.setColor(Qt::blue);
  7994. theBrush.setStyle(Qt::SolidPattern);
  7995. increment.setPolygon(up);
  7996. increment.setBrush(theBrush);
  7997. increment.setPos(0,0);
  7998. scene.addItem(&increment);
  7999. decrement.setPolygon(down);
  8000. decrement.setBrush(theBrush);
  8001. decrement.setPos(0,122);
  8002. scene.addItem(&decrement);
  8003. scalePath.moveTo(5,0);
  8004. scalePath.lineTo(5,100);
  8005. scalePath.moveTo(0,0);
  8006. scalePath.lineTo(10,0);
  8007. scalePath.moveTo(0,10);
  8008. scalePath.lineTo(10,10);
  8009. scalePath.moveTo(0,20);
  8010. scalePath.lineTo(10,20);
  8011. scalePath.moveTo(0,30);
  8012. scalePath.lineTo(10,30);
  8013. scalePath.moveTo(0,40);
  8014. scalePath.lineTo(10,40);
  8015. scalePath.moveTo(0,50);
  8016. scalePath.lineTo(10,50);
  8017. scalePath.moveTo(0,60);
  8018. scalePath.lineTo(10,60);
  8019. scalePath.moveTo(0,70);
  8020. scalePath.lineTo(10,70);
  8021. scalePath.moveTo(0,80);
  8022. scalePath.lineTo(10,80);
  8023. scalePath.moveTo(0,90);
  8024. scalePath.lineTo(10,90);
  8025. scalePath.moveTo(0,100);
  8026. scalePath.lineTo(10,100);
  8027. scaleLine.setPath(scalePath);
  8028. scaleLine.setPos(0,16);
  8029. scene.addItem(&scaleLine);
  8030. setScene(&scene);
  8031. indicator.setPolygon(left);
  8032. indicator.setBrush(theBrush);
  8033. setMinimumSize(sizeHint());
  8034. setMaximumSize(sizeHint());
  8035. }
  8036. /*:737*//*738:*/
  8037. #line 15180 "./typica.w"
  8038. QSize IntensityControl::sizeHint()const
  8039. {
  8040. return QSize(25,160);
  8041. }
  8042. /*:738*//*739:*/
  8043. #line 15195 "./typica.w"
  8044. void IntensityControl::setValue(double val)
  8045. {
  8046. if(val>=0&&val<=10)
  8047. {
  8048. theValue= val;
  8049. if(!valueSet)
  8050. {
  8051. scene.addItem(&indicator);
  8052. }
  8053. valueSet= true;
  8054. indicator.setPos(6,(100-(val*10))+16);
  8055. emit(valueChanged(val));
  8056. }
  8057. else if(val<1)
  8058. {
  8059. setValue(0);
  8060. }
  8061. else
  8062. {
  8063. setValue(10);
  8064. }
  8065. }
  8066. double IntensityControl::value()
  8067. {
  8068. return theValue;
  8069. }
  8070. /*:739*//*740:*/
  8071. #line 15227 "./typica.w"
  8072. void IntensityControl::mousePressEvent(QMouseEvent*event)
  8073. {
  8074. /*731:*/
  8075. #line 14971 "./typica.w"
  8076. if(event->button()!=Qt::LeftButton)
  8077. {
  8078. event->ignore();
  8079. return;
  8080. }
  8081. /*:731*/
  8082. #line 15230 "./typica.w"
  8083. scaleDown= true;
  8084. event->accept();
  8085. }
  8086. /*:740*//*741:*/
  8087. #line 15241 "./typica.w"
  8088. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  8089. {
  8090. /*731:*/
  8091. #line 14971 "./typica.w"
  8092. if(event->button()!=Qt::LeftButton)
  8093. {
  8094. event->ignore();
  8095. return;
  8096. }
  8097. /*:731*/
  8098. #line 15244 "./typica.w"
  8099. if(!scaleDown)
  8100. {
  8101. event->ignore();
  8102. return;
  8103. }
  8104. scaleDown= false;
  8105. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  8106. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  8107. {
  8108. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  8109. {
  8110. if(valueSet)
  8111. {
  8112. setValue(theValue+0.05);
  8113. }
  8114. event->accept();
  8115. return;
  8116. }
  8117. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  8118. {
  8119. if(valueSet)
  8120. {
  8121. setValue(theValue-0.05);
  8122. }
  8123. event->accept();
  8124. return;
  8125. }
  8126. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  8127. {
  8128. setValue(10-((sceneCoordinate.y()-16)/10.0));
  8129. event->accept();
  8130. return;
  8131. }
  8132. }
  8133. }
  8134. /*:741*/
  8135. #line 571 "./typica.w"
  8136. /*376:*/
  8137. #line 8447 "./typica.w"
  8138. void ThresholdDetector::newMeasurement(Measurement measure)
  8139. {
  8140. if((currentDirection==Ascending&&previousValue<threshold&&
  8141. previousValueValid)||(currentDirection==Descending&&
  8142. previousValue> threshold&&previousValueValid))
  8143. {
  8144. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  8145. (currentDirection==Descending&&measure.temperature()<=threshold))
  8146. {
  8147. double offset= measure.time().hour()*60*60;
  8148. offset+= measure.time().minute()*60;
  8149. offset+= measure.time().second();
  8150. offset+= measure.time().msec()/1000;
  8151. emit timeForValue(offset);
  8152. }
  8153. }
  8154. previousValue= measure.temperature();
  8155. previousValueValid= true;
  8156. }
  8157. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  8158. previousValueValid(false),
  8159. previousValue(-1),threshold(value),currentDirection(Ascending)
  8160. {
  8161. }
  8162. void ThresholdDetector::setThreshold(double value)
  8163. {
  8164. threshold= value;
  8165. }
  8166. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  8167. {
  8168. currentDirection= direction;
  8169. }
  8170. /*:376*/
  8171. #line 572 "./typica.w"
  8172. /*823:*/
  8173. #line 17133 "./typica.w"
  8174. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  8175. lister(new QextSerialEnumerator)
  8176. {
  8177. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  8178. QextPortInfo port;
  8179. foreach(port,ports)
  8180. {
  8181. #ifdef Q_OS_WIN32
  8182. addItem(port.portName);
  8183. #else
  8184. addItem(port.physName);
  8185. #endif
  8186. }
  8187. lister->setUpNotifications();
  8188. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  8189. this,SLOT(addDevice(QextPortInfo)));
  8190. setEditable(true);
  8191. }
  8192. void PortSelector::addDevice(QextPortInfo port)
  8193. {
  8194. addItem(port.portName);
  8195. }
  8196. /*:823*/
  8197. #line 573 "./typica.w"
  8198. /*825:*/
  8199. #line 17225 "./typica.w"
  8200. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  8201. {
  8202. QMetaObject meta= BaudSelector::staticMetaObject;
  8203. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  8204. for(int i= 0;i<type.keyCount();i++)
  8205. {
  8206. addItem(QString("%1").arg(type.value(i)));
  8207. }
  8208. }
  8209. /*:825*/
  8210. #line 574 "./typica.w"
  8211. /*827:*/
  8212. #line 17263 "./typica.w"
  8213. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  8214. {
  8215. QMetaObject meta= ParitySelector::staticMetaObject;
  8216. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  8217. for(int i= 0;i<type.keyCount();i++)
  8218. {
  8219. addItem(QString(type.key(i)),QVariant(type.value(i)));
  8220. }
  8221. }
  8222. /*:827*/
  8223. #line 575 "./typica.w"
  8224. /*829:*/
  8225. #line 17293 "./typica.w"
  8226. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  8227. {
  8228. QMetaObject meta= FlowSelector::staticMetaObject;
  8229. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  8230. for(int i= 0;i<type.keyCount();i++)
  8231. {
  8232. addItem(QString(type.key(i)),QVariant(type.value(i)));
  8233. }
  8234. }
  8235. /*:829*/
  8236. #line 576 "./typica.w"
  8237. /*831:*/
  8238. #line 17328 "./typica.w"
  8239. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  8240. {
  8241. QMetaObject meta= StopSelector::staticMetaObject;
  8242. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  8243. for(int i= 0;i<type.keyCount();i++)
  8244. {
  8245. addItem(QString(type.key(i)),QVariant(type.value(i)));
  8246. }
  8247. }
  8248. /*:831*/
  8249. #line 577 "./typica.w"
  8250. /*891:*/
  8251. #line 19114 "./typica.w"
  8252. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  8253. :BasicDeviceConfigurationWidget(model,index),
  8254. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  8255. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  8256. decimalQuery(new QCheckBox(tr("Enable"))),
  8257. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  8258. unitQuery(new QCheckBox(tr("Enable"))),
  8259. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  8260. valueC(new QSpinBox),fixedUnit(new QComboBox),
  8261. pVAddress(new ShortHexSpinBox),
  8262. sVEnabled(new QCheckBox(tr("Enable"))),
  8263. sVReadAddress(new ShortHexSpinBox),
  8264. deviceLimit(new QCheckBox(tr("Enable"))),
  8265. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  8266. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  8267. sVWritable(new QCheckBox(tr("Enable"))),
  8268. sVOutputAddr(new ShortHexSpinBox),
  8269. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  8270. {
  8271. QHBoxLayout*layout= new QHBoxLayout;
  8272. QWidget*form= new QWidget;
  8273. QHBoxLayout*masterLayout= new QHBoxLayout;
  8274. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  8275. QVBoxLayout*seriesLayout= new QVBoxLayout;
  8276. QFormLayout*serialSection= new QFormLayout;
  8277. serialSection->addRow(QString(tr("Port:")),port);
  8278. serialSection->addRow(QString(tr("Baud rate:")),baud);
  8279. serialSection->addRow(QString(tr("Parity:")),parity);
  8280. serialSection->addRow(QString(tr("Flow control:")),flow);
  8281. serialSection->addRow(QString(tr("Stop bits:")),stop);
  8282. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  8283. serialSectionBox->setLayout(serialSection);
  8284. portAndDeviceLayout->addWidget(serialSectionBox);
  8285. QFormLayout*deviceSection= new QFormLayout;
  8286. station->setMinimum(1);
  8287. station->setMaximum(255);
  8288. decimalPosition->setMinimum(0);
  8289. decimalPosition->setMaximum(9);
  8290. valueF->setMinimum(0);
  8291. valueF->setMaximum(0xFFFF);
  8292. valueC->setMinimum(0);
  8293. valueC->setMaximum(0xFFFF);
  8294. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  8295. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  8296. deviceSection->addRow(tr("Station:"),station);
  8297. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  8298. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  8299. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  8300. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  8301. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  8302. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  8303. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  8304. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  8305. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  8306. deviceSectionBox->setLayout(deviceSection);
  8307. portAndDeviceLayout->addWidget(deviceSectionBox);
  8308. QFormLayout*pVSection= new QFormLayout;
  8309. pVSection->addRow(tr("Value relative address:"),pVAddress);
  8310. pVSection->addRow(tr("PV column name:"),pVColumnName);
  8311. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  8312. pVSection->addRow(pVHideBox);
  8313. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  8314. processValueBox->setLayout(pVSection);
  8315. seriesLayout->addWidget(processValueBox);
  8316. QFormLayout*sVSection= new QFormLayout;
  8317. sVLower->setDecimals(1);
  8318. sVLower->setMinimum(0.0);
  8319. sVLower->setMaximum(999.9);
  8320. sVUpper->setDecimals(1);
  8321. sVUpper->setMinimum(0.0);
  8322. sVUpper->setMaximum(999.9);
  8323. sVSection->addRow(tr("Set value:"),sVEnabled);
  8324. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  8325. sVSection->addRow(tr("SV column name:"),sVColumnName);
  8326. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  8327. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  8328. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  8329. sVSection->addRow(tr("Lower limit:"),sVLower);
  8330. sVSection->addRow(tr("Upper limit:"),sVUpper);
  8331. sVSection->addRow(tr("Output set value:"),sVWritable);
  8332. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  8333. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  8334. sVSection->addRow(sVHideBox);
  8335. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  8336. setValueBox->setLayout(sVSection);
  8337. seriesLayout->addWidget(setValueBox);
  8338. masterLayout->addLayout(portAndDeviceLayout);
  8339. masterLayout->addLayout(seriesLayout);
  8340. form->setLayout(masterLayout);
  8341. /*799:*/
  8342. #line 16574 "./typica.w"
  8343. QDomElement referenceElement=
  8344. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8345. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8346. QDomElement node;
  8347. /*:799*/
  8348. #line 19204 "./typica.w"
  8349. for(int i= 0;i<configData.size();i++)
  8350. {
  8351. node= configData.at(i).toElement();
  8352. if(node.attribute("name")=="port")
  8353. {
  8354. QString portname= node.attribute("value");
  8355. int idx= port->findText(portname);
  8356. if(idx>=0)
  8357. {
  8358. port->setCurrentIndex(idx);
  8359. }
  8360. else
  8361. {
  8362. port->addItem(portname);
  8363. }
  8364. }
  8365. else if(node.attribute("name")=="baud")
  8366. {
  8367. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  8368. }
  8369. else if(node.attribute("name")=="parity")
  8370. {
  8371. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  8372. }
  8373. else if(node.attribute("name")=="flow")
  8374. {
  8375. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  8376. }
  8377. else if(node.attribute("name")=="stop")
  8378. {
  8379. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  8380. }
  8381. else if(node.attribute("name")=="station")
  8382. {
  8383. station->setValue(node.attribute("value").toInt());
  8384. }
  8385. else if(node.attribute("name")=="decimalQuery")
  8386. {
  8387. if(node.attribute("value")=="true")
  8388. {
  8389. decimalQuery->setChecked(true);
  8390. }
  8391. else
  8392. {
  8393. decimalQuery->setChecked(false);
  8394. }
  8395. }
  8396. else if(node.attribute("name")=="decimalAddress")
  8397. {
  8398. decimalAddress->setValue(node.attribute("value").toInt());
  8399. }
  8400. else if(node.attribute("name")=="decimalPosition")
  8401. {
  8402. decimalPosition->setValue(node.attribute("value").toInt());
  8403. }
  8404. else if(node.attribute("name")=="unitQuery")
  8405. {
  8406. if(node.attribute("value")=="true")
  8407. {
  8408. unitQuery->setChecked(true);
  8409. }
  8410. else
  8411. {
  8412. unitQuery->setChecked(false);
  8413. }
  8414. }
  8415. else if(node.attribute("name")=="unitAddress")
  8416. {
  8417. unitAddress->setValue(node.attribute("value").toInt());
  8418. }
  8419. else if(node.attribute("name")=="valueF")
  8420. {
  8421. valueF->setValue(node.attribute("value").toInt());
  8422. }
  8423. else if(node.attribute("name")=="valueC")
  8424. {
  8425. valueC->setValue(node.attribute("value").toInt());
  8426. }
  8427. else if(node.attribute("name")=="fixedUnit")
  8428. {
  8429. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  8430. }
  8431. else if(node.attribute("name")=="pVAddress")
  8432. {
  8433. pVAddress->setValue(node.attribute("value").toInt());
  8434. }
  8435. else if(node.attribute("name")=="sVEnabled")
  8436. {
  8437. if(node.attribute("value")=="true")
  8438. {
  8439. sVEnabled->setChecked(true);
  8440. }
  8441. else
  8442. {
  8443. sVEnabled->setChecked(false);
  8444. }
  8445. }
  8446. else if(node.attribute("name")=="sVReadAddress")
  8447. {
  8448. sVReadAddress->setValue(node.attribute("value").toInt());
  8449. }
  8450. else if(node.attribute("name")=="deviceLimit")
  8451. {
  8452. if(node.attribute("value")=="true")
  8453. {
  8454. deviceLimit->setChecked(true);
  8455. }
  8456. else
  8457. {
  8458. deviceLimit->setChecked(false);
  8459. }
  8460. }
  8461. else if(node.attribute("name")=="sVLowerAddr")
  8462. {
  8463. sVLowerAddr->setValue(node.attribute("value").toInt());
  8464. }
  8465. else if(node.attribute("name")=="sVUpperAddr")
  8466. {
  8467. sVUpperAddr->setValue(node.attribute("value").toInt());
  8468. }
  8469. else if(node.attribute("name")=="sVLower")
  8470. {
  8471. sVLower->setValue(node.attribute("value").toDouble());
  8472. }
  8473. else if(node.attribute("name")=="sVUpper")
  8474. {
  8475. sVUpper->setValue(node.attribute("value").toDouble());
  8476. }
  8477. else if(node.attribute("name")=="sVWritable")
  8478. {
  8479. if(node.attribute("value")=="true")
  8480. {
  8481. sVWritable->setChecked(true);
  8482. }
  8483. else
  8484. {
  8485. sVWritable->setChecked(false);
  8486. }
  8487. }
  8488. else if(node.attribute("name")=="sVOutputAddr")
  8489. {
  8490. sVOutputAddr->setValue(node.attribute("value").toInt());
  8491. }
  8492. else if(node.attribute("name")=="pvcolname")
  8493. {
  8494. pVColumnName->setText(node.attribute("value"));
  8495. }
  8496. else if(node.attribute("name")=="svcolname")
  8497. {
  8498. sVColumnName->setText(node.attribute("value"));
  8499. }
  8500. else if(node.attribute("name")=="pvhidden")
  8501. {
  8502. pVHideBox->setChecked(node.attribute("value")=="true");
  8503. }
  8504. else if(node.attribute("name")=="svhidden")
  8505. {
  8506. sVHideBox->setChecked(node.attribute("value")=="true");
  8507. }
  8508. }
  8509. updatePort(port->currentText());
  8510. updateBaudRate(baud->currentText());
  8511. updateParity(parity->itemData(parity->currentIndex()).toString());
  8512. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  8513. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  8514. updateStation(station->value());
  8515. updateFixedDecimal(decimalQuery->isChecked());
  8516. updateDecimalAddress(decimalAddress->value());
  8517. updateDecimalPosition(decimalPosition->value());
  8518. updateFixedUnit(unitQuery->isChecked());
  8519. updateUnitAddress(unitAddress->value());
  8520. updateValueForF(valueF->value());
  8521. updateValueForC(valueC->value());
  8522. updateUnit(fixedUnit->currentText());
  8523. updatePVAddress(pVAddress->value());
  8524. updateSVEnabled(sVEnabled->isChecked());
  8525. updateSVReadAddress(sVReadAddress->value());
  8526. updateDeviceLimit(deviceLimit->isChecked());
  8527. updateSVLowerAddress(sVLowerAddr->value());
  8528. updateSVUpperAddress(sVUpperAddr->value());
  8529. updateSVLower(sVLower->value());
  8530. updateSVUpper(sVUpper->value());
  8531. updateSVWritable(sVWritable->isChecked());
  8532. updateSVWriteAddress(sVOutputAddr->value());
  8533. updatePVColumnName(pVColumnName->text());
  8534. updateSVColumnName(sVColumnName->text());
  8535. updatePVHidden(pVHideBox->isChecked());
  8536. updateSVHidden(sVHideBox->isChecked());
  8537. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  8538. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  8539. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  8540. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  8541. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  8542. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  8543. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  8544. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  8545. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  8546. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  8547. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  8548. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  8549. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  8550. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  8551. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  8552. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  8553. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  8554. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  8555. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  8556. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  8557. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  8558. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  8559. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  8560. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  8561. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  8562. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  8563. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  8564. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  8565. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  8566. layout->addWidget(form);
  8567. setLayout(layout);
  8568. }
  8569. void ModbusConfigurator::updatePort(const QString&newPort)
  8570. {
  8571. updateAttribute("port",newPort);
  8572. }
  8573. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  8574. {
  8575. updateAttribute("baud",newRate);
  8576. }
  8577. void ModbusConfigurator::updateParity(const QString&)
  8578. {
  8579. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  8580. }
  8581. void ModbusConfigurator::updateFlowControl(const QString&)
  8582. {
  8583. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  8584. }
  8585. void ModbusConfigurator::updateStopBits(const QString&)
  8586. {
  8587. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  8588. }
  8589. void ModbusConfigurator::updateStation(int station)
  8590. {
  8591. updateAttribute("station",QString("%1").arg(station));
  8592. }
  8593. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  8594. {
  8595. updateAttribute("decimalQuery",fixed?"true":"false");
  8596. }
  8597. void ModbusConfigurator::updateDecimalAddress(int address)
  8598. {
  8599. updateAttribute("decimalAddress",QString("%1").arg(address));
  8600. }
  8601. void ModbusConfigurator::updateDecimalPosition(int position)
  8602. {
  8603. updateAttribute("decimalPosition",QString("%1").arg(position));
  8604. }
  8605. void ModbusConfigurator::updateFixedUnit(bool fixed)
  8606. {
  8607. updateAttribute("unitQuery",fixed?"true":"false");
  8608. }
  8609. void ModbusConfigurator::updateUnitAddress(int address)
  8610. {
  8611. updateAttribute("unitAddress",QString("%1").arg(address));
  8612. }
  8613. void ModbusConfigurator::updateValueForF(int value)
  8614. {
  8615. updateAttribute("valueF",QString("%1").arg(value));
  8616. }
  8617. void ModbusConfigurator::updateValueForC(int value)
  8618. {
  8619. updateAttribute("valueC",QString("%1").arg(value));
  8620. }
  8621. void ModbusConfigurator::updateUnit(const QString&newUnit)
  8622. {
  8623. updateAttribute("fixedUnit",newUnit);
  8624. }
  8625. void ModbusConfigurator::updatePVAddress(int address)
  8626. {
  8627. updateAttribute("pVAddress",QString("%1").arg(address));
  8628. }
  8629. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8630. {
  8631. updateAttribute("sVEnabled",enabled?"true":"false");
  8632. }
  8633. void ModbusConfigurator::updateSVReadAddress(int address)
  8634. {
  8635. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8636. }
  8637. void ModbusConfigurator::updateDeviceLimit(bool query)
  8638. {
  8639. updateAttribute("deviceLimit",query?"true":"false");
  8640. }
  8641. void ModbusConfigurator::updateSVLowerAddress(int address)
  8642. {
  8643. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8644. }
  8645. void ModbusConfigurator::updateSVUpperAddress(int address)
  8646. {
  8647. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  8648. }
  8649. void ModbusConfigurator::updateSVLower(double value)
  8650. {
  8651. updateAttribute("sVLower",QString("%1").arg(value));
  8652. }
  8653. void ModbusConfigurator::updateSVUpper(double value)
  8654. {
  8655. updateAttribute("sVUpper",QString("%1").arg(value));
  8656. }
  8657. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  8658. {
  8659. updateAttribute("sVWritable",canWriteSV?"true":"false");
  8660. }
  8661. void ModbusConfigurator::updateSVWriteAddress(int address)
  8662. {
  8663. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  8664. }
  8665. void ModbusConfigurator::updatePVColumnName(const QString&name)
  8666. {
  8667. updateAttribute("pvcolname",name);
  8668. }
  8669. void ModbusConfigurator::updateSVColumnName(const QString&name)
  8670. {
  8671. updateAttribute("svcolname",name);
  8672. }
  8673. void ModbusConfigurator::updatePVHidden(bool hidden)
  8674. {
  8675. updateAttribute("pvhidden",hidden?"true":"false");
  8676. }
  8677. void ModbusConfigurator::updateSVHidden(bool hidden)
  8678. {
  8679. updateAttribute("svhidden",hidden?"true":"false");
  8680. }
  8681. /*:891*/
  8682. #line 578 "./typica.w"
  8683. /*834:*/
  8684. #line 17381 "./typica.w"
  8685. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  8686. {
  8687. setMinimum(0);
  8688. setMaximum(0xFFFF);
  8689. setPrefix("0x");
  8690. setMinimumWidth(65);
  8691. }
  8692. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  8693. {
  8694. if(input.size()==2)
  8695. {
  8696. return QValidator::Intermediate;
  8697. }
  8698. bool okay;
  8699. input.toInt(&okay,16);
  8700. if(okay)
  8701. {
  8702. return QValidator::Acceptable;
  8703. }
  8704. return QValidator::Invalid;
  8705. }
  8706. int ShortHexSpinBox::valueFromText(const QString&text)const
  8707. {
  8708. return text.toInt(NULL,16);
  8709. }
  8710. QString ShortHexSpinBox::textFromValue(int value)const
  8711. {
  8712. QString retval;
  8713. retval.setNum(value,16);
  8714. while(retval.size()<4)
  8715. {
  8716. retval.prepend("0");
  8717. }
  8718. return retval.toUpper();
  8719. }
  8720. /*:834*/
  8721. #line 579 "./typica.w"
  8722. /*875:*/
  8723. #line 18413 "./typica.w"
  8724. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  8725. :QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),unitIsF(true),readingsv(false),
  8726. waiting(false)
  8727. {
  8728. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  8729. Qt::UserRole).toString());
  8730. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  8731. QDomElement node;
  8732. QVariantMap attributes;
  8733. for(int i= 0;i<portConfigData.size();i++)
  8734. {
  8735. node= portConfigData.at(i).toElement();
  8736. attributes.insert(node.attribute("name"),node.attribute("value"));
  8737. }
  8738. port= new QextSerialPort(attributes.value("port").toString(),
  8739. QextSerialPort::EventDriven);
  8740. int baudRate= attributes.value("baud").toInt();
  8741. port->setBaudRate((BaudRateType)baudRate);
  8742. double temp= ((double)(1)/(double)(baudRate))*48;
  8743. delayTime= (int)(temp*3000);
  8744. messageDelayTimer->setSingleShot(true);
  8745. commTimeout->setSingleShot(true);
  8746. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  8747. connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
  8748. port->setDataBits(DATA_8);
  8749. port->setParity((ParityType)attributes.value("parity").toInt());
  8750. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  8751. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  8752. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  8753. port->open(QIODevice::ReadWrite);
  8754. station= (char)attributes.value("station").toInt();
  8755. if(attributes.value("decimalQuery")=="true")
  8756. {
  8757. decimalPosition= 0;
  8758. QByteArray message;
  8759. message.append(station);
  8760. message.append((char)0x03);
  8761. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  8762. char*addressBytes= (char*)&address;
  8763. message.append(addressBytes[1]);
  8764. message.append(addressBytes[0]);
  8765. message.append((char)0x00);
  8766. message.append((char)0x01);
  8767. queueMessage(message,this,"decimalResponse(QByteArray)");
  8768. }
  8769. else
  8770. {
  8771. decimalPosition= attributes.value("decimalPosition").toInt();
  8772. }
  8773. valueF= attributes.value("valueF").toInt();
  8774. valueC= attributes.value("valueC").toInt();
  8775. if(attributes.value("unitQuery")=="true")
  8776. {
  8777. QByteArray message;
  8778. message.append(station);
  8779. message.append((char)0x03);
  8780. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  8781. char*addressBytes= (char*)&address;
  8782. message.append(addressBytes[1]);
  8783. message.append(addressBytes[0]);
  8784. message.append((char)0x00);
  8785. message.append((char)0x01);
  8786. queueMessage(message,this,"unitResponse(QByteArray)");
  8787. }
  8788. else
  8789. {
  8790. if(attributes.value("fixedUnit")=="Celsius")
  8791. {
  8792. unitIsF= false;
  8793. }
  8794. }
  8795. if(attributes.value("sVWritable")=="true")
  8796. {
  8797. if(attributes.value("deviceLimit")=="true")
  8798. {
  8799. QByteArray lmessage;
  8800. lmessage.append(station);
  8801. lmessage.append((char)0x03);
  8802. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  8803. char*addressBytes= (char*)&laddress;
  8804. lmessage.append(addressBytes[1]);
  8805. lmessage.append(addressBytes[0]);
  8806. lmessage.append((char)0x00);
  8807. lmessage.append((char)0x01);
  8808. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  8809. QByteArray umessage;
  8810. umessage.append(station);
  8811. umessage.append((char)0x03);
  8812. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  8813. addressBytes= (char*)&uaddress;
  8814. umessage.append(addressBytes[1]);
  8815. umessage.append(addressBytes[0]);
  8816. umessage.append((char)0x00);
  8817. umessage.append((char)0x01);
  8818. queueMessage(umessage,this,"svuResponse(QByteArray)");
  8819. }
  8820. else
  8821. {
  8822. outputSVLower= attributes.value("sVLower").toDouble();
  8823. outputSVUpper= attributes.value("sVUpper").toDouble();
  8824. }
  8825. outputSVStub.append(station);
  8826. outputSVStub.append((char)0x06);
  8827. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  8828. char*addressBytes= (char*)&address;
  8829. outputSVStub.append(addressBytes[1]);
  8830. outputSVStub.append(addressBytes[0]);
  8831. }
  8832. Channel*pv= new Channel;
  8833. channels.append(pv);
  8834. pvStub.append(station);
  8835. pvStub.append((char)0x04);
  8836. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  8837. char*pvac= (char*)&pvaddress;
  8838. pvStub.append(pvac[1]);
  8839. pvStub.append(pvac[0]);
  8840. pvStub.append((char)0x00);
  8841. pvStub.append((char)0x01);
  8842. svenabled= attributes.value("sVEnabled").toBool();
  8843. if(svenabled)
  8844. {
  8845. Channel*sv= new Channel;
  8846. channels.append(sv);
  8847. svStub.append(station);
  8848. svStub.append((char)0x04);
  8849. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  8850. char*svac= (char*)&svaddress;
  8851. svStub.append(svac[1]);
  8852. svStub.append(svac[0]);
  8853. svStub.append((char)0x00);
  8854. svStub.append((char)0x01);
  8855. if(svaddress-pvaddress==1)
  8856. {
  8857. mStub.append(station);
  8858. mStub.append((char)0x04);
  8859. mStub.append(pvac[1]);
  8860. mStub.append(pvac[0]);
  8861. mStub.append((char)0x00);
  8862. mStub.append((char)0x02);
  8863. }
  8864. }
  8865. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  8866. requestMeasurement();
  8867. }
  8868. double ModbusRTUDevice::SVLower()
  8869. {
  8870. return outputSVLower;
  8871. }
  8872. double ModbusRTUDevice::SVUpper()
  8873. {
  8874. return outputSVUpper;
  8875. }
  8876. int ModbusRTUDevice::decimals()
  8877. {
  8878. return decimalPosition;
  8879. }
  8880. void ModbusRTUDevice::decimalResponse(QByteArray response)
  8881. {
  8882. quint16 temp;
  8883. char*tchar= (char*)&temp;
  8884. tchar[1]= response.at(3);
  8885. tchar[0]= response.at(4);
  8886. decimalPosition= temp;
  8887. emit SVDecimalChanged(decimalPosition);
  8888. qDebug()<<"Received decimal response";
  8889. }
  8890. void ModbusRTUDevice::unitResponse(QByteArray response)
  8891. {
  8892. quint16 temp;
  8893. char*tchar= (char*)&temp;
  8894. tchar[1]= response.at(3);
  8895. tchar[0]= response.at(4);
  8896. int value= temp;
  8897. if(value==valueF)
  8898. {
  8899. unitIsF= true;
  8900. }
  8901. else
  8902. {
  8903. unitIsF= false;
  8904. }
  8905. qDebug()<<"Received unit response";
  8906. }
  8907. void ModbusRTUDevice::svlResponse(QByteArray response)
  8908. {
  8909. quint16 temp;
  8910. char*tchar= (char*)&temp;
  8911. tchar[1]= response.at(3);
  8912. tchar[0]= response.at(4);
  8913. outputSVLower= (double)temp;
  8914. for(int i= 0;i<decimalPosition;i++)
  8915. {
  8916. outputSVLower/= 10;
  8917. }
  8918. emit SVLowerChanged(outputSVLower);
  8919. qDebug()<<"Received set value lower bound response";
  8920. }
  8921. void ModbusRTUDevice::svuResponse(QByteArray response)
  8922. {
  8923. quint16 temp;
  8924. char*tchar= (char*)&temp;
  8925. tchar[1]= response.at(3);
  8926. tchar[0]= response.at(4);
  8927. outputSVUpper= (double)temp;
  8928. for(int i= 0;i<decimalPosition;i++)
  8929. {
  8930. outputSVUpper/= 10;
  8931. }
  8932. emit SVUpperChanged(outputSVUpper);
  8933. qDebug()<<"Received set value upper bound response";
  8934. }
  8935. void ModbusRTUDevice::requestMeasurement()
  8936. {
  8937. if(mStub.length()> 0)
  8938. {
  8939. queueMessage(mStub,this,"mResponse(QByteArray)");
  8940. }
  8941. else
  8942. {
  8943. queueMessage(pvStub,this,"mResponse(QByteArray)");
  8944. if(svenabled)
  8945. {
  8946. queueMessage(svStub,this,"mResponse(QByteArray)");
  8947. }
  8948. }
  8949. }
  8950. void ModbusRTUDevice::mResponse(QByteArray response)
  8951. {
  8952. QTime time= QTime::currentTime();
  8953. if(response.at(2)==0x04)
  8954. {
  8955. /*876:*/
  8956. #line 18667 "./typica.w"
  8957. quint16 pv;
  8958. quint16 sv;
  8959. char*pvBytes= (char*)&pv;
  8960. char*svBytes= (char*)&sv;
  8961. pvBytes[1]= response.at(3);
  8962. pvBytes[0]= response.at(4);
  8963. svBytes[1]= response.at(5);
  8964. svBytes[0]= response.at(6);
  8965. double pvOut= (double)pv;
  8966. double svOut= (double)sv;
  8967. for(int i= 0;i<decimalPosition;i++)
  8968. {
  8969. pvOut/= 10;
  8970. svOut/= 10;
  8971. }
  8972. if(!unitIsF)
  8973. {
  8974. pvOut= pvOut*9/5+32;
  8975. svOut= svOut*9/5+32;
  8976. }
  8977. Measurement pvm(pvOut,time,Units::Fahrenheit);
  8978. Measurement svm(svOut,time,Units::Fahrenheit);
  8979. channels.at(0)->input(pvm);
  8980. channels.at(1)->input(svm);
  8981. /*:876*/
  8982. #line 18654 "./typica.w"
  8983. }
  8984. else
  8985. {
  8986. /*877:*/
  8987. #line 18697 "./typica.w"
  8988. quint16 value;
  8989. char*valueBytes= (char*)&value;
  8990. valueBytes[1]= response.at(3);
  8991. valueBytes[0]= response.at(4);
  8992. double valueOut= (double)value;
  8993. for(int i= 0;i<decimalPosition;i++)
  8994. {
  8995. valueOut/= 10;
  8996. }
  8997. if(!unitIsF)
  8998. {
  8999. valueOut= valueOut*9/5+32;
  9000. }
  9001. if(!svenabled)
  9002. {
  9003. Measurement vm(valueOut,time,Units::Fahrenheit);
  9004. channels.at(0)->input(vm);
  9005. }
  9006. else
  9007. {
  9008. if(readingsv)
  9009. {
  9010. Measurement pvm(savedpv,time,Units::Fahrenheit);
  9011. Measurement svm(valueOut,time,Units::Fahrenheit);
  9012. channels.at(0)->input(pvm);
  9013. channels.at(1)->input(svm);
  9014. readingsv= false;
  9015. }
  9016. else
  9017. {
  9018. savedpv= valueOut;
  9019. readingsv= true;
  9020. }
  9021. }
  9022. /*:877*/
  9023. #line 18658 "./typica.w"
  9024. }
  9025. }
  9026. /*:875*//*878:*/
  9027. #line 18735 "./typica.w"
  9028. ModbusRTUDevice::~ModbusRTUDevice()
  9029. {
  9030. commTimeout->stop();
  9031. messageDelayTimer->stop();
  9032. port->close();
  9033. }
  9034. /*:878*//*879:*/
  9035. #line 18762 "./typica.w"
  9036. void ModbusRTUDevice::dataAvailable()
  9037. {
  9038. if(messageDelayTimer->isActive())
  9039. {
  9040. messageDelayTimer->stop();
  9041. }
  9042. responseBuffer.append(port->readAll());
  9043. /*880:*/
  9044. #line 18808 "./typica.w"
  9045. if(responseBuffer.size()<5)
  9046. {
  9047. return;
  9048. }
  9049. switch(responseBuffer.at(1))
  9050. {
  9051. case 0x01:
  9052. case 0x02:
  9053. if(responseBuffer.size()<6)
  9054. {
  9055. return;
  9056. }
  9057. responseBuffer= responseBuffer.left(6);
  9058. break;
  9059. case 0x03:
  9060. case 0x04:
  9061. if(responseBuffer.size()<5+responseBuffer.at(2))
  9062. {
  9063. return;
  9064. }
  9065. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  9066. break;
  9067. case 0x05:
  9068. case 0x06:
  9069. case 0x10:
  9070. if(responseBuffer.size()<8)
  9071. {
  9072. return;
  9073. }
  9074. responseBuffer= responseBuffer.left(8);
  9075. break;
  9076. }
  9077. /*:880*/
  9078. #line 18770 "./typica.w"
  9079. commTimeout->stop();
  9080. if(calculateCRC(responseBuffer)==0)
  9081. {
  9082. QObject*object= retObjQueue.at(0);
  9083. char*method= callbackQueue.at(0);
  9084. QMetaMethod metamethod= object->metaObject()->
  9085. method(object->metaObject()->
  9086. indexOfMethod(QMetaObject::normalizedSignature(method)));
  9087. metamethod.invoke(object,Qt::QueuedConnection,
  9088. Q_ARG(QByteArray,responseBuffer));
  9089. messageQueue.removeAt(0);
  9090. retObjQueue.removeAt(0);
  9091. callbackQueue.removeAt(0);
  9092. }
  9093. else
  9094. {
  9095. qDebug()<<"CRC failed";
  9096. }
  9097. messageDelayTimer->start(delayTime);
  9098. waiting= false;
  9099. responseBuffer.clear();
  9100. }
  9101. /*:879*//*881:*/
  9102. #line 18850 "./typica.w"
  9103. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  9104. {
  9105. quint16 retval= 0xFFFF;
  9106. int i= 0;
  9107. while(i<data.size())
  9108. {
  9109. retval^= 0x00FF&(quint16)data.at(i);
  9110. for(int j= 0;j<8;j++)
  9111. {
  9112. if(retval&1)
  9113. {
  9114. retval= (retval>>1)^0xA001;
  9115. }
  9116. else
  9117. {
  9118. retval>>= 1;
  9119. }
  9120. }
  9121. i++;
  9122. }
  9123. return retval;
  9124. }
  9125. /*:881*//*882:*/
  9126. #line 18881 "./typica.w"
  9127. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  9128. const char*callback)
  9129. {
  9130. messageQueue.append(request);
  9131. retObjQueue.append(object);
  9132. callbackQueue.append(const_cast<char*> (callback));
  9133. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  9134. {
  9135. sendNextMessage();
  9136. }
  9137. }
  9138. void ModbusRTUDevice::sendNextMessage()
  9139. {
  9140. if(messageQueue.size()> 0&&!waiting)
  9141. {
  9142. QByteArray message= messageQueue.at(0);
  9143. quint16 crc= calculateCRC(message);
  9144. char*check= (char*)&crc;
  9145. message.append(check[0]);
  9146. message.append(check[1]);
  9147. qDebug()<<"Writing"<<message.toHex();
  9148. port->write(message);
  9149. commTimeout->start(2000);
  9150. messageDelayTimer->start(delayTime);
  9151. waiting= true;
  9152. }
  9153. else
  9154. {
  9155. emit queueEmpty();
  9156. }
  9157. }
  9158. void ModbusRTUDevice::outputSV(double value)
  9159. {
  9160. for(int i= 0;i<decimalPosition;i++)
  9161. {
  9162. value*= 10;
  9163. }
  9164. quint16 outval= (quint16)value;
  9165. QByteArray message(outputSVStub);
  9166. char*valBytes= (char*)&outval;
  9167. message.append(valBytes[1]);
  9168. message.append(valBytes[0]);
  9169. queueMessage(message,this,"ignore(QByteArray)");
  9170. }
  9171. /*:882*//*883:*/
  9172. #line 18931 "./typica.w"
  9173. void ModbusRTUDevice::ignore(QByteArray)
  9174. {
  9175. return;
  9176. }
  9177. /*:883*//*884:*/
  9178. #line 18944 "./typica.w"
  9179. void ModbusRTUDevice::timeout()
  9180. {
  9181. qDebug()<<"Communications timeout.";
  9182. responseBuffer.clear();
  9183. waiting= false;
  9184. messageDelayTimer->start();
  9185. }
  9186. /*:884*/
  9187. #line 580 "./typica.w"
  9188. /*753:*/
  9189. #line 15499 "./typica.w"
  9190. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  9191. DeviceTreeModelNode*parent)
  9192. :domNode(node),rowNumber(row),parentItem(parent)
  9193. {
  9194. }
  9195. DeviceTreeModelNode::~DeviceTreeModelNode()
  9196. {
  9197. QHash<int,DeviceTreeModelNode*> ::iterator i;
  9198. for(i= children.begin();i!=children.end();i++)
  9199. {
  9200. delete i.value();
  9201. }
  9202. }
  9203. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  9204. {
  9205. return parentItem;
  9206. }
  9207. int DeviceTreeModelNode::row()
  9208. {
  9209. return rowNumber;
  9210. }
  9211. QDomNode DeviceTreeModelNode::node()const
  9212. {
  9213. return domNode;
  9214. }
  9215. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  9216. {
  9217. if(children.contains(index))
  9218. {
  9219. return children[index];
  9220. }
  9221. if(index>=0&&index<domNode.childNodes().count())
  9222. {
  9223. QDomNode childNode= domNode.childNodes().item(index);
  9224. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  9225. index,this);
  9226. children[index]= childItem;
  9227. return childItem;
  9228. }
  9229. return NULL;
  9230. }
  9231. /*:753*/
  9232. #line 581 "./typica.w"
  9233. /*755:*/
  9234. #line 15588 "./typica.w"
  9235. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  9236. :QAbstractItemModel(parent)
  9237. {
  9238. document= AppInstance->deviceConfiguration();
  9239. QDomNodeList elements= document.elementsByTagName("devices");
  9240. if(elements.size()!=1)
  9241. {
  9242. qDebug()<<"Unexpected result when loading device map.";
  9243. }
  9244. treeRoot= elements.at(0);
  9245. root= new DeviceTreeModelNode(treeRoot,0);
  9246. elements= document.elementsByTagName("references");
  9247. if(elements.size()!=1)
  9248. {
  9249. qDebug()<<"No references section. Creating.";
  9250. referenceSection= document.createElement("references");
  9251. document.appendChild(referenceSection);
  9252. }
  9253. else
  9254. {
  9255. referenceSection= elements.at(0);
  9256. }
  9257. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  9258. AppInstance,SLOT(saveDeviceConfiguration()));
  9259. connect(this,SIGNAL(modelReset()),
  9260. AppInstance,SLOT(saveDeviceConfiguration()));
  9261. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9262. AppInstance,SLOT(saveDeviceConfiguration()));
  9263. }
  9264. /*:755*//*756:*/
  9265. #line 15623 "./typica.w"
  9266. int DeviceTreeModel::columnCount(const QModelIndex&)const
  9267. {
  9268. return 1;
  9269. }
  9270. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  9271. {
  9272. if(parent.column()> 0)
  9273. {
  9274. return 0;
  9275. }
  9276. /*757:*/
  9277. #line 15642 "./typica.w"
  9278. DeviceTreeModelNode*parentItem;
  9279. if(!parent.isValid())
  9280. {
  9281. parentItem= root;
  9282. }
  9283. else
  9284. {
  9285. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9286. }
  9287. /*:757*/
  9288. #line 15635 "./typica.w"
  9289. return parentItem->node().childNodes().count();
  9290. }
  9291. /*:756*//*758:*/
  9292. #line 15656 "./typica.w"
  9293. QModelIndex DeviceTreeModel::index(int row,int column,
  9294. const QModelIndex&parent)const
  9295. {
  9296. if(!hasIndex(row,column,parent))
  9297. {
  9298. return QModelIndex();
  9299. }
  9300. /*757:*/
  9301. #line 15642 "./typica.w"
  9302. DeviceTreeModelNode*parentItem;
  9303. if(!parent.isValid())
  9304. {
  9305. parentItem= root;
  9306. }
  9307. else
  9308. {
  9309. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9310. }
  9311. /*:757*/
  9312. #line 15664 "./typica.w"
  9313. DeviceTreeModelNode*childItem= parentItem->child(row);
  9314. if(childItem)
  9315. {
  9316. return createIndex(row,column,childItem);
  9317. }
  9318. return QModelIndex();
  9319. }
  9320. /*:758*//*759:*/
  9321. #line 15675 "./typica.w"
  9322. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  9323. {
  9324. if(!child.isValid())
  9325. {
  9326. return QModelIndex();
  9327. }
  9328. DeviceTreeModelNode*childItem=
  9329. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  9330. DeviceTreeModelNode*parentItem= childItem->parent();
  9331. if(!parentItem||parentItem==root)
  9332. {
  9333. return QModelIndex();
  9334. }
  9335. return createIndex(parentItem->row(),0,parentItem);
  9336. }
  9337. /*:759*//*760:*/
  9338. #line 15694 "./typica.w"
  9339. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  9340. {
  9341. if(!index.isValid())
  9342. {
  9343. return 0;
  9344. }
  9345. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  9346. }
  9347. /*:760*//*761:*/
  9348. #line 15709 "./typica.w"
  9349. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  9350. {
  9351. if(!index.isValid())
  9352. {
  9353. return QVariant();
  9354. }
  9355. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  9356. {
  9357. return QVariant();
  9358. }
  9359. DeviceTreeModelNode*item=
  9360. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9361. QDomNode node= item->node();
  9362. QDomElement element= node.toElement();
  9363. switch(role)
  9364. {
  9365. case Qt::DisplayRole:
  9366. case Qt::EditRole:
  9367. return QVariant(element.attribute("name"));
  9368. case Qt::UserRole:
  9369. return QVariant(element.attribute("reference"));
  9370. default:
  9371. return QVariant();
  9372. }
  9373. return QVariant();
  9374. }
  9375. /*:761*//*762:*/
  9376. #line 15741 "./typica.w"
  9377. bool DeviceTreeModel::setData(const QModelIndex&index,
  9378. const QVariant&value,int)
  9379. {
  9380. if(!index.isValid())
  9381. {
  9382. return false;
  9383. }
  9384. DeviceTreeModelNode*item=
  9385. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9386. QDomNode node= item->node();
  9387. QDomElement element= node.toElement();
  9388. element.setAttribute("name",value.toString());
  9389. emit dataChanged(index,index);
  9390. return true;
  9391. }
  9392. /*:762*//*763:*/
  9393. #line 15764 "./typica.w"
  9394. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  9395. const QModelIndex&parent)
  9396. {
  9397. QString referenceID= QUuid::createUuid().toString();
  9398. /*757:*/
  9399. #line 15642 "./typica.w"
  9400. DeviceTreeModelNode*parentItem;
  9401. if(!parent.isValid())
  9402. {
  9403. parentItem= root;
  9404. }
  9405. else
  9406. {
  9407. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9408. }
  9409. /*:757*/
  9410. #line 15769 "./typica.w"
  9411. QDomNode parentNode= parentItem->node();
  9412. int newRowNumber= rowCount(parent);
  9413. beginInsertRows(parent,newRowNumber,newRowNumber);
  9414. QDomElement deviceElement= document.createElement("node");
  9415. deviceElement.setAttribute("name",name);
  9416. deviceElement.setAttribute("reference",referenceID);
  9417. parentNode.appendChild(deviceElement);
  9418. QDomElement referenceElement= document.createElement("reference");
  9419. referenceElement.setAttribute("id",referenceID);
  9420. referenceElement.setAttribute("driver",driver);
  9421. referenceSection.appendChild(referenceElement);
  9422. endInsertRows();
  9423. }
  9424. /*:763*//*764:*/
  9425. #line 15787 "./typica.w"
  9426. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  9427. {
  9428. /*757:*/
  9429. #line 15642 "./typica.w"
  9430. DeviceTreeModelNode*parentItem;
  9431. if(!parent.isValid())
  9432. {
  9433. parentItem= root;
  9434. }
  9435. else
  9436. {
  9437. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9438. }
  9439. /*:757*/
  9440. #line 15790 "./typica.w"
  9441. QDomNode parentNode= parentItem->node();
  9442. QDomNodeList childNodes= parentNode.childNodes();
  9443. if(childNodes.size()<row+count)
  9444. {
  9445. return false;
  9446. }
  9447. beginRemoveRows(parent,row,row+count-1);
  9448. QList<QDomElement> removalList;
  9449. for(int i= row;i<row+count;i++)
  9450. {
  9451. removalList.append(childNodes.at(i).toElement());
  9452. }
  9453. QDomElement element;
  9454. QDomElement reference;
  9455. for(int i= 0;i<count;i++)
  9456. {
  9457. element= removalList.at(i);
  9458. if(element.hasAttribute("reference"))
  9459. {
  9460. reference= referenceElement(element.attribute("reference"));
  9461. if(!reference.isNull())
  9462. {
  9463. referenceSection.removeChild(reference);
  9464. }
  9465. }
  9466. parentNode.removeChild(element);
  9467. }
  9468. endRemoveRows();
  9469. beginResetModel();
  9470. delete root;
  9471. root= new DeviceTreeModelNode(treeRoot,0);
  9472. endResetModel();
  9473. return true;
  9474. }
  9475. /*:764*//*765:*/
  9476. #line 15829 "./typica.w"
  9477. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  9478. {
  9479. QDomNodeList childNodes= referenceSection.childNodes();
  9480. QDomElement element;
  9481. for(int i= 0;i<childNodes.size();i++)
  9482. {
  9483. element= childNodes.at(i).toElement();
  9484. if(element.hasAttribute("id"))
  9485. {
  9486. if(element.attribute("id")==id)
  9487. {
  9488. return element;
  9489. }
  9490. }
  9491. }
  9492. return QDomElement();
  9493. }
  9494. /*:765*//*766:*/
  9495. #line 15850 "./typica.w"
  9496. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  9497. {
  9498. return QVariant();
  9499. }
  9500. /*:766*//*767:*/
  9501. #line 15859 "./typica.w"
  9502. DeviceTreeModel::~DeviceTreeModel()
  9503. {
  9504. delete root;
  9505. }
  9506. /*:767*/
  9507. #line 582 "./typica.w"
  9508. /*794:*/
  9509. #line 16359 "./typica.w"
  9510. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  9511. DeviceTreeModel*model,const QModelIndex&index)
  9512. :QWidget(NULL),deviceModel(model),currentNode(index)
  9513. {
  9514. }
  9515. /*:794*//*795:*/
  9516. #line 16371 "./typica.w"
  9517. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  9518. const QString&value)
  9519. {
  9520. QDomElement referenceElement= deviceModel->referenceElement(
  9521. deviceModel->data(currentNode,Qt::UserRole).toString());
  9522. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9523. QDomElement node;
  9524. bool found= false;
  9525. for(int i= 0;i<configData.size();i++)
  9526. {
  9527. node= configData.at(i).toElement();
  9528. if(node.attribute("name")==name)
  9529. {
  9530. node.setAttribute("value",value);
  9531. found= true;
  9532. break;
  9533. }
  9534. }
  9535. if(!found)
  9536. {
  9537. node= AppInstance->deviceConfiguration().createElement("attribute");
  9538. node.setAttribute("name",name);
  9539. node.setAttribute("value",value);
  9540. referenceElement.appendChild(node);
  9541. }
  9542. AppInstance->saveDeviceConfiguration();
  9543. }
  9544. /*:795*//*796:*/
  9545. #line 16405 "./typica.w"
  9546. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  9547. const QString&driver)
  9548. {
  9549. deviceModel->newNode(name,driver,currentNode);
  9550. }
  9551. /*:796*/
  9552. #line 583 "./typica.w"
  9553. /*785:*/
  9554. #line 16203 "./typica.w"
  9555. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  9556. view(new QTreeView),configArea(new QScrollArea)
  9557. {
  9558. QSplitter*splitter= new QSplitter;
  9559. QWidget*leftWidget= new QWidget;
  9560. leftWidget->setMinimumWidth(200);
  9561. QVBoxLayout*left= new QVBoxLayout;
  9562. view->setAnimated(true);
  9563. view->setSelectionMode(QAbstractItemView::SingleSelection);
  9564. document= AppInstance->deviceConfiguration();
  9565. model= new DeviceTreeModel;
  9566. view->setModel(model);
  9567. view->setTextElideMode(Qt::ElideNone);
  9568. view->expandAll();
  9569. view->resizeColumnToContents(0);
  9570. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  9571. QHBoxLayout*treeButtons= new QHBoxLayout;
  9572. QToolButton*addDeviceButton= new QToolButton;
  9573. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  9574. addDeviceButton->setToolTip(tr("New Roaster"));
  9575. connect(addDeviceButton,SIGNAL(clicked()),
  9576. this,SLOT(addDevice()));
  9577. QToolButton*removeNodeButton= new QToolButton;
  9578. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  9579. removeNodeButton->setToolTip(tr("Delete Selection"));
  9580. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  9581. treeButtons->addWidget(addDeviceButton);
  9582. treeButtons->addWidget(removeNodeButton);
  9583. left->addWidget(view);
  9584. left->addLayout(treeButtons);
  9585. leftWidget->setLayout(left);
  9586. splitter->addWidget(leftWidget);
  9587. configArea->setMinimumWidth(580);
  9588. configArea->setMinimumHeight(460);
  9589. configArea->setWidgetResizable(true);
  9590. splitter->addWidget(configArea);
  9591. QVBoxLayout*centralLayout= new QVBoxLayout;
  9592. centralLayout->addWidget(splitter);
  9593. setLayout(centralLayout);
  9594. connect(view,SIGNAL(activated(QModelIndex)),
  9595. this,SLOT(newSelection(QModelIndex)));
  9596. connect(view,SIGNAL(clicked(QModelIndex)),
  9597. this,SLOT(newSelection(QModelIndex)));
  9598. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9599. view,SLOT(expand(QModelIndex)));
  9600. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9601. this,SLOT(resizeColumn()));
  9602. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  9603. this,SLOT(resizeColumn()));
  9604. }
  9605. /*:785*//*786:*/
  9606. #line 16258 "./typica.w"
  9607. void DeviceConfigurationWindow::addDevice()
  9608. {
  9609. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  9610. }
  9611. /*:786*//*787:*/
  9612. #line 16266 "./typica.w"
  9613. void DeviceConfigurationWindow::removeNode()
  9614. {
  9615. QModelIndex index= view->currentIndex();
  9616. if(index.isValid())
  9617. {
  9618. int row= index.row();
  9619. QModelIndex parent= index.parent();
  9620. model->removeRow(row,parent);
  9621. }
  9622. }
  9623. /*:787*//*788:*/
  9624. #line 16282 "./typica.w"
  9625. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  9626. {
  9627. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  9628. if(editor)
  9629. {
  9630. configArea->setWidget(editor);
  9631. editor->show();
  9632. }
  9633. }
  9634. /*:788*//*789:*/
  9635. #line 16299 "./typica.w"
  9636. void DeviceConfigurationWindow::resizeColumn()
  9637. {
  9638. view->resizeColumnToContents(0);
  9639. }
  9640. /*:789*/
  9641. #line 584 "./typica.w"
  9642. /*809:*/
  9643. #line 16780 "./typica.w"
  9644. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  9645. const QModelIndex&index):
  9646. BasicDeviceConfigurationWidget(model,index)
  9647. {
  9648. QFormLayout*layout= new QFormLayout;
  9649. QLineEdit*columnName= new QLineEdit;
  9650. layout->addRow(tr("Column Name:"),columnName);
  9651. QComboBox*typeSelector= new QComboBox;
  9652. typeSelector->addItem("J");
  9653. typeSelector->addItem("K");
  9654. typeSelector->addItem("T");
  9655. typeSelector->addItem("B");
  9656. typeSelector->addItem("E");
  9657. typeSelector->addItem("N");
  9658. typeSelector->addItem("R");
  9659. typeSelector->addItem("S");
  9660. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9661. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  9662. layout->addRow(hideSeries);
  9663. setLayout(layout);
  9664. /*799:*/
  9665. #line 16574 "./typica.w"
  9666. QDomElement referenceElement=
  9667. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9668. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9669. QDomElement node;
  9670. /*:799*/
  9671. #line 16801 "./typica.w"
  9672. for(int i= 0;i<configData.size();i++)
  9673. {
  9674. node= configData.at(i).toElement();
  9675. if(node.attribute("name")=="type")
  9676. {
  9677. typeSelector->setCurrentIndex(
  9678. typeSelector->findText(node.attribute("value")));
  9679. }
  9680. else if(node.attribute("name")=="columnname")
  9681. {
  9682. columnName->setText(node.attribute("value"));
  9683. }
  9684. else if(node.attribute("name")=="hidden")
  9685. {
  9686. hideSeries->setChecked(node.attribute("value")=="true");
  9687. }
  9688. }
  9689. updateThermocoupleType(typeSelector->currentText());
  9690. updateColumnName(columnName->text());
  9691. updateHidden(hideSeries->isChecked());
  9692. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  9693. this,SLOT(updateThermocoupleType(QString)));
  9694. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9695. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9696. }
  9697. /*:809*//*810:*/
  9698. #line 16831 "./typica.w"
  9699. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  9700. {
  9701. updateAttribute("type",type);
  9702. }
  9703. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  9704. {
  9705. updateAttribute("columnname",name);
  9706. }
  9707. void Ni9211TcConfWidget::updateHidden(bool hidden)
  9708. {
  9709. updateAttribute("hidden",hidden?"true":"false");
  9710. }
  9711. /*:810*/
  9712. #line 585 "./typica.w"
  9713. /*805:*/
  9714. #line 16694 "./typica.w"
  9715. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  9716. const QModelIndex&index)
  9717. :BasicDeviceConfigurationWidget(model,index)
  9718. {
  9719. QVBoxLayout*layout= new QVBoxLayout;
  9720. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9721. QLabel*label= new QLabel(tr("Device ID:"));
  9722. QLineEdit*deviceId= new QLineEdit;
  9723. deviceIdLayout->addWidget(label);
  9724. deviceIdLayout->addWidget(deviceId);
  9725. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9726. layout->addLayout(deviceIdLayout);
  9727. layout->addWidget(addChannelButton);
  9728. /*799:*/
  9729. #line 16574 "./typica.w"
  9730. QDomElement referenceElement=
  9731. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9732. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9733. QDomElement node;
  9734. /*:799*/
  9735. #line 16708 "./typica.w"
  9736. for(int i= 0;i<configData.size();i++)
  9737. {
  9738. node= configData.at(i).toElement();
  9739. if(node.attribute("name")=="deviceID")
  9740. {
  9741. deviceId->setText(node.attribute("value","Dev1"));
  9742. break;
  9743. }
  9744. }
  9745. updateDeviceId(deviceId->text());
  9746. connect(addChannelButton,SIGNAL(clicked()),
  9747. this,SLOT(addChannel()));
  9748. connect(deviceId,SIGNAL(textEdited(QString)),
  9749. this,SLOT(updateDeviceId(QString)));
  9750. setLayout(layout);
  9751. }
  9752. /*:805*//*806:*/
  9753. #line 16730 "./typica.w"
  9754. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  9755. {
  9756. updateAttribute("deviceID",newId);
  9757. }
  9758. /*:806*//*807:*/
  9759. #line 16738 "./typica.w"
  9760. void NiDaqMxBase9211ConfWidget::addChannel()
  9761. {
  9762. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9763. }
  9764. /*:807*/
  9765. #line 586 "./typica.w"
  9766. /*803:*/
  9767. #line 16645 "./typica.w"
  9768. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  9769. DeviceTreeModel*model,const QModelIndex&index):
  9770. BasicDeviceConfigurationWidget(model,index)
  9771. {
  9772. QHBoxLayout*layout= new QHBoxLayout;
  9773. QToolButton*addDeviceButton= new QToolButton;
  9774. addDeviceButton->setText(tr("Add Device"));
  9775. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  9776. "nidaqmxbase9211series");
  9777. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9778. "nidaqmxbase9211series");
  9779. connect(add9211,SIGNAL(triggered(QString,QString)),
  9780. this,SLOT(insertChildNode(QString,QString)));
  9781. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9782. this,SLOT(insertChildNode(QString,QString)));
  9783. QMenu*deviceMenu= new QMenu;
  9784. deviceMenu->addAction(add9211);
  9785. deviceMenu->addAction(add9211a);
  9786. addDeviceButton->setMenu(deviceMenu);
  9787. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9788. layout->addWidget(addDeviceButton);
  9789. setLayout(layout);
  9790. }
  9791. /*:803*/
  9792. #line 587 "./typica.w"
  9793. /*664:*/
  9794. #line 14117 "./typica.w"
  9795. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  9796. QObject*parent):
  9797. QAction(reportName,parent),reportFile(fileName)
  9798. {
  9799. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  9800. }
  9801. /*:664*//*665:*/
  9802. #line 14133 "./typica.w"
  9803. void ReportAction::createReport()
  9804. {
  9805. QFile file(reportFile);
  9806. QDomDocument document;
  9807. if(file.open(QIODevice::ReadOnly))
  9808. {
  9809. document.setContent(&file,true);
  9810. QDomElement element= document.documentElement();
  9811. QScriptEngine*engine= AppInstance->engine;
  9812. QScriptContext*context= engine->pushContext();
  9813. QScriptValue object;
  9814. QString targetID= reportFile;
  9815. /*201:*/
  9816. #line 4710 "./typica.w"
  9817. ScriptQMainWindow*window= new ScriptQMainWindow;
  9818. window->setObjectName(targetID);
  9819. object= engine->newQObject(window);
  9820. setQMainWindowProperties(object,engine);
  9821. QWidget*central= new(QWidget);
  9822. central->setParent(window);
  9823. central->setObjectName("centralWidget");
  9824. window->setCentralWidget(central);
  9825. if(element.hasChildNodes())
  9826. {
  9827. /*202:*/
  9828. #line 4746 "./typica.w"
  9829. QStack<QWidget*> widgetStack;
  9830. QStack<QLayout*> layoutStack;
  9831. QString windowScript;
  9832. widgetStack.push(central);
  9833. QDomNodeList windowChildren= element.childNodes();
  9834. int i= 0;
  9835. while(i<windowChildren.count())
  9836. {
  9837. QDomNode current;
  9838. QDomElement element;
  9839. current= windowChildren.at(i);
  9840. if(current.isElement())
  9841. {
  9842. element= current.toElement();
  9843. if(element.tagName()=="program")
  9844. {
  9845. windowScript.append(element.text());
  9846. }
  9847. else if(element.tagName()=="layout")
  9848. {
  9849. element.setAttribute("trcontext","configuration");
  9850. addLayoutToWidget(element,&widgetStack,&layoutStack);
  9851. }
  9852. else if(element.tagName()=="menu")
  9853. {
  9854. /*203:*/
  9855. #line 4794 "./typica.w"
  9856. QMenuBar*bar= window->menuBar();
  9857. bar->setParent(window);
  9858. bar->setObjectName("menuBar");
  9859. if(element.hasAttribute("name"))
  9860. {
  9861. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  9862. element.attribute("name").toUtf8().data()));
  9863. menu->setParent(bar);
  9864. if(element.hasAttribute("type"))
  9865. {
  9866. if(element.attribute("type")=="reports")
  9867. {
  9868. if(element.hasAttribute("src"))
  9869. {
  9870. /*662:*/
  9871. #line 14077 "./typica.w"
  9872. QSettings settings;
  9873. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  9874. toString()).
  9875. arg(element.attribute("src"));
  9876. QDir::addSearchPath("reports",reportDirectory);
  9877. QDir directory(reportDirectory);
  9878. directory.setFilter(QDir::Files);
  9879. directory.setSorting(QDir::Name);
  9880. QStringList nameFilter;
  9881. nameFilter<<"*.xml";
  9882. directory.setNameFilters(nameFilter);
  9883. QFileInfoList reportFiles= directory.entryInfoList();
  9884. for(int i= 0;i<reportFiles.size();i++)
  9885. {
  9886. QFileInfo reportFile= reportFiles.at(i);
  9887. /*666:*/
  9888. #line 14157 "./typica.w"
  9889. QString path= reportFile.absoluteFilePath();
  9890. QFile file(path);
  9891. if(file.open(QIODevice::ReadOnly))
  9892. {
  9893. QDomDocument document;
  9894. document.setContent(&file,true);
  9895. QDomElement root= document.documentElement();
  9896. QString translationContext= root.attribute("id");
  9897. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  9898. if(!titleNode.isNull())
  9899. {
  9900. QDomElement titleElement= titleNode.toElement();
  9901. QString title= QCoreApplication::translate("configuration",
  9902. titleElement.text().toUtf8().data());
  9903. if(!title.isEmpty())
  9904. {
  9905. QStringList hierarchy= title.split(":->");
  9906. QMenu*insertionPoint= menu;
  9907. /*667:*/
  9908. #line 14186 "./typica.w"
  9909. for(int j= 0;j<hierarchy.size()-1;j++)
  9910. {
  9911. QObjectList menuList= insertionPoint->children();
  9912. bool menuFound= false;
  9913. for(int k= 0;k<menuList.size();k++)
  9914. {
  9915. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  9916. if(currentItem)
  9917. {
  9918. if(currentItem->title()==hierarchy.at(j))
  9919. {
  9920. menuFound= true;
  9921. insertionPoint= currentItem;
  9922. break;
  9923. }
  9924. }
  9925. }
  9926. if(!menuFound)
  9927. {
  9928. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  9929. }
  9930. }
  9931. /*:667*/
  9932. #line 14176 "./typica.w"
  9933. ReportAction*action= new ReportAction(path,hierarchy.last());
  9934. insertionPoint->addAction(action);
  9935. }
  9936. }
  9937. }
  9938. /*:666*/
  9939. #line 14093 "./typica.w"
  9940. }
  9941. /*:662*/
  9942. #line 4809 "./typica.w"
  9943. }
  9944. }
  9945. }
  9946. if(element.hasChildNodes())
  9947. {
  9948. /*204:*/
  9949. #line 4822 "./typica.w"
  9950. QDomNodeList menuItems= element.childNodes();
  9951. int j= 0;
  9952. while(j<menuItems.count())
  9953. {
  9954. QDomNode item= menuItems.at(j);
  9955. if(item.isElement())
  9956. {
  9957. QDomElement itemElement= item.toElement();
  9958. if(itemElement.tagName()=="item")
  9959. {
  9960. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  9961. itemElement.text().toUtf8().data()),menu);
  9962. if(itemElement.hasAttribute("id"))
  9963. {
  9964. itemAction->setObjectName(itemElement.attribute("id"));
  9965. }
  9966. if(itemElement.hasAttribute("shortcut"))
  9967. {
  9968. itemAction->setShortcut(itemElement.attribute("shortcut"));
  9969. }
  9970. menu->addAction(itemAction);
  9971. }
  9972. else if(itemElement.tagName()=="separator")
  9973. {
  9974. menu->addSeparator();
  9975. }
  9976. else if(itemElement.tagName()=="plugins")
  9977. {
  9978. /*687:*/
  9979. #line 21 "./plugins.w"
  9980. QMenu*pluginMenu= new QMenu(menu);
  9981. if(itemElement.hasAttribute("id"))
  9982. {
  9983. pluginMenu->setObjectName(itemElement.attribute("id"));
  9984. }
  9985. if(itemElement.hasAttribute("title"))
  9986. {
  9987. pluginMenu->setTitle(itemElement.attribute("title"));
  9988. }
  9989. if(itemElement.hasAttribute("src"))
  9990. {
  9991. QSettings settings;
  9992. QString pluginDirectory= QString("%1/%2").
  9993. arg(settings.value("config").toString()).
  9994. arg(itemElement.attribute("src"));
  9995. QDir directory(pluginDirectory);
  9996. directory.setFilter(QDir::Files);
  9997. directory.setSorting(QDir::Name);
  9998. QStringList nameFilter;
  9999. nameFilter<<"*.js";
  10000. directory.setNameFilters(nameFilter);
  10001. QFileInfoList pluginFiles= directory.entryInfoList();
  10002. for(int k= 0;k<pluginFiles.size();k++)
  10003. {
  10004. PluginAction*pa= new PluginAction(pluginFiles.at(k),pluginMenu);
  10005. if(itemElement.hasAttribute("preRun"))
  10006. {
  10007. pa->setPreRun(itemElement.attribute("preRun"));
  10008. }
  10009. if(itemElement.hasAttribute("postRun"))
  10010. {
  10011. pa->setPostRun(itemElement.attribute("postRun"));
  10012. }
  10013. pluginMenu->addAction(pa);
  10014. }
  10015. }
  10016. menu->addMenu(pluginMenu);
  10017. /*:687*/
  10018. #line 4851 "./typica.w"
  10019. }
  10020. }
  10021. j++;
  10022. }
  10023. #line 1 "./helpmenu.w"
  10024. /*:204*/
  10025. #line 4815 "./typica.w"
  10026. }
  10027. }
  10028. /*:203*/
  10029. #line 4772 "./typica.w"
  10030. }
  10031. }
  10032. i++;
  10033. }
  10034. QScriptValue oldThis= context->thisObject();
  10035. context->setThisObject(object);
  10036. QScriptValue result= engine->evaluate(windowScript);
  10037. /*195:*/
  10038. #line 4525 "./typica.w"
  10039. if(engine->hasUncaughtException())
  10040. {
  10041. int line= engine->uncaughtExceptionLineNumber();
  10042. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  10043. result.toString();
  10044. QString trace;
  10045. foreach(trace,engine->uncaughtExceptionBacktrace())
  10046. {
  10047. qDebug()<<trace;
  10048. }
  10049. }
  10050. /*:195*/
  10051. #line 4780 "./typica.w"
  10052. context->setThisObject(oldThis);
  10053. /*:202*/
  10054. #line 4721 "./typica.w"
  10055. }
  10056. /*205:*/
  10057. #line 9 "./helpmenu.w"
  10058. HelpMenu*helpMenu= new HelpMenu();
  10059. window->menuBar()->addMenu(helpMenu);
  10060. /*:205*/
  10061. #line 4723 "./typica.w"
  10062. window->show();
  10063. window->setupFinished();
  10064. /*:201*/
  10065. #line 14146 "./typica.w"
  10066. file.close();
  10067. engine->popContext();
  10068. }
  10069. }
  10070. /*:665*/
  10071. #line 588 "./typica.w"
  10072. /*250:*/
  10073. #line 5990 "./typica.w"
  10074. NumericDelegate::NumericDelegate(QObject*parent):
  10075. QItemDelegate(parent)
  10076. {
  10077. }
  10078. /*:250*//*251:*/
  10079. #line 6002 "./typica.w"
  10080. void NumericDelegate::setEditorData(QWidget*editor,
  10081. const QModelIndex&index)const
  10082. {
  10083. QString value= index.model()->data(index,Qt::EditRole).toString();
  10084. QLineEdit*line= static_cast<QLineEdit*> (editor);
  10085. line->setText(value);
  10086. }
  10087. /*:251*//*252:*/
  10088. #line 6017 "./typica.w"
  10089. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  10090. const QModelIndex&index)const
  10091. {
  10092. QLineEdit*line= static_cast<QLineEdit*> (editor);
  10093. model->setData(index,line->text(),Qt::EditRole);
  10094. QScriptEngine*engine= AppInstance->engine;
  10095. engine->pushContext();
  10096. QString script= QString("Number(%1)").arg(line->text());
  10097. QScriptValue result= engine->evaluate(line->text());
  10098. if(result.isNumber())
  10099. {
  10100. model->setData(index,result.toVariant(),Qt::DisplayRole);
  10101. }
  10102. else
  10103. {
  10104. model->setData(index,QVariant(),Qt::DisplayRole);
  10105. }
  10106. engine->popContext();
  10107. }
  10108. /*:252*//*253:*/
  10109. #line 6040 "./typica.w"
  10110. QWidget*NumericDelegate::createEditor(QWidget*parent,
  10111. const QStyleOptionViewItem&,
  10112. const QModelIndex&)const
  10113. {
  10114. return(new QLineEdit(parent));
  10115. }
  10116. /*:253*//*254:*/
  10117. #line 6051 "./typica.w"
  10118. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  10119. const QStyleOptionViewItem&option,
  10120. const QModelIndex&)const
  10121. {
  10122. editor->setGeometry(option.rect);
  10123. }
  10124. /*:254*/
  10125. #line 589 "./typica.w"
  10126. /*814:*/
  10127. #line 16890 "./typica.w"
  10128. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  10129. const QModelIndex&index)
  10130. :BasicDeviceConfigurationWidget(model,index)
  10131. {
  10132. QHBoxLayout*layout= new QHBoxLayout;
  10133. QToolButton*addDeviceButton= new QToolButton;
  10134. addDeviceButton->setText(tr("Add Device"));
  10135. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  10136. "nidaqmx9211series");
  10137. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  10138. "nidaqmxtc01");
  10139. connect(add9211a,SIGNAL(triggered(QString,QString)),
  10140. this,SLOT(insertChildNode(QString,QString)));
  10141. connect(addtc01,SIGNAL(triggered(QString,QString)),
  10142. this,SLOT(insertChildNode(QString,QString)));
  10143. QMenu*deviceMenu= new QMenu;
  10144. deviceMenu->addAction(add9211a);
  10145. deviceMenu->addAction(addtc01);
  10146. addDeviceButton->setMenu(deviceMenu);
  10147. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  10148. layout->addWidget(addDeviceButton);
  10149. setLayout(layout);
  10150. }
  10151. /*:814*/
  10152. #line 590 "./typica.w"
  10153. /*816:*/
  10154. #line 16939 "./typica.w"
  10155. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  10156. const QModelIndex&index)
  10157. :BasicDeviceConfigurationWidget(model,index)
  10158. {
  10159. QVBoxLayout*layout= new QVBoxLayout;
  10160. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  10161. QLabel*label= new QLabel(tr("Device ID:"));
  10162. QLineEdit*deviceId= new QLineEdit;
  10163. deviceIdLayout->addWidget(label);
  10164. deviceIdLayout->addWidget(deviceId);
  10165. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  10166. layout->addLayout(deviceIdLayout);
  10167. layout->addWidget(addChannelButton);
  10168. /*799:*/
  10169. #line 16574 "./typica.w"
  10170. QDomElement referenceElement=
  10171. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10172. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10173. QDomElement node;
  10174. /*:799*/
  10175. #line 16953 "./typica.w"
  10176. for(int i= 0;i<configData.size();i++)
  10177. {
  10178. node= configData.at(i).toElement();
  10179. if(node.attribute("name")=="deviceID")
  10180. {
  10181. deviceId->setText(node.attribute("value","Dev1"));
  10182. break;
  10183. }
  10184. }
  10185. updateDeviceId(deviceId->text());
  10186. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  10187. connect(deviceId,SIGNAL(textEdited(QString)),
  10188. this,SLOT(updateDeviceId(QString)));
  10189. setLayout(layout);
  10190. }
  10191. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  10192. {
  10193. updateAttribute("deviceID",newId);
  10194. }
  10195. void NiDaqMx9211ConfWidget::addChannel()
  10196. {
  10197. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  10198. }
  10199. /*:816*/
  10200. #line 591 "./typica.w"
  10201. /*818:*/
  10202. #line 17004 "./typica.w"
  10203. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  10204. const QModelIndex&index)
  10205. :BasicDeviceConfigurationWidget(model,index)
  10206. {
  10207. QFormLayout*layout= new QFormLayout;
  10208. QLineEdit*deviceId= new QLineEdit;
  10209. layout->addRow(tr("Device ID:"),deviceId);
  10210. QLineEdit*columnName= new QLineEdit;
  10211. layout->addRow(tr("Column Name:"),columnName);
  10212. QComboBox*typeSelector= new QComboBox;
  10213. typeSelector->addItem("J");
  10214. typeSelector->addItem("K");
  10215. typeSelector->addItem("T");
  10216. typeSelector->addItem("B");
  10217. typeSelector->addItem("E");
  10218. typeSelector->addItem("N");
  10219. typeSelector->addItem("R");
  10220. typeSelector->addItem("S");
  10221. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  10222. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  10223. layout->addRow(hideSeries);
  10224. /*799:*/
  10225. #line 16574 "./typica.w"
  10226. QDomElement referenceElement=
  10227. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10228. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10229. QDomElement node;
  10230. /*:799*/
  10231. #line 17026 "./typica.w"
  10232. for(int i= 0;i<configData.size();i++)
  10233. {
  10234. node= configData.at(i).toElement();
  10235. if(node.attribute("name")=="deviceID")
  10236. {
  10237. deviceId->setText(node.attribute("value"));
  10238. }
  10239. else if(node.attribute("name")=="type")
  10240. {
  10241. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  10242. }
  10243. else if(node.attribute("name")=="columnname")
  10244. {
  10245. columnName->setText(node.attribute("value"));
  10246. }
  10247. else if(node.attribute("name")=="hidden")
  10248. {
  10249. hideSeries->setChecked(node.attribute("value")=="true");
  10250. }
  10251. }
  10252. updateDeviceId(deviceId->text());
  10253. updateThermocoupleType(typeSelector->currentText());
  10254. updateColumnName(columnName->text());
  10255. updateHidden(hideSeries->isChecked());
  10256. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  10257. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  10258. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  10259. setLayout(layout);
  10260. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  10261. }
  10262. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  10263. {
  10264. updateAttribute("deviceID",newId);
  10265. }
  10266. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  10267. {
  10268. updateAttribute("type",type);
  10269. }
  10270. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  10271. {
  10272. updateAttribute("columnname",name);
  10273. }
  10274. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  10275. {
  10276. updateAttribute("hidden",hidden?"true":"false");
  10277. }
  10278. /*:818*/
  10279. #line 592 "./typica.w"
  10280. /*836:*/
  10281. #line 17446 "./typica.w"
  10282. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  10283. const QModelIndex&index)
  10284. :BasicDeviceConfigurationWidget(model,index)
  10285. {
  10286. QFormLayout*layout= new QFormLayout;
  10287. QToolButton*addDeviceButton= new QToolButton;
  10288. addDeviceButton->setText(tr("Add Device"));
  10289. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  10290. "Modbus RTU Device",
  10291. "modbusrtudevice");
  10292. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  10293. this,SLOT(insertChildNode(QString,QString)));
  10294. QMenu*deviceMenu= new QMenu;
  10295. deviceMenu->addAction(addModbusRtuDevice);
  10296. addDeviceButton->setMenu(deviceMenu);
  10297. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  10298. layout->addRow(QString(),addDeviceButton);
  10299. PortSelector*port= new PortSelector;
  10300. layout->addRow(tr("Port:"),port);
  10301. connect(port,SIGNAL(currentIndexChanged(QString)),
  10302. this,SLOT(updatePort(QString)));
  10303. connect(port,SIGNAL(editTextChanged(QString)),
  10304. this,SLOT(updatePort(QString)));
  10305. BaudSelector*rate= new BaudSelector;
  10306. layout->addRow(tr("Baud:"),rate);
  10307. connect(rate,SIGNAL(currentIndexChanged(QString)),
  10308. this,SLOT(updateBaudRate(QString)));
  10309. ParitySelector*parity= new ParitySelector;
  10310. layout->addRow(tr("Parity:"),parity);
  10311. connect(parity,SIGNAL(currentIndexChanged(QString)),
  10312. this,SLOT(updateParity(QString)));
  10313. FlowSelector*flow= new FlowSelector;
  10314. layout->addRow(tr("Flow Control:"),flow);
  10315. connect(flow,SIGNAL(currentIndexChanged(QString)),
  10316. this,SLOT(updateFlowControl(QString)));
  10317. StopSelector*stop= new StopSelector;
  10318. layout->addRow(tr("Stop Bits:"),stop);
  10319. connect(stop,SIGNAL(currentIndexChanged(QString)),
  10320. this,SLOT(updateStopBits(QString)));
  10321. /*799:*/
  10322. #line 16574 "./typica.w"
  10323. QDomElement referenceElement=
  10324. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10325. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10326. QDomElement node;
  10327. /*:799*/
  10328. #line 17486 "./typica.w"
  10329. for(int i= 0;i<configData.size();i++)
  10330. {
  10331. node= configData.at(i).toElement();
  10332. if(node.attribute("name")=="port")
  10333. {
  10334. int j= port->findText(node.attribute("value"));
  10335. if(j>=0)
  10336. {
  10337. port->setCurrentIndex(j);
  10338. }
  10339. else
  10340. {
  10341. port->insertItem(0,node.attribute("value"));
  10342. port->setCurrentIndex(0);
  10343. }
  10344. }
  10345. else if(node.attribute("name")=="baudrate")
  10346. {
  10347. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  10348. }
  10349. else if(node.attribute("name")=="parity")
  10350. {
  10351. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  10352. }
  10353. else if(node.attribute("name")=="flowcontrol")
  10354. {
  10355. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  10356. }
  10357. else if(node.attribute("name")=="stopbits")
  10358. {
  10359. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  10360. }
  10361. }
  10362. updatePort(port->currentText());
  10363. updateBaudRate(rate->currentText());
  10364. updateParity(parity->currentText());
  10365. updateFlowControl(flow->currentText());
  10366. updateStopBits(stop->currentText());
  10367. setLayout(layout);
  10368. }
  10369. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  10370. {
  10371. updateAttribute("port",newPort);
  10372. }
  10373. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  10374. {
  10375. updateAttribute("baudrate",newRate);
  10376. }
  10377. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  10378. {
  10379. updateAttribute("parity",newParity);
  10380. }
  10381. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  10382. {
  10383. updateAttribute("flowcontrol",newFlow);
  10384. }
  10385. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  10386. {
  10387. updateAttribute("stopbits",newStopBits);
  10388. }
  10389. /*:836*/
  10390. #line 593 "./typica.w"
  10391. /*838:*/
  10392. #line 17609 "./typica.w"
  10393. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  10394. const QModelIndex&index)
  10395. :BasicDeviceConfigurationWidget(model,index),
  10396. unitSpecificationLayout(new QStackedLayout),
  10397. decimalSpecificationLayout(new QStackedLayout)
  10398. {
  10399. QVBoxLayout*layout= new QVBoxLayout;
  10400. QToolButton*addChannelButton= new QToolButton;
  10401. addChannelButton->setText(tr("Add Channel"));
  10402. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  10403. "Temperature Process Value",
  10404. "modbustemperaturepv");
  10405. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  10406. "Temperature Set Value",
  10407. "modbustemperaturesv");
  10408. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  10409. this,SLOT(insertChildNode(QString,QString)));
  10410. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  10411. this,SLOT(insertChildNode(QString,QString)));
  10412. QMenu*channelMenu= new QMenu;
  10413. channelMenu->addAction(addTemperaturePV);
  10414. channelMenu->addAction(addTemperatureSV);
  10415. addChannelButton->setMenu(channelMenu);
  10416. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  10417. layout->addWidget(addChannelButton);
  10418. QHBoxLayout*stationLayout= new QHBoxLayout;
  10419. QLabel*stationLabel= new QLabel(tr("Station:"));
  10420. QSpinBox*stationNumber= new QSpinBox;
  10421. stationNumber->setMinimum(0);
  10422. stationNumber->setMaximum(255);
  10423. stationLayout->addWidget(stationLabel);
  10424. stationLayout->addWidget(stationNumber);
  10425. layout->addLayout(stationLayout);
  10426. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  10427. layout->addWidget(fixedUnit);
  10428. QWidget*fixedUnitPlaceholder= new QWidget(this);
  10429. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  10430. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  10431. QComboBox*fixedUnitSelector= new QComboBox;
  10432. fixedUnitSelector->addItem("Fahrenheit");
  10433. fixedUnitSelector->addItem("Celsius");
  10434. fixedUnitLayout->addWidget(fixedUnitLabel);
  10435. fixedUnitLayout->addWidget(fixedUnitSelector);
  10436. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  10437. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  10438. QWidget*queriedUnitPlaceholder= new QWidget(this);
  10439. QFormLayout*queriedUnitLayout= new QFormLayout;
  10440. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  10441. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  10442. QSpinBox*valueF= new QSpinBox;
  10443. valueF->setMinimum(0);
  10444. valueF->setMaximum(65535);
  10445. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  10446. QSpinBox*valueC= new QSpinBox;
  10447. valueC->setMinimum(0);
  10448. valueC->setMaximum(65535);
  10449. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  10450. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  10451. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  10452. layout->addLayout(unitSpecificationLayout);
  10453. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  10454. layout->addWidget(fixedPrecision);
  10455. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  10456. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  10457. QSpinBox*fixedPrecisionValue= new QSpinBox;
  10458. fixedPrecisionValue->setMinimum(0);
  10459. fixedPrecisionValue->setMaximum(9);
  10460. fixedPrecisionLayout->addRow("Places after the decimal point:",
  10461. fixedPrecisionValue);
  10462. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  10463. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  10464. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  10465. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  10466. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  10467. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  10468. precisionAddress);
  10469. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  10470. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  10471. layout->addLayout(decimalSpecificationLayout);
  10472. /*799:*/
  10473. #line 16574 "./typica.w"
  10474. QDomElement referenceElement=
  10475. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10476. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10477. QDomElement node;
  10478. /*:799*/
  10479. #line 17689 "./typica.w"
  10480. for(int i= 0;i<configData.size();i++)
  10481. {
  10482. node= configData.at(i).toElement();
  10483. if(node.attribute("name")=="station")
  10484. {
  10485. stationNumber->setValue(node.attribute("value").toInt());
  10486. }
  10487. else if(node.attribute("name")=="fixedunit")
  10488. {
  10489. if(node.attribute("value")=="true")
  10490. {
  10491. fixedUnit->setCheckState(Qt::Checked);
  10492. }
  10493. else if(node.attribute("value")=="false")
  10494. {
  10495. fixedUnit->setCheckState(Qt::Unchecked);
  10496. }
  10497. }
  10498. else if(node.attribute("name")=="fixedprecision")
  10499. {
  10500. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10501. }
  10502. else if(node.attribute("name")=="unit")
  10503. {
  10504. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  10505. }
  10506. else if(node.attribute("name")=="unitaddress")
  10507. {
  10508. unitAddress->setValue(node.attribute("value").toInt());
  10509. }
  10510. else if(node.attribute("name")=="fvalue")
  10511. {
  10512. valueF->setValue(node.attribute("value").toInt());
  10513. }
  10514. else if(node.attribute("name")=="cvalue")
  10515. {
  10516. valueC->setValue(node.attribute("value").toInt());
  10517. }
  10518. else if(node.attribute("name")=="precisionaddress")
  10519. {
  10520. precisionAddress->setValue(node.attribute("value").toInt());
  10521. }
  10522. else if(node.attribute("name")=="precision")
  10523. {
  10524. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10525. }
  10526. }
  10527. updateStationNumber(stationNumber->value());
  10528. updateFixedUnit(fixedUnit->isChecked());
  10529. updateFixedDecimal(fixedPrecision->isChecked());
  10530. updateUnit(fixedUnitSelector->currentText());
  10531. updateUnitAddress(unitAddress->value());
  10532. updateValueF(valueF->value());
  10533. updateValueC(valueC->value());
  10534. updatePrecisionAddress(precisionAddress->value());
  10535. updatePrecisionValue(fixedPrecisionValue->value());
  10536. connect(stationNumber,SIGNAL(valueChanged(int)),
  10537. this,SLOT(updateStationNumber(int)));
  10538. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  10539. this,SLOT(updateUnit(QString)));
  10540. connect(unitAddress,SIGNAL(valueChanged(int)),
  10541. this,SLOT(updateUnitAddress(int)));
  10542. connect(valueF,SIGNAL(valueChanged(int)),
  10543. this,SLOT(updateValueF(int)));
  10544. connect(valueC,SIGNAL(valueChanged(int)),
  10545. this,SLOT(updateValueC(int)));
  10546. connect(fixedUnit,SIGNAL(toggled(bool)),
  10547. this,SLOT(updateFixedUnit(bool)));
  10548. connect(fixedPrecision,SIGNAL(toggled(bool)),
  10549. this,SLOT(updateFixedDecimal(bool)));
  10550. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  10551. this,SLOT(updatePrecisionValue(int)));
  10552. connect(precisionAddress,SIGNAL(valueChanged(int)),
  10553. this,SLOT(updatePrecisionAddress(int)));
  10554. setLayout(layout);
  10555. }
  10556. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  10557. {
  10558. updateAttribute("station",QString("%1").arg(newStation));
  10559. }
  10560. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  10561. {
  10562. if(newFixed)
  10563. {
  10564. unitSpecificationLayout->setCurrentIndex(0);
  10565. updateAttribute("fixedunit","true");
  10566. }
  10567. else
  10568. {
  10569. unitSpecificationLayout->setCurrentIndex(1);
  10570. updateAttribute("fixedunit","false");
  10571. }
  10572. }
  10573. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  10574. {
  10575. if(newFixed)
  10576. {
  10577. decimalSpecificationLayout->setCurrentIndex(0);
  10578. updateAttribute("fixedprecision","true");
  10579. }
  10580. else
  10581. {
  10582. decimalSpecificationLayout->setCurrentIndex(1);
  10583. updateAttribute("fixedprecision","false");
  10584. }
  10585. }
  10586. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  10587. {
  10588. updateAttribute("unit",newUnit);
  10589. }
  10590. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  10591. {
  10592. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  10593. }
  10594. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  10595. {
  10596. updateAttribute("fvalue",QString("%1").arg(newValue));
  10597. }
  10598. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  10599. {
  10600. updateAttribute("cvalue",QString("%1").arg(newValue));
  10601. }
  10602. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  10603. {
  10604. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  10605. }
  10606. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  10607. {
  10608. updateAttribute("precision",QString("%1").arg(newValue));
  10609. }
  10610. /*:838*/
  10611. #line 594 "./typica.w"
  10612. /*840:*/
  10613. #line 17852 "./typica.w"
  10614. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  10615. const QModelIndex&index)
  10616. :BasicDeviceConfigurationWidget(model,index)
  10617. {
  10618. QFormLayout*layout= new QFormLayout;
  10619. ShortHexSpinBox*address= new ShortHexSpinBox;
  10620. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  10621. /*799:*/
  10622. #line 16574 "./typica.w"
  10623. QDomElement referenceElement=
  10624. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10625. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10626. QDomElement node;
  10627. /*:799*/
  10628. #line 17860 "./typica.w"
  10629. for(int i= 0;i<configData.size();i++)
  10630. {
  10631. node= configData.at(i).toElement();
  10632. if(node.attribute("name")=="address")
  10633. {
  10634. address->setValue(node.attribute("value").toInt());
  10635. break;
  10636. }
  10637. }
  10638. updateAddress(address->value());
  10639. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  10640. setLayout(layout);
  10641. }
  10642. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  10643. {
  10644. updateAttribute("address",QString("%1").arg(newAddress));
  10645. }
  10646. /*:840*/
  10647. #line 595 "./typica.w"
  10648. /*842:*/
  10649. #line 17908 "./typica.w"
  10650. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  10651. const QModelIndex&index)
  10652. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  10653. {
  10654. QVBoxLayout*layout= new QVBoxLayout;
  10655. QFormLayout*addressLayout= new QFormLayout;
  10656. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  10657. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  10658. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  10659. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  10660. layout->addLayout(addressLayout);
  10661. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  10662. layout->addWidget(fixedRange);
  10663. QWidget*queriedRangePlaceholder= new QWidget(this);
  10664. QFormLayout*queriedRangeLayout= new QFormLayout;
  10665. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  10666. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  10667. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  10668. lowerAddress);
  10669. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  10670. upperAddress);
  10671. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  10672. boundsLayout->addWidget(queriedRangePlaceholder);
  10673. QWidget*fixedRangePlaceholder= new QWidget(this);
  10674. QFormLayout*fixedRangeLayout= new QFormLayout;
  10675. QLineEdit*fixedLower= new QLineEdit;
  10676. QLineEdit*fixedUpper= new QLineEdit;
  10677. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  10678. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  10679. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  10680. boundsLayout->addWidget(fixedRangePlaceholder);
  10681. layout->addLayout(boundsLayout);
  10682. /*799:*/
  10683. #line 16574 "./typica.w"
  10684. QDomElement referenceElement=
  10685. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10686. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10687. QDomElement node;
  10688. /*:799*/
  10689. #line 17941 "./typica.w"
  10690. for(int i= 0;i<configData.size();i++)
  10691. {
  10692. node= configData.at(i).toElement();
  10693. if(node.attribute("name")=="readaddress")
  10694. {
  10695. readAddress->setValue(node.attribute("value").toInt());
  10696. }
  10697. else if(node.attribute("name")=="writeaddress")
  10698. {
  10699. writeAddress->setValue(node.attribute("value").toInt());
  10700. }
  10701. else if(node.attribute("name")=="fixedrange")
  10702. {
  10703. if(node.attribute("value")=="true")
  10704. {
  10705. fixedRange->setCheckState(Qt::Checked);
  10706. }
  10707. else if(node.attribute("value")=="false")
  10708. {
  10709. fixedRange->setCheckState(Qt::Unchecked);
  10710. }
  10711. }
  10712. else if(node.attribute("name")=="fixedlower")
  10713. {
  10714. fixedLower->setText(node.attribute("value"));
  10715. }
  10716. else if(node.attribute("name")=="fixedupper")
  10717. {
  10718. fixedUpper->setText(node.attribute("value"));
  10719. }
  10720. else if(node.attribute("name")=="loweraddress")
  10721. {
  10722. lowerAddress->setValue(node.attribute("value").toInt());
  10723. }
  10724. else if(node.attribute("name")=="upperaddress")
  10725. {
  10726. upperAddress->setValue(node.attribute("value").toInt());
  10727. }
  10728. }
  10729. updateReadAddress(readAddress->value());
  10730. updateWriteAddress(writeAddress->value());
  10731. updateFixedRange(fixedRange->isChecked());
  10732. updateLower(fixedLower->text());
  10733. updateUpper(fixedUpper->text());
  10734. updateLowerAddress(lowerAddress->value());
  10735. updateUpperAddress(upperAddress->value());
  10736. connect(readAddress,SIGNAL(valueChanged(int)),
  10737. this,SLOT(updateReadAddress(int)));
  10738. connect(writeAddress,SIGNAL(valueChanged(int)),
  10739. this,SLOT(updateWriteAddress(int)));
  10740. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  10741. connect(fixedLower,SIGNAL(textChanged(QString)),
  10742. this,SLOT(updateLower(QString)));
  10743. connect(fixedUpper,SIGNAL(textChanged(QString)),
  10744. this,SLOT(updateUpper(QString)));
  10745. connect(lowerAddress,SIGNAL(valueChanged(int)),
  10746. this,SLOT(updateLowerAddress(int)));
  10747. connect(upperAddress,SIGNAL(valueChanged(int)),
  10748. this,SLOT(updateUpperAddress(int)));
  10749. setLayout(layout);
  10750. }
  10751. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  10752. {
  10753. updateAttribute("readaddress",QString("%1").arg(newAddress));
  10754. }
  10755. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  10756. {
  10757. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  10758. }
  10759. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  10760. {
  10761. if(fixed)
  10762. {
  10763. updateAttribute("fixedrange","true");
  10764. boundsLayout->setCurrentIndex(1);
  10765. }
  10766. else
  10767. {
  10768. updateAttribute("fixedrange","false");
  10769. boundsLayout->setCurrentIndex(0);
  10770. }
  10771. }
  10772. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  10773. {
  10774. updateAttribute("fixedlower",lower);
  10775. }
  10776. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  10777. {
  10778. updateAttribute("fixedupper",upper);
  10779. }
  10780. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  10781. {
  10782. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  10783. }
  10784. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  10785. {
  10786. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  10787. }
  10788. /*:842*/
  10789. #line 596 "./typica.w"
  10790. /*798:*/
  10791. #line 16444 "./typica.w"
  10792. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10793. :BasicDeviceConfigurationWidget(model,index)
  10794. {
  10795. QVBoxLayout*layout= new QVBoxLayout;
  10796. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  10797. QMenu*deviceMenu= new QMenu;
  10798. NodeInserter*insertAction;
  10799. foreach(insertAction,AppInstance->topLevelNodeInserters)
  10800. {
  10801. connect(insertAction,SIGNAL(triggered(QString,QString)),
  10802. this,SLOT(insertChildNode(QString,QString)));
  10803. deviceMenu->addAction(insertAction);
  10804. }
  10805. addDeviceButton->setMenu(deviceMenu);
  10806. layout->addWidget(addDeviceButton);
  10807. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  10808. QMenu*annotationMenu= new QMenu;
  10809. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  10810. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  10811. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  10812. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  10813. tr("Free Text"),
  10814. "freeannotation");
  10815. annotationMenu->addAction(basicButtonInserter);
  10816. annotationMenu->addAction(countingButtonInserter);
  10817. annotationMenu->addAction(spinBoxInserter);
  10818. annotationMenu->addAction(freeAnnotationInserter);
  10819. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  10820. this,SLOT(insertChildNode(QString,QString)));
  10821. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  10822. this,SLOT(insertChildNode(QString,QString)));
  10823. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  10824. this,SLOT(insertChildNode(QString,QString)));
  10825. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10826. this,SLOT(insertChildNode(QString,QString)));
  10827. /*1084:*/
  10828. #line 144 "./valueannotation.w"
  10829. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  10830. tr("Value Annotation"),
  10831. "valueannotation");
  10832. annotationMenu->addAction(valueAnnotationInserter);
  10833. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10834. this,SLOT(insertChildNode(QString,QString)));
  10835. /*:1084*//*1098:*/
  10836. #line 115 "./thresholdannotation.w"
  10837. NodeInserter*thresholdAnnotationInserter= new NodeInserter(tr("Threshold Annotation"),
  10838. tr("Threshold Annotation"),
  10839. "thresholdannotation");
  10840. annotationMenu->addAction(thresholdAnnotationInserter);
  10841. connect(thresholdAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10842. this,SLOT(insertChildNode(QString,QString)));
  10843. /*:1098*/
  10844. #line 16480 "./typica.w"
  10845. addAnnotationControlButton->setMenu(annotationMenu);
  10846. layout->addWidget(addAnnotationControlButton);
  10847. QPushButton*timersButton= new QPushButton(tr("Extra Timers"));
  10848. QMenu*timersMenu= new QMenu;
  10849. NodeInserter*coolingTimerInserter= new NodeInserter(tr("Cooling Timer"),tr("Cooling Timer"),"coolingtimer");
  10850. NodeInserter*rangeTimerInserter= new NodeInserter(tr("Range Timer"),tr("Range Timer"),"rangetimer");
  10851. NodeInserter*multirangeTimerInserter= new NodeInserter(tr("Multi-Range Timer"),tr("Multi-Range Timer"),"multirangetimer");
  10852. timersMenu->addAction(coolingTimerInserter);
  10853. timersMenu->addAction(rangeTimerInserter);
  10854. timersMenu->addAction(multirangeTimerInserter);
  10855. connect(coolingTimerInserter,SIGNAL(triggered(QString,QString)),
  10856. this,SLOT(insertChildNode(QString,QString)));
  10857. connect(rangeTimerInserter,SIGNAL(triggered(QString,QString)),
  10858. this,SLOT(insertChildNode(QString,QString)));
  10859. connect(multirangeTimerInserter,SIGNAL(triggered(QString,QString)),
  10860. this,SLOT(insertChildNode(QString,QString)));
  10861. timersButton->setMenu(timersMenu);
  10862. layout->addWidget(timersButton);
  10863. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  10864. QMenu*advancedMenu= new QMenu;
  10865. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  10866. advancedMenu->addAction(linearsplineinserter);
  10867. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  10868. advancedMenu->addAction(translationinserter);
  10869. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10870. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10871. /*996:*/
  10872. #line 258 "./rate.w"
  10873. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  10874. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10875. advancedMenu->addAction(rateOfChangeInserter);
  10876. /*:996*//*1010:*/
  10877. #line 272 "./mergeseries.w"
  10878. NodeInserter*mergeSeriesInserter= new NodeInserter(tr("Merge Series"),
  10879. tr("Merge"),
  10880. "mergeseries");
  10881. connect(mergeSeriesInserter,SIGNAL(triggered(QString,QString)),
  10882. this,SLOT(insertChildNode(QString,QString)));
  10883. advancedMenu->addAction(mergeSeriesInserter);
  10884. /*:1010*/
  10885. #line 16509 "./typica.w"
  10886. advancedButton->setMenu(advancedMenu);
  10887. layout->addWidget(advancedButton);
  10888. QHBoxLayout*idLayout= new QHBoxLayout;
  10889. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  10890. idLayout->addWidget(idLabel);
  10891. QSpinBox*id= new QSpinBox;
  10892. idLayout->addWidget(id);
  10893. idLayout->addStretch();
  10894. layout->addLayout(idLayout);
  10895. QHBoxLayout*capacityLayout= new QHBoxLayout;
  10896. QCheckBox*capacityCheckEnabled= new QCheckBox(tr("Maximum batch size:"));
  10897. QDoubleSpinBox*capacity= new QDoubleSpinBox;
  10898. capacity->setMinimum(0.0);
  10899. capacity->setDecimals(3);
  10900. capacity->setMaximum(999999.999);
  10901. QComboBox*capacityUnit= new QComboBox;
  10902. capacityUnit->addItem("g");
  10903. capacityUnit->addItem("Kg");
  10904. capacityUnit->addItem("oz");
  10905. capacityUnit->addItem("Lb");
  10906. capacityUnit->setCurrentIndex(3);
  10907. capacityLayout->addWidget(capacityCheckEnabled);
  10908. capacityLayout->addWidget(capacity);
  10909. capacityLayout->addWidget(capacityUnit);
  10910. capacityLayout->addStretch();
  10911. layout->addLayout(capacityLayout);
  10912. layout->addStretch();
  10913. /*799:*/
  10914. #line 16574 "./typica.w"
  10915. QDomElement referenceElement=
  10916. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10917. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10918. QDomElement node;
  10919. /*:799*/
  10920. #line 16538 "./typica.w"
  10921. for(int i= 0;i<configData.size();i++)
  10922. {
  10923. node= configData.at(i).toElement();
  10924. if(node.attribute("name")=="databaseid")
  10925. {
  10926. id->setValue(node.attribute("value").toInt());
  10927. }
  10928. else if(node.attribute("name")=="checkcapacity")
  10929. {
  10930. capacityCheckEnabled->setChecked(node.attribute("value")=="true");
  10931. }
  10932. else if(node.attribute("name")=="capacity")
  10933. {
  10934. capacity->setValue(node.attribute("value").toDouble());
  10935. }
  10936. else if(node.attribute("name")=="capacityunit")
  10937. {
  10938. capacityUnit->setCurrentIndex(capacityUnit->findText(node.attribute("value")));
  10939. }
  10940. }
  10941. updateRoasterId(id->value());
  10942. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  10943. connect(capacityCheckEnabled,SIGNAL(stateChanged(int)),this,SLOT(updateCapacityCheck(int)));
  10944. connect(capacity,SIGNAL(valueChanged(QString)),this,SLOT(updateCapacity(QString)));
  10945. connect(capacityUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateCapacityUnit(QString)));
  10946. setLayout(layout);
  10947. }
  10948. /*:798*//*800:*/
  10949. #line 16584 "./typica.w"
  10950. void RoasterConfWidget::updateRoasterId(int id)
  10951. {
  10952. updateAttribute("databaseid",QString("%1").arg(id));
  10953. }
  10954. void RoasterConfWidget::updateCapacityCheck(int value)
  10955. {
  10956. updateAttribute("checkcapacity",value==Qt::Checked?"true":"false");
  10957. }
  10958. void RoasterConfWidget::updateCapacity(const QString&value)
  10959. {
  10960. updateAttribute("capacity",value);
  10961. }
  10962. void RoasterConfWidget::updateCapacityUnit(const QString&value)
  10963. {
  10964. updateAttribute("capacityunit",value);
  10965. }
  10966. /*:800*/
  10967. #line 597 "./typica.w"
  10968. /*846:*/
  10969. #line 18091 "./typica.w"
  10970. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10971. :BasicDeviceConfigurationWidget(model,index)
  10972. {
  10973. QFormLayout*layout= new QFormLayout;
  10974. QLineEdit*buttonTextEdit= new QLineEdit;
  10975. QLineEdit*annotationTextEdit= new QLineEdit;
  10976. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10977. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10978. /*799:*/
  10979. #line 16574 "./typica.w"
  10980. QDomElement referenceElement=
  10981. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10982. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10983. QDomElement node;
  10984. /*:799*/
  10985. #line 18100 "./typica.w"
  10986. for(int i= 0;i<configData.size();i++)
  10987. {
  10988. node= configData.at(i).toElement();
  10989. if(node.attribute("name")=="buttontext")
  10990. {
  10991. buttonTextEdit->setText(node.attribute("value"));
  10992. }
  10993. else if(node.attribute("name")=="annotationtext")
  10994. {
  10995. annotationTextEdit->setText(node.attribute("value"));
  10996. }
  10997. }
  10998. updateButtonText(buttonTextEdit->text());
  10999. updateAnnotationText(annotationTextEdit->text());
  11000. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  11001. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  11002. setLayout(layout);
  11003. }
  11004. /*:846*//*847:*/
  11005. #line 18122 "./typica.w"
  11006. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  11007. {
  11008. updateAttribute("buttontext",text);
  11009. }
  11010. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  11011. {
  11012. updateAttribute("annotationtext",text);
  11013. }
  11014. /*:847*//*850:*/
  11015. #line 18160 "./typica.w"
  11016. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11017. :BasicDeviceConfigurationWidget(model,index)
  11018. {
  11019. QFormLayout*layout= new QFormLayout;
  11020. QLineEdit*buttonTextEdit= new QLineEdit;
  11021. QLineEdit*annotationTextEdit= new QLineEdit;
  11022. layout->addRow(tr("Button Text:"),buttonTextEdit);
  11023. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  11024. /*799:*/
  11025. #line 16574 "./typica.w"
  11026. QDomElement referenceElement=
  11027. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11028. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11029. QDomElement node;
  11030. /*:799*/
  11031. #line 18169 "./typica.w"
  11032. for(int i= 0;i<configData.size();i++)
  11033. {
  11034. node= configData.at(i).toElement();
  11035. if(node.attribute("name")=="buttontext")
  11036. {
  11037. buttonTextEdit->setText(node.attribute("value"));
  11038. }
  11039. else if(node.attribute("name")=="annotationtext")
  11040. {
  11041. annotationTextEdit->setText(node.attribute("value"));
  11042. }
  11043. }
  11044. updateButtonText(buttonTextEdit->text());
  11045. updateAnnotationText(annotationTextEdit->text());
  11046. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  11047. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  11048. QTextEdit*documentation= new QTextEdit;
  11049. 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."));
  11050. documentation->setReadOnly(true);
  11051. layout->addRow("",documentation);
  11052. setLayout(layout);
  11053. }
  11054. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  11055. {
  11056. updateAttribute("buttontext",text);
  11057. }
  11058. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  11059. {
  11060. updateAttribute("annotationtext",text);
  11061. }
  11062. /*:850*/
  11063. #line 598 "./typica.w"
  11064. /*853:*/
  11065. #line 18237 "./typica.w"
  11066. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11067. :BasicDeviceConfigurationWidget(model,index)
  11068. {
  11069. QFormLayout*layout= new QFormLayout;
  11070. QLineEdit*labelEdit= new QLineEdit;
  11071. layout->addRow(tr("Control Label: "),labelEdit);
  11072. QLineEdit*minimumEdit= new QLineEdit;
  11073. layout->addRow(tr("Minimum Value: "),minimumEdit);
  11074. QLineEdit*maximumEdit= new QLineEdit;
  11075. layout->addRow(tr("Maximum Value: "),maximumEdit);
  11076. QSpinBox*precisionEdit= new QSpinBox;
  11077. precisionEdit->setMinimum(0);
  11078. precisionEdit->setMaximum(9);
  11079. layout->addRow(tr("Precision"),precisionEdit);
  11080. QLineEdit*pretext= new QLineEdit;
  11081. layout->addRow(tr("Prefix text"),pretext);
  11082. QLineEdit*posttext= new QLineEdit;
  11083. layout->addRow(tr("Suffix text"),posttext);
  11084. /*799:*/
  11085. #line 16574 "./typica.w"
  11086. QDomElement referenceElement=
  11087. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11088. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11089. QDomElement node;
  11090. /*:799*/
  11091. #line 18256 "./typica.w"
  11092. for(int i= 0;i<configData.size();i++)
  11093. {
  11094. node= configData.at(i).toElement();
  11095. if(node.attribute("name")=="label")
  11096. {
  11097. labelEdit->setText(node.attribute("value"));
  11098. }
  11099. else if(node.attribute("name")=="minimum")
  11100. {
  11101. minimumEdit->setText(node.attribute("value"));
  11102. }
  11103. else if(node.attribute("name")=="maximum")
  11104. {
  11105. maximumEdit->setText(node.attribute("value"));
  11106. }
  11107. else if(node.attribute("name")=="precision")
  11108. {
  11109. precisionEdit->setValue(node.attribute("value").toInt());
  11110. }
  11111. else if(node.attribute("name")=="pretext")
  11112. {
  11113. pretext->setText(node.attribute("value"));
  11114. }
  11115. else if(node.attribute("name")=="posttext")
  11116. {
  11117. posttext->setText(node.attribute("value"));
  11118. }
  11119. }
  11120. updateLabel(labelEdit->text());
  11121. updateMinimum(minimumEdit->text());
  11122. updateMaximum(maximumEdit->text());
  11123. updatePrecision(precisionEdit->value());
  11124. updatePretext(pretext->text());
  11125. updatePosttext(posttext->text());
  11126. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  11127. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  11128. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  11129. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  11130. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  11131. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  11132. setLayout(layout);
  11133. }
  11134. void NoteSpinConfWidget::updateLabel(const QString&text)
  11135. {
  11136. updateAttribute("label",text);
  11137. }
  11138. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  11139. {
  11140. updateAttribute("minimum",minimum);
  11141. }
  11142. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  11143. {
  11144. updateAttribute("maximum",maximum);
  11145. }
  11146. void NoteSpinConfWidget::updatePrecision(int precision)
  11147. {
  11148. updateAttribute("precision",QString("%1").arg(precision));
  11149. }
  11150. void NoteSpinConfWidget::updatePretext(const QString&text)
  11151. {
  11152. updateAttribute("pretext",text);
  11153. }
  11154. void NoteSpinConfWidget::updatePosttext(const QString&text)
  11155. {
  11156. updateAttribute("posttext",text);
  11157. }
  11158. /*:853*/
  11159. #line 599 "./typica.w"
  11160. /*346:*/
  11161. #line 7755 "./typica.w"
  11162. LinearCalibrator::LinearCalibrator(QObject*parent):
  11163. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  11164. {
  11165. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  11166. }
  11167. /*:346*//*347:*/
  11168. #line 7769 "./typica.w"
  11169. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  11170. {
  11171. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  11172. if(clamp)
  11173. {
  11174. if(outval<Lo1)
  11175. {
  11176. outval= Lo1;
  11177. }
  11178. else if(outval> Up1)
  11179. {
  11180. outval= Up1;
  11181. }
  11182. }
  11183. if(sensitivitySetting>=0.05)
  11184. {
  11185. int temp= qRound(outval/sensitivitySetting);
  11186. outval= temp*sensitivitySetting;
  11187. }
  11188. Measurement adjusted(outval,measure.time(),measure.scale());
  11189. emit measurement(adjusted);
  11190. return adjusted;
  11191. }
  11192. /*:347*//*348:*/
  11193. #line 7796 "./typica.w"
  11194. double LinearCalibrator::measuredLower()
  11195. {
  11196. return Lo2;
  11197. }
  11198. double LinearCalibrator::measuredUpper()
  11199. {
  11200. return Up2;
  11201. }
  11202. double LinearCalibrator::mappedLower()
  11203. {
  11204. return Lo1;
  11205. }
  11206. double LinearCalibrator::mappedUpper()
  11207. {
  11208. return Up1;
  11209. }
  11210. bool LinearCalibrator::isClosedRange()
  11211. {
  11212. return clamp;
  11213. }
  11214. void LinearCalibrator::setMeasuredLower(double lower)
  11215. {
  11216. Lo2= lower;
  11217. }
  11218. void LinearCalibrator::setMeasuredUpper(double upper)
  11219. {
  11220. Up2= upper;
  11221. }
  11222. void LinearCalibrator::setMappedLower(double lower)
  11223. {
  11224. Lo1= lower;
  11225. }
  11226. void LinearCalibrator::setMappedUpper(double upper)
  11227. {
  11228. Up1= upper;
  11229. }
  11230. void LinearCalibrator::setClosedRange(bool closed)
  11231. {
  11232. clamp= closed;
  11233. }
  11234. void LinearCalibrator::setSensitivity(double sensitivity)
  11235. {
  11236. sensitivitySetting= sensitivity;
  11237. }
  11238. double LinearCalibrator::sensitivity()
  11239. {
  11240. return sensitivitySetting;
  11241. }
  11242. /*:348*/
  11243. #line 600 "./typica.w"
  11244. /*353:*/
  11245. #line 7929 "./typica.w"
  11246. void LinearSplineInterpolator::add_pair(double source,double destination)
  11247. {
  11248. pairs->insert(source,destination);
  11249. make_interpolators();
  11250. }
  11251. void LinearSplineInterpolator::make_interpolators()
  11252. {
  11253. if(pairs->size()> 1)
  11254. {
  11255. while(interpolators->size()> 0)
  11256. {
  11257. LinearCalibrator*removed= interpolators->takeFirst();
  11258. removed->deleteLater();
  11259. }
  11260. QMap<double,double> ::const_iterator i= pairs->constBegin();
  11261. QMap<double,double> ::const_iterator j= i+1;
  11262. while(j!=pairs->constEnd())
  11263. {
  11264. LinearCalibrator*segment= new LinearCalibrator();
  11265. segment->setMeasuredLower(i.key());
  11266. segment->setMappedLower(i.value());
  11267. segment->setMeasuredUpper(j.key());
  11268. segment->setMappedUpper(j.value());
  11269. segment->setClosedRange(false);
  11270. interpolators->append(segment);
  11271. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  11272. i++;
  11273. j++;
  11274. }
  11275. }
  11276. }
  11277. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  11278. QObject(parent),pairs(new QMap<double,double> ),
  11279. interpolators(new QList<LinearCalibrator*> )
  11280. {
  11281. }
  11282. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  11283. {
  11284. QMap<double,double> ::const_iterator i= pairs->constBegin();
  11285. int index= -1;
  11286. while(i!=pairs->constEnd())
  11287. {
  11288. if(measure.temperature()<=i.key())
  11289. {
  11290. break;
  11291. }
  11292. i++;
  11293. index++;
  11294. }
  11295. if(index<0)
  11296. {
  11297. index= 0;
  11298. }
  11299. if(index>=interpolators->size())
  11300. {
  11301. index= interpolators->size()-1;
  11302. }
  11303. if(interpolators->at(index)!=NULL)
  11304. {
  11305. return interpolators->at(index)->newMeasurement(measure);
  11306. }
  11307. return Measurement();
  11308. }
  11309. /*:353*/
  11310. #line 601 "./typica.w"
  11311. /*961:*/
  11312. #line 19607 "./typica.w"
  11313. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11314. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  11315. {
  11316. QFormLayout*layout= new QFormLayout;
  11317. QLineEdit*source= new QLineEdit;
  11318. layout->addRow(tr("Source column name:"),source);
  11319. QLineEdit*destination= new QLineEdit;
  11320. layout->addRow(tr("Destination column name:"),destination);
  11321. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  11322. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  11323. QTableView*mappingTable= new QTableView;
  11324. mappingTable->setModel(tablemodel);
  11325. NumericDelegate*delegate= new NumericDelegate;
  11326. mappingTable->setItemDelegate(delegate);
  11327. layout->addRow(tr("Mapping data:"),mappingTable);
  11328. /*799:*/
  11329. #line 16574 "./typica.w"
  11330. QDomElement referenceElement=
  11331. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11332. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11333. QDomElement node;
  11334. /*:799*/
  11335. #line 19623 "./typica.w"
  11336. for(int i= 0;i<configData.size();i++)
  11337. {
  11338. node= configData.at(i).toElement();
  11339. if(node.attribute("name")=="source")
  11340. {
  11341. source->setText(node.attribute("value"));
  11342. }
  11343. else if(node.attribute("name")=="destination")
  11344. {
  11345. destination->setText(node.attribute("value"));
  11346. }
  11347. else if(node.attribute("name")=="sourcevalues")
  11348. {
  11349. /*962:*/
  11350. #line 19662 "./typica.w"
  11351. QString data= node.attribute("value");
  11352. if(data.length()> 3)
  11353. {
  11354. data.chop(2);
  11355. data= data.remove(0,2);
  11356. }
  11357. QStringList itemList= data.split(",");
  11358. /*:962*/
  11359. #line 19637 "./typica.w"
  11360. int column= 0;
  11361. /*963:*/
  11362. #line 19674 "./typica.w"
  11363. for(int j= 0;j<itemList.size();j++)
  11364. {
  11365. tablemodel->setData(tablemodel->index(j,column),
  11366. QVariant(itemList.at(j).toDouble()),
  11367. Qt::DisplayRole);
  11368. }
  11369. /*:963*/
  11370. #line 19639 "./typica.w"
  11371. }
  11372. else if(node.attribute("name")=="destinationvalues")
  11373. {
  11374. /*962:*/
  11375. #line 19662 "./typica.w"
  11376. QString data= node.attribute("value");
  11377. if(data.length()> 3)
  11378. {
  11379. data.chop(2);
  11380. data= data.remove(0,2);
  11381. }
  11382. QStringList itemList= data.split(",");
  11383. /*:962*/
  11384. #line 19644 "./typica.w"
  11385. int column= 1;
  11386. /*963:*/
  11387. #line 19674 "./typica.w"
  11388. for(int j= 0;j<itemList.size();j++)
  11389. {
  11390. tablemodel->setData(tablemodel->index(j,column),
  11391. QVariant(itemList.at(j).toDouble()),
  11392. Qt::DisplayRole);
  11393. }
  11394. /*:963*/
  11395. #line 19646 "./typica.w"
  11396. }
  11397. }
  11398. updateSourceColumn(source->text());
  11399. updateDestinationColumn(destination->text());
  11400. updateKnots();
  11401. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11402. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  11403. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  11404. setLayout(layout);
  11405. }
  11406. /*:961*//*964:*/
  11407. #line 19685 "./typica.w"
  11408. void LinearSplineInterpolationConfWidget::updateKnots()
  11409. {
  11410. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11411. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11412. }
  11413. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  11414. {
  11415. updateAttribute("source",source);
  11416. }
  11417. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  11418. {
  11419. updateAttribute("destination",dest);
  11420. }
  11421. /*:964*/
  11422. #line 602 "./typica.w"
  11423. /*981:*/
  11424. #line 20156 "./typica.w"
  11425. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11426. :BasicDeviceConfigurationWidget(model,index),
  11427. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox),
  11428. delaySelector(new QSpinBox)
  11429. {
  11430. unitSelector->addItem("Fahrenheit");
  11431. unitSelector->addItem("Celsius");
  11432. temperatureValue->setMinimum(0);
  11433. temperatureValue->setMaximum(1000);
  11434. QFormLayout*layout= new QFormLayout;
  11435. QLineEdit*column= new QLineEdit;
  11436. layout->addRow(tr("Column to match:"),column);
  11437. layout->addRow(tr("Unit:"),unitSelector);
  11438. layout->addRow(tr("Value:"),temperatureValue);
  11439. layout->addRow(tr("Start of batch safety delay:"),delaySelector);
  11440. /*799:*/
  11441. #line 16574 "./typica.w"
  11442. QDomElement referenceElement=
  11443. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11444. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11445. QDomElement node;
  11446. /*:799*/
  11447. #line 20172 "./typica.w"
  11448. for(int i= 0;i<configData.size();i++)
  11449. {
  11450. node= configData.at(i).toElement();
  11451. if(node.attribute("name")=="column")
  11452. {
  11453. column->setText(node.attribute("value"));
  11454. }
  11455. else if(node.attribute("name")=="unit")
  11456. {
  11457. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11458. }
  11459. else if(node.attribute("name")=="value")
  11460. {
  11461. temperatureValue->setValue(node.attribute("value").toDouble());
  11462. }
  11463. else if(node.attribute("name")=="delay")
  11464. {
  11465. delaySelector->setValue(node.attribute("value").toInt());
  11466. }
  11467. }
  11468. updateMatchingColumn(column->text());
  11469. updateTemperature();
  11470. updateDelay();
  11471. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  11472. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  11473. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  11474. connect(delaySelector,SIGNAL(valueChanged(int)),this,SLOT(updateDelay()));
  11475. setLayout(layout);
  11476. }
  11477. /*:981*//*982:*/
  11478. #line 20207 "./typica.w"
  11479. void TranslationConfWidget::updateTemperature()
  11480. {
  11481. updateAttribute("unit",unitSelector->currentText());
  11482. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  11483. if(unitSelector->currentText()=="Fahrenheit")
  11484. {
  11485. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  11486. }
  11487. else
  11488. {
  11489. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  11490. }
  11491. }
  11492. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  11493. {
  11494. updateAttribute("column",column);
  11495. }
  11496. void TranslationConfWidget::updateDelay()
  11497. {
  11498. updateAttribute("delay",QString("%1").arg(delaySelector->value()));
  11499. }
  11500. /*:982*/
  11501. #line 603 "./typica.w"
  11502. /*856:*/
  11503. #line 24 "./freeannotation.w"
  11504. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  11505. const QModelIndex&index)
  11506. :BasicDeviceConfigurationWidget(model,index)
  11507. {
  11508. QFormLayout*layout= new QFormLayout;
  11509. QLineEdit*labelEdit= new QLineEdit;
  11510. layout->addRow(tr("Label Text:"),labelEdit);
  11511. /*799:*/
  11512. #line 16574 "./typica.w"
  11513. QDomElement referenceElement=
  11514. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11515. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11516. QDomElement node;
  11517. /*:799*/
  11518. #line 32 "./freeannotation.w"
  11519. for(int i= 0;i<configData.size();i++)
  11520. {
  11521. node= configData.at(i).toElement();
  11522. if(node.attribute("name")=="labeltext")
  11523. {
  11524. labelEdit->setText(node.attribute("value"));
  11525. }
  11526. }
  11527. updateLabel(labelEdit->text());
  11528. connect(labelEdit,SIGNAL(textEdited(QString)),
  11529. this,SLOT(updateLabel(QString)));
  11530. setLayout(layout);
  11531. }
  11532. /*:856*//*857:*/
  11533. #line 49 "./freeannotation.w"
  11534. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  11535. {
  11536. updateAttribute("labeltext",text);
  11537. }
  11538. /*:857*/
  11539. #line 604 "./typica.w"
  11540. /*985:*/
  11541. #line 39 "./rate.w"
  11542. void RateOfChange::newMeasurement(Measurement measure)
  11543. {
  11544. cache.append(measure);
  11545. /*986:*/
  11546. #line 64 "./rate.w"
  11547. if(cache.size()> 2)
  11548. {
  11549. bool done= false;
  11550. while(!done)
  11551. {
  11552. if(cache.front().time().secsTo(cache.back().time())> ct)
  11553. {
  11554. cache.removeFirst();
  11555. }
  11556. else if(cache.back().time()<cache.front().time())
  11557. {
  11558. cache.removeFirst();
  11559. done= true;
  11560. }
  11561. else
  11562. {
  11563. done= true;
  11564. }
  11565. if(cache.size()<3)
  11566. {
  11567. done= true;
  11568. }
  11569. }
  11570. }
  11571. /*:986*/
  11572. #line 43 "./rate.w"
  11573. if(cache.size()>=2)
  11574. {
  11575. /*987:*/
  11576. #line 96 "./rate.w"
  11577. int N= cache.size();
  11578. double SXY= 0;
  11579. double SX= 0;
  11580. double SXX= 0;
  11581. double SY= 0;
  11582. double y;
  11583. double x;
  11584. for(int i= 0;i<N;i++)
  11585. {
  11586. y= cache.at(i).temperature();
  11587. SY+= y;
  11588. x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
  11589. SX+= x;
  11590. SXX+= (x*x);
  11591. SXY+= (x*y);
  11592. }
  11593. double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
  11594. Measurement value(M*st,cache.back().time(),cache.back().scale());
  11595. value.insert("relative",true);
  11596. emit newData(value);
  11597. /*:987*/
  11598. #line 46 "./rate.w"
  11599. }
  11600. }
  11601. /*:985*//*988:*/
  11602. #line 120 "./rate.w"
  11603. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  11604. {
  11605. setScaleTime(scaletime);
  11606. }
  11607. void RateOfChange::setCacheTime(int seconds)
  11608. {
  11609. ct= seconds;
  11610. }
  11611. void RateOfChange::setScaleTime(int seconds)
  11612. {
  11613. st= (seconds> 0?seconds:1);
  11614. }
  11615. /*:988*/
  11616. #line 605 "./typica.w"
  11617. /*860:*/
  11618. #line 26 "./settings.w"
  11619. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  11620. {
  11621. QTabWidget*settingsTab= new QTabWidget;
  11622. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  11623. settingsTab->addTab(deviceSettings,tr("Roasters"));
  11624. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  11625. settingsTab->addTab(graphSettings,tr("Graph"));
  11626. AdvancedSettingsWidget*advancedSettings= new AdvancedSettingsWidget;
  11627. settingsTab->addTab(advancedSettings,tr("Advanced"));
  11628. setCentralWidget(settingsTab);
  11629. }
  11630. /*:860*/
  11631. #line 606 "./typica.w"
  11632. /*865:*/
  11633. #line 27 "./graphsettings.w"
  11634. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  11635. {
  11636. QTabWidget*graphCategories= new QTabWidget;
  11637. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  11638. graphCategories->addTab(relative,tr("Relative Temperatures"));
  11639. QVBoxLayout*layout= new QVBoxLayout;
  11640. layout->addWidget(graphCategories);
  11641. setLayout(layout);
  11642. }
  11643. /*:865*//*867:*/
  11644. #line 69 "./graphsettings.w"
  11645. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  11646. colorEdit(new QLineEdit)
  11647. {
  11648. QSettings settings;
  11649. QVBoxLayout*layout= new QVBoxLayout;
  11650. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  11651. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  11652. updateEnableSetting(enable->isChecked());
  11653. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  11654. layout->addWidget(enable);
  11655. QHBoxLayout*colorLayout= new QHBoxLayout;
  11656. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  11657. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  11658. updateColorSetting(colorEdit->text());
  11659. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  11660. QToolButton*colorPickerButton= new QToolButton();
  11661. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  11662. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  11663. colorLayout->addWidget(colorLabel);
  11664. colorLayout->addWidget(colorEdit);
  11665. colorLayout->addWidget(colorPickerButton);
  11666. colorLayout->addStretch();
  11667. layout->addLayout(colorLayout);
  11668. QHBoxLayout*unitLayout= new QHBoxLayout;
  11669. QLabel*unitLabel= new QLabel(tr("Unit"));
  11670. QComboBox*unitSelector= new QComboBox;
  11671. unitSelector->addItem(tr("Fahrenheit"));
  11672. unitSelector->addItem(tr("Celsius"));
  11673. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  11674. updateUnit(unitSelector->currentIndex());
  11675. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  11676. unitLayout->addWidget(unitLabel);
  11677. unitLayout->addWidget(unitSelector);
  11678. unitLayout->addStretch();
  11679. layout->addLayout(unitLayout);
  11680. QHBoxLayout*axisLayout= new QHBoxLayout;
  11681. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  11682. QLineEdit*axisEdit= new QLineEdit;
  11683. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, 0, 30, 65, 100").toString());
  11684. updateAxisSetting(axisEdit->text());
  11685. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  11686. axisLayout->addWidget(axisLabel);
  11687. axisLayout->addWidget(axisEdit);
  11688. layout->addLayout(axisLayout);
  11689. layout->addStretch();
  11690. setLayout(layout);
  11691. }
  11692. /*:867*//*868:*/
  11693. #line 120 "./graphsettings.w"
  11694. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  11695. {
  11696. QSettings settings;
  11697. settings.setValue("settings/graph/relative/enable",enabled);
  11698. }
  11699. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  11700. {
  11701. QSettings settings;
  11702. settings.setValue("settings/graph/relative/color",color);
  11703. }
  11704. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  11705. {
  11706. QSettings settings;
  11707. QString settingValue;
  11708. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  11709. QStringList numbers;
  11710. foreach(QString text,points)
  11711. {
  11712. bool okay= false;
  11713. text.toDouble(&okay);
  11714. if(okay)
  11715. {
  11716. numbers.append(text);
  11717. }
  11718. }
  11719. numbers.removeDuplicates();
  11720. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  11721. }
  11722. void GraphSettingsRelativeTab::updateUnit(int unit)
  11723. {
  11724. QSettings settings;
  11725. settings.setValue("settings/graph/relative/unit",unit);
  11726. }
  11727. /*:868*//*869:*/
  11728. #line 163 "./graphsettings.w"
  11729. void GraphSettingsRelativeTab::showColorPicker()
  11730. {
  11731. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  11732. colorEdit->setText(color.name());
  11733. }
  11734. #line 62 "./settings.w"
  11735. #line 1 "./advancedsettings.w"
  11736. /*:869*/
  11737. #line 607 "./typica.w"
  11738. /*1034:*/
  11739. #line 682 "./dataqsdk.w"
  11740. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  11741. const QModelIndex&index)
  11742. :BasicDeviceConfigurationWidget(model,index),
  11743. deviceIdStack(new QStackedWidget)
  11744. {
  11745. QVBoxLayout*layout= new QVBoxLayout;
  11746. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  11747. layout->addWidget(autoDetect);
  11748. QWidget*autoLayerWidget= new QWidget;
  11749. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  11750. QLabel*autoLabel= new QLabel(tr("Device number"));
  11751. QSpinBox*autoNumber= new QSpinBox;
  11752. autoNumber->setMinimum(1);
  11753. autoNumber->setMaximum(99);
  11754. autoLayerLayout->addWidget(autoLabel);
  11755. autoLayerLayout->addWidget(autoNumber);
  11756. autoLayerWidget->setLayout(autoLayerLayout);
  11757. QWidget*fixedLayerWidget= new QWidget;
  11758. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  11759. QLabel*fixedLabel= new QLabel(tr("Device port"));
  11760. QComboBox*portSelection= new QComboBox;
  11761. portSelection->setEditable(true);
  11762. portSelection->addItems(DataqSdkDevice::detectHardware());
  11763. fixedLayerLayout->addWidget(fixedLabel);
  11764. fixedLayerLayout->addWidget(portSelection);
  11765. fixedLayerWidget->setLayout(fixedLayerLayout);
  11766. deviceIdStack->addWidget(autoLayerWidget);
  11767. deviceIdStack->addWidget(fixedLayerWidget);
  11768. layout->addWidget(deviceIdStack);
  11769. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  11770. layout->addWidget(addChannelButton);
  11771. /*799:*/
  11772. #line 16574 "./typica.w"
  11773. QDomElement referenceElement=
  11774. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11775. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11776. QDomElement node;
  11777. /*:799*/
  11778. #line 714 "./dataqsdk.w"
  11779. for(int i= 0;i<configData.size();i++)
  11780. {
  11781. node= configData.at(i).toElement();
  11782. if(node.attribute("name")=="autoSelect")
  11783. {
  11784. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  11785. }
  11786. else if(node.attribute("name")=="deviceNumber")
  11787. {
  11788. autoNumber->setValue(node.attribute("value").toInt());
  11789. }
  11790. else if(node.attribute("name")=="port")
  11791. {
  11792. int index= portSelection->findText(node.attribute("value"));
  11793. if(index> -1)
  11794. {
  11795. portSelection->setCurrentIndex(index);
  11796. }
  11797. else
  11798. {
  11799. portSelection->setEditText(node.attribute("value"));
  11800. }
  11801. }
  11802. }
  11803. updateAutoSelect(autoDetect->isChecked());
  11804. updateDeviceNumber(autoNumber->value());
  11805. updatePort(portSelection->currentText());
  11806. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  11807. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  11808. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  11809. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11810. setLayout(layout);
  11811. }
  11812. /*:1034*//*1035:*/
  11813. #line 758 "./dataqsdk.w"
  11814. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  11815. {
  11816. if(automatic)
  11817. {
  11818. updateAttribute("autoSelect","true");
  11819. deviceIdStack->setCurrentIndex(0);
  11820. }
  11821. else
  11822. {
  11823. updateAttribute("autoSelect","false");
  11824. deviceIdStack->setCurrentIndex(1);
  11825. }
  11826. }
  11827. /*:1035*//*1036:*/
  11828. #line 775 "./dataqsdk.w"
  11829. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  11830. {
  11831. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  11832. }
  11833. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  11834. {
  11835. updateAttribute("port",portId);
  11836. }
  11837. /*:1036*//*1037:*/
  11838. #line 788 "./dataqsdk.w"
  11839. void DataqSdkDeviceConfWidget::addChannel()
  11840. {
  11841. insertChildNode(tr("Channel"),"dataqsdkchannel");
  11842. }
  11843. /*:1037*//*1040:*/
  11844. #line 868 "./dataqsdk.w"
  11845. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  11846. const QModelIndex&index)
  11847. :BasicDeviceConfigurationWidget(model,index),
  11848. startButton(new QPushButton(tr("Start"))),
  11849. resetButton(new QPushButton(tr("Reset"))),
  11850. stopButton(new QPushButton(tr("Stop"))),
  11851. calibrator(new LinearCalibrator),
  11852. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  11853. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  11854. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  11855. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  11856. rmCount(0),cmCount(0),
  11857. rmin(std::numeric_limits<double> ::max()),
  11858. rmax(std::numeric_limits<double> ::min()),rmean(0),
  11859. cmin(std::numeric_limits<double> ::max()),
  11860. cmax(std::numeric_limits<double> ::min()),cmean(0)
  11861. {
  11862. /*1044:*/
  11863. #line 1107 "./dataqsdk.w"
  11864. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  11865. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  11866. QDomElement deviceNode;
  11867. QString configPort;
  11868. QString configAuto;
  11869. for(int i= 0;i<deviceConfigData.size();i++)
  11870. {
  11871. deviceNode= deviceConfigData.at(i).toElement();
  11872. if(deviceNode.attribute("name")=="autoSelect")
  11873. {
  11874. autoSelect= (deviceNode.attribute("value")=="true");
  11875. }
  11876. else if(deviceNode.attribute("name")=="deviceNumber")
  11877. {
  11878. configAuto= deviceNode.attribute("value");
  11879. }
  11880. else if(deviceNode.attribute("name")=="port")
  11881. {
  11882. configPort= deviceNode.attribute("value");
  11883. }
  11884. }
  11885. deviceID= autoSelect?configAuto:configPort;
  11886. channelOfInterest= index.row();
  11887. /*:1044*/
  11888. #line 886 "./dataqsdk.w"
  11889. resetButton->setEnabled(false);
  11890. stopButton->setEnabled(false);
  11891. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  11892. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  11893. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  11894. QVBoxLayout*layout= new QVBoxLayout;
  11895. QFormLayout*topLayout= new QFormLayout;
  11896. QLineEdit*columnEdit= new QLineEdit;
  11897. topLayout->addRow(tr("Column name"),columnEdit);
  11898. QComboBox*unitSelector= new QComboBox;
  11899. unitSelector->addItem(tr("Temperature"));
  11900. unitSelector->addItem(tr("Control"));
  11901. topLayout->addRow(tr("Measurement type"),unitSelector);
  11902. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  11903. topLayout->addRow(smoothingBox);
  11904. layout->addLayout(topLayout);
  11905. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  11906. topLayout->addRow(hideSeries);
  11907. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  11908. layout->addWidget(calibrationLabel);
  11909. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  11910. QFormLayout*calibrationControlsLayout= new QFormLayout;
  11911. QLineEdit*measuredLowerEdit= new QLineEdit;
  11912. measuredLowerEdit->setText("0");
  11913. QLineEdit*measuredUpperEdit= new QLineEdit;
  11914. measuredUpperEdit->setText("10");
  11915. QLineEdit*mappedLowerEdit= new QLineEdit;
  11916. mappedLowerEdit->setText("0");
  11917. QLineEdit*mappedUpperEdit= new QLineEdit;
  11918. mappedUpperEdit->setText("10");
  11919. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  11920. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  11921. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  11922. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  11923. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  11924. calibrationControlsLayout->addRow(closedBox);
  11925. QLineEdit*sensitivityEdit= new QLineEdit;
  11926. sensitivityEdit->setText("0");
  11927. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  11928. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  11929. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  11930. deviceControlLayout->addWidget(startButton);
  11931. deviceControlLayout->addWidget(resetButton);
  11932. deviceControlLayout->addWidget(stopButton);
  11933. QFormLayout*indicatorLayout= new QFormLayout;
  11934. currentMeasurement->setReadOnly(true);
  11935. minimumMeasurement->setReadOnly(true);
  11936. maximumMeasurement->setReadOnly(true);
  11937. averageMeasurement->setReadOnly(true);
  11938. currentMapped->setReadOnly(true);
  11939. minimumMapped->setReadOnly(true);
  11940. maximumMapped->setReadOnly(true);
  11941. averageMapped->setReadOnly(true);
  11942. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  11943. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  11944. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  11945. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  11946. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  11947. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  11948. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  11949. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  11950. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  11951. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  11952. calibrationTestLayout->addLayout(deviceControlLayout);
  11953. calibrationTestLayout->addLayout(indicatorLayout);
  11954. calibrationLayout->addLayout(calibrationControlsLayout);
  11955. calibrationLayout->addLayout(calibrationTestLayout);
  11956. layout->addLayout(calibrationLayout);
  11957. /*799:*/
  11958. #line 16574 "./typica.w"
  11959. QDomElement referenceElement=
  11960. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11961. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11962. QDomElement node;
  11963. /*:799*/
  11964. #line 955 "./dataqsdk.w"
  11965. for(int i= 0;i<configData.size();i++)
  11966. {
  11967. node= configData.at(i).toElement();
  11968. if(node.attribute("name")=="column")
  11969. {
  11970. columnEdit->setText(node.attribute("value"));
  11971. }
  11972. else if(node.attribute("name")=="type")
  11973. {
  11974. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11975. }
  11976. else if(node.attribute("name")=="smoothing")
  11977. {
  11978. smoothingBox->setChecked(node.attribute("value")=="true");
  11979. }
  11980. else if(node.attribute("name")=="calibrationMeasuredLower")
  11981. {
  11982. measuredLowerEdit->setText(node.attribute("value"));
  11983. }
  11984. else if(node.attribute("name")=="calibrationMeasuredUpper")
  11985. {
  11986. measuredUpperEdit->setText(node.attribute("value"));
  11987. }
  11988. else if(node.attribute("name")=="calibrationMappedLower")
  11989. {
  11990. mappedLowerEdit->setText(node.attribute("value"));
  11991. }
  11992. else if(node.attribute("name")=="calibrationMappedUpper")
  11993. {
  11994. mappedUpperEdit->setText(node.attribute("value"));
  11995. }
  11996. else if(node.attribute("name")=="calibrationClosedInterval")
  11997. {
  11998. closedBox->setChecked(node.attribute("value")=="true");
  11999. }
  12000. else if(node.attribute("name")=="calibrationSensitivity")
  12001. {
  12002. sensitivityEdit->setText(node.attribute("value"));
  12003. }
  12004. else if(node.attribute("name")=="hidden")
  12005. {
  12006. hideSeries->setChecked(node.attribute("value")=="true");
  12007. }
  12008. }
  12009. updateColumnName(columnEdit->text());
  12010. updateUnits(unitSelector->currentText());
  12011. updateSmoothingEnabled(smoothingBox->isChecked());
  12012. updateMeasuredLower(measuredLowerEdit->text());
  12013. updateMeasuredUpper(measuredUpperEdit->text());
  12014. updateMappedLower(mappedLowerEdit->text());
  12015. updateMappedUpper(mappedUpperEdit->text());
  12016. updateClosedInterval(closedBox->isChecked());
  12017. updateSensitivity(sensitivityEdit->text());
  12018. updateHidden(hideSeries->isChecked());
  12019. connect(columnEdit,SIGNAL(textChanged(QString)),
  12020. this,SLOT(updateColumnName(QString)));
  12021. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  12022. this,SLOT(updateUnits(QString)));
  12023. connect(smoothingBox,SIGNAL(toggled(bool)),
  12024. this,SLOT(updateSmoothingEnabled(bool)));
  12025. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  12026. this,SLOT(updateMeasuredLower(QString)));
  12027. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  12028. this,SLOT(updateMappedLower(QString)));
  12029. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  12030. this,SLOT(updateMeasuredUpper(QString)));
  12031. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  12032. this,SLOT(updateMappedUpper(QString)));
  12033. connect(closedBox,SIGNAL(toggled(bool)),
  12034. this,SLOT(updateClosedInterval(bool)));
  12035. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  12036. this,SLOT(updateSensitivity(QString)));
  12037. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12038. setLayout(layout);
  12039. }
  12040. /*:1040*//*1041:*/
  12041. #line 1038 "./dataqsdk.w"
  12042. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  12043. {
  12044. updateAttribute("type",unit);
  12045. }
  12046. /*:1041*//*1042:*/
  12047. #line 1047 "./dataqsdk.w"
  12048. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  12049. {
  12050. updateAttribute("calibrationMeasuredLower",value);
  12051. calibrator->setMeasuredLower(value.toDouble());
  12052. }
  12053. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  12054. {
  12055. updateAttribute("calibrationMeasuredUpper",value);
  12056. calibrator->setMeasuredUpper(value.toDouble());
  12057. }
  12058. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  12059. {
  12060. updateAttribute("calibrationMappedLower",value);
  12061. calibrator->setMappedLower(value.toDouble());
  12062. }
  12063. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  12064. {
  12065. updateAttribute("calibrationMappedUpper",value);
  12066. calibrator->setMappedUpper(value.toDouble());
  12067. }
  12068. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  12069. {
  12070. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  12071. calibrator->setClosedRange(closed);
  12072. }
  12073. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  12074. {
  12075. updateAttribute("smoothing",enabled?"true":"false");
  12076. }
  12077. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  12078. {
  12079. updateAttribute("calibrationSensitivity",value);
  12080. calibrator->setSensitivity(value.toDouble());
  12081. }
  12082. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  12083. {
  12084. updateAttribute("hidden",hidden?"true":"false");
  12085. }
  12086. /*:1042*//*1045:*/
  12087. #line 1136 "./dataqsdk.w"
  12088. void DataqSdkChannelConfWidget::startCalibration()
  12089. {
  12090. startButton->setEnabled(false);
  12091. stopButton->setEnabled(true);
  12092. resetButton->setEnabled(true);
  12093. calibrationDevice= new DataqSdkDevice(deviceID);
  12094. Channel*channel;
  12095. for(unsigned int i= 0;i<=channelOfInterest;i++)
  12096. {
  12097. channel= calibrationDevice->newChannel(Units::Unitless);
  12098. }
  12099. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  12100. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  12101. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  12102. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  12103. calibrationDevice->start();
  12104. }
  12105. void DataqSdkChannelConfWidget::stopCalibration()
  12106. {
  12107. startButton->setEnabled(true);
  12108. stopButton->setEnabled(false);
  12109. resetButton->setEnabled(false);
  12110. calibrationDevice->deleteLater();
  12111. /*1047:*/
  12112. #line 1181 "./dataqsdk.w"
  12113. rmCount= 0;
  12114. cmCount= 0;
  12115. rmin= std::numeric_limits<double> ::max();
  12116. rmax= std::numeric_limits<double> ::min();
  12117. rmean= 0;
  12118. cmin= std::numeric_limits<double> ::max();
  12119. cmax= std::numeric_limits<double> ::min();
  12120. cmean= 0;
  12121. /*:1047*/
  12122. #line 1161 "./dataqsdk.w"
  12123. }
  12124. /*:1045*//*1046:*/
  12125. #line 1172 "./dataqsdk.w"
  12126. void DataqSdkChannelConfWidget::resetCalibration()
  12127. {
  12128. /*1047:*/
  12129. #line 1181 "./dataqsdk.w"
  12130. rmCount= 0;
  12131. cmCount= 0;
  12132. rmin= std::numeric_limits<double> ::max();
  12133. rmax= std::numeric_limits<double> ::min();
  12134. rmean= 0;
  12135. cmin= std::numeric_limits<double> ::max();
  12136. cmax= std::numeric_limits<double> ::min();
  12137. cmean= 0;
  12138. /*:1047*/
  12139. #line 1175 "./dataqsdk.w"
  12140. }
  12141. /*:1046*//*1048:*/
  12142. #line 1195 "./dataqsdk.w"
  12143. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  12144. {
  12145. double nv= measure.temperature();
  12146. currentMeasurement->setText(QString("%1").arg(nv));
  12147. rmin= qMin(nv,rmin);
  12148. minimumMeasurement->setText(QString("%1").arg(rmin));
  12149. rmax= qMax(nv,rmax);
  12150. maximumMeasurement->setText(QString("%1").arg(rmax));
  12151. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  12152. rmCount++;
  12153. averageMeasurement->setText(QString("%1").arg(rmean));
  12154. }
  12155. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  12156. {
  12157. double nv= measure.temperature();
  12158. currentMapped->setText(QString("%1").arg(nv));
  12159. cmin= qMin(nv,cmin);
  12160. minimumMapped->setText(QString("%1").arg(cmin));
  12161. cmax= qMax(nv,cmax);
  12162. maximumMapped->setText(QString("%1").arg(cmax));
  12163. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  12164. cmCount++;
  12165. averageMapped->setText(QString("%1").arg(cmean));
  12166. }
  12167. /*:1048*//*1049:*/
  12168. #line 1224 "./dataqsdk.w"
  12169. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  12170. {
  12171. updateAttribute("column",value);
  12172. }
  12173. /*:1049*/
  12174. #line 608 "./typica.w"
  12175. /*1073:*/
  12176. #line 423 "./scales.w"
  12177. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  12178. const QModelIndex&index)
  12179. :BasicDeviceConfigurationWidget(model,index),
  12180. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  12181. flow(new FlowSelector),stop(new StopSelector),
  12182. weighcommand(new QLineEdit("!KP")),commandterminator(new QComboBox)
  12183. {
  12184. QFormLayout*layout= new QFormLayout;
  12185. layout->addRow(tr("Port:"),port);
  12186. connect(port,SIGNAL(currentIndexChanged(QString)),
  12187. this,SLOT(updatePort(QString)));
  12188. connect(port,SIGNAL(editTextChanged(QString)),
  12189. this,SLOT(updatePort(QString)));
  12190. layout->addRow(tr("Baud:"),baud);
  12191. connect(baud,SIGNAL(currentIndexChanged(QString)),
  12192. this,SLOT(updateBaudRate(QString)));
  12193. layout->addRow(tr("Parity:"),parity);
  12194. connect(parity,SIGNAL(currentIndexChanged(int)),
  12195. this,SLOT(updateParity(int)));
  12196. layout->addRow(tr("Flow Control:"),flow);
  12197. connect(flow,SIGNAL(currentIndexChanged(int)),
  12198. this,SLOT(updateFlowControl(int)));
  12199. layout->addRow(tr("Stop Bits:"),stop);
  12200. connect(stop,SIGNAL(currentIndexChanged(int)),
  12201. this,SLOT(updateStopBits(int)));
  12202. layout->addRow(tr("Weigh Command:"),weighcommand);
  12203. connect(weighcommand,SIGNAL(textChanged(QString)),
  12204. this,SLOT(updateWeighCommand(QString)));
  12205. commandterminator->addItem("CRLF");
  12206. commandterminator->addItem("CR");
  12207. commandterminator->addItem("LF");
  12208. layout->addRow(tr("Command Terminator:"),commandterminator);
  12209. connect(commandterminator,SIGNAL(currentIndexChanged(QString)),
  12210. this,SLOT(updateCommandTerminator(QString)));
  12211. /*799:*/
  12212. #line 16574 "./typica.w"
  12213. QDomElement referenceElement=
  12214. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12215. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12216. QDomElement node;
  12217. /*:799*/
  12218. #line 459 "./scales.w"
  12219. for(int i= 0;i<configData.size();i++)
  12220. {
  12221. node= configData.at(i).toElement();
  12222. if(node.attribute("name")=="port")
  12223. {
  12224. int j= port->findText(node.attribute("value"));
  12225. if(j>=0)
  12226. {
  12227. port->setCurrentIndex(j);
  12228. }
  12229. else
  12230. {
  12231. port->insertItem(0,node.attribute("value"));
  12232. port->setCurrentIndex(0);
  12233. }
  12234. }
  12235. else if(node.attribute("name")=="baudrate")
  12236. {
  12237. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  12238. }
  12239. else if(node.attribute("name")=="parity")
  12240. {
  12241. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  12242. }
  12243. else if(node.attribute("name")=="flowcontrol")
  12244. {
  12245. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  12246. }
  12247. else if(node.attribute("name")=="stopbits")
  12248. {
  12249. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  12250. }
  12251. else if(node.attribute("name")=="weighcommand")
  12252. {
  12253. weighcommand->setText(node.attribute("value"));
  12254. }
  12255. else if(node.attribute("name")=="commandterminator")
  12256. {
  12257. commandterminator->setCurrentIndex(
  12258. commandterminator->findText(node.attribute("value")));
  12259. }
  12260. }
  12261. updatePort(port->currentText());
  12262. updateBaudRate(baud->currentText());
  12263. updateParity(parity->currentIndex());
  12264. updateFlowControl(flow->currentIndex());
  12265. updateStopBits(stop->currentIndex());
  12266. updateWeighCommand(weighcommand->text());
  12267. updateCommandTerminator(commandterminator->currentText());
  12268. setLayout(layout);
  12269. }
  12270. /*:1073*//*1074:*/
  12271. #line 514 "./scales.w"
  12272. void SerialScaleConfWidget::updatePort(const QString&newPort)
  12273. {
  12274. updateAttribute("port",newPort);
  12275. }
  12276. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  12277. {
  12278. updateAttribute("baudrate",rate);
  12279. }
  12280. void SerialScaleConfWidget::updateParity(int index)
  12281. {
  12282. updateAttribute("parity",parity->itemData(index).toString());
  12283. }
  12284. void SerialScaleConfWidget::updateFlowControl(int index)
  12285. {
  12286. updateAttribute("flowcontrol",flow->itemData(index).toString());
  12287. }
  12288. void SerialScaleConfWidget::updateStopBits(int index)
  12289. {
  12290. updateAttribute("stopbits",stop->itemData(index).toString());
  12291. }
  12292. void SerialScaleConfWidget::updateWeighCommand(const QString&command)
  12293. {
  12294. updateAttribute("weighcommand",command);
  12295. }
  12296. void SerialScaleConfWidget::updateCommandTerminator(const QString&terminator)
  12297. {
  12298. updateAttribute("commandterminator",terminator);
  12299. }
  12300. /*:1074*/
  12301. #line 609 "./typica.w"
  12302. /*1086:*/
  12303. #line 195 "./valueannotation.w"
  12304. void ValueAnnotation::newMeasurement(Measurement measure)
  12305. {
  12306. for(int i= 0;i<values.size();i++)
  12307. {
  12308. if(measure.temperature()> values.at(i)-tolerance&&
  12309. measure.temperature()<values.at(i)+tolerance)
  12310. {
  12311. if(i!=lastIndex)
  12312. {
  12313. lastIndex= i;
  12314. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  12315. }
  12316. }
  12317. }
  12318. }
  12319. /*:1086*//*1087:*/
  12320. #line 216 "./valueannotation.w"
  12321. void ValueAnnotation::annotate()
  12322. {
  12323. if(lastIndex> -1)
  12324. {
  12325. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  12326. }
  12327. }
  12328. /*:1087*//*1088:*/
  12329. #line 228 "./valueannotation.w"
  12330. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  12331. {
  12332. values.append(value);
  12333. annotations.append(annotation);
  12334. }
  12335. /*:1088*//*1089:*/
  12336. #line 237 "./valueannotation.w"
  12337. void ValueAnnotation::setAnnotationColumn(int column)
  12338. {
  12339. annotationColumn= column;
  12340. }
  12341. void ValueAnnotation::setTemperatureColumn(int column)
  12342. {
  12343. measurementColumn= column;
  12344. }
  12345. void ValueAnnotation::setTolerance(double epsilon)
  12346. {
  12347. tolerance= epsilon;
  12348. }
  12349. /*:1089*//*1090:*/
  12350. #line 255 "./valueannotation.w"
  12351. ValueAnnotation::ValueAnnotation():QObject(),
  12352. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  12353. {
  12354. }
  12355. /*:1090*/
  12356. #line 610 "./typica.w"
  12357. /*1078:*/
  12358. #line 33 "./valueannotation.w"
  12359. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  12360. const QModelIndex&index)
  12361. :BasicDeviceConfigurationWidget(model,index),
  12362. tablemodel(new SaltModel(2))
  12363. {
  12364. QFormLayout*layout= new QFormLayout;
  12365. QLineEdit*source= new QLineEdit;
  12366. layout->addRow(tr("Source column name:"),source);
  12367. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  12368. noteOnStart->setChecked(true);
  12369. layout->addRow(noteOnStart);
  12370. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  12371. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  12372. QTableView*annotationTable= new QTableView;
  12373. annotationTable->setModel(tablemodel);
  12374. NumericDelegate*delegate= new NumericDelegate;
  12375. annotationTable->setItemDelegateForColumn(0,delegate);
  12376. layout->addRow(tr("Annotations for values:"),annotationTable);
  12377. /*799:*/
  12378. #line 16574 "./typica.w"
  12379. QDomElement referenceElement=
  12380. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12381. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12382. QDomElement node;
  12383. /*:799*/
  12384. #line 52 "./valueannotation.w"
  12385. for(int i= 0;i<configData.size();i++)
  12386. {
  12387. node= configData.at(i).toElement();
  12388. if(node.attribute("name")=="source")
  12389. {
  12390. source->setText(node.attribute("value"));
  12391. }
  12392. else if(node.attribute("name")=="emitOnStart")
  12393. {
  12394. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  12395. }
  12396. else if(node.attribute("name")=="measuredValues")
  12397. {
  12398. /*962:*/
  12399. #line 19662 "./typica.w"
  12400. QString data= node.attribute("value");
  12401. if(data.length()> 3)
  12402. {
  12403. data.chop(2);
  12404. data= data.remove(0,2);
  12405. }
  12406. QStringList itemList= data.split(",");
  12407. /*:962*/
  12408. #line 66 "./valueannotation.w"
  12409. int column= 0;
  12410. /*963:*/
  12411. #line 19674 "./typica.w"
  12412. for(int j= 0;j<itemList.size();j++)
  12413. {
  12414. tablemodel->setData(tablemodel->index(j,column),
  12415. QVariant(itemList.at(j).toDouble()),
  12416. Qt::DisplayRole);
  12417. }
  12418. /*:963*/
  12419. #line 68 "./valueannotation.w"
  12420. }
  12421. else if(node.attribute("name")=="annotations")
  12422. {
  12423. /*1079:*/
  12424. #line 89 "./valueannotation.w"
  12425. QString data= node.attribute("value");
  12426. if(data.length()> 3)
  12427. {
  12428. data.chop(2);
  12429. data= data.remove(0,2);
  12430. }
  12431. QStringList itemList= data.split(",");
  12432. for(int i= 0;i<itemList.size();i++)
  12433. {
  12434. itemList[i]= itemList[i].simplified();
  12435. }
  12436. /*:1079*/
  12437. #line 72 "./valueannotation.w"
  12438. int column= 1;
  12439. /*1080:*/
  12440. #line 104 "./valueannotation.w"
  12441. for(int i= 0;i<itemList.size();i++)
  12442. {
  12443. tablemodel->setData(tablemodel->index(i,column),
  12444. QVariant(itemList.at(i)),
  12445. Qt::DisplayRole);
  12446. }
  12447. /*:1080*/
  12448. #line 74 "./valueannotation.w"
  12449. }
  12450. }
  12451. updateSourceColumn(source->text());
  12452. updateStart(noteOnStart->isChecked());
  12453. updateAnnotations();
  12454. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  12455. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  12456. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  12457. setLayout(layout);
  12458. }
  12459. /*:1078*//*1081:*/
  12460. #line 115 "./valueannotation.w"
  12461. void ValueAnnotationConfWidget::updateAnnotations()
  12462. {
  12463. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  12464. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  12465. }
  12466. /*:1081*//*1082:*/
  12467. #line 125 "./valueannotation.w"
  12468. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  12469. {
  12470. updateAttribute("source",source);
  12471. }
  12472. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  12473. {
  12474. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  12475. }
  12476. /*:1082*/
  12477. #line 611 "./typica.w"
  12478. /*895:*/
  12479. #line 44 "./modbus.w"
  12480. ModbusNGConfWidget::ModbusNGConfWidget(DeviceTreeModel*model,const QModelIndex&index):
  12481. BasicDeviceConfigurationWidget(model,index),m_parity(new ParitySelector),
  12482. m_flow(new FlowSelector),m_stop(new StopSelector)
  12483. {
  12484. QFormLayout*layout= new QFormLayout;
  12485. PortSelector*port= new PortSelector;
  12486. BaudSelector*baud= new BaudSelector;
  12487. QPushButton*newInput= new QPushButton(tr("Add Input Channel"));
  12488. layout->addRow(QString(tr("Port:")),port);
  12489. layout->addRow(QString(tr("Baud rate:")),baud);
  12490. layout->addRow(QString(tr("Parity:")),m_parity);
  12491. layout->addRow(QString(tr("Flow control:")),m_flow);
  12492. layout->addRow(QString(tr("Stop bits:")),m_stop);
  12493. layout->addRow(newInput);
  12494. /*799:*/
  12495. #line 16574 "./typica.w"
  12496. QDomElement referenceElement=
  12497. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12498. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12499. QDomElement node;
  12500. /*:799*/
  12501. #line 60 "./modbus.w"
  12502. for(int i= 0;i<configData.size();i++)
  12503. {
  12504. node= configData.at(i).toElement();
  12505. if(node.attribute("name")=="port")
  12506. {
  12507. int idx= port->findText(node.attribute("value"));
  12508. if(idx>=0)
  12509. {
  12510. port->setCurrentIndex(idx);
  12511. }
  12512. else
  12513. {
  12514. port->addItem(node.attribute("value"));
  12515. }
  12516. }
  12517. else if(node.attribute("name")=="baud")
  12518. {
  12519. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  12520. }
  12521. else if(node.attribute("name")=="parity")
  12522. {
  12523. m_parity->setCurrentIndex(m_parity->findData(node.attribute("value")));
  12524. }
  12525. else if(node.attribute("name")=="flow")
  12526. {
  12527. m_flow->setCurrentIndex(m_flow->findData(node.attribute("value")));
  12528. }
  12529. else if(node.attribute("name")=="stop")
  12530. {
  12531. m_stop->setCurrentIndex(m_stop->findData(node.attribute("value")));
  12532. }
  12533. }
  12534. updatePort(port->currentText());
  12535. updateBaudRate(baud->currentText());
  12536. updateParity(m_parity->currentIndex());
  12537. updateFlowControl(m_flow->currentIndex());
  12538. updateStopBits(m_stop->currentIndex());
  12539. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  12540. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  12541. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  12542. connect(m_parity,SIGNAL(currentIndexChanged(int)),this,SLOT(updateParity(int)));
  12543. connect(m_flow,SIGNAL(currentIndexChanged(int)),
  12544. this,SLOT(updateFlowControl(int)));
  12545. connect(m_stop,SIGNAL(currentIndexChanged(int)),this,SLOT(updateStopBits(int)));
  12546. connect(newInput,SIGNAL(clicked()),this,SLOT(addInput()));
  12547. setLayout(layout);
  12548. }
  12549. void ModbusNGConfWidget::updatePort(const QString&value)
  12550. {
  12551. updateAttribute("port",value);
  12552. }
  12553. void ModbusNGConfWidget::updateBaudRate(const QString&value)
  12554. {
  12555. updateAttribute("baud",value);
  12556. }
  12557. void ModbusNGConfWidget::updateParity(int value)
  12558. {
  12559. updateAttribute("parity",m_parity->itemData(value).toString());
  12560. }
  12561. void ModbusNGConfWidget::updateFlowControl(int value)
  12562. {
  12563. updateAttribute("flow",m_flow->itemData(value).toString());
  12564. }
  12565. void ModbusNGConfWidget::updateStopBits(int value)
  12566. {
  12567. updateAttribute("stop",m_stop->itemData(value).toString());
  12568. }
  12569. void ModbusNGConfWidget::addInput()
  12570. {
  12571. insertChildNode(tr("Input"),"modbusnginput");
  12572. }
  12573. /*:895*//*897:*/
  12574. #line 164 "./modbus.w"
  12575. ModbusNGInputConfWidget::ModbusNGInputConfWidget(DeviceTreeModel*model,const QModelIndex&index):BasicDeviceConfigurationWidget(model,index)
  12576. {
  12577. QFormLayout*layout= new QFormLayout;
  12578. QSpinBox*station= new QSpinBox;
  12579. station->setMinimum(1);
  12580. station->setMaximum(247);
  12581. layout->addRow(tr("Station ID"),station);
  12582. QComboBox*function= new QComboBox;
  12583. function->addItem("3","3");
  12584. function->addItem("4","4");
  12585. function->setCurrentIndex(1);
  12586. layout->addRow(tr("Function"),function);
  12587. ShortHexSpinBox*address= new ShortHexSpinBox;
  12588. layout->addRow(tr("Address"),address);
  12589. QComboBox*format= new QComboBox;
  12590. format->addItem(tr("16 bits fixed point"),"16fixedint");
  12591. format->addItem(tr("32 bits floating point (High Low)"),"32floathl");
  12592. format->addItem(tr("32 bits floating point (Low High)"),"32floatlh");
  12593. layout->addRow(tr("Data format"),format);
  12594. QSpinBox*decimals= new QSpinBox;
  12595. decimals->setMinimum(0);
  12596. decimals->setMaximum(9);
  12597. layout->addRow(tr("Decimal places"),decimals);
  12598. QComboBox*unit= new QComboBox;
  12599. unit->addItem("Celsius","C");
  12600. unit->addItem("Fahrenheit","F");
  12601. unit->addItem("Control","Control");
  12602. unit->setCurrentIndex(1);
  12603. layout->addRow(tr("Unit"),unit);
  12604. QLineEdit*column= new QLineEdit;
  12605. layout->addRow(tr("Column name"),column);
  12606. QCheckBox*hidden= new QCheckBox(tr("Hide this channel"));
  12607. layout->addRow(hidden);
  12608. /*799:*/
  12609. #line 16574 "./typica.w"
  12610. QDomElement referenceElement=
  12611. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12612. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12613. QDomElement node;
  12614. /*:799*/
  12615. #line 199 "./modbus.w"
  12616. for(int i= 0;i<configData.size();i++)
  12617. {
  12618. node= configData.at(i).toElement();
  12619. if(node.attribute("name")=="station")
  12620. {
  12621. station->setValue(node.attribute("value").toInt());
  12622. }
  12623. else if(node.attribute("name")=="function")
  12624. {
  12625. function->setCurrentIndex(function->findText(node.attribute("value")));
  12626. }
  12627. else if(node.attribute("name")=="address")
  12628. {
  12629. address->setValue(node.attribute("value").toInt());
  12630. }
  12631. else if(node.attribute("name")=="format")
  12632. {
  12633. format->setCurrentIndex(format->findData(node.attribute("value")));
  12634. }
  12635. else if(node.attribute("name")=="decimals")
  12636. {
  12637. decimals->setValue(node.attribute("value").toInt());
  12638. }
  12639. else if(node.attribute("name")=="unit")
  12640. {
  12641. unit->setCurrentIndex(unit->findData(node.attribute("value")));
  12642. }
  12643. else if(node.attribute("name")=="column")
  12644. {
  12645. column->setText(node.attribute("value"));
  12646. }
  12647. else if(node.attribute("name")=="hidden")
  12648. {
  12649. hidden->setChecked(node.attribute("value")=="true"?true:false);
  12650. }
  12651. }
  12652. updateStation(station->value());
  12653. updateFunction(function->currentIndex());
  12654. updateAddress(address->value());
  12655. updateFormat(format->currentIndex());
  12656. updateDecimals(decimals->value());
  12657. updateUnit(unit->currentIndex());
  12658. updateColumnName(column->text());
  12659. updateHidden(hidden->isChecked());
  12660. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  12661. connect(function,SIGNAL(currentIndexChanged(int)),this,SLOT(updateFunction(int)));
  12662. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  12663. connect(format,SIGNAL(currentIndexChanged(int)),this,SLOT(updateFormat(int)));
  12664. connect(decimals,SIGNAL(valueChanged(int)),this,SLOT(updateDecimals(int)));
  12665. connect(unit,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  12666. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  12667. connect(hidden,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12668. setLayout(layout);
  12669. }
  12670. void ModbusNGInputConfWidget::updateStation(int value)
  12671. {
  12672. updateAttribute("station",QString("%1").arg(value));
  12673. }
  12674. void ModbusNGInputConfWidget::updateFunction(int value)
  12675. {
  12676. updateAttribute("function",QString("%1").arg(value==0?"3":"4"));
  12677. }
  12678. void ModbusNGInputConfWidget::updateAddress(int value)
  12679. {
  12680. updateAttribute("address",QString("%1").arg(value));
  12681. }
  12682. void ModbusNGInputConfWidget::updateFormat(int value)
  12683. {
  12684. switch(value)
  12685. {
  12686. case 0:
  12687. updateAttribute("format","16fixedint");
  12688. break;
  12689. case 1:
  12690. updateAttribute("format","32floathl");
  12691. break;
  12692. case 2:
  12693. updateAttribute("format","32floatlh");
  12694. break;
  12695. }
  12696. }
  12697. void ModbusNGInputConfWidget::updateDecimals(int value)
  12698. {
  12699. updateAttribute("decimals",QString("%1").arg(value));
  12700. }
  12701. void ModbusNGInputConfWidget::updateUnit(int value)
  12702. {
  12703. switch(value)
  12704. {
  12705. case 0:
  12706. updateAttribute("unit","C");
  12707. break;
  12708. case 1:
  12709. updateAttribute("unit","F");
  12710. break;
  12711. case 2:
  12712. updateAttribute("unit","Control");
  12713. break;
  12714. }
  12715. }
  12716. void ModbusNGInputConfWidget::updateColumnName(const QString&value)
  12717. {
  12718. updateAttribute("column",value);
  12719. }
  12720. void ModbusNGInputConfWidget::updateHidden(bool value)
  12721. {
  12722. updateAttribute("hidden",value?"true":"false");
  12723. }
  12724. /*:897*//*902:*/
  12725. #line 403 "./modbus.w"
  12726. ModbusNG::ModbusNG(DeviceTreeModel*model,const QModelIndex&index):
  12727. QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),
  12728. rateLimiter(new QTimer),scanPosition(0),waiting(false)
  12729. {
  12730. QDomElement portReferenceElement=
  12731. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12732. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  12733. QDomElement node;
  12734. QVariantMap attributes;
  12735. for(int i= 0;i<portConfigData.size();i++)
  12736. {
  12737. node= portConfigData.at(i).toElement();
  12738. attributes.insert(node.attribute("name"),node.attribute("value"));
  12739. }
  12740. port= new QextSerialPort(attributes.value("port").toString(),
  12741. QextSerialPort::EventDriven);
  12742. port->setBaudRate((BaudRateType)(attributes.value("baud").toInt()));
  12743. port->setDataBits(DATA_8);
  12744. port->setParity((ParityType)attributes.value("parity").toInt());
  12745. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  12746. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  12747. delayTime= (int)(((double)(1)/(double)(attributes.value("baud").toInt()))*144000.0);
  12748. messageDelayTimer->setSingleShot(true);
  12749. commTimeout->setSingleShot(true);
  12750. rateLimiter->setSingleShot(true);
  12751. rateLimiter->setInterval(0);
  12752. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  12753. connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
  12754. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  12755. connect(rateLimiter,SIGNAL(timeout()),this,SLOT(rateLimitTimeout()));
  12756. if(!port->open(QIODevice::ReadWrite))
  12757. {
  12758. qDebug()<<"Failed to open serial port";
  12759. }
  12760. for(int i= 0;i<model->rowCount(index);i++)
  12761. {
  12762. QModelIndex channelIndex= model->index(i,0,index);
  12763. QDomElement channelReferenceElement=
  12764. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  12765. QDomNodeList channelConfigData=
  12766. channelReferenceElement.elementsByTagName("attribute");
  12767. QDomElement channelNode;
  12768. QVariantMap channelAttributes;
  12769. for(int j= 0;j<channelConfigData.size();j++)
  12770. {
  12771. channelNode= channelConfigData.at(j).toElement();
  12772. channelAttributes.insert(channelNode.attribute("name"),
  12773. channelNode.attribute("value"));
  12774. }
  12775. ModbusScanItem scanItem;
  12776. QString format= channelAttributes.value("format").toString();
  12777. if(format=="16fixedint")
  12778. {
  12779. scanItem.format= Int16;
  12780. }
  12781. else if(format=="32floathl")
  12782. {
  12783. scanItem.format= FloatHL;
  12784. }
  12785. else if(format=="32floatlh")
  12786. {
  12787. scanItem.format= FloatLH;
  12788. }
  12789. scanItem.request.append((char)channelAttributes.value("station").toInt());
  12790. scanItem.request.append((char)channelAttributes.value("function").toInt());
  12791. quint16 startAddress= (quint16)channelAttributes.value("address").toInt();
  12792. char*startAddressBytes= (char*)&startAddress;
  12793. scanItem.request.append(startAddressBytes[1]);
  12794. scanItem.request.append(startAddressBytes[0]);
  12795. scanItem.request.append((char)0x00);
  12796. if(scanItem.format==Int16)
  12797. {
  12798. scanItem.request.append((char)0x01);
  12799. }
  12800. else
  12801. {
  12802. scanItem.request.append((char)0x02);
  12803. }
  12804. quint16 crc= calculateCRC(scanItem.request);
  12805. char*crcBytes= (char*)&crc;
  12806. scanItem.request.append(crcBytes[0]);
  12807. scanItem.request.append(crcBytes[1]);
  12808. scanItem.decimalPosition= channelAttributes.value("decimals").toInt();
  12809. if(channelAttributes.value("unit").toString()=="C")
  12810. {
  12811. scanItem.unit= Units::Celsius;
  12812. channelTypeList.append("T");
  12813. }
  12814. else if(channelAttributes.value("unit").toString()=="F")
  12815. {
  12816. scanItem.unit= Units::Fahrenheit;
  12817. channelTypeList.append("T");
  12818. }
  12819. else
  12820. {
  12821. scanItem.unit= Units::Unitless;
  12822. channelTypeList.append("C");
  12823. }
  12824. scanList.append(scanItem);
  12825. lastMeasurement.append(0.0);
  12826. channels.append(new Channel);
  12827. channelNames.append(channelAttributes.value("column").toString());
  12828. hiddenStates.append(
  12829. channelAttributes.value("hidden").toString()=="true"?true:false);
  12830. channelLabels.append(model->data(channelIndex,0).toString());
  12831. }
  12832. messageDelayTimer->start();
  12833. }
  12834. ModbusNG::~ModbusNG()
  12835. {
  12836. commTimeout->stop();
  12837. messageDelayTimer->stop();
  12838. port->close();
  12839. }
  12840. void ModbusNG::sendNextMessage()
  12841. {
  12842. if(scanList.length()> 0&&!waiting)
  12843. {
  12844. port->write(scanList.at(scanPosition).request);
  12845. commTimeout->start(2000);
  12846. messageDelayTimer->start(delayTime);
  12847. waiting= true;
  12848. }
  12849. }
  12850. void ModbusNG::timeout()
  12851. {
  12852. qDebug()<<"Communications timeout.";
  12853. messageDelayTimer->start();
  12854. }
  12855. void ModbusNG::rateLimitTimeout()
  12856. {
  12857. messageDelayTimer->start();
  12858. }
  12859. void ModbusNG::dataAvailable()
  12860. {
  12861. if(messageDelayTimer->isActive())
  12862. {
  12863. messageDelayTimer->stop();
  12864. }
  12865. responseBuffer.append(port->readAll());
  12866. if(responseBuffer.size()<5)
  12867. {
  12868. return;
  12869. }
  12870. if(responseBuffer.size()<5+responseBuffer.at(2))
  12871. {
  12872. return;
  12873. }
  12874. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  12875. commTimeout->stop();
  12876. if(calculateCRC(responseBuffer)==0)
  12877. {
  12878. quint16 intresponse;
  12879. float floatresponse;
  12880. char*ibytes= (char*)&intresponse;
  12881. char*fbytes= (char*)&floatresponse;
  12882. double output;
  12883. switch(scanList.at(scanPosition).format)
  12884. {
  12885. case Int16:
  12886. ibytes[0]= responseBuffer.at(4);
  12887. ibytes[1]= responseBuffer.at(3);
  12888. output= intresponse;
  12889. for(int i= 0;i<scanList.at(scanPosition).decimalPosition;i++)
  12890. {
  12891. output/= 10;
  12892. }
  12893. break;
  12894. case FloatHL:
  12895. fbytes[0]= responseBuffer.at(4);
  12896. fbytes[1]= responseBuffer.at(3);
  12897. fbytes[2]= responseBuffer.at(6);
  12898. fbytes[3]= responseBuffer.at(5);
  12899. output= floatresponse;
  12900. break;
  12901. case FloatLH:
  12902. fbytes[0]= responseBuffer.at(6);
  12903. fbytes[1]= responseBuffer.at(5);
  12904. fbytes[2]= responseBuffer.at(4);
  12905. fbytes[3]= responseBuffer.at(3);
  12906. output= floatresponse;
  12907. break;
  12908. }
  12909. if(scanList.at(scanPosition).unit==Units::Celsius)
  12910. {
  12911. output= output*9.0/5.0+32.0;
  12912. }
  12913. scanList.at(scanPosition).lastValue= output;
  12914. }
  12915. else
  12916. {
  12917. qDebug()<<"CRC failed";
  12918. }
  12919. scanPosition= (scanPosition+1)%scanList.size();
  12920. if(scanPosition==0)
  12921. {
  12922. QTime time= QTime::currentTime();
  12923. bool doOutput= false;
  12924. for(int i= 0;i<scanList.size();i++)
  12925. {
  12926. if(scanList.at(i).lastValue!=lastMeasurement.at(i))
  12927. {
  12928. doOutput= true;
  12929. break;
  12930. }
  12931. }
  12932. if(doOutput)
  12933. {
  12934. for(int i= 0;i<scanList.size();i++)
  12935. {
  12936. lastMeasurement[i]= scanList.at(i).lastValue;
  12937. if(scanList.at(scanPosition).unit==Units::Unitless)
  12938. {
  12939. channels.at(i)->input(Measurement(scanList.at(i).lastValue,time,Units::Unitless));
  12940. }
  12941. else
  12942. {
  12943. channels.at(i)->input(Measurement(scanList.at(i).lastValue,time,Units::Fahrenheit));
  12944. }
  12945. }
  12946. }
  12947. }
  12948. responseBuffer.clear();
  12949. waiting= false;
  12950. if(scanPosition==0)
  12951. {
  12952. rateLimiter->start();
  12953. }
  12954. else
  12955. {
  12956. messageDelayTimer->start(delayTime);
  12957. }
  12958. }
  12959. quint16 ModbusNG::calculateCRC(QByteArray data)
  12960. {
  12961. quint16 retval= 0xFFFF;
  12962. int i= 0;
  12963. while(i<data.size())
  12964. {
  12965. retval^= 0x00FF&(quint16)data.at(i);
  12966. for(int j= 0;j<8;j++)
  12967. {
  12968. if(retval&1)
  12969. {
  12970. retval= (retval>>1)^0xA001;
  12971. }
  12972. else
  12973. {
  12974. retval>>= 1;
  12975. }
  12976. }
  12977. i++;
  12978. }
  12979. return retval;
  12980. }
  12981. int ModbusNG::channelCount()
  12982. {
  12983. return channels.size();
  12984. }
  12985. Channel*ModbusNG::getChannel(int channel)
  12986. {
  12987. return channels.at(channel);
  12988. }
  12989. QString ModbusNG::channelColumnName(int channel)
  12990. {
  12991. return channelNames.at(channel);
  12992. }
  12993. QString ModbusNG::channelIndicatorText(int channel)
  12994. {
  12995. return channelLabels.at(channel);
  12996. }
  12997. bool ModbusNG::isChannelHidden(int channel)
  12998. {
  12999. return hiddenStates.at(channel);
  13000. }
  13001. QString ModbusNG::channelType(int channel)
  13002. {
  13003. return channelTypeList.at(channel);
  13004. }
  13005. /*:902*/
  13006. #line 612 "./typica.w"
  13007. /*1095:*/
  13008. #line 33 "./thresholdannotation.w"
  13009. ThresholdAnnotationConfWidget::ThresholdAnnotationConfWidget(DeviceTreeModel*model,
  13010. const QModelIndex&index)
  13011. :BasicDeviceConfigurationWidget(model,index)
  13012. {
  13013. QFormLayout*layout= new QFormLayout;
  13014. QLineEdit*source= new QLineEdit;
  13015. layout->addRow(tr("Source column name:"),source);
  13016. QDoubleSpinBox*value= new QDoubleSpinBox;
  13017. value->setMinimum(-9999.99);
  13018. value->setMaximum(9999.99);
  13019. value->setDecimals(2);
  13020. layout->addRow(tr("Threshold value:"),value);
  13021. QComboBox*direction= new QComboBox;
  13022. direction->addItem(tr("Ascending"));
  13023. direction->addItem(tr("Descending"));
  13024. layout->addRow(tr("Direction:"),direction);
  13025. QLineEdit*annotation= new QLineEdit;
  13026. layout->addRow(tr("Annotation:"),annotation);
  13027. /*799:*/
  13028. #line 16574 "./typica.w"
  13029. QDomElement referenceElement=
  13030. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13031. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13032. QDomElement node;
  13033. /*:799*/
  13034. #line 52 "./thresholdannotation.w"
  13035. for(int i= 0;i<configData.size();i++)
  13036. {
  13037. node= configData.at(i).toElement();
  13038. if(node.attribute("name")=="source")
  13039. {
  13040. source->setText(node.attribute("value"));
  13041. }
  13042. else if(node.attribute("name")=="value")
  13043. {
  13044. value->setValue(node.attribute("value").toDouble());
  13045. }
  13046. else if(node.attribute("name")=="direction")
  13047. {
  13048. direction->setCurrentIndex(node.attribute("value").toInt());
  13049. }
  13050. else if(node.attribute("name")=="annotation")
  13051. {
  13052. annotation->setText(node.attribute("value"));
  13053. }
  13054. }
  13055. updateSourceColumn(source->text());
  13056. updateThreshold(value->value());
  13057. updateDirection(direction->currentIndex());
  13058. updateAnnotation(annotation->text());
  13059. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  13060. connect(value,SIGNAL(valueChanged(double)),this,SLOT(updateThreshold(double)));
  13061. connect(direction,SIGNAL(currentIndexChanged(int)),this,SLOT(updateDirection(int)));
  13062. connect(annotation,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotation(QString)));
  13063. setLayout(layout);
  13064. }
  13065. /*:1095*//*1096:*/
  13066. #line 86 "./thresholdannotation.w"
  13067. void ThresholdAnnotationConfWidget::updateSourceColumn(const QString&source)
  13068. {
  13069. updateAttribute("source",source);
  13070. }
  13071. void ThresholdAnnotationConfWidget::updateThreshold(double value)
  13072. {
  13073. updateAttribute("value",QString("%1").arg(value));
  13074. }
  13075. void ThresholdAnnotationConfWidget::updateDirection(int direction)
  13076. {
  13077. updateAttribute("direction",QString("%1").arg(direction));
  13078. }
  13079. void ThresholdAnnotationConfWidget::updateAnnotation(const QString&annotation)
  13080. {
  13081. updateAttribute("annotation",annotation);
  13082. }
  13083. /*:1096*/
  13084. #line 613 "./typica.w"
  13085. /*1100:*/
  13086. #line 152 "./thresholdannotation.w"
  13087. Annotator::Annotator(const QString&text):QObject(NULL),note(text)
  13088. {
  13089. t.setInterval(0);
  13090. t.setSingleShot(true);
  13091. connect(&t,SIGNAL(timeout()),this,SLOT(catchTimer()));
  13092. }
  13093. void Annotator::setAnnotation(const QString&annotation)
  13094. {
  13095. note= annotation;
  13096. }
  13097. void Annotator::setTemperatureColumn(int tempcolumn)
  13098. {
  13099. tc= tempcolumn;
  13100. }
  13101. void Annotator::setAnnotationColumn(int annotationcolumn)
  13102. {
  13103. ac= annotationcolumn;
  13104. }
  13105. /*:1100*//*1101:*/
  13106. #line 181 "./thresholdannotation.w"
  13107. void Annotator::catchTimer()
  13108. {
  13109. emit annotation(note,tc,ac);
  13110. }
  13111. void Annotator::annotate()
  13112. {
  13113. t.start();
  13114. }
  13115. /*:1101*/
  13116. #line 614 "./typica.w"
  13117. /*:4*//*259:*/
  13118. #line 6116 "./typica.w"
  13119. /*256:*/
  13120. #line 6079 "./typica.w"
  13121. void ScriptValidator::fixup(QString&input)const
  13122. {
  13123. QScriptEngine*engine= AppInstance->engine;
  13124. engine->pushContext();
  13125. input= engine->evaluate(input).toString();
  13126. engine->popContext();
  13127. }
  13128. /*:256*//*257:*/
  13129. #line 6092 "./typica.w"
  13130. QValidator::State ScriptValidator::validate(QString&input,int&pos)const
  13131. {
  13132. if(v)
  13133. {
  13134. if(v->validate(input,pos)==QValidator::Acceptable)
  13135. {
  13136. return QValidator::Acceptable;
  13137. }
  13138. }
  13139. return QValidator::Intermediate;
  13140. }
  13141. /*:257*//*258:*/
  13142. #line 6107 "./typica.w"
  13143. ScriptValidator::ScriptValidator(QValidator*validator,QObject*parent)
  13144. :QValidator(parent),v(validator)
  13145. {
  13146. }
  13147. /*:258*/
  13148. #line 6117 "./typica.w"
  13149. /*:259*//*692:*/
  13150. #line 160 "./plugins.w"
  13151. /*689:*/
  13152. #line 92 "./plugins.w"
  13153. PluginAction::PluginAction(const QFileInfo&info,QObject*parent):
  13154. QAction(parent),preRunScript(""),postRunScript("")
  13155. {
  13156. pluginFile= info.absoluteFilePath();
  13157. setText(info.baseName());
  13158. connect(this,SIGNAL(triggered()),this,SLOT(runScript()));
  13159. }
  13160. void PluginAction::runScript()
  13161. {
  13162. QFile file(pluginFile);
  13163. if(file.open(QIODevice::ReadOnly))
  13164. {
  13165. QScriptEngine*engine= AppInstance->engine;
  13166. QScriptContext*context= engine->pushContext();
  13167. if(parent()->dynamicPropertyNames().contains("activationObject"))
  13168. {
  13169. QScriptValue activationObject=
  13170. parent()->property("activationObject").value<QScriptValue> ();
  13171. context->setActivationObject(activationObject);
  13172. }
  13173. QString script(file.readAll());
  13174. QScriptValue retval= engine->evaluate(preRunScript+script+postRunScript,pluginFile);
  13175. if(engine->hasUncaughtException())
  13176. {
  13177. qDebug()<<"Uncaught exception: "<<
  13178. engine->uncaughtException().toString()<<
  13179. " in "<<pluginFile<<" line: "<<
  13180. engine->uncaughtExceptionLineNumber();
  13181. }
  13182. engine->popContext();
  13183. file.close();
  13184. }
  13185. }
  13186. /*:689*//*690:*/
  13187. #line 131 "./plugins.w"
  13188. QString PluginAction::preRun()
  13189. {
  13190. return preRunScript;
  13191. }
  13192. QString PluginAction::postRun()
  13193. {
  13194. return postRunScript;
  13195. }
  13196. void PluginAction::setPreRun(const QString&script)
  13197. {
  13198. preRunScript= script;
  13199. }
  13200. void PluginAction::setPostRun(const QString&script)
  13201. {
  13202. postRunScript= script;
  13203. }
  13204. /*:690*/
  13205. #line 161 "./plugins.w"
  13206. #line 14535 "./typica.w"
  13207. #line 1 "./daterangeselector.w"
  13208. /*:692*//*873:*/
  13209. #line 60 "./advancedsettings.w"
  13210. /*871:*/
  13211. #line 26 "./advancedsettings.w"
  13212. AdvancedSettingsWidget::AdvancedSettingsWidget():QWidget(NULL)
  13213. {
  13214. QSettings settings;
  13215. QFormLayout*layout= new QFormLayout;
  13216. QCheckBox*logDiagnostics= new QCheckBox;
  13217. logDiagnostics->setCheckState(
  13218. settings.value("settings/advanced/logging",false).toBool()?
  13219. Qt::Checked:Qt::Unchecked);
  13220. connect(logDiagnostics,SIGNAL(toggled(bool)),this,SLOT(enableDiagnosticLogging(bool)));
  13221. layout->addRow(tr("Enable diagnostic logging"),logDiagnostics);
  13222. setLayout(layout);
  13223. }
  13224. /*:871*//*872:*/
  13225. #line 43 "./advancedsettings.w"
  13226. void AdvancedSettingsWidget::enableDiagnosticLogging(bool enabled)
  13227. {
  13228. QSettings settings;
  13229. settings.setValue("settings/advanced/logging",enabled);
  13230. if(enabled)
  13231. {
  13232. qInstallMsgHandler(messageFileOutput);
  13233. }
  13234. else
  13235. {
  13236. qInstallMsgHandler(0);
  13237. }
  13238. }
  13239. /*:872*/
  13240. #line 61 "./advancedsettings.w"
  13241. #line 18338 "./typica.w"
  13242. /*:873*//*932:*/
  13243. #line 639 "./unsupportedserial.w"
  13244. /*907:*/
  13245. #line 58 "./unsupportedserial.w"
  13246. UnsupportedSerialDeviceConfWidget::UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  13247. const QModelIndex&index)
  13248. :BasicDeviceConfigurationWidget(model,index),
  13249. deviceSettingsModel(new SaltModel(2)),
  13250. scriptEditor(new QTextEdit)
  13251. {
  13252. scriptEditor->setTabStopWidth(20);
  13253. QVBoxLayout*dummyLayout= new QVBoxLayout;
  13254. QTabWidget*central= new QTabWidget;
  13255. QWidget*deviceConfigurationWidget= new QWidget;
  13256. QVBoxLayout*deviceConfigurationLayout= new QVBoxLayout;
  13257. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  13258. deviceConfigurationLayout->addWidget(addChannelButton);
  13259. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  13260. QLabel*deviceSettingsLabel= new QLabel(tr("Device Settings:"));
  13261. deviceConfigurationLayout->addWidget(deviceSettingsLabel);
  13262. QTableView*deviceSettingsView= new QTableView;
  13263. deviceSettingsModel->setHeaderData(0,Qt::Horizontal,tr("Key"));
  13264. deviceSettingsModel->setHeaderData(1,Qt::Horizontal,tr("Value"));
  13265. deviceSettingsView->setModel(deviceSettingsModel);
  13266. deviceConfigurationLayout->addWidget(deviceSettingsView);
  13267. deviceConfigurationWidget->setLayout(deviceConfigurationLayout);
  13268. central->addTab(deviceConfigurationWidget,tr("Configuration"));
  13269. central->addTab(scriptEditor,tr("Script"));
  13270. dummyLayout->addWidget(central);
  13271. /*799:*/
  13272. #line 16574 "./typica.w"
  13273. QDomElement referenceElement=
  13274. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13275. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13276. QDomElement node;
  13277. /*:799*/
  13278. #line 86 "./unsupportedserial.w"
  13279. for(int i= 0;i<configData.size();i++)
  13280. {
  13281. node= configData.at(i).toElement();
  13282. if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  13283. {
  13284. int column= 0;
  13285. if(node.attribute("name")=="values")
  13286. {
  13287. column= 1;
  13288. }
  13289. QString data= node.attribute("value");
  13290. if(data.length()> 3)
  13291. {
  13292. data.chop(2);
  13293. data= data.remove(0,2);
  13294. }
  13295. QStringList keyList= data.split(", ");
  13296. for(int j= 0;j<keyList.size();j++)
  13297. {
  13298. deviceSettingsModel->setData(deviceSettingsModel->index(j,column),
  13299. QVariant(keyList.at(j)),
  13300. Qt::EditRole);
  13301. }
  13302. }
  13303. else if(node.attribute("name")=="script")
  13304. {
  13305. scriptEditor->setPlainText(node.attribute("value"));
  13306. }
  13307. }
  13308. connect(deviceSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  13309. this,SLOT(updateConfiguration()));
  13310. connect(scriptEditor,SIGNAL(textChanged()),this,SLOT(saveScript()));
  13311. setLayout(dummyLayout);
  13312. }
  13313. /*:907*//*908:*/
  13314. #line 131 "./unsupportedserial.w"
  13315. void UnsupportedSerialDeviceConfWidget::updateConfiguration()
  13316. {
  13317. updateAttribute("keys",deviceSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  13318. updateAttribute("values",deviceSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  13319. }
  13320. /*:908*//*909:*/
  13321. #line 144 "./unsupportedserial.w"
  13322. void UnsupportedSerialDeviceConfWidget::saveScript()
  13323. {
  13324. updateAttribute("script",scriptEditor->toPlainText());
  13325. }
  13326. /*:909*//*910:*/
  13327. #line 155 "./unsupportedserial.w"
  13328. void UnsupportedSerialDeviceConfWidget::addChannel()
  13329. {
  13330. insertChildNode(tr("Channel"),"unsupporteddevicechannel");
  13331. }
  13332. /*:910*//*912:*/
  13333. #line 183 "./unsupportedserial.w"
  13334. UnsupportedDeviceChannelConfWidget::UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  13335. const QModelIndex&index)
  13336. :BasicDeviceConfigurationWidget(model,index),
  13337. channelSettingsModel(new SaltModel(2))
  13338. {
  13339. QFormLayout*layout= new QFormLayout;
  13340. QLineEdit*columnName= new QLineEdit;
  13341. layout->addRow(tr("Column Name:"),columnName);
  13342. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  13343. layout->addRow(hideSeries);
  13344. QTableView*channelSettings= new QTableView;
  13345. channelSettingsModel->setHeaderData(0,Qt::Horizontal,"Key");
  13346. channelSettingsModel->setHeaderData(1,Qt::Horizontal,"Value");
  13347. channelSettings->setModel(channelSettingsModel);
  13348. layout->addRow(channelSettings);
  13349. setLayout(layout);
  13350. /*799:*/
  13351. #line 16574 "./typica.w"
  13352. QDomElement referenceElement=
  13353. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13354. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13355. QDomElement node;
  13356. /*:799*/
  13357. #line 200 "./unsupportedserial.w"
  13358. for(int i= 0;i<configData.size();i++)
  13359. {
  13360. node= configData.at(i).toElement();
  13361. if(node.attribute("name")=="columnname")
  13362. {
  13363. columnName->setText(node.attribute("value"));
  13364. }
  13365. else if(node.attribute("name")=="hidden")
  13366. {
  13367. hideSeries->setChecked(node.attribute("value")=="true");
  13368. }
  13369. else if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  13370. {
  13371. int column= 0;
  13372. if(node.attribute("name")=="values")
  13373. {
  13374. column= 1;
  13375. }
  13376. QString data= node.attribute("value");
  13377. if(data.length()> 3)
  13378. {
  13379. data.chop(2);
  13380. data= data.remove(0,2);
  13381. }
  13382. QStringList keyList= data.split(", ");
  13383. for(int j= 0;j<keyList.size();j++)
  13384. {
  13385. channelSettingsModel->setData(channelSettingsModel->index(j,column),
  13386. QVariant(keyList.at(j)),
  13387. Qt::EditRole);
  13388. }
  13389. }
  13390. }
  13391. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  13392. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  13393. connect(channelSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  13394. this,SLOT(updateConfiguration()));
  13395. }
  13396. /*:912*//*913:*/
  13397. #line 244 "./unsupportedserial.w"
  13398. void UnsupportedDeviceChannelConfWidget::updateColumnName(const QString&value)
  13399. {
  13400. updateAttribute("columnname",value);
  13401. }
  13402. void UnsupportedDeviceChannelConfWidget::updateHidden(bool hidden)
  13403. {
  13404. updateAttribute("hidden",hidden?"true":"false");
  13405. }
  13406. void UnsupportedDeviceChannelConfWidget::updateConfiguration()
  13407. {
  13408. updateAttribute("keys",channelSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  13409. updateAttribute("values",channelSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  13410. }
  13411. /*:913*/
  13412. #line 640 "./unsupportedserial.w"
  13413. /*920:*/
  13414. #line 371 "./unsupportedserial.w"
  13415. void JavaScriptDevice::start()
  13416. {
  13417. QScriptValue object= scriptengine->newQObject(this);
  13418. /*921:*/
  13419. #line 390 "./unsupportedserial.w"
  13420. QScriptValue settingsObject= scriptengine->newObject();
  13421. QVariantMap::const_iterator i= deviceSettings.constBegin();
  13422. while(i!=deviceSettings.constEnd())
  13423. {
  13424. settingsObject.setProperty(i.key(),i.value().toString());
  13425. i++;
  13426. }
  13427. object.setProperty("settings",settingsObject);
  13428. /*:921*/
  13429. #line 375 "./unsupportedserial.w"
  13430. /*922:*/
  13431. #line 405 "./unsupportedserial.w"
  13432. QScriptValue channelsArray= scriptengine->newArray(channelCount());
  13433. for(int i= 0;i<channelCount();i++)
  13434. {
  13435. QScriptValue channelObject= scriptengine->newQObject(getChannel(i));
  13436. QScriptValue channelSettingsObject= scriptengine->newObject();
  13437. QVariantMap::const_iterator j= channelSettings.at(i).constBegin();
  13438. while(j!=channelSettings.at(i).constEnd())
  13439. {
  13440. channelSettingsObject.setProperty(j.key(),j.value().toString());
  13441. j++;
  13442. }
  13443. channelObject.setProperty("settings",channelSettingsObject);
  13444. channelsArray.setProperty(i,channelObject);
  13445. }
  13446. object.setProperty("channels",channelsArray);
  13447. /*:922*/
  13448. #line 376 "./unsupportedserial.w"
  13449. QScriptContext*context= scriptengine->currentContext();
  13450. QScriptValue oldThis= context->thisObject();
  13451. context->setThisObject(object);
  13452. QScriptValue result= scriptengine->evaluate(deviceScript);
  13453. QScriptEngine*engine= scriptengine;
  13454. /*195:*/
  13455. #line 4525 "./typica.w"
  13456. if(engine->hasUncaughtException())
  13457. {
  13458. int line= engine->uncaughtExceptionLineNumber();
  13459. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  13460. result.toString();
  13461. QString trace;
  13462. foreach(trace,engine->uncaughtExceptionBacktrace())
  13463. {
  13464. qDebug()<<trace;
  13465. }
  13466. }
  13467. /*:195*/
  13468. #line 382 "./unsupportedserial.w"
  13469. context->setThisObject(oldThis);
  13470. }
  13471. /*:920*//*925:*/
  13472. #line 446 "./unsupportedserial.w"
  13473. void JavaScriptDevice::stop()
  13474. {
  13475. emit deviceStopRequested();
  13476. }
  13477. /*:925*//*926:*/
  13478. #line 459 "./unsupportedserial.w"
  13479. JavaScriptDevice::JavaScriptDevice(const QModelIndex&index,
  13480. QScriptEngine*engine):
  13481. QObject(NULL),scriptengine(engine)
  13482. {
  13483. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  13484. QDomElement deviceReferenceElement=
  13485. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13486. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  13487. QDomElement node;
  13488. QStringList deviceKeys;
  13489. QStringList deviceValues;
  13490. for(int i= 0;i<deviceConfigData.size();i++)
  13491. {
  13492. node= deviceConfigData.at(i).toElement();
  13493. if(node.attribute("name")=="keys")
  13494. {
  13495. QString data= node.attribute("value");
  13496. if(data.length()> 3)
  13497. {
  13498. data.chop(2);
  13499. data= data.remove(0,2);
  13500. }
  13501. deviceKeys= data.split(", ");
  13502. }
  13503. else if(node.attribute("name")=="values")
  13504. {
  13505. QString data= node.attribute("value");
  13506. if(data.length()> 3)
  13507. {
  13508. data.chop(2);
  13509. data= data.remove(0,2);
  13510. }
  13511. deviceValues= data.split(", ");
  13512. }
  13513. else if(node.attribute("name")=="script")
  13514. {
  13515. deviceScript= node.attribute("value");
  13516. }
  13517. deviceSettings.insert(node.attribute("name"),node.attribute("value"));
  13518. }
  13519. for(int i= 0;i<qMin(deviceKeys.length(),deviceValues.length());i++)
  13520. {
  13521. deviceSettings.insert(deviceKeys[i],deviceValues[i]);
  13522. }
  13523. if(model->hasChildren(index))
  13524. {
  13525. for(int i= 0;i<model->rowCount(index);i++)
  13526. {
  13527. QModelIndex channelIndex= model->index(i,0,index);
  13528. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  13529. channelList.append(new Channel);
  13530. QDomElement channelReferenceElement=
  13531. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  13532. QDomNodeList channelConfigData=
  13533. channelReferenceElement.elementsByTagName("attribute");
  13534. QStringList channelKeys;
  13535. QStringList channelValues;
  13536. for(int j= 0;j<channelConfigData.size();j++)
  13537. {
  13538. node= channelConfigData.at(j).toElement();
  13539. if(node.attribute("name")=="keys")
  13540. {
  13541. QString data= node.attribute("value");
  13542. if(data.length()> 3)
  13543. {
  13544. data.chop(2);
  13545. data= data.remove(0,2);
  13546. }
  13547. channelKeys= data.split(", ");
  13548. }
  13549. else if(node.attribute("name")=="values")
  13550. {
  13551. QString data= node.attribute("value");
  13552. if(data.length()> 3)
  13553. {
  13554. data.chop(2);
  13555. data= data.remove(0,2);
  13556. }
  13557. channelValues= data.split(", ");
  13558. }
  13559. else if(node.attribute("name")=="hidden")
  13560. {
  13561. hiddenState.append(node.attribute("value")=="true");
  13562. }
  13563. else if(node.attribute("name")=="columnname")
  13564. {
  13565. columnNames.append(node.attribute("value"));
  13566. }
  13567. }
  13568. QVariantMap cs;
  13569. for(int j= 0;j<qMin(channelKeys.length(),channelValues.length());j++)
  13570. {
  13571. cs.insert(channelKeys[j],channelValues[j]);
  13572. }
  13573. channelSettings.append(cs);
  13574. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  13575. channelUnits.append(Units::Fahrenheit);
  13576. }
  13577. }
  13578. }
  13579. /*:926*//*927:*/
  13580. #line 564 "./unsupportedserial.w"
  13581. int JavaScriptDevice::channelCount()
  13582. {
  13583. return channelList.length();
  13584. }
  13585. Channel*JavaScriptDevice::getChannel(int channel)
  13586. {
  13587. return channelList.at(channel);
  13588. }
  13589. bool JavaScriptDevice::isChannelHidden(int channel)
  13590. {
  13591. return hiddenState.at(channel);
  13592. }
  13593. Units::Unit JavaScriptDevice::expectedChannelUnit(int channel)
  13594. {
  13595. return channelUnits.at(channel);
  13596. }
  13597. QString JavaScriptDevice::channelColumnName(int channel)
  13598. {
  13599. if(channel>=0&&channel<columnNames.length())
  13600. {
  13601. return columnNames.at(channel);
  13602. }
  13603. return QString();
  13604. }
  13605. QString JavaScriptDevice::channelIndicatorText(int channel)
  13606. {
  13607. return indicatorTexts.at(channel);
  13608. }
  13609. /*:927*//*928:*/
  13610. #line 601 "./unsupportedserial.w"
  13611. void JavaScriptDevice::setTemperatureColumn(int tcol)
  13612. {
  13613. annotationTemperatureColumn= tcol;
  13614. }
  13615. void JavaScriptDevice::setAnnotationColumn(int ncol)
  13616. {
  13617. annotationNoteColumn= ncol;
  13618. }
  13619. /*:928*/
  13620. #line 641 "./unsupportedserial.w"
  13621. /*:932*//*955:*/
  13622. #line 444 "./phidgets.w"
  13623. /*939:*/
  13624. #line 31 "./phidgets.w"
  13625. PhidgetsTemperatureSensorConfWidget::PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  13626. const QModelIndex&index)
  13627. :BasicDeviceConfigurationWidget(model,index)
  13628. {
  13629. QFormLayout*layout= new QFormLayout;
  13630. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  13631. QSpinBox*sampleRate= new QSpinBox;
  13632. sampleRate->setMinimum(40);
  13633. sampleRate->setMaximum(600);
  13634. sampleRate->setSingleStep(40);
  13635. sampleRate->setValue(360);
  13636. /*799:*/
  13637. #line 16574 "./typica.w"
  13638. QDomElement referenceElement=
  13639. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13640. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13641. QDomElement node;
  13642. /*:799*/
  13643. #line 44 "./phidgets.w"
  13644. for(int i= 0;i<configData.size();i++)
  13645. {
  13646. node= configData.at(i).toElement();
  13647. if(node.attribute("name")=="sampleRate")
  13648. {
  13649. sampleRate->setValue(node.attribute("value").toInt());
  13650. }
  13651. }
  13652. updateRate(sampleRate->value());
  13653. connect(sampleRate,SIGNAL(valueChanged(int)),this,SLOT(updateRate(int)));
  13654. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  13655. layout->addRow(addChannelButton);
  13656. layout->addRow(tr("Sample rate:"),sampleRate);
  13657. setLayout(layout);
  13658. }
  13659. /*:939*//*940:*/
  13660. #line 66 "./phidgets.w"
  13661. void PhidgetsTemperatureSensorConfWidget::addChannel()
  13662. {
  13663. insertChildNode(tr("Channel"),"phidgets1048channel");
  13664. }
  13665. /*:940*//*941:*/
  13666. #line 74 "./phidgets.w"
  13667. void PhidgetsTemperatureSensorConfWidget::updateRate(int ms)
  13668. {
  13669. updateAttribute("sampleRate",QString("%1").arg(ms));
  13670. }
  13671. /*:941*//*943:*/
  13672. #line 103 "./phidgets.w"
  13673. PhidgetTemperatureSensorChannelConfWidget::PhidgetTemperatureSensorChannelConfWidget(
  13674. DeviceTreeModel*model,const QModelIndex&index)
  13675. :BasicDeviceConfigurationWidget(model,index),
  13676. tcType(new QComboBox)
  13677. {
  13678. QFormLayout*layout= new QFormLayout;
  13679. QLineEdit*columnName= new QLineEdit;
  13680. layout->addRow(tr("Column Name:"),columnName);
  13681. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  13682. layout->addRow(hideSeries);
  13683. layout->addRow(tr("Thermocouple Type:"),tcType);
  13684. tcType->addItem("Type K","1");
  13685. tcType->addItem("Type J","2");
  13686. tcType->addItem("Type E","3");
  13687. tcType->addItem("Type T","4");
  13688. QSpinBox*channel= new QSpinBox;
  13689. layout->addRow(tr("Channel:"),channel);
  13690. channel->setMinimum(0);
  13691. channel->setMaximum(3);
  13692. setLayout(layout);
  13693. /*799:*/
  13694. #line 16574 "./typica.w"
  13695. QDomElement referenceElement=
  13696. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13697. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13698. QDomElement node;
  13699. /*:799*/
  13700. #line 124 "./phidgets.w"
  13701. for(int i= 0;i<configData.size();i++)
  13702. {
  13703. node= configData.at(i).toElement();
  13704. if(node.attribute("name")=="columnname")
  13705. {
  13706. columnName->setText(node.attribute("value"));
  13707. }
  13708. else if(node.attribute("name")=="hidden")
  13709. {
  13710. hideSeries->setChecked(node.attribute("value")=="true");
  13711. }
  13712. else if(node.attribute("name")=="tctype")
  13713. {
  13714. tcType->setCurrentIndex(tcType->findData(node.attribute("value")));
  13715. }
  13716. else if(node.attribute("name")=="channel")
  13717. {
  13718. channel->setValue(node.attribute("value").toInt());
  13719. }
  13720. }
  13721. updateColumnName(columnName->text());
  13722. updateHidden(hideSeries->isChecked());
  13723. updateTC(tcType->currentIndex());
  13724. updateChannel(channel->value());
  13725. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  13726. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  13727. connect(tcType,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTC(int)));
  13728. connect(channel,SIGNAL(valueChanged(int)),this,SLOT(updateChannel(int)));
  13729. }
  13730. /*:943*//*944:*/
  13731. #line 157 "./phidgets.w"
  13732. void PhidgetTemperatureSensorChannelConfWidget::updateColumnName(const QString&value)
  13733. {
  13734. updateAttribute("columnname",value);
  13735. }
  13736. void PhidgetTemperatureSensorChannelConfWidget::updateHidden(bool hidden)
  13737. {
  13738. updateAttribute("hidden",hidden?"true":"false");
  13739. }
  13740. void PhidgetTemperatureSensorChannelConfWidget::updateTC(int index)
  13741. {
  13742. updateAttribute("tctype",tcType->itemData(index).toString());
  13743. }
  13744. void PhidgetTemperatureSensorChannelConfWidget::updateChannel(int channel)
  13745. {
  13746. updateAttribute("channel",QString("%1").arg(channel));
  13747. }
  13748. /*:944*//*948:*/
  13749. #line 246 "./phidgets.w"
  13750. PhidgetsTemperatureSensor::PhidgetsTemperatureSensor(const QModelIndex&index)
  13751. :QObject(NULL),driver("phidget21"),device(NULL)
  13752. {
  13753. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  13754. QDomElement deviceReferenceElement=
  13755. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13756. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  13757. QDomElement node;
  13758. for(int i= 0;i<deviceConfigData.size();i++)
  13759. {
  13760. node= deviceConfigData.at(i).toElement();
  13761. if(node.attribute("name")=="sampleRate")
  13762. {
  13763. sampleTimer.setInterval(node.attribute("value").toInt());
  13764. }
  13765. }
  13766. if(model->hasChildren(index))
  13767. {
  13768. for(int i= 0;i<model->rowCount(index);i++)
  13769. {
  13770. QModelIndex channelIndex= model->index(i,0,index);
  13771. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  13772. QDomElement channelReferenceElement= model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  13773. QDomNodeList channelConfigData= channelReferenceElement.elementsByTagName("attribute");
  13774. for(int j= 0;j<channelConfigData.size();j++)
  13775. {
  13776. node= channelConfigData.at(j).toElement();
  13777. if(node.attribute("name")=="channel")
  13778. {
  13779. int channelID= node.attribute("value").toInt();
  13780. channelIndices.append(channelID);
  13781. Channel*channel= new Channel;
  13782. channelList.append(channel);
  13783. channelMap.insert(channelID,channel);
  13784. }
  13785. else if(node.attribute("name")=="hidden")
  13786. {
  13787. hiddenState.append(node.attribute("value")=="true");
  13788. }
  13789. else if(node.attribute("name")=="columnname")
  13790. {
  13791. columnNames.append(node.attribute("value"));
  13792. }
  13793. else if(node.attribute("name")=="tctype")
  13794. {
  13795. tctypes.append(node.attribute("value").toInt());
  13796. }
  13797. }
  13798. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  13799. }
  13800. }
  13801. }
  13802. /*:948*//*949:*/
  13803. #line 306 "./phidgets.w"
  13804. int PhidgetsTemperatureSensor::channelCount()
  13805. {
  13806. return channelList.length();
  13807. }
  13808. Channel*PhidgetsTemperatureSensor::getChannel(int channel)
  13809. {
  13810. return channelList.at(channel);
  13811. }
  13812. /*:949*//*950:*/
  13813. #line 319 "./phidgets.w"
  13814. bool PhidgetsTemperatureSensor::isChannelHidden(int channel)
  13815. {
  13816. return hiddenState.at(channel);
  13817. }
  13818. QString PhidgetsTemperatureSensor::channelColumnName(int channel)
  13819. {
  13820. if(channel>=0&&channel<columnNames.length())
  13821. {
  13822. return columnNames.at(channel);
  13823. }
  13824. return QString();
  13825. }
  13826. QString PhidgetsTemperatureSensor::channelIndicatorText(int channel)
  13827. {
  13828. if(channel>=0&&channel<indicatorTexts.length())
  13829. {
  13830. return indicatorTexts.at(channel);
  13831. }
  13832. return QString();
  13833. }
  13834. /*:950*//*952:*/
  13835. #line 371 "./phidgets.w"
  13836. void PhidgetsTemperatureSensor::start()
  13837. {
  13838. if(!driver.load())
  13839. {
  13840. driver.setFileName("Phidget21.framework/Phidget21");
  13841. if(!driver.load())
  13842. {
  13843. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  13844. tr("Failed to find phidget21. Please install it."));
  13845. return;
  13846. }
  13847. }
  13848. if((createDevice= (PhidgetHandleOnly)driver.resolve("CPhidgetTemperatureSensor_create"))==0||
  13849. (openDevice= (PhidgetHandleInt)driver.resolve("CPhidget_open"))==0||
  13850. (waitForOpen= (PhidgetHandleInt)driver.resolve("CPhidget_waitForAttachment"))==0||
  13851. (setTCType= (PhidgetHandleIntInt)driver.resolve("CPhidgetTemperatureSensor_setThermocoupleType"))==0||
  13852. (getTemperature= (PhidgetHandleIntDoubleOut)driver.resolve("CPhidgetTemperatureSensor_getTemperature"))==0||
  13853. (closeDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_close"))==0||
  13854. (deleteDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_delete"))==0)
  13855. {
  13856. QMessageBox::critical(NULL,tr("Typica: Link error"),
  13857. tr("Failed to link a required symbol in phidget21."));
  13858. return;
  13859. }
  13860. createDevice(&device);
  13861. openDevice(device,-1);
  13862. int error;
  13863. if((error= waitForOpen(device,10000)))
  13864. {
  13865. closeDevice(device);
  13866. deleteDevice(device);
  13867. QMessageBox::critical(NULL,tr("Typica: Failed to Open Device"),
  13868. tr("CPhidget_waitForAttachment returns error %n",0,error));
  13869. return;
  13870. }
  13871. for(int i= 0;i<channelIndices.length();i++)
  13872. {
  13873. setTCType(device,channelIndices.at(i),tctypes.at(i));
  13874. }
  13875. connect(&sampleTimer,SIGNAL(timeout()),this,SLOT(getMeasurements()));
  13876. sampleTimer.start();
  13877. }
  13878. /*:952*//*953:*/
  13879. #line 418 "./phidgets.w"
  13880. void PhidgetsTemperatureSensor::getMeasurements()
  13881. {
  13882. double value= 0.0;
  13883. QTime time= QTime::currentTime();
  13884. foreach(int i,channelIndices)
  13885. {
  13886. getTemperature(device,i,&value);
  13887. Measurement measure(value*9.0/5.0+32.0,time);
  13888. channelMap[i]->input(measure);
  13889. }
  13890. }
  13891. /*:953*//*954:*/
  13892. #line 433 "./phidgets.w"
  13893. void PhidgetsTemperatureSensor::stop()
  13894. {
  13895. sampleTimer.stop();
  13896. closeDevice(device);
  13897. deleteDevice(device);
  13898. driver.unload();
  13899. }
  13900. /*:954*/
  13901. #line 445 "./phidgets.w"
  13902. /*:955*//*969:*/
  13903. #line 19770 "./typica.w"
  13904. /*967:*/
  13905. #line 19732 "./typica.w"
  13906. CoolingTimerConfWidget::CoolingTimerConfWidget(DeviceTreeModel*model,
  13907. const QModelIndex&index)
  13908. :BasicDeviceConfigurationWidget(model,index)
  13909. {
  13910. QHBoxLayout*layout= new QHBoxLayout;
  13911. QLabel*label= new QLabel(tr("Cooling Time: "));
  13912. QTimeEdit*editor= new QTimeEdit;
  13913. editor->setDisplayFormat("mm:ss");
  13914. /*799:*/
  13915. #line 16574 "./typica.w"
  13916. QDomElement referenceElement=
  13917. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13918. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13919. QDomElement node;
  13920. /*:799*/
  13921. #line 19741 "./typica.w"
  13922. for(int i= 0;i<configData.size();i++)
  13923. {
  13924. node= configData.at(i).toElement();
  13925. if(node.attribute("name")=="reset")
  13926. {
  13927. editor->setTime(QTime::fromString(node.attribute("value"),"mm:ss"));
  13928. }
  13929. }
  13930. updateResetTime(editor->time());
  13931. connect(editor,SIGNAL(timeChanged(QTime)),
  13932. this,SLOT(updateResetTime(QTime)));
  13933. layout->addWidget(label);
  13934. layout->addWidget(editor);
  13935. setLayout(layout);
  13936. }
  13937. void CoolingTimerConfWidget::updateResetTime(QTime time)
  13938. {
  13939. updateAttribute("reset",time.toString("mm:ss"));
  13940. }
  13941. /*:967*/
  13942. #line 19771 "./typica.w"
  13943. /*:969*//*974:*/
  13944. #line 20029 "./typica.w"
  13945. /*971:*/
  13946. #line 19803 "./typica.w"
  13947. RangeTimerConfWidget::RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  13948. :BasicDeviceConfigurationWidget(model,index)
  13949. {
  13950. QVBoxLayout*layout= new QVBoxLayout;
  13951. QGroupBox*startConfigurationGroup= new QGroupBox(tr("Start trigger"));
  13952. QRadioButton*startBatchOption= new QRadioButton(tr("Start of batch"));
  13953. QRadioButton*buttonOption= new QRadioButton(tr("Manual"));
  13954. QRadioButton*thresholdOption= new QRadioButton(tr("At temperature"));
  13955. QButtonGroup*startOptionGroup= new QButtonGroup;
  13956. startOptionGroup->addButton(startBatchOption,1);
  13957. startOptionGroup->addButton(buttonOption,2);
  13958. startOptionGroup->addButton(thresholdOption,3);
  13959. startBatchOption->setChecked(true);
  13960. QGridLayout*startOptions= new QGridLayout;
  13961. startOptions->addWidget(startBatchOption,0,0);
  13962. startOptions->addWidget(buttonOption,1,0);
  13963. startOptions->addWidget(thresholdOption,2,0);
  13964. QLabel*buttonTextLabel= new QLabel(tr("Button Text: "));
  13965. QLineEdit*buttonTextEdit= new QLineEdit;
  13966. QHBoxLayout*buttonTextOptions= new QHBoxLayout;
  13967. buttonTextOptions->addWidget(buttonTextLabel);
  13968. buttonTextOptions->addWidget(buttonTextEdit);
  13969. startOptions->addLayout(buttonTextOptions,1,1);
  13970. QFormLayout*thresholdOptions= new QFormLayout;
  13971. QLineEdit*startColumnName= new QLineEdit;
  13972. QLineEdit*startValue= new QLineEdit;
  13973. thresholdOptions->addRow(tr("Column Name: "),startColumnName);
  13974. thresholdOptions->addRow(tr("Value: "),startValue);
  13975. startOptions->addLayout(thresholdOptions,2,1);
  13976. startConfigurationGroup->setLayout(startOptions);
  13977. layout->addWidget(startConfigurationGroup);
  13978. QGroupBox*stopConfigurationGroup= new QGroupBox(tr("Stop trigger"));
  13979. QRadioButton*stopBatchOption= new QRadioButton(tr("End of batch"));
  13980. QRadioButton*stopButtonOption= new QRadioButton(tr("Manual"));
  13981. QRadioButton*stopThresholdOption= new QRadioButton(tr("At temperature"));
  13982. QButtonGroup*stopOptionGroup= new QButtonGroup;
  13983. stopOptionGroup->addButton(stopBatchOption,1);
  13984. stopOptionGroup->addButton(stopButtonOption,2);
  13985. stopOptionGroup->addButton(stopThresholdOption,3);
  13986. stopBatchOption->setChecked(true);
  13987. QGridLayout*stopOptions= new QGridLayout;
  13988. stopOptions->addWidget(stopBatchOption,0,0);
  13989. stopOptions->addWidget(stopButtonOption,1,0);
  13990. stopOptions->addWidget(stopThresholdOption,2,0);
  13991. QLabel*stopButtonLabel= new QLabel(tr("Button Text: "));
  13992. QLineEdit*stopButtonEdit= new QLineEdit;
  13993. QHBoxLayout*stopButtonTextOptions= new QHBoxLayout;
  13994. stopButtonTextOptions->addWidget(stopButtonLabel);
  13995. stopButtonTextOptions->addWidget(stopButtonEdit);
  13996. stopOptions->addLayout(stopButtonTextOptions,1,1);
  13997. QLineEdit*stopColumnName= new QLineEdit;
  13998. QLineEdit*stopValue= new QLineEdit;
  13999. QFormLayout*stopThresholdOptions= new QFormLayout;
  14000. stopThresholdOptions->addRow(tr("Column Name: "),stopColumnName);
  14001. stopThresholdOptions->addRow(tr("Value: "),stopValue);
  14002. stopOptions->addLayout(stopThresholdOptions,2,1);
  14003. stopConfigurationGroup->setLayout(stopOptions);
  14004. layout->addWidget(stopConfigurationGroup);
  14005. /*799:*/
  14006. #line 16574 "./typica.w"
  14007. QDomElement referenceElement=
  14008. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14009. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14010. QDomElement node;
  14011. /*:799*/
  14012. #line 19865 "./typica.w"
  14013. for(int i= 0;i<configData.size();i++)
  14014. {
  14015. node= configData.at(i).toElement();
  14016. if(node.attribute("name")=="startbuttontext")
  14017. {
  14018. buttonTextEdit->setText(node.attribute("value"));
  14019. }
  14020. else if(node.attribute("name")=="stopbuttontext")
  14021. {
  14022. stopButtonEdit->setText(node.attribute("value"));
  14023. }
  14024. else if(node.attribute("name")=="startcolumnname")
  14025. {
  14026. startColumnName->setText(node.attribute("value"));
  14027. }
  14028. else if(node.attribute("name")=="stopcolumnname")
  14029. {
  14030. stopColumnName->setText(node.attribute("value"));
  14031. }
  14032. else if(node.attribute("name")=="startvalue")
  14033. {
  14034. startValue->setText(node.attribute("value"));
  14035. }
  14036. else if(node.attribute("name")=="stopvalue")
  14037. {
  14038. stopValue->setText(node.attribute("value"));
  14039. }
  14040. else if(node.attribute("name")=="starttrigger")
  14041. {
  14042. if(node.attribute("value")=="batch")
  14043. {
  14044. startBatchOption->setChecked(true);
  14045. }
  14046. else if(node.attribute("value")=="manual")
  14047. {
  14048. buttonOption->setChecked(true);
  14049. }
  14050. else if(node.attribute("value")=="value")
  14051. {
  14052. thresholdOption->setChecked(true);
  14053. }
  14054. }
  14055. else if(node.attribute("name")=="stoptrigger")
  14056. {
  14057. if(node.attribute("value")=="batch")
  14058. {
  14059. stopBatchOption->setChecked(true);
  14060. }
  14061. else if(node.attribute("value")=="manual")
  14062. {
  14063. stopButtonOption->setChecked(true);
  14064. }
  14065. else if(node.attribute("value")=="value")
  14066. {
  14067. stopThresholdOption->setChecked(true);
  14068. }
  14069. }
  14070. }
  14071. updateStartButtonText(buttonTextEdit->text());
  14072. updateStopButtonText(stopButtonEdit->text());
  14073. updateStartColumnName(startColumnName->text());
  14074. updateStopColumnName(stopColumnName->text());
  14075. updateStartValue(startValue->text());
  14076. updateStopValue(stopValue->text());
  14077. updateStartTrigger(startOptionGroup->checkedId());
  14078. updateStopTrigger(stopOptionGroup->checkedId());
  14079. setLayout(layout);
  14080. connect(buttonTextEdit,SIGNAL(textChanged(QString)),
  14081. this,SLOT(updateStartButtonText(QString)));
  14082. connect(stopButtonEdit,SIGNAL(textChanged(QString)),
  14083. this,SLOT(updateStopButtonText(QString)));
  14084. connect(startColumnName,SIGNAL(textChanged(QString)),
  14085. this,SLOT(updateStartColumnName(QString)));
  14086. connect(stopColumnName,SIGNAL(textChanged(QString)),
  14087. this,SLOT(updateStopColumnName(QString)));
  14088. connect(startValue,SIGNAL(textChanged(QString)),
  14089. this,SLOT(updateStartValue(QString)));
  14090. connect(stopValue,SIGNAL(textChanged(QString)),
  14091. this,SLOT(updateStopValue(QString)));
  14092. connect(startOptionGroup,SIGNAL(buttonClicked(int)),
  14093. this,SLOT(updateStartTrigger(int)));
  14094. connect(stopOptionGroup,SIGNAL(buttonClicked(int)),
  14095. this,SLOT(updateStopTrigger(int)));
  14096. }
  14097. /*:971*//*972:*/
  14098. #line 19955 "./typica.w"
  14099. void RangeTimerConfWidget::updateStartButtonText(const QString&text)
  14100. {
  14101. updateAttribute("startbuttontext",text);
  14102. }
  14103. void RangeTimerConfWidget::updateStopButtonText(const QString&text)
  14104. {
  14105. updateAttribute("stopbuttontext",text);
  14106. }
  14107. void RangeTimerConfWidget::updateStartColumnName(const QString&text)
  14108. {
  14109. updateAttribute("startcolumnname",text);
  14110. }
  14111. void RangeTimerConfWidget::updateStopColumnName(const QString&text)
  14112. {
  14113. updateAttribute("stopcolumnname",text);
  14114. }
  14115. void RangeTimerConfWidget::updateStartValue(const QString&text)
  14116. {
  14117. updateAttribute("startvalue",text);
  14118. }
  14119. void RangeTimerConfWidget::updateStopValue(const QString&text)
  14120. {
  14121. updateAttribute("stopvalue",text);
  14122. }
  14123. void RangeTimerConfWidget::updateStartTrigger(int option)
  14124. {
  14125. switch(option)
  14126. {
  14127. case 1:
  14128. updateAttribute("starttrigger","batch");
  14129. break;
  14130. case 2:
  14131. updateAttribute("starttrigger","manual");
  14132. break;
  14133. case 3:
  14134. updateAttribute("starttrigger","value");
  14135. break;
  14136. default:
  14137. break;
  14138. }
  14139. }
  14140. void RangeTimerConfWidget::updateStopTrigger(int option)
  14141. {
  14142. switch(option)
  14143. {
  14144. case 1:
  14145. updateAttribute("stoptrigger","batch");
  14146. break;
  14147. case 2:
  14148. updateAttribute("stoptrigger","manual");
  14149. break;
  14150. case 3:
  14151. updateAttribute("stoptrigger","value");
  14152. break;
  14153. default:
  14154. break;
  14155. }
  14156. }
  14157. /*:972*/
  14158. #line 20030 "./typica.w"
  14159. /*:974*//*979:*/
  14160. #line 20130 "./typica.w"
  14161. /*976:*/
  14162. #line 20054 "./typica.w"
  14163. MultiRangeTimerConfWidget::MultiRangeTimerConfWidget(DeviceTreeModel*model,
  14164. const QModelIndex&index)
  14165. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  14166. {
  14167. QFormLayout*layout= new QFormLayout;
  14168. QLineEdit*trigger= new QLineEdit;
  14169. layout->addRow(tr("Trigger column name:"),trigger);
  14170. tablemodel->setHeaderData(0,Qt::Horizontal,"Range Name");
  14171. tablemodel->setHeaderData(1,Qt::Horizontal,"End Temperature");
  14172. QTableView*rangeTable= new QTableView;
  14173. rangeTable->setModel(tablemodel);
  14174. layout->addRow(tr("Range data:"),rangeTable);
  14175. /*799:*/
  14176. #line 16574 "./typica.w"
  14177. QDomElement referenceElement=
  14178. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14179. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14180. QDomElement node;
  14181. /*:799*/
  14182. #line 20067 "./typica.w"
  14183. for(int i= 0;i<configData.size();i++)
  14184. {
  14185. node= configData.at(i).toElement();
  14186. if(node.attribute("name")=="trigger")
  14187. {
  14188. trigger->setText(node.attribute("value"));
  14189. }
  14190. else if(node.attribute("name")=="rangenames")
  14191. {
  14192. QString data= node.attribute("value");
  14193. if(data.length()> 3)
  14194. {
  14195. data.chop(2);
  14196. data= data.remove(0,2);
  14197. }
  14198. QStringList itemList= data.split(", ");
  14199. for(int j= 0;j<itemList.size();j++)
  14200. {
  14201. QString item= itemList.at(j);
  14202. item.chop(1);
  14203. item= item.remove(0,1);
  14204. tablemodel->setData(tablemodel->index(j,0),
  14205. QVariant(item),Qt::DisplayRole);
  14206. }
  14207. }
  14208. else if(node.attribute("name")=="endtemps")
  14209. {
  14210. /*962:*/
  14211. #line 19662 "./typica.w"
  14212. QString data= node.attribute("value");
  14213. if(data.length()> 3)
  14214. {
  14215. data.chop(2);
  14216. data= data.remove(0,2);
  14217. }
  14218. QStringList itemList= data.split(",");
  14219. /*:962*/
  14220. #line 20095 "./typica.w"
  14221. int column= 1;
  14222. /*963:*/
  14223. #line 19674 "./typica.w"
  14224. for(int j= 0;j<itemList.size();j++)
  14225. {
  14226. tablemodel->setData(tablemodel->index(j,column),
  14227. QVariant(itemList.at(j).toDouble()),
  14228. Qt::DisplayRole);
  14229. }
  14230. /*:963*/
  14231. #line 20097 "./typica.w"
  14232. }
  14233. }
  14234. updateColumnName(trigger->text());
  14235. updateRangeData();
  14236. connect(trigger,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  14237. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateRangeData()));
  14238. setLayout(layout);
  14239. }
  14240. /*:976*//*977:*/
  14241. #line 20111 "./typica.w"
  14242. void MultiRangeTimerConfWidget::updateRangeData()
  14243. {
  14244. updateAttribute("rangenames",tablemodel->quotedArrayLiteral(0,Qt::DisplayRole));
  14245. updateAttribute("endtemps",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  14246. }
  14247. void MultiRangeTimerConfWidget::updateColumnName(const QString&text)
  14248. {
  14249. updateAttribute("trigger",text);
  14250. }
  14251. /*:977*/
  14252. #line 20131 "./typica.w"
  14253. /*:979*//*997:*/
  14254. #line 265 "./rate.w"
  14255. /*993:*/
  14256. #line 191 "./rate.w"
  14257. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  14258. :BasicDeviceConfigurationWidget(model,index)
  14259. {
  14260. QFormLayout*layout= new QFormLayout;
  14261. QLineEdit*column= new QLineEdit;
  14262. layout->addRow(tr("Primary series column name:"),column);
  14263. QSpinBox*cacheTime= new QSpinBox;
  14264. cacheTime->setMinimum(0);
  14265. cacheTime->setMaximum(300);
  14266. layout->addRow(tr("Cache time:"),cacheTime);
  14267. QSpinBox*scaleTime= new QSpinBox;
  14268. scaleTime->setMinimum(1);
  14269. scaleTime->setMaximum(300);
  14270. layout->addRow(tr("Scale time:"),scaleTime);
  14271. /*799:*/
  14272. #line 16574 "./typica.w"
  14273. QDomElement referenceElement=
  14274. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14275. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14276. QDomElement node;
  14277. /*:799*/
  14278. #line 206 "./rate.w"
  14279. for(int i= 0;i<configData.size();i++)
  14280. {
  14281. node= configData.at(i).toElement();
  14282. if(node.attribute("name")=="column")
  14283. {
  14284. column->setText(node.attribute("value"));
  14285. }
  14286. else if(node.attribute("name")=="cache")
  14287. {
  14288. cacheTime->setValue(node.attribute("value").toInt());
  14289. }
  14290. else if(node.attribute("name")=="scale")
  14291. {
  14292. scaleTime->setValue(node.attribute("value").toInt());
  14293. }
  14294. }
  14295. updateColumn(column->text());
  14296. updateCacheTime(cacheTime->text());
  14297. updateScaleTime(scaleTime->text());
  14298. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  14299. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  14300. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  14301. setLayout(layout);
  14302. }
  14303. /*:993*//*994:*/
  14304. #line 235 "./rate.w"
  14305. void RateOfChangeConfWidget::updateColumn(const QString&column)
  14306. {
  14307. updateAttribute("column",column);
  14308. }
  14309. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  14310. {
  14311. updateAttribute("cache",seconds);
  14312. }
  14313. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  14314. {
  14315. updateAttribute("scale",seconds);
  14316. }
  14317. /*:994*/
  14318. #line 266 "./rate.w"
  14319. #line 20238 "./typica.w"
  14320. #line 1 "./mergeseries.w"
  14321. /*:997*//*1011:*/
  14322. #line 282 "./mergeseries.w"
  14323. /*1007:*/
  14324. #line 183 "./mergeseries.w"
  14325. MergeSeriesConfWidget::MergeSeriesConfWidget(DeviceTreeModel*model,
  14326. const QModelIndex&index)
  14327. :BasicDeviceConfigurationWidget(model,index)
  14328. {
  14329. QFormLayout*layout= new QFormLayout;
  14330. QComboBox*type= new QComboBox;
  14331. type->addItem(tr("Difference"),QVariant("Difference"));
  14332. type->addItem(tr("Mean"),QVariant("Mean"));
  14333. layout->addRow(tr("Series type:"),type);
  14334. QLineEdit*column1= new QLineEdit;
  14335. layout->addRow(tr("First input column name:"),column1);
  14336. QLineEdit*column2= new QLineEdit;
  14337. layout->addRow(tr("Second input column name:"),column2);
  14338. QLineEdit*output= new QLineEdit;
  14339. layout->addRow(tr("Output column name:"),output);
  14340. /*799:*/
  14341. #line 16574 "./typica.w"
  14342. QDomElement referenceElement=
  14343. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14344. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14345. QDomElement node;
  14346. /*:799*/
  14347. #line 199 "./mergeseries.w"
  14348. for(int i= 0;i<configData.size();i++)
  14349. {
  14350. node= configData.at(i).toElement();
  14351. if(node.attribute("name")=="type")
  14352. {
  14353. type->setCurrentIndex(type->findData(node.attribute("value")));
  14354. }
  14355. else if(node.attribute("name")=="column1")
  14356. {
  14357. column1->setText(node.attribute("value"));
  14358. }
  14359. else if(node.attribute("name")=="column2")
  14360. {
  14361. column2->setText(node.attribute("value"));
  14362. }
  14363. else if(node.attribute("name")=="output")
  14364. {
  14365. output->setText(node.attribute("value"));
  14366. }
  14367. }
  14368. updateColumn1(column1->text());
  14369. updateColumn2(column2->text());
  14370. updateOutput(output->text());
  14371. updateType(type->currentIndex());
  14372. connect(column1,SIGNAL(textEdited(QString)),this,SLOT(updateColumn1(QString)));
  14373. connect(column2,SIGNAL(textEdited(QString)),this,SLOT(updateColumn2(QString)));
  14374. connect(output,SIGNAL(textEdited(QString)),this,SLOT(updateOutput(QString)));
  14375. connect(type,SIGNAL(currentIndexChanged(int)),this,SLOT(updateType(int)));
  14376. setLayout(layout);
  14377. }
  14378. /*:1007*//*1008:*/
  14379. #line 233 "./mergeseries.w"
  14380. void MergeSeriesConfWidget::updateColumn1(const QString&column)
  14381. {
  14382. updateAttribute("column1",column);
  14383. }
  14384. void MergeSeriesConfWidget::updateColumn2(const QString&column)
  14385. {
  14386. updateAttribute("column2",column);
  14387. }
  14388. void MergeSeriesConfWidget::updateOutput(const QString&column)
  14389. {
  14390. updateAttribute("output",column);
  14391. }
  14392. void MergeSeriesConfWidget::updateType(int index)
  14393. {
  14394. switch(index)
  14395. {
  14396. case 0:
  14397. updateAttribute("type","Difference");
  14398. break;
  14399. case 1:
  14400. updateAttribute("type","Mean");
  14401. break;
  14402. default:
  14403. break;
  14404. }
  14405. }
  14406. /*:1008*/
  14407. #line 283 "./mergeseries.w"
  14408. /*999:*/
  14409. #line 59 "./mergeseries.w"
  14410. void MergeSeries::in1(Measurement measure)
  14411. {
  14412. last1= measure;
  14413. received1= true;
  14414. if(received1&&received2)
  14415. {
  14416. calculate(last1,last2);
  14417. received1= false;
  14418. received2= false;
  14419. }
  14420. }
  14421. void MergeSeries::in2(Measurement measure)
  14422. {
  14423. last2= measure;
  14424. received2= true;
  14425. if(received1&&received2)
  14426. {
  14427. calculate(last1,last2);
  14428. received1= false;
  14429. received2= false;
  14430. }
  14431. }
  14432. /*:999*//*1000:*/
  14433. #line 86 "./mergeseries.w"
  14434. MergeSeries::MergeSeries():QObject(NULL),received1(false),received2(false)
  14435. {
  14436. }
  14437. /*:1000*//*1001:*/
  14438. #line 97 "./mergeseries.w"
  14439. void DifferenceSeries::calculate(Measurement m1,Measurement m2)
  14440. {
  14441. Measurement outval(m1.temperature()-m2.temperature(),
  14442. (m1.time()> m2.time()?m1.time():m2.time()));
  14443. outval.insert("relative",true);
  14444. emit newData(outval);
  14445. }
  14446. void MeanSeries::calculate(Measurement m1,Measurement m2)
  14447. {
  14448. Measurement outval((m1.temperature()+m2.temperature())/2,
  14449. (m1.time()> m2.time()?m1.time():m2.time()));
  14450. emit newData(outval);
  14451. }
  14452. /*:1001*//*1002:*/
  14453. #line 115 "./mergeseries.w"
  14454. DifferenceSeries::DifferenceSeries():MergeSeries()
  14455. {
  14456. }
  14457. MeanSeries::MeanSeries():MergeSeries()
  14458. {
  14459. }
  14460. /*:1002*/
  14461. #line 284 "./mergeseries.w"
  14462. #line 20240 "./typica.w"
  14463. #line 1 "./dataqsdk.w"
  14464. /*:1011*/
  14465. #line 529 "./typica.w"
  14466. /*8:*/
  14467. #line 675 "./typica.w"
  14468. template<class TYPE> TYPE getself(QScriptContext*context)
  14469. {
  14470. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  14471. return self;
  14472. }
  14473. template<> QTime getself(QScriptContext*context)
  14474. {
  14475. QTime self= context->thisObject().toVariant().toTime();
  14476. return self;
  14477. }
  14478. template<> QByteArray getself(QScriptContext*context)
  14479. {
  14480. QByteArray self= context->thisObject().toVariant().toByteArray();
  14481. return self;
  14482. }
  14483. template<> SqlQueryConnection*getself(QScriptContext*context)
  14484. {
  14485. SqlQueryConnection*self=
  14486. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  14487. return self;
  14488. }
  14489. template<> QXmlQuery*getself(QScriptContext*context)
  14490. {
  14491. QXmlQuery*self=
  14492. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  14493. return self;
  14494. }
  14495. template<> QXmlStreamWriter*getself(QScriptContext*context)
  14496. {
  14497. QXmlStreamWriter*self=
  14498. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  14499. return self;
  14500. }
  14501. template<> QXmlStreamReader*getself(QScriptContext*context)
  14502. {
  14503. QXmlStreamReader*self=
  14504. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  14505. return self;
  14506. }
  14507. /*:8*//*9:*/
  14508. #line 726 "./typica.w"
  14509. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  14510. {
  14511. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  14512. return argument;
  14513. }
  14514. template<> QString argument(int arg,QScriptContext*context)
  14515. {
  14516. return context->argument(arg).toString();
  14517. }
  14518. template<> QVariant argument(int arg,QScriptContext*context)
  14519. {
  14520. return context->argument(arg).toVariant();
  14521. }
  14522. template<> int argument(int arg,QScriptContext*context)
  14523. {
  14524. return context->argument(arg).toInt32();
  14525. }
  14526. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  14527. {
  14528. return(SqlQueryConnection*)
  14529. qscriptvalue_cast<void*> (context->argument(arg));
  14530. }
  14531. template<> QModelIndex argument(int arg,QScriptContext*context)
  14532. {
  14533. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  14534. }
  14535. template<> double argument(int arg,QScriptContext*context)
  14536. {
  14537. return(double)(context->argument(arg).toNumber());
  14538. }
  14539. template<> Units::Unit argument(int arg,QScriptContext*context)
  14540. {
  14541. return(Units::Unit)(context->argument(arg).toInt32());
  14542. }
  14543. template<> QByteArray argument(int arg,QScriptContext*context)
  14544. {
  14545. return qscriptvalue_cast<QByteArray> (context->argument(arg));
  14546. }
  14547. /*:9*//*13:*/
  14548. #line 820 "./typica.w"
  14549. void setQObjectProperties(QScriptValue value,QScriptEngine*engine)
  14550. {
  14551. value.setProperty("setProperty",engine->newFunction(QObject_setProperty));
  14552. }
  14553. QScriptValue QObject_setProperty(QScriptContext*context,QScriptEngine*)
  14554. {
  14555. QObject*self= getself<QObject*> (context);
  14556. self->setProperty(argument<QString> (0,context).toUtf8().constData(),
  14557. argument<QVariant> (1,context));
  14558. return QScriptValue();
  14559. }
  14560. /*:13*//*15:*/
  14561. #line 842 "./typica.w"
  14562. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  14563. {
  14564. }
  14565. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  14566. {
  14567. }
  14568. /*:15*//*18:*/
  14569. #line 874 "./typica.w"
  14570. void setQTimerProperties(QScriptValue value,QScriptEngine*engine)
  14571. {
  14572. setQObjectProperties(value,engine);
  14573. }
  14574. QScriptValue constructQTimer(QScriptContext*,QScriptEngine*engine)
  14575. {
  14576. QScriptValue object= engine->newQObject(new QTimer);
  14577. setQTimerProperties(object,engine);
  14578. return object;
  14579. }
  14580. /*:18*//*21:*/
  14581. #line 916 "./typica.w"
  14582. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  14583. {
  14584. QScriptValue object= engine->newQObject(new QWidget);
  14585. setQWidgetProperties(object,engine);
  14586. return object;
  14587. }
  14588. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  14589. {
  14590. setQObjectProperties(value,engine);
  14591. setQPaintDeviceProperties(value,engine);
  14592. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  14593. value.setProperty("activateWindow",
  14594. engine->newFunction(QWidget_activateWindow));
  14595. }
  14596. /*:21*//*22:*/
  14597. #line 938 "./typica.w"
  14598. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  14599. {
  14600. if(context->argumentCount()==1)
  14601. {
  14602. QWidget*self= getself<QWidget*> (context);
  14603. QLayout*layout= argument<QLayout*> (0,context);
  14604. if(layout)
  14605. {
  14606. self->setLayout(layout);
  14607. }
  14608. else
  14609. {
  14610. context->throwError("Incorrect argument type passed to "
  14611. "QWidget::setLayout(). This method requires "
  14612. "a QLayout.");
  14613. }
  14614. }
  14615. else
  14616. {
  14617. context->throwError("Incorrect number of arguments passed to "
  14618. "QWidget::setLayout(). This method takes one "
  14619. "QLayout as an argument.");
  14620. }
  14621. return QScriptValue();
  14622. }
  14623. QScriptValue QWidget_activateWindow(QScriptContext*context,
  14624. QScriptEngine*)
  14625. {
  14626. QWidget*self= getself<QWidget*> (context);
  14627. self->activateWindow();
  14628. return QScriptValue();
  14629. }
  14630. /*:22*//*25:*/
  14631. #line 1000 "./typica.w"
  14632. QScriptValue displayWarning(QScriptContext*context,QScriptEngine*)
  14633. {
  14634. QMessageBox::StandardButton selection= QMessageBox::warning(NULL,
  14635. argument<QString> (0,context),
  14636. argument<QString> (1,context),
  14637. QMessageBox::Ok|QMessageBox::Cancel);
  14638. if(selection==QMessageBox::Ok){
  14639. return QScriptValue(true);
  14640. }
  14641. return QScriptValue(false);
  14642. }
  14643. QScriptValue displayError(QScriptContext*context,QScriptEngine*)
  14644. {
  14645. QMessageBox::critical(NULL,argument<QString> (0,context),
  14646. argument<QString> (1,context));
  14647. return QScriptValue();
  14648. }
  14649. /*:25*//*27:*/
  14650. #line 1078 "./typica.w"
  14651. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  14652. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  14653. {
  14654. }
  14655. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  14656. {
  14657. QSettings settings;
  14658. settings.beginGroup(key);
  14659. settings.setValue("pos",pos());
  14660. settings.setValue("size",size());
  14661. settings.endGroup();
  14662. }
  14663. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  14664. {
  14665. QSettings settings;
  14666. settings.beginGroup(key);
  14667. if(settings.contains("size"))
  14668. {
  14669. resize(settings.value("size").toSize());
  14670. }
  14671. if(settings.contains("pos"))
  14672. {
  14673. move(settings.value("pos").toPoint());
  14674. }
  14675. settings.endGroup();
  14676. }
  14677. void ScriptQMainWindow::displayStatus(const QString&message)
  14678. {
  14679. statusBar()->showMessage(message);
  14680. }
  14681. void ScriptQMainWindow::showEvent(QShowEvent*event)
  14682. {
  14683. if(!event->spontaneous())
  14684. {
  14685. /*32:*/
  14686. #line 1195 "./typica.w"
  14687. QSettings settings;
  14688. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  14689. toByteArray());
  14690. /*:32*/
  14691. #line 1118 "./typica.w"
  14692. event->accept();
  14693. }
  14694. else
  14695. {
  14696. event->ignore();
  14697. }
  14698. }
  14699. void ScriptQMainWindow::show()
  14700. {
  14701. QMainWindow::show();
  14702. }
  14703. void ScriptQMainWindow::setupFinished()
  14704. {
  14705. emit windowReady();
  14706. }
  14707. /*:27*//*28:*/
  14708. #line 1144 "./typica.w"
  14709. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  14710. {
  14711. if(isWindowModified()){
  14712. /*29:*/
  14713. #line 1158 "./typica.w"
  14714. QMessageBox::StandardButton result;
  14715. result= QMessageBox::warning(this,"Typica",closePrompt(),
  14716. QMessageBox::Ok|QMessageBox::Cancel);
  14717. if(result==QMessageBox::Cancel)
  14718. {
  14719. event->ignore();
  14720. return;
  14721. }
  14722. /*:29*/
  14723. #line 1148 "./typica.w"
  14724. }
  14725. emit aboutToClose();
  14726. /*31:*/
  14727. #line 1189 "./typica.w"
  14728. QSettings settings;
  14729. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  14730. /*:31*/
  14731. #line 1151 "./typica.w"
  14732. event->accept();
  14733. }
  14734. /*:28*//*30:*/
  14735. #line 1170 "./typica.w"
  14736. QString ScriptQMainWindow::closePrompt()
  14737. {
  14738. return cprompt;
  14739. }
  14740. void ScriptQMainWindow::setClosePrompt(QString prompt)
  14741. {
  14742. cprompt= prompt;
  14743. }
  14744. /*:30*//*35:*/
  14745. #line 1223 "./typica.w"
  14746. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  14747. {
  14748. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  14749. setQMainWindowProperties(object,engine);
  14750. return object;
  14751. }
  14752. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  14753. {
  14754. setQWidgetProperties(value,engine);
  14755. value.setProperty("setCentralWidget",
  14756. engine->newFunction(QMainWindow_setCentralWidget));
  14757. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  14758. }
  14759. /*:35*//*36:*/
  14760. #line 1245 "./typica.w"
  14761. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  14762. QScriptEngine*)
  14763. {
  14764. if(context->argumentCount()==1)
  14765. {
  14766. QMainWindow*self= getself<QMainWindow*> (context);
  14767. QWidget*widget= argument<QWidget*> (0,context);
  14768. if(widget)
  14769. {
  14770. self->setCentralWidget(widget);
  14771. }
  14772. else
  14773. {
  14774. context->throwError("Incorrect argument type passed to "
  14775. "QMainWindow::setCentralWidget(). This "
  14776. "method requires a QWidget.");
  14777. }
  14778. }
  14779. else
  14780. {
  14781. context->throwError("Incorrect number of arguments passed to "
  14782. "QMainWindow::setCentralWidget(). This method "
  14783. "takes one QWidget as an argument.");
  14784. }
  14785. return QScriptValue();
  14786. }
  14787. /*:36*//*37:*/
  14788. #line 1279 "./typica.w"
  14789. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  14790. {
  14791. QScriptValue object;
  14792. if(context->argumentCount()==0)
  14793. {
  14794. QMainWindow*self= getself<QMainWindow*> (context);
  14795. QMenuBar*bar= self->menuBar();
  14796. object= engine->newQObject(bar);
  14797. setQMenuBarProperties(object,engine);
  14798. }
  14799. else
  14800. {
  14801. context->throwError("Incorrect number of arguments passed to "
  14802. "QMainWindow::menuBar(). This method takes no "
  14803. "arguments.");
  14804. }
  14805. return object;
  14806. }
  14807. /*:37*//*39:*/
  14808. #line 1309 "./typica.w"
  14809. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  14810. {
  14811. setQWidgetProperties(value,engine);
  14812. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  14813. }
  14814. /*:39*//*40:*/
  14815. #line 1324 "./typica.w"
  14816. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  14817. {
  14818. QScriptValue object;
  14819. if(context->argumentCount()==1)
  14820. {
  14821. QMenuBar*self= getself<QMenuBar*> (context);
  14822. QString title= argument<QString> (0,context);
  14823. object= engine->newQObject(self->addMenu(title));
  14824. setQMenuProperties(object,engine);
  14825. }
  14826. else
  14827. {
  14828. context->throwError("Incorrect number of arguments passed to "
  14829. "QMenuBar::addMenu(). This method takes one "
  14830. "string as an argument.");
  14831. }
  14832. return object;
  14833. }
  14834. /*:40*//*42:*/
  14835. #line 1354 "./typica.w"
  14836. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  14837. {
  14838. setQWidgetProperties(value,engine);
  14839. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  14840. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  14841. }
  14842. /*:42*//*43:*/
  14843. #line 1364 "./typica.w"
  14844. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  14845. {
  14846. if(context->argumentCount()==1)
  14847. {
  14848. QMenu*self= getself<QMenu*> (context);
  14849. QAction*action= argument<QAction*> (0,context);
  14850. if(action)
  14851. {
  14852. self->addAction(action);
  14853. }
  14854. else
  14855. {
  14856. context->throwError("Incorrect argument type passed to "
  14857. "QMenu::addAction(). This method requires a "
  14858. "QAction.");
  14859. }
  14860. }
  14861. else
  14862. {
  14863. context->throwError("Incorrect number of arguments passed to "
  14864. "QMenu::addAction(). This method takes one "
  14865. "QAction as an argument.");
  14866. }
  14867. return QScriptValue();
  14868. }
  14869. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  14870. {
  14871. if(context->argumentCount()==0)
  14872. {
  14873. QMenu*self= getself<QMenu*> (context);
  14874. self->addSeparator();
  14875. }
  14876. else
  14877. {
  14878. context->throwError("Incorrect number of arguments passed to "
  14879. "QMenu::addSeparator(). This method takes no "
  14880. "arguments.");
  14881. }
  14882. return QScriptValue();
  14883. }
  14884. /*:43*//*46:*/
  14885. #line 1426 "./typica.w"
  14886. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  14887. {
  14888. QScriptValue object= engine->newQObject(new QFrame);
  14889. setQFrameProperties(object,engine);
  14890. return object;
  14891. }
  14892. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  14893. {
  14894. setQWidgetProperties(value,engine);
  14895. }
  14896. /*:46*//*49:*/
  14897. #line 1460 "./typica.w"
  14898. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  14899. {
  14900. QString text;
  14901. if(context->argumentCount()==1)
  14902. {
  14903. text= argument<QString> (0,context);
  14904. }
  14905. QScriptValue object= engine->newQObject(new QLabel(text));
  14906. setQLabelProperties(object,engine);
  14907. return object;
  14908. }
  14909. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  14910. {
  14911. setQFrameProperties(value,engine);
  14912. }
  14913. /*:49*//*52:*/
  14914. #line 1502 "./typica.w"
  14915. QScriptValue constructQSvgWidget(QScriptContext*,
  14916. QScriptEngine*engine)
  14917. {
  14918. QScriptValue object= engine->newQObject(new QSvgWidget);
  14919. setQSvgWidgetProperties(object,engine);
  14920. return object;
  14921. }
  14922. /*:52*//*53:*/
  14923. #line 1513 "./typica.w"
  14924. void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine)
  14925. {
  14926. setQWidgetProperties(value,engine);
  14927. value.setProperty("loadDevice",
  14928. engine->newFunction(QSvgWidget_loadDevice));
  14929. }
  14930. QScriptValue QSvgWidget_loadDevice(QScriptContext*context,QScriptEngine*)
  14931. {
  14932. if(context->argumentCount()==1)
  14933. {
  14934. QSvgWidget*self= getself<QSvgWidget*> (context);
  14935. QIODevice*device= argument<QIODevice*> (0,context);
  14936. device->reset();
  14937. QByteArray data= device->readAll();
  14938. self->load(data);
  14939. }
  14940. else
  14941. {
  14942. context->throwError("Incorrect number of arguments passed to "
  14943. "QSvgWidget::loadData(). This method takes one "
  14944. "QIODevice as an argument.");
  14945. }
  14946. return QScriptValue();
  14947. }
  14948. /*:53*//*55:*/
  14949. #line 1551 "./typica.w"
  14950. void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *,
  14951. QStack<QLayout*> *layoutStack)
  14952. {
  14953. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14954. QSvgWidget*widget= new QSvgWidget;
  14955. layout->addWidget(widget);
  14956. QString id= element.attribute("id");
  14957. if(!id.isEmpty())
  14958. {
  14959. widget->setObjectName(id);
  14960. }
  14961. }
  14962. /*:55*//*58:*/
  14963. #line 1584 "./typica.w"
  14964. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  14965. {
  14966. QScriptValue object= engine->newQObject(new QLineEdit());
  14967. setQLineEditProperties(object,engine);
  14968. return object;
  14969. }
  14970. /*:58*//*59:*/
  14971. #line 1595 "./typica.w"
  14972. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  14973. {
  14974. setQWidgetProperties(value,engine);
  14975. }
  14976. /*:59*//*62:*/
  14977. #line 1631 "./typica.w"
  14978. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  14979. {
  14980. QScriptValue object= engine->newQObject(new QSplitter);
  14981. setQSplitterProperties(object,engine);
  14982. return object;
  14983. }
  14984. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  14985. {
  14986. setQFrameProperties(value,engine);
  14987. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  14988. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  14989. value.setProperty("restoreState",
  14990. engine->newFunction(QSplitter_restoreState));
  14991. value.setProperty("count",engine->newFunction(QSplitter_count));
  14992. }
  14993. /*:62*//*63:*/
  14994. #line 1652 "./typica.w"
  14995. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  14996. {
  14997. if(context->argumentCount()==1)
  14998. {
  14999. QSplitter*self= getself<QSplitter*> (context);
  15000. QWidget*widget= argument<QWidget*> (0,context);
  15001. if(widget)
  15002. {
  15003. self->addWidget(widget);
  15004. }
  15005. else
  15006. {
  15007. context->throwError("Incorrect argument type passed to "
  15008. "QSplitter::addWidget(). This method "
  15009. "requires a QWidget.");
  15010. }
  15011. }
  15012. else
  15013. {
  15014. context->throwError("Incorrect number of arguments passed to "
  15015. "QSplitter::addWidget(). This method takes one "
  15016. "QWidget as an argument.");
  15017. }
  15018. return QScriptValue();
  15019. }
  15020. /*:63*//*64:*/
  15021. #line 1689 "./typica.w"
  15022. QScriptValue QSplitter_count(QScriptContext*context,QScriptEngine*)
  15023. {
  15024. QSplitter*self= getself<QSplitter*> (context);
  15025. return QScriptValue(self->count());
  15026. }
  15027. /*:64*//*65:*/
  15028. #line 1702 "./typica.w"
  15029. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  15030. {
  15031. if(context->argumentCount()==1)
  15032. {
  15033. QSplitter*self= getself<QSplitter*> (context);
  15034. QString key= argument<QString> (0,context);
  15035. QSettings settings;
  15036. settings.setValue(key,self->saveState());
  15037. }
  15038. else
  15039. {
  15040. context->throwError("Incorrect number of arguments passed to "
  15041. "QSplitter::saveState(). This method takes one "
  15042. "string as an argument.");
  15043. }
  15044. return QScriptValue();
  15045. }
  15046. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  15047. {
  15048. if(context->argumentCount()==1)
  15049. {
  15050. QSplitter*self= getself<QSplitter*> (context);
  15051. QString key= argument<QString> (0,context);
  15052. QSettings settings;
  15053. self->restoreState(settings.value(key).toByteArray());
  15054. }
  15055. else
  15056. {
  15057. context->throwError("Incorrect number of arguments passed to "
  15058. "QSplitter::restoreState(). This method takes "
  15059. "one string as an argument.");
  15060. }
  15061. return QScriptValue();
  15062. }
  15063. /*:65*//*67:*/
  15064. #line 1755 "./typica.w"
  15065. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  15066. {
  15067. setQLayoutItemProperties(value,engine);
  15068. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  15069. }
  15070. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  15071. {
  15072. if(context->argumentCount()==1)
  15073. {
  15074. QLayout*self= getself<QLayout*> (context);
  15075. QWidget*widget= argument<QWidget*> (0,context);
  15076. if(widget)
  15077. {
  15078. self->addWidget(widget);
  15079. }
  15080. else
  15081. {
  15082. context->throwError("Incorrect argument type passed to "
  15083. "QLayout::addWidget(). This method requires "
  15084. "a QWidget.");
  15085. }
  15086. }
  15087. else
  15088. {
  15089. context->throwError("Incorrect number of arguments passed to "
  15090. "QLayout::addWidget(). This method takes one "
  15091. "QWidget as an argument.");
  15092. }
  15093. return QScriptValue();
  15094. }
  15095. /*:67*//*70:*/
  15096. #line 1822 "./typica.w"
  15097. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  15098. {
  15099. QScriptValue object=
  15100. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  15101. setQBoxLayoutProperties(object,engine);
  15102. return object;
  15103. }
  15104. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  15105. {
  15106. setQLayoutProperties(value,engine);
  15107. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  15108. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  15109. }
  15110. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  15111. {
  15112. if(context->argumentCount()> 0&&context->argumentCount()<3)
  15113. {
  15114. QBoxLayout*self= getself<QBoxLayout*> (context);
  15115. QLayout*layout= argument<QLayout*> (0,context);
  15116. int stretch= 0;
  15117. if(context->argumentCount()==2)
  15118. {
  15119. stretch= argument<int> (1,context);
  15120. }
  15121. if(layout)
  15122. {
  15123. self->addLayout(layout,stretch);
  15124. }
  15125. else
  15126. {
  15127. context->throwError("Incorrect argument type passed to "
  15128. "QLayout::addLayout(). This method requires "
  15129. "a QLayout.");
  15130. }
  15131. }
  15132. else
  15133. {
  15134. context->throwError("Incorrect number of arguments passed to "
  15135. "QLayout::addLayout(). This method takes one "
  15136. "QLayout as an argument and optionally one integer.");
  15137. }
  15138. return QScriptValue();
  15139. }
  15140. /*:70*//*71:*/
  15141. #line 1873 "./typica.w"
  15142. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  15143. {
  15144. if(context->argumentCount()> 0&&context->argumentCount()<4)
  15145. {
  15146. QBoxLayout*self= getself<QBoxLayout*> (context);
  15147. QWidget*widget= argument<QWidget*> (0,context);
  15148. int stretch= 0;
  15149. Qt::Alignment alignment= 0;
  15150. if(context->argumentCount()> 1)
  15151. {
  15152. stretch= argument<int> (1,context);
  15153. }
  15154. if(context->argumentCount()> 2)
  15155. {
  15156. alignment= (Qt::Alignment)(argument<int> (2,context));
  15157. }
  15158. if(widget)
  15159. {
  15160. self->addWidget(widget,stretch,alignment);
  15161. }
  15162. else
  15163. {
  15164. context->throwError("Incorrect argument type passed to "
  15165. "QBoxLayout::addWidget(). This method requires "
  15166. "a QWidget.");
  15167. }
  15168. }
  15169. else
  15170. {
  15171. context->throwError("Incorrect number of arguments passed to "
  15172. "QBoxLayout::addWidget(). This method takes one "
  15173. "QWidget and optionally up to two integers as "
  15174. "arguments.");
  15175. }
  15176. return QScriptValue();
  15177. }
  15178. /*:71*//*74:*/
  15179. #line 1937 "./typica.w"
  15180. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  15181. {
  15182. QScriptValue object= engine->newQObject(new QAction(NULL));
  15183. setQActionProperties(object,engine);
  15184. return object;
  15185. }
  15186. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  15187. {
  15188. setQObjectProperties(value,engine);
  15189. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  15190. }
  15191. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  15192. {
  15193. if(context->argumentCount()==1)
  15194. {
  15195. QAction*self= getself<QAction*> (context);
  15196. self->setShortcut(argument<QString> (0,context));
  15197. }
  15198. else
  15199. {
  15200. context->throwError("Incorrect number of arguments passed to "
  15201. "QAction::setShortcut(). This method takes one "
  15202. "string as an argument.");
  15203. }
  15204. return QScriptValue();
  15205. }
  15206. /*:74*//*77:*/
  15207. #line 1995 "./typica.w"
  15208. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  15209. QScriptEngine*engine)
  15210. {
  15211. QScriptValue retval;
  15212. if(context->argumentCount()==3)
  15213. {
  15214. QWidget*widget= argument<QWidget*> (0,context);
  15215. if(widget)
  15216. {
  15217. QString caption= argument<QString> (1,context);
  15218. QString dir= argument<QString> (2,context);
  15219. retval= QScriptValue(engine,
  15220. QFileDialog::getOpenFileName(widget,caption,
  15221. dir,"",0,0));
  15222. setQFileDialogProperties(retval,engine);
  15223. }
  15224. else
  15225. {
  15226. context->throwError("Incorrect argument type passed to "
  15227. "QFileDialog::getOpenFileName(). The first "
  15228. "argument to this method must be a QWidget.");
  15229. }
  15230. }
  15231. else
  15232. {
  15233. context->throwError("Incorrect number of arguments passed to "
  15234. "QFileDialog::getOpenFileName(). This method "
  15235. "takes one QWidget followed by two strings for a "
  15236. "total of three arguments.");
  15237. }
  15238. return retval;
  15239. }
  15240. /*:77*//*78:*/
  15241. #line 2031 "./typica.w"
  15242. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  15243. QScriptEngine*engine)
  15244. {
  15245. QScriptValue retval;
  15246. if(context->argumentCount()==3)
  15247. {
  15248. QWidget*widget= argument<QWidget*> (0,context);
  15249. if(widget)
  15250. {
  15251. QString caption= argument<QString> (1,context);
  15252. QString dir= argument<QString> (2,context);
  15253. retval= QScriptValue(engine,
  15254. QFileDialog::getSaveFileName(widget,caption,
  15255. dir,"",0,0));
  15256. setQFileDialogProperties(retval,engine);
  15257. }
  15258. else
  15259. {
  15260. context->throwError("Incorrect argument type passed to "
  15261. "QFileDialog::getSaveFileName(). The first "
  15262. "argument to this method must be a QWidget.");
  15263. }
  15264. }
  15265. else
  15266. {
  15267. context->throwError("Incorrect number of arguments passed to "
  15268. "QFileDialog::getSaveFileName(). This method "
  15269. "takes one QWidget followed by two strings for a "
  15270. "total of three arguments.");
  15271. }
  15272. return retval;
  15273. }
  15274. /*:78*//*79:*/
  15275. #line 2068 "./typica.w"
  15276. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  15277. {
  15278. setQDialogProperties(value,engine);
  15279. }
  15280. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  15281. {
  15282. setQWidgetProperties(value,engine);
  15283. }
  15284. /*:79*//*82:*/
  15285. #line 2109 "./typica.w"
  15286. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  15287. {
  15288. QScriptValue object=
  15289. engine->newQObject(new QFile(argument<QString> (0,context)));
  15290. setQFileProperties(object,engine);
  15291. return object;
  15292. }
  15293. /*:82*//*83:*/
  15294. #line 2120 "./typica.w"
  15295. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  15296. {
  15297. setQIODeviceProperties(value,engine);
  15298. value.setProperty("remove",engine->newFunction(QFile_remove));
  15299. }
  15300. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  15301. {
  15302. QFile*self= getself<QFile*> (context);
  15303. bool retval= self->remove();
  15304. return QScriptValue(engine,retval);
  15305. }
  15306. /*:83*//*84:*/
  15307. #line 2142 "./typica.w"
  15308. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  15309. {
  15310. setQObjectProperties(value,engine);
  15311. value.setProperty("open",engine->newFunction(QIODevice_open));
  15312. value.setProperty("close",engine->newFunction(QIODevice_close));
  15313. value.setProperty("readToString",
  15314. engine->newFunction(QIODevice_readToString));
  15315. value.setProperty("putChar",engine->newFunction(QIODevice_putChar));
  15316. value.setProperty("writeString",engine->newFunction(QIODevice_writeString));
  15317. value.setProperty("writeBytes",engine->newFunction(QIODevice_writeBytes));
  15318. value.setProperty("readBytes",engine->newFunction(QIODevice_readBytes));
  15319. value.setProperty("peek",engine->newFunction(QIODevice_peek));
  15320. value.setProperty("read",engine->newFunction(QIODevice_read));
  15321. }
  15322. /*:84*//*85:*/
  15323. #line 2163 "./typica.w"
  15324. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  15325. {
  15326. QIODevice*self= getself<QIODevice*> (context);
  15327. bool retval= false;
  15328. if(context->argumentCount()==1)
  15329. {
  15330. switch(argument<int> (0,context))
  15331. {
  15332. case 1:
  15333. retval= self->open(QIODevice::ReadOnly);
  15334. break;
  15335. case 2:
  15336. retval= self->open(QIODevice::WriteOnly);
  15337. break;
  15338. case 3:
  15339. retval= self->open(QIODevice::ReadWrite);
  15340. break;
  15341. default:
  15342. break;
  15343. }
  15344. }
  15345. else
  15346. {
  15347. retval= self->open(QIODevice::ReadWrite);
  15348. }
  15349. return QScriptValue(retval);
  15350. }
  15351. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  15352. {
  15353. QIODevice*self= getself<QIODevice*> (context);
  15354. self->close();
  15355. return QScriptValue();
  15356. }
  15357. /*:85*//*86:*/
  15358. #line 2203 "./typica.w"
  15359. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  15360. {
  15361. QIODevice*self= getself<QIODevice*> (context);
  15362. self->reset();
  15363. return QScriptValue(QString(self->readAll()));
  15364. }
  15365. /*:86*//*87:*/
  15366. #line 2219 "./typica.w"
  15367. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*)
  15368. {
  15369. QIODevice*self= getself<QIODevice*> (context);
  15370. if(context->argumentCount()==1)
  15371. {
  15372. return QScriptValue(self->putChar(argument<QString> (0,context).toUtf8().at(0)));
  15373. }
  15374. context->throwError("Incorrect number of arguments passed to "
  15375. "QIODevice::putChar()");
  15376. return QScriptValue();
  15377. }
  15378. /*:87*//*88:*/
  15379. #line 2237 "./typica.w"
  15380. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*)
  15381. {
  15382. QIODevice*self= getself<QIODevice*> (context);
  15383. if(context->argumentCount()==1)
  15384. {
  15385. self->write(argument<QString> (0,context).toUtf8());
  15386. }
  15387. else
  15388. {
  15389. context->throwError("Incorrect number of arguments passed to "
  15390. "QIODevice::writeString()");
  15391. }
  15392. return QScriptValue();
  15393. }
  15394. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*)
  15395. {
  15396. QIODevice*self= getself<QIODevice*> (context);
  15397. if(context->argumentCount()==1)
  15398. {
  15399. self->write(argument<QByteArray> (0,context));
  15400. }
  15401. else
  15402. {
  15403. context->throwError("Incorrect number of arguments passed to "
  15404. "QIODevice::writeBytes()");
  15405. }
  15406. return QScriptValue();
  15407. }
  15408. /*:88*//*89:*/
  15409. #line 2271 "./typica.w"
  15410. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine)
  15411. {
  15412. QIODevice*self= getself<QIODevice*> (context);
  15413. QScriptValue value= engine->toScriptValue<QByteArray> (self->readAll());
  15414. setQByteArrayProperties(value,engine);
  15415. return value;
  15416. }
  15417. /*:89*//*90:*/
  15418. #line 2282 "./typica.w"
  15419. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine)
  15420. {
  15421. QIODevice*self= getself<QIODevice*> (context);
  15422. QScriptValue value= engine->toScriptValue<QByteArray> (
  15423. self->peek(argument<int> (0,context)));
  15424. setQByteArrayProperties(value,engine);
  15425. return value;
  15426. }
  15427. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine)
  15428. {
  15429. QIODevice*self= getself<QIODevice*> (context);
  15430. QScriptValue value= engine->toScriptValue<QByteArray> (
  15431. self->read(argument<int> (0,context)));
  15432. setQByteArrayProperties(value,engine);
  15433. return value;
  15434. }
  15435. /*:90*//*93:*/
  15436. #line 2327 "./typica.w"
  15437. QScriptValue constructQProcess(QScriptContext*,QScriptEngine*engine)
  15438. {
  15439. QScriptValue object= engine->newQObject(new QProcess);
  15440. setQProcessProperties(object,engine);
  15441. return object;
  15442. }
  15443. /*:93*//*94:*/
  15444. #line 2338 "./typica.w"
  15445. void setQProcessProperties(QScriptValue value,QScriptEngine*engine)
  15446. {
  15447. setQIODeviceProperties(value,engine);
  15448. value.setProperty("execute",engine->newFunction(QProcess_execute));
  15449. value.setProperty("startDetached",engine->newFunction(QProcess_startDetached));
  15450. value.setProperty("setWorkingDirectory",engine->newFunction(QProcess_setWorkingDirectory));
  15451. value.setProperty("start",engine->newFunction(QProcess_start));
  15452. }
  15453. /*:94*//*95:*/
  15454. #line 2352 "./typica.w"
  15455. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*)
  15456. {
  15457. QProcess*self= getself<QProcess*> (context);
  15458. QString program= argument<QString> (0,context);
  15459. QStringList arguments= QStringList();
  15460. if(context->argumentCount()> 1){
  15461. arguments= argument<QVariant> (1,context).toStringList();
  15462. }
  15463. int retval= self->execute(program,arguments);
  15464. return QScriptValue(retval);
  15465. }
  15466. /*:95*//*96:*/
  15467. #line 2367 "./typica.w"
  15468. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*)
  15469. {
  15470. QProcess*self= getself<QProcess*> (context);
  15471. QString program= argument<QString> (0,context);
  15472. QStringList arguments= QStringList();
  15473. if(context->argumentCount()> 1){
  15474. arguments= argument<QVariant> (1,context).toStringList();
  15475. }
  15476. QString workingDirectory= "";
  15477. if(context->argumentCount()> 2){
  15478. workingDirectory= argument<QString> (2,context);
  15479. }
  15480. bool retval;
  15481. switch(context->argumentCount())
  15482. {
  15483. case 1:
  15484. retval= self->startDetached(program);
  15485. break;
  15486. case 2:
  15487. retval= self->startDetached(program,arguments);
  15488. break;
  15489. case 3:
  15490. retval= self->startDetached(program,arguments,workingDirectory);
  15491. break;
  15492. default:
  15493. retval= false;
  15494. }
  15495. return QScriptValue(retval);
  15496. }
  15497. /*:96*//*97:*/
  15498. #line 2400 "./typica.w"
  15499. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*)
  15500. {
  15501. QProcess*self= getself<QProcess*> (context);
  15502. QString directory= argument<QString> (0,context);
  15503. self->setWorkingDirectory(directory);
  15504. return QScriptValue();
  15505. }
  15506. /*:97*//*98:*/
  15507. #line 2412 "./typica.w"
  15508. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*)
  15509. {
  15510. QProcess*self= getself<QProcess*> (context);
  15511. QString program= argument<QString> (0,context);
  15512. QStringList arguments= QStringList();
  15513. if(context->argumentCount()> 1){
  15514. arguments= argument<QVariant> (1,context).toStringList();
  15515. }
  15516. self->start(program,arguments);
  15517. return QScriptValue();
  15518. }
  15519. /*:98*//*100:*/
  15520. #line 2453 "./typica.w"
  15521. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes)
  15522. {
  15523. QScriptValue object= engine->newVariant(QVariant(bytes));
  15524. setQByteArrayProperties(object,engine);
  15525. return object;
  15526. }
  15527. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes)
  15528. {
  15529. bytes= value.toVariant().toByteArray();
  15530. }
  15531. /*:100*//*102:*/
  15532. #line 2476 "./typica.w"
  15533. QScriptValue constructQByteArray(QScriptContext*,QScriptEngine*engine)
  15534. {
  15535. QScriptValue object= engine->toScriptValue<QByteArray> (QByteArray());
  15536. setQByteArrayProperties(object,engine);
  15537. return object;
  15538. }
  15539. /*:102*//*103:*/
  15540. #line 2487 "./typica.w"
  15541. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine)
  15542. {
  15543. value.setProperty("fromHex",engine->newFunction(QByteArray_fromHex));
  15544. value.setProperty("getAt",engine->newFunction(QByteArray_getAt));
  15545. value.setProperty("setAt",engine->newFunction(QByteArray_setAt));
  15546. value.setProperty("appendBytes",engine->newFunction(QByteArray_appendBytes));
  15547. value.setProperty("appendString",engine->newFunction(QByteArray_appendString));
  15548. value.setProperty("size",engine->newFunction(QByteArray_size));
  15549. value.setProperty("left",engine->newFunction(QByteArray_left));
  15550. value.setProperty("right",engine->newFunction(QByteArray_right));
  15551. value.setProperty("mid",engine->newFunction(QByteArray_mid));
  15552. value.setProperty("chop",engine->newFunction(QByteArray_chop));
  15553. value.setProperty("remove",engine->newFunction(QByteArray_remove));
  15554. value.setProperty("toInt8",engine->newFunction(QByteArray_toInt8));
  15555. value.setProperty("toInt16",engine->newFunction(QByteArray_toInt16));
  15556. value.setProperty("toInt32",engine->newFunction(QByteArray_toInt32));
  15557. value.setProperty("toFloat",engine->newFunction(QByteArray_toFloat));
  15558. value.setProperty("toDouble",engine->newFunction(QByteArray_toDouble));
  15559. }
  15560. /*:103*//*104:*/
  15561. #line 2511 "./typica.w"
  15562. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine)
  15563. {
  15564. QByteArray self= getself<QByteArray> (context);
  15565. QByteArray retval;
  15566. retval= self.fromHex(argument<QString> (0,context).toUtf8());
  15567. QScriptValue value= engine->toScriptValue<QByteArray> (retval);
  15568. setQByteArrayProperties(value,engine);
  15569. return value;
  15570. }
  15571. /*:104*//*105:*/
  15572. #line 2525 "./typica.w"
  15573. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*)
  15574. {
  15575. QByteArray self= getself<QByteArray> (context);
  15576. return QScriptValue((int)(self.at(argument<int> (0,context))));
  15577. }
  15578. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*)
  15579. {
  15580. QByteArray self= getself<QByteArray> (context);
  15581. self[argument<int> (0,context)]= (char)(argument<int> (1,context));
  15582. return QScriptValue();
  15583. }
  15584. /*:105*//*106:*/
  15585. #line 2543 "./typica.w"
  15586. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine)
  15587. {
  15588. QByteArray self= getself<QByteArray> (context);
  15589. QScriptValue value=
  15590. engine->toScriptValue<QByteArray> (
  15591. self.append(argument<QByteArray> (0,context)));
  15592. setQByteArrayProperties(value,engine);
  15593. return value;
  15594. }
  15595. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine)
  15596. {
  15597. QByteArray self= getself<QByteArray> (context);
  15598. QScriptValue value= engine->toScriptValue<QByteArray> (
  15599. self.append(argument<QString> (0,context)));
  15600. setQByteArrayProperties(value,engine);
  15601. return value;
  15602. }
  15603. /*:106*//*107:*/
  15604. #line 2565 "./typica.w"
  15605. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*)
  15606. {
  15607. QByteArray self= getself<QByteArray> (context);
  15608. return QScriptValue(self.size());
  15609. }
  15610. /*:107*//*108:*/
  15611. #line 2575 "./typica.w"
  15612. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine)
  15613. {
  15614. QByteArray self= getself<QByteArray> (context);
  15615. QScriptValue value= engine->toScriptValue<QByteArray> (
  15616. self.left(argument<int> (0,context)));
  15617. setQByteArrayProperties(value,engine);
  15618. return value;
  15619. }
  15620. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine)
  15621. {
  15622. QByteArray self= getself<QByteArray> (context);
  15623. QScriptValue value= engine->toScriptValue<QByteArray> (
  15624. self.right(argument<int> (0,context)));
  15625. setQByteArrayProperties(value,engine);
  15626. return value;
  15627. }
  15628. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine)
  15629. {
  15630. QByteArray self= getself<QByteArray> (context);
  15631. int length= -1;
  15632. if(context->argumentCount()> 1)
  15633. {
  15634. length= argument<int> (1,context);
  15635. }
  15636. QScriptValue value= engine->toScriptValue<QByteArray> (
  15637. self.mid(argument<int> (0,context),length));
  15638. setQByteArrayProperties(value,engine);
  15639. return value;
  15640. }
  15641. /*:108*//*109:*/
  15642. #line 2610 "./typica.w"
  15643. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*)
  15644. {
  15645. QByteArray self= getself<QByteArray> (context);
  15646. self.chop(argument<int> (0,context));
  15647. return QScriptValue();
  15648. }
  15649. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine)
  15650. {
  15651. QByteArray self= getself<QByteArray> (context);
  15652. QScriptValue value= engine->toScriptValue<QByteArray> (
  15653. self.remove(argument<int> (0,context),argument<int> (1,context)));
  15654. setQByteArrayProperties(value,engine);
  15655. return value;
  15656. }
  15657. /*:109*//*110:*/
  15658. #line 2633 "./typica.w"
  15659. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*)
  15660. {
  15661. QByteArray self= getself<QByteArray> (context);
  15662. int value= 0;
  15663. char*bytes= (char*)&value;
  15664. bytes[0]= self[0];
  15665. return QScriptValue(value);
  15666. }
  15667. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*)
  15668. {
  15669. QByteArray self= getself<QByteArray> (context);
  15670. int value= 0;
  15671. char*bytes= (char*)&value;
  15672. bytes[0]= self[0];
  15673. bytes[1]= self[1];
  15674. return QScriptValue(value);
  15675. }
  15676. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*)
  15677. {
  15678. QByteArray self= getself<QByteArray> (context);
  15679. int value= 0;
  15680. char*bytes= (char*)&value;
  15681. bytes[0]= self[0];
  15682. bytes[1]= self[1];
  15683. bytes[2]= self[2];
  15684. bytes[3]= self[3];
  15685. return QScriptValue(value);
  15686. }
  15687. /*:110*//*111:*/
  15688. #line 2669 "./typica.w"
  15689. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*)
  15690. {
  15691. QByteArray self= getself<QByteArray> (context);
  15692. float value= 0.0;
  15693. char*bytes= (char*)&value;
  15694. bytes[0]= self[0];
  15695. bytes[1]= self[1];
  15696. bytes[2]= self[2];
  15697. bytes[3]= self[3];
  15698. return QScriptValue(value);
  15699. }
  15700. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*)
  15701. {
  15702. QByteArray self= getself<QByteArray> (context);
  15703. double value= 0.0;
  15704. char*bytes= (char*)&value;
  15705. bytes[0]= self[0];
  15706. bytes[1]= self[1];
  15707. bytes[2]= self[2];
  15708. bytes[3]= self[3];
  15709. bytes[4]= self[4];
  15710. bytes[5]= self[5];
  15711. bytes[6]= self[6];
  15712. bytes[7]= self[7];
  15713. return QScriptValue(value);
  15714. }
  15715. /*:111*//*114:*/
  15716. #line 2724 "./typica.w"
  15717. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine)
  15718. {
  15719. qint8 value= (qint8)(argument<int> (0,context));
  15720. char*bytes= (char*)&value;
  15721. QByteArray retval;
  15722. retval.resize(1);
  15723. retval[0]= bytes[0];
  15724. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  15725. setQByteArrayProperties(v,engine);
  15726. return v;
  15727. }
  15728. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine)
  15729. {
  15730. qint16 value= (qint16)(argument<int> (0,context));
  15731. char*bytes= (char*)&value;
  15732. QByteArray retval;
  15733. retval.resize(2);
  15734. retval[0]= bytes[0];
  15735. retval[1]= bytes[1];
  15736. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  15737. setQByteArrayProperties(v,engine);
  15738. return v;
  15739. }
  15740. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine)
  15741. {
  15742. qint32 value= (qint32)(argument<int> (0,context));
  15743. char*bytes= (char*)&value;
  15744. QByteArray retval;
  15745. retval.resize(4);
  15746. retval[0]= bytes[0];
  15747. retval[1]= bytes[1];
  15748. retval[2]= bytes[2];
  15749. retval[3]= bytes[3];
  15750. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  15751. setQByteArrayProperties(v,engine);
  15752. return v;
  15753. }
  15754. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine)
  15755. {
  15756. float value= (float)(argument<double> (0,context));
  15757. char*bytes= (char*)&value;
  15758. QByteArray retval;
  15759. retval.resize(4);
  15760. retval[0]= bytes[0];
  15761. retval[1]= bytes[1];
  15762. retval[2]= bytes[2];
  15763. retval[3]= bytes[3];
  15764. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  15765. setQByteArrayProperties(v,engine);
  15766. return v;
  15767. }
  15768. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine)
  15769. {
  15770. double value= (double)(argument<double> (0,context));
  15771. char*bytes= (char*)&value;
  15772. QByteArray retval;
  15773. retval.resize(8);
  15774. retval[0]= bytes[0];
  15775. retval[1]= bytes[1];
  15776. retval[2]= bytes[2];
  15777. retval[3]= bytes[3];
  15778. retval[4]= bytes[4];
  15779. retval[5]= bytes[5];
  15780. retval[6]= bytes[6];
  15781. retval[7]= bytes[7];
  15782. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  15783. setQByteArrayProperties(v,engine);
  15784. return v;
  15785. }
  15786. /*:114*//*117:*/
  15787. #line 2821 "./typica.w"
  15788. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  15789. {
  15790. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  15791. QScriptValue object= engine->newQObject(new QBuffer(array));
  15792. setQBufferProperties(object,engine);
  15793. return object;
  15794. }
  15795. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  15796. {
  15797. setQIODeviceProperties(value,engine);
  15798. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  15799. }
  15800. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  15801. {
  15802. QBuffer*self= getself<QBuffer*> (context);
  15803. self->setData(argument<QString> (0,context).toAscii());
  15804. return QScriptValue();
  15805. }
  15806. /*:117*//*120:*/
  15807. #line 2870 "./typica.w"
  15808. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  15809. {
  15810. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  15811. setXQueryProperties(object,engine);
  15812. return object;
  15813. }
  15814. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  15815. {
  15816. QXmlQuery*self= getself<QXmlQuery*> (context);
  15817. delete self;
  15818. return QScriptValue();
  15819. }
  15820. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  15821. {
  15822. value.setProperty("bind",engine->newFunction(XQuery_bind));
  15823. value.setProperty("exec",engine->newFunction(XQuery_exec));
  15824. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  15825. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  15826. }
  15827. /*:120*//*121:*/
  15828. #line 2896 "./typica.w"
  15829. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  15830. {
  15831. QXmlQuery*self= getself<QXmlQuery*> (context);
  15832. QIODevice*buffer= argument<QIODevice*> (1,context);
  15833. self->bindVariable(argument<QString> (0,context),buffer);
  15834. return QScriptValue();
  15835. }
  15836. /*:121*//*122:*/
  15837. #line 2907 "./typica.w"
  15838. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  15839. {
  15840. QXmlQuery*self= getself<QXmlQuery*> (context);
  15841. self->setQuery(argument<QString> (0,context));
  15842. return QScriptValue();
  15843. }
  15844. /*:122*//*123:*/
  15845. #line 2917 "./typica.w"
  15846. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  15847. {
  15848. QXmlQuery*self= getself<QXmlQuery*> (context);
  15849. QString result;
  15850. self->evaluateTo(&result);
  15851. return QScriptValue(result);
  15852. }
  15853. /*:123*//*126:*/
  15854. #line 2972 "./typica.w"
  15855. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  15856. {
  15857. QXmlStreamWriter*retval;
  15858. if(context->argumentCount()==1)
  15859. {
  15860. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  15861. }
  15862. else
  15863. {
  15864. retval= new QXmlStreamWriter;
  15865. }
  15866. QScriptValue object= engine->toScriptValue<void*> (retval);
  15867. setXmlWriterProperties(object,engine);
  15868. return object;
  15869. }
  15870. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  15871. {
  15872. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  15873. value.setProperty("writeAttribute",
  15874. engine->newFunction(XmlWriter_writeAttribute));
  15875. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  15876. value.setProperty("writeCharacters",
  15877. engine->newFunction(XmlWriter_writeCharacters));
  15878. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  15879. value.setProperty("writeEmptyElement",
  15880. engine->newFunction(XmlWriter_writeEmptyElement));
  15881. value.setProperty("writeEndDocument",
  15882. engine->newFunction(XmlWriter_writeEndDocument));
  15883. value.setProperty("writeEndElement",
  15884. engine->newFunction(XmlWriter_writeEndElement));
  15885. value.setProperty("writeEntityReference",
  15886. engine->newFunction(XmlWriter_writeEntityReference));
  15887. value.setProperty("writeProcessingInstruction",
  15888. engine->newFunction(XmlWriter_writeProcessingInstruction));
  15889. value.setProperty("writeStartDocument",
  15890. engine->newFunction(XmlWriter_writeStartDocument));
  15891. value.setProperty("writeStartElement",
  15892. engine->newFunction(XmlWriter_writeStartElement));
  15893. value.setProperty("writeTextElement",
  15894. engine->newFunction(XmlWriter_writeTextElement));
  15895. }
  15896. /*:126*//*127:*/
  15897. #line 3019 "./typica.w"
  15898. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  15899. {
  15900. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15901. QIODevice*device= argument<QIODevice*> (0,context);
  15902. self->setDevice(device);
  15903. return QScriptValue();
  15904. }
  15905. /*:127*//*128:*/
  15906. #line 3033 "./typica.w"
  15907. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  15908. QScriptEngine*)
  15909. {
  15910. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15911. self->writeStartDocument(argument<QString> (0,context));
  15912. return QScriptValue();
  15913. }
  15914. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  15915. QScriptEngine*)
  15916. {
  15917. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15918. self->writeEndDocument();
  15919. return QScriptValue();
  15920. }
  15921. /*:128*//*129:*/
  15922. #line 3052 "./typica.w"
  15923. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  15924. {
  15925. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15926. self->writeDTD(argument<QString> (0,context));
  15927. return QScriptValue();
  15928. }
  15929. /*:129*//*130:*/
  15930. #line 3063 "./typica.w"
  15931. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  15932. QScriptEngine*)
  15933. {
  15934. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15935. self->writeStartElement(argument<QString> (0,context));
  15936. return QScriptValue();
  15937. }
  15938. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  15939. {
  15940. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15941. self->writeAttribute(argument<QString> (0,context),
  15942. argument<QString> (1,context));
  15943. return QScriptValue();
  15944. }
  15945. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  15946. {
  15947. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15948. self->writeCharacters(argument<QString> (0,context));
  15949. return QScriptValue();
  15950. }
  15951. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  15952. {
  15953. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15954. self->writeEndElement();
  15955. return QScriptValue();
  15956. }
  15957. /*:130*//*131:*/
  15958. #line 3099 "./typica.w"
  15959. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  15960. QScriptEngine*)
  15961. {
  15962. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15963. self->writeEmptyElement(argument<QString> (0,context));
  15964. return QScriptValue();
  15965. }
  15966. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  15967. QScriptEngine*)
  15968. {
  15969. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15970. self->writeTextElement(argument<QString> (0,context),
  15971. argument<QString> (1,context));
  15972. return QScriptValue();
  15973. }
  15974. /*:131*//*132:*/
  15975. #line 3120 "./typica.w"
  15976. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  15977. {
  15978. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15979. self->writeCDATA(argument<QString> (0,context));
  15980. return QScriptValue();
  15981. }
  15982. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  15983. QScriptEngine*)
  15984. {
  15985. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15986. self->writeEntityReference(argument<QString> (0,context));
  15987. return QScriptValue();
  15988. }
  15989. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  15990. QScriptEngine*)
  15991. {
  15992. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  15993. self->writeProcessingInstruction(argument<QString> (0,context),
  15994. argument<QString> (1,context));
  15995. return QScriptValue();
  15996. }
  15997. /*:132*//*135:*/
  15998. #line 3179 "./typica.w"
  15999. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  16000. {
  16001. QXmlStreamReader*retval=
  16002. new QXmlStreamReader(argument<QIODevice*> (0,context));
  16003. QScriptValue object= engine->toScriptValue<void*> (retval);
  16004. setXmlReaderProperties(object,engine);
  16005. return object;
  16006. }
  16007. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  16008. {
  16009. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  16010. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  16011. value.setProperty("hasAttribute",
  16012. engine->newFunction(XmlReader_hasAttribute));
  16013. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  16014. value.setProperty("isStartElement",
  16015. engine->newFunction(XmlReader_isStartElement));
  16016. value.setProperty("name",engine->newFunction(XmlReader_name));
  16017. value.setProperty("readElementText",
  16018. engine->newFunction(XmlReader_readElementText));
  16019. value.setProperty("readNext",
  16020. engine->newFunction(XmlReader_readNext));
  16021. value.setProperty("text",engine->newFunction(XmlReader_text));
  16022. }
  16023. /*:135*//*136:*/
  16024. #line 3209 "./typica.w"
  16025. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  16026. {
  16027. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16028. QString retval=
  16029. self->attributes().value(argument<QString> (0,context)).toString();
  16030. return QScriptValue(retval);
  16031. }
  16032. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  16033. {
  16034. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16035. bool retval=
  16036. self->attributes().hasAttribute(argument<QString> (0,context));
  16037. return QScriptValue(retval);
  16038. }
  16039. /*:136*//*137:*/
  16040. #line 3229 "./typica.w"
  16041. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  16042. {
  16043. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16044. return QScriptValue(self->atEnd());
  16045. }
  16046. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  16047. {
  16048. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16049. return QScriptValue(self->isDTD());
  16050. }
  16051. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  16052. {
  16053. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16054. return QScriptValue(self->isStartElement());
  16055. }
  16056. /*:137*//*138:*/
  16057. #line 3250 "./typica.w"
  16058. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  16059. {
  16060. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16061. self->readNext();
  16062. return QScriptValue();
  16063. }
  16064. /*:138*//*139:*/
  16065. #line 3260 "./typica.w"
  16066. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  16067. {
  16068. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16069. return QScriptValue(self->name().toString());
  16070. }
  16071. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  16072. {
  16073. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16074. return QScriptValue(self->readElementText());
  16075. }
  16076. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  16077. {
  16078. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  16079. return QScriptValue(self->text().toString());
  16080. }
  16081. /*:139*//*142:*/
  16082. #line 3302 "./typica.w"
  16083. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  16084. {
  16085. setQObjectProperties(value,engine);
  16086. value.setProperty("value",engine->newFunction(QSettings_value));
  16087. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  16088. }
  16089. /*:142*//*143:*/
  16090. #line 3314 "./typica.w"
  16091. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  16092. {
  16093. QScriptValue object;
  16094. if(context->argumentCount()==1||context->argumentCount()==2)
  16095. {
  16096. QSettings settings;
  16097. QString key= argument<QString> (0,context);
  16098. QVariant value;
  16099. QVariant retval;
  16100. if(context->argumentCount()> 1)
  16101. {
  16102. value= argument<QVariant> (1,context);
  16103. retval= settings.value(key,value);
  16104. }
  16105. else
  16106. {
  16107. retval= settings.value(key);
  16108. }
  16109. object= engine->newVariant(retval);
  16110. }
  16111. else
  16112. {
  16113. context->throwError("Incorrect number of arguments passed to "
  16114. "QSettings::value(). This method takes one "
  16115. "string and one optional variant type.");
  16116. }
  16117. return object;
  16118. }
  16119. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  16120. {
  16121. if(context->argumentCount()==2)
  16122. {
  16123. QSettings settings;
  16124. QString key= argument<QString> (0,context);
  16125. QVariant value= argument<QVariant> (1,context);
  16126. settings.setValue(key,value);
  16127. }
  16128. else
  16129. {
  16130. context->throwError("Incorrect number of arguments passed to "
  16131. "QSettings::setValue(). This method takes one "
  16132. "string and one variant type for a total of two "
  16133. "arguments.");
  16134. }
  16135. return QScriptValue();
  16136. }
  16137. /*:143*//*146:*/
  16138. #line 3383 "./typica.w"
  16139. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  16140. {
  16141. QScriptValue object= engine->newQObject(new QLCDNumber());
  16142. setQLCDNumberProperties(object,engine);
  16143. return object;
  16144. }
  16145. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  16146. {
  16147. setQFrameProperties(value,engine);
  16148. }
  16149. /*:146*//*149:*/
  16150. #line 3441 "./typica.w"
  16151. QScriptValue constructQTime(QScriptContext*context,
  16152. QScriptEngine*engine)
  16153. {
  16154. QScriptValue object;
  16155. if(context->argumentCount()==0||
  16156. (context->argumentCount()>=2&&context->argumentCount()<=4))
  16157. {
  16158. int arg1= 0;
  16159. int arg2= 0;
  16160. int arg3= 0;
  16161. int arg4= 0;
  16162. switch(context->argumentCount())
  16163. {
  16164. case 4:
  16165. arg4= argument<int> (3,context);
  16166. case 3:
  16167. arg3= argument<int> (2,context);
  16168. case 2:
  16169. arg2= argument<int> (1,context);
  16170. arg1= argument<int> (0,context);
  16171. default:
  16172. break;
  16173. }
  16174. if(context->argumentCount())
  16175. {
  16176. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  16177. arg4));
  16178. }
  16179. else
  16180. {
  16181. object= engine->toScriptValue<QTime> (QTime());
  16182. }
  16183. setQTimeProperties(object,engine);
  16184. }
  16185. else
  16186. {
  16187. context->throwError("Incorrect number of arguments passed to "
  16188. "QTime::QTime(). This method takes zero, two, "
  16189. "three, or four integer arguments.");
  16190. }
  16191. return object;
  16192. }
  16193. /*:149*//*150:*/
  16194. #line 3489 "./typica.w"
  16195. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  16196. {
  16197. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  16198. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  16199. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  16200. value.setProperty("hour",engine->newFunction(QTime_hour));
  16201. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  16202. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  16203. value.setProperty("minute",engine->newFunction(QTime_minute));
  16204. value.setProperty("msec",engine->newFunction(QTime_msec));
  16205. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  16206. value.setProperty("restart",engine->newFunction(QTime_restart));
  16207. value.setProperty("second",engine->newFunction(QTime_second));
  16208. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  16209. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  16210. value.setProperty("start",engine->newFunction(QTime_start));
  16211. value.setProperty("toString",engine->newFunction(QTime_toString));
  16212. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  16213. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  16214. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  16215. }
  16216. /*:150*//*151:*/
  16217. #line 3518 "./typica.w"
  16218. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  16219. {
  16220. QTime self= getself<QTime> (context);
  16221. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  16222. (self.second()*1000)+self.msec();
  16223. return QScriptValue(retval);
  16224. }
  16225. /*:151*//*152:*/
  16226. #line 3532 "./typica.w"
  16227. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  16228. {
  16229. QTime time;
  16230. QScriptValue retval;
  16231. if(context->argumentCount()==1)
  16232. {
  16233. QTime self= getself<QTime> (context);
  16234. time= self.addMSecs(argument<int> (0,context));
  16235. retval= engine->toScriptValue<QTime> (time);
  16236. setQTimeProperties(retval,engine);
  16237. }
  16238. else
  16239. {
  16240. context->throwError("Incorrect number of arguments passed to "
  16241. "QTime::addMSecs(). This method takes one "
  16242. "integer as an argument.");
  16243. }
  16244. return retval;
  16245. }
  16246. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  16247. {
  16248. QTime time;
  16249. QScriptValue retval;
  16250. if(context->argumentCount()==1)
  16251. {
  16252. QTime self= getself<QTime> (context);
  16253. time= self.addSecs(argument<int> (0,context));
  16254. retval= engine->toScriptValue<QTime> (time);
  16255. setQTimeProperties(retval,engine);
  16256. }
  16257. else
  16258. {
  16259. context->throwError("Incorrect number of arguments passed to "
  16260. "QTime::addSecs(). This method takes one "
  16261. "integer as an argument.");
  16262. }
  16263. return retval;
  16264. }
  16265. /*:152*//*153:*/
  16266. #line 3575 "./typica.w"
  16267. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  16268. {
  16269. QScriptValue retval;
  16270. if(context->argumentCount()==0)
  16271. {
  16272. QTime self= getself<QTime> (context);
  16273. retval= QScriptValue(engine,self.elapsed());
  16274. }
  16275. else
  16276. {
  16277. context->throwError("Incorrect number of arguments passed to "
  16278. "QTime::elapsed(). This method takes no "
  16279. "arguments.");
  16280. }
  16281. return retval;
  16282. }
  16283. /*:153*//*154:*/
  16284. #line 3596 "./typica.w"
  16285. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  16286. {
  16287. QScriptValue retval;
  16288. if(context->argumentCount()==0)
  16289. {
  16290. QTime self= getself<QTime> (context);
  16291. retval= QScriptValue(engine,self.hour());
  16292. }
  16293. else
  16294. {
  16295. context->throwError("Incorrect number of arguments passed to "
  16296. "QTime::hour(). This method takes no "
  16297. "arguments.");
  16298. }
  16299. return retval;
  16300. }
  16301. /*:154*//*155:*/
  16302. #line 3616 "./typica.w"
  16303. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  16304. {
  16305. QScriptValue retval;
  16306. if(context->argumentCount()==0)
  16307. {
  16308. QTime self= getself<QTime> (context);
  16309. retval= QScriptValue(engine,self.minute());
  16310. }
  16311. else
  16312. {
  16313. context->throwError("Incorrect number of arguments passed to "
  16314. "QTime::minute(). This method takes no "
  16315. "arguments.");
  16316. }
  16317. return retval;
  16318. }
  16319. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  16320. {
  16321. QScriptValue retval;
  16322. if(context->argumentCount()==0)
  16323. {
  16324. QTime self= getself<QTime> (context);
  16325. retval= QScriptValue(engine,self.second());
  16326. }
  16327. else
  16328. {
  16329. context->throwError("Incorrect number of arguments passed to "
  16330. "QTime::second(). This method takes no "
  16331. "arguments.");
  16332. }
  16333. return retval;
  16334. }
  16335. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  16336. {
  16337. QScriptValue retval;
  16338. if(context->argumentCount()==0)
  16339. {
  16340. QTime self= getself<QTime> (context);
  16341. retval= QScriptValue(engine,self.msec());
  16342. }
  16343. else
  16344. {
  16345. context->throwError("Incorrect number of arguments passed to "
  16346. "QTime::msec(). This method takes no "
  16347. "arguments.");
  16348. }
  16349. return retval;
  16350. }
  16351. /*:155*//*156:*/
  16352. #line 3672 "./typica.w"
  16353. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  16354. {
  16355. QScriptValue retval;
  16356. if(context->argumentCount()==0)
  16357. {
  16358. QTime self= getself<QTime> (context);
  16359. retval= QScriptValue(engine,self.isNull());
  16360. }
  16361. else
  16362. {
  16363. context->throwError("Incorrect number of arguments passed to "
  16364. "QTime::isNull(). This method takes no "
  16365. "arguments.");
  16366. }
  16367. return retval;
  16368. }
  16369. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  16370. {
  16371. QScriptValue retval;
  16372. if(context->argumentCount()==0)
  16373. {
  16374. QTime self= getself<QTime> (context);
  16375. retval= QScriptValue(engine,self.isValid());
  16376. }
  16377. else
  16378. {
  16379. context->throwError("Incorrect number of arguments passed to "
  16380. "QTime::isValid(). This method takes no "
  16381. "arguments.");
  16382. }
  16383. return retval;
  16384. }
  16385. /*:156*//*157:*/
  16386. #line 3710 "./typica.w"
  16387. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  16388. {
  16389. QScriptValue retval;
  16390. if(context->argumentCount()==1)
  16391. {
  16392. QTime self= getself<QTime> (context);
  16393. QTime arg= argument<QVariant> (0,context).toTime();
  16394. retval= QScriptValue(engine,self.msecsTo(arg));
  16395. }
  16396. else
  16397. {
  16398. context->throwError("Incorrect number of arguments passed to "
  16399. "QTime::msecsTo(). This method takes one QTime.");
  16400. }
  16401. return retval;
  16402. }
  16403. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  16404. {
  16405. QScriptValue retval;
  16406. if(context->argumentCount()==1)
  16407. {
  16408. QTime self= getself<QTime> (context);
  16409. QTime arg= argument<QVariant> (0,context).toTime();
  16410. retval= QScriptValue(engine,self.secsTo(arg));
  16411. }
  16412. else
  16413. {
  16414. context->throwError("Incorrect number of arguments passed to "
  16415. "QTime::secsTo(). This method takes one QTime.");
  16416. }
  16417. return retval;
  16418. }
  16419. /*:157*//*158:*/
  16420. #line 3749 "./typica.w"
  16421. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  16422. {
  16423. QScriptValue retval;
  16424. if(context->argumentCount()==0)
  16425. {
  16426. QTime self= getself<QTime> (context);
  16427. retval= QScriptValue(engine,self.restart());
  16428. }
  16429. else
  16430. {
  16431. context->throwError("Incorrect number of arguments passed to "
  16432. "QTime::restart(). This method takes no "
  16433. "arguments.");
  16434. }
  16435. return retval;
  16436. }
  16437. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  16438. {
  16439. if(context->argumentCount()==0)
  16440. {
  16441. QTime self= getself<QTime> (context);
  16442. self.start();
  16443. }
  16444. else
  16445. {
  16446. context->throwError("Incorrect number of arguments passed to "
  16447. "QTime::start(). This method takes no arguments.");
  16448. }
  16449. return QScriptValue();
  16450. }
  16451. /*:158*//*159:*/
  16452. #line 3785 "./typica.w"
  16453. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  16454. {
  16455. QScriptValue retval;
  16456. if(context->argumentCount()==3||context->argumentCount()==4)
  16457. {
  16458. QTime self= getself<QTime> (context);
  16459. int arg1= 0;
  16460. int arg2= 0;
  16461. int arg3= 0;
  16462. int arg4= 0;
  16463. switch(context->argumentCount())
  16464. {
  16465. case 4:
  16466. arg4= argument<int> (3,context);
  16467. case 3:
  16468. arg3= argument<int> (2,context);
  16469. arg2= argument<int> (1,context);
  16470. arg1= argument<int> (0,context);
  16471. default:
  16472. break;
  16473. }
  16474. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  16475. }
  16476. else
  16477. {
  16478. context->throwError("Incorrect number of arguments passed to "
  16479. "QTime::setHMS(). This method takes three or "
  16480. "four integer arguments.");
  16481. }
  16482. return retval;
  16483. }
  16484. /*:159*//*160:*/
  16485. #line 3821 "./typica.w"
  16486. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  16487. {
  16488. QScriptValue retval;
  16489. if(context->argumentCount()==1)
  16490. {
  16491. QTime self= getself<QTime> (context);
  16492. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  16493. }
  16494. else
  16495. {
  16496. context->throwError("Incorrect number of arguments passed to "
  16497. "QTime::toString(). This method takes one QString "
  16498. "as an argument.");
  16499. }
  16500. return retval;
  16501. }
  16502. /*:160*//*161:*/
  16503. #line 3842 "./typica.w"
  16504. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  16505. {
  16506. QScriptValue object;
  16507. object= engine->toScriptValue<QTime> (QTime::currentTime());
  16508. setQTimeProperties(object,engine);
  16509. return object;
  16510. }
  16511. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  16512. {
  16513. QScriptValue object;
  16514. if(context->argumentCount()==2)
  16515. {
  16516. QString time= argument<QString> (0,context);
  16517. QString format= argument<QString> (1,context);
  16518. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  16519. setQTimeProperties(object,engine);
  16520. }
  16521. else
  16522. {
  16523. context->throwError("Incorrect number of arguments passed to "
  16524. "QTime::fromString(). This method takes two "
  16525. "string arguments.");
  16526. }
  16527. return object;
  16528. }
  16529. /*:161*//*162:*/
  16530. #line 3873 "./typica.w"
  16531. template<> QTime argument(int arg,QScriptContext*context)
  16532. {
  16533. return qscriptvalue_cast<QTime> (context->argument(arg));
  16534. }
  16535. /*:162*//*164:*/
  16536. #line 3891 "./typica.w"
  16537. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  16538. {
  16539. setQFrameProperties(value,engine);
  16540. }
  16541. /*:164*//*166:*/
  16542. #line 3905 "./typica.w"
  16543. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  16544. {
  16545. setQAbstractScrollAreaProperties(value,engine);
  16546. }
  16547. /*:166*//*168:*/
  16548. #line 3919 "./typica.w"
  16549. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  16550. {
  16551. setQAbstractScrollAreaProperties(value,engine);
  16552. }
  16553. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  16554. {
  16555. setQAbstractItemViewProperties(value,engine);
  16556. }
  16557. /*:168*//*171:*/
  16558. #line 3952 "./typica.w"
  16559. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  16560. {
  16561. QScriptValue object= engine->newQObject(new QPushButton());
  16562. setQPushButtonProperties(object,engine);
  16563. return object;
  16564. }
  16565. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  16566. {
  16567. setQAbstractButtonProperties(value,engine);
  16568. }
  16569. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  16570. {
  16571. setQWidgetProperties(value,engine);
  16572. }
  16573. /*:171*//*178:*/
  16574. #line 4064 "./typica.w"
  16575. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  16576. {
  16577. SqlQueryConnection*obj= new SqlQueryConnection();
  16578. QScriptValue object=
  16579. engine->toScriptValue<void*> (obj);
  16580. setQSqlQueryProperties(object,engine);
  16581. return object;
  16582. }
  16583. /*:178*//*179:*/
  16584. #line 4077 "./typica.w"
  16585. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  16586. {
  16587. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  16588. value.setProperty("bindFileData",
  16589. engine->newFunction(QSqlQuery_bindFileData));
  16590. value.setProperty("bindDeviceData",
  16591. engine->newFunction(QSqlQuery_bindDeviceData));
  16592. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  16593. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  16594. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  16595. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  16596. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  16597. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  16598. }
  16599. /*:179*//*180:*/
  16600. #line 4095 "./typica.w"
  16601. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  16602. {
  16603. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  16604. QScriptValue retval;
  16605. if(context->argumentCount()==1)
  16606. {
  16607. retval= QScriptValue(engine,
  16608. q->exec(argument<QString> (0,context)));
  16609. }
  16610. else
  16611. {
  16612. retval= QScriptValue(engine,q->exec());
  16613. }
  16614. if(q->lastError().isValid())
  16615. {
  16616. qDebug()<<q->lastQuery();
  16617. qDebug()<<q->lastError().text();
  16618. }
  16619. return retval;
  16620. }
  16621. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  16622. {
  16623. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16624. return QScriptValue(query->lastQuery());
  16625. }
  16626. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  16627. {
  16628. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16629. return QScriptValue(engine,query->next());
  16630. }
  16631. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  16632. {
  16633. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16634. return QScriptValue(engine,
  16635. query->value(argument<int> (0,context)).toString());
  16636. }
  16637. /*:180*//*181:*/
  16638. #line 4139 "./typica.w"
  16639. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  16640. {
  16641. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16642. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  16643. }
  16644. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  16645. {
  16646. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16647. query->bindValue(argument<QString> (0,context),
  16648. argument<QVariant> (1,context));
  16649. return QScriptValue();
  16650. }
  16651. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  16652. QScriptEngine*)
  16653. {
  16654. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16655. QString placeholder= argument<QString> (0,context);
  16656. QString filename= argument<QString> (1,context);
  16657. QFile file(filename);
  16658. QByteArray data;
  16659. if(file.open(QIODevice::ReadOnly))
  16660. {
  16661. data= file.readAll();
  16662. file.close();
  16663. }
  16664. query->bindValue(placeholder,data);
  16665. return QScriptValue();
  16666. }
  16667. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  16668. QScriptEngine*)
  16669. {
  16670. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  16671. QString placeholder= argument<QString> (0,context);
  16672. QIODevice*device= argument<QIODevice*> (1,context);
  16673. device->reset();
  16674. QByteArray data;
  16675. data= device->readAll();
  16676. query->bindValue(placeholder,data);
  16677. return QScriptValue();
  16678. }
  16679. /*:181*//*182:*/
  16680. #line 4191 "./typica.w"
  16681. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  16682. {
  16683. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  16684. delete query;
  16685. return QScriptValue::UndefinedValue;
  16686. }
  16687. /*:182*//*185:*/
  16688. #line 4238 "./typica.w"
  16689. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  16690. {
  16691. QFileInfo info(argument<QString> (0,context));
  16692. QScriptValue retval(engine,info.baseName());
  16693. return retval;
  16694. }
  16695. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  16696. {
  16697. QFileInfo info(argument<QString> (0,context));
  16698. QDir dir= info.dir();
  16699. QScriptValue retval(engine,dir.path());
  16700. return retval;
  16701. }
  16702. /*:185*//*186:*/
  16703. #line 4257 "./typica.w"
  16704. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*)
  16705. {
  16706. SqlQueryConnection h;
  16707. QSqlQuery*query= h.operator->();
  16708. QString q= "SELECT file FROM files WHERE id = :file";
  16709. query->prepare(q);
  16710. query->bindValue(":file",argument<int> (0,context));
  16711. query->exec();
  16712. query->next();
  16713. QByteArray array= query->value(0).toByteArray();
  16714. QFile file(argument<QString> (1,context));
  16715. file.open(QIODevice::WriteOnly);
  16716. file.write(array);
  16717. file.close();
  16718. return QScriptValue();
  16719. }
  16720. /*:186*//*187:*/
  16721. #line 4278 "./typica.w"
  16722. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  16723. {
  16724. QString source= argument<QString> (0,context);
  16725. source.remove(0,1);
  16726. source.chop(1);
  16727. QStringList elements= source.split(",");
  16728. QString element;
  16729. QScriptValue dest= engine->newArray(elements.size());
  16730. int i= 0;
  16731. foreach(element,elements)
  16732. {
  16733. if(element.startsWith("\"")&&element.endsWith("\""))
  16734. {
  16735. element.chop(1);
  16736. element= element.remove(0,1);
  16737. }
  16738. dest.setProperty(i,QScriptValue(engine,element));
  16739. i++;
  16740. }
  16741. return dest;
  16742. }
  16743. /*:187*//*188:*/
  16744. #line 4304 "./typica.w"
  16745. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  16746. {
  16747. QString font= argument<QString> (0,context);
  16748. QString classname;
  16749. if(context->argumentCount()> 1)
  16750. {
  16751. classname= argument<QString> (1,context);
  16752. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  16753. }
  16754. else
  16755. {
  16756. QApplication::setFont(QFont(font));
  16757. }
  16758. return QScriptValue();
  16759. }
  16760. /*:188*//*189:*/
  16761. #line 4324 "./typica.w"
  16762. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  16763. {
  16764. SqlQueryConnection h;
  16765. QSqlQuery*query= h.operator->();
  16766. QString q= "SELECT file FROM files WHERE id = :file";
  16767. query->prepare(q);
  16768. query->bindValue(":file",argument<int> (0,context));
  16769. query->exec();
  16770. query->next();
  16771. QByteArray array= query->value(0).toByteArray();
  16772. QBuffer buffer(&array);
  16773. buffer.open(QIODevice::ReadOnly);
  16774. QXmlQuery xquery;
  16775. xquery.bindVariable("profile",&buffer);
  16776. QString xq;
  16777. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  16778. xquery.setQuery(xq);
  16779. QString result;
  16780. xquery.evaluateTo(&result);
  16781. return QScriptValue(result);
  16782. }
  16783. /*:189*//*190:*/
  16784. #line 4351 "./typica.w"
  16785. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  16786. {
  16787. QWidget::setTabOrder(argument<QWidget*> (0,context),
  16788. argument<QWidget*> (1,context));
  16789. return QScriptValue();
  16790. }
  16791. /*:190*//*191:*/
  16792. #line 4362 "./typica.w"
  16793. QScriptValue scriptTr(QScriptContext*context,QScriptEngine*)
  16794. {
  16795. return QScriptValue(QCoreApplication::translate(
  16796. "configuration",
  16797. argument<QString> (1,context).toUtf8().data()));
  16798. }
  16799. /*:191*//*198:*/
  16800. #line 4631 "./typica.w"
  16801. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  16802. {
  16803. QString targetID= argument<QString> (0,context);
  16804. QDomNode element;
  16805. QScriptValue object;
  16806. /*200:*/
  16807. #line 4678 "./typica.w"
  16808. QDomNodeList windows=
  16809. AppInstance->configuration()->documentElement().elementsByTagName("window");
  16810. QDomNode nullNode;
  16811. int i= 0;
  16812. element= nullNode;
  16813. while(i<windows.count())
  16814. {
  16815. element= windows.at(i);
  16816. QDomNamedNodeMap attributes= element.attributes();
  16817. if(attributes.contains("id"))
  16818. {
  16819. if(attributes.namedItem("id").toAttr().value()==targetID)
  16820. {
  16821. break;
  16822. }
  16823. }
  16824. element= nullNode;
  16825. i++;
  16826. }
  16827. /*:200*/
  16828. #line 4637 "./typica.w"
  16829. if(!element.isNull())
  16830. {
  16831. /*201:*/
  16832. #line 4710 "./typica.w"
  16833. ScriptQMainWindow*window= new ScriptQMainWindow;
  16834. window->setObjectName(targetID);
  16835. object= engine->newQObject(window);
  16836. setQMainWindowProperties(object,engine);
  16837. QWidget*central= new(QWidget);
  16838. central->setParent(window);
  16839. central->setObjectName("centralWidget");
  16840. window->setCentralWidget(central);
  16841. if(element.hasChildNodes())
  16842. {
  16843. /*202:*/
  16844. #line 4746 "./typica.w"
  16845. QStack<QWidget*> widgetStack;
  16846. QStack<QLayout*> layoutStack;
  16847. QString windowScript;
  16848. widgetStack.push(central);
  16849. QDomNodeList windowChildren= element.childNodes();
  16850. int i= 0;
  16851. while(i<windowChildren.count())
  16852. {
  16853. QDomNode current;
  16854. QDomElement element;
  16855. current= windowChildren.at(i);
  16856. if(current.isElement())
  16857. {
  16858. element= current.toElement();
  16859. if(element.tagName()=="program")
  16860. {
  16861. windowScript.append(element.text());
  16862. }
  16863. else if(element.tagName()=="layout")
  16864. {
  16865. element.setAttribute("trcontext","configuration");
  16866. addLayoutToWidget(element,&widgetStack,&layoutStack);
  16867. }
  16868. else if(element.tagName()=="menu")
  16869. {
  16870. /*203:*/
  16871. #line 4794 "./typica.w"
  16872. QMenuBar*bar= window->menuBar();
  16873. bar->setParent(window);
  16874. bar->setObjectName("menuBar");
  16875. if(element.hasAttribute("name"))
  16876. {
  16877. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  16878. element.attribute("name").toUtf8().data()));
  16879. menu->setParent(bar);
  16880. if(element.hasAttribute("type"))
  16881. {
  16882. if(element.attribute("type")=="reports")
  16883. {
  16884. if(element.hasAttribute("src"))
  16885. {
  16886. /*662:*/
  16887. #line 14077 "./typica.w"
  16888. QSettings settings;
  16889. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  16890. toString()).
  16891. arg(element.attribute("src"));
  16892. QDir::addSearchPath("reports",reportDirectory);
  16893. QDir directory(reportDirectory);
  16894. directory.setFilter(QDir::Files);
  16895. directory.setSorting(QDir::Name);
  16896. QStringList nameFilter;
  16897. nameFilter<<"*.xml";
  16898. directory.setNameFilters(nameFilter);
  16899. QFileInfoList reportFiles= directory.entryInfoList();
  16900. for(int i= 0;i<reportFiles.size();i++)
  16901. {
  16902. QFileInfo reportFile= reportFiles.at(i);
  16903. /*666:*/
  16904. #line 14157 "./typica.w"
  16905. QString path= reportFile.absoluteFilePath();
  16906. QFile file(path);
  16907. if(file.open(QIODevice::ReadOnly))
  16908. {
  16909. QDomDocument document;
  16910. document.setContent(&file,true);
  16911. QDomElement root= document.documentElement();
  16912. QString translationContext= root.attribute("id");
  16913. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  16914. if(!titleNode.isNull())
  16915. {
  16916. QDomElement titleElement= titleNode.toElement();
  16917. QString title= QCoreApplication::translate("configuration",
  16918. titleElement.text().toUtf8().data());
  16919. if(!title.isEmpty())
  16920. {
  16921. QStringList hierarchy= title.split(":->");
  16922. QMenu*insertionPoint= menu;
  16923. /*667:*/
  16924. #line 14186 "./typica.w"
  16925. for(int j= 0;j<hierarchy.size()-1;j++)
  16926. {
  16927. QObjectList menuList= insertionPoint->children();
  16928. bool menuFound= false;
  16929. for(int k= 0;k<menuList.size();k++)
  16930. {
  16931. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  16932. if(currentItem)
  16933. {
  16934. if(currentItem->title()==hierarchy.at(j))
  16935. {
  16936. menuFound= true;
  16937. insertionPoint= currentItem;
  16938. break;
  16939. }
  16940. }
  16941. }
  16942. if(!menuFound)
  16943. {
  16944. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  16945. }
  16946. }
  16947. /*:667*/
  16948. #line 14176 "./typica.w"
  16949. ReportAction*action= new ReportAction(path,hierarchy.last());
  16950. insertionPoint->addAction(action);
  16951. }
  16952. }
  16953. }
  16954. /*:666*/
  16955. #line 14093 "./typica.w"
  16956. }
  16957. /*:662*/
  16958. #line 4809 "./typica.w"
  16959. }
  16960. }
  16961. }
  16962. if(element.hasChildNodes())
  16963. {
  16964. /*204:*/
  16965. #line 4822 "./typica.w"
  16966. QDomNodeList menuItems= element.childNodes();
  16967. int j= 0;
  16968. while(j<menuItems.count())
  16969. {
  16970. QDomNode item= menuItems.at(j);
  16971. if(item.isElement())
  16972. {
  16973. QDomElement itemElement= item.toElement();
  16974. if(itemElement.tagName()=="item")
  16975. {
  16976. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  16977. itemElement.text().toUtf8().data()),menu);
  16978. if(itemElement.hasAttribute("id"))
  16979. {
  16980. itemAction->setObjectName(itemElement.attribute("id"));
  16981. }
  16982. if(itemElement.hasAttribute("shortcut"))
  16983. {
  16984. itemAction->setShortcut(itemElement.attribute("shortcut"));
  16985. }
  16986. menu->addAction(itemAction);
  16987. }
  16988. else if(itemElement.tagName()=="separator")
  16989. {
  16990. menu->addSeparator();
  16991. }
  16992. else if(itemElement.tagName()=="plugins")
  16993. {
  16994. /*687:*/
  16995. #line 21 "./plugins.w"
  16996. QMenu*pluginMenu= new QMenu(menu);
  16997. if(itemElement.hasAttribute("id"))
  16998. {
  16999. pluginMenu->setObjectName(itemElement.attribute("id"));
  17000. }
  17001. if(itemElement.hasAttribute("title"))
  17002. {
  17003. pluginMenu->setTitle(itemElement.attribute("title"));
  17004. }
  17005. if(itemElement.hasAttribute("src"))
  17006. {
  17007. QSettings settings;
  17008. QString pluginDirectory= QString("%1/%2").
  17009. arg(settings.value("config").toString()).
  17010. arg(itemElement.attribute("src"));
  17011. QDir directory(pluginDirectory);
  17012. directory.setFilter(QDir::Files);
  17013. directory.setSorting(QDir::Name);
  17014. QStringList nameFilter;
  17015. nameFilter<<"*.js";
  17016. directory.setNameFilters(nameFilter);
  17017. QFileInfoList pluginFiles= directory.entryInfoList();
  17018. for(int k= 0;k<pluginFiles.size();k++)
  17019. {
  17020. PluginAction*pa= new PluginAction(pluginFiles.at(k),pluginMenu);
  17021. if(itemElement.hasAttribute("preRun"))
  17022. {
  17023. pa->setPreRun(itemElement.attribute("preRun"));
  17024. }
  17025. if(itemElement.hasAttribute("postRun"))
  17026. {
  17027. pa->setPostRun(itemElement.attribute("postRun"));
  17028. }
  17029. pluginMenu->addAction(pa);
  17030. }
  17031. }
  17032. menu->addMenu(pluginMenu);
  17033. /*:687*/
  17034. #line 4851 "./typica.w"
  17035. }
  17036. }
  17037. j++;
  17038. }
  17039. #line 1 "./helpmenu.w"
  17040. /*:204*/
  17041. #line 4815 "./typica.w"
  17042. }
  17043. }
  17044. /*:203*/
  17045. #line 4772 "./typica.w"
  17046. }
  17047. }
  17048. i++;
  17049. }
  17050. QScriptValue oldThis= context->thisObject();
  17051. context->setThisObject(object);
  17052. QScriptValue result= engine->evaluate(windowScript);
  17053. /*195:*/
  17054. #line 4525 "./typica.w"
  17055. if(engine->hasUncaughtException())
  17056. {
  17057. int line= engine->uncaughtExceptionLineNumber();
  17058. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  17059. result.toString();
  17060. QString trace;
  17061. foreach(trace,engine->uncaughtExceptionBacktrace())
  17062. {
  17063. qDebug()<<trace;
  17064. }
  17065. }
  17066. /*:195*/
  17067. #line 4780 "./typica.w"
  17068. context->setThisObject(oldThis);
  17069. /*:202*/
  17070. #line 4721 "./typica.w"
  17071. }
  17072. /*205:*/
  17073. #line 9 "./helpmenu.w"
  17074. HelpMenu*helpMenu= new HelpMenu();
  17075. window->menuBar()->addMenu(helpMenu);
  17076. /*:205*/
  17077. #line 4723 "./typica.w"
  17078. window->show();
  17079. window->setupFinished();
  17080. /*:201*/
  17081. #line 4640 "./typica.w"
  17082. }
  17083. return object;
  17084. }
  17085. /*:198*//*199:*/
  17086. #line 4651 "./typica.w"
  17087. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  17088. {
  17089. QString targetID= argument<QString> (0,context);
  17090. QFile file(QString("reports:%1").arg(targetID));
  17091. QScriptValue object;
  17092. if(file.open(QIODevice::ReadOnly))
  17093. {
  17094. QDomDocument document;
  17095. document.setContent(&file,true);
  17096. QDomElement element= document.documentElement();
  17097. if(!element.isNull())
  17098. {
  17099. /*201:*/
  17100. #line 4710 "./typica.w"
  17101. ScriptQMainWindow*window= new ScriptQMainWindow;
  17102. window->setObjectName(targetID);
  17103. object= engine->newQObject(window);
  17104. setQMainWindowProperties(object,engine);
  17105. QWidget*central= new(QWidget);
  17106. central->setParent(window);
  17107. central->setObjectName("centralWidget");
  17108. window->setCentralWidget(central);
  17109. if(element.hasChildNodes())
  17110. {
  17111. /*202:*/
  17112. #line 4746 "./typica.w"
  17113. QStack<QWidget*> widgetStack;
  17114. QStack<QLayout*> layoutStack;
  17115. QString windowScript;
  17116. widgetStack.push(central);
  17117. QDomNodeList windowChildren= element.childNodes();
  17118. int i= 0;
  17119. while(i<windowChildren.count())
  17120. {
  17121. QDomNode current;
  17122. QDomElement element;
  17123. current= windowChildren.at(i);
  17124. if(current.isElement())
  17125. {
  17126. element= current.toElement();
  17127. if(element.tagName()=="program")
  17128. {
  17129. windowScript.append(element.text());
  17130. }
  17131. else if(element.tagName()=="layout")
  17132. {
  17133. element.setAttribute("trcontext","configuration");
  17134. addLayoutToWidget(element,&widgetStack,&layoutStack);
  17135. }
  17136. else if(element.tagName()=="menu")
  17137. {
  17138. /*203:*/
  17139. #line 4794 "./typica.w"
  17140. QMenuBar*bar= window->menuBar();
  17141. bar->setParent(window);
  17142. bar->setObjectName("menuBar");
  17143. if(element.hasAttribute("name"))
  17144. {
  17145. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  17146. element.attribute("name").toUtf8().data()));
  17147. menu->setParent(bar);
  17148. if(element.hasAttribute("type"))
  17149. {
  17150. if(element.attribute("type")=="reports")
  17151. {
  17152. if(element.hasAttribute("src"))
  17153. {
  17154. /*662:*/
  17155. #line 14077 "./typica.w"
  17156. QSettings settings;
  17157. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  17158. toString()).
  17159. arg(element.attribute("src"));
  17160. QDir::addSearchPath("reports",reportDirectory);
  17161. QDir directory(reportDirectory);
  17162. directory.setFilter(QDir::Files);
  17163. directory.setSorting(QDir::Name);
  17164. QStringList nameFilter;
  17165. nameFilter<<"*.xml";
  17166. directory.setNameFilters(nameFilter);
  17167. QFileInfoList reportFiles= directory.entryInfoList();
  17168. for(int i= 0;i<reportFiles.size();i++)
  17169. {
  17170. QFileInfo reportFile= reportFiles.at(i);
  17171. /*666:*/
  17172. #line 14157 "./typica.w"
  17173. QString path= reportFile.absoluteFilePath();
  17174. QFile file(path);
  17175. if(file.open(QIODevice::ReadOnly))
  17176. {
  17177. QDomDocument document;
  17178. document.setContent(&file,true);
  17179. QDomElement root= document.documentElement();
  17180. QString translationContext= root.attribute("id");
  17181. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  17182. if(!titleNode.isNull())
  17183. {
  17184. QDomElement titleElement= titleNode.toElement();
  17185. QString title= QCoreApplication::translate("configuration",
  17186. titleElement.text().toUtf8().data());
  17187. if(!title.isEmpty())
  17188. {
  17189. QStringList hierarchy= title.split(":->");
  17190. QMenu*insertionPoint= menu;
  17191. /*667:*/
  17192. #line 14186 "./typica.w"
  17193. for(int j= 0;j<hierarchy.size()-1;j++)
  17194. {
  17195. QObjectList menuList= insertionPoint->children();
  17196. bool menuFound= false;
  17197. for(int k= 0;k<menuList.size();k++)
  17198. {
  17199. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  17200. if(currentItem)
  17201. {
  17202. if(currentItem->title()==hierarchy.at(j))
  17203. {
  17204. menuFound= true;
  17205. insertionPoint= currentItem;
  17206. break;
  17207. }
  17208. }
  17209. }
  17210. if(!menuFound)
  17211. {
  17212. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  17213. }
  17214. }
  17215. /*:667*/
  17216. #line 14176 "./typica.w"
  17217. ReportAction*action= new ReportAction(path,hierarchy.last());
  17218. insertionPoint->addAction(action);
  17219. }
  17220. }
  17221. }
  17222. /*:666*/
  17223. #line 14093 "./typica.w"
  17224. }
  17225. /*:662*/
  17226. #line 4809 "./typica.w"
  17227. }
  17228. }
  17229. }
  17230. if(element.hasChildNodes())
  17231. {
  17232. /*204:*/
  17233. #line 4822 "./typica.w"
  17234. QDomNodeList menuItems= element.childNodes();
  17235. int j= 0;
  17236. while(j<menuItems.count())
  17237. {
  17238. QDomNode item= menuItems.at(j);
  17239. if(item.isElement())
  17240. {
  17241. QDomElement itemElement= item.toElement();
  17242. if(itemElement.tagName()=="item")
  17243. {
  17244. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  17245. itemElement.text().toUtf8().data()),menu);
  17246. if(itemElement.hasAttribute("id"))
  17247. {
  17248. itemAction->setObjectName(itemElement.attribute("id"));
  17249. }
  17250. if(itemElement.hasAttribute("shortcut"))
  17251. {
  17252. itemAction->setShortcut(itemElement.attribute("shortcut"));
  17253. }
  17254. menu->addAction(itemAction);
  17255. }
  17256. else if(itemElement.tagName()=="separator")
  17257. {
  17258. menu->addSeparator();
  17259. }
  17260. else if(itemElement.tagName()=="plugins")
  17261. {
  17262. /*687:*/
  17263. #line 21 "./plugins.w"
  17264. QMenu*pluginMenu= new QMenu(menu);
  17265. if(itemElement.hasAttribute("id"))
  17266. {
  17267. pluginMenu->setObjectName(itemElement.attribute("id"));
  17268. }
  17269. if(itemElement.hasAttribute("title"))
  17270. {
  17271. pluginMenu->setTitle(itemElement.attribute("title"));
  17272. }
  17273. if(itemElement.hasAttribute("src"))
  17274. {
  17275. QSettings settings;
  17276. QString pluginDirectory= QString("%1/%2").
  17277. arg(settings.value("config").toString()).
  17278. arg(itemElement.attribute("src"));
  17279. QDir directory(pluginDirectory);
  17280. directory.setFilter(QDir::Files);
  17281. directory.setSorting(QDir::Name);
  17282. QStringList nameFilter;
  17283. nameFilter<<"*.js";
  17284. directory.setNameFilters(nameFilter);
  17285. QFileInfoList pluginFiles= directory.entryInfoList();
  17286. for(int k= 0;k<pluginFiles.size();k++)
  17287. {
  17288. PluginAction*pa= new PluginAction(pluginFiles.at(k),pluginMenu);
  17289. if(itemElement.hasAttribute("preRun"))
  17290. {
  17291. pa->setPreRun(itemElement.attribute("preRun"));
  17292. }
  17293. if(itemElement.hasAttribute("postRun"))
  17294. {
  17295. pa->setPostRun(itemElement.attribute("postRun"));
  17296. }
  17297. pluginMenu->addAction(pa);
  17298. }
  17299. }
  17300. menu->addMenu(pluginMenu);
  17301. /*:687*/
  17302. #line 4851 "./typica.w"
  17303. }
  17304. }
  17305. j++;
  17306. }
  17307. #line 1 "./helpmenu.w"
  17308. /*:204*/
  17309. #line 4815 "./typica.w"
  17310. }
  17311. }
  17312. /*:203*/
  17313. #line 4772 "./typica.w"
  17314. }
  17315. }
  17316. i++;
  17317. }
  17318. QScriptValue oldThis= context->thisObject();
  17319. context->setThisObject(object);
  17320. QScriptValue result= engine->evaluate(windowScript);
  17321. /*195:*/
  17322. #line 4525 "./typica.w"
  17323. if(engine->hasUncaughtException())
  17324. {
  17325. int line= engine->uncaughtExceptionLineNumber();
  17326. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  17327. result.toString();
  17328. QString trace;
  17329. foreach(trace,engine->uncaughtExceptionBacktrace())
  17330. {
  17331. qDebug()<<trace;
  17332. }
  17333. }
  17334. /*:195*/
  17335. #line 4780 "./typica.w"
  17336. context->setThisObject(oldThis);
  17337. /*:202*/
  17338. #line 4721 "./typica.w"
  17339. }
  17340. /*205:*/
  17341. #line 9 "./helpmenu.w"
  17342. HelpMenu*helpMenu= new HelpMenu();
  17343. window->menuBar()->addMenu(helpMenu);
  17344. /*:205*/
  17345. #line 4723 "./typica.w"
  17346. window->show();
  17347. window->setupFinished();
  17348. /*:201*/
  17349. #line 4664 "./typica.w"
  17350. }
  17351. file.close();
  17352. }
  17353. return object;
  17354. }
  17355. /*:199*//*217:*/
  17356. #line 4871 "./typica.w"
  17357. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  17358. QStack<QLayout*> *layoutStack)
  17359. {
  17360. if(element.hasAttribute("type"))
  17361. {
  17362. /*218:*/
  17363. #line 4892 "./typica.w"
  17364. QLayout*layout;
  17365. QString layoutType= element.attribute("type");
  17366. if(layoutType=="horizontal")
  17367. {
  17368. layout= new QHBoxLayout;
  17369. layoutStack->push(layout);
  17370. populateBoxLayout(element,widgetStack,layoutStack);
  17371. }
  17372. else if(layoutType=="vertical")
  17373. {
  17374. layout= new QVBoxLayout;
  17375. layoutStack->push(layout);
  17376. populateBoxLayout(element,widgetStack,layoutStack);
  17377. }
  17378. else if(layoutType=="grid")
  17379. {
  17380. layout= new QGridLayout;
  17381. layoutStack->push(layout);
  17382. populateGridLayout(element,widgetStack,layoutStack);
  17383. }
  17384. else if(layoutType=="stack")
  17385. {
  17386. layout= new QStackedLayout;
  17387. layoutStack->push(layout);
  17388. populateStackedLayout(element,widgetStack,layoutStack);
  17389. }
  17390. if(element.hasAttribute("id"))
  17391. {
  17392. layout->setObjectName(element.attribute("id"));
  17393. }
  17394. if(element.hasAttribute("spacing"))
  17395. {
  17396. layout->setSpacing(element.attribute("spacing").toInt());
  17397. }
  17398. if(element.hasAttribute("margin"))
  17399. {
  17400. int m= element.attribute("margin").toInt();
  17401. layout->setContentsMargins(m,m,m,m);
  17402. }
  17403. /*:218*/
  17404. #line 4877 "./typica.w"
  17405. QWidget*widget= widgetStack->top();
  17406. if(layout)
  17407. {
  17408. widget->setLayout(layout);
  17409. }
  17410. layoutStack->pop();
  17411. }
  17412. }
  17413. /*:217*//*219:*/
  17414. #line 4939 "./typica.w"
  17415. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  17416. QStack<QLayout*> *layoutStack)
  17417. {
  17418. QDomNodeList children= element.childNodes();
  17419. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  17420. for(int i= 0;i<children.count();i++)
  17421. {
  17422. QDomNode current;
  17423. QDomElement currentElement;
  17424. current= children.at(i);
  17425. if(current.isElement())
  17426. {
  17427. currentElement= current.toElement();
  17428. if(currentElement.tagName()=="page")
  17429. {
  17430. QWidget*widget= new QWidget;
  17431. layout->addWidget(widget);
  17432. widgetStack->push(widget);
  17433. currentElement.setAttribute("trcontext","configuration");
  17434. populateWidget(currentElement,widgetStack,layoutStack);
  17435. widgetStack->pop();
  17436. }
  17437. }
  17438. }
  17439. }
  17440. /*:219*//*221:*/
  17441. #line 4978 "./typica.w"
  17442. void addTabBarToLayout(QDomElement element,QStack<QWidget*> *,QStack<QLayout*> *layoutStack)
  17443. {
  17444. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17445. QTabBar*widget= new QTabBar;
  17446. layout->addWidget(widget);
  17447. if(!element.attribute("id").isEmpty())
  17448. {
  17449. widget->setObjectName(element.attribute("id"));
  17450. }
  17451. }
  17452. /*:221*//*223:*/
  17453. #line 5000 "./typica.w"
  17454. QScriptValue constructQTabBar(QScriptContext*,QScriptEngine*engine)
  17455. {
  17456. QScriptValue object= engine->newQObject(new QTabBar);
  17457. setQTabBarProperties(object,engine);
  17458. return object;
  17459. }
  17460. /*:223*//*224:*/
  17461. #line 5011 "./typica.w"
  17462. void setQTabBarProperties(QScriptValue value,QScriptEngine*engine)
  17463. {
  17464. setQWidgetProperties(value,engine);
  17465. value.setProperty("addTab",engine->newFunction(QTabBar_addTab));
  17466. }
  17467. QScriptValue QTabBar_addTab(QScriptContext*context,QScriptEngine*)
  17468. {
  17469. QTabBar*self= getself<QTabBar*> (context);
  17470. if(context->argumentCount()> 0)
  17471. {
  17472. self->addTab(argument<QString> (0,context));
  17473. }
  17474. else
  17475. {
  17476. context->throwError("Incorrect number of arguments passed to "
  17477. "QTabBar::addTab().");
  17478. }
  17479. return QScriptValue();
  17480. }
  17481. /*:224*//*226:*/
  17482. #line 5046 "./typica.w"
  17483. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  17484. QStack<QLayout*> *layoutStack)
  17485. {
  17486. QDomNodeList children= element.childNodes();
  17487. int row= -1;
  17488. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  17489. for(int i= 0;i<children.count();i++)
  17490. {
  17491. QDomNode current;
  17492. QDomElement currentElement;
  17493. current= children.at(i);
  17494. if(current.isElement())
  17495. {
  17496. currentElement= current.toElement();
  17497. if(currentElement.tagName()=="row")
  17498. {
  17499. row++;
  17500. if(currentElement.hasAttribute("height"))
  17501. {
  17502. layout->setRowMinimumHeight(row,
  17503. currentElement.attribute("height").toInt());
  17504. }
  17505. if(currentElement.hasAttribute("stretch"))
  17506. {
  17507. layout->setRowStretch(row,
  17508. currentElement.attribute("stretch").toInt());
  17509. }
  17510. /*227:*/
  17511. #line 5102 "./typica.w"
  17512. int column= -1;
  17513. QDomNodeList rowChildren= currentElement.childNodes();
  17514. for(int j= 0;j<rowChildren.count();j++)
  17515. {
  17516. QDomNode columnNode;
  17517. QDomElement columnElement;
  17518. columnNode= rowChildren.at(j);
  17519. if(columnNode.isElement())
  17520. {
  17521. columnElement= columnNode.toElement();
  17522. if(columnElement.tagName()=="column")
  17523. {
  17524. column++;
  17525. if(columnElement.hasAttribute("column"))
  17526. {
  17527. column= columnElement.attribute("column").toInt();
  17528. }
  17529. if(columnElement.hasAttribute("width"))
  17530. {
  17531. layout->setColumnMinimumWidth(column,
  17532. columnElement.attribute("width").toInt());
  17533. }
  17534. if(columnElement.hasAttribute("stretch"))
  17535. {
  17536. layout->setColumnStretch(column,
  17537. columnElement.attribute("stretch").toInt());
  17538. }
  17539. int hspan= 1;
  17540. int vspan= 1;
  17541. if(columnElement.hasAttribute("rowspan"))
  17542. {
  17543. vspan= columnElement.attribute("rowspan").toInt();
  17544. }
  17545. if(columnElement.hasAttribute("colspan"))
  17546. {
  17547. hspan= columnElement.attribute("colspan").toInt();
  17548. }
  17549. QHBoxLayout*cell= new QHBoxLayout;
  17550. layout->addLayout(cell,row,column,vspan,hspan);
  17551. layoutStack->push(cell);
  17552. columnElement.setAttribute("trcontext","configuration");
  17553. populateBoxLayout(columnElement,widgetStack,layoutStack);
  17554. layoutStack->pop();
  17555. }
  17556. }
  17557. }
  17558. /*:227*/
  17559. #line 5074 "./typica.w"
  17560. }
  17561. }
  17562. }
  17563. }
  17564. /*:226*//*228:*/
  17565. #line 5153 "./typica.w"
  17566. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  17567. QStack<QLayout*> *layoutStack)
  17568. {
  17569. QDomNodeList children= element.childNodes();
  17570. for(int i= 0;i<children.count();i++)
  17571. {
  17572. QDomNode current;
  17573. QDomElement currentElement;
  17574. current= children.at(i);
  17575. if(current.isElement())
  17576. {
  17577. currentElement= current.toElement();
  17578. currentElement.setAttribute("trcontext","configuration");
  17579. if(currentElement.tagName()=="button")
  17580. {
  17581. addButtonToLayout(currentElement,widgetStack,layoutStack);
  17582. }
  17583. else if(currentElement.tagName()=="calendar")
  17584. {
  17585. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  17586. }
  17587. else if(currentElement.tagName()=="timeedit")
  17588. {
  17589. addTimeEditToLayout(currentElement,widgetStack,layoutStack);
  17590. }
  17591. else if(currentElement.tagName()=="decoration")
  17592. {
  17593. addDecorationToLayout(currentElement,widgetStack,
  17594. layoutStack);
  17595. }
  17596. else if(currentElement.tagName()=="layout")
  17597. {
  17598. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  17599. }
  17600. else if(currentElement.tagName()=="splitter")
  17601. {
  17602. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  17603. }
  17604. else if(currentElement.tagName()=="label")
  17605. {
  17606. QBoxLayout*layout=
  17607. qobject_cast<QBoxLayout*> (layoutStack->top());
  17608. QLabel*label= new QLabel(QCoreApplication::translate(
  17609. "configuration",
  17610. currentElement.text().toUtf8().data()));
  17611. layout->addWidget(label);
  17612. }
  17613. else if(currentElement.tagName()=="lcdtemperature")
  17614. {
  17615. addTemperatureDisplayToLayout(currentElement,widgetStack,
  17616. layoutStack);
  17617. }
  17618. else if(currentElement.tagName()=="lcdtimer")
  17619. {
  17620. addTimerDisplayToLayout(currentElement,widgetStack,
  17621. layoutStack);
  17622. }
  17623. else if(currentElement.tagName()=="line")
  17624. {
  17625. addLineToLayout(currentElement,widgetStack,layoutStack);
  17626. }
  17627. else if(currentElement.tagName()=="report")
  17628. {
  17629. addReportToLayout(currentElement,widgetStack,layoutStack);
  17630. }
  17631. else if(currentElement.tagName()=="sqldrop")
  17632. {
  17633. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  17634. }
  17635. else if(currentElement.tagName()=="sqltablearray")
  17636. {
  17637. addSaltToLayout(currentElement,widgetStack,layoutStack);
  17638. }
  17639. else if(currentElement.tagName()=="sqlview")
  17640. {
  17641. addSqlQueryViewToLayout(currentElement,widgetStack,
  17642. layoutStack);
  17643. }
  17644. else if(currentElement.tagName()=="textarea")
  17645. {
  17646. addTextToLayout(currentElement,widgetStack,layoutStack);
  17647. }
  17648. else if(currentElement.tagName()=="spinbox")
  17649. {
  17650. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  17651. }
  17652. else if(currentElement.tagName()=="formarray")
  17653. {
  17654. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  17655. }
  17656. else if(currentElement.tagName()=="hscale")
  17657. {
  17658. addScaleControlToLayout(currentElement,widgetStack,
  17659. layoutStack);
  17660. }
  17661. else if(currentElement.tagName()=="vscale")
  17662. {
  17663. addIntensityControlToLayout(currentElement,widgetStack,
  17664. layoutStack);
  17665. }
  17666. else if(currentElement.tagName()=="webview")
  17667. {
  17668. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  17669. }
  17670. else if(currentElement.tagName()=="stretch")
  17671. {
  17672. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17673. layout->addStretch();
  17674. }
  17675. /*54:*/
  17676. #line 1543 "./typica.w"
  17677. else if(currentElement.tagName()=="svgwidget")
  17678. {
  17679. addSvgWidgetToLayout(currentElement,widgetStack,layoutStack);
  17680. }
  17681. /*:54*//*220:*/
  17682. #line 4970 "./typica.w"
  17683. else if(currentElement.tagName()=="tabbar")
  17684. {
  17685. addTabBarToLayout(currentElement,widgetStack,layoutStack);
  17686. }
  17687. /*:220*//*596:*/
  17688. #line 111 "./printerselector.w"
  17689. else if(currentElement.tagName()=="printerselector")
  17690. {
  17691. addPrinterSelectorToLayout(currentElement,widgetStack,layoutStack);
  17692. }
  17693. #line 12804 "./typica.w"
  17694. /*:596*//*710:*/
  17695. #line 453 "./daterangeselector.w"
  17696. else if(currentElement.tagName()=="daterange")
  17697. {
  17698. addDateRangeToLayout(currentElement,widgetStack,layoutStack);
  17699. }
  17700. /*:710*/
  17701. #line 5263 "./typica.w"
  17702. }
  17703. }
  17704. }
  17705. /*:228*//*229:*/
  17706. #line 5271 "./typica.w"
  17707. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  17708. QStack<QLayout*> *layoutStack)
  17709. {
  17710. QLayout*targetLayout= layoutStack->pop();
  17711. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  17712. if(element.hasAttribute("type"))
  17713. {
  17714. /*218:*/
  17715. #line 4892 "./typica.w"
  17716. QLayout*layout;
  17717. QString layoutType= element.attribute("type");
  17718. if(layoutType=="horizontal")
  17719. {
  17720. layout= new QHBoxLayout;
  17721. layoutStack->push(layout);
  17722. populateBoxLayout(element,widgetStack,layoutStack);
  17723. }
  17724. else if(layoutType=="vertical")
  17725. {
  17726. layout= new QVBoxLayout;
  17727. layoutStack->push(layout);
  17728. populateBoxLayout(element,widgetStack,layoutStack);
  17729. }
  17730. else if(layoutType=="grid")
  17731. {
  17732. layout= new QGridLayout;
  17733. layoutStack->push(layout);
  17734. populateGridLayout(element,widgetStack,layoutStack);
  17735. }
  17736. else if(layoutType=="stack")
  17737. {
  17738. layout= new QStackedLayout;
  17739. layoutStack->push(layout);
  17740. populateStackedLayout(element,widgetStack,layoutStack);
  17741. }
  17742. if(element.hasAttribute("id"))
  17743. {
  17744. layout->setObjectName(element.attribute("id"));
  17745. }
  17746. if(element.hasAttribute("spacing"))
  17747. {
  17748. layout->setSpacing(element.attribute("spacing").toInt());
  17749. }
  17750. if(element.hasAttribute("margin"))
  17751. {
  17752. int m= element.attribute("margin").toInt();
  17753. layout->setContentsMargins(m,m,m,m);
  17754. }
  17755. /*:218*/
  17756. #line 5279 "./typica.w"
  17757. boxLayout->addLayout(layout);
  17758. layoutStack->pop();
  17759. }
  17760. layoutStack->push(targetLayout);
  17761. }
  17762. /*:229*//*230:*/
  17763. #line 5290 "./typica.w"
  17764. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  17765. QStack<QLayout*> *layoutStack)
  17766. {
  17767. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17768. QSplitter*splitter= new(QSplitter);
  17769. layout->addWidget(splitter);
  17770. /*231:*/
  17771. #line 5303 "./typica.w"
  17772. QString orientation= element.attribute("type");
  17773. if(orientation=="horizontal")
  17774. {
  17775. splitter->setOrientation(Qt::Horizontal);
  17776. }
  17777. else if(orientation=="vertical")
  17778. {
  17779. splitter->setOrientation(Qt::Vertical);
  17780. }
  17781. QString id= element.attribute("id");
  17782. if(!id.isEmpty())
  17783. {
  17784. splitter->setObjectName(id);
  17785. }
  17786. if(element.hasChildNodes())
  17787. {
  17788. widgetStack->push(splitter);
  17789. populateSplitter(element,widgetStack,layoutStack);
  17790. widgetStack->pop();
  17791. }
  17792. /*:231*/
  17793. #line 5297 "./typica.w"
  17794. }
  17795. /*:230*//*232:*/
  17796. #line 5329 "./typica.w"
  17797. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  17798. QStack<QLayout*> *layoutStack)
  17799. {
  17800. QDomNodeList children= element.childNodes();
  17801. for(int i= 0;i<children.count();i++)
  17802. {
  17803. QDomNode current;
  17804. QDomElement currentElement;
  17805. current= children.at(i);
  17806. if(current.isElement())
  17807. {
  17808. currentElement= current.toElement();
  17809. currentElement.setAttribute("trcontext","configuration");
  17810. if(currentElement.tagName()=="decoration")
  17811. {
  17812. addDecorationToSplitter(currentElement,widgetStack,
  17813. layoutStack);
  17814. }
  17815. else if(currentElement.tagName()=="graph")
  17816. {
  17817. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  17818. }
  17819. else if(currentElement.tagName()=="splitter")
  17820. {
  17821. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  17822. }
  17823. else if(currentElement.tagName()=="lcdtemperature")
  17824. {
  17825. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  17826. layoutStack);
  17827. }
  17828. else if(currentElement.tagName()=="lcdtimer")
  17829. {
  17830. addTimerDisplayToSplitter(currentElement,widgetStack,
  17831. layoutStack);
  17832. }
  17833. else if(currentElement.tagName()=="measurementtable")
  17834. {
  17835. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  17836. }
  17837. else if(currentElement.tagName()=="widget")
  17838. {
  17839. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  17840. }
  17841. }
  17842. }
  17843. }
  17844. /*:232*//*233:*/
  17845. #line 5380 "./typica.w"
  17846. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  17847. QStack<QLayout*> *layoutStack)
  17848. {
  17849. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  17850. QSplitter*splitter= new(QSplitter);
  17851. splitter->setParent(parent);
  17852. parent->addWidget(splitter);
  17853. /*231:*/
  17854. #line 5303 "./typica.w"
  17855. QString orientation= element.attribute("type");
  17856. if(orientation=="horizontal")
  17857. {
  17858. splitter->setOrientation(Qt::Horizontal);
  17859. }
  17860. else if(orientation=="vertical")
  17861. {
  17862. splitter->setOrientation(Qt::Vertical);
  17863. }
  17864. QString id= element.attribute("id");
  17865. if(!id.isEmpty())
  17866. {
  17867. splitter->setObjectName(id);
  17868. }
  17869. if(element.hasChildNodes())
  17870. {
  17871. widgetStack->push(splitter);
  17872. populateSplitter(element,widgetStack,layoutStack);
  17873. widgetStack->pop();
  17874. }
  17875. /*:231*/
  17876. #line 5388 "./typica.w"
  17877. }
  17878. /*:233*//*234:*/
  17879. #line 5397 "./typica.w"
  17880. void addTemperatureDisplayToSplitter(QDomElement element,
  17881. QStack<QWidget*> *widgetStack,
  17882. QStack<QLayout*> *)
  17883. {
  17884. TemperatureDisplay*display= new(TemperatureDisplay);
  17885. if(element.hasAttribute("id"))
  17886. {
  17887. display->setObjectName(element.attribute("id"));
  17888. }
  17889. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  17890. splitter->addWidget(display);
  17891. }
  17892. void addTemperatureDisplayToLayout(QDomElement element,
  17893. QStack<QWidget*> *,
  17894. QStack<QLayout*> *layoutStack)
  17895. {
  17896. TemperatureDisplay*display= new(TemperatureDisplay);
  17897. if(element.hasAttribute("id"))
  17898. {
  17899. display->setObjectName(element.attribute("id"));
  17900. }
  17901. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17902. layout->addWidget(display);
  17903. }
  17904. /*:234*//*235:*/
  17905. #line 5428 "./typica.w"
  17906. void addTimerDisplayToSplitter(QDomElement element,
  17907. QStack<QWidget*> *widgetStack,
  17908. QStack<QLayout*> *)
  17909. {
  17910. TimerDisplay*display= new(TimerDisplay);
  17911. if(element.hasAttribute("id"))
  17912. {
  17913. display->setObjectName(element.attribute("id"));
  17914. }
  17915. if(element.hasAttribute("format"))
  17916. {
  17917. display->setDisplayFormat(element.attribute("format"));
  17918. }
  17919. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  17920. splitter->addWidget(display);
  17921. }
  17922. void addTimerDisplayToLayout(QDomElement element,
  17923. QStack<QWidget*> *,
  17924. QStack<QLayout*> *layoutStack)
  17925. {
  17926. TimerDisplay*display= new(TimerDisplay);
  17927. if(element.hasAttribute("id"))
  17928. {
  17929. display->setObjectName(element.attribute("id"));
  17930. }
  17931. if(element.hasAttribute("format"))
  17932. {
  17933. display->setDisplayFormat(element.attribute("format"));
  17934. }
  17935. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17936. layout->addWidget(display);
  17937. }
  17938. /*:235*//*236:*/
  17939. #line 5466 "./typica.w"
  17940. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  17941. QStack<QLayout*> *layoutStack)
  17942. {
  17943. /*237:*/
  17944. #line 5487 "./typica.w"
  17945. QString labelText=
  17946. QCoreApplication::translate("configuration",
  17947. element.attribute("name").toUtf8().data());
  17948. Qt::Orientations orientation= Qt::Horizontal;
  17949. if(element.hasAttribute("type"))
  17950. {
  17951. if(element.attribute("type")=="horizontal")
  17952. {
  17953. orientation= Qt::Horizontal;
  17954. }
  17955. else if(element.attribute("type")=="vertical")
  17956. {
  17957. orientation= Qt::Vertical;
  17958. }
  17959. }
  17960. /*238:*/
  17961. #line 5514 "./typica.w"
  17962. QWidget*theWidget= NULL;
  17963. QDomNodeList children= element.childNodes();
  17964. for(int i= 0;i<children.count();i++)
  17965. {
  17966. QDomNode item= children.at(i);
  17967. if(item.isElement())
  17968. {
  17969. QDomElement itemElement= item.toElement();
  17970. if(itemElement.tagName()=="lcdtemperature")
  17971. {
  17972. TemperatureDisplay*display= new TemperatureDisplay;
  17973. if(itemElement.hasAttribute("id"))
  17974. {
  17975. display->setObjectName(itemElement.attribute("id"));
  17976. }
  17977. theWidget= display;
  17978. }
  17979. else if(itemElement.tagName()=="lcdtimer")
  17980. {
  17981. TimerDisplay*display= new TimerDisplay;
  17982. if(itemElement.hasAttribute("id"))
  17983. {
  17984. display->setObjectName(itemElement.attribute("id"));
  17985. }
  17986. if(itemElement.hasAttribute("format"))
  17987. {
  17988. display->setDisplayFormat(itemElement.attribute("format"));
  17989. }
  17990. theWidget= display;
  17991. }
  17992. }
  17993. }
  17994. /*:238*/
  17995. #line 5503 "./typica.w"
  17996. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  17997. orientation);
  17998. if(element.hasAttribute("id"))
  17999. {
  18000. decoration->setObjectName(element.attribute("id"));
  18001. }
  18002. /*:237*/
  18003. #line 5470 "./typica.w"
  18004. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18005. layout->addWidget(decoration);
  18006. }
  18007. void addDecorationToSplitter(QDomElement element,
  18008. QStack<QWidget*> *widgetStack,
  18009. QStack<QLayout*> *)
  18010. {
  18011. /*237:*/
  18012. #line 5487 "./typica.w"
  18013. QString labelText=
  18014. QCoreApplication::translate("configuration",
  18015. element.attribute("name").toUtf8().data());
  18016. Qt::Orientations orientation= Qt::Horizontal;
  18017. if(element.hasAttribute("type"))
  18018. {
  18019. if(element.attribute("type")=="horizontal")
  18020. {
  18021. orientation= Qt::Horizontal;
  18022. }
  18023. else if(element.attribute("type")=="vertical")
  18024. {
  18025. orientation= Qt::Vertical;
  18026. }
  18027. }
  18028. /*238:*/
  18029. #line 5514 "./typica.w"
  18030. QWidget*theWidget= NULL;
  18031. QDomNodeList children= element.childNodes();
  18032. for(int i= 0;i<children.count();i++)
  18033. {
  18034. QDomNode item= children.at(i);
  18035. if(item.isElement())
  18036. {
  18037. QDomElement itemElement= item.toElement();
  18038. if(itemElement.tagName()=="lcdtemperature")
  18039. {
  18040. TemperatureDisplay*display= new TemperatureDisplay;
  18041. if(itemElement.hasAttribute("id"))
  18042. {
  18043. display->setObjectName(itemElement.attribute("id"));
  18044. }
  18045. theWidget= display;
  18046. }
  18047. else if(itemElement.tagName()=="lcdtimer")
  18048. {
  18049. TimerDisplay*display= new TimerDisplay;
  18050. if(itemElement.hasAttribute("id"))
  18051. {
  18052. display->setObjectName(itemElement.attribute("id"));
  18053. }
  18054. if(itemElement.hasAttribute("format"))
  18055. {
  18056. display->setDisplayFormat(itemElement.attribute("format"));
  18057. }
  18058. theWidget= display;
  18059. }
  18060. }
  18061. }
  18062. /*:238*/
  18063. #line 5503 "./typica.w"
  18064. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  18065. orientation);
  18066. if(element.hasAttribute("id"))
  18067. {
  18068. decoration->setObjectName(element.attribute("id"));
  18069. }
  18070. /*:237*/
  18071. #line 5479 "./typica.w"
  18072. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  18073. splitter->addWidget(decoration);
  18074. }
  18075. /*:236*//*239:*/
  18076. #line 5553 "./typica.w"
  18077. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  18078. QStack<QLayout*> *layoutStack)
  18079. {
  18080. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  18081. QWidget*widget= new QWidget;
  18082. if(element.hasAttribute("id"))
  18083. {
  18084. widget->setObjectName(element.attribute("id"));
  18085. }
  18086. splitter->addWidget(widget);
  18087. if(element.hasChildNodes())
  18088. {
  18089. widgetStack->push(widget);
  18090. populateWidget(element,widgetStack,layoutStack);
  18091. widgetStack->pop();
  18092. }
  18093. }
  18094. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  18095. QStack<QLayout*> *layoutStack)
  18096. {
  18097. QDomNodeList children= element.childNodes();
  18098. for(int i= 0;i<children.count();i++)
  18099. {
  18100. QDomNode current;
  18101. QDomElement currentElement;
  18102. current= children.at(i);
  18103. if(current.isElement())
  18104. {
  18105. currentElement= current.toElement();
  18106. if(currentElement.tagName()=="layout")
  18107. {
  18108. currentElement.setAttribute("trcontext","configuration");
  18109. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  18110. }
  18111. }
  18112. }
  18113. }
  18114. /*:239*//*240:*/
  18115. #line 5597 "./typica.w"
  18116. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  18117. QStack<QLayout*> *layoutStack)
  18118. {
  18119. QAbstractButton*button= NULL;
  18120. QString text=
  18121. QCoreApplication::translate("configuration",
  18122. element.attribute("name").toUtf8().data());
  18123. if(element.hasAttribute("type"))
  18124. {
  18125. QString type= element.attribute("type");
  18126. if(type=="annotation")
  18127. {
  18128. AnnotationButton*abutton= new AnnotationButton(text);
  18129. if(element.hasAttribute("annotation"))
  18130. {
  18131. abutton->setAnnotation(element.attribute("annotation"));
  18132. }
  18133. if(element.hasAttribute("series"))
  18134. {
  18135. abutton->setTemperatureColumn(element.attribute("series").
  18136. toInt());
  18137. }
  18138. if(element.hasAttribute("column"))
  18139. {
  18140. abutton->setAnnotationColumn(element.attribute("column").
  18141. toInt());
  18142. }
  18143. button= abutton;
  18144. }
  18145. else if(type=="check")
  18146. {
  18147. button= new QCheckBox(text);
  18148. }
  18149. else if(type=="push")
  18150. {
  18151. button= new QPushButton(text);
  18152. }
  18153. }
  18154. if(element.hasAttribute("id"))
  18155. {
  18156. button->setObjectName(element.attribute("id"));
  18157. }
  18158. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18159. layout->addWidget(button);
  18160. }
  18161. /*:240*//*241:*/
  18162. #line 5651 "./typica.w"
  18163. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  18164. QStack<QLayout*> *layoutStack)
  18165. {
  18166. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  18167. if(element.hasAttribute("pretext"))
  18168. {
  18169. box->setPretext(QCoreApplication::translate(
  18170. "configuration",
  18171. element.attribute("pretext").toUtf8().data()));
  18172. }
  18173. if(element.hasAttribute("posttext"))
  18174. {
  18175. box->setPosttext(QCoreApplication::translate(
  18176. "configuration",
  18177. element.attribute("posttext").toUtf8().data()));
  18178. }
  18179. if(element.hasAttribute("series"))
  18180. {
  18181. box->setTemperatureColumn(element.attribute("series").toInt());
  18182. }
  18183. if(element.hasAttribute("column"))
  18184. {
  18185. box->setAnnotationColumn(element.attribute("column").toInt());
  18186. }
  18187. if(element.hasAttribute("min"))
  18188. {
  18189. box->setMinimum(element.attribute("min").toDouble());
  18190. }
  18191. if(element.hasAttribute("max"))
  18192. {
  18193. box->setMaximum(element.attribute("max").toDouble());
  18194. }
  18195. if(element.hasAttribute("decimals"))
  18196. {
  18197. box->setDecimals(element.attribute("decimals").toInt());
  18198. }
  18199. if(element.hasAttribute("step"))
  18200. {
  18201. box->setSingleStep(element.attribute("step").toDouble());
  18202. }
  18203. if(element.hasAttribute("id"))
  18204. {
  18205. box->setObjectName(element.attribute("id"));
  18206. }
  18207. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18208. layout->addWidget(box);
  18209. }
  18210. /*:241*//*242:*/
  18211. #line 5711 "./typica.w"
  18212. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  18213. QStack<QLayout*> *)
  18214. {
  18215. ZoomLog*widget= new ZoomLog;
  18216. if(element.hasAttribute("id"))
  18217. {
  18218. widget->setObjectName(element.attribute("id"));
  18219. }
  18220. if(element.hasChildNodes())
  18221. {
  18222. QDomNodeList children= element.childNodes();
  18223. int column= 0;
  18224. for(int i= 0;i<children.count();i++)
  18225. {
  18226. QDomNode current;
  18227. QDomElement currentElement;
  18228. current= children.at(i);
  18229. if(current.isElement())
  18230. {
  18231. currentElement= current.toElement();
  18232. if(currentElement.tagName()=="column")
  18233. {
  18234. QString text=
  18235. QCoreApplication::translate(
  18236. "configuration",
  18237. currentElement.text().toUtf8().data());
  18238. widget->setHeaderData(column,text);
  18239. column++;
  18240. }
  18241. }
  18242. }
  18243. }
  18244. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  18245. if(splitter)
  18246. {
  18247. splitter->addWidget(widget);
  18248. }
  18249. else
  18250. {
  18251. qDebug()<<"Splitter not found at top of widget stack!";
  18252. }
  18253. }
  18254. /*:242*//*243:*/
  18255. #line 5758 "./typica.w"
  18256. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  18257. QStack<QLayout*> *)
  18258. {
  18259. GraphView*view= new GraphView;
  18260. if(element.hasAttribute("id"))
  18261. {
  18262. view->setObjectName(element.attribute("id"));
  18263. }
  18264. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  18265. splitter->addWidget(view);
  18266. }
  18267. /*:243*//*244:*/
  18268. #line 5775 "./typica.w"
  18269. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  18270. QStack<QLayout*> *layoutStack)
  18271. {
  18272. SqlComboBox*box= new SqlComboBox();
  18273. if(element.hasAttribute("data"))
  18274. {
  18275. box->setDataColumn(element.attribute("data").toInt());
  18276. }
  18277. if(element.hasAttribute("display"))
  18278. {
  18279. box->setDisplayColumn(element.attribute("display").toInt());
  18280. }
  18281. if(element.hasAttribute("showdata"))
  18282. {
  18283. if(element.attribute("showdata")=="true")
  18284. {
  18285. box->showData(true);
  18286. }
  18287. }
  18288. if(element.hasAttribute("editable"))
  18289. {
  18290. if(element.attribute("editable")=="true")
  18291. {
  18292. box->setEditable(true);
  18293. }
  18294. }
  18295. if(element.hasChildNodes())
  18296. {
  18297. QDomNodeList children= element.childNodes();
  18298. for(int i= 0;i<children.count();i++)
  18299. {
  18300. QDomNode current;
  18301. QDomElement currentElement;
  18302. current= children.at(i);
  18303. if(current.isElement())
  18304. {
  18305. currentElement= current.toElement();
  18306. if(currentElement.tagName()=="null")
  18307. {
  18308. box->addNullOption();
  18309. }
  18310. else if(currentElement.tagName()=="query")
  18311. {
  18312. box->addSqlOptions(currentElement.text());
  18313. }
  18314. }
  18315. }
  18316. }
  18317. if(element.hasAttribute("id"))
  18318. {
  18319. box->setObjectName(element.attribute("id"));
  18320. }
  18321. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18322. layout->addWidget(box);
  18323. }
  18324. /*:244*//*245:*/
  18325. #line 5854 "./typica.w"
  18326. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  18327. QStack<QLayout*> *layoutStack)
  18328. {
  18329. QTableView*view= new QTableView;
  18330. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  18331. SaltModel*model= new SaltModel(element.childNodes().count());
  18332. if(element.hasAttribute("id"))
  18333. {
  18334. view->setObjectName(element.attribute("id"));
  18335. }
  18336. if(element.hasChildNodes())
  18337. {
  18338. QDomNodeList children= element.childNodes();
  18339. int currentColumn= 0;
  18340. for(int i= 0;i<children.count();i++)
  18341. {
  18342. QDomNode current;
  18343. QDomElement currentElement;
  18344. current= children.at(i);
  18345. if(current.isElement())
  18346. {
  18347. currentElement= current.toElement();
  18348. if(currentElement.tagName()=="column")
  18349. {
  18350. if(currentElement.hasAttribute("name"))
  18351. {
  18352. model->setHeaderData(currentColumn,
  18353. Qt::Horizontal,
  18354. QCoreApplication::translate(
  18355. "configuration",
  18356. currentElement.attribute("name").toUtf8().data()));
  18357. }
  18358. if(currentElement.hasAttribute("delegate"))
  18359. {
  18360. /*246:*/
  18361. #line 5905 "./typica.w"
  18362. if(currentElement.attribute("delegate")=="sql")
  18363. {
  18364. /*247:*/
  18365. #line 5921 "./typica.w"
  18366. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  18367. SqlComboBox*widget= new SqlComboBox();
  18368. if(currentElement.hasAttribute("nulltext"))
  18369. {
  18370. widget->setNullText(currentElement.attribute("nulltext"));
  18371. }
  18372. if(currentElement.hasAttribute("nulldata"))
  18373. {
  18374. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  18375. }
  18376. if(currentElement.hasAttribute("null"))
  18377. {
  18378. if(currentElement.attribute("null")=="true")
  18379. {
  18380. widget->addNullOption();
  18381. }
  18382. }
  18383. if(currentElement.hasAttribute("showdata"))
  18384. {
  18385. if(currentElement.attribute("showdata")=="true")
  18386. {
  18387. widget->showData(true);
  18388. }
  18389. }
  18390. if(currentElement.hasAttribute("data"))
  18391. {
  18392. widget->setDataColumn(currentElement.attribute("data").toInt());
  18393. }
  18394. if(currentElement.hasAttribute("display"))
  18395. {
  18396. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  18397. }
  18398. widget->addSqlOptions(currentElement.text());
  18399. delegate->setWidget(widget);
  18400. view->setItemDelegateForColumn(currentColumn,delegate);
  18401. /*:247*/
  18402. #line 5908 "./typica.w"
  18403. }
  18404. else if(currentElement.attribute("delegate")=="numeric")
  18405. {
  18406. /*248:*/
  18407. #line 5962 "./typica.w"
  18408. NumericDelegate*delegate= new NumericDelegate;
  18409. view->setItemDelegateForColumn(currentColumn,delegate);
  18410. /*:248*/
  18411. #line 5912 "./typica.w"
  18412. }
  18413. /*:246*/
  18414. #line 5889 "./typica.w"
  18415. }
  18416. currentColumn++;
  18417. }
  18418. }
  18419. }
  18420. }
  18421. view->setModel(model);
  18422. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18423. layout->addWidget(view);
  18424. }
  18425. /*:245*//*260:*/
  18426. #line 6135 "./typica.w"
  18427. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  18428. QStack<QLayout*> *layoutStack)
  18429. {
  18430. QLineEdit*widget= new QLineEdit(element.text());
  18431. if(element.hasAttribute("id"))
  18432. {
  18433. widget->setObjectName(element.attribute("id"));
  18434. }
  18435. if(element.hasAttribute("writable"))
  18436. {
  18437. if(element.attribute("writable")=="false")
  18438. {
  18439. widget->setReadOnly(true);
  18440. }
  18441. }
  18442. if(element.hasAttribute("validator"))
  18443. {
  18444. if(element.attribute("validator")=="numeric")
  18445. {
  18446. widget->setValidator(new ScriptValidator(new QDoubleValidator));
  18447. }
  18448. else if(element.attribute("validator")=="integer")
  18449. {
  18450. widget->setValidator(new ScriptValidator(new QIntValidator));
  18451. }
  18452. else if(element.attribute("validator")=="expression"&&
  18453. element.hasAttribute("expression"))
  18454. {
  18455. widget->setValidator(new QRegExpValidator(
  18456. QRegExp(element.attribute("expression")),
  18457. NULL));
  18458. }
  18459. }
  18460. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18461. layout->addWidget(widget);
  18462. }
  18463. /*:260*//*261:*/
  18464. #line 6176 "./typica.w"
  18465. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  18466. QStack<QLayout*> *layoutStack)
  18467. {
  18468. QTextEdit*widget= new QTextEdit;
  18469. if(element.hasAttribute("id"))
  18470. {
  18471. widget->setObjectName(element.attribute("id"));
  18472. }
  18473. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18474. layout->addWidget(widget);
  18475. }
  18476. /*:261*//*262:*/
  18477. #line 6193 "./typica.w"
  18478. void addSqlQueryViewToLayout(QDomElement element,
  18479. QStack<QWidget*> *,
  18480. QStack<QLayout*> *layoutStack)
  18481. {
  18482. SqlQueryView*view= new SqlQueryView;
  18483. if(element.hasAttribute("id"))
  18484. {
  18485. view->setObjectName(element.attribute("id"));
  18486. }
  18487. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18488. layout->addWidget(view);
  18489. }
  18490. /*:262*//*263:*/
  18491. #line 6210 "./typica.w"
  18492. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  18493. QStack<QLayout*> *layoutStack)
  18494. {
  18495. QWidget*widget;
  18496. if(element.hasAttribute("time"))
  18497. {
  18498. if(element.attribute("time")=="true")
  18499. {
  18500. QDateTimeEdit*edit= new QDateTimeEdit;
  18501. edit->setDateTime(QDateTime::currentDateTime());
  18502. edit->setCalendarPopup(true);
  18503. edit->setDisplayFormat("yyyy-MM-dd hh:mm:ss");
  18504. widget= qobject_cast<QWidget*> (edit);
  18505. }
  18506. else
  18507. {
  18508. QDateEdit*edit= new QDateEdit;
  18509. edit->setDate(QDate::currentDate());
  18510. edit->setCalendarPopup(true);
  18511. edit->setDisplayFormat("yyyy-MM-dd");
  18512. widget= qobject_cast<QWidget*> (edit);
  18513. }
  18514. }
  18515. else
  18516. {
  18517. QDateEdit*edit= new QDateEdit;
  18518. edit->setDate(QDate::currentDate());
  18519. edit->setCalendarPopup(true);
  18520. edit->setDisplayFormat("yyyy-MM-dd");
  18521. widget= qobject_cast<QWidget*> (edit);
  18522. }
  18523. if(element.hasAttribute("id"))
  18524. {
  18525. widget->setObjectName(element.attribute("id"));
  18526. }
  18527. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18528. layout->addWidget(widget);
  18529. }
  18530. /*:263*//*264:*/
  18531. #line 6253 "./typica.w"
  18532. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  18533. {
  18534. setQDateTimeEditProperties(value,engine);
  18535. }
  18536. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  18537. {
  18538. setQAbstractSpinBoxProperties(value,engine);
  18539. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  18540. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  18541. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  18542. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  18543. value.setProperty("setToCurrentTime",
  18544. engine->newFunction(QDateTimeEdit_setToCurrentTime));
  18545. }
  18546. /*:264*//*265:*/
  18547. #line 6275 "./typica.w"
  18548. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  18549. {
  18550. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  18551. if(context->argumentCount()==3)
  18552. {
  18553. self->setDate(QDate(argument<int> (0,context),
  18554. argument<int> (1,context),
  18555. argument<int> (2,context)));
  18556. }
  18557. else
  18558. {
  18559. context->throwError("Incorrect number of arguments passed to "
  18560. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  18561. "specifying the year, month, and day.");
  18562. }
  18563. return QScriptValue();
  18564. }
  18565. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  18566. {
  18567. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  18568. return QScriptValue(self->date().day());
  18569. }
  18570. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  18571. {
  18572. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  18573. return QScriptValue(self->date().month());
  18574. }
  18575. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  18576. {
  18577. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  18578. return QScriptValue(self->date().year());
  18579. }
  18580. QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*)
  18581. {
  18582. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  18583. self->setDateTime(QDateTime::currentDateTime());
  18584. return QScriptValue();
  18585. }
  18586. /*:265*//*267:*/
  18587. #line 6335 "./typica.w"
  18588. void addTimeEditToLayout(QDomElement element,QStack<QWidget*> *,
  18589. QStack<QLayout*> *layoutStack)
  18590. {
  18591. QTimeEdit*edit= new QTimeEdit;
  18592. if(element.hasAttribute("displayFormat"))
  18593. {
  18594. edit->setDisplayFormat(element.attribute("displayFormat"));
  18595. }
  18596. else
  18597. {
  18598. edit->setDisplayFormat("mm:ss.zzz");
  18599. }
  18600. if(element.hasAttribute("id"))
  18601. {
  18602. edit->setObjectName(element.attribute("id"));
  18603. }
  18604. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18605. layout->addWidget(edit);
  18606. }
  18607. /*:267*//*268:*/
  18608. #line 6358 "./typica.w"
  18609. void setQTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  18610. {
  18611. setQDateTimeEditProperties(value,engine);
  18612. }
  18613. /*:268*//*272:*/
  18614. #line 6387 "./typica.w"
  18615. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  18616. {
  18617. QObject*parent= argument<QObject*> (0,context);
  18618. QString name= argument<QString> (1,context);
  18619. QObject*object= parent->findChild<QObject*> (name);
  18620. QScriptValue value;
  18621. if(object)
  18622. {
  18623. value= engine->newQObject(object);
  18624. QString className= object->metaObject()->className();
  18625. /*273:*/
  18626. #line 6405 "./typica.w"
  18627. if(className=="TemperatureDisplay")
  18628. {
  18629. setTemperatureDisplayProperties(value,engine);
  18630. }
  18631. else if(className=="TimerDisplay")
  18632. {
  18633. setTimerDisplayProperties(value,engine);
  18634. }
  18635. else if(className=="QAction")
  18636. {
  18637. setQActionProperties(value,engine);
  18638. }
  18639. else if(className=="QBoxLayout")
  18640. {
  18641. setQBoxLayoutProperties(value,engine);
  18642. }
  18643. else if(className=="QDateEdit")
  18644. {
  18645. setQDateEditProperties(value,engine);
  18646. }
  18647. else if(className=="QDateTimeEdit")
  18648. {
  18649. setQDateTimeEditProperties(value,engine);
  18650. }
  18651. else if(className=="QFrame")
  18652. {
  18653. setQFrameProperties(value,engine);
  18654. }
  18655. else if(className=="QHBoxLayout")
  18656. {
  18657. setQBoxLayoutProperties(value,engine);
  18658. }
  18659. else if(className=="QLCDNumber")
  18660. {
  18661. setQLCDNumberProperties(value,engine);
  18662. }
  18663. else if(className=="QMenu")
  18664. {
  18665. setQMenuProperties(value,engine);
  18666. }
  18667. else if(className=="QMenuBar")
  18668. {
  18669. setQMenuBarProperties(value,engine);
  18670. }
  18671. else if(className=="QPushButton")
  18672. {
  18673. setQPushButtonProperties(value,engine);
  18674. }
  18675. else if(className=="QSplitter")
  18676. {
  18677. setQSplitterProperties(value,engine);
  18678. }
  18679. else if(className=="QTableView")
  18680. {
  18681. if(object->property("tabletype").isValid())
  18682. {
  18683. if(object->property("tabletype").toString()=="SaltTable")
  18684. {
  18685. setSaltTableProperties(value,engine);
  18686. }
  18687. }
  18688. }
  18689. else if(className=="QVBoxLayout")
  18690. {
  18691. setQBoxLayoutProperties(value,engine);
  18692. }
  18693. else if(className=="QWidget")
  18694. {
  18695. setQWidgetProperties(value,engine);
  18696. }
  18697. else if(className=="ScriptQMainWindow")
  18698. {
  18699. setQMainWindowProperties(value,engine);
  18700. }
  18701. else if(className=="SqlComboBox")
  18702. {
  18703. setSqlComboBoxProperties(value,engine);
  18704. }
  18705. else if(className=="SqlQueryView")
  18706. {
  18707. setSqlQueryViewProperties(value,engine);
  18708. }
  18709. else if(className=="ZoomLog")
  18710. {
  18711. setZoomLogProperties(value,engine);
  18712. }
  18713. else if(className=="QTextEdit")
  18714. {
  18715. setQTextEditProperties(value,engine);
  18716. }
  18717. else if(className=="QWebView")
  18718. {
  18719. setQWebViewProperties(value,engine);
  18720. }
  18721. else if(className=="QLineEdit")
  18722. {
  18723. setQLineEditProperties(value,engine);
  18724. }
  18725. else if(className=="QSvgWidget")
  18726. {
  18727. setQSvgWidgetProperties(value,engine);
  18728. }
  18729. else if(className=="QTabBar")
  18730. {
  18731. setQTabBarProperties(value,engine);
  18732. }
  18733. else if(className=="PrinterSelector")
  18734. {
  18735. setQComboBoxProperties(value,engine);
  18736. }
  18737. /*:273*/
  18738. #line 6398 "./typica.w"
  18739. }
  18740. return value;
  18741. }
  18742. /*:272*//*275:*/
  18743. #line 6546 "./typica.w"
  18744. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  18745. {
  18746. QTableView*self= getself<QTableView*> (context);
  18747. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18748. QString datum;
  18749. double total= 0.0;
  18750. int column= argument<int> (0,context);
  18751. int role= argument<int> (1,context);
  18752. for(int i= 0;i<model->rowCount();i++)
  18753. {
  18754. datum= model->data(model->index(i,column),role).toString();
  18755. if(!datum.isEmpty())
  18756. {
  18757. total+= datum.toDouble();
  18758. }
  18759. }
  18760. return QScriptValue(engine,total);
  18761. }
  18762. /*:275*//*276:*/
  18763. #line 6570 "./typica.w"
  18764. QScriptValue SaltTable_columnArray(QScriptContext*context,
  18765. QScriptEngine*engine)
  18766. {
  18767. QTableView*self= getself<QTableView*> (context);
  18768. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18769. int column= argument<int> (0,context);
  18770. int role= argument<int> (1,context);
  18771. QString literal= model->arrayLiteral(column,role);
  18772. return QScriptValue(engine,literal);
  18773. }
  18774. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  18775. QScriptEngine*engine)
  18776. {
  18777. QTableView*self= getself<QTableView*> (context);
  18778. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18779. int column= argument<int> (0,context);
  18780. int role= argument<int> (1,context);
  18781. QString literal= model->quotedArrayLiteral(column,role);
  18782. return QScriptValue(engine,literal);
  18783. }
  18784. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  18785. QScriptEngine*engine)
  18786. {
  18787. QTableView*self= getself<QTableView*> (context);
  18788. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18789. int column= argument<int> (0,context);
  18790. int role= argument<int> (1,context);
  18791. QString literal= model->arrayLiteral(column,role);
  18792. literal.chop(1);
  18793. literal= literal.remove(0,1);
  18794. return QScriptValue(engine,literal);
  18795. }
  18796. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  18797. QScriptEngine*engine)
  18798. {
  18799. QTableView*self= getself<QTableView*> (context);
  18800. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18801. int column= argument<int> (0,context);
  18802. int role= argument<int> (1,context);
  18803. QString literal= model->quotedArrayLiteral(column,role);
  18804. literal.chop(1);
  18805. literal= literal.remove(0,1);
  18806. return QScriptValue(engine,literal);
  18807. }
  18808. /*:276*//*277:*/
  18809. #line 6622 "./typica.w"
  18810. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  18811. {
  18812. QTableView*self= getself<QTableView*> (context);
  18813. QScriptValue value= engine->newQObject(self->model());
  18814. return value;
  18815. }
  18816. /*:277*//*278:*/
  18817. #line 6636 "./typica.w"
  18818. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  18819. {
  18820. QTableView*self= getself<QTableView*> (context);
  18821. int row= argument<int> (0,context);
  18822. int column= argument<int> (1,context);
  18823. QVariant value= argument<QVariant> (2,context);
  18824. int role= argument<int> (3,context);
  18825. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18826. QModelIndex cell= model->index(row,column);
  18827. model->setData(cell,value,role);
  18828. self->update(cell);
  18829. return QScriptValue();
  18830. }
  18831. /*:278*//*279:*/
  18832. #line 6654 "./typica.w"
  18833. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  18834. {
  18835. QTableView*self= getself<QTableView*> (context);
  18836. int row= argument<int> (0,context);
  18837. int column= argument<int> (1,context);
  18838. int role= argument<int> (2,context);
  18839. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18840. QModelIndex cell= model->index(row,column);
  18841. QVariant value= model->data(cell,role);
  18842. QScriptValue retval= engine->newVariant(value);
  18843. retval.setProperty("value",QScriptValue(value.toString()));
  18844. return retval;
  18845. }
  18846. /*:279*//*280:*/
  18847. #line 6674 "./typica.w"
  18848. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  18849. {
  18850. QTableView*self= getself<QTableView*> (context);
  18851. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18852. model->clear();
  18853. return QScriptValue();
  18854. }
  18855. /*:280*//*281:*/
  18856. #line 6686 "./typica.w"
  18857. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  18858. {
  18859. QTableView*self= getself<QTableView*> (context);
  18860. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18861. int row= argument<int> (0,context);
  18862. return engine->newVariant(model->removeRow(row));
  18863. }
  18864. /*:281*//*282:*/
  18865. #line 6699 "./typica.w"
  18866. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  18867. {
  18868. QTableView*self= getself<QTableView*> (context);
  18869. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  18870. QVariant value= argument<QVariant> (0,context);
  18871. int column= argument<int> (1,context);
  18872. return engine->newVariant(model->findData(value,column));
  18873. }
  18874. /*:282*//*283:*/
  18875. #line 6712 "./typica.w"
  18876. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  18877. {
  18878. setQWidgetProperties(value,engine);
  18879. value.setProperty("columnArray",
  18880. engine->newFunction(SaltTable_columnArray));
  18881. value.setProperty("quotedColumnArray",
  18882. engine->newFunction(SaltTable_quotedColumnArray));
  18883. value.setProperty("bindableColumnArray",
  18884. engine->newFunction(SaltTable_bindableColumnArray));
  18885. value.setProperty("bindableQuotedColumnArray",
  18886. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  18887. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  18888. value.setProperty("data",engine->newFunction(SaltTable_data));
  18889. value.setProperty("model",engine->newFunction(SaltTable_model));
  18890. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  18891. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  18892. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  18893. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  18894. }
  18895. /*:283*//*285:*/
  18896. #line 6749 "./typica.w"
  18897. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  18898. {
  18899. setQComboBoxProperties(value,engine);
  18900. }
  18901. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  18902. {
  18903. setQWidgetProperties(value,engine);
  18904. value.setProperty("currentData",
  18905. engine->newFunction(QComboBox_currentData));
  18906. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  18907. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  18908. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  18909. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  18910. }
  18911. QScriptValue QComboBox_currentData(QScriptContext*context,
  18912. QScriptEngine*engine)
  18913. {
  18914. QComboBox*self= getself<QComboBox*> (context);
  18915. return QScriptValue(engine,
  18916. self->itemData(self->currentIndex()).toString());
  18917. }
  18918. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  18919. {
  18920. QComboBox*self= getself<QComboBox*> (context);
  18921. self->addItem(argument<QString> (0,context));
  18922. return QScriptValue();
  18923. }
  18924. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  18925. {
  18926. QComboBox*self= getself<QComboBox*> (context);
  18927. self->setModel(argument<QAbstractItemModel*> (0,context));
  18928. return QScriptValue();
  18929. }
  18930. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  18931. {
  18932. QComboBox*self= getself<QComboBox*> (context);
  18933. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  18934. }
  18935. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  18936. {
  18937. QComboBox*self= getself<QComboBox*> (context);
  18938. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  18939. }
  18940. #line 1 "./abouttypica.w"
  18941. /*:285*//*298:*/
  18942. #line 401 "./units.w"
  18943. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
  18944. {
  18945. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  18946. argument<Units::Unit> (1,context),
  18947. argument<Units::Unit> (2,context)));
  18948. }
  18949. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  18950. QScriptEngine*)
  18951. {
  18952. return QScriptValue(Units::convertRelativeTemperature(
  18953. argument<double> (0,context),
  18954. argument<Units::Unit> (1,context),
  18955. argument<Units::Unit> (2,context)));
  18956. }
  18957. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
  18958. {
  18959. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  18960. }
  18961. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
  18962. {
  18963. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  18964. argument<Units::Unit> (1,context),
  18965. argument<Units::Unit> (2,context)));
  18966. }
  18967. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
  18968. {
  18969. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  18970. }
  18971. /*:298*//*301:*/
  18972. #line 449 "./units.w"
  18973. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  18974. {
  18975. return engine->newVariant(QVariant(value));
  18976. }
  18977. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  18978. {
  18979. value= sv.toVariant().value<Units::Unit> ();
  18980. }
  18981. /*:301*//*311:*/
  18982. #line 149 "./measurement.w"
  18983. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine)
  18984. {
  18985. QScriptValue object;
  18986. if(context->argumentCount()==2||context->argumentCount()==3)
  18987. {
  18988. double measurement= argument<double> (0,context);
  18989. QTime timestamp= argument<QTime> (1,context);
  18990. Units::Unit unit= Units::Fahrenheit;
  18991. if(context->argumentCount()==3)
  18992. {
  18993. unit= argument<Units::Unit> (2,context);
  18994. }
  18995. object= engine->toScriptValue<Measurement> (Measurement(measurement,timestamp,unit));
  18996. setMeasurementProperties(object,engine);
  18997. }
  18998. else
  18999. {
  19000. context->throwError("Incorrect number of arguments passed to "
  19001. "Measurement::Measurement(). This method takes two "
  19002. "or three arguments.");
  19003. }
  19004. return object;
  19005. }
  19006. /*:311*//*312:*/
  19007. #line 176 "./measurement.w"
  19008. void setMeasurementProperties(QScriptValue,QScriptEngine*)
  19009. {
  19010. }
  19011. /*:312*//*313:*/
  19012. #line 184 "./measurement.w"
  19013. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement)
  19014. {
  19015. QVariant var;
  19016. var.setValue(measurement);
  19017. return engine->newVariant(var);
  19018. }
  19019. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement)
  19020. {
  19021. measurement= value.toVariant().value<Measurement> ();
  19022. }
  19023. #line 6818 "./typica.w"
  19024. /*:313*//*331:*/
  19025. #line 7396 "./typica.w"
  19026. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  19027. {
  19028. QScriptValue object;
  19029. if(context->argumentCount()==1)
  19030. {
  19031. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  19032. QScriptEngine::ScriptOwnership);
  19033. setDAQProperties(object,engine);
  19034. }
  19035. else if(context->argumentCount()==2)
  19036. {
  19037. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  19038. argument<QString> (1,context)),
  19039. QScriptEngine::ScriptOwnership);
  19040. setDAQProperties(object,engine);
  19041. }
  19042. else
  19043. {
  19044. context->throwError("Incorrect number of arguments passed to DAQ"
  19045. "constructor. The DAQ constructor takes one"
  19046. "string as an argument specifying a device name."
  19047. "Example: Dev1");
  19048. }
  19049. return object;
  19050. }
  19051. /*:331*//*332:*/
  19052. #line 7426 "./typica.w"
  19053. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  19054. {
  19055. setQObjectProperties(value,engine);
  19056. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  19057. }
  19058. /*:332*//*333:*/
  19059. #line 7436 "./typica.w"
  19060. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  19061. {
  19062. DAQ*self= getself<DAQ*> (context);
  19063. QScriptValue object;
  19064. if(self)
  19065. {
  19066. object=
  19067. engine->newQObject(self->newChannel(argument<int> (0,context),
  19068. argument<int> (1,context)));
  19069. setChannelProperties(object,engine);
  19070. }
  19071. return object;
  19072. }
  19073. /*:333*//*340:*/
  19074. #line 7592 "./typica.w"
  19075. QScriptValue constructFakeDAQ(QScriptContext*context,
  19076. QScriptEngine*engine)
  19077. {
  19078. QScriptValue object;
  19079. if(context->argumentCount()==1)
  19080. {
  19081. object=
  19082. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  19083. QScriptEngine::ScriptOwnership);
  19084. setFakeDAQProperties(object,engine);
  19085. }
  19086. else
  19087. {
  19088. context->throwError("Incorrect number of arguments passed to DAQ"
  19089. "constructor. The DAQ constructor takes one"
  19090. "string as an argument specifying a device name."
  19091. "Example: Dev1");
  19092. }
  19093. return object;
  19094. }
  19095. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  19096. {
  19097. setQObjectProperties(value,engine);
  19098. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  19099. }
  19100. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  19101. {
  19102. FakeDAQ*self= getself<FakeDAQ*> (context);
  19103. QScriptValue object;
  19104. if(self)
  19105. {
  19106. object=
  19107. engine->newQObject(self->newChannel(argument<int> (0,context),
  19108. argument<int> (1,context)));
  19109. setChannelProperties(object,engine);
  19110. }
  19111. return object;
  19112. }
  19113. /*:340*//*344:*/
  19114. #line 7683 "./typica.w"
  19115. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  19116. {
  19117. setQObjectProperties(value,engine);
  19118. }
  19119. /*:344*//*351:*/
  19120. #line 7875 "./typica.w"
  19121. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  19122. {
  19123. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  19124. setLinearCalibratorProperties(object,engine);
  19125. return object;
  19126. }
  19127. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  19128. {
  19129. setQObjectProperties(value,engine);
  19130. }
  19131. /*:351*//*356:*/
  19132. #line 8013 "./typica.w"
  19133. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  19134. {
  19135. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  19136. setLinearSplineInterpolatorProperties(object,engine);
  19137. return object;
  19138. }
  19139. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  19140. {
  19141. setQObjectProperties(value,engine);
  19142. }
  19143. /*:356*//*366:*/
  19144. #line 8222 "./typica.w"
  19145. QScriptValue constructTemperatureDisplay(QScriptContext*,
  19146. QScriptEngine*engine)
  19147. {
  19148. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  19149. setTemperatureDisplayProperties(object,engine);
  19150. return object;
  19151. }
  19152. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  19153. {
  19154. setQLCDNumberProperties(value,engine);
  19155. value.setProperty("setDisplayUnits",
  19156. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  19157. }
  19158. /*:366*//*367:*/
  19159. #line 8246 "./typica.w"
  19160. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  19161. {
  19162. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  19163. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  19164. return QScriptValue();
  19165. }
  19166. /*:367*//*374:*/
  19167. #line 8383 "./typica.w"
  19168. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  19169. QScriptEngine*engine)
  19170. {
  19171. QScriptValue object=
  19172. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  19173. setMeasurementTimeOffsetProperties(object,engine);
  19174. return object;
  19175. }
  19176. void setMeasurementTimeOffsetProperties(QScriptValue value,
  19177. QScriptEngine*engine)
  19178. {
  19179. setQObjectProperties(value,engine);
  19180. }
  19181. /*:374*//*379:*/
  19182. #line 8502 "./typica.w"
  19183. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  19184. {
  19185. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  19186. return object;
  19187. }
  19188. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  19189. {
  19190. setQObjectProperties(value,engine);
  19191. }
  19192. /*:379*//*384:*/
  19193. #line 8599 "./typica.w"
  19194. QScriptValue constructZeroEmitter(QScriptContext*context,
  19195. QScriptEngine*engine)
  19196. {
  19197. QScriptValue object=
  19198. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  19199. setZeroEmitterProperties(object,engine);
  19200. return object;
  19201. }
  19202. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  19203. {
  19204. setQObjectProperties(value,engine);
  19205. }
  19206. /*:384*//*389:*/
  19207. #line 8679 "./typica.w"
  19208. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  19209. QScriptEngine*engine)
  19210. {
  19211. QScriptValue object=
  19212. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  19213. setMeasurementAdapterProperties(object,engine);
  19214. return object;
  19215. }
  19216. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  19217. {
  19218. setQObjectProperties(value,engine);
  19219. }
  19220. /*:389*//*406:*/
  19221. #line 9141 "./typica.w"
  19222. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  19223. {
  19224. QScriptValue object= engine->newQObject(new GraphView);
  19225. setGraphViewProperties(object,engine);
  19226. return object;
  19227. }
  19228. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  19229. {
  19230. setQGraphicsViewProperties(value,engine);
  19231. }
  19232. /*:406*//*429:*/
  19233. #line 9791 "./typica.w"
  19234. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  19235. {
  19236. QScriptValue object= engine->newQObject(new ZoomLog);
  19237. setZoomLogProperties(object,engine);
  19238. return object;
  19239. }
  19240. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  19241. {
  19242. setQTableViewProperties(value,engine);
  19243. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  19244. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  19245. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  19246. value.setProperty("restoreState",
  19247. engine->newFunction(ZoomLog_restoreState));
  19248. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  19249. value.setProperty("saveTemporary",
  19250. engine->newFunction(ZoomLog_saveTemporary));
  19251. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  19252. }
  19253. /*:429*//*430:*/
  19254. #line 9818 "./typica.w"
  19255. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  19256. {
  19257. ZoomLog*self= getself<ZoomLog*> (context);
  19258. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  19259. return QScriptValue(engine,retval);
  19260. }
  19261. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  19262. {
  19263. ZoomLog*self= getself<ZoomLog*> (context);
  19264. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  19265. return QScriptValue(engine,retval);
  19266. }
  19267. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  19268. QScriptEngine*engine)
  19269. {
  19270. ZoomLog*self= getself<ZoomLog*> (context);
  19271. QString filename= QDir::tempPath();
  19272. filename.append("/");
  19273. filename.append(QUuid::createUuid().toString());
  19274. filename.append(".xml");
  19275. QFile*file= new QFile(filename);
  19276. self->saveXML(file);
  19277. file->close();
  19278. delete file;
  19279. return QScriptValue(engine,filename);
  19280. }
  19281. /*:430*//*431:*/
  19282. #line 9866 "./typica.w"
  19283. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  19284. {
  19285. ZoomLog*self= getself<ZoomLog*> (context);
  19286. QString key= argument<QString> (0,context);
  19287. int columns= argument<int> (1,context);
  19288. QSettings settings;
  19289. for(int i= 0;i<columns;i++)
  19290. {
  19291. if(self->columnWidth(i))
  19292. {
  19293. settings.beginGroup(key);
  19294. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  19295. settings.endGroup();
  19296. }
  19297. }
  19298. return QScriptValue();
  19299. }
  19300. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  19301. {
  19302. ZoomLog*self= getself<ZoomLog*> (context);
  19303. QString key= argument<QString> (0,context);
  19304. int columns= argument<int> (1,context);
  19305. QSettings settings;
  19306. for(int i= 0;i<columns;i++)
  19307. {
  19308. settings.beginGroup(key);
  19309. self->setColumnWidth(i,
  19310. settings.value(QString("%1").arg(i),80).toInt());
  19311. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  19312. {
  19313. self->setColumnWidth(i,80);
  19314. }
  19315. settings.endGroup();
  19316. }
  19317. return QScriptValue();
  19318. }
  19319. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  19320. {
  19321. ZoomLog*self= getself<ZoomLog*> (context);
  19322. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  19323. }
  19324. /*:431*//*432:*/
  19325. #line 9919 "./typica.w"
  19326. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  19327. {
  19328. ZoomLog*self= getself<ZoomLog*> (context);
  19329. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  19330. return QScriptValue();
  19331. }
  19332. /*:432*//*467:*/
  19333. #line 10739 "./typica.w"
  19334. QScriptValue constructAnnotationButton(QScriptContext*context,
  19335. QScriptEngine*engine)
  19336. {
  19337. QScriptValue object=
  19338. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  19339. setAnnotationButtonProperties(object,engine);
  19340. return object;
  19341. }
  19342. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  19343. {
  19344. setQPushButtonProperties(value,engine);
  19345. }
  19346. /*:467*//*475:*/
  19347. #line 10882 "./typica.w"
  19348. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  19349. QScriptEngine*engine)
  19350. {
  19351. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  19352. argument<QString> (0,context),argument<QString> (1,context)));
  19353. setAnnotationSpinBoxProperties(object,engine);
  19354. return object;
  19355. }
  19356. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  19357. {
  19358. setQDoubleSpinBoxProperties(value,engine);
  19359. }
  19360. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  19361. {
  19362. setQAbstractSpinBoxProperties(value,engine);
  19363. }
  19364. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  19365. {
  19366. setQWidgetProperties(value,engine);
  19367. }
  19368. /*:475*//*496:*/
  19369. #line 11305 "./typica.w"
  19370. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  19371. {
  19372. QScriptValue object= engine->newQObject(new TimerDisplay);
  19373. setTimerDisplayProperties(object,engine);
  19374. return object;
  19375. }
  19376. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  19377. {
  19378. setQLCDNumberProperties(value,engine);
  19379. value.setProperty("setTimerMode",engine->newFunction(TimerDisplay_setTimerMode));
  19380. }
  19381. /*:496*//*497:*/
  19382. #line 11324 "./typica.w"
  19383. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*)
  19384. {
  19385. TimerDisplay*self= getself<TimerDisplay*> (context);
  19386. if(self)
  19387. {
  19388. switch(argument<int> (0,context))
  19389. {
  19390. case 0:
  19391. self->setMode(TimerDisplay::CountUp);
  19392. break;
  19393. case 1:
  19394. self->setMode(TimerDisplay::CountDown);
  19395. break;
  19396. case 2:
  19397. self->setMode(TimerDisplay::Clock);
  19398. break;
  19399. default:
  19400. break;
  19401. }
  19402. }
  19403. return QScriptValue();
  19404. }
  19405. /*:497*//*524:*/
  19406. #line 11830 "./typica.w"
  19407. QScriptValue constructWidgetDecorator(QScriptContext*context,
  19408. QScriptEngine*engine)
  19409. {
  19410. QWidget*widget= argument<QWidget*> (0,context);
  19411. QString text= argument<QString> (1,context);
  19412. Qt::Orientations orientation;
  19413. switch(argument<int> (2,context))
  19414. {
  19415. case 2:
  19416. orientation= Qt::Vertical;
  19417. break;
  19418. default:
  19419. orientation= Qt::Horizontal;
  19420. break;
  19421. }
  19422. QScriptValue object=
  19423. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  19424. setWidgetDecoratorProperties(object,engine);
  19425. return object;
  19426. }
  19427. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  19428. {
  19429. setQWidgetProperties(value,engine);
  19430. }
  19431. /*:524*//*537:*/
  19432. #line 12111 "./typica.w"
  19433. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  19434. {
  19435. QScriptValue object= engine->newQObject(new LogEditWindow);
  19436. return object;
  19437. }
  19438. /*:537*//*556:*/
  19439. #line 12638 "./typica.w"
  19440. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  19441. {
  19442. QIODevice*device= argument<QIODevice*> (0,context);
  19443. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  19444. argument<int> (1,context)));
  19445. object.setProperty("input",engine->newFunction(XMLInput_input));
  19446. return object;
  19447. }
  19448. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  19449. {
  19450. XMLInput*self= getself<XMLInput*> (context);
  19451. self->input();
  19452. return QScriptValue();
  19453. }
  19454. /*:556*//*571:*/
  19455. #line 172 "./webview.w"
  19456. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  19457. {
  19458. QScriptValue object= engine->newQObject(new TypicaWebView);
  19459. setQWebViewProperties(object,engine);
  19460. return object;
  19461. }
  19462. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  19463. {
  19464. setQWidgetProperties(value,engine);
  19465. }
  19466. /*:571*//*572:*/
  19467. #line 189 "./webview.w"
  19468. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  19469. QStack<QLayout*> *layoutStack)
  19470. {
  19471. TypicaWebView*view= new TypicaWebView;
  19472. if(element.hasAttribute("id"))
  19473. {
  19474. view->setObjectName(element.attribute("id"));
  19475. }
  19476. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19477. layout->addWidget(view);
  19478. }
  19479. /*:572*//*577:*/
  19480. #line 240 "./webview.w"
  19481. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  19482. {
  19483. QVariant var;
  19484. var.setValue(element);
  19485. QScriptValue object= engine->newVariant(var);
  19486. return object;
  19487. }
  19488. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  19489. {
  19490. element= value.toVariant().value<QWebElement> ();
  19491. }
  19492. /*:577*//*582:*/
  19493. #line 305 "./webview.w"
  19494. template<> QWebElement argument(int arg,QScriptContext*context)
  19495. {
  19496. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  19497. }
  19498. /*:582*//*583:*/
  19499. #line 314 "./webview.w"
  19500. QScriptValue constructWebElement(QScriptContext*context,
  19501. QScriptEngine*engine)
  19502. {
  19503. QWebElement element= argument<QWebElement> (0,context);
  19504. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  19505. return object;
  19506. }
  19507. /*:583*//*594:*/
  19508. #line 85 "./printerselector.w"
  19509. QScriptValue constructPrinterSelector(QScriptContext*,QScriptEngine*engine)
  19510. {
  19511. QScriptValue object= engine->newQObject(new PrinterSelector);
  19512. setQComboBoxProperties(object,engine);
  19513. return object;
  19514. }
  19515. /*:594*//*595:*/
  19516. #line 96 "./printerselector.w"
  19517. void addPrinterSelectorToLayout(QDomElement element,QStack<QWidget*> *,
  19518. QStack<QLayout*> *layoutStack)
  19519. {
  19520. PrinterSelector*selector= new PrinterSelector;
  19521. if(element.hasAttribute("id"))
  19522. {
  19523. selector->setObjectName(element.attribute("id"));
  19524. }
  19525. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19526. layout->addWidget(selector);
  19527. }
  19528. /*:595*//*660:*/
  19529. #line 13998 "./typica.w"
  19530. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  19531. {
  19532. QScriptValue object= engine->newQObject(new SqlQueryView);
  19533. setSqlQueryViewProperties(object,engine);
  19534. return object;
  19535. }
  19536. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  19537. {
  19538. setQTableViewProperties(value,engine);
  19539. value.setProperty("setHeaderData",
  19540. engine->newFunction(SqlQueryView_setHeaderData));
  19541. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  19542. }
  19543. /*:660*//*661:*/
  19544. #line 14016 "./typica.w"
  19545. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  19546. {
  19547. SqlQueryView*self= getself<SqlQueryView*> (context);
  19548. QString query= argument<QString> (0,context);
  19549. self->setQuery(query);
  19550. self->reset();
  19551. return QScriptValue();
  19552. }
  19553. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  19554. QScriptEngine*)
  19555. {
  19556. SqlQueryView*self= getself<SqlQueryView*> (context);
  19557. int section= argument<int> (0,context);
  19558. QString data= argument<QString> (1,context);
  19559. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  19560. return QScriptValue();
  19561. }
  19562. /*:661*//*669:*/
  19563. #line 14225 "./typica.w"
  19564. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  19565. QStack<QLayout*> *layoutStack)
  19566. {
  19567. QTextEdit*widget= new QTextEdit;
  19568. if(element.hasAttribute("id"))
  19569. {
  19570. widget->setObjectName(element.attribute("id"));
  19571. }
  19572. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19573. layout->addWidget(widget);
  19574. QTextDocument*document= new QTextDocument;
  19575. QFont defaultFont;
  19576. defaultFont.setPointSize(11);
  19577. document->setDefaultFont(defaultFont);
  19578. QTextCursor cursor(document);
  19579. /*670:*/
  19580. #line 14248 "./typica.w"
  19581. QDomNodeList children= element.childNodes();
  19582. for(int i= 0;i<children.count();i++)
  19583. {
  19584. QDomNode current;
  19585. QDomElement currentElement;
  19586. current= children.at(i);
  19587. if(current.isElement())
  19588. {
  19589. currentElement= current.toElement();
  19590. /*671:*/
  19591. #line 14265 "./typica.w"
  19592. if(currentElement.tagName()=="style")
  19593. {
  19594. document->setDefaultStyleSheet(currentElement.text());
  19595. }
  19596. /*:671*//*672:*/
  19597. #line 14276 "./typica.w"
  19598. if(currentElement.tagName()=="html")
  19599. {
  19600. cursor.insertHtml(currentElement.text());
  19601. }
  19602. /*:672*//*673:*/
  19603. #line 14286 "./typica.w"
  19604. if(currentElement.tagName()=="text")
  19605. {
  19606. cursor.insertText(currentElement.text());
  19607. }
  19608. /*:673*//*674:*/
  19609. #line 14296 "./typica.w"
  19610. if(currentElement.tagName()=="table")
  19611. {
  19612. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  19613. ReportTable*table= new ReportTable(frame,currentElement);
  19614. table->setParent(widget);
  19615. if(currentElement.hasAttribute("id"))
  19616. {
  19617. table->setObjectName(currentElement.attribute("id"));
  19618. }
  19619. }
  19620. /*:674*/
  19621. #line 14258 "./typica.w"
  19622. }
  19623. }
  19624. /*:670*/
  19625. #line 14241 "./typica.w"
  19626. widget->setDocument(document);
  19627. }
  19628. /*:669*//*685:*/
  19629. #line 14509 "./typica.w"
  19630. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  19631. {
  19632. QTextEdit*self= getself<QTextEdit*> (context);
  19633. QTextDocument*document= self->document();
  19634. QPrinter printer;
  19635. QPrintDialog printwindow(&printer,self);
  19636. if(printwindow.exec()!=QDialog::Accepted)
  19637. {
  19638. return QScriptValue();
  19639. }
  19640. document->print(&printer);
  19641. return QScriptValue();
  19642. }
  19643. /*:685*//*686:*/
  19644. #line 14527 "./typica.w"
  19645. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  19646. {
  19647. setQAbstractScrollAreaProperties(value,engine);
  19648. value.setProperty("print",engine->newFunction(QTextEdit_print));
  19649. }
  19650. #line 1 "./plugins.w"
  19651. /*:686*//*711:*/
  19652. #line 463 "./daterangeselector.w"
  19653. void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
  19654. QStack<QLayout*> *layoutStack)
  19655. {
  19656. DateRangeSelector*widget= new DateRangeSelector;
  19657. if(element.hasAttribute("id"))
  19658. {
  19659. widget->setObjectName(element.attribute("id"));
  19660. }
  19661. if(element.hasAttribute("initial"))
  19662. {
  19663. widget->setCurrentIndex(element.attribute("initial").toInt());
  19664. }
  19665. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19666. layout->addWidget(widget);
  19667. }
  19668. /*:711*//*722:*/
  19669. #line 14709 "./typica.w"
  19670. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  19671. QStack<QLayout*> *layoutStack)
  19672. {
  19673. FormArray*widget= new FormArray(element);
  19674. if(element.hasAttribute("id"))
  19675. {
  19676. widget->setObjectName(element.attribute("id"));
  19677. }
  19678. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19679. layout->addWidget(widget);
  19680. }
  19681. /*:722*//*743:*/
  19682. #line 15296 "./typica.w"
  19683. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  19684. QStack<QLayout*> *layoutStack)
  19685. {
  19686. ScaleControl*scale= new ScaleControl;
  19687. if(element.hasAttribute("id"))
  19688. {
  19689. scale->setObjectName(element.attribute("id"));
  19690. }
  19691. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19692. layout->addWidget(scale);
  19693. }
  19694. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  19695. QStack<QLayout*> *layoutStack)
  19696. {
  19697. IntensityControl*scale= new IntensityControl;
  19698. if(element.hasAttribute("id"))
  19699. {
  19700. scale->setObjectName(element.attribute("id"));
  19701. }
  19702. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19703. layout->addWidget(scale);
  19704. }
  19705. /*:743*//*769:*/
  19706. #line 15886 "./typica.w"
  19707. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  19708. {
  19709. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  19710. setDeviceTreeModelProperties(object,engine);
  19711. return object;
  19712. }
  19713. /*:769*//*771:*/
  19714. #line 15909 "./typica.w"
  19715. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  19716. {
  19717. setQAbstractItemModelProperties(value,engine);
  19718. value.setProperty("referenceElement",
  19719. engine->newFunction(DeviceTreeModel_referenceElement));
  19720. }
  19721. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  19722. {
  19723. setQObjectProperties(value,engine);
  19724. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  19725. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  19726. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  19727. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  19728. }
  19729. /*:771*//*772:*/
  19730. #line 15936 "./typica.w"
  19731. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  19732. QScriptEngine*engine)
  19733. {
  19734. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  19735. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  19736. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  19737. QDomElement node;
  19738. QVariantMap retval;
  19739. retval.insert("driver",referenceElement.attribute("driver"));
  19740. for(int i= 0;i<configData.size();i++)
  19741. {
  19742. node= configData.at(i).toElement();
  19743. retval.insert(node.attribute("name"),node.attribute("value"));
  19744. }
  19745. return engine->toScriptValue(retval);
  19746. }
  19747. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  19748. {
  19749. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  19750. QModelIndex index= argument<QModelIndex> (0,context);
  19751. int role= argument<int> (1,context);
  19752. return engine->toScriptValue(model->data(index,role));
  19753. }
  19754. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  19755. {
  19756. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  19757. int row= 0;
  19758. int column= 0;
  19759. QModelIndex index;
  19760. if(context->argumentCount()> 1)
  19761. {
  19762. row= argument<int> (0,context);
  19763. column= argument<int> (1,context);
  19764. }
  19765. if(context->argumentCount()> 2)
  19766. {
  19767. index= argument<QModelIndex> (2,context);
  19768. }
  19769. QModelIndex retval= model->index(row,column,index);
  19770. return engine->toScriptValue(retval);
  19771. }
  19772. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  19773. QScriptEngine*)
  19774. {
  19775. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  19776. QModelIndex index;
  19777. if(context->argumentCount()==1)
  19778. {
  19779. index= argument<QModelIndex> (0,context);
  19780. }
  19781. return QScriptValue(model->rowCount(index));
  19782. }
  19783. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  19784. QScriptEngine*engine)
  19785. {
  19786. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  19787. QModelIndex index;
  19788. if(context->argumentCount()==1)
  19789. {
  19790. index= argument<QModelIndex> (0,context);
  19791. }
  19792. return QScriptValue(engine,model->hasChildren(index));
  19793. }
  19794. /*:772*//*775:*/
  19795. #line 16020 "./typica.w"
  19796. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  19797. {
  19798. QVariant var;
  19799. var.setValue(index);
  19800. QScriptValue object= engine->newVariant(var);
  19801. return object;
  19802. }
  19803. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  19804. {
  19805. index= value.toVariant().value<QModelIndex> ();
  19806. }
  19807. /*:775*//*791:*/
  19808. #line 16318 "./typica.w"
  19809. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  19810. QScriptEngine*engine)
  19811. {
  19812. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  19813. return object;
  19814. }
  19815. /*:791*//*862:*/
  19816. #line 47 "./settings.w"
  19817. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  19818. {
  19819. QScriptValue object= engine->newQObject(new SettingsWindow);
  19820. return object;
  19821. }
  19822. /*:862*//*887:*/
  19823. #line 18972 "./typica.w"
  19824. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  19825. {
  19826. QScriptValue object;
  19827. if(context->argumentCount()==2)
  19828. {
  19829. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  19830. argument<QModelIndex> (1,context)),
  19831. QScriptEngine::ScriptOwnership);
  19832. setModbusRTUDeviceProperties(object,engine);
  19833. }
  19834. else
  19835. {
  19836. context->throwError("Incorrect number of arguments passed to "
  19837. "ModbusRTUDevice constructor. This takes the configuration model "
  19838. "and an index.");
  19839. }
  19840. return object;
  19841. }
  19842. /*:887*//*888:*/
  19843. #line 18994 "./typica.w"
  19844. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  19845. {
  19846. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  19847. QScriptValue object;
  19848. if(self)
  19849. {
  19850. if(self->channels.size()> 0)
  19851. {
  19852. object= engine->newQObject(self->channels.at(0));
  19853. setChannelProperties(object,engine);
  19854. }
  19855. }
  19856. return object;
  19857. }
  19858. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  19859. {
  19860. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  19861. QScriptValue object;
  19862. if(self)
  19863. {
  19864. if(self->channels.size()> 1)
  19865. {
  19866. object= engine->newQObject(self->channels.at(1));
  19867. setChannelProperties(object,engine);
  19868. }
  19869. }
  19870. return object;
  19871. }
  19872. /*:888*//*889:*/
  19873. #line 19027 "./typica.w"
  19874. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  19875. {
  19876. setQObjectProperties(value,engine);
  19877. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  19878. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  19879. }
  19880. /*:889*//*905:*/
  19881. #line 713 "./modbus.w"
  19882. QScriptValue constructModbusNG(QScriptContext*context,QScriptEngine*engine)
  19883. {
  19884. QScriptValue object;
  19885. if(context->argumentCount()==2)
  19886. {
  19887. object= engine->newQObject(new ModbusNG(argument<DeviceTreeModel*> (0,context),
  19888. argument<QModelIndex> (1,context)),
  19889. QScriptEngine::ScriptOwnership);
  19890. setModbusNGProperties(object,engine);
  19891. }
  19892. else
  19893. {
  19894. context->throwError("Incorrect number of arguments passed to "
  19895. "ModbusNG constructor.");
  19896. }
  19897. return object;
  19898. }
  19899. void setModbusNGProperties(QScriptValue value,QScriptEngine*engine)
  19900. {
  19901. setQObjectProperties(value,engine);
  19902. value.setProperty("getChannel",engine->newFunction(ModbusNG_getChannel));
  19903. }
  19904. QScriptValue ModbusNG_getChannel(QScriptContext*context,QScriptEngine*engine)
  19905. {
  19906. ModbusNG*self= getself<ModbusNG*> (context);
  19907. QScriptValue object;
  19908. if(self)
  19909. {
  19910. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  19911. setChannelProperties(object,engine);
  19912. }
  19913. return object;
  19914. }
  19915. #line 19578 "./typica.w"
  19916. #line 1 "./unsupportedserial.w"
  19917. /*:905*//*919:*/
  19918. #line 357 "./unsupportedserial.w"
  19919. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine)
  19920. {
  19921. QModelIndex deviceIndex= argument<QModelIndex> (0,context);
  19922. JavaScriptDevice*device= new JavaScriptDevice(deviceIndex,engine);
  19923. QScriptValue object= engine->newQObject(device);
  19924. setQObjectProperties(object,engine);
  19925. object.setProperty("getChannel",engine->newFunction(JavaScriptDevice_getChannel));
  19926. return object;
  19927. }
  19928. /*:919*//*924:*/
  19929. #line 430 "./unsupportedserial.w"
  19930. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine)
  19931. {
  19932. JavaScriptDevice*self= getself<JavaScriptDevice*> (context);
  19933. QScriptValue object;
  19934. if(self)
  19935. {
  19936. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  19937. setChannelProperties(object,engine);
  19938. }
  19939. return object;
  19940. }
  19941. /*:924*//*931:*/
  19942. #line 630 "./unsupportedserial.w"
  19943. QScriptValue getMeasurementTimestamp(QScriptContext*,QScriptEngine*engine)
  19944. {
  19945. return engine->toScriptValue<QTime> (QTime::currentTime());
  19946. }
  19947. /*:931*//*935:*/
  19948. #line 667 "./unsupportedserial.w"
  19949. QScriptValue constructSerialPort(QScriptContext*,QScriptEngine*engine)
  19950. {
  19951. QScriptValue object= engine->newQObject(new QextSerialPort());
  19952. setSerialPortProperties(object,engine);
  19953. return object;
  19954. }
  19955. /*:935*//*936:*/
  19956. #line 678 "./unsupportedserial.w"
  19957. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine)
  19958. {
  19959. setQIODeviceProperties(value,engine);
  19960. value.setProperty("flush",engine->newFunction(SerialPort_flush));
  19961. }
  19962. /*:936*//*937:*/
  19963. #line 687 "./unsupportedserial.w"
  19964. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*)
  19965. {
  19966. QextSerialPort*self= getself<QextSerialPort*> (context);
  19967. self->flush();
  19968. return QScriptValue();
  19969. }
  19970. #line 19580 "./typica.w"
  19971. #line 1 "./phidgets.w"
  19972. /*:937*//*958:*/
  19973. #line 463 "./phidgets.w"
  19974. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine)
  19975. {
  19976. if(context->argumentCount()!=1)
  19977. {
  19978. context->throwError("Incorrect number of arguments passed to "
  19979. "PhidgetsTemperatureSensor constructor. This takes "
  19980. "a QModelIndex.");
  19981. }
  19982. QScriptValue object= engine->newQObject(new PhidgetsTemperatureSensor(argument<QModelIndex> (0,context)),QScriptEngine::ScriptOwnership);
  19983. setQObjectProperties(object,engine);
  19984. object.setProperty("getChannel",engine->newFunction(Phidgets_getChannel));
  19985. return object;
  19986. }
  19987. /*:958*//*959:*/
  19988. #line 480 "./phidgets.w"
  19989. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine)
  19990. {
  19991. PhidgetsTemperatureSensor*self= getself<PhidgetsTemperatureSensor*> (context);
  19992. QScriptValue object;
  19993. if(self)
  19994. {
  19995. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  19996. setChannelProperties(object,engine);
  19997. }
  19998. return object;
  19999. }
  20000. #line 19582 "./typica.w"
  20001. /*:959*//*991:*/
  20002. #line 151 "./rate.w"
  20003. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  20004. {
  20005. int cachetime= 1;
  20006. int scaletime= 1;
  20007. if(context->argumentCount()> 0)
  20008. {
  20009. cachetime= argument<int> (0,context);
  20010. if(context->argumentCount()> 1)
  20011. {
  20012. scaletime= argument<int> (1,context);
  20013. }
  20014. }
  20015. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  20016. setRateOfChangeProperties(object,engine);
  20017. return object;
  20018. }
  20019. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  20020. {
  20021. setQObjectProperties(value,engine);
  20022. }
  20023. /*:991*//*1005:*/
  20024. #line 148 "./mergeseries.w"
  20025. QScriptValue constructDifferenceSeries(QScriptContext*,QScriptEngine*engine)
  20026. {
  20027. QScriptValue object= engine->newQObject(new DifferenceSeries);
  20028. setQObjectProperties(object,engine);
  20029. return object;
  20030. }
  20031. QScriptValue constructMeanSeries(QScriptContext*,QScriptEngine*engine)
  20032. {
  20033. QScriptValue object= engine->newQObject(new MeanSeries);
  20034. setQObjectProperties(object,engine);
  20035. return object;
  20036. }
  20037. /*:1005*//*1030:*/
  20038. #line 614 "./dataqsdk.w"
  20039. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  20040. {
  20041. QScriptValue object;
  20042. if(context->argumentCount()==1)
  20043. {
  20044. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  20045. QScriptEngine::ScriptOwnership);
  20046. setDataqSdkDeviceProperties(object,engine);
  20047. }
  20048. else
  20049. {
  20050. context->throwError("Incorrect number of arguments passed to "
  20051. "DataqSdkDevice. The constructor takes one string "
  20052. "as an argument specifying a device name. "
  20053. "Example: Dev1");
  20054. }
  20055. return object;
  20056. }
  20057. /*:1030*//*1031:*/
  20058. #line 637 "./dataqsdk.w"
  20059. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  20060. {
  20061. setQObjectProperties(value,engine);
  20062. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  20063. }
  20064. /*:1031*//*1032:*/
  20065. #line 647 "./dataqsdk.w"
  20066. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  20067. {
  20068. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  20069. QScriptValue object;
  20070. if(self)
  20071. {
  20072. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  20073. setChannelProperties(object,engine);
  20074. }
  20075. return object;
  20076. }
  20077. /*:1032*//*1057:*/
  20078. #line 80 "./scales.w"
  20079. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  20080. {
  20081. QScriptValue object;
  20082. QString labelText= "";
  20083. if(context->argumentCount()==1)
  20084. {
  20085. labelText= argument<QString> (0,context);
  20086. }
  20087. object= engine->newQObject(new DragLabel(labelText));
  20088. setDragLabelProperties(object,engine);
  20089. return object;
  20090. }
  20091. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  20092. {
  20093. setQLabelProperties(value,engine);
  20094. }
  20095. /*:1057*//*1067:*/
  20096. #line 298 "./scales.w"
  20097. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  20098. {
  20099. return engine->newVariant(QVariant((int)(value)));
  20100. }
  20101. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  20102. {
  20103. value= (BaudRateType)(sv.toVariant().toInt());
  20104. }
  20105. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  20106. {
  20107. return engine->newVariant(QVariant((int)(value)));
  20108. }
  20109. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  20110. {
  20111. value= (DataBitsType)(sv.toVariant().toInt());
  20112. }
  20113. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  20114. {
  20115. return engine->newVariant(QVariant((int)(value)));
  20116. }
  20117. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  20118. {
  20119. value= (ParityType)(sv.toVariant().toInt());
  20120. }
  20121. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  20122. {
  20123. return engine->newVariant(QVariant((int)(value)));
  20124. }
  20125. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  20126. {
  20127. value= (StopBitsType)(sv.toVariant().toInt());
  20128. }
  20129. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  20130. {
  20131. return engine->newVariant(QVariant((int)(value)));
  20132. }
  20133. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  20134. {
  20135. value= (FlowType)(sv.toVariant().toInt());
  20136. }
  20137. /*:1067*//*1070:*/
  20138. #line 367 "./scales.w"
  20139. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  20140. {
  20141. setQIODeviceProperties(value,engine);
  20142. }
  20143. /*:1070*//*1071:*/
  20144. #line 375 "./scales.w"
  20145. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  20146. {
  20147. QScriptValue object;
  20148. if(context->argumentCount()==1)
  20149. {
  20150. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  20151. setSerialScaleProperties(object,engine);
  20152. }
  20153. else
  20154. {
  20155. context->throwError("Incorrect number of arguments passed to "
  20156. "SerialScale. The constructor takes one string "
  20157. "as an argument specifying a port name.");
  20158. }
  20159. return object;
  20160. }
  20161. /*:1071*//*1093:*/
  20162. #line 278 "./valueannotation.w"
  20163. QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
  20164. {
  20165. QScriptValue object= engine->newQObject(new ValueAnnotation);
  20166. setValueAnnotationProperties(object,engine);
  20167. return object;
  20168. }
  20169. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  20170. {
  20171. setQObjectProperties(value,engine);
  20172. }
  20173. #line 20246 "./typica.w"
  20174. #line 1 "./thresholdannotation.w"
  20175. /*:1093*//*1104:*/
  20176. #line 208 "./thresholdannotation.w"
  20177. QScriptValue constructAnnotator(QScriptContext*context,QScriptEngine*engine)
  20178. {
  20179. QScriptValue object= engine->newQObject(new Annotator(argument<QString> (0,context)));
  20180. setAnnotatorProperties(object,engine);
  20181. return object;
  20182. }
  20183. void setAnnotatorProperties(QScriptValue value,QScriptEngine*engine)
  20184. {
  20185. setQObjectProperties(value,engine);
  20186. }
  20187. #line 20248 "./typica.w"
  20188. /*:1104*/
  20189. #line 530 "./typica.w"
  20190. /*639:*/
  20191. #line 13628 "./typica.w"
  20192. void messageFileOutput(QtMsgType,const char*msg)
  20193. {
  20194. QFile output("Typica-"+QDate::currentDate().toString("yyyy-MM-dd")+".log");
  20195. output.open(QIODevice::WriteOnly|QIODevice::Append);
  20196. QTextStream outstream(&output);
  20197. outstream<<msg<<"\r\n";
  20198. }
  20199. /*:639*/
  20200. #line 531 "./typica.w"
  20201. /*636:*/
  20202. #line 13589 "./typica.w"
  20203. int main(int argc,char**argv)
  20204. {
  20205. int*c= &argc;
  20206. Application app(*c,argv);
  20207. QSettings settings;
  20208. /*637:*/
  20209. #line 13615 "./typica.w"
  20210. if(settings.value("settings/advanced/logging",false).toBool())
  20211. {
  20212. qInstallMsgHandler(messageFileOutput);
  20213. }
  20214. /*:637*/
  20215. #line 13595 "./typica.w"
  20216. /*640:*/
  20217. #line 13641 "./typica.w"
  20218. QStringList themeSearchPath= QIcon::themeSearchPaths();
  20219. themeSearchPath.append(":/resources/icons/tango");
  20220. QIcon::setThemeSearchPaths(themeSearchPath);
  20221. QIcon::setThemeName(":/resources/icons/tango");
  20222. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  20223. /*:640*/
  20224. #line 13596 "./typica.w"
  20225. /*641:*/
  20226. #line 13661 "./typica.w"
  20227. QFile entypo(":/resources/fonts/entypo.ttf");
  20228. entypo.open(QIODevice::ReadOnly);
  20229. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  20230. entypo.close();
  20231. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  20232. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  20233. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  20234. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  20235. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  20236. /*:641*/
  20237. #line 13597 "./typica.w"
  20238. /*801:*/
  20239. #line 16608 "./typica.w"
  20240. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  20241. /*:801*//*811:*/
  20242. #line 16850 "./typica.w"
  20243. app.registerDeviceConfigurationWidget("nidaqmxbase",
  20244. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  20245. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  20246. NiDaqMxBase9211ConfWidget::staticMetaObject);
  20247. app.registerDeviceConfigurationWidget("ni9211seriestc",
  20248. Ni9211TcConfWidget::staticMetaObject);
  20249. /*:811*//*819:*/
  20250. #line 17081 "./typica.w"
  20251. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  20252. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  20253. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  20254. /*:819*//*843:*/
  20255. #line 18050 "./typica.w"
  20256. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  20257. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  20258. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  20259. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  20260. /*:843*//*848:*/
  20261. #line 18135 "./typica.w"
  20262. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  20263. /*:848*//*851:*/
  20264. #line 18205 "./typica.w"
  20265. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  20266. /*:851*//*854:*/
  20267. #line 18332 "./typica.w"
  20268. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  20269. #line 1 "./freeannotation.w"
  20270. /*:854*//*858:*/
  20271. #line 57 "./freeannotation.w"
  20272. app.registerDeviceConfigurationWidget("freeannotation",
  20273. FreeAnnotationConfWidget::staticMetaObject);
  20274. #line 18336 "./typica.w"
  20275. #line 1 "./settings.w"
  20276. /*:858*//*892:*/
  20277. #line 19568 "./typica.w"
  20278. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  20279. /*:892*//*898:*/
  20280. #line 321 "./modbus.w"
  20281. app.registerDeviceConfigurationWidget("modbusngport",ModbusNGConfWidget::staticMetaObject);
  20282. app.registerDeviceConfigurationWidget("modbusnginput",
  20283. ModbusNGInputConfWidget::staticMetaObject);
  20284. /*:898*//*914:*/
  20285. #line 264 "./unsupportedserial.w"
  20286. app.registerDeviceConfigurationWidget("unsupporteddevicechannel",
  20287. UnsupportedDeviceChannelConfWidget::staticMetaObject);
  20288. app.registerDeviceConfigurationWidget("unsupporteddevice",
  20289. UnsupportedSerialDeviceConfWidget::staticMetaObject);
  20290. /*:914*//*945:*/
  20291. #line 181 "./phidgets.w"
  20292. app.registerDeviceConfigurationWidget("phidgets1048",
  20293. PhidgetsTemperatureSensorConfWidget::staticMetaObject);
  20294. app.registerDeviceConfigurationWidget("phidgets1048channel",
  20295. PhidgetTemperatureSensorChannelConfWidget::staticMetaObject);
  20296. /*:945*//*965:*/
  20297. #line 19704 "./typica.w"
  20298. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  20299. /*:965*//*968:*/
  20300. #line 19764 "./typica.w"
  20301. app.registerDeviceConfigurationWidget("coolingtimer",
  20302. CoolingTimerConfWidget::staticMetaObject);
  20303. /*:968*//*973:*/
  20304. #line 20023 "./typica.w"
  20305. app.registerDeviceConfigurationWidget("rangetimer",
  20306. RangeTimerConfWidget::staticMetaObject);
  20307. /*:973*//*978:*/
  20308. #line 20124 "./typica.w"
  20309. app.registerDeviceConfigurationWidget("multirangetimer",
  20310. MultiRangeTimerConfWidget::staticMetaObject);
  20311. /*:978*//*983:*/
  20312. #line 20234 "./typica.w"
  20313. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  20314. #line 1 "./rate.w"
  20315. /*:983*//*995:*/
  20316. #line 253 "./rate.w"
  20317. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  20318. /*:995*//*1009:*/
  20319. #line 266 "./mergeseries.w"
  20320. app.registerDeviceConfigurationWidget("mergeseries",
  20321. MergeSeriesConfWidget::staticMetaObject);
  20322. /*:1009*//*1050:*/
  20323. #line 1233 "./dataqsdk.w"
  20324. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  20325. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  20326. DataqSdkChannelConfWidget::staticMetaObject);
  20327. /*:1050*//*1075:*/
  20328. #line 552 "./scales.w"
  20329. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  20330. /*:1075*//*1083:*/
  20331. #line 138 "./valueannotation.w"
  20332. app.registerDeviceConfigurationWidget("valueannotation",
  20333. ValueAnnotationConfWidget::staticMetaObject);
  20334. /*:1083*//*1097:*/
  20335. #line 109 "./thresholdannotation.w"
  20336. app.registerDeviceConfigurationWidget("thresholdannotation",
  20337. ThresholdAnnotationConfWidget::staticMetaObject);
  20338. /*:1097*/
  20339. #line 13599 "./typica.w"
  20340. /*642:*/
  20341. #line 13678 "./typica.w"
  20342. if(settings.value("database/exists","false").toString()=="true")
  20343. {
  20344. /*647:*/
  20345. #line 13812 "./typica.w"
  20346. QSqlDatabase database=
  20347. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  20348. database.setConnectOptions("application_name=Typica");
  20349. database.setHostName(settings.value("database/hostname").toString());
  20350. database.setPort(settings.value("database/portnumber",5432).toInt());
  20351. database.setDatabaseName(settings.value("database/dbname").toString());
  20352. database.setUserName(settings.value("database/user").toString());
  20353. database.setPassword(settings.value("database/password").toString());
  20354. if(!database.open())
  20355. {
  20356. settings.setValue("database/exists","false");
  20357. }
  20358. else
  20359. {
  20360. database.close();
  20361. }
  20362. /*:647*/
  20363. #line 13681 "./typica.w"
  20364. }
  20365. if(settings.value("database/exists","false").toString()=="false")
  20366. {
  20367. /*646:*/
  20368. #line 13803 "./typica.w"
  20369. SqlConnectionSetup dialog;
  20370. dialog.exec();
  20371. /*:646*/
  20372. #line 13685 "./typica.w"
  20373. }
  20374. /*:642*/
  20375. #line 13600 "./typica.w"
  20376. /*192:*/
  20377. #line 4399 "./typica.w"
  20378. QStringList arguments= QCoreApplication::arguments();
  20379. int position= arguments.indexOf("-c");
  20380. QString filename= QString();
  20381. if(position!=-1)
  20382. {
  20383. if(arguments.size()>=position+1)
  20384. {
  20385. filename= arguments.at(position+1);
  20386. }
  20387. }else{
  20388. QDir checkPath(QCoreApplication::applicationDirPath()+"/../config/");
  20389. if(checkPath.exists("config.xml")){
  20390. filename= checkPath.filePath("config.xml");
  20391. }else{
  20392. checkPath= QDir(QCoreApplication::applicationDirPath()+"/config/");
  20393. if(checkPath.exists("config.xml")){
  20394. filename= checkPath.filePath("config.xml");
  20395. }
  20396. }
  20397. }
  20398. if(filename.isEmpty())
  20399. {
  20400. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  20401. settings.value("config","").toString());
  20402. }
  20403. QDir directory;
  20404. if(!filename.isEmpty())
  20405. {
  20406. QFile file(filename);
  20407. QFileInfo info(filename);
  20408. directory= info.dir();
  20409. QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
  20410. QTranslator*configtr= new QTranslator;
  20411. if(configtr->load(QString("config.%1").arg(QLocale::system().name()),
  20412. QString("%1/Translations").arg(directory.canonicalPath())))
  20413. {
  20414. QCoreApplication::installTranslator(configtr);
  20415. }
  20416. settings.setValue("config",directory.path());
  20417. if(file.open(QIODevice::ReadOnly))
  20418. {
  20419. app.configuration()->setContent(&file,true);
  20420. }
  20421. }else{
  20422. return 1;
  20423. }
  20424. /*193:*/
  20425. #line 4452 "./typica.w"
  20426. QDomElement root= app.configuration()->documentElement();
  20427. QDomNodeList children= root.childNodes();
  20428. QString replacementDoc;
  20429. QDomDocument includedDoc;
  20430. QDomDocumentFragment fragment;
  20431. for(int i= 0;i<children.size();i++)
  20432. {
  20433. QDomNode currentNode= children.at(i);
  20434. QDomElement currentElement;
  20435. if(currentNode.nodeName()=="include")
  20436. {
  20437. currentElement= currentNode.toElement();
  20438. if(currentElement.hasAttribute("src"))
  20439. {
  20440. replacementDoc= directory.path();
  20441. replacementDoc.append('/');
  20442. replacementDoc.append(currentElement.attribute("src"));
  20443. QFile doc(replacementDoc);
  20444. if(doc.open(QIODevice::ReadOnly))
  20445. {
  20446. includedDoc.setContent(&doc,true);
  20447. fragment= includedDoc.createDocumentFragment();
  20448. fragment.appendChild(includedDoc.documentElement());
  20449. root.replaceChild(fragment,currentNode);
  20450. doc.close();
  20451. }
  20452. }
  20453. }
  20454. }
  20455. /*:193*/
  20456. #line 4446 "./typica.w"
  20457. /*:192*/
  20458. #line 13601 "./typica.w"
  20459. /*7:*/
  20460. #line 663 "./typica.w"
  20461. QScriptEngine*engine= new QScriptEngine;
  20462. QScriptValue constructor;
  20463. QScriptValue value;
  20464. /*:7*//*17:*/
  20465. #line 866 "./typica.w"
  20466. constructor= engine->newFunction(constructQTimer);
  20467. value= engine->newQMetaObject(&QTimer::staticMetaObject,constructor);
  20468. engine->globalObject().setProperty("Timer",value);
  20469. /*:17*//*20:*/
  20470. #line 905 "./typica.w"
  20471. constructor= engine->newFunction(constructQWidget);
  20472. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  20473. engine->globalObject().setProperty("QWidget",value);
  20474. /*:20*//*24:*/
  20475. #line 992 "./typica.w"
  20476. constructor= engine->newFunction(displayWarning);
  20477. engine->globalObject().setProperty("displayWarning",constructor);
  20478. constructor= engine->newFunction(displayError);
  20479. engine->globalObject().setProperty("displayError",constructor);
  20480. /*:24*//*34:*/
  20481. #line 1214 "./typica.w"
  20482. constructor= engine->newFunction(constructQMainWindow);
  20483. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  20484. constructor);
  20485. engine->globalObject().setProperty("QMainWindow",value);
  20486. /*:34*//*45:*/
  20487. #line 1419 "./typica.w"
  20488. constructor= engine->newFunction(constructQFrame);
  20489. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  20490. engine->globalObject().setProperty("QFrame",value);
  20491. /*:45*//*48:*/
  20492. #line 1452 "./typica.w"
  20493. constructor= engine->newFunction(constructQLabel);
  20494. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  20495. engine->globalObject().setProperty("QLabel",value);
  20496. /*:48*//*51:*/
  20497. #line 1495 "./typica.w"
  20498. constructor= engine->newFunction(constructQSvgWidget);
  20499. value= engine->newQMetaObject(&QSvgWidget::staticMetaObject,constructor);
  20500. engine->globalObject().setProperty("QSvgWidget",value);
  20501. /*:51*//*57:*/
  20502. #line 1577 "./typica.w"
  20503. constructor= engine->newFunction(constructQLineEdit);
  20504. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  20505. engine->globalObject().setProperty("QLineEdit",value);
  20506. /*:57*//*61:*/
  20507. #line 1624 "./typica.w"
  20508. constructor= engine->newFunction(constructQSplitter);
  20509. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  20510. engine->globalObject().setProperty("QSplitter",value);
  20511. /*:61*//*69:*/
  20512. #line 1813 "./typica.w"
  20513. constructor= engine->newFunction(constructQBoxLayout);
  20514. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  20515. engine->globalObject().setProperty("QBoxLayout",value);
  20516. /*:69*//*73:*/
  20517. #line 1925 "./typica.w"
  20518. constructor= engine->newFunction(constructQAction);
  20519. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  20520. engine->globalObject().setProperty("QAction",value);
  20521. /*:73*//*76:*/
  20522. #line 1984 "./typica.w"
  20523. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  20524. value.setProperty("getOpenFileName",
  20525. engine->newFunction(QFileDialog_getOpenFileName));
  20526. value.setProperty("getSaveFileName",
  20527. engine->newFunction(QFileDialog_getSaveFileName));
  20528. engine->globalObject().setProperty("QFileDialog",value);
  20529. /*:76*//*81:*/
  20530. #line 2102 "./typica.w"
  20531. constructor= engine->newFunction(constructQFile);
  20532. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  20533. engine->globalObject().setProperty("QFile",value);
  20534. /*:81*//*92:*/
  20535. #line 2320 "./typica.w"
  20536. constructor= engine->newFunction(constructQProcess);
  20537. value= engine->newQMetaObject(&QProcess::staticMetaObject,constructor);
  20538. engine->globalObject().setProperty("QProcess",value);
  20539. /*:92*//*101:*/
  20540. #line 2469 "./typica.w"
  20541. qScriptRegisterMetaType(engine,QByteArray_toScriptValue,QByteArray_fromScriptValue);
  20542. constructor= engine->newFunction(constructQByteArray);
  20543. engine->globalObject().setProperty("QByteArray",constructor);
  20544. /*:101*//*113:*/
  20545. #line 2711 "./typica.w"
  20546. engine->globalObject().setProperty("bytesFromInt8",engine->newFunction(bytesFromInt8));
  20547. engine->globalObject().setProperty("bytesFromInt16",engine->newFunction(bytesFromInt16));
  20548. engine->globalObject().setProperty("bytesFromInt32",engine->newFunction(bytesFromInt32));
  20549. engine->globalObject().setProperty("bytesFromFloat",engine->newFunction(bytesFromFloat));
  20550. engine->globalObject().setProperty("bytesFromDouble",engine->newFunction(bytesFromDouble));
  20551. /*:113*//*116:*/
  20552. #line 2814 "./typica.w"
  20553. constructor= engine->newFunction(constructQBuffer);
  20554. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  20555. engine->globalObject().setProperty("QBuffer",value);
  20556. /*:116*//*119:*/
  20557. #line 2863 "./typica.w"
  20558. constructor= engine->newFunction(constructXQuery);
  20559. engine->globalObject().setProperty("XQuery",constructor);
  20560. /*:119*//*125:*/
  20561. #line 2965 "./typica.w"
  20562. constructor= engine->newFunction(constructXmlWriter);
  20563. engine->globalObject().setProperty("XmlWriter",constructor);
  20564. /*:125*//*134:*/
  20565. #line 3171 "./typica.w"
  20566. constructor= engine->newFunction(constructXmlReader);
  20567. engine->globalObject().setProperty("XmlReader",constructor);
  20568. /*:134*//*141:*/
  20569. #line 3295 "./typica.w"
  20570. value= engine->newQObject(&settings);
  20571. setQSettingsProperties(value,engine);
  20572. engine->globalObject().setProperty("QSettings",value);
  20573. /*:141*//*145:*/
  20574. #line 3376 "./typica.w"
  20575. constructor= engine->newFunction(constructQLCDNumber);
  20576. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  20577. engine->globalObject().setProperty("QLCDNumber",value);
  20578. /*:145*//*148:*/
  20579. #line 3432 "./typica.w"
  20580. constructor= engine->newFunction(constructQTime);
  20581. engine->globalObject().setProperty("QTime",constructor);
  20582. /*:148*//*170:*/
  20583. #line 3945 "./typica.w"
  20584. constructor= engine->newFunction(constructQPushButton);
  20585. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  20586. engine->globalObject().setProperty("QPushButton",value);
  20587. /*:170*//*177:*/
  20588. #line 4056 "./typica.w"
  20589. constructor= engine->newFunction(constructQSqlQuery);
  20590. engine->globalObject().setProperty("QSqlQuery",constructor);
  20591. /*:177*//*184:*/
  20592. #line 4220 "./typica.w"
  20593. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  20594. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  20595. engine->globalObject().setProperty("sqlToArray",
  20596. engine->newFunction(sqlToArray));
  20597. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  20598. engine->globalObject().setProperty("annotationFromRecord",
  20599. engine->newFunction(annotationFromRecord));
  20600. engine->globalObject().setProperty("setTabOrder",
  20601. engine->newFunction(setTabOrder));
  20602. engine->globalObject().setProperty("saveFileFromDatabase",
  20603. engine->newFunction(saveFileFromDatabase));
  20604. engine->globalObject().setProperty("TTR",engine->newFunction(scriptTr));
  20605. /*:184*//*197:*/
  20606. #line 4621 "./typica.w"
  20607. engine->globalObject().setProperty("createWindow",
  20608. engine->newFunction(createWindow));
  20609. engine->globalObject().setProperty("createReport",
  20610. engine->newFunction(createReport));
  20611. /*:197*//*222:*/
  20612. #line 4993 "./typica.w"
  20613. constructor= engine->newFunction(constructQTabBar);
  20614. value= engine->newQMetaObject(&QTabBar::staticMetaObject,constructor);
  20615. engine->globalObject().setProperty("QTabBar",value);
  20616. /*:222*//*271:*/
  20617. #line 6379 "./typica.w"
  20618. engine->globalObject().setProperty("findChildObject",
  20619. engine->newFunction(findChildObject));
  20620. /*:271*//*297:*/
  20621. #line 389 "./units.w"
  20622. value= engine->newQMetaObject(&Units::staticMetaObject);
  20623. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  20624. value.setProperty("convertRelativeTemperature",
  20625. engine->newFunction(Units_convertRelativeTemperature));
  20626. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  20627. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  20628. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  20629. engine->globalObject().setProperty("Units",value);
  20630. /*:297*//*302:*/
  20631. #line 462 "./units.w"
  20632. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  20633. #line 6811 "./typica.w"
  20634. /*:302*//*310:*/
  20635. #line 141 "./measurement.w"
  20636. constructor= engine->newFunction(constructMeasurement);
  20637. engine->globalObject().setProperty("Measurement",constructor);
  20638. qScriptRegisterMetaType(engine,Measurement_toScriptValue,Measurement_fromScriptValue);
  20639. /*:310*//*330:*/
  20640. #line 7382 "./typica.w"
  20641. constructor= engine->newFunction(constructDAQ);
  20642. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  20643. value.setProperty("Fahrenheit",Units::Fahrenheit);
  20644. value.setProperty("Celsius",Units::Celsius);
  20645. value.setProperty("Kelvin",Units::Kelvin);
  20646. value.setProperty("Rankine",Units::Rankine);
  20647. engine->globalObject().setProperty("DAQ",value);
  20648. /*:330*//*339:*/
  20649. #line 7584 "./typica.w"
  20650. constructor= engine->newFunction(constructFakeDAQ);
  20651. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  20652. engine->globalObject().setProperty("FakeDAQ",value);
  20653. /*:339*//*350:*/
  20654. #line 7867 "./typica.w"
  20655. constructor= engine->newFunction(constructLinearCalibrator);
  20656. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  20657. constructor);
  20658. engine->globalObject().setProperty("LinearCalibrator",value);
  20659. /*:350*//*355:*/
  20660. #line 8006 "./typica.w"
  20661. constructor= engine->newFunction(constructLinearSplineInterpolator);
  20662. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  20663. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  20664. /*:355*//*365:*/
  20665. #line 8214 "./typica.w"
  20666. constructor= engine->newFunction(constructTemperatureDisplay);
  20667. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  20668. constructor);
  20669. engine->globalObject().setProperty("TemperatureDisplay",value);
  20670. /*:365*//*373:*/
  20671. #line 8372 "./typica.w"
  20672. constructor= engine->newFunction(constructMeasurementTimeOffset);
  20673. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  20674. constructor);
  20675. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  20676. /*:373*//*378:*/
  20677. #line 8493 "./typica.w"
  20678. constructor= engine->newFunction(constructThresholdDetector);
  20679. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  20680. engine->globalObject().setProperty("ThresholdDetector",value);
  20681. /*:378*//*383:*/
  20682. #line 8592 "./typica.w"
  20683. constructor= engine->newFunction(constructZeroEmitter);
  20684. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  20685. engine->globalObject().setProperty("ZeroEmitter",value);
  20686. /*:383*//*388:*/
  20687. #line 8671 "./typica.w"
  20688. constructor= engine->newFunction(constructMeasurementAdapter);
  20689. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  20690. constructor);
  20691. engine->globalObject().setProperty("MeasurementAdapter",value);
  20692. /*:388*//*405:*/
  20693. #line 9134 "./typica.w"
  20694. constructor= engine->newFunction(constructGraphView);
  20695. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  20696. engine->globalObject().setProperty("GraphView",value);
  20697. /*:405*//*428:*/
  20698. #line 9783 "./typica.w"
  20699. constructor= engine->newFunction(constructZoomLog);
  20700. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  20701. engine->globalObject().setProperty("ZoomLog",value);
  20702. /*:428*//*466:*/
  20703. #line 10731 "./typica.w"
  20704. constructor= engine->newFunction(constructAnnotationButton);
  20705. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  20706. constructor);
  20707. engine->globalObject().setProperty("AnnotationButton",value);
  20708. /*:466*//*474:*/
  20709. #line 10873 "./typica.w"
  20710. constructor= engine->newFunction(constructAnnotationSpinBox);
  20711. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  20712. constructor);
  20713. engine->globalObject().setProperty("AnnotationSpinBox",value);
  20714. /*:474*//*495:*/
  20715. #line 11298 "./typica.w"
  20716. constructor= engine->newFunction(constructTimerDisplay);
  20717. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  20718. engine->globalObject().setProperty("TimerDisplay",value);
  20719. /*:495*//*523:*/
  20720. #line 11822 "./typica.w"
  20721. constructor= engine->newFunction(constructWidgetDecorator);
  20722. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  20723. engine->globalObject().setProperty("WidgetDecorator",value);
  20724. /*:523*//*536:*/
  20725. #line 12104 "./typica.w"
  20726. constructor= engine->newFunction(constructLogEditWindow);
  20727. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  20728. engine->globalObject().setProperty("LogEditWindow",value);
  20729. /*:536*//*555:*/
  20730. #line 12631 "./typica.w"
  20731. constructor= engine->newFunction(constructXMLInput);
  20732. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  20733. engine->globalObject().setProperty("XMLInput",value);
  20734. /*:555*//*570:*/
  20735. #line 164 "./webview.w"
  20736. constructor= engine->newFunction(constructWebView);
  20737. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  20738. engine->globalObject().setProperty("WebView",value);
  20739. /*:570*//*578:*/
  20740. #line 256 "./webview.w"
  20741. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  20742. /*:578*//*581:*/
  20743. #line 298 "./webview.w"
  20744. constructor= engine->newFunction(constructWebElement);
  20745. engine->globalObject().setProperty("WebElement",constructor);
  20746. /*:581*//*593:*/
  20747. #line 76 "./printerselector.w"
  20748. constructor= engine->newFunction(constructPrinterSelector);
  20749. engine->globalObject().setProperty("PrinterSelector",constructor);
  20750. /*:593*//*601:*/
  20751. #line 12876 "./typica.w"
  20752. value= engine->newQObject(AppInstance);
  20753. engine->globalObject().setProperty("Application",value);
  20754. /*:601*//*659:*/
  20755. #line 13990 "./typica.w"
  20756. constructor= engine->newFunction(constructSqlQueryView);
  20757. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  20758. engine->globalObject().setProperty("SqlQueryView",value);
  20759. /*:659*//*770:*/
  20760. #line 15896 "./typica.w"
  20761. constructor= engine->newFunction(constructDeviceTreeModel);
  20762. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  20763. constructor);
  20764. engine->globalObject().setProperty("DeviceTreeModel",value);
  20765. /*:770*//*776:*/
  20766. #line 16036 "./typica.w"
  20767. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  20768. /*:776*//*792:*/
  20769. #line 16328 "./typica.w"
  20770. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  20771. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  20772. constructor);
  20773. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  20774. /*:792*//*863:*/
  20775. #line 56 "./settings.w"
  20776. constructor= engine->newFunction(constructSettingsWindow);
  20777. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  20778. engine->globalObject().setProperty("SettingsWindow",value);
  20779. #line 1 "./graphsettings.w"
  20780. /*:863*//*886:*/
  20781. #line 18963 "./typica.w"
  20782. constructor= engine->newFunction(constructModbusRTUDevice);
  20783. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  20784. engine->globalObject().setProperty("ModbusRTUDevice",value);
  20785. /*:886*//*904:*/
  20786. #line 705 "./modbus.w"
  20787. constructor= engine->newFunction(constructModbusNG);
  20788. value= engine->newQMetaObject(&ModbusNG::staticMetaObject,constructor);
  20789. engine->globalObject().setProperty("ModbusNG",value);
  20790. /*:904*//*918:*/
  20791. #line 350 "./unsupportedserial.w"
  20792. engine->globalObject().setProperty("createDevice",
  20793. engine->newFunction(createDevice));
  20794. /*:918*//*930:*/
  20795. #line 622 "./unsupportedserial.w"
  20796. engine->globalObject().setProperty("getMeasurementTimestamp",
  20797. engine->newFunction(getMeasurementTimestamp));
  20798. /*:930*//*934:*/
  20799. #line 658 "./unsupportedserial.w"
  20800. constructor= engine->newFunction(constructSerialPort);
  20801. value= engine->newQMetaObject(&QextSerialPort::staticMetaObject,constructor);
  20802. engine->globalObject().setProperty("SerialPort",value);
  20803. /*:934*//*956:*/
  20804. #line 450 "./phidgets.w"
  20805. constructor= engine->newFunction(constructPhidgetsTemperatureSensor);
  20806. value= engine->newQMetaObject(&PhidgetsTemperatureSensor::staticMetaObject,constructor);
  20807. engine->globalObject().setProperty("PhidgetsTemperatureSensor",value);
  20808. /*:956*//*990:*/
  20809. #line 144 "./rate.w"
  20810. constructor= engine->newFunction(constructRateOfChange);
  20811. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  20812. engine->globalObject().setProperty("RateOfChange",value);
  20813. /*:990*//*1004:*/
  20814. #line 137 "./mergeseries.w"
  20815. constructor= engine->newFunction(constructDifferenceSeries);
  20816. value= engine->newQMetaObject(&DifferenceSeries::staticMetaObject,
  20817. constructor);
  20818. engine->globalObject().setProperty("DifferenceSeries",value);
  20819. constructor= engine->newFunction(constructMeanSeries);
  20820. value= engine->newQMetaObject(&MeanSeries::staticMetaObject,constructor);
  20821. engine->globalObject().setProperty("MeanSeries",value);
  20822. /*:1004*//*1029:*/
  20823. #line 604 "./dataqsdk.w"
  20824. constructor= engine->newFunction(constructDataqSdkDevice);
  20825. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  20826. engine->globalObject().setProperty("DataqSdkDevice",value);
  20827. /*:1029*//*1056:*/
  20828. #line 73 "./scales.w"
  20829. constructor= engine->newFunction(constructDragLabel);
  20830. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  20831. engine->globalObject().setProperty("DragLabel",value);
  20832. /*:1056*//*1064:*/
  20833. #line 265 "./scales.w"
  20834. constructor= engine->newFunction(constructSerialScale);
  20835. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  20836. engine->globalObject().setProperty("SerialScale",value);
  20837. /*:1064*//*1068:*/
  20838. #line 351 "./scales.w"
  20839. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  20840. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  20841. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  20842. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  20843. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  20844. /*:1068*//*1092:*/
  20845. #line 271 "./valueannotation.w"
  20846. constructor= engine->newFunction(constructValueAnnotation);
  20847. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  20848. engine->globalObject().setProperty("ValueAnnotation",value);
  20849. /*:1092*//*1103:*/
  20850. #line 201 "./thresholdannotation.w"
  20851. constructor= engine->newFunction(constructAnnotator);
  20852. value= engine->newQMetaObject(&Annotator::staticMetaObject,constructor);
  20853. engine->globalObject().setProperty("Annotator",value);
  20854. /*:1103*/
  20855. #line 13602 "./typica.w"
  20856. app.engine= engine;
  20857. /*194:*/
  20858. #line 4500 "./typica.w"
  20859. QString styleText;
  20860. QString programText;
  20861. QDomElement currentElement;
  20862. for(int i= 0;i<children.size();i++)
  20863. {
  20864. QDomNode currentNode= children.at(i);
  20865. if(currentNode.nodeName()=="style")
  20866. {
  20867. currentElement= currentNode.toElement();
  20868. styleText.append(currentElement.text());
  20869. }
  20870. else if(currentNode.nodeName()=="program")
  20871. {
  20872. currentElement= currentNode.toElement();
  20873. programText.append(currentElement.text());
  20874. }
  20875. }
  20876. app.setStyleSheet(styleText);
  20877. QScriptValue result= engine->evaluate(programText);
  20878. /*195:*/
  20879. #line 4525 "./typica.w"
  20880. if(engine->hasUncaughtException())
  20881. {
  20882. int line= engine->uncaughtExceptionLineNumber();
  20883. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  20884. result.toString();
  20885. QString trace;
  20886. foreach(trace,engine->uncaughtExceptionBacktrace())
  20887. {
  20888. qDebug()<<trace;
  20889. }
  20890. }
  20891. /*:195*/
  20892. #line 4520 "./typica.w"
  20893. /*:194*/
  20894. #line 13604 "./typica.w"
  20895. int retval= app.exec();
  20896. delete engine;
  20897. return retval;
  20898. }
  20899. /*:636*/
  20900. #line 532 "./typica.w"
  20901. #include "moc_typica.cpp"
  20902. /*:3*/