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 507KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066
  1. /*3:*/
  2. #line 522 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*5:*/
  5. #line 616 "./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. /*:5*//*6:*/
  16. #line 631 "./typica.w"
  17. #include "helpmenu.h"
  18. /*:6*//*281:*/
  19. #line 6417 "./typica.w"
  20. #include "units.h"
  21. #line 1 "./measurement.w"
  22. /*:281*//*551:*/
  23. #line 197 "./webview.w"
  24. #include "webview.h"
  25. /*:551*//*564:*/
  26. #line 375 "./webview.w"
  27. #include "webelement.h"
  28. #line 12383 "./typica.w"
  29. /*:564*//*675:*/
  30. #line 487 "./daterangeselector.w"
  31. #include "daterangeselector.h"
  32. #line 14099 "./typica.w"
  33. /*:675*//*783:*/
  34. #line 16619 "./typica.w"
  35. #include "qextserialport.h"
  36. #include "qextserialenumerator.h"
  37. /*:783*//*954:*/
  38. #line 124 "./dataqsdk.w"
  39. #ifdef Q_OS_WIN32
  40. #include <windef.h>
  41. #else
  42. #define PASCAL
  43. #endif
  44. /*:954*//*978:*/
  45. #line 862 "./dataqsdk.w"
  46. #include <limits>
  47. /*:978*//*993:*/
  48. #line 62 "./scales.w"
  49. #include "draglabel.h"
  50. /*:993*//*1008:*/
  51. #line 335 "./scales.w"
  52. #include "scale.h"
  53. /*:1008*/
  54. #line 525 "./typica.w"
  55. /*20:*/
  56. #line 946 "./typica.w"
  57. class ScriptQMainWindow:public QMainWindow
  58. {
  59. Q_OBJECT
  60. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  61. public:
  62. ScriptQMainWindow();
  63. QString closePrompt();
  64. public slots:
  65. void show();
  66. void saveSizeAndPosition(const QString&key);
  67. void restoreSizeAndPosition(const QString&key);
  68. void displayStatus(const QString&message= QString());
  69. void setClosePrompt(QString prompt);
  70. protected:
  71. void closeEvent(QCloseEvent*event);
  72. void showEvent(QShowEvent*event);
  73. signals:
  74. void aboutToClose(void);
  75. private:
  76. QString cprompt;
  77. };
  78. /*:20*//*160:*/
  79. #line 3783 "./typica.w"
  80. class SqlQueryConnection:public QSqlQuery
  81. {
  82. public:
  83. SqlQueryConnection(const QString&query= QString());
  84. ~SqlQueryConnection();
  85. QSqlQuery*operator->()const;
  86. private:
  87. QString connection;
  88. QSqlQuery*q;
  89. };
  90. /*:160*//*230:*/
  91. #line 5633 "./typica.w"
  92. class NumericDelegate:public QItemDelegate
  93. {
  94. Q_OBJECT
  95. public:
  96. NumericDelegate(QObject*parent= NULL);
  97. QWidget*createEditor(QWidget*parent,
  98. const QStyleOptionViewItem&option,
  99. const QModelIndex&index)const;
  100. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  101. void setModelData(QWidget*editor,QAbstractItemModel*model,
  102. const QModelIndex&index)const;
  103. void updateEditorGeometry(QWidget*editor,
  104. const QStyleOptionViewItem&option,
  105. const QModelIndex&index)const;
  106. };
  107. /*:230*//*236:*/
  108. #line 5726 "./typica.w"
  109. class ScriptValidator:public QValidator
  110. {
  111. Q_OBJECT
  112. public:
  113. ScriptValidator(QValidator*validator,QObject*parent= NULL);
  114. void fixup(QString&input)const;
  115. QValidator::State validate(QString&input,int&pos)const;
  116. private:
  117. QValidator*v;
  118. };
  119. /*:236*//*277:*/
  120. #line 438 "./units.w"
  121. Q_DECLARE_METATYPE(Units::Unit)
  122. /*:277*//*282:*/
  123. #line 19 "./measurement.w"
  124. class Measurement:public QVariantMap
  125. {
  126. public:
  127. Measurement(double temperature= 0,QTime time= QTime(),
  128. Units::Unit sc= Units::Fahrenheit);
  129. Measurement(double temperature);
  130. double temperature()const;
  131. QTime time()const;
  132. void setTemperature(double temperature);
  133. void setTime(QTime time);
  134. void setUnit(Units::Unit scale);
  135. Units::Unit scale()const;
  136. Measurement toFahrenheit();
  137. Measurement toCelsius();
  138. Measurement toKelvin();
  139. Measurement toRankine();
  140. };
  141. /*:282*//*286:*/
  142. #line 128 "./measurement.w"
  143. Q_DECLARE_METATYPE(Measurement)
  144. /*:286*//*293:*/
  145. #line 6481 "./typica.w"
  146. class Channel;
  147. class DAQImplementation;
  148. class DAQ:public QObject
  149. {
  150. Q_OBJECT
  151. Q_ENUMS(ThermocoupleType)
  152. DAQImplementation*imp;
  153. private slots:
  154. void threadFinished();
  155. public:
  156. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  157. ~DAQ();
  158. Channel*newChannel(int units,int thermocouple);
  159. Q_INVOKABLE void setClockRate(double Hz);
  160. Q_INVOKABLE void start();
  161. Q_INVOKABLE void stop();
  162. enum ThermocoupleType
  163. {
  164. TypeJ= 10072,
  165. TypeK= 10073,
  166. TypeN= 10077,
  167. TypeR= 10082,
  168. TypeS= 10085,
  169. TypeT= 10086,
  170. TypeB= 10047,
  171. TypeE= 10055
  172. };
  173. };
  174. /*:293*//*294:*/
  175. #line 6519 "./typica.w"
  176. class DAQImplementation:public QThread
  177. {
  178. Q_OBJECT
  179. public:
  180. DAQImplementation(const QString&driverinfo);
  181. ~DAQImplementation();
  182. void run();
  183. void measure();
  184. /*295:*/
  185. #line 6539 "./typica.w"
  186. typedef int(*daqfp)(...);
  187. daqfp read;
  188. daqfp errorInfo;
  189. daqfp startTask;
  190. daqfp createTask;
  191. daqfp createChannel;
  192. daqfp setClock;
  193. daqfp stopTask;
  194. daqfp clearTask;
  195. daqfp resetDevice;
  196. daqfp waitForMeasurement;
  197. /*:295*/
  198. #line 6528 "./typica.w"
  199. /*296:*/
  200. #line 6555 "./typica.w"
  201. bool useBase;
  202. QString device;
  203. QVector<Channel*> channelMap;
  204. unsigned int handle;
  205. int error;
  206. int channels;
  207. bool ready;
  208. QLibrary driver;
  209. QVector<Units::Unit> unitMap;
  210. /*:296*/
  211. #line 6529 "./typica.w"
  212. };
  213. /*:294*//*312:*/
  214. #line 7060 "./typica.w"
  215. class FakeDAQImplementation:public QThread
  216. {
  217. Q_OBJECT
  218. public:
  219. FakeDAQImplementation();
  220. ~FakeDAQImplementation();
  221. void run();
  222. void measure();
  223. QVector<Channel*> channelMap;
  224. int channels;
  225. bool ready;
  226. double clockRate;
  227. };
  228. class FakeDAQ:public QObject
  229. {
  230. Q_OBJECT
  231. FakeDAQImplementation*imp;
  232. public:
  233. FakeDAQ(QString device);
  234. ~FakeDAQ();
  235. Channel*newChannel(int units,int thermocouple);
  236. Q_INVOKABLE void setClockRate(double Hz);
  237. Q_INVOKABLE void start();
  238. };
  239. /*:312*//*319:*/
  240. #line 7247 "./typica.w"
  241. class Channel:public QObject
  242. {
  243. Q_OBJECT
  244. public:
  245. Channel();
  246. ~Channel();
  247. public slots:
  248. void input(Measurement measurement);
  249. signals:
  250. void newData(Measurement);
  251. };
  252. /*:319*//*323:*/
  253. #line 7314 "./typica.w"
  254. class LinearCalibrator:public QObject
  255. {
  256. Q_OBJECT
  257. Q_PROPERTY(double measuredLower READ measuredLower
  258. WRITE setMeasuredLower)
  259. Q_PROPERTY(double measuredUpper READ measuredUpper
  260. WRITE setMeasuredUpper)
  261. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  262. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  263. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  264. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  265. public:
  266. LinearCalibrator(QObject*parent= NULL);
  267. double measuredLower();
  268. double measuredUpper();
  269. double mappedLower();
  270. double mappedUpper();
  271. bool isClosedRange();
  272. double sensitivity();
  273. public slots:
  274. void setMeasuredLower(double lower);
  275. void setMeasuredUpper(double upper);
  276. void setMappedLower(double lower);
  277. void setMappedUpper(double upper);
  278. void setClosedRange(bool closed);
  279. void setSensitivity(double sensitivity);
  280. Measurement newMeasurement(Measurement measure);
  281. signals:
  282. void measurement(Measurement measure);
  283. void newData(Measurement measure);
  284. private:
  285. double Lo1;
  286. double Lo2;
  287. double Up1;
  288. double Up2;
  289. double sensitivitySetting;
  290. bool clamp;
  291. };
  292. /*:323*//*330:*/
  293. #line 7510 "./typica.w"
  294. class LinearSplineInterpolator:public QObject
  295. {
  296. Q_OBJECT
  297. public:
  298. LinearSplineInterpolator(QObject*parent= NULL);
  299. Q_INVOKABLE void add_pair(double source,double destination);
  300. public slots:
  301. Measurement newMeasurement(Measurement measure);
  302. signals:
  303. void newData(Measurement measure);
  304. private:
  305. void make_interpolators();
  306. QMap<double,double> *pairs;
  307. QList<LinearCalibrator*> *interpolators;
  308. };
  309. /*:330*//*335:*/
  310. #line 7646 "./typica.w"
  311. class TemperatureDisplay:public QLCDNumber
  312. {
  313. Q_OBJECT
  314. int unit;
  315. bool r;
  316. public:
  317. TemperatureDisplay(QWidget*parent= NULL);
  318. ~TemperatureDisplay();
  319. public slots:
  320. void setValue(Measurement temperature);
  321. void invalidate();
  322. void setDisplayUnits(Units::Unit scale);
  323. void setRelativeMode(bool relative);
  324. };
  325. /*:335*//*346:*/
  326. #line 7865 "./typica.w"
  327. class MeasurementTimeOffset:public QObject
  328. {
  329. Q_OBJECT
  330. QTime epoch;
  331. QTime previous;
  332. bool hasPrevious;
  333. public:
  334. MeasurementTimeOffset(QTime zero);
  335. QTime zeroTime();
  336. public slots:
  337. void newMeasurement(Measurement measure);
  338. void setZeroTime(QTime zero);
  339. signals:
  340. void measurement(Measurement measure);
  341. };
  342. /*:346*//*353:*/
  343. #line 8017 "./typica.w"
  344. class ThresholdDetector:public QObject
  345. {
  346. Q_OBJECT
  347. Q_ENUMS(EdgeDirection)
  348. public:
  349. enum EdgeDirection{
  350. Ascending,Descending
  351. };
  352. ThresholdDetector(double value);
  353. public slots:
  354. void newMeasurement(Measurement measure);
  355. void setThreshold(double value);
  356. void setEdgeDirection(EdgeDirection direction);
  357. signals:
  358. void timeForValue(double);
  359. private:
  360. double previousValue;
  361. double threshold;
  362. EdgeDirection currentDirection;
  363. };
  364. /*:353*//*358:*/
  365. #line 8123 "./typica.w"
  366. class ZeroEmitter:public QObject
  367. {
  368. Q_OBJECT
  369. Q_PROPERTY(int column READ column WRITE setColumn)
  370. Measurement cache;
  371. int col;
  372. public:
  373. ZeroEmitter(int tempcolumn= 1);
  374. int column();
  375. double lastTemperature();
  376. public slots:
  377. void newMeasurement(Measurement measure);
  378. void setColumn(int column);
  379. void emitZero();
  380. signals:
  381. void measurement(Measurement measure,int tempcolumn);
  382. };
  383. /*:358*//*363:*/
  384. #line 8217 "./typica.w"
  385. class MeasurementAdapter:public QObject
  386. {
  387. Q_OBJECT
  388. int col;
  389. public:
  390. MeasurementAdapter(int tempcolumn);
  391. int column();
  392. public slots:
  393. void newMeasurement(Measurement measure);
  394. void setColumn(int column);
  395. signals:
  396. void measurement(Measurement measure,int tempcolumn);
  397. };
  398. /*:363*//*368:*/
  399. #line 8306 "./typica.w"
  400. class GraphView:public QGraphicsView
  401. {
  402. Q_OBJECT
  403. QGraphicsScene*theScene;
  404. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  405. QMap<int,QPointF> *prevPoints;
  406. QMap<int,double> *translations;
  407. QList<QGraphicsItem*> *gridLinesF;
  408. QList<QGraphicsItem*> *gridLinesC;
  409. QList<QGraphicsItem*> *relativeGridLines;
  410. bool relativeEnabled;
  411. bool timeIndicatorEnabled;
  412. QGraphicsLineItem*timeLine;
  413. LinearSplineInterpolator*relativeAdjuster;
  414. public:
  415. GraphView(QWidget*parent= NULL);
  416. void removeSeries(int column);
  417. protected:
  418. void resizeEvent(QResizeEvent*event);
  419. public slots:
  420. void newMeasurement(Measurement measure,int tempcolumn);
  421. void setSeriesTranslation(int column,double offset);
  422. void setTimeIndicatorEnabled(bool enabled);
  423. void clear();
  424. void showF();
  425. void showC();
  426. };
  427. /*:368*//*385:*/
  428. #line 8771 "./typica.w"
  429. class MeasurementModel;
  430. class ZoomLog:public QTableView
  431. {
  432. Q_OBJECT
  433. /*386:*/
  434. #line 8820 "./typica.w"
  435. MeasurementModel*model_ms;
  436. MeasurementModel*model_1s;
  437. MeasurementModel*model_5s;
  438. MeasurementModel*model_10s;
  439. MeasurementModel*model_15s;
  440. MeasurementModel*model_30s;
  441. MeasurementModel*model_1m;
  442. QList<MeasurementModel*> modelSet;
  443. QHash<int,Measurement> lastMeasurement;
  444. MeasurementModel*currentModel;
  445. QList<int> saveTempCols;
  446. QList<int> saveControlCols;
  447. QList<int> saveNoteCols;
  448. QList<int> currentColumnSet;
  449. /*:386*/
  450. #line 8776 "./typica.w"
  451. void switchLOD(MeasurementModel*m);
  452. private slots:
  453. void centerOn(int row);
  454. void persistColumnResize(int column,int oldsize,int newsize);
  455. void restoreColumnWidths();
  456. public:
  457. ZoomLog();
  458. QVariant data(int row,int column)const;
  459. int rowCount();
  460. bool saveXML(QIODevice*device);
  461. bool saveCSV(QIODevice*device);
  462. QString lastTime(int series);
  463. Q_INVOKABLE Units::Unit displayUnits();
  464. public slots:
  465. void setVisible(bool visibility);
  466. void setHeaderData(int section,QString text);
  467. void LOD_ms();
  468. void LOD_1s();
  469. void LOD_5s();
  470. void LOD_10s();
  471. void LOD_15s();
  472. void LOD_30s();
  473. void LOD_1m();
  474. void newMeasurement(Measurement measure,int tempcolumn);
  475. void newAnnotation(QString annotation,int tempcolumn,
  476. int annotationcolumn);
  477. void clear();
  478. void addOutputTemperatureColumn(int column);
  479. void addOutputControlColumn(int column);
  480. void addOutputAnnotationColumn(int column);
  481. void clearOutputColumns();
  482. void setDisplayUnits(Units::Unit scale);
  483. void addToCurrentColumnSet(int column);
  484. void clearCurrentColumnSet();
  485. protected:
  486. virtual void showEvent(QShowEvent*event);
  487. };
  488. /*:385*//*411:*/
  489. #line 9516 "./typica.w"
  490. class MeasurementList;
  491. class MeasurementModel:public QAbstractItemModel
  492. {
  493. Q_OBJECT
  494. Units::Unit unit;
  495. QList<MeasurementList*> *entries;
  496. QStringList*hData;
  497. int colcount;
  498. QHash<int,int> *lastTemperature;
  499. QList<MeasurementList*> ::iterator lastInsertion;
  500. QHash<int,bool> *controlColumns;
  501. public:
  502. MeasurementModel(QObject*parent= NULL);
  503. ~MeasurementModel();
  504. int rowCount(const QModelIndex&parent= QModelIndex())const;
  505. int columnCount(const QModelIndex&parent= QModelIndex())const;
  506. bool setHeaderData(int section,Qt::Orientation orientation,
  507. const QVariant&value,int role= Qt::DisplayRole);
  508. QVariant data(const QModelIndex&index,int role)const;
  509. bool setData(const QModelIndex&index,const QVariant&value,
  510. int role= Qt::EditRole);
  511. Qt::ItemFlags flags(const QModelIndex&index)const;
  512. QVariant headerData(int section,Qt::Orientation orientation,
  513. int role= Qt::DisplayRole)const;
  514. QModelIndex index(int row,int column,
  515. const QModelIndex&parent= QModelIndex())const;
  516. QModelIndex parent(const QModelIndex&index)const;
  517. Units::Unit displayUnits();
  518. public slots:
  519. void newMeasurement(Measurement measure,int tempcolumn);
  520. void newAnnotation(QString annotation,int tempcolumn,
  521. int annotationColumn);
  522. void clear();
  523. void setDisplayUnits(Units::Unit scale);
  524. signals:
  525. void rowChanged(int);
  526. };
  527. /*:411*//*412:*/
  528. #line 9560 "./typica.w"
  529. class MeasurementList:public QVariantList
  530. {
  531. public:
  532. bool operator<(const MeasurementList&other)const;
  533. bool operator==(const MeasurementList&other)const;
  534. };
  535. /*:412*//*438:*/
  536. #line 10218 "./typica.w"
  537. class AnnotationButton:public QPushButton
  538. {
  539. Q_OBJECT
  540. QString note;
  541. int tc;
  542. int ac;
  543. int count;
  544. public:
  545. AnnotationButton(const QString&text,QWidget*parent= NULL);
  546. public slots:
  547. void setAnnotation(const QString&annotation);
  548. void setTemperatureColumn(int tempcolumn);
  549. void setAnnotationColumn(int annotationcolumn);
  550. void annotate();
  551. void resetCount();
  552. signals:
  553. void annotation(QString annotation,int tempcolumn,
  554. int notecolumn);
  555. };
  556. /*:438*//*446:*/
  557. #line 10343 "./typica.w"
  558. class AnnotationSpinBox:public QDoubleSpinBox
  559. {
  560. Q_OBJECT
  561. QString pretext;
  562. QString posttext;
  563. int tc;
  564. int ac;
  565. bool change;
  566. public:
  567. AnnotationSpinBox(const QString&pret,const QString&postt,
  568. QWidget*parent= NULL);
  569. public slots:
  570. void setPretext(const QString&pret);
  571. void setPosttext(const QString&postt);
  572. void setTemperatureColumn(int tempcolumn);
  573. void setAnnotationColumn(int annotationcolumn);
  574. void annotate();
  575. void resetChange();
  576. signals:
  577. void annotation(QString annotation,int tempcolumn,
  578. int notecolumn);
  579. };
  580. /*:446*//*454:*/
  581. #line 10502 "./typica.w"
  582. class TimerDisplay:public QLCDNumber
  583. {
  584. Q_OBJECT
  585. /*455:*/
  586. #line 10552 "./typica.w"
  587. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  588. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  589. Q_PROPERTY(bool running READ isRunning)
  590. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  591. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  592. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  593. Q_PROPERTY(QString value READ value)
  594. /*:455*/
  595. #line 10506 "./typica.w"
  596. private slots:
  597. void updateTime();
  598. void setCountUpMode();
  599. void setCountDownMode();
  600. void setClockMode();
  601. public:
  602. TimerDisplay(QWidget*parent= NULL);
  603. ~TimerDisplay();
  604. enum TimerMode
  605. {
  606. CountUp,
  607. CountDown,
  608. Clock
  609. };
  610. QString value();
  611. QTime seconds();
  612. TimerMode mode();
  613. bool isRunning();
  614. QTime resetValue();
  615. QString displayFormat();
  616. bool autoReset();
  617. public slots:
  618. void setTimer(QTime value= QTime(0,0,0));
  619. void setMode(TimerMode mode);
  620. void startTimer();
  621. void stopTimer();
  622. void copyTimer();
  623. void setResetValue(QTime value= QTime(0,0,0));
  624. void reset();
  625. void setDisplayFormat(QString format);
  626. void setAutoReset(bool reset);
  627. void updateDisplay();
  628. signals:
  629. void valueChanged(QTime);
  630. void runStateChanged(bool);
  631. private:
  632. /*456:*/
  633. #line 10563 "./typica.w"
  634. QTime s;
  635. QTime r;
  636. QTimer clock;
  637. TimerDisplay::TimerMode m;
  638. bool running;
  639. bool ar;
  640. QAction*startAction;
  641. QAction*stopAction;
  642. QAction*resetAction;
  643. QString f;
  644. QTime relative;
  645. QTime base;
  646. /*:456*/
  647. #line 10543 "./typica.w"
  648. };
  649. /*:454*//*477:*/
  650. #line 10955 "./typica.w"
  651. class PackLayout:public QLayout
  652. {
  653. int doLayout(const QRect&rect,bool testOnly)const;
  654. QList<QLayoutItem*> itemList;
  655. Qt::Orientations orientation;
  656. public:
  657. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  658. PackLayout(int spacing= -1);
  659. ~PackLayout();
  660. void addItem(QLayoutItem*item);
  661. Qt::Orientations expandingDirections()const;
  662. bool hasHeightForWidth()const;
  663. int heightForWidth(int width)const;
  664. int count()const;
  665. QLayoutItem*itemAt(int index)const;
  666. QSize minimumSize()const;
  667. void setGeometry(const QRect&rect);
  668. void setOrientation(Qt::Orientations direction);
  669. QSize sizeHint()const;
  670. QLayoutItem*takeAt(int index);
  671. };
  672. /*:477*//*490:*/
  673. #line 11233 "./typica.w"
  674. class SceneButton:public QGraphicsScene
  675. {
  676. Q_OBJECT
  677. public:
  678. SceneButton();
  679. ~SceneButton();
  680. protected:
  681. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  682. signals:
  683. void clicked(QPoint pos);
  684. };
  685. /*:490*//*492:*/
  686. #line 11275 "./typica.w"
  687. class WidgetDecorator:public QWidget
  688. {
  689. Q_OBJECT
  690. PackLayout*layout;
  691. QGraphicsView*label;
  692. QGraphicsTextItem*text;
  693. SceneButton*scene;
  694. public:
  695. WidgetDecorator(QWidget*widget,const QString&labeltext,
  696. Qt::Orientations orientation= Qt::Horizontal,
  697. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  698. ~WidgetDecorator();
  699. void setBackgroundBrush(QBrush background);
  700. void setTextColor(QColor color);
  701. };
  702. /*:492*//*503:*/
  703. #line 11450 "./typica.w"
  704. class LogEditWindow:public QMainWindow
  705. {
  706. Q_OBJECT
  707. QWidget*centralWidget;
  708. PackLayout*mainLayout;
  709. QHBoxLayout*addRowsLayout;
  710. QLabel*startTimeLabel;
  711. QTimeEdit*startTime;
  712. QLabel*endTimeLabel;
  713. QTimeEdit*endTime;
  714. QLabel*intervalLabel;
  715. QSpinBox*interval;
  716. QPushButton*addRows;
  717. QAction*saveXml;
  718. QAction*saveCsv;
  719. QAction*openXml;
  720. MeasurementModel*model;
  721. QTableView*log;
  722. private slots:
  723. void addTheRows();
  724. void saveXML();
  725. void saveCSV();
  726. void openXML();
  727. protected:
  728. void closeEvent(QCloseEvent*event);
  729. public:
  730. LogEditWindow();
  731. };
  732. /*:503*//*517:*/
  733. #line 11758 "./typica.w"
  734. class XMLOutput:public QObject
  735. {
  736. Q_OBJECT
  737. MeasurementModel*data;
  738. QIODevice*out;
  739. int time;
  740. QMap<int,QString> temperatureColumns;
  741. QMap<int,QString> controlColumns;
  742. QMap<int,QString> annotationColumns;
  743. public:
  744. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  745. void addTemperatureColumn(const QString&series,int column);
  746. void addControlColumn(const QString&series,int column);
  747. void addAnnotationColumn(const QString&series,int column);
  748. void setModel(MeasurementModel*model);
  749. void setTimeColumn(int column);
  750. void setDevice(QIODevice*device);
  751. bool output();
  752. };
  753. /*:517*//*524:*/
  754. #line 11994 "./typica.w"
  755. class XMLInput:public QObject
  756. {
  757. Q_OBJECT
  758. int firstc;
  759. QIODevice*in;
  760. public:
  761. XMLInput(QIODevice*input,int c);
  762. void setFirstColumn(int column);
  763. void setDevice(QIODevice*device);
  764. bool input();
  765. signals:
  766. void measure(Measurement,int);
  767. void annotation(QString,int,int);
  768. void newTemperatureColumn(int,QString);
  769. void newAnnotationColumn(int,QString);
  770. void lastColumn(int);
  771. };
  772. /*:524*//*535:*/
  773. #line 12248 "./typica.w"
  774. class CSVOutput
  775. {
  776. MeasurementModel*data;
  777. QIODevice*out;
  778. int time;
  779. QMap<int,QString> temperatureColumns;
  780. QMap<int,QString> controlColumns;
  781. QMap<int,QString> annotationColumns;
  782. public:
  783. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  784. void addTemperatureColumn(const QString&series,int column);
  785. void addControlColumn(const QString&series,int column);
  786. void addAnnotationColumn(const QString&series,int column);
  787. void setModel(MeasurementModel*model);
  788. void setTimeColumn(int column);
  789. void setDevice(QIODevice*device);
  790. bool output();
  791. };
  792. /*:535*//*565:*/
  793. #line 12391 "./typica.w"
  794. #define AppInstance (qobject_cast<Application *> (qApp))
  795. class NodeInserter;
  796. class DeviceTreeModel;
  797. class Application:public QApplication
  798. {
  799. Q_OBJECT
  800. public:
  801. Application(int&argc,char**argv);
  802. QDomDocument*configuration();
  803. /*707:*/
  804. #line 14945 "./typica.w"
  805. QDomDocument deviceConfiguration();
  806. /*:707*//*740:*/
  807. #line 15618 "./typica.w"
  808. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  809. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  810. const QModelIndex&index);
  811. /*:740*//*745:*/
  812. #line 15722 "./typica.w"
  813. QList<NodeInserter*> topLevelNodeInserters;
  814. /*:745*/
  815. #line 12402 "./typica.w"
  816. QSqlDatabase database();
  817. QScriptEngine*engine;
  818. public slots:
  819. /*708:*/
  820. #line 14952 "./typica.w"
  821. void saveDeviceConfiguration();
  822. /*:708*/
  823. #line 12406 "./typica.w"
  824. private:
  825. /*706:*/
  826. #line 14936 "./typica.w"
  827. QDomDocument deviceConfigurationDocument;
  828. /*:706*//*739:*/
  829. #line 15612 "./typica.w"
  830. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  831. /*:739*/
  832. #line 12408 "./typica.w"
  833. QDomDocument conf;
  834. };
  835. /*:565*//*573:*/
  836. #line 12533 "./typica.w"
  837. class SaltModel:public QAbstractItemModel
  838. {
  839. Q_OBJECT
  840. QList<QList<QMap<int,QVariant> > > modelData;
  841. QStringList hData;
  842. int colcount;
  843. public:
  844. SaltModel(int columns);
  845. ~SaltModel();
  846. int rowCount(const QModelIndex&parent= QModelIndex())const;
  847. int columnCount(const QModelIndex&parent= QModelIndex())const;
  848. bool setHeaderData(int section,Qt::Orientation orientation,
  849. const QVariant&value,int role= Qt::DisplayRole);
  850. QVariant data(const QModelIndex&index,int role)const;
  851. bool setData(const QModelIndex&index,const QVariant&value,
  852. int role= Qt::EditRole);
  853. Qt::ItemFlags flags(const QModelIndex&index)const;
  854. QVariant headerData(int section,Qt::Orientation orientation,
  855. int role= Qt::DisplayRole)const;
  856. QModelIndex index(int row,int column,
  857. const QModelIndex&parent= QModelIndex())const;
  858. QModelIndex parent(const QModelIndex&index)const;
  859. QString arrayLiteral(int column,int role)const;
  860. QString quotedArrayLiteral(int column,int role)const;
  861. void clear();
  862. bool removeRows(int row,int count,
  863. const QModelIndex&parent= QModelIndex());
  864. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  865. };
  866. /*:573*//*589:*/
  867. #line 12918 "./typica.w"
  868. class SqlComboBox:public QComboBox
  869. {
  870. Q_OBJECT
  871. int dataColumn;
  872. int displayColumn;
  873. bool dataColumnShown;
  874. QString specialNullText;
  875. QVariant specialNullData;
  876. public:
  877. SqlComboBox();
  878. ~SqlComboBox();
  879. SqlComboBox*clone(QWidget*parent);
  880. public slots:
  881. void addNullOption();
  882. void addSqlOptions(QString query);
  883. void setDataColumn(int column);
  884. void setDisplayColumn(int column);
  885. void showData(bool show);
  886. void setNullText(QString nullText);
  887. void setNullData(QVariant nullData);
  888. };
  889. /*:589*//*596:*/
  890. #line 13065 "./typica.w"
  891. class SqlComboBoxDelegate:public QItemDelegate
  892. {
  893. Q_OBJECT
  894. SqlComboBox*delegate;
  895. public:
  896. SqlComboBoxDelegate(QObject*parent= NULL);
  897. QWidget*createEditor(QWidget*parent,
  898. const QStyleOptionViewItem&option,
  899. const QModelIndex&index)const;
  900. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  901. void setModelData(QWidget*editor,QAbstractItemModel*model,
  902. const QModelIndex&index)const;
  903. void setWidget(SqlComboBox*widget);
  904. virtual QSize sizeHint()const;
  905. void updateEditorGeometry(QWidget*editor,
  906. const QStyleOptionViewItem&option,
  907. const QModelIndex&index)const;
  908. };
  909. /*:596*//*611:*/
  910. #line 13276 "./typica.w"
  911. class SqlConnectionSetup:public QDialog
  912. {
  913. Q_OBJECT
  914. public:
  915. SqlConnectionSetup();
  916. ~SqlConnectionSetup();
  917. public slots:
  918. void testConnection();
  919. private:
  920. QFormLayout*formLayout;
  921. QComboBox*driver;
  922. QLineEdit*hostname;
  923. QLineEdit*dbname;
  924. QLineEdit*user;
  925. QLineEdit*password;
  926. QVBoxLayout*layout;
  927. QHBoxLayout*buttons;
  928. QPushButton*cancelButton;
  929. QPushButton*connectButton;
  930. };
  931. /*:611*//*616:*/
  932. #line 13411 "./typica.w"
  933. class SqlQueryView:public QTableView
  934. {
  935. Q_OBJECT
  936. public:
  937. SqlQueryView(QWidget*parent= NULL);
  938. void setQuery(const QString&query);
  939. bool setHeaderData(int section,Qt::Orientation orientation,
  940. const QVariant&value,int role);
  941. Q_INVOKABLE QVariant data(int row,int column,
  942. int role= Qt::DisplayRole);
  943. signals:
  944. void openEntry(QString key);
  945. void openEntryRow(int row);
  946. protected:
  947. virtual void showEvent(QShowEvent*event);
  948. private slots:
  949. void openRow(const QModelIndex&index);
  950. void persistColumnResize(int column,int oldsize,int newsize);
  951. };
  952. /*:616*//*631:*/
  953. #line 13666 "./typica.w"
  954. class ReportAction:public QAction
  955. {
  956. Q_OBJECT
  957. public:
  958. ReportAction(const QString&fileName,const QString&reportName,
  959. QObject*parent= NULL);
  960. private slots:
  961. void createReport();
  962. private:
  963. QString reportFile;
  964. };
  965. /*:631*//*643:*/
  966. #line 13875 "./typica.w"
  967. class ReportTable:public QObject
  968. {
  969. Q_OBJECT
  970. QTextFrame*area;
  971. QDomElement configuration;
  972. QMap<QString,QVariant> bindings;
  973. public:
  974. ReportTable(QTextFrame*frame,QDomElement description);
  975. ~ReportTable();
  976. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  977. public slots:
  978. void refresh();
  979. };
  980. /*:643*//*676:*/
  981. #line 14114 "./typica.w"
  982. class FormArray:public QScrollArea
  983. {
  984. Q_OBJECT
  985. QDomElement configuration;
  986. QWidget itemContainer;
  987. QVBoxLayout itemLayout;
  988. int maxwidth;
  989. int maxheight;
  990. public:
  991. FormArray(QDomElement description);
  992. Q_INVOKABLE QWidget*elementAt(int index);
  993. Q_INVOKABLE int elements();
  994. public slots:
  995. void addElements(int copies= 1);
  996. void removeAllElements();
  997. void setMaximumElementWidth(int width);
  998. void setMaximumElementHeight(int height);
  999. };
  1000. /*:676*//*686:*/
  1001. #line 14330 "./typica.w"
  1002. class ScaleControl:public QGraphicsView
  1003. {
  1004. Q_OBJECT
  1005. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  1006. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  1007. /*687:*/
  1008. #line 14356 "./typica.w"
  1009. QGraphicsScene scene;
  1010. QGraphicsPolygonItem initialDecrement;
  1011. QGraphicsPolygonItem initialIncrement;
  1012. QGraphicsPolygonItem finalDecrement;
  1013. QGraphicsPolygonItem finalIncrement;
  1014. QGraphicsPolygonItem initialIndicator;
  1015. QGraphicsPolygonItem finalIndicator;
  1016. QGraphicsPathItem scaleLine;
  1017. QPolygonF left;
  1018. QPolygonF right;
  1019. QPolygonF down;
  1020. QPolygonF up;
  1021. QPainterPath scalePath;
  1022. QBrush initialBrush;
  1023. QBrush finalBrush;
  1024. double nonScoredValue;
  1025. double scoredValue;
  1026. bool initialSet;
  1027. bool finalSet;
  1028. bool scaleDown;
  1029. /*:687*/
  1030. #line 14336 "./typica.w"
  1031. public:
  1032. ScaleControl();
  1033. double initialValue(void);
  1034. double finalValue(void);
  1035. virtual QSize sizeHint()const;
  1036. public slots:
  1037. void setInitialValue(double value);
  1038. void setFinalValue(double value);
  1039. signals:
  1040. void initialChanged(double);
  1041. void finalChanged(double);
  1042. protected:
  1043. virtual void mousePressEvent(QMouseEvent*event);
  1044. virtual void mouseReleaseEvent(QMouseEvent*event);
  1045. };
  1046. /*:686*//*698:*/
  1047. #line 14653 "./typica.w"
  1048. class IntensityControl:public QGraphicsView
  1049. {
  1050. Q_OBJECT
  1051. Q_PROPERTY(double value READ value WRITE setValue)
  1052. QGraphicsScene scene;
  1053. QGraphicsPolygonItem decrement;
  1054. QGraphicsPolygonItem increment;
  1055. QGraphicsPolygonItem indicator;
  1056. QGraphicsPathItem scaleLine;
  1057. QPolygonF left;
  1058. QPolygonF up;
  1059. QPolygonF down;
  1060. QPainterPath scalePath;
  1061. QBrush theBrush;
  1062. double theValue;
  1063. bool valueSet;
  1064. bool scaleDown;
  1065. public:
  1066. IntensityControl();
  1067. double value();
  1068. virtual QSize sizeHint()const;
  1069. public slots:
  1070. void setValue(double val);
  1071. signals:
  1072. void valueChanged(double);
  1073. protected:
  1074. virtual void mousePressEvent(QMouseEvent*event);
  1075. virtual void mouseReleaseEvent(QMouseEvent*event);
  1076. };
  1077. /*:698*//*714:*/
  1078. #line 15041 "./typica.w"
  1079. class DeviceTreeModelNode
  1080. {
  1081. public:
  1082. DeviceTreeModelNode(QDomNode&node,int row,
  1083. DeviceTreeModelNode*parent= NULL);
  1084. ~DeviceTreeModelNode();
  1085. DeviceTreeModelNode*child(int index);
  1086. DeviceTreeModelNode*parent();
  1087. QDomNode node()const;
  1088. int row();
  1089. private:
  1090. QDomNode domNode;
  1091. QHash<int,DeviceTreeModelNode*> children;
  1092. int rowNumber;
  1093. DeviceTreeModelNode*parentItem;
  1094. };
  1095. /*:714*//*716:*/
  1096. #line 15116 "./typica.w"
  1097. class DeviceTreeModel:public QAbstractItemModel
  1098. {
  1099. Q_OBJECT
  1100. public:
  1101. DeviceTreeModel(QObject*parent= NULL);
  1102. ~DeviceTreeModel();
  1103. QVariant data(const QModelIndex&index,int role)const;
  1104. Qt::ItemFlags flags(const QModelIndex&index)const;
  1105. QVariant headerData(int section,Qt::Orientation orientation,
  1106. int role= Qt::DisplayRole)const;
  1107. QModelIndex index(int row,int column,
  1108. const QModelIndex&parent= QModelIndex())const;
  1109. QModelIndex parent(const QModelIndex&child)const;
  1110. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1111. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1112. bool setData(const QModelIndex&index,const QVariant&value,
  1113. int role);
  1114. bool removeRows(int row,int count,const QModelIndex&parent);
  1115. QDomElement referenceElement(const QString&id);
  1116. public slots:
  1117. void newNode(const QString&name,const QString&driver,
  1118. const QModelIndex&parent);
  1119. private:
  1120. QDomDocument document;
  1121. DeviceTreeModelNode*root;
  1122. QDomNode referenceSection;
  1123. QDomNode treeRoot;
  1124. };
  1125. /*:716*//*735:*/
  1126. #line 15570 "./typica.w"
  1127. Q_DECLARE_METATYPE(QModelIndex)
  1128. /*:735*//*743:*/
  1129. #line 15677 "./typica.w"
  1130. class NodeInserter:public QAction
  1131. {
  1132. Q_OBJECT
  1133. public:
  1134. NodeInserter(const QString&title,const QString&name,
  1135. const QString&driver,QObject*parent= NULL);
  1136. signals:
  1137. void triggered(QString name,QString driver);
  1138. private slots:
  1139. void onTriggered();
  1140. private:
  1141. QString defaultNodeName;
  1142. QString driverString;
  1143. };
  1144. /*:743*//*746:*/
  1145. #line 15732 "./typica.w"
  1146. class DeviceConfigurationWindow:public QWidget
  1147. {
  1148. Q_OBJECT
  1149. public:
  1150. DeviceConfigurationWindow();
  1151. public slots:
  1152. void addDevice();
  1153. void removeNode();
  1154. void newSelection(const QModelIndex&index);
  1155. private slots:
  1156. void resizeColumn();
  1157. private:
  1158. QDomDocument document;
  1159. DeviceTreeModel*model;
  1160. QTreeView*view;
  1161. QScrollArea*configArea;
  1162. };
  1163. /*:746*//*755:*/
  1164. #line 15902 "./typica.w"
  1165. class BasicDeviceConfigurationWidget:public QWidget
  1166. {
  1167. Q_OBJECT
  1168. public:
  1169. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1170. const QModelIndex&index);
  1171. public slots:
  1172. void insertChildNode(const QString&name,const QString&driver);
  1173. void updateAttribute(const QString&name,const QString&value);
  1174. protected:
  1175. DeviceTreeModel*deviceModel;
  1176. QModelIndex currentNode;
  1177. };
  1178. /*:755*//*759:*/
  1179. #line 15987 "./typica.w"
  1180. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1181. {
  1182. Q_OBJECT
  1183. public:
  1184. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1185. const QModelIndex&index);
  1186. private slots:
  1187. void updateRoasterId(int id);
  1188. };
  1189. /*:759*//*764:*/
  1190. #line 16141 "./typica.w"
  1191. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1192. {
  1193. Q_OBJECT
  1194. public:
  1195. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1196. const QModelIndex&index);
  1197. };
  1198. /*:764*//*766:*/
  1199. #line 16187 "./typica.w"
  1200. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1201. {
  1202. Q_OBJECT
  1203. public:
  1204. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1205. const QModelIndex&index);
  1206. private slots:
  1207. void addChannel();
  1208. void updateDeviceId(const QString&newId);
  1209. };
  1210. /*:766*//*770:*/
  1211. #line 16273 "./typica.w"
  1212. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1213. {
  1214. Q_OBJECT
  1215. public:
  1216. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1217. const QModelIndex&index);
  1218. private slots:
  1219. void updateThermocoupleType(const QString&type);
  1220. void updateColumnName(const QString&name);
  1221. void updateHidden(bool hidden);
  1222. };
  1223. /*:770*//*775:*/
  1224. #line 16389 "./typica.w"
  1225. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1226. {
  1227. Q_OBJECT
  1228. public:
  1229. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1230. const QModelIndex&index);
  1231. };
  1232. /*:775*//*777:*/
  1233. #line 16430 "./typica.w"
  1234. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1235. {
  1236. Q_OBJECT
  1237. public:
  1238. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1239. const QModelIndex&index);
  1240. private slots:
  1241. void addChannel();
  1242. void updateDeviceId(const QString&newId);
  1243. };
  1244. /*:777*//*779:*/
  1245. #line 16499 "./typica.w"
  1246. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1247. {
  1248. Q_OBJECT
  1249. public:
  1250. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1251. const QModelIndex&index);
  1252. private slots:
  1253. void updateDeviceId(const QString&newId);
  1254. void updateThermocoupleType(const QString&type);
  1255. void updateColumnName(const QString&name);
  1256. void updateHidden(bool hidden);
  1257. };
  1258. /*:779*//*784:*/
  1259. #line 16630 "./typica.w"
  1260. class PortSelector:public QComboBox
  1261. {
  1262. Q_OBJECT
  1263. public:
  1264. PortSelector(QWidget*parent= NULL);
  1265. private slots:
  1266. void addDevice(QextPortInfo port);
  1267. private:
  1268. QextSerialEnumerator*lister;
  1269. };
  1270. /*:784*//*786:*/
  1271. #line 16678 "./typica.w"
  1272. class BaudSelector:public QComboBox
  1273. {
  1274. Q_OBJECT
  1275. Q_ENUMS(BaudRateType)
  1276. public:
  1277. BaudSelector(QWidget*parent= NULL);
  1278. enum BaudRateType
  1279. {
  1280. #if defined(Q_OS_UNIX) || defined(qdoc)
  1281. BAUD50= 50,
  1282. BAUD75= 75,
  1283. BAUD134= 134,
  1284. BAUD150= 150,
  1285. BAUD200= 200,
  1286. BAUD1800= 1800,
  1287. #if defined(B76800) || defined(qdoc)
  1288. BAUD76800= 76800,
  1289. #endif
  1290. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1291. BAUD230400= 230400,
  1292. BAUD460800= 460800,
  1293. BAUD500000= 500000,
  1294. BAUD576000= 576000,
  1295. BAUD921600= 921600,
  1296. BAUD1000000= 1000000,
  1297. BAUD1152000= 1152000,
  1298. BAUD1500000= 1500000,
  1299. BAUD2000000= 2000000,
  1300. BAUD2500000= 2500000,
  1301. BAUD3000000= 3000000,
  1302. BAUD3500000= 3500000,
  1303. BAUD4000000= 4000000,
  1304. #endif
  1305. #endif
  1306. #if defined(Q_OS_WIN) || defined(qdoc)
  1307. BAUD14400= 14400,
  1308. BAUD56000= 56000,
  1309. BAUD128000= 128000,
  1310. BAUD256000= 256000,
  1311. #endif
  1312. BAUD110= 110,
  1313. BAUD300= 300,
  1314. BAUD600= 600,
  1315. BAUD1200= 1200,
  1316. BAUD2400= 2400,
  1317. BAUD4800= 4800,
  1318. BAUD9600= 9600,
  1319. BAUD19200= 19200,
  1320. BAUD38400= 38400,
  1321. BAUD57600= 57600,
  1322. BAUD115200= 115200
  1323. };
  1324. };
  1325. /*:786*//*788:*/
  1326. #line 16749 "./typica.w"
  1327. class ParitySelector:public QComboBox
  1328. {
  1329. Q_OBJECT
  1330. Q_ENUMS(ParityType)
  1331. public:
  1332. ParitySelector(QWidget*parent= NULL);
  1333. enum ParityType
  1334. {
  1335. PAR_NONE,
  1336. PAR_ODD,
  1337. PAR_EVEN,
  1338. #if defined(Q_OS_WIN) || defined(qdoc)
  1339. PAR_MARK,
  1340. #endif
  1341. PAR_SPACE
  1342. };
  1343. };
  1344. /*:788*//*790:*/
  1345. #line 16787 "./typica.w"
  1346. class FlowSelector:public QComboBox
  1347. {
  1348. Q_OBJECT
  1349. Q_ENUMS(FlowType)
  1350. public:
  1351. FlowSelector(QWidget*parent= NULL);
  1352. enum FlowType
  1353. {
  1354. FLOW_OFF,
  1355. FLOW_HARDWARE,
  1356. FLOW_XONXOFF
  1357. };
  1358. };
  1359. /*:790*//*792:*/
  1360. #line 16820 "./typica.w"
  1361. class StopSelector:public QComboBox
  1362. {
  1363. Q_OBJECT
  1364. Q_ENUMS(StopBitsType)
  1365. public:
  1366. StopSelector(QWidget*parent= NULL);
  1367. enum StopBitsType
  1368. {
  1369. STOP_1,
  1370. #if defined(Q_OS_WIN) || defined(qdoc)
  1371. STOP_1_5,
  1372. #endif
  1373. STOP_2
  1374. };
  1375. };
  1376. /*:792*//*795:*/
  1377. #line 16873 "./typica.w"
  1378. class ShortHexSpinBox:public QSpinBox
  1379. {
  1380. Q_OBJECT
  1381. public:
  1382. ShortHexSpinBox(QWidget*parent= NULL);
  1383. virtual QValidator::State validate(QString&input,int&pos)const;
  1384. protected:
  1385. virtual int valueFromText(const QString&text)const;
  1386. virtual QString textFromValue(int value)const;
  1387. };
  1388. /*:795*//*797:*/
  1389. #line 16935 "./typica.w"
  1390. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1391. {
  1392. Q_OBJECT
  1393. public:
  1394. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1395. const QModelIndex&index);
  1396. private slots:
  1397. void updatePort(const QString&newPort);
  1398. void updateBaudRate(const QString&newRate);
  1399. void updateParity(const QString&newParity);
  1400. void updateFlowControl(const QString&newFlow);
  1401. void updateStopBits(const QString&newStopBits);
  1402. };
  1403. /*:797*//*799:*/
  1404. #line 17086 "./typica.w"
  1405. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1406. {
  1407. Q_OBJECT
  1408. public:
  1409. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1410. const QModelIndex&index);
  1411. private slots:
  1412. void updateStationNumber(int newStation);
  1413. void updateFixedUnit(bool newFixed);
  1414. void updateFixedDecimal(bool newFixed);
  1415. void updateUnit(const QString&newUnit);
  1416. void updateUnitAddress(int newAddress);
  1417. void updateValueF(int newValue);
  1418. void updateValueC(int newValue);
  1419. void updatePrecisionAddress(int newAddress);
  1420. void updatePrecisionValue(int newValue);
  1421. private:
  1422. QStackedLayout*unitSpecificationLayout;
  1423. QStackedLayout*decimalSpecificationLayout;
  1424. };
  1425. /*:799*//*801:*/
  1426. #line 17345 "./typica.w"
  1427. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1428. {
  1429. Q_OBJECT
  1430. public:
  1431. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1432. const QModelIndex&index);
  1433. private slots:
  1434. void updateAddress(int newAddress);
  1435. };
  1436. /*:801*//*803:*/
  1437. #line 17391 "./typica.w"
  1438. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1439. {
  1440. Q_OBJECT
  1441. public:
  1442. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1443. const QModelIndex&index);
  1444. private slots:
  1445. void updateReadAddress(int newAddress);
  1446. void updateWriteAddress(int newAddress);
  1447. void updateFixedRange(bool fixed);
  1448. void updateLower(const QString&lower);
  1449. void updateUpper(const QString&upper);
  1450. void updateLowerAddress(int newAddress);
  1451. void updateUpperAddress(int newAddress);
  1452. private:
  1453. QStackedLayout*boundsLayout;
  1454. };
  1455. /*:803*//*807:*/
  1456. #line 17585 "./typica.w"
  1457. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1458. {
  1459. Q_OBJECT
  1460. public:
  1461. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1462. private slots:
  1463. void updateButtonText(const QString&text);
  1464. void updateAnnotationText(const QString&text);
  1465. };
  1466. /*:807*//*811:*/
  1467. #line 17653 "./typica.w"
  1468. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1469. {
  1470. Q_OBJECT
  1471. public:
  1472. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1473. private slots:
  1474. void updateButtonText(const QString&text);
  1475. void updateAnnotationText(const QString&text);
  1476. };
  1477. /*:811*//*814:*/
  1478. #line 17727 "./typica.w"
  1479. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1480. {
  1481. Q_OBJECT
  1482. public:
  1483. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1484. private slots:
  1485. void updateLabel(const QString&text);
  1486. void updateMinimum(const QString&minimum);
  1487. void updateMaximum(const QString&maximum);
  1488. void updatePrecision(int precision);
  1489. void updatePretext(const QString&text);
  1490. void updatePosttext(const QString&text);
  1491. };
  1492. /*:814*//*817:*/
  1493. #line 12 "./freeannotation.w"
  1494. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1495. {
  1496. Q_OBJECT
  1497. public:
  1498. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1499. private slots:
  1500. void updateLabel(const QString&text);
  1501. };
  1502. /*:817*//*821:*/
  1503. #line 11 "./settings.w"
  1504. class SettingsWindow:public QMainWindow
  1505. {
  1506. Q_OBJECT
  1507. public:
  1508. SettingsWindow();
  1509. };
  1510. /*:821*//*826:*/
  1511. #line 8 "./graphsettings.w"
  1512. class GraphSettingsWidget:public QWidget
  1513. {
  1514. Q_OBJECT
  1515. public:
  1516. GraphSettingsWidget();
  1517. };
  1518. /*:826*//*828:*/
  1519. #line 46 "./graphsettings.w"
  1520. class GraphSettingsRelativeTab:public QWidget
  1521. {
  1522. Q_OBJECT
  1523. public:
  1524. GraphSettingsRelativeTab();
  1525. public slots:
  1526. void updateEnableSetting(bool enable);
  1527. void updateColorSetting(const QString&color);
  1528. void updateAxisSetting(const QString&gridList);
  1529. void updateUnit(int unit);
  1530. void showColorPicker();
  1531. private:
  1532. QLineEdit*colorEdit;
  1533. };
  1534. /*:828*//*832:*/
  1535. #line 7 "./advancedsettings.w"
  1536. class AdvancedSettingsWidget:public QWidget
  1537. {
  1538. Q_OBJECT
  1539. public:
  1540. AdvancedSettingsWidget();
  1541. public slots:
  1542. void enableDiagnosticLogging(bool enabled);
  1543. };
  1544. /*:832*//*836:*/
  1545. #line 17852 "./typica.w"
  1546. class ModbusRTUDevice:public QObject
  1547. {
  1548. Q_OBJECT
  1549. public:
  1550. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1551. ~ModbusRTUDevice();
  1552. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1553. Q_INVOKABLE double SVLower();
  1554. Q_INVOKABLE double SVUpper();
  1555. Q_INVOKABLE int decimals();
  1556. QList<Channel*> channels;
  1557. public slots:
  1558. void outputSV(double sv);
  1559. signals:
  1560. void SVLowerChanged(double);
  1561. void SVUpperChanged(double);
  1562. void SVDecimalChanged(int);
  1563. void queueEmpty();
  1564. private slots:
  1565. void dataAvailable();
  1566. void sendNextMessage();
  1567. void decimalResponse(QByteArray response);
  1568. void unitResponse(QByteArray response);
  1569. void svlResponse(QByteArray response);
  1570. void svuResponse(QByteArray response);
  1571. void requestMeasurement();
  1572. void mResponse(QByteArray response);
  1573. void ignore(QByteArray response);
  1574. void timeout();
  1575. private:
  1576. QextSerialPort*port;
  1577. QByteArray responseBuffer;
  1578. QList<QByteArray> messageQueue;
  1579. QList<QObject*> retObjQueue;
  1580. QList<char*> callbackQueue;
  1581. quint16 calculateCRC(QByteArray data);
  1582. QTimer*messageDelayTimer;
  1583. QTimer*commTimeout;
  1584. int delayTime;
  1585. char station;
  1586. int decimalPosition;
  1587. int valueF;
  1588. int valueC;
  1589. bool unitIsF;
  1590. double outputSVLower;
  1591. double outputSVUpper;
  1592. QByteArray outputSVStub;
  1593. QByteArray pvStub;
  1594. QByteArray svStub;
  1595. QByteArray mStub;
  1596. quint16 pvaddress;
  1597. quint16 svaddress;
  1598. bool svenabled;
  1599. bool readingsv;
  1600. double savedpv;
  1601. bool waiting;
  1602. };
  1603. /*:836*//*852:*/
  1604. #line 18555 "./typica.w"
  1605. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1606. {
  1607. Q_OBJECT
  1608. public:
  1609. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1610. private slots:
  1611. void updatePort(const QString&newPort);
  1612. void updateBaudRate(const QString&newRate);
  1613. void updateParity(const QString&newParity);
  1614. void updateFlowControl(const QString&newFlow);
  1615. void updateStopBits(const QString&newStopBits);
  1616. void updateStation(int station);
  1617. void updateFixedDecimal(bool fixed);
  1618. void updateDecimalAddress(int address);
  1619. void updateDecimalPosition(int position);
  1620. void updateFixedUnit(bool fixed);
  1621. void updateUnitAddress(int address);
  1622. void updateValueForF(int value);
  1623. void updateValueForC(int value);
  1624. void updateUnit(const QString&newUnit);
  1625. void updatePVAddress(int address);
  1626. void updateSVEnabled(bool enabled);
  1627. void updateSVReadAddress(int address);
  1628. void updateDeviceLimit(bool query);
  1629. void updateSVLowerAddress(int address);
  1630. void updateSVUpperAddress(int address);
  1631. void updateSVLower(double value);
  1632. void updateSVUpper(double value);
  1633. void updateSVWritable(bool canWriteSV);
  1634. void updateSVWriteAddress(int address);
  1635. void updatePVColumnName(const QString&name);
  1636. void updateSVColumnName(const QString&name);
  1637. void updatePVHidden(bool hidden);
  1638. void updateSVHidden(bool hidden);
  1639. private:
  1640. PortSelector*port;
  1641. BaudSelector*baud;
  1642. ParitySelector*parity;
  1643. FlowSelector*flow;
  1644. StopSelector*stop;
  1645. QSpinBox*station;
  1646. QCheckBox*decimalQuery;
  1647. ShortHexSpinBox*decimalAddress;
  1648. QSpinBox*decimalPosition;
  1649. QCheckBox*unitQuery;
  1650. ShortHexSpinBox*unitAddress;
  1651. QSpinBox*valueF;
  1652. QSpinBox*valueC;
  1653. QComboBox*fixedUnit;
  1654. ShortHexSpinBox*pVAddress;
  1655. QCheckBox*sVEnabled;
  1656. ShortHexSpinBox*sVReadAddress;
  1657. QCheckBox*deviceLimit;
  1658. ShortHexSpinBox*sVLowerAddr;
  1659. ShortHexSpinBox*sVUpperAddr;
  1660. QDoubleSpinBox*sVLower;
  1661. QDoubleSpinBox*sVUpper;
  1662. QCheckBox*sVWritable;
  1663. ShortHexSpinBox*sVOutputAddr;
  1664. QLineEdit*pVColumnName;
  1665. QLineEdit*sVColumnName;
  1666. };
  1667. /*:852*//*856:*/
  1668. #line 36 "./unsupportedserial.w"
  1669. class UnsupportedSerialDeviceConfWidget:public BasicDeviceConfigurationWidget
  1670. {
  1671. Q_OBJECT
  1672. public:
  1673. Q_INVOKABLE UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  1674. const QModelIndex&index);
  1675. private slots:
  1676. void updateConfiguration();
  1677. void saveScript();
  1678. void addChannel();
  1679. private:
  1680. SaltModel*deviceSettingsModel;
  1681. QTextEdit*scriptEditor;
  1682. };
  1683. /*:856*//*861:*/
  1684. #line 166 "./unsupportedserial.w"
  1685. class UnsupportedDeviceChannelConfWidget:public BasicDeviceConfigurationWidget
  1686. {
  1687. Q_OBJECT
  1688. public:
  1689. Q_INVOKABLE UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  1690. const QModelIndex&index);
  1691. private slots:
  1692. void updateColumnName(const QString&value);
  1693. void updateHidden(bool hidden);
  1694. void updateConfiguration();
  1695. private:
  1696. SaltModel*channelSettingsModel;
  1697. };
  1698. /*:861*//*866:*/
  1699. #line 298 "./unsupportedserial.w"
  1700. class JavaScriptDevice:public QObject
  1701. {
  1702. Q_OBJECT
  1703. public:
  1704. Q_INVOKABLE JavaScriptDevice(const QModelIndex&deviceIndex,
  1705. QScriptEngine*engine);
  1706. Q_INVOKABLE int channelCount();
  1707. Channel*getChannel(int channel);
  1708. Q_INVOKABLE bool isChannelHidden(int channel);
  1709. Q_INVOKABLE Units::Unit expectedChannelUnit(int channel);
  1710. Q_INVOKABLE QString channelColumnName(int channel);
  1711. Q_INVOKABLE QString channelIndicatorText(int channel);
  1712. public slots:
  1713. void setTemperatureColumn(int tcol);
  1714. void setAnnotationColumn(int ncol);
  1715. void start();
  1716. void stop();
  1717. signals:
  1718. void annotation(QString note,int tcol,int ncol);
  1719. void triggerStartBatch();
  1720. void triggerStopBatch();
  1721. void deviceStopRequested();
  1722. private:
  1723. QVariantMap deviceSettings;
  1724. QString deviceScript;
  1725. QList<Channel*> channelList;
  1726. QList<bool> hiddenState;
  1727. QList<Units::Unit> channelUnits;
  1728. QList<QString> columnNames;
  1729. QList<QString> indicatorTexts;
  1730. QList<QVariantMap> channelSettings;
  1731. int annotationTemperatureColumn;
  1732. int annotationNoteColumn;
  1733. QScriptEngine*scriptengine;
  1734. };
  1735. /*:866*//*891:*/
  1736. #line 11 "./phidgets.w"
  1737. class PhidgetsTemperatureSensorConfWidget:public BasicDeviceConfigurationWidget
  1738. {
  1739. Q_OBJECT
  1740. public:
  1741. Q_INVOKABLE PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  1742. const QModelIndex&index);
  1743. private slots:
  1744. void addChannel();
  1745. void updateRate(int ms);
  1746. };
  1747. /*:891*//*895:*/
  1748. #line 82 "./phidgets.w"
  1749. class PhidgetTemperatureSensorChannelConfWidget:public BasicDeviceConfigurationWidget
  1750. {
  1751. Q_OBJECT
  1752. public:
  1753. Q_INVOKABLE PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel*model,
  1754. const QModelIndex&index);
  1755. private slots:
  1756. void updateColumnName(const QString&value);
  1757. void updateHidden(bool hidden);
  1758. void updateTC(int index);
  1759. void updateChannel(int channel);
  1760. private:
  1761. QComboBox*tcType;
  1762. };
  1763. /*:895*//*900:*/
  1764. #line 213 "./phidgets.w"
  1765. class PhidgetsTemperatureSensor:public QObject
  1766. {
  1767. Q_OBJECT
  1768. public:
  1769. Q_INVOKABLE PhidgetsTemperatureSensor(const QModelIndex&deviceIndex);
  1770. Q_INVOKABLE int channelCount();
  1771. Channel*getChannel(int channel);
  1772. Q_INVOKABLE bool isChannelHidden(int channel);
  1773. Q_INVOKABLE QString channelColumnName(int channel);
  1774. Q_INVOKABLE QString channelIndicatorText(int channel);
  1775. public slots:
  1776. void start();
  1777. void stop();
  1778. private slots:
  1779. void getMeasurements();
  1780. private:
  1781. QList<int> channelIndices;
  1782. QList<int> tctypes;
  1783. QList<Channel*> channelList;
  1784. QMap<int,Channel*> channelMap;
  1785. QList<bool> hiddenState;
  1786. QList<QString> columnNames;
  1787. QList<QString> indicatorTexts;
  1788. QLibrary driver;
  1789. QTimer sampleTimer;
  1790. void*device;
  1791. /*904:*/
  1792. #line 349 "./phidgets.w"
  1793. #ifdef _WIN32
  1794. typedef int(__stdcall*PhidgetHandleOnly)(void*);
  1795. typedef int(__stdcall*PhidgetHandleInt)(void*,int);
  1796. typedef int(__stdcall*PhidgetHandleIntInt)(void*,int,int);
  1797. typedef int(__stdcall*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1798. #else
  1799. typedef int(*PhidgetHandleOnly)(void*);
  1800. typedef int(*PhidgetHandleInt)(void*,int);
  1801. typedef int(*PhidgetHandleIntInt)(void*,int,int);
  1802. typedef int(*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1803. #endif
  1804. PhidgetHandleOnly createDevice;
  1805. PhidgetHandleInt openDevice;
  1806. PhidgetHandleInt waitForOpen;
  1807. PhidgetHandleIntInt setTCType;
  1808. PhidgetHandleIntDoubleOut getTemperature;
  1809. PhidgetHandleOnly closeDevice;
  1810. PhidgetHandleOnly deleteDevice;
  1811. /*:904*/
  1812. #line 240 "./phidgets.w"
  1813. };
  1814. /*:900*//*913:*/
  1815. #line 19093 "./typica.w"
  1816. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1817. {
  1818. Q_OBJECT
  1819. public:
  1820. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1821. const QModelIndex&index);
  1822. private slots:
  1823. void updateSourceColumn(const QString&source);
  1824. void updateDestinationColumn(const QString&dest);
  1825. void updateKnots();
  1826. private:
  1827. SaltModel*tablemodel;
  1828. };
  1829. /*:913*//*919:*/
  1830. #line 19223 "./typica.w"
  1831. class CoolingTimerConfWidget:public BasicDeviceConfigurationWidget
  1832. {
  1833. Q_OBJECT
  1834. public:
  1835. Q_INVOKABLE CoolingTimerConfWidget(DeviceTreeModel*model,
  1836. const QModelIndex&index);
  1837. private slots:
  1838. void updateResetTime(QTime time);
  1839. };
  1840. /*:919*//*923:*/
  1841. #line 19289 "./typica.w"
  1842. class RangeTimerConfWidget:public BasicDeviceConfigurationWidget
  1843. {
  1844. Q_OBJECT
  1845. public:
  1846. Q_INVOKABLE RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1847. private slots:
  1848. void updateStartButtonText(const QString&text);
  1849. void updateStopButtonText(const QString&text);
  1850. void updateStartColumnName(const QString&text);
  1851. void updateStopColumnName(const QString&text);
  1852. void updateStartValue(const QString&text);
  1853. void updateStopValue(const QString&text);
  1854. void updateStartTrigger(int option);
  1855. void updateStopTrigger(int option);
  1856. };
  1857. /*:923*//*928:*/
  1858. #line 19541 "./typica.w"
  1859. class MultiRangeTimerConfWidget:public BasicDeviceConfigurationWidget
  1860. {
  1861. Q_OBJECT
  1862. public:
  1863. Q_INVOKABLE MultiRangeTimerConfWidget(DeviceTreeModel*model,
  1864. const QModelIndex&index);
  1865. private slots:
  1866. void updateColumnName(const QString&text);
  1867. void updateRangeData();
  1868. private:
  1869. SaltModel*tablemodel;
  1870. };
  1871. /*:928*//*933:*/
  1872. #line 19643 "./typica.w"
  1873. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1874. {
  1875. Q_OBJECT
  1876. public:
  1877. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1878. private slots:
  1879. void updateMatchingColumn(const QString&column);
  1880. void updateTemperature();
  1881. private:
  1882. QDoubleSpinBox*temperatureValue;
  1883. QComboBox*unitSelector;
  1884. };
  1885. /*:933*//*937:*/
  1886. #line 16 "./rate.w"
  1887. class RateOfChange:public QObject
  1888. {
  1889. Q_OBJECT
  1890. public:
  1891. RateOfChange(int cachetime= 1,int scaletime= 1);
  1892. public slots:
  1893. void newMeasurement(Measurement measure);
  1894. void setCacheTime(int seconds);
  1895. void setScaleTime(int seconds);
  1896. signals:
  1897. void newData(Measurement measure);
  1898. private:
  1899. int ct;
  1900. int st;
  1901. QList<Measurement> cache;
  1902. };
  1903. /*:937*//*945:*/
  1904. #line 177 "./rate.w"
  1905. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  1906. {
  1907. Q_OBJECT
  1908. public:
  1909. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1910. private slots:
  1911. void updateColumn(const QString&column);
  1912. void updateCacheTime(const QString&seconds);
  1913. void updateScaleTime(const QString&seconds);
  1914. };
  1915. /*:945*//*951:*/
  1916. #line 19 "./dataqsdk.w"
  1917. class DataqSdkDeviceImplementation;
  1918. class DataqSdkDevice:public QObject
  1919. {
  1920. Q_OBJECT
  1921. DataqSdkDeviceImplementation*imp;
  1922. private slots:
  1923. void threadFinished();
  1924. public:
  1925. DataqSdkDevice(QString device);
  1926. ~DataqSdkDevice();
  1927. Channel*newChannel(Units::Unit scale);
  1928. Q_INVOKABLE void setClockRate(double Hz);
  1929. Q_INVOKABLE void start();
  1930. static QStringList detectPorts();
  1931. static QStringList detectHardware();
  1932. };
  1933. /*:951*//*952:*/
  1934. #line 49 "./dataqsdk.w"
  1935. class DataqSdkDeviceImplementation:public QThread
  1936. {
  1937. Q_OBJECT
  1938. public:
  1939. DataqSdkDeviceImplementation();
  1940. ~DataqSdkDeviceImplementation();
  1941. void run();
  1942. /*953:*/
  1943. #line 70 "./dataqsdk.w"
  1944. typedef struct di_inlist_struct{
  1945. unsigned short chan;
  1946. unsigned short diff;
  1947. unsigned short gain;
  1948. unsigned short unipolar;
  1949. unsigned short dig_out_enable;
  1950. unsigned short dig_out;
  1951. unsigned short ave;
  1952. unsigned short counter;
  1953. }DI_INLIST_STRUCT;
  1954. typedef int(PASCAL*FPDIOPEN)(unsigned);
  1955. typedef int(PASCAL*FPDICLOSE)(void);
  1956. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  1957. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  1958. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  1959. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  1960. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  1961. typedef int(PASCAL*FPDISTARTSCAN)(void);
  1962. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  1963. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  1964. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  1965. typedef int(PASCAL*FPDISTOPSCAN)(void);
  1966. FPDIOPEN di_open;
  1967. FPDICLOSE di_close;
  1968. FPDISAMPLERATE di_sample_rate;
  1969. FPDIMAXIMUMRATE di_maximum_rate;
  1970. FPDILISTLENGTH di_list_length;
  1971. FPDIINLIST di_inlist;
  1972. FPDIBUFFERALLOC di_buffer_alloc;
  1973. FPDISTARTSCAN di_start_scan;
  1974. FPDISTATUSREAD di_status_read;
  1975. FPDIBUFFERSTATUS di_buffer_status;
  1976. FPDIBURSTRATE di_burst_rate;
  1977. FPDISTOPSCAN di_stop_scan;
  1978. /*:953*/
  1979. #line 57 "./dataqsdk.w"
  1980. /*955:*/
  1981. #line 134 "./dataqsdk.w"
  1982. bool isOpen;
  1983. double sampleRate;
  1984. long oversample;
  1985. long burstDivisor;
  1986. QString device;
  1987. unsigned deviceNumber;
  1988. QVector<Channel*> channelMap;
  1989. int error;
  1990. int channels;
  1991. bool ready;
  1992. QLibrary*driver;
  1993. QVector<Units::Unit> unitMap;
  1994. int*input_buffer;
  1995. QTimer*eventClock;
  1996. QMultiMap<int,double> smoother;
  1997. /*:955*/
  1998. #line 58 "./dataqsdk.w"
  1999. public slots:
  2000. void measure();
  2001. private:
  2002. qint16*buffer;
  2003. };
  2004. /*:952*//*972:*/
  2005. #line 663 "./dataqsdk.w"
  2006. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  2007. {
  2008. Q_OBJECT
  2009. public:
  2010. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  2011. const QModelIndex&index);
  2012. private slots:
  2013. void updateAutoSelect(bool automatic);
  2014. void updateDeviceNumber(int deviceNumber);
  2015. void updatePort(QString portId);
  2016. void addChannel();
  2017. private:
  2018. QStackedWidget*deviceIdStack;
  2019. };
  2020. /*:972*//*977:*/
  2021. #line 808 "./dataqsdk.w"
  2022. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  2023. {
  2024. Q_OBJECT
  2025. public:
  2026. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  2027. const QModelIndex&index);
  2028. private slots:
  2029. void updateUnits(const QString&unit);
  2030. void updateColumnName(const QString&value);
  2031. void updateMeasuredLower(const QString&value);
  2032. void updateMeasuredUpper(const QString&value);
  2033. void updateMappedLower(const QString&value);
  2034. void updateMappedUpper(const QString&value);
  2035. void updateClosedInterval(bool closed);
  2036. void updateSmoothingEnabled(bool enabled);
  2037. void updateSensitivity(const QString&value);
  2038. void startCalibration();
  2039. void stopCalibration();
  2040. void resetCalibration();
  2041. void updateInput(Measurement measure);
  2042. void updateOutput(Measurement measure);
  2043. void updateHidden(bool hidden);
  2044. private:
  2045. QPushButton*startButton;
  2046. QPushButton*resetButton;
  2047. QPushButton*stopButton;
  2048. /*982:*/
  2049. #line 1098 "./dataqsdk.w"
  2050. bool autoSelect;
  2051. QString deviceID;
  2052. unsigned int channelOfInterest;
  2053. /*:982*/
  2054. #line 835 "./dataqsdk.w"
  2055. DataqSdkDevice*calibrationDevice;
  2056. LinearCalibrator*calibrator;
  2057. QLineEdit*currentMeasurement;
  2058. QLineEdit*minimumMeasurement;
  2059. QLineEdit*maximumMeasurement;
  2060. QLineEdit*averageMeasurement;
  2061. QLineEdit*currentMapped;
  2062. QLineEdit*minimumMapped;
  2063. QLineEdit*maximumMapped;
  2064. QLineEdit*averageMapped;
  2065. int rmCount;
  2066. int cmCount;
  2067. double rmin;
  2068. double rmax;
  2069. double rmean;
  2070. double cmin;
  2071. double cmax;
  2072. double cmean;
  2073. };
  2074. /*:977*//*1004:*/
  2075. #line 247 "./scales.w"
  2076. Q_DECLARE_METATYPE(BaudRateType)
  2077. Q_DECLARE_METATYPE(DataBitsType)
  2078. Q_DECLARE_METATYPE(ParityType)
  2079. Q_DECLARE_METATYPE(StopBitsType)
  2080. Q_DECLARE_METATYPE(FlowType)
  2081. /*:1004*//*1011:*/
  2082. #line 370 "./scales.w"
  2083. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  2084. {
  2085. Q_OBJECT
  2086. public:
  2087. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  2088. const QModelIndex&index);
  2089. private slots:
  2090. void updatePort(const QString&newPort);
  2091. void updateBaudRate(const QString&rate);
  2092. void updateParity(int index);
  2093. void updateFlowControl(int index);
  2094. void updateStopBits(int index);
  2095. private:
  2096. PortSelector*port;
  2097. BaudSelector*baud;
  2098. ParitySelector*parity;
  2099. FlowSelector*flow;
  2100. StopSelector*stop;
  2101. };
  2102. /*:1011*//*1016:*/
  2103. #line 14 "./valueannotation.w"
  2104. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  2105. {
  2106. Q_OBJECT
  2107. public:
  2108. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  2109. const QModelIndex&index);
  2110. private slots:
  2111. void updateSourceColumn(const QString&source);
  2112. void updateAnnotations();
  2113. void updateStart(bool noteOnStart);
  2114. private:
  2115. SaltModel*tablemodel;
  2116. };
  2117. /*:1016*//*1024:*/
  2118. #line 165 "./valueannotation.w"
  2119. class ValueAnnotation:public QObject
  2120. {
  2121. Q_OBJECT
  2122. public:
  2123. ValueAnnotation();
  2124. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  2125. public slots:
  2126. void newMeasurement(Measurement measure);
  2127. void annotate();
  2128. void setAnnotationColumn(int column);
  2129. void setTemperatureColumn(int column);
  2130. void setTolerance(double epsilon);
  2131. signals:
  2132. void annotation(QString annotation,int tempcolumn,int notecolumn);
  2133. private:
  2134. int lastIndex;
  2135. int annotationColumn;
  2136. int measurementColumn;
  2137. QList<double> values;
  2138. QStringList annotations;
  2139. double tolerance;
  2140. };
  2141. /*:1024*/
  2142. #line 526 "./typica.w"
  2143. /*12:*/
  2144. #line 807 "./typica.w"
  2145. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  2146. /*:12*//*14:*/
  2147. #line 822 "./typica.w"
  2148. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2149. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  2150. /*:14*//*16:*/
  2151. #line 847 "./typica.w"
  2152. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2153. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  2154. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  2155. QScriptValue QWidget_activateWindow(QScriptContext*context,
  2156. QScriptEngine*engine);
  2157. /*:16*//*27:*/
  2158. #line 1091 "./typica.w"
  2159. QScriptValue constructQMainWindow(QScriptContext*context,
  2160. QScriptEngine*engine);
  2161. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  2162. QScriptEngine*engine);
  2163. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  2164. QScriptEngine*engine);
  2165. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  2166. /*:27*//*32:*/
  2167. #line 1190 "./typica.w"
  2168. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  2169. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  2170. /*:32*//*35:*/
  2171. #line 1235 "./typica.w"
  2172. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  2173. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  2174. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  2175. /*:35*//*38:*/
  2176. #line 1301 "./typica.w"
  2177. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  2178. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  2179. /*:38*//*41:*/
  2180. #line 1334 "./typica.w"
  2181. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  2182. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  2183. /*:41*//*44:*/
  2184. #line 1372 "./typica.w"
  2185. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  2186. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  2187. /*:44*//*48:*/
  2188. #line 1411 "./typica.w"
  2189. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  2190. QScriptValue QSplitter_addWidget(QScriptContext*context,
  2191. QScriptEngine*engine);
  2192. QScriptValue QSplitter_saveState(QScriptContext*context,
  2193. QScriptEngine*engine);
  2194. QScriptValue QSplitter_restoreState(QScriptContext*context,
  2195. QScriptEngine*engine);
  2196. QScriptValue QSplitter_count(QScriptContext*context,
  2197. QScriptEngine*engine);
  2198. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  2199. /*:48*//*54:*/
  2200. #line 1550 "./typica.w"
  2201. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2202. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2203. /*:54*//*56:*/
  2204. #line 1605 "./typica.w"
  2205. QScriptValue constructQBoxLayout(QScriptContext*context,
  2206. QScriptEngine*engine);
  2207. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2208. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  2209. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2210. /*:56*//*60:*/
  2211. #line 1718 "./typica.w"
  2212. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  2213. QScriptValue QAction_setShortcut(QScriptContext*context,
  2214. QScriptEngine*engine);
  2215. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  2216. /*:60*//*63:*/
  2217. #line 1774 "./typica.w"
  2218. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  2219. QScriptEngine*engine);
  2220. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  2221. QScriptEngine*engine);
  2222. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2223. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2224. /*:63*//*68:*/
  2225. #line 1885 "./typica.w"
  2226. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2227. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2228. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2229. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2230. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2231. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2232. QScriptValue QIODevice_readToString(QScriptContext*context,
  2233. QScriptEngine*engine);
  2234. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*engine);
  2235. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*engine);
  2236. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*engine);
  2237. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine);
  2238. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine);
  2239. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine);
  2240. /*:68*//*79:*/
  2241. #line 2111 "./typica.w"
  2242. QScriptValue constructQProcess(QScriptContext*context,QScriptEngine*engine);
  2243. void setQProcessProperties(QScriptValue value,QScriptEngine*engine);
  2244. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*engine);
  2245. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*engine);
  2246. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*engine);
  2247. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*engine);
  2248. /*:79*//*87:*/
  2249. #line 2229 "./typica.w"
  2250. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes);
  2251. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes);
  2252. QScriptValue constructQByteArray(QScriptContext*context,QScriptEngine*engine);
  2253. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine);
  2254. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine);
  2255. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*engine);
  2256. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*engine);
  2257. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine);
  2258. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine);
  2259. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*engine);
  2260. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine);
  2261. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine);
  2262. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine);
  2263. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*engine);
  2264. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine);
  2265. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*engine);
  2266. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*engine);
  2267. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*engine);
  2268. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*engine);
  2269. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*engine);
  2270. /*:87*//*100:*/
  2271. #line 2503 "./typica.w"
  2272. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine);
  2273. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine);
  2274. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine);
  2275. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine);
  2276. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine);
  2277. /*:100*//*103:*/
  2278. #line 2608 "./typica.w"
  2279. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2280. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2281. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2282. /*:103*//*106:*/
  2283. #line 2653 "./typica.w"
  2284. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2285. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2286. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2287. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2288. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2289. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2290. /*:106*//*112:*/
  2291. #line 2735 "./typica.w"
  2292. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2293. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2294. QScriptEngine*engine);
  2295. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2296. QScriptEngine*engine);
  2297. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2298. QScriptEngine*engine);
  2299. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2300. QScriptEngine*engine);
  2301. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2302. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2303. QScriptEngine*engine);
  2304. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2305. QScriptEngine*engine);
  2306. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2307. QScriptEngine*engine);
  2308. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2309. QScriptEngine*engine);
  2310. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2311. QScriptEngine*engine);
  2312. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2313. QScriptEngine*engine);
  2314. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2315. QScriptEngine*engine);
  2316. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2317. QScriptEngine*engine);
  2318. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2319. /*:112*//*121:*/
  2320. #line 2953 "./typica.w"
  2321. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2322. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2323. QScriptValue XmlReader_attribute(QScriptContext*context,
  2324. QScriptEngine*engine);
  2325. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2326. QScriptEngine*engine);
  2327. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2328. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2329. QScriptEngine*engine);
  2330. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2331. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2332. QScriptEngine*engine);
  2333. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2334. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2335. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2336. /*:121*//*128:*/
  2337. #line 3088 "./typica.w"
  2338. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2339. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2340. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2341. /*:128*//*132:*/
  2342. #line 3170 "./typica.w"
  2343. QScriptValue constructQLCDNumber(QScriptContext*context,
  2344. QScriptEngine*engine);
  2345. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2346. /*:132*//*135:*/
  2347. #line 3208 "./typica.w"
  2348. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2349. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2350. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2351. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2352. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2353. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2354. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2355. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2356. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2357. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2358. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2359. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2360. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2361. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2362. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2363. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2364. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2365. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2366. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2367. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2368. /*:135*//*151:*/
  2369. #line 3686 "./typica.w"
  2370. void setQAbstractScrollAreaProperties(QScriptValue value,
  2371. QScriptEngine*engine);
  2372. /*:151*//*153:*/
  2373. #line 3701 "./typica.w"
  2374. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2375. /*:153*//*155:*/
  2376. #line 3714 "./typica.w"
  2377. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2378. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2379. /*:155*//*157:*/
  2380. #line 3738 "./typica.w"
  2381. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2382. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2383. QScriptValue constructQPushButton(QScriptContext*context,
  2384. QScriptEngine*engine);
  2385. /*:157*//*164:*/
  2386. #line 3837 "./typica.w"
  2387. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2388. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2389. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2390. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2391. QScriptEngine*engine);
  2392. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2393. QScriptEngine*engine);
  2394. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2395. QScriptEngine*engine);
  2396. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2397. QScriptEngine*engine);
  2398. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2399. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2400. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2401. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2402. /*:164*//*171:*/
  2403. #line 4008 "./typica.w"
  2404. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2405. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2406. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2407. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2408. QScriptValue annotationFromRecord(QScriptContext*context,
  2409. QScriptEngine*engine);
  2410. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2411. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*engine);
  2412. /*:171*//*183:*/
  2413. #line 4321 "./typica.w"
  2414. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2415. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2416. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2417. QStack<QLayout*> *layoutStack);
  2418. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2419. QStack<QLayout*> *layoutStack);
  2420. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2421. QStack<QLayout*> *layoutStack);
  2422. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2423. QStack<QLayout*> *layoutStack);
  2424. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2425. QStack<QLayout*> *layoutStack);
  2426. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2427. QStack<QLayout*> *layoutStack);
  2428. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2429. QStack<QLayout*> *layoutStack);
  2430. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2431. QStack<QLayout*> *layoutStack);
  2432. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2433. QStack<QLayout*> *layoutStack);
  2434. void addTemperatureDisplayToSplitter(QDomElement element,
  2435. QStack<QWidget*> *widgetStack,
  2436. QStack<QLayout*> *layoutStack);
  2437. void addTemperatureDisplayToLayout(QDomElement element,
  2438. QStack<QWidget*> *widgetStack,
  2439. QStack<QLayout*> *layoutStack);
  2440. void addTimerDisplayToSplitter(QDomElement element,
  2441. QStack<QWidget*> *widgetStack,
  2442. QStack<QLayout*> *layoutStack);
  2443. void addTimerDisplayToLayout(QDomElement element,
  2444. QStack<QWidget*> *widgetStack,
  2445. QStack<QLayout*> *layoutStack);
  2446. void addDecorationToSplitter(QDomElement element,
  2447. QStack<QWidget*> *widgetStack,
  2448. QStack<QLayout*> *layoutStack);
  2449. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2450. QStack<QLayout*> *layoutStack);
  2451. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2452. QStack<QLayout*> *layoutStack);
  2453. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2454. QStack<QLayout*> *layoutStack);
  2455. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2456. QStack<QLayout*> *layoutStack);
  2457. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2458. QStack<QLayout*> *layoutStack);
  2459. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2460. QStack<QLayout*> *layoutStack);
  2461. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2462. QStack<QLayout*> *layoutStack);
  2463. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2464. QStack<QLayout*> *layoutStack);
  2465. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2466. QStack<QLayout*> *layoutStack);
  2467. void addSqlQueryViewToLayout(QDomElement element,
  2468. QStack<QWidget*> *widgetStack,
  2469. QStack<QLayout*> *layoutStack);
  2470. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2471. QStack<QLayout*> *layoutStack);
  2472. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2473. QStack<QLayout*> *layoutStack);
  2474. /*:183*//*247:*/
  2475. #line 5974 "./typica.w"
  2476. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2477. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2478. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2479. QScriptEngine*engine);
  2480. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2481. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2482. QScriptEngine*engine);
  2483. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2484. /*:247*//*248:*/
  2485. #line 5989 "./typica.w"
  2486. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  2487. /*:248*//*252:*/
  2488. #line 6124 "./typica.w"
  2489. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  2490. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  2491. QScriptEngine*engine);
  2492. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  2493. QScriptEngine*engine);
  2494. QScriptValue SaltTable_columnSum(QScriptContext*context,
  2495. QScriptEngine*engine);
  2496. QScriptValue SaltTable_columnArray(QScriptContext*context,
  2497. QScriptEngine*engine);
  2498. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  2499. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  2500. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  2501. QScriptEngine*engine);
  2502. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  2503. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  2504. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  2505. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  2506. /*:252*//*262:*/
  2507. #line 6340 "./typica.w"
  2508. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2509. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2510. QScriptValue QComboBox_currentData(QScriptContext*context,
  2511. QScriptEngine*engine);
  2512. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  2513. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  2514. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  2515. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  2516. /*:262*//*274:*/
  2517. #line 379 "./units.w"
  2518. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  2519. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  2520. QScriptEngine*engine);
  2521. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  2522. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  2523. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  2524. /*:274*//*278:*/
  2525. #line 443 "./units.w"
  2526. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  2527. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  2528. /*:278*//*287:*/
  2529. #line 133 "./measurement.w"
  2530. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine);
  2531. void setMeasurementProperties(QScriptValue value,QScriptEngine*engine);
  2532. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement);
  2533. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement);
  2534. /*:287*//*307:*/
  2535. #line 6975 "./typica.w"
  2536. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  2537. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2538. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  2539. /*:307*//*316:*/
  2540. #line 7180 "./typica.w"
  2541. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  2542. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2543. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  2544. /*:316*//*321:*/
  2545. #line 7281 "./typica.w"
  2546. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  2547. /*:321*//*327:*/
  2548. #line 7463 "./typica.w"
  2549. QScriptValue constructLinearCalibrator(QScriptContext*context,
  2550. QScriptEngine*engine);
  2551. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  2552. /*:327*//*332:*/
  2553. #line 7603 "./typica.w"
  2554. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  2555. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  2556. /*:332*//*342:*/
  2557. #line 7808 "./typica.w"
  2558. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  2559. QScriptEngine*engine);
  2560. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2561. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  2562. QScriptEngine*engine);
  2563. /*:342*//*350:*/
  2564. #line 7967 "./typica.w"
  2565. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  2566. QScriptEngine*engine);
  2567. void setMeasurementTimeOffsetProperties(QScriptValue value,
  2568. QScriptEngine*engine);
  2569. /*:350*//*355:*/
  2570. #line 8080 "./typica.w"
  2571. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  2572. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  2573. /*:355*//*360:*/
  2574. #line 8178 "./typica.w"
  2575. QScriptValue constructZeroEmitter(QScriptContext*context,
  2576. QScriptEngine*engine);
  2577. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  2578. /*:360*//*365:*/
  2579. #line 8257 "./typica.w"
  2580. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  2581. QScriptEngine*engine);
  2582. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  2583. /*:365*//*382:*/
  2584. #line 8721 "./typica.w"
  2585. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  2586. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  2587. /*:382*//*405:*/
  2588. #line 9348 "./typica.w"
  2589. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  2590. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  2591. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  2592. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  2593. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  2594. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  2595. QScriptEngine*engine);
  2596. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  2597. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  2598. QScriptEngine*engnie);
  2599. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  2600. QScriptEngine*engine);
  2601. /*:405*//*443:*/
  2602. #line 10305 "./typica.w"
  2603. QScriptValue constructAnnotationButton(QScriptContext*context,
  2604. QScriptEngine*engine);
  2605. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2606. /*:443*//*451:*/
  2607. #line 10445 "./typica.w"
  2608. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2609. QScriptEngine*engine);
  2610. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2611. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2612. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2613. /*:451*//*472:*/
  2614. #line 10871 "./typica.w"
  2615. QScriptValue constructTimerDisplay(QScriptContext*context,
  2616. QScriptEngine*engine);
  2617. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2618. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*engine);
  2619. /*:472*//*500:*/
  2620. #line 11396 "./typica.w"
  2621. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2622. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2623. QScriptEngine*engine);
  2624. /*:500*//*513:*/
  2625. #line 11679 "./typica.w"
  2626. QScriptValue constructLogEditWindow(QScriptContext*context,
  2627. QScriptEngine*engine);
  2628. /*:513*//*532:*/
  2629. #line 12206 "./typica.w"
  2630. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2631. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2632. /*:532*//*550:*/
  2633. #line 189 "./webview.w"
  2634. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2635. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2636. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2637. QStack<QLayout*> *layoutStack);
  2638. /*:550*//*553:*/
  2639. #line 219 "./webview.w"
  2640. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  2641. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  2642. /*:553*//*557:*/
  2643. #line 277 "./webview.w"
  2644. QScriptValue constructWebElement(QScriptContext*context,
  2645. QScriptEngine*engine);
  2646. /*:557*//*626:*/
  2647. #line 13545 "./typica.w"
  2648. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2649. QScriptValue constructSqlQueryView(QScriptContext*context,
  2650. QScriptEngine*engine);
  2651. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2652. QScriptEngine*engine);
  2653. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2654. QScriptEngine*engine);
  2655. /*:626*//*636:*/
  2656. #line 13782 "./typica.w"
  2657. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2658. QStack<QLayout*> *layoutStack);
  2659. /*:636*//*652:*/
  2660. #line 14067 "./typica.w"
  2661. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2662. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2663. /*:652*//*674:*/
  2664. #line 480 "./daterangeselector.w"
  2665. void addDateRangeToLayout(QDomElement element,
  2666. QStack<QWidget*> *widgetStack,
  2667. QStack<QLayout*> *layoutStack);
  2668. /*:674*//*683:*/
  2669. #line 14264 "./typica.w"
  2670. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2671. QStack<QLayout*> *layoutStack);
  2672. /*:683*//*704:*/
  2673. #line 14848 "./typica.w"
  2674. void addScaleControlToLayout(QDomElement element,
  2675. QStack<QWidget*> *widgetStack,
  2676. QStack<QLayout*> *layoutStack);
  2677. void addIntensityControlToLayout(QDomElement element,
  2678. QStack<QWidget*> *widgetStack,
  2679. QStack<QLayout*> *layoutStack);
  2680. /*:704*//*730:*/
  2681. #line 15434 "./typica.w"
  2682. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2683. QScriptEngine*engine);
  2684. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2685. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2686. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2687. QScriptEngine*engine);
  2688. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2689. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2690. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2691. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2692. /*:730*//*736:*/
  2693. #line 15576 "./typica.w"
  2694. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2695. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2696. /*:736*//*752:*/
  2697. #line 15874 "./typica.w"
  2698. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2699. QScriptEngine*engine);
  2700. /*:752*//*823:*/
  2701. #line 42 "./settings.w"
  2702. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  2703. /*:823*//*847:*/
  2704. #line 18462 "./typica.w"
  2705. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2706. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2707. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2708. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2709. /*:847*//*867:*/
  2710. #line 345 "./unsupportedserial.w"
  2711. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine);
  2712. /*:867*//*873:*/
  2713. #line 425 "./unsupportedserial.w"
  2714. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine);
  2715. /*:873*//*879:*/
  2716. #line 617 "./unsupportedserial.w"
  2717. QScriptValue getMeasurementTimestamp(QScriptContext*context,QScriptEngine*engine);
  2718. /*:879*//*883:*/
  2719. #line 651 "./unsupportedserial.w"
  2720. QScriptValue constructSerialPort(QScriptContext*context,QScriptEngine*engine);
  2721. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine);
  2722. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*engine);
  2723. /*:883*//*910:*/
  2724. #line 457 "./phidgets.w"
  2725. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine);
  2726. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine);
  2727. /*:910*//*942:*/
  2728. #line 138 "./rate.w"
  2729. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  2730. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  2731. /*:942*//*967:*/
  2732. #line 597 "./dataqsdk.w"
  2733. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  2734. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  2735. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2736. /*:967*//*994:*/
  2737. #line 67 "./scales.w"
  2738. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  2739. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  2740. /*:994*//*1002:*/
  2741. #line 233 "./scales.w"
  2742. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  2743. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  2744. /*:1002*//*1005:*/
  2745. #line 258 "./scales.w"
  2746. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  2747. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  2748. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  2749. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  2750. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  2751. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  2752. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  2753. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  2754. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  2755. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  2756. /*:1005*//*1030:*/
  2757. #line 265 "./valueannotation.w"
  2758. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  2759. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  2760. /*:1030*/
  2761. #line 527 "./typica.w"
  2762. /*606:*/
  2763. #line 13202 "./typica.w"
  2764. void messageFileOutput(QtMsgType type,const char*msg);
  2765. /*:606*/
  2766. #line 528 "./typica.w"
  2767. /*4:*/
  2768. #line 537 "./typica.w"
  2769. /*744:*/
  2770. #line 15697 "./typica.w"
  2771. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2772. const QString&driver,QObject*parent):
  2773. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2774. {
  2775. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2776. }
  2777. void NodeInserter::onTriggered()
  2778. {
  2779. emit triggered(defaultNodeName,driverString);
  2780. }
  2781. /*:744*/
  2782. #line 538 "./typica.w"
  2783. /*283:*/
  2784. #line 40 "./measurement.w"
  2785. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  2786. {
  2787. insert("measurement",temperature);
  2788. insert("time",time);
  2789. insert("unit",sc);
  2790. }
  2791. Measurement::Measurement(double temperature)
  2792. {
  2793. insert("measurement",temperature);
  2794. insert("time",QTime::currentTime());
  2795. insert("unit",Units::Fahrenheit);
  2796. }
  2797. void Measurement::setTemperature(double temperature)
  2798. {
  2799. insert("measurement",temperature);
  2800. }
  2801. void Measurement::setTime(QTime time)
  2802. {
  2803. insert("time",time);
  2804. }
  2805. void Measurement::setUnit(Units::Unit scale)
  2806. {
  2807. insert("unit",scale);
  2808. }
  2809. double Measurement::temperature()const
  2810. {
  2811. return value("measurement").toDouble();
  2812. }
  2813. QTime Measurement::time()const
  2814. {
  2815. return value("time").toTime();
  2816. }
  2817. Units::Unit Measurement::scale()const
  2818. {
  2819. return(Units::Unit)(value("unit").toInt());
  2820. }
  2821. /*:283*//*284:*/
  2822. #line 88 "./measurement.w"
  2823. Measurement Measurement::toFahrenheit()
  2824. {
  2825. return Measurement(Units::convertTemperature(this->temperature(),
  2826. this->scale(),Units::Fahrenheit),
  2827. this->time(),Units::Fahrenheit);
  2828. }
  2829. Measurement Measurement::toCelsius()
  2830. {
  2831. return Measurement(Units::convertTemperature(this->temperature(),
  2832. this->scale(),Units::Celsius),
  2833. this->time(),Units::Celsius);
  2834. }
  2835. Measurement Measurement::toKelvin()
  2836. {
  2837. return Measurement(Units::convertTemperature(this->temperature(),
  2838. this->scale(),Units::Kelvin),
  2839. this->time(),Units::Kelvin);
  2840. }
  2841. Measurement Measurement::toRankine()
  2842. {
  2843. return Measurement(Units::convertTemperature(this->temperature(),
  2844. this->scale(),Units::Rankine),
  2845. this->time(),Units::Rankine);
  2846. }
  2847. /*:284*/
  2848. #line 539 "./typica.w"
  2849. /*297:*/
  2850. #line 6580 "./typica.w"
  2851. void DAQImplementation::measure()
  2852. {
  2853. int samplesRead= 0;
  2854. double buffer[channels];
  2855. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2856. (unsigned long)(0),buffer,(unsigned long)(channels),
  2857. &samplesRead,(signed long)(0));
  2858. if(error)
  2859. {
  2860. ready= false;
  2861. }
  2862. else
  2863. {
  2864. if(samplesRead)
  2865. {
  2866. QTime time= QTime::currentTime();
  2867. for(int i= 0;i<samplesRead;i++)
  2868. {
  2869. for(int j= 0;j<channels;j++)
  2870. {
  2871. double measuredValue= buffer[j+(i*channels)];
  2872. Measurement measure(measuredValue,time,
  2873. unitMap[j]);
  2874. channelMap[j]->input(measure);
  2875. }
  2876. }
  2877. }
  2878. }
  2879. }
  2880. /*:297*//*298:*/
  2881. #line 6623 "./typica.w"
  2882. void DAQImplementation::run()
  2883. {
  2884. setPriority(QThread::TimeCriticalPriority);
  2885. while(ready)
  2886. {
  2887. measure();
  2888. }
  2889. }
  2890. /*:298*//*299:*/
  2891. #line 6639 "./typica.w"
  2892. void DAQ::threadFinished()
  2893. {
  2894. if(imp->error)
  2895. {
  2896. /*300:*/
  2897. #line 6690 "./typica.w"
  2898. imp->ready= false;
  2899. QMessageBox warning;
  2900. warning.setStandardButtons(QMessageBox::Cancel);
  2901. warning.setIcon(QMessageBox::Warning);
  2902. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2903. unsigned long bytes= imp->errorInfo(NULL,0);
  2904. char string[bytes];
  2905. imp->errorInfo(string,bytes);
  2906. warning.setInformativeText(QString(string));
  2907. warning.setWindowTitle(QString(PROGRAM_NAME));
  2908. warning.exec();
  2909. /*:300*/
  2910. #line 6644 "./typica.w"
  2911. }
  2912. }
  2913. /*:299*//*301:*/
  2914. #line 6715 "./typica.w"
  2915. void DAQ::start()
  2916. {
  2917. if(imp->ready)
  2918. {
  2919. imp->error= imp->startTask(imp->handle);
  2920. if(imp->error)
  2921. {
  2922. /*300:*/
  2923. #line 6690 "./typica.w"
  2924. imp->ready= false;
  2925. QMessageBox warning;
  2926. warning.setStandardButtons(QMessageBox::Cancel);
  2927. warning.setIcon(QMessageBox::Warning);
  2928. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2929. unsigned long bytes= imp->errorInfo(NULL,0);
  2930. char string[bytes];
  2931. imp->errorInfo(string,bytes);
  2932. warning.setInformativeText(QString(string));
  2933. warning.setWindowTitle(QString(PROGRAM_NAME));
  2934. warning.exec();
  2935. /*:300*/
  2936. #line 6723 "./typica.w"
  2937. }
  2938. else
  2939. {
  2940. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2941. imp->start();
  2942. }
  2943. }
  2944. }
  2945. void DAQ::stop()
  2946. {
  2947. if(imp->useBase)
  2948. {
  2949. imp->ready= false;
  2950. imp->wait(ULONG_MAX);
  2951. imp->stopTask(imp->handle);
  2952. }
  2953. else
  2954. {
  2955. imp->ready= false;
  2956. imp->error= imp->stopTask(imp->handle);
  2957. if(imp->error)
  2958. {
  2959. /*300:*/
  2960. #line 6690 "./typica.w"
  2961. imp->ready= false;
  2962. QMessageBox warning;
  2963. warning.setStandardButtons(QMessageBox::Cancel);
  2964. warning.setIcon(QMessageBox::Warning);
  2965. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2966. unsigned long bytes= imp->errorInfo(NULL,0);
  2967. char string[bytes];
  2968. imp->errorInfo(string,bytes);
  2969. warning.setInformativeText(QString(string));
  2970. warning.setWindowTitle(QString(PROGRAM_NAME));
  2971. warning.exec();
  2972. /*:300*/
  2973. #line 6747 "./typica.w"
  2974. }
  2975. imp->error= imp->clearTask(imp->handle);
  2976. if(imp->error)
  2977. {
  2978. /*300:*/
  2979. #line 6690 "./typica.w"
  2980. imp->ready= false;
  2981. QMessageBox warning;
  2982. warning.setStandardButtons(QMessageBox::Cancel);
  2983. warning.setIcon(QMessageBox::Warning);
  2984. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2985. unsigned long bytes= imp->errorInfo(NULL,0);
  2986. char string[bytes];
  2987. imp->errorInfo(string,bytes);
  2988. warning.setInformativeText(QString(string));
  2989. warning.setWindowTitle(QString(PROGRAM_NAME));
  2990. warning.exec();
  2991. /*:300*/
  2992. #line 6752 "./typica.w"
  2993. }
  2994. }
  2995. }
  2996. /*:301*//*302:*/
  2997. #line 6762 "./typica.w"
  2998. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2999. {
  3000. imp->device= device;
  3001. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  3002. if(imp->error)
  3003. {
  3004. /*300:*/
  3005. #line 6690 "./typica.w"
  3006. imp->ready= false;
  3007. QMessageBox warning;
  3008. warning.setStandardButtons(QMessageBox::Cancel);
  3009. warning.setIcon(QMessageBox::Warning);
  3010. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3011. unsigned long bytes= imp->errorInfo(NULL,0);
  3012. char string[bytes];
  3013. imp->errorInfo(string,bytes);
  3014. warning.setInformativeText(QString(string));
  3015. warning.setWindowTitle(QString(PROGRAM_NAME));
  3016. warning.exec();
  3017. /*:300*/
  3018. #line 6769 "./typica.w"
  3019. }
  3020. else
  3021. {
  3022. imp->ready= true;
  3023. }
  3024. }
  3025. /*:302*//*303:*/
  3026. #line 6783 "./typica.w"
  3027. Channel*DAQ::newChannel(int units,int thermocouple)
  3028. {
  3029. Channel*retval= new Channel();
  3030. imp->channelMap[imp->channels]= retval;
  3031. imp->unitMap[imp->channels]= (Units::Unit)units;
  3032. imp->channels++;
  3033. if(imp->ready)
  3034. {
  3035. if(imp->useBase)
  3036. {
  3037. imp->error= imp->createChannel(imp->handle,
  3038. QString("%1/ai%2").arg(imp->device).
  3039. arg(imp->channels-1).
  3040. toAscii().data(),
  3041. "",(double)(-1.0),(double)(100.0),
  3042. (signed long)(units),
  3043. (signed long)(thermocouple),
  3044. (signed long)(10200),(double)(0),
  3045. "");
  3046. }
  3047. else
  3048. {
  3049. imp->error= imp->createChannel(imp->handle,
  3050. QString("%1/ai%2").arg(imp->device).
  3051. arg(imp->channels-1).
  3052. toAscii().data(),
  3053. "",(double)(50.0),(double)(500.0),
  3054. (signed long)(units),
  3055. (signed long)(thermocouple),
  3056. (signed long)(10200),(double)(0),
  3057. "");
  3058. }
  3059. if(imp->error)
  3060. {
  3061. /*300:*/
  3062. #line 6690 "./typica.w"
  3063. imp->ready= false;
  3064. QMessageBox warning;
  3065. warning.setStandardButtons(QMessageBox::Cancel);
  3066. warning.setIcon(QMessageBox::Warning);
  3067. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3068. unsigned long bytes= imp->errorInfo(NULL,0);
  3069. char string[bytes];
  3070. imp->errorInfo(string,bytes);
  3071. warning.setInformativeText(QString(string));
  3072. warning.setWindowTitle(QString(PROGRAM_NAME));
  3073. warning.exec();
  3074. /*:300*/
  3075. #line 6818 "./typica.w"
  3076. }
  3077. }
  3078. return retval;
  3079. }
  3080. /*:303*//*304:*/
  3081. #line 6832 "./typica.w"
  3082. void DAQ::setClockRate(double Hz)
  3083. {
  3084. if(imp->ready)
  3085. {
  3086. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  3087. (signed long)(10280),(signed long)(10123),
  3088. (unsigned long long)(1));
  3089. if(imp->error)
  3090. {
  3091. /*300:*/
  3092. #line 6690 "./typica.w"
  3093. imp->ready= false;
  3094. QMessageBox warning;
  3095. warning.setStandardButtons(QMessageBox::Cancel);
  3096. warning.setIcon(QMessageBox::Warning);
  3097. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3098. unsigned long bytes= imp->errorInfo(NULL,0);
  3099. char string[bytes];
  3100. imp->errorInfo(string,bytes);
  3101. warning.setInformativeText(QString(string));
  3102. warning.setWindowTitle(QString(PROGRAM_NAME));
  3103. warning.exec();
  3104. /*:300*/
  3105. #line 6842 "./typica.w"
  3106. }
  3107. }
  3108. }
  3109. /*:304*//*305:*/
  3110. #line 6852 "./typica.w"
  3111. DAQ::~DAQ()
  3112. {
  3113. if(imp->useBase)
  3114. {
  3115. imp->resetDevice(imp->device.toAscii().data());
  3116. imp->clearTask(imp->handle);
  3117. }
  3118. else
  3119. {
  3120. if(imp->ready)
  3121. {
  3122. imp->ready= false;
  3123. imp->wait(ULONG_MAX);
  3124. imp->stopTask(imp->handle);
  3125. imp->resetDevice(imp->device.toAscii().data());
  3126. imp->clearTask(imp->handle);
  3127. }
  3128. }
  3129. delete imp;
  3130. }
  3131. /*:305*//*306:*/
  3132. #line 6883 "./typica.w"
  3133. DAQImplementation::DAQImplementation(const QString&driverinfo)
  3134. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  3135. unitMap(4)
  3136. {
  3137. if(driverinfo=="nidaqmxbase")
  3138. {
  3139. useBase= true;
  3140. }
  3141. else
  3142. {
  3143. useBase= false;
  3144. }
  3145. if(useBase)
  3146. {
  3147. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  3148. if(!driver.load())
  3149. {
  3150. driver.setFileName("nidaqmxbase");
  3151. if(!driver.load())
  3152. {
  3153. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3154. tr("Failed to find nidaqmxbase. Please install it."));
  3155. QApplication::quit();
  3156. }
  3157. }
  3158. }
  3159. else
  3160. {
  3161. driver.setFileName("nicaiu");
  3162. if(!driver.load())
  3163. {
  3164. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3165. tr("Failed to find nidaqmx. Please install it."));
  3166. QApplication::quit();
  3167. }
  3168. }
  3169. if(useBase)
  3170. {
  3171. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  3172. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  3173. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  3174. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  3175. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  3176. ==0||
  3177. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  3178. 0||
  3179. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  3180. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  3181. 0||
  3182. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  3183. {
  3184. waitForMeasurement= NULL;
  3185. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3186. tr("Failed to link a required symbol in NI-DAQmxBase."));
  3187. QApplication::quit();
  3188. }
  3189. }
  3190. else
  3191. {
  3192. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  3193. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  3194. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  3195. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  3196. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  3197. ==0||
  3198. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  3199. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  3200. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  3201. 0||
  3202. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  3203. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  3204. {
  3205. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3206. tr("Failed to link a required symbol in NI-DAQmx."));
  3207. QApplication::quit();
  3208. }
  3209. }
  3210. }
  3211. DAQImplementation::~DAQImplementation()
  3212. {
  3213. driver.unload();
  3214. }
  3215. /*:306*/
  3216. #line 540 "./typica.w"
  3217. /*956:*/
  3218. #line 197 "./dataqsdk.w"
  3219. void DataqSdkDeviceImplementation::measure()
  3220. {
  3221. unsigned count= channels*40;
  3222. di_status_read(buffer,count);
  3223. QTime time= QTime::currentTime();
  3224. for(unsigned int i= 0;i<count;i++)
  3225. {
  3226. buffer[i]= buffer[i]&0xFFFC;
  3227. }
  3228. QList<int> countList;
  3229. for(unsigned int i= 0;i<(unsigned)channels;i++)
  3230. {
  3231. QList<double> channelBuffer;
  3232. for(unsigned int j= 0;j<40;j++)
  3233. {
  3234. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  3235. if(i==0)
  3236. {
  3237. countList<<buffer[i+(channels*j)];
  3238. }
  3239. }
  3240. double value= 0.0;
  3241. for(unsigned int j= 0;j<40;j++)
  3242. {
  3243. value+= channelBuffer[j];
  3244. }
  3245. value/= 40.0;
  3246. if(i==0)
  3247. {
  3248. QList<double> smoothingList;
  3249. smoothingList<<value;
  3250. QList<int> smoothingKeys= smoother.uniqueKeys();
  3251. for(int j= 0;j<smoothingKeys.size();j++)
  3252. {
  3253. if(countList.contains(smoothingKeys[j]))
  3254. {
  3255. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  3256. for(int k= 0;k<keyValues.size();k++)
  3257. {
  3258. smoothingList<<keyValues[k];
  3259. }
  3260. }
  3261. else
  3262. {
  3263. smoother.remove(smoothingKeys[j]);
  3264. }
  3265. }
  3266. qSort(countList);
  3267. int lastCount= 0;
  3268. for(int j= 0;j<countList.size();j++)
  3269. {
  3270. if(j==0||countList[j]!=lastCount)
  3271. {
  3272. smoother.insert(countList[j],value);
  3273. lastCount= countList[j];
  3274. }
  3275. }
  3276. value= 0.0;
  3277. for(int j= 0;j<smoothingList.size();j++)
  3278. {
  3279. value+= smoothingList[j];
  3280. }
  3281. value/= smoothingList.size();
  3282. }
  3283. Measurement measure(value,time,unitMap[i]);
  3284. channelMap[i]->input(measure);
  3285. }
  3286. }
  3287. /*:956*//*957:*/
  3288. #line 290 "./dataqsdk.w"
  3289. void DataqSdkDeviceImplementation::run()
  3290. {
  3291. if(!ready)
  3292. {
  3293. error= 9;
  3294. return;
  3295. }
  3296. driver= new QLibrary(device);
  3297. if(!driver->load())
  3298. {
  3299. error= 1;
  3300. qDebug()<<"Failed to load driver: "<<device;
  3301. return;
  3302. }
  3303. di_open= (FPDIOPEN)driver->resolve("di_open");
  3304. di_close= (FPDICLOSE)driver->resolve("di_close");
  3305. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3306. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3307. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3308. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3309. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3310. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3311. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3312. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3313. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3314. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3315. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3316. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3317. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3318. (!di_burst_rate)||(!di_stop_scan))
  3319. {
  3320. error= 2;
  3321. return;
  3322. }
  3323. error= di_open(deviceNumber);
  3324. if(error)
  3325. {
  3326. di_close();
  3327. error= di_open(deviceNumber);
  3328. if(error)
  3329. {
  3330. error= 3;
  3331. di_close();
  3332. return;
  3333. }
  3334. }
  3335. isOpen= true;
  3336. di_maximum_rate(240.0);
  3337. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3338. &burstDivisor);
  3339. buffer= new qint16[(int)sampleRate];
  3340. di_inlist_struct inlist[16]= {{0,0,0,0,0,0,0,0}};
  3341. for(unsigned short i= 0;i<channels;i++)
  3342. {
  3343. inlist[i].chan= i;
  3344. inlist[i].gain= 0;
  3345. inlist[i].ave= 1;
  3346. inlist[i].counter= (oversample-1);
  3347. }
  3348. error= di_list_length(channels,0);
  3349. if(error)
  3350. {
  3351. error= 4;
  3352. return;
  3353. }
  3354. error= di_inlist(inlist);
  3355. if(error)
  3356. {
  3357. error= 5;
  3358. return;
  3359. }
  3360. input_buffer= di_buffer_alloc(0,4096);
  3361. if(input_buffer==NULL)
  3362. {
  3363. error= 6;
  3364. return;
  3365. }
  3366. error= di_start_scan();
  3367. if(error)
  3368. {
  3369. error= 7;
  3370. return;
  3371. }
  3372. while(ready)
  3373. {
  3374. measure();
  3375. }
  3376. }
  3377. /*:957*//*958:*/
  3378. #line 386 "./dataqsdk.w"
  3379. void DataqSdkDevice::threadFinished()
  3380. {
  3381. if(imp->error)
  3382. {
  3383. /*959:*/
  3384. #line 400 "./dataqsdk.w"
  3385. imp->ready= false;
  3386. QMessageBox warning;
  3387. warning.setStandardButtons(QMessageBox::Cancel);
  3388. warning.setIcon(QMessageBox::Warning);
  3389. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3390. warning.setInformativeText(tr("An error occurred"));
  3391. warning.setWindowTitle(QString(PROGRAM_NAME));
  3392. warning.exec();
  3393. /*:959*/
  3394. #line 391 "./dataqsdk.w"
  3395. }
  3396. }
  3397. /*:958*//*960:*/
  3398. #line 417 "./dataqsdk.w"
  3399. void DataqSdkDevice::start()
  3400. {
  3401. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3402. imp->start();
  3403. }
  3404. /*:960*//*961:*/
  3405. #line 428 "./dataqsdk.w"
  3406. QStringList DataqSdkDevice::detectHardware()
  3407. {
  3408. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3409. QSettings::NativeFormat);
  3410. QStringList keys= deviceLookup.childKeys();
  3411. QStringList devices;
  3412. for(int i= 0;i<keys.size();i++)
  3413. {
  3414. QString value= deviceLookup.value(keys.at(i)).toString();
  3415. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3416. {
  3417. devices.append(value.split("\\").at(2));
  3418. }
  3419. }
  3420. QStringList portList;
  3421. foreach(QString device,devices)
  3422. {
  3423. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3424. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3425. portList.append(deviceEntry.value("FriendlyName").toString());
  3426. }
  3427. return portList;
  3428. }
  3429. QStringList DataqSdkDevice::detectPorts()
  3430. {
  3431. QStringList friendlyNames= detectHardware();
  3432. QStringList portList;
  3433. foreach(QString name,friendlyNames)
  3434. {
  3435. name.remove(0,name.indexOf("COM"));
  3436. name.chop(1);
  3437. portList.append(name);
  3438. }
  3439. return portList;
  3440. }
  3441. /*:961*//*962:*/
  3442. #line 473 "./dataqsdk.w"
  3443. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3444. {
  3445. bool usesAuto= false;
  3446. int autoIndex= device.toInt(&usesAuto);
  3447. QString finalizedPort;
  3448. if(usesAuto)
  3449. {
  3450. QStringList portList= detectPorts();
  3451. if(autoIndex> 0&&autoIndex<=portList.size())
  3452. {
  3453. finalizedPort= portList.at(autoIndex-1);
  3454. }
  3455. else
  3456. {
  3457. imp->error= 8;
  3458. qDebug()<<"Failed to detect port.";
  3459. }
  3460. }
  3461. else
  3462. {
  3463. finalizedPort= device;
  3464. }
  3465. int rstart= finalizedPort.indexOf("COM");
  3466. finalizedPort.remove(0,rstart+3);
  3467. bool chopFinished= false;
  3468. int finalizedPortNumber= 0;
  3469. while(finalizedPort.size()> 0&&!chopFinished)
  3470. {
  3471. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  3472. if(!chopFinished)
  3473. {
  3474. finalizedPort.chop(1);
  3475. }
  3476. }
  3477. if(finalizedPortNumber<10)
  3478. {
  3479. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  3480. }
  3481. else
  3482. {
  3483. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  3484. }
  3485. imp->deviceNumber= 0x12C02D00;
  3486. imp->deviceNumber+= finalizedPortNumber;
  3487. imp->ready= true;
  3488. }
  3489. /*:962*//*963:*/
  3490. #line 523 "./dataqsdk.w"
  3491. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  3492. {
  3493. Channel*retval= NULL;
  3494. if(imp->ready)
  3495. {
  3496. retval= new Channel();
  3497. imp->channelMap[imp->channels]= retval;
  3498. imp->unitMap[imp->channels]= scale;
  3499. imp->channels++;
  3500. }
  3501. return retval;
  3502. }
  3503. /*:963*//*964:*/
  3504. #line 547 "./dataqsdk.w"
  3505. void DataqSdkDevice::setClockRate(double Hz)
  3506. {
  3507. imp->sampleRate= Hz;
  3508. }
  3509. /*:964*//*965:*/
  3510. #line 557 "./dataqsdk.w"
  3511. DataqSdkDevice::~DataqSdkDevice()
  3512. {
  3513. if(imp->ready)
  3514. {
  3515. imp->ready= false;
  3516. }
  3517. imp->wait(ULONG_MAX);
  3518. delete imp;
  3519. }
  3520. /*:965*//*966:*/
  3521. #line 575 "./dataqsdk.w"
  3522. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  3523. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  3524. {
  3525. }
  3526. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  3527. {
  3528. if(isOpen)
  3529. {
  3530. di_stop_scan();
  3531. di_close();
  3532. }
  3533. if(driver->isLoaded())
  3534. {
  3535. driver->unload();
  3536. }
  3537. }
  3538. /*:966*/
  3539. #line 541 "./typica.w"
  3540. /*313:*/
  3541. #line 7092 "./typica.w"
  3542. void FakeDAQImplementation::measure()
  3543. {
  3544. msleep((int)(1000/clockRate));
  3545. QTime time= QTime::currentTime();
  3546. for(int i= 0;i<channels;i++)
  3547. {
  3548. Measurement measure(qrand()%500,time);
  3549. channelMap[i]->input(measure);
  3550. }
  3551. }
  3552. /*:313*//*314:*/
  3553. #line 7106 "./typica.w"
  3554. void FakeDAQImplementation::run()
  3555. {
  3556. setPriority(QThread::TimeCriticalPriority);
  3557. while(ready)
  3558. {
  3559. measure();
  3560. }
  3561. }
  3562. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  3563. channels(0),ready(false),clockRate(1)
  3564. {
  3565. }
  3566. FakeDAQImplementation::~FakeDAQImplementation()
  3567. {
  3568. }
  3569. /*:314*//*315:*/
  3570. #line 7131 "./typica.w"
  3571. void FakeDAQ::start()
  3572. {
  3573. if(imp->ready)
  3574. {
  3575. imp->start();
  3576. }
  3577. }
  3578. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  3579. {
  3580. imp->ready= true;
  3581. }
  3582. Channel*FakeDAQ::newChannel(int,int)
  3583. {
  3584. Channel*retval;
  3585. if(imp->ready)
  3586. {
  3587. retval= new Channel();
  3588. imp->channelMap[imp->channels]= retval;
  3589. imp->channels++;
  3590. }
  3591. else
  3592. {
  3593. return NULL;
  3594. }
  3595. return retval;
  3596. }
  3597. void FakeDAQ::setClockRate(double Hz)
  3598. {
  3599. if(imp->ready)
  3600. {
  3601. imp->clockRate= Hz;
  3602. }
  3603. }
  3604. FakeDAQ::~FakeDAQ()
  3605. {
  3606. imp->ready= false;
  3607. imp->wait(ULONG_MAX);
  3608. delete imp;
  3609. }
  3610. /*:315*/
  3611. #line 542 "./typica.w"
  3612. /*320:*/
  3613. #line 7262 "./typica.w"
  3614. Channel::Channel():QObject(NULL)
  3615. {
  3616. }
  3617. Channel::~Channel()
  3618. {
  3619. }
  3620. void Channel::input(Measurement measurement)
  3621. {
  3622. emit newData(measurement);
  3623. }
  3624. /*:320*/
  3625. #line 543 "./typica.w"
  3626. /*336:*/
  3627. #line 7667 "./typica.w"
  3628. void TemperatureDisplay::setRelativeMode(bool relative)
  3629. {
  3630. r= relative;
  3631. }
  3632. /*:336*//*337:*/
  3633. #line 7684 "./typica.w"
  3634. void TemperatureDisplay::setValue(Measurement temperature)
  3635. {
  3636. QString number;
  3637. switch(unit)
  3638. {
  3639. case Units::Fahrenheit:
  3640. display(QString("%1'F").
  3641. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  3642. 2)));
  3643. break;
  3644. case Units::Celsius:
  3645. if(!r){
  3646. display(QString("%1'C").
  3647. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  3648. 2)));
  3649. }else{
  3650. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3651. display(QString("%1'C").arg(number));
  3652. }
  3653. break;
  3654. case Units::Kelvin:
  3655. if(!r){
  3656. display(QString("%1").
  3657. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  3658. 2)));
  3659. }else{
  3660. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3661. display(QString("%1").arg(number));
  3662. }
  3663. break;
  3664. case Units::Rankine:
  3665. display(QString("%1'r").
  3666. arg(number.setNum(temperature.toRankine().temperature(),'f',
  3667. 2)));
  3668. break;
  3669. case Units::Unitless:
  3670. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3671. break;
  3672. default:
  3673. switch(temperature.scale())
  3674. {
  3675. case Units::Fahrenheit:
  3676. display(QString("%1'F").
  3677. arg(number.setNum(temperature.temperature(),'f',2)));
  3678. break;
  3679. case Units::Celsius:
  3680. display(QString("%1'C").
  3681. arg(number.setNum(temperature.temperature(),'f',2)));
  3682. break;
  3683. case Units::Kelvin:
  3684. display(QString("%1").
  3685. arg(number.setNum(temperature.temperature(),'f',2)));
  3686. break;
  3687. case Units::Rankine:
  3688. display(QString("%1'r").
  3689. arg(number.setNum(temperature.temperature(),'f',2)));
  3690. break;
  3691. case Units::Unitless:
  3692. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3693. break;
  3694. default:
  3695. qDebug()<<"Warning: Attempting to convert a non-temperature unit to a temperature unit";
  3696. break;
  3697. }
  3698. break;
  3699. }
  3700. }
  3701. /*:337*//*338:*/
  3702. #line 7763 "./typica.w"
  3703. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  3704. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  3705. {
  3706. setSegmentStyle(Filled);
  3707. display("---.--'F");
  3708. }
  3709. /*:338*//*339:*/
  3710. #line 7779 "./typica.w"
  3711. void TemperatureDisplay::invalidate()
  3712. {
  3713. display("---.--'F");
  3714. }
  3715. /*:339*//*340:*/
  3716. #line 7791 "./typica.w"
  3717. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  3718. {
  3719. unit= scale;
  3720. }
  3721. /*:340*//*341:*/
  3722. #line 7799 "./typica.w"
  3723. TemperatureDisplay::~TemperatureDisplay()
  3724. {
  3725. }
  3726. /*:341*/
  3727. #line 544 "./typica.w"
  3728. /*347:*/
  3729. #line 7899 "./typica.w"
  3730. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  3731. {
  3732. if(measure.time()<epoch)
  3733. {
  3734. if(hasPrevious)
  3735. {
  3736. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  3737. epoch.msec());
  3738. QTime jitComp(epoch.hour(),measure.time().minute(),
  3739. measure.time().second(),measure.time().msec());
  3740. int relTime= jitBase.msecsTo(jitComp);
  3741. /*348:*/
  3742. #line 7933 "./typica.w"
  3743. QTime newTime(0,0,0,0);
  3744. newTime= newTime.addMSecs(relTime);
  3745. if(newTime.hour()> 0)
  3746. {
  3747. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3748. }
  3749. Measurement rel= measure;
  3750. rel.setTime(newTime);
  3751. emit measurement(rel);
  3752. /*:348*/
  3753. #line 7911 "./typica.w"
  3754. }
  3755. else
  3756. {
  3757. Measurement rel= measure;
  3758. rel.setTime(QTime(0,0,0,0));
  3759. emit measurement(rel);
  3760. }
  3761. }
  3762. else
  3763. {
  3764. int relTime= epoch.msecsTo(measure.time());
  3765. /*348:*/
  3766. #line 7933 "./typica.w"
  3767. QTime newTime(0,0,0,0);
  3768. newTime= newTime.addMSecs(relTime);
  3769. if(newTime.hour()> 0)
  3770. {
  3771. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3772. }
  3773. Measurement rel= measure;
  3774. rel.setTime(newTime);
  3775. emit measurement(rel);
  3776. /*:348*/
  3777. #line 7923 "./typica.w"
  3778. }
  3779. hasPrevious= true;
  3780. previous= measure.time();
  3781. }
  3782. /*:347*//*349:*/
  3783. #line 7946 "./typica.w"
  3784. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  3785. previous(0,0,0,0),hasPrevious(false)
  3786. {
  3787. }
  3788. QTime MeasurementTimeOffset::zeroTime()
  3789. {
  3790. return epoch;
  3791. }
  3792. void MeasurementTimeOffset::setZeroTime(QTime zero)
  3793. {
  3794. epoch= zero;
  3795. hasPrevious= false;
  3796. }
  3797. /*:349*/
  3798. #line 545 "./typica.w"
  3799. /*359:*/
  3800. #line 8144 "./typica.w"
  3801. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  3802. {
  3803. }
  3804. int ZeroEmitter::column()
  3805. {
  3806. return col;
  3807. }
  3808. double ZeroEmitter::lastTemperature()
  3809. {
  3810. return cache.temperature();
  3811. }
  3812. void ZeroEmitter::newMeasurement(Measurement measure)
  3813. {
  3814. cache= measure;
  3815. }
  3816. void ZeroEmitter::setColumn(int column)
  3817. {
  3818. col= column;
  3819. }
  3820. void ZeroEmitter::emitZero()
  3821. {
  3822. cache.setTime(QTime(0,0,0,0));
  3823. emit measurement(cache,col);
  3824. }
  3825. /*:359*/
  3826. #line 546 "./typica.w"
  3827. /*364:*/
  3828. #line 8234 "./typica.w"
  3829. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  3830. {
  3831. }
  3832. int MeasurementAdapter::column()
  3833. {
  3834. return col;
  3835. }
  3836. void MeasurementAdapter::newMeasurement(Measurement measure)
  3837. {
  3838. emit measurement(measure,col);
  3839. }
  3840. void MeasurementAdapter::setColumn(int column)
  3841. {
  3842. col= column;
  3843. }
  3844. /*:364*/
  3845. #line 547 "./typica.w"
  3846. /*369:*/
  3847. #line 8356 "./typica.w"
  3848. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  3849. theScene(new QGraphicsScene),
  3850. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  3851. prevPoints(new QMap<int,QPointF> ),
  3852. translations(new QMap<int,double> ),
  3853. gridLinesF(new QList<QGraphicsItem*> ),
  3854. gridLinesC(new QList<QGraphicsItem*> ),
  3855. relativeGridLines(new QList<QGraphicsItem*> ),
  3856. relativeEnabled(false),
  3857. timeIndicatorEnabled(false),
  3858. timeLine(new QGraphicsLineItem),
  3859. relativeAdjuster(new LinearSplineInterpolator)
  3860. {
  3861. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3862. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3863. setScene(theScene);
  3864. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  3865. QPen timePen;
  3866. timePen.setColor(QColor(160,160,164,127));
  3867. timeLine->setPen(timePen);
  3868. timeLine->setLine(0,0,0,-500);
  3869. timeLine->hide();
  3870. theScene->addItem(timeLine);
  3871. /*370:*/
  3872. #line 8396 "./typica.w"
  3873. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  3874. tempaxis->setLine(-10,-500,-10,0);
  3875. theScene->addItem(tempaxis);
  3876. QGraphicsLineItem*gridLine;
  3877. QGraphicsTextItem*label;
  3878. for(int y= -100;y> -600;y-= 100)
  3879. {
  3880. gridLine= new QGraphicsLineItem;
  3881. gridLine->setLine(0,y,1200,y);
  3882. theScene->addItem(gridLine);
  3883. label= new QGraphicsTextItem;
  3884. label->setHtml(QString("%1&deg;F").arg(-y));
  3885. label->setPos(-55,y-(label->boundingRect().height()/2));
  3886. theScene->addItem(label);
  3887. gridLinesF->append(gridLine);
  3888. gridLinesF->append(label);
  3889. }
  3890. for(int degC= 50;degC<=250;degC+= 50)
  3891. {
  3892. gridLine= new QGraphicsLineItem;
  3893. int y= -(degC*(9.0/5.0)+32);
  3894. gridLine->setLine(0,y,1200,y);
  3895. gridLine->hide();
  3896. theScene->addItem(gridLine);
  3897. gridLinesC->append(gridLine);
  3898. label= new QGraphicsTextItem;
  3899. label->setHtml(QString("%1&deg;C").arg(degC));
  3900. label->setPos(-55,y-(label->boundingRect().height()/2));
  3901. label->hide();
  3902. theScene->addItem(label);
  3903. gridLinesC->append(label);
  3904. }
  3905. /*:370*/
  3906. #line 8380 "./typica.w"
  3907. ;
  3908. /*371:*/
  3909. #line 8437 "./typica.w"
  3910. QSettings settings;
  3911. if(settings.contains("settings/graph/relative/enable"))
  3912. {
  3913. if(settings.value("settings/graph/relative/enable").toBool())
  3914. {
  3915. relativeEnabled= true;
  3916. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  3917. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  3918. QMap<double,QString> relativeAxisPairs;
  3919. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  3920. foreach(QString item,relativeAxisLabels)
  3921. {
  3922. relativeAxisPairs.insert(item.toDouble(),item);
  3923. }
  3924. if(relativeAxisPairs.size()> 1)
  3925. {
  3926. double skip= 500.0/(relativeAxisPairs.size()-1);
  3927. double y= 0;
  3928. foreach(double key,relativeAxisPairs.keys())
  3929. {
  3930. gridLine= new QGraphicsLineItem;
  3931. gridLine->setLine(0,y,1205,y);
  3932. gridLine->setPen(QPen(relativeColor));
  3933. theScene->addItem(gridLine);
  3934. relativeGridLines->append(gridLine);
  3935. label= new QGraphicsTextItem;
  3936. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  3937. label->setPos(1210,y-(label->boundingRect().height()/2));
  3938. theScene->addItem(label);
  3939. relativeGridLines->append(label);
  3940. if(unit=="F")
  3941. {
  3942. relativeAdjuster->add_pair(key,-y);
  3943. }
  3944. else
  3945. {
  3946. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  3947. }
  3948. y-= skip;
  3949. }
  3950. }
  3951. }
  3952. }
  3953. /*:371*/
  3954. #line 8381 "./typica.w"
  3955. /*373:*/
  3956. #line 8514 "./typica.w"
  3957. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  3958. timeaxis->setLine(0,10,1200,10);
  3959. theScene->addItem(timeaxis);
  3960. for(int x= 0;x<1201;x+= 120)
  3961. {
  3962. QGraphicsLineItem*tick= new QGraphicsLineItem;
  3963. tick->setLine(x,0,x,20);
  3964. theScene->addItem(tick);
  3965. QGraphicsTextItem*label= new QGraphicsTextItem;
  3966. label->setPlainText(QString("%1").arg(x/60));
  3967. label->setPos(x-(label->boundingRect().width()/2),20);
  3968. theScene->addItem(label);
  3969. }
  3970. /*:373*/
  3971. #line 8382 "./typica.w"
  3972. ;
  3973. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3974. }
  3975. /*:369*//*372:*/
  3976. #line 8484 "./typica.w"
  3977. void GraphView::showF()
  3978. {
  3979. for(int i= 0;i<gridLinesF->size();i++)
  3980. {
  3981. gridLinesF->at(i)->show();
  3982. }
  3983. for(int i= 0;i<gridLinesC->size();i++)
  3984. {
  3985. gridLinesC->at(i)->hide();
  3986. }
  3987. }
  3988. void GraphView::showC()
  3989. {
  3990. for(int i= 0;i<gridLinesF->size();i++)
  3991. {
  3992. gridLinesF->at(i)->hide();
  3993. }
  3994. for(int i= 0;i<gridLinesC->size();i++)
  3995. {
  3996. gridLinesC->at(i)->show();
  3997. }
  3998. }
  3999. /*:372*//*374:*/
  4000. #line 8533 "./typica.w"
  4001. void GraphView::resizeEvent(QResizeEvent*)
  4002. {
  4003. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  4004. }
  4005. /*:374*//*375:*/
  4006. #line 8547 "./typica.w"
  4007. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  4008. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  4009. {
  4010. double offset= 0;
  4011. if(measure.contains("relative"))
  4012. {
  4013. if(measure.value("relative").toBool())
  4014. {
  4015. if(relativeEnabled)
  4016. {
  4017. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  4018. }
  4019. else
  4020. {
  4021. return;
  4022. }
  4023. }
  4024. }
  4025. if(translations->contains(tempcolumn))
  4026. {
  4027. offset= translations->value(tempcolumn);
  4028. }
  4029. if(prevPoints->contains(tempcolumn))
  4030. {
  4031. /*377:*/
  4032. #line 8624 "./typica.w"
  4033. QGraphicsLineItem*segment= new QGraphicsLineItem;
  4034. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  4035. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  4036. -(prevPoints->value(tempcolumn).y()),
  4037. nextPoint.x()+offset,-(nextPoint.y()));
  4038. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  4039. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  4040. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  4041. Qt::darkYellow};
  4042. segment->setPen(p[tempcolumn%12]);
  4043. theScene->addItem(segment);
  4044. prevPoints->insert(tempcolumn,nextPoint);
  4045. if(timeIndicatorEnabled)
  4046. {
  4047. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  4048. }
  4049. /*:377*/
  4050. #line 8573 "./typica.w"
  4051. if(graphLines->contains(tempcolumn))
  4052. {
  4053. graphLines->value(tempcolumn)->append(segment);
  4054. }
  4055. else
  4056. {
  4057. QList<QGraphicsLineItem*> *newLine=
  4058. new QList<QGraphicsLineItem*> ;
  4059. newLine->append(segment);
  4060. graphLines->insert(tempcolumn,newLine);
  4061. }
  4062. }
  4063. else
  4064. {
  4065. /*376:*/
  4066. #line 8609 "./typica.w"
  4067. int x= FULLTIMETOINT(measure.time())/1000;
  4068. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  4069. if(timeIndicatorEnabled)
  4070. {
  4071. timeLine->setLine(x,0,x,-500);
  4072. }
  4073. /*:376*/
  4074. #line 8590 "./typica.w"
  4075. }
  4076. }
  4077. /*:375*//*378:*/
  4078. #line 8645 "./typica.w"
  4079. void GraphView::clear()
  4080. {
  4081. int i;
  4082. foreach(i,prevPoints->keys())
  4083. {
  4084. removeSeries(i);
  4085. }
  4086. translations->clear();
  4087. }
  4088. /*:378*//*379:*/
  4089. #line 8659 "./typica.w"
  4090. void GraphView::removeSeries(int column)
  4091. {
  4092. if(graphLines->contains(column))
  4093. {
  4094. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4095. QGraphicsLineItem*segment;
  4096. foreach(segment,*series)
  4097. {
  4098. theScene->removeItem(segment);
  4099. }
  4100. qDeleteAll(*series);
  4101. }
  4102. graphLines->remove(column);
  4103. prevPoints->remove(column);
  4104. }
  4105. /*:379*//*380:*/
  4106. #line 8678 "./typica.w"
  4107. void GraphView::setSeriesTranslation(int column,double offset)
  4108. {
  4109. if(graphLines->contains(column))
  4110. {
  4111. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4112. QGraphicsLineItem*segment;
  4113. foreach(segment,*series)
  4114. {
  4115. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  4116. }
  4117. }
  4118. if(translations->contains(column))
  4119. {
  4120. translations->insert(column,offset+translations->value(column));
  4121. }
  4122. else
  4123. {
  4124. translations->insert(column,offset);
  4125. }
  4126. }
  4127. /*:380*//*381:*/
  4128. #line 8705 "./typica.w"
  4129. void GraphView::setTimeIndicatorEnabled(bool enabled)
  4130. {
  4131. timeIndicatorEnabled= enabled;
  4132. if(enabled)
  4133. {
  4134. timeLine->show();
  4135. }
  4136. else
  4137. {
  4138. timeLine->hide();
  4139. }
  4140. }
  4141. /*:381*/
  4142. #line 548 "./typica.w"
  4143. /*387:*/
  4144. #line 8849 "./typica.w"
  4145. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  4146. {
  4147. if(measure.time()!=QTime(0,0,0,0))
  4148. {
  4149. /*389:*/
  4150. #line 8923 "./typica.w"
  4151. if(lastMeasurement.contains(tempcolumn))
  4152. {
  4153. if(lastMeasurement[tempcolumn].time()<measure.time())
  4154. {
  4155. QList<QTime> timelist;
  4156. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  4157. {
  4158. timelist.append(i);
  4159. }
  4160. for(int i= 0;i<timelist.size();i++)
  4161. {
  4162. Measurement synthesized= measure;
  4163. synthesized.setTime(timelist[i]);
  4164. newMeasurement(synthesized,tempcolumn);
  4165. }
  4166. }
  4167. }
  4168. /*:389*/
  4169. #line 8854 "./typica.w"
  4170. }
  4171. model_ms->newMeasurement(measure,tempcolumn);
  4172. if(lastMeasurement.contains(tempcolumn))
  4173. {
  4174. if(measure.time().second()!=
  4175. lastMeasurement.value(tempcolumn).time().second())
  4176. {
  4177. Measurement adjusted= measure;
  4178. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  4179. adjusted.setTime(adjtime);
  4180. model_1s->newMeasurement(adjusted,tempcolumn);
  4181. if(adjusted.time().second()%5==0)
  4182. {
  4183. model_5s->newMeasurement(adjusted,tempcolumn);
  4184. if(adjusted.time().second()%10==0)
  4185. {
  4186. model_10s->newMeasurement(adjusted,tempcolumn);
  4187. }
  4188. if(adjusted.time().second()%15==0)
  4189. {
  4190. model_15s->newMeasurement(adjusted,tempcolumn);
  4191. if(adjusted.time().second()%30==0)
  4192. {
  4193. model_30s->newMeasurement(adjusted,tempcolumn);
  4194. if(adjusted.time().second()==0)
  4195. {
  4196. model_1m->newMeasurement(adjusted,tempcolumn);
  4197. }
  4198. }
  4199. }
  4200. }
  4201. }
  4202. /*391:*/
  4203. #line 8967 "./typica.w"
  4204. if(currentColumnSet.contains(tempcolumn))
  4205. {
  4206. int replicationcolumn;
  4207. foreach(replicationcolumn,currentColumnSet)
  4208. {
  4209. if(replicationcolumn!=tempcolumn)
  4210. {
  4211. if(lastMeasurement.contains(replicationcolumn))
  4212. {
  4213. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  4214. {
  4215. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  4216. synthetic.setTime(measure.time());
  4217. model_ms->newMeasurement(synthetic,replicationcolumn);
  4218. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  4219. {
  4220. Measurement adjusted= synthetic;
  4221. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  4222. model_1s->newMeasurement(adjusted,replicationcolumn);
  4223. if(adjusted.time().second()%5==0)
  4224. {
  4225. model_5s->newMeasurement(adjusted,replicationcolumn);
  4226. if(adjusted.time().second()%10==0)
  4227. {
  4228. model_10s->newMeasurement(adjusted,replicationcolumn);
  4229. }
  4230. if(adjusted.time().second()%15==0)
  4231. {
  4232. model_15s->newMeasurement(adjusted,replicationcolumn);
  4233. if(adjusted.time().second()%30==0)
  4234. {
  4235. model_30s->newMeasurement(adjusted,replicationcolumn);
  4236. if(adjusted.time().second()==0)
  4237. {
  4238. model_1m->newMeasurement(adjusted,replicationcolumn);
  4239. }
  4240. }
  4241. }
  4242. }
  4243. }
  4244. lastMeasurement[replicationcolumn]= synthetic;
  4245. }
  4246. }
  4247. }
  4248. }
  4249. }
  4250. /*:391*/
  4251. #line 8887 "./typica.w"
  4252. }
  4253. else
  4254. {
  4255. /*388:*/
  4256. #line 8899 "./typica.w"
  4257. MeasurementModel*m;
  4258. foreach(m,modelSet)
  4259. {
  4260. m->newMeasurement(measure,tempcolumn);
  4261. }
  4262. /*:388*/
  4263. #line 8891 "./typica.w"
  4264. }
  4265. lastMeasurement.insert(tempcolumn,measure);
  4266. }
  4267. /*:387*//*390:*/
  4268. #line 8953 "./typica.w"
  4269. void ZoomLog::addToCurrentColumnSet(int column)
  4270. {
  4271. currentColumnSet.append(column);
  4272. }
  4273. void ZoomLog::clearCurrentColumnSet()
  4274. {
  4275. currentColumnSet.clear();
  4276. }
  4277. /*:390*//*392:*/
  4278. #line 9037 "./typica.w"
  4279. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  4280. int annotationcolumn)
  4281. {
  4282. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4283. MeasurementModel*m;
  4284. if(lastMeasurement.contains(tempcolumn))
  4285. {
  4286. foreach(m,modelSet)
  4287. {
  4288. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  4289. }
  4290. }
  4291. foreach(m,modelSet)
  4292. {
  4293. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4294. }
  4295. }
  4296. /*:392*//*393:*/
  4297. #line 9061 "./typica.w"
  4298. void ZoomLog::centerOn(int row)
  4299. {
  4300. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  4301. }
  4302. /*:393*//*394:*/
  4303. #line 9071 "./typica.w"
  4304. void ZoomLog::clear()
  4305. {
  4306. MeasurementModel*m;
  4307. foreach(m,modelSet)
  4308. {
  4309. m->clear();
  4310. }
  4311. lastMeasurement.clear();
  4312. saveTempCols.clear();
  4313. saveControlCols.clear();
  4314. saveNoteCols.clear();
  4315. }
  4316. /*:394*//*395:*/
  4317. #line 9089 "./typica.w"
  4318. QVariant ZoomLog::data(int row,int column)const
  4319. {
  4320. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4321. Qt::DisplayRole);
  4322. }
  4323. int ZoomLog::rowCount()
  4324. {
  4325. return model_ms->rowCount();
  4326. }
  4327. /*:395*//*396:*/
  4328. #line 9112 "./typica.w"
  4329. bool ZoomLog::saveXML(QIODevice*device)
  4330. {
  4331. Units::Unit prevUnits= model_ms->displayUnits();
  4332. if(prevUnits!=Units::Fahrenheit)
  4333. {
  4334. model_ms->setDisplayUnits(Units::Fahrenheit);
  4335. }
  4336. XMLOutput writer(model_ms,device,0);
  4337. int c;
  4338. foreach(c,saveTempCols)
  4339. {
  4340. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4341. toString(),c);
  4342. }
  4343. foreach(c,saveControlCols)
  4344. {
  4345. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4346. toString(),c);
  4347. }
  4348. foreach(c,saveNoteCols)
  4349. {
  4350. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4351. toString(),c);
  4352. }
  4353. bool retval= writer.output();
  4354. if(prevUnits!=Units::Fahrenheit)
  4355. {
  4356. model_ms->setDisplayUnits(prevUnits);
  4357. }
  4358. return retval;
  4359. }
  4360. /*:396*//*397:*/
  4361. #line 9148 "./typica.w"
  4362. bool ZoomLog::saveCSV(QIODevice*device)
  4363. {
  4364. CSVOutput writer(currentModel,device,0);
  4365. int c;
  4366. foreach(c,saveTempCols)
  4367. {
  4368. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4369. toString(),c);
  4370. }
  4371. foreach(c,saveControlCols)
  4372. {
  4373. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4374. toString(),c);
  4375. }
  4376. foreach(c,saveNoteCols)
  4377. {
  4378. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4379. toString(),c);
  4380. }
  4381. return writer.output();
  4382. }
  4383. /*:397*//*398:*/
  4384. #line 9177 "./typica.w"
  4385. void ZoomLog::switchLOD(MeasurementModel*m)
  4386. {
  4387. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4388. setModel(m);
  4389. currentModel= m;
  4390. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4391. }
  4392. void ZoomLog::LOD_ms()
  4393. {
  4394. switchLOD(model_ms);
  4395. }
  4396. void ZoomLog::LOD_1s()
  4397. {
  4398. switchLOD(model_1s);
  4399. }
  4400. void ZoomLog::LOD_5s()
  4401. {
  4402. switchLOD(model_5s);
  4403. }
  4404. void ZoomLog::LOD_10s()
  4405. {
  4406. switchLOD(model_10s);
  4407. }
  4408. void ZoomLog::LOD_15s()
  4409. {
  4410. switchLOD(model_15s);
  4411. }
  4412. void ZoomLog::LOD_30s()
  4413. {
  4414. switchLOD(model_30s);
  4415. }
  4416. void ZoomLog::LOD_1m()
  4417. {
  4418. switchLOD(model_1m);
  4419. }
  4420. /*:398*//*399:*/
  4421. #line 9225 "./typica.w"
  4422. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4423. {
  4424. model_ms->setDisplayUnits(scale);
  4425. model_1s->setDisplayUnits(scale);
  4426. model_5s->setDisplayUnits(scale);
  4427. model_10s->setDisplayUnits(scale);
  4428. model_15s->setDisplayUnits(scale);
  4429. model_30s->setDisplayUnits(scale);
  4430. model_1m->setDisplayUnits(scale);
  4431. }
  4432. Units::Unit ZoomLog::displayUnits()
  4433. {
  4434. return model_ms->displayUnits();
  4435. }
  4436. /*:399*//*400:*/
  4437. #line 9245 "./typica.w"
  4438. QString ZoomLog::lastTime(int series)
  4439. {
  4440. Measurement measure= lastMeasurement.value(series);
  4441. QTime time= measure.time();
  4442. return time.toString("h:mm:ss.zzz");
  4443. }
  4444. /*:400*//*401:*/
  4445. #line 9255 "./typica.w"
  4446. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  4447. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  4448. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  4449. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  4450. {
  4451. setEditTriggers(QAbstractItemView::NoEditTriggers);
  4452. setSelectionMode(QAbstractItemView::NoSelection);
  4453. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  4454. model_30s<<model_1m;
  4455. currentModel= model_30s;
  4456. setModel(currentModel);
  4457. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4458. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  4459. this,SLOT(persistColumnResize(int,int,int)));
  4460. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  4461. this,SLOT(restoreColumnWidths()));
  4462. }
  4463. /*:401*//*402:*/
  4464. #line 9278 "./typica.w"
  4465. void ZoomLog::setHeaderData(int section,QString text)
  4466. {
  4467. MeasurementModel*m;
  4468. foreach(m,modelSet)
  4469. {
  4470. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  4471. }
  4472. }
  4473. /*:402*//*403:*/
  4474. #line 9296 "./typica.w"
  4475. void ZoomLog::addOutputTemperatureColumn(int column)
  4476. {
  4477. saveTempCols.append(column);
  4478. }
  4479. void ZoomLog::addOutputControlColumn(int column)
  4480. {
  4481. saveControlCols.append(column);
  4482. }
  4483. void ZoomLog::addOutputAnnotationColumn(int column)
  4484. {
  4485. saveNoteCols.append(column);
  4486. }
  4487. void ZoomLog::clearOutputColumns()
  4488. {
  4489. saveTempCols.clear();
  4490. saveControlCols.clear();
  4491. saveNoteCols.clear();
  4492. }
  4493. /*:403*//*404:*/
  4494. #line 9322 "./typica.w"
  4495. void ZoomLog::persistColumnResize(int column,int,int newsize)
  4496. {
  4497. /*619:*/
  4498. #line 13460 "./typica.w"
  4499. QSettings settings;
  4500. /*620:*/
  4501. #line 13473 "./typica.w"
  4502. QWidget*topLevelWidget= this;
  4503. while(topLevelWidget->parentWidget())
  4504. {
  4505. topLevelWidget= topLevelWidget->parentWidget();
  4506. }
  4507. /*:620*/
  4508. #line 13462 "./typica.w"
  4509. settings.setValue(QString("columnWidths/%1/%2/%3").
  4510. arg(topLevelWidget->objectName()).
  4511. arg(objectName()).arg(column),
  4512. QVariant(newsize));
  4513. /*:619*/
  4514. #line 9325 "./typica.w"
  4515. }
  4516. void ZoomLog::restoreColumnWidths()
  4517. {
  4518. /*622:*/
  4519. #line 13493 "./typica.w"
  4520. QSettings settings;
  4521. /*620:*/
  4522. #line 13473 "./typica.w"
  4523. QWidget*topLevelWidget= this;
  4524. while(topLevelWidget->parentWidget())
  4525. {
  4526. topLevelWidget= topLevelWidget->parentWidget();
  4527. }
  4528. /*:620*/
  4529. #line 13495 "./typica.w"
  4530. QString baseKey=
  4531. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4532. arg(objectName());
  4533. for(int i= 0;i<model()->columnCount();i++)
  4534. {
  4535. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4536. if(settings.contains(key))
  4537. {
  4538. setColumnWidth(i,settings.value(key).toInt());
  4539. }
  4540. }
  4541. /*:622*/
  4542. #line 9330 "./typica.w"
  4543. }
  4544. void ZoomLog::setVisible(bool visibility)
  4545. {
  4546. QTableView::setVisible(visibility);
  4547. }
  4548. void ZoomLog::showEvent(QShowEvent*)
  4549. {
  4550. /*622:*/
  4551. #line 13493 "./typica.w"
  4552. QSettings settings;
  4553. /*620:*/
  4554. #line 13473 "./typica.w"
  4555. QWidget*topLevelWidget= this;
  4556. while(topLevelWidget->parentWidget())
  4557. {
  4558. topLevelWidget= topLevelWidget->parentWidget();
  4559. }
  4560. /*:620*/
  4561. #line 13495 "./typica.w"
  4562. QString baseKey=
  4563. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4564. arg(objectName());
  4565. for(int i= 0;i<model()->columnCount();i++)
  4566. {
  4567. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4568. if(settings.contains(key))
  4569. {
  4570. setColumnWidth(i,settings.value(key).toInt());
  4571. }
  4572. }
  4573. /*:622*/
  4574. #line 9340 "./typica.w"
  4575. }
  4576. /*:404*/
  4577. #line 549 "./typica.w"
  4578. /*413:*/
  4579. #line 9573 "./typica.w"
  4580. bool MeasurementList::operator<(const MeasurementList&other)const
  4581. {
  4582. return this->first().toTime()<other.first().toTime();
  4583. }
  4584. bool MeasurementList::operator==(const MeasurementList&other)const
  4585. {
  4586. return this->first().toTime()==other.first().toTime();
  4587. }
  4588. /*:413*//*414:*/
  4589. #line 9589 "./typica.w"
  4590. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  4591. {
  4592. return QModelIndex();
  4593. }
  4594. /*:414*//*415:*/
  4595. #line 9599 "./typica.w"
  4596. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  4597. {
  4598. if(measure.scale()==Units::Unitless)
  4599. {
  4600. controlColumns->insert(tempcolumn,true);
  4601. }
  4602. else
  4603. {
  4604. controlColumns->insert(tempcolumn,false);
  4605. }
  4606. MeasurementList*temp;
  4607. temp= new MeasurementList;
  4608. temp->append(QVariant(measure.time()));
  4609. /*416:*/
  4610. #line 9658 "./typica.w"
  4611. /*417:*/
  4612. #line 9703 "./typica.w"
  4613. QList<MeasurementList*> ::iterator i= lastInsertion;
  4614. bool quickscan= false;
  4615. if(entries->size()> 5)
  4616. {
  4617. if(**i<*temp)
  4618. {
  4619. i+= 1;
  4620. for(int j= 10;j> 0;j--)
  4621. {
  4622. if(i!=entries->end())
  4623. {
  4624. if(**i<*temp)
  4625. {
  4626. i+= 1;
  4627. }
  4628. else
  4629. {
  4630. quickscan= true;
  4631. break;
  4632. }
  4633. }
  4634. else
  4635. {
  4636. quickscan= true;
  4637. break;
  4638. }
  4639. }
  4640. }
  4641. else
  4642. {
  4643. if(**i==*temp)
  4644. {
  4645. quickscan= true;
  4646. }
  4647. }
  4648. }
  4649. /*:417*/
  4650. #line 9659 "./typica.w"
  4651. if(quickscan==false)
  4652. {
  4653. i= entries->begin();
  4654. QList<MeasurementList*> ::iterator u= entries->end();
  4655. QList<MeasurementList*> ::iterator midpoint;
  4656. int n= u-i;
  4657. int rA;
  4658. while(n> 0)
  4659. {
  4660. rA= n>>1;
  4661. midpoint= i+rA;
  4662. if(**midpoint<*temp)
  4663. {
  4664. i= midpoint+1;
  4665. n-= rA+1;
  4666. }
  4667. else
  4668. {
  4669. n= rA;
  4670. }
  4671. }
  4672. }
  4673. /*:416*/
  4674. #line 9613 "./typica.w"
  4675. MeasurementList*newEntry;
  4676. int insertion;
  4677. if(i!=entries->end())
  4678. {
  4679. insertion= entries->indexOf(*i);
  4680. if((*i)->first().toTime()==measure.time())
  4681. {
  4682. /*418:*/
  4683. #line 9745 "./typica.w"
  4684. if((*i)->size()<tempcolumn+1)
  4685. {
  4686. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  4687. {
  4688. (*i)->append(QVariant());
  4689. }
  4690. }
  4691. (*i)->replace(tempcolumn,measure);
  4692. lastInsertion= i;
  4693. emit dataChanged(createIndex(insertion,tempcolumn),
  4694. createIndex(insertion,tempcolumn));
  4695. lastTemperature->insert(tempcolumn,insertion);
  4696. /*:418*/
  4697. #line 9621 "./typica.w"
  4698. }
  4699. else
  4700. {
  4701. /*419:*/
  4702. #line 9763 "./typica.w"
  4703. beginInsertRows(QModelIndex(),insertion,insertion);
  4704. newEntry= new MeasurementList;
  4705. newEntry->append(QVariant(measure.time()));
  4706. for(int j= 0;j<tempcolumn+1;j++)
  4707. {
  4708. newEntry->append(QVariant());
  4709. }
  4710. newEntry->replace(tempcolumn,measure);
  4711. lastInsertion= entries->insert(i,newEntry);
  4712. endInsertRows();
  4713. lastTemperature->insert(tempcolumn,insertion);
  4714. /*:419*/
  4715. #line 9625 "./typica.w"
  4716. }
  4717. }
  4718. else
  4719. {
  4720. /*420:*/
  4721. #line 9781 "./typica.w"
  4722. insertion= entries->size();
  4723. /*419:*/
  4724. #line 9763 "./typica.w"
  4725. beginInsertRows(QModelIndex(),insertion,insertion);
  4726. newEntry= new MeasurementList;
  4727. newEntry->append(QVariant(measure.time()));
  4728. for(int j= 0;j<tempcolumn+1;j++)
  4729. {
  4730. newEntry->append(QVariant());
  4731. }
  4732. newEntry->replace(tempcolumn,measure);
  4733. lastInsertion= entries->insert(i,newEntry);
  4734. endInsertRows();
  4735. lastTemperature->insert(tempcolumn,insertion);
  4736. /*:419*/
  4737. #line 9783 "./typica.w"
  4738. /*:420*/
  4739. #line 9630 "./typica.w"
  4740. }
  4741. if(tempcolumn>=colcount)
  4742. {
  4743. colcount= tempcolumn+1;
  4744. }
  4745. emit rowChanged(insertion);
  4746. delete temp;
  4747. }
  4748. /*:415*//*421:*/
  4749. #line 9793 "./typica.w"
  4750. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  4751. int annotationColumn)
  4752. {
  4753. int r;
  4754. if(lastTemperature->contains(tempcolumn))
  4755. {
  4756. r= lastTemperature->value(tempcolumn);
  4757. }
  4758. else
  4759. {
  4760. r= 0;
  4761. }
  4762. if(r==0&&entries->size()==0)
  4763. {
  4764. /*422:*/
  4765. #line 9831 "./typica.w"
  4766. beginInsertRows(QModelIndex(),0,0);
  4767. MeasurementList*newEntry= new MeasurementList;
  4768. newEntry->append(QVariant(QTime(0,0,0,0)));
  4769. entries->append(newEntry);
  4770. endInsertRows();
  4771. /*:422*/
  4772. #line 9808 "./typica.w"
  4773. }
  4774. MeasurementList*row= entries->at(r);
  4775. if(row->size()<=annotationColumn)
  4776. {
  4777. for(int i= row->size()-1;i<annotationColumn+1;i++)
  4778. {
  4779. row->append(QVariant());
  4780. }
  4781. }
  4782. row->replace(annotationColumn,annotation);
  4783. emit dataChanged(createIndex(r,annotationColumn),
  4784. createIndex(r,annotationColumn));
  4785. emit rowChanged(r);
  4786. if(annotationColumn> colcount-1)
  4787. {
  4788. colcount= annotationColumn+1;
  4789. }
  4790. }
  4791. /*:421*//*423:*/
  4792. #line 9842 "./typica.w"
  4793. void MeasurementModel::clear()
  4794. {
  4795. beginRemoveRows(QModelIndex(),0,entries->size());
  4796. while(entries->size()!=0)
  4797. {
  4798. MeasurementList*row= entries->takeFirst();
  4799. delete row;
  4800. }
  4801. endRemoveRows();
  4802. colcount= hData->size();
  4803. lastTemperature->clear();
  4804. reset();
  4805. }
  4806. /*:423*//*424:*/
  4807. #line 9875 "./typica.w"
  4808. bool MeasurementModel::setData(const QModelIndex&index,
  4809. const QVariant&value,int role)
  4810. {
  4811. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  4812. {
  4813. return false;
  4814. }
  4815. /*425:*/
  4816. #line 9907 "./typica.w"
  4817. bool valid= false;
  4818. if(index.isValid())
  4819. {
  4820. if(index.row()<entries->size())
  4821. {
  4822. if(index.column()<colcount)
  4823. {
  4824. valid= true;
  4825. }
  4826. }
  4827. }
  4828. /*:425*/
  4829. #line 9883 "./typica.w"
  4830. if(!valid)
  4831. {
  4832. return false;
  4833. }
  4834. MeasurementList*row= entries->at(index.row());
  4835. if(index.column()>=row->size())
  4836. {
  4837. /*426:*/
  4838. #line 9924 "./typica.w"
  4839. for(int i= row->size()-1;i<index.column();i++)
  4840. {
  4841. row->append(QVariant());
  4842. }
  4843. /*:426*/
  4844. #line 9891 "./typica.w"
  4845. }
  4846. if(index.column()==0)
  4847. {
  4848. /*427:*/
  4849. #line 9939 "./typica.w"
  4850. QTime time;
  4851. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  4852. {
  4853. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  4854. {
  4855. return false;
  4856. }
  4857. }
  4858. row= entries->takeAt(index.row());
  4859. row->replace(index.column(),QVariant(time));
  4860. MeasurementList*temp= row;
  4861. /*416:*/
  4862. #line 9658 "./typica.w"
  4863. /*417:*/
  4864. #line 9703 "./typica.w"
  4865. QList<MeasurementList*> ::iterator i= lastInsertion;
  4866. bool quickscan= false;
  4867. if(entries->size()> 5)
  4868. {
  4869. if(**i<*temp)
  4870. {
  4871. i+= 1;
  4872. for(int j= 10;j> 0;j--)
  4873. {
  4874. if(i!=entries->end())
  4875. {
  4876. if(**i<*temp)
  4877. {
  4878. i+= 1;
  4879. }
  4880. else
  4881. {
  4882. quickscan= true;
  4883. break;
  4884. }
  4885. }
  4886. else
  4887. {
  4888. quickscan= true;
  4889. break;
  4890. }
  4891. }
  4892. }
  4893. else
  4894. {
  4895. if(**i==*temp)
  4896. {
  4897. quickscan= true;
  4898. }
  4899. }
  4900. }
  4901. /*:417*/
  4902. #line 9659 "./typica.w"
  4903. if(quickscan==false)
  4904. {
  4905. i= entries->begin();
  4906. QList<MeasurementList*> ::iterator u= entries->end();
  4907. QList<MeasurementList*> ::iterator midpoint;
  4908. int n= u-i;
  4909. int rA;
  4910. while(n> 0)
  4911. {
  4912. rA= n>>1;
  4913. midpoint= i+rA;
  4914. if(**midpoint<*temp)
  4915. {
  4916. i= midpoint+1;
  4917. n-= rA+1;
  4918. }
  4919. else
  4920. {
  4921. n= rA;
  4922. }
  4923. }
  4924. }
  4925. /*:416*/
  4926. #line 9951 "./typica.w"
  4927. entries->insert(i,row);
  4928. int newRow= entries->indexOf(*i);
  4929. if(newRow<index.row())
  4930. {
  4931. emit dataChanged(createIndex(newRow,index.column()),index);
  4932. }
  4933. else
  4934. {
  4935. emit dataChanged(index,createIndex(newRow,index.column()));
  4936. }
  4937. /*:427*/
  4938. #line 9895 "./typica.w"
  4939. }
  4940. else
  4941. {
  4942. /*428:*/
  4943. #line 9965 "./typica.w"
  4944. row->replace(index.column(),value);
  4945. emit dataChanged(index,index);
  4946. /*:428*/
  4947. #line 9899 "./typica.w"
  4948. }
  4949. return true;
  4950. }
  4951. /*:424*//*429:*/
  4952. #line 9973 "./typica.w"
  4953. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  4954. unit(Units::Fahrenheit),hData(new QStringList),
  4955. lastTemperature(new QHash<int,int> ),
  4956. controlColumns(new QHash<int,bool> )
  4957. {
  4958. colcount= 1;
  4959. entries= new QList<MeasurementList*> ;
  4960. lastInsertion= entries->begin();
  4961. hData->append(tr("Time"));
  4962. }
  4963. /*:429*//*430:*/
  4964. #line 9987 "./typica.w"
  4965. MeasurementModel::~MeasurementModel()
  4966. {
  4967. clear();
  4968. delete entries;
  4969. delete hData;
  4970. }
  4971. /*:430*//*431:*/
  4972. #line 9999 "./typica.w"
  4973. int MeasurementModel::rowCount(const QModelIndex&parent)const
  4974. {
  4975. if(parent==QModelIndex())
  4976. {
  4977. return entries->size();
  4978. }
  4979. return 0;
  4980. }
  4981. int MeasurementModel::columnCount(const QModelIndex&parent)const
  4982. {
  4983. if(parent==QModelIndex())
  4984. {
  4985. return colcount;
  4986. }
  4987. return 0;
  4988. }
  4989. /*:431*//*432:*/
  4990. #line 10026 "./typica.w"
  4991. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  4992. const QVariant&value,int)
  4993. {
  4994. if(orientation==Qt::Horizontal)
  4995. {
  4996. if(hData->size()<section+1)
  4997. {
  4998. for(int i= hData->size();i<section+1;i++)
  4999. {
  5000. if(colcount<i)
  5001. {
  5002. beginInsertColumns(QModelIndex(),i,i);
  5003. }
  5004. hData->append(QString());
  5005. if(colcount<i)
  5006. {
  5007. endInsertColumns();
  5008. }
  5009. }
  5010. }
  5011. hData->replace(section,value.toString());
  5012. emit headerDataChanged(orientation,section,section);
  5013. if(colcount<section+1)
  5014. {
  5015. colcount= section+1;
  5016. }
  5017. return true;
  5018. }
  5019. return false;
  5020. }
  5021. /*:432*//*433:*/
  5022. #line 10066 "./typica.w"
  5023. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  5024. {
  5025. beginResetModel();
  5026. unit= scale;
  5027. endResetModel();
  5028. }
  5029. Units::Unit MeasurementModel::displayUnits()
  5030. {
  5031. return unit;
  5032. }
  5033. /*:433*//*434:*/
  5034. #line 10092 "./typica.w"
  5035. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  5036. {
  5037. /*425:*/
  5038. #line 9907 "./typica.w"
  5039. bool valid= false;
  5040. if(index.isValid())
  5041. {
  5042. if(index.row()<entries->size())
  5043. {
  5044. if(index.column()<colcount)
  5045. {
  5046. valid= true;
  5047. }
  5048. }
  5049. }
  5050. /*:425*/
  5051. #line 10095 "./typica.w"
  5052. if(!valid)
  5053. {
  5054. return QVariant();
  5055. }
  5056. MeasurementList*row= entries->at(index.row());
  5057. if(role==Qt::UserRole)
  5058. {
  5059. return QVariant(row->at(index.column()));
  5060. }
  5061. if(role==Qt::DisplayRole||role==Qt::EditRole)
  5062. {
  5063. if(index.column()> row->size())
  5064. {
  5065. return QVariant();
  5066. }
  5067. else
  5068. {
  5069. if(index.column()==0)
  5070. {
  5071. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  5072. }
  5073. else if(lastTemperature->contains(index.column()))
  5074. {
  5075. QVariantMap v= row->at(index.column()).toMap();
  5076. if(!v.contains("measurement"))
  5077. {
  5078. return QVariant();
  5079. }
  5080. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  5081. {
  5082. return v.value("measurement");
  5083. }
  5084. else
  5085. {
  5086. if(v.contains("relative"))
  5087. {
  5088. if(v.value("relative").toBool())
  5089. {
  5090. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  5091. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  5092. }
  5093. }
  5094. return QVariant(QString("%1").
  5095. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  5096. (Units::Unit)(v.value("unit").toInt()),unit)));
  5097. }
  5098. }
  5099. return QVariant(row->at(index.column()).toString());
  5100. }
  5101. }
  5102. return QVariant();
  5103. }
  5104. /*:434*//*435:*/
  5105. #line 10151 "./typica.w"
  5106. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  5107. int role)const
  5108. {
  5109. if(orientation==Qt::Horizontal)
  5110. {
  5111. if(role==Qt::DisplayRole)
  5112. {
  5113. if(section<hData->size())
  5114. {
  5115. return QVariant(hData->at(section));
  5116. }
  5117. }
  5118. }
  5119. return QVariant();
  5120. }
  5121. /*:435*//*436:*/
  5122. #line 10178 "./typica.w"
  5123. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  5124. {
  5125. /*425:*/
  5126. #line 9907 "./typica.w"
  5127. bool valid= false;
  5128. if(index.isValid())
  5129. {
  5130. if(index.row()<entries->size())
  5131. {
  5132. if(index.column()<colcount)
  5133. {
  5134. valid= true;
  5135. }
  5136. }
  5137. }
  5138. /*:425*/
  5139. #line 10181 "./typica.w"
  5140. if(valid)
  5141. {
  5142. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5143. }
  5144. return 0;
  5145. }
  5146. /*:436*//*437:*/
  5147. #line 10193 "./typica.w"
  5148. QModelIndex MeasurementModel::index(int row,int column,
  5149. const QModelIndex&parent)const
  5150. {
  5151. if(parent==QModelIndex())
  5152. {
  5153. if(row<entries->size()&&entries->isEmpty()==false)
  5154. {
  5155. if(column<entries->at(row)->size())
  5156. {
  5157. return createIndex(row,column);
  5158. }
  5159. }
  5160. }
  5161. return QModelIndex();
  5162. }
  5163. /*:437*/
  5164. #line 550 "./typica.w"
  5165. /*439:*/
  5166. #line 10244 "./typica.w"
  5167. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  5168. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  5169. {
  5170. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  5171. }
  5172. /*:439*//*440:*/
  5173. #line 10259 "./typica.w"
  5174. void AnnotationButton::annotate()
  5175. {
  5176. if(note.contains("%1"))
  5177. {
  5178. count++;
  5179. emit annotation(note.arg(count),tc,ac);
  5180. }
  5181. else
  5182. {
  5183. emit annotation(note,tc,ac);
  5184. }
  5185. }
  5186. /*:440*//*441:*/
  5187. #line 10277 "./typica.w"
  5188. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  5189. {
  5190. tc= tempcolumn;
  5191. }
  5192. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  5193. {
  5194. ac= annotationcolumn;
  5195. }
  5196. void AnnotationButton::setAnnotation(const QString&annotation)
  5197. {
  5198. note= annotation;
  5199. }
  5200. /*:441*//*442:*/
  5201. #line 10296 "./typica.w"
  5202. void AnnotationButton::resetCount()
  5203. {
  5204. count= 0;
  5205. }
  5206. /*:442*/
  5207. #line 551 "./typica.w"
  5208. /*447:*/
  5209. #line 10379 "./typica.w"
  5210. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  5211. const QString&postt,
  5212. QWidget*parent)
  5213. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  5214. {
  5215. resetChange();
  5216. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  5217. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  5218. }
  5219. /*:447*//*448:*/
  5220. #line 10396 "./typica.w"
  5221. void AnnotationSpinBox::resetChange()
  5222. {
  5223. change= true;
  5224. }
  5225. /*:448*//*449:*/
  5226. #line 10407 "./typica.w"
  5227. void AnnotationSpinBox::annotate()
  5228. {
  5229. if(change)
  5230. {
  5231. change= false;
  5232. emit annotation(QString("%1%2%3").arg(pretext).
  5233. arg(value()).arg(posttext),tc,ac);
  5234. }
  5235. }
  5236. /*:449*//*450:*/
  5237. #line 10420 "./typica.w"
  5238. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  5239. {
  5240. tc= tempcolumn;
  5241. }
  5242. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  5243. {
  5244. ac= annotationcolumn;
  5245. }
  5246. void AnnotationSpinBox::setPretext(const QString&pret)
  5247. {
  5248. pretext= pret;
  5249. }
  5250. void AnnotationSpinBox::setPosttext(const QString&postt)
  5251. {
  5252. posttext= postt;
  5253. }
  5254. /*:450*/
  5255. #line 552 "./typica.w"
  5256. /*457:*/
  5257. #line 10589 "./typica.w"
  5258. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  5259. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  5260. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  5261. stopAction(new QAction(tr("Stop"),NULL)),
  5262. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  5263. relative(QTime::currentTime()),base(QTime(0,0,0))
  5264. {
  5265. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  5266. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  5267. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  5268. clock.setInterval(500);
  5269. clock.setSingleShot(false);
  5270. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  5271. setSegmentStyle(Filled);
  5272. updateDisplay();
  5273. }
  5274. /*:457*//*458:*/
  5275. #line 10610 "./typica.w"
  5276. void TimerDisplay::updateTime()
  5277. {
  5278. QTime time;
  5279. int cseconds= 0;
  5280. int oseconds= 0;
  5281. int r= 0;
  5282. QTime nt= QTime(0,0,0);
  5283. int n= 0;
  5284. int bseconds= 0;
  5285. switch(m)
  5286. {
  5287. case TimerDisplay::CountUp:
  5288. /*459:*/
  5289. #line 10642 "./typica.w"
  5290. /*460:*/
  5291. #line 10655 "./typica.w"
  5292. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5293. time= QTime::currentTime();
  5294. cseconds= TIMETOINT(time);
  5295. oseconds= TIMETOINT(relative);
  5296. r= cseconds-oseconds;
  5297. /*:460*/
  5298. #line 10643 "./typica.w"
  5299. nt= nt.addSecs(r);
  5300. if(nt!=s)
  5301. {
  5302. s= nt;
  5303. emit valueChanged(s);
  5304. }
  5305. /*:459*/
  5306. #line 10623 "./typica.w"
  5307. ;
  5308. break;
  5309. case TimerDisplay::CountDown:
  5310. /*461:*/
  5311. #line 10667 "./typica.w"
  5312. if(s> QTime(0,0,0))
  5313. {
  5314. /*460:*/
  5315. #line 10655 "./typica.w"
  5316. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5317. time= QTime::currentTime();
  5318. cseconds= TIMETOINT(time);
  5319. oseconds= TIMETOINT(relative);
  5320. r= cseconds-oseconds;
  5321. /*:460*/
  5322. #line 10670 "./typica.w"
  5323. bseconds= TIMETOINT(base);
  5324. n= bseconds-r;
  5325. nt= nt.addSecs(n);
  5326. if(nt!=s)
  5327. {
  5328. s= nt;
  5329. emit valueChanged(s);
  5330. }
  5331. }else{
  5332. stopTimer();
  5333. }
  5334. /*:461*/
  5335. #line 10626 "./typica.w"
  5336. ;
  5337. break;
  5338. case TimerDisplay::Clock:
  5339. /*462:*/
  5340. #line 10686 "./typica.w"
  5341. time= QTime::currentTime();
  5342. if(time!=s)
  5343. {
  5344. s= time;
  5345. emit valueChanged(s);
  5346. }
  5347. /*:462*/
  5348. #line 10629 "./typica.w"
  5349. ;
  5350. break;
  5351. default:
  5352. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5353. break;
  5354. }
  5355. updateDisplay();
  5356. }
  5357. /*:458*//*463:*/
  5358. #line 10698 "./typica.w"
  5359. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5360. void TimerDisplay::startTimer()
  5361. {
  5362. if(!running)
  5363. {
  5364. relative= QTime::currentTime();
  5365. if(ar)
  5366. {
  5367. reset();
  5368. }
  5369. else
  5370. {
  5371. relative= TIMESUBTRACT(relative,s);
  5372. }
  5373. if(m==Clock)
  5374. {
  5375. updateTime();
  5376. }
  5377. base= s;
  5378. clock.start();
  5379. running= true;
  5380. emit runStateChanged(true);
  5381. }
  5382. }
  5383. /*:463*//*464:*/
  5384. #line 10728 "./typica.w"
  5385. void TimerDisplay::stopTimer()
  5386. {
  5387. if(running)
  5388. {
  5389. clock.stop();
  5390. running= false;
  5391. emit runStateChanged(false);
  5392. }
  5393. }
  5394. /*:464*//*465:*/
  5395. #line 10741 "./typica.w"
  5396. TimerDisplay::~TimerDisplay()
  5397. {
  5398. clock.stop();
  5399. }
  5400. /*:465*//*466:*/
  5401. #line 10750 "./typica.w"
  5402. void TimerDisplay::setCountUpMode()
  5403. {
  5404. m= TimerDisplay::CountUp;
  5405. }
  5406. void TimerDisplay::setCountDownMode()
  5407. {
  5408. m= TimerDisplay::CountDown;
  5409. }
  5410. void TimerDisplay::setClockMode()
  5411. {
  5412. m= TimerDisplay::Clock;
  5413. }
  5414. /*:466*//*467:*/
  5415. #line 10768 "./typica.w"
  5416. QString TimerDisplay::value()
  5417. {
  5418. return s.toString(f);
  5419. }
  5420. QTime TimerDisplay::seconds()
  5421. {
  5422. return s;
  5423. }
  5424. TimerDisplay::TimerMode TimerDisplay::mode()
  5425. {
  5426. return m;
  5427. }
  5428. bool TimerDisplay::isRunning()
  5429. {
  5430. return running;
  5431. }
  5432. QTime TimerDisplay::resetValue()
  5433. {
  5434. return r;
  5435. }
  5436. QString TimerDisplay::displayFormat()
  5437. {
  5438. return f;
  5439. }
  5440. bool TimerDisplay::autoReset()
  5441. {
  5442. return ar;
  5443. }
  5444. /*:467*//*468:*/
  5445. #line 10806 "./typica.w"
  5446. void TimerDisplay::setTimer(QTime value)
  5447. {
  5448. if(value.isValid())
  5449. {
  5450. s= value;
  5451. updateDisplay();
  5452. emit valueChanged(value);
  5453. }
  5454. }
  5455. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  5456. {
  5457. m= mode;
  5458. }
  5459. void TimerDisplay::setResetValue(QTime value)
  5460. {
  5461. r= value;
  5462. }
  5463. void TimerDisplay::setDisplayFormat(QString format)
  5464. {
  5465. f= format;
  5466. setNumDigits(format.length());
  5467. }
  5468. void TimerDisplay::setAutoReset(bool reset)
  5469. {
  5470. ar= reset;
  5471. }
  5472. /*:468*//*469:*/
  5473. #line 10841 "./typica.w"
  5474. void TimerDisplay::copyTimer()
  5475. {
  5476. QApplication::clipboard()->setText(value());
  5477. }
  5478. /*:469*//*470:*/
  5479. #line 10850 "./typica.w"
  5480. void TimerDisplay::reset()
  5481. {
  5482. if(!running)
  5483. {
  5484. s= r;
  5485. updateDisplay();
  5486. }
  5487. }
  5488. /*:470*//*471:*/
  5489. #line 10863 "./typica.w"
  5490. void TimerDisplay::updateDisplay()
  5491. {
  5492. display(value());
  5493. }
  5494. /*:471*/
  5495. #line 553 "./typica.w"
  5496. /*478:*/
  5497. #line 10988 "./typica.w"
  5498. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  5499. {
  5500. int x= rect.x();
  5501. int y= rect.y();
  5502. QLayoutItem*item;
  5503. if(orientation==Qt::Horizontal)
  5504. {
  5505. /*479:*/
  5506. #line 11012 "./typica.w"
  5507. foreach(item,itemList)
  5508. {
  5509. int nextX= x+item->sizeHint().width()+spacing();
  5510. int right= x+item->sizeHint().width();
  5511. if(item==itemList.last())
  5512. {
  5513. right= rect.right();
  5514. }
  5515. int bottom= rect.bottom();
  5516. if(!testOnly)
  5517. {
  5518. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5519. }
  5520. x= nextX;
  5521. }
  5522. /*:479*/
  5523. #line 10996 "./typica.w"
  5524. }
  5525. else
  5526. {
  5527. /*480:*/
  5528. #line 11031 "./typica.w"
  5529. foreach(item,itemList)
  5530. {
  5531. int nextY= y+item->sizeHint().height()+spacing();
  5532. int bottom= y+item->sizeHint().height();
  5533. if(item==itemList.last())
  5534. {
  5535. bottom= rect.bottom();
  5536. }
  5537. int right= rect.right();
  5538. if(!testOnly)
  5539. {
  5540. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5541. }
  5542. y= nextY;
  5543. }
  5544. /*:480*/
  5545. #line 11000 "./typica.w"
  5546. }
  5547. return y;
  5548. }
  5549. /*:478*//*481:*/
  5550. #line 11055 "./typica.w"
  5551. QSize PackLayout::minimumSize()const
  5552. {
  5553. QSize size;
  5554. QLayoutItem*item;
  5555. foreach(item,itemList)
  5556. {
  5557. if(orientation==Qt::Horizontal)
  5558. {
  5559. size+= QSize(item->minimumSize().width(),0);
  5560. if(size.height()<item->minimumSize().height())
  5561. {
  5562. size.setHeight(item->minimumSize().height());
  5563. }
  5564. }
  5565. else
  5566. {
  5567. size+= QSize(0,item->minimumSize().height());
  5568. if(size.width()<item->minimumSize().width())
  5569. {
  5570. size.setWidth(item->minimumSize().width());
  5571. }
  5572. }
  5573. }
  5574. size+= QSize(2*margin(),2*margin());
  5575. return size;
  5576. }
  5577. /*:481*//*482:*/
  5578. #line 11087 "./typica.w"
  5579. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  5580. QLayout(parent)
  5581. {
  5582. setMargin(margin);
  5583. setSpacing(spacing);
  5584. setOrientation(Qt::Horizontal);
  5585. }
  5586. PackLayout::PackLayout(int spacing)
  5587. {
  5588. setSpacing(spacing);
  5589. setOrientation(Qt::Horizontal);
  5590. }
  5591. /*:482*//*483:*/
  5592. #line 11105 "./typica.w"
  5593. PackLayout::~PackLayout()
  5594. {
  5595. QLayoutItem*item;
  5596. while((item= takeAt(0)))
  5597. {
  5598. delete item;
  5599. }
  5600. }
  5601. /*:483*//*484:*/
  5602. #line 11119 "./typica.w"
  5603. QLayoutItem*PackLayout::takeAt(int index)
  5604. {
  5605. if(index>=0&&index<itemList.size())
  5606. {
  5607. return itemList.takeAt(index);
  5608. }
  5609. else
  5610. {
  5611. return NULL;
  5612. }
  5613. }
  5614. /*:484*//*485:*/
  5615. #line 11135 "./typica.w"
  5616. QLayoutItem*PackLayout::itemAt(int index)const
  5617. {
  5618. if(index>=0&&index<itemList.size())
  5619. {
  5620. return itemList.at(index);
  5621. }
  5622. else
  5623. {
  5624. return NULL;
  5625. }
  5626. }
  5627. /*:485*//*486:*/
  5628. #line 11158 "./typica.w"
  5629. void PackLayout::addItem(QLayoutItem*item)
  5630. {
  5631. itemList.append(item);
  5632. }
  5633. /*:486*//*487:*/
  5634. #line 11166 "./typica.w"
  5635. int PackLayout::count()const
  5636. {
  5637. return itemList.size();
  5638. }
  5639. /*:487*//*488:*/
  5640. #line 11178 "./typica.w"
  5641. Qt::Orientations PackLayout::expandingDirections()const
  5642. {
  5643. return Qt::Vertical|Qt::Horizontal;
  5644. }
  5645. bool PackLayout::hasHeightForWidth()const
  5646. {
  5647. return false;
  5648. }
  5649. int PackLayout::heightForWidth(int width)const
  5650. {
  5651. return doLayout(QRect(0,0,width,0),true);
  5652. }
  5653. void PackLayout::setGeometry(const QRect&rect)
  5654. {
  5655. QLayout::setGeometry(rect);
  5656. doLayout(rect,false);
  5657. }
  5658. QSize PackLayout::sizeHint()const
  5659. {
  5660. return minimumSize();
  5661. }
  5662. /*:488*//*489:*/
  5663. #line 11209 "./typica.w"
  5664. void PackLayout::setOrientation(Qt::Orientations direction)
  5665. {
  5666. orientation= direction;
  5667. doLayout(geometry(),false);
  5668. }
  5669. /*:489*/
  5670. #line 554 "./typica.w"
  5671. /*491:*/
  5672. #line 11248 "./typica.w"
  5673. SceneButton::SceneButton():QGraphicsScene()
  5674. {
  5675. }
  5676. SceneButton::~SceneButton()
  5677. {
  5678. }
  5679. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  5680. {
  5681. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  5682. }
  5683. /*:491*/
  5684. #line 555 "./typica.w"
  5685. /*493:*/
  5686. #line 11294 "./typica.w"
  5687. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  5688. Qt::Orientations orientation,
  5689. QWidget*parent,Qt::WindowFlags f):
  5690. QWidget(parent,f),label(new QGraphicsView()),
  5691. scene(new SceneButton())
  5692. {
  5693. layout= new PackLayout(this);
  5694. layout->setOrientation(orientation);
  5695. /*494:*/
  5696. #line 11314 "./typica.w"
  5697. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5698. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5699. label->setFrameShape(QFrame::NoFrame);
  5700. label->setInteractive(true);
  5701. /*:494*/
  5702. #line 11303 "./typica.w"
  5703. /*495:*/
  5704. #line 11325 "./typica.w"
  5705. scene->setBackgroundBrush(Qt::cyan);
  5706. text= scene->addText(labeltext);
  5707. if(orientation==Qt::Horizontal)
  5708. {
  5709. text->rotate(270.0);
  5710. }
  5711. label->setScene(scene);
  5712. /*:495*/
  5713. #line 11304 "./typica.w"
  5714. /*496:*/
  5715. #line 11343 "./typica.w"
  5716. if(orientation==Qt::Horizontal)
  5717. {
  5718. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  5719. }
  5720. else
  5721. {
  5722. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  5723. }
  5724. label->centerOn(text);
  5725. /*:496*/
  5726. #line 11305 "./typica.w"
  5727. /*497:*/
  5728. #line 11358 "./typica.w"
  5729. layout->addWidget(label);
  5730. layout->addWidget(widget);
  5731. if(orientation==Qt::Horizontal)
  5732. {
  5733. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  5734. widget->sizeHint().height());
  5735. }
  5736. else
  5737. {
  5738. setMinimumSize(widget->sizeHint().width(),
  5739. widget->sizeHint().height()+label->sizeHint().height());
  5740. }
  5741. /*:497*/
  5742. #line 11306 "./typica.w"
  5743. }
  5744. /*:493*//*498:*/
  5745. #line 11375 "./typica.w"
  5746. void WidgetDecorator::setBackgroundBrush(QBrush background)
  5747. {
  5748. scene->setBackgroundBrush(background);
  5749. }
  5750. void WidgetDecorator::setTextColor(QColor color)
  5751. {
  5752. text->setDefaultTextColor(color);
  5753. }
  5754. /*:498*//*499:*/
  5755. #line 11388 "./typica.w"
  5756. WidgetDecorator::~WidgetDecorator()
  5757. {
  5758. }
  5759. /*:499*/
  5760. #line 556 "./typica.w"
  5761. /*504:*/
  5762. #line 11487 "./typica.w"
  5763. void LogEditWindow::addTheRows()
  5764. {
  5765. QTime s= startTime->time();
  5766. while(s<endTime->time())
  5767. {
  5768. model->newMeasurement(Measurement(0,s),1);
  5769. s= s.addSecs(interval->value());
  5770. }
  5771. model->newMeasurement(Measurement(0,endTime->time()),1);
  5772. }
  5773. /*:504*//*505:*/
  5774. #line 11501 "./typica.w"
  5775. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  5776. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  5777. addRowsLayout(new QHBoxLayout(NULL)),
  5778. startTimeLabel(new QLabel("Start Time")),
  5779. startTime(new QTimeEdit(QTime(0,0,0,0))),
  5780. endTimeLabel(new QLabel("End Time")),
  5781. endTime(new QTimeEdit(QTime(0,20,0,0))),
  5782. intervalLabel(new QLabel("Interval (seconds)")),
  5783. interval(new QSpinBox()),
  5784. addRows(new QPushButton("Add Rows")),
  5785. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  5786. saveCsv(new QAction(tr("Export CSV"),NULL)),
  5787. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  5788. model(new MeasurementModel()),
  5789. log(new QTableView())
  5790. {
  5791. /*506:*/
  5792. #line 11538 "./typica.w"
  5793. QSettings settings;
  5794. resize(settings.value("logSize",QSize(620,400)).toSize());
  5795. move(settings.value("logPos",QPoint(200,60)).toPoint());
  5796. /*:506*/
  5797. #line 11518 "./typica.w"
  5798. /*507:*/
  5799. #line 11551 "./typica.w"
  5800. mainLayout->setOrientation(Qt::Vertical);
  5801. addRowsLayout->addSpacing(10);
  5802. addRowsLayout->addWidget(startTimeLabel);
  5803. addRowsLayout->addWidget(startTime);
  5804. addRowsLayout->addSpacing(10);
  5805. startTime->setDisplayFormat("mm:ss");
  5806. addRowsLayout->addWidget(endTimeLabel);
  5807. addRowsLayout->addWidget(endTime);
  5808. addRowsLayout->addSpacing(10);
  5809. endTime->setDisplayFormat("mm:ss");
  5810. addRowsLayout->addWidget(intervalLabel);
  5811. addRowsLayout->addWidget(interval);
  5812. addRowsLayout->addSpacing(10);
  5813. interval->setRange(0,60);
  5814. interval->setValue(30);
  5815. addRowsLayout->addWidget(addRows);
  5816. addRowsLayout->addSpacing(10);
  5817. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  5818. /*:507*/
  5819. #line 11519 "./typica.w"
  5820. /*508:*/
  5821. #line 11574 "./typica.w"
  5822. model->setHeaderData(0,Qt::Horizontal,"Time");
  5823. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  5824. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  5825. model->clear();
  5826. /*:508*/
  5827. #line 11520 "./typica.w"
  5828. /*509:*/
  5829. #line 11583 "./typica.w"
  5830. log->setModel(model);
  5831. log->setColumnWidth(0,100);
  5832. log->setColumnWidth(1,100);
  5833. log->setColumnWidth(2,100);
  5834. /*:509*/
  5835. #line 11521 "./typica.w"
  5836. mainLayout->addItem(addRowsLayout);
  5837. mainLayout->addWidget(log);
  5838. centralWidget->setLayout(mainLayout);
  5839. setCentralWidget(centralWidget);
  5840. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  5841. fileMenu->addAction(openXml);
  5842. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  5843. fileMenu->addAction(saveXml);
  5844. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  5845. fileMenu->addAction(saveCsv);
  5846. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  5847. }
  5848. /*:505*//*510:*/
  5849. #line 11594 "./typica.w"
  5850. void LogEditWindow::saveXML()
  5851. {
  5852. QSettings settings;
  5853. QString lastDir= settings.value("lastDirectory").toString();
  5854. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  5855. lastDir,"",0);
  5856. QFile file(filename);
  5857. XMLOutput writer(model,&file,0);
  5858. writer.addTemperatureColumn("Temperature",1);
  5859. writer.addAnnotationColumn("Annotation",2);
  5860. if(writer.output())
  5861. {
  5862. QFileInfo info(filename);
  5863. QDir directory= info.dir();
  5864. lastDir= directory.path();
  5865. settings.setValue("lastDirectory",lastDir);
  5866. }
  5867. }
  5868. void LogEditWindow::saveCSV()
  5869. {
  5870. QSettings settings;
  5871. QString lastDir= settings.value("lastDirectory").toString();
  5872. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  5873. lastDir,"",0);
  5874. QFile file(filename);
  5875. CSVOutput writer(model,&file,0);
  5876. writer.addTemperatureColumn("Temperature",1);
  5877. writer.addAnnotationColumn("Annotation",2);
  5878. if(writer.output())
  5879. {
  5880. QFileInfo info(filename);
  5881. QDir directory= info.dir();
  5882. lastDir= directory.path();
  5883. settings.setValue("lastDirectory",lastDir);
  5884. }
  5885. }
  5886. /*:510*//*511:*/
  5887. #line 11637 "./typica.w"
  5888. void LogEditWindow::openXML()
  5889. {
  5890. QSettings settings;
  5891. QString lastDir= settings.value("lastDirectory").toString();
  5892. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  5893. lastDir,"",0);
  5894. if(filename.isNull())
  5895. {
  5896. return;
  5897. }
  5898. QFile file(filename);
  5899. XMLInput reader(&file,1);
  5900. connect(&reader,SIGNAL(measure(Measurement,int)),
  5901. model,SLOT(newMeasurement(Measurement,int)));
  5902. connect(&reader,SIGNAL(annotation(QString,int,int)),
  5903. model,SLOT(newAnnotation(QString,int,int)));
  5904. if(reader.input())
  5905. {
  5906. QFileInfo info(filename);
  5907. setWindowTitle(QString(tr("%1 - %2")).
  5908. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  5909. QDir directory= info.dir();
  5910. lastDir= directory.path();
  5911. settings.setValue("lastDirectory",lastDir);
  5912. }
  5913. }
  5914. /*:511*//*512:*/
  5915. #line 11668 "./typica.w"
  5916. void LogEditWindow::closeEvent(QCloseEvent*event)
  5917. {
  5918. QSettings settings;
  5919. settings.setValue("logSize",size());
  5920. settings.setValue("logPos",pos());
  5921. event->accept();
  5922. }
  5923. /*:512*/
  5924. #line 557 "./typica.w"
  5925. /*518:*/
  5926. #line 11783 "./typica.w"
  5927. bool XMLOutput::output()
  5928. {
  5929. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5930. {
  5931. return false;
  5932. }
  5933. QXmlStreamWriter xmlout(out);
  5934. xmlout.writeStartDocument("1.0");
  5935. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  5936. xmlout.writeStartElement("roastlog");
  5937. /*519:*/
  5938. #line 11816 "./typica.w"
  5939. foreach(int c,temperatureColumns.keys())
  5940. {
  5941. xmlout.writeStartElement("tempseries");
  5942. xmlout.writeAttribute("name",temperatureColumns.value(c));
  5943. xmlout.writeEndElement();
  5944. }
  5945. foreach(int c,controlColumns.keys())
  5946. {
  5947. xmlout.writeStartElement("controlseries");
  5948. xmlout.writeAttribute("name",controlColumns.value(c));
  5949. xmlout.writeEndElement();
  5950. }
  5951. foreach(int c,annotationColumns.keys())
  5952. {
  5953. xmlout.writeStartElement("noteseries");
  5954. xmlout.writeAttribute("name",annotationColumns.value(c));
  5955. xmlout.writeEndElement();
  5956. }
  5957. /*:519*/
  5958. #line 11794 "./typica.w"
  5959. xmlout.writeStartElement("roast");
  5960. bool oresult;
  5961. for(int i= 0;i<data->rowCount();i++)
  5962. {
  5963. /*520:*/
  5964. #line 11841 "./typica.w"
  5965. oresult= false;
  5966. foreach(int c,temperatureColumns.keys())
  5967. {
  5968. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5969. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5970. {
  5971. oresult= true;
  5972. break;
  5973. }
  5974. }
  5975. foreach(int c,controlColumns.keys())
  5976. {
  5977. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5978. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5979. {
  5980. oresult= true;
  5981. break;
  5982. }
  5983. }
  5984. if(oresult==false)
  5985. {
  5986. foreach(int c,annotationColumns.keys())
  5987. {
  5988. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5989. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5990. isEmpty()))
  5991. {
  5992. oresult= true;
  5993. break;
  5994. }
  5995. }
  5996. }
  5997. /*:520*/
  5998. #line 11799 "./typica.w"
  5999. if(oresult)
  6000. {
  6001. /*521:*/
  6002. #line 11880 "./typica.w"
  6003. xmlout.writeStartElement("tuple");
  6004. xmlout.writeTextElement("time",data->data(data->index(i,time),
  6005. Qt::DisplayRole).toString());
  6006. foreach(int c,temperatureColumns.keys())
  6007. {
  6008. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6009. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6010. {
  6011. xmlout.writeStartElement("temperature");
  6012. xmlout.writeAttribute("series",temperatureColumns.value(c));
  6013. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  6014. {
  6015. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  6016. {
  6017. xmlout.writeAttribute("relative","true");
  6018. }
  6019. }
  6020. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6021. toString());
  6022. xmlout.writeEndElement();
  6023. }
  6024. }
  6025. foreach(int c,controlColumns.keys())
  6026. {
  6027. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6028. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6029. {
  6030. xmlout.writeStartElement("control");
  6031. xmlout.writeAttribute("series",controlColumns.value(c));
  6032. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  6033. xmlout.writeEndElement();
  6034. }
  6035. }
  6036. foreach(int c,annotationColumns.keys())
  6037. {
  6038. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6039. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6040. {
  6041. xmlout.writeStartElement("annotation");
  6042. xmlout.writeAttribute("series",annotationColumns.value(c));
  6043. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6044. toString());
  6045. xmlout.writeEndElement();
  6046. }
  6047. }
  6048. xmlout.writeEndElement();
  6049. /*:521*/
  6050. #line 11802 "./typica.w"
  6051. }
  6052. }
  6053. xmlout.writeEndElement();
  6054. xmlout.writeEndElement();
  6055. xmlout.writeEndDocument();
  6056. out->close();
  6057. return true;
  6058. }
  6059. /*:518*//*522:*/
  6060. #line 11930 "./typica.w"
  6061. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  6062. :QObject(NULL),data(model),out(device),time(timec)
  6063. {
  6064. }
  6065. void XMLOutput::setModel(MeasurementModel*model)
  6066. {
  6067. data= model;
  6068. }
  6069. void XMLOutput::setTimeColumn(int column)
  6070. {
  6071. time= column;
  6072. }
  6073. void XMLOutput::setDevice(QIODevice*device)
  6074. {
  6075. out= device;
  6076. }
  6077. /*:522*//*523:*/
  6078. #line 11959 "./typica.w"
  6079. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  6080. {
  6081. temperatureColumns.insert(column,series);
  6082. }
  6083. void XMLOutput::addControlColumn(const QString&series,int column)
  6084. {
  6085. controlColumns.insert(column,series);
  6086. }
  6087. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  6088. {
  6089. annotationColumns.insert(column,series);
  6090. }
  6091. /*:523*/
  6092. #line 558 "./typica.w"
  6093. /*525:*/
  6094. #line 12016 "./typica.w"
  6095. bool XMLInput::input()
  6096. {
  6097. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  6098. {
  6099. return false;
  6100. }
  6101. QXmlStreamReader xmlin(in);
  6102. QMap<QString,int> temperatureColumns;
  6103. QMap<QString,int> annotationColumns;
  6104. int nextColumn= firstc;
  6105. /*526:*/
  6106. #line 12047 "./typica.w"
  6107. while(!xmlin.isDTD())
  6108. {
  6109. xmlin.readNext();
  6110. }
  6111. if(xmlin.isDTD())
  6112. {
  6113. if(xmlin.text()=="<!DOCTYPE roastlog>")
  6114. {
  6115. /*527:*/
  6116. #line 12069 "./typica.w"
  6117. emit newTemperatureColumn(firstc,"Bean");
  6118. emit newAnnotationColumn(firstc+1,"Note");
  6119. emit lastColumn(firstc+1);
  6120. /*:527*/
  6121. #line 12056 "./typica.w"
  6122. }
  6123. else
  6124. {
  6125. xmlin.readNext();
  6126. /*528:*/
  6127. #line 12078 "./typica.w"
  6128. while(xmlin.name()!="roast")
  6129. {
  6130. if(xmlin.isStartElement())
  6131. {
  6132. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  6133. {
  6134. temperatureColumns.insert(xmlin.attributes().value("name").
  6135. toString(),
  6136. nextColumn);
  6137. emit newTemperatureColumn(nextColumn,
  6138. xmlin.attributes().value("name").
  6139. toString());
  6140. nextColumn++;
  6141. }
  6142. else if(xmlin.name()=="noteseries")
  6143. {
  6144. annotationColumns.insert(xmlin.attributes().value("name").
  6145. toString(),nextColumn);
  6146. emit newAnnotationColumn(nextColumn,
  6147. xmlin.attributes().value("name").
  6148. toString());
  6149. nextColumn++;
  6150. }
  6151. }
  6152. xmlin.readNext();
  6153. }
  6154. emit lastColumn(nextColumn-1);
  6155. /*:528*/
  6156. #line 12061 "./typica.w"
  6157. }
  6158. }
  6159. /*:526*/
  6160. #line 12027 "./typica.w"
  6161. QTime timeval= QTime();
  6162. double tempval= 0;
  6163. QString noteval= QString();
  6164. int column;
  6165. int counter= 0;
  6166. while(!xmlin.atEnd())
  6167. {
  6168. /*529:*/
  6169. #line 12119 "./typica.w"
  6170. xmlin.readNext();
  6171. if(xmlin.isStartElement())
  6172. {
  6173. /*530:*/
  6174. #line 12145 "./typica.w"
  6175. if(xmlin.name()=="time")
  6176. {
  6177. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  6178. }
  6179. else if(xmlin.name()=="temperature")
  6180. {
  6181. column= xmlin.attributes().hasAttribute("series")?
  6182. temperatureColumns.value(xmlin.attributes().value("series").toString()):firstc;
  6183. bool relative= (xmlin.attributes().value("relative")=="true");
  6184. tempval= xmlin.readElementText().toDouble();
  6185. Measurement measurement(tempval,timeval);
  6186. if(relative)
  6187. {
  6188. measurement.insert("relative",true);
  6189. }
  6190. emit measure(measurement,column);
  6191. }
  6192. else if(xmlin.name()=="control")
  6193. {
  6194. column= xmlin.attributes().value("series").toString().isEmpty()?
  6195. firstc:temperatureColumns.value(xmlin.attributes().
  6196. value("series").toString());
  6197. tempval= xmlin.readElementText().toDouble();
  6198. Measurement measurement(tempval,timeval,Units::Unitless);
  6199. emit measure(measurement,column);
  6200. }
  6201. else if(xmlin.name()=="annotation")
  6202. {
  6203. column= xmlin.attributes().value("series").toString().isEmpty()?
  6204. firstc+1:annotationColumns.value(xmlin.attributes().
  6205. value("series").toString());
  6206. noteval= xmlin.readElementText();
  6207. if(!noteval.isEmpty())
  6208. {
  6209. emit annotation(noteval,firstc,column);
  6210. }
  6211. }
  6212. /*:530*/
  6213. #line 12123 "./typica.w"
  6214. }
  6215. counter++;
  6216. if(counter%100==0)
  6217. {
  6218. QCoreApplication::processEvents();
  6219. }
  6220. /*:529*/
  6221. #line 12035 "./typica.w"
  6222. }
  6223. return true;
  6224. }
  6225. /*:525*//*531:*/
  6226. #line 12186 "./typica.w"
  6227. XMLInput::XMLInput(QIODevice*input,int c):
  6228. firstc(c),in(input)
  6229. {
  6230. }
  6231. void XMLInput::setFirstColumn(int column)
  6232. {
  6233. firstc= column;
  6234. }
  6235. void XMLInput::setDevice(QIODevice*device)
  6236. {
  6237. in= device;
  6238. }
  6239. /*:531*/
  6240. #line 559 "./typica.w"
  6241. /*536:*/
  6242. #line 12277 "./typica.w"
  6243. bool CSVOutput::output()
  6244. {
  6245. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6246. {
  6247. return false;
  6248. }
  6249. QTextStream output(out);
  6250. /*537:*/
  6251. #line 12301 "./typica.w"
  6252. output<<"Time";
  6253. foreach(int c,temperatureColumns.keys())
  6254. {
  6255. output<<','<<temperatureColumns.value(c);
  6256. }
  6257. foreach(int c,controlColumns.keys())
  6258. {
  6259. output<<','<<controlColumns.value(c);
  6260. }
  6261. foreach(int c,annotationColumns.keys())
  6262. {
  6263. output<<','<<annotationColumns.value(c);
  6264. }
  6265. output<<'\n';
  6266. /*:537*/
  6267. #line 12285 "./typica.w"
  6268. bool oresult;
  6269. for(int i= 0;i<data->rowCount();i++)
  6270. {
  6271. /*520:*/
  6272. #line 11841 "./typica.w"
  6273. oresult= false;
  6274. foreach(int c,temperatureColumns.keys())
  6275. {
  6276. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6277. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6278. {
  6279. oresult= true;
  6280. break;
  6281. }
  6282. }
  6283. foreach(int c,controlColumns.keys())
  6284. {
  6285. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6286. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6287. {
  6288. oresult= true;
  6289. break;
  6290. }
  6291. }
  6292. if(oresult==false)
  6293. {
  6294. foreach(int c,annotationColumns.keys())
  6295. {
  6296. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6297. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6298. isEmpty()))
  6299. {
  6300. oresult= true;
  6301. break;
  6302. }
  6303. }
  6304. }
  6305. /*:520*/
  6306. #line 12289 "./typica.w"
  6307. if(oresult)
  6308. {
  6309. /*538:*/
  6310. #line 12326 "./typica.w"
  6311. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6312. foreach(int c,temperatureColumns.keys())
  6313. {
  6314. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6315. }
  6316. foreach(int c,controlColumns.keys())
  6317. {
  6318. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6319. }
  6320. foreach(int c,annotationColumns.keys())
  6321. {
  6322. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6323. }
  6324. output<<'\n';
  6325. /*:538*/
  6326. #line 12292 "./typica.w"
  6327. }
  6328. }
  6329. out->close();
  6330. return true;
  6331. }
  6332. /*:536*//*539:*/
  6333. #line 12345 "./typica.w"
  6334. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6335. data(model),out(device),time(timec)
  6336. {
  6337. }
  6338. void CSVOutput::setModel(MeasurementModel*model)
  6339. {
  6340. data= model;
  6341. }
  6342. void CSVOutput::setTimeColumn(int column)
  6343. {
  6344. time= column;
  6345. }
  6346. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6347. {
  6348. temperatureColumns.insert(column,series);
  6349. }
  6350. void CSVOutput::addControlColumn(const QString&series,int column)
  6351. {
  6352. controlColumns.insert(column,series);
  6353. }
  6354. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6355. {
  6356. annotationColumns.insert(column,series);
  6357. }
  6358. void CSVOutput::setDevice(QIODevice*device)
  6359. {
  6360. out= device;
  6361. }
  6362. #line 1 "./webview.w"
  6363. /*:539*/
  6364. #line 560 "./typica.w"
  6365. /*574:*/
  6366. #line 12606 "./typica.w"
  6367. QString SaltModel::arrayLiteral(int column,int role)const
  6368. {
  6369. QString literal= "'{";
  6370. for(int i= 0;i<rowCount();i++)
  6371. {
  6372. QString datum= data(index(i,column),role).toString();
  6373. if(!datum.isEmpty())
  6374. {
  6375. literal.append(datum);
  6376. literal.append(", ");
  6377. }
  6378. }
  6379. if(literal.size()> 2)
  6380. {
  6381. literal.chop(2);
  6382. }
  6383. literal.append("}'");
  6384. return literal;
  6385. }
  6386. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6387. {
  6388. QString literal= "'{";
  6389. for(int i= 0;i<rowCount();i++)
  6390. {
  6391. QString datum= data(index(i,column),role).toString();
  6392. if(!datum.isEmpty())
  6393. {
  6394. literal.append("\"");
  6395. literal.append(datum);
  6396. literal.append("\", ");
  6397. }
  6398. }
  6399. if(literal.size()> 2)
  6400. {
  6401. literal.chop(2);
  6402. }
  6403. literal.append("}'");
  6404. return literal;
  6405. }
  6406. /*:574*//*575:*/
  6407. #line 12650 "./typica.w"
  6408. QModelIndex SaltModel::parent(const QModelIndex&)const
  6409. {
  6410. return QModelIndex();
  6411. }
  6412. /*:575*//*576:*/
  6413. #line 12669 "./typica.w"
  6414. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6415. int role)
  6416. {
  6417. /*577:*/
  6418. #line 12700 "./typica.w"
  6419. bool valid= false;
  6420. if(index.isValid())
  6421. {
  6422. if(index.row()<modelData.size())
  6423. {
  6424. if(index.column()<colcount)
  6425. {
  6426. valid= true;
  6427. }
  6428. }
  6429. }
  6430. /*:577*/
  6431. #line 12673 "./typica.w"
  6432. if(!valid)
  6433. {
  6434. return false;
  6435. }
  6436. if(index.row()==modelData.size()-1)
  6437. {
  6438. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6439. /*578:*/
  6440. #line 12716 "./typica.w"
  6441. QList<QMap<int,QVariant> > newRow;
  6442. QMap<int,QVariant> defaults;
  6443. for(int i= 0;i<colcount;i++)
  6444. {
  6445. newRow.append(defaults);
  6446. }
  6447. modelData.append(newRow);
  6448. /*:578*/
  6449. #line 12681 "./typica.w"
  6450. endInsertRows();
  6451. }
  6452. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6453. QMap<int,QVariant> cell= row.at(index.column());
  6454. cell.insert(role,value);
  6455. if(role==Qt::EditRole)
  6456. {
  6457. cell.insert(Qt::DisplayRole,value);
  6458. }
  6459. row.replace(index.column(),cell);
  6460. modelData.replace(index.row(),row);
  6461. emit dataChanged(index,index);
  6462. return true;
  6463. }
  6464. /*:576*//*579:*/
  6465. #line 12727 "./typica.w"
  6466. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  6467. {
  6468. for(int i= 0;i<columns;i++)
  6469. {
  6470. hData<<"";
  6471. }
  6472. /*578:*/
  6473. #line 12716 "./typica.w"
  6474. QList<QMap<int,QVariant> > newRow;
  6475. QMap<int,QVariant> defaults;
  6476. for(int i= 0;i<colcount;i++)
  6477. {
  6478. newRow.append(defaults);
  6479. }
  6480. modelData.append(newRow);
  6481. /*:578*/
  6482. #line 12734 "./typica.w"
  6483. }
  6484. /*:579*//*580:*/
  6485. #line 12739 "./typica.w"
  6486. SaltModel::~SaltModel()
  6487. {
  6488. }
  6489. /*:580*//*581:*/
  6490. #line 12749 "./typica.w"
  6491. int SaltModel::rowCount(const QModelIndex&parent)const
  6492. {
  6493. return(parent==QModelIndex()?modelData.size():0);
  6494. }
  6495. int SaltModel::columnCount(const QModelIndex&parent)const
  6496. {
  6497. return(parent==QModelIndex()?colcount:0);
  6498. }
  6499. /*:581*//*582:*/
  6500. #line 12762 "./typica.w"
  6501. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  6502. const QVariant&value,int)
  6503. {
  6504. if(orientation==Qt::Horizontal&&section<colcount)
  6505. {
  6506. hData.replace(section,value.toString());
  6507. emit headerDataChanged(orientation,section,section);
  6508. return true;
  6509. }
  6510. return false;
  6511. }
  6512. /*:582*//*583:*/
  6513. #line 12777 "./typica.w"
  6514. QVariant SaltModel::data(const QModelIndex&index,int role)const
  6515. {
  6516. /*577:*/
  6517. #line 12700 "./typica.w"
  6518. bool valid= false;
  6519. if(index.isValid())
  6520. {
  6521. if(index.row()<modelData.size())
  6522. {
  6523. if(index.column()<colcount)
  6524. {
  6525. valid= true;
  6526. }
  6527. }
  6528. }
  6529. /*:577*/
  6530. #line 12780 "./typica.w"
  6531. if(!valid)
  6532. {
  6533. return QVariant();
  6534. }
  6535. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6536. QMap<int,QVariant> cell= row.at(index.column());
  6537. return cell.value(role,QVariant());
  6538. }
  6539. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  6540. int role)const
  6541. {
  6542. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  6543. section<colcount)
  6544. {
  6545. return QVariant(hData.at(section));
  6546. }
  6547. return QVariant();
  6548. }
  6549. /*:583*//*584:*/
  6550. #line 12804 "./typica.w"
  6551. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  6552. {
  6553. /*577:*/
  6554. #line 12700 "./typica.w"
  6555. bool valid= false;
  6556. if(index.isValid())
  6557. {
  6558. if(index.row()<modelData.size())
  6559. {
  6560. if(index.column()<colcount)
  6561. {
  6562. valid= true;
  6563. }
  6564. }
  6565. }
  6566. /*:577*/
  6567. #line 12807 "./typica.w"
  6568. if(valid)
  6569. {
  6570. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  6571. }
  6572. return 0;
  6573. }
  6574. /*:584*//*585:*/
  6575. #line 12818 "./typica.w"
  6576. QModelIndex SaltModel::index(int row,int column,
  6577. const QModelIndex&parent)const
  6578. {
  6579. if(parent==QModelIndex())
  6580. {
  6581. if(row<modelData.size()&&column<colcount)
  6582. {
  6583. return createIndex(row,column);
  6584. }
  6585. }
  6586. return QModelIndex();
  6587. }
  6588. /*:585*//*586:*/
  6589. #line 12836 "./typica.w"
  6590. void SaltModel::clear()
  6591. {
  6592. beginResetModel();
  6593. modelData.clear();
  6594. /*578:*/
  6595. #line 12716 "./typica.w"
  6596. QList<QMap<int,QVariant> > newRow;
  6597. QMap<int,QVariant> defaults;
  6598. for(int i= 0;i<colcount;i++)
  6599. {
  6600. newRow.append(defaults);
  6601. }
  6602. modelData.append(newRow);
  6603. /*:578*/
  6604. #line 12841 "./typica.w"
  6605. endResetModel();
  6606. }
  6607. /*:586*//*587:*/
  6608. #line 12850 "./typica.w"
  6609. bool SaltModel::removeRows(int row,int count,
  6610. const QModelIndex&parent)
  6611. {
  6612. if(parent==QModelIndex())
  6613. {
  6614. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  6615. {
  6616. beginRemoveRows(parent,row,row+count-1);
  6617. for(int i= 0;i<count;i++)
  6618. {
  6619. modelData.removeAt(row);
  6620. }
  6621. endRemoveRows();
  6622. if(modelData.size()==0)
  6623. {
  6624. beginInsertRows(parent,0,0);
  6625. /*578:*/
  6626. #line 12716 "./typica.w"
  6627. QList<QMap<int,QVariant> > newRow;
  6628. QMap<int,QVariant> defaults;
  6629. for(int i= 0;i<colcount;i++)
  6630. {
  6631. newRow.append(defaults);
  6632. }
  6633. modelData.append(newRow);
  6634. /*:578*/
  6635. #line 12867 "./typica.w"
  6636. endInsertRows();
  6637. }
  6638. return true;
  6639. }
  6640. }
  6641. return false;
  6642. }
  6643. /*:587*//*588:*/
  6644. #line 12881 "./typica.w"
  6645. int SaltModel::findData(const QVariant&value,int column,int role)
  6646. {
  6647. for(int i= 0;i<modelData.size();i++)
  6648. {
  6649. if(modelData.at(i).size()> column)
  6650. {
  6651. if(modelData.at(i).at(column).contains(role))
  6652. {
  6653. if(modelData.at(i).at(column).value(role)==value)
  6654. {
  6655. return i;
  6656. }
  6657. }
  6658. }
  6659. }
  6660. return-1;
  6661. }
  6662. /*:588*/
  6663. #line 561 "./typica.w"
  6664. /*590:*/
  6665. #line 12945 "./typica.w"
  6666. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  6667. {
  6668. SqlComboBox*widget= new SqlComboBox();
  6669. widget->setParent(parent);
  6670. for(int i= 0;i<count();i++)
  6671. {
  6672. widget->addItem(itemText(i),itemData(i));
  6673. }
  6674. return widget;
  6675. }
  6676. /*:590*//*591:*/
  6677. #line 12962 "./typica.w"
  6678. void SqlComboBox::showData(bool show)
  6679. {
  6680. dataColumnShown= show;
  6681. }
  6682. /*:591*//*592:*/
  6683. #line 12976 "./typica.w"
  6684. void SqlComboBox::addNullOption()
  6685. {
  6686. addItem(specialNullText,specialNullData);
  6687. }
  6688. void SqlComboBox::setNullText(QString nullText)
  6689. {
  6690. specialNullText= nullText;
  6691. }
  6692. void SqlComboBox::setNullData(QVariant nullData)
  6693. {
  6694. specialNullData= nullData;
  6695. }
  6696. /*:592*//*593:*/
  6697. #line 12999 "./typica.w"
  6698. void SqlComboBox::setDataColumn(int column)
  6699. {
  6700. dataColumn= column;
  6701. }
  6702. void SqlComboBox::setDisplayColumn(int column)
  6703. {
  6704. displayColumn= column;
  6705. }
  6706. /*:593*//*594:*/
  6707. #line 13013 "./typica.w"
  6708. void SqlComboBox::addSqlOptions(QString query)
  6709. {
  6710. SqlQueryConnection h;
  6711. QSqlQuery*dbquery= h.operator->();
  6712. if(!dbquery->exec(query))
  6713. {
  6714. QSqlError error= dbquery->lastError();
  6715. qDebug()<<error.databaseText();
  6716. qDebug()<<error.driverText();
  6717. qDebug()<<error.text();
  6718. qDebug()<<dbquery->lastQuery();
  6719. }
  6720. while(dbquery->next())
  6721. {
  6722. QString displayValue(dbquery->value(displayColumn).toString());
  6723. QString dataValue(dbquery->value(dataColumn).toString());
  6724. if(dataColumnShown)
  6725. {
  6726. displayValue.append(QString(" (%1)").arg(dataValue));
  6727. }
  6728. addItem(displayValue,dataValue);
  6729. }
  6730. }
  6731. /*:594*//*595:*/
  6732. #line 13049 "./typica.w"
  6733. SqlComboBox::SqlComboBox():
  6734. dataColumn(0),displayColumn(0),dataColumnShown(false),
  6735. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  6736. {
  6737. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  6738. }
  6739. SqlComboBox::~SqlComboBox()
  6740. {
  6741. }
  6742. /*:595*/
  6743. #line 562 "./typica.w"
  6744. /*597:*/
  6745. #line 13088 "./typica.w"
  6746. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  6747. {
  6748. delegate= widget;
  6749. }
  6750. /*:597*//*598:*/
  6751. #line 13097 "./typica.w"
  6752. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  6753. const QStyleOptionViewItem&,
  6754. const QModelIndex&)const
  6755. {
  6756. return delegate->clone(parent);
  6757. }
  6758. /*:598*//*599:*/
  6759. #line 13108 "./typica.w"
  6760. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  6761. const QModelIndex&index)const
  6762. {
  6763. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6764. self->setCurrentIndex(self->findData(
  6765. index.model()->data(index,
  6766. Qt::UserRole).toString()));
  6767. }
  6768. /*:599*//*600:*/
  6769. #line 13121 "./typica.w"
  6770. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  6771. QAbstractItemModel*model,
  6772. const QModelIndex&index)const
  6773. {
  6774. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6775. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  6776. Qt::UserRole);
  6777. model->setData(index,self->currentText(),Qt::DisplayRole);
  6778. }
  6779. /*:600*//*601:*/
  6780. #line 13134 "./typica.w"
  6781. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  6782. const QStyleOptionViewItem&option,
  6783. const QModelIndex&)const
  6784. {
  6785. editor->setGeometry(option.rect);
  6786. }
  6787. /*:601*//*602:*/
  6788. #line 13145 "./typica.w"
  6789. QSize SqlComboBoxDelegate::sizeHint()const
  6790. {
  6791. return delegate->sizeHint();
  6792. }
  6793. /*:602*//*603:*/
  6794. #line 13153 "./typica.w"
  6795. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  6796. :QItemDelegate(parent)
  6797. {
  6798. }
  6799. /*:603*/
  6800. #line 563 "./typica.w"
  6801. /*566:*/
  6802. #line 12415 "./typica.w"
  6803. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  6804. {
  6805. /*567:*/
  6806. #line 12430 "./typica.w"
  6807. setOrganizationName("Wilson's Coffee & Tea");
  6808. setOrganizationDomain("wilsonscoffee.com");
  6809. setApplicationName(PROGRAM_NAME);
  6810. /*:567*/
  6811. #line 12418 "./typica.w"
  6812. /*568:*/
  6813. #line 12439 "./typica.w"
  6814. QTranslator base;
  6815. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  6816. {
  6817. installTranslator(&base);
  6818. }
  6819. QTranslator app;
  6820. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  6821. {
  6822. installTranslator(&app);
  6823. }
  6824. /*:568*/
  6825. #line 12419 "./typica.w"
  6826. /*285:*/
  6827. #line 123 "./measurement.w"
  6828. qRegisterMetaType<Measurement> ("Measurement");
  6829. /*:285*/
  6830. #line 12420 "./typica.w"
  6831. /*774:*/
  6832. #line 16373 "./typica.w"
  6833. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  6834. tr("NI DAQmx Base"),
  6835. "nidaqmxbase",NULL);
  6836. topLevelNodeInserters.append(inserter);
  6837. /*:774*//*782:*/
  6838. #line 16604 "./typica.w"
  6839. #ifdef Q_OS_WIN32
  6840. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  6841. topLevelNodeInserters.append(inserter);
  6842. #endif
  6843. /*:782*//*806:*/
  6844. #line 17567 "./typica.w"
  6845. #if 0
  6846. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  6847. topLevelNodeInserters.append(inserter);
  6848. #endif
  6849. /*:806*//*855:*/
  6850. #line 19080 "./typica.w"
  6851. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  6852. topLevelNodeInserters.append(inserter);
  6853. #line 1 "./unsupportedserial.w"
  6854. /*:855*//*865:*/
  6855. #line 272 "./unsupportedserial.w"
  6856. inserter= new NodeInserter(tr("Other Device"),tr("Other Device"),
  6857. "unsupporteddevice",NULL);
  6858. topLevelNodeInserters.append(inserter);
  6859. /*:865*//*899:*/
  6860. #line 190 "./phidgets.w"
  6861. QLibrary phidgetsCheck("phidget21");
  6862. if(phidgetsCheck.load())
  6863. {
  6864. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  6865. "phidgets1048",NULL);
  6866. topLevelNodeInserters.append(inserter);
  6867. phidgetsCheck.unload();
  6868. }
  6869. else
  6870. {
  6871. phidgetsCheck.setFileName("Phidget21.framework/Phidget21");
  6872. if(phidgetsCheck.load())
  6873. {
  6874. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  6875. "phidgets1048",NULL);
  6876. topLevelNodeInserters.append(inserter);
  6877. phidgetsCheck.unload();
  6878. }
  6879. }
  6880. /*:899*//*990:*/
  6881. #line 1241 "./dataqsdk.w"
  6882. #ifdef Q_OS_WIN32
  6883. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  6884. "dataqsdk",NULL);
  6885. topLevelNodeInserters.append(inserter);
  6886. #endif
  6887. #line 19730 "./typica.w"
  6888. #line 1 "./scales.w"
  6889. /*:990*//*1015:*/
  6890. #line 495 "./scales.w"
  6891. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  6892. topLevelNodeInserters.append(inserter);
  6893. #line 19732 "./typica.w"
  6894. #line 1 "./valueannotation.w"
  6895. /*:1015*/
  6896. #line 12421 "./typica.w"
  6897. }
  6898. /*:566*//*570:*/
  6899. #line 12462 "./typica.w"
  6900. QDomDocument*Application::configuration()
  6901. {
  6902. return&conf;
  6903. }
  6904. /*:570*//*571:*/
  6905. #line 12471 "./typica.w"
  6906. QSqlDatabase Application::database()
  6907. {
  6908. QString connectionName;
  6909. QSqlDatabase connection=
  6910. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  6911. do
  6912. {
  6913. connectionName= QUuid::createUuid().toString();
  6914. }while(QSqlDatabase::connectionNames().contains(connectionName));
  6915. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  6916. }
  6917. /*:571*//*709:*/
  6918. #line 14957 "./typica.w"
  6919. void Application::saveDeviceConfiguration()
  6920. {
  6921. QSettings settings;
  6922. settings.setValue("DeviceConfiguration",
  6923. QVariant(deviceConfigurationDocument.toByteArray()));
  6924. }
  6925. /*:709*//*710:*/
  6926. #line 14969 "./typica.w"
  6927. QDomDocument Application::deviceConfiguration()
  6928. {
  6929. if(deviceConfigurationDocument.isNull())
  6930. {
  6931. /*711:*/
  6932. #line 14983 "./typica.w"
  6933. QSettings settings;
  6934. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  6935. QString etext;
  6936. int eline;
  6937. int ecol;
  6938. if(document.length()==0)
  6939. {
  6940. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  6941. /*712:*/
  6942. #line 15007 "./typica.w"
  6943. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6944. emptyDocument.open(QIODevice::ReadOnly);
  6945. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6946. &etext,&eline,&ecol))
  6947. {
  6948. /*713:*/
  6949. #line 15024 "./typica.w"
  6950. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6951. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6952. qDebug()<<etext;
  6953. /*:713*/
  6954. #line 15013 "./typica.w"
  6955. }
  6956. else
  6957. {
  6958. saveDeviceConfiguration();
  6959. }
  6960. /*:712*/
  6961. #line 14992 "./typica.w"
  6962. }
  6963. else
  6964. {
  6965. if(!deviceConfigurationDocument.setContent(document,false,
  6966. &etext,&eline,&ecol))
  6967. {
  6968. /*713:*/
  6969. #line 15024 "./typica.w"
  6970. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6971. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6972. qDebug()<<etext;
  6973. /*:713*/
  6974. #line 14999 "./typica.w"
  6975. /*712:*/
  6976. #line 15007 "./typica.w"
  6977. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6978. emptyDocument.open(QIODevice::ReadOnly);
  6979. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6980. &etext,&eline,&ecol))
  6981. {
  6982. /*713:*/
  6983. #line 15024 "./typica.w"
  6984. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6985. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6986. qDebug()<<etext;
  6987. /*:713*/
  6988. #line 15013 "./typica.w"
  6989. }
  6990. else
  6991. {
  6992. saveDeviceConfiguration();
  6993. }
  6994. /*:712*/
  6995. #line 15000 "./typica.w"
  6996. }
  6997. }
  6998. /*:711*/
  6999. #line 14974 "./typica.w"
  7000. }
  7001. return deviceConfigurationDocument;
  7002. }
  7003. /*:710*//*741:*/
  7004. #line 15625 "./typica.w"
  7005. void Application::registerDeviceConfigurationWidget(QString driver,
  7006. QMetaObject widget)
  7007. {
  7008. deviceConfigurationWidgets.insert(driver,widget);
  7009. }
  7010. /*:741*//*742:*/
  7011. #line 15641 "./typica.w"
  7012. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  7013. const QModelIndex&index)
  7014. {
  7015. QVariant nodeReference= index.data(Qt::UserRole);
  7016. QDomElement referenceElement= model->referenceElement(
  7017. model->data(index,Qt::UserRole).toString());
  7018. QMetaObject metaObject=
  7019. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  7020. QWidget::staticMetaObject);
  7021. QWidget*editor;
  7022. if(metaObject.className()==QWidget::staticMetaObject.className())
  7023. {
  7024. editor= NULL;
  7025. }
  7026. else
  7027. {
  7028. editor= qobject_cast<QWidget*> (
  7029. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  7030. Q_ARG(QModelIndex,index)));
  7031. }
  7032. return editor;
  7033. }
  7034. /*:742*/
  7035. #line 564 "./typica.w"
  7036. /*612:*/
  7037. #line 13300 "./typica.w"
  7038. SqlConnectionSetup::SqlConnectionSetup():
  7039. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  7040. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  7041. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  7042. cancelButton(new QPushButton(tr("Cancel"))),
  7043. connectButton(new QPushButton(tr("Connect")))
  7044. {
  7045. driver->addItem("PostgreSQL","QPSQL");
  7046. formLayout->addRow(tr("Database driver:"),driver);
  7047. formLayout->addRow(tr("Host name:"),hostname);
  7048. formLayout->addRow(tr("Database name:"),dbname);
  7049. formLayout->addRow(tr("User name:"),user);
  7050. password->setEchoMode(QLineEdit::Password);
  7051. formLayout->addRow(tr("Password:"),password);
  7052. layout->addLayout(formLayout);
  7053. buttons->addStretch(1);
  7054. buttons->addWidget(cancelButton);
  7055. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  7056. buttons->addWidget(connectButton);
  7057. layout->addLayout(buttons);
  7058. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  7059. setLayout(layout);
  7060. setModal(true);
  7061. }
  7062. SqlConnectionSetup::~SqlConnectionSetup()
  7063. {
  7064. }
  7065. /*:612*//*613:*/
  7066. #line 13334 "./typica.w"
  7067. void SqlConnectionSetup::testConnection()
  7068. {
  7069. QSqlDatabase database=
  7070. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  7071. toString());
  7072. database.setConnectOptions("application_name=Typica");
  7073. database.setHostName(hostname->text());
  7074. database.setDatabaseName(dbname->text());
  7075. database.setUserName(user->text());
  7076. database.setPassword(password->text());
  7077. if(database.open())
  7078. {
  7079. QSettings settings;
  7080. settings.setValue("database/exists","true");
  7081. settings.setValue("database/driver",
  7082. driver->itemData(driver->currentIndex()).toString());
  7083. settings.setValue("database/hostname",hostname->text());
  7084. settings.setValue("database/dbname",dbname->text());
  7085. settings.setValue("database/user",user->text());
  7086. settings.setValue("database/password",password->text());
  7087. database.close();
  7088. accept();
  7089. }
  7090. else
  7091. {
  7092. QMessageBox::information(this,tr("Database connection failed"),
  7093. tr("Failed to connect to database."));
  7094. }
  7095. }
  7096. /*:613*/
  7097. #line 565 "./typica.w"
  7098. /*617:*/
  7099. #line 13436 "./typica.w"
  7100. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  7101. {
  7102. setModel(new QSqlQueryModel);
  7103. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  7104. this,SLOT(openRow(QModelIndex)));
  7105. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  7106. this,SLOT(persistColumnResize(int,int,int)));
  7107. }
  7108. /*:617*//*618:*/
  7109. #line 13451 "./typica.w"
  7110. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  7111. {
  7112. /*619:*/
  7113. #line 13460 "./typica.w"
  7114. QSettings settings;
  7115. /*620:*/
  7116. #line 13473 "./typica.w"
  7117. QWidget*topLevelWidget= this;
  7118. while(topLevelWidget->parentWidget())
  7119. {
  7120. topLevelWidget= topLevelWidget->parentWidget();
  7121. }
  7122. /*:620*/
  7123. #line 13462 "./typica.w"
  7124. settings.setValue(QString("columnWidths/%1/%2/%3").
  7125. arg(topLevelWidget->objectName()).
  7126. arg(objectName()).arg(column),
  7127. QVariant(newsize));
  7128. /*:619*/
  7129. #line 13454 "./typica.w"
  7130. }
  7131. /*:618*//*621:*/
  7132. #line 13483 "./typica.w"
  7133. void SqlQueryView::showEvent(QShowEvent*event)
  7134. {
  7135. /*622:*/
  7136. #line 13493 "./typica.w"
  7137. QSettings settings;
  7138. /*620:*/
  7139. #line 13473 "./typica.w"
  7140. QWidget*topLevelWidget= this;
  7141. while(topLevelWidget->parentWidget())
  7142. {
  7143. topLevelWidget= topLevelWidget->parentWidget();
  7144. }
  7145. /*:620*/
  7146. #line 13495 "./typica.w"
  7147. QString baseKey=
  7148. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  7149. arg(objectName());
  7150. for(int i= 0;i<model()->columnCount();i++)
  7151. {
  7152. QString key= QString("%1/%2").arg(baseKey).arg(i);
  7153. if(settings.contains(key))
  7154. {
  7155. setColumnWidth(i,settings.value(key).toInt());
  7156. }
  7157. }
  7158. /*:622*/
  7159. #line 13486 "./typica.w"
  7160. event->accept();
  7161. }
  7162. /*:621*//*623:*/
  7163. #line 13510 "./typica.w"
  7164. void SqlQueryView::openRow(const QModelIndex&index)
  7165. {
  7166. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  7167. emit openEntryRow(index.row());
  7168. }
  7169. /*:623*//*624:*/
  7170. #line 13519 "./typica.w"
  7171. void SqlQueryView::setQuery(const QString&query)
  7172. {
  7173. QSqlDatabase database= AppInstance->database();
  7174. database.open();
  7175. QSqlQuery q(query,database);
  7176. ((QSqlQueryModel*)model())->setQuery(q);
  7177. database.close();
  7178. }
  7179. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  7180. const QVariant&value,int role)
  7181. {
  7182. return model()->setHeaderData(section,orientation,value,role);
  7183. }
  7184. /*:624*//*625:*/
  7185. #line 13537 "./typica.w"
  7186. QVariant SqlQueryView::data(int row,int column,int role)
  7187. {
  7188. return model()->data(model()->index(row,column),role);
  7189. }
  7190. /*:625*/
  7191. #line 566 "./typica.w"
  7192. /*161:*/
  7193. #line 3801 "./typica.w"
  7194. SqlQueryConnection::SqlQueryConnection(const QString&query)
  7195. {
  7196. QSqlDatabase database= AppInstance->database();
  7197. database.open();
  7198. q= new QSqlQuery(query,database);
  7199. connection= database.connectionName();
  7200. }
  7201. /*:161*//*162:*/
  7202. #line 3814 "./typica.w"
  7203. SqlQueryConnection::~SqlQueryConnection()
  7204. {
  7205. delete q;
  7206. {
  7207. QSqlDatabase database= QSqlDatabase::database(connection);
  7208. database.close();
  7209. }
  7210. QSqlDatabase::removeDatabase(connection);
  7211. }
  7212. /*:162*//*163:*/
  7213. #line 3828 "./typica.w"
  7214. QSqlQuery*SqlQueryConnection::operator->()const
  7215. {
  7216. return q;
  7217. }
  7218. /*:163*/
  7219. #line 567 "./typica.w"
  7220. /*644:*/
  7221. #line 13894 "./typica.w"
  7222. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  7223. area(frame),configuration(description)
  7224. {
  7225. refresh();
  7226. }
  7227. ReportTable::~ReportTable()
  7228. {
  7229. }
  7230. /*:644*//*645:*/
  7231. #line 13910 "./typica.w"
  7232. void ReportTable::bind(QString placeholder,QVariant value)
  7233. {
  7234. bindings.insert(placeholder,value);
  7235. }
  7236. /*:645*//*646:*/
  7237. #line 13920 "./typica.w"
  7238. void ReportTable::refresh()
  7239. {
  7240. /*647:*/
  7241. #line 13941 "./typica.w"
  7242. QTextCursor cursor= area->firstCursorPosition();
  7243. while(cursor<area->lastCursorPosition())
  7244. {
  7245. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  7246. }
  7247. cursor.removeSelectedText();
  7248. /*:647*/
  7249. #line 13923 "./typica.w"
  7250. int rows= 1;
  7251. int columns= 1;
  7252. int currentRow= 0;
  7253. QTextTable*table= cursor.insertTable(rows,columns);
  7254. /*648:*/
  7255. #line 13954 "./typica.w"
  7256. QTextTableFormat format= table->format();
  7257. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  7258. if(configuration.hasAttribute("align"))
  7259. {
  7260. if(configuration.attribute("align")=="center")
  7261. {
  7262. format.setAlignment(Qt::AlignHCenter);
  7263. }
  7264. }
  7265. table->setFormat(format);
  7266. /*:648*/
  7267. #line 13928 "./typica.w"
  7268. /*649:*/
  7269. #line 13968 "./typica.w"
  7270. QDomNodeList children= configuration.childNodes();
  7271. for(int i= 0;i<children.count();i++)
  7272. {
  7273. QDomNode current;
  7274. QDomElement currentElement;
  7275. current= children.at(i);
  7276. if(current.isElement())
  7277. {
  7278. currentElement= current.toElement();
  7279. if(currentElement.tagName()=="query")
  7280. {
  7281. /*650:*/
  7282. #line 13995 "./typica.w"
  7283. SqlQueryConnection h;
  7284. QSqlQuery*query= h.operator->();
  7285. query->prepare(currentElement.text());
  7286. foreach(QString key,bindings.uniqueKeys())
  7287. {
  7288. if(currentElement.text().contains(key))
  7289. {
  7290. query->bindValue(key,bindings.value(key));
  7291. }
  7292. }
  7293. query->exec();
  7294. if(!query->next())
  7295. {
  7296. continue;
  7297. }
  7298. if(query->record().count()> columns)
  7299. {
  7300. table->appendColumns(query->record().count()-columns);
  7301. }
  7302. do
  7303. {
  7304. table->appendRows(1);
  7305. rows++;
  7306. currentRow++;
  7307. for(int j= 0;j<query->record().count();j++)
  7308. {
  7309. QTextTableCell cell= table->cellAt(currentRow,j);
  7310. cursor= cell.firstCursorPosition();
  7311. cursor.insertText(query->value(j).toString());
  7312. }
  7313. }while(query->next());
  7314. /*:650*/
  7315. #line 13980 "./typica.w"
  7316. }
  7317. else if(currentElement.tagName()=="row")
  7318. {
  7319. /*651:*/
  7320. #line 14035 "./typica.w"
  7321. table->appendRows(1);
  7322. currentRow++;
  7323. rows++;
  7324. QDomNodeList rowChildren= currentElement.childNodes();
  7325. int currentColumn= 0;
  7326. for(int j= 0;j<rowChildren.count();j++)
  7327. {
  7328. QDomNode node;
  7329. QDomElement nodeElement;
  7330. node= rowChildren.at(j);
  7331. if(node.isElement())
  7332. {
  7333. nodeElement= node.toElement();
  7334. if(nodeElement.tagName()=="cell")
  7335. {
  7336. if(currentColumn==columns)
  7337. {
  7338. table->appendColumns(1);
  7339. columns++;
  7340. }
  7341. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7342. cursor= cell.firstCursorPosition();
  7343. cursor.insertText(nodeElement.text());
  7344. currentColumn++;
  7345. }
  7346. }
  7347. }
  7348. /*:651*/
  7349. #line 13984 "./typica.w"
  7350. }
  7351. }
  7352. }
  7353. /*:649*/
  7354. #line 13929 "./typica.w"
  7355. if(rows> 1)
  7356. {
  7357. table->removeRows(0,1);
  7358. }
  7359. }
  7360. /*:646*/
  7361. #line 568 "./typica.w"
  7362. /*677:*/
  7363. #line 14139 "./typica.w"
  7364. FormArray::FormArray(QDomElement description):configuration(description),
  7365. maxwidth(-1),maxheight(-1)
  7366. {
  7367. setWidget(&itemContainer);
  7368. itemContainer.setLayout(&itemLayout);
  7369. }
  7370. /*:677*//*678:*/
  7371. #line 14156 "./typica.w"
  7372. void FormArray::addElements(int copies)
  7373. {
  7374. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  7375. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  7376. QWidget*widget;
  7377. for(int i= 0;i<copies;i++)
  7378. {
  7379. widget= new QWidget;
  7380. if(maxwidth> -1)
  7381. {
  7382. widget->setMaximumWidth(maxwidth);
  7383. }
  7384. if(maxheight> -1)
  7385. {
  7386. widget->setMaximumHeight(maxheight);
  7387. }
  7388. if(configuration.hasChildNodes())
  7389. {
  7390. widgetStack->push(widget);
  7391. populateWidget(configuration,widgetStack,layoutStack);
  7392. widgetStack->pop();
  7393. widget->setMinimumHeight(widget->sizeHint().height());
  7394. itemLayout.addWidget(widget);
  7395. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  7396. {
  7397. itemContainer.setMinimumHeight(maxheight*elements()+50);
  7398. }
  7399. else
  7400. {
  7401. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  7402. +widget->sizeHint().height());
  7403. }
  7404. if(maxwidth> -1)
  7405. {
  7406. itemContainer.setMinimumWidth(maxwidth+50);
  7407. }
  7408. else
  7409. {
  7410. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  7411. }
  7412. }
  7413. }
  7414. }
  7415. /*:678*//*679:*/
  7416. #line 14206 "./typica.w"
  7417. QWidget*FormArray::elementAt(int index)
  7418. {
  7419. if(index<itemLayout.count())
  7420. {
  7421. QLayoutItem*item= itemLayout.itemAt(index);
  7422. return item->widget();
  7423. }
  7424. else
  7425. {
  7426. return NULL;
  7427. }
  7428. }
  7429. /*:679*//*680:*/
  7430. #line 14223 "./typica.w"
  7431. void FormArray::removeAllElements()
  7432. {
  7433. while(itemLayout.count()> 0)
  7434. {
  7435. QLayoutItem*item;
  7436. item= itemLayout.itemAt(0);
  7437. item->widget()->hide();
  7438. itemLayout.removeWidget(item->widget());
  7439. }
  7440. itemContainer.setMinimumHeight(0);
  7441. }
  7442. /*:680*//*681:*/
  7443. #line 14239 "./typica.w"
  7444. int FormArray::elements()
  7445. {
  7446. return itemLayout.count();
  7447. }
  7448. /*:681*//*682:*/
  7449. #line 14250 "./typica.w"
  7450. void FormArray::setMaximumElementWidth(int width)
  7451. {
  7452. maxwidth= width;
  7453. }
  7454. void FormArray::setMaximumElementHeight(int height)
  7455. {
  7456. maxheight= height;
  7457. }
  7458. /*:682*/
  7459. #line 569 "./typica.w"
  7460. /*688:*/
  7461. #line 14381 "./typica.w"
  7462. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  7463. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  7464. {
  7465. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  7466. QPointF(0,5);
  7467. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  7468. QPointF(10,5);
  7469. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  7470. QPointF(0,0);
  7471. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  7472. initialBrush.setColor(QColor(170,170,255));
  7473. initialBrush.setStyle(Qt::SolidPattern);
  7474. finalBrush.setColor(Qt::blue);
  7475. finalBrush.setStyle(Qt::SolidPattern);
  7476. initialDecrement.setPolygon(left);
  7477. initialDecrement.setBrush(initialBrush);
  7478. initialDecrement.setPos(0,0);
  7479. scene.addItem(&initialDecrement);
  7480. initialIncrement.setPolygon(right);
  7481. initialIncrement.setBrush(initialBrush);
  7482. initialIncrement.setPos(122,0);
  7483. scene.addItem(&initialIncrement);
  7484. finalDecrement.setPolygon(left);
  7485. finalDecrement.setBrush(finalBrush);
  7486. finalDecrement.setPos(0,12);
  7487. scene.addItem(&finalDecrement);
  7488. finalIncrement.setPolygon(right);
  7489. finalIncrement.setBrush(finalBrush);
  7490. finalIncrement.setPos(122,12);
  7491. scene.addItem(&finalIncrement);
  7492. scalePath.moveTo(0,10);
  7493. scalePath.lineTo(100,10);
  7494. scalePath.moveTo(0,0);
  7495. scalePath.lineTo(0,20);
  7496. scalePath.moveTo(10,5);
  7497. scalePath.lineTo(10,15);
  7498. scalePath.moveTo(20,5);
  7499. scalePath.lineTo(20,15);
  7500. scalePath.moveTo(30,5);
  7501. scalePath.lineTo(30,15);
  7502. scalePath.moveTo(40,5);
  7503. scalePath.lineTo(40,15);
  7504. scalePath.moveTo(50,0);
  7505. scalePath.lineTo(50,20);
  7506. scalePath.moveTo(60,5);
  7507. scalePath.lineTo(60,15);
  7508. scalePath.moveTo(70,5);
  7509. scalePath.lineTo(70,15);
  7510. scalePath.moveTo(80,5);
  7511. scalePath.lineTo(80,15);
  7512. scalePath.moveTo(90,5);
  7513. scalePath.lineTo(90,15);
  7514. scalePath.moveTo(100,0);
  7515. scalePath.lineTo(100,20);
  7516. scaleLine.setPath(scalePath);
  7517. scaleLine.setPos(16,1);
  7518. scene.addItem(&scaleLine);
  7519. setScene(&scene);
  7520. initialIndicator.setPolygon(down);
  7521. initialIndicator.setBrush(initialBrush);
  7522. finalIndicator.setPolygon(up);
  7523. finalIndicator.setBrush(finalBrush);
  7524. setMinimumSize(sizeHint());
  7525. setMaximumSize(sizeHint());
  7526. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7527. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7528. setMinimumSize(sizeHint());
  7529. }
  7530. /*:688*//*689:*/
  7531. #line 14454 "./typica.w"
  7532. QSize ScaleControl::sizeHint()const
  7533. {
  7534. return QSize(140,30);
  7535. }
  7536. /*:689*//*690:*/
  7537. #line 14463 "./typica.w"
  7538. void ScaleControl::setInitialValue(double value)
  7539. {
  7540. if(value>=0&&value<=10)
  7541. {
  7542. nonScoredValue= value;
  7543. if(!initialSet)
  7544. {
  7545. scene.addItem(&initialIndicator);
  7546. }
  7547. initialSet= true;
  7548. initialIndicator.setPos(value*10+16,10);
  7549. emit initialChanged(value);
  7550. if(!finalSet)
  7551. {
  7552. setFinalValue(value);
  7553. }
  7554. }
  7555. }
  7556. void ScaleControl::setFinalValue(double value)
  7557. {
  7558. if(value>=0&&value<=10)
  7559. {
  7560. scoredValue= value;
  7561. if(!finalSet)
  7562. {
  7563. scene.addItem(&finalIndicator);
  7564. }
  7565. finalSet= true;
  7566. finalIndicator.setPos(value*10+16,11);
  7567. emit finalChanged(value);
  7568. }
  7569. }
  7570. /*:690*//*691:*/
  7571. #line 14500 "./typica.w"
  7572. double ScaleControl::initialValue(void)
  7573. {
  7574. return nonScoredValue;
  7575. }
  7576. double ScaleControl::finalValue(void)
  7577. {
  7578. return scoredValue;
  7579. }
  7580. /*:691*//*692:*/
  7581. #line 14521 "./typica.w"
  7582. void ScaleControl::mousePressEvent(QMouseEvent*event)
  7583. {
  7584. /*693:*/
  7585. #line 14533 "./typica.w"
  7586. if(event->button()!=Qt::LeftButton)
  7587. {
  7588. event->ignore();
  7589. return;
  7590. }
  7591. /*:693*/
  7592. #line 14524 "./typica.w"
  7593. scaleDown= true;
  7594. event->accept();
  7595. }
  7596. /*:692*//*694:*/
  7597. #line 14544 "./typica.w"
  7598. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  7599. {
  7600. /*693:*/
  7601. #line 14533 "./typica.w"
  7602. if(event->button()!=Qt::LeftButton)
  7603. {
  7604. event->ignore();
  7605. return;
  7606. }
  7607. /*:693*/
  7608. #line 14547 "./typica.w"
  7609. if(!scaleDown)
  7610. {
  7611. event->ignore();
  7612. return;
  7613. }
  7614. scaleDown= false;
  7615. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7616. /*695:*/
  7617. #line 14569 "./typica.w"
  7618. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  7619. {
  7620. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7621. {
  7622. if(initialSet)
  7623. {
  7624. setInitialValue(nonScoredValue-0.05);
  7625. }
  7626. event->accept();
  7627. return;
  7628. }
  7629. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7630. {
  7631. if(finalSet)
  7632. {
  7633. setFinalValue(scoredValue-0.05);
  7634. event->accept();
  7635. return;
  7636. }
  7637. }
  7638. }
  7639. /*:695*/
  7640. #line 14555 "./typica.w"
  7641. /*696:*/
  7642. #line 14595 "./typica.w"
  7643. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  7644. {
  7645. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7646. {
  7647. if(initialSet)
  7648. {
  7649. setInitialValue(nonScoredValue+0.05);
  7650. event->accept();
  7651. return;
  7652. }
  7653. }
  7654. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7655. {
  7656. if(finalSet)
  7657. {
  7658. setFinalValue(scoredValue+0.05);
  7659. event->accept();
  7660. return;
  7661. }
  7662. }
  7663. }
  7664. /*:696*/
  7665. #line 14556 "./typica.w"
  7666. /*697:*/
  7667. #line 14621 "./typica.w"
  7668. double relativeX= sceneCoordinate.x()-16;
  7669. if(initialSet)
  7670. {
  7671. if(relativeX>=0&&relativeX<=100)
  7672. {
  7673. setFinalValue(relativeX/10.0);
  7674. event->accept();
  7675. return;
  7676. }
  7677. }
  7678. else
  7679. {
  7680. if(relativeX>=0&&relativeX<=100)
  7681. {
  7682. setInitialValue(relativeX/10.0);
  7683. event->accept();
  7684. return;
  7685. }
  7686. }
  7687. /*:697*/
  7688. #line 14557 "./typica.w"
  7689. event->ignore();
  7690. return;
  7691. }
  7692. /*:694*/
  7693. #line 570 "./typica.w"
  7694. /*699:*/
  7695. #line 14687 "./typica.w"
  7696. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  7697. valueSet(false),scaleDown(false)
  7698. {
  7699. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7700. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7701. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  7702. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  7703. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  7704. theBrush.setColor(Qt::blue);
  7705. theBrush.setStyle(Qt::SolidPattern);
  7706. increment.setPolygon(up);
  7707. increment.setBrush(theBrush);
  7708. increment.setPos(0,0);
  7709. scene.addItem(&increment);
  7710. decrement.setPolygon(down);
  7711. decrement.setBrush(theBrush);
  7712. decrement.setPos(0,122);
  7713. scene.addItem(&decrement);
  7714. scalePath.moveTo(5,0);
  7715. scalePath.lineTo(5,100);
  7716. scalePath.moveTo(0,0);
  7717. scalePath.lineTo(10,0);
  7718. scalePath.moveTo(0,10);
  7719. scalePath.lineTo(10,10);
  7720. scalePath.moveTo(0,20);
  7721. scalePath.lineTo(10,20);
  7722. scalePath.moveTo(0,30);
  7723. scalePath.lineTo(10,30);
  7724. scalePath.moveTo(0,40);
  7725. scalePath.lineTo(10,40);
  7726. scalePath.moveTo(0,50);
  7727. scalePath.lineTo(10,50);
  7728. scalePath.moveTo(0,60);
  7729. scalePath.lineTo(10,60);
  7730. scalePath.moveTo(0,70);
  7731. scalePath.lineTo(10,70);
  7732. scalePath.moveTo(0,80);
  7733. scalePath.lineTo(10,80);
  7734. scalePath.moveTo(0,90);
  7735. scalePath.lineTo(10,90);
  7736. scalePath.moveTo(0,100);
  7737. scalePath.lineTo(10,100);
  7738. scaleLine.setPath(scalePath);
  7739. scaleLine.setPos(0,16);
  7740. scene.addItem(&scaleLine);
  7741. setScene(&scene);
  7742. indicator.setPolygon(left);
  7743. indicator.setBrush(theBrush);
  7744. setMinimumSize(sizeHint());
  7745. setMaximumSize(sizeHint());
  7746. }
  7747. /*:699*//*700:*/
  7748. #line 14742 "./typica.w"
  7749. QSize IntensityControl::sizeHint()const
  7750. {
  7751. return QSize(25,160);
  7752. }
  7753. /*:700*//*701:*/
  7754. #line 14757 "./typica.w"
  7755. void IntensityControl::setValue(double val)
  7756. {
  7757. if(val>=0&&val<=10)
  7758. {
  7759. theValue= val;
  7760. if(!valueSet)
  7761. {
  7762. scene.addItem(&indicator);
  7763. }
  7764. valueSet= true;
  7765. indicator.setPos(6,(100-(val*10))+16);
  7766. emit(valueChanged(val));
  7767. }
  7768. else if(val<1)
  7769. {
  7770. setValue(0);
  7771. }
  7772. else
  7773. {
  7774. setValue(10);
  7775. }
  7776. }
  7777. double IntensityControl::value()
  7778. {
  7779. return theValue;
  7780. }
  7781. /*:701*//*702:*/
  7782. #line 14789 "./typica.w"
  7783. void IntensityControl::mousePressEvent(QMouseEvent*event)
  7784. {
  7785. /*693:*/
  7786. #line 14533 "./typica.w"
  7787. if(event->button()!=Qt::LeftButton)
  7788. {
  7789. event->ignore();
  7790. return;
  7791. }
  7792. /*:693*/
  7793. #line 14792 "./typica.w"
  7794. scaleDown= true;
  7795. event->accept();
  7796. }
  7797. /*:702*//*703:*/
  7798. #line 14803 "./typica.w"
  7799. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  7800. {
  7801. /*693:*/
  7802. #line 14533 "./typica.w"
  7803. if(event->button()!=Qt::LeftButton)
  7804. {
  7805. event->ignore();
  7806. return;
  7807. }
  7808. /*:693*/
  7809. #line 14806 "./typica.w"
  7810. if(!scaleDown)
  7811. {
  7812. event->ignore();
  7813. return;
  7814. }
  7815. scaleDown= false;
  7816. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7817. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  7818. {
  7819. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7820. {
  7821. if(valueSet)
  7822. {
  7823. setValue(theValue+0.05);
  7824. }
  7825. event->accept();
  7826. return;
  7827. }
  7828. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  7829. {
  7830. if(valueSet)
  7831. {
  7832. setValue(theValue-0.05);
  7833. }
  7834. event->accept();
  7835. return;
  7836. }
  7837. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  7838. {
  7839. setValue(10-((sceneCoordinate.y()-16)/10.0));
  7840. event->accept();
  7841. return;
  7842. }
  7843. }
  7844. }
  7845. /*:703*/
  7846. #line 571 "./typica.w"
  7847. /*354:*/
  7848. #line 8042 "./typica.w"
  7849. void ThresholdDetector::newMeasurement(Measurement measure)
  7850. {
  7851. if((currentDirection==Ascending&&previousValue<threshold&&
  7852. previousValue>=0)||(currentDirection==Descending&&
  7853. previousValue> threshold&&previousValue>=0))
  7854. {
  7855. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  7856. (currentDirection==Descending&&measure.temperature()<=threshold))
  7857. {
  7858. double offset= measure.time().hour()*60*60;
  7859. offset+= measure.time().minute()*60;
  7860. offset+= measure.time().second();
  7861. offset+= measure.time().msec()/1000;
  7862. emit timeForValue(offset);
  7863. }
  7864. }
  7865. previousValue= measure.temperature();
  7866. }
  7867. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  7868. previousValue(-1),threshold(value),currentDirection(Ascending)
  7869. {
  7870. }
  7871. void ThresholdDetector::setThreshold(double value)
  7872. {
  7873. threshold= value;
  7874. }
  7875. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  7876. {
  7877. currentDirection= direction;
  7878. }
  7879. /*:354*/
  7880. #line 572 "./typica.w"
  7881. /*785:*/
  7882. #line 16644 "./typica.w"
  7883. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  7884. lister(new QextSerialEnumerator)
  7885. {
  7886. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  7887. QextPortInfo port;
  7888. foreach(port,ports)
  7889. {
  7890. #ifdef Q_OS_WIN32
  7891. addItem(port.portName);
  7892. #else
  7893. addItem(port.physName);
  7894. #endif
  7895. }
  7896. lister->setUpNotifications();
  7897. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  7898. this,SLOT(addDevice(QextPortInfo)));
  7899. setEditable(true);
  7900. }
  7901. void PortSelector::addDevice(QextPortInfo port)
  7902. {
  7903. addItem(port.portName);
  7904. }
  7905. /*:785*/
  7906. #line 573 "./typica.w"
  7907. /*787:*/
  7908. #line 16736 "./typica.w"
  7909. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  7910. {
  7911. QMetaObject meta= BaudSelector::staticMetaObject;
  7912. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  7913. for(int i= 0;i<type.keyCount();i++)
  7914. {
  7915. addItem(QString("%1").arg(type.value(i)));
  7916. }
  7917. }
  7918. /*:787*/
  7919. #line 574 "./typica.w"
  7920. /*789:*/
  7921. #line 16774 "./typica.w"
  7922. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  7923. {
  7924. QMetaObject meta= ParitySelector::staticMetaObject;
  7925. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  7926. for(int i= 0;i<type.keyCount();i++)
  7927. {
  7928. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7929. }
  7930. }
  7931. /*:789*/
  7932. #line 575 "./typica.w"
  7933. /*791:*/
  7934. #line 16804 "./typica.w"
  7935. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  7936. {
  7937. QMetaObject meta= FlowSelector::staticMetaObject;
  7938. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  7939. for(int i= 0;i<type.keyCount();i++)
  7940. {
  7941. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7942. }
  7943. }
  7944. /*:791*/
  7945. #line 576 "./typica.w"
  7946. /*793:*/
  7947. #line 16839 "./typica.w"
  7948. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  7949. {
  7950. QMetaObject meta= StopSelector::staticMetaObject;
  7951. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  7952. for(int i= 0;i<type.keyCount();i++)
  7953. {
  7954. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7955. }
  7956. }
  7957. /*:793*/
  7958. #line 577 "./typica.w"
  7959. /*853:*/
  7960. #line 18621 "./typica.w"
  7961. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  7962. :BasicDeviceConfigurationWidget(model,index),
  7963. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  7964. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  7965. decimalQuery(new QCheckBox(tr("Enable"))),
  7966. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  7967. unitQuery(new QCheckBox(tr("Enable"))),
  7968. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  7969. valueC(new QSpinBox),fixedUnit(new QComboBox),
  7970. pVAddress(new ShortHexSpinBox),
  7971. sVEnabled(new QCheckBox(tr("Enable"))),
  7972. sVReadAddress(new ShortHexSpinBox),
  7973. deviceLimit(new QCheckBox(tr("Enable"))),
  7974. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  7975. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  7976. sVWritable(new QCheckBox(tr("Enable"))),
  7977. sVOutputAddr(new ShortHexSpinBox),
  7978. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  7979. {
  7980. QHBoxLayout*layout= new QHBoxLayout;
  7981. QWidget*form= new QWidget;
  7982. QHBoxLayout*masterLayout= new QHBoxLayout;
  7983. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  7984. QVBoxLayout*seriesLayout= new QVBoxLayout;
  7985. QFormLayout*serialSection= new QFormLayout;
  7986. serialSection->addRow(QString(tr("Port:")),port);
  7987. serialSection->addRow(QString(tr("Baud rate:")),baud);
  7988. serialSection->addRow(QString(tr("Parity:")),parity);
  7989. serialSection->addRow(QString(tr("Flow control:")),flow);
  7990. serialSection->addRow(QString(tr("Stop bits:")),stop);
  7991. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  7992. serialSectionBox->setLayout(serialSection);
  7993. portAndDeviceLayout->addWidget(serialSectionBox);
  7994. QFormLayout*deviceSection= new QFormLayout;
  7995. station->setMinimum(1);
  7996. station->setMaximum(255);
  7997. decimalPosition->setMinimum(0);
  7998. decimalPosition->setMaximum(9);
  7999. valueF->setMinimum(0);
  8000. valueF->setMaximum(0xFFFF);
  8001. valueC->setMinimum(0);
  8002. valueC->setMaximum(0xFFFF);
  8003. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  8004. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  8005. deviceSection->addRow(tr("Station:"),station);
  8006. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  8007. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  8008. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  8009. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  8010. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  8011. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  8012. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  8013. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  8014. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  8015. deviceSectionBox->setLayout(deviceSection);
  8016. portAndDeviceLayout->addWidget(deviceSectionBox);
  8017. QFormLayout*pVSection= new QFormLayout;
  8018. pVSection->addRow(tr("Value relative address:"),pVAddress);
  8019. pVSection->addRow(tr("PV column name:"),pVColumnName);
  8020. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  8021. pVSection->addRow(pVHideBox);
  8022. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  8023. processValueBox->setLayout(pVSection);
  8024. seriesLayout->addWidget(processValueBox);
  8025. QFormLayout*sVSection= new QFormLayout;
  8026. sVLower->setDecimals(1);
  8027. sVLower->setMinimum(0.0);
  8028. sVLower->setMaximum(999.9);
  8029. sVUpper->setDecimals(1);
  8030. sVUpper->setMinimum(0.0);
  8031. sVUpper->setMaximum(999.9);
  8032. sVSection->addRow(tr("Set value:"),sVEnabled);
  8033. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  8034. sVSection->addRow(tr("SV column name:"),sVColumnName);
  8035. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  8036. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  8037. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  8038. sVSection->addRow(tr("Lower limit:"),sVLower);
  8039. sVSection->addRow(tr("Upper limit:"),sVUpper);
  8040. sVSection->addRow(tr("Output set value:"),sVWritable);
  8041. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  8042. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  8043. sVSection->addRow(sVHideBox);
  8044. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  8045. setValueBox->setLayout(sVSection);
  8046. seriesLayout->addWidget(setValueBox);
  8047. masterLayout->addLayout(portAndDeviceLayout);
  8048. masterLayout->addLayout(seriesLayout);
  8049. form->setLayout(masterLayout);
  8050. /*761:*/
  8051. #line 16100 "./typica.w"
  8052. QDomElement referenceElement=
  8053. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8054. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8055. QDomElement node;
  8056. /*:761*/
  8057. #line 18711 "./typica.w"
  8058. for(int i= 0;i<configData.size();i++)
  8059. {
  8060. node= configData.at(i).toElement();
  8061. if(node.attribute("name")=="port")
  8062. {
  8063. QString portname= node.attribute("value");
  8064. int idx= port->findText(portname);
  8065. if(idx>=0)
  8066. {
  8067. port->setCurrentIndex(idx);
  8068. }
  8069. else
  8070. {
  8071. port->addItem(portname);
  8072. }
  8073. }
  8074. else if(node.attribute("name")=="baud")
  8075. {
  8076. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  8077. }
  8078. else if(node.attribute("name")=="parity")
  8079. {
  8080. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  8081. }
  8082. else if(node.attribute("name")=="flow")
  8083. {
  8084. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  8085. }
  8086. else if(node.attribute("name")=="stop")
  8087. {
  8088. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  8089. }
  8090. else if(node.attribute("name")=="station")
  8091. {
  8092. station->setValue(node.attribute("value").toInt());
  8093. }
  8094. else if(node.attribute("name")=="decimalQuery")
  8095. {
  8096. if(node.attribute("value")=="true")
  8097. {
  8098. decimalQuery->setChecked(true);
  8099. }
  8100. else
  8101. {
  8102. decimalQuery->setChecked(false);
  8103. }
  8104. }
  8105. else if(node.attribute("name")=="decimalAddress")
  8106. {
  8107. decimalAddress->setValue(node.attribute("value").toInt());
  8108. }
  8109. else if(node.attribute("name")=="decimalPosition")
  8110. {
  8111. decimalPosition->setValue(node.attribute("value").toInt());
  8112. }
  8113. else if(node.attribute("name")=="unitQuery")
  8114. {
  8115. if(node.attribute("value")=="true")
  8116. {
  8117. unitQuery->setChecked(true);
  8118. }
  8119. else
  8120. {
  8121. unitQuery->setChecked(false);
  8122. }
  8123. }
  8124. else if(node.attribute("name")=="unitAddress")
  8125. {
  8126. unitAddress->setValue(node.attribute("value").toInt());
  8127. }
  8128. else if(node.attribute("name")=="valueF")
  8129. {
  8130. valueF->setValue(node.attribute("value").toInt());
  8131. }
  8132. else if(node.attribute("name")=="valueC")
  8133. {
  8134. valueC->setValue(node.attribute("value").toInt());
  8135. }
  8136. else if(node.attribute("name")=="fixedUnit")
  8137. {
  8138. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  8139. }
  8140. else if(node.attribute("name")=="pVAddress")
  8141. {
  8142. pVAddress->setValue(node.attribute("value").toInt());
  8143. }
  8144. else if(node.attribute("name")=="sVEnabled")
  8145. {
  8146. if(node.attribute("value")=="true")
  8147. {
  8148. sVEnabled->setChecked(true);
  8149. }
  8150. else
  8151. {
  8152. sVEnabled->setChecked(false);
  8153. }
  8154. }
  8155. else if(node.attribute("name")=="sVReadAddress")
  8156. {
  8157. sVReadAddress->setValue(node.attribute("value").toInt());
  8158. }
  8159. else if(node.attribute("name")=="deviceLimit")
  8160. {
  8161. if(node.attribute("value")=="true")
  8162. {
  8163. deviceLimit->setChecked(true);
  8164. }
  8165. else
  8166. {
  8167. deviceLimit->setChecked(false);
  8168. }
  8169. }
  8170. else if(node.attribute("name")=="sVLowerAddr")
  8171. {
  8172. sVLowerAddr->setValue(node.attribute("value").toInt());
  8173. }
  8174. else if(node.attribute("name")=="sVUpperAddr")
  8175. {
  8176. sVUpperAddr->setValue(node.attribute("value").toInt());
  8177. }
  8178. else if(node.attribute("name")=="sVLower")
  8179. {
  8180. sVLower->setValue(node.attribute("value").toDouble());
  8181. }
  8182. else if(node.attribute("name")=="sVUpper")
  8183. {
  8184. sVUpper->setValue(node.attribute("value").toDouble());
  8185. }
  8186. else if(node.attribute("name")=="sVWritable")
  8187. {
  8188. if(node.attribute("value")=="true")
  8189. {
  8190. sVWritable->setChecked(true);
  8191. }
  8192. else
  8193. {
  8194. sVWritable->setChecked(false);
  8195. }
  8196. }
  8197. else if(node.attribute("name")=="sVOutputAddr")
  8198. {
  8199. sVOutputAddr->setValue(node.attribute("value").toInt());
  8200. }
  8201. else if(node.attribute("name")=="pvcolname")
  8202. {
  8203. pVColumnName->setText(node.attribute("value"));
  8204. }
  8205. else if(node.attribute("name")=="svcolname")
  8206. {
  8207. sVColumnName->setText(node.attribute("value"));
  8208. }
  8209. else if(node.attribute("name")=="pvhidden")
  8210. {
  8211. pVHideBox->setChecked(node.attribute("value")=="true");
  8212. }
  8213. else if(node.attribute("name")=="svhidden")
  8214. {
  8215. sVHideBox->setChecked(node.attribute("value")=="true");
  8216. }
  8217. }
  8218. updatePort(port->currentText());
  8219. updateBaudRate(baud->currentText());
  8220. updateParity(parity->itemData(parity->currentIndex()).toString());
  8221. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  8222. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  8223. updateStation(station->value());
  8224. updateFixedDecimal(decimalQuery->isChecked());
  8225. updateDecimalAddress(decimalAddress->value());
  8226. updateDecimalPosition(decimalPosition->value());
  8227. updateFixedUnit(unitQuery->isChecked());
  8228. updateUnitAddress(unitAddress->value());
  8229. updateValueForF(valueF->value());
  8230. updateValueForC(valueC->value());
  8231. updateUnit(fixedUnit->currentText());
  8232. updatePVAddress(pVAddress->value());
  8233. updateSVEnabled(sVEnabled->isChecked());
  8234. updateSVReadAddress(sVReadAddress->value());
  8235. updateDeviceLimit(deviceLimit->isChecked());
  8236. updateSVLowerAddress(sVLowerAddr->value());
  8237. updateSVUpperAddress(sVUpperAddr->value());
  8238. updateSVLower(sVLower->value());
  8239. updateSVUpper(sVUpper->value());
  8240. updateSVWritable(sVWritable->isChecked());
  8241. updateSVWriteAddress(sVOutputAddr->value());
  8242. updatePVColumnName(pVColumnName->text());
  8243. updateSVColumnName(sVColumnName->text());
  8244. updatePVHidden(pVHideBox->isChecked());
  8245. updateSVHidden(sVHideBox->isChecked());
  8246. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  8247. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  8248. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  8249. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  8250. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  8251. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  8252. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  8253. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  8254. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  8255. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  8256. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  8257. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  8258. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  8259. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  8260. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  8261. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  8262. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  8263. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  8264. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  8265. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  8266. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  8267. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  8268. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  8269. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  8270. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  8271. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  8272. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  8273. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  8274. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  8275. layout->addWidget(form);
  8276. setLayout(layout);
  8277. }
  8278. void ModbusConfigurator::updatePort(const QString&newPort)
  8279. {
  8280. updateAttribute("port",newPort);
  8281. }
  8282. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  8283. {
  8284. updateAttribute("baud",newRate);
  8285. }
  8286. void ModbusConfigurator::updateParity(const QString&)
  8287. {
  8288. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  8289. }
  8290. void ModbusConfigurator::updateFlowControl(const QString&)
  8291. {
  8292. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  8293. }
  8294. void ModbusConfigurator::updateStopBits(const QString&)
  8295. {
  8296. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  8297. }
  8298. void ModbusConfigurator::updateStation(int station)
  8299. {
  8300. updateAttribute("station",QString("%1").arg(station));
  8301. }
  8302. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  8303. {
  8304. updateAttribute("decimalQuery",fixed?"true":"false");
  8305. }
  8306. void ModbusConfigurator::updateDecimalAddress(int address)
  8307. {
  8308. updateAttribute("decimalAddress",QString("%1").arg(address));
  8309. }
  8310. void ModbusConfigurator::updateDecimalPosition(int position)
  8311. {
  8312. updateAttribute("decimalPosition",QString("%1").arg(position));
  8313. }
  8314. void ModbusConfigurator::updateFixedUnit(bool fixed)
  8315. {
  8316. updateAttribute("unitQuery",fixed?"true":"false");
  8317. }
  8318. void ModbusConfigurator::updateUnitAddress(int address)
  8319. {
  8320. updateAttribute("unitAddress",QString("%1").arg(address));
  8321. }
  8322. void ModbusConfigurator::updateValueForF(int value)
  8323. {
  8324. updateAttribute("valueF",QString("%1").arg(value));
  8325. }
  8326. void ModbusConfigurator::updateValueForC(int value)
  8327. {
  8328. updateAttribute("valueC",QString("%1").arg(value));
  8329. }
  8330. void ModbusConfigurator::updateUnit(const QString&newUnit)
  8331. {
  8332. updateAttribute("fixedUnit",newUnit);
  8333. }
  8334. void ModbusConfigurator::updatePVAddress(int address)
  8335. {
  8336. updateAttribute("pVAddress",QString("%1").arg(address));
  8337. }
  8338. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8339. {
  8340. updateAttribute("sVEnabled",enabled?"true":"false");
  8341. }
  8342. void ModbusConfigurator::updateSVReadAddress(int address)
  8343. {
  8344. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8345. }
  8346. void ModbusConfigurator::updateDeviceLimit(bool query)
  8347. {
  8348. updateAttribute("deviceLimit",query?"true":"false");
  8349. }
  8350. void ModbusConfigurator::updateSVLowerAddress(int address)
  8351. {
  8352. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8353. }
  8354. void ModbusConfigurator::updateSVUpperAddress(int address)
  8355. {
  8356. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  8357. }
  8358. void ModbusConfigurator::updateSVLower(double value)
  8359. {
  8360. updateAttribute("sVLower",QString("%1").arg(value));
  8361. }
  8362. void ModbusConfigurator::updateSVUpper(double value)
  8363. {
  8364. updateAttribute("sVUpper",QString("%1").arg(value));
  8365. }
  8366. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  8367. {
  8368. updateAttribute("sVWritable",canWriteSV?"true":"false");
  8369. }
  8370. void ModbusConfigurator::updateSVWriteAddress(int address)
  8371. {
  8372. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  8373. }
  8374. void ModbusConfigurator::updatePVColumnName(const QString&name)
  8375. {
  8376. updateAttribute("pvcolname",name);
  8377. }
  8378. void ModbusConfigurator::updateSVColumnName(const QString&name)
  8379. {
  8380. updateAttribute("svcolname",name);
  8381. }
  8382. void ModbusConfigurator::updatePVHidden(bool hidden)
  8383. {
  8384. updateAttribute("pvhidden",hidden?"true":"false");
  8385. }
  8386. void ModbusConfigurator::updateSVHidden(bool hidden)
  8387. {
  8388. updateAttribute("svhidden",hidden?"true":"false");
  8389. }
  8390. /*:853*/
  8391. #line 578 "./typica.w"
  8392. /*796:*/
  8393. #line 16888 "./typica.w"
  8394. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  8395. {
  8396. setMinimum(0);
  8397. setMaximum(0xFFFF);
  8398. setPrefix("0x");
  8399. setMinimumWidth(65);
  8400. }
  8401. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  8402. {
  8403. if(input.size()==2)
  8404. {
  8405. return QValidator::Intermediate;
  8406. }
  8407. bool okay;
  8408. input.toInt(&okay,16);
  8409. if(okay)
  8410. {
  8411. return QValidator::Acceptable;
  8412. }
  8413. return QValidator::Invalid;
  8414. }
  8415. int ShortHexSpinBox::valueFromText(const QString&text)const
  8416. {
  8417. return text.toInt(NULL,16);
  8418. }
  8419. QString ShortHexSpinBox::textFromValue(int value)const
  8420. {
  8421. QString retval;
  8422. retval.setNum(value,16);
  8423. while(retval.size()<4)
  8424. {
  8425. retval.prepend("0");
  8426. }
  8427. return retval.toUpper();
  8428. }
  8429. /*:796*/
  8430. #line 579 "./typica.w"
  8431. /*837:*/
  8432. #line 17920 "./typica.w"
  8433. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  8434. :QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),unitIsF(true),readingsv(false),
  8435. waiting(false)
  8436. {
  8437. qDebug()<<"Initializing Modbus RTU Device";
  8438. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  8439. Qt::UserRole).toString());
  8440. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  8441. QDomElement node;
  8442. QVariantMap attributes;
  8443. for(int i= 0;i<portConfigData.size();i++)
  8444. {
  8445. node= portConfigData.at(i).toElement();
  8446. attributes.insert(node.attribute("name"),node.attribute("value"));
  8447. }
  8448. port= new QextSerialPort(attributes.value("port").toString(),
  8449. QextSerialPort::EventDriven);
  8450. int baudRate= attributes.value("baud").toInt();
  8451. port->setBaudRate((BaudRateType)baudRate);
  8452. double temp= ((double)(1)/(double)(baudRate))*48;
  8453. delayTime= (int)(temp*3000);
  8454. messageDelayTimer->setSingleShot(true);
  8455. commTimeout->setSingleShot(true);
  8456. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  8457. connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
  8458. port->setDataBits(DATA_8);
  8459. port->setParity((ParityType)attributes.value("parity").toInt());
  8460. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  8461. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  8462. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  8463. port->open(QIODevice::ReadWrite);
  8464. station= (char)attributes.value("station").toInt();
  8465. if(attributes.value("decimalQuery")=="true")
  8466. {
  8467. decimalPosition= 0;
  8468. QByteArray message;
  8469. message.append(station);
  8470. message.append((char)0x03);
  8471. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  8472. char*addressBytes= (char*)&address;
  8473. message.append(addressBytes[1]);
  8474. message.append(addressBytes[0]);
  8475. message.append((char)0x00);
  8476. message.append((char)0x01);
  8477. queueMessage(message,this,"decimalResponse(QByteArray)");
  8478. }
  8479. else
  8480. {
  8481. decimalPosition= attributes.value("decimalPosition").toInt();
  8482. }
  8483. valueF= attributes.value("valueF").toInt();
  8484. valueC= attributes.value("valueC").toInt();
  8485. if(attributes.value("unitQuery")=="true")
  8486. {
  8487. QByteArray message;
  8488. message.append(station);
  8489. message.append((char)0x03);
  8490. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  8491. char*addressBytes= (char*)&address;
  8492. message.append(addressBytes[1]);
  8493. message.append(addressBytes[0]);
  8494. message.append((char)0x00);
  8495. message.append((char)0x01);
  8496. queueMessage(message,this,"unitResponse(QByteArray)");
  8497. }
  8498. else
  8499. {
  8500. if(attributes.value("fixedUnit")=="Celsius")
  8501. {
  8502. unitIsF= false;
  8503. }
  8504. }
  8505. if(attributes.value("sVWritable")=="true")
  8506. {
  8507. if(attributes.value("deviceLimit")=="true")
  8508. {
  8509. QByteArray lmessage;
  8510. lmessage.append(station);
  8511. lmessage.append((char)0x03);
  8512. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  8513. char*addressBytes= (char*)&laddress;
  8514. lmessage.append(addressBytes[1]);
  8515. lmessage.append(addressBytes[0]);
  8516. lmessage.append((char)0x00);
  8517. lmessage.append((char)0x01);
  8518. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  8519. QByteArray umessage;
  8520. umessage.append(station);
  8521. umessage.append((char)0x03);
  8522. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  8523. addressBytes= (char*)&uaddress;
  8524. umessage.append(addressBytes[1]);
  8525. umessage.append(addressBytes[0]);
  8526. umessage.append((char)0x00);
  8527. umessage.append((char)0x01);
  8528. queueMessage(umessage,this,"svuResponse(QByteArray)");
  8529. }
  8530. else
  8531. {
  8532. outputSVLower= attributes.value("sVLower").toDouble();
  8533. outputSVUpper= attributes.value("sVUpper").toDouble();
  8534. }
  8535. outputSVStub.append(station);
  8536. outputSVStub.append((char)0x06);
  8537. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  8538. char*addressBytes= (char*)&address;
  8539. outputSVStub.append(addressBytes[1]);
  8540. outputSVStub.append(addressBytes[0]);
  8541. }
  8542. Channel*pv= new Channel;
  8543. channels.append(pv);
  8544. pvStub.append(station);
  8545. pvStub.append((char)0x04);
  8546. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  8547. char*pvac= (char*)&pvaddress;
  8548. pvStub.append(pvac[1]);
  8549. pvStub.append(pvac[0]);
  8550. pvStub.append((char)0x00);
  8551. pvStub.append((char)0x01);
  8552. svenabled= attributes.value("sVEnabled").toBool();
  8553. if(svenabled)
  8554. {
  8555. Channel*sv= new Channel;
  8556. channels.append(sv);
  8557. svStub.append(station);
  8558. svStub.append((char)0x04);
  8559. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  8560. char*svac= (char*)&svaddress;
  8561. svStub.append(svac[1]);
  8562. svStub.append(svac[0]);
  8563. svStub.append((char)0x00);
  8564. svStub.append((char)0x01);
  8565. if(svaddress-pvaddress==1)
  8566. {
  8567. mStub.append(station);
  8568. mStub.append((char)0x04);
  8569. mStub.append(pvac[1]);
  8570. mStub.append(pvac[0]);
  8571. mStub.append((char)0x00);
  8572. mStub.append((char)0x02);
  8573. }
  8574. }
  8575. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  8576. requestMeasurement();
  8577. }
  8578. double ModbusRTUDevice::SVLower()
  8579. {
  8580. return outputSVLower;
  8581. }
  8582. double ModbusRTUDevice::SVUpper()
  8583. {
  8584. return outputSVUpper;
  8585. }
  8586. int ModbusRTUDevice::decimals()
  8587. {
  8588. return decimalPosition;
  8589. }
  8590. void ModbusRTUDevice::decimalResponse(QByteArray response)
  8591. {
  8592. quint16 temp;
  8593. char*tchar= (char*)&temp;
  8594. tchar[1]= response.at(3);
  8595. tchar[0]= response.at(4);
  8596. decimalPosition= temp;
  8597. emit SVDecimalChanged(decimalPosition);
  8598. qDebug()<<"Received decimal response";
  8599. }
  8600. void ModbusRTUDevice::unitResponse(QByteArray response)
  8601. {
  8602. quint16 temp;
  8603. char*tchar= (char*)&temp;
  8604. tchar[1]= response.at(3);
  8605. tchar[0]= response.at(4);
  8606. int value= temp;
  8607. if(value==valueF)
  8608. {
  8609. unitIsF= true;
  8610. }
  8611. else
  8612. {
  8613. unitIsF= false;
  8614. }
  8615. qDebug()<<"Received unit response";
  8616. }
  8617. void ModbusRTUDevice::svlResponse(QByteArray response)
  8618. {
  8619. quint16 temp;
  8620. char*tchar= (char*)&temp;
  8621. tchar[1]= response.at(3);
  8622. tchar[0]= response.at(4);
  8623. outputSVLower= (double)temp;
  8624. for(int i= 0;i<decimalPosition;i++)
  8625. {
  8626. outputSVLower/= 10;
  8627. }
  8628. emit SVLowerChanged(outputSVLower);
  8629. qDebug()<<"Received set value lower bound response";
  8630. }
  8631. void ModbusRTUDevice::svuResponse(QByteArray response)
  8632. {
  8633. quint16 temp;
  8634. char*tchar= (char*)&temp;
  8635. tchar[1]= response.at(3);
  8636. tchar[0]= response.at(4);
  8637. outputSVUpper= (double)temp;
  8638. for(int i= 0;i<decimalPosition;i++)
  8639. {
  8640. outputSVUpper/= 10;
  8641. }
  8642. emit SVUpperChanged(outputSVUpper);
  8643. qDebug()<<"Received set value upper bound response";
  8644. }
  8645. void ModbusRTUDevice::requestMeasurement()
  8646. {
  8647. if(mStub.length()> 0)
  8648. {
  8649. queueMessage(mStub,this,"mResponse(QByteArray)");
  8650. }
  8651. else
  8652. {
  8653. queueMessage(pvStub,this,"mResponse(QByteArray)");
  8654. if(svenabled)
  8655. {
  8656. queueMessage(svStub,this,"mResponse(QByteArray)");
  8657. }
  8658. }
  8659. }
  8660. void ModbusRTUDevice::mResponse(QByteArray response)
  8661. {
  8662. QTime time= QTime::currentTime();
  8663. if(response.at(2)==0x04)
  8664. {
  8665. /*838:*/
  8666. #line 18175 "./typica.w"
  8667. quint16 pv;
  8668. quint16 sv;
  8669. char*pvBytes= (char*)&pv;
  8670. char*svBytes= (char*)&sv;
  8671. pvBytes[1]= response.at(3);
  8672. pvBytes[0]= response.at(4);
  8673. svBytes[1]= response.at(5);
  8674. svBytes[0]= response.at(6);
  8675. double pvOut= (double)pv;
  8676. double svOut= (double)sv;
  8677. for(int i= 0;i<decimalPosition;i++)
  8678. {
  8679. pvOut/= 10;
  8680. svOut/= 10;
  8681. }
  8682. if(!unitIsF)
  8683. {
  8684. pvOut= pvOut*9/5+32;
  8685. svOut= svOut*9/5+32;
  8686. }
  8687. Measurement pvm(pvOut,time,Units::Fahrenheit);
  8688. Measurement svm(svOut,time,Units::Fahrenheit);
  8689. channels.at(0)->input(pvm);
  8690. channels.at(1)->input(svm);
  8691. /*:838*/
  8692. #line 18162 "./typica.w"
  8693. }
  8694. else
  8695. {
  8696. /*839:*/
  8697. #line 18205 "./typica.w"
  8698. quint16 value;
  8699. char*valueBytes= (char*)&value;
  8700. valueBytes[1]= response.at(3);
  8701. valueBytes[0]= response.at(4);
  8702. double valueOut= (double)value;
  8703. for(int i= 0;i<decimalPosition;i++)
  8704. {
  8705. valueOut/= 10;
  8706. }
  8707. if(!unitIsF)
  8708. {
  8709. valueOut= valueOut*9/5+32;
  8710. }
  8711. if(!svenabled)
  8712. {
  8713. Measurement vm(valueOut,time,Units::Fahrenheit);
  8714. channels.at(0)->input(vm);
  8715. }
  8716. else
  8717. {
  8718. if(readingsv)
  8719. {
  8720. Measurement pvm(savedpv,time,Units::Fahrenheit);
  8721. Measurement svm(valueOut,time,Units::Fahrenheit);
  8722. channels.at(0)->input(pvm);
  8723. channels.at(1)->input(svm);
  8724. readingsv= false;
  8725. }
  8726. else
  8727. {
  8728. savedpv= valueOut;
  8729. readingsv= true;
  8730. }
  8731. }
  8732. /*:839*/
  8733. #line 18166 "./typica.w"
  8734. }
  8735. }
  8736. /*:837*//*840:*/
  8737. #line 18243 "./typica.w"
  8738. ModbusRTUDevice::~ModbusRTUDevice()
  8739. {
  8740. commTimeout->stop();
  8741. messageDelayTimer->stop();
  8742. port->close();
  8743. }
  8744. /*:840*//*841:*/
  8745. #line 18270 "./typica.w"
  8746. void ModbusRTUDevice::dataAvailable()
  8747. {
  8748. if(messageDelayTimer->isActive())
  8749. {
  8750. messageDelayTimer->stop();
  8751. }
  8752. responseBuffer.append(port->readAll());
  8753. /*842:*/
  8754. #line 18316 "./typica.w"
  8755. if(responseBuffer.size()<5)
  8756. {
  8757. return;
  8758. }
  8759. switch(responseBuffer.at(1))
  8760. {
  8761. case 0x01:
  8762. case 0x02:
  8763. if(responseBuffer.size()<6)
  8764. {
  8765. return;
  8766. }
  8767. responseBuffer= responseBuffer.left(6);
  8768. break;
  8769. case 0x03:
  8770. case 0x04:
  8771. if(responseBuffer.size()<5+responseBuffer.at(2))
  8772. {
  8773. return;
  8774. }
  8775. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  8776. break;
  8777. case 0x05:
  8778. case 0x06:
  8779. case 0x10:
  8780. if(responseBuffer.size()<8)
  8781. {
  8782. return;
  8783. }
  8784. responseBuffer= responseBuffer.left(8);
  8785. break;
  8786. }
  8787. /*:842*/
  8788. #line 18278 "./typica.w"
  8789. commTimeout->stop();
  8790. if(calculateCRC(responseBuffer)==0)
  8791. {
  8792. QObject*object= retObjQueue.at(0);
  8793. char*method= callbackQueue.at(0);
  8794. QMetaMethod metamethod= object->metaObject()->
  8795. method(object->metaObject()->
  8796. indexOfMethod(QMetaObject::normalizedSignature(method)));
  8797. metamethod.invoke(object,Qt::QueuedConnection,
  8798. Q_ARG(QByteArray,responseBuffer));
  8799. messageQueue.removeAt(0);
  8800. retObjQueue.removeAt(0);
  8801. callbackQueue.removeAt(0);
  8802. }
  8803. else
  8804. {
  8805. qDebug()<<"CRC failed";
  8806. }
  8807. messageDelayTimer->start(delayTime);
  8808. waiting= false;
  8809. responseBuffer.clear();
  8810. }
  8811. /*:841*//*843:*/
  8812. #line 18358 "./typica.w"
  8813. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  8814. {
  8815. quint16 retval= 0xFFFF;
  8816. int i= 0;
  8817. while(i<data.size())
  8818. {
  8819. retval^= 0x00FF&(quint16)data.at(i);
  8820. for(int j= 0;j<8;j++)
  8821. {
  8822. if(retval&1)
  8823. {
  8824. retval= (retval>>1)^0xA001;
  8825. }
  8826. else
  8827. {
  8828. retval>>= 1;
  8829. }
  8830. }
  8831. i++;
  8832. }
  8833. return retval;
  8834. }
  8835. /*:843*//*844:*/
  8836. #line 18389 "./typica.w"
  8837. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  8838. const char*callback)
  8839. {
  8840. messageQueue.append(request);
  8841. retObjQueue.append(object);
  8842. callbackQueue.append(const_cast<char*> (callback));
  8843. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  8844. {
  8845. sendNextMessage();
  8846. }
  8847. }
  8848. void ModbusRTUDevice::sendNextMessage()
  8849. {
  8850. if(messageQueue.size()> 0&&!waiting)
  8851. {
  8852. QByteArray message= messageQueue.at(0);
  8853. quint16 crc= calculateCRC(message);
  8854. char*check= (char*)&crc;
  8855. message.append(check[0]);
  8856. message.append(check[1]);
  8857. port->write(message);
  8858. commTimeout->start(2000);
  8859. messageDelayTimer->start(delayTime);
  8860. waiting= true;
  8861. }
  8862. else
  8863. {
  8864. emit queueEmpty();
  8865. }
  8866. }
  8867. void ModbusRTUDevice::outputSV(double value)
  8868. {
  8869. for(int i= 0;i<decimalPosition;i++)
  8870. {
  8871. value*= 10;
  8872. }
  8873. quint16 outval= (quint16)value;
  8874. QByteArray message(outputSVStub);
  8875. char*valBytes= (char*)&outval;
  8876. message.append(valBytes[1]);
  8877. message.append(valBytes[0]);
  8878. queueMessage(message,this,"ignore(QByteArray)");
  8879. }
  8880. /*:844*//*845:*/
  8881. #line 18438 "./typica.w"
  8882. void ModbusRTUDevice::ignore(QByteArray)
  8883. {
  8884. return;
  8885. }
  8886. /*:845*//*846:*/
  8887. #line 18451 "./typica.w"
  8888. void ModbusRTUDevice::timeout()
  8889. {
  8890. qDebug()<<"Communications timeout.";
  8891. responseBuffer.clear();
  8892. waiting= false;
  8893. messageDelayTimer->start();
  8894. }
  8895. /*:846*/
  8896. #line 580 "./typica.w"
  8897. /*715:*/
  8898. #line 15061 "./typica.w"
  8899. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  8900. DeviceTreeModelNode*parent)
  8901. :domNode(node),rowNumber(row),parentItem(parent)
  8902. {
  8903. }
  8904. DeviceTreeModelNode::~DeviceTreeModelNode()
  8905. {
  8906. QHash<int,DeviceTreeModelNode*> ::iterator i;
  8907. for(i= children.begin();i!=children.end();i++)
  8908. {
  8909. delete i.value();
  8910. }
  8911. }
  8912. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  8913. {
  8914. return parentItem;
  8915. }
  8916. int DeviceTreeModelNode::row()
  8917. {
  8918. return rowNumber;
  8919. }
  8920. QDomNode DeviceTreeModelNode::node()const
  8921. {
  8922. return domNode;
  8923. }
  8924. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  8925. {
  8926. if(children.contains(index))
  8927. {
  8928. return children[index];
  8929. }
  8930. if(index>=0&&index<domNode.childNodes().count())
  8931. {
  8932. QDomNode childNode= domNode.childNodes().item(index);
  8933. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  8934. index,this);
  8935. children[index]= childItem;
  8936. return childItem;
  8937. }
  8938. return NULL;
  8939. }
  8940. /*:715*/
  8941. #line 581 "./typica.w"
  8942. /*717:*/
  8943. #line 15150 "./typica.w"
  8944. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  8945. :QAbstractItemModel(parent)
  8946. {
  8947. document= AppInstance->deviceConfiguration();
  8948. QDomNodeList elements= document.elementsByTagName("devices");
  8949. if(elements.size()!=1)
  8950. {
  8951. qDebug()<<"Unexpected result when loading device map.";
  8952. }
  8953. treeRoot= elements.at(0);
  8954. root= new DeviceTreeModelNode(treeRoot,0);
  8955. elements= document.elementsByTagName("references");
  8956. if(elements.size()!=1)
  8957. {
  8958. qDebug()<<"No references section. Creating.";
  8959. referenceSection= document.createElement("references");
  8960. document.appendChild(referenceSection);
  8961. }
  8962. else
  8963. {
  8964. referenceSection= elements.at(0);
  8965. }
  8966. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  8967. AppInstance,SLOT(saveDeviceConfiguration()));
  8968. connect(this,SIGNAL(modelReset()),
  8969. AppInstance,SLOT(saveDeviceConfiguration()));
  8970. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8971. AppInstance,SLOT(saveDeviceConfiguration()));
  8972. }
  8973. /*:717*//*718:*/
  8974. #line 15185 "./typica.w"
  8975. int DeviceTreeModel::columnCount(const QModelIndex&)const
  8976. {
  8977. return 1;
  8978. }
  8979. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  8980. {
  8981. if(parent.column()> 0)
  8982. {
  8983. return 0;
  8984. }
  8985. /*719:*/
  8986. #line 15204 "./typica.w"
  8987. DeviceTreeModelNode*parentItem;
  8988. if(!parent.isValid())
  8989. {
  8990. parentItem= root;
  8991. }
  8992. else
  8993. {
  8994. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8995. }
  8996. /*:719*/
  8997. #line 15197 "./typica.w"
  8998. return parentItem->node().childNodes().count();
  8999. }
  9000. /*:718*//*720:*/
  9001. #line 15218 "./typica.w"
  9002. QModelIndex DeviceTreeModel::index(int row,int column,
  9003. const QModelIndex&parent)const
  9004. {
  9005. if(!hasIndex(row,column,parent))
  9006. {
  9007. return QModelIndex();
  9008. }
  9009. /*719:*/
  9010. #line 15204 "./typica.w"
  9011. DeviceTreeModelNode*parentItem;
  9012. if(!parent.isValid())
  9013. {
  9014. parentItem= root;
  9015. }
  9016. else
  9017. {
  9018. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9019. }
  9020. /*:719*/
  9021. #line 15226 "./typica.w"
  9022. DeviceTreeModelNode*childItem= parentItem->child(row);
  9023. if(childItem)
  9024. {
  9025. return createIndex(row,column,childItem);
  9026. }
  9027. return QModelIndex();
  9028. }
  9029. /*:720*//*721:*/
  9030. #line 15237 "./typica.w"
  9031. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  9032. {
  9033. if(!child.isValid())
  9034. {
  9035. return QModelIndex();
  9036. }
  9037. DeviceTreeModelNode*childItem=
  9038. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  9039. DeviceTreeModelNode*parentItem= childItem->parent();
  9040. if(!parentItem||parentItem==root)
  9041. {
  9042. return QModelIndex();
  9043. }
  9044. return createIndex(parentItem->row(),0,parentItem);
  9045. }
  9046. /*:721*//*722:*/
  9047. #line 15256 "./typica.w"
  9048. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  9049. {
  9050. if(!index.isValid())
  9051. {
  9052. return 0;
  9053. }
  9054. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  9055. }
  9056. /*:722*//*723:*/
  9057. #line 15271 "./typica.w"
  9058. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  9059. {
  9060. if(!index.isValid())
  9061. {
  9062. return QVariant();
  9063. }
  9064. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  9065. {
  9066. return QVariant();
  9067. }
  9068. DeviceTreeModelNode*item=
  9069. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9070. QDomNode node= item->node();
  9071. QDomElement element= node.toElement();
  9072. switch(role)
  9073. {
  9074. case Qt::DisplayRole:
  9075. case Qt::EditRole:
  9076. return QVariant(element.attribute("name"));
  9077. case Qt::UserRole:
  9078. return QVariant(element.attribute("reference"));
  9079. default:
  9080. return QVariant();
  9081. }
  9082. return QVariant();
  9083. }
  9084. /*:723*//*724:*/
  9085. #line 15303 "./typica.w"
  9086. bool DeviceTreeModel::setData(const QModelIndex&index,
  9087. const QVariant&value,int)
  9088. {
  9089. if(!index.isValid())
  9090. {
  9091. return false;
  9092. }
  9093. DeviceTreeModelNode*item=
  9094. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9095. QDomNode node= item->node();
  9096. QDomElement element= node.toElement();
  9097. element.setAttribute("name",value.toString());
  9098. emit dataChanged(index,index);
  9099. return true;
  9100. }
  9101. /*:724*//*725:*/
  9102. #line 15326 "./typica.w"
  9103. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  9104. const QModelIndex&parent)
  9105. {
  9106. QString referenceID= QUuid::createUuid().toString();
  9107. /*719:*/
  9108. #line 15204 "./typica.w"
  9109. DeviceTreeModelNode*parentItem;
  9110. if(!parent.isValid())
  9111. {
  9112. parentItem= root;
  9113. }
  9114. else
  9115. {
  9116. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9117. }
  9118. /*:719*/
  9119. #line 15331 "./typica.w"
  9120. QDomNode parentNode= parentItem->node();
  9121. int newRowNumber= rowCount(parent);
  9122. beginInsertRows(parent,newRowNumber,newRowNumber);
  9123. QDomElement deviceElement= document.createElement("node");
  9124. deviceElement.setAttribute("name",name);
  9125. deviceElement.setAttribute("reference",referenceID);
  9126. parentNode.appendChild(deviceElement);
  9127. QDomElement referenceElement= document.createElement("reference");
  9128. referenceElement.setAttribute("id",referenceID);
  9129. referenceElement.setAttribute("driver",driver);
  9130. referenceSection.appendChild(referenceElement);
  9131. endInsertRows();
  9132. }
  9133. /*:725*//*726:*/
  9134. #line 15349 "./typica.w"
  9135. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  9136. {
  9137. /*719:*/
  9138. #line 15204 "./typica.w"
  9139. DeviceTreeModelNode*parentItem;
  9140. if(!parent.isValid())
  9141. {
  9142. parentItem= root;
  9143. }
  9144. else
  9145. {
  9146. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9147. }
  9148. /*:719*/
  9149. #line 15352 "./typica.w"
  9150. QDomNode parentNode= parentItem->node();
  9151. QDomNodeList childNodes= parentNode.childNodes();
  9152. if(childNodes.size()<row+count)
  9153. {
  9154. return false;
  9155. }
  9156. beginRemoveRows(parent,row,row+count-1);
  9157. QList<QDomElement> removalList;
  9158. for(int i= row;i<row+count;i++)
  9159. {
  9160. removalList.append(childNodes.at(i).toElement());
  9161. }
  9162. QDomElement element;
  9163. QDomElement reference;
  9164. for(int i= 0;i<count;i++)
  9165. {
  9166. element= removalList.at(i);
  9167. if(element.hasAttribute("reference"))
  9168. {
  9169. reference= referenceElement(element.attribute("reference"));
  9170. if(!reference.isNull())
  9171. {
  9172. referenceSection.removeChild(reference);
  9173. }
  9174. }
  9175. parentNode.removeChild(element);
  9176. }
  9177. endRemoveRows();
  9178. beginResetModel();
  9179. delete root;
  9180. root= new DeviceTreeModelNode(treeRoot,0);
  9181. endResetModel();
  9182. return true;
  9183. }
  9184. /*:726*//*727:*/
  9185. #line 15391 "./typica.w"
  9186. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  9187. {
  9188. QDomNodeList childNodes= referenceSection.childNodes();
  9189. QDomElement element;
  9190. for(int i= 0;i<childNodes.size();i++)
  9191. {
  9192. element= childNodes.at(i).toElement();
  9193. if(element.hasAttribute("id"))
  9194. {
  9195. if(element.attribute("id")==id)
  9196. {
  9197. return element;
  9198. }
  9199. }
  9200. }
  9201. return QDomElement();
  9202. }
  9203. /*:727*//*728:*/
  9204. #line 15412 "./typica.w"
  9205. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  9206. {
  9207. return QVariant();
  9208. }
  9209. /*:728*//*729:*/
  9210. #line 15421 "./typica.w"
  9211. DeviceTreeModel::~DeviceTreeModel()
  9212. {
  9213. delete root;
  9214. }
  9215. /*:729*/
  9216. #line 582 "./typica.w"
  9217. /*756:*/
  9218. #line 15921 "./typica.w"
  9219. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  9220. DeviceTreeModel*model,const QModelIndex&index)
  9221. :QWidget(NULL),deviceModel(model),currentNode(index)
  9222. {
  9223. }
  9224. /*:756*//*757:*/
  9225. #line 15933 "./typica.w"
  9226. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  9227. const QString&value)
  9228. {
  9229. QDomElement referenceElement= deviceModel->referenceElement(
  9230. deviceModel->data(currentNode,Qt::UserRole).toString());
  9231. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9232. QDomElement node;
  9233. bool found= false;
  9234. for(int i= 0;i<configData.size();i++)
  9235. {
  9236. node= configData.at(i).toElement();
  9237. if(node.attribute("name")==name)
  9238. {
  9239. node.setAttribute("value",value);
  9240. found= true;
  9241. break;
  9242. }
  9243. }
  9244. if(!found)
  9245. {
  9246. node= AppInstance->deviceConfiguration().createElement("attribute");
  9247. node.setAttribute("name",name);
  9248. node.setAttribute("value",value);
  9249. referenceElement.appendChild(node);
  9250. }
  9251. AppInstance->saveDeviceConfiguration();
  9252. }
  9253. /*:757*//*758:*/
  9254. #line 15967 "./typica.w"
  9255. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  9256. const QString&driver)
  9257. {
  9258. deviceModel->newNode(name,driver,currentNode);
  9259. }
  9260. /*:758*/
  9261. #line 583 "./typica.w"
  9262. /*747:*/
  9263. #line 15765 "./typica.w"
  9264. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  9265. view(new QTreeView),configArea(new QScrollArea)
  9266. {
  9267. QSplitter*splitter= new QSplitter;
  9268. QWidget*leftWidget= new QWidget;
  9269. leftWidget->setMinimumWidth(200);
  9270. QVBoxLayout*left= new QVBoxLayout;
  9271. view->setAnimated(true);
  9272. view->setSelectionMode(QAbstractItemView::SingleSelection);
  9273. document= AppInstance->deviceConfiguration();
  9274. model= new DeviceTreeModel;
  9275. view->setModel(model);
  9276. view->setTextElideMode(Qt::ElideNone);
  9277. view->expandAll();
  9278. view->resizeColumnToContents(0);
  9279. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  9280. QHBoxLayout*treeButtons= new QHBoxLayout;
  9281. QToolButton*addDeviceButton= new QToolButton;
  9282. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  9283. addDeviceButton->setToolTip(tr("New Roaster"));
  9284. connect(addDeviceButton,SIGNAL(clicked()),
  9285. this,SLOT(addDevice()));
  9286. QToolButton*removeNodeButton= new QToolButton;
  9287. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  9288. removeNodeButton->setToolTip(tr("Delete Selection"));
  9289. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  9290. treeButtons->addWidget(addDeviceButton);
  9291. treeButtons->addWidget(removeNodeButton);
  9292. left->addWidget(view);
  9293. left->addLayout(treeButtons);
  9294. leftWidget->setLayout(left);
  9295. splitter->addWidget(leftWidget);
  9296. configArea->setMinimumWidth(580);
  9297. configArea->setMinimumHeight(460);
  9298. configArea->setWidgetResizable(true);
  9299. splitter->addWidget(configArea);
  9300. QVBoxLayout*centralLayout= new QVBoxLayout;
  9301. centralLayout->addWidget(splitter);
  9302. setLayout(centralLayout);
  9303. connect(view,SIGNAL(activated(QModelIndex)),
  9304. this,SLOT(newSelection(QModelIndex)));
  9305. connect(view,SIGNAL(clicked(QModelIndex)),
  9306. this,SLOT(newSelection(QModelIndex)));
  9307. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9308. view,SLOT(expand(QModelIndex)));
  9309. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9310. this,SLOT(resizeColumn()));
  9311. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  9312. this,SLOT(resizeColumn()));
  9313. }
  9314. /*:747*//*748:*/
  9315. #line 15820 "./typica.w"
  9316. void DeviceConfigurationWindow::addDevice()
  9317. {
  9318. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  9319. }
  9320. /*:748*//*749:*/
  9321. #line 15828 "./typica.w"
  9322. void DeviceConfigurationWindow::removeNode()
  9323. {
  9324. QModelIndex index= view->currentIndex();
  9325. if(index.isValid())
  9326. {
  9327. int row= index.row();
  9328. QModelIndex parent= index.parent();
  9329. model->removeRow(row,parent);
  9330. }
  9331. }
  9332. /*:749*//*750:*/
  9333. #line 15844 "./typica.w"
  9334. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  9335. {
  9336. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  9337. if(editor)
  9338. {
  9339. configArea->setWidget(editor);
  9340. editor->show();
  9341. }
  9342. }
  9343. /*:750*//*751:*/
  9344. #line 15861 "./typica.w"
  9345. void DeviceConfigurationWindow::resizeColumn()
  9346. {
  9347. view->resizeColumnToContents(0);
  9348. }
  9349. /*:751*/
  9350. #line 584 "./typica.w"
  9351. /*771:*/
  9352. #line 16291 "./typica.w"
  9353. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  9354. const QModelIndex&index):
  9355. BasicDeviceConfigurationWidget(model,index)
  9356. {
  9357. QFormLayout*layout= new QFormLayout;
  9358. QLineEdit*columnName= new QLineEdit;
  9359. layout->addRow(tr("Column Name:"),columnName);
  9360. QComboBox*typeSelector= new QComboBox;
  9361. typeSelector->addItem("J");
  9362. typeSelector->addItem("K");
  9363. typeSelector->addItem("T");
  9364. typeSelector->addItem("B");
  9365. typeSelector->addItem("E");
  9366. typeSelector->addItem("N");
  9367. typeSelector->addItem("R");
  9368. typeSelector->addItem("S");
  9369. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9370. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  9371. layout->addRow(hideSeries);
  9372. setLayout(layout);
  9373. /*761:*/
  9374. #line 16100 "./typica.w"
  9375. QDomElement referenceElement=
  9376. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9377. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9378. QDomElement node;
  9379. /*:761*/
  9380. #line 16312 "./typica.w"
  9381. for(int i= 0;i<configData.size();i++)
  9382. {
  9383. node= configData.at(i).toElement();
  9384. if(node.attribute("name")=="type")
  9385. {
  9386. typeSelector->setCurrentIndex(
  9387. typeSelector->findText(node.attribute("value")));
  9388. }
  9389. else if(node.attribute("name")=="columnname")
  9390. {
  9391. columnName->setText(node.attribute("value"));
  9392. }
  9393. else if(node.attribute("name")=="hidden")
  9394. {
  9395. hideSeries->setChecked(node.attribute("value")=="true");
  9396. }
  9397. }
  9398. updateThermocoupleType(typeSelector->currentText());
  9399. updateColumnName(columnName->text());
  9400. updateHidden(hideSeries->isChecked());
  9401. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  9402. this,SLOT(updateThermocoupleType(QString)));
  9403. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9404. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9405. }
  9406. /*:771*//*772:*/
  9407. #line 16342 "./typica.w"
  9408. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  9409. {
  9410. updateAttribute("type",type);
  9411. }
  9412. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  9413. {
  9414. updateAttribute("columnname",name);
  9415. }
  9416. void Ni9211TcConfWidget::updateHidden(bool hidden)
  9417. {
  9418. updateAttribute("hidden",hidden?"true":"false");
  9419. }
  9420. /*:772*/
  9421. #line 585 "./typica.w"
  9422. /*767:*/
  9423. #line 16205 "./typica.w"
  9424. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  9425. const QModelIndex&index)
  9426. :BasicDeviceConfigurationWidget(model,index)
  9427. {
  9428. QVBoxLayout*layout= new QVBoxLayout;
  9429. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9430. QLabel*label= new QLabel(tr("Device ID:"));
  9431. QLineEdit*deviceId= new QLineEdit;
  9432. deviceIdLayout->addWidget(label);
  9433. deviceIdLayout->addWidget(deviceId);
  9434. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9435. layout->addLayout(deviceIdLayout);
  9436. layout->addWidget(addChannelButton);
  9437. /*761:*/
  9438. #line 16100 "./typica.w"
  9439. QDomElement referenceElement=
  9440. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9441. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9442. QDomElement node;
  9443. /*:761*/
  9444. #line 16219 "./typica.w"
  9445. for(int i= 0;i<configData.size();i++)
  9446. {
  9447. node= configData.at(i).toElement();
  9448. if(node.attribute("name")=="deviceID")
  9449. {
  9450. deviceId->setText(node.attribute("value","Dev1"));
  9451. break;
  9452. }
  9453. }
  9454. updateDeviceId(deviceId->text());
  9455. connect(addChannelButton,SIGNAL(clicked()),
  9456. this,SLOT(addChannel()));
  9457. connect(deviceId,SIGNAL(textEdited(QString)),
  9458. this,SLOT(updateDeviceId(QString)));
  9459. setLayout(layout);
  9460. }
  9461. /*:767*//*768:*/
  9462. #line 16241 "./typica.w"
  9463. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  9464. {
  9465. updateAttribute("deviceID",newId);
  9466. }
  9467. /*:768*//*769:*/
  9468. #line 16249 "./typica.w"
  9469. void NiDaqMxBase9211ConfWidget::addChannel()
  9470. {
  9471. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9472. }
  9473. /*:769*/
  9474. #line 586 "./typica.w"
  9475. /*765:*/
  9476. #line 16156 "./typica.w"
  9477. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  9478. DeviceTreeModel*model,const QModelIndex&index):
  9479. BasicDeviceConfigurationWidget(model,index)
  9480. {
  9481. QHBoxLayout*layout= new QHBoxLayout;
  9482. QToolButton*addDeviceButton= new QToolButton;
  9483. addDeviceButton->setText(tr("Add Device"));
  9484. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  9485. "nidaqmxbase9211series");
  9486. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9487. "nidaqmxbase9211series");
  9488. connect(add9211,SIGNAL(triggered(QString,QString)),
  9489. this,SLOT(insertChildNode(QString,QString)));
  9490. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9491. this,SLOT(insertChildNode(QString,QString)));
  9492. QMenu*deviceMenu= new QMenu;
  9493. deviceMenu->addAction(add9211);
  9494. deviceMenu->addAction(add9211a);
  9495. addDeviceButton->setMenu(deviceMenu);
  9496. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9497. layout->addWidget(addDeviceButton);
  9498. setLayout(layout);
  9499. }
  9500. /*:765*/
  9501. #line 587 "./typica.w"
  9502. /*632:*/
  9503. #line 13683 "./typica.w"
  9504. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  9505. QObject*parent):
  9506. QAction(reportName,parent),reportFile(fileName)
  9507. {
  9508. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  9509. }
  9510. /*:632*//*633:*/
  9511. #line 13699 "./typica.w"
  9512. void ReportAction::createReport()
  9513. {
  9514. QFile file(reportFile);
  9515. QDomDocument document;
  9516. if(file.open(QIODevice::ReadOnly))
  9517. {
  9518. document.setContent(&file,true);
  9519. QDomElement element= document.documentElement();
  9520. QScriptEngine*engine= AppInstance->engine;
  9521. QScriptContext*context= engine->pushContext();
  9522. QScriptValue object;
  9523. QString targetID= reportFile;
  9524. /*188:*/
  9525. #line 4475 "./typica.w"
  9526. ScriptQMainWindow*window= new ScriptQMainWindow;
  9527. window->setObjectName(targetID);
  9528. object= engine->newQObject(window);
  9529. setQMainWindowProperties(object,engine);
  9530. QWidget*central= new(QWidget);
  9531. central->setParent(window);
  9532. central->setObjectName("centralWidget");
  9533. window->setCentralWidget(central);
  9534. if(element.hasChildNodes())
  9535. {
  9536. /*189:*/
  9537. #line 4510 "./typica.w"
  9538. QStack<QWidget*> widgetStack;
  9539. QStack<QLayout*> layoutStack;
  9540. QString windowScript;
  9541. widgetStack.push(central);
  9542. QDomNodeList windowChildren= element.childNodes();
  9543. int i= 0;
  9544. while(i<windowChildren.count())
  9545. {
  9546. QDomNode current;
  9547. QDomElement element;
  9548. current= windowChildren.at(i);
  9549. if(current.isElement())
  9550. {
  9551. element= current.toElement();
  9552. if(element.tagName()=="program")
  9553. {
  9554. windowScript.append(element.text());
  9555. }
  9556. else if(element.tagName()=="layout")
  9557. {
  9558. addLayoutToWidget(element,&widgetStack,&layoutStack);
  9559. }
  9560. else if(element.tagName()=="menu")
  9561. {
  9562. /*190:*/
  9563. #line 4557 "./typica.w"
  9564. QMenuBar*bar= window->menuBar();
  9565. bar->setParent(window);
  9566. bar->setObjectName("menuBar");
  9567. if(element.hasAttribute("name"))
  9568. {
  9569. QMenu*menu= bar->addMenu(element.attribute("name"));
  9570. menu->setParent(bar);
  9571. if(element.hasAttribute("type"))
  9572. {
  9573. if(element.attribute("type")=="reports")
  9574. {
  9575. if(element.hasAttribute("src"))
  9576. {
  9577. /*630:*/
  9578. #line 13643 "./typica.w"
  9579. QSettings settings;
  9580. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  9581. toString()).
  9582. arg(element.attribute("src"));
  9583. QDir::addSearchPath("reports",reportDirectory);
  9584. QDir directory(reportDirectory);
  9585. directory.setFilter(QDir::Files);
  9586. directory.setSorting(QDir::Name);
  9587. QStringList nameFilter;
  9588. nameFilter<<"*.xml";
  9589. directory.setNameFilters(nameFilter);
  9590. QFileInfoList reportFiles= directory.entryInfoList();
  9591. for(int i= 0;i<reportFiles.size();i++)
  9592. {
  9593. QFileInfo reportFile= reportFiles.at(i);
  9594. /*634:*/
  9595. #line 13723 "./typica.w"
  9596. QString path= reportFile.absoluteFilePath();
  9597. QFile file(path);
  9598. if(file.open(QIODevice::ReadOnly))
  9599. {
  9600. QDomDocument document;
  9601. document.setContent(&file,true);
  9602. QDomElement root= document.documentElement();
  9603. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  9604. if(!titleNode.isNull())
  9605. {
  9606. QDomElement titleElement= titleNode.toElement();
  9607. QString title= titleElement.text();
  9608. if(!title.isEmpty())
  9609. {
  9610. QStringList hierarchy= title.split(":->");
  9611. QMenu*insertionPoint= menu;
  9612. /*635:*/
  9613. #line 13750 "./typica.w"
  9614. for(int j= 0;j<hierarchy.size()-1;j++)
  9615. {
  9616. QObjectList menuList= insertionPoint->children();
  9617. bool menuFound= false;
  9618. for(int k= 0;k<menuList.size();k++)
  9619. {
  9620. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  9621. if(currentItem)
  9622. {
  9623. if(currentItem->title()==hierarchy.at(j))
  9624. {
  9625. menuFound= true;
  9626. insertionPoint= currentItem;
  9627. break;
  9628. }
  9629. }
  9630. }
  9631. if(!menuFound)
  9632. {
  9633. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  9634. }
  9635. }
  9636. /*:635*/
  9637. #line 13740 "./typica.w"
  9638. ReportAction*action= new ReportAction(path,hierarchy.last());
  9639. insertionPoint->addAction(action);
  9640. }
  9641. }
  9642. }
  9643. /*:634*/
  9644. #line 13659 "./typica.w"
  9645. }
  9646. /*:630*/
  9647. #line 4571 "./typica.w"
  9648. }
  9649. }
  9650. }
  9651. if(element.hasChildNodes())
  9652. {
  9653. /*191:*/
  9654. #line 4584 "./typica.w"
  9655. QDomNodeList menuItems= element.childNodes();
  9656. int j= 0;
  9657. while(j<menuItems.count())
  9658. {
  9659. QDomNode item= menuItems.at(j);
  9660. if(item.isElement())
  9661. {
  9662. QDomElement itemElement= item.toElement();
  9663. if(itemElement.tagName()=="item")
  9664. {
  9665. QAction*itemAction= new QAction(itemElement.text(),menu);
  9666. if(itemElement.hasAttribute("id"))
  9667. {
  9668. itemAction->setObjectName(itemElement.attribute("id"));
  9669. }
  9670. if(itemElement.hasAttribute("shortcut"))
  9671. {
  9672. itemAction->setShortcut(itemElement.attribute("shortcut"));
  9673. }
  9674. menu->addAction(itemAction);
  9675. }
  9676. else if(itemElement.tagName()=="separator")
  9677. {
  9678. menu->addSeparator();
  9679. }
  9680. }
  9681. j++;
  9682. }
  9683. #line 1 "./helpmenu.w"
  9684. /*:191*/
  9685. #line 4577 "./typica.w"
  9686. }
  9687. }
  9688. /*:190*/
  9689. #line 4535 "./typica.w"
  9690. }
  9691. }
  9692. i++;
  9693. }
  9694. QScriptValue oldThis= context->thisObject();
  9695. context->setThisObject(object);
  9696. QScriptValue result= engine->evaluate(windowScript);
  9697. /*182:*/
  9698. #line 4292 "./typica.w"
  9699. if(engine->hasUncaughtException())
  9700. {
  9701. int line= engine->uncaughtExceptionLineNumber();
  9702. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  9703. result.toString();
  9704. QString trace;
  9705. foreach(trace,engine->uncaughtExceptionBacktrace())
  9706. {
  9707. qDebug()<<trace;
  9708. }
  9709. }
  9710. /*:182*/
  9711. #line 4543 "./typica.w"
  9712. context->setThisObject(oldThis);
  9713. /*:189*/
  9714. #line 4486 "./typica.w"
  9715. }
  9716. /*192:*/
  9717. #line 9 "./helpmenu.w"
  9718. HelpMenu*helpMenu= new HelpMenu();
  9719. window->menuBar()->addMenu(helpMenu);
  9720. /*:192*/
  9721. #line 4488 "./typica.w"
  9722. window->show();
  9723. /*:188*/
  9724. #line 13712 "./typica.w"
  9725. file.close();
  9726. engine->popContext();
  9727. }
  9728. }
  9729. /*:633*/
  9730. #line 588 "./typica.w"
  9731. /*231:*/
  9732. #line 5652 "./typica.w"
  9733. NumericDelegate::NumericDelegate(QObject*parent):
  9734. QItemDelegate(parent)
  9735. {
  9736. }
  9737. /*:231*//*232:*/
  9738. #line 5664 "./typica.w"
  9739. void NumericDelegate::setEditorData(QWidget*editor,
  9740. const QModelIndex&index)const
  9741. {
  9742. QString value= index.model()->data(index,Qt::EditRole).toString();
  9743. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9744. line->setText(value);
  9745. }
  9746. /*:232*//*233:*/
  9747. #line 5679 "./typica.w"
  9748. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  9749. const QModelIndex&index)const
  9750. {
  9751. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9752. model->setData(index,line->text(),Qt::EditRole);
  9753. QScriptEngine*engine= AppInstance->engine;
  9754. engine->pushContext();
  9755. QString script= QString("Number(%1)").arg(line->text());
  9756. QScriptValue result= engine->evaluate(line->text());
  9757. if(result.isNumber())
  9758. {
  9759. model->setData(index,result.toVariant(),Qt::DisplayRole);
  9760. }
  9761. else
  9762. {
  9763. model->setData(index,QVariant(),Qt::DisplayRole);
  9764. }
  9765. engine->popContext();
  9766. }
  9767. /*:233*//*234:*/
  9768. #line 5702 "./typica.w"
  9769. QWidget*NumericDelegate::createEditor(QWidget*parent,
  9770. const QStyleOptionViewItem&,
  9771. const QModelIndex&)const
  9772. {
  9773. return(new QLineEdit(parent));
  9774. }
  9775. /*:234*//*235:*/
  9776. #line 5713 "./typica.w"
  9777. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  9778. const QStyleOptionViewItem&option,
  9779. const QModelIndex&)const
  9780. {
  9781. editor->setGeometry(option.rect);
  9782. }
  9783. /*:235*/
  9784. #line 589 "./typica.w"
  9785. /*776:*/
  9786. #line 16401 "./typica.w"
  9787. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  9788. const QModelIndex&index)
  9789. :BasicDeviceConfigurationWidget(model,index)
  9790. {
  9791. QHBoxLayout*layout= new QHBoxLayout;
  9792. QToolButton*addDeviceButton= new QToolButton;
  9793. addDeviceButton->setText(tr("Add Device"));
  9794. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9795. "nidaqmx9211series");
  9796. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  9797. "nidaqmxtc01");
  9798. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9799. this,SLOT(insertChildNode(QString,QString)));
  9800. connect(addtc01,SIGNAL(triggered(QString,QString)),
  9801. this,SLOT(insertChildNode(QString,QString)));
  9802. QMenu*deviceMenu= new QMenu;
  9803. deviceMenu->addAction(add9211a);
  9804. deviceMenu->addAction(addtc01);
  9805. addDeviceButton->setMenu(deviceMenu);
  9806. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9807. layout->addWidget(addDeviceButton);
  9808. setLayout(layout);
  9809. }
  9810. /*:776*/
  9811. #line 590 "./typica.w"
  9812. /*778:*/
  9813. #line 16450 "./typica.w"
  9814. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  9815. const QModelIndex&index)
  9816. :BasicDeviceConfigurationWidget(model,index)
  9817. {
  9818. QVBoxLayout*layout= new QVBoxLayout;
  9819. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9820. QLabel*label= new QLabel(tr("Device ID:"));
  9821. QLineEdit*deviceId= new QLineEdit;
  9822. deviceIdLayout->addWidget(label);
  9823. deviceIdLayout->addWidget(deviceId);
  9824. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9825. layout->addLayout(deviceIdLayout);
  9826. layout->addWidget(addChannelButton);
  9827. /*761:*/
  9828. #line 16100 "./typica.w"
  9829. QDomElement referenceElement=
  9830. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9831. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9832. QDomElement node;
  9833. /*:761*/
  9834. #line 16464 "./typica.w"
  9835. for(int i= 0;i<configData.size();i++)
  9836. {
  9837. node= configData.at(i).toElement();
  9838. if(node.attribute("name")=="deviceID")
  9839. {
  9840. deviceId->setText(node.attribute("value","Dev1"));
  9841. break;
  9842. }
  9843. }
  9844. updateDeviceId(deviceId->text());
  9845. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  9846. connect(deviceId,SIGNAL(textEdited(QString)),
  9847. this,SLOT(updateDeviceId(QString)));
  9848. setLayout(layout);
  9849. }
  9850. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  9851. {
  9852. updateAttribute("deviceID",newId);
  9853. }
  9854. void NiDaqMx9211ConfWidget::addChannel()
  9855. {
  9856. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9857. }
  9858. /*:778*/
  9859. #line 591 "./typica.w"
  9860. /*780:*/
  9861. #line 16515 "./typica.w"
  9862. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  9863. const QModelIndex&index)
  9864. :BasicDeviceConfigurationWidget(model,index)
  9865. {
  9866. QFormLayout*layout= new QFormLayout;
  9867. QLineEdit*deviceId= new QLineEdit;
  9868. layout->addRow(tr("Device ID:"),deviceId);
  9869. QLineEdit*columnName= new QLineEdit;
  9870. layout->addRow(tr("Column Name:"),columnName);
  9871. QComboBox*typeSelector= new QComboBox;
  9872. typeSelector->addItem("J");
  9873. typeSelector->addItem("K");
  9874. typeSelector->addItem("T");
  9875. typeSelector->addItem("B");
  9876. typeSelector->addItem("E");
  9877. typeSelector->addItem("N");
  9878. typeSelector->addItem("R");
  9879. typeSelector->addItem("S");
  9880. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9881. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  9882. layout->addRow(hideSeries);
  9883. /*761:*/
  9884. #line 16100 "./typica.w"
  9885. QDomElement referenceElement=
  9886. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9887. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9888. QDomElement node;
  9889. /*:761*/
  9890. #line 16537 "./typica.w"
  9891. for(int i= 0;i<configData.size();i++)
  9892. {
  9893. node= configData.at(i).toElement();
  9894. if(node.attribute("name")=="deviceID")
  9895. {
  9896. deviceId->setText(node.attribute("value"));
  9897. }
  9898. else if(node.attribute("name")=="type")
  9899. {
  9900. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  9901. }
  9902. else if(node.attribute("name")=="columnname")
  9903. {
  9904. columnName->setText(node.attribute("value"));
  9905. }
  9906. else if(node.attribute("name")=="hidden")
  9907. {
  9908. hideSeries->setChecked(node.attribute("value")=="true");
  9909. }
  9910. }
  9911. updateDeviceId(deviceId->text());
  9912. updateThermocoupleType(typeSelector->currentText());
  9913. updateColumnName(columnName->text());
  9914. updateHidden(hideSeries->isChecked());
  9915. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  9916. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  9917. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9918. setLayout(layout);
  9919. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9920. }
  9921. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  9922. {
  9923. updateAttribute("deviceID",newId);
  9924. }
  9925. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  9926. {
  9927. updateAttribute("type",type);
  9928. }
  9929. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  9930. {
  9931. updateAttribute("columnname",name);
  9932. }
  9933. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  9934. {
  9935. updateAttribute("hidden",hidden?"true":"false");
  9936. }
  9937. /*:780*/
  9938. #line 592 "./typica.w"
  9939. /*798:*/
  9940. #line 16953 "./typica.w"
  9941. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  9942. const QModelIndex&index)
  9943. :BasicDeviceConfigurationWidget(model,index)
  9944. {
  9945. QFormLayout*layout= new QFormLayout;
  9946. QToolButton*addDeviceButton= new QToolButton;
  9947. addDeviceButton->setText(tr("Add Device"));
  9948. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  9949. "Modbus RTU Device",
  9950. "modbusrtudevice");
  9951. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  9952. this,SLOT(insertChildNode(QString,QString)));
  9953. QMenu*deviceMenu= new QMenu;
  9954. deviceMenu->addAction(addModbusRtuDevice);
  9955. addDeviceButton->setMenu(deviceMenu);
  9956. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9957. layout->addRow(QString(),addDeviceButton);
  9958. PortSelector*port= new PortSelector;
  9959. layout->addRow(tr("Port:"),port);
  9960. connect(port,SIGNAL(currentIndexChanged(QString)),
  9961. this,SLOT(updatePort(QString)));
  9962. connect(port,SIGNAL(editTextChanged(QString)),
  9963. this,SLOT(updatePort(QString)));
  9964. BaudSelector*rate= new BaudSelector;
  9965. layout->addRow(tr("Baud:"),rate);
  9966. connect(rate,SIGNAL(currentIndexChanged(QString)),
  9967. this,SLOT(updateBaudRate(QString)));
  9968. ParitySelector*parity= new ParitySelector;
  9969. layout->addRow(tr("Parity:"),parity);
  9970. connect(parity,SIGNAL(currentIndexChanged(QString)),
  9971. this,SLOT(updateParity(QString)));
  9972. FlowSelector*flow= new FlowSelector;
  9973. layout->addRow(tr("Flow Control:"),flow);
  9974. connect(flow,SIGNAL(currentIndexChanged(QString)),
  9975. this,SLOT(updateFlowControl(QString)));
  9976. StopSelector*stop= new StopSelector;
  9977. layout->addRow(tr("Stop Bits:"),stop);
  9978. connect(stop,SIGNAL(currentIndexChanged(QString)),
  9979. this,SLOT(updateStopBits(QString)));
  9980. /*761:*/
  9981. #line 16100 "./typica.w"
  9982. QDomElement referenceElement=
  9983. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9984. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9985. QDomElement node;
  9986. /*:761*/
  9987. #line 16993 "./typica.w"
  9988. for(int i= 0;i<configData.size();i++)
  9989. {
  9990. node= configData.at(i).toElement();
  9991. if(node.attribute("name")=="port")
  9992. {
  9993. int j= port->findText(node.attribute("value"));
  9994. if(j>=0)
  9995. {
  9996. port->setCurrentIndex(j);
  9997. }
  9998. else
  9999. {
  10000. port->insertItem(0,node.attribute("value"));
  10001. port->setCurrentIndex(0);
  10002. }
  10003. }
  10004. else if(node.attribute("name")=="baudrate")
  10005. {
  10006. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  10007. }
  10008. else if(node.attribute("name")=="parity")
  10009. {
  10010. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  10011. }
  10012. else if(node.attribute("name")=="flowcontrol")
  10013. {
  10014. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  10015. }
  10016. else if(node.attribute("name")=="stopbits")
  10017. {
  10018. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  10019. }
  10020. }
  10021. updatePort(port->currentText());
  10022. updateBaudRate(rate->currentText());
  10023. updateParity(parity->currentText());
  10024. updateFlowControl(flow->currentText());
  10025. updateStopBits(stop->currentText());
  10026. setLayout(layout);
  10027. }
  10028. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  10029. {
  10030. updateAttribute("port",newPort);
  10031. }
  10032. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  10033. {
  10034. updateAttribute("baudrate",newRate);
  10035. }
  10036. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  10037. {
  10038. updateAttribute("parity",newParity);
  10039. }
  10040. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  10041. {
  10042. updateAttribute("flowcontrol",newFlow);
  10043. }
  10044. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  10045. {
  10046. updateAttribute("stopbits",newStopBits);
  10047. }
  10048. /*:798*/
  10049. #line 593 "./typica.w"
  10050. /*800:*/
  10051. #line 17116 "./typica.w"
  10052. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  10053. const QModelIndex&index)
  10054. :BasicDeviceConfigurationWidget(model,index),
  10055. unitSpecificationLayout(new QStackedLayout),
  10056. decimalSpecificationLayout(new QStackedLayout)
  10057. {
  10058. QVBoxLayout*layout= new QVBoxLayout;
  10059. QToolButton*addChannelButton= new QToolButton;
  10060. addChannelButton->setText(tr("Add Channel"));
  10061. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  10062. "Temperature Process Value",
  10063. "modbustemperaturepv");
  10064. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  10065. "Temperature Set Value",
  10066. "modbustemperaturesv");
  10067. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  10068. this,SLOT(insertChildNode(QString,QString)));
  10069. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  10070. this,SLOT(insertChildNode(QString,QString)));
  10071. QMenu*channelMenu= new QMenu;
  10072. channelMenu->addAction(addTemperaturePV);
  10073. channelMenu->addAction(addTemperatureSV);
  10074. addChannelButton->setMenu(channelMenu);
  10075. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  10076. layout->addWidget(addChannelButton);
  10077. QHBoxLayout*stationLayout= new QHBoxLayout;
  10078. QLabel*stationLabel= new QLabel(tr("Station:"));
  10079. QSpinBox*stationNumber= new QSpinBox;
  10080. stationNumber->setMinimum(0);
  10081. stationNumber->setMaximum(255);
  10082. stationLayout->addWidget(stationLabel);
  10083. stationLayout->addWidget(stationNumber);
  10084. layout->addLayout(stationLayout);
  10085. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  10086. layout->addWidget(fixedUnit);
  10087. QWidget*fixedUnitPlaceholder= new QWidget(this);
  10088. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  10089. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  10090. QComboBox*fixedUnitSelector= new QComboBox;
  10091. fixedUnitSelector->addItem("Fahrenheit");
  10092. fixedUnitSelector->addItem("Celsius");
  10093. fixedUnitLayout->addWidget(fixedUnitLabel);
  10094. fixedUnitLayout->addWidget(fixedUnitSelector);
  10095. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  10096. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  10097. QWidget*queriedUnitPlaceholder= new QWidget(this);
  10098. QFormLayout*queriedUnitLayout= new QFormLayout;
  10099. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  10100. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  10101. QSpinBox*valueF= new QSpinBox;
  10102. valueF->setMinimum(0);
  10103. valueF->setMaximum(65535);
  10104. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  10105. QSpinBox*valueC= new QSpinBox;
  10106. valueC->setMinimum(0);
  10107. valueC->setMaximum(65535);
  10108. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  10109. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  10110. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  10111. layout->addLayout(unitSpecificationLayout);
  10112. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  10113. layout->addWidget(fixedPrecision);
  10114. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  10115. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  10116. QSpinBox*fixedPrecisionValue= new QSpinBox;
  10117. fixedPrecisionValue->setMinimum(0);
  10118. fixedPrecisionValue->setMaximum(9);
  10119. fixedPrecisionLayout->addRow("Places after the decimal point:",
  10120. fixedPrecisionValue);
  10121. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  10122. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  10123. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  10124. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  10125. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  10126. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  10127. precisionAddress);
  10128. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  10129. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  10130. layout->addLayout(decimalSpecificationLayout);
  10131. /*761:*/
  10132. #line 16100 "./typica.w"
  10133. QDomElement referenceElement=
  10134. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10135. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10136. QDomElement node;
  10137. /*:761*/
  10138. #line 17196 "./typica.w"
  10139. for(int i= 0;i<configData.size();i++)
  10140. {
  10141. node= configData.at(i).toElement();
  10142. if(node.attribute("name")=="station")
  10143. {
  10144. stationNumber->setValue(node.attribute("value").toInt());
  10145. }
  10146. else if(node.attribute("name")=="fixedunit")
  10147. {
  10148. if(node.attribute("value")=="true")
  10149. {
  10150. fixedUnit->setCheckState(Qt::Checked);
  10151. }
  10152. else if(node.attribute("value")=="false")
  10153. {
  10154. fixedUnit->setCheckState(Qt::Unchecked);
  10155. }
  10156. }
  10157. else if(node.attribute("name")=="fixedprecision")
  10158. {
  10159. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10160. }
  10161. else if(node.attribute("name")=="unit")
  10162. {
  10163. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  10164. }
  10165. else if(node.attribute("name")=="unitaddress")
  10166. {
  10167. unitAddress->setValue(node.attribute("value").toInt());
  10168. }
  10169. else if(node.attribute("name")=="fvalue")
  10170. {
  10171. valueF->setValue(node.attribute("value").toInt());
  10172. }
  10173. else if(node.attribute("name")=="cvalue")
  10174. {
  10175. valueC->setValue(node.attribute("value").toInt());
  10176. }
  10177. else if(node.attribute("name")=="precisionaddress")
  10178. {
  10179. precisionAddress->setValue(node.attribute("value").toInt());
  10180. }
  10181. else if(node.attribute("name")=="precision")
  10182. {
  10183. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10184. }
  10185. }
  10186. updateStationNumber(stationNumber->value());
  10187. updateFixedUnit(fixedUnit->isChecked());
  10188. updateFixedDecimal(fixedPrecision->isChecked());
  10189. updateUnit(fixedUnitSelector->currentText());
  10190. updateUnitAddress(unitAddress->value());
  10191. updateValueF(valueF->value());
  10192. updateValueC(valueC->value());
  10193. updatePrecisionAddress(precisionAddress->value());
  10194. updatePrecisionValue(fixedPrecisionValue->value());
  10195. connect(stationNumber,SIGNAL(valueChanged(int)),
  10196. this,SLOT(updateStationNumber(int)));
  10197. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  10198. this,SLOT(updateUnit(QString)));
  10199. connect(unitAddress,SIGNAL(valueChanged(int)),
  10200. this,SLOT(updateUnitAddress(int)));
  10201. connect(valueF,SIGNAL(valueChanged(int)),
  10202. this,SLOT(updateValueF(int)));
  10203. connect(valueC,SIGNAL(valueChanged(int)),
  10204. this,SLOT(updateValueC(int)));
  10205. connect(fixedUnit,SIGNAL(toggled(bool)),
  10206. this,SLOT(updateFixedUnit(bool)));
  10207. connect(fixedPrecision,SIGNAL(toggled(bool)),
  10208. this,SLOT(updateFixedDecimal(bool)));
  10209. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  10210. this,SLOT(updatePrecisionValue(int)));
  10211. connect(precisionAddress,SIGNAL(valueChanged(int)),
  10212. this,SLOT(updatePrecisionAddress(int)));
  10213. setLayout(layout);
  10214. }
  10215. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  10216. {
  10217. updateAttribute("station",QString("%1").arg(newStation));
  10218. }
  10219. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  10220. {
  10221. if(newFixed)
  10222. {
  10223. unitSpecificationLayout->setCurrentIndex(0);
  10224. updateAttribute("fixedunit","true");
  10225. }
  10226. else
  10227. {
  10228. unitSpecificationLayout->setCurrentIndex(1);
  10229. updateAttribute("fixedunit","false");
  10230. }
  10231. }
  10232. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  10233. {
  10234. if(newFixed)
  10235. {
  10236. decimalSpecificationLayout->setCurrentIndex(0);
  10237. updateAttribute("fixedprecision","true");
  10238. }
  10239. else
  10240. {
  10241. decimalSpecificationLayout->setCurrentIndex(1);
  10242. updateAttribute("fixedprecision","false");
  10243. }
  10244. }
  10245. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  10246. {
  10247. updateAttribute("unit",newUnit);
  10248. }
  10249. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  10250. {
  10251. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  10252. }
  10253. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  10254. {
  10255. updateAttribute("fvalue",QString("%1").arg(newValue));
  10256. }
  10257. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  10258. {
  10259. updateAttribute("cvalue",QString("%1").arg(newValue));
  10260. }
  10261. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  10262. {
  10263. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  10264. }
  10265. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  10266. {
  10267. updateAttribute("precision",QString("%1").arg(newValue));
  10268. }
  10269. /*:800*/
  10270. #line 594 "./typica.w"
  10271. /*802:*/
  10272. #line 17359 "./typica.w"
  10273. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  10274. const QModelIndex&index)
  10275. :BasicDeviceConfigurationWidget(model,index)
  10276. {
  10277. QFormLayout*layout= new QFormLayout;
  10278. ShortHexSpinBox*address= new ShortHexSpinBox;
  10279. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  10280. /*761:*/
  10281. #line 16100 "./typica.w"
  10282. QDomElement referenceElement=
  10283. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10284. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10285. QDomElement node;
  10286. /*:761*/
  10287. #line 17367 "./typica.w"
  10288. for(int i= 0;i<configData.size();i++)
  10289. {
  10290. node= configData.at(i).toElement();
  10291. if(node.attribute("name")=="address")
  10292. {
  10293. address->setValue(node.attribute("value").toInt());
  10294. break;
  10295. }
  10296. }
  10297. updateAddress(address->value());
  10298. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  10299. setLayout(layout);
  10300. }
  10301. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  10302. {
  10303. updateAttribute("address",QString("%1").arg(newAddress));
  10304. }
  10305. /*:802*/
  10306. #line 595 "./typica.w"
  10307. /*804:*/
  10308. #line 17415 "./typica.w"
  10309. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  10310. const QModelIndex&index)
  10311. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  10312. {
  10313. QVBoxLayout*layout= new QVBoxLayout;
  10314. QFormLayout*addressLayout= new QFormLayout;
  10315. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  10316. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  10317. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  10318. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  10319. layout->addLayout(addressLayout);
  10320. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  10321. layout->addWidget(fixedRange);
  10322. QWidget*queriedRangePlaceholder= new QWidget(this);
  10323. QFormLayout*queriedRangeLayout= new QFormLayout;
  10324. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  10325. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  10326. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  10327. lowerAddress);
  10328. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  10329. upperAddress);
  10330. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  10331. boundsLayout->addWidget(queriedRangePlaceholder);
  10332. QWidget*fixedRangePlaceholder= new QWidget(this);
  10333. QFormLayout*fixedRangeLayout= new QFormLayout;
  10334. QLineEdit*fixedLower= new QLineEdit;
  10335. QLineEdit*fixedUpper= new QLineEdit;
  10336. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  10337. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  10338. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  10339. boundsLayout->addWidget(fixedRangePlaceholder);
  10340. layout->addLayout(boundsLayout);
  10341. /*761:*/
  10342. #line 16100 "./typica.w"
  10343. QDomElement referenceElement=
  10344. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10345. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10346. QDomElement node;
  10347. /*:761*/
  10348. #line 17448 "./typica.w"
  10349. for(int i= 0;i<configData.size();i++)
  10350. {
  10351. node= configData.at(i).toElement();
  10352. if(node.attribute("name")=="readaddress")
  10353. {
  10354. readAddress->setValue(node.attribute("value").toInt());
  10355. }
  10356. else if(node.attribute("name")=="writeaddress")
  10357. {
  10358. writeAddress->setValue(node.attribute("value").toInt());
  10359. }
  10360. else if(node.attribute("name")=="fixedrange")
  10361. {
  10362. if(node.attribute("value")=="true")
  10363. {
  10364. fixedRange->setCheckState(Qt::Checked);
  10365. }
  10366. else if(node.attribute("value")=="false")
  10367. {
  10368. fixedRange->setCheckState(Qt::Unchecked);
  10369. }
  10370. }
  10371. else if(node.attribute("name")=="fixedlower")
  10372. {
  10373. fixedLower->setText(node.attribute("value"));
  10374. }
  10375. else if(node.attribute("name")=="fixedupper")
  10376. {
  10377. fixedUpper->setText(node.attribute("value"));
  10378. }
  10379. else if(node.attribute("name")=="loweraddress")
  10380. {
  10381. lowerAddress->setValue(node.attribute("value").toInt());
  10382. }
  10383. else if(node.attribute("name")=="upperaddress")
  10384. {
  10385. upperAddress->setValue(node.attribute("value").toInt());
  10386. }
  10387. }
  10388. updateReadAddress(readAddress->value());
  10389. updateWriteAddress(writeAddress->value());
  10390. updateFixedRange(fixedRange->isChecked());
  10391. updateLower(fixedLower->text());
  10392. updateUpper(fixedUpper->text());
  10393. updateLowerAddress(lowerAddress->value());
  10394. updateUpperAddress(upperAddress->value());
  10395. connect(readAddress,SIGNAL(valueChanged(int)),
  10396. this,SLOT(updateReadAddress(int)));
  10397. connect(writeAddress,SIGNAL(valueChanged(int)),
  10398. this,SLOT(updateWriteAddress(int)));
  10399. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  10400. connect(fixedLower,SIGNAL(textChanged(QString)),
  10401. this,SLOT(updateLower(QString)));
  10402. connect(fixedUpper,SIGNAL(textChanged(QString)),
  10403. this,SLOT(updateUpper(QString)));
  10404. connect(lowerAddress,SIGNAL(valueChanged(int)),
  10405. this,SLOT(updateLowerAddress(int)));
  10406. connect(upperAddress,SIGNAL(valueChanged(int)),
  10407. this,SLOT(updateUpperAddress(int)));
  10408. setLayout(layout);
  10409. }
  10410. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  10411. {
  10412. updateAttribute("readaddress",QString("%1").arg(newAddress));
  10413. }
  10414. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  10415. {
  10416. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  10417. }
  10418. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  10419. {
  10420. if(fixed)
  10421. {
  10422. updateAttribute("fixedrange","true");
  10423. boundsLayout->setCurrentIndex(1);
  10424. }
  10425. else
  10426. {
  10427. updateAttribute("fixedrange","false");
  10428. boundsLayout->setCurrentIndex(0);
  10429. }
  10430. }
  10431. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  10432. {
  10433. updateAttribute("fixedlower",lower);
  10434. }
  10435. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  10436. {
  10437. updateAttribute("fixedupper",upper);
  10438. }
  10439. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  10440. {
  10441. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  10442. }
  10443. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  10444. {
  10445. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  10446. }
  10447. /*:804*/
  10448. #line 596 "./typica.w"
  10449. /*760:*/
  10450. #line 16003 "./typica.w"
  10451. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10452. :BasicDeviceConfigurationWidget(model,index)
  10453. {
  10454. QVBoxLayout*layout= new QVBoxLayout;
  10455. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  10456. QMenu*deviceMenu= new QMenu;
  10457. NodeInserter*insertAction;
  10458. foreach(insertAction,AppInstance->topLevelNodeInserters)
  10459. {
  10460. connect(insertAction,SIGNAL(triggered(QString,QString)),
  10461. this,SLOT(insertChildNode(QString,QString)));
  10462. deviceMenu->addAction(insertAction);
  10463. }
  10464. addDeviceButton->setMenu(deviceMenu);
  10465. layout->addWidget(addDeviceButton);
  10466. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  10467. QMenu*annotationMenu= new QMenu;
  10468. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  10469. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  10470. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  10471. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  10472. tr("Free Text"),
  10473. "freeannotation");
  10474. annotationMenu->addAction(basicButtonInserter);
  10475. annotationMenu->addAction(countingButtonInserter);
  10476. annotationMenu->addAction(spinBoxInserter);
  10477. annotationMenu->addAction(freeAnnotationInserter);
  10478. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  10479. this,SLOT(insertChildNode(QString,QString)));
  10480. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  10481. this,SLOT(insertChildNode(QString,QString)));
  10482. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  10483. this,SLOT(insertChildNode(QString,QString)));
  10484. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10485. this,SLOT(insertChildNode(QString,QString)));
  10486. /*1023:*/
  10487. #line 144 "./valueannotation.w"
  10488. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  10489. tr("Value Annotation"),
  10490. "valueannotation");
  10491. annotationMenu->addAction(valueAnnotationInserter);
  10492. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10493. this,SLOT(insertChildNode(QString,QString)));
  10494. /*:1023*/
  10495. #line 16039 "./typica.w"
  10496. addAnnotationControlButton->setMenu(annotationMenu);
  10497. layout->addWidget(addAnnotationControlButton);
  10498. QPushButton*timersButton= new QPushButton(tr("Extra Timers"));
  10499. QMenu*timersMenu= new QMenu;
  10500. NodeInserter*coolingTimerInserter= new NodeInserter(tr("Cooling Timer"),tr("Cooling Timer"),"coolingtimer");
  10501. NodeInserter*rangeTimerInserter= new NodeInserter(tr("Range Timer"),tr("Range Timer"),"rangetimer");
  10502. NodeInserter*multirangeTimerInserter= new NodeInserter(tr("Multi-Range Timer"),tr("Multi-Range Timer"),"multirangetimer");
  10503. timersMenu->addAction(coolingTimerInserter);
  10504. timersMenu->addAction(rangeTimerInserter);
  10505. timersMenu->addAction(multirangeTimerInserter);
  10506. connect(coolingTimerInserter,SIGNAL(triggered(QString,QString)),
  10507. this,SLOT(insertChildNode(QString,QString)));
  10508. connect(rangeTimerInserter,SIGNAL(triggered(QString,QString)),
  10509. this,SLOT(insertChildNode(QString,QString)));
  10510. connect(multirangeTimerInserter,SIGNAL(triggered(QString,QString)),
  10511. this,SLOT(insertChildNode(QString,QString)));
  10512. timersButton->setMenu(timersMenu);
  10513. layout->addWidget(timersButton);
  10514. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  10515. QMenu*advancedMenu= new QMenu;
  10516. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  10517. advancedMenu->addAction(linearsplineinserter);
  10518. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  10519. advancedMenu->addAction(translationinserter);
  10520. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10521. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10522. /*949:*/
  10523. #line 258 "./rate.w"
  10524. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  10525. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10526. advancedMenu->addAction(rateOfChangeInserter);
  10527. /*:949*/
  10528. #line 16068 "./typica.w"
  10529. advancedButton->setMenu(advancedMenu);
  10530. layout->addWidget(advancedButton);
  10531. QHBoxLayout*idLayout= new QHBoxLayout;
  10532. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  10533. idLayout->addWidget(idLabel);
  10534. QSpinBox*id= new QSpinBox;
  10535. idLayout->addWidget(id);
  10536. layout->addLayout(idLayout);
  10537. /*761:*/
  10538. #line 16100 "./typica.w"
  10539. QDomElement referenceElement=
  10540. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10541. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10542. QDomElement node;
  10543. /*:761*/
  10544. #line 16078 "./typica.w"
  10545. for(int i= 0;i<configData.size();i++)
  10546. {
  10547. node= configData.at(i).toElement();
  10548. if(node.attribute("name")=="databaseid")
  10549. {
  10550. id->setValue(node.attribute("value").toInt());
  10551. break;
  10552. }
  10553. }
  10554. updateRoasterId(id->value());
  10555. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  10556. setLayout(layout);
  10557. }
  10558. /*:760*//*762:*/
  10559. #line 16110 "./typica.w"
  10560. void RoasterConfWidget::updateRoasterId(int id)
  10561. {
  10562. updateAttribute("databaseid",QString("%1").arg(id));
  10563. }
  10564. /*:762*/
  10565. #line 597 "./typica.w"
  10566. /*808:*/
  10567. #line 17598 "./typica.w"
  10568. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10569. :BasicDeviceConfigurationWidget(model,index)
  10570. {
  10571. QFormLayout*layout= new QFormLayout;
  10572. QLineEdit*buttonTextEdit= new QLineEdit;
  10573. QLineEdit*annotationTextEdit= new QLineEdit;
  10574. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10575. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10576. /*761:*/
  10577. #line 16100 "./typica.w"
  10578. QDomElement referenceElement=
  10579. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10580. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10581. QDomElement node;
  10582. /*:761*/
  10583. #line 17607 "./typica.w"
  10584. for(int i= 0;i<configData.size();i++)
  10585. {
  10586. node= configData.at(i).toElement();
  10587. if(node.attribute("name")=="buttontext")
  10588. {
  10589. buttonTextEdit->setText(node.attribute("value"));
  10590. }
  10591. else if(node.attribute("name")=="annotationtext")
  10592. {
  10593. annotationTextEdit->setText(node.attribute("value"));
  10594. }
  10595. }
  10596. updateButtonText(buttonTextEdit->text());
  10597. updateAnnotationText(annotationTextEdit->text());
  10598. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10599. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10600. setLayout(layout);
  10601. }
  10602. /*:808*//*809:*/
  10603. #line 17629 "./typica.w"
  10604. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  10605. {
  10606. updateAttribute("buttontext",text);
  10607. }
  10608. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10609. {
  10610. updateAttribute("annotationtext",text);
  10611. }
  10612. /*:809*//*812:*/
  10613. #line 17667 "./typica.w"
  10614. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10615. :BasicDeviceConfigurationWidget(model,index)
  10616. {
  10617. QFormLayout*layout= new QFormLayout;
  10618. QLineEdit*buttonTextEdit= new QLineEdit;
  10619. QLineEdit*annotationTextEdit= new QLineEdit;
  10620. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10621. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10622. /*761:*/
  10623. #line 16100 "./typica.w"
  10624. QDomElement referenceElement=
  10625. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10626. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10627. QDomElement node;
  10628. /*:761*/
  10629. #line 17676 "./typica.w"
  10630. for(int i= 0;i<configData.size();i++)
  10631. {
  10632. node= configData.at(i).toElement();
  10633. if(node.attribute("name")=="buttontext")
  10634. {
  10635. buttonTextEdit->setText(node.attribute("value"));
  10636. }
  10637. else if(node.attribute("name")=="annotationtext")
  10638. {
  10639. annotationTextEdit->setText(node.attribute("value"));
  10640. }
  10641. }
  10642. updateButtonText(buttonTextEdit->text());
  10643. updateAnnotationText(annotationTextEdit->text());
  10644. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10645. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10646. QTextEdit*documentation= new QTextEdit;
  10647. 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."));
  10648. documentation->setReadOnly(true);
  10649. layout->addRow("",documentation);
  10650. setLayout(layout);
  10651. }
  10652. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  10653. {
  10654. updateAttribute("buttontext",text);
  10655. }
  10656. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10657. {
  10658. updateAttribute("annotationtext",text);
  10659. }
  10660. /*:812*/
  10661. #line 598 "./typica.w"
  10662. /*815:*/
  10663. #line 17744 "./typica.w"
  10664. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10665. :BasicDeviceConfigurationWidget(model,index)
  10666. {
  10667. QFormLayout*layout= new QFormLayout;
  10668. QLineEdit*labelEdit= new QLineEdit;
  10669. layout->addRow(tr("Control Label: "),labelEdit);
  10670. QLineEdit*minimumEdit= new QLineEdit;
  10671. layout->addRow(tr("Minimum Value: "),minimumEdit);
  10672. QLineEdit*maximumEdit= new QLineEdit;
  10673. layout->addRow(tr("Maximum Value: "),maximumEdit);
  10674. QSpinBox*precisionEdit= new QSpinBox;
  10675. precisionEdit->setMinimum(0);
  10676. precisionEdit->setMaximum(9);
  10677. layout->addRow(tr("Precision"),precisionEdit);
  10678. QLineEdit*pretext= new QLineEdit;
  10679. layout->addRow(tr("Prefix text"),pretext);
  10680. QLineEdit*posttext= new QLineEdit;
  10681. layout->addRow(tr("Suffix text"),posttext);
  10682. /*761:*/
  10683. #line 16100 "./typica.w"
  10684. QDomElement referenceElement=
  10685. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10686. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10687. QDomElement node;
  10688. /*:761*/
  10689. #line 17763 "./typica.w"
  10690. for(int i= 0;i<configData.size();i++)
  10691. {
  10692. node= configData.at(i).toElement();
  10693. if(node.attribute("name")=="label")
  10694. {
  10695. labelEdit->setText(node.attribute("value"));
  10696. }
  10697. else if(node.attribute("name")=="minimum")
  10698. {
  10699. minimumEdit->setText(node.attribute("value"));
  10700. }
  10701. else if(node.attribute("name")=="maximum")
  10702. {
  10703. maximumEdit->setText(node.attribute("value"));
  10704. }
  10705. else if(node.attribute("name")=="precision")
  10706. {
  10707. precisionEdit->setValue(node.attribute("value").toInt());
  10708. }
  10709. else if(node.attribute("name")=="pretext")
  10710. {
  10711. pretext->setText(node.attribute("value"));
  10712. }
  10713. else if(node.attribute("name")=="posttext")
  10714. {
  10715. posttext->setText(node.attribute("value"));
  10716. }
  10717. }
  10718. updateLabel(labelEdit->text());
  10719. updateMinimum(minimumEdit->text());
  10720. updateMaximum(maximumEdit->text());
  10721. updatePrecision(precisionEdit->value());
  10722. updatePretext(pretext->text());
  10723. updatePosttext(posttext->text());
  10724. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  10725. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  10726. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  10727. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  10728. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  10729. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  10730. setLayout(layout);
  10731. }
  10732. void NoteSpinConfWidget::updateLabel(const QString&text)
  10733. {
  10734. updateAttribute("label",text);
  10735. }
  10736. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  10737. {
  10738. updateAttribute("minimum",minimum);
  10739. }
  10740. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  10741. {
  10742. updateAttribute("maximum",maximum);
  10743. }
  10744. void NoteSpinConfWidget::updatePrecision(int precision)
  10745. {
  10746. updateAttribute("precision",QString("%1").arg(precision));
  10747. }
  10748. void NoteSpinConfWidget::updatePretext(const QString&text)
  10749. {
  10750. updateAttribute("pretext",text);
  10751. }
  10752. void NoteSpinConfWidget::updatePosttext(const QString&text)
  10753. {
  10754. updateAttribute("posttext",text);
  10755. }
  10756. /*:815*/
  10757. #line 599 "./typica.w"
  10758. /*324:*/
  10759. #line 7358 "./typica.w"
  10760. LinearCalibrator::LinearCalibrator(QObject*parent):
  10761. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  10762. {
  10763. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10764. }
  10765. /*:324*//*325:*/
  10766. #line 7372 "./typica.w"
  10767. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  10768. {
  10769. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  10770. if(clamp)
  10771. {
  10772. if(outval<Lo1)
  10773. {
  10774. outval= Lo1;
  10775. }
  10776. else if(outval> Up1)
  10777. {
  10778. outval= Up1;
  10779. }
  10780. }
  10781. if(sensitivitySetting>=0.05)
  10782. {
  10783. int temp= qRound(outval/sensitivitySetting);
  10784. outval= temp*sensitivitySetting;
  10785. }
  10786. Measurement adjusted(outval,measure.time(),measure.scale());
  10787. emit measurement(adjusted);
  10788. return adjusted;
  10789. }
  10790. /*:325*//*326:*/
  10791. #line 7399 "./typica.w"
  10792. double LinearCalibrator::measuredLower()
  10793. {
  10794. return Lo2;
  10795. }
  10796. double LinearCalibrator::measuredUpper()
  10797. {
  10798. return Up2;
  10799. }
  10800. double LinearCalibrator::mappedLower()
  10801. {
  10802. return Lo1;
  10803. }
  10804. double LinearCalibrator::mappedUpper()
  10805. {
  10806. return Up1;
  10807. }
  10808. bool LinearCalibrator::isClosedRange()
  10809. {
  10810. return clamp;
  10811. }
  10812. void LinearCalibrator::setMeasuredLower(double lower)
  10813. {
  10814. Lo2= lower;
  10815. }
  10816. void LinearCalibrator::setMeasuredUpper(double upper)
  10817. {
  10818. Up2= upper;
  10819. }
  10820. void LinearCalibrator::setMappedLower(double lower)
  10821. {
  10822. Lo1= lower;
  10823. }
  10824. void LinearCalibrator::setMappedUpper(double upper)
  10825. {
  10826. Up1= upper;
  10827. }
  10828. void LinearCalibrator::setClosedRange(bool closed)
  10829. {
  10830. clamp= closed;
  10831. }
  10832. void LinearCalibrator::setSensitivity(double sensitivity)
  10833. {
  10834. sensitivitySetting= sensitivity;
  10835. }
  10836. double LinearCalibrator::sensitivity()
  10837. {
  10838. return sensitivitySetting;
  10839. }
  10840. /*:326*/
  10841. #line 600 "./typica.w"
  10842. /*331:*/
  10843. #line 7532 "./typica.w"
  10844. void LinearSplineInterpolator::add_pair(double source,double destination)
  10845. {
  10846. pairs->insert(source,destination);
  10847. make_interpolators();
  10848. }
  10849. void LinearSplineInterpolator::make_interpolators()
  10850. {
  10851. if(pairs->size()> 1)
  10852. {
  10853. while(interpolators->size()> 0)
  10854. {
  10855. LinearCalibrator*removed= interpolators->takeFirst();
  10856. removed->deleteLater();
  10857. }
  10858. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10859. QMap<double,double> ::const_iterator j= i+1;
  10860. while(j!=pairs->constEnd())
  10861. {
  10862. LinearCalibrator*segment= new LinearCalibrator();
  10863. segment->setMeasuredLower(i.key());
  10864. segment->setMappedLower(i.value());
  10865. segment->setMeasuredUpper(j.key());
  10866. segment->setMappedUpper(j.value());
  10867. segment->setClosedRange(false);
  10868. interpolators->append(segment);
  10869. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10870. i++;
  10871. j++;
  10872. }
  10873. }
  10874. }
  10875. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  10876. QObject(parent),pairs(new QMap<double,double> ),
  10877. interpolators(new QList<LinearCalibrator*> )
  10878. {
  10879. }
  10880. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  10881. {
  10882. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10883. int index= -1;
  10884. while(i!=pairs->constEnd())
  10885. {
  10886. if(measure.temperature()<=i.key())
  10887. {
  10888. break;
  10889. }
  10890. i++;
  10891. index++;
  10892. }
  10893. if(index<0)
  10894. {
  10895. index= 0;
  10896. }
  10897. if(index>=interpolators->size())
  10898. {
  10899. index= interpolators->size()-1;
  10900. }
  10901. if(interpolators->at(index)!=NULL)
  10902. {
  10903. return interpolators->at(index)->newMeasurement(measure);
  10904. }
  10905. return Measurement();
  10906. }
  10907. /*:331*/
  10908. #line 601 "./typica.w"
  10909. /*914:*/
  10910. #line 19112 "./typica.w"
  10911. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10912. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  10913. {
  10914. QFormLayout*layout= new QFormLayout;
  10915. QLineEdit*source= new QLineEdit;
  10916. layout->addRow(tr("Source column name:"),source);
  10917. QLineEdit*destination= new QLineEdit;
  10918. layout->addRow(tr("Destination column name:"),destination);
  10919. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  10920. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  10921. QTableView*mappingTable= new QTableView;
  10922. mappingTable->setModel(tablemodel);
  10923. NumericDelegate*delegate= new NumericDelegate;
  10924. mappingTable->setItemDelegate(delegate);
  10925. layout->addRow(tr("Mapping data:"),mappingTable);
  10926. /*761:*/
  10927. #line 16100 "./typica.w"
  10928. QDomElement referenceElement=
  10929. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10930. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10931. QDomElement node;
  10932. /*:761*/
  10933. #line 19128 "./typica.w"
  10934. for(int i= 0;i<configData.size();i++)
  10935. {
  10936. node= configData.at(i).toElement();
  10937. if(node.attribute("name")=="source")
  10938. {
  10939. source->setText(node.attribute("value"));
  10940. }
  10941. else if(node.attribute("name")=="destination")
  10942. {
  10943. destination->setText(node.attribute("value"));
  10944. }
  10945. else if(node.attribute("name")=="sourcevalues")
  10946. {
  10947. /*915:*/
  10948. #line 19167 "./typica.w"
  10949. QString data= node.attribute("value");
  10950. if(data.length()> 3)
  10951. {
  10952. data.chop(2);
  10953. data= data.remove(0,2);
  10954. }
  10955. QStringList itemList= data.split(",");
  10956. /*:915*/
  10957. #line 19142 "./typica.w"
  10958. int column= 0;
  10959. /*916:*/
  10960. #line 19179 "./typica.w"
  10961. for(int j= 0;j<itemList.size();j++)
  10962. {
  10963. tablemodel->setData(tablemodel->index(j,column),
  10964. QVariant(itemList.at(j).toDouble()),
  10965. Qt::DisplayRole);
  10966. }
  10967. /*:916*/
  10968. #line 19144 "./typica.w"
  10969. }
  10970. else if(node.attribute("name")=="destinationvalues")
  10971. {
  10972. /*915:*/
  10973. #line 19167 "./typica.w"
  10974. QString data= node.attribute("value");
  10975. if(data.length()> 3)
  10976. {
  10977. data.chop(2);
  10978. data= data.remove(0,2);
  10979. }
  10980. QStringList itemList= data.split(",");
  10981. /*:915*/
  10982. #line 19149 "./typica.w"
  10983. int column= 1;
  10984. /*916:*/
  10985. #line 19179 "./typica.w"
  10986. for(int j= 0;j<itemList.size();j++)
  10987. {
  10988. tablemodel->setData(tablemodel->index(j,column),
  10989. QVariant(itemList.at(j).toDouble()),
  10990. Qt::DisplayRole);
  10991. }
  10992. /*:916*/
  10993. #line 19151 "./typica.w"
  10994. }
  10995. }
  10996. updateSourceColumn(source->text());
  10997. updateDestinationColumn(destination->text());
  10998. updateKnots();
  10999. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11000. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  11001. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  11002. setLayout(layout);
  11003. }
  11004. /*:914*//*917:*/
  11005. #line 19190 "./typica.w"
  11006. void LinearSplineInterpolationConfWidget::updateKnots()
  11007. {
  11008. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11009. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11010. }
  11011. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  11012. {
  11013. updateAttribute("source",source);
  11014. }
  11015. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  11016. {
  11017. updateAttribute("destination",dest);
  11018. }
  11019. /*:917*/
  11020. #line 602 "./typica.w"
  11021. /*934:*/
  11022. #line 19659 "./typica.w"
  11023. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11024. :BasicDeviceConfigurationWidget(model,index),
  11025. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  11026. {
  11027. unitSelector->addItem("Fahrenheit");
  11028. unitSelector->addItem("Celsius");
  11029. temperatureValue->setMinimum(0);
  11030. temperatureValue->setMaximum(1000);
  11031. QFormLayout*layout= new QFormLayout;
  11032. QLineEdit*column= new QLineEdit;
  11033. layout->addRow(tr("Column to match:"),column);
  11034. layout->addRow(tr("Unit:"),unitSelector);
  11035. layout->addRow(tr("Value:"),temperatureValue);
  11036. /*761:*/
  11037. #line 16100 "./typica.w"
  11038. QDomElement referenceElement=
  11039. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11040. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11041. QDomElement node;
  11042. /*:761*/
  11043. #line 19673 "./typica.w"
  11044. for(int i= 0;i<configData.size();i++)
  11045. {
  11046. node= configData.at(i).toElement();
  11047. if(node.attribute("name")=="column")
  11048. {
  11049. column->setText(node.attribute("value"));
  11050. }
  11051. else if(node.attribute("name")=="unit")
  11052. {
  11053. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11054. }
  11055. else if(node.attribute("name")=="value")
  11056. {
  11057. temperatureValue->setValue(node.attribute("value").toDouble());
  11058. }
  11059. }
  11060. updateMatchingColumn(column->text());
  11061. updateTemperature();
  11062. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  11063. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  11064. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  11065. setLayout(layout);
  11066. }
  11067. /*:934*//*935:*/
  11068. #line 19702 "./typica.w"
  11069. void TranslationConfWidget::updateTemperature()
  11070. {
  11071. updateAttribute("unit",unitSelector->currentText());
  11072. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  11073. if(unitSelector->currentText()=="Fahrenheit")
  11074. {
  11075. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  11076. }
  11077. else
  11078. {
  11079. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  11080. }
  11081. }
  11082. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  11083. {
  11084. updateAttribute("column",column);
  11085. }
  11086. /*:935*/
  11087. #line 603 "./typica.w"
  11088. /*818:*/
  11089. #line 24 "./freeannotation.w"
  11090. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  11091. const QModelIndex&index)
  11092. :BasicDeviceConfigurationWidget(model,index)
  11093. {
  11094. QFormLayout*layout= new QFormLayout;
  11095. QLineEdit*labelEdit= new QLineEdit;
  11096. layout->addRow(tr("Label Text:"),labelEdit);
  11097. /*761:*/
  11098. #line 16100 "./typica.w"
  11099. QDomElement referenceElement=
  11100. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11101. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11102. QDomElement node;
  11103. /*:761*/
  11104. #line 32 "./freeannotation.w"
  11105. for(int i= 0;i<configData.size();i++)
  11106. {
  11107. node= configData.at(i).toElement();
  11108. if(node.attribute("name")=="labeltext")
  11109. {
  11110. labelEdit->setText(node.attribute("value"));
  11111. }
  11112. }
  11113. updateLabel(labelEdit->text());
  11114. connect(labelEdit,SIGNAL(textEdited(QString)),
  11115. this,SLOT(updateLabel(QString)));
  11116. setLayout(layout);
  11117. }
  11118. /*:818*//*819:*/
  11119. #line 49 "./freeannotation.w"
  11120. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  11121. {
  11122. updateAttribute("labeltext",text);
  11123. }
  11124. /*:819*/
  11125. #line 604 "./typica.w"
  11126. /*938:*/
  11127. #line 39 "./rate.w"
  11128. void RateOfChange::newMeasurement(Measurement measure)
  11129. {
  11130. cache.append(measure);
  11131. /*939:*/
  11132. #line 64 "./rate.w"
  11133. if(cache.size()> 2)
  11134. {
  11135. bool done= false;
  11136. while(!done)
  11137. {
  11138. if(cache.front().time().secsTo(cache.back().time())> ct)
  11139. {
  11140. cache.removeFirst();
  11141. }
  11142. else if(cache.back().time()<cache.front().time())
  11143. {
  11144. cache.removeFirst();
  11145. done= true;
  11146. }
  11147. else
  11148. {
  11149. done= true;
  11150. }
  11151. if(cache.size()<3)
  11152. {
  11153. done= true;
  11154. }
  11155. }
  11156. }
  11157. /*:939*/
  11158. #line 43 "./rate.w"
  11159. if(cache.size()>=2)
  11160. {
  11161. /*940:*/
  11162. #line 96 "./rate.w"
  11163. int N= cache.size();
  11164. double SXY= 0;
  11165. double SX= 0;
  11166. double SXX= 0;
  11167. double SY= 0;
  11168. double y;
  11169. double x;
  11170. for(int i= 0;i<N;i++)
  11171. {
  11172. y= cache.at(i).temperature();
  11173. SY+= y;
  11174. x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
  11175. SX+= x;
  11176. SXX+= (x*x);
  11177. SXY+= (x*y);
  11178. }
  11179. double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
  11180. Measurement value(M*st,cache.back().time(),cache.back().scale());
  11181. value.insert("relative",true);
  11182. emit newData(value);
  11183. /*:940*/
  11184. #line 46 "./rate.w"
  11185. }
  11186. }
  11187. /*:938*//*941:*/
  11188. #line 120 "./rate.w"
  11189. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  11190. {
  11191. setScaleTime(scaletime);
  11192. }
  11193. void RateOfChange::setCacheTime(int seconds)
  11194. {
  11195. ct= seconds;
  11196. }
  11197. void RateOfChange::setScaleTime(int seconds)
  11198. {
  11199. st= (seconds> 0?seconds:1);
  11200. }
  11201. /*:941*/
  11202. #line 605 "./typica.w"
  11203. /*822:*/
  11204. #line 26 "./settings.w"
  11205. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  11206. {
  11207. QTabWidget*settingsTab= new QTabWidget;
  11208. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  11209. settingsTab->addTab(deviceSettings,tr("Roasters"));
  11210. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  11211. settingsTab->addTab(graphSettings,tr("Graph"));
  11212. AdvancedSettingsWidget*advancedSettings= new AdvancedSettingsWidget;
  11213. settingsTab->addTab(advancedSettings,tr("Advanced"));
  11214. setCentralWidget(settingsTab);
  11215. }
  11216. /*:822*/
  11217. #line 606 "./typica.w"
  11218. /*827:*/
  11219. #line 27 "./graphsettings.w"
  11220. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  11221. {
  11222. QTabWidget*graphCategories= new QTabWidget;
  11223. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  11224. graphCategories->addTab(relative,tr("Relative Temperatures"));
  11225. QVBoxLayout*layout= new QVBoxLayout;
  11226. layout->addWidget(graphCategories);
  11227. setLayout(layout);
  11228. }
  11229. /*:827*//*829:*/
  11230. #line 65 "./graphsettings.w"
  11231. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  11232. colorEdit(new QLineEdit)
  11233. {
  11234. QSettings settings;
  11235. QVBoxLayout*layout= new QVBoxLayout;
  11236. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  11237. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  11238. updateEnableSetting(enable->isChecked());
  11239. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  11240. layout->addWidget(enable);
  11241. QHBoxLayout*colorLayout= new QHBoxLayout;
  11242. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  11243. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  11244. updateColorSetting(colorEdit->text());
  11245. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  11246. QToolButton*colorPickerButton= new QToolButton();
  11247. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  11248. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  11249. colorLayout->addWidget(colorLabel);
  11250. colorLayout->addWidget(colorEdit);
  11251. colorLayout->addWidget(colorPickerButton);
  11252. colorLayout->addStretch();
  11253. layout->addLayout(colorLayout);
  11254. QHBoxLayout*unitLayout= new QHBoxLayout;
  11255. QLabel*unitLabel= new QLabel(tr("Unit"));
  11256. QComboBox*unitSelector= new QComboBox;
  11257. unitSelector->addItem(tr("Fahrenheit"));
  11258. unitSelector->addItem(tr("Celsius"));
  11259. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  11260. updateUnit(unitSelector->currentIndex());
  11261. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  11262. unitLayout->addWidget(unitLabel);
  11263. unitLayout->addWidget(unitSelector);
  11264. unitLayout->addStretch();
  11265. layout->addLayout(unitLayout);
  11266. QHBoxLayout*axisLayout= new QHBoxLayout;
  11267. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  11268. QLineEdit*axisEdit= new QLineEdit;
  11269. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, -10, 0, 10, 30, 50").toString());
  11270. updateAxisSetting(axisEdit->text());
  11271. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  11272. axisLayout->addWidget(axisLabel);
  11273. axisLayout->addWidget(axisEdit);
  11274. layout->addLayout(axisLayout);
  11275. layout->addStretch();
  11276. setLayout(layout);
  11277. }
  11278. /*:829*//*830:*/
  11279. #line 116 "./graphsettings.w"
  11280. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  11281. {
  11282. QSettings settings;
  11283. settings.setValue("settings/graph/relative/enable",enabled);
  11284. }
  11285. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  11286. {
  11287. QSettings settings;
  11288. settings.setValue("settings/graph/relative/color",color);
  11289. }
  11290. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  11291. {
  11292. QSettings settings;
  11293. QString settingValue;
  11294. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  11295. QStringList numbers;
  11296. foreach(QString text,points)
  11297. {
  11298. bool okay= false;
  11299. text.toDouble(&okay);
  11300. if(okay)
  11301. {
  11302. numbers.append(text);
  11303. }
  11304. }
  11305. numbers.removeDuplicates();
  11306. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  11307. }
  11308. void GraphSettingsRelativeTab::updateUnit(int unit)
  11309. {
  11310. QSettings settings;
  11311. settings.setValue("settings/graph/relative/unit",unit);
  11312. }
  11313. /*:830*//*831:*/
  11314. #line 159 "./graphsettings.w"
  11315. void GraphSettingsRelativeTab::showColorPicker()
  11316. {
  11317. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  11318. colorEdit->setText(color.name());
  11319. }
  11320. #line 62 "./settings.w"
  11321. #line 1 "./advancedsettings.w"
  11322. /*:831*/
  11323. #line 607 "./typica.w"
  11324. /*973:*/
  11325. #line 682 "./dataqsdk.w"
  11326. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  11327. const QModelIndex&index)
  11328. :BasicDeviceConfigurationWidget(model,index),
  11329. deviceIdStack(new QStackedWidget)
  11330. {
  11331. QVBoxLayout*layout= new QVBoxLayout;
  11332. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  11333. layout->addWidget(autoDetect);
  11334. QWidget*autoLayerWidget= new QWidget;
  11335. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  11336. QLabel*autoLabel= new QLabel(tr("Device number"));
  11337. QSpinBox*autoNumber= new QSpinBox;
  11338. autoNumber->setMinimum(1);
  11339. autoNumber->setMaximum(99);
  11340. autoLayerLayout->addWidget(autoLabel);
  11341. autoLayerLayout->addWidget(autoNumber);
  11342. autoLayerWidget->setLayout(autoLayerLayout);
  11343. QWidget*fixedLayerWidget= new QWidget;
  11344. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  11345. QLabel*fixedLabel= new QLabel(tr("Device port"));
  11346. QComboBox*portSelection= new QComboBox;
  11347. portSelection->setEditable(true);
  11348. portSelection->addItems(DataqSdkDevice::detectHardware());
  11349. fixedLayerLayout->addWidget(fixedLabel);
  11350. fixedLayerLayout->addWidget(portSelection);
  11351. fixedLayerWidget->setLayout(fixedLayerLayout);
  11352. deviceIdStack->addWidget(autoLayerWidget);
  11353. deviceIdStack->addWidget(fixedLayerWidget);
  11354. layout->addWidget(deviceIdStack);
  11355. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  11356. layout->addWidget(addChannelButton);
  11357. /*761:*/
  11358. #line 16100 "./typica.w"
  11359. QDomElement referenceElement=
  11360. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11361. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11362. QDomElement node;
  11363. /*:761*/
  11364. #line 714 "./dataqsdk.w"
  11365. for(int i= 0;i<configData.size();i++)
  11366. {
  11367. node= configData.at(i).toElement();
  11368. if(node.attribute("name")=="autoSelect")
  11369. {
  11370. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  11371. }
  11372. else if(node.attribute("name")=="deviceNumber")
  11373. {
  11374. autoNumber->setValue(node.attribute("value").toInt());
  11375. }
  11376. else if(node.attribute("name")=="port")
  11377. {
  11378. int index= portSelection->findText(node.attribute("value"));
  11379. if(index> -1)
  11380. {
  11381. portSelection->setCurrentIndex(index);
  11382. }
  11383. else
  11384. {
  11385. portSelection->setEditText(node.attribute("value"));
  11386. }
  11387. }
  11388. }
  11389. updateAutoSelect(autoDetect->isChecked());
  11390. updateDeviceNumber(autoNumber->value());
  11391. updatePort(portSelection->currentText());
  11392. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  11393. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  11394. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  11395. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11396. setLayout(layout);
  11397. }
  11398. /*:973*//*974:*/
  11399. #line 758 "./dataqsdk.w"
  11400. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  11401. {
  11402. if(automatic)
  11403. {
  11404. updateAttribute("autoSelect","true");
  11405. deviceIdStack->setCurrentIndex(0);
  11406. }
  11407. else
  11408. {
  11409. updateAttribute("autoSelect","false");
  11410. deviceIdStack->setCurrentIndex(1);
  11411. }
  11412. }
  11413. /*:974*//*975:*/
  11414. #line 775 "./dataqsdk.w"
  11415. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  11416. {
  11417. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  11418. }
  11419. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  11420. {
  11421. updateAttribute("port",portId);
  11422. }
  11423. /*:975*//*976:*/
  11424. #line 788 "./dataqsdk.w"
  11425. void DataqSdkDeviceConfWidget::addChannel()
  11426. {
  11427. insertChildNode(tr("Channel"),"dataqsdkchannel");
  11428. }
  11429. /*:976*//*979:*/
  11430. #line 868 "./dataqsdk.w"
  11431. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  11432. const QModelIndex&index)
  11433. :BasicDeviceConfigurationWidget(model,index),
  11434. startButton(new QPushButton(tr("Start"))),
  11435. resetButton(new QPushButton(tr("Reset"))),
  11436. stopButton(new QPushButton(tr("Stop"))),
  11437. calibrator(new LinearCalibrator),
  11438. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  11439. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  11440. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  11441. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  11442. rmCount(0),cmCount(0),
  11443. rmin(std::numeric_limits<double> ::max()),
  11444. rmax(std::numeric_limits<double> ::min()),rmean(0),
  11445. cmin(std::numeric_limits<double> ::max()),
  11446. cmax(std::numeric_limits<double> ::min()),cmean(0)
  11447. {
  11448. /*983:*/
  11449. #line 1107 "./dataqsdk.w"
  11450. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  11451. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  11452. QDomElement deviceNode;
  11453. QString configPort;
  11454. QString configAuto;
  11455. for(int i= 0;i<deviceConfigData.size();i++)
  11456. {
  11457. deviceNode= deviceConfigData.at(i).toElement();
  11458. if(deviceNode.attribute("name")=="autoSelect")
  11459. {
  11460. autoSelect= (deviceNode.attribute("value")=="true");
  11461. }
  11462. else if(deviceNode.attribute("name")=="deviceNumber")
  11463. {
  11464. configAuto= deviceNode.attribute("value");
  11465. }
  11466. else if(deviceNode.attribute("name")=="port")
  11467. {
  11468. configPort= deviceNode.attribute("value");
  11469. }
  11470. }
  11471. deviceID= autoSelect?configAuto:configPort;
  11472. channelOfInterest= index.row();
  11473. /*:983*/
  11474. #line 886 "./dataqsdk.w"
  11475. resetButton->setEnabled(false);
  11476. stopButton->setEnabled(false);
  11477. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  11478. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  11479. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  11480. QVBoxLayout*layout= new QVBoxLayout;
  11481. QFormLayout*topLayout= new QFormLayout;
  11482. QLineEdit*columnEdit= new QLineEdit;
  11483. topLayout->addRow(tr("Column name"),columnEdit);
  11484. QComboBox*unitSelector= new QComboBox;
  11485. unitSelector->addItem(tr("Temperature"));
  11486. unitSelector->addItem(tr("Control"));
  11487. topLayout->addRow(tr("Measurement type"),unitSelector);
  11488. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  11489. topLayout->addRow(smoothingBox);
  11490. layout->addLayout(topLayout);
  11491. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  11492. topLayout->addRow(hideSeries);
  11493. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  11494. layout->addWidget(calibrationLabel);
  11495. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  11496. QFormLayout*calibrationControlsLayout= new QFormLayout;
  11497. QLineEdit*measuredLowerEdit= new QLineEdit;
  11498. measuredLowerEdit->setText("0");
  11499. QLineEdit*measuredUpperEdit= new QLineEdit;
  11500. measuredUpperEdit->setText("10");
  11501. QLineEdit*mappedLowerEdit= new QLineEdit;
  11502. mappedLowerEdit->setText("0");
  11503. QLineEdit*mappedUpperEdit= new QLineEdit;
  11504. mappedUpperEdit->setText("10");
  11505. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  11506. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  11507. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  11508. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  11509. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  11510. calibrationControlsLayout->addRow(closedBox);
  11511. QLineEdit*sensitivityEdit= new QLineEdit;
  11512. sensitivityEdit->setText("0");
  11513. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  11514. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  11515. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  11516. deviceControlLayout->addWidget(startButton);
  11517. deviceControlLayout->addWidget(resetButton);
  11518. deviceControlLayout->addWidget(stopButton);
  11519. QFormLayout*indicatorLayout= new QFormLayout;
  11520. currentMeasurement->setReadOnly(true);
  11521. minimumMeasurement->setReadOnly(true);
  11522. maximumMeasurement->setReadOnly(true);
  11523. averageMeasurement->setReadOnly(true);
  11524. currentMapped->setReadOnly(true);
  11525. minimumMapped->setReadOnly(true);
  11526. maximumMapped->setReadOnly(true);
  11527. averageMapped->setReadOnly(true);
  11528. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  11529. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  11530. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  11531. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  11532. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  11533. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  11534. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  11535. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  11536. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  11537. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  11538. calibrationTestLayout->addLayout(deviceControlLayout);
  11539. calibrationTestLayout->addLayout(indicatorLayout);
  11540. calibrationLayout->addLayout(calibrationControlsLayout);
  11541. calibrationLayout->addLayout(calibrationTestLayout);
  11542. layout->addLayout(calibrationLayout);
  11543. /*761:*/
  11544. #line 16100 "./typica.w"
  11545. QDomElement referenceElement=
  11546. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11547. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11548. QDomElement node;
  11549. /*:761*/
  11550. #line 955 "./dataqsdk.w"
  11551. for(int i= 0;i<configData.size();i++)
  11552. {
  11553. node= configData.at(i).toElement();
  11554. if(node.attribute("name")=="column")
  11555. {
  11556. columnEdit->setText(node.attribute("value"));
  11557. }
  11558. else if(node.attribute("name")=="type")
  11559. {
  11560. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11561. }
  11562. else if(node.attribute("name")=="smoothing")
  11563. {
  11564. smoothingBox->setChecked(node.attribute("value")=="true");
  11565. }
  11566. else if(node.attribute("name")=="calibrationMeasuredLower")
  11567. {
  11568. measuredLowerEdit->setText(node.attribute("value"));
  11569. }
  11570. else if(node.attribute("name")=="calibrationMeasuredUpper")
  11571. {
  11572. measuredUpperEdit->setText(node.attribute("value"));
  11573. }
  11574. else if(node.attribute("name")=="calibrationMappedLower")
  11575. {
  11576. mappedLowerEdit->setText(node.attribute("value"));
  11577. }
  11578. else if(node.attribute("name")=="calibrationMappedUpper")
  11579. {
  11580. mappedUpperEdit->setText(node.attribute("value"));
  11581. }
  11582. else if(node.attribute("name")=="calibrationClosedInterval")
  11583. {
  11584. closedBox->setChecked(node.attribute("value")=="true");
  11585. }
  11586. else if(node.attribute("name")=="calibrationSensitivity")
  11587. {
  11588. sensitivityEdit->setText(node.attribute("value"));
  11589. }
  11590. else if(node.attribute("name")=="hidden")
  11591. {
  11592. hideSeries->setChecked(node.attribute("value")=="true");
  11593. }
  11594. }
  11595. updateColumnName(columnEdit->text());
  11596. updateUnits(unitSelector->currentText());
  11597. updateSmoothingEnabled(smoothingBox->isChecked());
  11598. updateMeasuredLower(measuredLowerEdit->text());
  11599. updateMeasuredUpper(measuredUpperEdit->text());
  11600. updateMappedLower(mappedLowerEdit->text());
  11601. updateMappedUpper(mappedUpperEdit->text());
  11602. updateClosedInterval(closedBox->isChecked());
  11603. updateSensitivity(sensitivityEdit->text());
  11604. updateHidden(hideSeries->isChecked());
  11605. connect(columnEdit,SIGNAL(textChanged(QString)),
  11606. this,SLOT(updateColumnName(QString)));
  11607. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  11608. this,SLOT(updateUnits(QString)));
  11609. connect(smoothingBox,SIGNAL(toggled(bool)),
  11610. this,SLOT(updateSmoothingEnabled(bool)));
  11611. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  11612. this,SLOT(updateMeasuredLower(QString)));
  11613. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  11614. this,SLOT(updateMappedLower(QString)));
  11615. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  11616. this,SLOT(updateMeasuredUpper(QString)));
  11617. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  11618. this,SLOT(updateMappedUpper(QString)));
  11619. connect(closedBox,SIGNAL(toggled(bool)),
  11620. this,SLOT(updateClosedInterval(bool)));
  11621. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  11622. this,SLOT(updateSensitivity(QString)));
  11623. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  11624. setLayout(layout);
  11625. }
  11626. /*:979*//*980:*/
  11627. #line 1038 "./dataqsdk.w"
  11628. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  11629. {
  11630. updateAttribute("type",unit);
  11631. }
  11632. /*:980*//*981:*/
  11633. #line 1047 "./dataqsdk.w"
  11634. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  11635. {
  11636. updateAttribute("calibrationMeasuredLower",value);
  11637. calibrator->setMeasuredLower(value.toDouble());
  11638. }
  11639. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  11640. {
  11641. updateAttribute("calibrationMeasuredUpper",value);
  11642. calibrator->setMeasuredUpper(value.toDouble());
  11643. }
  11644. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  11645. {
  11646. updateAttribute("calibrationMappedLower",value);
  11647. calibrator->setMappedLower(value.toDouble());
  11648. }
  11649. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  11650. {
  11651. updateAttribute("calibrationMappedUpper",value);
  11652. calibrator->setMappedUpper(value.toDouble());
  11653. }
  11654. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  11655. {
  11656. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  11657. calibrator->setClosedRange(closed);
  11658. }
  11659. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  11660. {
  11661. updateAttribute("smoothing",enabled?"true":"false");
  11662. }
  11663. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  11664. {
  11665. updateAttribute("calibrationSensitivity",value);
  11666. calibrator->setSensitivity(value.toDouble());
  11667. }
  11668. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  11669. {
  11670. updateAttribute("hidden",hidden?"true":"false");
  11671. }
  11672. /*:981*//*984:*/
  11673. #line 1136 "./dataqsdk.w"
  11674. void DataqSdkChannelConfWidget::startCalibration()
  11675. {
  11676. startButton->setEnabled(false);
  11677. stopButton->setEnabled(true);
  11678. resetButton->setEnabled(true);
  11679. calibrationDevice= new DataqSdkDevice(deviceID);
  11680. Channel*channel;
  11681. for(unsigned int i= 0;i<=channelOfInterest;i++)
  11682. {
  11683. channel= calibrationDevice->newChannel(Units::Unitless);
  11684. }
  11685. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  11686. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  11687. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  11688. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  11689. calibrationDevice->start();
  11690. }
  11691. void DataqSdkChannelConfWidget::stopCalibration()
  11692. {
  11693. startButton->setEnabled(true);
  11694. stopButton->setEnabled(false);
  11695. resetButton->setEnabled(false);
  11696. calibrationDevice->deleteLater();
  11697. /*986:*/
  11698. #line 1181 "./dataqsdk.w"
  11699. rmCount= 0;
  11700. cmCount= 0;
  11701. rmin= std::numeric_limits<double> ::max();
  11702. rmax= std::numeric_limits<double> ::min();
  11703. rmean= 0;
  11704. cmin= std::numeric_limits<double> ::max();
  11705. cmax= std::numeric_limits<double> ::min();
  11706. cmean= 0;
  11707. /*:986*/
  11708. #line 1161 "./dataqsdk.w"
  11709. }
  11710. /*:984*//*985:*/
  11711. #line 1172 "./dataqsdk.w"
  11712. void DataqSdkChannelConfWidget::resetCalibration()
  11713. {
  11714. /*986:*/
  11715. #line 1181 "./dataqsdk.w"
  11716. rmCount= 0;
  11717. cmCount= 0;
  11718. rmin= std::numeric_limits<double> ::max();
  11719. rmax= std::numeric_limits<double> ::min();
  11720. rmean= 0;
  11721. cmin= std::numeric_limits<double> ::max();
  11722. cmax= std::numeric_limits<double> ::min();
  11723. cmean= 0;
  11724. /*:986*/
  11725. #line 1175 "./dataqsdk.w"
  11726. }
  11727. /*:985*//*987:*/
  11728. #line 1195 "./dataqsdk.w"
  11729. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  11730. {
  11731. double nv= measure.temperature();
  11732. currentMeasurement->setText(QString("%1").arg(nv));
  11733. rmin= qMin(nv,rmin);
  11734. minimumMeasurement->setText(QString("%1").arg(rmin));
  11735. rmax= qMax(nv,rmax);
  11736. maximumMeasurement->setText(QString("%1").arg(rmax));
  11737. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  11738. rmCount++;
  11739. averageMeasurement->setText(QString("%1").arg(rmean));
  11740. }
  11741. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  11742. {
  11743. double nv= measure.temperature();
  11744. currentMapped->setText(QString("%1").arg(nv));
  11745. cmin= qMin(nv,cmin);
  11746. minimumMapped->setText(QString("%1").arg(cmin));
  11747. cmax= qMax(nv,cmax);
  11748. maximumMapped->setText(QString("%1").arg(cmax));
  11749. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  11750. cmCount++;
  11751. averageMapped->setText(QString("%1").arg(cmean));
  11752. }
  11753. /*:987*//*988:*/
  11754. #line 1224 "./dataqsdk.w"
  11755. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  11756. {
  11757. updateAttribute("column",value);
  11758. }
  11759. /*:988*/
  11760. #line 608 "./typica.w"
  11761. /*1012:*/
  11762. #line 393 "./scales.w"
  11763. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  11764. const QModelIndex&index)
  11765. :BasicDeviceConfigurationWidget(model,index),
  11766. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  11767. flow(new FlowSelector),stop(new StopSelector)
  11768. {
  11769. QFormLayout*layout= new QFormLayout;
  11770. layout->addRow(tr("Port:"),port);
  11771. connect(port,SIGNAL(currentIndexChanged(QString)),
  11772. this,SLOT(updatePort(QString)));
  11773. connect(port,SIGNAL(editTextChanged(QString)),
  11774. this,SLOT(updatePort(QString)));
  11775. layout->addRow(tr("Baud:"),baud);
  11776. connect(baud,SIGNAL(currentIndexChanged(QString)),
  11777. this,SLOT(updateBaudRate(QString)));
  11778. layout->addRow(tr("Parity:"),parity);
  11779. connect(parity,SIGNAL(currentIndexChanged(int)),
  11780. this,SLOT(updateParity(int)));
  11781. layout->addRow(tr("Flow Control:"),flow);
  11782. connect(flow,SIGNAL(currentIndexChanged(int)),
  11783. this,SLOT(updateFlowControl(int)));
  11784. layout->addRow(tr("Stop Bits:"),stop);
  11785. connect(stop,SIGNAL(currentIndexChanged(int)),
  11786. this,SLOT(updateStopBits(int)));
  11787. /*761:*/
  11788. #line 16100 "./typica.w"
  11789. QDomElement referenceElement=
  11790. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11791. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11792. QDomElement node;
  11793. /*:761*/
  11794. #line 418 "./scales.w"
  11795. for(int i= 0;i<configData.size();i++)
  11796. {
  11797. node= configData.at(i).toElement();
  11798. if(node.attribute("name")=="port")
  11799. {
  11800. int j= port->findText(node.attribute("value"));
  11801. if(j>=0)
  11802. {
  11803. port->setCurrentIndex(j);
  11804. }
  11805. else
  11806. {
  11807. port->insertItem(0,node.attribute("value"));
  11808. port->setCurrentIndex(0);
  11809. }
  11810. }
  11811. else if(node.attribute("name")=="baudrate")
  11812. {
  11813. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  11814. }
  11815. else if(node.attribute("name")=="parity")
  11816. {
  11817. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  11818. }
  11819. else if(node.attribute("name")=="flowcontrol")
  11820. {
  11821. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  11822. }
  11823. else if(node.attribute("name")=="stopbits")
  11824. {
  11825. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  11826. }
  11827. }
  11828. updatePort(port->currentText());
  11829. updateBaudRate(baud->currentText());
  11830. updateParity(parity->currentIndex());
  11831. updateFlowControl(flow->currentIndex());
  11832. updateStopBits(stop->currentIndex());
  11833. setLayout(layout);
  11834. }
  11835. /*:1012*//*1013:*/
  11836. #line 462 "./scales.w"
  11837. void SerialScaleConfWidget::updatePort(const QString&newPort)
  11838. {
  11839. updateAttribute("port",newPort);
  11840. }
  11841. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  11842. {
  11843. updateAttribute("baudrate",rate);
  11844. }
  11845. void SerialScaleConfWidget::updateParity(int index)
  11846. {
  11847. updateAttribute("parity",parity->itemData(index).toString());
  11848. }
  11849. void SerialScaleConfWidget::updateFlowControl(int index)
  11850. {
  11851. updateAttribute("flowcontrol",flow->itemData(index).toString());
  11852. }
  11853. void SerialScaleConfWidget::updateStopBits(int index)
  11854. {
  11855. updateAttribute("stopbits",stop->itemData(index).toString());
  11856. }
  11857. /*:1013*/
  11858. #line 609 "./typica.w"
  11859. /*1025:*/
  11860. #line 195 "./valueannotation.w"
  11861. void ValueAnnotation::newMeasurement(Measurement measure)
  11862. {
  11863. for(int i= 0;i<values.size();i++)
  11864. {
  11865. if(measure.temperature()> values.at(i)-tolerance&&
  11866. measure.temperature()<values.at(i)+tolerance)
  11867. {
  11868. if(i!=lastIndex)
  11869. {
  11870. lastIndex= i;
  11871. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  11872. }
  11873. }
  11874. }
  11875. }
  11876. /*:1025*//*1026:*/
  11877. #line 216 "./valueannotation.w"
  11878. void ValueAnnotation::annotate()
  11879. {
  11880. if(lastIndex> -1)
  11881. {
  11882. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  11883. }
  11884. }
  11885. /*:1026*//*1027:*/
  11886. #line 228 "./valueannotation.w"
  11887. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  11888. {
  11889. values.append(value);
  11890. annotations.append(annotation);
  11891. }
  11892. /*:1027*//*1028:*/
  11893. #line 237 "./valueannotation.w"
  11894. void ValueAnnotation::setAnnotationColumn(int column)
  11895. {
  11896. annotationColumn= column;
  11897. }
  11898. void ValueAnnotation::setTemperatureColumn(int column)
  11899. {
  11900. measurementColumn= column;
  11901. }
  11902. void ValueAnnotation::setTolerance(double epsilon)
  11903. {
  11904. tolerance= epsilon;
  11905. }
  11906. /*:1028*//*1029:*/
  11907. #line 255 "./valueannotation.w"
  11908. ValueAnnotation::ValueAnnotation():QObject(),
  11909. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  11910. {
  11911. }
  11912. /*:1029*/
  11913. #line 610 "./typica.w"
  11914. /*1017:*/
  11915. #line 33 "./valueannotation.w"
  11916. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  11917. const QModelIndex&index)
  11918. :BasicDeviceConfigurationWidget(model,index),
  11919. tablemodel(new SaltModel(2))
  11920. {
  11921. QFormLayout*layout= new QFormLayout;
  11922. QLineEdit*source= new QLineEdit;
  11923. layout->addRow(tr("Source column name:"),source);
  11924. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  11925. noteOnStart->setChecked(true);
  11926. layout->addRow(noteOnStart);
  11927. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  11928. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  11929. QTableView*annotationTable= new QTableView;
  11930. annotationTable->setModel(tablemodel);
  11931. NumericDelegate*delegate= new NumericDelegate;
  11932. annotationTable->setItemDelegateForColumn(0,delegate);
  11933. layout->addRow(tr("Annotations for values:"),annotationTable);
  11934. /*761:*/
  11935. #line 16100 "./typica.w"
  11936. QDomElement referenceElement=
  11937. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11938. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11939. QDomElement node;
  11940. /*:761*/
  11941. #line 52 "./valueannotation.w"
  11942. for(int i= 0;i<configData.size();i++)
  11943. {
  11944. node= configData.at(i).toElement();
  11945. if(node.attribute("name")=="source")
  11946. {
  11947. source->setText(node.attribute("value"));
  11948. }
  11949. else if(node.attribute("name")=="emitOnStart")
  11950. {
  11951. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  11952. }
  11953. else if(node.attribute("name")=="measuredValues")
  11954. {
  11955. /*915:*/
  11956. #line 19167 "./typica.w"
  11957. QString data= node.attribute("value");
  11958. if(data.length()> 3)
  11959. {
  11960. data.chop(2);
  11961. data= data.remove(0,2);
  11962. }
  11963. QStringList itemList= data.split(",");
  11964. /*:915*/
  11965. #line 66 "./valueannotation.w"
  11966. int column= 0;
  11967. /*916:*/
  11968. #line 19179 "./typica.w"
  11969. for(int j= 0;j<itemList.size();j++)
  11970. {
  11971. tablemodel->setData(tablemodel->index(j,column),
  11972. QVariant(itemList.at(j).toDouble()),
  11973. Qt::DisplayRole);
  11974. }
  11975. /*:916*/
  11976. #line 68 "./valueannotation.w"
  11977. }
  11978. else if(node.attribute("name")=="annotations")
  11979. {
  11980. /*1018:*/
  11981. #line 89 "./valueannotation.w"
  11982. QString data= node.attribute("value");
  11983. if(data.length()> 3)
  11984. {
  11985. data.chop(2);
  11986. data= data.remove(0,2);
  11987. }
  11988. QStringList itemList= data.split(",");
  11989. for(int i= 0;i<itemList.size();i++)
  11990. {
  11991. itemList[i]= itemList[i].simplified();
  11992. }
  11993. /*:1018*/
  11994. #line 72 "./valueannotation.w"
  11995. int column= 1;
  11996. /*1019:*/
  11997. #line 104 "./valueannotation.w"
  11998. for(int i= 0;i<itemList.size();i++)
  11999. {
  12000. tablemodel->setData(tablemodel->index(i,column),
  12001. QVariant(itemList.at(i)),
  12002. Qt::DisplayRole);
  12003. }
  12004. /*:1019*/
  12005. #line 74 "./valueannotation.w"
  12006. }
  12007. }
  12008. updateSourceColumn(source->text());
  12009. updateStart(noteOnStart->isChecked());
  12010. updateAnnotations();
  12011. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  12012. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  12013. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  12014. setLayout(layout);
  12015. }
  12016. /*:1017*//*1020:*/
  12017. #line 115 "./valueannotation.w"
  12018. void ValueAnnotationConfWidget::updateAnnotations()
  12019. {
  12020. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  12021. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  12022. }
  12023. /*:1020*//*1021:*/
  12024. #line 125 "./valueannotation.w"
  12025. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  12026. {
  12027. updateAttribute("source",source);
  12028. }
  12029. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  12030. {
  12031. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  12032. }
  12033. /*:1021*/
  12034. #line 611 "./typica.w"
  12035. /*:4*//*240:*/
  12036. #line 5778 "./typica.w"
  12037. /*237:*/
  12038. #line 5741 "./typica.w"
  12039. void ScriptValidator::fixup(QString&input)const
  12040. {
  12041. QScriptEngine*engine= AppInstance->engine;
  12042. engine->pushContext();
  12043. input= engine->evaluate(input).toString();
  12044. engine->popContext();
  12045. }
  12046. /*:237*//*238:*/
  12047. #line 5754 "./typica.w"
  12048. QValidator::State ScriptValidator::validate(QString&input,int&pos)const
  12049. {
  12050. if(v)
  12051. {
  12052. if(v->validate(input,pos)==QValidator::Acceptable)
  12053. {
  12054. return QValidator::Acceptable;
  12055. }
  12056. }
  12057. return QValidator::Intermediate;
  12058. }
  12059. /*:238*//*239:*/
  12060. #line 5769 "./typica.w"
  12061. ScriptValidator::ScriptValidator(QValidator*validator,QObject*parent)
  12062. :QValidator(parent),v(validator)
  12063. {
  12064. }
  12065. /*:239*/
  12066. #line 5779 "./typica.w"
  12067. /*:240*//*835:*/
  12068. #line 60 "./advancedsettings.w"
  12069. /*833:*/
  12070. #line 26 "./advancedsettings.w"
  12071. AdvancedSettingsWidget::AdvancedSettingsWidget():QWidget(NULL)
  12072. {
  12073. QSettings settings;
  12074. QFormLayout*layout= new QFormLayout;
  12075. QCheckBox*logDiagnostics= new QCheckBox;
  12076. logDiagnostics->setCheckState(
  12077. settings.value("settings/advanced/logging",false).toBool()?
  12078. Qt::Checked:Qt::Unchecked);
  12079. connect(logDiagnostics,SIGNAL(toggled(bool)),this,SLOT(enableDiagnosticLogging(bool)));
  12080. layout->addRow(tr("Enable diagnostic logging"),logDiagnostics);
  12081. setLayout(layout);
  12082. }
  12083. /*:833*//*834:*/
  12084. #line 43 "./advancedsettings.w"
  12085. void AdvancedSettingsWidget::enableDiagnosticLogging(bool enabled)
  12086. {
  12087. QSettings settings;
  12088. settings.setValue("settings/advanced/logging",enabled);
  12089. if(enabled)
  12090. {
  12091. qInstallMsgHandler(messageFileOutput);
  12092. }
  12093. else
  12094. {
  12095. qInstallMsgHandler(0);
  12096. }
  12097. }
  12098. /*:834*/
  12099. #line 61 "./advancedsettings.w"
  12100. #line 17845 "./typica.w"
  12101. /*:835*//*882:*/
  12102. #line 639 "./unsupportedserial.w"
  12103. /*857:*/
  12104. #line 58 "./unsupportedserial.w"
  12105. UnsupportedSerialDeviceConfWidget::UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  12106. const QModelIndex&index)
  12107. :BasicDeviceConfigurationWidget(model,index),
  12108. deviceSettingsModel(new SaltModel(2)),
  12109. scriptEditor(new QTextEdit)
  12110. {
  12111. scriptEditor->setTabStopWidth(20);
  12112. QVBoxLayout*dummyLayout= new QVBoxLayout;
  12113. QTabWidget*central= new QTabWidget;
  12114. QWidget*deviceConfigurationWidget= new QWidget;
  12115. QVBoxLayout*deviceConfigurationLayout= new QVBoxLayout;
  12116. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  12117. deviceConfigurationLayout->addWidget(addChannelButton);
  12118. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  12119. QLabel*deviceSettingsLabel= new QLabel(tr("Device Settings:"));
  12120. deviceConfigurationLayout->addWidget(deviceSettingsLabel);
  12121. QTableView*deviceSettingsView= new QTableView;
  12122. deviceSettingsModel->setHeaderData(0,Qt::Horizontal,tr("Key"));
  12123. deviceSettingsModel->setHeaderData(1,Qt::Horizontal,tr("Value"));
  12124. deviceSettingsView->setModel(deviceSettingsModel);
  12125. deviceConfigurationLayout->addWidget(deviceSettingsView);
  12126. deviceConfigurationWidget->setLayout(deviceConfigurationLayout);
  12127. central->addTab(deviceConfigurationWidget,tr("Configuration"));
  12128. central->addTab(scriptEditor,tr("Script"));
  12129. dummyLayout->addWidget(central);
  12130. /*761:*/
  12131. #line 16100 "./typica.w"
  12132. QDomElement referenceElement=
  12133. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12134. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12135. QDomElement node;
  12136. /*:761*/
  12137. #line 86 "./unsupportedserial.w"
  12138. for(int i= 0;i<configData.size();i++)
  12139. {
  12140. node= configData.at(i).toElement();
  12141. if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  12142. {
  12143. int column= 0;
  12144. if(node.attribute("name")=="values")
  12145. {
  12146. column= 1;
  12147. }
  12148. QString data= node.attribute("value");
  12149. if(data.length()> 3)
  12150. {
  12151. data.chop(2);
  12152. data= data.remove(0,2);
  12153. }
  12154. QStringList keyList= data.split(", ");
  12155. for(int j= 0;j<keyList.size();j++)
  12156. {
  12157. deviceSettingsModel->setData(deviceSettingsModel->index(j,column),
  12158. QVariant(keyList.at(j)),
  12159. Qt::EditRole);
  12160. }
  12161. }
  12162. else if(node.attribute("name")=="script")
  12163. {
  12164. scriptEditor->setPlainText(node.attribute("value"));
  12165. }
  12166. }
  12167. connect(deviceSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  12168. this,SLOT(updateConfiguration()));
  12169. connect(scriptEditor,SIGNAL(textChanged()),this,SLOT(saveScript()));
  12170. setLayout(dummyLayout);
  12171. }
  12172. /*:857*//*858:*/
  12173. #line 131 "./unsupportedserial.w"
  12174. void UnsupportedSerialDeviceConfWidget::updateConfiguration()
  12175. {
  12176. updateAttribute("keys",deviceSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  12177. updateAttribute("values",deviceSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  12178. }
  12179. /*:858*//*859:*/
  12180. #line 144 "./unsupportedserial.w"
  12181. void UnsupportedSerialDeviceConfWidget::saveScript()
  12182. {
  12183. updateAttribute("script",scriptEditor->toPlainText());
  12184. }
  12185. /*:859*//*860:*/
  12186. #line 155 "./unsupportedserial.w"
  12187. void UnsupportedSerialDeviceConfWidget::addChannel()
  12188. {
  12189. insertChildNode(tr("Channel"),"unsupporteddevicechannel");
  12190. }
  12191. /*:860*//*862:*/
  12192. #line 183 "./unsupportedserial.w"
  12193. UnsupportedDeviceChannelConfWidget::UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  12194. const QModelIndex&index)
  12195. :BasicDeviceConfigurationWidget(model,index),
  12196. channelSettingsModel(new SaltModel(2))
  12197. {
  12198. QFormLayout*layout= new QFormLayout;
  12199. QLineEdit*columnName= new QLineEdit;
  12200. layout->addRow(tr("Column Name:"),columnName);
  12201. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  12202. layout->addRow(hideSeries);
  12203. QTableView*channelSettings= new QTableView;
  12204. channelSettingsModel->setHeaderData(0,Qt::Horizontal,"Key");
  12205. channelSettingsModel->setHeaderData(1,Qt::Horizontal,"Value");
  12206. channelSettings->setModel(channelSettingsModel);
  12207. layout->addRow(channelSettings);
  12208. setLayout(layout);
  12209. /*761:*/
  12210. #line 16100 "./typica.w"
  12211. QDomElement referenceElement=
  12212. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12213. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12214. QDomElement node;
  12215. /*:761*/
  12216. #line 200 "./unsupportedserial.w"
  12217. for(int i= 0;i<configData.size();i++)
  12218. {
  12219. node= configData.at(i).toElement();
  12220. if(node.attribute("name")=="columnname")
  12221. {
  12222. columnName->setText(node.attribute("value"));
  12223. }
  12224. else if(node.attribute("name")=="hidden")
  12225. {
  12226. hideSeries->setChecked(node.attribute("value")=="true");
  12227. }
  12228. else if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  12229. {
  12230. int column= 0;
  12231. if(node.attribute("name")=="values")
  12232. {
  12233. column= 1;
  12234. }
  12235. QString data= node.attribute("value");
  12236. if(data.length()> 3)
  12237. {
  12238. data.chop(2);
  12239. data= data.remove(0,2);
  12240. }
  12241. QStringList keyList= data.split(", ");
  12242. for(int j= 0;j<keyList.size();j++)
  12243. {
  12244. channelSettingsModel->setData(channelSettingsModel->index(j,column),
  12245. QVariant(keyList.at(j)),
  12246. Qt::EditRole);
  12247. }
  12248. }
  12249. }
  12250. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  12251. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12252. connect(channelSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  12253. this,SLOT(updateConfiguration()));
  12254. }
  12255. /*:862*//*863:*/
  12256. #line 244 "./unsupportedserial.w"
  12257. void UnsupportedDeviceChannelConfWidget::updateColumnName(const QString&value)
  12258. {
  12259. updateAttribute("columnname",value);
  12260. }
  12261. void UnsupportedDeviceChannelConfWidget::updateHidden(bool hidden)
  12262. {
  12263. updateAttribute("hidden",hidden?"true":"false");
  12264. }
  12265. void UnsupportedDeviceChannelConfWidget::updateConfiguration()
  12266. {
  12267. updateAttribute("keys",channelSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  12268. updateAttribute("values",channelSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  12269. }
  12270. /*:863*/
  12271. #line 640 "./unsupportedserial.w"
  12272. /*870:*/
  12273. #line 371 "./unsupportedserial.w"
  12274. void JavaScriptDevice::start()
  12275. {
  12276. QScriptValue object= scriptengine->newQObject(this);
  12277. /*871:*/
  12278. #line 390 "./unsupportedserial.w"
  12279. QScriptValue settingsObject= scriptengine->newObject();
  12280. QVariantMap::const_iterator i= deviceSettings.constBegin();
  12281. while(i!=deviceSettings.constEnd())
  12282. {
  12283. settingsObject.setProperty(i.key(),i.value().toString());
  12284. i++;
  12285. }
  12286. object.setProperty("settings",settingsObject);
  12287. /*:871*/
  12288. #line 375 "./unsupportedserial.w"
  12289. /*872:*/
  12290. #line 405 "./unsupportedserial.w"
  12291. QScriptValue channelsArray= scriptengine->newArray(channelCount());
  12292. for(int i= 0;i<channelCount();i++)
  12293. {
  12294. QScriptValue channelObject= scriptengine->newQObject(getChannel(i));
  12295. QScriptValue channelSettingsObject= scriptengine->newObject();
  12296. QVariantMap::const_iterator j= channelSettings.at(i).constBegin();
  12297. while(j!=channelSettings.at(i).constEnd())
  12298. {
  12299. channelSettingsObject.setProperty(j.key(),j.value().toString());
  12300. j++;
  12301. }
  12302. channelObject.setProperty("settings",channelSettingsObject);
  12303. channelsArray.setProperty(i,channelObject);
  12304. }
  12305. object.setProperty("channels",channelsArray);
  12306. /*:872*/
  12307. #line 376 "./unsupportedserial.w"
  12308. QScriptContext*context= scriptengine->currentContext();
  12309. QScriptValue oldThis= context->thisObject();
  12310. context->setThisObject(object);
  12311. QScriptValue result= scriptengine->evaluate(deviceScript);
  12312. QScriptEngine*engine= scriptengine;
  12313. /*182:*/
  12314. #line 4292 "./typica.w"
  12315. if(engine->hasUncaughtException())
  12316. {
  12317. int line= engine->uncaughtExceptionLineNumber();
  12318. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  12319. result.toString();
  12320. QString trace;
  12321. foreach(trace,engine->uncaughtExceptionBacktrace())
  12322. {
  12323. qDebug()<<trace;
  12324. }
  12325. }
  12326. /*:182*/
  12327. #line 382 "./unsupportedserial.w"
  12328. context->setThisObject(oldThis);
  12329. }
  12330. /*:870*//*875:*/
  12331. #line 446 "./unsupportedserial.w"
  12332. void JavaScriptDevice::stop()
  12333. {
  12334. emit deviceStopRequested();
  12335. }
  12336. /*:875*//*876:*/
  12337. #line 459 "./unsupportedserial.w"
  12338. JavaScriptDevice::JavaScriptDevice(const QModelIndex&index,
  12339. QScriptEngine*engine):
  12340. QObject(NULL),scriptengine(engine)
  12341. {
  12342. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  12343. QDomElement deviceReferenceElement=
  12344. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12345. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  12346. QDomElement node;
  12347. QStringList deviceKeys;
  12348. QStringList deviceValues;
  12349. for(int i= 0;i<deviceConfigData.size();i++)
  12350. {
  12351. node= deviceConfigData.at(i).toElement();
  12352. if(node.attribute("name")=="keys")
  12353. {
  12354. QString data= node.attribute("value");
  12355. if(data.length()> 3)
  12356. {
  12357. data.chop(2);
  12358. data= data.remove(0,2);
  12359. }
  12360. deviceKeys= data.split(", ");
  12361. }
  12362. else if(node.attribute("name")=="values")
  12363. {
  12364. QString data= node.attribute("value");
  12365. if(data.length()> 3)
  12366. {
  12367. data.chop(2);
  12368. data= data.remove(0,2);
  12369. }
  12370. deviceValues= data.split(", ");
  12371. }
  12372. else if(node.attribute("name")=="script")
  12373. {
  12374. deviceScript= node.attribute("value");
  12375. }
  12376. deviceSettings.insert(node.attribute("name"),node.attribute("value"));
  12377. }
  12378. for(int i= 0;i<qMin(deviceKeys.length(),deviceValues.length());i++)
  12379. {
  12380. deviceSettings.insert(deviceKeys[i],deviceValues[i]);
  12381. }
  12382. if(model->hasChildren(index))
  12383. {
  12384. for(int i= 0;i<model->rowCount(index);i++)
  12385. {
  12386. QModelIndex channelIndex= model->index(i,0,index);
  12387. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  12388. channelList.append(new Channel);
  12389. QDomElement channelReferenceElement=
  12390. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  12391. QDomNodeList channelConfigData=
  12392. channelReferenceElement.elementsByTagName("attribute");
  12393. QStringList channelKeys;
  12394. QStringList channelValues;
  12395. for(int j= 0;j<channelConfigData.size();j++)
  12396. {
  12397. node= channelConfigData.at(j).toElement();
  12398. if(node.attribute("name")=="keys")
  12399. {
  12400. QString data= node.attribute("value");
  12401. if(data.length()> 3)
  12402. {
  12403. data.chop(2);
  12404. data= data.remove(0,2);
  12405. }
  12406. channelKeys= data.split(", ");
  12407. }
  12408. else if(node.attribute("name")=="values")
  12409. {
  12410. QString data= node.attribute("value");
  12411. if(data.length()> 3)
  12412. {
  12413. data.chop(2);
  12414. data= data.remove(0,2);
  12415. }
  12416. channelValues= data.split(", ");
  12417. }
  12418. else if(node.attribute("name")=="hidden")
  12419. {
  12420. hiddenState.append(node.attribute("value")=="true");
  12421. }
  12422. else if(node.attribute("name")=="columnname")
  12423. {
  12424. columnNames.append(node.attribute("value"));
  12425. }
  12426. }
  12427. QVariantMap cs;
  12428. for(int j= 0;j<qMin(channelKeys.length(),channelValues.length());j++)
  12429. {
  12430. cs.insert(channelKeys[j],channelValues[j]);
  12431. }
  12432. channelSettings.append(cs);
  12433. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  12434. channelUnits.append(Units::Fahrenheit);
  12435. }
  12436. }
  12437. }
  12438. /*:876*//*877:*/
  12439. #line 564 "./unsupportedserial.w"
  12440. int JavaScriptDevice::channelCount()
  12441. {
  12442. return channelList.length();
  12443. }
  12444. Channel*JavaScriptDevice::getChannel(int channel)
  12445. {
  12446. return channelList.at(channel);
  12447. }
  12448. bool JavaScriptDevice::isChannelHidden(int channel)
  12449. {
  12450. return hiddenState.at(channel);
  12451. }
  12452. Units::Unit JavaScriptDevice::expectedChannelUnit(int channel)
  12453. {
  12454. return channelUnits.at(channel);
  12455. }
  12456. QString JavaScriptDevice::channelColumnName(int channel)
  12457. {
  12458. if(channel>=0&&channel<columnNames.length())
  12459. {
  12460. return columnNames.at(channel);
  12461. }
  12462. return QString();
  12463. }
  12464. QString JavaScriptDevice::channelIndicatorText(int channel)
  12465. {
  12466. return indicatorTexts.at(channel);
  12467. }
  12468. /*:877*//*878:*/
  12469. #line 601 "./unsupportedserial.w"
  12470. void JavaScriptDevice::setTemperatureColumn(int tcol)
  12471. {
  12472. annotationTemperatureColumn= tcol;
  12473. }
  12474. void JavaScriptDevice::setAnnotationColumn(int ncol)
  12475. {
  12476. annotationNoteColumn= ncol;
  12477. }
  12478. /*:878*/
  12479. #line 641 "./unsupportedserial.w"
  12480. /*:882*//*908:*/
  12481. #line 444 "./phidgets.w"
  12482. /*892:*/
  12483. #line 31 "./phidgets.w"
  12484. PhidgetsTemperatureSensorConfWidget::PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  12485. const QModelIndex&index)
  12486. :BasicDeviceConfigurationWidget(model,index)
  12487. {
  12488. QFormLayout*layout= new QFormLayout;
  12489. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  12490. QSpinBox*sampleRate= new QSpinBox;
  12491. sampleRate->setMinimum(40);
  12492. sampleRate->setMaximum(600);
  12493. sampleRate->setSingleStep(40);
  12494. sampleRate->setValue(360);
  12495. /*761:*/
  12496. #line 16100 "./typica.w"
  12497. QDomElement referenceElement=
  12498. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12499. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12500. QDomElement node;
  12501. /*:761*/
  12502. #line 44 "./phidgets.w"
  12503. for(int i= 0;i<configData.size();i++)
  12504. {
  12505. node= configData.at(i).toElement();
  12506. if(node.attribute("name")=="sampleRate")
  12507. {
  12508. sampleRate->setValue(node.attribute("value").toInt());
  12509. }
  12510. }
  12511. updateRate(sampleRate->value());
  12512. connect(sampleRate,SIGNAL(valueChanged(int)),this,SLOT(updateRate(int)));
  12513. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  12514. layout->addRow(addChannelButton);
  12515. layout->addRow(tr("Sample rate:"),sampleRate);
  12516. setLayout(layout);
  12517. }
  12518. /*:892*//*893:*/
  12519. #line 66 "./phidgets.w"
  12520. void PhidgetsTemperatureSensorConfWidget::addChannel()
  12521. {
  12522. insertChildNode(tr("Channel"),"phidgets1048channel");
  12523. }
  12524. /*:893*//*894:*/
  12525. #line 74 "./phidgets.w"
  12526. void PhidgetsTemperatureSensorConfWidget::updateRate(int ms)
  12527. {
  12528. updateAttribute("sampleRate",QString("%1").arg(ms));
  12529. }
  12530. /*:894*//*896:*/
  12531. #line 103 "./phidgets.w"
  12532. PhidgetTemperatureSensorChannelConfWidget::PhidgetTemperatureSensorChannelConfWidget(
  12533. DeviceTreeModel*model,const QModelIndex&index)
  12534. :BasicDeviceConfigurationWidget(model,index),
  12535. tcType(new QComboBox)
  12536. {
  12537. QFormLayout*layout= new QFormLayout;
  12538. QLineEdit*columnName= new QLineEdit;
  12539. layout->addRow(tr("Column Name:"),columnName);
  12540. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  12541. layout->addRow(hideSeries);
  12542. layout->addRow(tr("Thermocouple Type:"),tcType);
  12543. tcType->addItem("Type K","1");
  12544. tcType->addItem("Type J","2");
  12545. tcType->addItem("Type E","3");
  12546. tcType->addItem("Type T","4");
  12547. QSpinBox*channel= new QSpinBox;
  12548. layout->addRow(tr("Channel:"),channel);
  12549. channel->setMinimum(0);
  12550. channel->setMaximum(3);
  12551. setLayout(layout);
  12552. /*761:*/
  12553. #line 16100 "./typica.w"
  12554. QDomElement referenceElement=
  12555. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12556. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12557. QDomElement node;
  12558. /*:761*/
  12559. #line 124 "./phidgets.w"
  12560. for(int i= 0;i<configData.size();i++)
  12561. {
  12562. node= configData.at(i).toElement();
  12563. if(node.attribute("name")=="columnname")
  12564. {
  12565. columnName->setText(node.attribute("value"));
  12566. }
  12567. else if(node.attribute("name")=="hidden")
  12568. {
  12569. hideSeries->setChecked(node.attribute("value")=="true");
  12570. }
  12571. else if(node.attribute("name")=="tctype")
  12572. {
  12573. tcType->setCurrentIndex(tcType->findData(node.attribute("value")));
  12574. }
  12575. else if(node.attribute("name")=="channel")
  12576. {
  12577. channel->setValue(node.attribute("value").toInt());
  12578. }
  12579. }
  12580. updateColumnName(columnName->text());
  12581. updateHidden(hideSeries->isChecked());
  12582. updateTC(tcType->currentIndex());
  12583. updateChannel(channel->value());
  12584. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  12585. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12586. connect(tcType,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTC(int)));
  12587. connect(channel,SIGNAL(valueChanged(int)),this,SLOT(updateChannel(int)));
  12588. }
  12589. /*:896*//*897:*/
  12590. #line 157 "./phidgets.w"
  12591. void PhidgetTemperatureSensorChannelConfWidget::updateColumnName(const QString&value)
  12592. {
  12593. updateAttribute("columnname",value);
  12594. }
  12595. void PhidgetTemperatureSensorChannelConfWidget::updateHidden(bool hidden)
  12596. {
  12597. updateAttribute("hidden",hidden?"true":"false");
  12598. }
  12599. void PhidgetTemperatureSensorChannelConfWidget::updateTC(int index)
  12600. {
  12601. updateAttribute("tctype",tcType->itemData(index).toString());
  12602. }
  12603. void PhidgetTemperatureSensorChannelConfWidget::updateChannel(int channel)
  12604. {
  12605. updateAttribute("channel",QString("%1").arg(channel));
  12606. }
  12607. /*:897*//*901:*/
  12608. #line 246 "./phidgets.w"
  12609. PhidgetsTemperatureSensor::PhidgetsTemperatureSensor(const QModelIndex&index)
  12610. :QObject(NULL),driver("phidget21"),device(NULL)
  12611. {
  12612. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  12613. QDomElement deviceReferenceElement=
  12614. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12615. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  12616. QDomElement node;
  12617. for(int i= 0;i<deviceConfigData.size();i++)
  12618. {
  12619. node= deviceConfigData.at(i).toElement();
  12620. if(node.attribute("name")=="sampleRate")
  12621. {
  12622. sampleTimer.setInterval(node.attribute("value").toInt());
  12623. }
  12624. }
  12625. if(model->hasChildren(index))
  12626. {
  12627. for(int i= 0;i<model->rowCount(index);i++)
  12628. {
  12629. QModelIndex channelIndex= model->index(i,0,index);
  12630. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  12631. QDomElement channelReferenceElement= model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  12632. QDomNodeList channelConfigData= channelReferenceElement.elementsByTagName("attribute");
  12633. for(int j= 0;j<channelConfigData.size();j++)
  12634. {
  12635. node= channelConfigData.at(j).toElement();
  12636. if(node.attribute("name")=="channel")
  12637. {
  12638. int channelID= node.attribute("value").toInt();
  12639. channelIndices.append(channelID);
  12640. Channel*channel= new Channel;
  12641. channelList.append(channel);
  12642. channelMap.insert(channelID,channel);
  12643. }
  12644. else if(node.attribute("name")=="hidden")
  12645. {
  12646. hiddenState.append(node.attribute("value")=="true");
  12647. }
  12648. else if(node.attribute("name")=="columnname")
  12649. {
  12650. columnNames.append(node.attribute("value"));
  12651. }
  12652. else if(node.attribute("name")=="tctype")
  12653. {
  12654. tctypes.append(node.attribute("value").toInt());
  12655. }
  12656. }
  12657. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  12658. }
  12659. }
  12660. }
  12661. /*:901*//*902:*/
  12662. #line 306 "./phidgets.w"
  12663. int PhidgetsTemperatureSensor::channelCount()
  12664. {
  12665. return channelList.length();
  12666. }
  12667. Channel*PhidgetsTemperatureSensor::getChannel(int channel)
  12668. {
  12669. return channelList.at(channel);
  12670. }
  12671. /*:902*//*903:*/
  12672. #line 319 "./phidgets.w"
  12673. bool PhidgetsTemperatureSensor::isChannelHidden(int channel)
  12674. {
  12675. return hiddenState.at(channel);
  12676. }
  12677. QString PhidgetsTemperatureSensor::channelColumnName(int channel)
  12678. {
  12679. if(channel>=0&&channel<columnNames.length())
  12680. {
  12681. return columnNames.at(channel);
  12682. }
  12683. return QString();
  12684. }
  12685. QString PhidgetsTemperatureSensor::channelIndicatorText(int channel)
  12686. {
  12687. if(channel>=0&&channel<indicatorTexts.length())
  12688. {
  12689. return indicatorTexts.at(channel);
  12690. }
  12691. return QString();
  12692. }
  12693. /*:903*//*905:*/
  12694. #line 371 "./phidgets.w"
  12695. void PhidgetsTemperatureSensor::start()
  12696. {
  12697. if(!driver.load())
  12698. {
  12699. driver.setFileName("Phidget21.framework/Phidget21");
  12700. if(!driver.load())
  12701. {
  12702. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  12703. tr("Failed to find phidget21. Please install it."));
  12704. return;
  12705. }
  12706. }
  12707. if((createDevice= (PhidgetHandleOnly)driver.resolve("CPhidgetTemperatureSensor_create"))==0||
  12708. (openDevice= (PhidgetHandleInt)driver.resolve("CPhidget_open"))==0||
  12709. (waitForOpen= (PhidgetHandleInt)driver.resolve("CPhidget_waitForAttachment"))==0||
  12710. (setTCType= (PhidgetHandleIntInt)driver.resolve("CPhidgetTemperatureSensor_setThermocoupleType"))==0||
  12711. (getTemperature= (PhidgetHandleIntDoubleOut)driver.resolve("CPhidgetTemperatureSensor_getTemperature"))==0||
  12712. (closeDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_close"))==0||
  12713. (deleteDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_delete"))==0)
  12714. {
  12715. QMessageBox::critical(NULL,tr("Typica: Link error"),
  12716. tr("Failed to link a required symbol in phidget21."));
  12717. return;
  12718. }
  12719. createDevice(&device);
  12720. openDevice(device,-1);
  12721. int error;
  12722. if((error= waitForOpen(device,10000)))
  12723. {
  12724. closeDevice(device);
  12725. deleteDevice(device);
  12726. QMessageBox::critical(NULL,tr("Typica: Failed to Open Device"),
  12727. tr("CPhidget_waitForAttachment returns error %n",0,error));
  12728. return;
  12729. }
  12730. for(int i= 0;i<channelIndices.length();i++)
  12731. {
  12732. setTCType(device,channelIndices.at(i),tctypes.at(i));
  12733. }
  12734. connect(&sampleTimer,SIGNAL(timeout()),this,SLOT(getMeasurements()));
  12735. sampleTimer.start();
  12736. }
  12737. /*:905*//*906:*/
  12738. #line 418 "./phidgets.w"
  12739. void PhidgetsTemperatureSensor::getMeasurements()
  12740. {
  12741. double value= 0.0;
  12742. QTime time= QTime::currentTime();
  12743. foreach(int i,channelIndices)
  12744. {
  12745. getTemperature(device,i,&value);
  12746. Measurement measure(value*9.0/5.0+32.0,time);
  12747. channelMap[i]->input(measure);
  12748. }
  12749. }
  12750. /*:906*//*907:*/
  12751. #line 433 "./phidgets.w"
  12752. void PhidgetsTemperatureSensor::stop()
  12753. {
  12754. sampleTimer.stop();
  12755. closeDevice(device);
  12756. deleteDevice(device);
  12757. driver.unload();
  12758. }
  12759. /*:907*/
  12760. #line 445 "./phidgets.w"
  12761. /*:908*//*922:*/
  12762. #line 19275 "./typica.w"
  12763. /*920:*/
  12764. #line 19237 "./typica.w"
  12765. CoolingTimerConfWidget::CoolingTimerConfWidget(DeviceTreeModel*model,
  12766. const QModelIndex&index)
  12767. :BasicDeviceConfigurationWidget(model,index)
  12768. {
  12769. QHBoxLayout*layout= new QHBoxLayout;
  12770. QLabel*label= new QLabel(tr("Cooling Time: "));
  12771. QTimeEdit*editor= new QTimeEdit;
  12772. editor->setDisplayFormat("mm:ss");
  12773. /*761:*/
  12774. #line 16100 "./typica.w"
  12775. QDomElement referenceElement=
  12776. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12777. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12778. QDomElement node;
  12779. /*:761*/
  12780. #line 19246 "./typica.w"
  12781. for(int i= 0;i<configData.size();i++)
  12782. {
  12783. node= configData.at(i).toElement();
  12784. if(node.attribute("name")=="reset")
  12785. {
  12786. editor->setTime(QTime::fromString(node.attribute("value"),"mm:ss"));
  12787. }
  12788. }
  12789. updateResetTime(editor->time());
  12790. connect(editor,SIGNAL(timeChanged(QTime)),
  12791. this,SLOT(updateResetTime(QTime)));
  12792. layout->addWidget(label);
  12793. layout->addWidget(editor);
  12794. setLayout(layout);
  12795. }
  12796. void CoolingTimerConfWidget::updateResetTime(QTime time)
  12797. {
  12798. updateAttribute("reset",time.toString("mm:ss"));
  12799. }
  12800. /*:920*/
  12801. #line 19276 "./typica.w"
  12802. /*:922*//*927:*/
  12803. #line 19534 "./typica.w"
  12804. /*924:*/
  12805. #line 19308 "./typica.w"
  12806. RangeTimerConfWidget::RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  12807. :BasicDeviceConfigurationWidget(model,index)
  12808. {
  12809. QVBoxLayout*layout= new QVBoxLayout;
  12810. QGroupBox*startConfigurationGroup= new QGroupBox(tr("Start trigger"));
  12811. QRadioButton*startBatchOption= new QRadioButton(tr("Start of batch"));
  12812. QRadioButton*buttonOption= new QRadioButton(tr("Manual"));
  12813. QRadioButton*thresholdOption= new QRadioButton(tr("At temperature"));
  12814. QButtonGroup*startOptionGroup= new QButtonGroup;
  12815. startOptionGroup->addButton(startBatchOption,1);
  12816. startOptionGroup->addButton(buttonOption,2);
  12817. startOptionGroup->addButton(thresholdOption,3);
  12818. startBatchOption->setChecked(true);
  12819. QGridLayout*startOptions= new QGridLayout;
  12820. startOptions->addWidget(startBatchOption,0,0);
  12821. startOptions->addWidget(buttonOption,1,0);
  12822. startOptions->addWidget(thresholdOption,2,0);
  12823. QLabel*buttonTextLabel= new QLabel(tr("Button Text: "));
  12824. QLineEdit*buttonTextEdit= new QLineEdit;
  12825. QHBoxLayout*buttonTextOptions= new QHBoxLayout;
  12826. buttonTextOptions->addWidget(buttonTextLabel);
  12827. buttonTextOptions->addWidget(buttonTextEdit);
  12828. startOptions->addLayout(buttonTextOptions,1,1);
  12829. QFormLayout*thresholdOptions= new QFormLayout;
  12830. QLineEdit*startColumnName= new QLineEdit;
  12831. QLineEdit*startValue= new QLineEdit;
  12832. thresholdOptions->addRow(tr("Column Name: "),startColumnName);
  12833. thresholdOptions->addRow(tr("Value: "),startValue);
  12834. startOptions->addLayout(thresholdOptions,2,1);
  12835. startConfigurationGroup->setLayout(startOptions);
  12836. layout->addWidget(startConfigurationGroup);
  12837. QGroupBox*stopConfigurationGroup= new QGroupBox(tr("Stop trigger"));
  12838. QRadioButton*stopBatchOption= new QRadioButton(tr("End of batch"));
  12839. QRadioButton*stopButtonOption= new QRadioButton(tr("Manual"));
  12840. QRadioButton*stopThresholdOption= new QRadioButton(tr("At temperature"));
  12841. QButtonGroup*stopOptionGroup= new QButtonGroup;
  12842. stopOptionGroup->addButton(stopBatchOption,1);
  12843. stopOptionGroup->addButton(stopButtonOption,2);
  12844. stopOptionGroup->addButton(stopThresholdOption,3);
  12845. stopBatchOption->setChecked(true);
  12846. QGridLayout*stopOptions= new QGridLayout;
  12847. stopOptions->addWidget(stopBatchOption,0,0);
  12848. stopOptions->addWidget(stopButtonOption,1,0);
  12849. stopOptions->addWidget(stopThresholdOption,2,0);
  12850. QLabel*stopButtonLabel= new QLabel(tr("Button Text: "));
  12851. QLineEdit*stopButtonEdit= new QLineEdit;
  12852. QHBoxLayout*stopButtonTextOptions= new QHBoxLayout;
  12853. stopButtonTextOptions->addWidget(stopButtonLabel);
  12854. stopButtonTextOptions->addWidget(stopButtonEdit);
  12855. stopOptions->addLayout(stopButtonTextOptions,1,1);
  12856. QLineEdit*stopColumnName= new QLineEdit;
  12857. QLineEdit*stopValue= new QLineEdit;
  12858. QFormLayout*stopThresholdOptions= new QFormLayout;
  12859. stopThresholdOptions->addRow(tr("Column Name: "),stopColumnName);
  12860. stopThresholdOptions->addRow(tr("Value: "),stopValue);
  12861. stopOptions->addLayout(stopThresholdOptions,2,1);
  12862. stopConfigurationGroup->setLayout(stopOptions);
  12863. layout->addWidget(stopConfigurationGroup);
  12864. /*761:*/
  12865. #line 16100 "./typica.w"
  12866. QDomElement referenceElement=
  12867. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12868. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12869. QDomElement node;
  12870. /*:761*/
  12871. #line 19370 "./typica.w"
  12872. for(int i= 0;i<configData.size();i++)
  12873. {
  12874. node= configData.at(i).toElement();
  12875. if(node.attribute("name")=="startbuttontext")
  12876. {
  12877. buttonTextEdit->setText(node.attribute("value"));
  12878. }
  12879. else if(node.attribute("name")=="stopbuttontext")
  12880. {
  12881. stopButtonEdit->setText(node.attribute("value"));
  12882. }
  12883. else if(node.attribute("name")=="startcolumnname")
  12884. {
  12885. startColumnName->setText(node.attribute("value"));
  12886. }
  12887. else if(node.attribute("name")=="stopcolumnname")
  12888. {
  12889. stopColumnName->setText(node.attribute("value"));
  12890. }
  12891. else if(node.attribute("name")=="startvalue")
  12892. {
  12893. startValue->setText(node.attribute("value"));
  12894. }
  12895. else if(node.attribute("name")=="stopvalue")
  12896. {
  12897. stopValue->setText(node.attribute("value"));
  12898. }
  12899. else if(node.attribute("name")=="starttrigger")
  12900. {
  12901. if(node.attribute("value")=="batch")
  12902. {
  12903. startBatchOption->setChecked(true);
  12904. }
  12905. else if(node.attribute("value")=="manual")
  12906. {
  12907. buttonOption->setChecked(true);
  12908. }
  12909. else if(node.attribute("value")=="value")
  12910. {
  12911. thresholdOption->setChecked(true);
  12912. }
  12913. }
  12914. else if(node.attribute("name")=="stoptrigger")
  12915. {
  12916. if(node.attribute("value")=="batch")
  12917. {
  12918. stopBatchOption->setChecked(true);
  12919. }
  12920. else if(node.attribute("value")=="manual")
  12921. {
  12922. stopButtonOption->setChecked(true);
  12923. }
  12924. else if(node.attribute("value")=="value")
  12925. {
  12926. stopThresholdOption->setChecked(true);
  12927. }
  12928. }
  12929. }
  12930. updateStartButtonText(buttonTextEdit->text());
  12931. updateStopButtonText(stopButtonEdit->text());
  12932. updateStartColumnName(startColumnName->text());
  12933. updateStopColumnName(stopColumnName->text());
  12934. updateStartValue(startValue->text());
  12935. updateStopValue(stopValue->text());
  12936. updateStartTrigger(startOptionGroup->checkedId());
  12937. updateStopTrigger(stopOptionGroup->checkedId());
  12938. setLayout(layout);
  12939. connect(buttonTextEdit,SIGNAL(textChanged(QString)),
  12940. this,SLOT(updateStartButtonText(QString)));
  12941. connect(stopButtonEdit,SIGNAL(textChanged(QString)),
  12942. this,SLOT(updateStopButtonText(QString)));
  12943. connect(startColumnName,SIGNAL(textChanged(QString)),
  12944. this,SLOT(updateStartColumnName(QString)));
  12945. connect(stopColumnName,SIGNAL(textChanged(QString)),
  12946. this,SLOT(updateStopColumnName(QString)));
  12947. connect(startValue,SIGNAL(textChanged(QString)),
  12948. this,SLOT(updateStartValue(QString)));
  12949. connect(stopValue,SIGNAL(textChanged(QString)),
  12950. this,SLOT(updateStopValue(QString)));
  12951. connect(startOptionGroup,SIGNAL(buttonClicked(int)),
  12952. this,SLOT(updateStartTrigger(int)));
  12953. connect(stopOptionGroup,SIGNAL(buttonClicked(int)),
  12954. this,SLOT(updateStopTrigger(int)));
  12955. }
  12956. /*:924*//*925:*/
  12957. #line 19460 "./typica.w"
  12958. void RangeTimerConfWidget::updateStartButtonText(const QString&text)
  12959. {
  12960. updateAttribute("startbuttontext",text);
  12961. }
  12962. void RangeTimerConfWidget::updateStopButtonText(const QString&text)
  12963. {
  12964. updateAttribute("stopbuttontext",text);
  12965. }
  12966. void RangeTimerConfWidget::updateStartColumnName(const QString&text)
  12967. {
  12968. updateAttribute("startcolumnname",text);
  12969. }
  12970. void RangeTimerConfWidget::updateStopColumnName(const QString&text)
  12971. {
  12972. updateAttribute("stopcolumnname",text);
  12973. }
  12974. void RangeTimerConfWidget::updateStartValue(const QString&text)
  12975. {
  12976. updateAttribute("startvalue",text);
  12977. }
  12978. void RangeTimerConfWidget::updateStopValue(const QString&text)
  12979. {
  12980. updateAttribute("stopvalue",text);
  12981. }
  12982. void RangeTimerConfWidget::updateStartTrigger(int option)
  12983. {
  12984. switch(option)
  12985. {
  12986. case 1:
  12987. updateAttribute("starttrigger","batch");
  12988. break;
  12989. case 2:
  12990. updateAttribute("starttrigger","manual");
  12991. break;
  12992. case 3:
  12993. updateAttribute("starttrigger","value");
  12994. break;
  12995. default:
  12996. break;
  12997. }
  12998. }
  12999. void RangeTimerConfWidget::updateStopTrigger(int option)
  13000. {
  13001. switch(option)
  13002. {
  13003. case 1:
  13004. updateAttribute("stoptrigger","batch");
  13005. break;
  13006. case 2:
  13007. updateAttribute("stoptrigger","manual");
  13008. break;
  13009. case 3:
  13010. updateAttribute("stoptrigger","value");
  13011. break;
  13012. default:
  13013. break;
  13014. }
  13015. }
  13016. /*:925*/
  13017. #line 19535 "./typica.w"
  13018. /*:927*//*932:*/
  13019. #line 19635 "./typica.w"
  13020. /*929:*/
  13021. #line 19559 "./typica.w"
  13022. MultiRangeTimerConfWidget::MultiRangeTimerConfWidget(DeviceTreeModel*model,
  13023. const QModelIndex&index)
  13024. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  13025. {
  13026. QFormLayout*layout= new QFormLayout;
  13027. QLineEdit*trigger= new QLineEdit;
  13028. layout->addRow(tr("Trigger column name:"),trigger);
  13029. tablemodel->setHeaderData(0,Qt::Horizontal,"Range Name");
  13030. tablemodel->setHeaderData(1,Qt::Horizontal,"End Temperature");
  13031. QTableView*rangeTable= new QTableView;
  13032. rangeTable->setModel(tablemodel);
  13033. layout->addRow(tr("Range data:"),rangeTable);
  13034. /*761:*/
  13035. #line 16100 "./typica.w"
  13036. QDomElement referenceElement=
  13037. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13038. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13039. QDomElement node;
  13040. /*:761*/
  13041. #line 19572 "./typica.w"
  13042. for(int i= 0;i<configData.size();i++)
  13043. {
  13044. node= configData.at(i).toElement();
  13045. if(node.attribute("name")=="trigger")
  13046. {
  13047. trigger->setText(node.attribute("value"));
  13048. }
  13049. else if(node.attribute("name")=="rangenames")
  13050. {
  13051. QString data= node.attribute("value");
  13052. if(data.length()> 3)
  13053. {
  13054. data.chop(2);
  13055. data= data.remove(0,2);
  13056. }
  13057. QStringList itemList= data.split(", ");
  13058. for(int j= 0;j<itemList.size();j++)
  13059. {
  13060. QString item= itemList.at(j);
  13061. item.chop(1);
  13062. item= item.remove(0,1);
  13063. tablemodel->setData(tablemodel->index(j,0),
  13064. QVariant(item),Qt::DisplayRole);
  13065. }
  13066. }
  13067. else if(node.attribute("name")=="endtemps")
  13068. {
  13069. /*915:*/
  13070. #line 19167 "./typica.w"
  13071. QString data= node.attribute("value");
  13072. if(data.length()> 3)
  13073. {
  13074. data.chop(2);
  13075. data= data.remove(0,2);
  13076. }
  13077. QStringList itemList= data.split(",");
  13078. /*:915*/
  13079. #line 19600 "./typica.w"
  13080. int column= 1;
  13081. /*916:*/
  13082. #line 19179 "./typica.w"
  13083. for(int j= 0;j<itemList.size();j++)
  13084. {
  13085. tablemodel->setData(tablemodel->index(j,column),
  13086. QVariant(itemList.at(j).toDouble()),
  13087. Qt::DisplayRole);
  13088. }
  13089. /*:916*/
  13090. #line 19602 "./typica.w"
  13091. }
  13092. }
  13093. updateColumnName(trigger->text());
  13094. updateRangeData();
  13095. connect(trigger,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  13096. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateRangeData()));
  13097. setLayout(layout);
  13098. }
  13099. /*:929*//*930:*/
  13100. #line 19616 "./typica.w"
  13101. void MultiRangeTimerConfWidget::updateRangeData()
  13102. {
  13103. updateAttribute("rangenames",tablemodel->quotedArrayLiteral(0,Qt::DisplayRole));
  13104. updateAttribute("endtemps",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  13105. }
  13106. void MultiRangeTimerConfWidget::updateColumnName(const QString&text)
  13107. {
  13108. updateAttribute("trigger",text);
  13109. }
  13110. /*:930*/
  13111. #line 19636 "./typica.w"
  13112. /*:932*//*950:*/
  13113. #line 265 "./rate.w"
  13114. /*946:*/
  13115. #line 191 "./rate.w"
  13116. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  13117. :BasicDeviceConfigurationWidget(model,index)
  13118. {
  13119. QFormLayout*layout= new QFormLayout;
  13120. QLineEdit*column= new QLineEdit;
  13121. layout->addRow(tr("Primary series column name:"),column);
  13122. QSpinBox*cacheTime= new QSpinBox;
  13123. cacheTime->setMinimum(0);
  13124. cacheTime->setMaximum(300);
  13125. layout->addRow(tr("Cache time:"),cacheTime);
  13126. QSpinBox*scaleTime= new QSpinBox;
  13127. scaleTime->setMinimum(1);
  13128. scaleTime->setMaximum(300);
  13129. layout->addRow(tr("Scale time:"),scaleTime);
  13130. /*761:*/
  13131. #line 16100 "./typica.w"
  13132. QDomElement referenceElement=
  13133. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13134. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13135. QDomElement node;
  13136. /*:761*/
  13137. #line 206 "./rate.w"
  13138. for(int i= 0;i<configData.size();i++)
  13139. {
  13140. node= configData.at(i).toElement();
  13141. if(node.attribute("name")=="column")
  13142. {
  13143. column->setText(node.attribute("value"));
  13144. }
  13145. else if(node.attribute("name")=="cache")
  13146. {
  13147. cacheTime->setValue(node.attribute("value").toInt());
  13148. }
  13149. else if(node.attribute("name")=="scale")
  13150. {
  13151. scaleTime->setValue(node.attribute("value").toInt());
  13152. }
  13153. }
  13154. updateColumn(column->text());
  13155. updateCacheTime(cacheTime->text());
  13156. updateScaleTime(scaleTime->text());
  13157. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  13158. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  13159. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  13160. setLayout(layout);
  13161. }
  13162. /*:946*//*947:*/
  13163. #line 235 "./rate.w"
  13164. void RateOfChangeConfWidget::updateColumn(const QString&column)
  13165. {
  13166. updateAttribute("column",column);
  13167. }
  13168. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  13169. {
  13170. updateAttribute("cache",seconds);
  13171. }
  13172. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  13173. {
  13174. updateAttribute("scale",seconds);
  13175. }
  13176. /*:947*/
  13177. #line 266 "./rate.w"
  13178. #line 19728 "./typica.w"
  13179. #line 1 "./dataqsdk.w"
  13180. /*:950*/
  13181. #line 529 "./typica.w"
  13182. /*8:*/
  13183. #line 671 "./typica.w"
  13184. template<class TYPE> TYPE getself(QScriptContext*context)
  13185. {
  13186. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  13187. return self;
  13188. }
  13189. template<> QTime getself(QScriptContext*context)
  13190. {
  13191. QTime self= context->thisObject().toVariant().toTime();
  13192. return self;
  13193. }
  13194. template<> QByteArray getself(QScriptContext*context)
  13195. {
  13196. QByteArray self= context->thisObject().toVariant().toByteArray();
  13197. return self;
  13198. }
  13199. template<> SqlQueryConnection*getself(QScriptContext*context)
  13200. {
  13201. SqlQueryConnection*self=
  13202. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  13203. return self;
  13204. }
  13205. template<> QXmlQuery*getself(QScriptContext*context)
  13206. {
  13207. QXmlQuery*self=
  13208. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  13209. return self;
  13210. }
  13211. template<> QXmlStreamWriter*getself(QScriptContext*context)
  13212. {
  13213. QXmlStreamWriter*self=
  13214. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  13215. return self;
  13216. }
  13217. template<> QXmlStreamReader*getself(QScriptContext*context)
  13218. {
  13219. QXmlStreamReader*self=
  13220. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  13221. return self;
  13222. }
  13223. /*:8*//*9:*/
  13224. #line 722 "./typica.w"
  13225. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  13226. {
  13227. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  13228. return argument;
  13229. }
  13230. template<> QString argument(int arg,QScriptContext*context)
  13231. {
  13232. return context->argument(arg).toString();
  13233. }
  13234. template<> QVariant argument(int arg,QScriptContext*context)
  13235. {
  13236. return context->argument(arg).toVariant();
  13237. }
  13238. template<> int argument(int arg,QScriptContext*context)
  13239. {
  13240. return context->argument(arg).toInt32();
  13241. }
  13242. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  13243. {
  13244. return(SqlQueryConnection*)
  13245. qscriptvalue_cast<void*> (context->argument(arg));
  13246. }
  13247. template<> QModelIndex argument(int arg,QScriptContext*context)
  13248. {
  13249. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  13250. }
  13251. template<> double argument(int arg,QScriptContext*context)
  13252. {
  13253. return(double)(context->argument(arg).toNumber());
  13254. }
  13255. template<> Units::Unit argument(int arg,QScriptContext*context)
  13256. {
  13257. return(Units::Unit)(context->argument(arg).toInt32());
  13258. }
  13259. template<> QByteArray argument(int arg,QScriptContext*context)
  13260. {
  13261. return qscriptvalue_cast<QByteArray> (context->argument(arg));
  13262. }
  13263. /*:9*//*13:*/
  13264. #line 814 "./typica.w"
  13265. void setQObjectProperties(QScriptValue,QScriptEngine*)
  13266. {
  13267. }
  13268. /*:13*//*15:*/
  13269. #line 828 "./typica.w"
  13270. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  13271. {
  13272. }
  13273. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  13274. {
  13275. }
  13276. /*:15*//*18:*/
  13277. #line 867 "./typica.w"
  13278. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  13279. {
  13280. QScriptValue object= engine->newQObject(new QWidget);
  13281. setQWidgetProperties(object,engine);
  13282. return object;
  13283. }
  13284. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  13285. {
  13286. setQObjectProperties(value,engine);
  13287. setQPaintDeviceProperties(value,engine);
  13288. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  13289. value.setProperty("activateWindow",
  13290. engine->newFunction(QWidget_activateWindow));
  13291. }
  13292. /*:18*//*19:*/
  13293. #line 889 "./typica.w"
  13294. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  13295. {
  13296. if(context->argumentCount()==1)
  13297. {
  13298. QWidget*self= getself<QWidget*> (context);
  13299. QLayout*layout= argument<QLayout*> (0,context);
  13300. if(layout)
  13301. {
  13302. self->setLayout(layout);
  13303. }
  13304. else
  13305. {
  13306. context->throwError("Incorrect argument type passed to "
  13307. "QWidget::setLayout(). This method requires "
  13308. "a QLayout.");
  13309. }
  13310. }
  13311. else
  13312. {
  13313. context->throwError("Incorrect number of arguments passed to "
  13314. "QWidget::setLayout(). This method takes one "
  13315. "QLayout as an argument.");
  13316. }
  13317. return QScriptValue();
  13318. }
  13319. QScriptValue QWidget_activateWindow(QScriptContext*context,
  13320. QScriptEngine*)
  13321. {
  13322. QWidget*self= getself<QWidget*> (context);
  13323. self->activateWindow();
  13324. return QScriptValue();
  13325. }
  13326. /*:19*//*21:*/
  13327. #line 971 "./typica.w"
  13328. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  13329. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  13330. {
  13331. }
  13332. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  13333. {
  13334. QSettings settings;
  13335. settings.beginGroup(key);
  13336. settings.setValue("pos",pos());
  13337. settings.setValue("size",size());
  13338. settings.endGroup();
  13339. }
  13340. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  13341. {
  13342. QSettings settings;
  13343. settings.beginGroup(key);
  13344. if(settings.contains("size"))
  13345. {
  13346. resize(settings.value("size").toSize());
  13347. }
  13348. if(settings.contains("pos"))
  13349. {
  13350. move(settings.value("pos").toPoint());
  13351. }
  13352. settings.endGroup();
  13353. }
  13354. void ScriptQMainWindow::displayStatus(const QString&message)
  13355. {
  13356. statusBar()->showMessage(message);
  13357. }
  13358. void ScriptQMainWindow::showEvent(QShowEvent*event)
  13359. {
  13360. if(!event->spontaneous())
  13361. {
  13362. /*26:*/
  13363. #line 1083 "./typica.w"
  13364. QSettings settings;
  13365. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  13366. toByteArray());
  13367. /*:26*/
  13368. #line 1011 "./typica.w"
  13369. event->accept();
  13370. }
  13371. else
  13372. {
  13373. event->ignore();
  13374. }
  13375. }
  13376. void ScriptQMainWindow::show()
  13377. {
  13378. QMainWindow::show();
  13379. }
  13380. /*:21*//*22:*/
  13381. #line 1032 "./typica.w"
  13382. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  13383. {
  13384. if(isWindowModified()){
  13385. /*23:*/
  13386. #line 1046 "./typica.w"
  13387. QMessageBox::StandardButton result;
  13388. result= QMessageBox::warning(this,"Typica",closePrompt(),
  13389. QMessageBox::Ok|QMessageBox::Cancel);
  13390. if(result==QMessageBox::Cancel)
  13391. {
  13392. event->ignore();
  13393. return;
  13394. }
  13395. /*:23*/
  13396. #line 1036 "./typica.w"
  13397. }
  13398. emit aboutToClose();
  13399. /*25:*/
  13400. #line 1077 "./typica.w"
  13401. QSettings settings;
  13402. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  13403. /*:25*/
  13404. #line 1039 "./typica.w"
  13405. event->accept();
  13406. }
  13407. /*:22*//*24:*/
  13408. #line 1058 "./typica.w"
  13409. QString ScriptQMainWindow::closePrompt()
  13410. {
  13411. return cprompt;
  13412. }
  13413. void ScriptQMainWindow::setClosePrompt(QString prompt)
  13414. {
  13415. cprompt= prompt;
  13416. }
  13417. /*:24*//*29:*/
  13418. #line 1111 "./typica.w"
  13419. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  13420. {
  13421. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  13422. setQMainWindowProperties(object,engine);
  13423. return object;
  13424. }
  13425. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  13426. {
  13427. setQWidgetProperties(value,engine);
  13428. value.setProperty("setCentralWidget",
  13429. engine->newFunction(QMainWindow_setCentralWidget));
  13430. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  13431. }
  13432. /*:29*//*30:*/
  13433. #line 1133 "./typica.w"
  13434. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  13435. QScriptEngine*)
  13436. {
  13437. if(context->argumentCount()==1)
  13438. {
  13439. QMainWindow*self= getself<QMainWindow*> (context);
  13440. QWidget*widget= argument<QWidget*> (0,context);
  13441. if(widget)
  13442. {
  13443. self->setCentralWidget(widget);
  13444. }
  13445. else
  13446. {
  13447. context->throwError("Incorrect argument type passed to "
  13448. "QMainWindow::setCentralWidget(). This "
  13449. "method requires a QWidget.");
  13450. }
  13451. }
  13452. else
  13453. {
  13454. context->throwError("Incorrect number of arguments passed to "
  13455. "QMainWindow::setCentralWidget(). This method "
  13456. "takes one QWidget as an argument.");
  13457. }
  13458. return QScriptValue();
  13459. }
  13460. /*:30*//*31:*/
  13461. #line 1167 "./typica.w"
  13462. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  13463. {
  13464. QScriptValue object;
  13465. if(context->argumentCount()==0)
  13466. {
  13467. QMainWindow*self= getself<QMainWindow*> (context);
  13468. QMenuBar*bar= self->menuBar();
  13469. object= engine->newQObject(bar);
  13470. setQMenuBarProperties(object,engine);
  13471. }
  13472. else
  13473. {
  13474. context->throwError("Incorrect number of arguments passed to "
  13475. "QMainWindow::menuBar(). This method takes no "
  13476. "arguments.");
  13477. }
  13478. return object;
  13479. }
  13480. /*:31*//*33:*/
  13481. #line 1197 "./typica.w"
  13482. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  13483. {
  13484. setQWidgetProperties(value,engine);
  13485. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  13486. }
  13487. /*:33*//*34:*/
  13488. #line 1212 "./typica.w"
  13489. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  13490. {
  13491. QScriptValue object;
  13492. if(context->argumentCount()==1)
  13493. {
  13494. QMenuBar*self= getself<QMenuBar*> (context);
  13495. QString title= argument<QString> (0,context);
  13496. object= engine->newQObject(self->addMenu(title));
  13497. setQMenuProperties(object,engine);
  13498. }
  13499. else
  13500. {
  13501. context->throwError("Incorrect number of arguments passed to "
  13502. "QMenuBar::addMenu(). This method takes one "
  13503. "string as an argument.");
  13504. }
  13505. return object;
  13506. }
  13507. /*:34*//*36:*/
  13508. #line 1242 "./typica.w"
  13509. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  13510. {
  13511. setQWidgetProperties(value,engine);
  13512. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  13513. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  13514. }
  13515. /*:36*//*37:*/
  13516. #line 1252 "./typica.w"
  13517. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  13518. {
  13519. if(context->argumentCount()==1)
  13520. {
  13521. QMenu*self= getself<QMenu*> (context);
  13522. QAction*action= argument<QAction*> (0,context);
  13523. if(action)
  13524. {
  13525. self->addAction(action);
  13526. }
  13527. else
  13528. {
  13529. context->throwError("Incorrect argument type passed to "
  13530. "QMenu::addAction(). This method requires a "
  13531. "QAction.");
  13532. }
  13533. }
  13534. else
  13535. {
  13536. context->throwError("Incorrect number of arguments passed to "
  13537. "QMenu::addAction(). This method takes one "
  13538. "QAction as an argument.");
  13539. }
  13540. return QScriptValue();
  13541. }
  13542. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  13543. {
  13544. if(context->argumentCount()==0)
  13545. {
  13546. QMenu*self= getself<QMenu*> (context);
  13547. self->addSeparator();
  13548. }
  13549. else
  13550. {
  13551. context->throwError("Incorrect number of arguments passed to "
  13552. "QMenu::addSeparator(). This method takes no "
  13553. "arguments.");
  13554. }
  13555. return QScriptValue();
  13556. }
  13557. /*:37*//*40:*/
  13558. #line 1314 "./typica.w"
  13559. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  13560. {
  13561. QScriptValue object= engine->newQObject(new QFrame);
  13562. setQFrameProperties(object,engine);
  13563. return object;
  13564. }
  13565. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  13566. {
  13567. setQWidgetProperties(value,engine);
  13568. }
  13569. /*:40*//*43:*/
  13570. #line 1348 "./typica.w"
  13571. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  13572. {
  13573. QString text;
  13574. if(context->argumentCount()==1)
  13575. {
  13576. text= argument<QString> (0,context);
  13577. }
  13578. QScriptValue object= engine->newQObject(new QLabel(text));
  13579. setQLabelProperties(object,engine);
  13580. return object;
  13581. }
  13582. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  13583. {
  13584. setQFrameProperties(value,engine);
  13585. }
  13586. /*:43*//*46:*/
  13587. #line 1385 "./typica.w"
  13588. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  13589. {
  13590. QScriptValue object= engine->newQObject(new QLineEdit());
  13591. setQLineEditProperties(object,engine);
  13592. return object;
  13593. }
  13594. /*:46*//*47:*/
  13595. #line 1396 "./typica.w"
  13596. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  13597. {
  13598. setQWidgetProperties(value,engine);
  13599. }
  13600. /*:47*//*50:*/
  13601. #line 1432 "./typica.w"
  13602. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  13603. {
  13604. QScriptValue object= engine->newQObject(new QSplitter);
  13605. setQSplitterProperties(object,engine);
  13606. return object;
  13607. }
  13608. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  13609. {
  13610. setQFrameProperties(value,engine);
  13611. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  13612. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  13613. value.setProperty("restoreState",
  13614. engine->newFunction(QSplitter_restoreState));
  13615. value.setProperty("count",engine->newFunction(QSplitter_count));
  13616. }
  13617. /*:50*//*51:*/
  13618. #line 1453 "./typica.w"
  13619. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  13620. {
  13621. if(context->argumentCount()==1)
  13622. {
  13623. QSplitter*self= getself<QSplitter*> (context);
  13624. QWidget*widget= argument<QWidget*> (0,context);
  13625. if(widget)
  13626. {
  13627. self->addWidget(widget);
  13628. }
  13629. else
  13630. {
  13631. context->throwError("Incorrect argument type passed to "
  13632. "QSplitter::addWidget(). This method "
  13633. "requires a QWidget.");
  13634. }
  13635. }
  13636. else
  13637. {
  13638. context->throwError("Incorrect number of arguments passed to "
  13639. "QSplitter::addWidget(). This method takes one "
  13640. "QWidget as an argument.");
  13641. }
  13642. return QScriptValue();
  13643. }
  13644. /*:51*//*52:*/
  13645. #line 1490 "./typica.w"
  13646. QScriptValue QSplitter_count(QScriptContext*context,QScriptEngine*)
  13647. {
  13648. QSplitter*self= getself<QSplitter*> (context);
  13649. return QScriptValue(self->count());
  13650. }
  13651. /*:52*//*53:*/
  13652. #line 1503 "./typica.w"
  13653. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  13654. {
  13655. if(context->argumentCount()==1)
  13656. {
  13657. QSplitter*self= getself<QSplitter*> (context);
  13658. QString key= argument<QString> (0,context);
  13659. QSettings settings;
  13660. settings.setValue(key,self->saveState());
  13661. }
  13662. else
  13663. {
  13664. context->throwError("Incorrect number of arguments passed to "
  13665. "QSplitter::saveState(). This method takes one "
  13666. "string as an argument.");
  13667. }
  13668. return QScriptValue();
  13669. }
  13670. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  13671. {
  13672. if(context->argumentCount()==1)
  13673. {
  13674. QSplitter*self= getself<QSplitter*> (context);
  13675. QString key= argument<QString> (0,context);
  13676. QSettings settings;
  13677. self->restoreState(settings.value(key).toByteArray());
  13678. }
  13679. else
  13680. {
  13681. context->throwError("Incorrect number of arguments passed to "
  13682. "QSplitter::restoreState(). This method takes "
  13683. "one string as an argument.");
  13684. }
  13685. return QScriptValue();
  13686. }
  13687. /*:53*//*55:*/
  13688. #line 1556 "./typica.w"
  13689. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  13690. {
  13691. setQLayoutItemProperties(value,engine);
  13692. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  13693. }
  13694. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  13695. {
  13696. if(context->argumentCount()==1)
  13697. {
  13698. QLayout*self= getself<QLayout*> (context);
  13699. QWidget*widget= argument<QWidget*> (0,context);
  13700. if(widget)
  13701. {
  13702. self->addWidget(widget);
  13703. }
  13704. else
  13705. {
  13706. context->throwError("Incorrect argument type passed to "
  13707. "QLayout::addWidget(). This method requires "
  13708. "a QWidget.");
  13709. }
  13710. }
  13711. else
  13712. {
  13713. context->throwError("Incorrect number of arguments passed to "
  13714. "QLayout::addWidget(). This method takes one "
  13715. "QWidget as an argument.");
  13716. }
  13717. return QScriptValue();
  13718. }
  13719. /*:55*//*58:*/
  13720. #line 1623 "./typica.w"
  13721. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  13722. {
  13723. QScriptValue object=
  13724. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  13725. setQBoxLayoutProperties(object,engine);
  13726. return object;
  13727. }
  13728. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  13729. {
  13730. setQLayoutProperties(value,engine);
  13731. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  13732. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  13733. }
  13734. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  13735. {
  13736. if(context->argumentCount()> 0&&context->argumentCount()<3)
  13737. {
  13738. QBoxLayout*self= getself<QBoxLayout*> (context);
  13739. QLayout*layout= argument<QLayout*> (0,context);
  13740. int stretch= 0;
  13741. if(context->argumentCount()==2)
  13742. {
  13743. stretch= argument<int> (1,context);
  13744. }
  13745. if(layout)
  13746. {
  13747. self->addLayout(layout,stretch);
  13748. }
  13749. else
  13750. {
  13751. context->throwError("Incorrect argument type passed to "
  13752. "QLayout::addLayout(). This method requires "
  13753. "a QLayout.");
  13754. }
  13755. }
  13756. else
  13757. {
  13758. context->throwError("Incorrect number of arguments passed to "
  13759. "QLayout::addLayout(). This method takes one "
  13760. "QLayout as an argument and optionally one integer.");
  13761. }
  13762. return QScriptValue();
  13763. }
  13764. /*:58*//*59:*/
  13765. #line 1674 "./typica.w"
  13766. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  13767. {
  13768. if(context->argumentCount()> 0&&context->argumentCount()<4)
  13769. {
  13770. QBoxLayout*self= getself<QBoxLayout*> (context);
  13771. QWidget*widget= argument<QWidget*> (0,context);
  13772. int stretch= 0;
  13773. Qt::Alignment alignment= 0;
  13774. if(context->argumentCount()> 1)
  13775. {
  13776. stretch= argument<int> (1,context);
  13777. }
  13778. if(context->argumentCount()> 2)
  13779. {
  13780. alignment= (Qt::Alignment)(argument<int> (2,context));
  13781. }
  13782. if(widget)
  13783. {
  13784. self->addWidget(widget,stretch,alignment);
  13785. }
  13786. else
  13787. {
  13788. context->throwError("Incorrect argument type passed to "
  13789. "QBoxLayout::addWidget(). This method requires "
  13790. "a QWidget.");
  13791. }
  13792. }
  13793. else
  13794. {
  13795. context->throwError("Incorrect number of arguments passed to "
  13796. "QBoxLayout::addWidget(). This method takes one "
  13797. "QWidget and optionally up to two integers as "
  13798. "arguments.");
  13799. }
  13800. return QScriptValue();
  13801. }
  13802. /*:59*//*62:*/
  13803. #line 1738 "./typica.w"
  13804. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  13805. {
  13806. QScriptValue object= engine->newQObject(new QAction(NULL));
  13807. setQActionProperties(object,engine);
  13808. return object;
  13809. }
  13810. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  13811. {
  13812. setQObjectProperties(value,engine);
  13813. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  13814. }
  13815. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  13816. {
  13817. if(context->argumentCount()==1)
  13818. {
  13819. QAction*self= getself<QAction*> (context);
  13820. self->setShortcut(argument<QString> (0,context));
  13821. }
  13822. else
  13823. {
  13824. context->throwError("Incorrect number of arguments passed to "
  13825. "QAction::setShortcut(). This method takes one "
  13826. "string as an argument.");
  13827. }
  13828. return QScriptValue();
  13829. }
  13830. /*:62*//*65:*/
  13831. #line 1796 "./typica.w"
  13832. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  13833. QScriptEngine*engine)
  13834. {
  13835. QScriptValue retval;
  13836. if(context->argumentCount()==3)
  13837. {
  13838. QWidget*widget= argument<QWidget*> (0,context);
  13839. if(widget)
  13840. {
  13841. QString caption= argument<QString> (1,context);
  13842. QString dir= argument<QString> (2,context);
  13843. retval= QScriptValue(engine,
  13844. QFileDialog::getOpenFileName(widget,caption,
  13845. dir,"",0,0));
  13846. setQFileDialogProperties(retval,engine);
  13847. }
  13848. else
  13849. {
  13850. context->throwError("Incorrect argument type passed to "
  13851. "QFileDialog::getOpenFileName(). The first "
  13852. "argument to this method must be a QWidget.");
  13853. }
  13854. }
  13855. else
  13856. {
  13857. context->throwError("Incorrect number of arguments passed to "
  13858. "QFileDialog::getOpenFileName(). This method "
  13859. "takes one QWidget followed by two strings for a "
  13860. "total of three arguments.");
  13861. }
  13862. return retval;
  13863. }
  13864. /*:65*//*66:*/
  13865. #line 1832 "./typica.w"
  13866. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  13867. QScriptEngine*engine)
  13868. {
  13869. QScriptValue retval;
  13870. if(context->argumentCount()==3)
  13871. {
  13872. QWidget*widget= argument<QWidget*> (0,context);
  13873. if(widget)
  13874. {
  13875. QString caption= argument<QString> (1,context);
  13876. QString dir= argument<QString> (2,context);
  13877. retval= QScriptValue(engine,
  13878. QFileDialog::getSaveFileName(widget,caption,
  13879. dir,"",0,0));
  13880. setQFileDialogProperties(retval,engine);
  13881. }
  13882. else
  13883. {
  13884. context->throwError("Incorrect argument type passed to "
  13885. "QFileDialog::getSaveFileName(). The first "
  13886. "argument to this method must be a QWidget.");
  13887. }
  13888. }
  13889. else
  13890. {
  13891. context->throwError("Incorrect number of arguments passed to "
  13892. "QFileDialog::getSaveFileName(). This method "
  13893. "takes one QWidget followed by two strings for a "
  13894. "total of three arguments.");
  13895. }
  13896. return retval;
  13897. }
  13898. /*:66*//*67:*/
  13899. #line 1869 "./typica.w"
  13900. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  13901. {
  13902. setQDialogProperties(value,engine);
  13903. }
  13904. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  13905. {
  13906. setQWidgetProperties(value,engine);
  13907. }
  13908. /*:67*//*70:*/
  13909. #line 1910 "./typica.w"
  13910. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  13911. {
  13912. QScriptValue object=
  13913. engine->newQObject(new QFile(argument<QString> (0,context)));
  13914. setQFileProperties(object,engine);
  13915. return object;
  13916. }
  13917. /*:70*//*71:*/
  13918. #line 1921 "./typica.w"
  13919. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  13920. {
  13921. setQIODeviceProperties(value,engine);
  13922. value.setProperty("remove",engine->newFunction(QFile_remove));
  13923. }
  13924. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  13925. {
  13926. QFile*self= getself<QFile*> (context);
  13927. bool retval= self->remove();
  13928. return QScriptValue(engine,retval);
  13929. }
  13930. /*:71*//*72:*/
  13931. #line 1943 "./typica.w"
  13932. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  13933. {
  13934. setQObjectProperties(value,engine);
  13935. value.setProperty("open",engine->newFunction(QIODevice_open));
  13936. value.setProperty("close",engine->newFunction(QIODevice_close));
  13937. value.setProperty("readToString",
  13938. engine->newFunction(QIODevice_readToString));
  13939. value.setProperty("putChar",engine->newFunction(QIODevice_putChar));
  13940. value.setProperty("writeString",engine->newFunction(QIODevice_writeString));
  13941. value.setProperty("writeBytes",engine->newFunction(QIODevice_writeBytes));
  13942. value.setProperty("readBytes",engine->newFunction(QIODevice_readBytes));
  13943. value.setProperty("peek",engine->newFunction(QIODevice_peek));
  13944. value.setProperty("read",engine->newFunction(QIODevice_read));
  13945. }
  13946. /*:72*//*73:*/
  13947. #line 1964 "./typica.w"
  13948. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  13949. {
  13950. QIODevice*self= getself<QIODevice*> (context);
  13951. bool retval= false;
  13952. if(context->argumentCount()==1)
  13953. {
  13954. switch(argument<int> (0,context))
  13955. {
  13956. case 1:
  13957. retval= self->open(QIODevice::ReadOnly);
  13958. break;
  13959. case 2:
  13960. retval= self->open(QIODevice::WriteOnly);
  13961. break;
  13962. case 3:
  13963. retval= self->open(QIODevice::ReadWrite);
  13964. break;
  13965. default:
  13966. break;
  13967. }
  13968. }
  13969. else
  13970. {
  13971. retval= self->open(QIODevice::ReadWrite);
  13972. }
  13973. return QScriptValue(retval);
  13974. }
  13975. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  13976. {
  13977. QIODevice*self= getself<QIODevice*> (context);
  13978. self->close();
  13979. return QScriptValue();
  13980. }
  13981. /*:73*//*74:*/
  13982. #line 2004 "./typica.w"
  13983. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  13984. {
  13985. QIODevice*self= getself<QIODevice*> (context);
  13986. self->reset();
  13987. return QScriptValue(QString(self->readAll()));
  13988. }
  13989. /*:74*//*75:*/
  13990. #line 2020 "./typica.w"
  13991. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*)
  13992. {
  13993. QIODevice*self= getself<QIODevice*> (context);
  13994. if(context->argumentCount()==1)
  13995. {
  13996. return QScriptValue(self->putChar(argument<QString> (0,context).toUtf8().at(0)));
  13997. }
  13998. context->throwError("Incorrect number of arguments passed to "
  13999. "QIODevice::putChar()");
  14000. return QScriptValue();
  14001. }
  14002. /*:75*//*76:*/
  14003. #line 2038 "./typica.w"
  14004. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*)
  14005. {
  14006. QIODevice*self= getself<QIODevice*> (context);
  14007. if(context->argumentCount()==1)
  14008. {
  14009. self->write(argument<QString> (0,context).toUtf8());
  14010. }
  14011. else
  14012. {
  14013. context->throwError("Incorrect number of arguments passed to "
  14014. "QIODevice::writeString()");
  14015. }
  14016. return QScriptValue();
  14017. }
  14018. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*)
  14019. {
  14020. QIODevice*self= getself<QIODevice*> (context);
  14021. if(context->argumentCount()==1)
  14022. {
  14023. self->write(argument<QByteArray> (0,context));
  14024. }
  14025. else
  14026. {
  14027. context->throwError("Incorrect number of arguments passed to "
  14028. "QIODevice::writeBytes()");
  14029. }
  14030. return QScriptValue();
  14031. }
  14032. /*:76*//*77:*/
  14033. #line 2072 "./typica.w"
  14034. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine)
  14035. {
  14036. QIODevice*self= getself<QIODevice*> (context);
  14037. QScriptValue value= engine->toScriptValue<QByteArray> (self->readAll());
  14038. setQByteArrayProperties(value,engine);
  14039. return value;
  14040. }
  14041. /*:77*//*78:*/
  14042. #line 2083 "./typica.w"
  14043. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine)
  14044. {
  14045. QIODevice*self= getself<QIODevice*> (context);
  14046. QScriptValue value= engine->toScriptValue<QByteArray> (
  14047. self->peek(argument<int> (0,context)));
  14048. setQByteArrayProperties(value,engine);
  14049. return value;
  14050. }
  14051. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine)
  14052. {
  14053. QIODevice*self= getself<QIODevice*> (context);
  14054. QScriptValue value= engine->toScriptValue<QByteArray> (
  14055. self->read(argument<int> (0,context)));
  14056. setQByteArrayProperties(value,engine);
  14057. return value;
  14058. }
  14059. /*:78*//*81:*/
  14060. #line 2128 "./typica.w"
  14061. QScriptValue constructQProcess(QScriptContext*,QScriptEngine*engine)
  14062. {
  14063. QScriptValue object= engine->newQObject(new QProcess);
  14064. setQProcessProperties(object,engine);
  14065. return object;
  14066. }
  14067. /*:81*//*82:*/
  14068. #line 2139 "./typica.w"
  14069. void setQProcessProperties(QScriptValue value,QScriptEngine*engine)
  14070. {
  14071. setQIODeviceProperties(value,engine);
  14072. value.setProperty("execute",engine->newFunction(QProcess_execute));
  14073. value.setProperty("startDetached",engine->newFunction(QProcess_startDetached));
  14074. value.setProperty("setWorkingDirectory",engine->newFunction(QProcess_setWorkingDirectory));
  14075. value.setProperty("start",engine->newFunction(QProcess_start));
  14076. }
  14077. /*:82*//*83:*/
  14078. #line 2153 "./typica.w"
  14079. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*)
  14080. {
  14081. QProcess*self= getself<QProcess*> (context);
  14082. QString program= argument<QString> (0,context);
  14083. QStringList arguments= QStringList();
  14084. if(context->argumentCount()> 1){
  14085. arguments= argument<QVariant> (1,context).toStringList();
  14086. }
  14087. int retval= self->execute(program,arguments);
  14088. return QScriptValue(retval);
  14089. }
  14090. /*:83*//*84:*/
  14091. #line 2168 "./typica.w"
  14092. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*)
  14093. {
  14094. QProcess*self= getself<QProcess*> (context);
  14095. QString program= argument<QString> (0,context);
  14096. QStringList arguments= QStringList();
  14097. if(context->argumentCount()> 1){
  14098. arguments= argument<QVariant> (1,context).toStringList();
  14099. }
  14100. QString workingDirectory= "";
  14101. if(context->argumentCount()> 2){
  14102. workingDirectory= argument<QString> (2,context);
  14103. }
  14104. bool retval;
  14105. switch(context->argumentCount())
  14106. {
  14107. case 1:
  14108. retval= self->startDetached(program);
  14109. break;
  14110. case 2:
  14111. retval= self->startDetached(program,arguments);
  14112. break;
  14113. case 3:
  14114. retval= self->startDetached(program,arguments,workingDirectory);
  14115. break;
  14116. default:
  14117. retval= false;
  14118. }
  14119. return QScriptValue(retval);
  14120. }
  14121. /*:84*//*85:*/
  14122. #line 2201 "./typica.w"
  14123. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*)
  14124. {
  14125. QProcess*self= getself<QProcess*> (context);
  14126. QString directory= argument<QString> (0,context);
  14127. self->setWorkingDirectory(directory);
  14128. return QScriptValue();
  14129. }
  14130. /*:85*//*86:*/
  14131. #line 2213 "./typica.w"
  14132. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*)
  14133. {
  14134. QProcess*self= getself<QProcess*> (context);
  14135. QString program= argument<QString> (0,context);
  14136. QStringList arguments= QStringList();
  14137. if(context->argumentCount()> 1){
  14138. arguments= argument<QVariant> (1,context).toStringList();
  14139. }
  14140. self->start(program,arguments);
  14141. return QScriptValue();
  14142. }
  14143. /*:86*//*88:*/
  14144. #line 2254 "./typica.w"
  14145. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes)
  14146. {
  14147. QScriptValue object= engine->newVariant(QVariant(bytes));
  14148. setQByteArrayProperties(object,engine);
  14149. return object;
  14150. }
  14151. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes)
  14152. {
  14153. bytes= value.toVariant().toByteArray();
  14154. }
  14155. /*:88*//*90:*/
  14156. #line 2277 "./typica.w"
  14157. QScriptValue constructQByteArray(QScriptContext*,QScriptEngine*engine)
  14158. {
  14159. QScriptValue object= engine->toScriptValue<QByteArray> (QByteArray());
  14160. setQByteArrayProperties(object,engine);
  14161. return object;
  14162. }
  14163. /*:90*//*91:*/
  14164. #line 2288 "./typica.w"
  14165. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine)
  14166. {
  14167. value.setProperty("fromHex",engine->newFunction(QByteArray_fromHex));
  14168. value.setProperty("getAt",engine->newFunction(QByteArray_getAt));
  14169. value.setProperty("setAt",engine->newFunction(QByteArray_setAt));
  14170. value.setProperty("appendBytes",engine->newFunction(QByteArray_appendBytes));
  14171. value.setProperty("appendString",engine->newFunction(QByteArray_appendString));
  14172. value.setProperty("size",engine->newFunction(QByteArray_size));
  14173. value.setProperty("left",engine->newFunction(QByteArray_left));
  14174. value.setProperty("right",engine->newFunction(QByteArray_right));
  14175. value.setProperty("mid",engine->newFunction(QByteArray_mid));
  14176. value.setProperty("chop",engine->newFunction(QByteArray_chop));
  14177. value.setProperty("remove",engine->newFunction(QByteArray_remove));
  14178. value.setProperty("toInt8",engine->newFunction(QByteArray_toInt8));
  14179. value.setProperty("toInt16",engine->newFunction(QByteArray_toInt16));
  14180. value.setProperty("toInt32",engine->newFunction(QByteArray_toInt32));
  14181. value.setProperty("toFloat",engine->newFunction(QByteArray_toFloat));
  14182. value.setProperty("toDouble",engine->newFunction(QByteArray_toDouble));
  14183. }
  14184. /*:91*//*92:*/
  14185. #line 2312 "./typica.w"
  14186. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine)
  14187. {
  14188. QByteArray self= getself<QByteArray> (context);
  14189. QByteArray retval;
  14190. retval= self.fromHex(argument<QString> (0,context).toUtf8());
  14191. QScriptValue value= engine->toScriptValue<QByteArray> (retval);
  14192. setQByteArrayProperties(value,engine);
  14193. return value;
  14194. }
  14195. /*:92*//*93:*/
  14196. #line 2326 "./typica.w"
  14197. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*)
  14198. {
  14199. QByteArray self= getself<QByteArray> (context);
  14200. return QScriptValue((int)(self.at(argument<int> (0,context))));
  14201. }
  14202. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*)
  14203. {
  14204. QByteArray self= getself<QByteArray> (context);
  14205. self[argument<int> (0,context)]= (char)(argument<int> (1,context));
  14206. return QScriptValue();
  14207. }
  14208. /*:93*//*94:*/
  14209. #line 2344 "./typica.w"
  14210. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine)
  14211. {
  14212. QByteArray self= getself<QByteArray> (context);
  14213. QScriptValue value=
  14214. engine->toScriptValue<QByteArray> (
  14215. self.append(argument<QByteArray> (0,context)));
  14216. setQByteArrayProperties(value,engine);
  14217. return value;
  14218. }
  14219. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine)
  14220. {
  14221. QByteArray self= getself<QByteArray> (context);
  14222. QScriptValue value= engine->toScriptValue<QByteArray> (
  14223. self.append(argument<QString> (0,context)));
  14224. setQByteArrayProperties(value,engine);
  14225. return value;
  14226. }
  14227. /*:94*//*95:*/
  14228. #line 2366 "./typica.w"
  14229. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*)
  14230. {
  14231. QByteArray self= getself<QByteArray> (context);
  14232. return QScriptValue(self.size());
  14233. }
  14234. /*:95*//*96:*/
  14235. #line 2376 "./typica.w"
  14236. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine)
  14237. {
  14238. QByteArray self= getself<QByteArray> (context);
  14239. QScriptValue value= engine->toScriptValue<QByteArray> (
  14240. self.left(argument<int> (0,context)));
  14241. setQByteArrayProperties(value,engine);
  14242. return value;
  14243. }
  14244. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine)
  14245. {
  14246. QByteArray self= getself<QByteArray> (context);
  14247. QScriptValue value= engine->toScriptValue<QByteArray> (
  14248. self.right(argument<int> (0,context)));
  14249. setQByteArrayProperties(value,engine);
  14250. return value;
  14251. }
  14252. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine)
  14253. {
  14254. QByteArray self= getself<QByteArray> (context);
  14255. int length= -1;
  14256. if(context->argumentCount()> 1)
  14257. {
  14258. length= argument<int> (1,context);
  14259. }
  14260. QScriptValue value= engine->toScriptValue<QByteArray> (
  14261. self.mid(argument<int> (0,context),length));
  14262. setQByteArrayProperties(value,engine);
  14263. return value;
  14264. }
  14265. /*:96*//*97:*/
  14266. #line 2411 "./typica.w"
  14267. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*)
  14268. {
  14269. QByteArray self= getself<QByteArray> (context);
  14270. self.chop(argument<int> (0,context));
  14271. return QScriptValue();
  14272. }
  14273. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine)
  14274. {
  14275. QByteArray self= getself<QByteArray> (context);
  14276. QScriptValue value= engine->toScriptValue<QByteArray> (
  14277. self.remove(argument<int> (0,context),argument<int> (1,context)));
  14278. setQByteArrayProperties(value,engine);
  14279. return value;
  14280. }
  14281. /*:97*//*98:*/
  14282. #line 2434 "./typica.w"
  14283. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*)
  14284. {
  14285. QByteArray self= getself<QByteArray> (context);
  14286. int value= 0;
  14287. char*bytes= (char*)&value;
  14288. bytes[0]= self[0];
  14289. return QScriptValue(value);
  14290. }
  14291. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*)
  14292. {
  14293. QByteArray self= getself<QByteArray> (context);
  14294. int value= 0;
  14295. char*bytes= (char*)&value;
  14296. bytes[0]= self[0];
  14297. bytes[1]= self[1];
  14298. return QScriptValue(value);
  14299. }
  14300. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*)
  14301. {
  14302. QByteArray self= getself<QByteArray> (context);
  14303. int value= 0;
  14304. char*bytes= (char*)&value;
  14305. bytes[0]= self[0];
  14306. bytes[1]= self[1];
  14307. bytes[2]= self[2];
  14308. bytes[3]= self[3];
  14309. return QScriptValue(value);
  14310. }
  14311. /*:98*//*99:*/
  14312. #line 2470 "./typica.w"
  14313. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*)
  14314. {
  14315. QByteArray self= getself<QByteArray> (context);
  14316. float value= 0.0;
  14317. char*bytes= (char*)&value;
  14318. bytes[0]= self[0];
  14319. bytes[1]= self[1];
  14320. bytes[2]= self[2];
  14321. bytes[3]= self[3];
  14322. return QScriptValue(value);
  14323. }
  14324. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*)
  14325. {
  14326. QByteArray self= getself<QByteArray> (context);
  14327. double value= 0.0;
  14328. char*bytes= (char*)&value;
  14329. bytes[0]= self[0];
  14330. bytes[1]= self[1];
  14331. bytes[2]= self[2];
  14332. bytes[3]= self[3];
  14333. bytes[4]= self[4];
  14334. bytes[5]= self[5];
  14335. bytes[6]= self[6];
  14336. bytes[7]= self[7];
  14337. return QScriptValue(value);
  14338. }
  14339. /*:99*//*102:*/
  14340. #line 2525 "./typica.w"
  14341. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine)
  14342. {
  14343. qint8 value= (qint8)(argument<int> (0,context));
  14344. char*bytes= (char*)&value;
  14345. QByteArray retval;
  14346. retval.resize(1);
  14347. retval[0]= bytes[0];
  14348. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14349. setQByteArrayProperties(v,engine);
  14350. return v;
  14351. }
  14352. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine)
  14353. {
  14354. qint16 value= (qint16)(argument<int> (0,context));
  14355. char*bytes= (char*)&value;
  14356. QByteArray retval;
  14357. retval.resize(2);
  14358. retval[0]= bytes[0];
  14359. retval[1]= bytes[1];
  14360. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14361. setQByteArrayProperties(v,engine);
  14362. return v;
  14363. }
  14364. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine)
  14365. {
  14366. qint32 value= (qint32)(argument<int> (0,context));
  14367. char*bytes= (char*)&value;
  14368. QByteArray retval;
  14369. retval.resize(4);
  14370. retval[0]= bytes[0];
  14371. retval[1]= bytes[1];
  14372. retval[2]= bytes[2];
  14373. retval[3]= bytes[3];
  14374. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14375. setQByteArrayProperties(v,engine);
  14376. return v;
  14377. }
  14378. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine)
  14379. {
  14380. float value= (float)(argument<double> (0,context));
  14381. char*bytes= (char*)&value;
  14382. QByteArray retval;
  14383. retval.resize(4);
  14384. retval[0]= bytes[0];
  14385. retval[1]= bytes[1];
  14386. retval[2]= bytes[2];
  14387. retval[3]= bytes[3];
  14388. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14389. setQByteArrayProperties(v,engine);
  14390. return v;
  14391. }
  14392. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine)
  14393. {
  14394. double value= (double)(argument<double> (0,context));
  14395. char*bytes= (char*)&value;
  14396. QByteArray retval;
  14397. retval.resize(8);
  14398. retval[0]= bytes[0];
  14399. retval[1]= bytes[1];
  14400. retval[2]= bytes[2];
  14401. retval[3]= bytes[3];
  14402. retval[4]= bytes[4];
  14403. retval[5]= bytes[5];
  14404. retval[6]= bytes[6];
  14405. retval[7]= bytes[7];
  14406. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14407. setQByteArrayProperties(v,engine);
  14408. return v;
  14409. }
  14410. /*:102*//*105:*/
  14411. #line 2622 "./typica.w"
  14412. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  14413. {
  14414. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  14415. QScriptValue object= engine->newQObject(new QBuffer(array));
  14416. setQBufferProperties(object,engine);
  14417. return object;
  14418. }
  14419. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  14420. {
  14421. setQIODeviceProperties(value,engine);
  14422. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  14423. }
  14424. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  14425. {
  14426. QBuffer*self= getself<QBuffer*> (context);
  14427. self->setData(argument<QString> (0,context).toAscii());
  14428. return QScriptValue();
  14429. }
  14430. /*:105*//*108:*/
  14431. #line 2671 "./typica.w"
  14432. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  14433. {
  14434. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  14435. setXQueryProperties(object,engine);
  14436. return object;
  14437. }
  14438. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  14439. {
  14440. QXmlQuery*self= getself<QXmlQuery*> (context);
  14441. delete self;
  14442. return QScriptValue();
  14443. }
  14444. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  14445. {
  14446. value.setProperty("bind",engine->newFunction(XQuery_bind));
  14447. value.setProperty("exec",engine->newFunction(XQuery_exec));
  14448. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  14449. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  14450. }
  14451. /*:108*//*109:*/
  14452. #line 2697 "./typica.w"
  14453. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  14454. {
  14455. QXmlQuery*self= getself<QXmlQuery*> (context);
  14456. QIODevice*buffer= argument<QIODevice*> (1,context);
  14457. self->bindVariable(argument<QString> (0,context),buffer);
  14458. return QScriptValue();
  14459. }
  14460. /*:109*//*110:*/
  14461. #line 2708 "./typica.w"
  14462. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  14463. {
  14464. QXmlQuery*self= getself<QXmlQuery*> (context);
  14465. self->setQuery(argument<QString> (0,context));
  14466. return QScriptValue();
  14467. }
  14468. /*:110*//*111:*/
  14469. #line 2718 "./typica.w"
  14470. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  14471. {
  14472. QXmlQuery*self= getself<QXmlQuery*> (context);
  14473. QString result;
  14474. self->evaluateTo(&result);
  14475. return QScriptValue(result);
  14476. }
  14477. /*:111*//*114:*/
  14478. #line 2773 "./typica.w"
  14479. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  14480. {
  14481. QXmlStreamWriter*retval;
  14482. if(context->argumentCount()==1)
  14483. {
  14484. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  14485. }
  14486. else
  14487. {
  14488. retval= new QXmlStreamWriter;
  14489. }
  14490. QScriptValue object= engine->toScriptValue<void*> (retval);
  14491. setXmlWriterProperties(object,engine);
  14492. return object;
  14493. }
  14494. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  14495. {
  14496. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  14497. value.setProperty("writeAttribute",
  14498. engine->newFunction(XmlWriter_writeAttribute));
  14499. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  14500. value.setProperty("writeCharacters",
  14501. engine->newFunction(XmlWriter_writeCharacters));
  14502. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  14503. value.setProperty("writeEmptyElement",
  14504. engine->newFunction(XmlWriter_writeEmptyElement));
  14505. value.setProperty("writeEndDocument",
  14506. engine->newFunction(XmlWriter_writeEndDocument));
  14507. value.setProperty("writeEndElement",
  14508. engine->newFunction(XmlWriter_writeEndElement));
  14509. value.setProperty("writeEntityReference",
  14510. engine->newFunction(XmlWriter_writeEntityReference));
  14511. value.setProperty("writeProcessingInstruction",
  14512. engine->newFunction(XmlWriter_writeProcessingInstruction));
  14513. value.setProperty("writeStartDocument",
  14514. engine->newFunction(XmlWriter_writeStartDocument));
  14515. value.setProperty("writeStartElement",
  14516. engine->newFunction(XmlWriter_writeStartElement));
  14517. value.setProperty("writeTextElement",
  14518. engine->newFunction(XmlWriter_writeTextElement));
  14519. }
  14520. /*:114*//*115:*/
  14521. #line 2820 "./typica.w"
  14522. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  14523. {
  14524. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14525. QIODevice*device= argument<QIODevice*> (0,context);
  14526. self->setDevice(device);
  14527. return QScriptValue();
  14528. }
  14529. /*:115*//*116:*/
  14530. #line 2834 "./typica.w"
  14531. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  14532. QScriptEngine*)
  14533. {
  14534. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14535. self->writeStartDocument(argument<QString> (0,context));
  14536. return QScriptValue();
  14537. }
  14538. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  14539. QScriptEngine*)
  14540. {
  14541. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14542. self->writeEndDocument();
  14543. return QScriptValue();
  14544. }
  14545. /*:116*//*117:*/
  14546. #line 2853 "./typica.w"
  14547. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  14548. {
  14549. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14550. self->writeDTD(argument<QString> (0,context));
  14551. return QScriptValue();
  14552. }
  14553. /*:117*//*118:*/
  14554. #line 2864 "./typica.w"
  14555. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  14556. QScriptEngine*)
  14557. {
  14558. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14559. self->writeStartElement(argument<QString> (0,context));
  14560. return QScriptValue();
  14561. }
  14562. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  14563. {
  14564. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14565. self->writeAttribute(argument<QString> (0,context),
  14566. argument<QString> (1,context));
  14567. return QScriptValue();
  14568. }
  14569. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  14570. {
  14571. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14572. self->writeCharacters(argument<QString> (0,context));
  14573. return QScriptValue();
  14574. }
  14575. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  14576. {
  14577. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14578. self->writeEndElement();
  14579. return QScriptValue();
  14580. }
  14581. /*:118*//*119:*/
  14582. #line 2900 "./typica.w"
  14583. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  14584. QScriptEngine*)
  14585. {
  14586. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14587. self->writeEmptyElement(argument<QString> (0,context));
  14588. return QScriptValue();
  14589. }
  14590. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  14591. QScriptEngine*)
  14592. {
  14593. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14594. self->writeTextElement(argument<QString> (0,context),
  14595. argument<QString> (1,context));
  14596. return QScriptValue();
  14597. }
  14598. /*:119*//*120:*/
  14599. #line 2921 "./typica.w"
  14600. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  14601. {
  14602. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14603. self->writeCDATA(argument<QString> (0,context));
  14604. return QScriptValue();
  14605. }
  14606. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  14607. QScriptEngine*)
  14608. {
  14609. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14610. self->writeEntityReference(argument<QString> (0,context));
  14611. return QScriptValue();
  14612. }
  14613. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  14614. QScriptEngine*)
  14615. {
  14616. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14617. self->writeProcessingInstruction(argument<QString> (0,context),
  14618. argument<QString> (1,context));
  14619. return QScriptValue();
  14620. }
  14621. /*:120*//*123:*/
  14622. #line 2980 "./typica.w"
  14623. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  14624. {
  14625. QXmlStreamReader*retval=
  14626. new QXmlStreamReader(argument<QIODevice*> (0,context));
  14627. QScriptValue object= engine->toScriptValue<void*> (retval);
  14628. setXmlReaderProperties(object,engine);
  14629. return object;
  14630. }
  14631. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  14632. {
  14633. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  14634. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  14635. value.setProperty("hasAttribute",
  14636. engine->newFunction(XmlReader_hasAttribute));
  14637. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  14638. value.setProperty("isStartElement",
  14639. engine->newFunction(XmlReader_isStartElement));
  14640. value.setProperty("name",engine->newFunction(XmlReader_name));
  14641. value.setProperty("readElementText",
  14642. engine->newFunction(XmlReader_readElementText));
  14643. value.setProperty("readNext",
  14644. engine->newFunction(XmlReader_readNext));
  14645. value.setProperty("text",engine->newFunction(XmlReader_text));
  14646. }
  14647. /*:123*//*124:*/
  14648. #line 3010 "./typica.w"
  14649. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  14650. {
  14651. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14652. QString retval=
  14653. self->attributes().value(argument<QString> (0,context)).toString();
  14654. return QScriptValue(retval);
  14655. }
  14656. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  14657. {
  14658. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14659. bool retval=
  14660. self->attributes().hasAttribute(argument<QString> (0,context));
  14661. return QScriptValue(retval);
  14662. }
  14663. /*:124*//*125:*/
  14664. #line 3030 "./typica.w"
  14665. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  14666. {
  14667. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14668. return QScriptValue(self->atEnd());
  14669. }
  14670. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  14671. {
  14672. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14673. return QScriptValue(self->isDTD());
  14674. }
  14675. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  14676. {
  14677. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14678. return QScriptValue(self->isStartElement());
  14679. }
  14680. /*:125*//*126:*/
  14681. #line 3051 "./typica.w"
  14682. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  14683. {
  14684. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14685. self->readNext();
  14686. return QScriptValue();
  14687. }
  14688. /*:126*//*127:*/
  14689. #line 3061 "./typica.w"
  14690. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  14691. {
  14692. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14693. return QScriptValue(self->name().toString());
  14694. }
  14695. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  14696. {
  14697. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14698. return QScriptValue(self->readElementText());
  14699. }
  14700. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  14701. {
  14702. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14703. return QScriptValue(self->text().toString());
  14704. }
  14705. /*:127*//*130:*/
  14706. #line 3103 "./typica.w"
  14707. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  14708. {
  14709. setQObjectProperties(value,engine);
  14710. value.setProperty("value",engine->newFunction(QSettings_value));
  14711. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  14712. }
  14713. /*:130*//*131:*/
  14714. #line 3115 "./typica.w"
  14715. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  14716. {
  14717. QScriptValue object;
  14718. if(context->argumentCount()==1||context->argumentCount()==2)
  14719. {
  14720. QSettings settings;
  14721. QString key= argument<QString> (0,context);
  14722. QVariant value;
  14723. QVariant retval;
  14724. if(context->argumentCount()> 1)
  14725. {
  14726. value= argument<QVariant> (1,context);
  14727. retval= settings.value(key,value);
  14728. }
  14729. else
  14730. {
  14731. retval= settings.value(key);
  14732. }
  14733. object= engine->newVariant(retval);
  14734. }
  14735. else
  14736. {
  14737. context->throwError("Incorrect number of arguments passed to "
  14738. "QSettings::value(). This method takes one "
  14739. "string and one optional variant type.");
  14740. }
  14741. return object;
  14742. }
  14743. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  14744. {
  14745. if(context->argumentCount()==2)
  14746. {
  14747. QSettings settings;
  14748. QString key= argument<QString> (0,context);
  14749. QVariant value= argument<QVariant> (1,context);
  14750. settings.setValue(key,value);
  14751. }
  14752. else
  14753. {
  14754. context->throwError("Incorrect number of arguments passed to "
  14755. "QSettings::setValue(). This method takes one "
  14756. "string and one variant type for a total of two "
  14757. "arguments.");
  14758. }
  14759. return QScriptValue();
  14760. }
  14761. /*:131*//*134:*/
  14762. #line 3184 "./typica.w"
  14763. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  14764. {
  14765. QScriptValue object= engine->newQObject(new QLCDNumber());
  14766. setQLCDNumberProperties(object,engine);
  14767. return object;
  14768. }
  14769. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  14770. {
  14771. setQFrameProperties(value,engine);
  14772. }
  14773. /*:134*//*137:*/
  14774. #line 3242 "./typica.w"
  14775. QScriptValue constructQTime(QScriptContext*context,
  14776. QScriptEngine*engine)
  14777. {
  14778. QScriptValue object;
  14779. if(context->argumentCount()==0||
  14780. (context->argumentCount()>=2&&context->argumentCount()<=4))
  14781. {
  14782. int arg1= 0;
  14783. int arg2= 0;
  14784. int arg3= 0;
  14785. int arg4= 0;
  14786. switch(context->argumentCount())
  14787. {
  14788. case 4:
  14789. arg4= argument<int> (3,context);
  14790. case 3:
  14791. arg3= argument<int> (2,context);
  14792. case 2:
  14793. arg2= argument<int> (1,context);
  14794. arg1= argument<int> (0,context);
  14795. default:
  14796. break;
  14797. }
  14798. if(context->argumentCount())
  14799. {
  14800. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  14801. arg4));
  14802. }
  14803. else
  14804. {
  14805. object= engine->toScriptValue<QTime> (QTime());
  14806. }
  14807. setQTimeProperties(object,engine);
  14808. }
  14809. else
  14810. {
  14811. context->throwError("Incorrect number of arguments passed to "
  14812. "QTime::QTime(). This method takes zero, two, "
  14813. "three, or four integer arguments.");
  14814. }
  14815. return object;
  14816. }
  14817. /*:137*//*138:*/
  14818. #line 3290 "./typica.w"
  14819. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  14820. {
  14821. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  14822. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  14823. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  14824. value.setProperty("hour",engine->newFunction(QTime_hour));
  14825. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  14826. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  14827. value.setProperty("minute",engine->newFunction(QTime_minute));
  14828. value.setProperty("msec",engine->newFunction(QTime_msec));
  14829. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  14830. value.setProperty("restart",engine->newFunction(QTime_restart));
  14831. value.setProperty("second",engine->newFunction(QTime_second));
  14832. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  14833. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  14834. value.setProperty("start",engine->newFunction(QTime_start));
  14835. value.setProperty("toString",engine->newFunction(QTime_toString));
  14836. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  14837. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  14838. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  14839. }
  14840. /*:138*//*139:*/
  14841. #line 3319 "./typica.w"
  14842. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  14843. {
  14844. QTime self= getself<QTime> (context);
  14845. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  14846. (self.second()*1000)+self.msec();
  14847. return QScriptValue(retval);
  14848. }
  14849. /*:139*//*140:*/
  14850. #line 3333 "./typica.w"
  14851. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  14852. {
  14853. QTime time;
  14854. QScriptValue retval;
  14855. if(context->argumentCount()==1)
  14856. {
  14857. QTime self= getself<QTime> (context);
  14858. time= self.addMSecs(argument<int> (0,context));
  14859. retval= engine->toScriptValue<QTime> (time);
  14860. setQTimeProperties(retval,engine);
  14861. }
  14862. else
  14863. {
  14864. context->throwError("Incorrect number of arguments passed to "
  14865. "QTime::addMSecs(). This method takes one "
  14866. "integer as an argument.");
  14867. }
  14868. return retval;
  14869. }
  14870. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  14871. {
  14872. QTime time;
  14873. QScriptValue retval;
  14874. if(context->argumentCount()==1)
  14875. {
  14876. QTime self= getself<QTime> (context);
  14877. time= self.addSecs(argument<int> (0,context));
  14878. retval= engine->toScriptValue<QTime> (time);
  14879. setQTimeProperties(retval,engine);
  14880. }
  14881. else
  14882. {
  14883. context->throwError("Incorrect number of arguments passed to "
  14884. "QTime::addSecs(). This method takes one "
  14885. "integer as an argument.");
  14886. }
  14887. return retval;
  14888. }
  14889. /*:140*//*141:*/
  14890. #line 3376 "./typica.w"
  14891. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  14892. {
  14893. QScriptValue retval;
  14894. if(context->argumentCount()==0)
  14895. {
  14896. QTime self= getself<QTime> (context);
  14897. retval= QScriptValue(engine,self.elapsed());
  14898. }
  14899. else
  14900. {
  14901. context->throwError("Incorrect number of arguments passed to "
  14902. "QTime::elapsed(). This method takes no "
  14903. "arguments.");
  14904. }
  14905. return retval;
  14906. }
  14907. /*:141*//*142:*/
  14908. #line 3397 "./typica.w"
  14909. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  14910. {
  14911. QScriptValue retval;
  14912. if(context->argumentCount()==0)
  14913. {
  14914. QTime self= getself<QTime> (context);
  14915. retval= QScriptValue(engine,self.hour());
  14916. }
  14917. else
  14918. {
  14919. context->throwError("Incorrect number of arguments passed to "
  14920. "QTime::hour(). This method takes no "
  14921. "arguments.");
  14922. }
  14923. return retval;
  14924. }
  14925. /*:142*//*143:*/
  14926. #line 3417 "./typica.w"
  14927. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  14928. {
  14929. QScriptValue retval;
  14930. if(context->argumentCount()==0)
  14931. {
  14932. QTime self= getself<QTime> (context);
  14933. retval= QScriptValue(engine,self.minute());
  14934. }
  14935. else
  14936. {
  14937. context->throwError("Incorrect number of arguments passed to "
  14938. "QTime::minute(). This method takes no "
  14939. "arguments.");
  14940. }
  14941. return retval;
  14942. }
  14943. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  14944. {
  14945. QScriptValue retval;
  14946. if(context->argumentCount()==0)
  14947. {
  14948. QTime self= getself<QTime> (context);
  14949. retval= QScriptValue(engine,self.second());
  14950. }
  14951. else
  14952. {
  14953. context->throwError("Incorrect number of arguments passed to "
  14954. "QTime::second(). This method takes no "
  14955. "arguments.");
  14956. }
  14957. return retval;
  14958. }
  14959. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  14960. {
  14961. QScriptValue retval;
  14962. if(context->argumentCount()==0)
  14963. {
  14964. QTime self= getself<QTime> (context);
  14965. retval= QScriptValue(engine,self.msec());
  14966. }
  14967. else
  14968. {
  14969. context->throwError("Incorrect number of arguments passed to "
  14970. "QTime::msec(). This method takes no "
  14971. "arguments.");
  14972. }
  14973. return retval;
  14974. }
  14975. /*:143*//*144:*/
  14976. #line 3473 "./typica.w"
  14977. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  14978. {
  14979. QScriptValue retval;
  14980. if(context->argumentCount()==0)
  14981. {
  14982. QTime self= getself<QTime> (context);
  14983. retval= QScriptValue(engine,self.isNull());
  14984. }
  14985. else
  14986. {
  14987. context->throwError("Incorrect number of arguments passed to "
  14988. "QTime::isNull(). This method takes no "
  14989. "arguments.");
  14990. }
  14991. return retval;
  14992. }
  14993. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  14994. {
  14995. QScriptValue retval;
  14996. if(context->argumentCount()==0)
  14997. {
  14998. QTime self= getself<QTime> (context);
  14999. retval= QScriptValue(engine,self.isValid());
  15000. }
  15001. else
  15002. {
  15003. context->throwError("Incorrect number of arguments passed to "
  15004. "QTime::isValid(). This method takes no "
  15005. "arguments.");
  15006. }
  15007. return retval;
  15008. }
  15009. /*:144*//*145:*/
  15010. #line 3511 "./typica.w"
  15011. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  15012. {
  15013. QScriptValue retval;
  15014. if(context->argumentCount()==1)
  15015. {
  15016. QTime self= getself<QTime> (context);
  15017. QTime arg= argument<QVariant> (0,context).toTime();
  15018. retval= QScriptValue(engine,self.msecsTo(arg));
  15019. }
  15020. else
  15021. {
  15022. context->throwError("Incorrect number of arguments passed to "
  15023. "QTime::msecsTo(). This method takes one QTime.");
  15024. }
  15025. return retval;
  15026. }
  15027. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  15028. {
  15029. QScriptValue retval;
  15030. if(context->argumentCount()==1)
  15031. {
  15032. QTime self= getself<QTime> (context);
  15033. QTime arg= argument<QVariant> (0,context).toTime();
  15034. retval= QScriptValue(engine,self.secsTo(arg));
  15035. }
  15036. else
  15037. {
  15038. context->throwError("Incorrect number of arguments passed to "
  15039. "QTime::secsTo(). This method takes one QTime.");
  15040. }
  15041. return retval;
  15042. }
  15043. /*:145*//*146:*/
  15044. #line 3550 "./typica.w"
  15045. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  15046. {
  15047. QScriptValue retval;
  15048. if(context->argumentCount()==0)
  15049. {
  15050. QTime self= getself<QTime> (context);
  15051. retval= QScriptValue(engine,self.restart());
  15052. }
  15053. else
  15054. {
  15055. context->throwError("Incorrect number of arguments passed to "
  15056. "QTime::restart(). This method takes no "
  15057. "arguments.");
  15058. }
  15059. return retval;
  15060. }
  15061. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  15062. {
  15063. if(context->argumentCount()==0)
  15064. {
  15065. QTime self= getself<QTime> (context);
  15066. self.start();
  15067. }
  15068. else
  15069. {
  15070. context->throwError("Incorrect number of arguments passed to "
  15071. "QTime::start(). This method takes no arguments.");
  15072. }
  15073. return QScriptValue();
  15074. }
  15075. /*:146*//*147:*/
  15076. #line 3586 "./typica.w"
  15077. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  15078. {
  15079. QScriptValue retval;
  15080. if(context->argumentCount()==3||context->argumentCount()==4)
  15081. {
  15082. QTime self= getself<QTime> (context);
  15083. int arg1= 0;
  15084. int arg2= 0;
  15085. int arg3= 0;
  15086. int arg4= 0;
  15087. switch(context->argumentCount())
  15088. {
  15089. case 4:
  15090. arg4= argument<int> (3,context);
  15091. case 3:
  15092. arg3= argument<int> (2,context);
  15093. arg2= argument<int> (1,context);
  15094. arg1= argument<int> (0,context);
  15095. default:
  15096. break;
  15097. }
  15098. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  15099. }
  15100. else
  15101. {
  15102. context->throwError("Incorrect number of arguments passed to "
  15103. "QTime::setHMS(). This method takes three or "
  15104. "four integer arguments.");
  15105. }
  15106. return retval;
  15107. }
  15108. /*:147*//*148:*/
  15109. #line 3622 "./typica.w"
  15110. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  15111. {
  15112. QScriptValue retval;
  15113. if(context->argumentCount()==1)
  15114. {
  15115. QTime self= getself<QTime> (context);
  15116. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  15117. }
  15118. else
  15119. {
  15120. context->throwError("Incorrect number of arguments passed to "
  15121. "QTime::toString(). This method takes one QString "
  15122. "as an argument.");
  15123. }
  15124. return retval;
  15125. }
  15126. /*:148*//*149:*/
  15127. #line 3643 "./typica.w"
  15128. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  15129. {
  15130. QScriptValue object;
  15131. object= engine->toScriptValue<QTime> (QTime::currentTime());
  15132. setQTimeProperties(object,engine);
  15133. return object;
  15134. }
  15135. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  15136. {
  15137. QScriptValue object;
  15138. if(context->argumentCount()==2)
  15139. {
  15140. QString time= argument<QString> (0,context);
  15141. QString format= argument<QString> (1,context);
  15142. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  15143. setQTimeProperties(object,engine);
  15144. }
  15145. else
  15146. {
  15147. context->throwError("Incorrect number of arguments passed to "
  15148. "QTime::fromString(). This method takes two "
  15149. "string arguments.");
  15150. }
  15151. return object;
  15152. }
  15153. /*:149*//*150:*/
  15154. #line 3674 "./typica.w"
  15155. template<> QTime argument(int arg,QScriptContext*context)
  15156. {
  15157. return qscriptvalue_cast<QTime> (context->argument(arg));
  15158. }
  15159. /*:150*//*152:*/
  15160. #line 3692 "./typica.w"
  15161. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  15162. {
  15163. setQFrameProperties(value,engine);
  15164. }
  15165. /*:152*//*154:*/
  15166. #line 3706 "./typica.w"
  15167. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  15168. {
  15169. setQAbstractScrollAreaProperties(value,engine);
  15170. }
  15171. /*:154*//*156:*/
  15172. #line 3720 "./typica.w"
  15173. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  15174. {
  15175. setQAbstractScrollAreaProperties(value,engine);
  15176. }
  15177. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  15178. {
  15179. setQAbstractItemViewProperties(value,engine);
  15180. }
  15181. /*:156*//*159:*/
  15182. #line 3753 "./typica.w"
  15183. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  15184. {
  15185. QScriptValue object= engine->newQObject(new QPushButton());
  15186. setQPushButtonProperties(object,engine);
  15187. return object;
  15188. }
  15189. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  15190. {
  15191. setQAbstractButtonProperties(value,engine);
  15192. }
  15193. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  15194. {
  15195. setQWidgetProperties(value,engine);
  15196. }
  15197. /*:159*//*166:*/
  15198. #line 3865 "./typica.w"
  15199. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  15200. {
  15201. SqlQueryConnection*obj= new SqlQueryConnection();
  15202. QScriptValue object=
  15203. engine->toScriptValue<void*> (obj);
  15204. setQSqlQueryProperties(object,engine);
  15205. return object;
  15206. }
  15207. /*:166*//*167:*/
  15208. #line 3878 "./typica.w"
  15209. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  15210. {
  15211. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  15212. value.setProperty("bindFileData",
  15213. engine->newFunction(QSqlQuery_bindFileData));
  15214. value.setProperty("bindDeviceData",
  15215. engine->newFunction(QSqlQuery_bindDeviceData));
  15216. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  15217. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  15218. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  15219. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  15220. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  15221. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  15222. }
  15223. /*:167*//*168:*/
  15224. #line 3896 "./typica.w"
  15225. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  15226. {
  15227. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  15228. QScriptValue retval;
  15229. if(context->argumentCount()==1)
  15230. {
  15231. retval= QScriptValue(engine,
  15232. q->exec(argument<QString> (0,context)));
  15233. }
  15234. else
  15235. {
  15236. retval= QScriptValue(engine,q->exec());
  15237. }
  15238. if(q->lastError().isValid())
  15239. {
  15240. qDebug()<<q->lastQuery();
  15241. qDebug()<<q->lastError().text();
  15242. }
  15243. return retval;
  15244. }
  15245. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  15246. {
  15247. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15248. return QScriptValue(query->lastQuery());
  15249. }
  15250. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  15251. {
  15252. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15253. return QScriptValue(engine,query->next());
  15254. }
  15255. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  15256. {
  15257. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15258. return QScriptValue(engine,
  15259. query->value(argument<int> (0,context)).toString());
  15260. }
  15261. /*:168*//*169:*/
  15262. #line 3940 "./typica.w"
  15263. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  15264. {
  15265. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15266. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  15267. }
  15268. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  15269. {
  15270. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15271. query->bindValue(argument<QString> (0,context),
  15272. argument<QVariant> (1,context));
  15273. return QScriptValue();
  15274. }
  15275. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  15276. QScriptEngine*)
  15277. {
  15278. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15279. QString placeholder= argument<QString> (0,context);
  15280. QString filename= argument<QString> (1,context);
  15281. QFile file(filename);
  15282. QByteArray data;
  15283. if(file.open(QIODevice::ReadOnly))
  15284. {
  15285. data= file.readAll();
  15286. file.close();
  15287. }
  15288. query->bindValue(placeholder,data);
  15289. return QScriptValue();
  15290. }
  15291. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  15292. QScriptEngine*)
  15293. {
  15294. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15295. QString placeholder= argument<QString> (0,context);
  15296. QIODevice*device= argument<QIODevice*> (1,context);
  15297. device->reset();
  15298. QByteArray data;
  15299. data= device->readAll();
  15300. query->bindValue(placeholder,data);
  15301. return QScriptValue();
  15302. }
  15303. /*:169*//*170:*/
  15304. #line 3992 "./typica.w"
  15305. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  15306. {
  15307. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  15308. delete query;
  15309. return QScriptValue::UndefinedValue;
  15310. }
  15311. /*:170*//*173:*/
  15312. #line 4037 "./typica.w"
  15313. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  15314. {
  15315. QFileInfo info(argument<QString> (0,context));
  15316. QScriptValue retval(engine,info.baseName());
  15317. return retval;
  15318. }
  15319. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  15320. {
  15321. QFileInfo info(argument<QString> (0,context));
  15322. QDir dir= info.dir();
  15323. QScriptValue retval(engine,dir.path());
  15324. return retval;
  15325. }
  15326. /*:173*//*174:*/
  15327. #line 4056 "./typica.w"
  15328. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*)
  15329. {
  15330. SqlQueryConnection h;
  15331. QSqlQuery*query= h.operator->();
  15332. QString q= "SELECT file FROM files WHERE id = :file";
  15333. query->prepare(q);
  15334. query->bindValue(":file",argument<int> (0,context));
  15335. query->exec();
  15336. query->next();
  15337. QByteArray array= query->value(0).toByteArray();
  15338. QFile file(argument<QString> (1,context));
  15339. file.open(QIODevice::WriteOnly);
  15340. file.write(array);
  15341. file.close();
  15342. return QScriptValue();
  15343. }
  15344. /*:174*//*175:*/
  15345. #line 4077 "./typica.w"
  15346. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  15347. {
  15348. QString source= argument<QString> (0,context);
  15349. source.remove(0,1);
  15350. source.chop(1);
  15351. QStringList elements= source.split(",");
  15352. QString element;
  15353. QScriptValue dest= engine->newArray(elements.size());
  15354. int i= 0;
  15355. foreach(element,elements)
  15356. {
  15357. if(element.startsWith("\"")&&element.endsWith("\""))
  15358. {
  15359. element.chop(1);
  15360. element= element.remove(0,1);
  15361. }
  15362. dest.setProperty(i,QScriptValue(engine,element));
  15363. i++;
  15364. }
  15365. return dest;
  15366. }
  15367. /*:175*//*176:*/
  15368. #line 4103 "./typica.w"
  15369. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  15370. {
  15371. QString font= argument<QString> (0,context);
  15372. QString classname;
  15373. if(context->argumentCount()> 1)
  15374. {
  15375. classname= argument<QString> (1,context);
  15376. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  15377. }
  15378. else
  15379. {
  15380. QApplication::setFont(QFont(font));
  15381. }
  15382. return QScriptValue();
  15383. }
  15384. /*:176*//*177:*/
  15385. #line 4123 "./typica.w"
  15386. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  15387. {
  15388. SqlQueryConnection h;
  15389. QSqlQuery*query= h.operator->();
  15390. QString q= "SELECT file FROM files WHERE id = :file";
  15391. query->prepare(q);
  15392. query->bindValue(":file",argument<int> (0,context));
  15393. query->exec();
  15394. query->next();
  15395. QByteArray array= query->value(0).toByteArray();
  15396. QBuffer buffer(&array);
  15397. buffer.open(QIODevice::ReadOnly);
  15398. QXmlQuery xquery;
  15399. xquery.bindVariable("profile",&buffer);
  15400. QString xq;
  15401. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  15402. xquery.setQuery(xq);
  15403. QString result;
  15404. xquery.evaluateTo(&result);
  15405. return QScriptValue(result);
  15406. }
  15407. /*:177*//*178:*/
  15408. #line 4150 "./typica.w"
  15409. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  15410. {
  15411. QWidget::setTabOrder(argument<QWidget*> (0,context),
  15412. argument<QWidget*> (1,context));
  15413. return QScriptValue();
  15414. }
  15415. /*:178*//*185:*/
  15416. #line 4396 "./typica.w"
  15417. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  15418. {
  15419. QString targetID= argument<QString> (0,context);
  15420. QDomNode element;
  15421. QScriptValue object;
  15422. /*187:*/
  15423. #line 4443 "./typica.w"
  15424. QDomNodeList windows=
  15425. AppInstance->configuration()->documentElement().elementsByTagName("window");
  15426. QDomNode nullNode;
  15427. int i= 0;
  15428. element= nullNode;
  15429. while(i<windows.count())
  15430. {
  15431. element= windows.at(i);
  15432. QDomNamedNodeMap attributes= element.attributes();
  15433. if(attributes.contains("id"))
  15434. {
  15435. if(attributes.namedItem("id").toAttr().value()==targetID)
  15436. {
  15437. break;
  15438. }
  15439. }
  15440. element= nullNode;
  15441. i++;
  15442. }
  15443. /*:187*/
  15444. #line 4402 "./typica.w"
  15445. if(!element.isNull())
  15446. {
  15447. /*188:*/
  15448. #line 4475 "./typica.w"
  15449. ScriptQMainWindow*window= new ScriptQMainWindow;
  15450. window->setObjectName(targetID);
  15451. object= engine->newQObject(window);
  15452. setQMainWindowProperties(object,engine);
  15453. QWidget*central= new(QWidget);
  15454. central->setParent(window);
  15455. central->setObjectName("centralWidget");
  15456. window->setCentralWidget(central);
  15457. if(element.hasChildNodes())
  15458. {
  15459. /*189:*/
  15460. #line 4510 "./typica.w"
  15461. QStack<QWidget*> widgetStack;
  15462. QStack<QLayout*> layoutStack;
  15463. QString windowScript;
  15464. widgetStack.push(central);
  15465. QDomNodeList windowChildren= element.childNodes();
  15466. int i= 0;
  15467. while(i<windowChildren.count())
  15468. {
  15469. QDomNode current;
  15470. QDomElement element;
  15471. current= windowChildren.at(i);
  15472. if(current.isElement())
  15473. {
  15474. element= current.toElement();
  15475. if(element.tagName()=="program")
  15476. {
  15477. windowScript.append(element.text());
  15478. }
  15479. else if(element.tagName()=="layout")
  15480. {
  15481. addLayoutToWidget(element,&widgetStack,&layoutStack);
  15482. }
  15483. else if(element.tagName()=="menu")
  15484. {
  15485. /*190:*/
  15486. #line 4557 "./typica.w"
  15487. QMenuBar*bar= window->menuBar();
  15488. bar->setParent(window);
  15489. bar->setObjectName("menuBar");
  15490. if(element.hasAttribute("name"))
  15491. {
  15492. QMenu*menu= bar->addMenu(element.attribute("name"));
  15493. menu->setParent(bar);
  15494. if(element.hasAttribute("type"))
  15495. {
  15496. if(element.attribute("type")=="reports")
  15497. {
  15498. if(element.hasAttribute("src"))
  15499. {
  15500. /*630:*/
  15501. #line 13643 "./typica.w"
  15502. QSettings settings;
  15503. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  15504. toString()).
  15505. arg(element.attribute("src"));
  15506. QDir::addSearchPath("reports",reportDirectory);
  15507. QDir directory(reportDirectory);
  15508. directory.setFilter(QDir::Files);
  15509. directory.setSorting(QDir::Name);
  15510. QStringList nameFilter;
  15511. nameFilter<<"*.xml";
  15512. directory.setNameFilters(nameFilter);
  15513. QFileInfoList reportFiles= directory.entryInfoList();
  15514. for(int i= 0;i<reportFiles.size();i++)
  15515. {
  15516. QFileInfo reportFile= reportFiles.at(i);
  15517. /*634:*/
  15518. #line 13723 "./typica.w"
  15519. QString path= reportFile.absoluteFilePath();
  15520. QFile file(path);
  15521. if(file.open(QIODevice::ReadOnly))
  15522. {
  15523. QDomDocument document;
  15524. document.setContent(&file,true);
  15525. QDomElement root= document.documentElement();
  15526. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  15527. if(!titleNode.isNull())
  15528. {
  15529. QDomElement titleElement= titleNode.toElement();
  15530. QString title= titleElement.text();
  15531. if(!title.isEmpty())
  15532. {
  15533. QStringList hierarchy= title.split(":->");
  15534. QMenu*insertionPoint= menu;
  15535. /*635:*/
  15536. #line 13750 "./typica.w"
  15537. for(int j= 0;j<hierarchy.size()-1;j++)
  15538. {
  15539. QObjectList menuList= insertionPoint->children();
  15540. bool menuFound= false;
  15541. for(int k= 0;k<menuList.size();k++)
  15542. {
  15543. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  15544. if(currentItem)
  15545. {
  15546. if(currentItem->title()==hierarchy.at(j))
  15547. {
  15548. menuFound= true;
  15549. insertionPoint= currentItem;
  15550. break;
  15551. }
  15552. }
  15553. }
  15554. if(!menuFound)
  15555. {
  15556. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  15557. }
  15558. }
  15559. /*:635*/
  15560. #line 13740 "./typica.w"
  15561. ReportAction*action= new ReportAction(path,hierarchy.last());
  15562. insertionPoint->addAction(action);
  15563. }
  15564. }
  15565. }
  15566. /*:634*/
  15567. #line 13659 "./typica.w"
  15568. }
  15569. /*:630*/
  15570. #line 4571 "./typica.w"
  15571. }
  15572. }
  15573. }
  15574. if(element.hasChildNodes())
  15575. {
  15576. /*191:*/
  15577. #line 4584 "./typica.w"
  15578. QDomNodeList menuItems= element.childNodes();
  15579. int j= 0;
  15580. while(j<menuItems.count())
  15581. {
  15582. QDomNode item= menuItems.at(j);
  15583. if(item.isElement())
  15584. {
  15585. QDomElement itemElement= item.toElement();
  15586. if(itemElement.tagName()=="item")
  15587. {
  15588. QAction*itemAction= new QAction(itemElement.text(),menu);
  15589. if(itemElement.hasAttribute("id"))
  15590. {
  15591. itemAction->setObjectName(itemElement.attribute("id"));
  15592. }
  15593. if(itemElement.hasAttribute("shortcut"))
  15594. {
  15595. itemAction->setShortcut(itemElement.attribute("shortcut"));
  15596. }
  15597. menu->addAction(itemAction);
  15598. }
  15599. else if(itemElement.tagName()=="separator")
  15600. {
  15601. menu->addSeparator();
  15602. }
  15603. }
  15604. j++;
  15605. }
  15606. #line 1 "./helpmenu.w"
  15607. /*:191*/
  15608. #line 4577 "./typica.w"
  15609. }
  15610. }
  15611. /*:190*/
  15612. #line 4535 "./typica.w"
  15613. }
  15614. }
  15615. i++;
  15616. }
  15617. QScriptValue oldThis= context->thisObject();
  15618. context->setThisObject(object);
  15619. QScriptValue result= engine->evaluate(windowScript);
  15620. /*182:*/
  15621. #line 4292 "./typica.w"
  15622. if(engine->hasUncaughtException())
  15623. {
  15624. int line= engine->uncaughtExceptionLineNumber();
  15625. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  15626. result.toString();
  15627. QString trace;
  15628. foreach(trace,engine->uncaughtExceptionBacktrace())
  15629. {
  15630. qDebug()<<trace;
  15631. }
  15632. }
  15633. /*:182*/
  15634. #line 4543 "./typica.w"
  15635. context->setThisObject(oldThis);
  15636. /*:189*/
  15637. #line 4486 "./typica.w"
  15638. }
  15639. /*192:*/
  15640. #line 9 "./helpmenu.w"
  15641. HelpMenu*helpMenu= new HelpMenu();
  15642. window->menuBar()->addMenu(helpMenu);
  15643. /*:192*/
  15644. #line 4488 "./typica.w"
  15645. window->show();
  15646. /*:188*/
  15647. #line 4405 "./typica.w"
  15648. }
  15649. return object;
  15650. }
  15651. /*:185*//*186:*/
  15652. #line 4416 "./typica.w"
  15653. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  15654. {
  15655. QString targetID= argument<QString> (0,context);
  15656. QFile file(QString("reports:%1").arg(targetID));
  15657. QScriptValue object;
  15658. if(file.open(QIODevice::ReadOnly))
  15659. {
  15660. QDomDocument document;
  15661. document.setContent(&file,true);
  15662. QDomElement element= document.documentElement();
  15663. if(!element.isNull())
  15664. {
  15665. /*188:*/
  15666. #line 4475 "./typica.w"
  15667. ScriptQMainWindow*window= new ScriptQMainWindow;
  15668. window->setObjectName(targetID);
  15669. object= engine->newQObject(window);
  15670. setQMainWindowProperties(object,engine);
  15671. QWidget*central= new(QWidget);
  15672. central->setParent(window);
  15673. central->setObjectName("centralWidget");
  15674. window->setCentralWidget(central);
  15675. if(element.hasChildNodes())
  15676. {
  15677. /*189:*/
  15678. #line 4510 "./typica.w"
  15679. QStack<QWidget*> widgetStack;
  15680. QStack<QLayout*> layoutStack;
  15681. QString windowScript;
  15682. widgetStack.push(central);
  15683. QDomNodeList windowChildren= element.childNodes();
  15684. int i= 0;
  15685. while(i<windowChildren.count())
  15686. {
  15687. QDomNode current;
  15688. QDomElement element;
  15689. current= windowChildren.at(i);
  15690. if(current.isElement())
  15691. {
  15692. element= current.toElement();
  15693. if(element.tagName()=="program")
  15694. {
  15695. windowScript.append(element.text());
  15696. }
  15697. else if(element.tagName()=="layout")
  15698. {
  15699. addLayoutToWidget(element,&widgetStack,&layoutStack);
  15700. }
  15701. else if(element.tagName()=="menu")
  15702. {
  15703. /*190:*/
  15704. #line 4557 "./typica.w"
  15705. QMenuBar*bar= window->menuBar();
  15706. bar->setParent(window);
  15707. bar->setObjectName("menuBar");
  15708. if(element.hasAttribute("name"))
  15709. {
  15710. QMenu*menu= bar->addMenu(element.attribute("name"));
  15711. menu->setParent(bar);
  15712. if(element.hasAttribute("type"))
  15713. {
  15714. if(element.attribute("type")=="reports")
  15715. {
  15716. if(element.hasAttribute("src"))
  15717. {
  15718. /*630:*/
  15719. #line 13643 "./typica.w"
  15720. QSettings settings;
  15721. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  15722. toString()).
  15723. arg(element.attribute("src"));
  15724. QDir::addSearchPath("reports",reportDirectory);
  15725. QDir directory(reportDirectory);
  15726. directory.setFilter(QDir::Files);
  15727. directory.setSorting(QDir::Name);
  15728. QStringList nameFilter;
  15729. nameFilter<<"*.xml";
  15730. directory.setNameFilters(nameFilter);
  15731. QFileInfoList reportFiles= directory.entryInfoList();
  15732. for(int i= 0;i<reportFiles.size();i++)
  15733. {
  15734. QFileInfo reportFile= reportFiles.at(i);
  15735. /*634:*/
  15736. #line 13723 "./typica.w"
  15737. QString path= reportFile.absoluteFilePath();
  15738. QFile file(path);
  15739. if(file.open(QIODevice::ReadOnly))
  15740. {
  15741. QDomDocument document;
  15742. document.setContent(&file,true);
  15743. QDomElement root= document.documentElement();
  15744. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  15745. if(!titleNode.isNull())
  15746. {
  15747. QDomElement titleElement= titleNode.toElement();
  15748. QString title= titleElement.text();
  15749. if(!title.isEmpty())
  15750. {
  15751. QStringList hierarchy= title.split(":->");
  15752. QMenu*insertionPoint= menu;
  15753. /*635:*/
  15754. #line 13750 "./typica.w"
  15755. for(int j= 0;j<hierarchy.size()-1;j++)
  15756. {
  15757. QObjectList menuList= insertionPoint->children();
  15758. bool menuFound= false;
  15759. for(int k= 0;k<menuList.size();k++)
  15760. {
  15761. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  15762. if(currentItem)
  15763. {
  15764. if(currentItem->title()==hierarchy.at(j))
  15765. {
  15766. menuFound= true;
  15767. insertionPoint= currentItem;
  15768. break;
  15769. }
  15770. }
  15771. }
  15772. if(!menuFound)
  15773. {
  15774. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  15775. }
  15776. }
  15777. /*:635*/
  15778. #line 13740 "./typica.w"
  15779. ReportAction*action= new ReportAction(path,hierarchy.last());
  15780. insertionPoint->addAction(action);
  15781. }
  15782. }
  15783. }
  15784. /*:634*/
  15785. #line 13659 "./typica.w"
  15786. }
  15787. /*:630*/
  15788. #line 4571 "./typica.w"
  15789. }
  15790. }
  15791. }
  15792. if(element.hasChildNodes())
  15793. {
  15794. /*191:*/
  15795. #line 4584 "./typica.w"
  15796. QDomNodeList menuItems= element.childNodes();
  15797. int j= 0;
  15798. while(j<menuItems.count())
  15799. {
  15800. QDomNode item= menuItems.at(j);
  15801. if(item.isElement())
  15802. {
  15803. QDomElement itemElement= item.toElement();
  15804. if(itemElement.tagName()=="item")
  15805. {
  15806. QAction*itemAction= new QAction(itemElement.text(),menu);
  15807. if(itemElement.hasAttribute("id"))
  15808. {
  15809. itemAction->setObjectName(itemElement.attribute("id"));
  15810. }
  15811. if(itemElement.hasAttribute("shortcut"))
  15812. {
  15813. itemAction->setShortcut(itemElement.attribute("shortcut"));
  15814. }
  15815. menu->addAction(itemAction);
  15816. }
  15817. else if(itemElement.tagName()=="separator")
  15818. {
  15819. menu->addSeparator();
  15820. }
  15821. }
  15822. j++;
  15823. }
  15824. #line 1 "./helpmenu.w"
  15825. /*:191*/
  15826. #line 4577 "./typica.w"
  15827. }
  15828. }
  15829. /*:190*/
  15830. #line 4535 "./typica.w"
  15831. }
  15832. }
  15833. i++;
  15834. }
  15835. QScriptValue oldThis= context->thisObject();
  15836. context->setThisObject(object);
  15837. QScriptValue result= engine->evaluate(windowScript);
  15838. /*182:*/
  15839. #line 4292 "./typica.w"
  15840. if(engine->hasUncaughtException())
  15841. {
  15842. int line= engine->uncaughtExceptionLineNumber();
  15843. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  15844. result.toString();
  15845. QString trace;
  15846. foreach(trace,engine->uncaughtExceptionBacktrace())
  15847. {
  15848. qDebug()<<trace;
  15849. }
  15850. }
  15851. /*:182*/
  15852. #line 4543 "./typica.w"
  15853. context->setThisObject(oldThis);
  15854. /*:189*/
  15855. #line 4486 "./typica.w"
  15856. }
  15857. /*192:*/
  15858. #line 9 "./helpmenu.w"
  15859. HelpMenu*helpMenu= new HelpMenu();
  15860. window->menuBar()->addMenu(helpMenu);
  15861. /*:192*/
  15862. #line 4488 "./typica.w"
  15863. window->show();
  15864. /*:188*/
  15865. #line 4429 "./typica.w"
  15866. }
  15867. file.close();
  15868. }
  15869. return object;
  15870. }
  15871. /*:186*//*204:*/
  15872. #line 4628 "./typica.w"
  15873. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  15874. QStack<QLayout*> *layoutStack)
  15875. {
  15876. if(element.hasAttribute("type"))
  15877. {
  15878. /*205:*/
  15879. #line 4649 "./typica.w"
  15880. QLayout*layout;
  15881. QString layoutType= element.attribute("type");
  15882. if(layoutType=="horizontal")
  15883. {
  15884. layout= new QHBoxLayout;
  15885. layoutStack->push(layout);
  15886. populateBoxLayout(element,widgetStack,layoutStack);
  15887. }
  15888. else if(layoutType=="vertical")
  15889. {
  15890. layout= new QVBoxLayout;
  15891. layoutStack->push(layout);
  15892. populateBoxLayout(element,widgetStack,layoutStack);
  15893. }
  15894. else if(layoutType=="grid")
  15895. {
  15896. layout= new QGridLayout;
  15897. layoutStack->push(layout);
  15898. populateGridLayout(element,widgetStack,layoutStack);
  15899. }
  15900. else if(layoutType=="stack")
  15901. {
  15902. layout= new QStackedLayout;
  15903. layoutStack->push(layout);
  15904. populateStackedLayout(element,widgetStack,layoutStack);
  15905. }
  15906. if(element.hasAttribute("id"))
  15907. {
  15908. layout->setObjectName(element.attribute("id"));
  15909. }
  15910. if(element.hasAttribute("spacing"))
  15911. {
  15912. layout->setSpacing(element.attribute("spacing").toInt());
  15913. }
  15914. if(element.hasAttribute("margin"))
  15915. {
  15916. int m= element.attribute("margin").toInt();
  15917. layout->setContentsMargins(m,m,m,m);
  15918. }
  15919. /*:205*/
  15920. #line 4634 "./typica.w"
  15921. QWidget*widget= widgetStack->top();
  15922. if(layout)
  15923. {
  15924. widget->setLayout(layout);
  15925. }
  15926. layoutStack->pop();
  15927. }
  15928. }
  15929. /*:204*//*206:*/
  15930. #line 4696 "./typica.w"
  15931. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  15932. QStack<QLayout*> *layoutStack)
  15933. {
  15934. QDomNodeList children= element.childNodes();
  15935. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  15936. for(int i= 0;i<children.count();i++)
  15937. {
  15938. QDomNode current;
  15939. QDomElement currentElement;
  15940. current= children.at(i);
  15941. if(current.isElement())
  15942. {
  15943. currentElement= current.toElement();
  15944. if(currentElement.tagName()=="page")
  15945. {
  15946. QWidget*widget= new QWidget;
  15947. layout->addWidget(widget);
  15948. widgetStack->push(widget);
  15949. populateWidget(currentElement,widgetStack,layoutStack);
  15950. widgetStack->pop();
  15951. }
  15952. }
  15953. }
  15954. }
  15955. /*:206*//*207:*/
  15956. #line 4728 "./typica.w"
  15957. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  15958. QStack<QLayout*> *layoutStack)
  15959. {
  15960. QDomNodeList children= element.childNodes();
  15961. int row= -1;
  15962. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  15963. for(int i= 0;i<children.count();i++)
  15964. {
  15965. QDomNode current;
  15966. QDomElement currentElement;
  15967. current= children.at(i);
  15968. if(current.isElement())
  15969. {
  15970. currentElement= current.toElement();
  15971. if(currentElement.tagName()=="row")
  15972. {
  15973. row++;
  15974. if(currentElement.hasAttribute("height"))
  15975. {
  15976. layout->setRowMinimumHeight(row,
  15977. currentElement.attribute("height").toInt());
  15978. }
  15979. if(currentElement.hasAttribute("stretch"))
  15980. {
  15981. layout->setRowStretch(row,
  15982. currentElement.attribute("stretch").toInt());
  15983. }
  15984. /*208:*/
  15985. #line 4784 "./typica.w"
  15986. int column= -1;
  15987. QDomNodeList rowChildren= currentElement.childNodes();
  15988. for(int j= 0;j<rowChildren.count();j++)
  15989. {
  15990. QDomNode columnNode;
  15991. QDomElement columnElement;
  15992. columnNode= rowChildren.at(j);
  15993. if(columnNode.isElement())
  15994. {
  15995. columnElement= columnNode.toElement();
  15996. if(columnElement.tagName()=="column")
  15997. {
  15998. column++;
  15999. if(columnElement.hasAttribute("column"))
  16000. {
  16001. column= columnElement.attribute("column").toInt();
  16002. }
  16003. if(columnElement.hasAttribute("width"))
  16004. {
  16005. layout->setColumnMinimumWidth(column,
  16006. columnElement.attribute("width").toInt());
  16007. }
  16008. if(columnElement.hasAttribute("stretch"))
  16009. {
  16010. layout->setColumnStretch(column,
  16011. columnElement.attribute("stretch").toInt());
  16012. }
  16013. int hspan= 1;
  16014. int vspan= 1;
  16015. if(columnElement.hasAttribute("rowspan"))
  16016. {
  16017. vspan= columnElement.attribute("rowspan").toInt();
  16018. }
  16019. if(columnElement.hasAttribute("colspan"))
  16020. {
  16021. hspan= columnElement.attribute("colspan").toInt();
  16022. }
  16023. QHBoxLayout*cell= new QHBoxLayout;
  16024. layout->addLayout(cell,row,column,vspan,hspan);
  16025. layoutStack->push(cell);
  16026. populateBoxLayout(columnElement,widgetStack,layoutStack);
  16027. layoutStack->pop();
  16028. }
  16029. }
  16030. }
  16031. /*:208*/
  16032. #line 4756 "./typica.w"
  16033. }
  16034. }
  16035. }
  16036. }
  16037. /*:207*//*209:*/
  16038. #line 4834 "./typica.w"
  16039. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16040. QStack<QLayout*> *layoutStack)
  16041. {
  16042. QDomNodeList children= element.childNodes();
  16043. for(int i= 0;i<children.count();i++)
  16044. {
  16045. QDomNode current;
  16046. QDomElement currentElement;
  16047. current= children.at(i);
  16048. if(current.isElement())
  16049. {
  16050. currentElement= current.toElement();
  16051. if(currentElement.tagName()=="button")
  16052. {
  16053. addButtonToLayout(currentElement,widgetStack,layoutStack);
  16054. }
  16055. else if(currentElement.tagName()=="calendar")
  16056. {
  16057. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  16058. }
  16059. else if(currentElement.tagName()=="decoration")
  16060. {
  16061. addDecorationToLayout(currentElement,widgetStack,
  16062. layoutStack);
  16063. }
  16064. else if(currentElement.tagName()=="layout")
  16065. {
  16066. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  16067. }
  16068. else if(currentElement.tagName()=="splitter")
  16069. {
  16070. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  16071. }
  16072. else if(currentElement.tagName()=="label")
  16073. {
  16074. QBoxLayout*layout=
  16075. qobject_cast<QBoxLayout*> (layoutStack->top());
  16076. QLabel*label= new QLabel(currentElement.text());
  16077. layout->addWidget(label);
  16078. }
  16079. else if(currentElement.tagName()=="lcdtemperature")
  16080. {
  16081. addTemperatureDisplayToLayout(currentElement,widgetStack,
  16082. layoutStack);
  16083. }
  16084. else if(currentElement.tagName()=="lcdtimer")
  16085. {
  16086. addTimerDisplayToLayout(currentElement,widgetStack,
  16087. layoutStack);
  16088. }
  16089. else if(currentElement.tagName()=="line")
  16090. {
  16091. addLineToLayout(currentElement,widgetStack,layoutStack);
  16092. }
  16093. else if(currentElement.tagName()=="report")
  16094. {
  16095. addReportToLayout(currentElement,widgetStack,layoutStack);
  16096. }
  16097. else if(currentElement.tagName()=="sqldrop")
  16098. {
  16099. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  16100. }
  16101. else if(currentElement.tagName()=="sqltablearray")
  16102. {
  16103. addSaltToLayout(currentElement,widgetStack,layoutStack);
  16104. }
  16105. else if(currentElement.tagName()=="sqlview")
  16106. {
  16107. addSqlQueryViewToLayout(currentElement,widgetStack,
  16108. layoutStack);
  16109. }
  16110. else if(currentElement.tagName()=="textarea")
  16111. {
  16112. addTextToLayout(currentElement,widgetStack,layoutStack);
  16113. }
  16114. else if(currentElement.tagName()=="spinbox")
  16115. {
  16116. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  16117. }
  16118. else if(currentElement.tagName()=="formarray")
  16119. {
  16120. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  16121. }
  16122. else if(currentElement.tagName()=="hscale")
  16123. {
  16124. addScaleControlToLayout(currentElement,widgetStack,
  16125. layoutStack);
  16126. }
  16127. else if(currentElement.tagName()=="vscale")
  16128. {
  16129. addIntensityControlToLayout(currentElement,widgetStack,
  16130. layoutStack);
  16131. }
  16132. else if(currentElement.tagName()=="webview")
  16133. {
  16134. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  16135. }
  16136. else if(currentElement.tagName()=="stretch")
  16137. {
  16138. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16139. layout->addStretch();
  16140. }
  16141. /*672:*/
  16142. #line 451 "./daterangeselector.w"
  16143. else if(currentElement.tagName()=="daterange")
  16144. {
  16145. addDateRangeToLayout(currentElement,widgetStack,layoutStack);
  16146. }
  16147. /*:672*/
  16148. #line 4937 "./typica.w"
  16149. }
  16150. }
  16151. }
  16152. /*:209*//*210:*/
  16153. #line 4945 "./typica.w"
  16154. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16155. QStack<QLayout*> *layoutStack)
  16156. {
  16157. QLayout*targetLayout= layoutStack->pop();
  16158. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  16159. if(element.hasAttribute("type"))
  16160. {
  16161. /*205:*/
  16162. #line 4649 "./typica.w"
  16163. QLayout*layout;
  16164. QString layoutType= element.attribute("type");
  16165. if(layoutType=="horizontal")
  16166. {
  16167. layout= new QHBoxLayout;
  16168. layoutStack->push(layout);
  16169. populateBoxLayout(element,widgetStack,layoutStack);
  16170. }
  16171. else if(layoutType=="vertical")
  16172. {
  16173. layout= new QVBoxLayout;
  16174. layoutStack->push(layout);
  16175. populateBoxLayout(element,widgetStack,layoutStack);
  16176. }
  16177. else if(layoutType=="grid")
  16178. {
  16179. layout= new QGridLayout;
  16180. layoutStack->push(layout);
  16181. populateGridLayout(element,widgetStack,layoutStack);
  16182. }
  16183. else if(layoutType=="stack")
  16184. {
  16185. layout= new QStackedLayout;
  16186. layoutStack->push(layout);
  16187. populateStackedLayout(element,widgetStack,layoutStack);
  16188. }
  16189. if(element.hasAttribute("id"))
  16190. {
  16191. layout->setObjectName(element.attribute("id"));
  16192. }
  16193. if(element.hasAttribute("spacing"))
  16194. {
  16195. layout->setSpacing(element.attribute("spacing").toInt());
  16196. }
  16197. if(element.hasAttribute("margin"))
  16198. {
  16199. int m= element.attribute("margin").toInt();
  16200. layout->setContentsMargins(m,m,m,m);
  16201. }
  16202. /*:205*/
  16203. #line 4953 "./typica.w"
  16204. boxLayout->addLayout(layout);
  16205. layoutStack->pop();
  16206. }
  16207. layoutStack->push(targetLayout);
  16208. }
  16209. /*:210*//*211:*/
  16210. #line 4964 "./typica.w"
  16211. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16212. QStack<QLayout*> *layoutStack)
  16213. {
  16214. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16215. QSplitter*splitter= new(QSplitter);
  16216. layout->addWidget(splitter);
  16217. /*212:*/
  16218. #line 4977 "./typica.w"
  16219. QString orientation= element.attribute("type");
  16220. if(orientation=="horizontal")
  16221. {
  16222. splitter->setOrientation(Qt::Horizontal);
  16223. }
  16224. else if(orientation=="vertical")
  16225. {
  16226. splitter->setOrientation(Qt::Vertical);
  16227. }
  16228. QString id= element.attribute("id");
  16229. if(!id.isEmpty())
  16230. {
  16231. splitter->setObjectName(id);
  16232. }
  16233. if(element.hasChildNodes())
  16234. {
  16235. widgetStack->push(splitter);
  16236. populateSplitter(element,widgetStack,layoutStack);
  16237. widgetStack->pop();
  16238. }
  16239. /*:212*/
  16240. #line 4971 "./typica.w"
  16241. }
  16242. /*:211*//*213:*/
  16243. #line 5003 "./typica.w"
  16244. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16245. QStack<QLayout*> *layoutStack)
  16246. {
  16247. QDomNodeList children= element.childNodes();
  16248. for(int i= 0;i<children.count();i++)
  16249. {
  16250. QDomNode current;
  16251. QDomElement currentElement;
  16252. current= children.at(i);
  16253. if(current.isElement())
  16254. {
  16255. currentElement= current.toElement();
  16256. if(currentElement.tagName()=="decoration")
  16257. {
  16258. addDecorationToSplitter(currentElement,widgetStack,
  16259. layoutStack);
  16260. }
  16261. else if(currentElement.tagName()=="graph")
  16262. {
  16263. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  16264. }
  16265. else if(currentElement.tagName()=="splitter")
  16266. {
  16267. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  16268. }
  16269. else if(currentElement.tagName()=="lcdtemperature")
  16270. {
  16271. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  16272. layoutStack);
  16273. }
  16274. else if(currentElement.tagName()=="lcdtimer")
  16275. {
  16276. addTimerDisplayToSplitter(currentElement,widgetStack,
  16277. layoutStack);
  16278. }
  16279. else if(currentElement.tagName()=="measurementtable")
  16280. {
  16281. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  16282. }
  16283. else if(currentElement.tagName()=="widget")
  16284. {
  16285. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  16286. }
  16287. }
  16288. }
  16289. }
  16290. /*:213*//*214:*/
  16291. #line 5053 "./typica.w"
  16292. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16293. QStack<QLayout*> *layoutStack)
  16294. {
  16295. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  16296. QSplitter*splitter= new(QSplitter);
  16297. splitter->setParent(parent);
  16298. parent->addWidget(splitter);
  16299. /*212:*/
  16300. #line 4977 "./typica.w"
  16301. QString orientation= element.attribute("type");
  16302. if(orientation=="horizontal")
  16303. {
  16304. splitter->setOrientation(Qt::Horizontal);
  16305. }
  16306. else if(orientation=="vertical")
  16307. {
  16308. splitter->setOrientation(Qt::Vertical);
  16309. }
  16310. QString id= element.attribute("id");
  16311. if(!id.isEmpty())
  16312. {
  16313. splitter->setObjectName(id);
  16314. }
  16315. if(element.hasChildNodes())
  16316. {
  16317. widgetStack->push(splitter);
  16318. populateSplitter(element,widgetStack,layoutStack);
  16319. widgetStack->pop();
  16320. }
  16321. /*:212*/
  16322. #line 5061 "./typica.w"
  16323. }
  16324. /*:214*//*215:*/
  16325. #line 5070 "./typica.w"
  16326. void addTemperatureDisplayToSplitter(QDomElement element,
  16327. QStack<QWidget*> *widgetStack,
  16328. QStack<QLayout*> *)
  16329. {
  16330. TemperatureDisplay*display= new(TemperatureDisplay);
  16331. if(element.hasAttribute("id"))
  16332. {
  16333. display->setObjectName(element.attribute("id"));
  16334. }
  16335. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16336. splitter->addWidget(display);
  16337. }
  16338. void addTemperatureDisplayToLayout(QDomElement element,
  16339. QStack<QWidget*> *,
  16340. QStack<QLayout*> *layoutStack)
  16341. {
  16342. TemperatureDisplay*display= new(TemperatureDisplay);
  16343. if(element.hasAttribute("id"))
  16344. {
  16345. display->setObjectName(element.attribute("id"));
  16346. }
  16347. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16348. layout->addWidget(display);
  16349. }
  16350. /*:215*//*216:*/
  16351. #line 5101 "./typica.w"
  16352. void addTimerDisplayToSplitter(QDomElement element,
  16353. QStack<QWidget*> *widgetStack,
  16354. QStack<QLayout*> *)
  16355. {
  16356. TimerDisplay*display= new(TimerDisplay);
  16357. if(element.hasAttribute("id"))
  16358. {
  16359. display->setObjectName(element.attribute("id"));
  16360. }
  16361. if(element.hasAttribute("format"))
  16362. {
  16363. display->setDisplayFormat(element.attribute("format"));
  16364. }
  16365. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16366. splitter->addWidget(display);
  16367. }
  16368. void addTimerDisplayToLayout(QDomElement element,
  16369. QStack<QWidget*> *,
  16370. QStack<QLayout*> *layoutStack)
  16371. {
  16372. TimerDisplay*display= new(TimerDisplay);
  16373. if(element.hasAttribute("id"))
  16374. {
  16375. display->setObjectName(element.attribute("id"));
  16376. }
  16377. if(element.hasAttribute("format"))
  16378. {
  16379. display->setDisplayFormat(element.attribute("format"));
  16380. }
  16381. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16382. layout->addWidget(display);
  16383. }
  16384. /*:216*//*217:*/
  16385. #line 5139 "./typica.w"
  16386. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  16387. QStack<QLayout*> *layoutStack)
  16388. {
  16389. /*218:*/
  16390. #line 5160 "./typica.w"
  16391. QString labelText= element.attribute("name");
  16392. Qt::Orientations orientation= Qt::Horizontal;
  16393. if(element.hasAttribute("type"))
  16394. {
  16395. if(element.attribute("type")=="horizontal")
  16396. {
  16397. orientation= Qt::Horizontal;
  16398. }
  16399. else if(element.attribute("type")=="vertical")
  16400. {
  16401. orientation= Qt::Vertical;
  16402. }
  16403. }
  16404. /*219:*/
  16405. #line 5185 "./typica.w"
  16406. QWidget*theWidget= NULL;
  16407. QDomNodeList children= element.childNodes();
  16408. for(int i= 0;i<children.count();i++)
  16409. {
  16410. QDomNode item= children.at(i);
  16411. if(item.isElement())
  16412. {
  16413. QDomElement itemElement= item.toElement();
  16414. if(itemElement.tagName()=="lcdtemperature")
  16415. {
  16416. TemperatureDisplay*display= new TemperatureDisplay;
  16417. if(itemElement.hasAttribute("id"))
  16418. {
  16419. display->setObjectName(itemElement.attribute("id"));
  16420. }
  16421. theWidget= display;
  16422. }
  16423. else if(itemElement.tagName()=="lcdtimer")
  16424. {
  16425. TimerDisplay*display= new TimerDisplay;
  16426. if(itemElement.hasAttribute("id"))
  16427. {
  16428. display->setObjectName(itemElement.attribute("id"));
  16429. }
  16430. if(itemElement.hasAttribute("format"))
  16431. {
  16432. display->setDisplayFormat(itemElement.attribute("format"));
  16433. }
  16434. theWidget= display;
  16435. }
  16436. }
  16437. }
  16438. /*:219*/
  16439. #line 5174 "./typica.w"
  16440. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  16441. orientation);
  16442. if(element.hasAttribute("id"))
  16443. {
  16444. decoration->setObjectName(element.attribute("id"));
  16445. }
  16446. /*:218*/
  16447. #line 5143 "./typica.w"
  16448. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16449. layout->addWidget(decoration);
  16450. }
  16451. void addDecorationToSplitter(QDomElement element,
  16452. QStack<QWidget*> *widgetStack,
  16453. QStack<QLayout*> *)
  16454. {
  16455. /*218:*/
  16456. #line 5160 "./typica.w"
  16457. QString labelText= element.attribute("name");
  16458. Qt::Orientations orientation= Qt::Horizontal;
  16459. if(element.hasAttribute("type"))
  16460. {
  16461. if(element.attribute("type")=="horizontal")
  16462. {
  16463. orientation= Qt::Horizontal;
  16464. }
  16465. else if(element.attribute("type")=="vertical")
  16466. {
  16467. orientation= Qt::Vertical;
  16468. }
  16469. }
  16470. /*219:*/
  16471. #line 5185 "./typica.w"
  16472. QWidget*theWidget= NULL;
  16473. QDomNodeList children= element.childNodes();
  16474. for(int i= 0;i<children.count();i++)
  16475. {
  16476. QDomNode item= children.at(i);
  16477. if(item.isElement())
  16478. {
  16479. QDomElement itemElement= item.toElement();
  16480. if(itemElement.tagName()=="lcdtemperature")
  16481. {
  16482. TemperatureDisplay*display= new TemperatureDisplay;
  16483. if(itemElement.hasAttribute("id"))
  16484. {
  16485. display->setObjectName(itemElement.attribute("id"));
  16486. }
  16487. theWidget= display;
  16488. }
  16489. else if(itemElement.tagName()=="lcdtimer")
  16490. {
  16491. TimerDisplay*display= new TimerDisplay;
  16492. if(itemElement.hasAttribute("id"))
  16493. {
  16494. display->setObjectName(itemElement.attribute("id"));
  16495. }
  16496. if(itemElement.hasAttribute("format"))
  16497. {
  16498. display->setDisplayFormat(itemElement.attribute("format"));
  16499. }
  16500. theWidget= display;
  16501. }
  16502. }
  16503. }
  16504. /*:219*/
  16505. #line 5174 "./typica.w"
  16506. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  16507. orientation);
  16508. if(element.hasAttribute("id"))
  16509. {
  16510. decoration->setObjectName(element.attribute("id"));
  16511. }
  16512. /*:218*/
  16513. #line 5152 "./typica.w"
  16514. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16515. splitter->addWidget(decoration);
  16516. }
  16517. /*:217*//*220:*/
  16518. #line 5224 "./typica.w"
  16519. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16520. QStack<QLayout*> *layoutStack)
  16521. {
  16522. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16523. QWidget*widget= new QWidget;
  16524. if(element.hasAttribute("id"))
  16525. {
  16526. widget->setObjectName(element.attribute("id"));
  16527. }
  16528. splitter->addWidget(widget);
  16529. if(element.hasChildNodes())
  16530. {
  16531. widgetStack->push(widget);
  16532. populateWidget(element,widgetStack,layoutStack);
  16533. widgetStack->pop();
  16534. }
  16535. }
  16536. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  16537. QStack<QLayout*> *layoutStack)
  16538. {
  16539. QDomNodeList children= element.childNodes();
  16540. for(int i= 0;i<children.count();i++)
  16541. {
  16542. QDomNode current;
  16543. QDomElement currentElement;
  16544. current= children.at(i);
  16545. if(current.isElement())
  16546. {
  16547. currentElement= current.toElement();
  16548. if(currentElement.tagName()=="layout")
  16549. {
  16550. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  16551. }
  16552. }
  16553. }
  16554. }
  16555. /*:220*//*221:*/
  16556. #line 5267 "./typica.w"
  16557. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  16558. QStack<QLayout*> *layoutStack)
  16559. {
  16560. QAbstractButton*button= NULL;
  16561. QString text= element.attribute("name");
  16562. if(element.hasAttribute("type"))
  16563. {
  16564. QString type= element.attribute("type");
  16565. if(type=="annotation")
  16566. {
  16567. AnnotationButton*abutton= new AnnotationButton(text);
  16568. if(element.hasAttribute("annotation"))
  16569. {
  16570. abutton->setAnnotation(element.attribute("annotation"));
  16571. }
  16572. if(element.hasAttribute("series"))
  16573. {
  16574. abutton->setTemperatureColumn(element.attribute("series").
  16575. toInt());
  16576. }
  16577. if(element.hasAttribute("column"))
  16578. {
  16579. abutton->setAnnotationColumn(element.attribute("column").
  16580. toInt());
  16581. }
  16582. button= abutton;
  16583. }
  16584. else if(type=="check")
  16585. {
  16586. button= new QCheckBox(text);
  16587. }
  16588. else if(type=="push")
  16589. {
  16590. button= new QPushButton(text);
  16591. }
  16592. }
  16593. if(element.hasAttribute("id"))
  16594. {
  16595. button->setObjectName(element.attribute("id"));
  16596. }
  16597. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16598. layout->addWidget(button);
  16599. }
  16600. /*:221*//*222:*/
  16601. #line 5319 "./typica.w"
  16602. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  16603. QStack<QLayout*> *layoutStack)
  16604. {
  16605. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  16606. if(element.hasAttribute("pretext"))
  16607. {
  16608. box->setPretext(element.attribute("pretext"));
  16609. }
  16610. if(element.hasAttribute("posttext"))
  16611. {
  16612. box->setPosttext(element.attribute("posttext"));
  16613. }
  16614. if(element.hasAttribute("series"))
  16615. {
  16616. box->setTemperatureColumn(element.attribute("series").toInt());
  16617. }
  16618. if(element.hasAttribute("column"))
  16619. {
  16620. box->setAnnotationColumn(element.attribute("column").toInt());
  16621. }
  16622. if(element.hasAttribute("min"))
  16623. {
  16624. box->setMinimum(element.attribute("min").toDouble());
  16625. }
  16626. if(element.hasAttribute("max"))
  16627. {
  16628. box->setMaximum(element.attribute("max").toDouble());
  16629. }
  16630. if(element.hasAttribute("decimals"))
  16631. {
  16632. box->setDecimals(element.attribute("decimals").toInt());
  16633. }
  16634. if(element.hasAttribute("step"))
  16635. {
  16636. box->setSingleStep(element.attribute("step").toDouble());
  16637. }
  16638. if(element.hasAttribute("id"))
  16639. {
  16640. box->setObjectName(element.attribute("id"));
  16641. }
  16642. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16643. layout->addWidget(box);
  16644. }
  16645. /*:222*//*223:*/
  16646. #line 5375 "./typica.w"
  16647. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16648. QStack<QLayout*> *)
  16649. {
  16650. ZoomLog*widget= new ZoomLog;
  16651. if(!widget)
  16652. {
  16653. qDebug()<<"Error constructing widget!";
  16654. }
  16655. if(element.hasAttribute("id"))
  16656. {
  16657. widget->setObjectName(element.attribute("id"));
  16658. }
  16659. if(element.hasChildNodes())
  16660. {
  16661. QDomNodeList children= element.childNodes();
  16662. int column= 0;
  16663. for(int i= 0;i<children.count();i++)
  16664. {
  16665. QDomNode current;
  16666. QDomElement currentElement;
  16667. current= children.at(i);
  16668. if(current.isElement())
  16669. {
  16670. currentElement= current.toElement();
  16671. if(currentElement.tagName()=="column")
  16672. {
  16673. QString text= currentElement.text();
  16674. widget->setHeaderData(column,text);
  16675. column++;
  16676. }
  16677. }
  16678. }
  16679. }
  16680. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16681. if(splitter)
  16682. {
  16683. splitter->addWidget(widget);
  16684. }
  16685. else
  16686. {
  16687. qDebug()<<"Splitter not found at top of widget stack!";
  16688. }
  16689. }
  16690. /*:223*//*224:*/
  16691. #line 5423 "./typica.w"
  16692. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16693. QStack<QLayout*> *)
  16694. {
  16695. GraphView*view= new GraphView;
  16696. if(element.hasAttribute("id"))
  16697. {
  16698. view->setObjectName(element.attribute("id"));
  16699. }
  16700. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16701. splitter->addWidget(view);
  16702. }
  16703. /*:224*//*225:*/
  16704. #line 5440 "./typica.w"
  16705. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  16706. QStack<QLayout*> *layoutStack)
  16707. {
  16708. SqlComboBox*box= new SqlComboBox();
  16709. if(element.hasAttribute("data"))
  16710. {
  16711. box->setDataColumn(element.attribute("data").toInt());
  16712. }
  16713. if(element.hasAttribute("display"))
  16714. {
  16715. box->setDisplayColumn(element.attribute("display").toInt());
  16716. }
  16717. if(element.hasAttribute("showdata"))
  16718. {
  16719. if(element.attribute("showdata")=="true")
  16720. {
  16721. box->showData(true);
  16722. }
  16723. }
  16724. if(element.hasAttribute("editable"))
  16725. {
  16726. if(element.attribute("editable")=="true")
  16727. {
  16728. box->setEditable(true);
  16729. }
  16730. }
  16731. if(element.hasChildNodes())
  16732. {
  16733. QDomNodeList children= element.childNodes();
  16734. for(int i= 0;i<children.count();i++)
  16735. {
  16736. QDomNode current;
  16737. QDomElement currentElement;
  16738. current= children.at(i);
  16739. if(current.isElement())
  16740. {
  16741. currentElement= current.toElement();
  16742. if(currentElement.tagName()=="null")
  16743. {
  16744. box->addNullOption();
  16745. }
  16746. else if(currentElement.tagName()=="query")
  16747. {
  16748. box->addSqlOptions(currentElement.text());
  16749. }
  16750. }
  16751. }
  16752. }
  16753. if(element.hasAttribute("id"))
  16754. {
  16755. box->setObjectName(element.attribute("id"));
  16756. }
  16757. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16758. layout->addWidget(box);
  16759. }
  16760. /*:225*//*226:*/
  16761. #line 5519 "./typica.w"
  16762. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  16763. QStack<QLayout*> *layoutStack)
  16764. {
  16765. QTableView*view= new QTableView;
  16766. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  16767. SaltModel*model= new SaltModel(element.childNodes().count());
  16768. if(element.hasAttribute("id"))
  16769. {
  16770. view->setObjectName(element.attribute("id"));
  16771. }
  16772. if(element.hasChildNodes())
  16773. {
  16774. QDomNodeList children= element.childNodes();
  16775. int currentColumn= 0;
  16776. for(int i= 0;i<children.count();i++)
  16777. {
  16778. QDomNode current;
  16779. QDomElement currentElement;
  16780. current= children.at(i);
  16781. if(current.isElement())
  16782. {
  16783. currentElement= current.toElement();
  16784. if(currentElement.tagName()=="column")
  16785. {
  16786. if(currentElement.hasAttribute("name"))
  16787. {
  16788. model->setHeaderData(currentColumn,Qt::Horizontal,
  16789. currentElement.attribute("name"));
  16790. }
  16791. if(currentElement.hasAttribute("delegate"))
  16792. {
  16793. /*227:*/
  16794. #line 5567 "./typica.w"
  16795. if(currentElement.attribute("delegate")=="sql")
  16796. {
  16797. /*228:*/
  16798. #line 5583 "./typica.w"
  16799. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  16800. SqlComboBox*widget= new SqlComboBox();
  16801. if(currentElement.hasAttribute("nulltext"))
  16802. {
  16803. widget->setNullText(currentElement.attribute("nulltext"));
  16804. }
  16805. if(currentElement.hasAttribute("nulldata"))
  16806. {
  16807. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  16808. }
  16809. if(currentElement.hasAttribute("null"))
  16810. {
  16811. if(currentElement.attribute("null")=="true")
  16812. {
  16813. widget->addNullOption();
  16814. }
  16815. }
  16816. if(currentElement.hasAttribute("showdata"))
  16817. {
  16818. if(currentElement.attribute("showdata")=="true")
  16819. {
  16820. widget->showData(true);
  16821. }
  16822. }
  16823. if(currentElement.hasAttribute("data"))
  16824. {
  16825. widget->setDataColumn(currentElement.attribute("data").toInt());
  16826. }
  16827. if(currentElement.hasAttribute("display"))
  16828. {
  16829. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  16830. }
  16831. widget->addSqlOptions(currentElement.text());
  16832. delegate->setWidget(widget);
  16833. view->setItemDelegateForColumn(currentColumn,delegate);
  16834. /*:228*/
  16835. #line 5570 "./typica.w"
  16836. }
  16837. else if(currentElement.attribute("delegate")=="numeric")
  16838. {
  16839. /*229:*/
  16840. #line 5624 "./typica.w"
  16841. NumericDelegate*delegate= new NumericDelegate;
  16842. view->setItemDelegateForColumn(currentColumn,delegate);
  16843. /*:229*/
  16844. #line 5574 "./typica.w"
  16845. }
  16846. /*:227*/
  16847. #line 5551 "./typica.w"
  16848. }
  16849. currentColumn++;
  16850. }
  16851. }
  16852. }
  16853. }
  16854. view->setModel(model);
  16855. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16856. layout->addWidget(view);
  16857. }
  16858. /*:226*//*241:*/
  16859. #line 5797 "./typica.w"
  16860. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  16861. QStack<QLayout*> *layoutStack)
  16862. {
  16863. QLineEdit*widget= new QLineEdit(element.text());
  16864. if(element.hasAttribute("id"))
  16865. {
  16866. widget->setObjectName(element.attribute("id"));
  16867. }
  16868. if(element.hasAttribute("writable"))
  16869. {
  16870. if(element.attribute("writable")=="false")
  16871. {
  16872. widget->setReadOnly(true);
  16873. }
  16874. }
  16875. if(element.hasAttribute("validator"))
  16876. {
  16877. if(element.attribute("validator")=="numeric")
  16878. {
  16879. widget->setValidator(new ScriptValidator(new QDoubleValidator));
  16880. }
  16881. else if(element.attribute("validator")=="integer")
  16882. {
  16883. widget->setValidator(new ScriptValidator(new QIntValidator));
  16884. }
  16885. else if(element.attribute("validator")=="expression"&&
  16886. element.hasAttribute("expression"))
  16887. {
  16888. widget->setValidator(new QRegExpValidator(
  16889. QRegExp(element.attribute("expression")),
  16890. NULL));
  16891. }
  16892. }
  16893. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16894. layout->addWidget(widget);
  16895. }
  16896. /*:241*//*242:*/
  16897. #line 5838 "./typica.w"
  16898. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  16899. QStack<QLayout*> *layoutStack)
  16900. {
  16901. QTextEdit*widget= new QTextEdit;
  16902. if(element.hasAttribute("id"))
  16903. {
  16904. widget->setObjectName(element.attribute("id"));
  16905. }
  16906. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16907. layout->addWidget(widget);
  16908. }
  16909. /*:242*//*243:*/
  16910. #line 5855 "./typica.w"
  16911. void addSqlQueryViewToLayout(QDomElement element,
  16912. QStack<QWidget*> *,
  16913. QStack<QLayout*> *layoutStack)
  16914. {
  16915. SqlQueryView*view= new SqlQueryView;
  16916. if(element.hasAttribute("id"))
  16917. {
  16918. view->setObjectName(element.attribute("id"));
  16919. }
  16920. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16921. layout->addWidget(view);
  16922. }
  16923. /*:243*//*244:*/
  16924. #line 5872 "./typica.w"
  16925. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  16926. QStack<QLayout*> *layoutStack)
  16927. {
  16928. QWidget*widget;
  16929. if(element.hasAttribute("time"))
  16930. {
  16931. if(element.attribute("time")=="true")
  16932. {
  16933. QDateTimeEdit*edit= new QDateTimeEdit;
  16934. edit->setDateTime(QDateTime::currentDateTime());
  16935. edit->setCalendarPopup(true);
  16936. edit->setDisplayFormat("yyyy-MM-dd hh:mm:ss");
  16937. widget= qobject_cast<QWidget*> (edit);
  16938. }
  16939. else
  16940. {
  16941. QDateEdit*edit= new QDateEdit;
  16942. edit->setDate(QDate::currentDate());
  16943. edit->setCalendarPopup(true);
  16944. edit->setDisplayFormat("yyyy-MM-dd");
  16945. widget= qobject_cast<QWidget*> (edit);
  16946. }
  16947. }
  16948. else
  16949. {
  16950. QDateEdit*edit= new QDateEdit;
  16951. edit->setDate(QDate::currentDate());
  16952. edit->setCalendarPopup(true);
  16953. edit->setDisplayFormat("yyyy-MM-dd");
  16954. widget= qobject_cast<QWidget*> (edit);
  16955. }
  16956. if(element.hasAttribute("id"))
  16957. {
  16958. widget->setObjectName(element.attribute("id"));
  16959. }
  16960. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16961. layout->addWidget(widget);
  16962. }
  16963. /*:244*//*245:*/
  16964. #line 5915 "./typica.w"
  16965. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  16966. {
  16967. setQDateTimeEditProperties(value,engine);
  16968. }
  16969. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  16970. {
  16971. setQAbstractSpinBoxProperties(value,engine);
  16972. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  16973. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  16974. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  16975. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  16976. }
  16977. /*:245*//*246:*/
  16978. #line 5935 "./typica.w"
  16979. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  16980. {
  16981. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  16982. if(context->argumentCount()==3)
  16983. {
  16984. self->setDate(QDate(argument<int> (0,context),
  16985. argument<int> (1,context),
  16986. argument<int> (2,context)));
  16987. }
  16988. else
  16989. {
  16990. context->throwError("Incorrect number of arguments passed to "
  16991. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  16992. "specifying the year, month, and day.");
  16993. }
  16994. return QScriptValue();
  16995. }
  16996. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  16997. {
  16998. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  16999. return QScriptValue(self->date().day());
  17000. }
  17001. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  17002. {
  17003. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17004. return QScriptValue(self->date().month());
  17005. }
  17006. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  17007. {
  17008. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17009. return QScriptValue(self->date().year());
  17010. }
  17011. /*:246*//*250:*/
  17012. #line 6002 "./typica.w"
  17013. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  17014. {
  17015. QObject*parent= argument<QObject*> (0,context);
  17016. QString name= argument<QString> (1,context);
  17017. QObject*object= parent->findChild<QObject*> (name);
  17018. QScriptValue value;
  17019. if(object)
  17020. {
  17021. value= engine->newQObject(object);
  17022. QString className= object->metaObject()->className();
  17023. /*251:*/
  17024. #line 6020 "./typica.w"
  17025. if(className=="TemperatureDisplay")
  17026. {
  17027. setTemperatureDisplayProperties(value,engine);
  17028. }
  17029. else if(className=="TimerDisplay")
  17030. {
  17031. setTimerDisplayProperties(value,engine);
  17032. }
  17033. else if(className=="QAction")
  17034. {
  17035. setQActionProperties(value,engine);
  17036. }
  17037. else if(className=="QBoxLayout")
  17038. {
  17039. setQBoxLayoutProperties(value,engine);
  17040. }
  17041. else if(className=="QDateEdit")
  17042. {
  17043. setQDateEditProperties(value,engine);
  17044. }
  17045. else if(className=="QDateTimeEdit")
  17046. {
  17047. setQDateTimeEditProperties(value,engine);
  17048. }
  17049. else if(className=="QFrame")
  17050. {
  17051. setQFrameProperties(value,engine);
  17052. }
  17053. else if(className=="QHBoxLayout")
  17054. {
  17055. setQBoxLayoutProperties(value,engine);
  17056. }
  17057. else if(className=="QLCDNumber")
  17058. {
  17059. setQLCDNumberProperties(value,engine);
  17060. }
  17061. else if(className=="QMenu")
  17062. {
  17063. setQMenuProperties(value,engine);
  17064. }
  17065. else if(className=="QMenuBar")
  17066. {
  17067. setQMenuBarProperties(value,engine);
  17068. }
  17069. else if(className=="QPushButton")
  17070. {
  17071. setQPushButtonProperties(value,engine);
  17072. }
  17073. else if(className=="QSplitter")
  17074. {
  17075. setQSplitterProperties(value,engine);
  17076. }
  17077. else if(className=="QTableView")
  17078. {
  17079. if(object->property("tabletype").isValid())
  17080. {
  17081. if(object->property("tabletype").toString()=="SaltTable")
  17082. {
  17083. setSaltTableProperties(value,engine);
  17084. }
  17085. }
  17086. }
  17087. else if(className=="QVBoxLayout")
  17088. {
  17089. setQBoxLayoutProperties(value,engine);
  17090. }
  17091. else if(className=="QWidget")
  17092. {
  17093. setQWidgetProperties(value,engine);
  17094. }
  17095. else if(className=="ScriptQMainWindow")
  17096. {
  17097. setQMainWindowProperties(value,engine);
  17098. }
  17099. else if(className=="SqlComboBox")
  17100. {
  17101. setSqlComboBoxProperties(value,engine);
  17102. }
  17103. else if(className=="SqlQueryView")
  17104. {
  17105. setSqlQueryViewProperties(value,engine);
  17106. }
  17107. else if(className=="ZoomLog")
  17108. {
  17109. setZoomLogProperties(value,engine);
  17110. }
  17111. else if(className=="QTextEdit")
  17112. {
  17113. setQTextEditProperties(value,engine);
  17114. }
  17115. else if(className=="QWebView")
  17116. {
  17117. setQWebViewProperties(value,engine);
  17118. }
  17119. else if(className=="QLineEdit")
  17120. {
  17121. setQLineEditProperties(value,engine);
  17122. }
  17123. /*:251*/
  17124. #line 6013 "./typica.w"
  17125. }
  17126. return value;
  17127. }
  17128. /*:250*//*253:*/
  17129. #line 6149 "./typica.w"
  17130. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  17131. {
  17132. QTableView*self= getself<QTableView*> (context);
  17133. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17134. QString datum;
  17135. double total= 0.0;
  17136. int column= argument<int> (0,context);
  17137. int role= argument<int> (1,context);
  17138. for(int i= 0;i<model->rowCount();i++)
  17139. {
  17140. datum= model->data(model->index(i,column),role).toString();
  17141. if(!datum.isEmpty())
  17142. {
  17143. total+= datum.toDouble();
  17144. }
  17145. }
  17146. return QScriptValue(engine,total);
  17147. }
  17148. /*:253*//*254:*/
  17149. #line 6173 "./typica.w"
  17150. QScriptValue SaltTable_columnArray(QScriptContext*context,
  17151. QScriptEngine*engine)
  17152. {
  17153. QTableView*self= getself<QTableView*> (context);
  17154. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17155. int column= argument<int> (0,context);
  17156. int role= argument<int> (1,context);
  17157. QString literal= model->arrayLiteral(column,role);
  17158. return QScriptValue(engine,literal);
  17159. }
  17160. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  17161. QScriptEngine*engine)
  17162. {
  17163. QTableView*self= getself<QTableView*> (context);
  17164. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17165. int column= argument<int> (0,context);
  17166. int role= argument<int> (1,context);
  17167. QString literal= model->quotedArrayLiteral(column,role);
  17168. return QScriptValue(engine,literal);
  17169. }
  17170. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  17171. QScriptEngine*engine)
  17172. {
  17173. QTableView*self= getself<QTableView*> (context);
  17174. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17175. int column= argument<int> (0,context);
  17176. int role= argument<int> (1,context);
  17177. QString literal= model->arrayLiteral(column,role);
  17178. literal.chop(1);
  17179. literal= literal.remove(0,1);
  17180. return QScriptValue(engine,literal);
  17181. }
  17182. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  17183. QScriptEngine*engine)
  17184. {
  17185. QTableView*self= getself<QTableView*> (context);
  17186. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17187. int column= argument<int> (0,context);
  17188. int role= argument<int> (1,context);
  17189. QString literal= model->quotedArrayLiteral(column,role);
  17190. literal.chop(1);
  17191. literal= literal.remove(0,1);
  17192. return QScriptValue(engine,literal);
  17193. }
  17194. /*:254*//*255:*/
  17195. #line 6225 "./typica.w"
  17196. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  17197. {
  17198. QTableView*self= getself<QTableView*> (context);
  17199. QScriptValue value= engine->newQObject(self->model());
  17200. return value;
  17201. }
  17202. /*:255*//*256:*/
  17203. #line 6239 "./typica.w"
  17204. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  17205. {
  17206. QTableView*self= getself<QTableView*> (context);
  17207. int row= argument<int> (0,context);
  17208. int column= argument<int> (1,context);
  17209. QVariant value= argument<QVariant> (2,context);
  17210. int role= argument<int> (3,context);
  17211. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17212. QModelIndex cell= model->index(row,column);
  17213. model->setData(cell,value,role);
  17214. self->update(cell);
  17215. return QScriptValue();
  17216. }
  17217. /*:256*//*257:*/
  17218. #line 6257 "./typica.w"
  17219. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  17220. {
  17221. QTableView*self= getself<QTableView*> (context);
  17222. int row= argument<int> (0,context);
  17223. int column= argument<int> (1,context);
  17224. int role= argument<int> (2,context);
  17225. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17226. QModelIndex cell= model->index(row,column);
  17227. QVariant value= model->data(cell,role);
  17228. QScriptValue retval= engine->newVariant(value);
  17229. retval.setProperty("value",QScriptValue(value.toString()));
  17230. return retval;
  17231. }
  17232. /*:257*//*258:*/
  17233. #line 6277 "./typica.w"
  17234. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  17235. {
  17236. QTableView*self= getself<QTableView*> (context);
  17237. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17238. model->clear();
  17239. return QScriptValue();
  17240. }
  17241. /*:258*//*259:*/
  17242. #line 6289 "./typica.w"
  17243. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  17244. {
  17245. QTableView*self= getself<QTableView*> (context);
  17246. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17247. int row= argument<int> (0,context);
  17248. return engine->newVariant(model->removeRow(row));
  17249. }
  17250. /*:259*//*260:*/
  17251. #line 6302 "./typica.w"
  17252. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  17253. {
  17254. QTableView*self= getself<QTableView*> (context);
  17255. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17256. QVariant value= argument<QVariant> (0,context);
  17257. int column= argument<int> (1,context);
  17258. return engine->newVariant(model->findData(value,column));
  17259. }
  17260. /*:260*//*261:*/
  17261. #line 6315 "./typica.w"
  17262. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  17263. {
  17264. setQWidgetProperties(value,engine);
  17265. value.setProperty("columnArray",
  17266. engine->newFunction(SaltTable_columnArray));
  17267. value.setProperty("quotedColumnArray",
  17268. engine->newFunction(SaltTable_quotedColumnArray));
  17269. value.setProperty("bindableColumnArray",
  17270. engine->newFunction(SaltTable_bindableColumnArray));
  17271. value.setProperty("bindableQuotedColumnArray",
  17272. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  17273. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  17274. value.setProperty("data",engine->newFunction(SaltTable_data));
  17275. value.setProperty("model",engine->newFunction(SaltTable_model));
  17276. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  17277. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  17278. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  17279. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  17280. }
  17281. /*:261*//*263:*/
  17282. #line 6352 "./typica.w"
  17283. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  17284. {
  17285. setQComboBoxProperties(value,engine);
  17286. }
  17287. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  17288. {
  17289. setQWidgetProperties(value,engine);
  17290. value.setProperty("currentData",
  17291. engine->newFunction(QComboBox_currentData));
  17292. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  17293. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  17294. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  17295. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  17296. }
  17297. QScriptValue QComboBox_currentData(QScriptContext*context,
  17298. QScriptEngine*engine)
  17299. {
  17300. QComboBox*self= getself<QComboBox*> (context);
  17301. return QScriptValue(engine,
  17302. self->itemData(self->currentIndex()).toString());
  17303. }
  17304. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  17305. {
  17306. QComboBox*self= getself<QComboBox*> (context);
  17307. self->addItem(argument<QString> (0,context));
  17308. return QScriptValue();
  17309. }
  17310. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  17311. {
  17312. QComboBox*self= getself<QComboBox*> (context);
  17313. self->setModel(argument<QAbstractItemModel*> (0,context));
  17314. return QScriptValue();
  17315. }
  17316. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  17317. {
  17318. QComboBox*self= getself<QComboBox*> (context);
  17319. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  17320. }
  17321. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  17322. {
  17323. QComboBox*self= getself<QComboBox*> (context);
  17324. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  17325. }
  17326. #line 1 "./abouttypica.w"
  17327. /*:263*//*276:*/
  17328. #line 401 "./units.w"
  17329. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
  17330. {
  17331. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  17332. argument<Units::Unit> (1,context),
  17333. argument<Units::Unit> (2,context)));
  17334. }
  17335. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  17336. QScriptEngine*)
  17337. {
  17338. return QScriptValue(Units::convertRelativeTemperature(
  17339. argument<double> (0,context),
  17340. argument<Units::Unit> (1,context),
  17341. argument<Units::Unit> (2,context)));
  17342. }
  17343. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
  17344. {
  17345. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  17346. }
  17347. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
  17348. {
  17349. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  17350. argument<Units::Unit> (1,context),
  17351. argument<Units::Unit> (2,context)));
  17352. }
  17353. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
  17354. {
  17355. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  17356. }
  17357. /*:276*//*279:*/
  17358. #line 449 "./units.w"
  17359. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  17360. {
  17361. return engine->newVariant(QVariant(value));
  17362. }
  17363. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  17364. {
  17365. value= sv.toVariant().value<Units::Unit> ();
  17366. }
  17367. /*:279*//*289:*/
  17368. #line 149 "./measurement.w"
  17369. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine)
  17370. {
  17371. QScriptValue object;
  17372. if(context->argumentCount()==2||context->argumentCount()==3)
  17373. {
  17374. double measurement= argument<double> (0,context);
  17375. QTime timestamp= argument<QTime> (1,context);
  17376. Units::Unit unit= Units::Fahrenheit;
  17377. if(context->argumentCount()==3)
  17378. {
  17379. unit= argument<Units::Unit> (2,context);
  17380. }
  17381. object= engine->toScriptValue<Measurement> (Measurement(measurement,timestamp,unit));
  17382. setMeasurementProperties(object,engine);
  17383. }
  17384. else
  17385. {
  17386. context->throwError("Incorrect number of arguments passed to "
  17387. "Measurement::Measurement(). This method takes two "
  17388. "or three arguments.");
  17389. }
  17390. return object;
  17391. }
  17392. /*:289*//*290:*/
  17393. #line 176 "./measurement.w"
  17394. void setMeasurementProperties(QScriptValue,QScriptEngine*)
  17395. {
  17396. }
  17397. /*:290*//*291:*/
  17398. #line 184 "./measurement.w"
  17399. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement)
  17400. {
  17401. QVariant var;
  17402. var.setValue(measurement);
  17403. return engine->newVariant(var);
  17404. }
  17405. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement)
  17406. {
  17407. measurement= value.toVariant().value<Measurement> ();
  17408. }
  17409. #line 6421 "./typica.w"
  17410. /*:291*//*309:*/
  17411. #line 6999 "./typica.w"
  17412. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  17413. {
  17414. QScriptValue object;
  17415. if(context->argumentCount()==1)
  17416. {
  17417. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  17418. QScriptEngine::ScriptOwnership);
  17419. setDAQProperties(object,engine);
  17420. }
  17421. else if(context->argumentCount()==2)
  17422. {
  17423. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  17424. argument<QString> (1,context)),
  17425. QScriptEngine::ScriptOwnership);
  17426. setDAQProperties(object,engine);
  17427. }
  17428. else
  17429. {
  17430. context->throwError("Incorrect number of arguments passed to DAQ"
  17431. "constructor. The DAQ constructor takes one"
  17432. "string as an argument specifying a device name."
  17433. "Example: Dev1");
  17434. }
  17435. return object;
  17436. }
  17437. /*:309*//*310:*/
  17438. #line 7029 "./typica.w"
  17439. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  17440. {
  17441. setQObjectProperties(value,engine);
  17442. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  17443. }
  17444. /*:310*//*311:*/
  17445. #line 7039 "./typica.w"
  17446. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  17447. {
  17448. DAQ*self= getself<DAQ*> (context);
  17449. QScriptValue object;
  17450. if(self)
  17451. {
  17452. object=
  17453. engine->newQObject(self->newChannel(argument<int> (0,context),
  17454. argument<int> (1,context)));
  17455. setChannelProperties(object,engine);
  17456. }
  17457. return object;
  17458. }
  17459. /*:311*//*318:*/
  17460. #line 7195 "./typica.w"
  17461. QScriptValue constructFakeDAQ(QScriptContext*context,
  17462. QScriptEngine*engine)
  17463. {
  17464. QScriptValue object;
  17465. if(context->argumentCount()==1)
  17466. {
  17467. object=
  17468. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  17469. QScriptEngine::ScriptOwnership);
  17470. setFakeDAQProperties(object,engine);
  17471. }
  17472. else
  17473. {
  17474. context->throwError("Incorrect number of arguments passed to DAQ"
  17475. "constructor. The DAQ constructor takes one"
  17476. "string as an argument specifying a device name."
  17477. "Example: Dev1");
  17478. }
  17479. return object;
  17480. }
  17481. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  17482. {
  17483. setQObjectProperties(value,engine);
  17484. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  17485. }
  17486. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  17487. {
  17488. FakeDAQ*self= getself<FakeDAQ*> (context);
  17489. QScriptValue object;
  17490. if(self)
  17491. {
  17492. object=
  17493. engine->newQObject(self->newChannel(argument<int> (0,context),
  17494. argument<int> (1,context)));
  17495. setChannelProperties(object,engine);
  17496. }
  17497. return object;
  17498. }
  17499. /*:318*//*322:*/
  17500. #line 7286 "./typica.w"
  17501. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  17502. {
  17503. setQObjectProperties(value,engine);
  17504. }
  17505. /*:322*//*329:*/
  17506. #line 7478 "./typica.w"
  17507. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  17508. {
  17509. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  17510. setLinearCalibratorProperties(object,engine);
  17511. return object;
  17512. }
  17513. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  17514. {
  17515. setQObjectProperties(value,engine);
  17516. }
  17517. /*:329*//*334:*/
  17518. #line 7616 "./typica.w"
  17519. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  17520. {
  17521. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  17522. setLinearSplineInterpolatorProperties(object,engine);
  17523. return object;
  17524. }
  17525. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  17526. {
  17527. setQObjectProperties(value,engine);
  17528. }
  17529. /*:334*//*344:*/
  17530. #line 7825 "./typica.w"
  17531. QScriptValue constructTemperatureDisplay(QScriptContext*,
  17532. QScriptEngine*engine)
  17533. {
  17534. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  17535. setTemperatureDisplayProperties(object,engine);
  17536. return object;
  17537. }
  17538. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  17539. {
  17540. setQLCDNumberProperties(value,engine);
  17541. value.setProperty("setDisplayUnits",
  17542. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  17543. }
  17544. /*:344*//*345:*/
  17545. #line 7849 "./typica.w"
  17546. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  17547. {
  17548. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  17549. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  17550. return QScriptValue();
  17551. }
  17552. /*:345*//*352:*/
  17553. #line 7986 "./typica.w"
  17554. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  17555. QScriptEngine*engine)
  17556. {
  17557. QScriptValue object=
  17558. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  17559. setMeasurementTimeOffsetProperties(object,engine);
  17560. return object;
  17561. }
  17562. void setMeasurementTimeOffsetProperties(QScriptValue value,
  17563. QScriptEngine*engine)
  17564. {
  17565. setQObjectProperties(value,engine);
  17566. }
  17567. /*:352*//*357:*/
  17568. #line 8095 "./typica.w"
  17569. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  17570. {
  17571. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  17572. return object;
  17573. }
  17574. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  17575. {
  17576. setQObjectProperties(value,engine);
  17577. }
  17578. /*:357*//*362:*/
  17579. #line 8192 "./typica.w"
  17580. QScriptValue constructZeroEmitter(QScriptContext*context,
  17581. QScriptEngine*engine)
  17582. {
  17583. QScriptValue object=
  17584. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  17585. setZeroEmitterProperties(object,engine);
  17586. return object;
  17587. }
  17588. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  17589. {
  17590. setQObjectProperties(value,engine);
  17591. }
  17592. /*:362*//*367:*/
  17593. #line 8272 "./typica.w"
  17594. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  17595. QScriptEngine*engine)
  17596. {
  17597. QScriptValue object=
  17598. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  17599. setMeasurementAdapterProperties(object,engine);
  17600. return object;
  17601. }
  17602. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  17603. {
  17604. setQObjectProperties(value,engine);
  17605. }
  17606. /*:367*//*384:*/
  17607. #line 8734 "./typica.w"
  17608. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  17609. {
  17610. QScriptValue object= engine->newQObject(new GraphView);
  17611. setGraphViewProperties(object,engine);
  17612. return object;
  17613. }
  17614. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  17615. {
  17616. setQGraphicsViewProperties(value,engine);
  17617. }
  17618. /*:384*//*407:*/
  17619. #line 9372 "./typica.w"
  17620. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  17621. {
  17622. QScriptValue object= engine->newQObject(new ZoomLog);
  17623. setZoomLogProperties(object,engine);
  17624. return object;
  17625. }
  17626. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  17627. {
  17628. setQTableViewProperties(value,engine);
  17629. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  17630. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  17631. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  17632. value.setProperty("restoreState",
  17633. engine->newFunction(ZoomLog_restoreState));
  17634. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  17635. value.setProperty("saveTemporary",
  17636. engine->newFunction(ZoomLog_saveTemporary));
  17637. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  17638. }
  17639. /*:407*//*408:*/
  17640. #line 9399 "./typica.w"
  17641. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  17642. {
  17643. ZoomLog*self= getself<ZoomLog*> (context);
  17644. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  17645. return QScriptValue(engine,retval);
  17646. }
  17647. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  17648. {
  17649. ZoomLog*self= getself<ZoomLog*> (context);
  17650. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  17651. return QScriptValue(engine,retval);
  17652. }
  17653. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  17654. QScriptEngine*engine)
  17655. {
  17656. ZoomLog*self= getself<ZoomLog*> (context);
  17657. QString filename= QDir::tempPath();
  17658. filename.append("/");
  17659. filename.append(QUuid::createUuid().toString());
  17660. filename.append(".xml");
  17661. QFile*file= new QFile(filename);
  17662. self->saveXML(file);
  17663. file->close();
  17664. delete file;
  17665. return QScriptValue(engine,filename);
  17666. }
  17667. /*:408*//*409:*/
  17668. #line 9447 "./typica.w"
  17669. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  17670. {
  17671. ZoomLog*self= getself<ZoomLog*> (context);
  17672. QString key= argument<QString> (0,context);
  17673. int columns= argument<int> (1,context);
  17674. QSettings settings;
  17675. for(int i= 0;i<columns;i++)
  17676. {
  17677. if(self->columnWidth(i))
  17678. {
  17679. settings.beginGroup(key);
  17680. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  17681. settings.endGroup();
  17682. }
  17683. }
  17684. return QScriptValue();
  17685. }
  17686. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  17687. {
  17688. ZoomLog*self= getself<ZoomLog*> (context);
  17689. QString key= argument<QString> (0,context);
  17690. int columns= argument<int> (1,context);
  17691. QSettings settings;
  17692. for(int i= 0;i<columns;i++)
  17693. {
  17694. settings.beginGroup(key);
  17695. self->setColumnWidth(i,
  17696. settings.value(QString("%1").arg(i),80).toInt());
  17697. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  17698. {
  17699. self->setColumnWidth(i,80);
  17700. }
  17701. settings.endGroup();
  17702. }
  17703. return QScriptValue();
  17704. }
  17705. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  17706. {
  17707. ZoomLog*self= getself<ZoomLog*> (context);
  17708. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  17709. }
  17710. /*:409*//*410:*/
  17711. #line 9500 "./typica.w"
  17712. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  17713. {
  17714. ZoomLog*self= getself<ZoomLog*> (context);
  17715. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  17716. return QScriptValue();
  17717. }
  17718. /*:410*//*445:*/
  17719. #line 10320 "./typica.w"
  17720. QScriptValue constructAnnotationButton(QScriptContext*context,
  17721. QScriptEngine*engine)
  17722. {
  17723. QScriptValue object=
  17724. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  17725. setAnnotationButtonProperties(object,engine);
  17726. return object;
  17727. }
  17728. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  17729. {
  17730. setQPushButtonProperties(value,engine);
  17731. }
  17732. /*:445*//*453:*/
  17733. #line 10463 "./typica.w"
  17734. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  17735. QScriptEngine*engine)
  17736. {
  17737. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  17738. argument<QString> (0,context),argument<QString> (1,context)));
  17739. setAnnotationSpinBoxProperties(object,engine);
  17740. return object;
  17741. }
  17742. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  17743. {
  17744. setQDoubleSpinBoxProperties(value,engine);
  17745. }
  17746. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  17747. {
  17748. setQAbstractSpinBoxProperties(value,engine);
  17749. }
  17750. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  17751. {
  17752. setQWidgetProperties(value,engine);
  17753. }
  17754. /*:453*//*474:*/
  17755. #line 10886 "./typica.w"
  17756. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  17757. {
  17758. QScriptValue object= engine->newQObject(new TimerDisplay);
  17759. setTimerDisplayProperties(object,engine);
  17760. return object;
  17761. }
  17762. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  17763. {
  17764. setQLCDNumberProperties(value,engine);
  17765. value.setProperty("setTimerMode",engine->newFunction(TimerDisplay_setTimerMode));
  17766. }
  17767. /*:474*//*475:*/
  17768. #line 10905 "./typica.w"
  17769. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*)
  17770. {
  17771. TimerDisplay*self= getself<TimerDisplay*> (context);
  17772. if(self)
  17773. {
  17774. switch(argument<int> (0,context))
  17775. {
  17776. case 0:
  17777. self->setMode(TimerDisplay::CountUp);
  17778. break;
  17779. case 1:
  17780. self->setMode(TimerDisplay::CountDown);
  17781. break;
  17782. case 2:
  17783. self->setMode(TimerDisplay::Clock);
  17784. break;
  17785. default:
  17786. break;
  17787. }
  17788. }
  17789. return QScriptValue();
  17790. }
  17791. /*:475*//*502:*/
  17792. #line 11411 "./typica.w"
  17793. QScriptValue constructWidgetDecorator(QScriptContext*context,
  17794. QScriptEngine*engine)
  17795. {
  17796. QWidget*widget= argument<QWidget*> (0,context);
  17797. QString text= argument<QString> (1,context);
  17798. Qt::Orientations orientation;
  17799. switch(argument<int> (2,context))
  17800. {
  17801. case 2:
  17802. orientation= Qt::Vertical;
  17803. break;
  17804. default:
  17805. orientation= Qt::Horizontal;
  17806. break;
  17807. }
  17808. QScriptValue object=
  17809. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  17810. setWidgetDecoratorProperties(object,engine);
  17811. return object;
  17812. }
  17813. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  17814. {
  17815. setQWidgetProperties(value,engine);
  17816. }
  17817. /*:502*//*515:*/
  17818. #line 11692 "./typica.w"
  17819. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  17820. {
  17821. QScriptValue object= engine->newQObject(new LogEditWindow);
  17822. return object;
  17823. }
  17824. /*:515*//*534:*/
  17825. #line 12219 "./typica.w"
  17826. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  17827. {
  17828. QIODevice*device= argument<QIODevice*> (0,context);
  17829. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  17830. argument<int> (1,context)));
  17831. object.setProperty("input",engine->newFunction(XMLInput_input));
  17832. return object;
  17833. }
  17834. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  17835. {
  17836. XMLInput*self= getself<XMLInput*> (context);
  17837. self->input();
  17838. return QScriptValue();
  17839. }
  17840. /*:534*//*548:*/
  17841. #line 157 "./webview.w"
  17842. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  17843. {
  17844. QScriptValue object= engine->newQObject(new TypicaWebView);
  17845. setQWebViewProperties(object,engine);
  17846. return object;
  17847. }
  17848. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  17849. {
  17850. setQWidgetProperties(value,engine);
  17851. }
  17852. /*:548*//*549:*/
  17853. #line 174 "./webview.w"
  17854. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  17855. QStack<QLayout*> *layoutStack)
  17856. {
  17857. TypicaWebView*view= new TypicaWebView;
  17858. if(element.hasAttribute("id"))
  17859. {
  17860. view->setObjectName(element.attribute("id"));
  17861. }
  17862. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17863. layout->addWidget(view);
  17864. }
  17865. /*:549*//*554:*/
  17866. #line 225 "./webview.w"
  17867. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  17868. {
  17869. QVariant var;
  17870. var.setValue(element);
  17871. QScriptValue object= engine->newVariant(var);
  17872. return object;
  17873. }
  17874. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  17875. {
  17876. element= value.toVariant().value<QWebElement> ();
  17877. }
  17878. /*:554*//*559:*/
  17879. #line 290 "./webview.w"
  17880. template<> QWebElement argument(int arg,QScriptContext*context)
  17881. {
  17882. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  17883. }
  17884. /*:559*//*560:*/
  17885. #line 299 "./webview.w"
  17886. QScriptValue constructWebElement(QScriptContext*context,
  17887. QScriptEngine*engine)
  17888. {
  17889. QWebElement element= argument<QWebElement> (0,context);
  17890. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  17891. return object;
  17892. }
  17893. /*:560*//*628:*/
  17894. #line 13564 "./typica.w"
  17895. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  17896. {
  17897. QScriptValue object= engine->newQObject(new SqlQueryView);
  17898. setSqlQueryViewProperties(object,engine);
  17899. return object;
  17900. }
  17901. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  17902. {
  17903. setQTableViewProperties(value,engine);
  17904. value.setProperty("setHeaderData",
  17905. engine->newFunction(SqlQueryView_setHeaderData));
  17906. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  17907. }
  17908. /*:628*//*629:*/
  17909. #line 13582 "./typica.w"
  17910. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  17911. {
  17912. SqlQueryView*self= getself<SqlQueryView*> (context);
  17913. QString query= argument<QString> (0,context);
  17914. self->setQuery(query);
  17915. self->reset();
  17916. return QScriptValue();
  17917. }
  17918. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  17919. QScriptEngine*)
  17920. {
  17921. SqlQueryView*self= getself<SqlQueryView*> (context);
  17922. int section= argument<int> (0,context);
  17923. QString data= argument<QString> (1,context);
  17924. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  17925. return QScriptValue();
  17926. }
  17927. /*:629*//*637:*/
  17928. #line 13789 "./typica.w"
  17929. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  17930. QStack<QLayout*> *layoutStack)
  17931. {
  17932. QTextEdit*widget= new QTextEdit;
  17933. if(element.hasAttribute("id"))
  17934. {
  17935. widget->setObjectName(element.attribute("id"));
  17936. }
  17937. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17938. layout->addWidget(widget);
  17939. QTextDocument*document= new QTextDocument;
  17940. QFont defaultFont;
  17941. defaultFont.setPointSize(11);
  17942. document->setDefaultFont(defaultFont);
  17943. QTextCursor cursor(document);
  17944. /*638:*/
  17945. #line 13812 "./typica.w"
  17946. QDomNodeList children= element.childNodes();
  17947. for(int i= 0;i<children.count();i++)
  17948. {
  17949. QDomNode current;
  17950. QDomElement currentElement;
  17951. current= children.at(i);
  17952. if(current.isElement())
  17953. {
  17954. currentElement= current.toElement();
  17955. /*639:*/
  17956. #line 13829 "./typica.w"
  17957. if(currentElement.tagName()=="style")
  17958. {
  17959. document->setDefaultStyleSheet(currentElement.text());
  17960. }
  17961. /*:639*//*640:*/
  17962. #line 13840 "./typica.w"
  17963. if(currentElement.tagName()=="html")
  17964. {
  17965. cursor.insertHtml(currentElement.text());
  17966. }
  17967. /*:640*//*641:*/
  17968. #line 13850 "./typica.w"
  17969. if(currentElement.tagName()=="text")
  17970. {
  17971. cursor.insertText(currentElement.text());
  17972. }
  17973. /*:641*//*642:*/
  17974. #line 13860 "./typica.w"
  17975. if(currentElement.tagName()=="table")
  17976. {
  17977. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  17978. ReportTable*table= new ReportTable(frame,currentElement);
  17979. table->setParent(widget);
  17980. if(currentElement.hasAttribute("id"))
  17981. {
  17982. table->setObjectName(currentElement.attribute("id"));
  17983. }
  17984. }
  17985. /*:642*/
  17986. #line 13822 "./typica.w"
  17987. }
  17988. }
  17989. /*:638*/
  17990. #line 13805 "./typica.w"
  17991. widget->setDocument(document);
  17992. }
  17993. /*:637*//*653:*/
  17994. #line 14073 "./typica.w"
  17995. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  17996. {
  17997. QTextEdit*self= getself<QTextEdit*> (context);
  17998. QTextDocument*document= self->document();
  17999. QPrinter printer;
  18000. QPrintDialog printwindow(&printer,self);
  18001. if(printwindow.exec()!=QDialog::Accepted)
  18002. {
  18003. return QScriptValue();
  18004. }
  18005. document->print(&printer);
  18006. return QScriptValue();
  18007. }
  18008. /*:653*//*654:*/
  18009. #line 14091 "./typica.w"
  18010. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  18011. {
  18012. setQAbstractScrollAreaProperties(value,engine);
  18013. value.setProperty("print",engine->newFunction(QTextEdit_print));
  18014. }
  18015. #line 1 "./daterangeselector.w"
  18016. /*:654*//*673:*/
  18017. #line 461 "./daterangeselector.w"
  18018. void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
  18019. QStack<QLayout*> *layoutStack)
  18020. {
  18021. DateRangeSelector*widget= new DateRangeSelector;
  18022. if(element.hasAttribute("id"))
  18023. {
  18024. widget->setObjectName(element.attribute("id"));
  18025. }
  18026. if(element.hasAttribute("initial"))
  18027. {
  18028. widget->setCurrentIndex(element.attribute("initial").toInt());
  18029. }
  18030. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18031. layout->addWidget(widget);
  18032. }
  18033. /*:673*//*684:*/
  18034. #line 14271 "./typica.w"
  18035. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  18036. QStack<QLayout*> *layoutStack)
  18037. {
  18038. FormArray*widget= new FormArray(element);
  18039. if(element.hasAttribute("id"))
  18040. {
  18041. widget->setObjectName(element.attribute("id"));
  18042. }
  18043. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18044. layout->addWidget(widget);
  18045. }
  18046. /*:684*//*705:*/
  18047. #line 14858 "./typica.w"
  18048. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  18049. QStack<QLayout*> *layoutStack)
  18050. {
  18051. ScaleControl*scale= new ScaleControl;
  18052. if(element.hasAttribute("id"))
  18053. {
  18054. scale->setObjectName(element.attribute("id"));
  18055. }
  18056. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18057. layout->addWidget(scale);
  18058. }
  18059. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  18060. QStack<QLayout*> *layoutStack)
  18061. {
  18062. IntensityControl*scale= new IntensityControl;
  18063. if(element.hasAttribute("id"))
  18064. {
  18065. scale->setObjectName(element.attribute("id"));
  18066. }
  18067. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18068. layout->addWidget(scale);
  18069. }
  18070. /*:705*//*731:*/
  18071. #line 15448 "./typica.w"
  18072. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  18073. {
  18074. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  18075. setDeviceTreeModelProperties(object,engine);
  18076. return object;
  18077. }
  18078. /*:731*//*733:*/
  18079. #line 15471 "./typica.w"
  18080. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  18081. {
  18082. setQAbstractItemModelProperties(value,engine);
  18083. value.setProperty("referenceElement",
  18084. engine->newFunction(DeviceTreeModel_referenceElement));
  18085. }
  18086. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  18087. {
  18088. setQObjectProperties(value,engine);
  18089. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  18090. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  18091. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  18092. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  18093. }
  18094. /*:733*//*734:*/
  18095. #line 15498 "./typica.w"
  18096. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  18097. QScriptEngine*engine)
  18098. {
  18099. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  18100. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  18101. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  18102. QDomElement node;
  18103. QVariantMap retval;
  18104. retval.insert("driver",referenceElement.attribute("driver"));
  18105. for(int i= 0;i<configData.size();i++)
  18106. {
  18107. node= configData.at(i).toElement();
  18108. retval.insert(node.attribute("name"),node.attribute("value"));
  18109. }
  18110. return engine->toScriptValue(retval);
  18111. }
  18112. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  18113. {
  18114. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18115. QModelIndex index= argument<QModelIndex> (0,context);
  18116. int role= argument<int> (1,context);
  18117. return engine->toScriptValue(model->data(index,role));
  18118. }
  18119. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  18120. {
  18121. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18122. int row= 0;
  18123. int column= 0;
  18124. QModelIndex index;
  18125. if(context->argumentCount()> 1)
  18126. {
  18127. row= argument<int> (0,context);
  18128. column= argument<int> (1,context);
  18129. }
  18130. if(context->argumentCount()> 2)
  18131. {
  18132. index= argument<QModelIndex> (2,context);
  18133. }
  18134. QModelIndex retval= model->index(row,column,index);
  18135. return engine->toScriptValue(retval);
  18136. }
  18137. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  18138. QScriptEngine*)
  18139. {
  18140. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18141. QModelIndex index;
  18142. if(context->argumentCount()==1)
  18143. {
  18144. index= argument<QModelIndex> (0,context);
  18145. }
  18146. return QScriptValue(model->rowCount(index));
  18147. }
  18148. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  18149. QScriptEngine*engine)
  18150. {
  18151. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18152. QModelIndex index;
  18153. if(context->argumentCount()==1)
  18154. {
  18155. index= argument<QModelIndex> (0,context);
  18156. }
  18157. return QScriptValue(engine,model->hasChildren(index));
  18158. }
  18159. /*:734*//*737:*/
  18160. #line 15582 "./typica.w"
  18161. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  18162. {
  18163. QVariant var;
  18164. var.setValue(index);
  18165. QScriptValue object= engine->newVariant(var);
  18166. return object;
  18167. }
  18168. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  18169. {
  18170. index= value.toVariant().value<QModelIndex> ();
  18171. }
  18172. /*:737*//*753:*/
  18173. #line 15880 "./typica.w"
  18174. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  18175. QScriptEngine*engine)
  18176. {
  18177. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  18178. return object;
  18179. }
  18180. /*:753*//*824:*/
  18181. #line 47 "./settings.w"
  18182. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  18183. {
  18184. QScriptValue object= engine->newQObject(new SettingsWindow);
  18185. return object;
  18186. }
  18187. /*:824*//*849:*/
  18188. #line 18479 "./typica.w"
  18189. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  18190. {
  18191. QScriptValue object;
  18192. if(context->argumentCount()==2)
  18193. {
  18194. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  18195. argument<QModelIndex> (1,context)),
  18196. QScriptEngine::ScriptOwnership);
  18197. setModbusRTUDeviceProperties(object,engine);
  18198. }
  18199. else
  18200. {
  18201. context->throwError("Incorrect number of arguments passed to "
  18202. "ModbusRTUDevice constructor. This takes the configuration model "
  18203. "and an index.");
  18204. }
  18205. return object;
  18206. }
  18207. /*:849*//*850:*/
  18208. #line 18501 "./typica.w"
  18209. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  18210. {
  18211. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  18212. QScriptValue object;
  18213. if(self)
  18214. {
  18215. if(self->channels.size()> 0)
  18216. {
  18217. object= engine->newQObject(self->channels.at(0));
  18218. setChannelProperties(object,engine);
  18219. }
  18220. }
  18221. return object;
  18222. }
  18223. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  18224. {
  18225. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  18226. QScriptValue object;
  18227. if(self)
  18228. {
  18229. if(self->channels.size()> 1)
  18230. {
  18231. object= engine->newQObject(self->channels.at(1));
  18232. setChannelProperties(object,engine);
  18233. }
  18234. }
  18235. return object;
  18236. }
  18237. /*:850*//*851:*/
  18238. #line 18534 "./typica.w"
  18239. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  18240. {
  18241. setQObjectProperties(value,engine);
  18242. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  18243. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  18244. }
  18245. /*:851*//*869:*/
  18246. #line 357 "./unsupportedserial.w"
  18247. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine)
  18248. {
  18249. QModelIndex deviceIndex= argument<QModelIndex> (0,context);
  18250. JavaScriptDevice*device= new JavaScriptDevice(deviceIndex,engine);
  18251. QScriptValue object= engine->newQObject(device);
  18252. setQObjectProperties(object,engine);
  18253. object.setProperty("getChannel",engine->newFunction(JavaScriptDevice_getChannel));
  18254. return object;
  18255. }
  18256. /*:869*//*874:*/
  18257. #line 430 "./unsupportedserial.w"
  18258. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine)
  18259. {
  18260. JavaScriptDevice*self= getself<JavaScriptDevice*> (context);
  18261. QScriptValue object;
  18262. if(self)
  18263. {
  18264. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  18265. setChannelProperties(object,engine);
  18266. }
  18267. return object;
  18268. }
  18269. /*:874*//*881:*/
  18270. #line 630 "./unsupportedserial.w"
  18271. QScriptValue getMeasurementTimestamp(QScriptContext*,QScriptEngine*engine)
  18272. {
  18273. return engine->toScriptValue<QTime> (QTime::currentTime());
  18274. }
  18275. /*:881*//*885:*/
  18276. #line 667 "./unsupportedserial.w"
  18277. QScriptValue constructSerialPort(QScriptContext*,QScriptEngine*engine)
  18278. {
  18279. QScriptValue object= engine->newQObject(new QextSerialPort());
  18280. setSerialPortProperties(object,engine);
  18281. return object;
  18282. }
  18283. /*:885*//*886:*/
  18284. #line 678 "./unsupportedserial.w"
  18285. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine)
  18286. {
  18287. setQIODeviceProperties(value,engine);
  18288. value.setProperty("flush",engine->newFunction(SerialPort_flush));
  18289. }
  18290. /*:886*//*887:*/
  18291. #line 687 "./unsupportedserial.w"
  18292. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*)
  18293. {
  18294. QextSerialPort*self= getself<QextSerialPort*> (context);
  18295. self->flush();
  18296. return QScriptValue();
  18297. }
  18298. /*:887*//*890:*/
  18299. #line 721 "./unsupportedserial.w"
  18300. void setQTimerProperties(QScriptValue value,QScriptEngine*engine)
  18301. {
  18302. setQObjectProperties(value,engine);
  18303. }
  18304. QScriptValue constructQTimer(QScriptContext*,QScriptEngine*engine)
  18305. {
  18306. QScriptValue object= engine->newQObject(new QTimer);
  18307. setQTimerProperties(object,engine);
  18308. return object;
  18309. }
  18310. #line 19085 "./typica.w"
  18311. #line 1 "./phidgets.w"
  18312. /*:890*//*911:*/
  18313. #line 463 "./phidgets.w"
  18314. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine)
  18315. {
  18316. if(context->argumentCount()!=1)
  18317. {
  18318. context->throwError("Incorrect number of arguments passed to "
  18319. "PhidgetsTemperatureSensor constructor. This takes "
  18320. "a QModelIndex.");
  18321. }
  18322. QScriptValue object= engine->newQObject(new PhidgetsTemperatureSensor(argument<QModelIndex> (0,context)),QScriptEngine::ScriptOwnership);
  18323. setQObjectProperties(object,engine);
  18324. object.setProperty("getChannel",engine->newFunction(Phidgets_getChannel));
  18325. return object;
  18326. }
  18327. /*:911*//*912:*/
  18328. #line 480 "./phidgets.w"
  18329. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine)
  18330. {
  18331. PhidgetsTemperatureSensor*self= getself<PhidgetsTemperatureSensor*> (context);
  18332. QScriptValue object;
  18333. if(self)
  18334. {
  18335. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  18336. setChannelProperties(object,engine);
  18337. }
  18338. return object;
  18339. }
  18340. #line 19087 "./typica.w"
  18341. /*:912*//*944:*/
  18342. #line 151 "./rate.w"
  18343. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  18344. {
  18345. int cachetime= 1;
  18346. int scaletime= 1;
  18347. if(context->argumentCount()> 0)
  18348. {
  18349. cachetime= argument<int> (0,context);
  18350. if(context->argumentCount()> 1)
  18351. {
  18352. scaletime= argument<int> (1,context);
  18353. }
  18354. }
  18355. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  18356. setRateOfChangeProperties(object,engine);
  18357. return object;
  18358. }
  18359. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  18360. {
  18361. setQObjectProperties(value,engine);
  18362. }
  18363. /*:944*//*969:*/
  18364. #line 614 "./dataqsdk.w"
  18365. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  18366. {
  18367. QScriptValue object;
  18368. if(context->argumentCount()==1)
  18369. {
  18370. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  18371. QScriptEngine::ScriptOwnership);
  18372. setDataqSdkDeviceProperties(object,engine);
  18373. }
  18374. else
  18375. {
  18376. context->throwError("Incorrect number of arguments passed to "
  18377. "DataqSdkDevice. The constructor takes one string "
  18378. "as an argument specifying a device name. "
  18379. "Example: Dev1");
  18380. }
  18381. return object;
  18382. }
  18383. /*:969*//*970:*/
  18384. #line 637 "./dataqsdk.w"
  18385. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  18386. {
  18387. setQObjectProperties(value,engine);
  18388. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  18389. }
  18390. /*:970*//*971:*/
  18391. #line 647 "./dataqsdk.w"
  18392. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  18393. {
  18394. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  18395. QScriptValue object;
  18396. if(self)
  18397. {
  18398. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  18399. setChannelProperties(object,engine);
  18400. }
  18401. return object;
  18402. }
  18403. /*:971*//*996:*/
  18404. #line 80 "./scales.w"
  18405. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  18406. {
  18407. QScriptValue object;
  18408. QString labelText= "";
  18409. if(context->argumentCount()==1)
  18410. {
  18411. labelText= argument<QString> (0,context);
  18412. }
  18413. object= engine->newQObject(new DragLabel(labelText));
  18414. setDragLabelProperties(object,engine);
  18415. return object;
  18416. }
  18417. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  18418. {
  18419. setQLabelProperties(value,engine);
  18420. }
  18421. /*:996*//*1006:*/
  18422. #line 272 "./scales.w"
  18423. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  18424. {
  18425. return engine->newVariant(QVariant((int)(value)));
  18426. }
  18427. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  18428. {
  18429. value= (BaudRateType)(sv.toVariant().toInt());
  18430. }
  18431. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  18432. {
  18433. return engine->newVariant(QVariant((int)(value)));
  18434. }
  18435. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  18436. {
  18437. value= (DataBitsType)(sv.toVariant().toInt());
  18438. }
  18439. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  18440. {
  18441. return engine->newVariant(QVariant((int)(value)));
  18442. }
  18443. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  18444. {
  18445. value= (ParityType)(sv.toVariant().toInt());
  18446. }
  18447. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  18448. {
  18449. return engine->newVariant(QVariant((int)(value)));
  18450. }
  18451. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  18452. {
  18453. value= (StopBitsType)(sv.toVariant().toInt());
  18454. }
  18455. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  18456. {
  18457. return engine->newVariant(QVariant((int)(value)));
  18458. }
  18459. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  18460. {
  18461. value= (FlowType)(sv.toVariant().toInt());
  18462. }
  18463. /*:1006*//*1009:*/
  18464. #line 341 "./scales.w"
  18465. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  18466. {
  18467. setQIODeviceProperties(value,engine);
  18468. }
  18469. /*:1009*//*1010:*/
  18470. #line 349 "./scales.w"
  18471. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  18472. {
  18473. QScriptValue object;
  18474. if(context->argumentCount()==1)
  18475. {
  18476. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  18477. setSerialScaleProperties(object,engine);
  18478. }
  18479. else
  18480. {
  18481. context->throwError("Incorrect number of arguments passed to "
  18482. "SerialScale. The constructor takes one string "
  18483. "as an argument specifying a port name.");
  18484. }
  18485. return object;
  18486. }
  18487. /*:1010*//*1032:*/
  18488. #line 278 "./valueannotation.w"
  18489. QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
  18490. {
  18491. QScriptValue object= engine->newQObject(new ValueAnnotation);
  18492. setValueAnnotationProperties(object,engine);
  18493. return object;
  18494. }
  18495. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  18496. {
  18497. setQObjectProperties(value,engine);
  18498. }
  18499. #line 19734 "./typica.w"
  18500. /*:1032*/
  18501. #line 530 "./typica.w"
  18502. /*607:*/
  18503. #line 13207 "./typica.w"
  18504. void messageFileOutput(QtMsgType,const char*msg)
  18505. {
  18506. QFile output("Typica-"+QDate::currentDate().toString("yyyy-MM-dd")+".log");
  18507. output.open(QIODevice::WriteOnly|QIODevice::Append);
  18508. QTextStream outstream(&output);
  18509. outstream<<msg<<"\r\n";
  18510. }
  18511. /*:607*/
  18512. #line 531 "./typica.w"
  18513. /*604:*/
  18514. #line 13168 "./typica.w"
  18515. int main(int argc,char**argv)
  18516. {
  18517. int*c= &argc;
  18518. Application app(*c,argv);
  18519. QSettings settings;
  18520. /*605:*/
  18521. #line 13194 "./typica.w"
  18522. if(settings.value("settings/advanced/logging",false).toBool())
  18523. {
  18524. qInstallMsgHandler(messageFileOutput);
  18525. }
  18526. /*:605*/
  18527. #line 13174 "./typica.w"
  18528. /*608:*/
  18529. #line 13220 "./typica.w"
  18530. QStringList themeSearchPath= QIcon::themeSearchPaths();
  18531. themeSearchPath.append(":/resources/icons/tango");
  18532. QIcon::setThemeSearchPaths(themeSearchPath);
  18533. QIcon::setThemeName(":/resources/icons/tango");
  18534. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  18535. /*:608*/
  18536. #line 13175 "./typica.w"
  18537. /*609:*/
  18538. #line 13240 "./typica.w"
  18539. QFile entypo(":/resources/fonts/entypo.ttf");
  18540. entypo.open(QIODevice::ReadOnly);
  18541. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  18542. entypo.close();
  18543. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  18544. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  18545. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  18546. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  18547. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  18548. /*:609*/
  18549. #line 13176 "./typica.w"
  18550. /*763:*/
  18551. #line 16119 "./typica.w"
  18552. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  18553. /*:763*//*773:*/
  18554. #line 16361 "./typica.w"
  18555. app.registerDeviceConfigurationWidget("nidaqmxbase",
  18556. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  18557. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  18558. NiDaqMxBase9211ConfWidget::staticMetaObject);
  18559. app.registerDeviceConfigurationWidget("ni9211seriestc",
  18560. Ni9211TcConfWidget::staticMetaObject);
  18561. /*:773*//*781:*/
  18562. #line 16592 "./typica.w"
  18563. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  18564. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  18565. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  18566. /*:781*//*805:*/
  18567. #line 17557 "./typica.w"
  18568. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  18569. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  18570. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  18571. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  18572. /*:805*//*810:*/
  18573. #line 17642 "./typica.w"
  18574. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  18575. /*:810*//*813:*/
  18576. #line 17712 "./typica.w"
  18577. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  18578. /*:813*//*816:*/
  18579. #line 17839 "./typica.w"
  18580. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  18581. #line 1 "./freeannotation.w"
  18582. /*:816*//*820:*/
  18583. #line 57 "./freeannotation.w"
  18584. app.registerDeviceConfigurationWidget("freeannotation",
  18585. FreeAnnotationConfWidget::staticMetaObject);
  18586. #line 17843 "./typica.w"
  18587. #line 1 "./settings.w"
  18588. /*:820*//*854:*/
  18589. #line 19075 "./typica.w"
  18590. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  18591. /*:854*//*864:*/
  18592. #line 264 "./unsupportedserial.w"
  18593. app.registerDeviceConfigurationWidget("unsupporteddevicechannel",
  18594. UnsupportedDeviceChannelConfWidget::staticMetaObject);
  18595. app.registerDeviceConfigurationWidget("unsupporteddevice",
  18596. UnsupportedSerialDeviceConfWidget::staticMetaObject);
  18597. /*:864*//*898:*/
  18598. #line 181 "./phidgets.w"
  18599. app.registerDeviceConfigurationWidget("phidgets1048",
  18600. PhidgetsTemperatureSensorConfWidget::staticMetaObject);
  18601. app.registerDeviceConfigurationWidget("phidgets1048channel",
  18602. PhidgetTemperatureSensorChannelConfWidget::staticMetaObject);
  18603. /*:898*//*918:*/
  18604. #line 19209 "./typica.w"
  18605. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  18606. /*:918*//*921:*/
  18607. #line 19269 "./typica.w"
  18608. app.registerDeviceConfigurationWidget("coolingtimer",
  18609. CoolingTimerConfWidget::staticMetaObject);
  18610. /*:921*//*926:*/
  18611. #line 19528 "./typica.w"
  18612. app.registerDeviceConfigurationWidget("rangetimer",
  18613. RangeTimerConfWidget::staticMetaObject);
  18614. /*:926*//*931:*/
  18615. #line 19629 "./typica.w"
  18616. app.registerDeviceConfigurationWidget("multirangetimer",
  18617. MultiRangeTimerConfWidget::staticMetaObject);
  18618. /*:931*//*936:*/
  18619. #line 19724 "./typica.w"
  18620. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  18621. #line 1 "./rate.w"
  18622. /*:936*//*948:*/
  18623. #line 253 "./rate.w"
  18624. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  18625. /*:948*//*989:*/
  18626. #line 1233 "./dataqsdk.w"
  18627. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  18628. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  18629. DataqSdkChannelConfWidget::staticMetaObject);
  18630. /*:989*//*1014:*/
  18631. #line 490 "./scales.w"
  18632. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  18633. /*:1014*//*1022:*/
  18634. #line 138 "./valueannotation.w"
  18635. app.registerDeviceConfigurationWidget("valueannotation",
  18636. ValueAnnotationConfWidget::staticMetaObject);
  18637. /*:1022*/
  18638. #line 13178 "./typica.w"
  18639. /*610:*/
  18640. #line 13257 "./typica.w"
  18641. if(settings.value("database/exists","false").toString()=="true")
  18642. {
  18643. /*615:*/
  18644. #line 13379 "./typica.w"
  18645. QSqlDatabase database=
  18646. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  18647. database.setConnectOptions("application_name=Typica");
  18648. database.setHostName(settings.value("database/hostname").toString());
  18649. database.setDatabaseName(settings.value("database/dbname").toString());
  18650. database.setUserName(settings.value("database/user").toString());
  18651. database.setPassword(settings.value("database/password").toString());
  18652. if(!database.open())
  18653. {
  18654. settings.setValue("database/exists","false");
  18655. }
  18656. else
  18657. {
  18658. database.close();
  18659. }
  18660. /*:615*/
  18661. #line 13260 "./typica.w"
  18662. }
  18663. if(settings.value("database/exists","false").toString()=="false")
  18664. {
  18665. /*614:*/
  18666. #line 13370 "./typica.w"
  18667. SqlConnectionSetup dialog;
  18668. dialog.exec();
  18669. /*:614*/
  18670. #line 13264 "./typica.w"
  18671. }
  18672. /*:610*/
  18673. #line 13179 "./typica.w"
  18674. /*179:*/
  18675. #line 4185 "./typica.w"
  18676. QStringList arguments= QCoreApplication::arguments();
  18677. int position= arguments.indexOf("-c");
  18678. QString filename= QString();
  18679. if(position!=-1)
  18680. {
  18681. if(arguments.size()>=position+1)
  18682. {
  18683. filename= arguments.at(position+1);
  18684. }
  18685. }
  18686. if(filename.isEmpty())
  18687. {
  18688. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  18689. settings.value("config","").toString());
  18690. }
  18691. QDir directory;
  18692. if(!filename.isEmpty())
  18693. {
  18694. QFile file(filename);
  18695. QFileInfo info(filename);
  18696. directory= info.dir();
  18697. settings.setValue("config",directory.path());
  18698. if(file.open(QIODevice::ReadOnly))
  18699. {
  18700. app.configuration()->setContent(&file,true);
  18701. }
  18702. }
  18703. /*180:*/
  18704. #line 4219 "./typica.w"
  18705. QDomElement root= app.configuration()->documentElement();
  18706. QDomNodeList children= root.childNodes();
  18707. QString replacementDoc;
  18708. QDomDocument includedDoc;
  18709. QDomDocumentFragment fragment;
  18710. for(int i= 0;i<children.size();i++)
  18711. {
  18712. QDomNode currentNode= children.at(i);
  18713. QDomElement currentElement;
  18714. if(currentNode.nodeName()=="include")
  18715. {
  18716. currentElement= currentNode.toElement();
  18717. if(currentElement.hasAttribute("src"))
  18718. {
  18719. replacementDoc= directory.path();
  18720. replacementDoc.append('/');
  18721. replacementDoc.append(currentElement.attribute("src"));
  18722. QFile doc(replacementDoc);
  18723. if(doc.open(QIODevice::ReadOnly))
  18724. {
  18725. includedDoc.setContent(&doc,true);
  18726. fragment= includedDoc.createDocumentFragment();
  18727. fragment.appendChild(includedDoc.documentElement());
  18728. root.replaceChild(fragment,currentNode);
  18729. doc.close();
  18730. }
  18731. }
  18732. }
  18733. }
  18734. /*:180*/
  18735. #line 4213 "./typica.w"
  18736. /*:179*/
  18737. #line 13180 "./typica.w"
  18738. /*7:*/
  18739. #line 659 "./typica.w"
  18740. QScriptEngine*engine= new QScriptEngine;
  18741. QScriptValue constructor;
  18742. QScriptValue value;
  18743. /*:7*//*17:*/
  18744. #line 856 "./typica.w"
  18745. constructor= engine->newFunction(constructQWidget);
  18746. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  18747. engine->globalObject().setProperty("QWidget",value);
  18748. /*:17*//*28:*/
  18749. #line 1102 "./typica.w"
  18750. constructor= engine->newFunction(constructQMainWindow);
  18751. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  18752. constructor);
  18753. engine->globalObject().setProperty("QMainWindow",value);
  18754. /*:28*//*39:*/
  18755. #line 1307 "./typica.w"
  18756. constructor= engine->newFunction(constructQFrame);
  18757. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  18758. engine->globalObject().setProperty("QFrame",value);
  18759. /*:39*//*42:*/
  18760. #line 1340 "./typica.w"
  18761. constructor= engine->newFunction(constructQLabel);
  18762. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  18763. engine->globalObject().setProperty("QLabel",value);
  18764. /*:42*//*45:*/
  18765. #line 1378 "./typica.w"
  18766. constructor= engine->newFunction(constructQLineEdit);
  18767. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  18768. engine->globalObject().setProperty("QLineEdit",value);
  18769. /*:45*//*49:*/
  18770. #line 1425 "./typica.w"
  18771. constructor= engine->newFunction(constructQSplitter);
  18772. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  18773. engine->globalObject().setProperty("QSplitter",value);
  18774. /*:49*//*57:*/
  18775. #line 1614 "./typica.w"
  18776. constructor= engine->newFunction(constructQBoxLayout);
  18777. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  18778. engine->globalObject().setProperty("QBoxLayout",value);
  18779. /*:57*//*61:*/
  18780. #line 1726 "./typica.w"
  18781. constructor= engine->newFunction(constructQAction);
  18782. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  18783. engine->globalObject().setProperty("QAction",value);
  18784. /*:61*//*64:*/
  18785. #line 1785 "./typica.w"
  18786. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  18787. value.setProperty("getOpenFileName",
  18788. engine->newFunction(QFileDialog_getOpenFileName));
  18789. value.setProperty("getSaveFileName",
  18790. engine->newFunction(QFileDialog_getSaveFileName));
  18791. engine->globalObject().setProperty("QFileDialog",value);
  18792. /*:64*//*69:*/
  18793. #line 1903 "./typica.w"
  18794. constructor= engine->newFunction(constructQFile);
  18795. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  18796. engine->globalObject().setProperty("QFile",value);
  18797. /*:69*//*80:*/
  18798. #line 2121 "./typica.w"
  18799. constructor= engine->newFunction(constructQProcess);
  18800. value= engine->newQMetaObject(&QProcess::staticMetaObject,constructor);
  18801. engine->globalObject().setProperty("QProcess",value);
  18802. /*:80*//*89:*/
  18803. #line 2270 "./typica.w"
  18804. qScriptRegisterMetaType(engine,QByteArray_toScriptValue,QByteArray_fromScriptValue);
  18805. constructor= engine->newFunction(constructQByteArray);
  18806. engine->globalObject().setProperty("QByteArray",constructor);
  18807. /*:89*//*101:*/
  18808. #line 2512 "./typica.w"
  18809. engine->globalObject().setProperty("bytesFromInt8",engine->newFunction(bytesFromInt8));
  18810. engine->globalObject().setProperty("bytesFromInt16",engine->newFunction(bytesFromInt16));
  18811. engine->globalObject().setProperty("bytesFromInt32",engine->newFunction(bytesFromInt32));
  18812. engine->globalObject().setProperty("bytesFromFloat",engine->newFunction(bytesFromFloat));
  18813. engine->globalObject().setProperty("bytesFromDouble",engine->newFunction(bytesFromDouble));
  18814. /*:101*//*104:*/
  18815. #line 2615 "./typica.w"
  18816. constructor= engine->newFunction(constructQBuffer);
  18817. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  18818. engine->globalObject().setProperty("QBuffer",value);
  18819. /*:104*//*107:*/
  18820. #line 2664 "./typica.w"
  18821. constructor= engine->newFunction(constructXQuery);
  18822. engine->globalObject().setProperty("XQuery",constructor);
  18823. /*:107*//*113:*/
  18824. #line 2766 "./typica.w"
  18825. constructor= engine->newFunction(constructXmlWriter);
  18826. engine->globalObject().setProperty("XmlWriter",constructor);
  18827. /*:113*//*122:*/
  18828. #line 2972 "./typica.w"
  18829. constructor= engine->newFunction(constructXmlReader);
  18830. engine->globalObject().setProperty("XmlReader",constructor);
  18831. /*:122*//*129:*/
  18832. #line 3096 "./typica.w"
  18833. value= engine->newQObject(&settings);
  18834. setQSettingsProperties(value,engine);
  18835. engine->globalObject().setProperty("QSettings",value);
  18836. /*:129*//*133:*/
  18837. #line 3177 "./typica.w"
  18838. constructor= engine->newFunction(constructQLCDNumber);
  18839. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  18840. engine->globalObject().setProperty("QLCDNumber",value);
  18841. /*:133*//*136:*/
  18842. #line 3233 "./typica.w"
  18843. constructor= engine->newFunction(constructQTime);
  18844. engine->globalObject().setProperty("QTime",constructor);
  18845. /*:136*//*158:*/
  18846. #line 3746 "./typica.w"
  18847. constructor= engine->newFunction(constructQPushButton);
  18848. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  18849. engine->globalObject().setProperty("QPushButton",value);
  18850. /*:158*//*165:*/
  18851. #line 3857 "./typica.w"
  18852. constructor= engine->newFunction(constructQSqlQuery);
  18853. engine->globalObject().setProperty("QSqlQuery",constructor);
  18854. /*:165*//*172:*/
  18855. #line 4020 "./typica.w"
  18856. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  18857. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  18858. engine->globalObject().setProperty("sqlToArray",
  18859. engine->newFunction(sqlToArray));
  18860. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  18861. engine->globalObject().setProperty("annotationFromRecord",
  18862. engine->newFunction(annotationFromRecord));
  18863. engine->globalObject().setProperty("setTabOrder",
  18864. engine->newFunction(setTabOrder));
  18865. engine->globalObject().setProperty("saveFileFromDatabase",
  18866. engine->newFunction(saveFileFromDatabase));
  18867. /*:172*//*184:*/
  18868. #line 4386 "./typica.w"
  18869. engine->globalObject().setProperty("createWindow",
  18870. engine->newFunction(createWindow));
  18871. engine->globalObject().setProperty("createReport",
  18872. engine->newFunction(createReport));
  18873. /*:184*//*249:*/
  18874. #line 5994 "./typica.w"
  18875. engine->globalObject().setProperty("findChildObject",
  18876. engine->newFunction(findChildObject));
  18877. /*:249*//*275:*/
  18878. #line 389 "./units.w"
  18879. value= engine->newQMetaObject(&Units::staticMetaObject);
  18880. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  18881. value.setProperty("convertRelativeTemperature",
  18882. engine->newFunction(Units_convertRelativeTemperature));
  18883. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  18884. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  18885. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  18886. engine->globalObject().setProperty("Units",value);
  18887. /*:275*//*280:*/
  18888. #line 462 "./units.w"
  18889. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  18890. #line 6414 "./typica.w"
  18891. /*:280*//*288:*/
  18892. #line 141 "./measurement.w"
  18893. constructor= engine->newFunction(constructMeasurement);
  18894. engine->globalObject().setProperty("Measurement",constructor);
  18895. qScriptRegisterMetaType(engine,Measurement_toScriptValue,Measurement_fromScriptValue);
  18896. /*:288*//*308:*/
  18897. #line 6985 "./typica.w"
  18898. constructor= engine->newFunction(constructDAQ);
  18899. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  18900. value.setProperty("Fahrenheit",Units::Fahrenheit);
  18901. value.setProperty("Celsius",Units::Celsius);
  18902. value.setProperty("Kelvin",Units::Kelvin);
  18903. value.setProperty("Rankine",Units::Rankine);
  18904. engine->globalObject().setProperty("DAQ",value);
  18905. /*:308*//*317:*/
  18906. #line 7187 "./typica.w"
  18907. constructor= engine->newFunction(constructFakeDAQ);
  18908. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  18909. engine->globalObject().setProperty("FakeDAQ",value);
  18910. /*:317*//*328:*/
  18911. #line 7470 "./typica.w"
  18912. constructor= engine->newFunction(constructLinearCalibrator);
  18913. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  18914. constructor);
  18915. engine->globalObject().setProperty("LinearCalibrator",value);
  18916. /*:328*//*333:*/
  18917. #line 7609 "./typica.w"
  18918. constructor= engine->newFunction(constructLinearSplineInterpolator);
  18919. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  18920. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  18921. /*:333*//*343:*/
  18922. #line 7817 "./typica.w"
  18923. constructor= engine->newFunction(constructTemperatureDisplay);
  18924. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  18925. constructor);
  18926. engine->globalObject().setProperty("TemperatureDisplay",value);
  18927. /*:343*//*351:*/
  18928. #line 7975 "./typica.w"
  18929. constructor= engine->newFunction(constructMeasurementTimeOffset);
  18930. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  18931. constructor);
  18932. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  18933. /*:351*//*356:*/
  18934. #line 8086 "./typica.w"
  18935. constructor= engine->newFunction(constructThresholdDetector);
  18936. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  18937. engine->globalObject().setProperty("ThresholdDetector",value);
  18938. /*:356*//*361:*/
  18939. #line 8185 "./typica.w"
  18940. constructor= engine->newFunction(constructZeroEmitter);
  18941. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  18942. engine->globalObject().setProperty("ZeroEmitter",value);
  18943. /*:361*//*366:*/
  18944. #line 8264 "./typica.w"
  18945. constructor= engine->newFunction(constructMeasurementAdapter);
  18946. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  18947. constructor);
  18948. engine->globalObject().setProperty("MeasurementAdapter",value);
  18949. /*:366*//*383:*/
  18950. #line 8727 "./typica.w"
  18951. constructor= engine->newFunction(constructGraphView);
  18952. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  18953. engine->globalObject().setProperty("GraphView",value);
  18954. /*:383*//*406:*/
  18955. #line 9364 "./typica.w"
  18956. constructor= engine->newFunction(constructZoomLog);
  18957. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  18958. engine->globalObject().setProperty("ZoomLog",value);
  18959. /*:406*//*444:*/
  18960. #line 10312 "./typica.w"
  18961. constructor= engine->newFunction(constructAnnotationButton);
  18962. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  18963. constructor);
  18964. engine->globalObject().setProperty("AnnotationButton",value);
  18965. /*:444*//*452:*/
  18966. #line 10454 "./typica.w"
  18967. constructor= engine->newFunction(constructAnnotationSpinBox);
  18968. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  18969. constructor);
  18970. engine->globalObject().setProperty("AnnotationSpinBox",value);
  18971. /*:452*//*473:*/
  18972. #line 10879 "./typica.w"
  18973. constructor= engine->newFunction(constructTimerDisplay);
  18974. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  18975. engine->globalObject().setProperty("TimerDisplay",value);
  18976. /*:473*//*501:*/
  18977. #line 11403 "./typica.w"
  18978. constructor= engine->newFunction(constructWidgetDecorator);
  18979. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  18980. engine->globalObject().setProperty("WidgetDecorator",value);
  18981. /*:501*//*514:*/
  18982. #line 11685 "./typica.w"
  18983. constructor= engine->newFunction(constructLogEditWindow);
  18984. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  18985. engine->globalObject().setProperty("LogEditWindow",value);
  18986. /*:514*//*533:*/
  18987. #line 12212 "./typica.w"
  18988. constructor= engine->newFunction(constructXMLInput);
  18989. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  18990. engine->globalObject().setProperty("XMLInput",value);
  18991. /*:533*//*547:*/
  18992. #line 149 "./webview.w"
  18993. constructor= engine->newFunction(constructWebView);
  18994. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  18995. engine->globalObject().setProperty("WebView",value);
  18996. /*:547*//*555:*/
  18997. #line 241 "./webview.w"
  18998. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  18999. /*:555*//*558:*/
  19000. #line 283 "./webview.w"
  19001. constructor= engine->newFunction(constructWebElement);
  19002. engine->globalObject().setProperty("WebElement",constructor);
  19003. /*:558*//*569:*/
  19004. #line 12455 "./typica.w"
  19005. value= engine->newQObject(AppInstance);
  19006. engine->globalObject().setProperty("Application",value);
  19007. /*:569*//*627:*/
  19008. #line 13556 "./typica.w"
  19009. constructor= engine->newFunction(constructSqlQueryView);
  19010. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  19011. engine->globalObject().setProperty("SqlQueryView",value);
  19012. /*:627*//*732:*/
  19013. #line 15458 "./typica.w"
  19014. constructor= engine->newFunction(constructDeviceTreeModel);
  19015. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  19016. constructor);
  19017. engine->globalObject().setProperty("DeviceTreeModel",value);
  19018. /*:732*//*738:*/
  19019. #line 15598 "./typica.w"
  19020. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  19021. /*:738*//*754:*/
  19022. #line 15890 "./typica.w"
  19023. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  19024. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  19025. constructor);
  19026. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  19027. /*:754*//*825:*/
  19028. #line 56 "./settings.w"
  19029. constructor= engine->newFunction(constructSettingsWindow);
  19030. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  19031. engine->globalObject().setProperty("SettingsWindow",value);
  19032. #line 1 "./graphsettings.w"
  19033. /*:825*//*848:*/
  19034. #line 18470 "./typica.w"
  19035. constructor= engine->newFunction(constructModbusRTUDevice);
  19036. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  19037. engine->globalObject().setProperty("ModbusRTUDevice",value);
  19038. /*:848*//*868:*/
  19039. #line 350 "./unsupportedserial.w"
  19040. engine->globalObject().setProperty("createDevice",
  19041. engine->newFunction(createDevice));
  19042. /*:868*//*880:*/
  19043. #line 622 "./unsupportedserial.w"
  19044. engine->globalObject().setProperty("getMeasurementTimestamp",
  19045. engine->newFunction(getMeasurementTimestamp));
  19046. /*:880*//*884:*/
  19047. #line 658 "./unsupportedserial.w"
  19048. constructor= engine->newFunction(constructSerialPort);
  19049. value= engine->newQMetaObject(&QextSerialPort::staticMetaObject,constructor);
  19050. engine->globalObject().setProperty("SerialPort",value);
  19051. /*:884*//*889:*/
  19052. #line 713 "./unsupportedserial.w"
  19053. constructor= engine->newFunction(constructQTimer);
  19054. value= engine->newQMetaObject(&QTimer::staticMetaObject,constructor);
  19055. engine->globalObject().setProperty("Timer",value);
  19056. /*:889*//*909:*/
  19057. #line 450 "./phidgets.w"
  19058. constructor= engine->newFunction(constructPhidgetsTemperatureSensor);
  19059. value= engine->newQMetaObject(&PhidgetsTemperatureSensor::staticMetaObject,constructor);
  19060. engine->globalObject().setProperty("PhidgetsTemperatureSensor",value);
  19061. /*:909*//*943:*/
  19062. #line 144 "./rate.w"
  19063. constructor= engine->newFunction(constructRateOfChange);
  19064. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  19065. engine->globalObject().setProperty("RateOfChange",value);
  19066. /*:943*//*968:*/
  19067. #line 604 "./dataqsdk.w"
  19068. constructor= engine->newFunction(constructDataqSdkDevice);
  19069. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  19070. engine->globalObject().setProperty("DataqSdkDevice",value);
  19071. /*:968*//*995:*/
  19072. #line 73 "./scales.w"
  19073. constructor= engine->newFunction(constructDragLabel);
  19074. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  19075. engine->globalObject().setProperty("DragLabel",value);
  19076. /*:995*//*1003:*/
  19077. #line 239 "./scales.w"
  19078. constructor= engine->newFunction(constructSerialScale);
  19079. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  19080. engine->globalObject().setProperty("SerialScale",value);
  19081. /*:1003*//*1007:*/
  19082. #line 325 "./scales.w"
  19083. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  19084. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  19085. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  19086. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  19087. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  19088. /*:1007*//*1031:*/
  19089. #line 271 "./valueannotation.w"
  19090. constructor= engine->newFunction(constructValueAnnotation);
  19091. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  19092. engine->globalObject().setProperty("ValueAnnotation",value);
  19093. /*:1031*/
  19094. #line 13181 "./typica.w"
  19095. app.engine= engine;
  19096. /*181:*/
  19097. #line 4267 "./typica.w"
  19098. QString styleText;
  19099. QString programText;
  19100. QDomElement currentElement;
  19101. for(int i= 0;i<children.size();i++)
  19102. {
  19103. QDomNode currentNode= children.at(i);
  19104. if(currentNode.nodeName()=="style")
  19105. {
  19106. currentElement= currentNode.toElement();
  19107. styleText.append(currentElement.text());
  19108. }
  19109. else if(currentNode.nodeName()=="program")
  19110. {
  19111. currentElement= currentNode.toElement();
  19112. programText.append(currentElement.text());
  19113. }
  19114. }
  19115. app.setStyleSheet(styleText);
  19116. QScriptValue result= engine->evaluate(programText);
  19117. /*182:*/
  19118. #line 4292 "./typica.w"
  19119. if(engine->hasUncaughtException())
  19120. {
  19121. int line= engine->uncaughtExceptionLineNumber();
  19122. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  19123. result.toString();
  19124. QString trace;
  19125. foreach(trace,engine->uncaughtExceptionBacktrace())
  19126. {
  19127. qDebug()<<trace;
  19128. }
  19129. }
  19130. /*:182*/
  19131. #line 4287 "./typica.w"
  19132. /*:181*/
  19133. #line 13183 "./typica.w"
  19134. int retval= app.exec();
  19135. delete engine;
  19136. return retval;
  19137. }
  19138. /*:604*/
  19139. #line 532 "./typica.w"
  19140. #include "moc_typica.cpp"
  19141. /*:3*/