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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310
  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. #include <QtSvg>
  16. /*:5*//*6:*/
  17. #line 632 "./typica.w"
  18. #include "helpmenu.h"
  19. /*:6*//*291:*/
  20. #line 6605 "./typica.w"
  21. #include "units.h"
  22. #line 1 "./measurement.w"
  23. /*:291*//*561:*/
  24. #line 197 "./webview.w"
  25. #include "webview.h"
  26. /*:561*//*574:*/
  27. #line 375 "./webview.w"
  28. #include "webelement.h"
  29. #line 12571 "./typica.w"
  30. /*:574*//*685:*/
  31. #line 487 "./daterangeselector.w"
  32. #include "daterangeselector.h"
  33. #line 14297 "./typica.w"
  34. /*:685*//*793:*/
  35. #line 16868 "./typica.w"
  36. #include "qextserialport.h"
  37. #include "qextserialenumerator.h"
  38. /*:793*//*964:*/
  39. #line 124 "./dataqsdk.w"
  40. #ifdef Q_OS_WIN32
  41. #include <windef.h>
  42. #else
  43. #define PASCAL
  44. #endif
  45. /*:964*//*988:*/
  46. #line 862 "./dataqsdk.w"
  47. #include <limits>
  48. /*:988*//*1003:*/
  49. #line 62 "./scales.w"
  50. #include "draglabel.h"
  51. /*:1003*//*1018:*/
  52. #line 335 "./scales.w"
  53. #include "scale.h"
  54. /*:1018*/
  55. #line 525 "./typica.w"
  56. /*23:*/
  57. #line 994 "./typica.w"
  58. class ScriptQMainWindow:public QMainWindow
  59. {
  60. Q_OBJECT
  61. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  62. public:
  63. ScriptQMainWindow();
  64. QString closePrompt();
  65. public slots:
  66. void show();
  67. void saveSizeAndPosition(const QString&key);
  68. void restoreSizeAndPosition(const QString&key);
  69. void displayStatus(const QString&message= QString());
  70. void setClosePrompt(QString prompt);
  71. protected:
  72. void closeEvent(QCloseEvent*event);
  73. void showEvent(QShowEvent*event);
  74. signals:
  75. void aboutToClose(void);
  76. private:
  77. QString cprompt;
  78. };
  79. /*:23*//*169:*/
  80. #line 3918 "./typica.w"
  81. class SqlQueryConnection:public QSqlQuery
  82. {
  83. public:
  84. SqlQueryConnection(const QString&query= QString());
  85. ~SqlQueryConnection();
  86. QSqlQuery*operator->()const;
  87. private:
  88. QString connection;
  89. QSqlQuery*q;
  90. };
  91. /*:169*//*240:*/
  92. #line 5807 "./typica.w"
  93. class NumericDelegate:public QItemDelegate
  94. {
  95. Q_OBJECT
  96. public:
  97. NumericDelegate(QObject*parent= NULL);
  98. QWidget*createEditor(QWidget*parent,
  99. const QStyleOptionViewItem&option,
  100. const QModelIndex&index)const;
  101. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  102. void setModelData(QWidget*editor,QAbstractItemModel*model,
  103. const QModelIndex&index)const;
  104. void updateEditorGeometry(QWidget*editor,
  105. const QStyleOptionViewItem&option,
  106. const QModelIndex&index)const;
  107. };
  108. /*:240*//*246:*/
  109. #line 5900 "./typica.w"
  110. class ScriptValidator:public QValidator
  111. {
  112. Q_OBJECT
  113. public:
  114. ScriptValidator(QValidator*validator,QObject*parent= NULL);
  115. void fixup(QString&input)const;
  116. QValidator::State validate(QString&input,int&pos)const;
  117. private:
  118. QValidator*v;
  119. };
  120. /*:246*//*287:*/
  121. #line 438 "./units.w"
  122. Q_DECLARE_METATYPE(Units::Unit)
  123. /*:287*//*292:*/
  124. #line 19 "./measurement.w"
  125. class Measurement:public QVariantMap
  126. {
  127. public:
  128. Measurement(double temperature= 0,QTime time= QTime(),
  129. Units::Unit sc= Units::Fahrenheit);
  130. Measurement(double temperature);
  131. double temperature()const;
  132. QTime time()const;
  133. void setTemperature(double temperature);
  134. void setTime(QTime time);
  135. void setUnit(Units::Unit scale);
  136. Units::Unit scale()const;
  137. Measurement toFahrenheit();
  138. Measurement toCelsius();
  139. Measurement toKelvin();
  140. Measurement toRankine();
  141. };
  142. /*:292*//*296:*/
  143. #line 128 "./measurement.w"
  144. Q_DECLARE_METATYPE(Measurement)
  145. /*:296*//*303:*/
  146. #line 6669 "./typica.w"
  147. class Channel;
  148. class DAQImplementation;
  149. class DAQ:public QObject
  150. {
  151. Q_OBJECT
  152. Q_ENUMS(ThermocoupleType)
  153. DAQImplementation*imp;
  154. private slots:
  155. void threadFinished();
  156. public:
  157. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  158. ~DAQ();
  159. Channel*newChannel(int units,int thermocouple);
  160. Q_INVOKABLE void setClockRate(double Hz);
  161. Q_INVOKABLE void start();
  162. Q_INVOKABLE void stop();
  163. enum ThermocoupleType
  164. {
  165. TypeJ= 10072,
  166. TypeK= 10073,
  167. TypeN= 10077,
  168. TypeR= 10082,
  169. TypeS= 10085,
  170. TypeT= 10086,
  171. TypeB= 10047,
  172. TypeE= 10055
  173. };
  174. };
  175. /*:303*//*304:*/
  176. #line 6707 "./typica.w"
  177. class DAQImplementation:public QThread
  178. {
  179. Q_OBJECT
  180. public:
  181. DAQImplementation(const QString&driverinfo);
  182. ~DAQImplementation();
  183. void run();
  184. void measure();
  185. /*305:*/
  186. #line 6727 "./typica.w"
  187. typedef int(*daqfp)(...);
  188. daqfp read;
  189. daqfp errorInfo;
  190. daqfp startTask;
  191. daqfp createTask;
  192. daqfp createChannel;
  193. daqfp setClock;
  194. daqfp stopTask;
  195. daqfp clearTask;
  196. daqfp resetDevice;
  197. daqfp waitForMeasurement;
  198. /*:305*/
  199. #line 6716 "./typica.w"
  200. /*306:*/
  201. #line 6743 "./typica.w"
  202. bool useBase;
  203. QString device;
  204. QVector<Channel*> channelMap;
  205. unsigned int handle;
  206. int error;
  207. int channels;
  208. bool ready;
  209. QLibrary driver;
  210. QVector<Units::Unit> unitMap;
  211. /*:306*/
  212. #line 6717 "./typica.w"
  213. };
  214. /*:304*//*322:*/
  215. #line 7248 "./typica.w"
  216. class FakeDAQImplementation:public QThread
  217. {
  218. Q_OBJECT
  219. public:
  220. FakeDAQImplementation();
  221. ~FakeDAQImplementation();
  222. void run();
  223. void measure();
  224. QVector<Channel*> channelMap;
  225. int channels;
  226. bool ready;
  227. double clockRate;
  228. };
  229. class FakeDAQ:public QObject
  230. {
  231. Q_OBJECT
  232. FakeDAQImplementation*imp;
  233. public:
  234. FakeDAQ(QString device);
  235. ~FakeDAQ();
  236. Channel*newChannel(int units,int thermocouple);
  237. Q_INVOKABLE void setClockRate(double Hz);
  238. Q_INVOKABLE void start();
  239. };
  240. /*:322*//*329:*/
  241. #line 7435 "./typica.w"
  242. class Channel:public QObject
  243. {
  244. Q_OBJECT
  245. public:
  246. Channel();
  247. ~Channel();
  248. public slots:
  249. void input(Measurement measurement);
  250. signals:
  251. void newData(Measurement);
  252. };
  253. /*:329*//*333:*/
  254. #line 7502 "./typica.w"
  255. class LinearCalibrator:public QObject
  256. {
  257. Q_OBJECT
  258. Q_PROPERTY(double measuredLower READ measuredLower
  259. WRITE setMeasuredLower)
  260. Q_PROPERTY(double measuredUpper READ measuredUpper
  261. WRITE setMeasuredUpper)
  262. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  263. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  264. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  265. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  266. public:
  267. LinearCalibrator(QObject*parent= NULL);
  268. double measuredLower();
  269. double measuredUpper();
  270. double mappedLower();
  271. double mappedUpper();
  272. bool isClosedRange();
  273. double sensitivity();
  274. public slots:
  275. void setMeasuredLower(double lower);
  276. void setMeasuredUpper(double upper);
  277. void setMappedLower(double lower);
  278. void setMappedUpper(double upper);
  279. void setClosedRange(bool closed);
  280. void setSensitivity(double sensitivity);
  281. Measurement newMeasurement(Measurement measure);
  282. signals:
  283. void measurement(Measurement measure);
  284. void newData(Measurement measure);
  285. private:
  286. double Lo1;
  287. double Lo2;
  288. double Up1;
  289. double Up2;
  290. double sensitivitySetting;
  291. bool clamp;
  292. };
  293. /*:333*//*340:*/
  294. #line 7698 "./typica.w"
  295. class LinearSplineInterpolator:public QObject
  296. {
  297. Q_OBJECT
  298. public:
  299. LinearSplineInterpolator(QObject*parent= NULL);
  300. Q_INVOKABLE void add_pair(double source,double destination);
  301. public slots:
  302. Measurement newMeasurement(Measurement measure);
  303. signals:
  304. void newData(Measurement measure);
  305. private:
  306. void make_interpolators();
  307. QMap<double,double> *pairs;
  308. QList<LinearCalibrator*> *interpolators;
  309. };
  310. /*:340*//*345:*/
  311. #line 7834 "./typica.w"
  312. class TemperatureDisplay:public QLCDNumber
  313. {
  314. Q_OBJECT
  315. int unit;
  316. bool r;
  317. public:
  318. TemperatureDisplay(QWidget*parent= NULL);
  319. ~TemperatureDisplay();
  320. public slots:
  321. void setValue(Measurement temperature);
  322. void invalidate();
  323. void setDisplayUnits(Units::Unit scale);
  324. void setRelativeMode(bool relative);
  325. };
  326. /*:345*//*356:*/
  327. #line 8053 "./typica.w"
  328. class MeasurementTimeOffset:public QObject
  329. {
  330. Q_OBJECT
  331. QTime epoch;
  332. QTime previous;
  333. bool hasPrevious;
  334. public:
  335. MeasurementTimeOffset(QTime zero);
  336. QTime zeroTime();
  337. public slots:
  338. void newMeasurement(Measurement measure);
  339. void setZeroTime(QTime zero);
  340. signals:
  341. void measurement(Measurement measure);
  342. };
  343. /*:356*//*363:*/
  344. #line 8205 "./typica.w"
  345. class ThresholdDetector:public QObject
  346. {
  347. Q_OBJECT
  348. Q_ENUMS(EdgeDirection)
  349. public:
  350. enum EdgeDirection{
  351. Ascending,Descending
  352. };
  353. ThresholdDetector(double value);
  354. public slots:
  355. void newMeasurement(Measurement measure);
  356. void setThreshold(double value);
  357. void setEdgeDirection(EdgeDirection direction);
  358. signals:
  359. void timeForValue(double);
  360. private:
  361. double previousValue;
  362. double threshold;
  363. EdgeDirection currentDirection;
  364. };
  365. /*:363*//*368:*/
  366. #line 8311 "./typica.w"
  367. class ZeroEmitter:public QObject
  368. {
  369. Q_OBJECT
  370. Q_PROPERTY(int column READ column WRITE setColumn)
  371. Measurement cache;
  372. int col;
  373. public:
  374. ZeroEmitter(int tempcolumn= 1);
  375. int column();
  376. double lastTemperature();
  377. public slots:
  378. void newMeasurement(Measurement measure);
  379. void setColumn(int column);
  380. void emitZero();
  381. signals:
  382. void measurement(Measurement measure,int tempcolumn);
  383. };
  384. /*:368*//*373:*/
  385. #line 8405 "./typica.w"
  386. class MeasurementAdapter:public QObject
  387. {
  388. Q_OBJECT
  389. int col;
  390. public:
  391. MeasurementAdapter(int tempcolumn);
  392. int column();
  393. public slots:
  394. void newMeasurement(Measurement measure);
  395. void setColumn(int column);
  396. signals:
  397. void measurement(Measurement measure,int tempcolumn);
  398. };
  399. /*:373*//*378:*/
  400. #line 8494 "./typica.w"
  401. class GraphView:public QGraphicsView
  402. {
  403. Q_OBJECT
  404. QGraphicsScene*theScene;
  405. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  406. QMap<int,QPointF> *prevPoints;
  407. QMap<int,double> *translations;
  408. QList<QGraphicsItem*> *gridLinesF;
  409. QList<QGraphicsItem*> *gridLinesC;
  410. QList<QGraphicsItem*> *relativeGridLines;
  411. bool relativeEnabled;
  412. bool timeIndicatorEnabled;
  413. QGraphicsLineItem*timeLine;
  414. LinearSplineInterpolator*relativeAdjuster;
  415. public:
  416. GraphView(QWidget*parent= NULL);
  417. void removeSeries(int column);
  418. protected:
  419. void resizeEvent(QResizeEvent*event);
  420. public slots:
  421. void newMeasurement(Measurement measure,int tempcolumn);
  422. void setSeriesTranslation(int column,double offset);
  423. void setTimeIndicatorEnabled(bool enabled);
  424. void clear();
  425. void showF();
  426. void showC();
  427. };
  428. /*:378*//*395:*/
  429. #line 8959 "./typica.w"
  430. class MeasurementModel;
  431. class ZoomLog:public QTableView
  432. {
  433. Q_OBJECT
  434. /*396:*/
  435. #line 9008 "./typica.w"
  436. MeasurementModel*model_ms;
  437. MeasurementModel*model_1s;
  438. MeasurementModel*model_5s;
  439. MeasurementModel*model_10s;
  440. MeasurementModel*model_15s;
  441. MeasurementModel*model_30s;
  442. MeasurementModel*model_1m;
  443. QList<MeasurementModel*> modelSet;
  444. QHash<int,Measurement> lastMeasurement;
  445. MeasurementModel*currentModel;
  446. QList<int> saveTempCols;
  447. QList<int> saveControlCols;
  448. QList<int> saveNoteCols;
  449. QList<int> currentColumnSet;
  450. /*:396*/
  451. #line 8964 "./typica.w"
  452. void switchLOD(MeasurementModel*m);
  453. private slots:
  454. void centerOn(int row);
  455. void persistColumnResize(int column,int oldsize,int newsize);
  456. void restoreColumnWidths();
  457. public:
  458. ZoomLog();
  459. QVariant data(int row,int column)const;
  460. int rowCount();
  461. bool saveXML(QIODevice*device);
  462. bool saveCSV(QIODevice*device);
  463. QString lastTime(int series);
  464. Q_INVOKABLE Units::Unit displayUnits();
  465. public slots:
  466. void setVisible(bool visibility);
  467. void setHeaderData(int section,QString text);
  468. void LOD_ms();
  469. void LOD_1s();
  470. void LOD_5s();
  471. void LOD_10s();
  472. void LOD_15s();
  473. void LOD_30s();
  474. void LOD_1m();
  475. void newMeasurement(Measurement measure,int tempcolumn);
  476. void newAnnotation(QString annotation,int tempcolumn,
  477. int annotationcolumn);
  478. void clear();
  479. void addOutputTemperatureColumn(int column);
  480. void addOutputControlColumn(int column);
  481. void addOutputAnnotationColumn(int column);
  482. void clearOutputColumns();
  483. void setDisplayUnits(Units::Unit scale);
  484. void addToCurrentColumnSet(int column);
  485. void clearCurrentColumnSet();
  486. protected:
  487. virtual void showEvent(QShowEvent*event);
  488. };
  489. /*:395*//*421:*/
  490. #line 9704 "./typica.w"
  491. class MeasurementList;
  492. class MeasurementModel:public QAbstractItemModel
  493. {
  494. Q_OBJECT
  495. Units::Unit unit;
  496. QList<MeasurementList*> *entries;
  497. QStringList*hData;
  498. int colcount;
  499. QHash<int,int> *lastTemperature;
  500. QList<MeasurementList*> ::iterator lastInsertion;
  501. QHash<int,bool> *controlColumns;
  502. public:
  503. MeasurementModel(QObject*parent= NULL);
  504. ~MeasurementModel();
  505. int rowCount(const QModelIndex&parent= QModelIndex())const;
  506. int columnCount(const QModelIndex&parent= QModelIndex())const;
  507. bool setHeaderData(int section,Qt::Orientation orientation,
  508. const QVariant&value,int role= Qt::DisplayRole);
  509. QVariant data(const QModelIndex&index,int role)const;
  510. bool setData(const QModelIndex&index,const QVariant&value,
  511. int role= Qt::EditRole);
  512. Qt::ItemFlags flags(const QModelIndex&index)const;
  513. QVariant headerData(int section,Qt::Orientation orientation,
  514. int role= Qt::DisplayRole)const;
  515. QModelIndex index(int row,int column,
  516. const QModelIndex&parent= QModelIndex())const;
  517. QModelIndex parent(const QModelIndex&index)const;
  518. Units::Unit displayUnits();
  519. public slots:
  520. void newMeasurement(Measurement measure,int tempcolumn);
  521. void newAnnotation(QString annotation,int tempcolumn,
  522. int annotationColumn);
  523. void clear();
  524. void setDisplayUnits(Units::Unit scale);
  525. signals:
  526. void rowChanged(int);
  527. };
  528. /*:421*//*422:*/
  529. #line 9748 "./typica.w"
  530. class MeasurementList:public QVariantList
  531. {
  532. public:
  533. bool operator<(const MeasurementList&other)const;
  534. bool operator==(const MeasurementList&other)const;
  535. };
  536. /*:422*//*448:*/
  537. #line 10406 "./typica.w"
  538. class AnnotationButton:public QPushButton
  539. {
  540. Q_OBJECT
  541. QString note;
  542. int tc;
  543. int ac;
  544. int count;
  545. public:
  546. AnnotationButton(const QString&text,QWidget*parent= NULL);
  547. public slots:
  548. void setAnnotation(const QString&annotation);
  549. void setTemperatureColumn(int tempcolumn);
  550. void setAnnotationColumn(int annotationcolumn);
  551. void annotate();
  552. void resetCount();
  553. signals:
  554. void annotation(QString annotation,int tempcolumn,
  555. int notecolumn);
  556. };
  557. /*:448*//*456:*/
  558. #line 10531 "./typica.w"
  559. class AnnotationSpinBox:public QDoubleSpinBox
  560. {
  561. Q_OBJECT
  562. QString pretext;
  563. QString posttext;
  564. int tc;
  565. int ac;
  566. bool change;
  567. public:
  568. AnnotationSpinBox(const QString&pret,const QString&postt,
  569. QWidget*parent= NULL);
  570. public slots:
  571. void setPretext(const QString&pret);
  572. void setPosttext(const QString&postt);
  573. void setTemperatureColumn(int tempcolumn);
  574. void setAnnotationColumn(int annotationcolumn);
  575. void annotate();
  576. void resetChange();
  577. signals:
  578. void annotation(QString annotation,int tempcolumn,
  579. int notecolumn);
  580. };
  581. /*:456*//*464:*/
  582. #line 10690 "./typica.w"
  583. class TimerDisplay:public QLCDNumber
  584. {
  585. Q_OBJECT
  586. /*465:*/
  587. #line 10740 "./typica.w"
  588. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  589. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  590. Q_PROPERTY(bool running READ isRunning)
  591. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  592. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  593. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  594. Q_PROPERTY(QString value READ value)
  595. /*:465*/
  596. #line 10694 "./typica.w"
  597. private slots:
  598. void updateTime();
  599. void setCountUpMode();
  600. void setCountDownMode();
  601. void setClockMode();
  602. public:
  603. TimerDisplay(QWidget*parent= NULL);
  604. ~TimerDisplay();
  605. enum TimerMode
  606. {
  607. CountUp,
  608. CountDown,
  609. Clock
  610. };
  611. QString value();
  612. QTime seconds();
  613. TimerMode mode();
  614. bool isRunning();
  615. QTime resetValue();
  616. QString displayFormat();
  617. bool autoReset();
  618. public slots:
  619. void setTimer(QTime value= QTime(0,0,0));
  620. void setMode(TimerMode mode);
  621. void startTimer();
  622. void stopTimer();
  623. void copyTimer();
  624. void setResetValue(QTime value= QTime(0,0,0));
  625. void reset();
  626. void setDisplayFormat(QString format);
  627. void setAutoReset(bool reset);
  628. void updateDisplay();
  629. signals:
  630. void valueChanged(QTime);
  631. void runStateChanged(bool);
  632. private:
  633. /*466:*/
  634. #line 10751 "./typica.w"
  635. QTime s;
  636. QTime r;
  637. QTimer clock;
  638. TimerDisplay::TimerMode m;
  639. bool running;
  640. bool ar;
  641. QAction*startAction;
  642. QAction*stopAction;
  643. QAction*resetAction;
  644. QString f;
  645. QTime relative;
  646. QTime base;
  647. /*:466*/
  648. #line 10731 "./typica.w"
  649. };
  650. /*:464*//*487:*/
  651. #line 11143 "./typica.w"
  652. class PackLayout:public QLayout
  653. {
  654. int doLayout(const QRect&rect,bool testOnly)const;
  655. QList<QLayoutItem*> itemList;
  656. Qt::Orientations orientation;
  657. public:
  658. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  659. PackLayout(int spacing= -1);
  660. ~PackLayout();
  661. void addItem(QLayoutItem*item);
  662. Qt::Orientations expandingDirections()const;
  663. bool hasHeightForWidth()const;
  664. int heightForWidth(int width)const;
  665. int count()const;
  666. QLayoutItem*itemAt(int index)const;
  667. QSize minimumSize()const;
  668. void setGeometry(const QRect&rect);
  669. void setOrientation(Qt::Orientations direction);
  670. QSize sizeHint()const;
  671. QLayoutItem*takeAt(int index);
  672. };
  673. /*:487*//*500:*/
  674. #line 11421 "./typica.w"
  675. class SceneButton:public QGraphicsScene
  676. {
  677. Q_OBJECT
  678. public:
  679. SceneButton();
  680. ~SceneButton();
  681. protected:
  682. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  683. signals:
  684. void clicked(QPoint pos);
  685. };
  686. /*:500*//*502:*/
  687. #line 11463 "./typica.w"
  688. class WidgetDecorator:public QWidget
  689. {
  690. Q_OBJECT
  691. PackLayout*layout;
  692. QGraphicsView*label;
  693. QGraphicsTextItem*text;
  694. SceneButton*scene;
  695. public:
  696. WidgetDecorator(QWidget*widget,const QString&labeltext,
  697. Qt::Orientations orientation= Qt::Horizontal,
  698. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  699. ~WidgetDecorator();
  700. void setBackgroundBrush(QBrush background);
  701. void setTextColor(QColor color);
  702. };
  703. /*:502*//*513:*/
  704. #line 11638 "./typica.w"
  705. class LogEditWindow:public QMainWindow
  706. {
  707. Q_OBJECT
  708. QWidget*centralWidget;
  709. PackLayout*mainLayout;
  710. QHBoxLayout*addRowsLayout;
  711. QLabel*startTimeLabel;
  712. QTimeEdit*startTime;
  713. QLabel*endTimeLabel;
  714. QTimeEdit*endTime;
  715. QLabel*intervalLabel;
  716. QSpinBox*interval;
  717. QPushButton*addRows;
  718. QAction*saveXml;
  719. QAction*saveCsv;
  720. QAction*openXml;
  721. MeasurementModel*model;
  722. QTableView*log;
  723. private slots:
  724. void addTheRows();
  725. void saveXML();
  726. void saveCSV();
  727. void openXML();
  728. protected:
  729. void closeEvent(QCloseEvent*event);
  730. public:
  731. LogEditWindow();
  732. };
  733. /*:513*//*527:*/
  734. #line 11946 "./typica.w"
  735. class XMLOutput:public QObject
  736. {
  737. Q_OBJECT
  738. MeasurementModel*data;
  739. QIODevice*out;
  740. int time;
  741. QMap<int,QString> temperatureColumns;
  742. QMap<int,QString> controlColumns;
  743. QMap<int,QString> annotationColumns;
  744. public:
  745. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  746. void addTemperatureColumn(const QString&series,int column);
  747. void addControlColumn(const QString&series,int column);
  748. void addAnnotationColumn(const QString&series,int column);
  749. void setModel(MeasurementModel*model);
  750. void setTimeColumn(int column);
  751. void setDevice(QIODevice*device);
  752. bool output();
  753. };
  754. /*:527*//*534:*/
  755. #line 12182 "./typica.w"
  756. class XMLInput:public QObject
  757. {
  758. Q_OBJECT
  759. int firstc;
  760. QIODevice*in;
  761. public:
  762. XMLInput(QIODevice*input,int c);
  763. void setFirstColumn(int column);
  764. void setDevice(QIODevice*device);
  765. bool input();
  766. signals:
  767. void measure(Measurement,int);
  768. void annotation(QString,int,int);
  769. void newTemperatureColumn(int,QString);
  770. void newAnnotationColumn(int,QString);
  771. void lastColumn(int);
  772. };
  773. /*:534*//*545:*/
  774. #line 12436 "./typica.w"
  775. class CSVOutput
  776. {
  777. MeasurementModel*data;
  778. QIODevice*out;
  779. int time;
  780. QMap<int,QString> temperatureColumns;
  781. QMap<int,QString> controlColumns;
  782. QMap<int,QString> annotationColumns;
  783. public:
  784. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  785. void addTemperatureColumn(const QString&series,int column);
  786. void addControlColumn(const QString&series,int column);
  787. void addAnnotationColumn(const QString&series,int column);
  788. void setModel(MeasurementModel*model);
  789. void setTimeColumn(int column);
  790. void setDevice(QIODevice*device);
  791. bool output();
  792. };
  793. /*:545*//*575:*/
  794. #line 12579 "./typica.w"
  795. #define AppInstance (qobject_cast<Application *> (qApp))
  796. class NodeInserter;
  797. class DeviceTreeModel;
  798. class Application:public QApplication
  799. {
  800. Q_OBJECT
  801. public:
  802. Application(int&argc,char**argv);
  803. QDomDocument*configuration();
  804. /*717:*/
  805. #line 15143 "./typica.w"
  806. QDomDocument deviceConfiguration();
  807. /*:717*//*750:*/
  808. #line 15816 "./typica.w"
  809. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  810. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  811. const QModelIndex&index);
  812. /*:750*//*755:*/
  813. #line 15920 "./typica.w"
  814. QList<NodeInserter*> topLevelNodeInserters;
  815. /*:755*/
  816. #line 12590 "./typica.w"
  817. QSqlDatabase database();
  818. QScriptEngine*engine;
  819. public slots:
  820. /*718:*/
  821. #line 15150 "./typica.w"
  822. void saveDeviceConfiguration();
  823. /*:718*/
  824. #line 12594 "./typica.w"
  825. private:
  826. /*716:*/
  827. #line 15134 "./typica.w"
  828. QDomDocument deviceConfigurationDocument;
  829. /*:716*//*749:*/
  830. #line 15810 "./typica.w"
  831. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  832. /*:749*/
  833. #line 12596 "./typica.w"
  834. QDomDocument conf;
  835. };
  836. /*:575*//*583:*/
  837. #line 12721 "./typica.w"
  838. class SaltModel:public QAbstractItemModel
  839. {
  840. Q_OBJECT
  841. QList<QList<QMap<int,QVariant> > > modelData;
  842. QStringList hData;
  843. int colcount;
  844. public:
  845. SaltModel(int columns);
  846. ~SaltModel();
  847. int rowCount(const QModelIndex&parent= QModelIndex())const;
  848. int columnCount(const QModelIndex&parent= QModelIndex())const;
  849. bool setHeaderData(int section,Qt::Orientation orientation,
  850. const QVariant&value,int role= Qt::DisplayRole);
  851. QVariant data(const QModelIndex&index,int role)const;
  852. bool setData(const QModelIndex&index,const QVariant&value,
  853. int role= Qt::EditRole);
  854. Qt::ItemFlags flags(const QModelIndex&index)const;
  855. QVariant headerData(int section,Qt::Orientation orientation,
  856. int role= Qt::DisplayRole)const;
  857. QModelIndex index(int row,int column,
  858. const QModelIndex&parent= QModelIndex())const;
  859. QModelIndex parent(const QModelIndex&index)const;
  860. QString arrayLiteral(int column,int role)const;
  861. QString quotedArrayLiteral(int column,int role)const;
  862. void clear();
  863. bool removeRows(int row,int count,
  864. const QModelIndex&parent= QModelIndex());
  865. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  866. };
  867. /*:583*//*599:*/
  868. #line 13106 "./typica.w"
  869. class SqlComboBox:public QComboBox
  870. {
  871. Q_OBJECT
  872. int dataColumn;
  873. int displayColumn;
  874. bool dataColumnShown;
  875. QString specialNullText;
  876. QVariant specialNullData;
  877. public:
  878. SqlComboBox();
  879. ~SqlComboBox();
  880. SqlComboBox*clone(QWidget*parent);
  881. public slots:
  882. void addNullOption();
  883. void addSqlOptions(QString query);
  884. void setDataColumn(int column);
  885. void setDisplayColumn(int column);
  886. void showData(bool show);
  887. void setNullText(QString nullText);
  888. void setNullData(QVariant nullData);
  889. };
  890. /*:599*//*606:*/
  891. #line 13253 "./typica.w"
  892. class SqlComboBoxDelegate:public QItemDelegate
  893. {
  894. Q_OBJECT
  895. SqlComboBox*delegate;
  896. public:
  897. SqlComboBoxDelegate(QObject*parent= NULL);
  898. QWidget*createEditor(QWidget*parent,
  899. const QStyleOptionViewItem&option,
  900. const QModelIndex&index)const;
  901. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  902. void setModelData(QWidget*editor,QAbstractItemModel*model,
  903. const QModelIndex&index)const;
  904. void setWidget(SqlComboBox*widget);
  905. virtual QSize sizeHint()const;
  906. void updateEditorGeometry(QWidget*editor,
  907. const QStyleOptionViewItem&option,
  908. const QModelIndex&index)const;
  909. };
  910. /*:606*//*621:*/
  911. #line 13464 "./typica.w"
  912. class SqlConnectionSetup:public QDialog
  913. {
  914. Q_OBJECT
  915. public:
  916. SqlConnectionSetup();
  917. ~SqlConnectionSetup();
  918. public slots:
  919. void testConnection();
  920. private:
  921. QFormLayout*formLayout;
  922. QComboBox*driver;
  923. QLineEdit*hostname;
  924. QLineEdit*portnumber;
  925. QLineEdit*dbname;
  926. QLineEdit*user;
  927. QLineEdit*password;
  928. QVBoxLayout*layout;
  929. QHBoxLayout*buttons;
  930. QPushButton*cancelButton;
  931. QPushButton*connectButton;
  932. };
  933. /*:621*//*626:*/
  934. #line 13607 "./typica.w"
  935. class SqlQueryView:public QTableView
  936. {
  937. Q_OBJECT
  938. public:
  939. SqlQueryView(QWidget*parent= NULL);
  940. void setQuery(const QString&query);
  941. bool setHeaderData(int section,Qt::Orientation orientation,
  942. const QVariant&value,int role);
  943. Q_INVOKABLE QVariant data(int row,int column,
  944. int role= Qt::DisplayRole);
  945. signals:
  946. void openEntry(QString key);
  947. void openEntryRow(int row);
  948. protected:
  949. virtual void showEvent(QShowEvent*event);
  950. private slots:
  951. void openRow(const QModelIndex&index);
  952. void persistColumnResize(int column,int oldsize,int newsize);
  953. };
  954. /*:626*//*641:*/
  955. #line 13862 "./typica.w"
  956. class ReportAction:public QAction
  957. {
  958. Q_OBJECT
  959. public:
  960. ReportAction(const QString&fileName,const QString&reportName,
  961. QObject*parent= NULL);
  962. private slots:
  963. void createReport();
  964. private:
  965. QString reportFile;
  966. };
  967. /*:641*//*653:*/
  968. #line 14073 "./typica.w"
  969. class ReportTable:public QObject
  970. {
  971. Q_OBJECT
  972. QTextFrame*area;
  973. QDomElement configuration;
  974. QMap<QString,QVariant> bindings;
  975. public:
  976. ReportTable(QTextFrame*frame,QDomElement description);
  977. ~ReportTable();
  978. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  979. public slots:
  980. void refresh();
  981. };
  982. /*:653*//*686:*/
  983. #line 14312 "./typica.w"
  984. class FormArray:public QScrollArea
  985. {
  986. Q_OBJECT
  987. QDomElement configuration;
  988. QWidget itemContainer;
  989. QVBoxLayout itemLayout;
  990. int maxwidth;
  991. int maxheight;
  992. public:
  993. FormArray(QDomElement description);
  994. Q_INVOKABLE QWidget*elementAt(int index);
  995. Q_INVOKABLE int elements();
  996. public slots:
  997. void addElements(int copies= 1);
  998. void removeAllElements();
  999. void setMaximumElementWidth(int width);
  1000. void setMaximumElementHeight(int height);
  1001. };
  1002. /*:686*//*696:*/
  1003. #line 14528 "./typica.w"
  1004. class ScaleControl:public QGraphicsView
  1005. {
  1006. Q_OBJECT
  1007. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  1008. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  1009. /*697:*/
  1010. #line 14554 "./typica.w"
  1011. QGraphicsScene scene;
  1012. QGraphicsPolygonItem initialDecrement;
  1013. QGraphicsPolygonItem initialIncrement;
  1014. QGraphicsPolygonItem finalDecrement;
  1015. QGraphicsPolygonItem finalIncrement;
  1016. QGraphicsPolygonItem initialIndicator;
  1017. QGraphicsPolygonItem finalIndicator;
  1018. QGraphicsPathItem scaleLine;
  1019. QPolygonF left;
  1020. QPolygonF right;
  1021. QPolygonF down;
  1022. QPolygonF up;
  1023. QPainterPath scalePath;
  1024. QBrush initialBrush;
  1025. QBrush finalBrush;
  1026. double nonScoredValue;
  1027. double scoredValue;
  1028. bool initialSet;
  1029. bool finalSet;
  1030. bool scaleDown;
  1031. /*:697*/
  1032. #line 14534 "./typica.w"
  1033. public:
  1034. ScaleControl();
  1035. double initialValue(void);
  1036. double finalValue(void);
  1037. virtual QSize sizeHint()const;
  1038. public slots:
  1039. void setInitialValue(double value);
  1040. void setFinalValue(double value);
  1041. signals:
  1042. void initialChanged(double);
  1043. void finalChanged(double);
  1044. protected:
  1045. virtual void mousePressEvent(QMouseEvent*event);
  1046. virtual void mouseReleaseEvent(QMouseEvent*event);
  1047. };
  1048. /*:696*//*708:*/
  1049. #line 14851 "./typica.w"
  1050. class IntensityControl:public QGraphicsView
  1051. {
  1052. Q_OBJECT
  1053. Q_PROPERTY(double value READ value WRITE setValue)
  1054. QGraphicsScene scene;
  1055. QGraphicsPolygonItem decrement;
  1056. QGraphicsPolygonItem increment;
  1057. QGraphicsPolygonItem indicator;
  1058. QGraphicsPathItem scaleLine;
  1059. QPolygonF left;
  1060. QPolygonF up;
  1061. QPolygonF down;
  1062. QPainterPath scalePath;
  1063. QBrush theBrush;
  1064. double theValue;
  1065. bool valueSet;
  1066. bool scaleDown;
  1067. public:
  1068. IntensityControl();
  1069. double value();
  1070. virtual QSize sizeHint()const;
  1071. public slots:
  1072. void setValue(double val);
  1073. signals:
  1074. void valueChanged(double);
  1075. protected:
  1076. virtual void mousePressEvent(QMouseEvent*event);
  1077. virtual void mouseReleaseEvent(QMouseEvent*event);
  1078. };
  1079. /*:708*//*724:*/
  1080. #line 15239 "./typica.w"
  1081. class DeviceTreeModelNode
  1082. {
  1083. public:
  1084. DeviceTreeModelNode(QDomNode&node,int row,
  1085. DeviceTreeModelNode*parent= NULL);
  1086. ~DeviceTreeModelNode();
  1087. DeviceTreeModelNode*child(int index);
  1088. DeviceTreeModelNode*parent();
  1089. QDomNode node()const;
  1090. int row();
  1091. private:
  1092. QDomNode domNode;
  1093. QHash<int,DeviceTreeModelNode*> children;
  1094. int rowNumber;
  1095. DeviceTreeModelNode*parentItem;
  1096. };
  1097. /*:724*//*726:*/
  1098. #line 15314 "./typica.w"
  1099. class DeviceTreeModel:public QAbstractItemModel
  1100. {
  1101. Q_OBJECT
  1102. public:
  1103. DeviceTreeModel(QObject*parent= NULL);
  1104. ~DeviceTreeModel();
  1105. QVariant data(const QModelIndex&index,int role)const;
  1106. Qt::ItemFlags flags(const QModelIndex&index)const;
  1107. QVariant headerData(int section,Qt::Orientation orientation,
  1108. int role= Qt::DisplayRole)const;
  1109. QModelIndex index(int row,int column,
  1110. const QModelIndex&parent= QModelIndex())const;
  1111. QModelIndex parent(const QModelIndex&child)const;
  1112. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1113. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1114. bool setData(const QModelIndex&index,const QVariant&value,
  1115. int role);
  1116. bool removeRows(int row,int count,const QModelIndex&parent);
  1117. QDomElement referenceElement(const QString&id);
  1118. public slots:
  1119. void newNode(const QString&name,const QString&driver,
  1120. const QModelIndex&parent);
  1121. private:
  1122. QDomDocument document;
  1123. DeviceTreeModelNode*root;
  1124. QDomNode referenceSection;
  1125. QDomNode treeRoot;
  1126. };
  1127. /*:726*//*745:*/
  1128. #line 15768 "./typica.w"
  1129. Q_DECLARE_METATYPE(QModelIndex)
  1130. /*:745*//*753:*/
  1131. #line 15875 "./typica.w"
  1132. class NodeInserter:public QAction
  1133. {
  1134. Q_OBJECT
  1135. public:
  1136. NodeInserter(const QString&title,const QString&name,
  1137. const QString&driver,QObject*parent= NULL);
  1138. signals:
  1139. void triggered(QString name,QString driver);
  1140. private slots:
  1141. void onTriggered();
  1142. private:
  1143. QString defaultNodeName;
  1144. QString driverString;
  1145. };
  1146. /*:753*//*756:*/
  1147. #line 15930 "./typica.w"
  1148. class DeviceConfigurationWindow:public QWidget
  1149. {
  1150. Q_OBJECT
  1151. public:
  1152. DeviceConfigurationWindow();
  1153. public slots:
  1154. void addDevice();
  1155. void removeNode();
  1156. void newSelection(const QModelIndex&index);
  1157. private slots:
  1158. void resizeColumn();
  1159. private:
  1160. QDomDocument document;
  1161. DeviceTreeModel*model;
  1162. QTreeView*view;
  1163. QScrollArea*configArea;
  1164. };
  1165. /*:756*//*765:*/
  1166. #line 16100 "./typica.w"
  1167. class BasicDeviceConfigurationWidget:public QWidget
  1168. {
  1169. Q_OBJECT
  1170. public:
  1171. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1172. const QModelIndex&index);
  1173. public slots:
  1174. void insertChildNode(const QString&name,const QString&driver);
  1175. void updateAttribute(const QString&name,const QString&value);
  1176. protected:
  1177. DeviceTreeModel*deviceModel;
  1178. QModelIndex currentNode;
  1179. };
  1180. /*:765*//*769:*/
  1181. #line 16185 "./typica.w"
  1182. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1183. {
  1184. Q_OBJECT
  1185. public:
  1186. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1187. const QModelIndex&index);
  1188. private slots:
  1189. void updateRoasterId(int id);
  1190. void updateCapacityCheck(int value);
  1191. void updateCapacity(const QString&value);
  1192. void updateCapacityUnit(const QString&value);
  1193. };
  1194. /*:769*//*774:*/
  1195. #line 16390 "./typica.w"
  1196. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1197. {
  1198. Q_OBJECT
  1199. public:
  1200. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1201. const QModelIndex&index);
  1202. };
  1203. /*:774*//*776:*/
  1204. #line 16436 "./typica.w"
  1205. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1206. {
  1207. Q_OBJECT
  1208. public:
  1209. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1210. const QModelIndex&index);
  1211. private slots:
  1212. void addChannel();
  1213. void updateDeviceId(const QString&newId);
  1214. };
  1215. /*:776*//*780:*/
  1216. #line 16522 "./typica.w"
  1217. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1218. {
  1219. Q_OBJECT
  1220. public:
  1221. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1222. const QModelIndex&index);
  1223. private slots:
  1224. void updateThermocoupleType(const QString&type);
  1225. void updateColumnName(const QString&name);
  1226. void updateHidden(bool hidden);
  1227. };
  1228. /*:780*//*785:*/
  1229. #line 16638 "./typica.w"
  1230. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1231. {
  1232. Q_OBJECT
  1233. public:
  1234. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1235. const QModelIndex&index);
  1236. };
  1237. /*:785*//*787:*/
  1238. #line 16679 "./typica.w"
  1239. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1240. {
  1241. Q_OBJECT
  1242. public:
  1243. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1244. const QModelIndex&index);
  1245. private slots:
  1246. void addChannel();
  1247. void updateDeviceId(const QString&newId);
  1248. };
  1249. /*:787*//*789:*/
  1250. #line 16748 "./typica.w"
  1251. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1252. {
  1253. Q_OBJECT
  1254. public:
  1255. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1256. const QModelIndex&index);
  1257. private slots:
  1258. void updateDeviceId(const QString&newId);
  1259. void updateThermocoupleType(const QString&type);
  1260. void updateColumnName(const QString&name);
  1261. void updateHidden(bool hidden);
  1262. };
  1263. /*:789*//*794:*/
  1264. #line 16879 "./typica.w"
  1265. class PortSelector:public QComboBox
  1266. {
  1267. Q_OBJECT
  1268. public:
  1269. PortSelector(QWidget*parent= NULL);
  1270. private slots:
  1271. void addDevice(QextPortInfo port);
  1272. private:
  1273. QextSerialEnumerator*lister;
  1274. };
  1275. /*:794*//*796:*/
  1276. #line 16927 "./typica.w"
  1277. class BaudSelector:public QComboBox
  1278. {
  1279. Q_OBJECT
  1280. Q_ENUMS(BaudRateType)
  1281. public:
  1282. BaudSelector(QWidget*parent= NULL);
  1283. enum BaudRateType
  1284. {
  1285. #if defined(Q_OS_UNIX) || defined(qdoc)
  1286. BAUD50= 50,
  1287. BAUD75= 75,
  1288. BAUD134= 134,
  1289. BAUD150= 150,
  1290. BAUD200= 200,
  1291. BAUD1800= 1800,
  1292. #if defined(B76800) || defined(qdoc)
  1293. BAUD76800= 76800,
  1294. #endif
  1295. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1296. BAUD230400= 230400,
  1297. BAUD460800= 460800,
  1298. BAUD500000= 500000,
  1299. BAUD576000= 576000,
  1300. BAUD921600= 921600,
  1301. BAUD1000000= 1000000,
  1302. BAUD1152000= 1152000,
  1303. BAUD1500000= 1500000,
  1304. BAUD2000000= 2000000,
  1305. BAUD2500000= 2500000,
  1306. BAUD3000000= 3000000,
  1307. BAUD3500000= 3500000,
  1308. BAUD4000000= 4000000,
  1309. #endif
  1310. #endif
  1311. #if defined(Q_OS_WIN) || defined(qdoc)
  1312. BAUD14400= 14400,
  1313. BAUD56000= 56000,
  1314. BAUD128000= 128000,
  1315. BAUD256000= 256000,
  1316. #endif
  1317. BAUD110= 110,
  1318. BAUD300= 300,
  1319. BAUD600= 600,
  1320. BAUD1200= 1200,
  1321. BAUD2400= 2400,
  1322. BAUD4800= 4800,
  1323. BAUD9600= 9600,
  1324. BAUD19200= 19200,
  1325. BAUD38400= 38400,
  1326. BAUD57600= 57600,
  1327. BAUD115200= 115200
  1328. };
  1329. };
  1330. /*:796*//*798:*/
  1331. #line 16998 "./typica.w"
  1332. class ParitySelector:public QComboBox
  1333. {
  1334. Q_OBJECT
  1335. Q_ENUMS(ParityType)
  1336. public:
  1337. ParitySelector(QWidget*parent= NULL);
  1338. enum ParityType
  1339. {
  1340. PAR_NONE,
  1341. PAR_ODD,
  1342. PAR_EVEN,
  1343. #if defined(Q_OS_WIN) || defined(qdoc)
  1344. PAR_MARK,
  1345. #endif
  1346. PAR_SPACE
  1347. };
  1348. };
  1349. /*:798*//*800:*/
  1350. #line 17036 "./typica.w"
  1351. class FlowSelector:public QComboBox
  1352. {
  1353. Q_OBJECT
  1354. Q_ENUMS(FlowType)
  1355. public:
  1356. FlowSelector(QWidget*parent= NULL);
  1357. enum FlowType
  1358. {
  1359. FLOW_OFF,
  1360. FLOW_HARDWARE,
  1361. FLOW_XONXOFF
  1362. };
  1363. };
  1364. /*:800*//*802:*/
  1365. #line 17069 "./typica.w"
  1366. class StopSelector:public QComboBox
  1367. {
  1368. Q_OBJECT
  1369. Q_ENUMS(StopBitsType)
  1370. public:
  1371. StopSelector(QWidget*parent= NULL);
  1372. enum StopBitsType
  1373. {
  1374. STOP_1,
  1375. #if defined(Q_OS_WIN) || defined(qdoc)
  1376. STOP_1_5,
  1377. #endif
  1378. STOP_2
  1379. };
  1380. };
  1381. /*:802*//*805:*/
  1382. #line 17122 "./typica.w"
  1383. class ShortHexSpinBox:public QSpinBox
  1384. {
  1385. Q_OBJECT
  1386. public:
  1387. ShortHexSpinBox(QWidget*parent= NULL);
  1388. virtual QValidator::State validate(QString&input,int&pos)const;
  1389. protected:
  1390. virtual int valueFromText(const QString&text)const;
  1391. virtual QString textFromValue(int value)const;
  1392. };
  1393. /*:805*//*807:*/
  1394. #line 17184 "./typica.w"
  1395. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1396. {
  1397. Q_OBJECT
  1398. public:
  1399. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1400. const QModelIndex&index);
  1401. private slots:
  1402. void updatePort(const QString&newPort);
  1403. void updateBaudRate(const QString&newRate);
  1404. void updateParity(const QString&newParity);
  1405. void updateFlowControl(const QString&newFlow);
  1406. void updateStopBits(const QString&newStopBits);
  1407. };
  1408. /*:807*//*809:*/
  1409. #line 17335 "./typica.w"
  1410. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1411. {
  1412. Q_OBJECT
  1413. public:
  1414. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1415. const QModelIndex&index);
  1416. private slots:
  1417. void updateStationNumber(int newStation);
  1418. void updateFixedUnit(bool newFixed);
  1419. void updateFixedDecimal(bool newFixed);
  1420. void updateUnit(const QString&newUnit);
  1421. void updateUnitAddress(int newAddress);
  1422. void updateValueF(int newValue);
  1423. void updateValueC(int newValue);
  1424. void updatePrecisionAddress(int newAddress);
  1425. void updatePrecisionValue(int newValue);
  1426. private:
  1427. QStackedLayout*unitSpecificationLayout;
  1428. QStackedLayout*decimalSpecificationLayout;
  1429. };
  1430. /*:809*//*811:*/
  1431. #line 17594 "./typica.w"
  1432. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1433. {
  1434. Q_OBJECT
  1435. public:
  1436. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1437. const QModelIndex&index);
  1438. private slots:
  1439. void updateAddress(int newAddress);
  1440. };
  1441. /*:811*//*813:*/
  1442. #line 17640 "./typica.w"
  1443. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1444. {
  1445. Q_OBJECT
  1446. public:
  1447. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1448. const QModelIndex&index);
  1449. private slots:
  1450. void updateReadAddress(int newAddress);
  1451. void updateWriteAddress(int newAddress);
  1452. void updateFixedRange(bool fixed);
  1453. void updateLower(const QString&lower);
  1454. void updateUpper(const QString&upper);
  1455. void updateLowerAddress(int newAddress);
  1456. void updateUpperAddress(int newAddress);
  1457. private:
  1458. QStackedLayout*boundsLayout;
  1459. };
  1460. /*:813*//*817:*/
  1461. #line 17834 "./typica.w"
  1462. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1463. {
  1464. Q_OBJECT
  1465. public:
  1466. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1467. private slots:
  1468. void updateButtonText(const QString&text);
  1469. void updateAnnotationText(const QString&text);
  1470. };
  1471. /*:817*//*821:*/
  1472. #line 17902 "./typica.w"
  1473. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1474. {
  1475. Q_OBJECT
  1476. public:
  1477. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1478. private slots:
  1479. void updateButtonText(const QString&text);
  1480. void updateAnnotationText(const QString&text);
  1481. };
  1482. /*:821*//*824:*/
  1483. #line 17976 "./typica.w"
  1484. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1485. {
  1486. Q_OBJECT
  1487. public:
  1488. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1489. private slots:
  1490. void updateLabel(const QString&text);
  1491. void updateMinimum(const QString&minimum);
  1492. void updateMaximum(const QString&maximum);
  1493. void updatePrecision(int precision);
  1494. void updatePretext(const QString&text);
  1495. void updatePosttext(const QString&text);
  1496. };
  1497. /*:824*//*827:*/
  1498. #line 12 "./freeannotation.w"
  1499. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1500. {
  1501. Q_OBJECT
  1502. public:
  1503. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1504. private slots:
  1505. void updateLabel(const QString&text);
  1506. };
  1507. /*:827*//*831:*/
  1508. #line 11 "./settings.w"
  1509. class SettingsWindow:public QMainWindow
  1510. {
  1511. Q_OBJECT
  1512. public:
  1513. SettingsWindow();
  1514. };
  1515. /*:831*//*836:*/
  1516. #line 8 "./graphsettings.w"
  1517. class GraphSettingsWidget:public QWidget
  1518. {
  1519. Q_OBJECT
  1520. public:
  1521. GraphSettingsWidget();
  1522. };
  1523. /*:836*//*838:*/
  1524. #line 46 "./graphsettings.w"
  1525. class GraphSettingsRelativeTab:public QWidget
  1526. {
  1527. Q_OBJECT
  1528. public:
  1529. GraphSettingsRelativeTab();
  1530. public slots:
  1531. void updateEnableSetting(bool enable);
  1532. void updateColorSetting(const QString&color);
  1533. void updateAxisSetting(const QString&gridList);
  1534. void updateUnit(int unit);
  1535. void showColorPicker();
  1536. private:
  1537. QLineEdit*colorEdit;
  1538. };
  1539. /*:838*//*842:*/
  1540. #line 7 "./advancedsettings.w"
  1541. class AdvancedSettingsWidget:public QWidget
  1542. {
  1543. Q_OBJECT
  1544. public:
  1545. AdvancedSettingsWidget();
  1546. public slots:
  1547. void enableDiagnosticLogging(bool enabled);
  1548. };
  1549. /*:842*//*846:*/
  1550. #line 18101 "./typica.w"
  1551. class ModbusRTUDevice:public QObject
  1552. {
  1553. Q_OBJECT
  1554. public:
  1555. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1556. ~ModbusRTUDevice();
  1557. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1558. Q_INVOKABLE double SVLower();
  1559. Q_INVOKABLE double SVUpper();
  1560. Q_INVOKABLE int decimals();
  1561. QList<Channel*> channels;
  1562. public slots:
  1563. void outputSV(double sv);
  1564. signals:
  1565. void SVLowerChanged(double);
  1566. void SVUpperChanged(double);
  1567. void SVDecimalChanged(int);
  1568. void queueEmpty();
  1569. private slots:
  1570. void dataAvailable();
  1571. void sendNextMessage();
  1572. void decimalResponse(QByteArray response);
  1573. void unitResponse(QByteArray response);
  1574. void svlResponse(QByteArray response);
  1575. void svuResponse(QByteArray response);
  1576. void requestMeasurement();
  1577. void mResponse(QByteArray response);
  1578. void ignore(QByteArray response);
  1579. void timeout();
  1580. private:
  1581. QextSerialPort*port;
  1582. QByteArray responseBuffer;
  1583. QList<QByteArray> messageQueue;
  1584. QList<QObject*> retObjQueue;
  1585. QList<char*> callbackQueue;
  1586. quint16 calculateCRC(QByteArray data);
  1587. QTimer*messageDelayTimer;
  1588. QTimer*commTimeout;
  1589. int delayTime;
  1590. char station;
  1591. int decimalPosition;
  1592. int valueF;
  1593. int valueC;
  1594. bool unitIsF;
  1595. double outputSVLower;
  1596. double outputSVUpper;
  1597. QByteArray outputSVStub;
  1598. QByteArray pvStub;
  1599. QByteArray svStub;
  1600. QByteArray mStub;
  1601. quint16 pvaddress;
  1602. quint16 svaddress;
  1603. bool svenabled;
  1604. bool readingsv;
  1605. double savedpv;
  1606. bool waiting;
  1607. };
  1608. /*:846*//*862:*/
  1609. #line 18804 "./typica.w"
  1610. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1611. {
  1612. Q_OBJECT
  1613. public:
  1614. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1615. private slots:
  1616. void updatePort(const QString&newPort);
  1617. void updateBaudRate(const QString&newRate);
  1618. void updateParity(const QString&newParity);
  1619. void updateFlowControl(const QString&newFlow);
  1620. void updateStopBits(const QString&newStopBits);
  1621. void updateStation(int station);
  1622. void updateFixedDecimal(bool fixed);
  1623. void updateDecimalAddress(int address);
  1624. void updateDecimalPosition(int position);
  1625. void updateFixedUnit(bool fixed);
  1626. void updateUnitAddress(int address);
  1627. void updateValueForF(int value);
  1628. void updateValueForC(int value);
  1629. void updateUnit(const QString&newUnit);
  1630. void updatePVAddress(int address);
  1631. void updateSVEnabled(bool enabled);
  1632. void updateSVReadAddress(int address);
  1633. void updateDeviceLimit(bool query);
  1634. void updateSVLowerAddress(int address);
  1635. void updateSVUpperAddress(int address);
  1636. void updateSVLower(double value);
  1637. void updateSVUpper(double value);
  1638. void updateSVWritable(bool canWriteSV);
  1639. void updateSVWriteAddress(int address);
  1640. void updatePVColumnName(const QString&name);
  1641. void updateSVColumnName(const QString&name);
  1642. void updatePVHidden(bool hidden);
  1643. void updateSVHidden(bool hidden);
  1644. private:
  1645. PortSelector*port;
  1646. BaudSelector*baud;
  1647. ParitySelector*parity;
  1648. FlowSelector*flow;
  1649. StopSelector*stop;
  1650. QSpinBox*station;
  1651. QCheckBox*decimalQuery;
  1652. ShortHexSpinBox*decimalAddress;
  1653. QSpinBox*decimalPosition;
  1654. QCheckBox*unitQuery;
  1655. ShortHexSpinBox*unitAddress;
  1656. QSpinBox*valueF;
  1657. QSpinBox*valueC;
  1658. QComboBox*fixedUnit;
  1659. ShortHexSpinBox*pVAddress;
  1660. QCheckBox*sVEnabled;
  1661. ShortHexSpinBox*sVReadAddress;
  1662. QCheckBox*deviceLimit;
  1663. ShortHexSpinBox*sVLowerAddr;
  1664. ShortHexSpinBox*sVUpperAddr;
  1665. QDoubleSpinBox*sVLower;
  1666. QDoubleSpinBox*sVUpper;
  1667. QCheckBox*sVWritable;
  1668. ShortHexSpinBox*sVOutputAddr;
  1669. QLineEdit*pVColumnName;
  1670. QLineEdit*sVColumnName;
  1671. };
  1672. /*:862*//*866:*/
  1673. #line 36 "./unsupportedserial.w"
  1674. class UnsupportedSerialDeviceConfWidget:public BasicDeviceConfigurationWidget
  1675. {
  1676. Q_OBJECT
  1677. public:
  1678. Q_INVOKABLE UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  1679. const QModelIndex&index);
  1680. private slots:
  1681. void updateConfiguration();
  1682. void saveScript();
  1683. void addChannel();
  1684. private:
  1685. SaltModel*deviceSettingsModel;
  1686. QTextEdit*scriptEditor;
  1687. };
  1688. /*:866*//*871:*/
  1689. #line 166 "./unsupportedserial.w"
  1690. class UnsupportedDeviceChannelConfWidget:public BasicDeviceConfigurationWidget
  1691. {
  1692. Q_OBJECT
  1693. public:
  1694. Q_INVOKABLE UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  1695. const QModelIndex&index);
  1696. private slots:
  1697. void updateColumnName(const QString&value);
  1698. void updateHidden(bool hidden);
  1699. void updateConfiguration();
  1700. private:
  1701. SaltModel*channelSettingsModel;
  1702. };
  1703. /*:871*//*876:*/
  1704. #line 298 "./unsupportedserial.w"
  1705. class JavaScriptDevice:public QObject
  1706. {
  1707. Q_OBJECT
  1708. public:
  1709. Q_INVOKABLE JavaScriptDevice(const QModelIndex&deviceIndex,
  1710. QScriptEngine*engine);
  1711. Q_INVOKABLE int channelCount();
  1712. Channel*getChannel(int channel);
  1713. Q_INVOKABLE bool isChannelHidden(int channel);
  1714. Q_INVOKABLE Units::Unit expectedChannelUnit(int channel);
  1715. Q_INVOKABLE QString channelColumnName(int channel);
  1716. Q_INVOKABLE QString channelIndicatorText(int channel);
  1717. public slots:
  1718. void setTemperatureColumn(int tcol);
  1719. void setAnnotationColumn(int ncol);
  1720. void start();
  1721. void stop();
  1722. signals:
  1723. void annotation(QString note,int tcol,int ncol);
  1724. void triggerStartBatch();
  1725. void triggerStopBatch();
  1726. void deviceStopRequested();
  1727. private:
  1728. QVariantMap deviceSettings;
  1729. QString deviceScript;
  1730. QList<Channel*> channelList;
  1731. QList<bool> hiddenState;
  1732. QList<Units::Unit> channelUnits;
  1733. QList<QString> columnNames;
  1734. QList<QString> indicatorTexts;
  1735. QList<QVariantMap> channelSettings;
  1736. int annotationTemperatureColumn;
  1737. int annotationNoteColumn;
  1738. QScriptEngine*scriptengine;
  1739. };
  1740. /*:876*//*901:*/
  1741. #line 11 "./phidgets.w"
  1742. class PhidgetsTemperatureSensorConfWidget:public BasicDeviceConfigurationWidget
  1743. {
  1744. Q_OBJECT
  1745. public:
  1746. Q_INVOKABLE PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  1747. const QModelIndex&index);
  1748. private slots:
  1749. void addChannel();
  1750. void updateRate(int ms);
  1751. };
  1752. /*:901*//*905:*/
  1753. #line 82 "./phidgets.w"
  1754. class PhidgetTemperatureSensorChannelConfWidget:public BasicDeviceConfigurationWidget
  1755. {
  1756. Q_OBJECT
  1757. public:
  1758. Q_INVOKABLE PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel*model,
  1759. const QModelIndex&index);
  1760. private slots:
  1761. void updateColumnName(const QString&value);
  1762. void updateHidden(bool hidden);
  1763. void updateTC(int index);
  1764. void updateChannel(int channel);
  1765. private:
  1766. QComboBox*tcType;
  1767. };
  1768. /*:905*//*910:*/
  1769. #line 213 "./phidgets.w"
  1770. class PhidgetsTemperatureSensor:public QObject
  1771. {
  1772. Q_OBJECT
  1773. public:
  1774. Q_INVOKABLE PhidgetsTemperatureSensor(const QModelIndex&deviceIndex);
  1775. Q_INVOKABLE int channelCount();
  1776. Channel*getChannel(int channel);
  1777. Q_INVOKABLE bool isChannelHidden(int channel);
  1778. Q_INVOKABLE QString channelColumnName(int channel);
  1779. Q_INVOKABLE QString channelIndicatorText(int channel);
  1780. public slots:
  1781. void start();
  1782. void stop();
  1783. private slots:
  1784. void getMeasurements();
  1785. private:
  1786. QList<int> channelIndices;
  1787. QList<int> tctypes;
  1788. QList<Channel*> channelList;
  1789. QMap<int,Channel*> channelMap;
  1790. QList<bool> hiddenState;
  1791. QList<QString> columnNames;
  1792. QList<QString> indicatorTexts;
  1793. QLibrary driver;
  1794. QTimer sampleTimer;
  1795. void*device;
  1796. /*914:*/
  1797. #line 349 "./phidgets.w"
  1798. #ifdef _WIN32
  1799. typedef int(__stdcall*PhidgetHandleOnly)(void*);
  1800. typedef int(__stdcall*PhidgetHandleInt)(void*,int);
  1801. typedef int(__stdcall*PhidgetHandleIntInt)(void*,int,int);
  1802. typedef int(__stdcall*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1803. #else
  1804. typedef int(*PhidgetHandleOnly)(void*);
  1805. typedef int(*PhidgetHandleInt)(void*,int);
  1806. typedef int(*PhidgetHandleIntInt)(void*,int,int);
  1807. typedef int(*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1808. #endif
  1809. PhidgetHandleOnly createDevice;
  1810. PhidgetHandleInt openDevice;
  1811. PhidgetHandleInt waitForOpen;
  1812. PhidgetHandleIntInt setTCType;
  1813. PhidgetHandleIntDoubleOut getTemperature;
  1814. PhidgetHandleOnly closeDevice;
  1815. PhidgetHandleOnly deleteDevice;
  1816. /*:914*/
  1817. #line 240 "./phidgets.w"
  1818. };
  1819. /*:910*//*923:*/
  1820. #line 19342 "./typica.w"
  1821. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1822. {
  1823. Q_OBJECT
  1824. public:
  1825. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1826. const QModelIndex&index);
  1827. private slots:
  1828. void updateSourceColumn(const QString&source);
  1829. void updateDestinationColumn(const QString&dest);
  1830. void updateKnots();
  1831. private:
  1832. SaltModel*tablemodel;
  1833. };
  1834. /*:923*//*929:*/
  1835. #line 19472 "./typica.w"
  1836. class CoolingTimerConfWidget:public BasicDeviceConfigurationWidget
  1837. {
  1838. Q_OBJECT
  1839. public:
  1840. Q_INVOKABLE CoolingTimerConfWidget(DeviceTreeModel*model,
  1841. const QModelIndex&index);
  1842. private slots:
  1843. void updateResetTime(QTime time);
  1844. };
  1845. /*:929*//*933:*/
  1846. #line 19538 "./typica.w"
  1847. class RangeTimerConfWidget:public BasicDeviceConfigurationWidget
  1848. {
  1849. Q_OBJECT
  1850. public:
  1851. Q_INVOKABLE RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1852. private slots:
  1853. void updateStartButtonText(const QString&text);
  1854. void updateStopButtonText(const QString&text);
  1855. void updateStartColumnName(const QString&text);
  1856. void updateStopColumnName(const QString&text);
  1857. void updateStartValue(const QString&text);
  1858. void updateStopValue(const QString&text);
  1859. void updateStartTrigger(int option);
  1860. void updateStopTrigger(int option);
  1861. };
  1862. /*:933*//*938:*/
  1863. #line 19790 "./typica.w"
  1864. class MultiRangeTimerConfWidget:public BasicDeviceConfigurationWidget
  1865. {
  1866. Q_OBJECT
  1867. public:
  1868. Q_INVOKABLE MultiRangeTimerConfWidget(DeviceTreeModel*model,
  1869. const QModelIndex&index);
  1870. private slots:
  1871. void updateColumnName(const QString&text);
  1872. void updateRangeData();
  1873. private:
  1874. SaltModel*tablemodel;
  1875. };
  1876. /*:938*//*943:*/
  1877. #line 19892 "./typica.w"
  1878. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1879. {
  1880. Q_OBJECT
  1881. public:
  1882. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1883. private slots:
  1884. void updateMatchingColumn(const QString&column);
  1885. void updateTemperature();
  1886. private:
  1887. QDoubleSpinBox*temperatureValue;
  1888. QComboBox*unitSelector;
  1889. };
  1890. /*:943*//*947:*/
  1891. #line 16 "./rate.w"
  1892. class RateOfChange:public QObject
  1893. {
  1894. Q_OBJECT
  1895. public:
  1896. RateOfChange(int cachetime= 1,int scaletime= 1);
  1897. public slots:
  1898. void newMeasurement(Measurement measure);
  1899. void setCacheTime(int seconds);
  1900. void setScaleTime(int seconds);
  1901. signals:
  1902. void newData(Measurement measure);
  1903. private:
  1904. int ct;
  1905. int st;
  1906. QList<Measurement> cache;
  1907. };
  1908. /*:947*//*955:*/
  1909. #line 177 "./rate.w"
  1910. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  1911. {
  1912. Q_OBJECT
  1913. public:
  1914. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1915. private slots:
  1916. void updateColumn(const QString&column);
  1917. void updateCacheTime(const QString&seconds);
  1918. void updateScaleTime(const QString&seconds);
  1919. };
  1920. /*:955*//*961:*/
  1921. #line 19 "./dataqsdk.w"
  1922. class DataqSdkDeviceImplementation;
  1923. class DataqSdkDevice:public QObject
  1924. {
  1925. Q_OBJECT
  1926. DataqSdkDeviceImplementation*imp;
  1927. private slots:
  1928. void threadFinished();
  1929. public:
  1930. DataqSdkDevice(QString device);
  1931. ~DataqSdkDevice();
  1932. Channel*newChannel(Units::Unit scale);
  1933. Q_INVOKABLE void setClockRate(double Hz);
  1934. Q_INVOKABLE void start();
  1935. static QStringList detectPorts();
  1936. static QStringList detectHardware();
  1937. };
  1938. /*:961*//*962:*/
  1939. #line 49 "./dataqsdk.w"
  1940. class DataqSdkDeviceImplementation:public QThread
  1941. {
  1942. Q_OBJECT
  1943. public:
  1944. DataqSdkDeviceImplementation();
  1945. ~DataqSdkDeviceImplementation();
  1946. void run();
  1947. /*963:*/
  1948. #line 70 "./dataqsdk.w"
  1949. typedef struct di_inlist_struct{
  1950. unsigned short chan;
  1951. unsigned short diff;
  1952. unsigned short gain;
  1953. unsigned short unipolar;
  1954. unsigned short dig_out_enable;
  1955. unsigned short dig_out;
  1956. unsigned short ave;
  1957. unsigned short counter;
  1958. }DI_INLIST_STRUCT;
  1959. typedef int(PASCAL*FPDIOPEN)(unsigned);
  1960. typedef int(PASCAL*FPDICLOSE)(void);
  1961. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  1962. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  1963. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  1964. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  1965. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  1966. typedef int(PASCAL*FPDISTARTSCAN)(void);
  1967. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  1968. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  1969. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  1970. typedef int(PASCAL*FPDISTOPSCAN)(void);
  1971. FPDIOPEN di_open;
  1972. FPDICLOSE di_close;
  1973. FPDISAMPLERATE di_sample_rate;
  1974. FPDIMAXIMUMRATE di_maximum_rate;
  1975. FPDILISTLENGTH di_list_length;
  1976. FPDIINLIST di_inlist;
  1977. FPDIBUFFERALLOC di_buffer_alloc;
  1978. FPDISTARTSCAN di_start_scan;
  1979. FPDISTATUSREAD di_status_read;
  1980. FPDIBUFFERSTATUS di_buffer_status;
  1981. FPDIBURSTRATE di_burst_rate;
  1982. FPDISTOPSCAN di_stop_scan;
  1983. /*:963*/
  1984. #line 57 "./dataqsdk.w"
  1985. /*965:*/
  1986. #line 134 "./dataqsdk.w"
  1987. bool isOpen;
  1988. double sampleRate;
  1989. long oversample;
  1990. long burstDivisor;
  1991. QString device;
  1992. unsigned deviceNumber;
  1993. QVector<Channel*> channelMap;
  1994. int error;
  1995. int channels;
  1996. bool ready;
  1997. QLibrary*driver;
  1998. QVector<Units::Unit> unitMap;
  1999. int*input_buffer;
  2000. QTimer*eventClock;
  2001. QMultiMap<int,double> smoother;
  2002. /*:965*/
  2003. #line 58 "./dataqsdk.w"
  2004. public slots:
  2005. void measure();
  2006. private:
  2007. qint16*buffer;
  2008. };
  2009. /*:962*//*982:*/
  2010. #line 663 "./dataqsdk.w"
  2011. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  2012. {
  2013. Q_OBJECT
  2014. public:
  2015. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  2016. const QModelIndex&index);
  2017. private slots:
  2018. void updateAutoSelect(bool automatic);
  2019. void updateDeviceNumber(int deviceNumber);
  2020. void updatePort(QString portId);
  2021. void addChannel();
  2022. private:
  2023. QStackedWidget*deviceIdStack;
  2024. };
  2025. /*:982*//*987:*/
  2026. #line 808 "./dataqsdk.w"
  2027. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  2028. {
  2029. Q_OBJECT
  2030. public:
  2031. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  2032. const QModelIndex&index);
  2033. private slots:
  2034. void updateUnits(const QString&unit);
  2035. void updateColumnName(const QString&value);
  2036. void updateMeasuredLower(const QString&value);
  2037. void updateMeasuredUpper(const QString&value);
  2038. void updateMappedLower(const QString&value);
  2039. void updateMappedUpper(const QString&value);
  2040. void updateClosedInterval(bool closed);
  2041. void updateSmoothingEnabled(bool enabled);
  2042. void updateSensitivity(const QString&value);
  2043. void startCalibration();
  2044. void stopCalibration();
  2045. void resetCalibration();
  2046. void updateInput(Measurement measure);
  2047. void updateOutput(Measurement measure);
  2048. void updateHidden(bool hidden);
  2049. private:
  2050. QPushButton*startButton;
  2051. QPushButton*resetButton;
  2052. QPushButton*stopButton;
  2053. /*992:*/
  2054. #line 1098 "./dataqsdk.w"
  2055. bool autoSelect;
  2056. QString deviceID;
  2057. unsigned int channelOfInterest;
  2058. /*:992*/
  2059. #line 835 "./dataqsdk.w"
  2060. DataqSdkDevice*calibrationDevice;
  2061. LinearCalibrator*calibrator;
  2062. QLineEdit*currentMeasurement;
  2063. QLineEdit*minimumMeasurement;
  2064. QLineEdit*maximumMeasurement;
  2065. QLineEdit*averageMeasurement;
  2066. QLineEdit*currentMapped;
  2067. QLineEdit*minimumMapped;
  2068. QLineEdit*maximumMapped;
  2069. QLineEdit*averageMapped;
  2070. int rmCount;
  2071. int cmCount;
  2072. double rmin;
  2073. double rmax;
  2074. double rmean;
  2075. double cmin;
  2076. double cmax;
  2077. double cmean;
  2078. };
  2079. /*:987*//*1014:*/
  2080. #line 247 "./scales.w"
  2081. Q_DECLARE_METATYPE(BaudRateType)
  2082. Q_DECLARE_METATYPE(DataBitsType)
  2083. Q_DECLARE_METATYPE(ParityType)
  2084. Q_DECLARE_METATYPE(StopBitsType)
  2085. Q_DECLARE_METATYPE(FlowType)
  2086. /*:1014*//*1021:*/
  2087. #line 370 "./scales.w"
  2088. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  2089. {
  2090. Q_OBJECT
  2091. public:
  2092. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  2093. const QModelIndex&index);
  2094. private slots:
  2095. void updatePort(const QString&newPort);
  2096. void updateBaudRate(const QString&rate);
  2097. void updateParity(int index);
  2098. void updateFlowControl(int index);
  2099. void updateStopBits(int index);
  2100. private:
  2101. PortSelector*port;
  2102. BaudSelector*baud;
  2103. ParitySelector*parity;
  2104. FlowSelector*flow;
  2105. StopSelector*stop;
  2106. };
  2107. /*:1021*//*1026:*/
  2108. #line 14 "./valueannotation.w"
  2109. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  2110. {
  2111. Q_OBJECT
  2112. public:
  2113. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  2114. const QModelIndex&index);
  2115. private slots:
  2116. void updateSourceColumn(const QString&source);
  2117. void updateAnnotations();
  2118. void updateStart(bool noteOnStart);
  2119. private:
  2120. SaltModel*tablemodel;
  2121. };
  2122. /*:1026*//*1034:*/
  2123. #line 165 "./valueannotation.w"
  2124. class ValueAnnotation:public QObject
  2125. {
  2126. Q_OBJECT
  2127. public:
  2128. ValueAnnotation();
  2129. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  2130. public slots:
  2131. void newMeasurement(Measurement measure);
  2132. void annotate();
  2133. void setAnnotationColumn(int column);
  2134. void setTemperatureColumn(int column);
  2135. void setTolerance(double epsilon);
  2136. signals:
  2137. void annotation(QString annotation,int tempcolumn,int notecolumn);
  2138. private:
  2139. int lastIndex;
  2140. int annotationColumn;
  2141. int measurementColumn;
  2142. QList<double> values;
  2143. QStringList annotations;
  2144. double tolerance;
  2145. };
  2146. /*:1034*/
  2147. #line 526 "./typica.w"
  2148. /*12:*/
  2149. #line 808 "./typica.w"
  2150. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  2151. /*:12*//*14:*/
  2152. #line 823 "./typica.w"
  2153. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2154. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  2155. /*:14*//*16:*/
  2156. #line 848 "./typica.w"
  2157. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2158. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  2159. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  2160. QScriptValue QWidget_activateWindow(QScriptContext*context,
  2161. QScriptEngine*engine);
  2162. /*:16*//*20:*/
  2163. #line 938 "./typica.w"
  2164. QScriptValue displayWarning(QScriptContext*context,QScriptEngine*engine);
  2165. QScriptValue displayError(QScriptContext*context,QScriptEngine*engine);
  2166. /*:20*//*30:*/
  2167. #line 1139 "./typica.w"
  2168. QScriptValue constructQMainWindow(QScriptContext*context,
  2169. QScriptEngine*engine);
  2170. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  2171. QScriptEngine*engine);
  2172. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  2173. QScriptEngine*engine);
  2174. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  2175. /*:30*//*35:*/
  2176. #line 1238 "./typica.w"
  2177. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  2178. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  2179. /*:35*//*38:*/
  2180. #line 1283 "./typica.w"
  2181. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  2182. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  2183. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  2184. /*:38*//*41:*/
  2185. #line 1349 "./typica.w"
  2186. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  2187. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  2188. /*:41*//*44:*/
  2189. #line 1382 "./typica.w"
  2190. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  2191. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  2192. /*:44*//*47:*/
  2193. #line 1420 "./typica.w"
  2194. void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2195. QScriptValue constructQSvgWidget(QScriptContext*context,
  2196. QScriptEngine*engine);
  2197. QScriptValue QSvgWidget_loadDevice(QScriptContext*context,
  2198. QScriptEngine*engine);
  2199. void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2200. QStack<QLayout*> *layoutStack);
  2201. /*:47*//*53:*/
  2202. #line 1507 "./typica.w"
  2203. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  2204. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  2205. /*:53*//*57:*/
  2206. #line 1546 "./typica.w"
  2207. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  2208. QScriptValue QSplitter_addWidget(QScriptContext*context,
  2209. QScriptEngine*engine);
  2210. QScriptValue QSplitter_saveState(QScriptContext*context,
  2211. QScriptEngine*engine);
  2212. QScriptValue QSplitter_restoreState(QScriptContext*context,
  2213. QScriptEngine*engine);
  2214. QScriptValue QSplitter_count(QScriptContext*context,
  2215. QScriptEngine*engine);
  2216. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  2217. /*:57*//*63:*/
  2218. #line 1685 "./typica.w"
  2219. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2220. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2221. /*:63*//*65:*/
  2222. #line 1740 "./typica.w"
  2223. QScriptValue constructQBoxLayout(QScriptContext*context,
  2224. QScriptEngine*engine);
  2225. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2226. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  2227. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2228. /*:65*//*69:*/
  2229. #line 1853 "./typica.w"
  2230. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  2231. QScriptValue QAction_setShortcut(QScriptContext*context,
  2232. QScriptEngine*engine);
  2233. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  2234. /*:69*//*72:*/
  2235. #line 1909 "./typica.w"
  2236. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  2237. QScriptEngine*engine);
  2238. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  2239. QScriptEngine*engine);
  2240. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2241. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2242. /*:72*//*77:*/
  2243. #line 2020 "./typica.w"
  2244. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2245. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2246. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2247. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2248. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2249. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2250. QScriptValue QIODevice_readToString(QScriptContext*context,
  2251. QScriptEngine*engine);
  2252. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*engine);
  2253. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*engine);
  2254. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*engine);
  2255. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine);
  2256. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine);
  2257. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine);
  2258. /*:77*//*88:*/
  2259. #line 2246 "./typica.w"
  2260. QScriptValue constructQProcess(QScriptContext*context,QScriptEngine*engine);
  2261. void setQProcessProperties(QScriptValue value,QScriptEngine*engine);
  2262. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*engine);
  2263. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*engine);
  2264. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*engine);
  2265. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*engine);
  2266. /*:88*//*96:*/
  2267. #line 2364 "./typica.w"
  2268. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes);
  2269. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes);
  2270. QScriptValue constructQByteArray(QScriptContext*context,QScriptEngine*engine);
  2271. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine);
  2272. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine);
  2273. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*engine);
  2274. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*engine);
  2275. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine);
  2276. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine);
  2277. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*engine);
  2278. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine);
  2279. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine);
  2280. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine);
  2281. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*engine);
  2282. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine);
  2283. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*engine);
  2284. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*engine);
  2285. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*engine);
  2286. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*engine);
  2287. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*engine);
  2288. /*:96*//*109:*/
  2289. #line 2638 "./typica.w"
  2290. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine);
  2291. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine);
  2292. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine);
  2293. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine);
  2294. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine);
  2295. /*:109*//*112:*/
  2296. #line 2743 "./typica.w"
  2297. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2298. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2299. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2300. /*:112*//*115:*/
  2301. #line 2788 "./typica.w"
  2302. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2303. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2304. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2305. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2306. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2307. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2308. /*:115*//*121:*/
  2309. #line 2870 "./typica.w"
  2310. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2311. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2312. QScriptEngine*engine);
  2313. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2314. QScriptEngine*engine);
  2315. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2316. QScriptEngine*engine);
  2317. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2318. QScriptEngine*engine);
  2319. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2320. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2321. QScriptEngine*engine);
  2322. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2323. QScriptEngine*engine);
  2324. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2325. QScriptEngine*engine);
  2326. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2327. QScriptEngine*engine);
  2328. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2329. QScriptEngine*engine);
  2330. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2331. QScriptEngine*engine);
  2332. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2333. QScriptEngine*engine);
  2334. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2335. QScriptEngine*engine);
  2336. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2337. /*:121*//*130:*/
  2338. #line 3088 "./typica.w"
  2339. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2340. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2341. QScriptValue XmlReader_attribute(QScriptContext*context,
  2342. QScriptEngine*engine);
  2343. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2344. QScriptEngine*engine);
  2345. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2346. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2347. QScriptEngine*engine);
  2348. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2349. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2350. QScriptEngine*engine);
  2351. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2352. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2353. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2354. /*:130*//*137:*/
  2355. #line 3223 "./typica.w"
  2356. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2357. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2358. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2359. /*:137*//*141:*/
  2360. #line 3305 "./typica.w"
  2361. QScriptValue constructQLCDNumber(QScriptContext*context,
  2362. QScriptEngine*engine);
  2363. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2364. /*:141*//*144:*/
  2365. #line 3343 "./typica.w"
  2366. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2367. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2368. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2369. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2370. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2371. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2372. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2373. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2374. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2375. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2376. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2377. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2378. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2379. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2380. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2381. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2382. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2383. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2384. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2385. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2386. /*:144*//*160:*/
  2387. #line 3821 "./typica.w"
  2388. void setQAbstractScrollAreaProperties(QScriptValue value,
  2389. QScriptEngine*engine);
  2390. /*:160*//*162:*/
  2391. #line 3836 "./typica.w"
  2392. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2393. /*:162*//*164:*/
  2394. #line 3849 "./typica.w"
  2395. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2396. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2397. /*:164*//*166:*/
  2398. #line 3873 "./typica.w"
  2399. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2400. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2401. QScriptValue constructQPushButton(QScriptContext*context,
  2402. QScriptEngine*engine);
  2403. /*:166*//*173:*/
  2404. #line 3972 "./typica.w"
  2405. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2406. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2407. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2408. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2409. QScriptEngine*engine);
  2410. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2411. QScriptEngine*engine);
  2412. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2413. QScriptEngine*engine);
  2414. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2415. QScriptEngine*engine);
  2416. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2417. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2418. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2419. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2420. /*:173*//*180:*/
  2421. #line 4143 "./typica.w"
  2422. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2423. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2424. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2425. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2426. QScriptValue annotationFromRecord(QScriptContext*context,
  2427. QScriptEngine*engine);
  2428. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2429. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*engine);
  2430. QScriptValue scriptTr(QScriptContext*context,QScriptEngine*engine);
  2431. /*:180*//*193:*/
  2432. #line 4475 "./typica.w"
  2433. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2434. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2435. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2436. QStack<QLayout*> *layoutStack);
  2437. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2438. QStack<QLayout*> *layoutStack);
  2439. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2440. QStack<QLayout*> *layoutStack);
  2441. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2442. QStack<QLayout*> *layoutStack);
  2443. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2444. QStack<QLayout*> *layoutStack);
  2445. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2446. QStack<QLayout*> *layoutStack);
  2447. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2448. QStack<QLayout*> *layoutStack);
  2449. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2450. QStack<QLayout*> *layoutStack);
  2451. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2452. QStack<QLayout*> *layoutStack);
  2453. void addTemperatureDisplayToSplitter(QDomElement element,
  2454. QStack<QWidget*> *widgetStack,
  2455. QStack<QLayout*> *layoutStack);
  2456. void addTemperatureDisplayToLayout(QDomElement element,
  2457. QStack<QWidget*> *widgetStack,
  2458. QStack<QLayout*> *layoutStack);
  2459. void addTimerDisplayToSplitter(QDomElement element,
  2460. QStack<QWidget*> *widgetStack,
  2461. QStack<QLayout*> *layoutStack);
  2462. void addTimerDisplayToLayout(QDomElement element,
  2463. QStack<QWidget*> *widgetStack,
  2464. QStack<QLayout*> *layoutStack);
  2465. void addDecorationToSplitter(QDomElement element,
  2466. QStack<QWidget*> *widgetStack,
  2467. QStack<QLayout*> *layoutStack);
  2468. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2469. QStack<QLayout*> *layoutStack);
  2470. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2471. QStack<QLayout*> *layoutStack);
  2472. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2473. QStack<QLayout*> *layoutStack);
  2474. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2475. QStack<QLayout*> *layoutStack);
  2476. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2477. QStack<QLayout*> *layoutStack);
  2478. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2479. QStack<QLayout*> *layoutStack);
  2480. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2481. QStack<QLayout*> *layoutStack);
  2482. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2483. QStack<QLayout*> *layoutStack);
  2484. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2485. QStack<QLayout*> *layoutStack);
  2486. void addSqlQueryViewToLayout(QDomElement element,
  2487. QStack<QWidget*> *widgetStack,
  2488. QStack<QLayout*> *layoutStack);
  2489. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2490. QStack<QLayout*> *layoutStack);
  2491. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2492. QStack<QLayout*> *layoutStack);
  2493. /*:193*//*257:*/
  2494. #line 6157 "./typica.w"
  2495. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2496. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2497. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2498. QScriptEngine*engine);
  2499. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2500. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2501. QScriptEngine*engine);
  2502. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2503. QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*engine);
  2504. /*:257*//*258:*/
  2505. #line 6173 "./typica.w"
  2506. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  2507. /*:258*//*262:*/
  2508. #line 6312 "./typica.w"
  2509. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  2510. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  2511. QScriptEngine*engine);
  2512. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  2513. QScriptEngine*engine);
  2514. QScriptValue SaltTable_columnSum(QScriptContext*context,
  2515. QScriptEngine*engine);
  2516. QScriptValue SaltTable_columnArray(QScriptContext*context,
  2517. QScriptEngine*engine);
  2518. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  2519. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  2520. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  2521. QScriptEngine*engine);
  2522. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  2523. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  2524. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  2525. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  2526. /*:262*//*272:*/
  2527. #line 6528 "./typica.w"
  2528. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2529. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2530. QScriptValue QComboBox_currentData(QScriptContext*context,
  2531. QScriptEngine*engine);
  2532. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  2533. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  2534. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  2535. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  2536. /*:272*//*284:*/
  2537. #line 379 "./units.w"
  2538. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  2539. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  2540. QScriptEngine*engine);
  2541. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  2542. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  2543. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  2544. /*:284*//*288:*/
  2545. #line 443 "./units.w"
  2546. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  2547. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  2548. /*:288*//*297:*/
  2549. #line 133 "./measurement.w"
  2550. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine);
  2551. void setMeasurementProperties(QScriptValue value,QScriptEngine*engine);
  2552. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement);
  2553. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement);
  2554. /*:297*//*317:*/
  2555. #line 7163 "./typica.w"
  2556. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  2557. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2558. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  2559. /*:317*//*326:*/
  2560. #line 7368 "./typica.w"
  2561. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  2562. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2563. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  2564. /*:326*//*331:*/
  2565. #line 7469 "./typica.w"
  2566. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  2567. /*:331*//*337:*/
  2568. #line 7651 "./typica.w"
  2569. QScriptValue constructLinearCalibrator(QScriptContext*context,
  2570. QScriptEngine*engine);
  2571. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  2572. /*:337*//*342:*/
  2573. #line 7791 "./typica.w"
  2574. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  2575. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  2576. /*:342*//*352:*/
  2577. #line 7996 "./typica.w"
  2578. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  2579. QScriptEngine*engine);
  2580. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2581. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  2582. QScriptEngine*engine);
  2583. /*:352*//*360:*/
  2584. #line 8155 "./typica.w"
  2585. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  2586. QScriptEngine*engine);
  2587. void setMeasurementTimeOffsetProperties(QScriptValue value,
  2588. QScriptEngine*engine);
  2589. /*:360*//*365:*/
  2590. #line 8268 "./typica.w"
  2591. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  2592. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  2593. /*:365*//*370:*/
  2594. #line 8366 "./typica.w"
  2595. QScriptValue constructZeroEmitter(QScriptContext*context,
  2596. QScriptEngine*engine);
  2597. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  2598. /*:370*//*375:*/
  2599. #line 8445 "./typica.w"
  2600. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  2601. QScriptEngine*engine);
  2602. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  2603. /*:375*//*392:*/
  2604. #line 8909 "./typica.w"
  2605. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  2606. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  2607. /*:392*//*415:*/
  2608. #line 9536 "./typica.w"
  2609. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  2610. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  2611. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  2612. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  2613. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  2614. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  2615. QScriptEngine*engine);
  2616. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  2617. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  2618. QScriptEngine*engnie);
  2619. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  2620. QScriptEngine*engine);
  2621. /*:415*//*453:*/
  2622. #line 10493 "./typica.w"
  2623. QScriptValue constructAnnotationButton(QScriptContext*context,
  2624. QScriptEngine*engine);
  2625. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2626. /*:453*//*461:*/
  2627. #line 10633 "./typica.w"
  2628. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2629. QScriptEngine*engine);
  2630. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2631. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2632. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2633. /*:461*//*482:*/
  2634. #line 11059 "./typica.w"
  2635. QScriptValue constructTimerDisplay(QScriptContext*context,
  2636. QScriptEngine*engine);
  2637. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2638. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*engine);
  2639. /*:482*//*510:*/
  2640. #line 11584 "./typica.w"
  2641. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2642. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2643. QScriptEngine*engine);
  2644. /*:510*//*523:*/
  2645. #line 11867 "./typica.w"
  2646. QScriptValue constructLogEditWindow(QScriptContext*context,
  2647. QScriptEngine*engine);
  2648. /*:523*//*542:*/
  2649. #line 12394 "./typica.w"
  2650. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2651. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2652. /*:542*//*560:*/
  2653. #line 189 "./webview.w"
  2654. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2655. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2656. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2657. QStack<QLayout*> *layoutStack);
  2658. /*:560*//*563:*/
  2659. #line 219 "./webview.w"
  2660. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  2661. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  2662. /*:563*//*567:*/
  2663. #line 277 "./webview.w"
  2664. QScriptValue constructWebElement(QScriptContext*context,
  2665. QScriptEngine*engine);
  2666. /*:567*//*636:*/
  2667. #line 13741 "./typica.w"
  2668. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2669. QScriptValue constructSqlQueryView(QScriptContext*context,
  2670. QScriptEngine*engine);
  2671. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2672. QScriptEngine*engine);
  2673. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2674. QScriptEngine*engine);
  2675. /*:636*//*646:*/
  2676. #line 13980 "./typica.w"
  2677. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2678. QStack<QLayout*> *layoutStack);
  2679. /*:646*//*662:*/
  2680. #line 14265 "./typica.w"
  2681. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2682. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2683. /*:662*//*684:*/
  2684. #line 480 "./daterangeselector.w"
  2685. void addDateRangeToLayout(QDomElement element,
  2686. QStack<QWidget*> *widgetStack,
  2687. QStack<QLayout*> *layoutStack);
  2688. /*:684*//*693:*/
  2689. #line 14462 "./typica.w"
  2690. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2691. QStack<QLayout*> *layoutStack);
  2692. /*:693*//*714:*/
  2693. #line 15046 "./typica.w"
  2694. void addScaleControlToLayout(QDomElement element,
  2695. QStack<QWidget*> *widgetStack,
  2696. QStack<QLayout*> *layoutStack);
  2697. void addIntensityControlToLayout(QDomElement element,
  2698. QStack<QWidget*> *widgetStack,
  2699. QStack<QLayout*> *layoutStack);
  2700. /*:714*//*740:*/
  2701. #line 15632 "./typica.w"
  2702. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2703. QScriptEngine*engine);
  2704. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2705. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2706. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2707. QScriptEngine*engine);
  2708. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2709. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2710. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2711. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2712. /*:740*//*746:*/
  2713. #line 15774 "./typica.w"
  2714. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2715. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2716. /*:746*//*762:*/
  2717. #line 16072 "./typica.w"
  2718. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2719. QScriptEngine*engine);
  2720. /*:762*//*833:*/
  2721. #line 42 "./settings.w"
  2722. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  2723. /*:833*//*857:*/
  2724. #line 18711 "./typica.w"
  2725. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2726. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2727. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2728. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2729. /*:857*//*877:*/
  2730. #line 345 "./unsupportedserial.w"
  2731. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine);
  2732. /*:877*//*883:*/
  2733. #line 425 "./unsupportedserial.w"
  2734. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine);
  2735. /*:883*//*889:*/
  2736. #line 617 "./unsupportedserial.w"
  2737. QScriptValue getMeasurementTimestamp(QScriptContext*context,QScriptEngine*engine);
  2738. /*:889*//*893:*/
  2739. #line 651 "./unsupportedserial.w"
  2740. QScriptValue constructSerialPort(QScriptContext*context,QScriptEngine*engine);
  2741. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine);
  2742. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*engine);
  2743. /*:893*//*920:*/
  2744. #line 457 "./phidgets.w"
  2745. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine);
  2746. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine);
  2747. /*:920*//*952:*/
  2748. #line 138 "./rate.w"
  2749. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  2750. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  2751. /*:952*//*977:*/
  2752. #line 597 "./dataqsdk.w"
  2753. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  2754. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  2755. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2756. /*:977*//*1004:*/
  2757. #line 67 "./scales.w"
  2758. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  2759. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  2760. /*:1004*//*1012:*/
  2761. #line 233 "./scales.w"
  2762. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  2763. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  2764. /*:1012*//*1015:*/
  2765. #line 258 "./scales.w"
  2766. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  2767. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  2768. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  2769. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  2770. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  2771. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  2772. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  2773. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  2774. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  2775. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  2776. /*:1015*//*1040:*/
  2777. #line 265 "./valueannotation.w"
  2778. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  2779. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  2780. /*:1040*/
  2781. #line 527 "./typica.w"
  2782. /*616:*/
  2783. #line 13390 "./typica.w"
  2784. void messageFileOutput(QtMsgType type,const char*msg);
  2785. /*:616*/
  2786. #line 528 "./typica.w"
  2787. /*4:*/
  2788. #line 537 "./typica.w"
  2789. /*754:*/
  2790. #line 15895 "./typica.w"
  2791. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2792. const QString&driver,QObject*parent):
  2793. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2794. {
  2795. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2796. }
  2797. void NodeInserter::onTriggered()
  2798. {
  2799. emit triggered(defaultNodeName,driverString);
  2800. }
  2801. /*:754*/
  2802. #line 538 "./typica.w"
  2803. /*293:*/
  2804. #line 40 "./measurement.w"
  2805. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  2806. {
  2807. insert("measurement",temperature);
  2808. insert("time",time);
  2809. insert("unit",sc);
  2810. }
  2811. Measurement::Measurement(double temperature)
  2812. {
  2813. insert("measurement",temperature);
  2814. insert("time",QTime::currentTime());
  2815. insert("unit",Units::Fahrenheit);
  2816. }
  2817. void Measurement::setTemperature(double temperature)
  2818. {
  2819. insert("measurement",temperature);
  2820. }
  2821. void Measurement::setTime(QTime time)
  2822. {
  2823. insert("time",time);
  2824. }
  2825. void Measurement::setUnit(Units::Unit scale)
  2826. {
  2827. insert("unit",scale);
  2828. }
  2829. double Measurement::temperature()const
  2830. {
  2831. return value("measurement").toDouble();
  2832. }
  2833. QTime Measurement::time()const
  2834. {
  2835. return value("time").toTime();
  2836. }
  2837. Units::Unit Measurement::scale()const
  2838. {
  2839. return(Units::Unit)(value("unit").toInt());
  2840. }
  2841. /*:293*//*294:*/
  2842. #line 88 "./measurement.w"
  2843. Measurement Measurement::toFahrenheit()
  2844. {
  2845. return Measurement(Units::convertTemperature(this->temperature(),
  2846. this->scale(),Units::Fahrenheit),
  2847. this->time(),Units::Fahrenheit);
  2848. }
  2849. Measurement Measurement::toCelsius()
  2850. {
  2851. return Measurement(Units::convertTemperature(this->temperature(),
  2852. this->scale(),Units::Celsius),
  2853. this->time(),Units::Celsius);
  2854. }
  2855. Measurement Measurement::toKelvin()
  2856. {
  2857. return Measurement(Units::convertTemperature(this->temperature(),
  2858. this->scale(),Units::Kelvin),
  2859. this->time(),Units::Kelvin);
  2860. }
  2861. Measurement Measurement::toRankine()
  2862. {
  2863. return Measurement(Units::convertTemperature(this->temperature(),
  2864. this->scale(),Units::Rankine),
  2865. this->time(),Units::Rankine);
  2866. }
  2867. /*:294*/
  2868. #line 539 "./typica.w"
  2869. /*307:*/
  2870. #line 6768 "./typica.w"
  2871. void DAQImplementation::measure()
  2872. {
  2873. int samplesRead= 0;
  2874. double buffer[channels];
  2875. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2876. (unsigned long)(0),buffer,(unsigned long)(channels),
  2877. &samplesRead,(signed long)(0));
  2878. if(error)
  2879. {
  2880. ready= false;
  2881. }
  2882. else
  2883. {
  2884. if(samplesRead)
  2885. {
  2886. QTime time= QTime::currentTime();
  2887. for(int i= 0;i<samplesRead;i++)
  2888. {
  2889. for(int j= 0;j<channels;j++)
  2890. {
  2891. double measuredValue= buffer[j+(i*channels)];
  2892. Measurement measure(measuredValue,time,
  2893. unitMap[j]);
  2894. channelMap[j]->input(measure);
  2895. }
  2896. }
  2897. }
  2898. }
  2899. }
  2900. /*:307*//*308:*/
  2901. #line 6811 "./typica.w"
  2902. void DAQImplementation::run()
  2903. {
  2904. setPriority(QThread::TimeCriticalPriority);
  2905. while(ready)
  2906. {
  2907. measure();
  2908. }
  2909. }
  2910. /*:308*//*309:*/
  2911. #line 6827 "./typica.w"
  2912. void DAQ::threadFinished()
  2913. {
  2914. if(imp->error)
  2915. {
  2916. /*310:*/
  2917. #line 6878 "./typica.w"
  2918. imp->ready= false;
  2919. QMessageBox warning;
  2920. warning.setStandardButtons(QMessageBox::Cancel);
  2921. warning.setIcon(QMessageBox::Warning);
  2922. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2923. unsigned long bytes= imp->errorInfo(NULL,0);
  2924. char string[bytes];
  2925. imp->errorInfo(string,bytes);
  2926. warning.setInformativeText(QString(string));
  2927. warning.setWindowTitle(QString(PROGRAM_NAME));
  2928. warning.exec();
  2929. /*:310*/
  2930. #line 6832 "./typica.w"
  2931. }
  2932. }
  2933. /*:309*//*311:*/
  2934. #line 6903 "./typica.w"
  2935. void DAQ::start()
  2936. {
  2937. if(imp->ready)
  2938. {
  2939. imp->error= imp->startTask(imp->handle);
  2940. if(imp->error)
  2941. {
  2942. /*310:*/
  2943. #line 6878 "./typica.w"
  2944. imp->ready= false;
  2945. QMessageBox warning;
  2946. warning.setStandardButtons(QMessageBox::Cancel);
  2947. warning.setIcon(QMessageBox::Warning);
  2948. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2949. unsigned long bytes= imp->errorInfo(NULL,0);
  2950. char string[bytes];
  2951. imp->errorInfo(string,bytes);
  2952. warning.setInformativeText(QString(string));
  2953. warning.setWindowTitle(QString(PROGRAM_NAME));
  2954. warning.exec();
  2955. /*:310*/
  2956. #line 6911 "./typica.w"
  2957. }
  2958. else
  2959. {
  2960. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2961. imp->start();
  2962. }
  2963. }
  2964. }
  2965. void DAQ::stop()
  2966. {
  2967. if(imp->useBase)
  2968. {
  2969. imp->ready= false;
  2970. imp->wait(ULONG_MAX);
  2971. imp->stopTask(imp->handle);
  2972. }
  2973. else
  2974. {
  2975. imp->ready= false;
  2976. imp->error= imp->stopTask(imp->handle);
  2977. if(imp->error)
  2978. {
  2979. /*310:*/
  2980. #line 6878 "./typica.w"
  2981. imp->ready= false;
  2982. QMessageBox warning;
  2983. warning.setStandardButtons(QMessageBox::Cancel);
  2984. warning.setIcon(QMessageBox::Warning);
  2985. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2986. unsigned long bytes= imp->errorInfo(NULL,0);
  2987. char string[bytes];
  2988. imp->errorInfo(string,bytes);
  2989. warning.setInformativeText(QString(string));
  2990. warning.setWindowTitle(QString(PROGRAM_NAME));
  2991. warning.exec();
  2992. /*:310*/
  2993. #line 6935 "./typica.w"
  2994. }
  2995. imp->error= imp->clearTask(imp->handle);
  2996. if(imp->error)
  2997. {
  2998. /*310:*/
  2999. #line 6878 "./typica.w"
  3000. imp->ready= false;
  3001. QMessageBox warning;
  3002. warning.setStandardButtons(QMessageBox::Cancel);
  3003. warning.setIcon(QMessageBox::Warning);
  3004. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3005. unsigned long bytes= imp->errorInfo(NULL,0);
  3006. char string[bytes];
  3007. imp->errorInfo(string,bytes);
  3008. warning.setInformativeText(QString(string));
  3009. warning.setWindowTitle(QString(PROGRAM_NAME));
  3010. warning.exec();
  3011. /*:310*/
  3012. #line 6940 "./typica.w"
  3013. }
  3014. }
  3015. }
  3016. /*:311*//*312:*/
  3017. #line 6950 "./typica.w"
  3018. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  3019. {
  3020. imp->device= device;
  3021. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  3022. if(imp->error)
  3023. {
  3024. /*310:*/
  3025. #line 6878 "./typica.w"
  3026. imp->ready= false;
  3027. QMessageBox warning;
  3028. warning.setStandardButtons(QMessageBox::Cancel);
  3029. warning.setIcon(QMessageBox::Warning);
  3030. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3031. unsigned long bytes= imp->errorInfo(NULL,0);
  3032. char string[bytes];
  3033. imp->errorInfo(string,bytes);
  3034. warning.setInformativeText(QString(string));
  3035. warning.setWindowTitle(QString(PROGRAM_NAME));
  3036. warning.exec();
  3037. /*:310*/
  3038. #line 6957 "./typica.w"
  3039. }
  3040. else
  3041. {
  3042. imp->ready= true;
  3043. }
  3044. }
  3045. /*:312*//*313:*/
  3046. #line 6971 "./typica.w"
  3047. Channel*DAQ::newChannel(int units,int thermocouple)
  3048. {
  3049. Channel*retval= new Channel();
  3050. imp->channelMap[imp->channels]= retval;
  3051. imp->unitMap[imp->channels]= (Units::Unit)units;
  3052. imp->channels++;
  3053. if(imp->ready)
  3054. {
  3055. if(imp->useBase)
  3056. {
  3057. imp->error= imp->createChannel(imp->handle,
  3058. QString("%1/ai%2").arg(imp->device).
  3059. arg(imp->channels-1).
  3060. toAscii().data(),
  3061. "",(double)(-1.0),(double)(100.0),
  3062. (signed long)(units),
  3063. (signed long)(thermocouple),
  3064. (signed long)(10200),(double)(0),
  3065. "");
  3066. }
  3067. else
  3068. {
  3069. imp->error= imp->createChannel(imp->handle,
  3070. QString("%1/ai%2").arg(imp->device).
  3071. arg(imp->channels-1).
  3072. toAscii().data(),
  3073. "",(double)(50.0),(double)(500.0),
  3074. (signed long)(units),
  3075. (signed long)(thermocouple),
  3076. (signed long)(10200),(double)(0),
  3077. "");
  3078. }
  3079. if(imp->error)
  3080. {
  3081. /*310:*/
  3082. #line 6878 "./typica.w"
  3083. imp->ready= false;
  3084. QMessageBox warning;
  3085. warning.setStandardButtons(QMessageBox::Cancel);
  3086. warning.setIcon(QMessageBox::Warning);
  3087. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3088. unsigned long bytes= imp->errorInfo(NULL,0);
  3089. char string[bytes];
  3090. imp->errorInfo(string,bytes);
  3091. warning.setInformativeText(QString(string));
  3092. warning.setWindowTitle(QString(PROGRAM_NAME));
  3093. warning.exec();
  3094. /*:310*/
  3095. #line 7006 "./typica.w"
  3096. }
  3097. }
  3098. return retval;
  3099. }
  3100. /*:313*//*314:*/
  3101. #line 7020 "./typica.w"
  3102. void DAQ::setClockRate(double Hz)
  3103. {
  3104. if(imp->ready)
  3105. {
  3106. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  3107. (signed long)(10280),(signed long)(10123),
  3108. (unsigned long long)(1));
  3109. if(imp->error)
  3110. {
  3111. /*310:*/
  3112. #line 6878 "./typica.w"
  3113. imp->ready= false;
  3114. QMessageBox warning;
  3115. warning.setStandardButtons(QMessageBox::Cancel);
  3116. warning.setIcon(QMessageBox::Warning);
  3117. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3118. unsigned long bytes= imp->errorInfo(NULL,0);
  3119. char string[bytes];
  3120. imp->errorInfo(string,bytes);
  3121. warning.setInformativeText(QString(string));
  3122. warning.setWindowTitle(QString(PROGRAM_NAME));
  3123. warning.exec();
  3124. /*:310*/
  3125. #line 7030 "./typica.w"
  3126. }
  3127. }
  3128. }
  3129. /*:314*//*315:*/
  3130. #line 7040 "./typica.w"
  3131. DAQ::~DAQ()
  3132. {
  3133. if(imp->useBase)
  3134. {
  3135. imp->resetDevice(imp->device.toAscii().data());
  3136. imp->clearTask(imp->handle);
  3137. }
  3138. else
  3139. {
  3140. if(imp->ready)
  3141. {
  3142. imp->ready= false;
  3143. imp->wait(ULONG_MAX);
  3144. imp->stopTask(imp->handle);
  3145. imp->resetDevice(imp->device.toAscii().data());
  3146. imp->clearTask(imp->handle);
  3147. }
  3148. }
  3149. delete imp;
  3150. }
  3151. /*:315*//*316:*/
  3152. #line 7071 "./typica.w"
  3153. DAQImplementation::DAQImplementation(const QString&driverinfo)
  3154. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  3155. unitMap(4)
  3156. {
  3157. if(driverinfo=="nidaqmxbase")
  3158. {
  3159. useBase= true;
  3160. }
  3161. else
  3162. {
  3163. useBase= false;
  3164. }
  3165. if(useBase)
  3166. {
  3167. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  3168. if(!driver.load())
  3169. {
  3170. driver.setFileName("nidaqmxbase");
  3171. if(!driver.load())
  3172. {
  3173. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3174. tr("Failed to find nidaqmxbase. Please install it."));
  3175. QApplication::quit();
  3176. }
  3177. }
  3178. }
  3179. else
  3180. {
  3181. driver.setFileName("nicaiu");
  3182. if(!driver.load())
  3183. {
  3184. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3185. tr("Failed to find nidaqmx. Please install it."));
  3186. QApplication::quit();
  3187. }
  3188. }
  3189. if(useBase)
  3190. {
  3191. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  3192. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  3193. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  3194. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  3195. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  3196. ==0||
  3197. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  3198. 0||
  3199. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  3200. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  3201. 0||
  3202. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  3203. {
  3204. waitForMeasurement= NULL;
  3205. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3206. tr("Failed to link a required symbol in NI-DAQmxBase."));
  3207. QApplication::quit();
  3208. }
  3209. }
  3210. else
  3211. {
  3212. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  3213. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  3214. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  3215. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  3216. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  3217. ==0||
  3218. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  3219. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  3220. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  3221. 0||
  3222. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  3223. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  3224. {
  3225. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3226. tr("Failed to link a required symbol in NI-DAQmx."));
  3227. QApplication::quit();
  3228. }
  3229. }
  3230. }
  3231. DAQImplementation::~DAQImplementation()
  3232. {
  3233. driver.unload();
  3234. }
  3235. /*:316*/
  3236. #line 540 "./typica.w"
  3237. /*966:*/
  3238. #line 197 "./dataqsdk.w"
  3239. void DataqSdkDeviceImplementation::measure()
  3240. {
  3241. unsigned count= channels*40;
  3242. di_status_read(buffer,count);
  3243. QTime time= QTime::currentTime();
  3244. for(unsigned int i= 0;i<count;i++)
  3245. {
  3246. buffer[i]= buffer[i]&0xFFFC;
  3247. }
  3248. QList<int> countList;
  3249. for(unsigned int i= 0;i<(unsigned)channels;i++)
  3250. {
  3251. QList<double> channelBuffer;
  3252. for(unsigned int j= 0;j<40;j++)
  3253. {
  3254. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  3255. if(i==0)
  3256. {
  3257. countList<<buffer[i+(channels*j)];
  3258. }
  3259. }
  3260. double value= 0.0;
  3261. for(unsigned int j= 0;j<40;j++)
  3262. {
  3263. value+= channelBuffer[j];
  3264. }
  3265. value/= 40.0;
  3266. if(i==0)
  3267. {
  3268. QList<double> smoothingList;
  3269. smoothingList<<value;
  3270. QList<int> smoothingKeys= smoother.uniqueKeys();
  3271. for(int j= 0;j<smoothingKeys.size();j++)
  3272. {
  3273. if(countList.contains(smoothingKeys[j]))
  3274. {
  3275. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  3276. for(int k= 0;k<keyValues.size();k++)
  3277. {
  3278. smoothingList<<keyValues[k];
  3279. }
  3280. }
  3281. else
  3282. {
  3283. smoother.remove(smoothingKeys[j]);
  3284. }
  3285. }
  3286. qSort(countList);
  3287. int lastCount= 0;
  3288. for(int j= 0;j<countList.size();j++)
  3289. {
  3290. if(j==0||countList[j]!=lastCount)
  3291. {
  3292. smoother.insert(countList[j],value);
  3293. lastCount= countList[j];
  3294. }
  3295. }
  3296. value= 0.0;
  3297. for(int j= 0;j<smoothingList.size();j++)
  3298. {
  3299. value+= smoothingList[j];
  3300. }
  3301. value/= smoothingList.size();
  3302. }
  3303. Measurement measure(value,time,unitMap[i]);
  3304. channelMap[i]->input(measure);
  3305. }
  3306. }
  3307. /*:966*//*967:*/
  3308. #line 290 "./dataqsdk.w"
  3309. void DataqSdkDeviceImplementation::run()
  3310. {
  3311. if(!ready)
  3312. {
  3313. error= 9;
  3314. return;
  3315. }
  3316. driver= new QLibrary(device);
  3317. if(!driver->load())
  3318. {
  3319. error= 1;
  3320. qDebug()<<"Failed to load driver: "<<device;
  3321. return;
  3322. }
  3323. di_open= (FPDIOPEN)driver->resolve("di_open");
  3324. di_close= (FPDICLOSE)driver->resolve("di_close");
  3325. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3326. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3327. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3328. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3329. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3330. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3331. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3332. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3333. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3334. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3335. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3336. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3337. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3338. (!di_burst_rate)||(!di_stop_scan))
  3339. {
  3340. error= 2;
  3341. return;
  3342. }
  3343. error= di_open(deviceNumber);
  3344. if(error)
  3345. {
  3346. di_close();
  3347. error= di_open(deviceNumber);
  3348. if(error)
  3349. {
  3350. error= 3;
  3351. di_close();
  3352. return;
  3353. }
  3354. }
  3355. isOpen= true;
  3356. di_maximum_rate(240.0);
  3357. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3358. &burstDivisor);
  3359. buffer= new qint16[(int)sampleRate];
  3360. di_inlist_struct inlist[16]= {{0,0,0,0,0,0,0,0}};
  3361. for(unsigned short i= 0;i<channels;i++)
  3362. {
  3363. inlist[i].chan= i;
  3364. inlist[i].gain= 0;
  3365. inlist[i].ave= 1;
  3366. inlist[i].counter= (oversample-1);
  3367. }
  3368. error= di_list_length(channels,0);
  3369. if(error)
  3370. {
  3371. error= 4;
  3372. return;
  3373. }
  3374. error= di_inlist(inlist);
  3375. if(error)
  3376. {
  3377. error= 5;
  3378. return;
  3379. }
  3380. input_buffer= di_buffer_alloc(0,4096);
  3381. if(input_buffer==NULL)
  3382. {
  3383. error= 6;
  3384. return;
  3385. }
  3386. error= di_start_scan();
  3387. if(error)
  3388. {
  3389. error= 7;
  3390. return;
  3391. }
  3392. while(ready)
  3393. {
  3394. measure();
  3395. }
  3396. }
  3397. /*:967*//*968:*/
  3398. #line 386 "./dataqsdk.w"
  3399. void DataqSdkDevice::threadFinished()
  3400. {
  3401. if(imp->error)
  3402. {
  3403. /*969:*/
  3404. #line 400 "./dataqsdk.w"
  3405. imp->ready= false;
  3406. QMessageBox warning;
  3407. warning.setStandardButtons(QMessageBox::Cancel);
  3408. warning.setIcon(QMessageBox::Warning);
  3409. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3410. warning.setInformativeText(tr("An error occurred"));
  3411. warning.setWindowTitle(QString(PROGRAM_NAME));
  3412. warning.exec();
  3413. /*:969*/
  3414. #line 391 "./dataqsdk.w"
  3415. }
  3416. }
  3417. /*:968*//*970:*/
  3418. #line 417 "./dataqsdk.w"
  3419. void DataqSdkDevice::start()
  3420. {
  3421. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3422. imp->start();
  3423. }
  3424. /*:970*//*971:*/
  3425. #line 428 "./dataqsdk.w"
  3426. QStringList DataqSdkDevice::detectHardware()
  3427. {
  3428. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3429. QSettings::NativeFormat);
  3430. QStringList keys= deviceLookup.childKeys();
  3431. QStringList devices;
  3432. for(int i= 0;i<keys.size();i++)
  3433. {
  3434. QString value= deviceLookup.value(keys.at(i)).toString();
  3435. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3436. {
  3437. devices.append(value.split("\\").at(2));
  3438. }
  3439. }
  3440. QStringList portList;
  3441. foreach(QString device,devices)
  3442. {
  3443. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3444. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3445. portList.append(deviceEntry.value("FriendlyName").toString());
  3446. }
  3447. return portList;
  3448. }
  3449. QStringList DataqSdkDevice::detectPorts()
  3450. {
  3451. QStringList friendlyNames= detectHardware();
  3452. QStringList portList;
  3453. foreach(QString name,friendlyNames)
  3454. {
  3455. name.remove(0,name.indexOf("COM"));
  3456. name.chop(1);
  3457. portList.append(name);
  3458. }
  3459. return portList;
  3460. }
  3461. /*:971*//*972:*/
  3462. #line 473 "./dataqsdk.w"
  3463. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3464. {
  3465. bool usesAuto= false;
  3466. int autoIndex= device.toInt(&usesAuto);
  3467. QString finalizedPort;
  3468. if(usesAuto)
  3469. {
  3470. QStringList portList= detectPorts();
  3471. if(autoIndex> 0&&autoIndex<=portList.size())
  3472. {
  3473. finalizedPort= portList.at(autoIndex-1);
  3474. }
  3475. else
  3476. {
  3477. imp->error= 8;
  3478. qDebug()<<"Failed to detect port.";
  3479. }
  3480. }
  3481. else
  3482. {
  3483. finalizedPort= device;
  3484. }
  3485. int rstart= finalizedPort.indexOf("COM");
  3486. finalizedPort.remove(0,rstart+3);
  3487. bool chopFinished= false;
  3488. int finalizedPortNumber= 0;
  3489. while(finalizedPort.size()> 0&&!chopFinished)
  3490. {
  3491. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  3492. if(!chopFinished)
  3493. {
  3494. finalizedPort.chop(1);
  3495. }
  3496. }
  3497. if(finalizedPortNumber<10)
  3498. {
  3499. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  3500. }
  3501. else
  3502. {
  3503. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  3504. }
  3505. imp->deviceNumber= 0x12C02D00;
  3506. imp->deviceNumber+= finalizedPortNumber;
  3507. imp->ready= true;
  3508. }
  3509. /*:972*//*973:*/
  3510. #line 523 "./dataqsdk.w"
  3511. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  3512. {
  3513. Channel*retval= NULL;
  3514. if(imp->ready)
  3515. {
  3516. retval= new Channel();
  3517. imp->channelMap[imp->channels]= retval;
  3518. imp->unitMap[imp->channels]= scale;
  3519. imp->channels++;
  3520. }
  3521. return retval;
  3522. }
  3523. /*:973*//*974:*/
  3524. #line 547 "./dataqsdk.w"
  3525. void DataqSdkDevice::setClockRate(double Hz)
  3526. {
  3527. imp->sampleRate= Hz;
  3528. }
  3529. /*:974*//*975:*/
  3530. #line 557 "./dataqsdk.w"
  3531. DataqSdkDevice::~DataqSdkDevice()
  3532. {
  3533. if(imp->ready)
  3534. {
  3535. imp->ready= false;
  3536. }
  3537. imp->wait(ULONG_MAX);
  3538. delete imp;
  3539. }
  3540. /*:975*//*976:*/
  3541. #line 575 "./dataqsdk.w"
  3542. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  3543. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  3544. {
  3545. }
  3546. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  3547. {
  3548. if(isOpen)
  3549. {
  3550. di_stop_scan();
  3551. di_close();
  3552. }
  3553. if(driver->isLoaded())
  3554. {
  3555. driver->unload();
  3556. }
  3557. }
  3558. /*:976*/
  3559. #line 541 "./typica.w"
  3560. /*323:*/
  3561. #line 7280 "./typica.w"
  3562. void FakeDAQImplementation::measure()
  3563. {
  3564. msleep((int)(1000/clockRate));
  3565. QTime time= QTime::currentTime();
  3566. for(int i= 0;i<channels;i++)
  3567. {
  3568. Measurement measure(qrand()%500,time);
  3569. channelMap[i]->input(measure);
  3570. }
  3571. }
  3572. /*:323*//*324:*/
  3573. #line 7294 "./typica.w"
  3574. void FakeDAQImplementation::run()
  3575. {
  3576. setPriority(QThread::TimeCriticalPriority);
  3577. while(ready)
  3578. {
  3579. measure();
  3580. }
  3581. }
  3582. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  3583. channels(0),ready(false),clockRate(1)
  3584. {
  3585. }
  3586. FakeDAQImplementation::~FakeDAQImplementation()
  3587. {
  3588. }
  3589. /*:324*//*325:*/
  3590. #line 7319 "./typica.w"
  3591. void FakeDAQ::start()
  3592. {
  3593. if(imp->ready)
  3594. {
  3595. imp->start();
  3596. }
  3597. }
  3598. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  3599. {
  3600. imp->ready= true;
  3601. }
  3602. Channel*FakeDAQ::newChannel(int,int)
  3603. {
  3604. Channel*retval;
  3605. if(imp->ready)
  3606. {
  3607. retval= new Channel();
  3608. imp->channelMap[imp->channels]= retval;
  3609. imp->channels++;
  3610. }
  3611. else
  3612. {
  3613. return NULL;
  3614. }
  3615. return retval;
  3616. }
  3617. void FakeDAQ::setClockRate(double Hz)
  3618. {
  3619. if(imp->ready)
  3620. {
  3621. imp->clockRate= Hz;
  3622. }
  3623. }
  3624. FakeDAQ::~FakeDAQ()
  3625. {
  3626. imp->ready= false;
  3627. imp->wait(ULONG_MAX);
  3628. delete imp;
  3629. }
  3630. /*:325*/
  3631. #line 542 "./typica.w"
  3632. /*330:*/
  3633. #line 7450 "./typica.w"
  3634. Channel::Channel():QObject(NULL)
  3635. {
  3636. }
  3637. Channel::~Channel()
  3638. {
  3639. }
  3640. void Channel::input(Measurement measurement)
  3641. {
  3642. emit newData(measurement);
  3643. }
  3644. /*:330*/
  3645. #line 543 "./typica.w"
  3646. /*346:*/
  3647. #line 7855 "./typica.w"
  3648. void TemperatureDisplay::setRelativeMode(bool relative)
  3649. {
  3650. r= relative;
  3651. }
  3652. /*:346*//*347:*/
  3653. #line 7872 "./typica.w"
  3654. void TemperatureDisplay::setValue(Measurement temperature)
  3655. {
  3656. QString number;
  3657. switch(unit)
  3658. {
  3659. case Units::Fahrenheit:
  3660. display(QString("%1'F").
  3661. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  3662. 2)));
  3663. break;
  3664. case Units::Celsius:
  3665. if(!r){
  3666. display(QString("%1'C").
  3667. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  3668. 2)));
  3669. }else{
  3670. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3671. display(QString("%1'C").arg(number));
  3672. }
  3673. break;
  3674. case Units::Kelvin:
  3675. if(!r){
  3676. display(QString("%1").
  3677. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  3678. 2)));
  3679. }else{
  3680. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3681. display(QString("%1").arg(number));
  3682. }
  3683. break;
  3684. case Units::Rankine:
  3685. display(QString("%1'r").
  3686. arg(number.setNum(temperature.toRankine().temperature(),'f',
  3687. 2)));
  3688. break;
  3689. case Units::Unitless:
  3690. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3691. break;
  3692. default:
  3693. switch(temperature.scale())
  3694. {
  3695. case Units::Fahrenheit:
  3696. display(QString("%1'F").
  3697. arg(number.setNum(temperature.temperature(),'f',2)));
  3698. break;
  3699. case Units::Celsius:
  3700. display(QString("%1'C").
  3701. arg(number.setNum(temperature.temperature(),'f',2)));
  3702. break;
  3703. case Units::Kelvin:
  3704. display(QString("%1").
  3705. arg(number.setNum(temperature.temperature(),'f',2)));
  3706. break;
  3707. case Units::Rankine:
  3708. display(QString("%1'r").
  3709. arg(number.setNum(temperature.temperature(),'f',2)));
  3710. break;
  3711. case Units::Unitless:
  3712. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3713. break;
  3714. default:
  3715. qDebug()<<"Warning: Attempting to convert a non-temperature unit to a temperature unit";
  3716. break;
  3717. }
  3718. break;
  3719. }
  3720. }
  3721. /*:347*//*348:*/
  3722. #line 7951 "./typica.w"
  3723. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  3724. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  3725. {
  3726. setSegmentStyle(Filled);
  3727. display("---.--'F");
  3728. }
  3729. /*:348*//*349:*/
  3730. #line 7967 "./typica.w"
  3731. void TemperatureDisplay::invalidate()
  3732. {
  3733. display("---.--'F");
  3734. }
  3735. /*:349*//*350:*/
  3736. #line 7979 "./typica.w"
  3737. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  3738. {
  3739. unit= scale;
  3740. }
  3741. /*:350*//*351:*/
  3742. #line 7987 "./typica.w"
  3743. TemperatureDisplay::~TemperatureDisplay()
  3744. {
  3745. }
  3746. /*:351*/
  3747. #line 544 "./typica.w"
  3748. /*357:*/
  3749. #line 8087 "./typica.w"
  3750. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  3751. {
  3752. if(measure.time()<epoch)
  3753. {
  3754. if(hasPrevious)
  3755. {
  3756. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  3757. epoch.msec());
  3758. QTime jitComp(epoch.hour(),measure.time().minute(),
  3759. measure.time().second(),measure.time().msec());
  3760. int relTime= jitBase.msecsTo(jitComp);
  3761. /*358:*/
  3762. #line 8121 "./typica.w"
  3763. QTime newTime(0,0,0,0);
  3764. newTime= newTime.addMSecs(relTime);
  3765. if(newTime.hour()> 0)
  3766. {
  3767. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3768. }
  3769. Measurement rel= measure;
  3770. rel.setTime(newTime);
  3771. emit measurement(rel);
  3772. /*:358*/
  3773. #line 8099 "./typica.w"
  3774. }
  3775. else
  3776. {
  3777. Measurement rel= measure;
  3778. rel.setTime(QTime(0,0,0,0));
  3779. emit measurement(rel);
  3780. }
  3781. }
  3782. else
  3783. {
  3784. int relTime= epoch.msecsTo(measure.time());
  3785. /*358:*/
  3786. #line 8121 "./typica.w"
  3787. QTime newTime(0,0,0,0);
  3788. newTime= newTime.addMSecs(relTime);
  3789. if(newTime.hour()> 0)
  3790. {
  3791. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3792. }
  3793. Measurement rel= measure;
  3794. rel.setTime(newTime);
  3795. emit measurement(rel);
  3796. /*:358*/
  3797. #line 8111 "./typica.w"
  3798. }
  3799. hasPrevious= true;
  3800. previous= measure.time();
  3801. }
  3802. /*:357*//*359:*/
  3803. #line 8134 "./typica.w"
  3804. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  3805. previous(0,0,0,0),hasPrevious(false)
  3806. {
  3807. }
  3808. QTime MeasurementTimeOffset::zeroTime()
  3809. {
  3810. return epoch;
  3811. }
  3812. void MeasurementTimeOffset::setZeroTime(QTime zero)
  3813. {
  3814. epoch= zero;
  3815. hasPrevious= false;
  3816. }
  3817. /*:359*/
  3818. #line 545 "./typica.w"
  3819. /*369:*/
  3820. #line 8332 "./typica.w"
  3821. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  3822. {
  3823. }
  3824. int ZeroEmitter::column()
  3825. {
  3826. return col;
  3827. }
  3828. double ZeroEmitter::lastTemperature()
  3829. {
  3830. return cache.temperature();
  3831. }
  3832. void ZeroEmitter::newMeasurement(Measurement measure)
  3833. {
  3834. cache= measure;
  3835. }
  3836. void ZeroEmitter::setColumn(int column)
  3837. {
  3838. col= column;
  3839. }
  3840. void ZeroEmitter::emitZero()
  3841. {
  3842. cache.setTime(QTime(0,0,0,0));
  3843. emit measurement(cache,col);
  3844. }
  3845. /*:369*/
  3846. #line 546 "./typica.w"
  3847. /*374:*/
  3848. #line 8422 "./typica.w"
  3849. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  3850. {
  3851. }
  3852. int MeasurementAdapter::column()
  3853. {
  3854. return col;
  3855. }
  3856. void MeasurementAdapter::newMeasurement(Measurement measure)
  3857. {
  3858. emit measurement(measure,col);
  3859. }
  3860. void MeasurementAdapter::setColumn(int column)
  3861. {
  3862. col= column;
  3863. }
  3864. /*:374*/
  3865. #line 547 "./typica.w"
  3866. /*379:*/
  3867. #line 8544 "./typica.w"
  3868. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  3869. theScene(new QGraphicsScene),
  3870. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  3871. prevPoints(new QMap<int,QPointF> ),
  3872. translations(new QMap<int,double> ),
  3873. gridLinesF(new QList<QGraphicsItem*> ),
  3874. gridLinesC(new QList<QGraphicsItem*> ),
  3875. relativeGridLines(new QList<QGraphicsItem*> ),
  3876. relativeEnabled(false),
  3877. timeIndicatorEnabled(false),
  3878. timeLine(new QGraphicsLineItem),
  3879. relativeAdjuster(new LinearSplineInterpolator)
  3880. {
  3881. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3882. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3883. setScene(theScene);
  3884. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  3885. QPen timePen;
  3886. timePen.setColor(QColor(160,160,164,127));
  3887. timeLine->setPen(timePen);
  3888. timeLine->setLine(0,0,0,-500);
  3889. timeLine->hide();
  3890. theScene->addItem(timeLine);
  3891. /*380:*/
  3892. #line 8584 "./typica.w"
  3893. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  3894. tempaxis->setLine(-10,-500,-10,0);
  3895. theScene->addItem(tempaxis);
  3896. QGraphicsLineItem*gridLine;
  3897. QGraphicsTextItem*label;
  3898. for(int y= -100;y> -600;y-= 100)
  3899. {
  3900. gridLine= new QGraphicsLineItem;
  3901. gridLine->setLine(0,y,1200,y);
  3902. theScene->addItem(gridLine);
  3903. label= new QGraphicsTextItem;
  3904. label->setHtml(QString("%1&deg;F").arg(-y));
  3905. label->setPos(-55,y-(label->boundingRect().height()/2));
  3906. theScene->addItem(label);
  3907. gridLinesF->append(gridLine);
  3908. gridLinesF->append(label);
  3909. }
  3910. for(int degC= 50;degC<=250;degC+= 50)
  3911. {
  3912. gridLine= new QGraphicsLineItem;
  3913. int y= -(degC*(9.0/5.0)+32);
  3914. gridLine->setLine(0,y,1200,y);
  3915. gridLine->hide();
  3916. theScene->addItem(gridLine);
  3917. gridLinesC->append(gridLine);
  3918. label= new QGraphicsTextItem;
  3919. label->setHtml(QString("%1&deg;C").arg(degC));
  3920. label->setPos(-55,y-(label->boundingRect().height()/2));
  3921. label->hide();
  3922. theScene->addItem(label);
  3923. gridLinesC->append(label);
  3924. }
  3925. /*:380*/
  3926. #line 8568 "./typica.w"
  3927. ;
  3928. /*381:*/
  3929. #line 8625 "./typica.w"
  3930. QSettings settings;
  3931. if(settings.contains("settings/graph/relative/enable"))
  3932. {
  3933. if(settings.value("settings/graph/relative/enable").toBool())
  3934. {
  3935. relativeEnabled= true;
  3936. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  3937. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  3938. QMap<double,QString> relativeAxisPairs;
  3939. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  3940. foreach(QString item,relativeAxisLabels)
  3941. {
  3942. relativeAxisPairs.insert(item.toDouble(),item);
  3943. }
  3944. if(relativeAxisPairs.size()> 1)
  3945. {
  3946. double skip= 500.0/(relativeAxisPairs.size()-1);
  3947. double y= 0;
  3948. foreach(double key,relativeAxisPairs.keys())
  3949. {
  3950. gridLine= new QGraphicsLineItem;
  3951. gridLine->setLine(0,y,1205,y);
  3952. gridLine->setPen(QPen(relativeColor));
  3953. theScene->addItem(gridLine);
  3954. relativeGridLines->append(gridLine);
  3955. label= new QGraphicsTextItem;
  3956. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  3957. label->setPos(1210,y-(label->boundingRect().height()/2));
  3958. theScene->addItem(label);
  3959. relativeGridLines->append(label);
  3960. if(unit=="F")
  3961. {
  3962. relativeAdjuster->add_pair(key,-y);
  3963. }
  3964. else
  3965. {
  3966. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  3967. }
  3968. y-= skip;
  3969. }
  3970. }
  3971. }
  3972. }
  3973. /*:381*/
  3974. #line 8569 "./typica.w"
  3975. /*383:*/
  3976. #line 8702 "./typica.w"
  3977. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  3978. timeaxis->setLine(0,10,1200,10);
  3979. theScene->addItem(timeaxis);
  3980. for(int x= 0;x<1201;x+= 120)
  3981. {
  3982. QGraphicsLineItem*tick= new QGraphicsLineItem;
  3983. tick->setLine(x,0,x,20);
  3984. theScene->addItem(tick);
  3985. QGraphicsTextItem*label= new QGraphicsTextItem;
  3986. label->setPlainText(QString("%1").arg(x/60));
  3987. label->setPos(x-(label->boundingRect().width()/2),20);
  3988. theScene->addItem(label);
  3989. }
  3990. /*:383*/
  3991. #line 8570 "./typica.w"
  3992. ;
  3993. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3994. }
  3995. /*:379*//*382:*/
  3996. #line 8672 "./typica.w"
  3997. void GraphView::showF()
  3998. {
  3999. for(int i= 0;i<gridLinesF->size();i++)
  4000. {
  4001. gridLinesF->at(i)->show();
  4002. }
  4003. for(int i= 0;i<gridLinesC->size();i++)
  4004. {
  4005. gridLinesC->at(i)->hide();
  4006. }
  4007. }
  4008. void GraphView::showC()
  4009. {
  4010. for(int i= 0;i<gridLinesF->size();i++)
  4011. {
  4012. gridLinesF->at(i)->hide();
  4013. }
  4014. for(int i= 0;i<gridLinesC->size();i++)
  4015. {
  4016. gridLinesC->at(i)->show();
  4017. }
  4018. }
  4019. /*:382*//*384:*/
  4020. #line 8721 "./typica.w"
  4021. void GraphView::resizeEvent(QResizeEvent*)
  4022. {
  4023. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  4024. }
  4025. /*:384*//*385:*/
  4026. #line 8735 "./typica.w"
  4027. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  4028. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  4029. {
  4030. double offset= 0;
  4031. if(measure.contains("relative"))
  4032. {
  4033. if(measure.value("relative").toBool())
  4034. {
  4035. if(relativeEnabled)
  4036. {
  4037. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  4038. }
  4039. else
  4040. {
  4041. return;
  4042. }
  4043. }
  4044. }
  4045. if(translations->contains(tempcolumn))
  4046. {
  4047. offset= translations->value(tempcolumn);
  4048. }
  4049. if(prevPoints->contains(tempcolumn))
  4050. {
  4051. /*387:*/
  4052. #line 8812 "./typica.w"
  4053. QGraphicsLineItem*segment= new QGraphicsLineItem;
  4054. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  4055. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  4056. -(prevPoints->value(tempcolumn).y()),
  4057. nextPoint.x()+offset,-(nextPoint.y()));
  4058. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  4059. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  4060. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  4061. Qt::darkYellow};
  4062. segment->setPen(p[tempcolumn%12]);
  4063. theScene->addItem(segment);
  4064. prevPoints->insert(tempcolumn,nextPoint);
  4065. if(timeIndicatorEnabled)
  4066. {
  4067. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  4068. }
  4069. /*:387*/
  4070. #line 8761 "./typica.w"
  4071. if(graphLines->contains(tempcolumn))
  4072. {
  4073. graphLines->value(tempcolumn)->append(segment);
  4074. }
  4075. else
  4076. {
  4077. QList<QGraphicsLineItem*> *newLine=
  4078. new QList<QGraphicsLineItem*> ;
  4079. newLine->append(segment);
  4080. graphLines->insert(tempcolumn,newLine);
  4081. }
  4082. }
  4083. else
  4084. {
  4085. /*386:*/
  4086. #line 8797 "./typica.w"
  4087. int x= FULLTIMETOINT(measure.time())/1000;
  4088. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  4089. if(timeIndicatorEnabled)
  4090. {
  4091. timeLine->setLine(x,0,x,-500);
  4092. }
  4093. /*:386*/
  4094. #line 8778 "./typica.w"
  4095. }
  4096. }
  4097. /*:385*//*388:*/
  4098. #line 8833 "./typica.w"
  4099. void GraphView::clear()
  4100. {
  4101. int i;
  4102. foreach(i,prevPoints->keys())
  4103. {
  4104. removeSeries(i);
  4105. }
  4106. translations->clear();
  4107. }
  4108. /*:388*//*389:*/
  4109. #line 8847 "./typica.w"
  4110. void GraphView::removeSeries(int column)
  4111. {
  4112. if(graphLines->contains(column))
  4113. {
  4114. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4115. QGraphicsLineItem*segment;
  4116. foreach(segment,*series)
  4117. {
  4118. theScene->removeItem(segment);
  4119. }
  4120. qDeleteAll(*series);
  4121. }
  4122. graphLines->remove(column);
  4123. prevPoints->remove(column);
  4124. }
  4125. /*:389*//*390:*/
  4126. #line 8866 "./typica.w"
  4127. void GraphView::setSeriesTranslation(int column,double offset)
  4128. {
  4129. if(graphLines->contains(column))
  4130. {
  4131. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4132. QGraphicsLineItem*segment;
  4133. foreach(segment,*series)
  4134. {
  4135. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  4136. }
  4137. }
  4138. if(translations->contains(column))
  4139. {
  4140. translations->insert(column,offset+translations->value(column));
  4141. }
  4142. else
  4143. {
  4144. translations->insert(column,offset);
  4145. }
  4146. }
  4147. /*:390*//*391:*/
  4148. #line 8893 "./typica.w"
  4149. void GraphView::setTimeIndicatorEnabled(bool enabled)
  4150. {
  4151. timeIndicatorEnabled= enabled;
  4152. if(enabled)
  4153. {
  4154. timeLine->show();
  4155. }
  4156. else
  4157. {
  4158. timeLine->hide();
  4159. }
  4160. }
  4161. /*:391*/
  4162. #line 548 "./typica.w"
  4163. /*397:*/
  4164. #line 9037 "./typica.w"
  4165. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  4166. {
  4167. if(measure.time()!=QTime(0,0,0,0))
  4168. {
  4169. /*399:*/
  4170. #line 9111 "./typica.w"
  4171. if(lastMeasurement.contains(tempcolumn))
  4172. {
  4173. if(lastMeasurement[tempcolumn].time()<measure.time())
  4174. {
  4175. QList<QTime> timelist;
  4176. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  4177. {
  4178. timelist.append(i);
  4179. }
  4180. for(int i= 0;i<timelist.size();i++)
  4181. {
  4182. Measurement synthesized= measure;
  4183. synthesized.setTime(timelist[i]);
  4184. newMeasurement(synthesized,tempcolumn);
  4185. }
  4186. }
  4187. }
  4188. /*:399*/
  4189. #line 9042 "./typica.w"
  4190. }
  4191. model_ms->newMeasurement(measure,tempcolumn);
  4192. if(lastMeasurement.contains(tempcolumn))
  4193. {
  4194. if(measure.time().second()!=
  4195. lastMeasurement.value(tempcolumn).time().second())
  4196. {
  4197. Measurement adjusted= measure;
  4198. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  4199. adjusted.setTime(adjtime);
  4200. model_1s->newMeasurement(adjusted,tempcolumn);
  4201. if(adjusted.time().second()%5==0)
  4202. {
  4203. model_5s->newMeasurement(adjusted,tempcolumn);
  4204. if(adjusted.time().second()%10==0)
  4205. {
  4206. model_10s->newMeasurement(adjusted,tempcolumn);
  4207. }
  4208. if(adjusted.time().second()%15==0)
  4209. {
  4210. model_15s->newMeasurement(adjusted,tempcolumn);
  4211. if(adjusted.time().second()%30==0)
  4212. {
  4213. model_30s->newMeasurement(adjusted,tempcolumn);
  4214. if(adjusted.time().second()==0)
  4215. {
  4216. model_1m->newMeasurement(adjusted,tempcolumn);
  4217. }
  4218. }
  4219. }
  4220. }
  4221. }
  4222. /*401:*/
  4223. #line 9155 "./typica.w"
  4224. if(currentColumnSet.contains(tempcolumn))
  4225. {
  4226. int replicationcolumn;
  4227. foreach(replicationcolumn,currentColumnSet)
  4228. {
  4229. if(replicationcolumn!=tempcolumn)
  4230. {
  4231. if(lastMeasurement.contains(replicationcolumn))
  4232. {
  4233. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  4234. {
  4235. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  4236. synthetic.setTime(measure.time());
  4237. model_ms->newMeasurement(synthetic,replicationcolumn);
  4238. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  4239. {
  4240. Measurement adjusted= synthetic;
  4241. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  4242. model_1s->newMeasurement(adjusted,replicationcolumn);
  4243. if(adjusted.time().second()%5==0)
  4244. {
  4245. model_5s->newMeasurement(adjusted,replicationcolumn);
  4246. if(adjusted.time().second()%10==0)
  4247. {
  4248. model_10s->newMeasurement(adjusted,replicationcolumn);
  4249. }
  4250. if(adjusted.time().second()%15==0)
  4251. {
  4252. model_15s->newMeasurement(adjusted,replicationcolumn);
  4253. if(adjusted.time().second()%30==0)
  4254. {
  4255. model_30s->newMeasurement(adjusted,replicationcolumn);
  4256. if(adjusted.time().second()==0)
  4257. {
  4258. model_1m->newMeasurement(adjusted,replicationcolumn);
  4259. }
  4260. }
  4261. }
  4262. }
  4263. }
  4264. lastMeasurement[replicationcolumn]= synthetic;
  4265. }
  4266. }
  4267. }
  4268. }
  4269. }
  4270. /*:401*/
  4271. #line 9075 "./typica.w"
  4272. }
  4273. else
  4274. {
  4275. /*398:*/
  4276. #line 9087 "./typica.w"
  4277. MeasurementModel*m;
  4278. foreach(m,modelSet)
  4279. {
  4280. m->newMeasurement(measure,tempcolumn);
  4281. }
  4282. /*:398*/
  4283. #line 9079 "./typica.w"
  4284. }
  4285. lastMeasurement.insert(tempcolumn,measure);
  4286. }
  4287. /*:397*//*400:*/
  4288. #line 9141 "./typica.w"
  4289. void ZoomLog::addToCurrentColumnSet(int column)
  4290. {
  4291. currentColumnSet.append(column);
  4292. }
  4293. void ZoomLog::clearCurrentColumnSet()
  4294. {
  4295. currentColumnSet.clear();
  4296. }
  4297. /*:400*//*402:*/
  4298. #line 9225 "./typica.w"
  4299. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  4300. int annotationcolumn)
  4301. {
  4302. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4303. MeasurementModel*m;
  4304. if(lastMeasurement.contains(tempcolumn))
  4305. {
  4306. foreach(m,modelSet)
  4307. {
  4308. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  4309. }
  4310. }
  4311. foreach(m,modelSet)
  4312. {
  4313. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4314. }
  4315. }
  4316. /*:402*//*403:*/
  4317. #line 9249 "./typica.w"
  4318. void ZoomLog::centerOn(int row)
  4319. {
  4320. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  4321. }
  4322. /*:403*//*404:*/
  4323. #line 9259 "./typica.w"
  4324. void ZoomLog::clear()
  4325. {
  4326. MeasurementModel*m;
  4327. foreach(m,modelSet)
  4328. {
  4329. m->clear();
  4330. }
  4331. lastMeasurement.clear();
  4332. saveTempCols.clear();
  4333. saveControlCols.clear();
  4334. saveNoteCols.clear();
  4335. }
  4336. /*:404*//*405:*/
  4337. #line 9277 "./typica.w"
  4338. QVariant ZoomLog::data(int row,int column)const
  4339. {
  4340. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4341. Qt::DisplayRole);
  4342. }
  4343. int ZoomLog::rowCount()
  4344. {
  4345. return model_ms->rowCount();
  4346. }
  4347. /*:405*//*406:*/
  4348. #line 9300 "./typica.w"
  4349. bool ZoomLog::saveXML(QIODevice*device)
  4350. {
  4351. Units::Unit prevUnits= model_ms->displayUnits();
  4352. if(prevUnits!=Units::Fahrenheit)
  4353. {
  4354. model_ms->setDisplayUnits(Units::Fahrenheit);
  4355. }
  4356. XMLOutput writer(model_ms,device,0);
  4357. int c;
  4358. foreach(c,saveTempCols)
  4359. {
  4360. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4361. toString(),c);
  4362. }
  4363. foreach(c,saveControlCols)
  4364. {
  4365. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4366. toString(),c);
  4367. }
  4368. foreach(c,saveNoteCols)
  4369. {
  4370. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4371. toString(),c);
  4372. }
  4373. bool retval= writer.output();
  4374. if(prevUnits!=Units::Fahrenheit)
  4375. {
  4376. model_ms->setDisplayUnits(prevUnits);
  4377. }
  4378. return retval;
  4379. }
  4380. /*:406*//*407:*/
  4381. #line 9336 "./typica.w"
  4382. bool ZoomLog::saveCSV(QIODevice*device)
  4383. {
  4384. CSVOutput writer(currentModel,device,0);
  4385. int c;
  4386. foreach(c,saveTempCols)
  4387. {
  4388. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4389. toString(),c);
  4390. }
  4391. foreach(c,saveControlCols)
  4392. {
  4393. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4394. toString(),c);
  4395. }
  4396. foreach(c,saveNoteCols)
  4397. {
  4398. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4399. toString(),c);
  4400. }
  4401. return writer.output();
  4402. }
  4403. /*:407*//*408:*/
  4404. #line 9365 "./typica.w"
  4405. void ZoomLog::switchLOD(MeasurementModel*m)
  4406. {
  4407. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4408. setModel(m);
  4409. currentModel= m;
  4410. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4411. }
  4412. void ZoomLog::LOD_ms()
  4413. {
  4414. switchLOD(model_ms);
  4415. }
  4416. void ZoomLog::LOD_1s()
  4417. {
  4418. switchLOD(model_1s);
  4419. }
  4420. void ZoomLog::LOD_5s()
  4421. {
  4422. switchLOD(model_5s);
  4423. }
  4424. void ZoomLog::LOD_10s()
  4425. {
  4426. switchLOD(model_10s);
  4427. }
  4428. void ZoomLog::LOD_15s()
  4429. {
  4430. switchLOD(model_15s);
  4431. }
  4432. void ZoomLog::LOD_30s()
  4433. {
  4434. switchLOD(model_30s);
  4435. }
  4436. void ZoomLog::LOD_1m()
  4437. {
  4438. switchLOD(model_1m);
  4439. }
  4440. /*:408*//*409:*/
  4441. #line 9413 "./typica.w"
  4442. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4443. {
  4444. model_ms->setDisplayUnits(scale);
  4445. model_1s->setDisplayUnits(scale);
  4446. model_5s->setDisplayUnits(scale);
  4447. model_10s->setDisplayUnits(scale);
  4448. model_15s->setDisplayUnits(scale);
  4449. model_30s->setDisplayUnits(scale);
  4450. model_1m->setDisplayUnits(scale);
  4451. }
  4452. Units::Unit ZoomLog::displayUnits()
  4453. {
  4454. return model_ms->displayUnits();
  4455. }
  4456. /*:409*//*410:*/
  4457. #line 9433 "./typica.w"
  4458. QString ZoomLog::lastTime(int series)
  4459. {
  4460. Measurement measure= lastMeasurement.value(series);
  4461. QTime time= measure.time();
  4462. return time.toString("h:mm:ss.zzz");
  4463. }
  4464. /*:410*//*411:*/
  4465. #line 9443 "./typica.w"
  4466. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  4467. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  4468. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  4469. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  4470. {
  4471. setEditTriggers(QAbstractItemView::NoEditTriggers);
  4472. setSelectionMode(QAbstractItemView::NoSelection);
  4473. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  4474. model_30s<<model_1m;
  4475. currentModel= model_30s;
  4476. setModel(currentModel);
  4477. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4478. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  4479. this,SLOT(persistColumnResize(int,int,int)));
  4480. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  4481. this,SLOT(restoreColumnWidths()));
  4482. }
  4483. /*:411*//*412:*/
  4484. #line 9466 "./typica.w"
  4485. void ZoomLog::setHeaderData(int section,QString text)
  4486. {
  4487. MeasurementModel*m;
  4488. foreach(m,modelSet)
  4489. {
  4490. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  4491. }
  4492. }
  4493. /*:412*//*413:*/
  4494. #line 9484 "./typica.w"
  4495. void ZoomLog::addOutputTemperatureColumn(int column)
  4496. {
  4497. saveTempCols.append(column);
  4498. }
  4499. void ZoomLog::addOutputControlColumn(int column)
  4500. {
  4501. saveControlCols.append(column);
  4502. }
  4503. void ZoomLog::addOutputAnnotationColumn(int column)
  4504. {
  4505. saveNoteCols.append(column);
  4506. }
  4507. void ZoomLog::clearOutputColumns()
  4508. {
  4509. saveTempCols.clear();
  4510. saveControlCols.clear();
  4511. saveNoteCols.clear();
  4512. }
  4513. /*:413*//*414:*/
  4514. #line 9510 "./typica.w"
  4515. void ZoomLog::persistColumnResize(int column,int,int newsize)
  4516. {
  4517. /*629:*/
  4518. #line 13656 "./typica.w"
  4519. QSettings settings;
  4520. /*630:*/
  4521. #line 13669 "./typica.w"
  4522. QWidget*topLevelWidget= this;
  4523. while(topLevelWidget->parentWidget())
  4524. {
  4525. topLevelWidget= topLevelWidget->parentWidget();
  4526. }
  4527. /*:630*/
  4528. #line 13658 "./typica.w"
  4529. settings.setValue(QString("columnWidths/%1/%2/%3").
  4530. arg(topLevelWidget->objectName()).
  4531. arg(objectName()).arg(column),
  4532. QVariant(newsize));
  4533. /*:629*/
  4534. #line 9513 "./typica.w"
  4535. }
  4536. void ZoomLog::restoreColumnWidths()
  4537. {
  4538. /*632:*/
  4539. #line 13689 "./typica.w"
  4540. QSettings settings;
  4541. /*630:*/
  4542. #line 13669 "./typica.w"
  4543. QWidget*topLevelWidget= this;
  4544. while(topLevelWidget->parentWidget())
  4545. {
  4546. topLevelWidget= topLevelWidget->parentWidget();
  4547. }
  4548. /*:630*/
  4549. #line 13691 "./typica.w"
  4550. QString baseKey=
  4551. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4552. arg(objectName());
  4553. for(int i= 0;i<model()->columnCount();i++)
  4554. {
  4555. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4556. if(settings.contains(key))
  4557. {
  4558. setColumnWidth(i,settings.value(key).toInt());
  4559. }
  4560. }
  4561. /*:632*/
  4562. #line 9518 "./typica.w"
  4563. }
  4564. void ZoomLog::setVisible(bool visibility)
  4565. {
  4566. QTableView::setVisible(visibility);
  4567. }
  4568. void ZoomLog::showEvent(QShowEvent*)
  4569. {
  4570. /*632:*/
  4571. #line 13689 "./typica.w"
  4572. QSettings settings;
  4573. /*630:*/
  4574. #line 13669 "./typica.w"
  4575. QWidget*topLevelWidget= this;
  4576. while(topLevelWidget->parentWidget())
  4577. {
  4578. topLevelWidget= topLevelWidget->parentWidget();
  4579. }
  4580. /*:630*/
  4581. #line 13691 "./typica.w"
  4582. QString baseKey=
  4583. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4584. arg(objectName());
  4585. for(int i= 0;i<model()->columnCount();i++)
  4586. {
  4587. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4588. if(settings.contains(key))
  4589. {
  4590. setColumnWidth(i,settings.value(key).toInt());
  4591. }
  4592. }
  4593. /*:632*/
  4594. #line 9528 "./typica.w"
  4595. }
  4596. /*:414*/
  4597. #line 549 "./typica.w"
  4598. /*423:*/
  4599. #line 9761 "./typica.w"
  4600. bool MeasurementList::operator<(const MeasurementList&other)const
  4601. {
  4602. return this->first().toTime()<other.first().toTime();
  4603. }
  4604. bool MeasurementList::operator==(const MeasurementList&other)const
  4605. {
  4606. return this->first().toTime()==other.first().toTime();
  4607. }
  4608. /*:423*//*424:*/
  4609. #line 9777 "./typica.w"
  4610. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  4611. {
  4612. return QModelIndex();
  4613. }
  4614. /*:424*//*425:*/
  4615. #line 9787 "./typica.w"
  4616. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  4617. {
  4618. if(measure.scale()==Units::Unitless)
  4619. {
  4620. controlColumns->insert(tempcolumn,true);
  4621. }
  4622. else
  4623. {
  4624. controlColumns->insert(tempcolumn,false);
  4625. }
  4626. MeasurementList*temp;
  4627. temp= new MeasurementList;
  4628. temp->append(QVariant(measure.time()));
  4629. /*426:*/
  4630. #line 9846 "./typica.w"
  4631. /*427:*/
  4632. #line 9891 "./typica.w"
  4633. QList<MeasurementList*> ::iterator i= lastInsertion;
  4634. bool quickscan= false;
  4635. if(entries->size()> 5)
  4636. {
  4637. if(**i<*temp)
  4638. {
  4639. i+= 1;
  4640. for(int j= 10;j> 0;j--)
  4641. {
  4642. if(i!=entries->end())
  4643. {
  4644. if(**i<*temp)
  4645. {
  4646. i+= 1;
  4647. }
  4648. else
  4649. {
  4650. quickscan= true;
  4651. break;
  4652. }
  4653. }
  4654. else
  4655. {
  4656. quickscan= true;
  4657. break;
  4658. }
  4659. }
  4660. }
  4661. else
  4662. {
  4663. if(**i==*temp)
  4664. {
  4665. quickscan= true;
  4666. }
  4667. }
  4668. }
  4669. /*:427*/
  4670. #line 9847 "./typica.w"
  4671. if(quickscan==false)
  4672. {
  4673. i= entries->begin();
  4674. QList<MeasurementList*> ::iterator u= entries->end();
  4675. QList<MeasurementList*> ::iterator midpoint;
  4676. int n= u-i;
  4677. int rA;
  4678. while(n> 0)
  4679. {
  4680. rA= n>>1;
  4681. midpoint= i+rA;
  4682. if(**midpoint<*temp)
  4683. {
  4684. i= midpoint+1;
  4685. n-= rA+1;
  4686. }
  4687. else
  4688. {
  4689. n= rA;
  4690. }
  4691. }
  4692. }
  4693. /*:426*/
  4694. #line 9801 "./typica.w"
  4695. MeasurementList*newEntry;
  4696. int insertion;
  4697. if(i!=entries->end())
  4698. {
  4699. insertion= entries->indexOf(*i);
  4700. if((*i)->first().toTime()==measure.time())
  4701. {
  4702. /*428:*/
  4703. #line 9933 "./typica.w"
  4704. if((*i)->size()<tempcolumn+1)
  4705. {
  4706. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  4707. {
  4708. (*i)->append(QVariant());
  4709. }
  4710. }
  4711. (*i)->replace(tempcolumn,measure);
  4712. lastInsertion= i;
  4713. emit dataChanged(createIndex(insertion,tempcolumn),
  4714. createIndex(insertion,tempcolumn));
  4715. lastTemperature->insert(tempcolumn,insertion);
  4716. /*:428*/
  4717. #line 9809 "./typica.w"
  4718. }
  4719. else
  4720. {
  4721. /*429:*/
  4722. #line 9951 "./typica.w"
  4723. beginInsertRows(QModelIndex(),insertion,insertion);
  4724. newEntry= new MeasurementList;
  4725. newEntry->append(QVariant(measure.time()));
  4726. for(int j= 0;j<tempcolumn+1;j++)
  4727. {
  4728. newEntry->append(QVariant());
  4729. }
  4730. newEntry->replace(tempcolumn,measure);
  4731. lastInsertion= entries->insert(i,newEntry);
  4732. endInsertRows();
  4733. lastTemperature->insert(tempcolumn,insertion);
  4734. /*:429*/
  4735. #line 9813 "./typica.w"
  4736. }
  4737. }
  4738. else
  4739. {
  4740. /*430:*/
  4741. #line 9969 "./typica.w"
  4742. insertion= entries->size();
  4743. /*429:*/
  4744. #line 9951 "./typica.w"
  4745. beginInsertRows(QModelIndex(),insertion,insertion);
  4746. newEntry= new MeasurementList;
  4747. newEntry->append(QVariant(measure.time()));
  4748. for(int j= 0;j<tempcolumn+1;j++)
  4749. {
  4750. newEntry->append(QVariant());
  4751. }
  4752. newEntry->replace(tempcolumn,measure);
  4753. lastInsertion= entries->insert(i,newEntry);
  4754. endInsertRows();
  4755. lastTemperature->insert(tempcolumn,insertion);
  4756. /*:429*/
  4757. #line 9971 "./typica.w"
  4758. /*:430*/
  4759. #line 9818 "./typica.w"
  4760. }
  4761. if(tempcolumn>=colcount)
  4762. {
  4763. colcount= tempcolumn+1;
  4764. }
  4765. emit rowChanged(insertion);
  4766. delete temp;
  4767. }
  4768. /*:425*//*431:*/
  4769. #line 9981 "./typica.w"
  4770. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  4771. int annotationColumn)
  4772. {
  4773. int r;
  4774. if(lastTemperature->contains(tempcolumn))
  4775. {
  4776. r= lastTemperature->value(tempcolumn);
  4777. }
  4778. else
  4779. {
  4780. r= 0;
  4781. }
  4782. if(r==0&&entries->size()==0)
  4783. {
  4784. /*432:*/
  4785. #line 10019 "./typica.w"
  4786. beginInsertRows(QModelIndex(),0,0);
  4787. MeasurementList*newEntry= new MeasurementList;
  4788. newEntry->append(QVariant(QTime(0,0,0,0)));
  4789. entries->append(newEntry);
  4790. endInsertRows();
  4791. /*:432*/
  4792. #line 9996 "./typica.w"
  4793. }
  4794. MeasurementList*row= entries->at(r);
  4795. if(row->size()<=annotationColumn)
  4796. {
  4797. for(int i= row->size()-1;i<annotationColumn+1;i++)
  4798. {
  4799. row->append(QVariant());
  4800. }
  4801. }
  4802. row->replace(annotationColumn,annotation);
  4803. emit dataChanged(createIndex(r,annotationColumn),
  4804. createIndex(r,annotationColumn));
  4805. emit rowChanged(r);
  4806. if(annotationColumn> colcount-1)
  4807. {
  4808. colcount= annotationColumn+1;
  4809. }
  4810. }
  4811. /*:431*//*433:*/
  4812. #line 10030 "./typica.w"
  4813. void MeasurementModel::clear()
  4814. {
  4815. beginRemoveRows(QModelIndex(),0,entries->size());
  4816. while(entries->size()!=0)
  4817. {
  4818. MeasurementList*row= entries->takeFirst();
  4819. delete row;
  4820. }
  4821. endRemoveRows();
  4822. colcount= hData->size();
  4823. lastTemperature->clear();
  4824. reset();
  4825. }
  4826. /*:433*//*434:*/
  4827. #line 10063 "./typica.w"
  4828. bool MeasurementModel::setData(const QModelIndex&index,
  4829. const QVariant&value,int role)
  4830. {
  4831. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  4832. {
  4833. return false;
  4834. }
  4835. /*435:*/
  4836. #line 10095 "./typica.w"
  4837. bool valid= false;
  4838. if(index.isValid())
  4839. {
  4840. if(index.row()<entries->size())
  4841. {
  4842. if(index.column()<colcount)
  4843. {
  4844. valid= true;
  4845. }
  4846. }
  4847. }
  4848. /*:435*/
  4849. #line 10071 "./typica.w"
  4850. if(!valid)
  4851. {
  4852. return false;
  4853. }
  4854. MeasurementList*row= entries->at(index.row());
  4855. if(index.column()>=row->size())
  4856. {
  4857. /*436:*/
  4858. #line 10112 "./typica.w"
  4859. for(int i= row->size()-1;i<index.column();i++)
  4860. {
  4861. row->append(QVariant());
  4862. }
  4863. /*:436*/
  4864. #line 10079 "./typica.w"
  4865. }
  4866. if(index.column()==0)
  4867. {
  4868. /*437:*/
  4869. #line 10127 "./typica.w"
  4870. QTime time;
  4871. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  4872. {
  4873. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  4874. {
  4875. return false;
  4876. }
  4877. }
  4878. row= entries->takeAt(index.row());
  4879. row->replace(index.column(),QVariant(time));
  4880. MeasurementList*temp= row;
  4881. /*426:*/
  4882. #line 9846 "./typica.w"
  4883. /*427:*/
  4884. #line 9891 "./typica.w"
  4885. QList<MeasurementList*> ::iterator i= lastInsertion;
  4886. bool quickscan= false;
  4887. if(entries->size()> 5)
  4888. {
  4889. if(**i<*temp)
  4890. {
  4891. i+= 1;
  4892. for(int j= 10;j> 0;j--)
  4893. {
  4894. if(i!=entries->end())
  4895. {
  4896. if(**i<*temp)
  4897. {
  4898. i+= 1;
  4899. }
  4900. else
  4901. {
  4902. quickscan= true;
  4903. break;
  4904. }
  4905. }
  4906. else
  4907. {
  4908. quickscan= true;
  4909. break;
  4910. }
  4911. }
  4912. }
  4913. else
  4914. {
  4915. if(**i==*temp)
  4916. {
  4917. quickscan= true;
  4918. }
  4919. }
  4920. }
  4921. /*:427*/
  4922. #line 9847 "./typica.w"
  4923. if(quickscan==false)
  4924. {
  4925. i= entries->begin();
  4926. QList<MeasurementList*> ::iterator u= entries->end();
  4927. QList<MeasurementList*> ::iterator midpoint;
  4928. int n= u-i;
  4929. int rA;
  4930. while(n> 0)
  4931. {
  4932. rA= n>>1;
  4933. midpoint= i+rA;
  4934. if(**midpoint<*temp)
  4935. {
  4936. i= midpoint+1;
  4937. n-= rA+1;
  4938. }
  4939. else
  4940. {
  4941. n= rA;
  4942. }
  4943. }
  4944. }
  4945. /*:426*/
  4946. #line 10139 "./typica.w"
  4947. entries->insert(i,row);
  4948. int newRow= entries->indexOf(*i);
  4949. if(newRow<index.row())
  4950. {
  4951. emit dataChanged(createIndex(newRow,index.column()),index);
  4952. }
  4953. else
  4954. {
  4955. emit dataChanged(index,createIndex(newRow,index.column()));
  4956. }
  4957. /*:437*/
  4958. #line 10083 "./typica.w"
  4959. }
  4960. else
  4961. {
  4962. /*438:*/
  4963. #line 10153 "./typica.w"
  4964. row->replace(index.column(),value);
  4965. emit dataChanged(index,index);
  4966. /*:438*/
  4967. #line 10087 "./typica.w"
  4968. }
  4969. return true;
  4970. }
  4971. /*:434*//*439:*/
  4972. #line 10161 "./typica.w"
  4973. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  4974. unit(Units::Fahrenheit),hData(new QStringList),
  4975. lastTemperature(new QHash<int,int> ),
  4976. controlColumns(new QHash<int,bool> )
  4977. {
  4978. colcount= 1;
  4979. entries= new QList<MeasurementList*> ;
  4980. lastInsertion= entries->begin();
  4981. hData->append(tr("Time"));
  4982. }
  4983. /*:439*//*440:*/
  4984. #line 10175 "./typica.w"
  4985. MeasurementModel::~MeasurementModel()
  4986. {
  4987. clear();
  4988. delete entries;
  4989. delete hData;
  4990. }
  4991. /*:440*//*441:*/
  4992. #line 10187 "./typica.w"
  4993. int MeasurementModel::rowCount(const QModelIndex&parent)const
  4994. {
  4995. if(parent==QModelIndex())
  4996. {
  4997. return entries->size();
  4998. }
  4999. return 0;
  5000. }
  5001. int MeasurementModel::columnCount(const QModelIndex&parent)const
  5002. {
  5003. if(parent==QModelIndex())
  5004. {
  5005. return colcount;
  5006. }
  5007. return 0;
  5008. }
  5009. /*:441*//*442:*/
  5010. #line 10214 "./typica.w"
  5011. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  5012. const QVariant&value,int)
  5013. {
  5014. if(orientation==Qt::Horizontal)
  5015. {
  5016. if(hData->size()<section+1)
  5017. {
  5018. for(int i= hData->size();i<section+1;i++)
  5019. {
  5020. if(colcount<i)
  5021. {
  5022. beginInsertColumns(QModelIndex(),i,i);
  5023. }
  5024. hData->append(QString());
  5025. if(colcount<i)
  5026. {
  5027. endInsertColumns();
  5028. }
  5029. }
  5030. }
  5031. hData->replace(section,value.toString());
  5032. emit headerDataChanged(orientation,section,section);
  5033. if(colcount<section+1)
  5034. {
  5035. colcount= section+1;
  5036. }
  5037. return true;
  5038. }
  5039. return false;
  5040. }
  5041. /*:442*//*443:*/
  5042. #line 10254 "./typica.w"
  5043. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  5044. {
  5045. beginResetModel();
  5046. unit= scale;
  5047. endResetModel();
  5048. }
  5049. Units::Unit MeasurementModel::displayUnits()
  5050. {
  5051. return unit;
  5052. }
  5053. /*:443*//*444:*/
  5054. #line 10280 "./typica.w"
  5055. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  5056. {
  5057. /*435:*/
  5058. #line 10095 "./typica.w"
  5059. bool valid= false;
  5060. if(index.isValid())
  5061. {
  5062. if(index.row()<entries->size())
  5063. {
  5064. if(index.column()<colcount)
  5065. {
  5066. valid= true;
  5067. }
  5068. }
  5069. }
  5070. /*:435*/
  5071. #line 10283 "./typica.w"
  5072. if(!valid)
  5073. {
  5074. return QVariant();
  5075. }
  5076. MeasurementList*row= entries->at(index.row());
  5077. if(role==Qt::UserRole)
  5078. {
  5079. return QVariant(row->at(index.column()));
  5080. }
  5081. if(role==Qt::DisplayRole||role==Qt::EditRole)
  5082. {
  5083. if(index.column()> row->size())
  5084. {
  5085. return QVariant();
  5086. }
  5087. else
  5088. {
  5089. if(index.column()==0)
  5090. {
  5091. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  5092. }
  5093. else if(lastTemperature->contains(index.column()))
  5094. {
  5095. QVariantMap v= row->at(index.column()).toMap();
  5096. if(!v.contains("measurement"))
  5097. {
  5098. return QVariant();
  5099. }
  5100. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  5101. {
  5102. return v.value("measurement");
  5103. }
  5104. else
  5105. {
  5106. if(v.contains("relative"))
  5107. {
  5108. if(v.value("relative").toBool())
  5109. {
  5110. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  5111. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  5112. }
  5113. }
  5114. return QVariant(QString("%1").
  5115. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  5116. (Units::Unit)(v.value("unit").toInt()),unit)));
  5117. }
  5118. }
  5119. return QVariant(row->at(index.column()).toString());
  5120. }
  5121. }
  5122. return QVariant();
  5123. }
  5124. /*:444*//*445:*/
  5125. #line 10339 "./typica.w"
  5126. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  5127. int role)const
  5128. {
  5129. if(orientation==Qt::Horizontal)
  5130. {
  5131. if(role==Qt::DisplayRole)
  5132. {
  5133. if(section<hData->size())
  5134. {
  5135. return QVariant(hData->at(section));
  5136. }
  5137. }
  5138. }
  5139. return QVariant();
  5140. }
  5141. /*:445*//*446:*/
  5142. #line 10366 "./typica.w"
  5143. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  5144. {
  5145. /*435:*/
  5146. #line 10095 "./typica.w"
  5147. bool valid= false;
  5148. if(index.isValid())
  5149. {
  5150. if(index.row()<entries->size())
  5151. {
  5152. if(index.column()<colcount)
  5153. {
  5154. valid= true;
  5155. }
  5156. }
  5157. }
  5158. /*:435*/
  5159. #line 10369 "./typica.w"
  5160. if(valid)
  5161. {
  5162. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5163. }
  5164. return 0;
  5165. }
  5166. /*:446*//*447:*/
  5167. #line 10381 "./typica.w"
  5168. QModelIndex MeasurementModel::index(int row,int column,
  5169. const QModelIndex&parent)const
  5170. {
  5171. if(parent==QModelIndex())
  5172. {
  5173. if(row<entries->size()&&entries->isEmpty()==false)
  5174. {
  5175. if(column<entries->at(row)->size())
  5176. {
  5177. return createIndex(row,column);
  5178. }
  5179. }
  5180. }
  5181. return QModelIndex();
  5182. }
  5183. /*:447*/
  5184. #line 550 "./typica.w"
  5185. /*449:*/
  5186. #line 10432 "./typica.w"
  5187. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  5188. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  5189. {
  5190. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  5191. }
  5192. /*:449*//*450:*/
  5193. #line 10447 "./typica.w"
  5194. void AnnotationButton::annotate()
  5195. {
  5196. if(note.contains("%1"))
  5197. {
  5198. count++;
  5199. emit annotation(note.arg(count),tc,ac);
  5200. }
  5201. else
  5202. {
  5203. emit annotation(note,tc,ac);
  5204. }
  5205. }
  5206. /*:450*//*451:*/
  5207. #line 10465 "./typica.w"
  5208. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  5209. {
  5210. tc= tempcolumn;
  5211. }
  5212. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  5213. {
  5214. ac= annotationcolumn;
  5215. }
  5216. void AnnotationButton::setAnnotation(const QString&annotation)
  5217. {
  5218. note= annotation;
  5219. }
  5220. /*:451*//*452:*/
  5221. #line 10484 "./typica.w"
  5222. void AnnotationButton::resetCount()
  5223. {
  5224. count= 0;
  5225. }
  5226. /*:452*/
  5227. #line 551 "./typica.w"
  5228. /*457:*/
  5229. #line 10567 "./typica.w"
  5230. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  5231. const QString&postt,
  5232. QWidget*parent)
  5233. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  5234. {
  5235. resetChange();
  5236. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  5237. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  5238. }
  5239. /*:457*//*458:*/
  5240. #line 10584 "./typica.w"
  5241. void AnnotationSpinBox::resetChange()
  5242. {
  5243. change= true;
  5244. }
  5245. /*:458*//*459:*/
  5246. #line 10595 "./typica.w"
  5247. void AnnotationSpinBox::annotate()
  5248. {
  5249. if(change)
  5250. {
  5251. change= false;
  5252. emit annotation(QString("%1%2%3").arg(pretext).
  5253. arg(value()).arg(posttext),tc,ac);
  5254. }
  5255. }
  5256. /*:459*//*460:*/
  5257. #line 10608 "./typica.w"
  5258. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  5259. {
  5260. tc= tempcolumn;
  5261. }
  5262. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  5263. {
  5264. ac= annotationcolumn;
  5265. }
  5266. void AnnotationSpinBox::setPretext(const QString&pret)
  5267. {
  5268. pretext= pret;
  5269. }
  5270. void AnnotationSpinBox::setPosttext(const QString&postt)
  5271. {
  5272. posttext= postt;
  5273. }
  5274. /*:460*/
  5275. #line 552 "./typica.w"
  5276. /*467:*/
  5277. #line 10777 "./typica.w"
  5278. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  5279. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  5280. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  5281. stopAction(new QAction(tr("Stop"),NULL)),
  5282. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  5283. relative(QTime::currentTime()),base(QTime(0,0,0))
  5284. {
  5285. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  5286. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  5287. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  5288. clock.setInterval(500);
  5289. clock.setSingleShot(false);
  5290. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  5291. setSegmentStyle(Filled);
  5292. updateDisplay();
  5293. }
  5294. /*:467*//*468:*/
  5295. #line 10798 "./typica.w"
  5296. void TimerDisplay::updateTime()
  5297. {
  5298. QTime time;
  5299. int cseconds= 0;
  5300. int oseconds= 0;
  5301. int r= 0;
  5302. QTime nt= QTime(0,0,0);
  5303. int n= 0;
  5304. int bseconds= 0;
  5305. switch(m)
  5306. {
  5307. case TimerDisplay::CountUp:
  5308. /*469:*/
  5309. #line 10830 "./typica.w"
  5310. /*470:*/
  5311. #line 10843 "./typica.w"
  5312. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5313. time= QTime::currentTime();
  5314. cseconds= TIMETOINT(time);
  5315. oseconds= TIMETOINT(relative);
  5316. r= cseconds-oseconds;
  5317. /*:470*/
  5318. #line 10831 "./typica.w"
  5319. nt= nt.addSecs(r);
  5320. if(nt!=s)
  5321. {
  5322. s= nt;
  5323. emit valueChanged(s);
  5324. }
  5325. /*:469*/
  5326. #line 10811 "./typica.w"
  5327. ;
  5328. break;
  5329. case TimerDisplay::CountDown:
  5330. /*471:*/
  5331. #line 10855 "./typica.w"
  5332. if(s> QTime(0,0,0))
  5333. {
  5334. /*470:*/
  5335. #line 10843 "./typica.w"
  5336. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5337. time= QTime::currentTime();
  5338. cseconds= TIMETOINT(time);
  5339. oseconds= TIMETOINT(relative);
  5340. r= cseconds-oseconds;
  5341. /*:470*/
  5342. #line 10858 "./typica.w"
  5343. bseconds= TIMETOINT(base);
  5344. n= bseconds-r;
  5345. nt= nt.addSecs(n);
  5346. if(nt!=s)
  5347. {
  5348. s= nt;
  5349. emit valueChanged(s);
  5350. }
  5351. }else{
  5352. stopTimer();
  5353. }
  5354. /*:471*/
  5355. #line 10814 "./typica.w"
  5356. ;
  5357. break;
  5358. case TimerDisplay::Clock:
  5359. /*472:*/
  5360. #line 10874 "./typica.w"
  5361. time= QTime::currentTime();
  5362. if(time!=s)
  5363. {
  5364. s= time;
  5365. emit valueChanged(s);
  5366. }
  5367. /*:472*/
  5368. #line 10817 "./typica.w"
  5369. ;
  5370. break;
  5371. default:
  5372. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5373. break;
  5374. }
  5375. updateDisplay();
  5376. }
  5377. /*:468*//*473:*/
  5378. #line 10886 "./typica.w"
  5379. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5380. void TimerDisplay::startTimer()
  5381. {
  5382. if(!running)
  5383. {
  5384. relative= QTime::currentTime();
  5385. if(ar)
  5386. {
  5387. reset();
  5388. }
  5389. else
  5390. {
  5391. relative= TIMESUBTRACT(relative,s);
  5392. }
  5393. if(m==Clock)
  5394. {
  5395. updateTime();
  5396. }
  5397. base= s;
  5398. clock.start();
  5399. running= true;
  5400. emit runStateChanged(true);
  5401. }
  5402. }
  5403. /*:473*//*474:*/
  5404. #line 10916 "./typica.w"
  5405. void TimerDisplay::stopTimer()
  5406. {
  5407. if(running)
  5408. {
  5409. clock.stop();
  5410. running= false;
  5411. emit runStateChanged(false);
  5412. }
  5413. }
  5414. /*:474*//*475:*/
  5415. #line 10929 "./typica.w"
  5416. TimerDisplay::~TimerDisplay()
  5417. {
  5418. clock.stop();
  5419. }
  5420. /*:475*//*476:*/
  5421. #line 10938 "./typica.w"
  5422. void TimerDisplay::setCountUpMode()
  5423. {
  5424. m= TimerDisplay::CountUp;
  5425. }
  5426. void TimerDisplay::setCountDownMode()
  5427. {
  5428. m= TimerDisplay::CountDown;
  5429. }
  5430. void TimerDisplay::setClockMode()
  5431. {
  5432. m= TimerDisplay::Clock;
  5433. }
  5434. /*:476*//*477:*/
  5435. #line 10956 "./typica.w"
  5436. QString TimerDisplay::value()
  5437. {
  5438. return s.toString(f);
  5439. }
  5440. QTime TimerDisplay::seconds()
  5441. {
  5442. return s;
  5443. }
  5444. TimerDisplay::TimerMode TimerDisplay::mode()
  5445. {
  5446. return m;
  5447. }
  5448. bool TimerDisplay::isRunning()
  5449. {
  5450. return running;
  5451. }
  5452. QTime TimerDisplay::resetValue()
  5453. {
  5454. return r;
  5455. }
  5456. QString TimerDisplay::displayFormat()
  5457. {
  5458. return f;
  5459. }
  5460. bool TimerDisplay::autoReset()
  5461. {
  5462. return ar;
  5463. }
  5464. /*:477*//*478:*/
  5465. #line 10994 "./typica.w"
  5466. void TimerDisplay::setTimer(QTime value)
  5467. {
  5468. if(value.isValid())
  5469. {
  5470. s= value;
  5471. updateDisplay();
  5472. emit valueChanged(value);
  5473. }
  5474. }
  5475. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  5476. {
  5477. m= mode;
  5478. }
  5479. void TimerDisplay::setResetValue(QTime value)
  5480. {
  5481. r= value;
  5482. }
  5483. void TimerDisplay::setDisplayFormat(QString format)
  5484. {
  5485. f= format;
  5486. setNumDigits(format.length());
  5487. }
  5488. void TimerDisplay::setAutoReset(bool reset)
  5489. {
  5490. ar= reset;
  5491. }
  5492. /*:478*//*479:*/
  5493. #line 11029 "./typica.w"
  5494. void TimerDisplay::copyTimer()
  5495. {
  5496. QApplication::clipboard()->setText(value());
  5497. }
  5498. /*:479*//*480:*/
  5499. #line 11038 "./typica.w"
  5500. void TimerDisplay::reset()
  5501. {
  5502. if(!running)
  5503. {
  5504. s= r;
  5505. updateDisplay();
  5506. }
  5507. }
  5508. /*:480*//*481:*/
  5509. #line 11051 "./typica.w"
  5510. void TimerDisplay::updateDisplay()
  5511. {
  5512. display(value());
  5513. }
  5514. /*:481*/
  5515. #line 553 "./typica.w"
  5516. /*488:*/
  5517. #line 11176 "./typica.w"
  5518. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  5519. {
  5520. int x= rect.x();
  5521. int y= rect.y();
  5522. QLayoutItem*item;
  5523. if(orientation==Qt::Horizontal)
  5524. {
  5525. /*489:*/
  5526. #line 11200 "./typica.w"
  5527. foreach(item,itemList)
  5528. {
  5529. int nextX= x+item->sizeHint().width()+spacing();
  5530. int right= x+item->sizeHint().width();
  5531. if(item==itemList.last())
  5532. {
  5533. right= rect.right();
  5534. }
  5535. int bottom= rect.bottom();
  5536. if(!testOnly)
  5537. {
  5538. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5539. }
  5540. x= nextX;
  5541. }
  5542. /*:489*/
  5543. #line 11184 "./typica.w"
  5544. }
  5545. else
  5546. {
  5547. /*490:*/
  5548. #line 11219 "./typica.w"
  5549. foreach(item,itemList)
  5550. {
  5551. int nextY= y+item->sizeHint().height()+spacing();
  5552. int bottom= y+item->sizeHint().height();
  5553. if(item==itemList.last())
  5554. {
  5555. bottom= rect.bottom();
  5556. }
  5557. int right= rect.right();
  5558. if(!testOnly)
  5559. {
  5560. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5561. }
  5562. y= nextY;
  5563. }
  5564. /*:490*/
  5565. #line 11188 "./typica.w"
  5566. }
  5567. return y;
  5568. }
  5569. /*:488*//*491:*/
  5570. #line 11243 "./typica.w"
  5571. QSize PackLayout::minimumSize()const
  5572. {
  5573. QSize size;
  5574. QLayoutItem*item;
  5575. foreach(item,itemList)
  5576. {
  5577. if(orientation==Qt::Horizontal)
  5578. {
  5579. size+= QSize(item->minimumSize().width(),0);
  5580. if(size.height()<item->minimumSize().height())
  5581. {
  5582. size.setHeight(item->minimumSize().height());
  5583. }
  5584. }
  5585. else
  5586. {
  5587. size+= QSize(0,item->minimumSize().height());
  5588. if(size.width()<item->minimumSize().width())
  5589. {
  5590. size.setWidth(item->minimumSize().width());
  5591. }
  5592. }
  5593. }
  5594. size+= QSize(2*margin(),2*margin());
  5595. return size;
  5596. }
  5597. /*:491*//*492:*/
  5598. #line 11275 "./typica.w"
  5599. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  5600. QLayout(parent)
  5601. {
  5602. setMargin(margin);
  5603. setSpacing(spacing);
  5604. setOrientation(Qt::Horizontal);
  5605. }
  5606. PackLayout::PackLayout(int spacing)
  5607. {
  5608. setSpacing(spacing);
  5609. setOrientation(Qt::Horizontal);
  5610. }
  5611. /*:492*//*493:*/
  5612. #line 11293 "./typica.w"
  5613. PackLayout::~PackLayout()
  5614. {
  5615. QLayoutItem*item;
  5616. while((item= takeAt(0)))
  5617. {
  5618. delete item;
  5619. }
  5620. }
  5621. /*:493*//*494:*/
  5622. #line 11307 "./typica.w"
  5623. QLayoutItem*PackLayout::takeAt(int index)
  5624. {
  5625. if(index>=0&&index<itemList.size())
  5626. {
  5627. return itemList.takeAt(index);
  5628. }
  5629. else
  5630. {
  5631. return NULL;
  5632. }
  5633. }
  5634. /*:494*//*495:*/
  5635. #line 11323 "./typica.w"
  5636. QLayoutItem*PackLayout::itemAt(int index)const
  5637. {
  5638. if(index>=0&&index<itemList.size())
  5639. {
  5640. return itemList.at(index);
  5641. }
  5642. else
  5643. {
  5644. return NULL;
  5645. }
  5646. }
  5647. /*:495*//*496:*/
  5648. #line 11346 "./typica.w"
  5649. void PackLayout::addItem(QLayoutItem*item)
  5650. {
  5651. itemList.append(item);
  5652. }
  5653. /*:496*//*497:*/
  5654. #line 11354 "./typica.w"
  5655. int PackLayout::count()const
  5656. {
  5657. return itemList.size();
  5658. }
  5659. /*:497*//*498:*/
  5660. #line 11366 "./typica.w"
  5661. Qt::Orientations PackLayout::expandingDirections()const
  5662. {
  5663. return Qt::Vertical|Qt::Horizontal;
  5664. }
  5665. bool PackLayout::hasHeightForWidth()const
  5666. {
  5667. return false;
  5668. }
  5669. int PackLayout::heightForWidth(int width)const
  5670. {
  5671. return doLayout(QRect(0,0,width,0),true);
  5672. }
  5673. void PackLayout::setGeometry(const QRect&rect)
  5674. {
  5675. QLayout::setGeometry(rect);
  5676. doLayout(rect,false);
  5677. }
  5678. QSize PackLayout::sizeHint()const
  5679. {
  5680. return minimumSize();
  5681. }
  5682. /*:498*//*499:*/
  5683. #line 11397 "./typica.w"
  5684. void PackLayout::setOrientation(Qt::Orientations direction)
  5685. {
  5686. orientation= direction;
  5687. doLayout(geometry(),false);
  5688. }
  5689. /*:499*/
  5690. #line 554 "./typica.w"
  5691. /*501:*/
  5692. #line 11436 "./typica.w"
  5693. SceneButton::SceneButton():QGraphicsScene()
  5694. {
  5695. }
  5696. SceneButton::~SceneButton()
  5697. {
  5698. }
  5699. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  5700. {
  5701. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  5702. }
  5703. /*:501*/
  5704. #line 555 "./typica.w"
  5705. /*503:*/
  5706. #line 11482 "./typica.w"
  5707. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  5708. Qt::Orientations orientation,
  5709. QWidget*parent,Qt::WindowFlags f):
  5710. QWidget(parent,f),label(new QGraphicsView()),
  5711. scene(new SceneButton())
  5712. {
  5713. layout= new PackLayout(this);
  5714. layout->setOrientation(orientation);
  5715. /*504:*/
  5716. #line 11502 "./typica.w"
  5717. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5718. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5719. label->setFrameShape(QFrame::NoFrame);
  5720. label->setInteractive(true);
  5721. /*:504*/
  5722. #line 11491 "./typica.w"
  5723. /*505:*/
  5724. #line 11513 "./typica.w"
  5725. scene->setBackgroundBrush(Qt::cyan);
  5726. text= scene->addText(labeltext);
  5727. if(orientation==Qt::Horizontal)
  5728. {
  5729. text->rotate(270.0);
  5730. }
  5731. label->setScene(scene);
  5732. /*:505*/
  5733. #line 11492 "./typica.w"
  5734. /*506:*/
  5735. #line 11531 "./typica.w"
  5736. if(orientation==Qt::Horizontal)
  5737. {
  5738. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  5739. }
  5740. else
  5741. {
  5742. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  5743. }
  5744. label->centerOn(text);
  5745. /*:506*/
  5746. #line 11493 "./typica.w"
  5747. /*507:*/
  5748. #line 11546 "./typica.w"
  5749. layout->addWidget(label);
  5750. layout->addWidget(widget);
  5751. if(orientation==Qt::Horizontal)
  5752. {
  5753. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  5754. widget->sizeHint().height());
  5755. }
  5756. else
  5757. {
  5758. setMinimumSize(widget->sizeHint().width(),
  5759. widget->sizeHint().height()+label->sizeHint().height());
  5760. }
  5761. /*:507*/
  5762. #line 11494 "./typica.w"
  5763. }
  5764. /*:503*//*508:*/
  5765. #line 11563 "./typica.w"
  5766. void WidgetDecorator::setBackgroundBrush(QBrush background)
  5767. {
  5768. scene->setBackgroundBrush(background);
  5769. }
  5770. void WidgetDecorator::setTextColor(QColor color)
  5771. {
  5772. text->setDefaultTextColor(color);
  5773. }
  5774. /*:508*//*509:*/
  5775. #line 11576 "./typica.w"
  5776. WidgetDecorator::~WidgetDecorator()
  5777. {
  5778. }
  5779. /*:509*/
  5780. #line 556 "./typica.w"
  5781. /*514:*/
  5782. #line 11675 "./typica.w"
  5783. void LogEditWindow::addTheRows()
  5784. {
  5785. QTime s= startTime->time();
  5786. while(s<endTime->time())
  5787. {
  5788. model->newMeasurement(Measurement(0,s),1);
  5789. s= s.addSecs(interval->value());
  5790. }
  5791. model->newMeasurement(Measurement(0,endTime->time()),1);
  5792. }
  5793. /*:514*//*515:*/
  5794. #line 11689 "./typica.w"
  5795. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  5796. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  5797. addRowsLayout(new QHBoxLayout(NULL)),
  5798. startTimeLabel(new QLabel("Start Time")),
  5799. startTime(new QTimeEdit(QTime(0,0,0,0))),
  5800. endTimeLabel(new QLabel("End Time")),
  5801. endTime(new QTimeEdit(QTime(0,20,0,0))),
  5802. intervalLabel(new QLabel("Interval (seconds)")),
  5803. interval(new QSpinBox()),
  5804. addRows(new QPushButton("Add Rows")),
  5805. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  5806. saveCsv(new QAction(tr("Export CSV"),NULL)),
  5807. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  5808. model(new MeasurementModel()),
  5809. log(new QTableView())
  5810. {
  5811. /*516:*/
  5812. #line 11726 "./typica.w"
  5813. QSettings settings;
  5814. resize(settings.value("logSize",QSize(620,400)).toSize());
  5815. move(settings.value("logPos",QPoint(200,60)).toPoint());
  5816. /*:516*/
  5817. #line 11706 "./typica.w"
  5818. /*517:*/
  5819. #line 11739 "./typica.w"
  5820. mainLayout->setOrientation(Qt::Vertical);
  5821. addRowsLayout->addSpacing(10);
  5822. addRowsLayout->addWidget(startTimeLabel);
  5823. addRowsLayout->addWidget(startTime);
  5824. addRowsLayout->addSpacing(10);
  5825. startTime->setDisplayFormat("mm:ss");
  5826. addRowsLayout->addWidget(endTimeLabel);
  5827. addRowsLayout->addWidget(endTime);
  5828. addRowsLayout->addSpacing(10);
  5829. endTime->setDisplayFormat("mm:ss");
  5830. addRowsLayout->addWidget(intervalLabel);
  5831. addRowsLayout->addWidget(interval);
  5832. addRowsLayout->addSpacing(10);
  5833. interval->setRange(0,60);
  5834. interval->setValue(30);
  5835. addRowsLayout->addWidget(addRows);
  5836. addRowsLayout->addSpacing(10);
  5837. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  5838. /*:517*/
  5839. #line 11707 "./typica.w"
  5840. /*518:*/
  5841. #line 11762 "./typica.w"
  5842. model->setHeaderData(0,Qt::Horizontal,"Time");
  5843. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  5844. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  5845. model->clear();
  5846. /*:518*/
  5847. #line 11708 "./typica.w"
  5848. /*519:*/
  5849. #line 11771 "./typica.w"
  5850. log->setModel(model);
  5851. log->setColumnWidth(0,100);
  5852. log->setColumnWidth(1,100);
  5853. log->setColumnWidth(2,100);
  5854. /*:519*/
  5855. #line 11709 "./typica.w"
  5856. mainLayout->addItem(addRowsLayout);
  5857. mainLayout->addWidget(log);
  5858. centralWidget->setLayout(mainLayout);
  5859. setCentralWidget(centralWidget);
  5860. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  5861. fileMenu->addAction(openXml);
  5862. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  5863. fileMenu->addAction(saveXml);
  5864. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  5865. fileMenu->addAction(saveCsv);
  5866. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  5867. }
  5868. /*:515*//*520:*/
  5869. #line 11782 "./typica.w"
  5870. void LogEditWindow::saveXML()
  5871. {
  5872. QSettings settings;
  5873. QString lastDir= settings.value("lastDirectory").toString();
  5874. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  5875. lastDir,"",0);
  5876. QFile file(filename);
  5877. XMLOutput writer(model,&file,0);
  5878. writer.addTemperatureColumn("Temperature",1);
  5879. writer.addAnnotationColumn("Annotation",2);
  5880. if(writer.output())
  5881. {
  5882. QFileInfo info(filename);
  5883. QDir directory= info.dir();
  5884. lastDir= directory.path();
  5885. settings.setValue("lastDirectory",lastDir);
  5886. }
  5887. }
  5888. void LogEditWindow::saveCSV()
  5889. {
  5890. QSettings settings;
  5891. QString lastDir= settings.value("lastDirectory").toString();
  5892. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  5893. lastDir,"",0);
  5894. QFile file(filename);
  5895. CSVOutput writer(model,&file,0);
  5896. writer.addTemperatureColumn("Temperature",1);
  5897. writer.addAnnotationColumn("Annotation",2);
  5898. if(writer.output())
  5899. {
  5900. QFileInfo info(filename);
  5901. QDir directory= info.dir();
  5902. lastDir= directory.path();
  5903. settings.setValue("lastDirectory",lastDir);
  5904. }
  5905. }
  5906. /*:520*//*521:*/
  5907. #line 11825 "./typica.w"
  5908. void LogEditWindow::openXML()
  5909. {
  5910. QSettings settings;
  5911. QString lastDir= settings.value("lastDirectory").toString();
  5912. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  5913. lastDir,"",0);
  5914. if(filename.isNull())
  5915. {
  5916. return;
  5917. }
  5918. QFile file(filename);
  5919. XMLInput reader(&file,1);
  5920. connect(&reader,SIGNAL(measure(Measurement,int)),
  5921. model,SLOT(newMeasurement(Measurement,int)));
  5922. connect(&reader,SIGNAL(annotation(QString,int,int)),
  5923. model,SLOT(newAnnotation(QString,int,int)));
  5924. if(reader.input())
  5925. {
  5926. QFileInfo info(filename);
  5927. setWindowTitle(QString(tr("%1 - %2")).
  5928. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  5929. QDir directory= info.dir();
  5930. lastDir= directory.path();
  5931. settings.setValue("lastDirectory",lastDir);
  5932. }
  5933. }
  5934. /*:521*//*522:*/
  5935. #line 11856 "./typica.w"
  5936. void LogEditWindow::closeEvent(QCloseEvent*event)
  5937. {
  5938. QSettings settings;
  5939. settings.setValue("logSize",size());
  5940. settings.setValue("logPos",pos());
  5941. event->accept();
  5942. }
  5943. /*:522*/
  5944. #line 557 "./typica.w"
  5945. /*528:*/
  5946. #line 11971 "./typica.w"
  5947. bool XMLOutput::output()
  5948. {
  5949. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5950. {
  5951. return false;
  5952. }
  5953. QXmlStreamWriter xmlout(out);
  5954. xmlout.writeStartDocument("1.0");
  5955. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  5956. xmlout.writeStartElement("roastlog");
  5957. /*529:*/
  5958. #line 12004 "./typica.w"
  5959. foreach(int c,temperatureColumns.keys())
  5960. {
  5961. xmlout.writeStartElement("tempseries");
  5962. xmlout.writeAttribute("name",temperatureColumns.value(c));
  5963. xmlout.writeEndElement();
  5964. }
  5965. foreach(int c,controlColumns.keys())
  5966. {
  5967. xmlout.writeStartElement("controlseries");
  5968. xmlout.writeAttribute("name",controlColumns.value(c));
  5969. xmlout.writeEndElement();
  5970. }
  5971. foreach(int c,annotationColumns.keys())
  5972. {
  5973. xmlout.writeStartElement("noteseries");
  5974. xmlout.writeAttribute("name",annotationColumns.value(c));
  5975. xmlout.writeEndElement();
  5976. }
  5977. /*:529*/
  5978. #line 11982 "./typica.w"
  5979. xmlout.writeStartElement("roast");
  5980. bool oresult;
  5981. for(int i= 0;i<data->rowCount();i++)
  5982. {
  5983. /*530:*/
  5984. #line 12029 "./typica.w"
  5985. oresult= false;
  5986. foreach(int c,temperatureColumns.keys())
  5987. {
  5988. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5989. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5990. {
  5991. oresult= true;
  5992. break;
  5993. }
  5994. }
  5995. foreach(int c,controlColumns.keys())
  5996. {
  5997. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5998. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5999. {
  6000. oresult= true;
  6001. break;
  6002. }
  6003. }
  6004. if(oresult==false)
  6005. {
  6006. foreach(int c,annotationColumns.keys())
  6007. {
  6008. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6009. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6010. isEmpty()))
  6011. {
  6012. oresult= true;
  6013. break;
  6014. }
  6015. }
  6016. }
  6017. /*:530*/
  6018. #line 11987 "./typica.w"
  6019. if(oresult)
  6020. {
  6021. /*531:*/
  6022. #line 12068 "./typica.w"
  6023. xmlout.writeStartElement("tuple");
  6024. xmlout.writeTextElement("time",data->data(data->index(i,time),
  6025. Qt::DisplayRole).toString());
  6026. foreach(int c,temperatureColumns.keys())
  6027. {
  6028. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6029. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6030. {
  6031. xmlout.writeStartElement("temperature");
  6032. xmlout.writeAttribute("series",temperatureColumns.value(c));
  6033. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  6034. {
  6035. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  6036. {
  6037. xmlout.writeAttribute("relative","true");
  6038. }
  6039. }
  6040. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6041. toString());
  6042. xmlout.writeEndElement();
  6043. }
  6044. }
  6045. foreach(int c,controlColumns.keys())
  6046. {
  6047. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6048. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6049. {
  6050. xmlout.writeStartElement("control");
  6051. xmlout.writeAttribute("series",controlColumns.value(c));
  6052. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  6053. xmlout.writeEndElement();
  6054. }
  6055. }
  6056. foreach(int c,annotationColumns.keys())
  6057. {
  6058. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6059. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6060. {
  6061. xmlout.writeStartElement("annotation");
  6062. xmlout.writeAttribute("series",annotationColumns.value(c));
  6063. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6064. toString());
  6065. xmlout.writeEndElement();
  6066. }
  6067. }
  6068. xmlout.writeEndElement();
  6069. /*:531*/
  6070. #line 11990 "./typica.w"
  6071. }
  6072. }
  6073. xmlout.writeEndElement();
  6074. xmlout.writeEndElement();
  6075. xmlout.writeEndDocument();
  6076. out->close();
  6077. return true;
  6078. }
  6079. /*:528*//*532:*/
  6080. #line 12118 "./typica.w"
  6081. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  6082. :QObject(NULL),data(model),out(device),time(timec)
  6083. {
  6084. }
  6085. void XMLOutput::setModel(MeasurementModel*model)
  6086. {
  6087. data= model;
  6088. }
  6089. void XMLOutput::setTimeColumn(int column)
  6090. {
  6091. time= column;
  6092. }
  6093. void XMLOutput::setDevice(QIODevice*device)
  6094. {
  6095. out= device;
  6096. }
  6097. /*:532*//*533:*/
  6098. #line 12147 "./typica.w"
  6099. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  6100. {
  6101. temperatureColumns.insert(column,series);
  6102. }
  6103. void XMLOutput::addControlColumn(const QString&series,int column)
  6104. {
  6105. controlColumns.insert(column,series);
  6106. }
  6107. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  6108. {
  6109. annotationColumns.insert(column,series);
  6110. }
  6111. /*:533*/
  6112. #line 558 "./typica.w"
  6113. /*535:*/
  6114. #line 12204 "./typica.w"
  6115. bool XMLInput::input()
  6116. {
  6117. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  6118. {
  6119. return false;
  6120. }
  6121. QXmlStreamReader xmlin(in);
  6122. QMap<QString,int> temperatureColumns;
  6123. QMap<QString,int> annotationColumns;
  6124. int nextColumn= firstc;
  6125. /*536:*/
  6126. #line 12235 "./typica.w"
  6127. while(!xmlin.isDTD())
  6128. {
  6129. xmlin.readNext();
  6130. }
  6131. if(xmlin.isDTD())
  6132. {
  6133. if(xmlin.text()=="<!DOCTYPE roastlog>")
  6134. {
  6135. /*537:*/
  6136. #line 12257 "./typica.w"
  6137. emit newTemperatureColumn(firstc,"Bean");
  6138. emit newAnnotationColumn(firstc+1,"Note");
  6139. emit lastColumn(firstc+1);
  6140. /*:537*/
  6141. #line 12244 "./typica.w"
  6142. }
  6143. else
  6144. {
  6145. xmlin.readNext();
  6146. /*538:*/
  6147. #line 12266 "./typica.w"
  6148. while(xmlin.name()!="roast")
  6149. {
  6150. if(xmlin.isStartElement())
  6151. {
  6152. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  6153. {
  6154. temperatureColumns.insert(xmlin.attributes().value("name").
  6155. toString(),
  6156. nextColumn);
  6157. emit newTemperatureColumn(nextColumn,
  6158. xmlin.attributes().value("name").
  6159. toString());
  6160. nextColumn++;
  6161. }
  6162. else if(xmlin.name()=="noteseries")
  6163. {
  6164. annotationColumns.insert(xmlin.attributes().value("name").
  6165. toString(),nextColumn);
  6166. emit newAnnotationColumn(nextColumn,
  6167. xmlin.attributes().value("name").
  6168. toString());
  6169. nextColumn++;
  6170. }
  6171. }
  6172. xmlin.readNext();
  6173. }
  6174. emit lastColumn(nextColumn-1);
  6175. /*:538*/
  6176. #line 12249 "./typica.w"
  6177. }
  6178. }
  6179. /*:536*/
  6180. #line 12215 "./typica.w"
  6181. QTime timeval= QTime();
  6182. double tempval= 0;
  6183. QString noteval= QString();
  6184. int column;
  6185. int counter= 0;
  6186. while(!xmlin.atEnd())
  6187. {
  6188. /*539:*/
  6189. #line 12307 "./typica.w"
  6190. xmlin.readNext();
  6191. if(xmlin.isStartElement())
  6192. {
  6193. /*540:*/
  6194. #line 12333 "./typica.w"
  6195. if(xmlin.name()=="time")
  6196. {
  6197. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  6198. }
  6199. else if(xmlin.name()=="temperature")
  6200. {
  6201. column= xmlin.attributes().hasAttribute("series")?
  6202. temperatureColumns.value(xmlin.attributes().value("series").toString()):firstc;
  6203. bool relative= (xmlin.attributes().value("relative")=="true");
  6204. tempval= xmlin.readElementText().toDouble();
  6205. Measurement measurement(tempval,timeval);
  6206. if(relative)
  6207. {
  6208. measurement.insert("relative",true);
  6209. }
  6210. emit measure(measurement,column);
  6211. }
  6212. else if(xmlin.name()=="control")
  6213. {
  6214. column= xmlin.attributes().value("series").toString().isEmpty()?
  6215. firstc:temperatureColumns.value(xmlin.attributes().
  6216. value("series").toString());
  6217. tempval= xmlin.readElementText().toDouble();
  6218. Measurement measurement(tempval,timeval,Units::Unitless);
  6219. emit measure(measurement,column);
  6220. }
  6221. else if(xmlin.name()=="annotation")
  6222. {
  6223. column= xmlin.attributes().value("series").toString().isEmpty()?
  6224. firstc+1:annotationColumns.value(xmlin.attributes().
  6225. value("series").toString());
  6226. noteval= xmlin.readElementText();
  6227. if(!noteval.isEmpty())
  6228. {
  6229. emit annotation(noteval,firstc,column);
  6230. }
  6231. }
  6232. /*:540*/
  6233. #line 12311 "./typica.w"
  6234. }
  6235. counter++;
  6236. if(counter%100==0)
  6237. {
  6238. QCoreApplication::processEvents();
  6239. }
  6240. /*:539*/
  6241. #line 12223 "./typica.w"
  6242. }
  6243. return true;
  6244. }
  6245. /*:535*//*541:*/
  6246. #line 12374 "./typica.w"
  6247. XMLInput::XMLInput(QIODevice*input,int c):
  6248. firstc(c),in(input)
  6249. {
  6250. }
  6251. void XMLInput::setFirstColumn(int column)
  6252. {
  6253. firstc= column;
  6254. }
  6255. void XMLInput::setDevice(QIODevice*device)
  6256. {
  6257. in= device;
  6258. }
  6259. /*:541*/
  6260. #line 559 "./typica.w"
  6261. /*546:*/
  6262. #line 12465 "./typica.w"
  6263. bool CSVOutput::output()
  6264. {
  6265. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6266. {
  6267. return false;
  6268. }
  6269. QTextStream output(out);
  6270. /*547:*/
  6271. #line 12489 "./typica.w"
  6272. output<<"Time";
  6273. foreach(int c,temperatureColumns.keys())
  6274. {
  6275. output<<','<<temperatureColumns.value(c);
  6276. }
  6277. foreach(int c,controlColumns.keys())
  6278. {
  6279. output<<','<<controlColumns.value(c);
  6280. }
  6281. foreach(int c,annotationColumns.keys())
  6282. {
  6283. output<<','<<annotationColumns.value(c);
  6284. }
  6285. output<<'\n';
  6286. /*:547*/
  6287. #line 12473 "./typica.w"
  6288. bool oresult;
  6289. for(int i= 0;i<data->rowCount();i++)
  6290. {
  6291. /*530:*/
  6292. #line 12029 "./typica.w"
  6293. oresult= false;
  6294. foreach(int c,temperatureColumns.keys())
  6295. {
  6296. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6297. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6298. {
  6299. oresult= true;
  6300. break;
  6301. }
  6302. }
  6303. foreach(int c,controlColumns.keys())
  6304. {
  6305. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6306. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6307. {
  6308. oresult= true;
  6309. break;
  6310. }
  6311. }
  6312. if(oresult==false)
  6313. {
  6314. foreach(int c,annotationColumns.keys())
  6315. {
  6316. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6317. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6318. isEmpty()))
  6319. {
  6320. oresult= true;
  6321. break;
  6322. }
  6323. }
  6324. }
  6325. /*:530*/
  6326. #line 12477 "./typica.w"
  6327. if(oresult)
  6328. {
  6329. /*548:*/
  6330. #line 12514 "./typica.w"
  6331. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6332. foreach(int c,temperatureColumns.keys())
  6333. {
  6334. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6335. }
  6336. foreach(int c,controlColumns.keys())
  6337. {
  6338. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6339. }
  6340. foreach(int c,annotationColumns.keys())
  6341. {
  6342. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6343. }
  6344. output<<'\n';
  6345. /*:548*/
  6346. #line 12480 "./typica.w"
  6347. }
  6348. }
  6349. out->close();
  6350. return true;
  6351. }
  6352. /*:546*//*549:*/
  6353. #line 12533 "./typica.w"
  6354. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6355. data(model),out(device),time(timec)
  6356. {
  6357. }
  6358. void CSVOutput::setModel(MeasurementModel*model)
  6359. {
  6360. data= model;
  6361. }
  6362. void CSVOutput::setTimeColumn(int column)
  6363. {
  6364. time= column;
  6365. }
  6366. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6367. {
  6368. temperatureColumns.insert(column,series);
  6369. }
  6370. void CSVOutput::addControlColumn(const QString&series,int column)
  6371. {
  6372. controlColumns.insert(column,series);
  6373. }
  6374. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6375. {
  6376. annotationColumns.insert(column,series);
  6377. }
  6378. void CSVOutput::setDevice(QIODevice*device)
  6379. {
  6380. out= device;
  6381. }
  6382. #line 1 "./webview.w"
  6383. /*:549*/
  6384. #line 560 "./typica.w"
  6385. /*584:*/
  6386. #line 12794 "./typica.w"
  6387. QString SaltModel::arrayLiteral(int column,int role)const
  6388. {
  6389. QString literal= "'{";
  6390. for(int i= 0;i<rowCount();i++)
  6391. {
  6392. QString datum= data(index(i,column),role).toString();
  6393. if(!datum.isEmpty())
  6394. {
  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. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6407. {
  6408. QString literal= "'{";
  6409. for(int i= 0;i<rowCount();i++)
  6410. {
  6411. QString datum= data(index(i,column),role).toString();
  6412. if(!datum.isEmpty())
  6413. {
  6414. literal.append("\"");
  6415. literal.append(datum);
  6416. literal.append("\", ");
  6417. }
  6418. }
  6419. if(literal.size()> 2)
  6420. {
  6421. literal.chop(2);
  6422. }
  6423. literal.append("}'");
  6424. return literal;
  6425. }
  6426. /*:584*//*585:*/
  6427. #line 12838 "./typica.w"
  6428. QModelIndex SaltModel::parent(const QModelIndex&)const
  6429. {
  6430. return QModelIndex();
  6431. }
  6432. /*:585*//*586:*/
  6433. #line 12857 "./typica.w"
  6434. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6435. int role)
  6436. {
  6437. /*587:*/
  6438. #line 12888 "./typica.w"
  6439. bool valid= false;
  6440. if(index.isValid())
  6441. {
  6442. if(index.row()<modelData.size())
  6443. {
  6444. if(index.column()<colcount)
  6445. {
  6446. valid= true;
  6447. }
  6448. }
  6449. }
  6450. /*:587*/
  6451. #line 12861 "./typica.w"
  6452. if(!valid)
  6453. {
  6454. return false;
  6455. }
  6456. if(index.row()==modelData.size()-1)
  6457. {
  6458. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6459. /*588:*/
  6460. #line 12904 "./typica.w"
  6461. QList<QMap<int,QVariant> > newRow;
  6462. QMap<int,QVariant> defaults;
  6463. for(int i= 0;i<colcount;i++)
  6464. {
  6465. newRow.append(defaults);
  6466. }
  6467. modelData.append(newRow);
  6468. /*:588*/
  6469. #line 12869 "./typica.w"
  6470. endInsertRows();
  6471. }
  6472. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6473. QMap<int,QVariant> cell= row.at(index.column());
  6474. cell.insert(role,value);
  6475. if(role==Qt::EditRole)
  6476. {
  6477. cell.insert(Qt::DisplayRole,value);
  6478. }
  6479. row.replace(index.column(),cell);
  6480. modelData.replace(index.row(),row);
  6481. emit dataChanged(index,index);
  6482. return true;
  6483. }
  6484. /*:586*//*589:*/
  6485. #line 12915 "./typica.w"
  6486. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  6487. {
  6488. for(int i= 0;i<columns;i++)
  6489. {
  6490. hData<<"";
  6491. }
  6492. /*588:*/
  6493. #line 12904 "./typica.w"
  6494. QList<QMap<int,QVariant> > newRow;
  6495. QMap<int,QVariant> defaults;
  6496. for(int i= 0;i<colcount;i++)
  6497. {
  6498. newRow.append(defaults);
  6499. }
  6500. modelData.append(newRow);
  6501. /*:588*/
  6502. #line 12922 "./typica.w"
  6503. }
  6504. /*:589*//*590:*/
  6505. #line 12927 "./typica.w"
  6506. SaltModel::~SaltModel()
  6507. {
  6508. }
  6509. /*:590*//*591:*/
  6510. #line 12937 "./typica.w"
  6511. int SaltModel::rowCount(const QModelIndex&parent)const
  6512. {
  6513. return(parent==QModelIndex()?modelData.size():0);
  6514. }
  6515. int SaltModel::columnCount(const QModelIndex&parent)const
  6516. {
  6517. return(parent==QModelIndex()?colcount:0);
  6518. }
  6519. /*:591*//*592:*/
  6520. #line 12950 "./typica.w"
  6521. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  6522. const QVariant&value,int)
  6523. {
  6524. if(orientation==Qt::Horizontal&&section<colcount)
  6525. {
  6526. hData.replace(section,value.toString());
  6527. emit headerDataChanged(orientation,section,section);
  6528. return true;
  6529. }
  6530. return false;
  6531. }
  6532. /*:592*//*593:*/
  6533. #line 12965 "./typica.w"
  6534. QVariant SaltModel::data(const QModelIndex&index,int role)const
  6535. {
  6536. /*587:*/
  6537. #line 12888 "./typica.w"
  6538. bool valid= false;
  6539. if(index.isValid())
  6540. {
  6541. if(index.row()<modelData.size())
  6542. {
  6543. if(index.column()<colcount)
  6544. {
  6545. valid= true;
  6546. }
  6547. }
  6548. }
  6549. /*:587*/
  6550. #line 12968 "./typica.w"
  6551. if(!valid)
  6552. {
  6553. return QVariant();
  6554. }
  6555. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6556. QMap<int,QVariant> cell= row.at(index.column());
  6557. return cell.value(role,QVariant());
  6558. }
  6559. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  6560. int role)const
  6561. {
  6562. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  6563. section<colcount)
  6564. {
  6565. return QVariant(hData.at(section));
  6566. }
  6567. return QVariant();
  6568. }
  6569. /*:593*//*594:*/
  6570. #line 12992 "./typica.w"
  6571. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  6572. {
  6573. /*587:*/
  6574. #line 12888 "./typica.w"
  6575. bool valid= false;
  6576. if(index.isValid())
  6577. {
  6578. if(index.row()<modelData.size())
  6579. {
  6580. if(index.column()<colcount)
  6581. {
  6582. valid= true;
  6583. }
  6584. }
  6585. }
  6586. /*:587*/
  6587. #line 12995 "./typica.w"
  6588. if(valid)
  6589. {
  6590. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  6591. }
  6592. return 0;
  6593. }
  6594. /*:594*//*595:*/
  6595. #line 13006 "./typica.w"
  6596. QModelIndex SaltModel::index(int row,int column,
  6597. const QModelIndex&parent)const
  6598. {
  6599. if(parent==QModelIndex())
  6600. {
  6601. if(row<modelData.size()&&column<colcount)
  6602. {
  6603. return createIndex(row,column);
  6604. }
  6605. }
  6606. return QModelIndex();
  6607. }
  6608. /*:595*//*596:*/
  6609. #line 13024 "./typica.w"
  6610. void SaltModel::clear()
  6611. {
  6612. beginResetModel();
  6613. modelData.clear();
  6614. /*588:*/
  6615. #line 12904 "./typica.w"
  6616. QList<QMap<int,QVariant> > newRow;
  6617. QMap<int,QVariant> defaults;
  6618. for(int i= 0;i<colcount;i++)
  6619. {
  6620. newRow.append(defaults);
  6621. }
  6622. modelData.append(newRow);
  6623. /*:588*/
  6624. #line 13029 "./typica.w"
  6625. endResetModel();
  6626. }
  6627. /*:596*//*597:*/
  6628. #line 13038 "./typica.w"
  6629. bool SaltModel::removeRows(int row,int count,
  6630. const QModelIndex&parent)
  6631. {
  6632. if(parent==QModelIndex())
  6633. {
  6634. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  6635. {
  6636. beginRemoveRows(parent,row,row+count-1);
  6637. for(int i= 0;i<count;i++)
  6638. {
  6639. modelData.removeAt(row);
  6640. }
  6641. endRemoveRows();
  6642. if(modelData.size()==0)
  6643. {
  6644. beginInsertRows(parent,0,0);
  6645. /*588:*/
  6646. #line 12904 "./typica.w"
  6647. QList<QMap<int,QVariant> > newRow;
  6648. QMap<int,QVariant> defaults;
  6649. for(int i= 0;i<colcount;i++)
  6650. {
  6651. newRow.append(defaults);
  6652. }
  6653. modelData.append(newRow);
  6654. /*:588*/
  6655. #line 13055 "./typica.w"
  6656. endInsertRows();
  6657. }
  6658. return true;
  6659. }
  6660. }
  6661. return false;
  6662. }
  6663. /*:597*//*598:*/
  6664. #line 13069 "./typica.w"
  6665. int SaltModel::findData(const QVariant&value,int column,int role)
  6666. {
  6667. for(int i= 0;i<modelData.size();i++)
  6668. {
  6669. if(modelData.at(i).size()> column)
  6670. {
  6671. if(modelData.at(i).at(column).contains(role))
  6672. {
  6673. if(modelData.at(i).at(column).value(role)==value)
  6674. {
  6675. return i;
  6676. }
  6677. }
  6678. }
  6679. }
  6680. return-1;
  6681. }
  6682. /*:598*/
  6683. #line 561 "./typica.w"
  6684. /*600:*/
  6685. #line 13133 "./typica.w"
  6686. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  6687. {
  6688. SqlComboBox*widget= new SqlComboBox();
  6689. widget->setParent(parent);
  6690. for(int i= 0;i<count();i++)
  6691. {
  6692. widget->addItem(itemText(i),itemData(i));
  6693. }
  6694. return widget;
  6695. }
  6696. /*:600*//*601:*/
  6697. #line 13150 "./typica.w"
  6698. void SqlComboBox::showData(bool show)
  6699. {
  6700. dataColumnShown= show;
  6701. }
  6702. /*:601*//*602:*/
  6703. #line 13164 "./typica.w"
  6704. void SqlComboBox::addNullOption()
  6705. {
  6706. addItem(specialNullText,specialNullData);
  6707. }
  6708. void SqlComboBox::setNullText(QString nullText)
  6709. {
  6710. specialNullText= nullText;
  6711. }
  6712. void SqlComboBox::setNullData(QVariant nullData)
  6713. {
  6714. specialNullData= nullData;
  6715. }
  6716. /*:602*//*603:*/
  6717. #line 13187 "./typica.w"
  6718. void SqlComboBox::setDataColumn(int column)
  6719. {
  6720. dataColumn= column;
  6721. }
  6722. void SqlComboBox::setDisplayColumn(int column)
  6723. {
  6724. displayColumn= column;
  6725. }
  6726. /*:603*//*604:*/
  6727. #line 13201 "./typica.w"
  6728. void SqlComboBox::addSqlOptions(QString query)
  6729. {
  6730. SqlQueryConnection h;
  6731. QSqlQuery*dbquery= h.operator->();
  6732. if(!dbquery->exec(query))
  6733. {
  6734. QSqlError error= dbquery->lastError();
  6735. qDebug()<<error.databaseText();
  6736. qDebug()<<error.driverText();
  6737. qDebug()<<error.text();
  6738. qDebug()<<dbquery->lastQuery();
  6739. }
  6740. while(dbquery->next())
  6741. {
  6742. QString displayValue(dbquery->value(displayColumn).toString());
  6743. QString dataValue(dbquery->value(dataColumn).toString());
  6744. if(dataColumnShown)
  6745. {
  6746. displayValue.append(QString(" (%1)").arg(dataValue));
  6747. }
  6748. addItem(displayValue,dataValue);
  6749. }
  6750. }
  6751. /*:604*//*605:*/
  6752. #line 13237 "./typica.w"
  6753. SqlComboBox::SqlComboBox():
  6754. dataColumn(0),displayColumn(0),dataColumnShown(false),
  6755. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  6756. {
  6757. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  6758. }
  6759. SqlComboBox::~SqlComboBox()
  6760. {
  6761. }
  6762. /*:605*/
  6763. #line 562 "./typica.w"
  6764. /*607:*/
  6765. #line 13276 "./typica.w"
  6766. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  6767. {
  6768. delegate= widget;
  6769. }
  6770. /*:607*//*608:*/
  6771. #line 13285 "./typica.w"
  6772. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  6773. const QStyleOptionViewItem&,
  6774. const QModelIndex&)const
  6775. {
  6776. return delegate->clone(parent);
  6777. }
  6778. /*:608*//*609:*/
  6779. #line 13296 "./typica.w"
  6780. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  6781. const QModelIndex&index)const
  6782. {
  6783. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6784. self->setCurrentIndex(self->findData(
  6785. index.model()->data(index,
  6786. Qt::UserRole).toString()));
  6787. }
  6788. /*:609*//*610:*/
  6789. #line 13309 "./typica.w"
  6790. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  6791. QAbstractItemModel*model,
  6792. const QModelIndex&index)const
  6793. {
  6794. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6795. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  6796. Qt::UserRole);
  6797. model->setData(index,self->currentText(),Qt::DisplayRole);
  6798. }
  6799. /*:610*//*611:*/
  6800. #line 13322 "./typica.w"
  6801. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  6802. const QStyleOptionViewItem&option,
  6803. const QModelIndex&)const
  6804. {
  6805. editor->setGeometry(option.rect);
  6806. }
  6807. /*:611*//*612:*/
  6808. #line 13333 "./typica.w"
  6809. QSize SqlComboBoxDelegate::sizeHint()const
  6810. {
  6811. return delegate->sizeHint();
  6812. }
  6813. /*:612*//*613:*/
  6814. #line 13341 "./typica.w"
  6815. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  6816. :QItemDelegate(parent)
  6817. {
  6818. }
  6819. /*:613*/
  6820. #line 563 "./typica.w"
  6821. /*576:*/
  6822. #line 12603 "./typica.w"
  6823. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  6824. {
  6825. /*577:*/
  6826. #line 12618 "./typica.w"
  6827. setOrganizationName("Wilson's Coffee & Tea");
  6828. setOrganizationDomain("wilsonscoffee.com");
  6829. setApplicationName(PROGRAM_NAME);
  6830. /*:577*/
  6831. #line 12606 "./typica.w"
  6832. /*578:*/
  6833. #line 12627 "./typica.w"
  6834. QTranslator*base= new QTranslator;
  6835. if(base->load(QString("qt_%1").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
  6836. {
  6837. installTranslator(base);
  6838. }
  6839. QTranslator*app= new QTranslator;
  6840. if(app->load(QString("%1_%2").arg("Typica").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
  6841. {
  6842. installTranslator(app);
  6843. }
  6844. /*:578*/
  6845. #line 12607 "./typica.w"
  6846. /*295:*/
  6847. #line 123 "./measurement.w"
  6848. qRegisterMetaType<Measurement> ("Measurement");
  6849. /*:295*/
  6850. #line 12608 "./typica.w"
  6851. /*784:*/
  6852. #line 16622 "./typica.w"
  6853. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  6854. tr("NI DAQmx Base"),
  6855. "nidaqmxbase",NULL);
  6856. topLevelNodeInserters.append(inserter);
  6857. /*:784*//*792:*/
  6858. #line 16853 "./typica.w"
  6859. #ifdef Q_OS_WIN32
  6860. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  6861. topLevelNodeInserters.append(inserter);
  6862. #endif
  6863. /*:792*//*816:*/
  6864. #line 17816 "./typica.w"
  6865. #if 0
  6866. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  6867. topLevelNodeInserters.append(inserter);
  6868. #endif
  6869. /*:816*//*865:*/
  6870. #line 19329 "./typica.w"
  6871. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  6872. topLevelNodeInserters.append(inserter);
  6873. #line 1 "./unsupportedserial.w"
  6874. /*:865*//*875:*/
  6875. #line 272 "./unsupportedserial.w"
  6876. inserter= new NodeInserter(tr("Other Device"),tr("Other Device"),
  6877. "unsupporteddevice",NULL);
  6878. topLevelNodeInserters.append(inserter);
  6879. /*:875*//*909:*/
  6880. #line 190 "./phidgets.w"
  6881. QLibrary phidgetsCheck("phidget21");
  6882. if(phidgetsCheck.load())
  6883. {
  6884. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  6885. "phidgets1048",NULL);
  6886. topLevelNodeInserters.append(inserter);
  6887. phidgetsCheck.unload();
  6888. }
  6889. else
  6890. {
  6891. phidgetsCheck.setFileName("Phidget21.framework/Phidget21");
  6892. if(phidgetsCheck.load())
  6893. {
  6894. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  6895. "phidgets1048",NULL);
  6896. topLevelNodeInserters.append(inserter);
  6897. phidgetsCheck.unload();
  6898. }
  6899. }
  6900. /*:909*//*1000:*/
  6901. #line 1241 "./dataqsdk.w"
  6902. #ifdef Q_OS_WIN32
  6903. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  6904. "dataqsdk",NULL);
  6905. topLevelNodeInserters.append(inserter);
  6906. #endif
  6907. #line 19979 "./typica.w"
  6908. #line 1 "./scales.w"
  6909. /*:1000*//*1025:*/
  6910. #line 495 "./scales.w"
  6911. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  6912. topLevelNodeInserters.append(inserter);
  6913. #line 19981 "./typica.w"
  6914. #line 1 "./valueannotation.w"
  6915. /*:1025*/
  6916. #line 12609 "./typica.w"
  6917. }
  6918. /*:576*//*580:*/
  6919. #line 12650 "./typica.w"
  6920. QDomDocument*Application::configuration()
  6921. {
  6922. return&conf;
  6923. }
  6924. /*:580*//*581:*/
  6925. #line 12659 "./typica.w"
  6926. QSqlDatabase Application::database()
  6927. {
  6928. QString connectionName;
  6929. QSqlDatabase connection=
  6930. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  6931. do
  6932. {
  6933. connectionName= QUuid::createUuid().toString();
  6934. }while(QSqlDatabase::connectionNames().contains(connectionName));
  6935. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  6936. }
  6937. /*:581*//*719:*/
  6938. #line 15155 "./typica.w"
  6939. void Application::saveDeviceConfiguration()
  6940. {
  6941. QSettings settings;
  6942. settings.setValue("DeviceConfiguration",
  6943. QVariant(deviceConfigurationDocument.toByteArray()));
  6944. }
  6945. /*:719*//*720:*/
  6946. #line 15167 "./typica.w"
  6947. QDomDocument Application::deviceConfiguration()
  6948. {
  6949. if(deviceConfigurationDocument.isNull())
  6950. {
  6951. /*721:*/
  6952. #line 15181 "./typica.w"
  6953. QSettings settings;
  6954. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  6955. QString etext;
  6956. int eline;
  6957. int ecol;
  6958. if(document.length()==0)
  6959. {
  6960. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  6961. /*722:*/
  6962. #line 15205 "./typica.w"
  6963. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6964. emptyDocument.open(QIODevice::ReadOnly);
  6965. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6966. &etext,&eline,&ecol))
  6967. {
  6968. /*723:*/
  6969. #line 15222 "./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. /*:723*/
  6974. #line 15211 "./typica.w"
  6975. }
  6976. else
  6977. {
  6978. saveDeviceConfiguration();
  6979. }
  6980. /*:722*/
  6981. #line 15190 "./typica.w"
  6982. }
  6983. else
  6984. {
  6985. if(!deviceConfigurationDocument.setContent(document,false,
  6986. &etext,&eline,&ecol))
  6987. {
  6988. /*723:*/
  6989. #line 15222 "./typica.w"
  6990. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6991. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6992. qDebug()<<etext;
  6993. /*:723*/
  6994. #line 15197 "./typica.w"
  6995. /*722:*/
  6996. #line 15205 "./typica.w"
  6997. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6998. emptyDocument.open(QIODevice::ReadOnly);
  6999. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  7000. &etext,&eline,&ecol))
  7001. {
  7002. /*723:*/
  7003. #line 15222 "./typica.w"
  7004. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7005. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7006. qDebug()<<etext;
  7007. /*:723*/
  7008. #line 15211 "./typica.w"
  7009. }
  7010. else
  7011. {
  7012. saveDeviceConfiguration();
  7013. }
  7014. /*:722*/
  7015. #line 15198 "./typica.w"
  7016. }
  7017. }
  7018. /*:721*/
  7019. #line 15172 "./typica.w"
  7020. }
  7021. return deviceConfigurationDocument;
  7022. }
  7023. /*:720*//*751:*/
  7024. #line 15823 "./typica.w"
  7025. void Application::registerDeviceConfigurationWidget(QString driver,
  7026. QMetaObject widget)
  7027. {
  7028. deviceConfigurationWidgets.insert(driver,widget);
  7029. }
  7030. /*:751*//*752:*/
  7031. #line 15839 "./typica.w"
  7032. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  7033. const QModelIndex&index)
  7034. {
  7035. QVariant nodeReference= index.data(Qt::UserRole);
  7036. QDomElement referenceElement= model->referenceElement(
  7037. model->data(index,Qt::UserRole).toString());
  7038. QMetaObject metaObject=
  7039. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  7040. QWidget::staticMetaObject);
  7041. QWidget*editor;
  7042. if(metaObject.className()==QWidget::staticMetaObject.className())
  7043. {
  7044. editor= NULL;
  7045. }
  7046. else
  7047. {
  7048. editor= qobject_cast<QWidget*> (
  7049. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  7050. Q_ARG(QModelIndex,index)));
  7051. }
  7052. return editor;
  7053. }
  7054. /*:752*/
  7055. #line 564 "./typica.w"
  7056. /*622:*/
  7057. #line 13489 "./typica.w"
  7058. SqlConnectionSetup::SqlConnectionSetup():
  7059. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  7060. portnumber(new QLineEdit),
  7061. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  7062. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  7063. cancelButton(new QPushButton(tr("Cancel"))),
  7064. connectButton(new QPushButton(tr("Connect")))
  7065. {
  7066. driver->addItem("PostgreSQL","QPSQL");
  7067. formLayout->addRow(tr("Database driver:"),driver);
  7068. formLayout->addRow(tr("Host name:"),hostname);
  7069. formLayout->addRow(tr("Port number:"),portnumber);
  7070. portnumber->setText("5432");
  7071. formLayout->addRow(tr("Database name:"),dbname);
  7072. formLayout->addRow(tr("User name:"),user);
  7073. password->setEchoMode(QLineEdit::Password);
  7074. formLayout->addRow(tr("Password:"),password);
  7075. layout->addLayout(formLayout);
  7076. buttons->addStretch(1);
  7077. buttons->addWidget(cancelButton);
  7078. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  7079. buttons->addWidget(connectButton);
  7080. layout->addLayout(buttons);
  7081. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  7082. connectButton->setDefault(true);
  7083. setLayout(layout);
  7084. setModal(true);
  7085. }
  7086. SqlConnectionSetup::~SqlConnectionSetup()
  7087. {
  7088. }
  7089. /*:622*//*623:*/
  7090. #line 13527 "./typica.w"
  7091. void SqlConnectionSetup::testConnection()
  7092. {
  7093. QSqlDatabase database=
  7094. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  7095. toString());
  7096. database.setConnectOptions("application_name=Typica");
  7097. database.setHostName(hostname->text());
  7098. database.setPort(portnumber->text().toInt());
  7099. database.setDatabaseName(dbname->text());
  7100. database.setUserName(user->text());
  7101. database.setPassword(password->text());
  7102. if(database.open())
  7103. {
  7104. QSettings settings;
  7105. settings.setValue("database/exists","true");
  7106. settings.setValue("database/driver",
  7107. driver->itemData(driver->currentIndex()).toString());
  7108. settings.setValue("database/hostname",hostname->text());
  7109. settings.setValue("database/portnumber",portnumber->text());
  7110. settings.setValue("database/dbname",dbname->text());
  7111. settings.setValue("database/user",user->text());
  7112. settings.setValue("database/password",password->text());
  7113. database.close();
  7114. accept();
  7115. }
  7116. else
  7117. {
  7118. QMessageBox::information(this,tr("Database connection failed"),
  7119. tr("Failed to connect to database."));
  7120. }
  7121. }
  7122. /*:623*/
  7123. #line 565 "./typica.w"
  7124. /*627:*/
  7125. #line 13632 "./typica.w"
  7126. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  7127. {
  7128. setModel(new QSqlQueryModel);
  7129. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  7130. this,SLOT(openRow(QModelIndex)));
  7131. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  7132. this,SLOT(persistColumnResize(int,int,int)));
  7133. }
  7134. /*:627*//*628:*/
  7135. #line 13647 "./typica.w"
  7136. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  7137. {
  7138. /*629:*/
  7139. #line 13656 "./typica.w"
  7140. QSettings settings;
  7141. /*630:*/
  7142. #line 13669 "./typica.w"
  7143. QWidget*topLevelWidget= this;
  7144. while(topLevelWidget->parentWidget())
  7145. {
  7146. topLevelWidget= topLevelWidget->parentWidget();
  7147. }
  7148. /*:630*/
  7149. #line 13658 "./typica.w"
  7150. settings.setValue(QString("columnWidths/%1/%2/%3").
  7151. arg(topLevelWidget->objectName()).
  7152. arg(objectName()).arg(column),
  7153. QVariant(newsize));
  7154. /*:629*/
  7155. #line 13650 "./typica.w"
  7156. }
  7157. /*:628*//*631:*/
  7158. #line 13679 "./typica.w"
  7159. void SqlQueryView::showEvent(QShowEvent*event)
  7160. {
  7161. /*632:*/
  7162. #line 13689 "./typica.w"
  7163. QSettings settings;
  7164. /*630:*/
  7165. #line 13669 "./typica.w"
  7166. QWidget*topLevelWidget= this;
  7167. while(topLevelWidget->parentWidget())
  7168. {
  7169. topLevelWidget= topLevelWidget->parentWidget();
  7170. }
  7171. /*:630*/
  7172. #line 13691 "./typica.w"
  7173. QString baseKey=
  7174. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  7175. arg(objectName());
  7176. for(int i= 0;i<model()->columnCount();i++)
  7177. {
  7178. QString key= QString("%1/%2").arg(baseKey).arg(i);
  7179. if(settings.contains(key))
  7180. {
  7181. setColumnWidth(i,settings.value(key).toInt());
  7182. }
  7183. }
  7184. /*:632*/
  7185. #line 13682 "./typica.w"
  7186. event->accept();
  7187. }
  7188. /*:631*//*633:*/
  7189. #line 13706 "./typica.w"
  7190. void SqlQueryView::openRow(const QModelIndex&index)
  7191. {
  7192. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  7193. emit openEntryRow(index.row());
  7194. }
  7195. /*:633*//*634:*/
  7196. #line 13715 "./typica.w"
  7197. void SqlQueryView::setQuery(const QString&query)
  7198. {
  7199. QSqlDatabase database= AppInstance->database();
  7200. database.open();
  7201. QSqlQuery q(query,database);
  7202. ((QSqlQueryModel*)model())->setQuery(q);
  7203. database.close();
  7204. }
  7205. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  7206. const QVariant&value,int role)
  7207. {
  7208. return model()->setHeaderData(section,orientation,value,role);
  7209. }
  7210. /*:634*//*635:*/
  7211. #line 13733 "./typica.w"
  7212. QVariant SqlQueryView::data(int row,int column,int role)
  7213. {
  7214. return model()->data(model()->index(row,column),role);
  7215. }
  7216. /*:635*/
  7217. #line 566 "./typica.w"
  7218. /*170:*/
  7219. #line 3936 "./typica.w"
  7220. SqlQueryConnection::SqlQueryConnection(const QString&query)
  7221. {
  7222. QSqlDatabase database= AppInstance->database();
  7223. database.open();
  7224. q= new QSqlQuery(query,database);
  7225. connection= database.connectionName();
  7226. }
  7227. /*:170*//*171:*/
  7228. #line 3949 "./typica.w"
  7229. SqlQueryConnection::~SqlQueryConnection()
  7230. {
  7231. delete q;
  7232. {
  7233. QSqlDatabase database= QSqlDatabase::database(connection);
  7234. database.close();
  7235. }
  7236. QSqlDatabase::removeDatabase(connection);
  7237. }
  7238. /*:171*//*172:*/
  7239. #line 3963 "./typica.w"
  7240. QSqlQuery*SqlQueryConnection::operator->()const
  7241. {
  7242. return q;
  7243. }
  7244. /*:172*/
  7245. #line 567 "./typica.w"
  7246. /*654:*/
  7247. #line 14092 "./typica.w"
  7248. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  7249. area(frame),configuration(description)
  7250. {
  7251. refresh();
  7252. }
  7253. ReportTable::~ReportTable()
  7254. {
  7255. }
  7256. /*:654*//*655:*/
  7257. #line 14108 "./typica.w"
  7258. void ReportTable::bind(QString placeholder,QVariant value)
  7259. {
  7260. bindings.insert(placeholder,value);
  7261. }
  7262. /*:655*//*656:*/
  7263. #line 14118 "./typica.w"
  7264. void ReportTable::refresh()
  7265. {
  7266. /*657:*/
  7267. #line 14139 "./typica.w"
  7268. QTextCursor cursor= area->firstCursorPosition();
  7269. while(cursor<area->lastCursorPosition())
  7270. {
  7271. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  7272. }
  7273. cursor.removeSelectedText();
  7274. /*:657*/
  7275. #line 14121 "./typica.w"
  7276. int rows= 1;
  7277. int columns= 1;
  7278. int currentRow= 0;
  7279. QTextTable*table= cursor.insertTable(rows,columns);
  7280. /*658:*/
  7281. #line 14152 "./typica.w"
  7282. QTextTableFormat format= table->format();
  7283. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  7284. if(configuration.hasAttribute("align"))
  7285. {
  7286. if(configuration.attribute("align")=="center")
  7287. {
  7288. format.setAlignment(Qt::AlignHCenter);
  7289. }
  7290. }
  7291. table->setFormat(format);
  7292. /*:658*/
  7293. #line 14126 "./typica.w"
  7294. /*659:*/
  7295. #line 14166 "./typica.w"
  7296. QDomNodeList children= configuration.childNodes();
  7297. for(int i= 0;i<children.count();i++)
  7298. {
  7299. QDomNode current;
  7300. QDomElement currentElement;
  7301. current= children.at(i);
  7302. if(current.isElement())
  7303. {
  7304. currentElement= current.toElement();
  7305. if(currentElement.tagName()=="query")
  7306. {
  7307. /*660:*/
  7308. #line 14193 "./typica.w"
  7309. SqlQueryConnection h;
  7310. QSqlQuery*query= h.operator->();
  7311. query->prepare(currentElement.text());
  7312. foreach(QString key,bindings.uniqueKeys())
  7313. {
  7314. if(currentElement.text().contains(key))
  7315. {
  7316. query->bindValue(key,bindings.value(key));
  7317. }
  7318. }
  7319. query->exec();
  7320. if(!query->next())
  7321. {
  7322. continue;
  7323. }
  7324. if(query->record().count()> columns)
  7325. {
  7326. table->appendColumns(query->record().count()-columns);
  7327. }
  7328. do
  7329. {
  7330. table->appendRows(1);
  7331. rows++;
  7332. currentRow++;
  7333. for(int j= 0;j<query->record().count();j++)
  7334. {
  7335. QTextTableCell cell= table->cellAt(currentRow,j);
  7336. cursor= cell.firstCursorPosition();
  7337. cursor.insertText(query->value(j).toString());
  7338. }
  7339. }while(query->next());
  7340. /*:660*/
  7341. #line 14178 "./typica.w"
  7342. }
  7343. else if(currentElement.tagName()=="row")
  7344. {
  7345. /*661:*/
  7346. #line 14233 "./typica.w"
  7347. table->appendRows(1);
  7348. currentRow++;
  7349. rows++;
  7350. QDomNodeList rowChildren= currentElement.childNodes();
  7351. int currentColumn= 0;
  7352. for(int j= 0;j<rowChildren.count();j++)
  7353. {
  7354. QDomNode node;
  7355. QDomElement nodeElement;
  7356. node= rowChildren.at(j);
  7357. if(node.isElement())
  7358. {
  7359. nodeElement= node.toElement();
  7360. if(nodeElement.tagName()=="cell")
  7361. {
  7362. if(currentColumn==columns)
  7363. {
  7364. table->appendColumns(1);
  7365. columns++;
  7366. }
  7367. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7368. cursor= cell.firstCursorPosition();
  7369. cursor.insertText(nodeElement.text());
  7370. currentColumn++;
  7371. }
  7372. }
  7373. }
  7374. /*:661*/
  7375. #line 14182 "./typica.w"
  7376. }
  7377. }
  7378. }
  7379. /*:659*/
  7380. #line 14127 "./typica.w"
  7381. if(rows> 1)
  7382. {
  7383. table->removeRows(0,1);
  7384. }
  7385. }
  7386. /*:656*/
  7387. #line 568 "./typica.w"
  7388. /*687:*/
  7389. #line 14337 "./typica.w"
  7390. FormArray::FormArray(QDomElement description):configuration(description),
  7391. maxwidth(-1),maxheight(-1)
  7392. {
  7393. setWidget(&itemContainer);
  7394. itemContainer.setLayout(&itemLayout);
  7395. }
  7396. /*:687*//*688:*/
  7397. #line 14354 "./typica.w"
  7398. void FormArray::addElements(int copies)
  7399. {
  7400. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  7401. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  7402. QWidget*widget;
  7403. for(int i= 0;i<copies;i++)
  7404. {
  7405. widget= new QWidget;
  7406. if(maxwidth> -1)
  7407. {
  7408. widget->setMaximumWidth(maxwidth);
  7409. }
  7410. if(maxheight> -1)
  7411. {
  7412. widget->setMaximumHeight(maxheight);
  7413. }
  7414. if(configuration.hasChildNodes())
  7415. {
  7416. widgetStack->push(widget);
  7417. populateWidget(configuration,widgetStack,layoutStack);
  7418. widgetStack->pop();
  7419. widget->setMinimumHeight(widget->sizeHint().height());
  7420. itemLayout.addWidget(widget);
  7421. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  7422. {
  7423. itemContainer.setMinimumHeight(maxheight*elements()+50);
  7424. }
  7425. else
  7426. {
  7427. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  7428. +widget->sizeHint().height());
  7429. }
  7430. if(maxwidth> -1)
  7431. {
  7432. itemContainer.setMinimumWidth(maxwidth+50);
  7433. }
  7434. else
  7435. {
  7436. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  7437. }
  7438. }
  7439. }
  7440. }
  7441. /*:688*//*689:*/
  7442. #line 14404 "./typica.w"
  7443. QWidget*FormArray::elementAt(int index)
  7444. {
  7445. if(index<itemLayout.count())
  7446. {
  7447. QLayoutItem*item= itemLayout.itemAt(index);
  7448. return item->widget();
  7449. }
  7450. else
  7451. {
  7452. return NULL;
  7453. }
  7454. }
  7455. /*:689*//*690:*/
  7456. #line 14421 "./typica.w"
  7457. void FormArray::removeAllElements()
  7458. {
  7459. while(itemLayout.count()> 0)
  7460. {
  7461. QLayoutItem*item;
  7462. item= itemLayout.itemAt(0);
  7463. item->widget()->hide();
  7464. itemLayout.removeWidget(item->widget());
  7465. }
  7466. itemContainer.setMinimumHeight(0);
  7467. }
  7468. /*:690*//*691:*/
  7469. #line 14437 "./typica.w"
  7470. int FormArray::elements()
  7471. {
  7472. return itemLayout.count();
  7473. }
  7474. /*:691*//*692:*/
  7475. #line 14448 "./typica.w"
  7476. void FormArray::setMaximumElementWidth(int width)
  7477. {
  7478. maxwidth= width;
  7479. }
  7480. void FormArray::setMaximumElementHeight(int height)
  7481. {
  7482. maxheight= height;
  7483. }
  7484. /*:692*/
  7485. #line 569 "./typica.w"
  7486. /*698:*/
  7487. #line 14579 "./typica.w"
  7488. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  7489. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  7490. {
  7491. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  7492. QPointF(0,5);
  7493. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  7494. QPointF(10,5);
  7495. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  7496. QPointF(0,0);
  7497. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  7498. initialBrush.setColor(QColor(170,170,255));
  7499. initialBrush.setStyle(Qt::SolidPattern);
  7500. finalBrush.setColor(Qt::blue);
  7501. finalBrush.setStyle(Qt::SolidPattern);
  7502. initialDecrement.setPolygon(left);
  7503. initialDecrement.setBrush(initialBrush);
  7504. initialDecrement.setPos(0,0);
  7505. scene.addItem(&initialDecrement);
  7506. initialIncrement.setPolygon(right);
  7507. initialIncrement.setBrush(initialBrush);
  7508. initialIncrement.setPos(122,0);
  7509. scene.addItem(&initialIncrement);
  7510. finalDecrement.setPolygon(left);
  7511. finalDecrement.setBrush(finalBrush);
  7512. finalDecrement.setPos(0,12);
  7513. scene.addItem(&finalDecrement);
  7514. finalIncrement.setPolygon(right);
  7515. finalIncrement.setBrush(finalBrush);
  7516. finalIncrement.setPos(122,12);
  7517. scene.addItem(&finalIncrement);
  7518. scalePath.moveTo(0,10);
  7519. scalePath.lineTo(100,10);
  7520. scalePath.moveTo(0,0);
  7521. scalePath.lineTo(0,20);
  7522. scalePath.moveTo(10,5);
  7523. scalePath.lineTo(10,15);
  7524. scalePath.moveTo(20,5);
  7525. scalePath.lineTo(20,15);
  7526. scalePath.moveTo(30,5);
  7527. scalePath.lineTo(30,15);
  7528. scalePath.moveTo(40,5);
  7529. scalePath.lineTo(40,15);
  7530. scalePath.moveTo(50,0);
  7531. scalePath.lineTo(50,20);
  7532. scalePath.moveTo(60,5);
  7533. scalePath.lineTo(60,15);
  7534. scalePath.moveTo(70,5);
  7535. scalePath.lineTo(70,15);
  7536. scalePath.moveTo(80,5);
  7537. scalePath.lineTo(80,15);
  7538. scalePath.moveTo(90,5);
  7539. scalePath.lineTo(90,15);
  7540. scalePath.moveTo(100,0);
  7541. scalePath.lineTo(100,20);
  7542. scaleLine.setPath(scalePath);
  7543. scaleLine.setPos(16,1);
  7544. scene.addItem(&scaleLine);
  7545. setScene(&scene);
  7546. initialIndicator.setPolygon(down);
  7547. initialIndicator.setBrush(initialBrush);
  7548. finalIndicator.setPolygon(up);
  7549. finalIndicator.setBrush(finalBrush);
  7550. setMinimumSize(sizeHint());
  7551. setMaximumSize(sizeHint());
  7552. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7553. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7554. setMinimumSize(sizeHint());
  7555. }
  7556. /*:698*//*699:*/
  7557. #line 14652 "./typica.w"
  7558. QSize ScaleControl::sizeHint()const
  7559. {
  7560. return QSize(140,30);
  7561. }
  7562. /*:699*//*700:*/
  7563. #line 14661 "./typica.w"
  7564. void ScaleControl::setInitialValue(double value)
  7565. {
  7566. if(value>=0&&value<=10)
  7567. {
  7568. nonScoredValue= value;
  7569. if(!initialSet)
  7570. {
  7571. scene.addItem(&initialIndicator);
  7572. }
  7573. initialSet= true;
  7574. initialIndicator.setPos(value*10+16,10);
  7575. emit initialChanged(value);
  7576. if(!finalSet)
  7577. {
  7578. setFinalValue(value);
  7579. }
  7580. }
  7581. }
  7582. void ScaleControl::setFinalValue(double value)
  7583. {
  7584. if(value>=0&&value<=10)
  7585. {
  7586. scoredValue= value;
  7587. if(!finalSet)
  7588. {
  7589. scene.addItem(&finalIndicator);
  7590. }
  7591. finalSet= true;
  7592. finalIndicator.setPos(value*10+16,11);
  7593. emit finalChanged(value);
  7594. }
  7595. }
  7596. /*:700*//*701:*/
  7597. #line 14698 "./typica.w"
  7598. double ScaleControl::initialValue(void)
  7599. {
  7600. return nonScoredValue;
  7601. }
  7602. double ScaleControl::finalValue(void)
  7603. {
  7604. return scoredValue;
  7605. }
  7606. /*:701*//*702:*/
  7607. #line 14719 "./typica.w"
  7608. void ScaleControl::mousePressEvent(QMouseEvent*event)
  7609. {
  7610. /*703:*/
  7611. #line 14731 "./typica.w"
  7612. if(event->button()!=Qt::LeftButton)
  7613. {
  7614. event->ignore();
  7615. return;
  7616. }
  7617. /*:703*/
  7618. #line 14722 "./typica.w"
  7619. scaleDown= true;
  7620. event->accept();
  7621. }
  7622. /*:702*//*704:*/
  7623. #line 14742 "./typica.w"
  7624. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  7625. {
  7626. /*703:*/
  7627. #line 14731 "./typica.w"
  7628. if(event->button()!=Qt::LeftButton)
  7629. {
  7630. event->ignore();
  7631. return;
  7632. }
  7633. /*:703*/
  7634. #line 14745 "./typica.w"
  7635. if(!scaleDown)
  7636. {
  7637. event->ignore();
  7638. return;
  7639. }
  7640. scaleDown= false;
  7641. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7642. /*705:*/
  7643. #line 14767 "./typica.w"
  7644. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  7645. {
  7646. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7647. {
  7648. if(initialSet)
  7649. {
  7650. setInitialValue(nonScoredValue-0.05);
  7651. }
  7652. event->accept();
  7653. return;
  7654. }
  7655. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7656. {
  7657. if(finalSet)
  7658. {
  7659. setFinalValue(scoredValue-0.05);
  7660. event->accept();
  7661. return;
  7662. }
  7663. }
  7664. }
  7665. /*:705*/
  7666. #line 14753 "./typica.w"
  7667. /*706:*/
  7668. #line 14793 "./typica.w"
  7669. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  7670. {
  7671. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7672. {
  7673. if(initialSet)
  7674. {
  7675. setInitialValue(nonScoredValue+0.05);
  7676. event->accept();
  7677. return;
  7678. }
  7679. }
  7680. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7681. {
  7682. if(finalSet)
  7683. {
  7684. setFinalValue(scoredValue+0.05);
  7685. event->accept();
  7686. return;
  7687. }
  7688. }
  7689. }
  7690. /*:706*/
  7691. #line 14754 "./typica.w"
  7692. /*707:*/
  7693. #line 14819 "./typica.w"
  7694. double relativeX= sceneCoordinate.x()-16;
  7695. if(initialSet)
  7696. {
  7697. if(relativeX>=0&&relativeX<=100)
  7698. {
  7699. setFinalValue(relativeX/10.0);
  7700. event->accept();
  7701. return;
  7702. }
  7703. }
  7704. else
  7705. {
  7706. if(relativeX>=0&&relativeX<=100)
  7707. {
  7708. setInitialValue(relativeX/10.0);
  7709. event->accept();
  7710. return;
  7711. }
  7712. }
  7713. /*:707*/
  7714. #line 14755 "./typica.w"
  7715. event->ignore();
  7716. return;
  7717. }
  7718. /*:704*/
  7719. #line 570 "./typica.w"
  7720. /*709:*/
  7721. #line 14885 "./typica.w"
  7722. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  7723. valueSet(false),scaleDown(false)
  7724. {
  7725. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7726. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7727. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  7728. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  7729. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  7730. theBrush.setColor(Qt::blue);
  7731. theBrush.setStyle(Qt::SolidPattern);
  7732. increment.setPolygon(up);
  7733. increment.setBrush(theBrush);
  7734. increment.setPos(0,0);
  7735. scene.addItem(&increment);
  7736. decrement.setPolygon(down);
  7737. decrement.setBrush(theBrush);
  7738. decrement.setPos(0,122);
  7739. scene.addItem(&decrement);
  7740. scalePath.moveTo(5,0);
  7741. scalePath.lineTo(5,100);
  7742. scalePath.moveTo(0,0);
  7743. scalePath.lineTo(10,0);
  7744. scalePath.moveTo(0,10);
  7745. scalePath.lineTo(10,10);
  7746. scalePath.moveTo(0,20);
  7747. scalePath.lineTo(10,20);
  7748. scalePath.moveTo(0,30);
  7749. scalePath.lineTo(10,30);
  7750. scalePath.moveTo(0,40);
  7751. scalePath.lineTo(10,40);
  7752. scalePath.moveTo(0,50);
  7753. scalePath.lineTo(10,50);
  7754. scalePath.moveTo(0,60);
  7755. scalePath.lineTo(10,60);
  7756. scalePath.moveTo(0,70);
  7757. scalePath.lineTo(10,70);
  7758. scalePath.moveTo(0,80);
  7759. scalePath.lineTo(10,80);
  7760. scalePath.moveTo(0,90);
  7761. scalePath.lineTo(10,90);
  7762. scalePath.moveTo(0,100);
  7763. scalePath.lineTo(10,100);
  7764. scaleLine.setPath(scalePath);
  7765. scaleLine.setPos(0,16);
  7766. scene.addItem(&scaleLine);
  7767. setScene(&scene);
  7768. indicator.setPolygon(left);
  7769. indicator.setBrush(theBrush);
  7770. setMinimumSize(sizeHint());
  7771. setMaximumSize(sizeHint());
  7772. }
  7773. /*:709*//*710:*/
  7774. #line 14940 "./typica.w"
  7775. QSize IntensityControl::sizeHint()const
  7776. {
  7777. return QSize(25,160);
  7778. }
  7779. /*:710*//*711:*/
  7780. #line 14955 "./typica.w"
  7781. void IntensityControl::setValue(double val)
  7782. {
  7783. if(val>=0&&val<=10)
  7784. {
  7785. theValue= val;
  7786. if(!valueSet)
  7787. {
  7788. scene.addItem(&indicator);
  7789. }
  7790. valueSet= true;
  7791. indicator.setPos(6,(100-(val*10))+16);
  7792. emit(valueChanged(val));
  7793. }
  7794. else if(val<1)
  7795. {
  7796. setValue(0);
  7797. }
  7798. else
  7799. {
  7800. setValue(10);
  7801. }
  7802. }
  7803. double IntensityControl::value()
  7804. {
  7805. return theValue;
  7806. }
  7807. /*:711*//*712:*/
  7808. #line 14987 "./typica.w"
  7809. void IntensityControl::mousePressEvent(QMouseEvent*event)
  7810. {
  7811. /*703:*/
  7812. #line 14731 "./typica.w"
  7813. if(event->button()!=Qt::LeftButton)
  7814. {
  7815. event->ignore();
  7816. return;
  7817. }
  7818. /*:703*/
  7819. #line 14990 "./typica.w"
  7820. scaleDown= true;
  7821. event->accept();
  7822. }
  7823. /*:712*//*713:*/
  7824. #line 15001 "./typica.w"
  7825. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  7826. {
  7827. /*703:*/
  7828. #line 14731 "./typica.w"
  7829. if(event->button()!=Qt::LeftButton)
  7830. {
  7831. event->ignore();
  7832. return;
  7833. }
  7834. /*:703*/
  7835. #line 15004 "./typica.w"
  7836. if(!scaleDown)
  7837. {
  7838. event->ignore();
  7839. return;
  7840. }
  7841. scaleDown= false;
  7842. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7843. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  7844. {
  7845. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7846. {
  7847. if(valueSet)
  7848. {
  7849. setValue(theValue+0.05);
  7850. }
  7851. event->accept();
  7852. return;
  7853. }
  7854. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  7855. {
  7856. if(valueSet)
  7857. {
  7858. setValue(theValue-0.05);
  7859. }
  7860. event->accept();
  7861. return;
  7862. }
  7863. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  7864. {
  7865. setValue(10-((sceneCoordinate.y()-16)/10.0));
  7866. event->accept();
  7867. return;
  7868. }
  7869. }
  7870. }
  7871. /*:713*/
  7872. #line 571 "./typica.w"
  7873. /*364:*/
  7874. #line 8230 "./typica.w"
  7875. void ThresholdDetector::newMeasurement(Measurement measure)
  7876. {
  7877. if((currentDirection==Ascending&&previousValue<threshold&&
  7878. previousValue>=0)||(currentDirection==Descending&&
  7879. previousValue> threshold&&previousValue>=0))
  7880. {
  7881. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  7882. (currentDirection==Descending&&measure.temperature()<=threshold))
  7883. {
  7884. double offset= measure.time().hour()*60*60;
  7885. offset+= measure.time().minute()*60;
  7886. offset+= measure.time().second();
  7887. offset+= measure.time().msec()/1000;
  7888. emit timeForValue(offset);
  7889. }
  7890. }
  7891. previousValue= measure.temperature();
  7892. }
  7893. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  7894. previousValue(-1),threshold(value),currentDirection(Ascending)
  7895. {
  7896. }
  7897. void ThresholdDetector::setThreshold(double value)
  7898. {
  7899. threshold= value;
  7900. }
  7901. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  7902. {
  7903. currentDirection= direction;
  7904. }
  7905. /*:364*/
  7906. #line 572 "./typica.w"
  7907. /*795:*/
  7908. #line 16893 "./typica.w"
  7909. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  7910. lister(new QextSerialEnumerator)
  7911. {
  7912. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  7913. QextPortInfo port;
  7914. foreach(port,ports)
  7915. {
  7916. #ifdef Q_OS_WIN32
  7917. addItem(port.portName);
  7918. #else
  7919. addItem(port.physName);
  7920. #endif
  7921. }
  7922. lister->setUpNotifications();
  7923. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  7924. this,SLOT(addDevice(QextPortInfo)));
  7925. setEditable(true);
  7926. }
  7927. void PortSelector::addDevice(QextPortInfo port)
  7928. {
  7929. addItem(port.portName);
  7930. }
  7931. /*:795*/
  7932. #line 573 "./typica.w"
  7933. /*797:*/
  7934. #line 16985 "./typica.w"
  7935. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  7936. {
  7937. QMetaObject meta= BaudSelector::staticMetaObject;
  7938. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  7939. for(int i= 0;i<type.keyCount();i++)
  7940. {
  7941. addItem(QString("%1").arg(type.value(i)));
  7942. }
  7943. }
  7944. /*:797*/
  7945. #line 574 "./typica.w"
  7946. /*799:*/
  7947. #line 17023 "./typica.w"
  7948. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  7949. {
  7950. QMetaObject meta= ParitySelector::staticMetaObject;
  7951. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  7952. for(int i= 0;i<type.keyCount();i++)
  7953. {
  7954. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7955. }
  7956. }
  7957. /*:799*/
  7958. #line 575 "./typica.w"
  7959. /*801:*/
  7960. #line 17053 "./typica.w"
  7961. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  7962. {
  7963. QMetaObject meta= FlowSelector::staticMetaObject;
  7964. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  7965. for(int i= 0;i<type.keyCount();i++)
  7966. {
  7967. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7968. }
  7969. }
  7970. /*:801*/
  7971. #line 576 "./typica.w"
  7972. /*803:*/
  7973. #line 17088 "./typica.w"
  7974. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  7975. {
  7976. QMetaObject meta= StopSelector::staticMetaObject;
  7977. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  7978. for(int i= 0;i<type.keyCount();i++)
  7979. {
  7980. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7981. }
  7982. }
  7983. /*:803*/
  7984. #line 577 "./typica.w"
  7985. /*863:*/
  7986. #line 18870 "./typica.w"
  7987. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  7988. :BasicDeviceConfigurationWidget(model,index),
  7989. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  7990. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  7991. decimalQuery(new QCheckBox(tr("Enable"))),
  7992. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  7993. unitQuery(new QCheckBox(tr("Enable"))),
  7994. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  7995. valueC(new QSpinBox),fixedUnit(new QComboBox),
  7996. pVAddress(new ShortHexSpinBox),
  7997. sVEnabled(new QCheckBox(tr("Enable"))),
  7998. sVReadAddress(new ShortHexSpinBox),
  7999. deviceLimit(new QCheckBox(tr("Enable"))),
  8000. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  8001. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  8002. sVWritable(new QCheckBox(tr("Enable"))),
  8003. sVOutputAddr(new ShortHexSpinBox),
  8004. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  8005. {
  8006. QHBoxLayout*layout= new QHBoxLayout;
  8007. QWidget*form= new QWidget;
  8008. QHBoxLayout*masterLayout= new QHBoxLayout;
  8009. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  8010. QVBoxLayout*seriesLayout= new QVBoxLayout;
  8011. QFormLayout*serialSection= new QFormLayout;
  8012. serialSection->addRow(QString(tr("Port:")),port);
  8013. serialSection->addRow(QString(tr("Baud rate:")),baud);
  8014. serialSection->addRow(QString(tr("Parity:")),parity);
  8015. serialSection->addRow(QString(tr("Flow control:")),flow);
  8016. serialSection->addRow(QString(tr("Stop bits:")),stop);
  8017. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  8018. serialSectionBox->setLayout(serialSection);
  8019. portAndDeviceLayout->addWidget(serialSectionBox);
  8020. QFormLayout*deviceSection= new QFormLayout;
  8021. station->setMinimum(1);
  8022. station->setMaximum(255);
  8023. decimalPosition->setMinimum(0);
  8024. decimalPosition->setMaximum(9);
  8025. valueF->setMinimum(0);
  8026. valueF->setMaximum(0xFFFF);
  8027. valueC->setMinimum(0);
  8028. valueC->setMaximum(0xFFFF);
  8029. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  8030. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  8031. deviceSection->addRow(tr("Station:"),station);
  8032. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  8033. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  8034. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  8035. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  8036. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  8037. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  8038. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  8039. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  8040. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  8041. deviceSectionBox->setLayout(deviceSection);
  8042. portAndDeviceLayout->addWidget(deviceSectionBox);
  8043. QFormLayout*pVSection= new QFormLayout;
  8044. pVSection->addRow(tr("Value relative address:"),pVAddress);
  8045. pVSection->addRow(tr("PV column name:"),pVColumnName);
  8046. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  8047. pVSection->addRow(pVHideBox);
  8048. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  8049. processValueBox->setLayout(pVSection);
  8050. seriesLayout->addWidget(processValueBox);
  8051. QFormLayout*sVSection= new QFormLayout;
  8052. sVLower->setDecimals(1);
  8053. sVLower->setMinimum(0.0);
  8054. sVLower->setMaximum(999.9);
  8055. sVUpper->setDecimals(1);
  8056. sVUpper->setMinimum(0.0);
  8057. sVUpper->setMaximum(999.9);
  8058. sVSection->addRow(tr("Set value:"),sVEnabled);
  8059. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  8060. sVSection->addRow(tr("SV column name:"),sVColumnName);
  8061. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  8062. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  8063. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  8064. sVSection->addRow(tr("Lower limit:"),sVLower);
  8065. sVSection->addRow(tr("Upper limit:"),sVUpper);
  8066. sVSection->addRow(tr("Output set value:"),sVWritable);
  8067. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  8068. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  8069. sVSection->addRow(sVHideBox);
  8070. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  8071. setValueBox->setLayout(sVSection);
  8072. seriesLayout->addWidget(setValueBox);
  8073. masterLayout->addLayout(portAndDeviceLayout);
  8074. masterLayout->addLayout(seriesLayout);
  8075. form->setLayout(masterLayout);
  8076. /*771:*/
  8077. #line 16334 "./typica.w"
  8078. QDomElement referenceElement=
  8079. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8080. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8081. QDomElement node;
  8082. /*:771*/
  8083. #line 18960 "./typica.w"
  8084. for(int i= 0;i<configData.size();i++)
  8085. {
  8086. node= configData.at(i).toElement();
  8087. if(node.attribute("name")=="port")
  8088. {
  8089. QString portname= node.attribute("value");
  8090. int idx= port->findText(portname);
  8091. if(idx>=0)
  8092. {
  8093. port->setCurrentIndex(idx);
  8094. }
  8095. else
  8096. {
  8097. port->addItem(portname);
  8098. }
  8099. }
  8100. else if(node.attribute("name")=="baud")
  8101. {
  8102. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  8103. }
  8104. else if(node.attribute("name")=="parity")
  8105. {
  8106. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  8107. }
  8108. else if(node.attribute("name")=="flow")
  8109. {
  8110. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  8111. }
  8112. else if(node.attribute("name")=="stop")
  8113. {
  8114. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  8115. }
  8116. else if(node.attribute("name")=="station")
  8117. {
  8118. station->setValue(node.attribute("value").toInt());
  8119. }
  8120. else if(node.attribute("name")=="decimalQuery")
  8121. {
  8122. if(node.attribute("value")=="true")
  8123. {
  8124. decimalQuery->setChecked(true);
  8125. }
  8126. else
  8127. {
  8128. decimalQuery->setChecked(false);
  8129. }
  8130. }
  8131. else if(node.attribute("name")=="decimalAddress")
  8132. {
  8133. decimalAddress->setValue(node.attribute("value").toInt());
  8134. }
  8135. else if(node.attribute("name")=="decimalPosition")
  8136. {
  8137. decimalPosition->setValue(node.attribute("value").toInt());
  8138. }
  8139. else if(node.attribute("name")=="unitQuery")
  8140. {
  8141. if(node.attribute("value")=="true")
  8142. {
  8143. unitQuery->setChecked(true);
  8144. }
  8145. else
  8146. {
  8147. unitQuery->setChecked(false);
  8148. }
  8149. }
  8150. else if(node.attribute("name")=="unitAddress")
  8151. {
  8152. unitAddress->setValue(node.attribute("value").toInt());
  8153. }
  8154. else if(node.attribute("name")=="valueF")
  8155. {
  8156. valueF->setValue(node.attribute("value").toInt());
  8157. }
  8158. else if(node.attribute("name")=="valueC")
  8159. {
  8160. valueC->setValue(node.attribute("value").toInt());
  8161. }
  8162. else if(node.attribute("name")=="fixedUnit")
  8163. {
  8164. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  8165. }
  8166. else if(node.attribute("name")=="pVAddress")
  8167. {
  8168. pVAddress->setValue(node.attribute("value").toInt());
  8169. }
  8170. else if(node.attribute("name")=="sVEnabled")
  8171. {
  8172. if(node.attribute("value")=="true")
  8173. {
  8174. sVEnabled->setChecked(true);
  8175. }
  8176. else
  8177. {
  8178. sVEnabled->setChecked(false);
  8179. }
  8180. }
  8181. else if(node.attribute("name")=="sVReadAddress")
  8182. {
  8183. sVReadAddress->setValue(node.attribute("value").toInt());
  8184. }
  8185. else if(node.attribute("name")=="deviceLimit")
  8186. {
  8187. if(node.attribute("value")=="true")
  8188. {
  8189. deviceLimit->setChecked(true);
  8190. }
  8191. else
  8192. {
  8193. deviceLimit->setChecked(false);
  8194. }
  8195. }
  8196. else if(node.attribute("name")=="sVLowerAddr")
  8197. {
  8198. sVLowerAddr->setValue(node.attribute("value").toInt());
  8199. }
  8200. else if(node.attribute("name")=="sVUpperAddr")
  8201. {
  8202. sVUpperAddr->setValue(node.attribute("value").toInt());
  8203. }
  8204. else if(node.attribute("name")=="sVLower")
  8205. {
  8206. sVLower->setValue(node.attribute("value").toDouble());
  8207. }
  8208. else if(node.attribute("name")=="sVUpper")
  8209. {
  8210. sVUpper->setValue(node.attribute("value").toDouble());
  8211. }
  8212. else if(node.attribute("name")=="sVWritable")
  8213. {
  8214. if(node.attribute("value")=="true")
  8215. {
  8216. sVWritable->setChecked(true);
  8217. }
  8218. else
  8219. {
  8220. sVWritable->setChecked(false);
  8221. }
  8222. }
  8223. else if(node.attribute("name")=="sVOutputAddr")
  8224. {
  8225. sVOutputAddr->setValue(node.attribute("value").toInt());
  8226. }
  8227. else if(node.attribute("name")=="pvcolname")
  8228. {
  8229. pVColumnName->setText(node.attribute("value"));
  8230. }
  8231. else if(node.attribute("name")=="svcolname")
  8232. {
  8233. sVColumnName->setText(node.attribute("value"));
  8234. }
  8235. else if(node.attribute("name")=="pvhidden")
  8236. {
  8237. pVHideBox->setChecked(node.attribute("value")=="true");
  8238. }
  8239. else if(node.attribute("name")=="svhidden")
  8240. {
  8241. sVHideBox->setChecked(node.attribute("value")=="true");
  8242. }
  8243. }
  8244. updatePort(port->currentText());
  8245. updateBaudRate(baud->currentText());
  8246. updateParity(parity->itemData(parity->currentIndex()).toString());
  8247. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  8248. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  8249. updateStation(station->value());
  8250. updateFixedDecimal(decimalQuery->isChecked());
  8251. updateDecimalAddress(decimalAddress->value());
  8252. updateDecimalPosition(decimalPosition->value());
  8253. updateFixedUnit(unitQuery->isChecked());
  8254. updateUnitAddress(unitAddress->value());
  8255. updateValueForF(valueF->value());
  8256. updateValueForC(valueC->value());
  8257. updateUnit(fixedUnit->currentText());
  8258. updatePVAddress(pVAddress->value());
  8259. updateSVEnabled(sVEnabled->isChecked());
  8260. updateSVReadAddress(sVReadAddress->value());
  8261. updateDeviceLimit(deviceLimit->isChecked());
  8262. updateSVLowerAddress(sVLowerAddr->value());
  8263. updateSVUpperAddress(sVUpperAddr->value());
  8264. updateSVLower(sVLower->value());
  8265. updateSVUpper(sVUpper->value());
  8266. updateSVWritable(sVWritable->isChecked());
  8267. updateSVWriteAddress(sVOutputAddr->value());
  8268. updatePVColumnName(pVColumnName->text());
  8269. updateSVColumnName(sVColumnName->text());
  8270. updatePVHidden(pVHideBox->isChecked());
  8271. updateSVHidden(sVHideBox->isChecked());
  8272. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  8273. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  8274. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  8275. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  8276. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  8277. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  8278. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  8279. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  8280. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  8281. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  8282. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  8283. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  8284. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  8285. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  8286. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  8287. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  8288. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  8289. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  8290. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  8291. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  8292. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  8293. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  8294. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  8295. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  8296. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  8297. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  8298. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  8299. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  8300. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  8301. layout->addWidget(form);
  8302. setLayout(layout);
  8303. }
  8304. void ModbusConfigurator::updatePort(const QString&newPort)
  8305. {
  8306. updateAttribute("port",newPort);
  8307. }
  8308. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  8309. {
  8310. updateAttribute("baud",newRate);
  8311. }
  8312. void ModbusConfigurator::updateParity(const QString&)
  8313. {
  8314. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  8315. }
  8316. void ModbusConfigurator::updateFlowControl(const QString&)
  8317. {
  8318. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  8319. }
  8320. void ModbusConfigurator::updateStopBits(const QString&)
  8321. {
  8322. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  8323. }
  8324. void ModbusConfigurator::updateStation(int station)
  8325. {
  8326. updateAttribute("station",QString("%1").arg(station));
  8327. }
  8328. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  8329. {
  8330. updateAttribute("decimalQuery",fixed?"true":"false");
  8331. }
  8332. void ModbusConfigurator::updateDecimalAddress(int address)
  8333. {
  8334. updateAttribute("decimalAddress",QString("%1").arg(address));
  8335. }
  8336. void ModbusConfigurator::updateDecimalPosition(int position)
  8337. {
  8338. updateAttribute("decimalPosition",QString("%1").arg(position));
  8339. }
  8340. void ModbusConfigurator::updateFixedUnit(bool fixed)
  8341. {
  8342. updateAttribute("unitQuery",fixed?"true":"false");
  8343. }
  8344. void ModbusConfigurator::updateUnitAddress(int address)
  8345. {
  8346. updateAttribute("unitAddress",QString("%1").arg(address));
  8347. }
  8348. void ModbusConfigurator::updateValueForF(int value)
  8349. {
  8350. updateAttribute("valueF",QString("%1").arg(value));
  8351. }
  8352. void ModbusConfigurator::updateValueForC(int value)
  8353. {
  8354. updateAttribute("valueC",QString("%1").arg(value));
  8355. }
  8356. void ModbusConfigurator::updateUnit(const QString&newUnit)
  8357. {
  8358. updateAttribute("fixedUnit",newUnit);
  8359. }
  8360. void ModbusConfigurator::updatePVAddress(int address)
  8361. {
  8362. updateAttribute("pVAddress",QString("%1").arg(address));
  8363. }
  8364. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8365. {
  8366. updateAttribute("sVEnabled",enabled?"true":"false");
  8367. }
  8368. void ModbusConfigurator::updateSVReadAddress(int address)
  8369. {
  8370. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8371. }
  8372. void ModbusConfigurator::updateDeviceLimit(bool query)
  8373. {
  8374. updateAttribute("deviceLimit",query?"true":"false");
  8375. }
  8376. void ModbusConfigurator::updateSVLowerAddress(int address)
  8377. {
  8378. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8379. }
  8380. void ModbusConfigurator::updateSVUpperAddress(int address)
  8381. {
  8382. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  8383. }
  8384. void ModbusConfigurator::updateSVLower(double value)
  8385. {
  8386. updateAttribute("sVLower",QString("%1").arg(value));
  8387. }
  8388. void ModbusConfigurator::updateSVUpper(double value)
  8389. {
  8390. updateAttribute("sVUpper",QString("%1").arg(value));
  8391. }
  8392. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  8393. {
  8394. updateAttribute("sVWritable",canWriteSV?"true":"false");
  8395. }
  8396. void ModbusConfigurator::updateSVWriteAddress(int address)
  8397. {
  8398. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  8399. }
  8400. void ModbusConfigurator::updatePVColumnName(const QString&name)
  8401. {
  8402. updateAttribute("pvcolname",name);
  8403. }
  8404. void ModbusConfigurator::updateSVColumnName(const QString&name)
  8405. {
  8406. updateAttribute("svcolname",name);
  8407. }
  8408. void ModbusConfigurator::updatePVHidden(bool hidden)
  8409. {
  8410. updateAttribute("pvhidden",hidden?"true":"false");
  8411. }
  8412. void ModbusConfigurator::updateSVHidden(bool hidden)
  8413. {
  8414. updateAttribute("svhidden",hidden?"true":"false");
  8415. }
  8416. /*:863*/
  8417. #line 578 "./typica.w"
  8418. /*806:*/
  8419. #line 17137 "./typica.w"
  8420. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  8421. {
  8422. setMinimum(0);
  8423. setMaximum(0xFFFF);
  8424. setPrefix("0x");
  8425. setMinimumWidth(65);
  8426. }
  8427. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  8428. {
  8429. if(input.size()==2)
  8430. {
  8431. return QValidator::Intermediate;
  8432. }
  8433. bool okay;
  8434. input.toInt(&okay,16);
  8435. if(okay)
  8436. {
  8437. return QValidator::Acceptable;
  8438. }
  8439. return QValidator::Invalid;
  8440. }
  8441. int ShortHexSpinBox::valueFromText(const QString&text)const
  8442. {
  8443. return text.toInt(NULL,16);
  8444. }
  8445. QString ShortHexSpinBox::textFromValue(int value)const
  8446. {
  8447. QString retval;
  8448. retval.setNum(value,16);
  8449. while(retval.size()<4)
  8450. {
  8451. retval.prepend("0");
  8452. }
  8453. return retval.toUpper();
  8454. }
  8455. /*:806*/
  8456. #line 579 "./typica.w"
  8457. /*847:*/
  8458. #line 18169 "./typica.w"
  8459. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  8460. :QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),unitIsF(true),readingsv(false),
  8461. waiting(false)
  8462. {
  8463. qDebug()<<"Initializing Modbus RTU Device";
  8464. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  8465. Qt::UserRole).toString());
  8466. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  8467. QDomElement node;
  8468. QVariantMap attributes;
  8469. for(int i= 0;i<portConfigData.size();i++)
  8470. {
  8471. node= portConfigData.at(i).toElement();
  8472. attributes.insert(node.attribute("name"),node.attribute("value"));
  8473. }
  8474. port= new QextSerialPort(attributes.value("port").toString(),
  8475. QextSerialPort::EventDriven);
  8476. int baudRate= attributes.value("baud").toInt();
  8477. port->setBaudRate((BaudRateType)baudRate);
  8478. double temp= ((double)(1)/(double)(baudRate))*48;
  8479. delayTime= (int)(temp*3000);
  8480. messageDelayTimer->setSingleShot(true);
  8481. commTimeout->setSingleShot(true);
  8482. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  8483. connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
  8484. port->setDataBits(DATA_8);
  8485. port->setParity((ParityType)attributes.value("parity").toInt());
  8486. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  8487. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  8488. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  8489. port->open(QIODevice::ReadWrite);
  8490. station= (char)attributes.value("station").toInt();
  8491. if(attributes.value("decimalQuery")=="true")
  8492. {
  8493. decimalPosition= 0;
  8494. QByteArray message;
  8495. message.append(station);
  8496. message.append((char)0x03);
  8497. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  8498. char*addressBytes= (char*)&address;
  8499. message.append(addressBytes[1]);
  8500. message.append(addressBytes[0]);
  8501. message.append((char)0x00);
  8502. message.append((char)0x01);
  8503. queueMessage(message,this,"decimalResponse(QByteArray)");
  8504. }
  8505. else
  8506. {
  8507. decimalPosition= attributes.value("decimalPosition").toInt();
  8508. }
  8509. valueF= attributes.value("valueF").toInt();
  8510. valueC= attributes.value("valueC").toInt();
  8511. if(attributes.value("unitQuery")=="true")
  8512. {
  8513. QByteArray message;
  8514. message.append(station);
  8515. message.append((char)0x03);
  8516. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  8517. char*addressBytes= (char*)&address;
  8518. message.append(addressBytes[1]);
  8519. message.append(addressBytes[0]);
  8520. message.append((char)0x00);
  8521. message.append((char)0x01);
  8522. queueMessage(message,this,"unitResponse(QByteArray)");
  8523. }
  8524. else
  8525. {
  8526. if(attributes.value("fixedUnit")=="Celsius")
  8527. {
  8528. unitIsF= false;
  8529. }
  8530. }
  8531. if(attributes.value("sVWritable")=="true")
  8532. {
  8533. if(attributes.value("deviceLimit")=="true")
  8534. {
  8535. QByteArray lmessage;
  8536. lmessage.append(station);
  8537. lmessage.append((char)0x03);
  8538. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  8539. char*addressBytes= (char*)&laddress;
  8540. lmessage.append(addressBytes[1]);
  8541. lmessage.append(addressBytes[0]);
  8542. lmessage.append((char)0x00);
  8543. lmessage.append((char)0x01);
  8544. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  8545. QByteArray umessage;
  8546. umessage.append(station);
  8547. umessage.append((char)0x03);
  8548. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  8549. addressBytes= (char*)&uaddress;
  8550. umessage.append(addressBytes[1]);
  8551. umessage.append(addressBytes[0]);
  8552. umessage.append((char)0x00);
  8553. umessage.append((char)0x01);
  8554. queueMessage(umessage,this,"svuResponse(QByteArray)");
  8555. }
  8556. else
  8557. {
  8558. outputSVLower= attributes.value("sVLower").toDouble();
  8559. outputSVUpper= attributes.value("sVUpper").toDouble();
  8560. }
  8561. outputSVStub.append(station);
  8562. outputSVStub.append((char)0x06);
  8563. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  8564. char*addressBytes= (char*)&address;
  8565. outputSVStub.append(addressBytes[1]);
  8566. outputSVStub.append(addressBytes[0]);
  8567. }
  8568. Channel*pv= new Channel;
  8569. channels.append(pv);
  8570. pvStub.append(station);
  8571. pvStub.append((char)0x04);
  8572. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  8573. char*pvac= (char*)&pvaddress;
  8574. pvStub.append(pvac[1]);
  8575. pvStub.append(pvac[0]);
  8576. pvStub.append((char)0x00);
  8577. pvStub.append((char)0x01);
  8578. svenabled= attributes.value("sVEnabled").toBool();
  8579. if(svenabled)
  8580. {
  8581. Channel*sv= new Channel;
  8582. channels.append(sv);
  8583. svStub.append(station);
  8584. svStub.append((char)0x04);
  8585. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  8586. char*svac= (char*)&svaddress;
  8587. svStub.append(svac[1]);
  8588. svStub.append(svac[0]);
  8589. svStub.append((char)0x00);
  8590. svStub.append((char)0x01);
  8591. if(svaddress-pvaddress==1)
  8592. {
  8593. mStub.append(station);
  8594. mStub.append((char)0x04);
  8595. mStub.append(pvac[1]);
  8596. mStub.append(pvac[0]);
  8597. mStub.append((char)0x00);
  8598. mStub.append((char)0x02);
  8599. }
  8600. }
  8601. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  8602. requestMeasurement();
  8603. }
  8604. double ModbusRTUDevice::SVLower()
  8605. {
  8606. return outputSVLower;
  8607. }
  8608. double ModbusRTUDevice::SVUpper()
  8609. {
  8610. return outputSVUpper;
  8611. }
  8612. int ModbusRTUDevice::decimals()
  8613. {
  8614. return decimalPosition;
  8615. }
  8616. void ModbusRTUDevice::decimalResponse(QByteArray response)
  8617. {
  8618. quint16 temp;
  8619. char*tchar= (char*)&temp;
  8620. tchar[1]= response.at(3);
  8621. tchar[0]= response.at(4);
  8622. decimalPosition= temp;
  8623. emit SVDecimalChanged(decimalPosition);
  8624. qDebug()<<"Received decimal response";
  8625. }
  8626. void ModbusRTUDevice::unitResponse(QByteArray response)
  8627. {
  8628. quint16 temp;
  8629. char*tchar= (char*)&temp;
  8630. tchar[1]= response.at(3);
  8631. tchar[0]= response.at(4);
  8632. int value= temp;
  8633. if(value==valueF)
  8634. {
  8635. unitIsF= true;
  8636. }
  8637. else
  8638. {
  8639. unitIsF= false;
  8640. }
  8641. qDebug()<<"Received unit response";
  8642. }
  8643. void ModbusRTUDevice::svlResponse(QByteArray response)
  8644. {
  8645. quint16 temp;
  8646. char*tchar= (char*)&temp;
  8647. tchar[1]= response.at(3);
  8648. tchar[0]= response.at(4);
  8649. outputSVLower= (double)temp;
  8650. for(int i= 0;i<decimalPosition;i++)
  8651. {
  8652. outputSVLower/= 10;
  8653. }
  8654. emit SVLowerChanged(outputSVLower);
  8655. qDebug()<<"Received set value lower bound response";
  8656. }
  8657. void ModbusRTUDevice::svuResponse(QByteArray response)
  8658. {
  8659. quint16 temp;
  8660. char*tchar= (char*)&temp;
  8661. tchar[1]= response.at(3);
  8662. tchar[0]= response.at(4);
  8663. outputSVUpper= (double)temp;
  8664. for(int i= 0;i<decimalPosition;i++)
  8665. {
  8666. outputSVUpper/= 10;
  8667. }
  8668. emit SVUpperChanged(outputSVUpper);
  8669. qDebug()<<"Received set value upper bound response";
  8670. }
  8671. void ModbusRTUDevice::requestMeasurement()
  8672. {
  8673. if(mStub.length()> 0)
  8674. {
  8675. queueMessage(mStub,this,"mResponse(QByteArray)");
  8676. }
  8677. else
  8678. {
  8679. queueMessage(pvStub,this,"mResponse(QByteArray)");
  8680. if(svenabled)
  8681. {
  8682. queueMessage(svStub,this,"mResponse(QByteArray)");
  8683. }
  8684. }
  8685. }
  8686. void ModbusRTUDevice::mResponse(QByteArray response)
  8687. {
  8688. QTime time= QTime::currentTime();
  8689. if(response.at(2)==0x04)
  8690. {
  8691. /*848:*/
  8692. #line 18424 "./typica.w"
  8693. quint16 pv;
  8694. quint16 sv;
  8695. char*pvBytes= (char*)&pv;
  8696. char*svBytes= (char*)&sv;
  8697. pvBytes[1]= response.at(3);
  8698. pvBytes[0]= response.at(4);
  8699. svBytes[1]= response.at(5);
  8700. svBytes[0]= response.at(6);
  8701. double pvOut= (double)pv;
  8702. double svOut= (double)sv;
  8703. for(int i= 0;i<decimalPosition;i++)
  8704. {
  8705. pvOut/= 10;
  8706. svOut/= 10;
  8707. }
  8708. if(!unitIsF)
  8709. {
  8710. pvOut= pvOut*9/5+32;
  8711. svOut= svOut*9/5+32;
  8712. }
  8713. Measurement pvm(pvOut,time,Units::Fahrenheit);
  8714. Measurement svm(svOut,time,Units::Fahrenheit);
  8715. channels.at(0)->input(pvm);
  8716. channels.at(1)->input(svm);
  8717. /*:848*/
  8718. #line 18411 "./typica.w"
  8719. }
  8720. else
  8721. {
  8722. /*849:*/
  8723. #line 18454 "./typica.w"
  8724. quint16 value;
  8725. char*valueBytes= (char*)&value;
  8726. valueBytes[1]= response.at(3);
  8727. valueBytes[0]= response.at(4);
  8728. double valueOut= (double)value;
  8729. for(int i= 0;i<decimalPosition;i++)
  8730. {
  8731. valueOut/= 10;
  8732. }
  8733. if(!unitIsF)
  8734. {
  8735. valueOut= valueOut*9/5+32;
  8736. }
  8737. if(!svenabled)
  8738. {
  8739. Measurement vm(valueOut,time,Units::Fahrenheit);
  8740. channels.at(0)->input(vm);
  8741. }
  8742. else
  8743. {
  8744. if(readingsv)
  8745. {
  8746. Measurement pvm(savedpv,time,Units::Fahrenheit);
  8747. Measurement svm(valueOut,time,Units::Fahrenheit);
  8748. channels.at(0)->input(pvm);
  8749. channels.at(1)->input(svm);
  8750. readingsv= false;
  8751. }
  8752. else
  8753. {
  8754. savedpv= valueOut;
  8755. readingsv= true;
  8756. }
  8757. }
  8758. /*:849*/
  8759. #line 18415 "./typica.w"
  8760. }
  8761. }
  8762. /*:847*//*850:*/
  8763. #line 18492 "./typica.w"
  8764. ModbusRTUDevice::~ModbusRTUDevice()
  8765. {
  8766. commTimeout->stop();
  8767. messageDelayTimer->stop();
  8768. port->close();
  8769. }
  8770. /*:850*//*851:*/
  8771. #line 18519 "./typica.w"
  8772. void ModbusRTUDevice::dataAvailable()
  8773. {
  8774. if(messageDelayTimer->isActive())
  8775. {
  8776. messageDelayTimer->stop();
  8777. }
  8778. responseBuffer.append(port->readAll());
  8779. /*852:*/
  8780. #line 18565 "./typica.w"
  8781. if(responseBuffer.size()<5)
  8782. {
  8783. return;
  8784. }
  8785. switch(responseBuffer.at(1))
  8786. {
  8787. case 0x01:
  8788. case 0x02:
  8789. if(responseBuffer.size()<6)
  8790. {
  8791. return;
  8792. }
  8793. responseBuffer= responseBuffer.left(6);
  8794. break;
  8795. case 0x03:
  8796. case 0x04:
  8797. if(responseBuffer.size()<5+responseBuffer.at(2))
  8798. {
  8799. return;
  8800. }
  8801. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  8802. break;
  8803. case 0x05:
  8804. case 0x06:
  8805. case 0x10:
  8806. if(responseBuffer.size()<8)
  8807. {
  8808. return;
  8809. }
  8810. responseBuffer= responseBuffer.left(8);
  8811. break;
  8812. }
  8813. /*:852*/
  8814. #line 18527 "./typica.w"
  8815. commTimeout->stop();
  8816. if(calculateCRC(responseBuffer)==0)
  8817. {
  8818. QObject*object= retObjQueue.at(0);
  8819. char*method= callbackQueue.at(0);
  8820. QMetaMethod metamethod= object->metaObject()->
  8821. method(object->metaObject()->
  8822. indexOfMethod(QMetaObject::normalizedSignature(method)));
  8823. metamethod.invoke(object,Qt::QueuedConnection,
  8824. Q_ARG(QByteArray,responseBuffer));
  8825. messageQueue.removeAt(0);
  8826. retObjQueue.removeAt(0);
  8827. callbackQueue.removeAt(0);
  8828. }
  8829. else
  8830. {
  8831. qDebug()<<"CRC failed";
  8832. }
  8833. messageDelayTimer->start(delayTime);
  8834. waiting= false;
  8835. responseBuffer.clear();
  8836. }
  8837. /*:851*//*853:*/
  8838. #line 18607 "./typica.w"
  8839. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  8840. {
  8841. quint16 retval= 0xFFFF;
  8842. int i= 0;
  8843. while(i<data.size())
  8844. {
  8845. retval^= 0x00FF&(quint16)data.at(i);
  8846. for(int j= 0;j<8;j++)
  8847. {
  8848. if(retval&1)
  8849. {
  8850. retval= (retval>>1)^0xA001;
  8851. }
  8852. else
  8853. {
  8854. retval>>= 1;
  8855. }
  8856. }
  8857. i++;
  8858. }
  8859. return retval;
  8860. }
  8861. /*:853*//*854:*/
  8862. #line 18638 "./typica.w"
  8863. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  8864. const char*callback)
  8865. {
  8866. messageQueue.append(request);
  8867. retObjQueue.append(object);
  8868. callbackQueue.append(const_cast<char*> (callback));
  8869. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  8870. {
  8871. sendNextMessage();
  8872. }
  8873. }
  8874. void ModbusRTUDevice::sendNextMessage()
  8875. {
  8876. if(messageQueue.size()> 0&&!waiting)
  8877. {
  8878. QByteArray message= messageQueue.at(0);
  8879. quint16 crc= calculateCRC(message);
  8880. char*check= (char*)&crc;
  8881. message.append(check[0]);
  8882. message.append(check[1]);
  8883. port->write(message);
  8884. commTimeout->start(2000);
  8885. messageDelayTimer->start(delayTime);
  8886. waiting= true;
  8887. }
  8888. else
  8889. {
  8890. emit queueEmpty();
  8891. }
  8892. }
  8893. void ModbusRTUDevice::outputSV(double value)
  8894. {
  8895. for(int i= 0;i<decimalPosition;i++)
  8896. {
  8897. value*= 10;
  8898. }
  8899. quint16 outval= (quint16)value;
  8900. QByteArray message(outputSVStub);
  8901. char*valBytes= (char*)&outval;
  8902. message.append(valBytes[1]);
  8903. message.append(valBytes[0]);
  8904. queueMessage(message,this,"ignore(QByteArray)");
  8905. }
  8906. /*:854*//*855:*/
  8907. #line 18687 "./typica.w"
  8908. void ModbusRTUDevice::ignore(QByteArray)
  8909. {
  8910. return;
  8911. }
  8912. /*:855*//*856:*/
  8913. #line 18700 "./typica.w"
  8914. void ModbusRTUDevice::timeout()
  8915. {
  8916. qDebug()<<"Communications timeout.";
  8917. responseBuffer.clear();
  8918. waiting= false;
  8919. messageDelayTimer->start();
  8920. }
  8921. /*:856*/
  8922. #line 580 "./typica.w"
  8923. /*725:*/
  8924. #line 15259 "./typica.w"
  8925. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  8926. DeviceTreeModelNode*parent)
  8927. :domNode(node),rowNumber(row),parentItem(parent)
  8928. {
  8929. }
  8930. DeviceTreeModelNode::~DeviceTreeModelNode()
  8931. {
  8932. QHash<int,DeviceTreeModelNode*> ::iterator i;
  8933. for(i= children.begin();i!=children.end();i++)
  8934. {
  8935. delete i.value();
  8936. }
  8937. }
  8938. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  8939. {
  8940. return parentItem;
  8941. }
  8942. int DeviceTreeModelNode::row()
  8943. {
  8944. return rowNumber;
  8945. }
  8946. QDomNode DeviceTreeModelNode::node()const
  8947. {
  8948. return domNode;
  8949. }
  8950. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  8951. {
  8952. if(children.contains(index))
  8953. {
  8954. return children[index];
  8955. }
  8956. if(index>=0&&index<domNode.childNodes().count())
  8957. {
  8958. QDomNode childNode= domNode.childNodes().item(index);
  8959. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  8960. index,this);
  8961. children[index]= childItem;
  8962. return childItem;
  8963. }
  8964. return NULL;
  8965. }
  8966. /*:725*/
  8967. #line 581 "./typica.w"
  8968. /*727:*/
  8969. #line 15348 "./typica.w"
  8970. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  8971. :QAbstractItemModel(parent)
  8972. {
  8973. document= AppInstance->deviceConfiguration();
  8974. QDomNodeList elements= document.elementsByTagName("devices");
  8975. if(elements.size()!=1)
  8976. {
  8977. qDebug()<<"Unexpected result when loading device map.";
  8978. }
  8979. treeRoot= elements.at(0);
  8980. root= new DeviceTreeModelNode(treeRoot,0);
  8981. elements= document.elementsByTagName("references");
  8982. if(elements.size()!=1)
  8983. {
  8984. qDebug()<<"No references section. Creating.";
  8985. referenceSection= document.createElement("references");
  8986. document.appendChild(referenceSection);
  8987. }
  8988. else
  8989. {
  8990. referenceSection= elements.at(0);
  8991. }
  8992. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  8993. AppInstance,SLOT(saveDeviceConfiguration()));
  8994. connect(this,SIGNAL(modelReset()),
  8995. AppInstance,SLOT(saveDeviceConfiguration()));
  8996. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8997. AppInstance,SLOT(saveDeviceConfiguration()));
  8998. }
  8999. /*:727*//*728:*/
  9000. #line 15383 "./typica.w"
  9001. int DeviceTreeModel::columnCount(const QModelIndex&)const
  9002. {
  9003. return 1;
  9004. }
  9005. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  9006. {
  9007. if(parent.column()> 0)
  9008. {
  9009. return 0;
  9010. }
  9011. /*729:*/
  9012. #line 15402 "./typica.w"
  9013. DeviceTreeModelNode*parentItem;
  9014. if(!parent.isValid())
  9015. {
  9016. parentItem= root;
  9017. }
  9018. else
  9019. {
  9020. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9021. }
  9022. /*:729*/
  9023. #line 15395 "./typica.w"
  9024. return parentItem->node().childNodes().count();
  9025. }
  9026. /*:728*//*730:*/
  9027. #line 15416 "./typica.w"
  9028. QModelIndex DeviceTreeModel::index(int row,int column,
  9029. const QModelIndex&parent)const
  9030. {
  9031. if(!hasIndex(row,column,parent))
  9032. {
  9033. return QModelIndex();
  9034. }
  9035. /*729:*/
  9036. #line 15402 "./typica.w"
  9037. DeviceTreeModelNode*parentItem;
  9038. if(!parent.isValid())
  9039. {
  9040. parentItem= root;
  9041. }
  9042. else
  9043. {
  9044. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9045. }
  9046. /*:729*/
  9047. #line 15424 "./typica.w"
  9048. DeviceTreeModelNode*childItem= parentItem->child(row);
  9049. if(childItem)
  9050. {
  9051. return createIndex(row,column,childItem);
  9052. }
  9053. return QModelIndex();
  9054. }
  9055. /*:730*//*731:*/
  9056. #line 15435 "./typica.w"
  9057. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  9058. {
  9059. if(!child.isValid())
  9060. {
  9061. return QModelIndex();
  9062. }
  9063. DeviceTreeModelNode*childItem=
  9064. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  9065. DeviceTreeModelNode*parentItem= childItem->parent();
  9066. if(!parentItem||parentItem==root)
  9067. {
  9068. return QModelIndex();
  9069. }
  9070. return createIndex(parentItem->row(),0,parentItem);
  9071. }
  9072. /*:731*//*732:*/
  9073. #line 15454 "./typica.w"
  9074. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  9075. {
  9076. if(!index.isValid())
  9077. {
  9078. return 0;
  9079. }
  9080. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  9081. }
  9082. /*:732*//*733:*/
  9083. #line 15469 "./typica.w"
  9084. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  9085. {
  9086. if(!index.isValid())
  9087. {
  9088. return QVariant();
  9089. }
  9090. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  9091. {
  9092. return QVariant();
  9093. }
  9094. DeviceTreeModelNode*item=
  9095. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9096. QDomNode node= item->node();
  9097. QDomElement element= node.toElement();
  9098. switch(role)
  9099. {
  9100. case Qt::DisplayRole:
  9101. case Qt::EditRole:
  9102. return QVariant(element.attribute("name"));
  9103. case Qt::UserRole:
  9104. return QVariant(element.attribute("reference"));
  9105. default:
  9106. return QVariant();
  9107. }
  9108. return QVariant();
  9109. }
  9110. /*:733*//*734:*/
  9111. #line 15501 "./typica.w"
  9112. bool DeviceTreeModel::setData(const QModelIndex&index,
  9113. const QVariant&value,int)
  9114. {
  9115. if(!index.isValid())
  9116. {
  9117. return false;
  9118. }
  9119. DeviceTreeModelNode*item=
  9120. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9121. QDomNode node= item->node();
  9122. QDomElement element= node.toElement();
  9123. element.setAttribute("name",value.toString());
  9124. emit dataChanged(index,index);
  9125. return true;
  9126. }
  9127. /*:734*//*735:*/
  9128. #line 15524 "./typica.w"
  9129. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  9130. const QModelIndex&parent)
  9131. {
  9132. QString referenceID= QUuid::createUuid().toString();
  9133. /*729:*/
  9134. #line 15402 "./typica.w"
  9135. DeviceTreeModelNode*parentItem;
  9136. if(!parent.isValid())
  9137. {
  9138. parentItem= root;
  9139. }
  9140. else
  9141. {
  9142. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9143. }
  9144. /*:729*/
  9145. #line 15529 "./typica.w"
  9146. QDomNode parentNode= parentItem->node();
  9147. int newRowNumber= rowCount(parent);
  9148. beginInsertRows(parent,newRowNumber,newRowNumber);
  9149. QDomElement deviceElement= document.createElement("node");
  9150. deviceElement.setAttribute("name",name);
  9151. deviceElement.setAttribute("reference",referenceID);
  9152. parentNode.appendChild(deviceElement);
  9153. QDomElement referenceElement= document.createElement("reference");
  9154. referenceElement.setAttribute("id",referenceID);
  9155. referenceElement.setAttribute("driver",driver);
  9156. referenceSection.appendChild(referenceElement);
  9157. endInsertRows();
  9158. }
  9159. /*:735*//*736:*/
  9160. #line 15547 "./typica.w"
  9161. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  9162. {
  9163. /*729:*/
  9164. #line 15402 "./typica.w"
  9165. DeviceTreeModelNode*parentItem;
  9166. if(!parent.isValid())
  9167. {
  9168. parentItem= root;
  9169. }
  9170. else
  9171. {
  9172. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9173. }
  9174. /*:729*/
  9175. #line 15550 "./typica.w"
  9176. QDomNode parentNode= parentItem->node();
  9177. QDomNodeList childNodes= parentNode.childNodes();
  9178. if(childNodes.size()<row+count)
  9179. {
  9180. return false;
  9181. }
  9182. beginRemoveRows(parent,row,row+count-1);
  9183. QList<QDomElement> removalList;
  9184. for(int i= row;i<row+count;i++)
  9185. {
  9186. removalList.append(childNodes.at(i).toElement());
  9187. }
  9188. QDomElement element;
  9189. QDomElement reference;
  9190. for(int i= 0;i<count;i++)
  9191. {
  9192. element= removalList.at(i);
  9193. if(element.hasAttribute("reference"))
  9194. {
  9195. reference= referenceElement(element.attribute("reference"));
  9196. if(!reference.isNull())
  9197. {
  9198. referenceSection.removeChild(reference);
  9199. }
  9200. }
  9201. parentNode.removeChild(element);
  9202. }
  9203. endRemoveRows();
  9204. beginResetModel();
  9205. delete root;
  9206. root= new DeviceTreeModelNode(treeRoot,0);
  9207. endResetModel();
  9208. return true;
  9209. }
  9210. /*:736*//*737:*/
  9211. #line 15589 "./typica.w"
  9212. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  9213. {
  9214. QDomNodeList childNodes= referenceSection.childNodes();
  9215. QDomElement element;
  9216. for(int i= 0;i<childNodes.size();i++)
  9217. {
  9218. element= childNodes.at(i).toElement();
  9219. if(element.hasAttribute("id"))
  9220. {
  9221. if(element.attribute("id")==id)
  9222. {
  9223. return element;
  9224. }
  9225. }
  9226. }
  9227. return QDomElement();
  9228. }
  9229. /*:737*//*738:*/
  9230. #line 15610 "./typica.w"
  9231. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  9232. {
  9233. return QVariant();
  9234. }
  9235. /*:738*//*739:*/
  9236. #line 15619 "./typica.w"
  9237. DeviceTreeModel::~DeviceTreeModel()
  9238. {
  9239. delete root;
  9240. }
  9241. /*:739*/
  9242. #line 582 "./typica.w"
  9243. /*766:*/
  9244. #line 16119 "./typica.w"
  9245. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  9246. DeviceTreeModel*model,const QModelIndex&index)
  9247. :QWidget(NULL),deviceModel(model),currentNode(index)
  9248. {
  9249. }
  9250. /*:766*//*767:*/
  9251. #line 16131 "./typica.w"
  9252. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  9253. const QString&value)
  9254. {
  9255. QDomElement referenceElement= deviceModel->referenceElement(
  9256. deviceModel->data(currentNode,Qt::UserRole).toString());
  9257. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9258. QDomElement node;
  9259. bool found= false;
  9260. for(int i= 0;i<configData.size();i++)
  9261. {
  9262. node= configData.at(i).toElement();
  9263. if(node.attribute("name")==name)
  9264. {
  9265. node.setAttribute("value",value);
  9266. found= true;
  9267. break;
  9268. }
  9269. }
  9270. if(!found)
  9271. {
  9272. node= AppInstance->deviceConfiguration().createElement("attribute");
  9273. node.setAttribute("name",name);
  9274. node.setAttribute("value",value);
  9275. referenceElement.appendChild(node);
  9276. }
  9277. AppInstance->saveDeviceConfiguration();
  9278. }
  9279. /*:767*//*768:*/
  9280. #line 16165 "./typica.w"
  9281. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  9282. const QString&driver)
  9283. {
  9284. deviceModel->newNode(name,driver,currentNode);
  9285. }
  9286. /*:768*/
  9287. #line 583 "./typica.w"
  9288. /*757:*/
  9289. #line 15963 "./typica.w"
  9290. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  9291. view(new QTreeView),configArea(new QScrollArea)
  9292. {
  9293. QSplitter*splitter= new QSplitter;
  9294. QWidget*leftWidget= new QWidget;
  9295. leftWidget->setMinimumWidth(200);
  9296. QVBoxLayout*left= new QVBoxLayout;
  9297. view->setAnimated(true);
  9298. view->setSelectionMode(QAbstractItemView::SingleSelection);
  9299. document= AppInstance->deviceConfiguration();
  9300. model= new DeviceTreeModel;
  9301. view->setModel(model);
  9302. view->setTextElideMode(Qt::ElideNone);
  9303. view->expandAll();
  9304. view->resizeColumnToContents(0);
  9305. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  9306. QHBoxLayout*treeButtons= new QHBoxLayout;
  9307. QToolButton*addDeviceButton= new QToolButton;
  9308. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  9309. addDeviceButton->setToolTip(tr("New Roaster"));
  9310. connect(addDeviceButton,SIGNAL(clicked()),
  9311. this,SLOT(addDevice()));
  9312. QToolButton*removeNodeButton= new QToolButton;
  9313. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  9314. removeNodeButton->setToolTip(tr("Delete Selection"));
  9315. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  9316. treeButtons->addWidget(addDeviceButton);
  9317. treeButtons->addWidget(removeNodeButton);
  9318. left->addWidget(view);
  9319. left->addLayout(treeButtons);
  9320. leftWidget->setLayout(left);
  9321. splitter->addWidget(leftWidget);
  9322. configArea->setMinimumWidth(580);
  9323. configArea->setMinimumHeight(460);
  9324. configArea->setWidgetResizable(true);
  9325. splitter->addWidget(configArea);
  9326. QVBoxLayout*centralLayout= new QVBoxLayout;
  9327. centralLayout->addWidget(splitter);
  9328. setLayout(centralLayout);
  9329. connect(view,SIGNAL(activated(QModelIndex)),
  9330. this,SLOT(newSelection(QModelIndex)));
  9331. connect(view,SIGNAL(clicked(QModelIndex)),
  9332. this,SLOT(newSelection(QModelIndex)));
  9333. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9334. view,SLOT(expand(QModelIndex)));
  9335. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9336. this,SLOT(resizeColumn()));
  9337. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  9338. this,SLOT(resizeColumn()));
  9339. }
  9340. /*:757*//*758:*/
  9341. #line 16018 "./typica.w"
  9342. void DeviceConfigurationWindow::addDevice()
  9343. {
  9344. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  9345. }
  9346. /*:758*//*759:*/
  9347. #line 16026 "./typica.w"
  9348. void DeviceConfigurationWindow::removeNode()
  9349. {
  9350. QModelIndex index= view->currentIndex();
  9351. if(index.isValid())
  9352. {
  9353. int row= index.row();
  9354. QModelIndex parent= index.parent();
  9355. model->removeRow(row,parent);
  9356. }
  9357. }
  9358. /*:759*//*760:*/
  9359. #line 16042 "./typica.w"
  9360. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  9361. {
  9362. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  9363. if(editor)
  9364. {
  9365. configArea->setWidget(editor);
  9366. editor->show();
  9367. }
  9368. }
  9369. /*:760*//*761:*/
  9370. #line 16059 "./typica.w"
  9371. void DeviceConfigurationWindow::resizeColumn()
  9372. {
  9373. view->resizeColumnToContents(0);
  9374. }
  9375. /*:761*/
  9376. #line 584 "./typica.w"
  9377. /*781:*/
  9378. #line 16540 "./typica.w"
  9379. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  9380. const QModelIndex&index):
  9381. BasicDeviceConfigurationWidget(model,index)
  9382. {
  9383. QFormLayout*layout= new QFormLayout;
  9384. QLineEdit*columnName= new QLineEdit;
  9385. layout->addRow(tr("Column Name:"),columnName);
  9386. QComboBox*typeSelector= new QComboBox;
  9387. typeSelector->addItem("J");
  9388. typeSelector->addItem("K");
  9389. typeSelector->addItem("T");
  9390. typeSelector->addItem("B");
  9391. typeSelector->addItem("E");
  9392. typeSelector->addItem("N");
  9393. typeSelector->addItem("R");
  9394. typeSelector->addItem("S");
  9395. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9396. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  9397. layout->addRow(hideSeries);
  9398. setLayout(layout);
  9399. /*771:*/
  9400. #line 16334 "./typica.w"
  9401. QDomElement referenceElement=
  9402. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9403. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9404. QDomElement node;
  9405. /*:771*/
  9406. #line 16561 "./typica.w"
  9407. for(int i= 0;i<configData.size();i++)
  9408. {
  9409. node= configData.at(i).toElement();
  9410. if(node.attribute("name")=="type")
  9411. {
  9412. typeSelector->setCurrentIndex(
  9413. typeSelector->findText(node.attribute("value")));
  9414. }
  9415. else if(node.attribute("name")=="columnname")
  9416. {
  9417. columnName->setText(node.attribute("value"));
  9418. }
  9419. else if(node.attribute("name")=="hidden")
  9420. {
  9421. hideSeries->setChecked(node.attribute("value")=="true");
  9422. }
  9423. }
  9424. updateThermocoupleType(typeSelector->currentText());
  9425. updateColumnName(columnName->text());
  9426. updateHidden(hideSeries->isChecked());
  9427. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  9428. this,SLOT(updateThermocoupleType(QString)));
  9429. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9430. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9431. }
  9432. /*:781*//*782:*/
  9433. #line 16591 "./typica.w"
  9434. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  9435. {
  9436. updateAttribute("type",type);
  9437. }
  9438. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  9439. {
  9440. updateAttribute("columnname",name);
  9441. }
  9442. void Ni9211TcConfWidget::updateHidden(bool hidden)
  9443. {
  9444. updateAttribute("hidden",hidden?"true":"false");
  9445. }
  9446. /*:782*/
  9447. #line 585 "./typica.w"
  9448. /*777:*/
  9449. #line 16454 "./typica.w"
  9450. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  9451. const QModelIndex&index)
  9452. :BasicDeviceConfigurationWidget(model,index)
  9453. {
  9454. QVBoxLayout*layout= new QVBoxLayout;
  9455. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9456. QLabel*label= new QLabel(tr("Device ID:"));
  9457. QLineEdit*deviceId= new QLineEdit;
  9458. deviceIdLayout->addWidget(label);
  9459. deviceIdLayout->addWidget(deviceId);
  9460. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9461. layout->addLayout(deviceIdLayout);
  9462. layout->addWidget(addChannelButton);
  9463. /*771:*/
  9464. #line 16334 "./typica.w"
  9465. QDomElement referenceElement=
  9466. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9467. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9468. QDomElement node;
  9469. /*:771*/
  9470. #line 16468 "./typica.w"
  9471. for(int i= 0;i<configData.size();i++)
  9472. {
  9473. node= configData.at(i).toElement();
  9474. if(node.attribute("name")=="deviceID")
  9475. {
  9476. deviceId->setText(node.attribute("value","Dev1"));
  9477. break;
  9478. }
  9479. }
  9480. updateDeviceId(deviceId->text());
  9481. connect(addChannelButton,SIGNAL(clicked()),
  9482. this,SLOT(addChannel()));
  9483. connect(deviceId,SIGNAL(textEdited(QString)),
  9484. this,SLOT(updateDeviceId(QString)));
  9485. setLayout(layout);
  9486. }
  9487. /*:777*//*778:*/
  9488. #line 16490 "./typica.w"
  9489. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  9490. {
  9491. updateAttribute("deviceID",newId);
  9492. }
  9493. /*:778*//*779:*/
  9494. #line 16498 "./typica.w"
  9495. void NiDaqMxBase9211ConfWidget::addChannel()
  9496. {
  9497. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9498. }
  9499. /*:779*/
  9500. #line 586 "./typica.w"
  9501. /*775:*/
  9502. #line 16405 "./typica.w"
  9503. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  9504. DeviceTreeModel*model,const QModelIndex&index):
  9505. BasicDeviceConfigurationWidget(model,index)
  9506. {
  9507. QHBoxLayout*layout= new QHBoxLayout;
  9508. QToolButton*addDeviceButton= new QToolButton;
  9509. addDeviceButton->setText(tr("Add Device"));
  9510. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  9511. "nidaqmxbase9211series");
  9512. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9513. "nidaqmxbase9211series");
  9514. connect(add9211,SIGNAL(triggered(QString,QString)),
  9515. this,SLOT(insertChildNode(QString,QString)));
  9516. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9517. this,SLOT(insertChildNode(QString,QString)));
  9518. QMenu*deviceMenu= new QMenu;
  9519. deviceMenu->addAction(add9211);
  9520. deviceMenu->addAction(add9211a);
  9521. addDeviceButton->setMenu(deviceMenu);
  9522. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9523. layout->addWidget(addDeviceButton);
  9524. setLayout(layout);
  9525. }
  9526. /*:775*/
  9527. #line 587 "./typica.w"
  9528. /*642:*/
  9529. #line 13879 "./typica.w"
  9530. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  9531. QObject*parent):
  9532. QAction(reportName,parent),reportFile(fileName)
  9533. {
  9534. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  9535. }
  9536. /*:642*//*643:*/
  9537. #line 13895 "./typica.w"
  9538. void ReportAction::createReport()
  9539. {
  9540. QFile file(reportFile);
  9541. QDomDocument document;
  9542. if(file.open(QIODevice::ReadOnly))
  9543. {
  9544. document.setContent(&file,true);
  9545. QDomElement element= document.documentElement();
  9546. QScriptEngine*engine= AppInstance->engine;
  9547. QScriptContext*context= engine->pushContext();
  9548. QScriptValue object;
  9549. QString targetID= reportFile;
  9550. /*198:*/
  9551. #line 4629 "./typica.w"
  9552. ScriptQMainWindow*window= new ScriptQMainWindow;
  9553. window->setObjectName(targetID);
  9554. object= engine->newQObject(window);
  9555. setQMainWindowProperties(object,engine);
  9556. QWidget*central= new(QWidget);
  9557. central->setParent(window);
  9558. central->setObjectName("centralWidget");
  9559. window->setCentralWidget(central);
  9560. if(element.hasChildNodes())
  9561. {
  9562. /*199:*/
  9563. #line 4664 "./typica.w"
  9564. QStack<QWidget*> widgetStack;
  9565. QStack<QLayout*> layoutStack;
  9566. QString windowScript;
  9567. widgetStack.push(central);
  9568. QDomNodeList windowChildren= element.childNodes();
  9569. int i= 0;
  9570. while(i<windowChildren.count())
  9571. {
  9572. QDomNode current;
  9573. QDomElement element;
  9574. current= windowChildren.at(i);
  9575. if(current.isElement())
  9576. {
  9577. element= current.toElement();
  9578. if(element.tagName()=="program")
  9579. {
  9580. windowScript.append(element.text());
  9581. }
  9582. else if(element.tagName()=="layout")
  9583. {
  9584. element.setAttribute("trcontext","configuration");
  9585. addLayoutToWidget(element,&widgetStack,&layoutStack);
  9586. }
  9587. else if(element.tagName()=="menu")
  9588. {
  9589. /*200:*/
  9590. #line 4712 "./typica.w"
  9591. QMenuBar*bar= window->menuBar();
  9592. bar->setParent(window);
  9593. bar->setObjectName("menuBar");
  9594. if(element.hasAttribute("name"))
  9595. {
  9596. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  9597. element.attribute("name").toUtf8().data()));
  9598. menu->setParent(bar);
  9599. if(element.hasAttribute("type"))
  9600. {
  9601. if(element.attribute("type")=="reports")
  9602. {
  9603. if(element.hasAttribute("src"))
  9604. {
  9605. /*640:*/
  9606. #line 13839 "./typica.w"
  9607. QSettings settings;
  9608. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  9609. toString()).
  9610. arg(element.attribute("src"));
  9611. QDir::addSearchPath("reports",reportDirectory);
  9612. QDir directory(reportDirectory);
  9613. directory.setFilter(QDir::Files);
  9614. directory.setSorting(QDir::Name);
  9615. QStringList nameFilter;
  9616. nameFilter<<"*.xml";
  9617. directory.setNameFilters(nameFilter);
  9618. QFileInfoList reportFiles= directory.entryInfoList();
  9619. for(int i= 0;i<reportFiles.size();i++)
  9620. {
  9621. QFileInfo reportFile= reportFiles.at(i);
  9622. /*644:*/
  9623. #line 13919 "./typica.w"
  9624. QString path= reportFile.absoluteFilePath();
  9625. QFile file(path);
  9626. if(file.open(QIODevice::ReadOnly))
  9627. {
  9628. QDomDocument document;
  9629. document.setContent(&file,true);
  9630. QDomElement root= document.documentElement();
  9631. QString translationContext= root.attribute("id");
  9632. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  9633. if(!titleNode.isNull())
  9634. {
  9635. QDomElement titleElement= titleNode.toElement();
  9636. QString title= QCoreApplication::translate("configuration",
  9637. titleElement.text().toUtf8().data());
  9638. if(!title.isEmpty())
  9639. {
  9640. QStringList hierarchy= title.split(":->");
  9641. QMenu*insertionPoint= menu;
  9642. /*645:*/
  9643. #line 13948 "./typica.w"
  9644. for(int j= 0;j<hierarchy.size()-1;j++)
  9645. {
  9646. QObjectList menuList= insertionPoint->children();
  9647. bool menuFound= false;
  9648. for(int k= 0;k<menuList.size();k++)
  9649. {
  9650. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  9651. if(currentItem)
  9652. {
  9653. if(currentItem->title()==hierarchy.at(j))
  9654. {
  9655. menuFound= true;
  9656. insertionPoint= currentItem;
  9657. break;
  9658. }
  9659. }
  9660. }
  9661. if(!menuFound)
  9662. {
  9663. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  9664. }
  9665. }
  9666. /*:645*/
  9667. #line 13938 "./typica.w"
  9668. ReportAction*action= new ReportAction(path,hierarchy.last());
  9669. insertionPoint->addAction(action);
  9670. }
  9671. }
  9672. }
  9673. /*:644*/
  9674. #line 13855 "./typica.w"
  9675. }
  9676. /*:640*/
  9677. #line 4727 "./typica.w"
  9678. }
  9679. }
  9680. }
  9681. if(element.hasChildNodes())
  9682. {
  9683. /*201:*/
  9684. #line 4740 "./typica.w"
  9685. QDomNodeList menuItems= element.childNodes();
  9686. int j= 0;
  9687. while(j<menuItems.count())
  9688. {
  9689. QDomNode item= menuItems.at(j);
  9690. if(item.isElement())
  9691. {
  9692. QDomElement itemElement= item.toElement();
  9693. if(itemElement.tagName()=="item")
  9694. {
  9695. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  9696. itemElement.text().toUtf8().data()),menu);
  9697. if(itemElement.hasAttribute("id"))
  9698. {
  9699. itemAction->setObjectName(itemElement.attribute("id"));
  9700. }
  9701. if(itemElement.hasAttribute("shortcut"))
  9702. {
  9703. itemAction->setShortcut(itemElement.attribute("shortcut"));
  9704. }
  9705. menu->addAction(itemAction);
  9706. }
  9707. else if(itemElement.tagName()=="separator")
  9708. {
  9709. menu->addSeparator();
  9710. }
  9711. }
  9712. j++;
  9713. }
  9714. #line 1 "./helpmenu.w"
  9715. /*:201*/
  9716. #line 4733 "./typica.w"
  9717. }
  9718. }
  9719. /*:200*/
  9720. #line 4690 "./typica.w"
  9721. }
  9722. }
  9723. i++;
  9724. }
  9725. QScriptValue oldThis= context->thisObject();
  9726. context->setThisObject(object);
  9727. QScriptValue result= engine->evaluate(windowScript);
  9728. /*192:*/
  9729. #line 4446 "./typica.w"
  9730. if(engine->hasUncaughtException())
  9731. {
  9732. int line= engine->uncaughtExceptionLineNumber();
  9733. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  9734. result.toString();
  9735. QString trace;
  9736. foreach(trace,engine->uncaughtExceptionBacktrace())
  9737. {
  9738. qDebug()<<trace;
  9739. }
  9740. }
  9741. /*:192*/
  9742. #line 4698 "./typica.w"
  9743. context->setThisObject(oldThis);
  9744. /*:199*/
  9745. #line 4640 "./typica.w"
  9746. }
  9747. /*202:*/
  9748. #line 9 "./helpmenu.w"
  9749. HelpMenu*helpMenu= new HelpMenu();
  9750. window->menuBar()->addMenu(helpMenu);
  9751. /*:202*/
  9752. #line 4642 "./typica.w"
  9753. window->show();
  9754. /*:198*/
  9755. #line 13908 "./typica.w"
  9756. file.close();
  9757. engine->popContext();
  9758. }
  9759. }
  9760. /*:643*/
  9761. #line 588 "./typica.w"
  9762. /*241:*/
  9763. #line 5826 "./typica.w"
  9764. NumericDelegate::NumericDelegate(QObject*parent):
  9765. QItemDelegate(parent)
  9766. {
  9767. }
  9768. /*:241*//*242:*/
  9769. #line 5838 "./typica.w"
  9770. void NumericDelegate::setEditorData(QWidget*editor,
  9771. const QModelIndex&index)const
  9772. {
  9773. QString value= index.model()->data(index,Qt::EditRole).toString();
  9774. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9775. line->setText(value);
  9776. }
  9777. /*:242*//*243:*/
  9778. #line 5853 "./typica.w"
  9779. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  9780. const QModelIndex&index)const
  9781. {
  9782. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9783. model->setData(index,line->text(),Qt::EditRole);
  9784. QScriptEngine*engine= AppInstance->engine;
  9785. engine->pushContext();
  9786. QString script= QString("Number(%1)").arg(line->text());
  9787. QScriptValue result= engine->evaluate(line->text());
  9788. if(result.isNumber())
  9789. {
  9790. model->setData(index,result.toVariant(),Qt::DisplayRole);
  9791. }
  9792. else
  9793. {
  9794. model->setData(index,QVariant(),Qt::DisplayRole);
  9795. }
  9796. engine->popContext();
  9797. }
  9798. /*:243*//*244:*/
  9799. #line 5876 "./typica.w"
  9800. QWidget*NumericDelegate::createEditor(QWidget*parent,
  9801. const QStyleOptionViewItem&,
  9802. const QModelIndex&)const
  9803. {
  9804. return(new QLineEdit(parent));
  9805. }
  9806. /*:244*//*245:*/
  9807. #line 5887 "./typica.w"
  9808. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  9809. const QStyleOptionViewItem&option,
  9810. const QModelIndex&)const
  9811. {
  9812. editor->setGeometry(option.rect);
  9813. }
  9814. /*:245*/
  9815. #line 589 "./typica.w"
  9816. /*786:*/
  9817. #line 16650 "./typica.w"
  9818. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  9819. const QModelIndex&index)
  9820. :BasicDeviceConfigurationWidget(model,index)
  9821. {
  9822. QHBoxLayout*layout= new QHBoxLayout;
  9823. QToolButton*addDeviceButton= new QToolButton;
  9824. addDeviceButton->setText(tr("Add Device"));
  9825. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9826. "nidaqmx9211series");
  9827. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  9828. "nidaqmxtc01");
  9829. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9830. this,SLOT(insertChildNode(QString,QString)));
  9831. connect(addtc01,SIGNAL(triggered(QString,QString)),
  9832. this,SLOT(insertChildNode(QString,QString)));
  9833. QMenu*deviceMenu= new QMenu;
  9834. deviceMenu->addAction(add9211a);
  9835. deviceMenu->addAction(addtc01);
  9836. addDeviceButton->setMenu(deviceMenu);
  9837. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9838. layout->addWidget(addDeviceButton);
  9839. setLayout(layout);
  9840. }
  9841. /*:786*/
  9842. #line 590 "./typica.w"
  9843. /*788:*/
  9844. #line 16699 "./typica.w"
  9845. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  9846. const QModelIndex&index)
  9847. :BasicDeviceConfigurationWidget(model,index)
  9848. {
  9849. QVBoxLayout*layout= new QVBoxLayout;
  9850. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9851. QLabel*label= new QLabel(tr("Device ID:"));
  9852. QLineEdit*deviceId= new QLineEdit;
  9853. deviceIdLayout->addWidget(label);
  9854. deviceIdLayout->addWidget(deviceId);
  9855. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9856. layout->addLayout(deviceIdLayout);
  9857. layout->addWidget(addChannelButton);
  9858. /*771:*/
  9859. #line 16334 "./typica.w"
  9860. QDomElement referenceElement=
  9861. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9862. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9863. QDomElement node;
  9864. /*:771*/
  9865. #line 16713 "./typica.w"
  9866. for(int i= 0;i<configData.size();i++)
  9867. {
  9868. node= configData.at(i).toElement();
  9869. if(node.attribute("name")=="deviceID")
  9870. {
  9871. deviceId->setText(node.attribute("value","Dev1"));
  9872. break;
  9873. }
  9874. }
  9875. updateDeviceId(deviceId->text());
  9876. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  9877. connect(deviceId,SIGNAL(textEdited(QString)),
  9878. this,SLOT(updateDeviceId(QString)));
  9879. setLayout(layout);
  9880. }
  9881. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  9882. {
  9883. updateAttribute("deviceID",newId);
  9884. }
  9885. void NiDaqMx9211ConfWidget::addChannel()
  9886. {
  9887. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9888. }
  9889. /*:788*/
  9890. #line 591 "./typica.w"
  9891. /*790:*/
  9892. #line 16764 "./typica.w"
  9893. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  9894. const QModelIndex&index)
  9895. :BasicDeviceConfigurationWidget(model,index)
  9896. {
  9897. QFormLayout*layout= new QFormLayout;
  9898. QLineEdit*deviceId= new QLineEdit;
  9899. layout->addRow(tr("Device ID:"),deviceId);
  9900. QLineEdit*columnName= new QLineEdit;
  9901. layout->addRow(tr("Column Name:"),columnName);
  9902. QComboBox*typeSelector= new QComboBox;
  9903. typeSelector->addItem("J");
  9904. typeSelector->addItem("K");
  9905. typeSelector->addItem("T");
  9906. typeSelector->addItem("B");
  9907. typeSelector->addItem("E");
  9908. typeSelector->addItem("N");
  9909. typeSelector->addItem("R");
  9910. typeSelector->addItem("S");
  9911. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9912. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  9913. layout->addRow(hideSeries);
  9914. /*771:*/
  9915. #line 16334 "./typica.w"
  9916. QDomElement referenceElement=
  9917. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9918. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9919. QDomElement node;
  9920. /*:771*/
  9921. #line 16786 "./typica.w"
  9922. for(int i= 0;i<configData.size();i++)
  9923. {
  9924. node= configData.at(i).toElement();
  9925. if(node.attribute("name")=="deviceID")
  9926. {
  9927. deviceId->setText(node.attribute("value"));
  9928. }
  9929. else if(node.attribute("name")=="type")
  9930. {
  9931. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  9932. }
  9933. else if(node.attribute("name")=="columnname")
  9934. {
  9935. columnName->setText(node.attribute("value"));
  9936. }
  9937. else if(node.attribute("name")=="hidden")
  9938. {
  9939. hideSeries->setChecked(node.attribute("value")=="true");
  9940. }
  9941. }
  9942. updateDeviceId(deviceId->text());
  9943. updateThermocoupleType(typeSelector->currentText());
  9944. updateColumnName(columnName->text());
  9945. updateHidden(hideSeries->isChecked());
  9946. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  9947. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  9948. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9949. setLayout(layout);
  9950. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9951. }
  9952. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  9953. {
  9954. updateAttribute("deviceID",newId);
  9955. }
  9956. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  9957. {
  9958. updateAttribute("type",type);
  9959. }
  9960. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  9961. {
  9962. updateAttribute("columnname",name);
  9963. }
  9964. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  9965. {
  9966. updateAttribute("hidden",hidden?"true":"false");
  9967. }
  9968. /*:790*/
  9969. #line 592 "./typica.w"
  9970. /*808:*/
  9971. #line 17202 "./typica.w"
  9972. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  9973. const QModelIndex&index)
  9974. :BasicDeviceConfigurationWidget(model,index)
  9975. {
  9976. QFormLayout*layout= new QFormLayout;
  9977. QToolButton*addDeviceButton= new QToolButton;
  9978. addDeviceButton->setText(tr("Add Device"));
  9979. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  9980. "Modbus RTU Device",
  9981. "modbusrtudevice");
  9982. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  9983. this,SLOT(insertChildNode(QString,QString)));
  9984. QMenu*deviceMenu= new QMenu;
  9985. deviceMenu->addAction(addModbusRtuDevice);
  9986. addDeviceButton->setMenu(deviceMenu);
  9987. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9988. layout->addRow(QString(),addDeviceButton);
  9989. PortSelector*port= new PortSelector;
  9990. layout->addRow(tr("Port:"),port);
  9991. connect(port,SIGNAL(currentIndexChanged(QString)),
  9992. this,SLOT(updatePort(QString)));
  9993. connect(port,SIGNAL(editTextChanged(QString)),
  9994. this,SLOT(updatePort(QString)));
  9995. BaudSelector*rate= new BaudSelector;
  9996. layout->addRow(tr("Baud:"),rate);
  9997. connect(rate,SIGNAL(currentIndexChanged(QString)),
  9998. this,SLOT(updateBaudRate(QString)));
  9999. ParitySelector*parity= new ParitySelector;
  10000. layout->addRow(tr("Parity:"),parity);
  10001. connect(parity,SIGNAL(currentIndexChanged(QString)),
  10002. this,SLOT(updateParity(QString)));
  10003. FlowSelector*flow= new FlowSelector;
  10004. layout->addRow(tr("Flow Control:"),flow);
  10005. connect(flow,SIGNAL(currentIndexChanged(QString)),
  10006. this,SLOT(updateFlowControl(QString)));
  10007. StopSelector*stop= new StopSelector;
  10008. layout->addRow(tr("Stop Bits:"),stop);
  10009. connect(stop,SIGNAL(currentIndexChanged(QString)),
  10010. this,SLOT(updateStopBits(QString)));
  10011. /*771:*/
  10012. #line 16334 "./typica.w"
  10013. QDomElement referenceElement=
  10014. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10015. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10016. QDomElement node;
  10017. /*:771*/
  10018. #line 17242 "./typica.w"
  10019. for(int i= 0;i<configData.size();i++)
  10020. {
  10021. node= configData.at(i).toElement();
  10022. if(node.attribute("name")=="port")
  10023. {
  10024. int j= port->findText(node.attribute("value"));
  10025. if(j>=0)
  10026. {
  10027. port->setCurrentIndex(j);
  10028. }
  10029. else
  10030. {
  10031. port->insertItem(0,node.attribute("value"));
  10032. port->setCurrentIndex(0);
  10033. }
  10034. }
  10035. else if(node.attribute("name")=="baudrate")
  10036. {
  10037. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  10038. }
  10039. else if(node.attribute("name")=="parity")
  10040. {
  10041. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  10042. }
  10043. else if(node.attribute("name")=="flowcontrol")
  10044. {
  10045. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  10046. }
  10047. else if(node.attribute("name")=="stopbits")
  10048. {
  10049. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  10050. }
  10051. }
  10052. updatePort(port->currentText());
  10053. updateBaudRate(rate->currentText());
  10054. updateParity(parity->currentText());
  10055. updateFlowControl(flow->currentText());
  10056. updateStopBits(stop->currentText());
  10057. setLayout(layout);
  10058. }
  10059. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  10060. {
  10061. updateAttribute("port",newPort);
  10062. }
  10063. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  10064. {
  10065. updateAttribute("baudrate",newRate);
  10066. }
  10067. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  10068. {
  10069. updateAttribute("parity",newParity);
  10070. }
  10071. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  10072. {
  10073. updateAttribute("flowcontrol",newFlow);
  10074. }
  10075. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  10076. {
  10077. updateAttribute("stopbits",newStopBits);
  10078. }
  10079. /*:808*/
  10080. #line 593 "./typica.w"
  10081. /*810:*/
  10082. #line 17365 "./typica.w"
  10083. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  10084. const QModelIndex&index)
  10085. :BasicDeviceConfigurationWidget(model,index),
  10086. unitSpecificationLayout(new QStackedLayout),
  10087. decimalSpecificationLayout(new QStackedLayout)
  10088. {
  10089. QVBoxLayout*layout= new QVBoxLayout;
  10090. QToolButton*addChannelButton= new QToolButton;
  10091. addChannelButton->setText(tr("Add Channel"));
  10092. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  10093. "Temperature Process Value",
  10094. "modbustemperaturepv");
  10095. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  10096. "Temperature Set Value",
  10097. "modbustemperaturesv");
  10098. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  10099. this,SLOT(insertChildNode(QString,QString)));
  10100. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  10101. this,SLOT(insertChildNode(QString,QString)));
  10102. QMenu*channelMenu= new QMenu;
  10103. channelMenu->addAction(addTemperaturePV);
  10104. channelMenu->addAction(addTemperatureSV);
  10105. addChannelButton->setMenu(channelMenu);
  10106. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  10107. layout->addWidget(addChannelButton);
  10108. QHBoxLayout*stationLayout= new QHBoxLayout;
  10109. QLabel*stationLabel= new QLabel(tr("Station:"));
  10110. QSpinBox*stationNumber= new QSpinBox;
  10111. stationNumber->setMinimum(0);
  10112. stationNumber->setMaximum(255);
  10113. stationLayout->addWidget(stationLabel);
  10114. stationLayout->addWidget(stationNumber);
  10115. layout->addLayout(stationLayout);
  10116. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  10117. layout->addWidget(fixedUnit);
  10118. QWidget*fixedUnitPlaceholder= new QWidget(this);
  10119. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  10120. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  10121. QComboBox*fixedUnitSelector= new QComboBox;
  10122. fixedUnitSelector->addItem("Fahrenheit");
  10123. fixedUnitSelector->addItem("Celsius");
  10124. fixedUnitLayout->addWidget(fixedUnitLabel);
  10125. fixedUnitLayout->addWidget(fixedUnitSelector);
  10126. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  10127. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  10128. QWidget*queriedUnitPlaceholder= new QWidget(this);
  10129. QFormLayout*queriedUnitLayout= new QFormLayout;
  10130. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  10131. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  10132. QSpinBox*valueF= new QSpinBox;
  10133. valueF->setMinimum(0);
  10134. valueF->setMaximum(65535);
  10135. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  10136. QSpinBox*valueC= new QSpinBox;
  10137. valueC->setMinimum(0);
  10138. valueC->setMaximum(65535);
  10139. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  10140. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  10141. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  10142. layout->addLayout(unitSpecificationLayout);
  10143. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  10144. layout->addWidget(fixedPrecision);
  10145. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  10146. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  10147. QSpinBox*fixedPrecisionValue= new QSpinBox;
  10148. fixedPrecisionValue->setMinimum(0);
  10149. fixedPrecisionValue->setMaximum(9);
  10150. fixedPrecisionLayout->addRow("Places after the decimal point:",
  10151. fixedPrecisionValue);
  10152. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  10153. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  10154. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  10155. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  10156. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  10157. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  10158. precisionAddress);
  10159. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  10160. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  10161. layout->addLayout(decimalSpecificationLayout);
  10162. /*771:*/
  10163. #line 16334 "./typica.w"
  10164. QDomElement referenceElement=
  10165. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10166. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10167. QDomElement node;
  10168. /*:771*/
  10169. #line 17445 "./typica.w"
  10170. for(int i= 0;i<configData.size();i++)
  10171. {
  10172. node= configData.at(i).toElement();
  10173. if(node.attribute("name")=="station")
  10174. {
  10175. stationNumber->setValue(node.attribute("value").toInt());
  10176. }
  10177. else if(node.attribute("name")=="fixedunit")
  10178. {
  10179. if(node.attribute("value")=="true")
  10180. {
  10181. fixedUnit->setCheckState(Qt::Checked);
  10182. }
  10183. else if(node.attribute("value")=="false")
  10184. {
  10185. fixedUnit->setCheckState(Qt::Unchecked);
  10186. }
  10187. }
  10188. else if(node.attribute("name")=="fixedprecision")
  10189. {
  10190. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10191. }
  10192. else if(node.attribute("name")=="unit")
  10193. {
  10194. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  10195. }
  10196. else if(node.attribute("name")=="unitaddress")
  10197. {
  10198. unitAddress->setValue(node.attribute("value").toInt());
  10199. }
  10200. else if(node.attribute("name")=="fvalue")
  10201. {
  10202. valueF->setValue(node.attribute("value").toInt());
  10203. }
  10204. else if(node.attribute("name")=="cvalue")
  10205. {
  10206. valueC->setValue(node.attribute("value").toInt());
  10207. }
  10208. else if(node.attribute("name")=="precisionaddress")
  10209. {
  10210. precisionAddress->setValue(node.attribute("value").toInt());
  10211. }
  10212. else if(node.attribute("name")=="precision")
  10213. {
  10214. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10215. }
  10216. }
  10217. updateStationNumber(stationNumber->value());
  10218. updateFixedUnit(fixedUnit->isChecked());
  10219. updateFixedDecimal(fixedPrecision->isChecked());
  10220. updateUnit(fixedUnitSelector->currentText());
  10221. updateUnitAddress(unitAddress->value());
  10222. updateValueF(valueF->value());
  10223. updateValueC(valueC->value());
  10224. updatePrecisionAddress(precisionAddress->value());
  10225. updatePrecisionValue(fixedPrecisionValue->value());
  10226. connect(stationNumber,SIGNAL(valueChanged(int)),
  10227. this,SLOT(updateStationNumber(int)));
  10228. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  10229. this,SLOT(updateUnit(QString)));
  10230. connect(unitAddress,SIGNAL(valueChanged(int)),
  10231. this,SLOT(updateUnitAddress(int)));
  10232. connect(valueF,SIGNAL(valueChanged(int)),
  10233. this,SLOT(updateValueF(int)));
  10234. connect(valueC,SIGNAL(valueChanged(int)),
  10235. this,SLOT(updateValueC(int)));
  10236. connect(fixedUnit,SIGNAL(toggled(bool)),
  10237. this,SLOT(updateFixedUnit(bool)));
  10238. connect(fixedPrecision,SIGNAL(toggled(bool)),
  10239. this,SLOT(updateFixedDecimal(bool)));
  10240. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  10241. this,SLOT(updatePrecisionValue(int)));
  10242. connect(precisionAddress,SIGNAL(valueChanged(int)),
  10243. this,SLOT(updatePrecisionAddress(int)));
  10244. setLayout(layout);
  10245. }
  10246. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  10247. {
  10248. updateAttribute("station",QString("%1").arg(newStation));
  10249. }
  10250. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  10251. {
  10252. if(newFixed)
  10253. {
  10254. unitSpecificationLayout->setCurrentIndex(0);
  10255. updateAttribute("fixedunit","true");
  10256. }
  10257. else
  10258. {
  10259. unitSpecificationLayout->setCurrentIndex(1);
  10260. updateAttribute("fixedunit","false");
  10261. }
  10262. }
  10263. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  10264. {
  10265. if(newFixed)
  10266. {
  10267. decimalSpecificationLayout->setCurrentIndex(0);
  10268. updateAttribute("fixedprecision","true");
  10269. }
  10270. else
  10271. {
  10272. decimalSpecificationLayout->setCurrentIndex(1);
  10273. updateAttribute("fixedprecision","false");
  10274. }
  10275. }
  10276. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  10277. {
  10278. updateAttribute("unit",newUnit);
  10279. }
  10280. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  10281. {
  10282. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  10283. }
  10284. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  10285. {
  10286. updateAttribute("fvalue",QString("%1").arg(newValue));
  10287. }
  10288. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  10289. {
  10290. updateAttribute("cvalue",QString("%1").arg(newValue));
  10291. }
  10292. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  10293. {
  10294. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  10295. }
  10296. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  10297. {
  10298. updateAttribute("precision",QString("%1").arg(newValue));
  10299. }
  10300. /*:810*/
  10301. #line 594 "./typica.w"
  10302. /*812:*/
  10303. #line 17608 "./typica.w"
  10304. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  10305. const QModelIndex&index)
  10306. :BasicDeviceConfigurationWidget(model,index)
  10307. {
  10308. QFormLayout*layout= new QFormLayout;
  10309. ShortHexSpinBox*address= new ShortHexSpinBox;
  10310. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  10311. /*771:*/
  10312. #line 16334 "./typica.w"
  10313. QDomElement referenceElement=
  10314. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10315. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10316. QDomElement node;
  10317. /*:771*/
  10318. #line 17616 "./typica.w"
  10319. for(int i= 0;i<configData.size();i++)
  10320. {
  10321. node= configData.at(i).toElement();
  10322. if(node.attribute("name")=="address")
  10323. {
  10324. address->setValue(node.attribute("value").toInt());
  10325. break;
  10326. }
  10327. }
  10328. updateAddress(address->value());
  10329. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  10330. setLayout(layout);
  10331. }
  10332. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  10333. {
  10334. updateAttribute("address",QString("%1").arg(newAddress));
  10335. }
  10336. /*:812*/
  10337. #line 595 "./typica.w"
  10338. /*814:*/
  10339. #line 17664 "./typica.w"
  10340. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  10341. const QModelIndex&index)
  10342. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  10343. {
  10344. QVBoxLayout*layout= new QVBoxLayout;
  10345. QFormLayout*addressLayout= new QFormLayout;
  10346. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  10347. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  10348. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  10349. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  10350. layout->addLayout(addressLayout);
  10351. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  10352. layout->addWidget(fixedRange);
  10353. QWidget*queriedRangePlaceholder= new QWidget(this);
  10354. QFormLayout*queriedRangeLayout= new QFormLayout;
  10355. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  10356. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  10357. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  10358. lowerAddress);
  10359. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  10360. upperAddress);
  10361. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  10362. boundsLayout->addWidget(queriedRangePlaceholder);
  10363. QWidget*fixedRangePlaceholder= new QWidget(this);
  10364. QFormLayout*fixedRangeLayout= new QFormLayout;
  10365. QLineEdit*fixedLower= new QLineEdit;
  10366. QLineEdit*fixedUpper= new QLineEdit;
  10367. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  10368. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  10369. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  10370. boundsLayout->addWidget(fixedRangePlaceholder);
  10371. layout->addLayout(boundsLayout);
  10372. /*771:*/
  10373. #line 16334 "./typica.w"
  10374. QDomElement referenceElement=
  10375. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10376. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10377. QDomElement node;
  10378. /*:771*/
  10379. #line 17697 "./typica.w"
  10380. for(int i= 0;i<configData.size();i++)
  10381. {
  10382. node= configData.at(i).toElement();
  10383. if(node.attribute("name")=="readaddress")
  10384. {
  10385. readAddress->setValue(node.attribute("value").toInt());
  10386. }
  10387. else if(node.attribute("name")=="writeaddress")
  10388. {
  10389. writeAddress->setValue(node.attribute("value").toInt());
  10390. }
  10391. else if(node.attribute("name")=="fixedrange")
  10392. {
  10393. if(node.attribute("value")=="true")
  10394. {
  10395. fixedRange->setCheckState(Qt::Checked);
  10396. }
  10397. else if(node.attribute("value")=="false")
  10398. {
  10399. fixedRange->setCheckState(Qt::Unchecked);
  10400. }
  10401. }
  10402. else if(node.attribute("name")=="fixedlower")
  10403. {
  10404. fixedLower->setText(node.attribute("value"));
  10405. }
  10406. else if(node.attribute("name")=="fixedupper")
  10407. {
  10408. fixedUpper->setText(node.attribute("value"));
  10409. }
  10410. else if(node.attribute("name")=="loweraddress")
  10411. {
  10412. lowerAddress->setValue(node.attribute("value").toInt());
  10413. }
  10414. else if(node.attribute("name")=="upperaddress")
  10415. {
  10416. upperAddress->setValue(node.attribute("value").toInt());
  10417. }
  10418. }
  10419. updateReadAddress(readAddress->value());
  10420. updateWriteAddress(writeAddress->value());
  10421. updateFixedRange(fixedRange->isChecked());
  10422. updateLower(fixedLower->text());
  10423. updateUpper(fixedUpper->text());
  10424. updateLowerAddress(lowerAddress->value());
  10425. updateUpperAddress(upperAddress->value());
  10426. connect(readAddress,SIGNAL(valueChanged(int)),
  10427. this,SLOT(updateReadAddress(int)));
  10428. connect(writeAddress,SIGNAL(valueChanged(int)),
  10429. this,SLOT(updateWriteAddress(int)));
  10430. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  10431. connect(fixedLower,SIGNAL(textChanged(QString)),
  10432. this,SLOT(updateLower(QString)));
  10433. connect(fixedUpper,SIGNAL(textChanged(QString)),
  10434. this,SLOT(updateUpper(QString)));
  10435. connect(lowerAddress,SIGNAL(valueChanged(int)),
  10436. this,SLOT(updateLowerAddress(int)));
  10437. connect(upperAddress,SIGNAL(valueChanged(int)),
  10438. this,SLOT(updateUpperAddress(int)));
  10439. setLayout(layout);
  10440. }
  10441. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  10442. {
  10443. updateAttribute("readaddress",QString("%1").arg(newAddress));
  10444. }
  10445. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  10446. {
  10447. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  10448. }
  10449. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  10450. {
  10451. if(fixed)
  10452. {
  10453. updateAttribute("fixedrange","true");
  10454. boundsLayout->setCurrentIndex(1);
  10455. }
  10456. else
  10457. {
  10458. updateAttribute("fixedrange","false");
  10459. boundsLayout->setCurrentIndex(0);
  10460. }
  10461. }
  10462. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  10463. {
  10464. updateAttribute("fixedlower",lower);
  10465. }
  10466. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  10467. {
  10468. updateAttribute("fixedupper",upper);
  10469. }
  10470. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  10471. {
  10472. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  10473. }
  10474. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  10475. {
  10476. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  10477. }
  10478. /*:814*/
  10479. #line 596 "./typica.w"
  10480. /*770:*/
  10481. #line 16204 "./typica.w"
  10482. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10483. :BasicDeviceConfigurationWidget(model,index)
  10484. {
  10485. QVBoxLayout*layout= new QVBoxLayout;
  10486. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  10487. QMenu*deviceMenu= new QMenu;
  10488. NodeInserter*insertAction;
  10489. foreach(insertAction,AppInstance->topLevelNodeInserters)
  10490. {
  10491. connect(insertAction,SIGNAL(triggered(QString,QString)),
  10492. this,SLOT(insertChildNode(QString,QString)));
  10493. deviceMenu->addAction(insertAction);
  10494. }
  10495. addDeviceButton->setMenu(deviceMenu);
  10496. layout->addWidget(addDeviceButton);
  10497. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  10498. QMenu*annotationMenu= new QMenu;
  10499. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  10500. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  10501. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  10502. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  10503. tr("Free Text"),
  10504. "freeannotation");
  10505. annotationMenu->addAction(basicButtonInserter);
  10506. annotationMenu->addAction(countingButtonInserter);
  10507. annotationMenu->addAction(spinBoxInserter);
  10508. annotationMenu->addAction(freeAnnotationInserter);
  10509. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  10510. this,SLOT(insertChildNode(QString,QString)));
  10511. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  10512. this,SLOT(insertChildNode(QString,QString)));
  10513. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  10514. this,SLOT(insertChildNode(QString,QString)));
  10515. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10516. this,SLOT(insertChildNode(QString,QString)));
  10517. /*1033:*/
  10518. #line 144 "./valueannotation.w"
  10519. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  10520. tr("Value Annotation"),
  10521. "valueannotation");
  10522. annotationMenu->addAction(valueAnnotationInserter);
  10523. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10524. this,SLOT(insertChildNode(QString,QString)));
  10525. /*:1033*/
  10526. #line 16240 "./typica.w"
  10527. addAnnotationControlButton->setMenu(annotationMenu);
  10528. layout->addWidget(addAnnotationControlButton);
  10529. QPushButton*timersButton= new QPushButton(tr("Extra Timers"));
  10530. QMenu*timersMenu= new QMenu;
  10531. NodeInserter*coolingTimerInserter= new NodeInserter(tr("Cooling Timer"),tr("Cooling Timer"),"coolingtimer");
  10532. NodeInserter*rangeTimerInserter= new NodeInserter(tr("Range Timer"),tr("Range Timer"),"rangetimer");
  10533. NodeInserter*multirangeTimerInserter= new NodeInserter(tr("Multi-Range Timer"),tr("Multi-Range Timer"),"multirangetimer");
  10534. timersMenu->addAction(coolingTimerInserter);
  10535. timersMenu->addAction(rangeTimerInserter);
  10536. timersMenu->addAction(multirangeTimerInserter);
  10537. connect(coolingTimerInserter,SIGNAL(triggered(QString,QString)),
  10538. this,SLOT(insertChildNode(QString,QString)));
  10539. connect(rangeTimerInserter,SIGNAL(triggered(QString,QString)),
  10540. this,SLOT(insertChildNode(QString,QString)));
  10541. connect(multirangeTimerInserter,SIGNAL(triggered(QString,QString)),
  10542. this,SLOT(insertChildNode(QString,QString)));
  10543. timersButton->setMenu(timersMenu);
  10544. layout->addWidget(timersButton);
  10545. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  10546. QMenu*advancedMenu= new QMenu;
  10547. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  10548. advancedMenu->addAction(linearsplineinserter);
  10549. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  10550. advancedMenu->addAction(translationinserter);
  10551. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10552. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10553. /*959:*/
  10554. #line 258 "./rate.w"
  10555. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  10556. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10557. advancedMenu->addAction(rateOfChangeInserter);
  10558. /*:959*/
  10559. #line 16269 "./typica.w"
  10560. advancedButton->setMenu(advancedMenu);
  10561. layout->addWidget(advancedButton);
  10562. QHBoxLayout*idLayout= new QHBoxLayout;
  10563. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  10564. idLayout->addWidget(idLabel);
  10565. QSpinBox*id= new QSpinBox;
  10566. idLayout->addWidget(id);
  10567. idLayout->addStretch();
  10568. layout->addLayout(idLayout);
  10569. QHBoxLayout*capacityLayout= new QHBoxLayout;
  10570. QCheckBox*capacityCheckEnabled= new QCheckBox(tr("Maximum batch size:"));
  10571. QDoubleSpinBox*capacity= new QDoubleSpinBox;
  10572. capacity->setMinimum(0.0);
  10573. capacity->setDecimals(3);
  10574. capacity->setMaximum(999999.999);
  10575. QComboBox*capacityUnit= new QComboBox;
  10576. capacityUnit->addItem("g");
  10577. capacityUnit->addItem("Kg");
  10578. capacityUnit->addItem("oz");
  10579. capacityUnit->addItem("Lb");
  10580. capacityUnit->setCurrentIndex(3);
  10581. capacityLayout->addWidget(capacityCheckEnabled);
  10582. capacityLayout->addWidget(capacity);
  10583. capacityLayout->addWidget(capacityUnit);
  10584. capacityLayout->addStretch();
  10585. layout->addLayout(capacityLayout);
  10586. layout->addStretch();
  10587. /*771:*/
  10588. #line 16334 "./typica.w"
  10589. QDomElement referenceElement=
  10590. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10591. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10592. QDomElement node;
  10593. /*:771*/
  10594. #line 16298 "./typica.w"
  10595. for(int i= 0;i<configData.size();i++)
  10596. {
  10597. node= configData.at(i).toElement();
  10598. if(node.attribute("name")=="databaseid")
  10599. {
  10600. id->setValue(node.attribute("value").toInt());
  10601. }
  10602. else if(node.attribute("name")=="checkcapacity")
  10603. {
  10604. capacityCheckEnabled->setChecked(node.attribute("value")=="true");
  10605. }
  10606. else if(node.attribute("name")=="capacity")
  10607. {
  10608. capacity->setValue(node.attribute("value").toDouble());
  10609. }
  10610. else if(node.attribute("name")=="capacityunit")
  10611. {
  10612. capacityUnit->setCurrentIndex(capacityUnit->findText(node.attribute("value")));
  10613. }
  10614. }
  10615. updateRoasterId(id->value());
  10616. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  10617. connect(capacityCheckEnabled,SIGNAL(stateChanged(int)),this,SLOT(updateCapacityCheck(int)));
  10618. connect(capacity,SIGNAL(valueChanged(QString)),this,SLOT(updateCapacity(QString)));
  10619. connect(capacityUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateCapacityUnit(QString)));
  10620. setLayout(layout);
  10621. }
  10622. /*:770*//*772:*/
  10623. #line 16344 "./typica.w"
  10624. void RoasterConfWidget::updateRoasterId(int id)
  10625. {
  10626. updateAttribute("databaseid",QString("%1").arg(id));
  10627. }
  10628. void RoasterConfWidget::updateCapacityCheck(int value)
  10629. {
  10630. updateAttribute("checkcapacity",value==Qt::Checked?"true":"false");
  10631. }
  10632. void RoasterConfWidget::updateCapacity(const QString&value)
  10633. {
  10634. updateAttribute("capacity",value);
  10635. }
  10636. void RoasterConfWidget::updateCapacityUnit(const QString&value)
  10637. {
  10638. updateAttribute("capacityunit",value);
  10639. }
  10640. /*:772*/
  10641. #line 597 "./typica.w"
  10642. /*818:*/
  10643. #line 17847 "./typica.w"
  10644. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10645. :BasicDeviceConfigurationWidget(model,index)
  10646. {
  10647. QFormLayout*layout= new QFormLayout;
  10648. QLineEdit*buttonTextEdit= new QLineEdit;
  10649. QLineEdit*annotationTextEdit= new QLineEdit;
  10650. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10651. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10652. /*771:*/
  10653. #line 16334 "./typica.w"
  10654. QDomElement referenceElement=
  10655. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10656. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10657. QDomElement node;
  10658. /*:771*/
  10659. #line 17856 "./typica.w"
  10660. for(int i= 0;i<configData.size();i++)
  10661. {
  10662. node= configData.at(i).toElement();
  10663. if(node.attribute("name")=="buttontext")
  10664. {
  10665. buttonTextEdit->setText(node.attribute("value"));
  10666. }
  10667. else if(node.attribute("name")=="annotationtext")
  10668. {
  10669. annotationTextEdit->setText(node.attribute("value"));
  10670. }
  10671. }
  10672. updateButtonText(buttonTextEdit->text());
  10673. updateAnnotationText(annotationTextEdit->text());
  10674. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10675. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10676. setLayout(layout);
  10677. }
  10678. /*:818*//*819:*/
  10679. #line 17878 "./typica.w"
  10680. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  10681. {
  10682. updateAttribute("buttontext",text);
  10683. }
  10684. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10685. {
  10686. updateAttribute("annotationtext",text);
  10687. }
  10688. /*:819*//*822:*/
  10689. #line 17916 "./typica.w"
  10690. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10691. :BasicDeviceConfigurationWidget(model,index)
  10692. {
  10693. QFormLayout*layout= new QFormLayout;
  10694. QLineEdit*buttonTextEdit= new QLineEdit;
  10695. QLineEdit*annotationTextEdit= new QLineEdit;
  10696. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10697. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10698. /*771:*/
  10699. #line 16334 "./typica.w"
  10700. QDomElement referenceElement=
  10701. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10702. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10703. QDomElement node;
  10704. /*:771*/
  10705. #line 17925 "./typica.w"
  10706. for(int i= 0;i<configData.size();i++)
  10707. {
  10708. node= configData.at(i).toElement();
  10709. if(node.attribute("name")=="buttontext")
  10710. {
  10711. buttonTextEdit->setText(node.attribute("value"));
  10712. }
  10713. else if(node.attribute("name")=="annotationtext")
  10714. {
  10715. annotationTextEdit->setText(node.attribute("value"));
  10716. }
  10717. }
  10718. updateButtonText(buttonTextEdit->text());
  10719. updateAnnotationText(annotationTextEdit->text());
  10720. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10721. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10722. QTextEdit*documentation= new QTextEdit;
  10723. 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."));
  10724. documentation->setReadOnly(true);
  10725. layout->addRow("",documentation);
  10726. setLayout(layout);
  10727. }
  10728. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  10729. {
  10730. updateAttribute("buttontext",text);
  10731. }
  10732. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10733. {
  10734. updateAttribute("annotationtext",text);
  10735. }
  10736. /*:822*/
  10737. #line 598 "./typica.w"
  10738. /*825:*/
  10739. #line 17993 "./typica.w"
  10740. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10741. :BasicDeviceConfigurationWidget(model,index)
  10742. {
  10743. QFormLayout*layout= new QFormLayout;
  10744. QLineEdit*labelEdit= new QLineEdit;
  10745. layout->addRow(tr("Control Label: "),labelEdit);
  10746. QLineEdit*minimumEdit= new QLineEdit;
  10747. layout->addRow(tr("Minimum Value: "),minimumEdit);
  10748. QLineEdit*maximumEdit= new QLineEdit;
  10749. layout->addRow(tr("Maximum Value: "),maximumEdit);
  10750. QSpinBox*precisionEdit= new QSpinBox;
  10751. precisionEdit->setMinimum(0);
  10752. precisionEdit->setMaximum(9);
  10753. layout->addRow(tr("Precision"),precisionEdit);
  10754. QLineEdit*pretext= new QLineEdit;
  10755. layout->addRow(tr("Prefix text"),pretext);
  10756. QLineEdit*posttext= new QLineEdit;
  10757. layout->addRow(tr("Suffix text"),posttext);
  10758. /*771:*/
  10759. #line 16334 "./typica.w"
  10760. QDomElement referenceElement=
  10761. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10762. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10763. QDomElement node;
  10764. /*:771*/
  10765. #line 18012 "./typica.w"
  10766. for(int i= 0;i<configData.size();i++)
  10767. {
  10768. node= configData.at(i).toElement();
  10769. if(node.attribute("name")=="label")
  10770. {
  10771. labelEdit->setText(node.attribute("value"));
  10772. }
  10773. else if(node.attribute("name")=="minimum")
  10774. {
  10775. minimumEdit->setText(node.attribute("value"));
  10776. }
  10777. else if(node.attribute("name")=="maximum")
  10778. {
  10779. maximumEdit->setText(node.attribute("value"));
  10780. }
  10781. else if(node.attribute("name")=="precision")
  10782. {
  10783. precisionEdit->setValue(node.attribute("value").toInt());
  10784. }
  10785. else if(node.attribute("name")=="pretext")
  10786. {
  10787. pretext->setText(node.attribute("value"));
  10788. }
  10789. else if(node.attribute("name")=="posttext")
  10790. {
  10791. posttext->setText(node.attribute("value"));
  10792. }
  10793. }
  10794. updateLabel(labelEdit->text());
  10795. updateMinimum(minimumEdit->text());
  10796. updateMaximum(maximumEdit->text());
  10797. updatePrecision(precisionEdit->value());
  10798. updatePretext(pretext->text());
  10799. updatePosttext(posttext->text());
  10800. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  10801. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  10802. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  10803. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  10804. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  10805. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  10806. setLayout(layout);
  10807. }
  10808. void NoteSpinConfWidget::updateLabel(const QString&text)
  10809. {
  10810. updateAttribute("label",text);
  10811. }
  10812. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  10813. {
  10814. updateAttribute("minimum",minimum);
  10815. }
  10816. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  10817. {
  10818. updateAttribute("maximum",maximum);
  10819. }
  10820. void NoteSpinConfWidget::updatePrecision(int precision)
  10821. {
  10822. updateAttribute("precision",QString("%1").arg(precision));
  10823. }
  10824. void NoteSpinConfWidget::updatePretext(const QString&text)
  10825. {
  10826. updateAttribute("pretext",text);
  10827. }
  10828. void NoteSpinConfWidget::updatePosttext(const QString&text)
  10829. {
  10830. updateAttribute("posttext",text);
  10831. }
  10832. /*:825*/
  10833. #line 599 "./typica.w"
  10834. /*334:*/
  10835. #line 7546 "./typica.w"
  10836. LinearCalibrator::LinearCalibrator(QObject*parent):
  10837. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  10838. {
  10839. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10840. }
  10841. /*:334*//*335:*/
  10842. #line 7560 "./typica.w"
  10843. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  10844. {
  10845. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  10846. if(clamp)
  10847. {
  10848. if(outval<Lo1)
  10849. {
  10850. outval= Lo1;
  10851. }
  10852. else if(outval> Up1)
  10853. {
  10854. outval= Up1;
  10855. }
  10856. }
  10857. if(sensitivitySetting>=0.05)
  10858. {
  10859. int temp= qRound(outval/sensitivitySetting);
  10860. outval= temp*sensitivitySetting;
  10861. }
  10862. Measurement adjusted(outval,measure.time(),measure.scale());
  10863. emit measurement(adjusted);
  10864. return adjusted;
  10865. }
  10866. /*:335*//*336:*/
  10867. #line 7587 "./typica.w"
  10868. double LinearCalibrator::measuredLower()
  10869. {
  10870. return Lo2;
  10871. }
  10872. double LinearCalibrator::measuredUpper()
  10873. {
  10874. return Up2;
  10875. }
  10876. double LinearCalibrator::mappedLower()
  10877. {
  10878. return Lo1;
  10879. }
  10880. double LinearCalibrator::mappedUpper()
  10881. {
  10882. return Up1;
  10883. }
  10884. bool LinearCalibrator::isClosedRange()
  10885. {
  10886. return clamp;
  10887. }
  10888. void LinearCalibrator::setMeasuredLower(double lower)
  10889. {
  10890. Lo2= lower;
  10891. }
  10892. void LinearCalibrator::setMeasuredUpper(double upper)
  10893. {
  10894. Up2= upper;
  10895. }
  10896. void LinearCalibrator::setMappedLower(double lower)
  10897. {
  10898. Lo1= lower;
  10899. }
  10900. void LinearCalibrator::setMappedUpper(double upper)
  10901. {
  10902. Up1= upper;
  10903. }
  10904. void LinearCalibrator::setClosedRange(bool closed)
  10905. {
  10906. clamp= closed;
  10907. }
  10908. void LinearCalibrator::setSensitivity(double sensitivity)
  10909. {
  10910. sensitivitySetting= sensitivity;
  10911. }
  10912. double LinearCalibrator::sensitivity()
  10913. {
  10914. return sensitivitySetting;
  10915. }
  10916. /*:336*/
  10917. #line 600 "./typica.w"
  10918. /*341:*/
  10919. #line 7720 "./typica.w"
  10920. void LinearSplineInterpolator::add_pair(double source,double destination)
  10921. {
  10922. pairs->insert(source,destination);
  10923. make_interpolators();
  10924. }
  10925. void LinearSplineInterpolator::make_interpolators()
  10926. {
  10927. if(pairs->size()> 1)
  10928. {
  10929. while(interpolators->size()> 0)
  10930. {
  10931. LinearCalibrator*removed= interpolators->takeFirst();
  10932. removed->deleteLater();
  10933. }
  10934. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10935. QMap<double,double> ::const_iterator j= i+1;
  10936. while(j!=pairs->constEnd())
  10937. {
  10938. LinearCalibrator*segment= new LinearCalibrator();
  10939. segment->setMeasuredLower(i.key());
  10940. segment->setMappedLower(i.value());
  10941. segment->setMeasuredUpper(j.key());
  10942. segment->setMappedUpper(j.value());
  10943. segment->setClosedRange(false);
  10944. interpolators->append(segment);
  10945. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10946. i++;
  10947. j++;
  10948. }
  10949. }
  10950. }
  10951. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  10952. QObject(parent),pairs(new QMap<double,double> ),
  10953. interpolators(new QList<LinearCalibrator*> )
  10954. {
  10955. }
  10956. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  10957. {
  10958. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10959. int index= -1;
  10960. while(i!=pairs->constEnd())
  10961. {
  10962. if(measure.temperature()<=i.key())
  10963. {
  10964. break;
  10965. }
  10966. i++;
  10967. index++;
  10968. }
  10969. if(index<0)
  10970. {
  10971. index= 0;
  10972. }
  10973. if(index>=interpolators->size())
  10974. {
  10975. index= interpolators->size()-1;
  10976. }
  10977. if(interpolators->at(index)!=NULL)
  10978. {
  10979. return interpolators->at(index)->newMeasurement(measure);
  10980. }
  10981. return Measurement();
  10982. }
  10983. /*:341*/
  10984. #line 601 "./typica.w"
  10985. /*924:*/
  10986. #line 19361 "./typica.w"
  10987. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10988. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  10989. {
  10990. QFormLayout*layout= new QFormLayout;
  10991. QLineEdit*source= new QLineEdit;
  10992. layout->addRow(tr("Source column name:"),source);
  10993. QLineEdit*destination= new QLineEdit;
  10994. layout->addRow(tr("Destination column name:"),destination);
  10995. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  10996. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  10997. QTableView*mappingTable= new QTableView;
  10998. mappingTable->setModel(tablemodel);
  10999. NumericDelegate*delegate= new NumericDelegate;
  11000. mappingTable->setItemDelegate(delegate);
  11001. layout->addRow(tr("Mapping data:"),mappingTable);
  11002. /*771:*/
  11003. #line 16334 "./typica.w"
  11004. QDomElement referenceElement=
  11005. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11006. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11007. QDomElement node;
  11008. /*:771*/
  11009. #line 19377 "./typica.w"
  11010. for(int i= 0;i<configData.size();i++)
  11011. {
  11012. node= configData.at(i).toElement();
  11013. if(node.attribute("name")=="source")
  11014. {
  11015. source->setText(node.attribute("value"));
  11016. }
  11017. else if(node.attribute("name")=="destination")
  11018. {
  11019. destination->setText(node.attribute("value"));
  11020. }
  11021. else if(node.attribute("name")=="sourcevalues")
  11022. {
  11023. /*925:*/
  11024. #line 19416 "./typica.w"
  11025. QString data= node.attribute("value");
  11026. if(data.length()> 3)
  11027. {
  11028. data.chop(2);
  11029. data= data.remove(0,2);
  11030. }
  11031. QStringList itemList= data.split(",");
  11032. /*:925*/
  11033. #line 19391 "./typica.w"
  11034. int column= 0;
  11035. /*926:*/
  11036. #line 19428 "./typica.w"
  11037. for(int j= 0;j<itemList.size();j++)
  11038. {
  11039. tablemodel->setData(tablemodel->index(j,column),
  11040. QVariant(itemList.at(j).toDouble()),
  11041. Qt::DisplayRole);
  11042. }
  11043. /*:926*/
  11044. #line 19393 "./typica.w"
  11045. }
  11046. else if(node.attribute("name")=="destinationvalues")
  11047. {
  11048. /*925:*/
  11049. #line 19416 "./typica.w"
  11050. QString data= node.attribute("value");
  11051. if(data.length()> 3)
  11052. {
  11053. data.chop(2);
  11054. data= data.remove(0,2);
  11055. }
  11056. QStringList itemList= data.split(",");
  11057. /*:925*/
  11058. #line 19398 "./typica.w"
  11059. int column= 1;
  11060. /*926:*/
  11061. #line 19428 "./typica.w"
  11062. for(int j= 0;j<itemList.size();j++)
  11063. {
  11064. tablemodel->setData(tablemodel->index(j,column),
  11065. QVariant(itemList.at(j).toDouble()),
  11066. Qt::DisplayRole);
  11067. }
  11068. /*:926*/
  11069. #line 19400 "./typica.w"
  11070. }
  11071. }
  11072. updateSourceColumn(source->text());
  11073. updateDestinationColumn(destination->text());
  11074. updateKnots();
  11075. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11076. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  11077. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  11078. setLayout(layout);
  11079. }
  11080. /*:924*//*927:*/
  11081. #line 19439 "./typica.w"
  11082. void LinearSplineInterpolationConfWidget::updateKnots()
  11083. {
  11084. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11085. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11086. }
  11087. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  11088. {
  11089. updateAttribute("source",source);
  11090. }
  11091. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  11092. {
  11093. updateAttribute("destination",dest);
  11094. }
  11095. /*:927*/
  11096. #line 602 "./typica.w"
  11097. /*944:*/
  11098. #line 19908 "./typica.w"
  11099. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11100. :BasicDeviceConfigurationWidget(model,index),
  11101. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  11102. {
  11103. unitSelector->addItem("Fahrenheit");
  11104. unitSelector->addItem("Celsius");
  11105. temperatureValue->setMinimum(0);
  11106. temperatureValue->setMaximum(1000);
  11107. QFormLayout*layout= new QFormLayout;
  11108. QLineEdit*column= new QLineEdit;
  11109. layout->addRow(tr("Column to match:"),column);
  11110. layout->addRow(tr("Unit:"),unitSelector);
  11111. layout->addRow(tr("Value:"),temperatureValue);
  11112. /*771:*/
  11113. #line 16334 "./typica.w"
  11114. QDomElement referenceElement=
  11115. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11116. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11117. QDomElement node;
  11118. /*:771*/
  11119. #line 19922 "./typica.w"
  11120. for(int i= 0;i<configData.size();i++)
  11121. {
  11122. node= configData.at(i).toElement();
  11123. if(node.attribute("name")=="column")
  11124. {
  11125. column->setText(node.attribute("value"));
  11126. }
  11127. else if(node.attribute("name")=="unit")
  11128. {
  11129. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11130. }
  11131. else if(node.attribute("name")=="value")
  11132. {
  11133. temperatureValue->setValue(node.attribute("value").toDouble());
  11134. }
  11135. }
  11136. updateMatchingColumn(column->text());
  11137. updateTemperature();
  11138. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  11139. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  11140. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  11141. setLayout(layout);
  11142. }
  11143. /*:944*//*945:*/
  11144. #line 19951 "./typica.w"
  11145. void TranslationConfWidget::updateTemperature()
  11146. {
  11147. updateAttribute("unit",unitSelector->currentText());
  11148. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  11149. if(unitSelector->currentText()=="Fahrenheit")
  11150. {
  11151. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  11152. }
  11153. else
  11154. {
  11155. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  11156. }
  11157. }
  11158. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  11159. {
  11160. updateAttribute("column",column);
  11161. }
  11162. /*:945*/
  11163. #line 603 "./typica.w"
  11164. /*828:*/
  11165. #line 24 "./freeannotation.w"
  11166. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  11167. const QModelIndex&index)
  11168. :BasicDeviceConfigurationWidget(model,index)
  11169. {
  11170. QFormLayout*layout= new QFormLayout;
  11171. QLineEdit*labelEdit= new QLineEdit;
  11172. layout->addRow(tr("Label Text:"),labelEdit);
  11173. /*771:*/
  11174. #line 16334 "./typica.w"
  11175. QDomElement referenceElement=
  11176. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11177. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11178. QDomElement node;
  11179. /*:771*/
  11180. #line 32 "./freeannotation.w"
  11181. for(int i= 0;i<configData.size();i++)
  11182. {
  11183. node= configData.at(i).toElement();
  11184. if(node.attribute("name")=="labeltext")
  11185. {
  11186. labelEdit->setText(node.attribute("value"));
  11187. }
  11188. }
  11189. updateLabel(labelEdit->text());
  11190. connect(labelEdit,SIGNAL(textEdited(QString)),
  11191. this,SLOT(updateLabel(QString)));
  11192. setLayout(layout);
  11193. }
  11194. /*:828*//*829:*/
  11195. #line 49 "./freeannotation.w"
  11196. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  11197. {
  11198. updateAttribute("labeltext",text);
  11199. }
  11200. /*:829*/
  11201. #line 604 "./typica.w"
  11202. /*948:*/
  11203. #line 39 "./rate.w"
  11204. void RateOfChange::newMeasurement(Measurement measure)
  11205. {
  11206. cache.append(measure);
  11207. /*949:*/
  11208. #line 64 "./rate.w"
  11209. if(cache.size()> 2)
  11210. {
  11211. bool done= false;
  11212. while(!done)
  11213. {
  11214. if(cache.front().time().secsTo(cache.back().time())> ct)
  11215. {
  11216. cache.removeFirst();
  11217. }
  11218. else if(cache.back().time()<cache.front().time())
  11219. {
  11220. cache.removeFirst();
  11221. done= true;
  11222. }
  11223. else
  11224. {
  11225. done= true;
  11226. }
  11227. if(cache.size()<3)
  11228. {
  11229. done= true;
  11230. }
  11231. }
  11232. }
  11233. /*:949*/
  11234. #line 43 "./rate.w"
  11235. if(cache.size()>=2)
  11236. {
  11237. /*950:*/
  11238. #line 96 "./rate.w"
  11239. int N= cache.size();
  11240. double SXY= 0;
  11241. double SX= 0;
  11242. double SXX= 0;
  11243. double SY= 0;
  11244. double y;
  11245. double x;
  11246. for(int i= 0;i<N;i++)
  11247. {
  11248. y= cache.at(i).temperature();
  11249. SY+= y;
  11250. x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
  11251. SX+= x;
  11252. SXX+= (x*x);
  11253. SXY+= (x*y);
  11254. }
  11255. double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
  11256. Measurement value(M*st,cache.back().time(),cache.back().scale());
  11257. value.insert("relative",true);
  11258. emit newData(value);
  11259. /*:950*/
  11260. #line 46 "./rate.w"
  11261. }
  11262. }
  11263. /*:948*//*951:*/
  11264. #line 120 "./rate.w"
  11265. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  11266. {
  11267. setScaleTime(scaletime);
  11268. }
  11269. void RateOfChange::setCacheTime(int seconds)
  11270. {
  11271. ct= seconds;
  11272. }
  11273. void RateOfChange::setScaleTime(int seconds)
  11274. {
  11275. st= (seconds> 0?seconds:1);
  11276. }
  11277. /*:951*/
  11278. #line 605 "./typica.w"
  11279. /*832:*/
  11280. #line 26 "./settings.w"
  11281. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  11282. {
  11283. QTabWidget*settingsTab= new QTabWidget;
  11284. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  11285. settingsTab->addTab(deviceSettings,tr("Roasters"));
  11286. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  11287. settingsTab->addTab(graphSettings,tr("Graph"));
  11288. AdvancedSettingsWidget*advancedSettings= new AdvancedSettingsWidget;
  11289. settingsTab->addTab(advancedSettings,tr("Advanced"));
  11290. setCentralWidget(settingsTab);
  11291. }
  11292. /*:832*/
  11293. #line 606 "./typica.w"
  11294. /*837:*/
  11295. #line 27 "./graphsettings.w"
  11296. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  11297. {
  11298. QTabWidget*graphCategories= new QTabWidget;
  11299. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  11300. graphCategories->addTab(relative,tr("Relative Temperatures"));
  11301. QVBoxLayout*layout= new QVBoxLayout;
  11302. layout->addWidget(graphCategories);
  11303. setLayout(layout);
  11304. }
  11305. /*:837*//*839:*/
  11306. #line 65 "./graphsettings.w"
  11307. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  11308. colorEdit(new QLineEdit)
  11309. {
  11310. QSettings settings;
  11311. QVBoxLayout*layout= new QVBoxLayout;
  11312. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  11313. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  11314. updateEnableSetting(enable->isChecked());
  11315. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  11316. layout->addWidget(enable);
  11317. QHBoxLayout*colorLayout= new QHBoxLayout;
  11318. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  11319. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  11320. updateColorSetting(colorEdit->text());
  11321. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  11322. QToolButton*colorPickerButton= new QToolButton();
  11323. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  11324. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  11325. colorLayout->addWidget(colorLabel);
  11326. colorLayout->addWidget(colorEdit);
  11327. colorLayout->addWidget(colorPickerButton);
  11328. colorLayout->addStretch();
  11329. layout->addLayout(colorLayout);
  11330. QHBoxLayout*unitLayout= new QHBoxLayout;
  11331. QLabel*unitLabel= new QLabel(tr("Unit"));
  11332. QComboBox*unitSelector= new QComboBox;
  11333. unitSelector->addItem(tr("Fahrenheit"));
  11334. unitSelector->addItem(tr("Celsius"));
  11335. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  11336. updateUnit(unitSelector->currentIndex());
  11337. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  11338. unitLayout->addWidget(unitLabel);
  11339. unitLayout->addWidget(unitSelector);
  11340. unitLayout->addStretch();
  11341. layout->addLayout(unitLayout);
  11342. QHBoxLayout*axisLayout= new QHBoxLayout;
  11343. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  11344. QLineEdit*axisEdit= new QLineEdit;
  11345. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, -10, 0, 10, 30, 50").toString());
  11346. updateAxisSetting(axisEdit->text());
  11347. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  11348. axisLayout->addWidget(axisLabel);
  11349. axisLayout->addWidget(axisEdit);
  11350. layout->addLayout(axisLayout);
  11351. layout->addStretch();
  11352. setLayout(layout);
  11353. }
  11354. /*:839*//*840:*/
  11355. #line 116 "./graphsettings.w"
  11356. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  11357. {
  11358. QSettings settings;
  11359. settings.setValue("settings/graph/relative/enable",enabled);
  11360. }
  11361. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  11362. {
  11363. QSettings settings;
  11364. settings.setValue("settings/graph/relative/color",color);
  11365. }
  11366. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  11367. {
  11368. QSettings settings;
  11369. QString settingValue;
  11370. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  11371. QStringList numbers;
  11372. foreach(QString text,points)
  11373. {
  11374. bool okay= false;
  11375. text.toDouble(&okay);
  11376. if(okay)
  11377. {
  11378. numbers.append(text);
  11379. }
  11380. }
  11381. numbers.removeDuplicates();
  11382. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  11383. }
  11384. void GraphSettingsRelativeTab::updateUnit(int unit)
  11385. {
  11386. QSettings settings;
  11387. settings.setValue("settings/graph/relative/unit",unit);
  11388. }
  11389. /*:840*//*841:*/
  11390. #line 159 "./graphsettings.w"
  11391. void GraphSettingsRelativeTab::showColorPicker()
  11392. {
  11393. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  11394. colorEdit->setText(color.name());
  11395. }
  11396. #line 62 "./settings.w"
  11397. #line 1 "./advancedsettings.w"
  11398. /*:841*/
  11399. #line 607 "./typica.w"
  11400. /*983:*/
  11401. #line 682 "./dataqsdk.w"
  11402. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  11403. const QModelIndex&index)
  11404. :BasicDeviceConfigurationWidget(model,index),
  11405. deviceIdStack(new QStackedWidget)
  11406. {
  11407. QVBoxLayout*layout= new QVBoxLayout;
  11408. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  11409. layout->addWidget(autoDetect);
  11410. QWidget*autoLayerWidget= new QWidget;
  11411. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  11412. QLabel*autoLabel= new QLabel(tr("Device number"));
  11413. QSpinBox*autoNumber= new QSpinBox;
  11414. autoNumber->setMinimum(1);
  11415. autoNumber->setMaximum(99);
  11416. autoLayerLayout->addWidget(autoLabel);
  11417. autoLayerLayout->addWidget(autoNumber);
  11418. autoLayerWidget->setLayout(autoLayerLayout);
  11419. QWidget*fixedLayerWidget= new QWidget;
  11420. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  11421. QLabel*fixedLabel= new QLabel(tr("Device port"));
  11422. QComboBox*portSelection= new QComboBox;
  11423. portSelection->setEditable(true);
  11424. portSelection->addItems(DataqSdkDevice::detectHardware());
  11425. fixedLayerLayout->addWidget(fixedLabel);
  11426. fixedLayerLayout->addWidget(portSelection);
  11427. fixedLayerWidget->setLayout(fixedLayerLayout);
  11428. deviceIdStack->addWidget(autoLayerWidget);
  11429. deviceIdStack->addWidget(fixedLayerWidget);
  11430. layout->addWidget(deviceIdStack);
  11431. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  11432. layout->addWidget(addChannelButton);
  11433. /*771:*/
  11434. #line 16334 "./typica.w"
  11435. QDomElement referenceElement=
  11436. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11437. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11438. QDomElement node;
  11439. /*:771*/
  11440. #line 714 "./dataqsdk.w"
  11441. for(int i= 0;i<configData.size();i++)
  11442. {
  11443. node= configData.at(i).toElement();
  11444. if(node.attribute("name")=="autoSelect")
  11445. {
  11446. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  11447. }
  11448. else if(node.attribute("name")=="deviceNumber")
  11449. {
  11450. autoNumber->setValue(node.attribute("value").toInt());
  11451. }
  11452. else if(node.attribute("name")=="port")
  11453. {
  11454. int index= portSelection->findText(node.attribute("value"));
  11455. if(index> -1)
  11456. {
  11457. portSelection->setCurrentIndex(index);
  11458. }
  11459. else
  11460. {
  11461. portSelection->setEditText(node.attribute("value"));
  11462. }
  11463. }
  11464. }
  11465. updateAutoSelect(autoDetect->isChecked());
  11466. updateDeviceNumber(autoNumber->value());
  11467. updatePort(portSelection->currentText());
  11468. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  11469. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  11470. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  11471. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11472. setLayout(layout);
  11473. }
  11474. /*:983*//*984:*/
  11475. #line 758 "./dataqsdk.w"
  11476. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  11477. {
  11478. if(automatic)
  11479. {
  11480. updateAttribute("autoSelect","true");
  11481. deviceIdStack->setCurrentIndex(0);
  11482. }
  11483. else
  11484. {
  11485. updateAttribute("autoSelect","false");
  11486. deviceIdStack->setCurrentIndex(1);
  11487. }
  11488. }
  11489. /*:984*//*985:*/
  11490. #line 775 "./dataqsdk.w"
  11491. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  11492. {
  11493. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  11494. }
  11495. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  11496. {
  11497. updateAttribute("port",portId);
  11498. }
  11499. /*:985*//*986:*/
  11500. #line 788 "./dataqsdk.w"
  11501. void DataqSdkDeviceConfWidget::addChannel()
  11502. {
  11503. insertChildNode(tr("Channel"),"dataqsdkchannel");
  11504. }
  11505. /*:986*//*989:*/
  11506. #line 868 "./dataqsdk.w"
  11507. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  11508. const QModelIndex&index)
  11509. :BasicDeviceConfigurationWidget(model,index),
  11510. startButton(new QPushButton(tr("Start"))),
  11511. resetButton(new QPushButton(tr("Reset"))),
  11512. stopButton(new QPushButton(tr("Stop"))),
  11513. calibrator(new LinearCalibrator),
  11514. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  11515. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  11516. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  11517. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  11518. rmCount(0),cmCount(0),
  11519. rmin(std::numeric_limits<double> ::max()),
  11520. rmax(std::numeric_limits<double> ::min()),rmean(0),
  11521. cmin(std::numeric_limits<double> ::max()),
  11522. cmax(std::numeric_limits<double> ::min()),cmean(0)
  11523. {
  11524. /*993:*/
  11525. #line 1107 "./dataqsdk.w"
  11526. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  11527. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  11528. QDomElement deviceNode;
  11529. QString configPort;
  11530. QString configAuto;
  11531. for(int i= 0;i<deviceConfigData.size();i++)
  11532. {
  11533. deviceNode= deviceConfigData.at(i).toElement();
  11534. if(deviceNode.attribute("name")=="autoSelect")
  11535. {
  11536. autoSelect= (deviceNode.attribute("value")=="true");
  11537. }
  11538. else if(deviceNode.attribute("name")=="deviceNumber")
  11539. {
  11540. configAuto= deviceNode.attribute("value");
  11541. }
  11542. else if(deviceNode.attribute("name")=="port")
  11543. {
  11544. configPort= deviceNode.attribute("value");
  11545. }
  11546. }
  11547. deviceID= autoSelect?configAuto:configPort;
  11548. channelOfInterest= index.row();
  11549. /*:993*/
  11550. #line 886 "./dataqsdk.w"
  11551. resetButton->setEnabled(false);
  11552. stopButton->setEnabled(false);
  11553. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  11554. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  11555. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  11556. QVBoxLayout*layout= new QVBoxLayout;
  11557. QFormLayout*topLayout= new QFormLayout;
  11558. QLineEdit*columnEdit= new QLineEdit;
  11559. topLayout->addRow(tr("Column name"),columnEdit);
  11560. QComboBox*unitSelector= new QComboBox;
  11561. unitSelector->addItem(tr("Temperature"));
  11562. unitSelector->addItem(tr("Control"));
  11563. topLayout->addRow(tr("Measurement type"),unitSelector);
  11564. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  11565. topLayout->addRow(smoothingBox);
  11566. layout->addLayout(topLayout);
  11567. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  11568. topLayout->addRow(hideSeries);
  11569. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  11570. layout->addWidget(calibrationLabel);
  11571. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  11572. QFormLayout*calibrationControlsLayout= new QFormLayout;
  11573. QLineEdit*measuredLowerEdit= new QLineEdit;
  11574. measuredLowerEdit->setText("0");
  11575. QLineEdit*measuredUpperEdit= new QLineEdit;
  11576. measuredUpperEdit->setText("10");
  11577. QLineEdit*mappedLowerEdit= new QLineEdit;
  11578. mappedLowerEdit->setText("0");
  11579. QLineEdit*mappedUpperEdit= new QLineEdit;
  11580. mappedUpperEdit->setText("10");
  11581. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  11582. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  11583. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  11584. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  11585. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  11586. calibrationControlsLayout->addRow(closedBox);
  11587. QLineEdit*sensitivityEdit= new QLineEdit;
  11588. sensitivityEdit->setText("0");
  11589. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  11590. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  11591. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  11592. deviceControlLayout->addWidget(startButton);
  11593. deviceControlLayout->addWidget(resetButton);
  11594. deviceControlLayout->addWidget(stopButton);
  11595. QFormLayout*indicatorLayout= new QFormLayout;
  11596. currentMeasurement->setReadOnly(true);
  11597. minimumMeasurement->setReadOnly(true);
  11598. maximumMeasurement->setReadOnly(true);
  11599. averageMeasurement->setReadOnly(true);
  11600. currentMapped->setReadOnly(true);
  11601. minimumMapped->setReadOnly(true);
  11602. maximumMapped->setReadOnly(true);
  11603. averageMapped->setReadOnly(true);
  11604. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  11605. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  11606. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  11607. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  11608. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  11609. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  11610. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  11611. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  11612. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  11613. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  11614. calibrationTestLayout->addLayout(deviceControlLayout);
  11615. calibrationTestLayout->addLayout(indicatorLayout);
  11616. calibrationLayout->addLayout(calibrationControlsLayout);
  11617. calibrationLayout->addLayout(calibrationTestLayout);
  11618. layout->addLayout(calibrationLayout);
  11619. /*771:*/
  11620. #line 16334 "./typica.w"
  11621. QDomElement referenceElement=
  11622. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11623. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11624. QDomElement node;
  11625. /*:771*/
  11626. #line 955 "./dataqsdk.w"
  11627. for(int i= 0;i<configData.size();i++)
  11628. {
  11629. node= configData.at(i).toElement();
  11630. if(node.attribute("name")=="column")
  11631. {
  11632. columnEdit->setText(node.attribute("value"));
  11633. }
  11634. else if(node.attribute("name")=="type")
  11635. {
  11636. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11637. }
  11638. else if(node.attribute("name")=="smoothing")
  11639. {
  11640. smoothingBox->setChecked(node.attribute("value")=="true");
  11641. }
  11642. else if(node.attribute("name")=="calibrationMeasuredLower")
  11643. {
  11644. measuredLowerEdit->setText(node.attribute("value"));
  11645. }
  11646. else if(node.attribute("name")=="calibrationMeasuredUpper")
  11647. {
  11648. measuredUpperEdit->setText(node.attribute("value"));
  11649. }
  11650. else if(node.attribute("name")=="calibrationMappedLower")
  11651. {
  11652. mappedLowerEdit->setText(node.attribute("value"));
  11653. }
  11654. else if(node.attribute("name")=="calibrationMappedUpper")
  11655. {
  11656. mappedUpperEdit->setText(node.attribute("value"));
  11657. }
  11658. else if(node.attribute("name")=="calibrationClosedInterval")
  11659. {
  11660. closedBox->setChecked(node.attribute("value")=="true");
  11661. }
  11662. else if(node.attribute("name")=="calibrationSensitivity")
  11663. {
  11664. sensitivityEdit->setText(node.attribute("value"));
  11665. }
  11666. else if(node.attribute("name")=="hidden")
  11667. {
  11668. hideSeries->setChecked(node.attribute("value")=="true");
  11669. }
  11670. }
  11671. updateColumnName(columnEdit->text());
  11672. updateUnits(unitSelector->currentText());
  11673. updateSmoothingEnabled(smoothingBox->isChecked());
  11674. updateMeasuredLower(measuredLowerEdit->text());
  11675. updateMeasuredUpper(measuredUpperEdit->text());
  11676. updateMappedLower(mappedLowerEdit->text());
  11677. updateMappedUpper(mappedUpperEdit->text());
  11678. updateClosedInterval(closedBox->isChecked());
  11679. updateSensitivity(sensitivityEdit->text());
  11680. updateHidden(hideSeries->isChecked());
  11681. connect(columnEdit,SIGNAL(textChanged(QString)),
  11682. this,SLOT(updateColumnName(QString)));
  11683. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  11684. this,SLOT(updateUnits(QString)));
  11685. connect(smoothingBox,SIGNAL(toggled(bool)),
  11686. this,SLOT(updateSmoothingEnabled(bool)));
  11687. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  11688. this,SLOT(updateMeasuredLower(QString)));
  11689. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  11690. this,SLOT(updateMappedLower(QString)));
  11691. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  11692. this,SLOT(updateMeasuredUpper(QString)));
  11693. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  11694. this,SLOT(updateMappedUpper(QString)));
  11695. connect(closedBox,SIGNAL(toggled(bool)),
  11696. this,SLOT(updateClosedInterval(bool)));
  11697. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  11698. this,SLOT(updateSensitivity(QString)));
  11699. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  11700. setLayout(layout);
  11701. }
  11702. /*:989*//*990:*/
  11703. #line 1038 "./dataqsdk.w"
  11704. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  11705. {
  11706. updateAttribute("type",unit);
  11707. }
  11708. /*:990*//*991:*/
  11709. #line 1047 "./dataqsdk.w"
  11710. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  11711. {
  11712. updateAttribute("calibrationMeasuredLower",value);
  11713. calibrator->setMeasuredLower(value.toDouble());
  11714. }
  11715. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  11716. {
  11717. updateAttribute("calibrationMeasuredUpper",value);
  11718. calibrator->setMeasuredUpper(value.toDouble());
  11719. }
  11720. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  11721. {
  11722. updateAttribute("calibrationMappedLower",value);
  11723. calibrator->setMappedLower(value.toDouble());
  11724. }
  11725. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  11726. {
  11727. updateAttribute("calibrationMappedUpper",value);
  11728. calibrator->setMappedUpper(value.toDouble());
  11729. }
  11730. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  11731. {
  11732. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  11733. calibrator->setClosedRange(closed);
  11734. }
  11735. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  11736. {
  11737. updateAttribute("smoothing",enabled?"true":"false");
  11738. }
  11739. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  11740. {
  11741. updateAttribute("calibrationSensitivity",value);
  11742. calibrator->setSensitivity(value.toDouble());
  11743. }
  11744. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  11745. {
  11746. updateAttribute("hidden",hidden?"true":"false");
  11747. }
  11748. /*:991*//*994:*/
  11749. #line 1136 "./dataqsdk.w"
  11750. void DataqSdkChannelConfWidget::startCalibration()
  11751. {
  11752. startButton->setEnabled(false);
  11753. stopButton->setEnabled(true);
  11754. resetButton->setEnabled(true);
  11755. calibrationDevice= new DataqSdkDevice(deviceID);
  11756. Channel*channel;
  11757. for(unsigned int i= 0;i<=channelOfInterest;i++)
  11758. {
  11759. channel= calibrationDevice->newChannel(Units::Unitless);
  11760. }
  11761. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  11762. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  11763. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  11764. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  11765. calibrationDevice->start();
  11766. }
  11767. void DataqSdkChannelConfWidget::stopCalibration()
  11768. {
  11769. startButton->setEnabled(true);
  11770. stopButton->setEnabled(false);
  11771. resetButton->setEnabled(false);
  11772. calibrationDevice->deleteLater();
  11773. /*996:*/
  11774. #line 1181 "./dataqsdk.w"
  11775. rmCount= 0;
  11776. cmCount= 0;
  11777. rmin= std::numeric_limits<double> ::max();
  11778. rmax= std::numeric_limits<double> ::min();
  11779. rmean= 0;
  11780. cmin= std::numeric_limits<double> ::max();
  11781. cmax= std::numeric_limits<double> ::min();
  11782. cmean= 0;
  11783. /*:996*/
  11784. #line 1161 "./dataqsdk.w"
  11785. }
  11786. /*:994*//*995:*/
  11787. #line 1172 "./dataqsdk.w"
  11788. void DataqSdkChannelConfWidget::resetCalibration()
  11789. {
  11790. /*996:*/
  11791. #line 1181 "./dataqsdk.w"
  11792. rmCount= 0;
  11793. cmCount= 0;
  11794. rmin= std::numeric_limits<double> ::max();
  11795. rmax= std::numeric_limits<double> ::min();
  11796. rmean= 0;
  11797. cmin= std::numeric_limits<double> ::max();
  11798. cmax= std::numeric_limits<double> ::min();
  11799. cmean= 0;
  11800. /*:996*/
  11801. #line 1175 "./dataqsdk.w"
  11802. }
  11803. /*:995*//*997:*/
  11804. #line 1195 "./dataqsdk.w"
  11805. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  11806. {
  11807. double nv= measure.temperature();
  11808. currentMeasurement->setText(QString("%1").arg(nv));
  11809. rmin= qMin(nv,rmin);
  11810. minimumMeasurement->setText(QString("%1").arg(rmin));
  11811. rmax= qMax(nv,rmax);
  11812. maximumMeasurement->setText(QString("%1").arg(rmax));
  11813. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  11814. rmCount++;
  11815. averageMeasurement->setText(QString("%1").arg(rmean));
  11816. }
  11817. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  11818. {
  11819. double nv= measure.temperature();
  11820. currentMapped->setText(QString("%1").arg(nv));
  11821. cmin= qMin(nv,cmin);
  11822. minimumMapped->setText(QString("%1").arg(cmin));
  11823. cmax= qMax(nv,cmax);
  11824. maximumMapped->setText(QString("%1").arg(cmax));
  11825. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  11826. cmCount++;
  11827. averageMapped->setText(QString("%1").arg(cmean));
  11828. }
  11829. /*:997*//*998:*/
  11830. #line 1224 "./dataqsdk.w"
  11831. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  11832. {
  11833. updateAttribute("column",value);
  11834. }
  11835. /*:998*/
  11836. #line 608 "./typica.w"
  11837. /*1022:*/
  11838. #line 393 "./scales.w"
  11839. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  11840. const QModelIndex&index)
  11841. :BasicDeviceConfigurationWidget(model,index),
  11842. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  11843. flow(new FlowSelector),stop(new StopSelector)
  11844. {
  11845. QFormLayout*layout= new QFormLayout;
  11846. layout->addRow(tr("Port:"),port);
  11847. connect(port,SIGNAL(currentIndexChanged(QString)),
  11848. this,SLOT(updatePort(QString)));
  11849. connect(port,SIGNAL(editTextChanged(QString)),
  11850. this,SLOT(updatePort(QString)));
  11851. layout->addRow(tr("Baud:"),baud);
  11852. connect(baud,SIGNAL(currentIndexChanged(QString)),
  11853. this,SLOT(updateBaudRate(QString)));
  11854. layout->addRow(tr("Parity:"),parity);
  11855. connect(parity,SIGNAL(currentIndexChanged(int)),
  11856. this,SLOT(updateParity(int)));
  11857. layout->addRow(tr("Flow Control:"),flow);
  11858. connect(flow,SIGNAL(currentIndexChanged(int)),
  11859. this,SLOT(updateFlowControl(int)));
  11860. layout->addRow(tr("Stop Bits:"),stop);
  11861. connect(stop,SIGNAL(currentIndexChanged(int)),
  11862. this,SLOT(updateStopBits(int)));
  11863. /*771:*/
  11864. #line 16334 "./typica.w"
  11865. QDomElement referenceElement=
  11866. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11867. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11868. QDomElement node;
  11869. /*:771*/
  11870. #line 418 "./scales.w"
  11871. for(int i= 0;i<configData.size();i++)
  11872. {
  11873. node= configData.at(i).toElement();
  11874. if(node.attribute("name")=="port")
  11875. {
  11876. int j= port->findText(node.attribute("value"));
  11877. if(j>=0)
  11878. {
  11879. port->setCurrentIndex(j);
  11880. }
  11881. else
  11882. {
  11883. port->insertItem(0,node.attribute("value"));
  11884. port->setCurrentIndex(0);
  11885. }
  11886. }
  11887. else if(node.attribute("name")=="baudrate")
  11888. {
  11889. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  11890. }
  11891. else if(node.attribute("name")=="parity")
  11892. {
  11893. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  11894. }
  11895. else if(node.attribute("name")=="flowcontrol")
  11896. {
  11897. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  11898. }
  11899. else if(node.attribute("name")=="stopbits")
  11900. {
  11901. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  11902. }
  11903. }
  11904. updatePort(port->currentText());
  11905. updateBaudRate(baud->currentText());
  11906. updateParity(parity->currentIndex());
  11907. updateFlowControl(flow->currentIndex());
  11908. updateStopBits(stop->currentIndex());
  11909. setLayout(layout);
  11910. }
  11911. /*:1022*//*1023:*/
  11912. #line 462 "./scales.w"
  11913. void SerialScaleConfWidget::updatePort(const QString&newPort)
  11914. {
  11915. updateAttribute("port",newPort);
  11916. }
  11917. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  11918. {
  11919. updateAttribute("baudrate",rate);
  11920. }
  11921. void SerialScaleConfWidget::updateParity(int index)
  11922. {
  11923. updateAttribute("parity",parity->itemData(index).toString());
  11924. }
  11925. void SerialScaleConfWidget::updateFlowControl(int index)
  11926. {
  11927. updateAttribute("flowcontrol",flow->itemData(index).toString());
  11928. }
  11929. void SerialScaleConfWidget::updateStopBits(int index)
  11930. {
  11931. updateAttribute("stopbits",stop->itemData(index).toString());
  11932. }
  11933. /*:1023*/
  11934. #line 609 "./typica.w"
  11935. /*1035:*/
  11936. #line 195 "./valueannotation.w"
  11937. void ValueAnnotation::newMeasurement(Measurement measure)
  11938. {
  11939. for(int i= 0;i<values.size();i++)
  11940. {
  11941. if(measure.temperature()> values.at(i)-tolerance&&
  11942. measure.temperature()<values.at(i)+tolerance)
  11943. {
  11944. if(i!=lastIndex)
  11945. {
  11946. lastIndex= i;
  11947. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  11948. }
  11949. }
  11950. }
  11951. }
  11952. /*:1035*//*1036:*/
  11953. #line 216 "./valueannotation.w"
  11954. void ValueAnnotation::annotate()
  11955. {
  11956. if(lastIndex> -1)
  11957. {
  11958. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  11959. }
  11960. }
  11961. /*:1036*//*1037:*/
  11962. #line 228 "./valueannotation.w"
  11963. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  11964. {
  11965. values.append(value);
  11966. annotations.append(annotation);
  11967. }
  11968. /*:1037*//*1038:*/
  11969. #line 237 "./valueannotation.w"
  11970. void ValueAnnotation::setAnnotationColumn(int column)
  11971. {
  11972. annotationColumn= column;
  11973. }
  11974. void ValueAnnotation::setTemperatureColumn(int column)
  11975. {
  11976. measurementColumn= column;
  11977. }
  11978. void ValueAnnotation::setTolerance(double epsilon)
  11979. {
  11980. tolerance= epsilon;
  11981. }
  11982. /*:1038*//*1039:*/
  11983. #line 255 "./valueannotation.w"
  11984. ValueAnnotation::ValueAnnotation():QObject(),
  11985. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  11986. {
  11987. }
  11988. /*:1039*/
  11989. #line 610 "./typica.w"
  11990. /*1027:*/
  11991. #line 33 "./valueannotation.w"
  11992. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  11993. const QModelIndex&index)
  11994. :BasicDeviceConfigurationWidget(model,index),
  11995. tablemodel(new SaltModel(2))
  11996. {
  11997. QFormLayout*layout= new QFormLayout;
  11998. QLineEdit*source= new QLineEdit;
  11999. layout->addRow(tr("Source column name:"),source);
  12000. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  12001. noteOnStart->setChecked(true);
  12002. layout->addRow(noteOnStart);
  12003. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  12004. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  12005. QTableView*annotationTable= new QTableView;
  12006. annotationTable->setModel(tablemodel);
  12007. NumericDelegate*delegate= new NumericDelegate;
  12008. annotationTable->setItemDelegateForColumn(0,delegate);
  12009. layout->addRow(tr("Annotations for values:"),annotationTable);
  12010. /*771:*/
  12011. #line 16334 "./typica.w"
  12012. QDomElement referenceElement=
  12013. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12014. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12015. QDomElement node;
  12016. /*:771*/
  12017. #line 52 "./valueannotation.w"
  12018. for(int i= 0;i<configData.size();i++)
  12019. {
  12020. node= configData.at(i).toElement();
  12021. if(node.attribute("name")=="source")
  12022. {
  12023. source->setText(node.attribute("value"));
  12024. }
  12025. else if(node.attribute("name")=="emitOnStart")
  12026. {
  12027. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  12028. }
  12029. else if(node.attribute("name")=="measuredValues")
  12030. {
  12031. /*925:*/
  12032. #line 19416 "./typica.w"
  12033. QString data= node.attribute("value");
  12034. if(data.length()> 3)
  12035. {
  12036. data.chop(2);
  12037. data= data.remove(0,2);
  12038. }
  12039. QStringList itemList= data.split(",");
  12040. /*:925*/
  12041. #line 66 "./valueannotation.w"
  12042. int column= 0;
  12043. /*926:*/
  12044. #line 19428 "./typica.w"
  12045. for(int j= 0;j<itemList.size();j++)
  12046. {
  12047. tablemodel->setData(tablemodel->index(j,column),
  12048. QVariant(itemList.at(j).toDouble()),
  12049. Qt::DisplayRole);
  12050. }
  12051. /*:926*/
  12052. #line 68 "./valueannotation.w"
  12053. }
  12054. else if(node.attribute("name")=="annotations")
  12055. {
  12056. /*1028:*/
  12057. #line 89 "./valueannotation.w"
  12058. QString data= node.attribute("value");
  12059. if(data.length()> 3)
  12060. {
  12061. data.chop(2);
  12062. data= data.remove(0,2);
  12063. }
  12064. QStringList itemList= data.split(",");
  12065. for(int i= 0;i<itemList.size();i++)
  12066. {
  12067. itemList[i]= itemList[i].simplified();
  12068. }
  12069. /*:1028*/
  12070. #line 72 "./valueannotation.w"
  12071. int column= 1;
  12072. /*1029:*/
  12073. #line 104 "./valueannotation.w"
  12074. for(int i= 0;i<itemList.size();i++)
  12075. {
  12076. tablemodel->setData(tablemodel->index(i,column),
  12077. QVariant(itemList.at(i)),
  12078. Qt::DisplayRole);
  12079. }
  12080. /*:1029*/
  12081. #line 74 "./valueannotation.w"
  12082. }
  12083. }
  12084. updateSourceColumn(source->text());
  12085. updateStart(noteOnStart->isChecked());
  12086. updateAnnotations();
  12087. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  12088. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  12089. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  12090. setLayout(layout);
  12091. }
  12092. /*:1027*//*1030:*/
  12093. #line 115 "./valueannotation.w"
  12094. void ValueAnnotationConfWidget::updateAnnotations()
  12095. {
  12096. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  12097. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  12098. }
  12099. /*:1030*//*1031:*/
  12100. #line 125 "./valueannotation.w"
  12101. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  12102. {
  12103. updateAttribute("source",source);
  12104. }
  12105. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  12106. {
  12107. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  12108. }
  12109. /*:1031*/
  12110. #line 611 "./typica.w"
  12111. /*:4*//*250:*/
  12112. #line 5952 "./typica.w"
  12113. /*247:*/
  12114. #line 5915 "./typica.w"
  12115. void ScriptValidator::fixup(QString&input)const
  12116. {
  12117. QScriptEngine*engine= AppInstance->engine;
  12118. engine->pushContext();
  12119. input= engine->evaluate(input).toString();
  12120. engine->popContext();
  12121. }
  12122. /*:247*//*248:*/
  12123. #line 5928 "./typica.w"
  12124. QValidator::State ScriptValidator::validate(QString&input,int&pos)const
  12125. {
  12126. if(v)
  12127. {
  12128. if(v->validate(input,pos)==QValidator::Acceptable)
  12129. {
  12130. return QValidator::Acceptable;
  12131. }
  12132. }
  12133. return QValidator::Intermediate;
  12134. }
  12135. /*:248*//*249:*/
  12136. #line 5943 "./typica.w"
  12137. ScriptValidator::ScriptValidator(QValidator*validator,QObject*parent)
  12138. :QValidator(parent),v(validator)
  12139. {
  12140. }
  12141. /*:249*/
  12142. #line 5953 "./typica.w"
  12143. /*:250*//*845:*/
  12144. #line 60 "./advancedsettings.w"
  12145. /*843:*/
  12146. #line 26 "./advancedsettings.w"
  12147. AdvancedSettingsWidget::AdvancedSettingsWidget():QWidget(NULL)
  12148. {
  12149. QSettings settings;
  12150. QFormLayout*layout= new QFormLayout;
  12151. QCheckBox*logDiagnostics= new QCheckBox;
  12152. logDiagnostics->setCheckState(
  12153. settings.value("settings/advanced/logging",false).toBool()?
  12154. Qt::Checked:Qt::Unchecked);
  12155. connect(logDiagnostics,SIGNAL(toggled(bool)),this,SLOT(enableDiagnosticLogging(bool)));
  12156. layout->addRow(tr("Enable diagnostic logging"),logDiagnostics);
  12157. setLayout(layout);
  12158. }
  12159. /*:843*//*844:*/
  12160. #line 43 "./advancedsettings.w"
  12161. void AdvancedSettingsWidget::enableDiagnosticLogging(bool enabled)
  12162. {
  12163. QSettings settings;
  12164. settings.setValue("settings/advanced/logging",enabled);
  12165. if(enabled)
  12166. {
  12167. qInstallMsgHandler(messageFileOutput);
  12168. }
  12169. else
  12170. {
  12171. qInstallMsgHandler(0);
  12172. }
  12173. }
  12174. /*:844*/
  12175. #line 61 "./advancedsettings.w"
  12176. #line 18094 "./typica.w"
  12177. /*:845*//*892:*/
  12178. #line 639 "./unsupportedserial.w"
  12179. /*867:*/
  12180. #line 58 "./unsupportedserial.w"
  12181. UnsupportedSerialDeviceConfWidget::UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  12182. const QModelIndex&index)
  12183. :BasicDeviceConfigurationWidget(model,index),
  12184. deviceSettingsModel(new SaltModel(2)),
  12185. scriptEditor(new QTextEdit)
  12186. {
  12187. scriptEditor->setTabStopWidth(20);
  12188. QVBoxLayout*dummyLayout= new QVBoxLayout;
  12189. QTabWidget*central= new QTabWidget;
  12190. QWidget*deviceConfigurationWidget= new QWidget;
  12191. QVBoxLayout*deviceConfigurationLayout= new QVBoxLayout;
  12192. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  12193. deviceConfigurationLayout->addWidget(addChannelButton);
  12194. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  12195. QLabel*deviceSettingsLabel= new QLabel(tr("Device Settings:"));
  12196. deviceConfigurationLayout->addWidget(deviceSettingsLabel);
  12197. QTableView*deviceSettingsView= new QTableView;
  12198. deviceSettingsModel->setHeaderData(0,Qt::Horizontal,tr("Key"));
  12199. deviceSettingsModel->setHeaderData(1,Qt::Horizontal,tr("Value"));
  12200. deviceSettingsView->setModel(deviceSettingsModel);
  12201. deviceConfigurationLayout->addWidget(deviceSettingsView);
  12202. deviceConfigurationWidget->setLayout(deviceConfigurationLayout);
  12203. central->addTab(deviceConfigurationWidget,tr("Configuration"));
  12204. central->addTab(scriptEditor,tr("Script"));
  12205. dummyLayout->addWidget(central);
  12206. /*771:*/
  12207. #line 16334 "./typica.w"
  12208. QDomElement referenceElement=
  12209. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12210. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12211. QDomElement node;
  12212. /*:771*/
  12213. #line 86 "./unsupportedserial.w"
  12214. for(int i= 0;i<configData.size();i++)
  12215. {
  12216. node= configData.at(i).toElement();
  12217. if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  12218. {
  12219. int column= 0;
  12220. if(node.attribute("name")=="values")
  12221. {
  12222. column= 1;
  12223. }
  12224. QString data= node.attribute("value");
  12225. if(data.length()> 3)
  12226. {
  12227. data.chop(2);
  12228. data= data.remove(0,2);
  12229. }
  12230. QStringList keyList= data.split(", ");
  12231. for(int j= 0;j<keyList.size();j++)
  12232. {
  12233. deviceSettingsModel->setData(deviceSettingsModel->index(j,column),
  12234. QVariant(keyList.at(j)),
  12235. Qt::EditRole);
  12236. }
  12237. }
  12238. else if(node.attribute("name")=="script")
  12239. {
  12240. scriptEditor->setPlainText(node.attribute("value"));
  12241. }
  12242. }
  12243. connect(deviceSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  12244. this,SLOT(updateConfiguration()));
  12245. connect(scriptEditor,SIGNAL(textChanged()),this,SLOT(saveScript()));
  12246. setLayout(dummyLayout);
  12247. }
  12248. /*:867*//*868:*/
  12249. #line 131 "./unsupportedserial.w"
  12250. void UnsupportedSerialDeviceConfWidget::updateConfiguration()
  12251. {
  12252. updateAttribute("keys",deviceSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  12253. updateAttribute("values",deviceSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  12254. }
  12255. /*:868*//*869:*/
  12256. #line 144 "./unsupportedserial.w"
  12257. void UnsupportedSerialDeviceConfWidget::saveScript()
  12258. {
  12259. updateAttribute("script",scriptEditor->toPlainText());
  12260. }
  12261. /*:869*//*870:*/
  12262. #line 155 "./unsupportedserial.w"
  12263. void UnsupportedSerialDeviceConfWidget::addChannel()
  12264. {
  12265. insertChildNode(tr("Channel"),"unsupporteddevicechannel");
  12266. }
  12267. /*:870*//*872:*/
  12268. #line 183 "./unsupportedserial.w"
  12269. UnsupportedDeviceChannelConfWidget::UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  12270. const QModelIndex&index)
  12271. :BasicDeviceConfigurationWidget(model,index),
  12272. channelSettingsModel(new SaltModel(2))
  12273. {
  12274. QFormLayout*layout= new QFormLayout;
  12275. QLineEdit*columnName= new QLineEdit;
  12276. layout->addRow(tr("Column Name:"),columnName);
  12277. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  12278. layout->addRow(hideSeries);
  12279. QTableView*channelSettings= new QTableView;
  12280. channelSettingsModel->setHeaderData(0,Qt::Horizontal,"Key");
  12281. channelSettingsModel->setHeaderData(1,Qt::Horizontal,"Value");
  12282. channelSettings->setModel(channelSettingsModel);
  12283. layout->addRow(channelSettings);
  12284. setLayout(layout);
  12285. /*771:*/
  12286. #line 16334 "./typica.w"
  12287. QDomElement referenceElement=
  12288. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12289. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12290. QDomElement node;
  12291. /*:771*/
  12292. #line 200 "./unsupportedserial.w"
  12293. for(int i= 0;i<configData.size();i++)
  12294. {
  12295. node= configData.at(i).toElement();
  12296. if(node.attribute("name")=="columnname")
  12297. {
  12298. columnName->setText(node.attribute("value"));
  12299. }
  12300. else if(node.attribute("name")=="hidden")
  12301. {
  12302. hideSeries->setChecked(node.attribute("value")=="true");
  12303. }
  12304. else if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  12305. {
  12306. int column= 0;
  12307. if(node.attribute("name")=="values")
  12308. {
  12309. column= 1;
  12310. }
  12311. QString data= node.attribute("value");
  12312. if(data.length()> 3)
  12313. {
  12314. data.chop(2);
  12315. data= data.remove(0,2);
  12316. }
  12317. QStringList keyList= data.split(", ");
  12318. for(int j= 0;j<keyList.size();j++)
  12319. {
  12320. channelSettingsModel->setData(channelSettingsModel->index(j,column),
  12321. QVariant(keyList.at(j)),
  12322. Qt::EditRole);
  12323. }
  12324. }
  12325. }
  12326. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  12327. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12328. connect(channelSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  12329. this,SLOT(updateConfiguration()));
  12330. }
  12331. /*:872*//*873:*/
  12332. #line 244 "./unsupportedserial.w"
  12333. void UnsupportedDeviceChannelConfWidget::updateColumnName(const QString&value)
  12334. {
  12335. updateAttribute("columnname",value);
  12336. }
  12337. void UnsupportedDeviceChannelConfWidget::updateHidden(bool hidden)
  12338. {
  12339. updateAttribute("hidden",hidden?"true":"false");
  12340. }
  12341. void UnsupportedDeviceChannelConfWidget::updateConfiguration()
  12342. {
  12343. updateAttribute("keys",channelSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  12344. updateAttribute("values",channelSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  12345. }
  12346. /*:873*/
  12347. #line 640 "./unsupportedserial.w"
  12348. /*880:*/
  12349. #line 371 "./unsupportedserial.w"
  12350. void JavaScriptDevice::start()
  12351. {
  12352. QScriptValue object= scriptengine->newQObject(this);
  12353. /*881:*/
  12354. #line 390 "./unsupportedserial.w"
  12355. QScriptValue settingsObject= scriptengine->newObject();
  12356. QVariantMap::const_iterator i= deviceSettings.constBegin();
  12357. while(i!=deviceSettings.constEnd())
  12358. {
  12359. settingsObject.setProperty(i.key(),i.value().toString());
  12360. i++;
  12361. }
  12362. object.setProperty("settings",settingsObject);
  12363. /*:881*/
  12364. #line 375 "./unsupportedserial.w"
  12365. /*882:*/
  12366. #line 405 "./unsupportedserial.w"
  12367. QScriptValue channelsArray= scriptengine->newArray(channelCount());
  12368. for(int i= 0;i<channelCount();i++)
  12369. {
  12370. QScriptValue channelObject= scriptengine->newQObject(getChannel(i));
  12371. QScriptValue channelSettingsObject= scriptengine->newObject();
  12372. QVariantMap::const_iterator j= channelSettings.at(i).constBegin();
  12373. while(j!=channelSettings.at(i).constEnd())
  12374. {
  12375. channelSettingsObject.setProperty(j.key(),j.value().toString());
  12376. j++;
  12377. }
  12378. channelObject.setProperty("settings",channelSettingsObject);
  12379. channelsArray.setProperty(i,channelObject);
  12380. }
  12381. object.setProperty("channels",channelsArray);
  12382. /*:882*/
  12383. #line 376 "./unsupportedserial.w"
  12384. QScriptContext*context= scriptengine->currentContext();
  12385. QScriptValue oldThis= context->thisObject();
  12386. context->setThisObject(object);
  12387. QScriptValue result= scriptengine->evaluate(deviceScript);
  12388. QScriptEngine*engine= scriptengine;
  12389. /*192:*/
  12390. #line 4446 "./typica.w"
  12391. if(engine->hasUncaughtException())
  12392. {
  12393. int line= engine->uncaughtExceptionLineNumber();
  12394. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  12395. result.toString();
  12396. QString trace;
  12397. foreach(trace,engine->uncaughtExceptionBacktrace())
  12398. {
  12399. qDebug()<<trace;
  12400. }
  12401. }
  12402. /*:192*/
  12403. #line 382 "./unsupportedserial.w"
  12404. context->setThisObject(oldThis);
  12405. }
  12406. /*:880*//*885:*/
  12407. #line 446 "./unsupportedserial.w"
  12408. void JavaScriptDevice::stop()
  12409. {
  12410. emit deviceStopRequested();
  12411. }
  12412. /*:885*//*886:*/
  12413. #line 459 "./unsupportedserial.w"
  12414. JavaScriptDevice::JavaScriptDevice(const QModelIndex&index,
  12415. QScriptEngine*engine):
  12416. QObject(NULL),scriptengine(engine)
  12417. {
  12418. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  12419. QDomElement deviceReferenceElement=
  12420. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12421. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  12422. QDomElement node;
  12423. QStringList deviceKeys;
  12424. QStringList deviceValues;
  12425. for(int i= 0;i<deviceConfigData.size();i++)
  12426. {
  12427. node= deviceConfigData.at(i).toElement();
  12428. if(node.attribute("name")=="keys")
  12429. {
  12430. QString data= node.attribute("value");
  12431. if(data.length()> 3)
  12432. {
  12433. data.chop(2);
  12434. data= data.remove(0,2);
  12435. }
  12436. deviceKeys= data.split(", ");
  12437. }
  12438. else if(node.attribute("name")=="values")
  12439. {
  12440. QString data= node.attribute("value");
  12441. if(data.length()> 3)
  12442. {
  12443. data.chop(2);
  12444. data= data.remove(0,2);
  12445. }
  12446. deviceValues= data.split(", ");
  12447. }
  12448. else if(node.attribute("name")=="script")
  12449. {
  12450. deviceScript= node.attribute("value");
  12451. }
  12452. deviceSettings.insert(node.attribute("name"),node.attribute("value"));
  12453. }
  12454. for(int i= 0;i<qMin(deviceKeys.length(),deviceValues.length());i++)
  12455. {
  12456. deviceSettings.insert(deviceKeys[i],deviceValues[i]);
  12457. }
  12458. if(model->hasChildren(index))
  12459. {
  12460. for(int i= 0;i<model->rowCount(index);i++)
  12461. {
  12462. QModelIndex channelIndex= model->index(i,0,index);
  12463. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  12464. channelList.append(new Channel);
  12465. QDomElement channelReferenceElement=
  12466. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  12467. QDomNodeList channelConfigData=
  12468. channelReferenceElement.elementsByTagName("attribute");
  12469. QStringList channelKeys;
  12470. QStringList channelValues;
  12471. for(int j= 0;j<channelConfigData.size();j++)
  12472. {
  12473. node= channelConfigData.at(j).toElement();
  12474. if(node.attribute("name")=="keys")
  12475. {
  12476. QString data= node.attribute("value");
  12477. if(data.length()> 3)
  12478. {
  12479. data.chop(2);
  12480. data= data.remove(0,2);
  12481. }
  12482. channelKeys= data.split(", ");
  12483. }
  12484. else if(node.attribute("name")=="values")
  12485. {
  12486. QString data= node.attribute("value");
  12487. if(data.length()> 3)
  12488. {
  12489. data.chop(2);
  12490. data= data.remove(0,2);
  12491. }
  12492. channelValues= data.split(", ");
  12493. }
  12494. else if(node.attribute("name")=="hidden")
  12495. {
  12496. hiddenState.append(node.attribute("value")=="true");
  12497. }
  12498. else if(node.attribute("name")=="columnname")
  12499. {
  12500. columnNames.append(node.attribute("value"));
  12501. }
  12502. }
  12503. QVariantMap cs;
  12504. for(int j= 0;j<qMin(channelKeys.length(),channelValues.length());j++)
  12505. {
  12506. cs.insert(channelKeys[j],channelValues[j]);
  12507. }
  12508. channelSettings.append(cs);
  12509. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  12510. channelUnits.append(Units::Fahrenheit);
  12511. }
  12512. }
  12513. }
  12514. /*:886*//*887:*/
  12515. #line 564 "./unsupportedserial.w"
  12516. int JavaScriptDevice::channelCount()
  12517. {
  12518. return channelList.length();
  12519. }
  12520. Channel*JavaScriptDevice::getChannel(int channel)
  12521. {
  12522. return channelList.at(channel);
  12523. }
  12524. bool JavaScriptDevice::isChannelHidden(int channel)
  12525. {
  12526. return hiddenState.at(channel);
  12527. }
  12528. Units::Unit JavaScriptDevice::expectedChannelUnit(int channel)
  12529. {
  12530. return channelUnits.at(channel);
  12531. }
  12532. QString JavaScriptDevice::channelColumnName(int channel)
  12533. {
  12534. if(channel>=0&&channel<columnNames.length())
  12535. {
  12536. return columnNames.at(channel);
  12537. }
  12538. return QString();
  12539. }
  12540. QString JavaScriptDevice::channelIndicatorText(int channel)
  12541. {
  12542. return indicatorTexts.at(channel);
  12543. }
  12544. /*:887*//*888:*/
  12545. #line 601 "./unsupportedserial.w"
  12546. void JavaScriptDevice::setTemperatureColumn(int tcol)
  12547. {
  12548. annotationTemperatureColumn= tcol;
  12549. }
  12550. void JavaScriptDevice::setAnnotationColumn(int ncol)
  12551. {
  12552. annotationNoteColumn= ncol;
  12553. }
  12554. /*:888*/
  12555. #line 641 "./unsupportedserial.w"
  12556. /*:892*//*918:*/
  12557. #line 444 "./phidgets.w"
  12558. /*902:*/
  12559. #line 31 "./phidgets.w"
  12560. PhidgetsTemperatureSensorConfWidget::PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  12561. const QModelIndex&index)
  12562. :BasicDeviceConfigurationWidget(model,index)
  12563. {
  12564. QFormLayout*layout= new QFormLayout;
  12565. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  12566. QSpinBox*sampleRate= new QSpinBox;
  12567. sampleRate->setMinimum(40);
  12568. sampleRate->setMaximum(600);
  12569. sampleRate->setSingleStep(40);
  12570. sampleRate->setValue(360);
  12571. /*771:*/
  12572. #line 16334 "./typica.w"
  12573. QDomElement referenceElement=
  12574. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12575. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12576. QDomElement node;
  12577. /*:771*/
  12578. #line 44 "./phidgets.w"
  12579. for(int i= 0;i<configData.size();i++)
  12580. {
  12581. node= configData.at(i).toElement();
  12582. if(node.attribute("name")=="sampleRate")
  12583. {
  12584. sampleRate->setValue(node.attribute("value").toInt());
  12585. }
  12586. }
  12587. updateRate(sampleRate->value());
  12588. connect(sampleRate,SIGNAL(valueChanged(int)),this,SLOT(updateRate(int)));
  12589. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  12590. layout->addRow(addChannelButton);
  12591. layout->addRow(tr("Sample rate:"),sampleRate);
  12592. setLayout(layout);
  12593. }
  12594. /*:902*//*903:*/
  12595. #line 66 "./phidgets.w"
  12596. void PhidgetsTemperatureSensorConfWidget::addChannel()
  12597. {
  12598. insertChildNode(tr("Channel"),"phidgets1048channel");
  12599. }
  12600. /*:903*//*904:*/
  12601. #line 74 "./phidgets.w"
  12602. void PhidgetsTemperatureSensorConfWidget::updateRate(int ms)
  12603. {
  12604. updateAttribute("sampleRate",QString("%1").arg(ms));
  12605. }
  12606. /*:904*//*906:*/
  12607. #line 103 "./phidgets.w"
  12608. PhidgetTemperatureSensorChannelConfWidget::PhidgetTemperatureSensorChannelConfWidget(
  12609. DeviceTreeModel*model,const QModelIndex&index)
  12610. :BasicDeviceConfigurationWidget(model,index),
  12611. tcType(new QComboBox)
  12612. {
  12613. QFormLayout*layout= new QFormLayout;
  12614. QLineEdit*columnName= new QLineEdit;
  12615. layout->addRow(tr("Column Name:"),columnName);
  12616. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  12617. layout->addRow(hideSeries);
  12618. layout->addRow(tr("Thermocouple Type:"),tcType);
  12619. tcType->addItem("Type K","1");
  12620. tcType->addItem("Type J","2");
  12621. tcType->addItem("Type E","3");
  12622. tcType->addItem("Type T","4");
  12623. QSpinBox*channel= new QSpinBox;
  12624. layout->addRow(tr("Channel:"),channel);
  12625. channel->setMinimum(0);
  12626. channel->setMaximum(3);
  12627. setLayout(layout);
  12628. /*771:*/
  12629. #line 16334 "./typica.w"
  12630. QDomElement referenceElement=
  12631. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12632. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12633. QDomElement node;
  12634. /*:771*/
  12635. #line 124 "./phidgets.w"
  12636. for(int i= 0;i<configData.size();i++)
  12637. {
  12638. node= configData.at(i).toElement();
  12639. if(node.attribute("name")=="columnname")
  12640. {
  12641. columnName->setText(node.attribute("value"));
  12642. }
  12643. else if(node.attribute("name")=="hidden")
  12644. {
  12645. hideSeries->setChecked(node.attribute("value")=="true");
  12646. }
  12647. else if(node.attribute("name")=="tctype")
  12648. {
  12649. tcType->setCurrentIndex(tcType->findData(node.attribute("value")));
  12650. }
  12651. else if(node.attribute("name")=="channel")
  12652. {
  12653. channel->setValue(node.attribute("value").toInt());
  12654. }
  12655. }
  12656. updateColumnName(columnName->text());
  12657. updateHidden(hideSeries->isChecked());
  12658. updateTC(tcType->currentIndex());
  12659. updateChannel(channel->value());
  12660. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  12661. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12662. connect(tcType,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTC(int)));
  12663. connect(channel,SIGNAL(valueChanged(int)),this,SLOT(updateChannel(int)));
  12664. }
  12665. /*:906*//*907:*/
  12666. #line 157 "./phidgets.w"
  12667. void PhidgetTemperatureSensorChannelConfWidget::updateColumnName(const QString&value)
  12668. {
  12669. updateAttribute("columnname",value);
  12670. }
  12671. void PhidgetTemperatureSensorChannelConfWidget::updateHidden(bool hidden)
  12672. {
  12673. updateAttribute("hidden",hidden?"true":"false");
  12674. }
  12675. void PhidgetTemperatureSensorChannelConfWidget::updateTC(int index)
  12676. {
  12677. updateAttribute("tctype",tcType->itemData(index).toString());
  12678. }
  12679. void PhidgetTemperatureSensorChannelConfWidget::updateChannel(int channel)
  12680. {
  12681. updateAttribute("channel",QString("%1").arg(channel));
  12682. }
  12683. /*:907*//*911:*/
  12684. #line 246 "./phidgets.w"
  12685. PhidgetsTemperatureSensor::PhidgetsTemperatureSensor(const QModelIndex&index)
  12686. :QObject(NULL),driver("phidget21"),device(NULL)
  12687. {
  12688. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  12689. QDomElement deviceReferenceElement=
  12690. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12691. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  12692. QDomElement node;
  12693. for(int i= 0;i<deviceConfigData.size();i++)
  12694. {
  12695. node= deviceConfigData.at(i).toElement();
  12696. if(node.attribute("name")=="sampleRate")
  12697. {
  12698. sampleTimer.setInterval(node.attribute("value").toInt());
  12699. }
  12700. }
  12701. if(model->hasChildren(index))
  12702. {
  12703. for(int i= 0;i<model->rowCount(index);i++)
  12704. {
  12705. QModelIndex channelIndex= model->index(i,0,index);
  12706. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  12707. QDomElement channelReferenceElement= model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  12708. QDomNodeList channelConfigData= channelReferenceElement.elementsByTagName("attribute");
  12709. for(int j= 0;j<channelConfigData.size();j++)
  12710. {
  12711. node= channelConfigData.at(j).toElement();
  12712. if(node.attribute("name")=="channel")
  12713. {
  12714. int channelID= node.attribute("value").toInt();
  12715. channelIndices.append(channelID);
  12716. Channel*channel= new Channel;
  12717. channelList.append(channel);
  12718. channelMap.insert(channelID,channel);
  12719. }
  12720. else if(node.attribute("name")=="hidden")
  12721. {
  12722. hiddenState.append(node.attribute("value")=="true");
  12723. }
  12724. else if(node.attribute("name")=="columnname")
  12725. {
  12726. columnNames.append(node.attribute("value"));
  12727. }
  12728. else if(node.attribute("name")=="tctype")
  12729. {
  12730. tctypes.append(node.attribute("value").toInt());
  12731. }
  12732. }
  12733. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  12734. }
  12735. }
  12736. }
  12737. /*:911*//*912:*/
  12738. #line 306 "./phidgets.w"
  12739. int PhidgetsTemperatureSensor::channelCount()
  12740. {
  12741. return channelList.length();
  12742. }
  12743. Channel*PhidgetsTemperatureSensor::getChannel(int channel)
  12744. {
  12745. return channelList.at(channel);
  12746. }
  12747. /*:912*//*913:*/
  12748. #line 319 "./phidgets.w"
  12749. bool PhidgetsTemperatureSensor::isChannelHidden(int channel)
  12750. {
  12751. return hiddenState.at(channel);
  12752. }
  12753. QString PhidgetsTemperatureSensor::channelColumnName(int channel)
  12754. {
  12755. if(channel>=0&&channel<columnNames.length())
  12756. {
  12757. return columnNames.at(channel);
  12758. }
  12759. return QString();
  12760. }
  12761. QString PhidgetsTemperatureSensor::channelIndicatorText(int channel)
  12762. {
  12763. if(channel>=0&&channel<indicatorTexts.length())
  12764. {
  12765. return indicatorTexts.at(channel);
  12766. }
  12767. return QString();
  12768. }
  12769. /*:913*//*915:*/
  12770. #line 371 "./phidgets.w"
  12771. void PhidgetsTemperatureSensor::start()
  12772. {
  12773. if(!driver.load())
  12774. {
  12775. driver.setFileName("Phidget21.framework/Phidget21");
  12776. if(!driver.load())
  12777. {
  12778. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  12779. tr("Failed to find phidget21. Please install it."));
  12780. return;
  12781. }
  12782. }
  12783. if((createDevice= (PhidgetHandleOnly)driver.resolve("CPhidgetTemperatureSensor_create"))==0||
  12784. (openDevice= (PhidgetHandleInt)driver.resolve("CPhidget_open"))==0||
  12785. (waitForOpen= (PhidgetHandleInt)driver.resolve("CPhidget_waitForAttachment"))==0||
  12786. (setTCType= (PhidgetHandleIntInt)driver.resolve("CPhidgetTemperatureSensor_setThermocoupleType"))==0||
  12787. (getTemperature= (PhidgetHandleIntDoubleOut)driver.resolve("CPhidgetTemperatureSensor_getTemperature"))==0||
  12788. (closeDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_close"))==0||
  12789. (deleteDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_delete"))==0)
  12790. {
  12791. QMessageBox::critical(NULL,tr("Typica: Link error"),
  12792. tr("Failed to link a required symbol in phidget21."));
  12793. return;
  12794. }
  12795. createDevice(&device);
  12796. openDevice(device,-1);
  12797. int error;
  12798. if((error= waitForOpen(device,10000)))
  12799. {
  12800. closeDevice(device);
  12801. deleteDevice(device);
  12802. QMessageBox::critical(NULL,tr("Typica: Failed to Open Device"),
  12803. tr("CPhidget_waitForAttachment returns error %n",0,error));
  12804. return;
  12805. }
  12806. for(int i= 0;i<channelIndices.length();i++)
  12807. {
  12808. setTCType(device,channelIndices.at(i),tctypes.at(i));
  12809. }
  12810. connect(&sampleTimer,SIGNAL(timeout()),this,SLOT(getMeasurements()));
  12811. sampleTimer.start();
  12812. }
  12813. /*:915*//*916:*/
  12814. #line 418 "./phidgets.w"
  12815. void PhidgetsTemperatureSensor::getMeasurements()
  12816. {
  12817. double value= 0.0;
  12818. QTime time= QTime::currentTime();
  12819. foreach(int i,channelIndices)
  12820. {
  12821. getTemperature(device,i,&value);
  12822. Measurement measure(value*9.0/5.0+32.0,time);
  12823. channelMap[i]->input(measure);
  12824. }
  12825. }
  12826. /*:916*//*917:*/
  12827. #line 433 "./phidgets.w"
  12828. void PhidgetsTemperatureSensor::stop()
  12829. {
  12830. sampleTimer.stop();
  12831. closeDevice(device);
  12832. deleteDevice(device);
  12833. driver.unload();
  12834. }
  12835. /*:917*/
  12836. #line 445 "./phidgets.w"
  12837. /*:918*//*932:*/
  12838. #line 19524 "./typica.w"
  12839. /*930:*/
  12840. #line 19486 "./typica.w"
  12841. CoolingTimerConfWidget::CoolingTimerConfWidget(DeviceTreeModel*model,
  12842. const QModelIndex&index)
  12843. :BasicDeviceConfigurationWidget(model,index)
  12844. {
  12845. QHBoxLayout*layout= new QHBoxLayout;
  12846. QLabel*label= new QLabel(tr("Cooling Time: "));
  12847. QTimeEdit*editor= new QTimeEdit;
  12848. editor->setDisplayFormat("mm:ss");
  12849. /*771:*/
  12850. #line 16334 "./typica.w"
  12851. QDomElement referenceElement=
  12852. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12853. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12854. QDomElement node;
  12855. /*:771*/
  12856. #line 19495 "./typica.w"
  12857. for(int i= 0;i<configData.size();i++)
  12858. {
  12859. node= configData.at(i).toElement();
  12860. if(node.attribute("name")=="reset")
  12861. {
  12862. editor->setTime(QTime::fromString(node.attribute("value"),"mm:ss"));
  12863. }
  12864. }
  12865. updateResetTime(editor->time());
  12866. connect(editor,SIGNAL(timeChanged(QTime)),
  12867. this,SLOT(updateResetTime(QTime)));
  12868. layout->addWidget(label);
  12869. layout->addWidget(editor);
  12870. setLayout(layout);
  12871. }
  12872. void CoolingTimerConfWidget::updateResetTime(QTime time)
  12873. {
  12874. updateAttribute("reset",time.toString("mm:ss"));
  12875. }
  12876. /*:930*/
  12877. #line 19525 "./typica.w"
  12878. /*:932*//*937:*/
  12879. #line 19783 "./typica.w"
  12880. /*934:*/
  12881. #line 19557 "./typica.w"
  12882. RangeTimerConfWidget::RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  12883. :BasicDeviceConfigurationWidget(model,index)
  12884. {
  12885. QVBoxLayout*layout= new QVBoxLayout;
  12886. QGroupBox*startConfigurationGroup= new QGroupBox(tr("Start trigger"));
  12887. QRadioButton*startBatchOption= new QRadioButton(tr("Start of batch"));
  12888. QRadioButton*buttonOption= new QRadioButton(tr("Manual"));
  12889. QRadioButton*thresholdOption= new QRadioButton(tr("At temperature"));
  12890. QButtonGroup*startOptionGroup= new QButtonGroup;
  12891. startOptionGroup->addButton(startBatchOption,1);
  12892. startOptionGroup->addButton(buttonOption,2);
  12893. startOptionGroup->addButton(thresholdOption,3);
  12894. startBatchOption->setChecked(true);
  12895. QGridLayout*startOptions= new QGridLayout;
  12896. startOptions->addWidget(startBatchOption,0,0);
  12897. startOptions->addWidget(buttonOption,1,0);
  12898. startOptions->addWidget(thresholdOption,2,0);
  12899. QLabel*buttonTextLabel= new QLabel(tr("Button Text: "));
  12900. QLineEdit*buttonTextEdit= new QLineEdit;
  12901. QHBoxLayout*buttonTextOptions= new QHBoxLayout;
  12902. buttonTextOptions->addWidget(buttonTextLabel);
  12903. buttonTextOptions->addWidget(buttonTextEdit);
  12904. startOptions->addLayout(buttonTextOptions,1,1);
  12905. QFormLayout*thresholdOptions= new QFormLayout;
  12906. QLineEdit*startColumnName= new QLineEdit;
  12907. QLineEdit*startValue= new QLineEdit;
  12908. thresholdOptions->addRow(tr("Column Name: "),startColumnName);
  12909. thresholdOptions->addRow(tr("Value: "),startValue);
  12910. startOptions->addLayout(thresholdOptions,2,1);
  12911. startConfigurationGroup->setLayout(startOptions);
  12912. layout->addWidget(startConfigurationGroup);
  12913. QGroupBox*stopConfigurationGroup= new QGroupBox(tr("Stop trigger"));
  12914. QRadioButton*stopBatchOption= new QRadioButton(tr("End of batch"));
  12915. QRadioButton*stopButtonOption= new QRadioButton(tr("Manual"));
  12916. QRadioButton*stopThresholdOption= new QRadioButton(tr("At temperature"));
  12917. QButtonGroup*stopOptionGroup= new QButtonGroup;
  12918. stopOptionGroup->addButton(stopBatchOption,1);
  12919. stopOptionGroup->addButton(stopButtonOption,2);
  12920. stopOptionGroup->addButton(stopThresholdOption,3);
  12921. stopBatchOption->setChecked(true);
  12922. QGridLayout*stopOptions= new QGridLayout;
  12923. stopOptions->addWidget(stopBatchOption,0,0);
  12924. stopOptions->addWidget(stopButtonOption,1,0);
  12925. stopOptions->addWidget(stopThresholdOption,2,0);
  12926. QLabel*stopButtonLabel= new QLabel(tr("Button Text: "));
  12927. QLineEdit*stopButtonEdit= new QLineEdit;
  12928. QHBoxLayout*stopButtonTextOptions= new QHBoxLayout;
  12929. stopButtonTextOptions->addWidget(stopButtonLabel);
  12930. stopButtonTextOptions->addWidget(stopButtonEdit);
  12931. stopOptions->addLayout(stopButtonTextOptions,1,1);
  12932. QLineEdit*stopColumnName= new QLineEdit;
  12933. QLineEdit*stopValue= new QLineEdit;
  12934. QFormLayout*stopThresholdOptions= new QFormLayout;
  12935. stopThresholdOptions->addRow(tr("Column Name: "),stopColumnName);
  12936. stopThresholdOptions->addRow(tr("Value: "),stopValue);
  12937. stopOptions->addLayout(stopThresholdOptions,2,1);
  12938. stopConfigurationGroup->setLayout(stopOptions);
  12939. layout->addWidget(stopConfigurationGroup);
  12940. /*771:*/
  12941. #line 16334 "./typica.w"
  12942. QDomElement referenceElement=
  12943. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12944. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12945. QDomElement node;
  12946. /*:771*/
  12947. #line 19619 "./typica.w"
  12948. for(int i= 0;i<configData.size();i++)
  12949. {
  12950. node= configData.at(i).toElement();
  12951. if(node.attribute("name")=="startbuttontext")
  12952. {
  12953. buttonTextEdit->setText(node.attribute("value"));
  12954. }
  12955. else if(node.attribute("name")=="stopbuttontext")
  12956. {
  12957. stopButtonEdit->setText(node.attribute("value"));
  12958. }
  12959. else if(node.attribute("name")=="startcolumnname")
  12960. {
  12961. startColumnName->setText(node.attribute("value"));
  12962. }
  12963. else if(node.attribute("name")=="stopcolumnname")
  12964. {
  12965. stopColumnName->setText(node.attribute("value"));
  12966. }
  12967. else if(node.attribute("name")=="startvalue")
  12968. {
  12969. startValue->setText(node.attribute("value"));
  12970. }
  12971. else if(node.attribute("name")=="stopvalue")
  12972. {
  12973. stopValue->setText(node.attribute("value"));
  12974. }
  12975. else if(node.attribute("name")=="starttrigger")
  12976. {
  12977. if(node.attribute("value")=="batch")
  12978. {
  12979. startBatchOption->setChecked(true);
  12980. }
  12981. else if(node.attribute("value")=="manual")
  12982. {
  12983. buttonOption->setChecked(true);
  12984. }
  12985. else if(node.attribute("value")=="value")
  12986. {
  12987. thresholdOption->setChecked(true);
  12988. }
  12989. }
  12990. else if(node.attribute("name")=="stoptrigger")
  12991. {
  12992. if(node.attribute("value")=="batch")
  12993. {
  12994. stopBatchOption->setChecked(true);
  12995. }
  12996. else if(node.attribute("value")=="manual")
  12997. {
  12998. stopButtonOption->setChecked(true);
  12999. }
  13000. else if(node.attribute("value")=="value")
  13001. {
  13002. stopThresholdOption->setChecked(true);
  13003. }
  13004. }
  13005. }
  13006. updateStartButtonText(buttonTextEdit->text());
  13007. updateStopButtonText(stopButtonEdit->text());
  13008. updateStartColumnName(startColumnName->text());
  13009. updateStopColumnName(stopColumnName->text());
  13010. updateStartValue(startValue->text());
  13011. updateStopValue(stopValue->text());
  13012. updateStartTrigger(startOptionGroup->checkedId());
  13013. updateStopTrigger(stopOptionGroup->checkedId());
  13014. setLayout(layout);
  13015. connect(buttonTextEdit,SIGNAL(textChanged(QString)),
  13016. this,SLOT(updateStartButtonText(QString)));
  13017. connect(stopButtonEdit,SIGNAL(textChanged(QString)),
  13018. this,SLOT(updateStopButtonText(QString)));
  13019. connect(startColumnName,SIGNAL(textChanged(QString)),
  13020. this,SLOT(updateStartColumnName(QString)));
  13021. connect(stopColumnName,SIGNAL(textChanged(QString)),
  13022. this,SLOT(updateStopColumnName(QString)));
  13023. connect(startValue,SIGNAL(textChanged(QString)),
  13024. this,SLOT(updateStartValue(QString)));
  13025. connect(stopValue,SIGNAL(textChanged(QString)),
  13026. this,SLOT(updateStopValue(QString)));
  13027. connect(startOptionGroup,SIGNAL(buttonClicked(int)),
  13028. this,SLOT(updateStartTrigger(int)));
  13029. connect(stopOptionGroup,SIGNAL(buttonClicked(int)),
  13030. this,SLOT(updateStopTrigger(int)));
  13031. }
  13032. /*:934*//*935:*/
  13033. #line 19709 "./typica.w"
  13034. void RangeTimerConfWidget::updateStartButtonText(const QString&text)
  13035. {
  13036. updateAttribute("startbuttontext",text);
  13037. }
  13038. void RangeTimerConfWidget::updateStopButtonText(const QString&text)
  13039. {
  13040. updateAttribute("stopbuttontext",text);
  13041. }
  13042. void RangeTimerConfWidget::updateStartColumnName(const QString&text)
  13043. {
  13044. updateAttribute("startcolumnname",text);
  13045. }
  13046. void RangeTimerConfWidget::updateStopColumnName(const QString&text)
  13047. {
  13048. updateAttribute("stopcolumnname",text);
  13049. }
  13050. void RangeTimerConfWidget::updateStartValue(const QString&text)
  13051. {
  13052. updateAttribute("startvalue",text);
  13053. }
  13054. void RangeTimerConfWidget::updateStopValue(const QString&text)
  13055. {
  13056. updateAttribute("stopvalue",text);
  13057. }
  13058. void RangeTimerConfWidget::updateStartTrigger(int option)
  13059. {
  13060. switch(option)
  13061. {
  13062. case 1:
  13063. updateAttribute("starttrigger","batch");
  13064. break;
  13065. case 2:
  13066. updateAttribute("starttrigger","manual");
  13067. break;
  13068. case 3:
  13069. updateAttribute("starttrigger","value");
  13070. break;
  13071. default:
  13072. break;
  13073. }
  13074. }
  13075. void RangeTimerConfWidget::updateStopTrigger(int option)
  13076. {
  13077. switch(option)
  13078. {
  13079. case 1:
  13080. updateAttribute("stoptrigger","batch");
  13081. break;
  13082. case 2:
  13083. updateAttribute("stoptrigger","manual");
  13084. break;
  13085. case 3:
  13086. updateAttribute("stoptrigger","value");
  13087. break;
  13088. default:
  13089. break;
  13090. }
  13091. }
  13092. /*:935*/
  13093. #line 19784 "./typica.w"
  13094. /*:937*//*942:*/
  13095. #line 19884 "./typica.w"
  13096. /*939:*/
  13097. #line 19808 "./typica.w"
  13098. MultiRangeTimerConfWidget::MultiRangeTimerConfWidget(DeviceTreeModel*model,
  13099. const QModelIndex&index)
  13100. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  13101. {
  13102. QFormLayout*layout= new QFormLayout;
  13103. QLineEdit*trigger= new QLineEdit;
  13104. layout->addRow(tr("Trigger column name:"),trigger);
  13105. tablemodel->setHeaderData(0,Qt::Horizontal,"Range Name");
  13106. tablemodel->setHeaderData(1,Qt::Horizontal,"End Temperature");
  13107. QTableView*rangeTable= new QTableView;
  13108. rangeTable->setModel(tablemodel);
  13109. layout->addRow(tr("Range data:"),rangeTable);
  13110. /*771:*/
  13111. #line 16334 "./typica.w"
  13112. QDomElement referenceElement=
  13113. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13114. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13115. QDomElement node;
  13116. /*:771*/
  13117. #line 19821 "./typica.w"
  13118. for(int i= 0;i<configData.size();i++)
  13119. {
  13120. node= configData.at(i).toElement();
  13121. if(node.attribute("name")=="trigger")
  13122. {
  13123. trigger->setText(node.attribute("value"));
  13124. }
  13125. else if(node.attribute("name")=="rangenames")
  13126. {
  13127. QString data= node.attribute("value");
  13128. if(data.length()> 3)
  13129. {
  13130. data.chop(2);
  13131. data= data.remove(0,2);
  13132. }
  13133. QStringList itemList= data.split(", ");
  13134. for(int j= 0;j<itemList.size();j++)
  13135. {
  13136. QString item= itemList.at(j);
  13137. item.chop(1);
  13138. item= item.remove(0,1);
  13139. tablemodel->setData(tablemodel->index(j,0),
  13140. QVariant(item),Qt::DisplayRole);
  13141. }
  13142. }
  13143. else if(node.attribute("name")=="endtemps")
  13144. {
  13145. /*925:*/
  13146. #line 19416 "./typica.w"
  13147. QString data= node.attribute("value");
  13148. if(data.length()> 3)
  13149. {
  13150. data.chop(2);
  13151. data= data.remove(0,2);
  13152. }
  13153. QStringList itemList= data.split(",");
  13154. /*:925*/
  13155. #line 19849 "./typica.w"
  13156. int column= 1;
  13157. /*926:*/
  13158. #line 19428 "./typica.w"
  13159. for(int j= 0;j<itemList.size();j++)
  13160. {
  13161. tablemodel->setData(tablemodel->index(j,column),
  13162. QVariant(itemList.at(j).toDouble()),
  13163. Qt::DisplayRole);
  13164. }
  13165. /*:926*/
  13166. #line 19851 "./typica.w"
  13167. }
  13168. }
  13169. updateColumnName(trigger->text());
  13170. updateRangeData();
  13171. connect(trigger,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  13172. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateRangeData()));
  13173. setLayout(layout);
  13174. }
  13175. /*:939*//*940:*/
  13176. #line 19865 "./typica.w"
  13177. void MultiRangeTimerConfWidget::updateRangeData()
  13178. {
  13179. updateAttribute("rangenames",tablemodel->quotedArrayLiteral(0,Qt::DisplayRole));
  13180. updateAttribute("endtemps",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  13181. }
  13182. void MultiRangeTimerConfWidget::updateColumnName(const QString&text)
  13183. {
  13184. updateAttribute("trigger",text);
  13185. }
  13186. /*:940*/
  13187. #line 19885 "./typica.w"
  13188. /*:942*//*960:*/
  13189. #line 265 "./rate.w"
  13190. /*956:*/
  13191. #line 191 "./rate.w"
  13192. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  13193. :BasicDeviceConfigurationWidget(model,index)
  13194. {
  13195. QFormLayout*layout= new QFormLayout;
  13196. QLineEdit*column= new QLineEdit;
  13197. layout->addRow(tr("Primary series column name:"),column);
  13198. QSpinBox*cacheTime= new QSpinBox;
  13199. cacheTime->setMinimum(0);
  13200. cacheTime->setMaximum(300);
  13201. layout->addRow(tr("Cache time:"),cacheTime);
  13202. QSpinBox*scaleTime= new QSpinBox;
  13203. scaleTime->setMinimum(1);
  13204. scaleTime->setMaximum(300);
  13205. layout->addRow(tr("Scale time:"),scaleTime);
  13206. /*771:*/
  13207. #line 16334 "./typica.w"
  13208. QDomElement referenceElement=
  13209. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13210. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13211. QDomElement node;
  13212. /*:771*/
  13213. #line 206 "./rate.w"
  13214. for(int i= 0;i<configData.size();i++)
  13215. {
  13216. node= configData.at(i).toElement();
  13217. if(node.attribute("name")=="column")
  13218. {
  13219. column->setText(node.attribute("value"));
  13220. }
  13221. else if(node.attribute("name")=="cache")
  13222. {
  13223. cacheTime->setValue(node.attribute("value").toInt());
  13224. }
  13225. else if(node.attribute("name")=="scale")
  13226. {
  13227. scaleTime->setValue(node.attribute("value").toInt());
  13228. }
  13229. }
  13230. updateColumn(column->text());
  13231. updateCacheTime(cacheTime->text());
  13232. updateScaleTime(scaleTime->text());
  13233. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  13234. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  13235. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  13236. setLayout(layout);
  13237. }
  13238. /*:956*//*957:*/
  13239. #line 235 "./rate.w"
  13240. void RateOfChangeConfWidget::updateColumn(const QString&column)
  13241. {
  13242. updateAttribute("column",column);
  13243. }
  13244. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  13245. {
  13246. updateAttribute("cache",seconds);
  13247. }
  13248. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  13249. {
  13250. updateAttribute("scale",seconds);
  13251. }
  13252. /*:957*/
  13253. #line 266 "./rate.w"
  13254. #line 19977 "./typica.w"
  13255. #line 1 "./dataqsdk.w"
  13256. /*:960*/
  13257. #line 529 "./typica.w"
  13258. /*8:*/
  13259. #line 672 "./typica.w"
  13260. template<class TYPE> TYPE getself(QScriptContext*context)
  13261. {
  13262. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  13263. return self;
  13264. }
  13265. template<> QTime getself(QScriptContext*context)
  13266. {
  13267. QTime self= context->thisObject().toVariant().toTime();
  13268. return self;
  13269. }
  13270. template<> QByteArray getself(QScriptContext*context)
  13271. {
  13272. QByteArray self= context->thisObject().toVariant().toByteArray();
  13273. return self;
  13274. }
  13275. template<> SqlQueryConnection*getself(QScriptContext*context)
  13276. {
  13277. SqlQueryConnection*self=
  13278. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  13279. return self;
  13280. }
  13281. template<> QXmlQuery*getself(QScriptContext*context)
  13282. {
  13283. QXmlQuery*self=
  13284. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  13285. return self;
  13286. }
  13287. template<> QXmlStreamWriter*getself(QScriptContext*context)
  13288. {
  13289. QXmlStreamWriter*self=
  13290. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  13291. return self;
  13292. }
  13293. template<> QXmlStreamReader*getself(QScriptContext*context)
  13294. {
  13295. QXmlStreamReader*self=
  13296. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  13297. return self;
  13298. }
  13299. /*:8*//*9:*/
  13300. #line 723 "./typica.w"
  13301. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  13302. {
  13303. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  13304. return argument;
  13305. }
  13306. template<> QString argument(int arg,QScriptContext*context)
  13307. {
  13308. return context->argument(arg).toString();
  13309. }
  13310. template<> QVariant argument(int arg,QScriptContext*context)
  13311. {
  13312. return context->argument(arg).toVariant();
  13313. }
  13314. template<> int argument(int arg,QScriptContext*context)
  13315. {
  13316. return context->argument(arg).toInt32();
  13317. }
  13318. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  13319. {
  13320. return(SqlQueryConnection*)
  13321. qscriptvalue_cast<void*> (context->argument(arg));
  13322. }
  13323. template<> QModelIndex argument(int arg,QScriptContext*context)
  13324. {
  13325. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  13326. }
  13327. template<> double argument(int arg,QScriptContext*context)
  13328. {
  13329. return(double)(context->argument(arg).toNumber());
  13330. }
  13331. template<> Units::Unit argument(int arg,QScriptContext*context)
  13332. {
  13333. return(Units::Unit)(context->argument(arg).toInt32());
  13334. }
  13335. template<> QByteArray argument(int arg,QScriptContext*context)
  13336. {
  13337. return qscriptvalue_cast<QByteArray> (context->argument(arg));
  13338. }
  13339. /*:9*//*13:*/
  13340. #line 815 "./typica.w"
  13341. void setQObjectProperties(QScriptValue,QScriptEngine*)
  13342. {
  13343. }
  13344. /*:13*//*15:*/
  13345. #line 829 "./typica.w"
  13346. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  13347. {
  13348. }
  13349. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  13350. {
  13351. }
  13352. /*:15*//*18:*/
  13353. #line 868 "./typica.w"
  13354. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  13355. {
  13356. QScriptValue object= engine->newQObject(new QWidget);
  13357. setQWidgetProperties(object,engine);
  13358. return object;
  13359. }
  13360. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  13361. {
  13362. setQObjectProperties(value,engine);
  13363. setQPaintDeviceProperties(value,engine);
  13364. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  13365. value.setProperty("activateWindow",
  13366. engine->newFunction(QWidget_activateWindow));
  13367. }
  13368. /*:18*//*19:*/
  13369. #line 890 "./typica.w"
  13370. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  13371. {
  13372. if(context->argumentCount()==1)
  13373. {
  13374. QWidget*self= getself<QWidget*> (context);
  13375. QLayout*layout= argument<QLayout*> (0,context);
  13376. if(layout)
  13377. {
  13378. self->setLayout(layout);
  13379. }
  13380. else
  13381. {
  13382. context->throwError("Incorrect argument type passed to "
  13383. "QWidget::setLayout(). This method requires "
  13384. "a QLayout.");
  13385. }
  13386. }
  13387. else
  13388. {
  13389. context->throwError("Incorrect number of arguments passed to "
  13390. "QWidget::setLayout(). This method takes one "
  13391. "QLayout as an argument.");
  13392. }
  13393. return QScriptValue();
  13394. }
  13395. QScriptValue QWidget_activateWindow(QScriptContext*context,
  13396. QScriptEngine*)
  13397. {
  13398. QWidget*self= getself<QWidget*> (context);
  13399. self->activateWindow();
  13400. return QScriptValue();
  13401. }
  13402. /*:19*//*22:*/
  13403. #line 952 "./typica.w"
  13404. QScriptValue displayWarning(QScriptContext*context,QScriptEngine*)
  13405. {
  13406. QMessageBox::StandardButton selection= QMessageBox::warning(NULL,
  13407. argument<QString> (0,context),
  13408. argument<QString> (1,context),
  13409. QMessageBox::Ok|QMessageBox::Cancel);
  13410. if(selection==QMessageBox::Ok){
  13411. return QScriptValue(true);
  13412. }
  13413. return QScriptValue(false);
  13414. }
  13415. QScriptValue displayError(QScriptContext*context,QScriptEngine*)
  13416. {
  13417. QMessageBox::critical(NULL,argument<QString> (0,context),
  13418. argument<QString> (1,context));
  13419. return QScriptValue();
  13420. }
  13421. /*:22*//*24:*/
  13422. #line 1019 "./typica.w"
  13423. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  13424. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  13425. {
  13426. }
  13427. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  13428. {
  13429. QSettings settings;
  13430. settings.beginGroup(key);
  13431. settings.setValue("pos",pos());
  13432. settings.setValue("size",size());
  13433. settings.endGroup();
  13434. }
  13435. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  13436. {
  13437. QSettings settings;
  13438. settings.beginGroup(key);
  13439. if(settings.contains("size"))
  13440. {
  13441. resize(settings.value("size").toSize());
  13442. }
  13443. if(settings.contains("pos"))
  13444. {
  13445. move(settings.value("pos").toPoint());
  13446. }
  13447. settings.endGroup();
  13448. }
  13449. void ScriptQMainWindow::displayStatus(const QString&message)
  13450. {
  13451. statusBar()->showMessage(message);
  13452. }
  13453. void ScriptQMainWindow::showEvent(QShowEvent*event)
  13454. {
  13455. if(!event->spontaneous())
  13456. {
  13457. /*29:*/
  13458. #line 1131 "./typica.w"
  13459. QSettings settings;
  13460. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  13461. toByteArray());
  13462. /*:29*/
  13463. #line 1059 "./typica.w"
  13464. event->accept();
  13465. }
  13466. else
  13467. {
  13468. event->ignore();
  13469. }
  13470. }
  13471. void ScriptQMainWindow::show()
  13472. {
  13473. QMainWindow::show();
  13474. }
  13475. /*:24*//*25:*/
  13476. #line 1080 "./typica.w"
  13477. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  13478. {
  13479. if(isWindowModified()){
  13480. /*26:*/
  13481. #line 1094 "./typica.w"
  13482. QMessageBox::StandardButton result;
  13483. result= QMessageBox::warning(this,"Typica",closePrompt(),
  13484. QMessageBox::Ok|QMessageBox::Cancel);
  13485. if(result==QMessageBox::Cancel)
  13486. {
  13487. event->ignore();
  13488. return;
  13489. }
  13490. /*:26*/
  13491. #line 1084 "./typica.w"
  13492. }
  13493. emit aboutToClose();
  13494. /*28:*/
  13495. #line 1125 "./typica.w"
  13496. QSettings settings;
  13497. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  13498. /*:28*/
  13499. #line 1087 "./typica.w"
  13500. event->accept();
  13501. }
  13502. /*:25*//*27:*/
  13503. #line 1106 "./typica.w"
  13504. QString ScriptQMainWindow::closePrompt()
  13505. {
  13506. return cprompt;
  13507. }
  13508. void ScriptQMainWindow::setClosePrompt(QString prompt)
  13509. {
  13510. cprompt= prompt;
  13511. }
  13512. /*:27*//*32:*/
  13513. #line 1159 "./typica.w"
  13514. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  13515. {
  13516. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  13517. setQMainWindowProperties(object,engine);
  13518. return object;
  13519. }
  13520. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  13521. {
  13522. setQWidgetProperties(value,engine);
  13523. value.setProperty("setCentralWidget",
  13524. engine->newFunction(QMainWindow_setCentralWidget));
  13525. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  13526. }
  13527. /*:32*//*33:*/
  13528. #line 1181 "./typica.w"
  13529. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  13530. QScriptEngine*)
  13531. {
  13532. if(context->argumentCount()==1)
  13533. {
  13534. QMainWindow*self= getself<QMainWindow*> (context);
  13535. QWidget*widget= argument<QWidget*> (0,context);
  13536. if(widget)
  13537. {
  13538. self->setCentralWidget(widget);
  13539. }
  13540. else
  13541. {
  13542. context->throwError("Incorrect argument type passed to "
  13543. "QMainWindow::setCentralWidget(). This "
  13544. "method requires a QWidget.");
  13545. }
  13546. }
  13547. else
  13548. {
  13549. context->throwError("Incorrect number of arguments passed to "
  13550. "QMainWindow::setCentralWidget(). This method "
  13551. "takes one QWidget as an argument.");
  13552. }
  13553. return QScriptValue();
  13554. }
  13555. /*:33*//*34:*/
  13556. #line 1215 "./typica.w"
  13557. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  13558. {
  13559. QScriptValue object;
  13560. if(context->argumentCount()==0)
  13561. {
  13562. QMainWindow*self= getself<QMainWindow*> (context);
  13563. QMenuBar*bar= self->menuBar();
  13564. object= engine->newQObject(bar);
  13565. setQMenuBarProperties(object,engine);
  13566. }
  13567. else
  13568. {
  13569. context->throwError("Incorrect number of arguments passed to "
  13570. "QMainWindow::menuBar(). This method takes no "
  13571. "arguments.");
  13572. }
  13573. return object;
  13574. }
  13575. /*:34*//*36:*/
  13576. #line 1245 "./typica.w"
  13577. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  13578. {
  13579. setQWidgetProperties(value,engine);
  13580. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  13581. }
  13582. /*:36*//*37:*/
  13583. #line 1260 "./typica.w"
  13584. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  13585. {
  13586. QScriptValue object;
  13587. if(context->argumentCount()==1)
  13588. {
  13589. QMenuBar*self= getself<QMenuBar*> (context);
  13590. QString title= argument<QString> (0,context);
  13591. object= engine->newQObject(self->addMenu(title));
  13592. setQMenuProperties(object,engine);
  13593. }
  13594. else
  13595. {
  13596. context->throwError("Incorrect number of arguments passed to "
  13597. "QMenuBar::addMenu(). This method takes one "
  13598. "string as an argument.");
  13599. }
  13600. return object;
  13601. }
  13602. /*:37*//*39:*/
  13603. #line 1290 "./typica.w"
  13604. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  13605. {
  13606. setQWidgetProperties(value,engine);
  13607. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  13608. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  13609. }
  13610. /*:39*//*40:*/
  13611. #line 1300 "./typica.w"
  13612. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  13613. {
  13614. if(context->argumentCount()==1)
  13615. {
  13616. QMenu*self= getself<QMenu*> (context);
  13617. QAction*action= argument<QAction*> (0,context);
  13618. if(action)
  13619. {
  13620. self->addAction(action);
  13621. }
  13622. else
  13623. {
  13624. context->throwError("Incorrect argument type passed to "
  13625. "QMenu::addAction(). This method requires a "
  13626. "QAction.");
  13627. }
  13628. }
  13629. else
  13630. {
  13631. context->throwError("Incorrect number of arguments passed to "
  13632. "QMenu::addAction(). This method takes one "
  13633. "QAction as an argument.");
  13634. }
  13635. return QScriptValue();
  13636. }
  13637. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  13638. {
  13639. if(context->argumentCount()==0)
  13640. {
  13641. QMenu*self= getself<QMenu*> (context);
  13642. self->addSeparator();
  13643. }
  13644. else
  13645. {
  13646. context->throwError("Incorrect number of arguments passed to "
  13647. "QMenu::addSeparator(). This method takes no "
  13648. "arguments.");
  13649. }
  13650. return QScriptValue();
  13651. }
  13652. /*:40*//*43:*/
  13653. #line 1362 "./typica.w"
  13654. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  13655. {
  13656. QScriptValue object= engine->newQObject(new QFrame);
  13657. setQFrameProperties(object,engine);
  13658. return object;
  13659. }
  13660. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  13661. {
  13662. setQWidgetProperties(value,engine);
  13663. }
  13664. /*:43*//*46:*/
  13665. #line 1396 "./typica.w"
  13666. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  13667. {
  13668. QString text;
  13669. if(context->argumentCount()==1)
  13670. {
  13671. text= argument<QString> (0,context);
  13672. }
  13673. QScriptValue object= engine->newQObject(new QLabel(text));
  13674. setQLabelProperties(object,engine);
  13675. return object;
  13676. }
  13677. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  13678. {
  13679. setQFrameProperties(value,engine);
  13680. }
  13681. /*:46*//*49:*/
  13682. #line 1438 "./typica.w"
  13683. QScriptValue constructQSvgWidget(QScriptContext*,
  13684. QScriptEngine*engine)
  13685. {
  13686. QScriptValue object= engine->newQObject(new QSvgWidget);
  13687. setQSvgWidgetProperties(object,engine);
  13688. return object;
  13689. }
  13690. /*:49*//*50:*/
  13691. #line 1449 "./typica.w"
  13692. void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine)
  13693. {
  13694. setQWidgetProperties(value,engine);
  13695. value.setProperty("loadDevice",
  13696. engine->newFunction(QSvgWidget_loadDevice));
  13697. }
  13698. QScriptValue QSvgWidget_loadDevice(QScriptContext*context,QScriptEngine*)
  13699. {
  13700. if(context->argumentCount()==1)
  13701. {
  13702. QSvgWidget*self= getself<QSvgWidget*> (context);
  13703. QIODevice*device= argument<QIODevice*> (0,context);
  13704. device->reset();
  13705. QByteArray data= device->readAll();
  13706. self->load(data);
  13707. }
  13708. else
  13709. {
  13710. context->throwError("Incorrect number of arguments passed to "
  13711. "QSvgWidget::loadData(). This method takes one "
  13712. "QIODevice as an argument.");
  13713. }
  13714. return QScriptValue();
  13715. }
  13716. /*:50*//*52:*/
  13717. #line 1487 "./typica.w"
  13718. void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *,
  13719. QStack<QLayout*> *layoutStack)
  13720. {
  13721. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  13722. QSvgWidget*widget= new QSvgWidget;
  13723. layout->addWidget(widget);
  13724. QString id= element.attribute("id");
  13725. if(!id.isEmpty())
  13726. {
  13727. widget->setObjectName(id);
  13728. }
  13729. }
  13730. /*:52*//*55:*/
  13731. #line 1520 "./typica.w"
  13732. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  13733. {
  13734. QScriptValue object= engine->newQObject(new QLineEdit());
  13735. setQLineEditProperties(object,engine);
  13736. return object;
  13737. }
  13738. /*:55*//*56:*/
  13739. #line 1531 "./typica.w"
  13740. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  13741. {
  13742. setQWidgetProperties(value,engine);
  13743. }
  13744. /*:56*//*59:*/
  13745. #line 1567 "./typica.w"
  13746. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  13747. {
  13748. QScriptValue object= engine->newQObject(new QSplitter);
  13749. setQSplitterProperties(object,engine);
  13750. return object;
  13751. }
  13752. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  13753. {
  13754. setQFrameProperties(value,engine);
  13755. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  13756. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  13757. value.setProperty("restoreState",
  13758. engine->newFunction(QSplitter_restoreState));
  13759. value.setProperty("count",engine->newFunction(QSplitter_count));
  13760. }
  13761. /*:59*//*60:*/
  13762. #line 1588 "./typica.w"
  13763. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  13764. {
  13765. if(context->argumentCount()==1)
  13766. {
  13767. QSplitter*self= getself<QSplitter*> (context);
  13768. QWidget*widget= argument<QWidget*> (0,context);
  13769. if(widget)
  13770. {
  13771. self->addWidget(widget);
  13772. }
  13773. else
  13774. {
  13775. context->throwError("Incorrect argument type passed to "
  13776. "QSplitter::addWidget(). This method "
  13777. "requires a QWidget.");
  13778. }
  13779. }
  13780. else
  13781. {
  13782. context->throwError("Incorrect number of arguments passed to "
  13783. "QSplitter::addWidget(). This method takes one "
  13784. "QWidget as an argument.");
  13785. }
  13786. return QScriptValue();
  13787. }
  13788. /*:60*//*61:*/
  13789. #line 1625 "./typica.w"
  13790. QScriptValue QSplitter_count(QScriptContext*context,QScriptEngine*)
  13791. {
  13792. QSplitter*self= getself<QSplitter*> (context);
  13793. return QScriptValue(self->count());
  13794. }
  13795. /*:61*//*62:*/
  13796. #line 1638 "./typica.w"
  13797. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  13798. {
  13799. if(context->argumentCount()==1)
  13800. {
  13801. QSplitter*self= getself<QSplitter*> (context);
  13802. QString key= argument<QString> (0,context);
  13803. QSettings settings;
  13804. settings.setValue(key,self->saveState());
  13805. }
  13806. else
  13807. {
  13808. context->throwError("Incorrect number of arguments passed to "
  13809. "QSplitter::saveState(). This method takes one "
  13810. "string as an argument.");
  13811. }
  13812. return QScriptValue();
  13813. }
  13814. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  13815. {
  13816. if(context->argumentCount()==1)
  13817. {
  13818. QSplitter*self= getself<QSplitter*> (context);
  13819. QString key= argument<QString> (0,context);
  13820. QSettings settings;
  13821. self->restoreState(settings.value(key).toByteArray());
  13822. }
  13823. else
  13824. {
  13825. context->throwError("Incorrect number of arguments passed to "
  13826. "QSplitter::restoreState(). This method takes "
  13827. "one string as an argument.");
  13828. }
  13829. return QScriptValue();
  13830. }
  13831. /*:62*//*64:*/
  13832. #line 1691 "./typica.w"
  13833. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  13834. {
  13835. setQLayoutItemProperties(value,engine);
  13836. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  13837. }
  13838. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  13839. {
  13840. if(context->argumentCount()==1)
  13841. {
  13842. QLayout*self= getself<QLayout*> (context);
  13843. QWidget*widget= argument<QWidget*> (0,context);
  13844. if(widget)
  13845. {
  13846. self->addWidget(widget);
  13847. }
  13848. else
  13849. {
  13850. context->throwError("Incorrect argument type passed to "
  13851. "QLayout::addWidget(). This method requires "
  13852. "a QWidget.");
  13853. }
  13854. }
  13855. else
  13856. {
  13857. context->throwError("Incorrect number of arguments passed to "
  13858. "QLayout::addWidget(). This method takes one "
  13859. "QWidget as an argument.");
  13860. }
  13861. return QScriptValue();
  13862. }
  13863. /*:64*//*67:*/
  13864. #line 1758 "./typica.w"
  13865. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  13866. {
  13867. QScriptValue object=
  13868. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  13869. setQBoxLayoutProperties(object,engine);
  13870. return object;
  13871. }
  13872. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  13873. {
  13874. setQLayoutProperties(value,engine);
  13875. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  13876. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  13877. }
  13878. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  13879. {
  13880. if(context->argumentCount()> 0&&context->argumentCount()<3)
  13881. {
  13882. QBoxLayout*self= getself<QBoxLayout*> (context);
  13883. QLayout*layout= argument<QLayout*> (0,context);
  13884. int stretch= 0;
  13885. if(context->argumentCount()==2)
  13886. {
  13887. stretch= argument<int> (1,context);
  13888. }
  13889. if(layout)
  13890. {
  13891. self->addLayout(layout,stretch);
  13892. }
  13893. else
  13894. {
  13895. context->throwError("Incorrect argument type passed to "
  13896. "QLayout::addLayout(). This method requires "
  13897. "a QLayout.");
  13898. }
  13899. }
  13900. else
  13901. {
  13902. context->throwError("Incorrect number of arguments passed to "
  13903. "QLayout::addLayout(). This method takes one "
  13904. "QLayout as an argument and optionally one integer.");
  13905. }
  13906. return QScriptValue();
  13907. }
  13908. /*:67*//*68:*/
  13909. #line 1809 "./typica.w"
  13910. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  13911. {
  13912. if(context->argumentCount()> 0&&context->argumentCount()<4)
  13913. {
  13914. QBoxLayout*self= getself<QBoxLayout*> (context);
  13915. QWidget*widget= argument<QWidget*> (0,context);
  13916. int stretch= 0;
  13917. Qt::Alignment alignment= 0;
  13918. if(context->argumentCount()> 1)
  13919. {
  13920. stretch= argument<int> (1,context);
  13921. }
  13922. if(context->argumentCount()> 2)
  13923. {
  13924. alignment= (Qt::Alignment)(argument<int> (2,context));
  13925. }
  13926. if(widget)
  13927. {
  13928. self->addWidget(widget,stretch,alignment);
  13929. }
  13930. else
  13931. {
  13932. context->throwError("Incorrect argument type passed to "
  13933. "QBoxLayout::addWidget(). This method requires "
  13934. "a QWidget.");
  13935. }
  13936. }
  13937. else
  13938. {
  13939. context->throwError("Incorrect number of arguments passed to "
  13940. "QBoxLayout::addWidget(). This method takes one "
  13941. "QWidget and optionally up to two integers as "
  13942. "arguments.");
  13943. }
  13944. return QScriptValue();
  13945. }
  13946. /*:68*//*71:*/
  13947. #line 1873 "./typica.w"
  13948. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  13949. {
  13950. QScriptValue object= engine->newQObject(new QAction(NULL));
  13951. setQActionProperties(object,engine);
  13952. return object;
  13953. }
  13954. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  13955. {
  13956. setQObjectProperties(value,engine);
  13957. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  13958. }
  13959. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  13960. {
  13961. if(context->argumentCount()==1)
  13962. {
  13963. QAction*self= getself<QAction*> (context);
  13964. self->setShortcut(argument<QString> (0,context));
  13965. }
  13966. else
  13967. {
  13968. context->throwError("Incorrect number of arguments passed to "
  13969. "QAction::setShortcut(). This method takes one "
  13970. "string as an argument.");
  13971. }
  13972. return QScriptValue();
  13973. }
  13974. /*:71*//*74:*/
  13975. #line 1931 "./typica.w"
  13976. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  13977. QScriptEngine*engine)
  13978. {
  13979. QScriptValue retval;
  13980. if(context->argumentCount()==3)
  13981. {
  13982. QWidget*widget= argument<QWidget*> (0,context);
  13983. if(widget)
  13984. {
  13985. QString caption= argument<QString> (1,context);
  13986. QString dir= argument<QString> (2,context);
  13987. retval= QScriptValue(engine,
  13988. QFileDialog::getOpenFileName(widget,caption,
  13989. dir,"",0,0));
  13990. setQFileDialogProperties(retval,engine);
  13991. }
  13992. else
  13993. {
  13994. context->throwError("Incorrect argument type passed to "
  13995. "QFileDialog::getOpenFileName(). The first "
  13996. "argument to this method must be a QWidget.");
  13997. }
  13998. }
  13999. else
  14000. {
  14001. context->throwError("Incorrect number of arguments passed to "
  14002. "QFileDialog::getOpenFileName(). This method "
  14003. "takes one QWidget followed by two strings for a "
  14004. "total of three arguments.");
  14005. }
  14006. return retval;
  14007. }
  14008. /*:74*//*75:*/
  14009. #line 1967 "./typica.w"
  14010. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  14011. QScriptEngine*engine)
  14012. {
  14013. QScriptValue retval;
  14014. if(context->argumentCount()==3)
  14015. {
  14016. QWidget*widget= argument<QWidget*> (0,context);
  14017. if(widget)
  14018. {
  14019. QString caption= argument<QString> (1,context);
  14020. QString dir= argument<QString> (2,context);
  14021. retval= QScriptValue(engine,
  14022. QFileDialog::getSaveFileName(widget,caption,
  14023. dir,"",0,0));
  14024. setQFileDialogProperties(retval,engine);
  14025. }
  14026. else
  14027. {
  14028. context->throwError("Incorrect argument type passed to "
  14029. "QFileDialog::getSaveFileName(). The first "
  14030. "argument to this method must be a QWidget.");
  14031. }
  14032. }
  14033. else
  14034. {
  14035. context->throwError("Incorrect number of arguments passed to "
  14036. "QFileDialog::getSaveFileName(). This method "
  14037. "takes one QWidget followed by two strings for a "
  14038. "total of three arguments.");
  14039. }
  14040. return retval;
  14041. }
  14042. /*:75*//*76:*/
  14043. #line 2004 "./typica.w"
  14044. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  14045. {
  14046. setQDialogProperties(value,engine);
  14047. }
  14048. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  14049. {
  14050. setQWidgetProperties(value,engine);
  14051. }
  14052. /*:76*//*79:*/
  14053. #line 2045 "./typica.w"
  14054. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  14055. {
  14056. QScriptValue object=
  14057. engine->newQObject(new QFile(argument<QString> (0,context)));
  14058. setQFileProperties(object,engine);
  14059. return object;
  14060. }
  14061. /*:79*//*80:*/
  14062. #line 2056 "./typica.w"
  14063. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  14064. {
  14065. setQIODeviceProperties(value,engine);
  14066. value.setProperty("remove",engine->newFunction(QFile_remove));
  14067. }
  14068. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  14069. {
  14070. QFile*self= getself<QFile*> (context);
  14071. bool retval= self->remove();
  14072. return QScriptValue(engine,retval);
  14073. }
  14074. /*:80*//*81:*/
  14075. #line 2078 "./typica.w"
  14076. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  14077. {
  14078. setQObjectProperties(value,engine);
  14079. value.setProperty("open",engine->newFunction(QIODevice_open));
  14080. value.setProperty("close",engine->newFunction(QIODevice_close));
  14081. value.setProperty("readToString",
  14082. engine->newFunction(QIODevice_readToString));
  14083. value.setProperty("putChar",engine->newFunction(QIODevice_putChar));
  14084. value.setProperty("writeString",engine->newFunction(QIODevice_writeString));
  14085. value.setProperty("writeBytes",engine->newFunction(QIODevice_writeBytes));
  14086. value.setProperty("readBytes",engine->newFunction(QIODevice_readBytes));
  14087. value.setProperty("peek",engine->newFunction(QIODevice_peek));
  14088. value.setProperty("read",engine->newFunction(QIODevice_read));
  14089. }
  14090. /*:81*//*82:*/
  14091. #line 2099 "./typica.w"
  14092. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  14093. {
  14094. QIODevice*self= getself<QIODevice*> (context);
  14095. bool retval= false;
  14096. if(context->argumentCount()==1)
  14097. {
  14098. switch(argument<int> (0,context))
  14099. {
  14100. case 1:
  14101. retval= self->open(QIODevice::ReadOnly);
  14102. break;
  14103. case 2:
  14104. retval= self->open(QIODevice::WriteOnly);
  14105. break;
  14106. case 3:
  14107. retval= self->open(QIODevice::ReadWrite);
  14108. break;
  14109. default:
  14110. break;
  14111. }
  14112. }
  14113. else
  14114. {
  14115. retval= self->open(QIODevice::ReadWrite);
  14116. }
  14117. return QScriptValue(retval);
  14118. }
  14119. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  14120. {
  14121. QIODevice*self= getself<QIODevice*> (context);
  14122. self->close();
  14123. return QScriptValue();
  14124. }
  14125. /*:82*//*83:*/
  14126. #line 2139 "./typica.w"
  14127. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  14128. {
  14129. QIODevice*self= getself<QIODevice*> (context);
  14130. self->reset();
  14131. return QScriptValue(QString(self->readAll()));
  14132. }
  14133. /*:83*//*84:*/
  14134. #line 2155 "./typica.w"
  14135. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*)
  14136. {
  14137. QIODevice*self= getself<QIODevice*> (context);
  14138. if(context->argumentCount()==1)
  14139. {
  14140. return QScriptValue(self->putChar(argument<QString> (0,context).toUtf8().at(0)));
  14141. }
  14142. context->throwError("Incorrect number of arguments passed to "
  14143. "QIODevice::putChar()");
  14144. return QScriptValue();
  14145. }
  14146. /*:84*//*85:*/
  14147. #line 2173 "./typica.w"
  14148. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*)
  14149. {
  14150. QIODevice*self= getself<QIODevice*> (context);
  14151. if(context->argumentCount()==1)
  14152. {
  14153. self->write(argument<QString> (0,context).toUtf8());
  14154. }
  14155. else
  14156. {
  14157. context->throwError("Incorrect number of arguments passed to "
  14158. "QIODevice::writeString()");
  14159. }
  14160. return QScriptValue();
  14161. }
  14162. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*)
  14163. {
  14164. QIODevice*self= getself<QIODevice*> (context);
  14165. if(context->argumentCount()==1)
  14166. {
  14167. self->write(argument<QByteArray> (0,context));
  14168. }
  14169. else
  14170. {
  14171. context->throwError("Incorrect number of arguments passed to "
  14172. "QIODevice::writeBytes()");
  14173. }
  14174. return QScriptValue();
  14175. }
  14176. /*:85*//*86:*/
  14177. #line 2207 "./typica.w"
  14178. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine)
  14179. {
  14180. QIODevice*self= getself<QIODevice*> (context);
  14181. QScriptValue value= engine->toScriptValue<QByteArray> (self->readAll());
  14182. setQByteArrayProperties(value,engine);
  14183. return value;
  14184. }
  14185. /*:86*//*87:*/
  14186. #line 2218 "./typica.w"
  14187. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine)
  14188. {
  14189. QIODevice*self= getself<QIODevice*> (context);
  14190. QScriptValue value= engine->toScriptValue<QByteArray> (
  14191. self->peek(argument<int> (0,context)));
  14192. setQByteArrayProperties(value,engine);
  14193. return value;
  14194. }
  14195. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine)
  14196. {
  14197. QIODevice*self= getself<QIODevice*> (context);
  14198. QScriptValue value= engine->toScriptValue<QByteArray> (
  14199. self->read(argument<int> (0,context)));
  14200. setQByteArrayProperties(value,engine);
  14201. return value;
  14202. }
  14203. /*:87*//*90:*/
  14204. #line 2263 "./typica.w"
  14205. QScriptValue constructQProcess(QScriptContext*,QScriptEngine*engine)
  14206. {
  14207. QScriptValue object= engine->newQObject(new QProcess);
  14208. setQProcessProperties(object,engine);
  14209. return object;
  14210. }
  14211. /*:90*//*91:*/
  14212. #line 2274 "./typica.w"
  14213. void setQProcessProperties(QScriptValue value,QScriptEngine*engine)
  14214. {
  14215. setQIODeviceProperties(value,engine);
  14216. value.setProperty("execute",engine->newFunction(QProcess_execute));
  14217. value.setProperty("startDetached",engine->newFunction(QProcess_startDetached));
  14218. value.setProperty("setWorkingDirectory",engine->newFunction(QProcess_setWorkingDirectory));
  14219. value.setProperty("start",engine->newFunction(QProcess_start));
  14220. }
  14221. /*:91*//*92:*/
  14222. #line 2288 "./typica.w"
  14223. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*)
  14224. {
  14225. QProcess*self= getself<QProcess*> (context);
  14226. QString program= argument<QString> (0,context);
  14227. QStringList arguments= QStringList();
  14228. if(context->argumentCount()> 1){
  14229. arguments= argument<QVariant> (1,context).toStringList();
  14230. }
  14231. int retval= self->execute(program,arguments);
  14232. return QScriptValue(retval);
  14233. }
  14234. /*:92*//*93:*/
  14235. #line 2303 "./typica.w"
  14236. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*)
  14237. {
  14238. QProcess*self= getself<QProcess*> (context);
  14239. QString program= argument<QString> (0,context);
  14240. QStringList arguments= QStringList();
  14241. if(context->argumentCount()> 1){
  14242. arguments= argument<QVariant> (1,context).toStringList();
  14243. }
  14244. QString workingDirectory= "";
  14245. if(context->argumentCount()> 2){
  14246. workingDirectory= argument<QString> (2,context);
  14247. }
  14248. bool retval;
  14249. switch(context->argumentCount())
  14250. {
  14251. case 1:
  14252. retval= self->startDetached(program);
  14253. break;
  14254. case 2:
  14255. retval= self->startDetached(program,arguments);
  14256. break;
  14257. case 3:
  14258. retval= self->startDetached(program,arguments,workingDirectory);
  14259. break;
  14260. default:
  14261. retval= false;
  14262. }
  14263. return QScriptValue(retval);
  14264. }
  14265. /*:93*//*94:*/
  14266. #line 2336 "./typica.w"
  14267. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*)
  14268. {
  14269. QProcess*self= getself<QProcess*> (context);
  14270. QString directory= argument<QString> (0,context);
  14271. self->setWorkingDirectory(directory);
  14272. return QScriptValue();
  14273. }
  14274. /*:94*//*95:*/
  14275. #line 2348 "./typica.w"
  14276. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*)
  14277. {
  14278. QProcess*self= getself<QProcess*> (context);
  14279. QString program= argument<QString> (0,context);
  14280. QStringList arguments= QStringList();
  14281. if(context->argumentCount()> 1){
  14282. arguments= argument<QVariant> (1,context).toStringList();
  14283. }
  14284. self->start(program,arguments);
  14285. return QScriptValue();
  14286. }
  14287. /*:95*//*97:*/
  14288. #line 2389 "./typica.w"
  14289. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes)
  14290. {
  14291. QScriptValue object= engine->newVariant(QVariant(bytes));
  14292. setQByteArrayProperties(object,engine);
  14293. return object;
  14294. }
  14295. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes)
  14296. {
  14297. bytes= value.toVariant().toByteArray();
  14298. }
  14299. /*:97*//*99:*/
  14300. #line 2412 "./typica.w"
  14301. QScriptValue constructQByteArray(QScriptContext*,QScriptEngine*engine)
  14302. {
  14303. QScriptValue object= engine->toScriptValue<QByteArray> (QByteArray());
  14304. setQByteArrayProperties(object,engine);
  14305. return object;
  14306. }
  14307. /*:99*//*100:*/
  14308. #line 2423 "./typica.w"
  14309. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine)
  14310. {
  14311. value.setProperty("fromHex",engine->newFunction(QByteArray_fromHex));
  14312. value.setProperty("getAt",engine->newFunction(QByteArray_getAt));
  14313. value.setProperty("setAt",engine->newFunction(QByteArray_setAt));
  14314. value.setProperty("appendBytes",engine->newFunction(QByteArray_appendBytes));
  14315. value.setProperty("appendString",engine->newFunction(QByteArray_appendString));
  14316. value.setProperty("size",engine->newFunction(QByteArray_size));
  14317. value.setProperty("left",engine->newFunction(QByteArray_left));
  14318. value.setProperty("right",engine->newFunction(QByteArray_right));
  14319. value.setProperty("mid",engine->newFunction(QByteArray_mid));
  14320. value.setProperty("chop",engine->newFunction(QByteArray_chop));
  14321. value.setProperty("remove",engine->newFunction(QByteArray_remove));
  14322. value.setProperty("toInt8",engine->newFunction(QByteArray_toInt8));
  14323. value.setProperty("toInt16",engine->newFunction(QByteArray_toInt16));
  14324. value.setProperty("toInt32",engine->newFunction(QByteArray_toInt32));
  14325. value.setProperty("toFloat",engine->newFunction(QByteArray_toFloat));
  14326. value.setProperty("toDouble",engine->newFunction(QByteArray_toDouble));
  14327. }
  14328. /*:100*//*101:*/
  14329. #line 2447 "./typica.w"
  14330. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine)
  14331. {
  14332. QByteArray self= getself<QByteArray> (context);
  14333. QByteArray retval;
  14334. retval= self.fromHex(argument<QString> (0,context).toUtf8());
  14335. QScriptValue value= engine->toScriptValue<QByteArray> (retval);
  14336. setQByteArrayProperties(value,engine);
  14337. return value;
  14338. }
  14339. /*:101*//*102:*/
  14340. #line 2461 "./typica.w"
  14341. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*)
  14342. {
  14343. QByteArray self= getself<QByteArray> (context);
  14344. return QScriptValue((int)(self.at(argument<int> (0,context))));
  14345. }
  14346. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*)
  14347. {
  14348. QByteArray self= getself<QByteArray> (context);
  14349. self[argument<int> (0,context)]= (char)(argument<int> (1,context));
  14350. return QScriptValue();
  14351. }
  14352. /*:102*//*103:*/
  14353. #line 2479 "./typica.w"
  14354. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine)
  14355. {
  14356. QByteArray self= getself<QByteArray> (context);
  14357. QScriptValue value=
  14358. engine->toScriptValue<QByteArray> (
  14359. self.append(argument<QByteArray> (0,context)));
  14360. setQByteArrayProperties(value,engine);
  14361. return value;
  14362. }
  14363. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine)
  14364. {
  14365. QByteArray self= getself<QByteArray> (context);
  14366. QScriptValue value= engine->toScriptValue<QByteArray> (
  14367. self.append(argument<QString> (0,context)));
  14368. setQByteArrayProperties(value,engine);
  14369. return value;
  14370. }
  14371. /*:103*//*104:*/
  14372. #line 2501 "./typica.w"
  14373. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*)
  14374. {
  14375. QByteArray self= getself<QByteArray> (context);
  14376. return QScriptValue(self.size());
  14377. }
  14378. /*:104*//*105:*/
  14379. #line 2511 "./typica.w"
  14380. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine)
  14381. {
  14382. QByteArray self= getself<QByteArray> (context);
  14383. QScriptValue value= engine->toScriptValue<QByteArray> (
  14384. self.left(argument<int> (0,context)));
  14385. setQByteArrayProperties(value,engine);
  14386. return value;
  14387. }
  14388. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine)
  14389. {
  14390. QByteArray self= getself<QByteArray> (context);
  14391. QScriptValue value= engine->toScriptValue<QByteArray> (
  14392. self.right(argument<int> (0,context)));
  14393. setQByteArrayProperties(value,engine);
  14394. return value;
  14395. }
  14396. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine)
  14397. {
  14398. QByteArray self= getself<QByteArray> (context);
  14399. int length= -1;
  14400. if(context->argumentCount()> 1)
  14401. {
  14402. length= argument<int> (1,context);
  14403. }
  14404. QScriptValue value= engine->toScriptValue<QByteArray> (
  14405. self.mid(argument<int> (0,context),length));
  14406. setQByteArrayProperties(value,engine);
  14407. return value;
  14408. }
  14409. /*:105*//*106:*/
  14410. #line 2546 "./typica.w"
  14411. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*)
  14412. {
  14413. QByteArray self= getself<QByteArray> (context);
  14414. self.chop(argument<int> (0,context));
  14415. return QScriptValue();
  14416. }
  14417. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine)
  14418. {
  14419. QByteArray self= getself<QByteArray> (context);
  14420. QScriptValue value= engine->toScriptValue<QByteArray> (
  14421. self.remove(argument<int> (0,context),argument<int> (1,context)));
  14422. setQByteArrayProperties(value,engine);
  14423. return value;
  14424. }
  14425. /*:106*//*107:*/
  14426. #line 2569 "./typica.w"
  14427. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*)
  14428. {
  14429. QByteArray self= getself<QByteArray> (context);
  14430. int value= 0;
  14431. char*bytes= (char*)&value;
  14432. bytes[0]= self[0];
  14433. return QScriptValue(value);
  14434. }
  14435. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*)
  14436. {
  14437. QByteArray self= getself<QByteArray> (context);
  14438. int value= 0;
  14439. char*bytes= (char*)&value;
  14440. bytes[0]= self[0];
  14441. bytes[1]= self[1];
  14442. return QScriptValue(value);
  14443. }
  14444. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*)
  14445. {
  14446. QByteArray self= getself<QByteArray> (context);
  14447. int value= 0;
  14448. char*bytes= (char*)&value;
  14449. bytes[0]= self[0];
  14450. bytes[1]= self[1];
  14451. bytes[2]= self[2];
  14452. bytes[3]= self[3];
  14453. return QScriptValue(value);
  14454. }
  14455. /*:107*//*108:*/
  14456. #line 2605 "./typica.w"
  14457. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*)
  14458. {
  14459. QByteArray self= getself<QByteArray> (context);
  14460. float value= 0.0;
  14461. char*bytes= (char*)&value;
  14462. bytes[0]= self[0];
  14463. bytes[1]= self[1];
  14464. bytes[2]= self[2];
  14465. bytes[3]= self[3];
  14466. return QScriptValue(value);
  14467. }
  14468. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*)
  14469. {
  14470. QByteArray self= getself<QByteArray> (context);
  14471. double value= 0.0;
  14472. char*bytes= (char*)&value;
  14473. bytes[0]= self[0];
  14474. bytes[1]= self[1];
  14475. bytes[2]= self[2];
  14476. bytes[3]= self[3];
  14477. bytes[4]= self[4];
  14478. bytes[5]= self[5];
  14479. bytes[6]= self[6];
  14480. bytes[7]= self[7];
  14481. return QScriptValue(value);
  14482. }
  14483. /*:108*//*111:*/
  14484. #line 2660 "./typica.w"
  14485. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine)
  14486. {
  14487. qint8 value= (qint8)(argument<int> (0,context));
  14488. char*bytes= (char*)&value;
  14489. QByteArray retval;
  14490. retval.resize(1);
  14491. retval[0]= bytes[0];
  14492. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14493. setQByteArrayProperties(v,engine);
  14494. return v;
  14495. }
  14496. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine)
  14497. {
  14498. qint16 value= (qint16)(argument<int> (0,context));
  14499. char*bytes= (char*)&value;
  14500. QByteArray retval;
  14501. retval.resize(2);
  14502. retval[0]= bytes[0];
  14503. retval[1]= bytes[1];
  14504. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14505. setQByteArrayProperties(v,engine);
  14506. return v;
  14507. }
  14508. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine)
  14509. {
  14510. qint32 value= (qint32)(argument<int> (0,context));
  14511. char*bytes= (char*)&value;
  14512. QByteArray retval;
  14513. retval.resize(4);
  14514. retval[0]= bytes[0];
  14515. retval[1]= bytes[1];
  14516. retval[2]= bytes[2];
  14517. retval[3]= bytes[3];
  14518. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14519. setQByteArrayProperties(v,engine);
  14520. return v;
  14521. }
  14522. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine)
  14523. {
  14524. float value= (float)(argument<double> (0,context));
  14525. char*bytes= (char*)&value;
  14526. QByteArray retval;
  14527. retval.resize(4);
  14528. retval[0]= bytes[0];
  14529. retval[1]= bytes[1];
  14530. retval[2]= bytes[2];
  14531. retval[3]= bytes[3];
  14532. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14533. setQByteArrayProperties(v,engine);
  14534. return v;
  14535. }
  14536. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine)
  14537. {
  14538. double value= (double)(argument<double> (0,context));
  14539. char*bytes= (char*)&value;
  14540. QByteArray retval;
  14541. retval.resize(8);
  14542. retval[0]= bytes[0];
  14543. retval[1]= bytes[1];
  14544. retval[2]= bytes[2];
  14545. retval[3]= bytes[3];
  14546. retval[4]= bytes[4];
  14547. retval[5]= bytes[5];
  14548. retval[6]= bytes[6];
  14549. retval[7]= bytes[7];
  14550. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  14551. setQByteArrayProperties(v,engine);
  14552. return v;
  14553. }
  14554. /*:111*//*114:*/
  14555. #line 2757 "./typica.w"
  14556. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  14557. {
  14558. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  14559. QScriptValue object= engine->newQObject(new QBuffer(array));
  14560. setQBufferProperties(object,engine);
  14561. return object;
  14562. }
  14563. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  14564. {
  14565. setQIODeviceProperties(value,engine);
  14566. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  14567. }
  14568. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  14569. {
  14570. QBuffer*self= getself<QBuffer*> (context);
  14571. self->setData(argument<QString> (0,context).toAscii());
  14572. return QScriptValue();
  14573. }
  14574. /*:114*//*117:*/
  14575. #line 2806 "./typica.w"
  14576. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  14577. {
  14578. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  14579. setXQueryProperties(object,engine);
  14580. return object;
  14581. }
  14582. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  14583. {
  14584. QXmlQuery*self= getself<QXmlQuery*> (context);
  14585. delete self;
  14586. return QScriptValue();
  14587. }
  14588. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  14589. {
  14590. value.setProperty("bind",engine->newFunction(XQuery_bind));
  14591. value.setProperty("exec",engine->newFunction(XQuery_exec));
  14592. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  14593. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  14594. }
  14595. /*:117*//*118:*/
  14596. #line 2832 "./typica.w"
  14597. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  14598. {
  14599. QXmlQuery*self= getself<QXmlQuery*> (context);
  14600. QIODevice*buffer= argument<QIODevice*> (1,context);
  14601. self->bindVariable(argument<QString> (0,context),buffer);
  14602. return QScriptValue();
  14603. }
  14604. /*:118*//*119:*/
  14605. #line 2843 "./typica.w"
  14606. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  14607. {
  14608. QXmlQuery*self= getself<QXmlQuery*> (context);
  14609. self->setQuery(argument<QString> (0,context));
  14610. return QScriptValue();
  14611. }
  14612. /*:119*//*120:*/
  14613. #line 2853 "./typica.w"
  14614. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  14615. {
  14616. QXmlQuery*self= getself<QXmlQuery*> (context);
  14617. QString result;
  14618. self->evaluateTo(&result);
  14619. return QScriptValue(result);
  14620. }
  14621. /*:120*//*123:*/
  14622. #line 2908 "./typica.w"
  14623. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  14624. {
  14625. QXmlStreamWriter*retval;
  14626. if(context->argumentCount()==1)
  14627. {
  14628. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  14629. }
  14630. else
  14631. {
  14632. retval= new QXmlStreamWriter;
  14633. }
  14634. QScriptValue object= engine->toScriptValue<void*> (retval);
  14635. setXmlWriterProperties(object,engine);
  14636. return object;
  14637. }
  14638. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  14639. {
  14640. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  14641. value.setProperty("writeAttribute",
  14642. engine->newFunction(XmlWriter_writeAttribute));
  14643. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  14644. value.setProperty("writeCharacters",
  14645. engine->newFunction(XmlWriter_writeCharacters));
  14646. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  14647. value.setProperty("writeEmptyElement",
  14648. engine->newFunction(XmlWriter_writeEmptyElement));
  14649. value.setProperty("writeEndDocument",
  14650. engine->newFunction(XmlWriter_writeEndDocument));
  14651. value.setProperty("writeEndElement",
  14652. engine->newFunction(XmlWriter_writeEndElement));
  14653. value.setProperty("writeEntityReference",
  14654. engine->newFunction(XmlWriter_writeEntityReference));
  14655. value.setProperty("writeProcessingInstruction",
  14656. engine->newFunction(XmlWriter_writeProcessingInstruction));
  14657. value.setProperty("writeStartDocument",
  14658. engine->newFunction(XmlWriter_writeStartDocument));
  14659. value.setProperty("writeStartElement",
  14660. engine->newFunction(XmlWriter_writeStartElement));
  14661. value.setProperty("writeTextElement",
  14662. engine->newFunction(XmlWriter_writeTextElement));
  14663. }
  14664. /*:123*//*124:*/
  14665. #line 2955 "./typica.w"
  14666. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  14667. {
  14668. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14669. QIODevice*device= argument<QIODevice*> (0,context);
  14670. self->setDevice(device);
  14671. return QScriptValue();
  14672. }
  14673. /*:124*//*125:*/
  14674. #line 2969 "./typica.w"
  14675. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  14676. QScriptEngine*)
  14677. {
  14678. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14679. self->writeStartDocument(argument<QString> (0,context));
  14680. return QScriptValue();
  14681. }
  14682. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  14683. QScriptEngine*)
  14684. {
  14685. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14686. self->writeEndDocument();
  14687. return QScriptValue();
  14688. }
  14689. /*:125*//*126:*/
  14690. #line 2988 "./typica.w"
  14691. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  14692. {
  14693. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14694. self->writeDTD(argument<QString> (0,context));
  14695. return QScriptValue();
  14696. }
  14697. /*:126*//*127:*/
  14698. #line 2999 "./typica.w"
  14699. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  14700. QScriptEngine*)
  14701. {
  14702. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14703. self->writeStartElement(argument<QString> (0,context));
  14704. return QScriptValue();
  14705. }
  14706. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  14707. {
  14708. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14709. self->writeAttribute(argument<QString> (0,context),
  14710. argument<QString> (1,context));
  14711. return QScriptValue();
  14712. }
  14713. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  14714. {
  14715. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14716. self->writeCharacters(argument<QString> (0,context));
  14717. return QScriptValue();
  14718. }
  14719. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  14720. {
  14721. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14722. self->writeEndElement();
  14723. return QScriptValue();
  14724. }
  14725. /*:127*//*128:*/
  14726. #line 3035 "./typica.w"
  14727. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  14728. QScriptEngine*)
  14729. {
  14730. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14731. self->writeEmptyElement(argument<QString> (0,context));
  14732. return QScriptValue();
  14733. }
  14734. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  14735. QScriptEngine*)
  14736. {
  14737. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14738. self->writeTextElement(argument<QString> (0,context),
  14739. argument<QString> (1,context));
  14740. return QScriptValue();
  14741. }
  14742. /*:128*//*129:*/
  14743. #line 3056 "./typica.w"
  14744. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  14745. {
  14746. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14747. self->writeCDATA(argument<QString> (0,context));
  14748. return QScriptValue();
  14749. }
  14750. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  14751. QScriptEngine*)
  14752. {
  14753. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14754. self->writeEntityReference(argument<QString> (0,context));
  14755. return QScriptValue();
  14756. }
  14757. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  14758. QScriptEngine*)
  14759. {
  14760. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  14761. self->writeProcessingInstruction(argument<QString> (0,context),
  14762. argument<QString> (1,context));
  14763. return QScriptValue();
  14764. }
  14765. /*:129*//*132:*/
  14766. #line 3115 "./typica.w"
  14767. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  14768. {
  14769. QXmlStreamReader*retval=
  14770. new QXmlStreamReader(argument<QIODevice*> (0,context));
  14771. QScriptValue object= engine->toScriptValue<void*> (retval);
  14772. setXmlReaderProperties(object,engine);
  14773. return object;
  14774. }
  14775. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  14776. {
  14777. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  14778. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  14779. value.setProperty("hasAttribute",
  14780. engine->newFunction(XmlReader_hasAttribute));
  14781. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  14782. value.setProperty("isStartElement",
  14783. engine->newFunction(XmlReader_isStartElement));
  14784. value.setProperty("name",engine->newFunction(XmlReader_name));
  14785. value.setProperty("readElementText",
  14786. engine->newFunction(XmlReader_readElementText));
  14787. value.setProperty("readNext",
  14788. engine->newFunction(XmlReader_readNext));
  14789. value.setProperty("text",engine->newFunction(XmlReader_text));
  14790. }
  14791. /*:132*//*133:*/
  14792. #line 3145 "./typica.w"
  14793. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  14794. {
  14795. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14796. QString retval=
  14797. self->attributes().value(argument<QString> (0,context)).toString();
  14798. return QScriptValue(retval);
  14799. }
  14800. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  14801. {
  14802. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14803. bool retval=
  14804. self->attributes().hasAttribute(argument<QString> (0,context));
  14805. return QScriptValue(retval);
  14806. }
  14807. /*:133*//*134:*/
  14808. #line 3165 "./typica.w"
  14809. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  14810. {
  14811. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14812. return QScriptValue(self->atEnd());
  14813. }
  14814. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  14815. {
  14816. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14817. return QScriptValue(self->isDTD());
  14818. }
  14819. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  14820. {
  14821. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14822. return QScriptValue(self->isStartElement());
  14823. }
  14824. /*:134*//*135:*/
  14825. #line 3186 "./typica.w"
  14826. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  14827. {
  14828. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14829. self->readNext();
  14830. return QScriptValue();
  14831. }
  14832. /*:135*//*136:*/
  14833. #line 3196 "./typica.w"
  14834. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  14835. {
  14836. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14837. return QScriptValue(self->name().toString());
  14838. }
  14839. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  14840. {
  14841. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14842. return QScriptValue(self->readElementText());
  14843. }
  14844. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  14845. {
  14846. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  14847. return QScriptValue(self->text().toString());
  14848. }
  14849. /*:136*//*139:*/
  14850. #line 3238 "./typica.w"
  14851. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  14852. {
  14853. setQObjectProperties(value,engine);
  14854. value.setProperty("value",engine->newFunction(QSettings_value));
  14855. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  14856. }
  14857. /*:139*//*140:*/
  14858. #line 3250 "./typica.w"
  14859. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  14860. {
  14861. QScriptValue object;
  14862. if(context->argumentCount()==1||context->argumentCount()==2)
  14863. {
  14864. QSettings settings;
  14865. QString key= argument<QString> (0,context);
  14866. QVariant value;
  14867. QVariant retval;
  14868. if(context->argumentCount()> 1)
  14869. {
  14870. value= argument<QVariant> (1,context);
  14871. retval= settings.value(key,value);
  14872. }
  14873. else
  14874. {
  14875. retval= settings.value(key);
  14876. }
  14877. object= engine->newVariant(retval);
  14878. }
  14879. else
  14880. {
  14881. context->throwError("Incorrect number of arguments passed to "
  14882. "QSettings::value(). This method takes one "
  14883. "string and one optional variant type.");
  14884. }
  14885. return object;
  14886. }
  14887. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  14888. {
  14889. if(context->argumentCount()==2)
  14890. {
  14891. QSettings settings;
  14892. QString key= argument<QString> (0,context);
  14893. QVariant value= argument<QVariant> (1,context);
  14894. settings.setValue(key,value);
  14895. }
  14896. else
  14897. {
  14898. context->throwError("Incorrect number of arguments passed to "
  14899. "QSettings::setValue(). This method takes one "
  14900. "string and one variant type for a total of two "
  14901. "arguments.");
  14902. }
  14903. return QScriptValue();
  14904. }
  14905. /*:140*//*143:*/
  14906. #line 3319 "./typica.w"
  14907. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  14908. {
  14909. QScriptValue object= engine->newQObject(new QLCDNumber());
  14910. setQLCDNumberProperties(object,engine);
  14911. return object;
  14912. }
  14913. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  14914. {
  14915. setQFrameProperties(value,engine);
  14916. }
  14917. /*:143*//*146:*/
  14918. #line 3377 "./typica.w"
  14919. QScriptValue constructQTime(QScriptContext*context,
  14920. QScriptEngine*engine)
  14921. {
  14922. QScriptValue object;
  14923. if(context->argumentCount()==0||
  14924. (context->argumentCount()>=2&&context->argumentCount()<=4))
  14925. {
  14926. int arg1= 0;
  14927. int arg2= 0;
  14928. int arg3= 0;
  14929. int arg4= 0;
  14930. switch(context->argumentCount())
  14931. {
  14932. case 4:
  14933. arg4= argument<int> (3,context);
  14934. case 3:
  14935. arg3= argument<int> (2,context);
  14936. case 2:
  14937. arg2= argument<int> (1,context);
  14938. arg1= argument<int> (0,context);
  14939. default:
  14940. break;
  14941. }
  14942. if(context->argumentCount())
  14943. {
  14944. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  14945. arg4));
  14946. }
  14947. else
  14948. {
  14949. object= engine->toScriptValue<QTime> (QTime());
  14950. }
  14951. setQTimeProperties(object,engine);
  14952. }
  14953. else
  14954. {
  14955. context->throwError("Incorrect number of arguments passed to "
  14956. "QTime::QTime(). This method takes zero, two, "
  14957. "three, or four integer arguments.");
  14958. }
  14959. return object;
  14960. }
  14961. /*:146*//*147:*/
  14962. #line 3425 "./typica.w"
  14963. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  14964. {
  14965. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  14966. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  14967. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  14968. value.setProperty("hour",engine->newFunction(QTime_hour));
  14969. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  14970. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  14971. value.setProperty("minute",engine->newFunction(QTime_minute));
  14972. value.setProperty("msec",engine->newFunction(QTime_msec));
  14973. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  14974. value.setProperty("restart",engine->newFunction(QTime_restart));
  14975. value.setProperty("second",engine->newFunction(QTime_second));
  14976. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  14977. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  14978. value.setProperty("start",engine->newFunction(QTime_start));
  14979. value.setProperty("toString",engine->newFunction(QTime_toString));
  14980. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  14981. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  14982. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  14983. }
  14984. /*:147*//*148:*/
  14985. #line 3454 "./typica.w"
  14986. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  14987. {
  14988. QTime self= getself<QTime> (context);
  14989. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  14990. (self.second()*1000)+self.msec();
  14991. return QScriptValue(retval);
  14992. }
  14993. /*:148*//*149:*/
  14994. #line 3468 "./typica.w"
  14995. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  14996. {
  14997. QTime time;
  14998. QScriptValue retval;
  14999. if(context->argumentCount()==1)
  15000. {
  15001. QTime self= getself<QTime> (context);
  15002. time= self.addMSecs(argument<int> (0,context));
  15003. retval= engine->toScriptValue<QTime> (time);
  15004. setQTimeProperties(retval,engine);
  15005. }
  15006. else
  15007. {
  15008. context->throwError("Incorrect number of arguments passed to "
  15009. "QTime::addMSecs(). This method takes one "
  15010. "integer as an argument.");
  15011. }
  15012. return retval;
  15013. }
  15014. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  15015. {
  15016. QTime time;
  15017. QScriptValue retval;
  15018. if(context->argumentCount()==1)
  15019. {
  15020. QTime self= getself<QTime> (context);
  15021. time= self.addSecs(argument<int> (0,context));
  15022. retval= engine->toScriptValue<QTime> (time);
  15023. setQTimeProperties(retval,engine);
  15024. }
  15025. else
  15026. {
  15027. context->throwError("Incorrect number of arguments passed to "
  15028. "QTime::addSecs(). This method takes one "
  15029. "integer as an argument.");
  15030. }
  15031. return retval;
  15032. }
  15033. /*:149*//*150:*/
  15034. #line 3511 "./typica.w"
  15035. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  15036. {
  15037. QScriptValue retval;
  15038. if(context->argumentCount()==0)
  15039. {
  15040. QTime self= getself<QTime> (context);
  15041. retval= QScriptValue(engine,self.elapsed());
  15042. }
  15043. else
  15044. {
  15045. context->throwError("Incorrect number of arguments passed to "
  15046. "QTime::elapsed(). This method takes no "
  15047. "arguments.");
  15048. }
  15049. return retval;
  15050. }
  15051. /*:150*//*151:*/
  15052. #line 3532 "./typica.w"
  15053. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  15054. {
  15055. QScriptValue retval;
  15056. if(context->argumentCount()==0)
  15057. {
  15058. QTime self= getself<QTime> (context);
  15059. retval= QScriptValue(engine,self.hour());
  15060. }
  15061. else
  15062. {
  15063. context->throwError("Incorrect number of arguments passed to "
  15064. "QTime::hour(). This method takes no "
  15065. "arguments.");
  15066. }
  15067. return retval;
  15068. }
  15069. /*:151*//*152:*/
  15070. #line 3552 "./typica.w"
  15071. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  15072. {
  15073. QScriptValue retval;
  15074. if(context->argumentCount()==0)
  15075. {
  15076. QTime self= getself<QTime> (context);
  15077. retval= QScriptValue(engine,self.minute());
  15078. }
  15079. else
  15080. {
  15081. context->throwError("Incorrect number of arguments passed to "
  15082. "QTime::minute(). This method takes no "
  15083. "arguments.");
  15084. }
  15085. return retval;
  15086. }
  15087. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  15088. {
  15089. QScriptValue retval;
  15090. if(context->argumentCount()==0)
  15091. {
  15092. QTime self= getself<QTime> (context);
  15093. retval= QScriptValue(engine,self.second());
  15094. }
  15095. else
  15096. {
  15097. context->throwError("Incorrect number of arguments passed to "
  15098. "QTime::second(). This method takes no "
  15099. "arguments.");
  15100. }
  15101. return retval;
  15102. }
  15103. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  15104. {
  15105. QScriptValue retval;
  15106. if(context->argumentCount()==0)
  15107. {
  15108. QTime self= getself<QTime> (context);
  15109. retval= QScriptValue(engine,self.msec());
  15110. }
  15111. else
  15112. {
  15113. context->throwError("Incorrect number of arguments passed to "
  15114. "QTime::msec(). This method takes no "
  15115. "arguments.");
  15116. }
  15117. return retval;
  15118. }
  15119. /*:152*//*153:*/
  15120. #line 3608 "./typica.w"
  15121. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  15122. {
  15123. QScriptValue retval;
  15124. if(context->argumentCount()==0)
  15125. {
  15126. QTime self= getself<QTime> (context);
  15127. retval= QScriptValue(engine,self.isNull());
  15128. }
  15129. else
  15130. {
  15131. context->throwError("Incorrect number of arguments passed to "
  15132. "QTime::isNull(). This method takes no "
  15133. "arguments.");
  15134. }
  15135. return retval;
  15136. }
  15137. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  15138. {
  15139. QScriptValue retval;
  15140. if(context->argumentCount()==0)
  15141. {
  15142. QTime self= getself<QTime> (context);
  15143. retval= QScriptValue(engine,self.isValid());
  15144. }
  15145. else
  15146. {
  15147. context->throwError("Incorrect number of arguments passed to "
  15148. "QTime::isValid(). This method takes no "
  15149. "arguments.");
  15150. }
  15151. return retval;
  15152. }
  15153. /*:153*//*154:*/
  15154. #line 3646 "./typica.w"
  15155. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  15156. {
  15157. QScriptValue retval;
  15158. if(context->argumentCount()==1)
  15159. {
  15160. QTime self= getself<QTime> (context);
  15161. QTime arg= argument<QVariant> (0,context).toTime();
  15162. retval= QScriptValue(engine,self.msecsTo(arg));
  15163. }
  15164. else
  15165. {
  15166. context->throwError("Incorrect number of arguments passed to "
  15167. "QTime::msecsTo(). This method takes one QTime.");
  15168. }
  15169. return retval;
  15170. }
  15171. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  15172. {
  15173. QScriptValue retval;
  15174. if(context->argumentCount()==1)
  15175. {
  15176. QTime self= getself<QTime> (context);
  15177. QTime arg= argument<QVariant> (0,context).toTime();
  15178. retval= QScriptValue(engine,self.secsTo(arg));
  15179. }
  15180. else
  15181. {
  15182. context->throwError("Incorrect number of arguments passed to "
  15183. "QTime::secsTo(). This method takes one QTime.");
  15184. }
  15185. return retval;
  15186. }
  15187. /*:154*//*155:*/
  15188. #line 3685 "./typica.w"
  15189. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  15190. {
  15191. QScriptValue retval;
  15192. if(context->argumentCount()==0)
  15193. {
  15194. QTime self= getself<QTime> (context);
  15195. retval= QScriptValue(engine,self.restart());
  15196. }
  15197. else
  15198. {
  15199. context->throwError("Incorrect number of arguments passed to "
  15200. "QTime::restart(). This method takes no "
  15201. "arguments.");
  15202. }
  15203. return retval;
  15204. }
  15205. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  15206. {
  15207. if(context->argumentCount()==0)
  15208. {
  15209. QTime self= getself<QTime> (context);
  15210. self.start();
  15211. }
  15212. else
  15213. {
  15214. context->throwError("Incorrect number of arguments passed to "
  15215. "QTime::start(). This method takes no arguments.");
  15216. }
  15217. return QScriptValue();
  15218. }
  15219. /*:155*//*156:*/
  15220. #line 3721 "./typica.w"
  15221. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  15222. {
  15223. QScriptValue retval;
  15224. if(context->argumentCount()==3||context->argumentCount()==4)
  15225. {
  15226. QTime self= getself<QTime> (context);
  15227. int arg1= 0;
  15228. int arg2= 0;
  15229. int arg3= 0;
  15230. int arg4= 0;
  15231. switch(context->argumentCount())
  15232. {
  15233. case 4:
  15234. arg4= argument<int> (3,context);
  15235. case 3:
  15236. arg3= argument<int> (2,context);
  15237. arg2= argument<int> (1,context);
  15238. arg1= argument<int> (0,context);
  15239. default:
  15240. break;
  15241. }
  15242. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  15243. }
  15244. else
  15245. {
  15246. context->throwError("Incorrect number of arguments passed to "
  15247. "QTime::setHMS(). This method takes three or "
  15248. "four integer arguments.");
  15249. }
  15250. return retval;
  15251. }
  15252. /*:156*//*157:*/
  15253. #line 3757 "./typica.w"
  15254. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  15255. {
  15256. QScriptValue retval;
  15257. if(context->argumentCount()==1)
  15258. {
  15259. QTime self= getself<QTime> (context);
  15260. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  15261. }
  15262. else
  15263. {
  15264. context->throwError("Incorrect number of arguments passed to "
  15265. "QTime::toString(). This method takes one QString "
  15266. "as an argument.");
  15267. }
  15268. return retval;
  15269. }
  15270. /*:157*//*158:*/
  15271. #line 3778 "./typica.w"
  15272. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  15273. {
  15274. QScriptValue object;
  15275. object= engine->toScriptValue<QTime> (QTime::currentTime());
  15276. setQTimeProperties(object,engine);
  15277. return object;
  15278. }
  15279. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  15280. {
  15281. QScriptValue object;
  15282. if(context->argumentCount()==2)
  15283. {
  15284. QString time= argument<QString> (0,context);
  15285. QString format= argument<QString> (1,context);
  15286. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  15287. setQTimeProperties(object,engine);
  15288. }
  15289. else
  15290. {
  15291. context->throwError("Incorrect number of arguments passed to "
  15292. "QTime::fromString(). This method takes two "
  15293. "string arguments.");
  15294. }
  15295. return object;
  15296. }
  15297. /*:158*//*159:*/
  15298. #line 3809 "./typica.w"
  15299. template<> QTime argument(int arg,QScriptContext*context)
  15300. {
  15301. return qscriptvalue_cast<QTime> (context->argument(arg));
  15302. }
  15303. /*:159*//*161:*/
  15304. #line 3827 "./typica.w"
  15305. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  15306. {
  15307. setQFrameProperties(value,engine);
  15308. }
  15309. /*:161*//*163:*/
  15310. #line 3841 "./typica.w"
  15311. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  15312. {
  15313. setQAbstractScrollAreaProperties(value,engine);
  15314. }
  15315. /*:163*//*165:*/
  15316. #line 3855 "./typica.w"
  15317. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  15318. {
  15319. setQAbstractScrollAreaProperties(value,engine);
  15320. }
  15321. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  15322. {
  15323. setQAbstractItemViewProperties(value,engine);
  15324. }
  15325. /*:165*//*168:*/
  15326. #line 3888 "./typica.w"
  15327. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  15328. {
  15329. QScriptValue object= engine->newQObject(new QPushButton());
  15330. setQPushButtonProperties(object,engine);
  15331. return object;
  15332. }
  15333. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  15334. {
  15335. setQAbstractButtonProperties(value,engine);
  15336. }
  15337. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  15338. {
  15339. setQWidgetProperties(value,engine);
  15340. }
  15341. /*:168*//*175:*/
  15342. #line 4000 "./typica.w"
  15343. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  15344. {
  15345. SqlQueryConnection*obj= new SqlQueryConnection();
  15346. QScriptValue object=
  15347. engine->toScriptValue<void*> (obj);
  15348. setQSqlQueryProperties(object,engine);
  15349. return object;
  15350. }
  15351. /*:175*//*176:*/
  15352. #line 4013 "./typica.w"
  15353. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  15354. {
  15355. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  15356. value.setProperty("bindFileData",
  15357. engine->newFunction(QSqlQuery_bindFileData));
  15358. value.setProperty("bindDeviceData",
  15359. engine->newFunction(QSqlQuery_bindDeviceData));
  15360. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  15361. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  15362. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  15363. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  15364. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  15365. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  15366. }
  15367. /*:176*//*177:*/
  15368. #line 4031 "./typica.w"
  15369. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  15370. {
  15371. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  15372. QScriptValue retval;
  15373. if(context->argumentCount()==1)
  15374. {
  15375. retval= QScriptValue(engine,
  15376. q->exec(argument<QString> (0,context)));
  15377. }
  15378. else
  15379. {
  15380. retval= QScriptValue(engine,q->exec());
  15381. }
  15382. if(q->lastError().isValid())
  15383. {
  15384. qDebug()<<q->lastQuery();
  15385. qDebug()<<q->lastError().text();
  15386. }
  15387. return retval;
  15388. }
  15389. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  15390. {
  15391. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15392. return QScriptValue(query->lastQuery());
  15393. }
  15394. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  15395. {
  15396. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15397. return QScriptValue(engine,query->next());
  15398. }
  15399. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  15400. {
  15401. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15402. return QScriptValue(engine,
  15403. query->value(argument<int> (0,context)).toString());
  15404. }
  15405. /*:177*//*178:*/
  15406. #line 4075 "./typica.w"
  15407. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  15408. {
  15409. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15410. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  15411. }
  15412. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  15413. {
  15414. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15415. query->bindValue(argument<QString> (0,context),
  15416. argument<QVariant> (1,context));
  15417. return QScriptValue();
  15418. }
  15419. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  15420. QScriptEngine*)
  15421. {
  15422. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15423. QString placeholder= argument<QString> (0,context);
  15424. QString filename= argument<QString> (1,context);
  15425. QFile file(filename);
  15426. QByteArray data;
  15427. if(file.open(QIODevice::ReadOnly))
  15428. {
  15429. data= file.readAll();
  15430. file.close();
  15431. }
  15432. query->bindValue(placeholder,data);
  15433. return QScriptValue();
  15434. }
  15435. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  15436. QScriptEngine*)
  15437. {
  15438. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  15439. QString placeholder= argument<QString> (0,context);
  15440. QIODevice*device= argument<QIODevice*> (1,context);
  15441. device->reset();
  15442. QByteArray data;
  15443. data= device->readAll();
  15444. query->bindValue(placeholder,data);
  15445. return QScriptValue();
  15446. }
  15447. /*:178*//*179:*/
  15448. #line 4127 "./typica.w"
  15449. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  15450. {
  15451. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  15452. delete query;
  15453. return QScriptValue::UndefinedValue;
  15454. }
  15455. /*:179*//*182:*/
  15456. #line 4174 "./typica.w"
  15457. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  15458. {
  15459. QFileInfo info(argument<QString> (0,context));
  15460. QScriptValue retval(engine,info.baseName());
  15461. return retval;
  15462. }
  15463. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  15464. {
  15465. QFileInfo info(argument<QString> (0,context));
  15466. QDir dir= info.dir();
  15467. QScriptValue retval(engine,dir.path());
  15468. return retval;
  15469. }
  15470. /*:182*//*183:*/
  15471. #line 4193 "./typica.w"
  15472. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*)
  15473. {
  15474. SqlQueryConnection h;
  15475. QSqlQuery*query= h.operator->();
  15476. QString q= "SELECT file FROM files WHERE id = :file";
  15477. query->prepare(q);
  15478. query->bindValue(":file",argument<int> (0,context));
  15479. query->exec();
  15480. query->next();
  15481. QByteArray array= query->value(0).toByteArray();
  15482. QFile file(argument<QString> (1,context));
  15483. file.open(QIODevice::WriteOnly);
  15484. file.write(array);
  15485. file.close();
  15486. return QScriptValue();
  15487. }
  15488. /*:183*//*184:*/
  15489. #line 4214 "./typica.w"
  15490. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  15491. {
  15492. QString source= argument<QString> (0,context);
  15493. source.remove(0,1);
  15494. source.chop(1);
  15495. QStringList elements= source.split(",");
  15496. QString element;
  15497. QScriptValue dest= engine->newArray(elements.size());
  15498. int i= 0;
  15499. foreach(element,elements)
  15500. {
  15501. if(element.startsWith("\"")&&element.endsWith("\""))
  15502. {
  15503. element.chop(1);
  15504. element= element.remove(0,1);
  15505. }
  15506. dest.setProperty(i,QScriptValue(engine,element));
  15507. i++;
  15508. }
  15509. return dest;
  15510. }
  15511. /*:184*//*185:*/
  15512. #line 4240 "./typica.w"
  15513. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  15514. {
  15515. QString font= argument<QString> (0,context);
  15516. QString classname;
  15517. if(context->argumentCount()> 1)
  15518. {
  15519. classname= argument<QString> (1,context);
  15520. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  15521. }
  15522. else
  15523. {
  15524. QApplication::setFont(QFont(font));
  15525. }
  15526. return QScriptValue();
  15527. }
  15528. /*:185*//*186:*/
  15529. #line 4260 "./typica.w"
  15530. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  15531. {
  15532. SqlQueryConnection h;
  15533. QSqlQuery*query= h.operator->();
  15534. QString q= "SELECT file FROM files WHERE id = :file";
  15535. query->prepare(q);
  15536. query->bindValue(":file",argument<int> (0,context));
  15537. query->exec();
  15538. query->next();
  15539. QByteArray array= query->value(0).toByteArray();
  15540. QBuffer buffer(&array);
  15541. buffer.open(QIODevice::ReadOnly);
  15542. QXmlQuery xquery;
  15543. xquery.bindVariable("profile",&buffer);
  15544. QString xq;
  15545. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  15546. xquery.setQuery(xq);
  15547. QString result;
  15548. xquery.evaluateTo(&result);
  15549. return QScriptValue(result);
  15550. }
  15551. /*:186*//*187:*/
  15552. #line 4287 "./typica.w"
  15553. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  15554. {
  15555. QWidget::setTabOrder(argument<QWidget*> (0,context),
  15556. argument<QWidget*> (1,context));
  15557. return QScriptValue();
  15558. }
  15559. /*:187*//*188:*/
  15560. #line 4298 "./typica.w"
  15561. QScriptValue scriptTr(QScriptContext*context,QScriptEngine*)
  15562. {
  15563. return QScriptValue(QCoreApplication::translate(
  15564. "configuration",
  15565. argument<QString> (1,context).toUtf8().data()));
  15566. }
  15567. /*:188*//*195:*/
  15568. #line 4550 "./typica.w"
  15569. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  15570. {
  15571. QString targetID= argument<QString> (0,context);
  15572. QDomNode element;
  15573. QScriptValue object;
  15574. /*197:*/
  15575. #line 4597 "./typica.w"
  15576. QDomNodeList windows=
  15577. AppInstance->configuration()->documentElement().elementsByTagName("window");
  15578. QDomNode nullNode;
  15579. int i= 0;
  15580. element= nullNode;
  15581. while(i<windows.count())
  15582. {
  15583. element= windows.at(i);
  15584. QDomNamedNodeMap attributes= element.attributes();
  15585. if(attributes.contains("id"))
  15586. {
  15587. if(attributes.namedItem("id").toAttr().value()==targetID)
  15588. {
  15589. break;
  15590. }
  15591. }
  15592. element= nullNode;
  15593. i++;
  15594. }
  15595. /*:197*/
  15596. #line 4556 "./typica.w"
  15597. if(!element.isNull())
  15598. {
  15599. /*198:*/
  15600. #line 4629 "./typica.w"
  15601. ScriptQMainWindow*window= new ScriptQMainWindow;
  15602. window->setObjectName(targetID);
  15603. object= engine->newQObject(window);
  15604. setQMainWindowProperties(object,engine);
  15605. QWidget*central= new(QWidget);
  15606. central->setParent(window);
  15607. central->setObjectName("centralWidget");
  15608. window->setCentralWidget(central);
  15609. if(element.hasChildNodes())
  15610. {
  15611. /*199:*/
  15612. #line 4664 "./typica.w"
  15613. QStack<QWidget*> widgetStack;
  15614. QStack<QLayout*> layoutStack;
  15615. QString windowScript;
  15616. widgetStack.push(central);
  15617. QDomNodeList windowChildren= element.childNodes();
  15618. int i= 0;
  15619. while(i<windowChildren.count())
  15620. {
  15621. QDomNode current;
  15622. QDomElement element;
  15623. current= windowChildren.at(i);
  15624. if(current.isElement())
  15625. {
  15626. element= current.toElement();
  15627. if(element.tagName()=="program")
  15628. {
  15629. windowScript.append(element.text());
  15630. }
  15631. else if(element.tagName()=="layout")
  15632. {
  15633. element.setAttribute("trcontext","configuration");
  15634. addLayoutToWidget(element,&widgetStack,&layoutStack);
  15635. }
  15636. else if(element.tagName()=="menu")
  15637. {
  15638. /*200:*/
  15639. #line 4712 "./typica.w"
  15640. QMenuBar*bar= window->menuBar();
  15641. bar->setParent(window);
  15642. bar->setObjectName("menuBar");
  15643. if(element.hasAttribute("name"))
  15644. {
  15645. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  15646. element.attribute("name").toUtf8().data()));
  15647. menu->setParent(bar);
  15648. if(element.hasAttribute("type"))
  15649. {
  15650. if(element.attribute("type")=="reports")
  15651. {
  15652. if(element.hasAttribute("src"))
  15653. {
  15654. /*640:*/
  15655. #line 13839 "./typica.w"
  15656. QSettings settings;
  15657. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  15658. toString()).
  15659. arg(element.attribute("src"));
  15660. QDir::addSearchPath("reports",reportDirectory);
  15661. QDir directory(reportDirectory);
  15662. directory.setFilter(QDir::Files);
  15663. directory.setSorting(QDir::Name);
  15664. QStringList nameFilter;
  15665. nameFilter<<"*.xml";
  15666. directory.setNameFilters(nameFilter);
  15667. QFileInfoList reportFiles= directory.entryInfoList();
  15668. for(int i= 0;i<reportFiles.size();i++)
  15669. {
  15670. QFileInfo reportFile= reportFiles.at(i);
  15671. /*644:*/
  15672. #line 13919 "./typica.w"
  15673. QString path= reportFile.absoluteFilePath();
  15674. QFile file(path);
  15675. if(file.open(QIODevice::ReadOnly))
  15676. {
  15677. QDomDocument document;
  15678. document.setContent(&file,true);
  15679. QDomElement root= document.documentElement();
  15680. QString translationContext= root.attribute("id");
  15681. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  15682. if(!titleNode.isNull())
  15683. {
  15684. QDomElement titleElement= titleNode.toElement();
  15685. QString title= QCoreApplication::translate("configuration",
  15686. titleElement.text().toUtf8().data());
  15687. if(!title.isEmpty())
  15688. {
  15689. QStringList hierarchy= title.split(":->");
  15690. QMenu*insertionPoint= menu;
  15691. /*645:*/
  15692. #line 13948 "./typica.w"
  15693. for(int j= 0;j<hierarchy.size()-1;j++)
  15694. {
  15695. QObjectList menuList= insertionPoint->children();
  15696. bool menuFound= false;
  15697. for(int k= 0;k<menuList.size();k++)
  15698. {
  15699. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  15700. if(currentItem)
  15701. {
  15702. if(currentItem->title()==hierarchy.at(j))
  15703. {
  15704. menuFound= true;
  15705. insertionPoint= currentItem;
  15706. break;
  15707. }
  15708. }
  15709. }
  15710. if(!menuFound)
  15711. {
  15712. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  15713. }
  15714. }
  15715. /*:645*/
  15716. #line 13938 "./typica.w"
  15717. ReportAction*action= new ReportAction(path,hierarchy.last());
  15718. insertionPoint->addAction(action);
  15719. }
  15720. }
  15721. }
  15722. /*:644*/
  15723. #line 13855 "./typica.w"
  15724. }
  15725. /*:640*/
  15726. #line 4727 "./typica.w"
  15727. }
  15728. }
  15729. }
  15730. if(element.hasChildNodes())
  15731. {
  15732. /*201:*/
  15733. #line 4740 "./typica.w"
  15734. QDomNodeList menuItems= element.childNodes();
  15735. int j= 0;
  15736. while(j<menuItems.count())
  15737. {
  15738. QDomNode item= menuItems.at(j);
  15739. if(item.isElement())
  15740. {
  15741. QDomElement itemElement= item.toElement();
  15742. if(itemElement.tagName()=="item")
  15743. {
  15744. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  15745. itemElement.text().toUtf8().data()),menu);
  15746. if(itemElement.hasAttribute("id"))
  15747. {
  15748. itemAction->setObjectName(itemElement.attribute("id"));
  15749. }
  15750. if(itemElement.hasAttribute("shortcut"))
  15751. {
  15752. itemAction->setShortcut(itemElement.attribute("shortcut"));
  15753. }
  15754. menu->addAction(itemAction);
  15755. }
  15756. else if(itemElement.tagName()=="separator")
  15757. {
  15758. menu->addSeparator();
  15759. }
  15760. }
  15761. j++;
  15762. }
  15763. #line 1 "./helpmenu.w"
  15764. /*:201*/
  15765. #line 4733 "./typica.w"
  15766. }
  15767. }
  15768. /*:200*/
  15769. #line 4690 "./typica.w"
  15770. }
  15771. }
  15772. i++;
  15773. }
  15774. QScriptValue oldThis= context->thisObject();
  15775. context->setThisObject(object);
  15776. QScriptValue result= engine->evaluate(windowScript);
  15777. /*192:*/
  15778. #line 4446 "./typica.w"
  15779. if(engine->hasUncaughtException())
  15780. {
  15781. int line= engine->uncaughtExceptionLineNumber();
  15782. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  15783. result.toString();
  15784. QString trace;
  15785. foreach(trace,engine->uncaughtExceptionBacktrace())
  15786. {
  15787. qDebug()<<trace;
  15788. }
  15789. }
  15790. /*:192*/
  15791. #line 4698 "./typica.w"
  15792. context->setThisObject(oldThis);
  15793. /*:199*/
  15794. #line 4640 "./typica.w"
  15795. }
  15796. /*202:*/
  15797. #line 9 "./helpmenu.w"
  15798. HelpMenu*helpMenu= new HelpMenu();
  15799. window->menuBar()->addMenu(helpMenu);
  15800. /*:202*/
  15801. #line 4642 "./typica.w"
  15802. window->show();
  15803. /*:198*/
  15804. #line 4559 "./typica.w"
  15805. }
  15806. return object;
  15807. }
  15808. /*:195*//*196:*/
  15809. #line 4570 "./typica.w"
  15810. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  15811. {
  15812. QString targetID= argument<QString> (0,context);
  15813. QFile file(QString("reports:%1").arg(targetID));
  15814. QScriptValue object;
  15815. if(file.open(QIODevice::ReadOnly))
  15816. {
  15817. QDomDocument document;
  15818. document.setContent(&file,true);
  15819. QDomElement element= document.documentElement();
  15820. if(!element.isNull())
  15821. {
  15822. /*198:*/
  15823. #line 4629 "./typica.w"
  15824. ScriptQMainWindow*window= new ScriptQMainWindow;
  15825. window->setObjectName(targetID);
  15826. object= engine->newQObject(window);
  15827. setQMainWindowProperties(object,engine);
  15828. QWidget*central= new(QWidget);
  15829. central->setParent(window);
  15830. central->setObjectName("centralWidget");
  15831. window->setCentralWidget(central);
  15832. if(element.hasChildNodes())
  15833. {
  15834. /*199:*/
  15835. #line 4664 "./typica.w"
  15836. QStack<QWidget*> widgetStack;
  15837. QStack<QLayout*> layoutStack;
  15838. QString windowScript;
  15839. widgetStack.push(central);
  15840. QDomNodeList windowChildren= element.childNodes();
  15841. int i= 0;
  15842. while(i<windowChildren.count())
  15843. {
  15844. QDomNode current;
  15845. QDomElement element;
  15846. current= windowChildren.at(i);
  15847. if(current.isElement())
  15848. {
  15849. element= current.toElement();
  15850. if(element.tagName()=="program")
  15851. {
  15852. windowScript.append(element.text());
  15853. }
  15854. else if(element.tagName()=="layout")
  15855. {
  15856. element.setAttribute("trcontext","configuration");
  15857. addLayoutToWidget(element,&widgetStack,&layoutStack);
  15858. }
  15859. else if(element.tagName()=="menu")
  15860. {
  15861. /*200:*/
  15862. #line 4712 "./typica.w"
  15863. QMenuBar*bar= window->menuBar();
  15864. bar->setParent(window);
  15865. bar->setObjectName("menuBar");
  15866. if(element.hasAttribute("name"))
  15867. {
  15868. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  15869. element.attribute("name").toUtf8().data()));
  15870. menu->setParent(bar);
  15871. if(element.hasAttribute("type"))
  15872. {
  15873. if(element.attribute("type")=="reports")
  15874. {
  15875. if(element.hasAttribute("src"))
  15876. {
  15877. /*640:*/
  15878. #line 13839 "./typica.w"
  15879. QSettings settings;
  15880. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  15881. toString()).
  15882. arg(element.attribute("src"));
  15883. QDir::addSearchPath("reports",reportDirectory);
  15884. QDir directory(reportDirectory);
  15885. directory.setFilter(QDir::Files);
  15886. directory.setSorting(QDir::Name);
  15887. QStringList nameFilter;
  15888. nameFilter<<"*.xml";
  15889. directory.setNameFilters(nameFilter);
  15890. QFileInfoList reportFiles= directory.entryInfoList();
  15891. for(int i= 0;i<reportFiles.size();i++)
  15892. {
  15893. QFileInfo reportFile= reportFiles.at(i);
  15894. /*644:*/
  15895. #line 13919 "./typica.w"
  15896. QString path= reportFile.absoluteFilePath();
  15897. QFile file(path);
  15898. if(file.open(QIODevice::ReadOnly))
  15899. {
  15900. QDomDocument document;
  15901. document.setContent(&file,true);
  15902. QDomElement root= document.documentElement();
  15903. QString translationContext= root.attribute("id");
  15904. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  15905. if(!titleNode.isNull())
  15906. {
  15907. QDomElement titleElement= titleNode.toElement();
  15908. QString title= QCoreApplication::translate("configuration",
  15909. titleElement.text().toUtf8().data());
  15910. if(!title.isEmpty())
  15911. {
  15912. QStringList hierarchy= title.split(":->");
  15913. QMenu*insertionPoint= menu;
  15914. /*645:*/
  15915. #line 13948 "./typica.w"
  15916. for(int j= 0;j<hierarchy.size()-1;j++)
  15917. {
  15918. QObjectList menuList= insertionPoint->children();
  15919. bool menuFound= false;
  15920. for(int k= 0;k<menuList.size();k++)
  15921. {
  15922. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  15923. if(currentItem)
  15924. {
  15925. if(currentItem->title()==hierarchy.at(j))
  15926. {
  15927. menuFound= true;
  15928. insertionPoint= currentItem;
  15929. break;
  15930. }
  15931. }
  15932. }
  15933. if(!menuFound)
  15934. {
  15935. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  15936. }
  15937. }
  15938. /*:645*/
  15939. #line 13938 "./typica.w"
  15940. ReportAction*action= new ReportAction(path,hierarchy.last());
  15941. insertionPoint->addAction(action);
  15942. }
  15943. }
  15944. }
  15945. /*:644*/
  15946. #line 13855 "./typica.w"
  15947. }
  15948. /*:640*/
  15949. #line 4727 "./typica.w"
  15950. }
  15951. }
  15952. }
  15953. if(element.hasChildNodes())
  15954. {
  15955. /*201:*/
  15956. #line 4740 "./typica.w"
  15957. QDomNodeList menuItems= element.childNodes();
  15958. int j= 0;
  15959. while(j<menuItems.count())
  15960. {
  15961. QDomNode item= menuItems.at(j);
  15962. if(item.isElement())
  15963. {
  15964. QDomElement itemElement= item.toElement();
  15965. if(itemElement.tagName()=="item")
  15966. {
  15967. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  15968. itemElement.text().toUtf8().data()),menu);
  15969. if(itemElement.hasAttribute("id"))
  15970. {
  15971. itemAction->setObjectName(itemElement.attribute("id"));
  15972. }
  15973. if(itemElement.hasAttribute("shortcut"))
  15974. {
  15975. itemAction->setShortcut(itemElement.attribute("shortcut"));
  15976. }
  15977. menu->addAction(itemAction);
  15978. }
  15979. else if(itemElement.tagName()=="separator")
  15980. {
  15981. menu->addSeparator();
  15982. }
  15983. }
  15984. j++;
  15985. }
  15986. #line 1 "./helpmenu.w"
  15987. /*:201*/
  15988. #line 4733 "./typica.w"
  15989. }
  15990. }
  15991. /*:200*/
  15992. #line 4690 "./typica.w"
  15993. }
  15994. }
  15995. i++;
  15996. }
  15997. QScriptValue oldThis= context->thisObject();
  15998. context->setThisObject(object);
  15999. QScriptValue result= engine->evaluate(windowScript);
  16000. /*192:*/
  16001. #line 4446 "./typica.w"
  16002. if(engine->hasUncaughtException())
  16003. {
  16004. int line= engine->uncaughtExceptionLineNumber();
  16005. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  16006. result.toString();
  16007. QString trace;
  16008. foreach(trace,engine->uncaughtExceptionBacktrace())
  16009. {
  16010. qDebug()<<trace;
  16011. }
  16012. }
  16013. /*:192*/
  16014. #line 4698 "./typica.w"
  16015. context->setThisObject(oldThis);
  16016. /*:199*/
  16017. #line 4640 "./typica.w"
  16018. }
  16019. /*202:*/
  16020. #line 9 "./helpmenu.w"
  16021. HelpMenu*helpMenu= new HelpMenu();
  16022. window->menuBar()->addMenu(helpMenu);
  16023. /*:202*/
  16024. #line 4642 "./typica.w"
  16025. window->show();
  16026. /*:198*/
  16027. #line 4583 "./typica.w"
  16028. }
  16029. file.close();
  16030. }
  16031. return object;
  16032. }
  16033. /*:196*//*214:*/
  16034. #line 4785 "./typica.w"
  16035. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  16036. QStack<QLayout*> *layoutStack)
  16037. {
  16038. if(element.hasAttribute("type"))
  16039. {
  16040. /*215:*/
  16041. #line 4806 "./typica.w"
  16042. QLayout*layout;
  16043. QString layoutType= element.attribute("type");
  16044. if(layoutType=="horizontal")
  16045. {
  16046. layout= new QHBoxLayout;
  16047. layoutStack->push(layout);
  16048. populateBoxLayout(element,widgetStack,layoutStack);
  16049. }
  16050. else if(layoutType=="vertical")
  16051. {
  16052. layout= new QVBoxLayout;
  16053. layoutStack->push(layout);
  16054. populateBoxLayout(element,widgetStack,layoutStack);
  16055. }
  16056. else if(layoutType=="grid")
  16057. {
  16058. layout= new QGridLayout;
  16059. layoutStack->push(layout);
  16060. populateGridLayout(element,widgetStack,layoutStack);
  16061. }
  16062. else if(layoutType=="stack")
  16063. {
  16064. layout= new QStackedLayout;
  16065. layoutStack->push(layout);
  16066. populateStackedLayout(element,widgetStack,layoutStack);
  16067. }
  16068. if(element.hasAttribute("id"))
  16069. {
  16070. layout->setObjectName(element.attribute("id"));
  16071. }
  16072. if(element.hasAttribute("spacing"))
  16073. {
  16074. layout->setSpacing(element.attribute("spacing").toInt());
  16075. }
  16076. if(element.hasAttribute("margin"))
  16077. {
  16078. int m= element.attribute("margin").toInt();
  16079. layout->setContentsMargins(m,m,m,m);
  16080. }
  16081. /*:215*/
  16082. #line 4791 "./typica.w"
  16083. QWidget*widget= widgetStack->top();
  16084. if(layout)
  16085. {
  16086. widget->setLayout(layout);
  16087. }
  16088. layoutStack->pop();
  16089. }
  16090. }
  16091. /*:214*//*216:*/
  16092. #line 4853 "./typica.w"
  16093. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16094. QStack<QLayout*> *layoutStack)
  16095. {
  16096. QDomNodeList children= element.childNodes();
  16097. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  16098. for(int i= 0;i<children.count();i++)
  16099. {
  16100. QDomNode current;
  16101. QDomElement currentElement;
  16102. current= children.at(i);
  16103. if(current.isElement())
  16104. {
  16105. currentElement= current.toElement();
  16106. if(currentElement.tagName()=="page")
  16107. {
  16108. QWidget*widget= new QWidget;
  16109. layout->addWidget(widget);
  16110. widgetStack->push(widget);
  16111. currentElement.setAttribute("trcontext","configuration");
  16112. populateWidget(currentElement,widgetStack,layoutStack);
  16113. widgetStack->pop();
  16114. }
  16115. }
  16116. }
  16117. }
  16118. /*:216*//*217:*/
  16119. #line 4886 "./typica.w"
  16120. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16121. QStack<QLayout*> *layoutStack)
  16122. {
  16123. QDomNodeList children= element.childNodes();
  16124. int row= -1;
  16125. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  16126. for(int i= 0;i<children.count();i++)
  16127. {
  16128. QDomNode current;
  16129. QDomElement currentElement;
  16130. current= children.at(i);
  16131. if(current.isElement())
  16132. {
  16133. currentElement= current.toElement();
  16134. if(currentElement.tagName()=="row")
  16135. {
  16136. row++;
  16137. if(currentElement.hasAttribute("height"))
  16138. {
  16139. layout->setRowMinimumHeight(row,
  16140. currentElement.attribute("height").toInt());
  16141. }
  16142. if(currentElement.hasAttribute("stretch"))
  16143. {
  16144. layout->setRowStretch(row,
  16145. currentElement.attribute("stretch").toInt());
  16146. }
  16147. /*218:*/
  16148. #line 4942 "./typica.w"
  16149. int column= -1;
  16150. QDomNodeList rowChildren= currentElement.childNodes();
  16151. for(int j= 0;j<rowChildren.count();j++)
  16152. {
  16153. QDomNode columnNode;
  16154. QDomElement columnElement;
  16155. columnNode= rowChildren.at(j);
  16156. if(columnNode.isElement())
  16157. {
  16158. columnElement= columnNode.toElement();
  16159. if(columnElement.tagName()=="column")
  16160. {
  16161. column++;
  16162. if(columnElement.hasAttribute("column"))
  16163. {
  16164. column= columnElement.attribute("column").toInt();
  16165. }
  16166. if(columnElement.hasAttribute("width"))
  16167. {
  16168. layout->setColumnMinimumWidth(column,
  16169. columnElement.attribute("width").toInt());
  16170. }
  16171. if(columnElement.hasAttribute("stretch"))
  16172. {
  16173. layout->setColumnStretch(column,
  16174. columnElement.attribute("stretch").toInt());
  16175. }
  16176. int hspan= 1;
  16177. int vspan= 1;
  16178. if(columnElement.hasAttribute("rowspan"))
  16179. {
  16180. vspan= columnElement.attribute("rowspan").toInt();
  16181. }
  16182. if(columnElement.hasAttribute("colspan"))
  16183. {
  16184. hspan= columnElement.attribute("colspan").toInt();
  16185. }
  16186. QHBoxLayout*cell= new QHBoxLayout;
  16187. layout->addLayout(cell,row,column,vspan,hspan);
  16188. layoutStack->push(cell);
  16189. columnElement.setAttribute("trcontext","configuration");
  16190. populateBoxLayout(columnElement,widgetStack,layoutStack);
  16191. layoutStack->pop();
  16192. }
  16193. }
  16194. }
  16195. /*:218*/
  16196. #line 4914 "./typica.w"
  16197. }
  16198. }
  16199. }
  16200. }
  16201. /*:217*//*219:*/
  16202. #line 4993 "./typica.w"
  16203. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16204. QStack<QLayout*> *layoutStack)
  16205. {
  16206. QDomNodeList children= element.childNodes();
  16207. for(int i= 0;i<children.count();i++)
  16208. {
  16209. QDomNode current;
  16210. QDomElement currentElement;
  16211. current= children.at(i);
  16212. if(current.isElement())
  16213. {
  16214. currentElement= current.toElement();
  16215. currentElement.setAttribute("trcontext","configuration");
  16216. if(currentElement.tagName()=="button")
  16217. {
  16218. addButtonToLayout(currentElement,widgetStack,layoutStack);
  16219. }
  16220. else if(currentElement.tagName()=="calendar")
  16221. {
  16222. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  16223. }
  16224. else if(currentElement.tagName()=="decoration")
  16225. {
  16226. addDecorationToLayout(currentElement,widgetStack,
  16227. layoutStack);
  16228. }
  16229. else if(currentElement.tagName()=="layout")
  16230. {
  16231. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  16232. }
  16233. else if(currentElement.tagName()=="splitter")
  16234. {
  16235. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  16236. }
  16237. else if(currentElement.tagName()=="label")
  16238. {
  16239. QBoxLayout*layout=
  16240. qobject_cast<QBoxLayout*> (layoutStack->top());
  16241. QLabel*label= new QLabel(QCoreApplication::translate(
  16242. "configuration",
  16243. currentElement.text().toUtf8().data()));
  16244. layout->addWidget(label);
  16245. }
  16246. else if(currentElement.tagName()=="lcdtemperature")
  16247. {
  16248. addTemperatureDisplayToLayout(currentElement,widgetStack,
  16249. layoutStack);
  16250. }
  16251. else if(currentElement.tagName()=="lcdtimer")
  16252. {
  16253. addTimerDisplayToLayout(currentElement,widgetStack,
  16254. layoutStack);
  16255. }
  16256. else if(currentElement.tagName()=="line")
  16257. {
  16258. addLineToLayout(currentElement,widgetStack,layoutStack);
  16259. }
  16260. else if(currentElement.tagName()=="report")
  16261. {
  16262. addReportToLayout(currentElement,widgetStack,layoutStack);
  16263. }
  16264. else if(currentElement.tagName()=="sqldrop")
  16265. {
  16266. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  16267. }
  16268. else if(currentElement.tagName()=="sqltablearray")
  16269. {
  16270. addSaltToLayout(currentElement,widgetStack,layoutStack);
  16271. }
  16272. else if(currentElement.tagName()=="sqlview")
  16273. {
  16274. addSqlQueryViewToLayout(currentElement,widgetStack,
  16275. layoutStack);
  16276. }
  16277. else if(currentElement.tagName()=="textarea")
  16278. {
  16279. addTextToLayout(currentElement,widgetStack,layoutStack);
  16280. }
  16281. else if(currentElement.tagName()=="spinbox")
  16282. {
  16283. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  16284. }
  16285. else if(currentElement.tagName()=="formarray")
  16286. {
  16287. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  16288. }
  16289. else if(currentElement.tagName()=="hscale")
  16290. {
  16291. addScaleControlToLayout(currentElement,widgetStack,
  16292. layoutStack);
  16293. }
  16294. else if(currentElement.tagName()=="vscale")
  16295. {
  16296. addIntensityControlToLayout(currentElement,widgetStack,
  16297. layoutStack);
  16298. }
  16299. else if(currentElement.tagName()=="webview")
  16300. {
  16301. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  16302. }
  16303. else if(currentElement.tagName()=="stretch")
  16304. {
  16305. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16306. layout->addStretch();
  16307. }
  16308. /*51:*/
  16309. #line 1479 "./typica.w"
  16310. else if(currentElement.tagName()=="svgwidget")
  16311. {
  16312. addSvgWidgetToLayout(currentElement,widgetStack,layoutStack);
  16313. }
  16314. /*:51*//*682:*/
  16315. #line 451 "./daterangeselector.w"
  16316. else if(currentElement.tagName()=="daterange")
  16317. {
  16318. addDateRangeToLayout(currentElement,widgetStack,layoutStack);
  16319. }
  16320. /*:682*/
  16321. #line 5099 "./typica.w"
  16322. }
  16323. }
  16324. }
  16325. /*:219*//*220:*/
  16326. #line 5107 "./typica.w"
  16327. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16328. QStack<QLayout*> *layoutStack)
  16329. {
  16330. QLayout*targetLayout= layoutStack->pop();
  16331. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  16332. if(element.hasAttribute("type"))
  16333. {
  16334. /*215:*/
  16335. #line 4806 "./typica.w"
  16336. QLayout*layout;
  16337. QString layoutType= element.attribute("type");
  16338. if(layoutType=="horizontal")
  16339. {
  16340. layout= new QHBoxLayout;
  16341. layoutStack->push(layout);
  16342. populateBoxLayout(element,widgetStack,layoutStack);
  16343. }
  16344. else if(layoutType=="vertical")
  16345. {
  16346. layout= new QVBoxLayout;
  16347. layoutStack->push(layout);
  16348. populateBoxLayout(element,widgetStack,layoutStack);
  16349. }
  16350. else if(layoutType=="grid")
  16351. {
  16352. layout= new QGridLayout;
  16353. layoutStack->push(layout);
  16354. populateGridLayout(element,widgetStack,layoutStack);
  16355. }
  16356. else if(layoutType=="stack")
  16357. {
  16358. layout= new QStackedLayout;
  16359. layoutStack->push(layout);
  16360. populateStackedLayout(element,widgetStack,layoutStack);
  16361. }
  16362. if(element.hasAttribute("id"))
  16363. {
  16364. layout->setObjectName(element.attribute("id"));
  16365. }
  16366. if(element.hasAttribute("spacing"))
  16367. {
  16368. layout->setSpacing(element.attribute("spacing").toInt());
  16369. }
  16370. if(element.hasAttribute("margin"))
  16371. {
  16372. int m= element.attribute("margin").toInt();
  16373. layout->setContentsMargins(m,m,m,m);
  16374. }
  16375. /*:215*/
  16376. #line 5115 "./typica.w"
  16377. boxLayout->addLayout(layout);
  16378. layoutStack->pop();
  16379. }
  16380. layoutStack->push(targetLayout);
  16381. }
  16382. /*:220*//*221:*/
  16383. #line 5126 "./typica.w"
  16384. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  16385. QStack<QLayout*> *layoutStack)
  16386. {
  16387. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16388. QSplitter*splitter= new(QSplitter);
  16389. layout->addWidget(splitter);
  16390. /*222:*/
  16391. #line 5139 "./typica.w"
  16392. QString orientation= element.attribute("type");
  16393. if(orientation=="horizontal")
  16394. {
  16395. splitter->setOrientation(Qt::Horizontal);
  16396. }
  16397. else if(orientation=="vertical")
  16398. {
  16399. splitter->setOrientation(Qt::Vertical);
  16400. }
  16401. QString id= element.attribute("id");
  16402. if(!id.isEmpty())
  16403. {
  16404. splitter->setObjectName(id);
  16405. }
  16406. if(element.hasChildNodes())
  16407. {
  16408. widgetStack->push(splitter);
  16409. populateSplitter(element,widgetStack,layoutStack);
  16410. widgetStack->pop();
  16411. }
  16412. /*:222*/
  16413. #line 5133 "./typica.w"
  16414. }
  16415. /*:221*//*223:*/
  16416. #line 5165 "./typica.w"
  16417. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16418. QStack<QLayout*> *layoutStack)
  16419. {
  16420. QDomNodeList children= element.childNodes();
  16421. for(int i= 0;i<children.count();i++)
  16422. {
  16423. QDomNode current;
  16424. QDomElement currentElement;
  16425. current= children.at(i);
  16426. if(current.isElement())
  16427. {
  16428. currentElement= current.toElement();
  16429. currentElement.setAttribute("trcontext","configuration");
  16430. if(currentElement.tagName()=="decoration")
  16431. {
  16432. addDecorationToSplitter(currentElement,widgetStack,
  16433. layoutStack);
  16434. }
  16435. else if(currentElement.tagName()=="graph")
  16436. {
  16437. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  16438. }
  16439. else if(currentElement.tagName()=="splitter")
  16440. {
  16441. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  16442. }
  16443. else if(currentElement.tagName()=="lcdtemperature")
  16444. {
  16445. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  16446. layoutStack);
  16447. }
  16448. else if(currentElement.tagName()=="lcdtimer")
  16449. {
  16450. addTimerDisplayToSplitter(currentElement,widgetStack,
  16451. layoutStack);
  16452. }
  16453. else if(currentElement.tagName()=="measurementtable")
  16454. {
  16455. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  16456. }
  16457. else if(currentElement.tagName()=="widget")
  16458. {
  16459. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  16460. }
  16461. }
  16462. }
  16463. }
  16464. /*:223*//*224:*/
  16465. #line 5216 "./typica.w"
  16466. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16467. QStack<QLayout*> *layoutStack)
  16468. {
  16469. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  16470. QSplitter*splitter= new(QSplitter);
  16471. splitter->setParent(parent);
  16472. parent->addWidget(splitter);
  16473. /*222:*/
  16474. #line 5139 "./typica.w"
  16475. QString orientation= element.attribute("type");
  16476. if(orientation=="horizontal")
  16477. {
  16478. splitter->setOrientation(Qt::Horizontal);
  16479. }
  16480. else if(orientation=="vertical")
  16481. {
  16482. splitter->setOrientation(Qt::Vertical);
  16483. }
  16484. QString id= element.attribute("id");
  16485. if(!id.isEmpty())
  16486. {
  16487. splitter->setObjectName(id);
  16488. }
  16489. if(element.hasChildNodes())
  16490. {
  16491. widgetStack->push(splitter);
  16492. populateSplitter(element,widgetStack,layoutStack);
  16493. widgetStack->pop();
  16494. }
  16495. /*:222*/
  16496. #line 5224 "./typica.w"
  16497. }
  16498. /*:224*//*225:*/
  16499. #line 5233 "./typica.w"
  16500. void addTemperatureDisplayToSplitter(QDomElement element,
  16501. QStack<QWidget*> *widgetStack,
  16502. QStack<QLayout*> *)
  16503. {
  16504. TemperatureDisplay*display= new(TemperatureDisplay);
  16505. if(element.hasAttribute("id"))
  16506. {
  16507. display->setObjectName(element.attribute("id"));
  16508. }
  16509. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16510. splitter->addWidget(display);
  16511. }
  16512. void addTemperatureDisplayToLayout(QDomElement element,
  16513. QStack<QWidget*> *,
  16514. QStack<QLayout*> *layoutStack)
  16515. {
  16516. TemperatureDisplay*display= new(TemperatureDisplay);
  16517. if(element.hasAttribute("id"))
  16518. {
  16519. display->setObjectName(element.attribute("id"));
  16520. }
  16521. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16522. layout->addWidget(display);
  16523. }
  16524. /*:225*//*226:*/
  16525. #line 5264 "./typica.w"
  16526. void addTimerDisplayToSplitter(QDomElement element,
  16527. QStack<QWidget*> *widgetStack,
  16528. QStack<QLayout*> *)
  16529. {
  16530. TimerDisplay*display= new(TimerDisplay);
  16531. if(element.hasAttribute("id"))
  16532. {
  16533. display->setObjectName(element.attribute("id"));
  16534. }
  16535. if(element.hasAttribute("format"))
  16536. {
  16537. display->setDisplayFormat(element.attribute("format"));
  16538. }
  16539. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16540. splitter->addWidget(display);
  16541. }
  16542. void addTimerDisplayToLayout(QDomElement element,
  16543. QStack<QWidget*> *,
  16544. QStack<QLayout*> *layoutStack)
  16545. {
  16546. TimerDisplay*display= new(TimerDisplay);
  16547. if(element.hasAttribute("id"))
  16548. {
  16549. display->setObjectName(element.attribute("id"));
  16550. }
  16551. if(element.hasAttribute("format"))
  16552. {
  16553. display->setDisplayFormat(element.attribute("format"));
  16554. }
  16555. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16556. layout->addWidget(display);
  16557. }
  16558. /*:226*//*227:*/
  16559. #line 5302 "./typica.w"
  16560. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  16561. QStack<QLayout*> *layoutStack)
  16562. {
  16563. /*228:*/
  16564. #line 5323 "./typica.w"
  16565. QString labelText=
  16566. QCoreApplication::translate("configuration",
  16567. element.attribute("name").toUtf8().data());
  16568. Qt::Orientations orientation= Qt::Horizontal;
  16569. if(element.hasAttribute("type"))
  16570. {
  16571. if(element.attribute("type")=="horizontal")
  16572. {
  16573. orientation= Qt::Horizontal;
  16574. }
  16575. else if(element.attribute("type")=="vertical")
  16576. {
  16577. orientation= Qt::Vertical;
  16578. }
  16579. }
  16580. /*229:*/
  16581. #line 5350 "./typica.w"
  16582. QWidget*theWidget= NULL;
  16583. QDomNodeList children= element.childNodes();
  16584. for(int i= 0;i<children.count();i++)
  16585. {
  16586. QDomNode item= children.at(i);
  16587. if(item.isElement())
  16588. {
  16589. QDomElement itemElement= item.toElement();
  16590. if(itemElement.tagName()=="lcdtemperature")
  16591. {
  16592. TemperatureDisplay*display= new TemperatureDisplay;
  16593. if(itemElement.hasAttribute("id"))
  16594. {
  16595. display->setObjectName(itemElement.attribute("id"));
  16596. }
  16597. theWidget= display;
  16598. }
  16599. else if(itemElement.tagName()=="lcdtimer")
  16600. {
  16601. TimerDisplay*display= new TimerDisplay;
  16602. if(itemElement.hasAttribute("id"))
  16603. {
  16604. display->setObjectName(itemElement.attribute("id"));
  16605. }
  16606. if(itemElement.hasAttribute("format"))
  16607. {
  16608. display->setDisplayFormat(itemElement.attribute("format"));
  16609. }
  16610. theWidget= display;
  16611. }
  16612. }
  16613. }
  16614. /*:229*/
  16615. #line 5339 "./typica.w"
  16616. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  16617. orientation);
  16618. if(element.hasAttribute("id"))
  16619. {
  16620. decoration->setObjectName(element.attribute("id"));
  16621. }
  16622. /*:228*/
  16623. #line 5306 "./typica.w"
  16624. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16625. layout->addWidget(decoration);
  16626. }
  16627. void addDecorationToSplitter(QDomElement element,
  16628. QStack<QWidget*> *widgetStack,
  16629. QStack<QLayout*> *)
  16630. {
  16631. /*228:*/
  16632. #line 5323 "./typica.w"
  16633. QString labelText=
  16634. QCoreApplication::translate("configuration",
  16635. element.attribute("name").toUtf8().data());
  16636. Qt::Orientations orientation= Qt::Horizontal;
  16637. if(element.hasAttribute("type"))
  16638. {
  16639. if(element.attribute("type")=="horizontal")
  16640. {
  16641. orientation= Qt::Horizontal;
  16642. }
  16643. else if(element.attribute("type")=="vertical")
  16644. {
  16645. orientation= Qt::Vertical;
  16646. }
  16647. }
  16648. /*229:*/
  16649. #line 5350 "./typica.w"
  16650. QWidget*theWidget= NULL;
  16651. QDomNodeList children= element.childNodes();
  16652. for(int i= 0;i<children.count();i++)
  16653. {
  16654. QDomNode item= children.at(i);
  16655. if(item.isElement())
  16656. {
  16657. QDomElement itemElement= item.toElement();
  16658. if(itemElement.tagName()=="lcdtemperature")
  16659. {
  16660. TemperatureDisplay*display= new TemperatureDisplay;
  16661. if(itemElement.hasAttribute("id"))
  16662. {
  16663. display->setObjectName(itemElement.attribute("id"));
  16664. }
  16665. theWidget= display;
  16666. }
  16667. else if(itemElement.tagName()=="lcdtimer")
  16668. {
  16669. TimerDisplay*display= new TimerDisplay;
  16670. if(itemElement.hasAttribute("id"))
  16671. {
  16672. display->setObjectName(itemElement.attribute("id"));
  16673. }
  16674. if(itemElement.hasAttribute("format"))
  16675. {
  16676. display->setDisplayFormat(itemElement.attribute("format"));
  16677. }
  16678. theWidget= display;
  16679. }
  16680. }
  16681. }
  16682. /*:229*/
  16683. #line 5339 "./typica.w"
  16684. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  16685. orientation);
  16686. if(element.hasAttribute("id"))
  16687. {
  16688. decoration->setObjectName(element.attribute("id"));
  16689. }
  16690. /*:228*/
  16691. #line 5315 "./typica.w"
  16692. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16693. splitter->addWidget(decoration);
  16694. }
  16695. /*:227*//*230:*/
  16696. #line 5389 "./typica.w"
  16697. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16698. QStack<QLayout*> *layoutStack)
  16699. {
  16700. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16701. QWidget*widget= new QWidget;
  16702. if(element.hasAttribute("id"))
  16703. {
  16704. widget->setObjectName(element.attribute("id"));
  16705. }
  16706. splitter->addWidget(widget);
  16707. if(element.hasChildNodes())
  16708. {
  16709. widgetStack->push(widget);
  16710. populateWidget(element,widgetStack,layoutStack);
  16711. widgetStack->pop();
  16712. }
  16713. }
  16714. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  16715. QStack<QLayout*> *layoutStack)
  16716. {
  16717. QDomNodeList children= element.childNodes();
  16718. for(int i= 0;i<children.count();i++)
  16719. {
  16720. QDomNode current;
  16721. QDomElement currentElement;
  16722. current= children.at(i);
  16723. if(current.isElement())
  16724. {
  16725. currentElement= current.toElement();
  16726. if(currentElement.tagName()=="layout")
  16727. {
  16728. currentElement.setAttribute("trcontext","configuration");
  16729. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  16730. }
  16731. }
  16732. }
  16733. }
  16734. /*:230*//*231:*/
  16735. #line 5433 "./typica.w"
  16736. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  16737. QStack<QLayout*> *layoutStack)
  16738. {
  16739. QAbstractButton*button= NULL;
  16740. QString text=
  16741. QCoreApplication::translate("configuration",
  16742. element.attribute("name").toUtf8().data());
  16743. if(element.hasAttribute("type"))
  16744. {
  16745. QString type= element.attribute("type");
  16746. if(type=="annotation")
  16747. {
  16748. AnnotationButton*abutton= new AnnotationButton(text);
  16749. if(element.hasAttribute("annotation"))
  16750. {
  16751. abutton->setAnnotation(element.attribute("annotation"));
  16752. }
  16753. if(element.hasAttribute("series"))
  16754. {
  16755. abutton->setTemperatureColumn(element.attribute("series").
  16756. toInt());
  16757. }
  16758. if(element.hasAttribute("column"))
  16759. {
  16760. abutton->setAnnotationColumn(element.attribute("column").
  16761. toInt());
  16762. }
  16763. button= abutton;
  16764. }
  16765. else if(type=="check")
  16766. {
  16767. button= new QCheckBox(text);
  16768. }
  16769. else if(type=="push")
  16770. {
  16771. button= new QPushButton(text);
  16772. }
  16773. }
  16774. if(element.hasAttribute("id"))
  16775. {
  16776. button->setObjectName(element.attribute("id"));
  16777. }
  16778. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16779. layout->addWidget(button);
  16780. }
  16781. /*:231*//*232:*/
  16782. #line 5487 "./typica.w"
  16783. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  16784. QStack<QLayout*> *layoutStack)
  16785. {
  16786. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  16787. if(element.hasAttribute("pretext"))
  16788. {
  16789. box->setPretext(QCoreApplication::translate(
  16790. "configuration",
  16791. element.attribute("pretext").toUtf8().data()));
  16792. }
  16793. if(element.hasAttribute("posttext"))
  16794. {
  16795. box->setPosttext(QCoreApplication::translate(
  16796. "configuration",
  16797. element.attribute("posttext").toUtf8().data()));
  16798. }
  16799. if(element.hasAttribute("series"))
  16800. {
  16801. box->setTemperatureColumn(element.attribute("series").toInt());
  16802. }
  16803. if(element.hasAttribute("column"))
  16804. {
  16805. box->setAnnotationColumn(element.attribute("column").toInt());
  16806. }
  16807. if(element.hasAttribute("min"))
  16808. {
  16809. box->setMinimum(element.attribute("min").toDouble());
  16810. }
  16811. if(element.hasAttribute("max"))
  16812. {
  16813. box->setMaximum(element.attribute("max").toDouble());
  16814. }
  16815. if(element.hasAttribute("decimals"))
  16816. {
  16817. box->setDecimals(element.attribute("decimals").toInt());
  16818. }
  16819. if(element.hasAttribute("step"))
  16820. {
  16821. box->setSingleStep(element.attribute("step").toDouble());
  16822. }
  16823. if(element.hasAttribute("id"))
  16824. {
  16825. box->setObjectName(element.attribute("id"));
  16826. }
  16827. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16828. layout->addWidget(box);
  16829. }
  16830. /*:232*//*233:*/
  16831. #line 5547 "./typica.w"
  16832. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16833. QStack<QLayout*> *)
  16834. {
  16835. ZoomLog*widget= new ZoomLog;
  16836. if(element.hasAttribute("id"))
  16837. {
  16838. widget->setObjectName(element.attribute("id"));
  16839. }
  16840. if(element.hasChildNodes())
  16841. {
  16842. QDomNodeList children= element.childNodes();
  16843. int column= 0;
  16844. for(int i= 0;i<children.count();i++)
  16845. {
  16846. QDomNode current;
  16847. QDomElement currentElement;
  16848. current= children.at(i);
  16849. if(current.isElement())
  16850. {
  16851. currentElement= current.toElement();
  16852. if(currentElement.tagName()=="column")
  16853. {
  16854. QString text=
  16855. QCoreApplication::translate(
  16856. "configuration",
  16857. currentElement.text().toUtf8().data());
  16858. widget->setHeaderData(column,text);
  16859. column++;
  16860. }
  16861. }
  16862. }
  16863. }
  16864. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16865. if(splitter)
  16866. {
  16867. splitter->addWidget(widget);
  16868. }
  16869. else
  16870. {
  16871. qDebug()<<"Splitter not found at top of widget stack!";
  16872. }
  16873. }
  16874. /*:233*//*234:*/
  16875. #line 5594 "./typica.w"
  16876. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  16877. QStack<QLayout*> *)
  16878. {
  16879. GraphView*view= new GraphView;
  16880. if(element.hasAttribute("id"))
  16881. {
  16882. view->setObjectName(element.attribute("id"));
  16883. }
  16884. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  16885. splitter->addWidget(view);
  16886. }
  16887. /*:234*//*235:*/
  16888. #line 5611 "./typica.w"
  16889. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  16890. QStack<QLayout*> *layoutStack)
  16891. {
  16892. SqlComboBox*box= new SqlComboBox();
  16893. if(element.hasAttribute("data"))
  16894. {
  16895. box->setDataColumn(element.attribute("data").toInt());
  16896. }
  16897. if(element.hasAttribute("display"))
  16898. {
  16899. box->setDisplayColumn(element.attribute("display").toInt());
  16900. }
  16901. if(element.hasAttribute("showdata"))
  16902. {
  16903. if(element.attribute("showdata")=="true")
  16904. {
  16905. box->showData(true);
  16906. }
  16907. }
  16908. if(element.hasAttribute("editable"))
  16909. {
  16910. if(element.attribute("editable")=="true")
  16911. {
  16912. box->setEditable(true);
  16913. }
  16914. }
  16915. if(element.hasChildNodes())
  16916. {
  16917. QDomNodeList children= element.childNodes();
  16918. for(int i= 0;i<children.count();i++)
  16919. {
  16920. QDomNode current;
  16921. QDomElement currentElement;
  16922. current= children.at(i);
  16923. if(current.isElement())
  16924. {
  16925. currentElement= current.toElement();
  16926. if(currentElement.tagName()=="null")
  16927. {
  16928. box->addNullOption();
  16929. }
  16930. else if(currentElement.tagName()=="query")
  16931. {
  16932. box->addSqlOptions(currentElement.text());
  16933. }
  16934. }
  16935. }
  16936. }
  16937. if(element.hasAttribute("id"))
  16938. {
  16939. box->setObjectName(element.attribute("id"));
  16940. }
  16941. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16942. layout->addWidget(box);
  16943. }
  16944. /*:235*//*236:*/
  16945. #line 5690 "./typica.w"
  16946. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  16947. QStack<QLayout*> *layoutStack)
  16948. {
  16949. QTableView*view= new QTableView;
  16950. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  16951. SaltModel*model= new SaltModel(element.childNodes().count());
  16952. if(element.hasAttribute("id"))
  16953. {
  16954. view->setObjectName(element.attribute("id"));
  16955. }
  16956. if(element.hasChildNodes())
  16957. {
  16958. QDomNodeList children= element.childNodes();
  16959. int currentColumn= 0;
  16960. for(int i= 0;i<children.count();i++)
  16961. {
  16962. QDomNode current;
  16963. QDomElement currentElement;
  16964. current= children.at(i);
  16965. if(current.isElement())
  16966. {
  16967. currentElement= current.toElement();
  16968. if(currentElement.tagName()=="column")
  16969. {
  16970. if(currentElement.hasAttribute("name"))
  16971. {
  16972. model->setHeaderData(currentColumn,
  16973. Qt::Horizontal,
  16974. QCoreApplication::translate(
  16975. "configuration",
  16976. currentElement.attribute("name").toUtf8().data()));
  16977. }
  16978. if(currentElement.hasAttribute("delegate"))
  16979. {
  16980. /*237:*/
  16981. #line 5741 "./typica.w"
  16982. if(currentElement.attribute("delegate")=="sql")
  16983. {
  16984. /*238:*/
  16985. #line 5757 "./typica.w"
  16986. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  16987. SqlComboBox*widget= new SqlComboBox();
  16988. if(currentElement.hasAttribute("nulltext"))
  16989. {
  16990. widget->setNullText(currentElement.attribute("nulltext"));
  16991. }
  16992. if(currentElement.hasAttribute("nulldata"))
  16993. {
  16994. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  16995. }
  16996. if(currentElement.hasAttribute("null"))
  16997. {
  16998. if(currentElement.attribute("null")=="true")
  16999. {
  17000. widget->addNullOption();
  17001. }
  17002. }
  17003. if(currentElement.hasAttribute("showdata"))
  17004. {
  17005. if(currentElement.attribute("showdata")=="true")
  17006. {
  17007. widget->showData(true);
  17008. }
  17009. }
  17010. if(currentElement.hasAttribute("data"))
  17011. {
  17012. widget->setDataColumn(currentElement.attribute("data").toInt());
  17013. }
  17014. if(currentElement.hasAttribute("display"))
  17015. {
  17016. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  17017. }
  17018. widget->addSqlOptions(currentElement.text());
  17019. delegate->setWidget(widget);
  17020. view->setItemDelegateForColumn(currentColumn,delegate);
  17021. /*:238*/
  17022. #line 5744 "./typica.w"
  17023. }
  17024. else if(currentElement.attribute("delegate")=="numeric")
  17025. {
  17026. /*239:*/
  17027. #line 5798 "./typica.w"
  17028. NumericDelegate*delegate= new NumericDelegate;
  17029. view->setItemDelegateForColumn(currentColumn,delegate);
  17030. /*:239*/
  17031. #line 5748 "./typica.w"
  17032. }
  17033. /*:237*/
  17034. #line 5725 "./typica.w"
  17035. }
  17036. currentColumn++;
  17037. }
  17038. }
  17039. }
  17040. }
  17041. view->setModel(model);
  17042. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17043. layout->addWidget(view);
  17044. }
  17045. /*:236*//*251:*/
  17046. #line 5971 "./typica.w"
  17047. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  17048. QStack<QLayout*> *layoutStack)
  17049. {
  17050. QLineEdit*widget= new QLineEdit(element.text());
  17051. if(element.hasAttribute("id"))
  17052. {
  17053. widget->setObjectName(element.attribute("id"));
  17054. }
  17055. if(element.hasAttribute("writable"))
  17056. {
  17057. if(element.attribute("writable")=="false")
  17058. {
  17059. widget->setReadOnly(true);
  17060. }
  17061. }
  17062. if(element.hasAttribute("validator"))
  17063. {
  17064. if(element.attribute("validator")=="numeric")
  17065. {
  17066. widget->setValidator(new ScriptValidator(new QDoubleValidator));
  17067. }
  17068. else if(element.attribute("validator")=="integer")
  17069. {
  17070. widget->setValidator(new ScriptValidator(new QIntValidator));
  17071. }
  17072. else if(element.attribute("validator")=="expression"&&
  17073. element.hasAttribute("expression"))
  17074. {
  17075. widget->setValidator(new QRegExpValidator(
  17076. QRegExp(element.attribute("expression")),
  17077. NULL));
  17078. }
  17079. }
  17080. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17081. layout->addWidget(widget);
  17082. }
  17083. /*:251*//*252:*/
  17084. #line 6012 "./typica.w"
  17085. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  17086. QStack<QLayout*> *layoutStack)
  17087. {
  17088. QTextEdit*widget= new QTextEdit;
  17089. if(element.hasAttribute("id"))
  17090. {
  17091. widget->setObjectName(element.attribute("id"));
  17092. }
  17093. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17094. layout->addWidget(widget);
  17095. }
  17096. /*:252*//*253:*/
  17097. #line 6029 "./typica.w"
  17098. void addSqlQueryViewToLayout(QDomElement element,
  17099. QStack<QWidget*> *,
  17100. QStack<QLayout*> *layoutStack)
  17101. {
  17102. SqlQueryView*view= new SqlQueryView;
  17103. if(element.hasAttribute("id"))
  17104. {
  17105. view->setObjectName(element.attribute("id"));
  17106. }
  17107. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17108. layout->addWidget(view);
  17109. }
  17110. /*:253*//*254:*/
  17111. #line 6046 "./typica.w"
  17112. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  17113. QStack<QLayout*> *layoutStack)
  17114. {
  17115. QWidget*widget;
  17116. if(element.hasAttribute("time"))
  17117. {
  17118. if(element.attribute("time")=="true")
  17119. {
  17120. QDateTimeEdit*edit= new QDateTimeEdit;
  17121. edit->setDateTime(QDateTime::currentDateTime());
  17122. edit->setCalendarPopup(true);
  17123. edit->setDisplayFormat("yyyy-MM-dd hh:mm:ss");
  17124. widget= qobject_cast<QWidget*> (edit);
  17125. }
  17126. else
  17127. {
  17128. QDateEdit*edit= new QDateEdit;
  17129. edit->setDate(QDate::currentDate());
  17130. edit->setCalendarPopup(true);
  17131. edit->setDisplayFormat("yyyy-MM-dd");
  17132. widget= qobject_cast<QWidget*> (edit);
  17133. }
  17134. }
  17135. else
  17136. {
  17137. QDateEdit*edit= new QDateEdit;
  17138. edit->setDate(QDate::currentDate());
  17139. edit->setCalendarPopup(true);
  17140. edit->setDisplayFormat("yyyy-MM-dd");
  17141. widget= qobject_cast<QWidget*> (edit);
  17142. }
  17143. if(element.hasAttribute("id"))
  17144. {
  17145. widget->setObjectName(element.attribute("id"));
  17146. }
  17147. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  17148. layout->addWidget(widget);
  17149. }
  17150. /*:254*//*255:*/
  17151. #line 6089 "./typica.w"
  17152. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  17153. {
  17154. setQDateTimeEditProperties(value,engine);
  17155. }
  17156. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  17157. {
  17158. setQAbstractSpinBoxProperties(value,engine);
  17159. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  17160. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  17161. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  17162. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  17163. value.setProperty("setToCurrentTime",
  17164. engine->newFunction(QDateTimeEdit_setToCurrentTime));
  17165. }
  17166. /*:255*//*256:*/
  17167. #line 6111 "./typica.w"
  17168. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  17169. {
  17170. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17171. if(context->argumentCount()==3)
  17172. {
  17173. self->setDate(QDate(argument<int> (0,context),
  17174. argument<int> (1,context),
  17175. argument<int> (2,context)));
  17176. }
  17177. else
  17178. {
  17179. context->throwError("Incorrect number of arguments passed to "
  17180. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  17181. "specifying the year, month, and day.");
  17182. }
  17183. return QScriptValue();
  17184. }
  17185. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  17186. {
  17187. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17188. return QScriptValue(self->date().day());
  17189. }
  17190. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  17191. {
  17192. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17193. return QScriptValue(self->date().month());
  17194. }
  17195. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  17196. {
  17197. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17198. return QScriptValue(self->date().year());
  17199. }
  17200. QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*)
  17201. {
  17202. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  17203. self->setDateTime(QDateTime::currentDateTime());
  17204. return QScriptValue();
  17205. }
  17206. /*:256*//*260:*/
  17207. #line 6186 "./typica.w"
  17208. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  17209. {
  17210. QObject*parent= argument<QObject*> (0,context);
  17211. QString name= argument<QString> (1,context);
  17212. QObject*object= parent->findChild<QObject*> (name);
  17213. QScriptValue value;
  17214. if(object)
  17215. {
  17216. value= engine->newQObject(object);
  17217. QString className= object->metaObject()->className();
  17218. /*261:*/
  17219. #line 6204 "./typica.w"
  17220. if(className=="TemperatureDisplay")
  17221. {
  17222. setTemperatureDisplayProperties(value,engine);
  17223. }
  17224. else if(className=="TimerDisplay")
  17225. {
  17226. setTimerDisplayProperties(value,engine);
  17227. }
  17228. else if(className=="QAction")
  17229. {
  17230. setQActionProperties(value,engine);
  17231. }
  17232. else if(className=="QBoxLayout")
  17233. {
  17234. setQBoxLayoutProperties(value,engine);
  17235. }
  17236. else if(className=="QDateEdit")
  17237. {
  17238. setQDateEditProperties(value,engine);
  17239. }
  17240. else if(className=="QDateTimeEdit")
  17241. {
  17242. setQDateTimeEditProperties(value,engine);
  17243. }
  17244. else if(className=="QFrame")
  17245. {
  17246. setQFrameProperties(value,engine);
  17247. }
  17248. else if(className=="QHBoxLayout")
  17249. {
  17250. setQBoxLayoutProperties(value,engine);
  17251. }
  17252. else if(className=="QLCDNumber")
  17253. {
  17254. setQLCDNumberProperties(value,engine);
  17255. }
  17256. else if(className=="QMenu")
  17257. {
  17258. setQMenuProperties(value,engine);
  17259. }
  17260. else if(className=="QMenuBar")
  17261. {
  17262. setQMenuBarProperties(value,engine);
  17263. }
  17264. else if(className=="QPushButton")
  17265. {
  17266. setQPushButtonProperties(value,engine);
  17267. }
  17268. else if(className=="QSplitter")
  17269. {
  17270. setQSplitterProperties(value,engine);
  17271. }
  17272. else if(className=="QTableView")
  17273. {
  17274. if(object->property("tabletype").isValid())
  17275. {
  17276. if(object->property("tabletype").toString()=="SaltTable")
  17277. {
  17278. setSaltTableProperties(value,engine);
  17279. }
  17280. }
  17281. }
  17282. else if(className=="QVBoxLayout")
  17283. {
  17284. setQBoxLayoutProperties(value,engine);
  17285. }
  17286. else if(className=="QWidget")
  17287. {
  17288. setQWidgetProperties(value,engine);
  17289. }
  17290. else if(className=="ScriptQMainWindow")
  17291. {
  17292. setQMainWindowProperties(value,engine);
  17293. }
  17294. else if(className=="SqlComboBox")
  17295. {
  17296. setSqlComboBoxProperties(value,engine);
  17297. }
  17298. else if(className=="SqlQueryView")
  17299. {
  17300. setSqlQueryViewProperties(value,engine);
  17301. }
  17302. else if(className=="ZoomLog")
  17303. {
  17304. setZoomLogProperties(value,engine);
  17305. }
  17306. else if(className=="QTextEdit")
  17307. {
  17308. setQTextEditProperties(value,engine);
  17309. }
  17310. else if(className=="QWebView")
  17311. {
  17312. setQWebViewProperties(value,engine);
  17313. }
  17314. else if(className=="QLineEdit")
  17315. {
  17316. setQLineEditProperties(value,engine);
  17317. }
  17318. else if(className=="QSvgWidget")
  17319. {
  17320. setQSvgWidgetProperties(value,engine);
  17321. }
  17322. /*:261*/
  17323. #line 6197 "./typica.w"
  17324. }
  17325. return value;
  17326. }
  17327. /*:260*//*263:*/
  17328. #line 6337 "./typica.w"
  17329. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  17330. {
  17331. QTableView*self= getself<QTableView*> (context);
  17332. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17333. QString datum;
  17334. double total= 0.0;
  17335. int column= argument<int> (0,context);
  17336. int role= argument<int> (1,context);
  17337. for(int i= 0;i<model->rowCount();i++)
  17338. {
  17339. datum= model->data(model->index(i,column),role).toString();
  17340. if(!datum.isEmpty())
  17341. {
  17342. total+= datum.toDouble();
  17343. }
  17344. }
  17345. return QScriptValue(engine,total);
  17346. }
  17347. /*:263*//*264:*/
  17348. #line 6361 "./typica.w"
  17349. QScriptValue SaltTable_columnArray(QScriptContext*context,
  17350. QScriptEngine*engine)
  17351. {
  17352. QTableView*self= getself<QTableView*> (context);
  17353. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17354. int column= argument<int> (0,context);
  17355. int role= argument<int> (1,context);
  17356. QString literal= model->arrayLiteral(column,role);
  17357. return QScriptValue(engine,literal);
  17358. }
  17359. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  17360. QScriptEngine*engine)
  17361. {
  17362. QTableView*self= getself<QTableView*> (context);
  17363. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17364. int column= argument<int> (0,context);
  17365. int role= argument<int> (1,context);
  17366. QString literal= model->quotedArrayLiteral(column,role);
  17367. return QScriptValue(engine,literal);
  17368. }
  17369. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  17370. QScriptEngine*engine)
  17371. {
  17372. QTableView*self= getself<QTableView*> (context);
  17373. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17374. int column= argument<int> (0,context);
  17375. int role= argument<int> (1,context);
  17376. QString literal= model->arrayLiteral(column,role);
  17377. literal.chop(1);
  17378. literal= literal.remove(0,1);
  17379. return QScriptValue(engine,literal);
  17380. }
  17381. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  17382. QScriptEngine*engine)
  17383. {
  17384. QTableView*self= getself<QTableView*> (context);
  17385. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17386. int column= argument<int> (0,context);
  17387. int role= argument<int> (1,context);
  17388. QString literal= model->quotedArrayLiteral(column,role);
  17389. literal.chop(1);
  17390. literal= literal.remove(0,1);
  17391. return QScriptValue(engine,literal);
  17392. }
  17393. /*:264*//*265:*/
  17394. #line 6413 "./typica.w"
  17395. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  17396. {
  17397. QTableView*self= getself<QTableView*> (context);
  17398. QScriptValue value= engine->newQObject(self->model());
  17399. return value;
  17400. }
  17401. /*:265*//*266:*/
  17402. #line 6427 "./typica.w"
  17403. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  17404. {
  17405. QTableView*self= getself<QTableView*> (context);
  17406. int row= argument<int> (0,context);
  17407. int column= argument<int> (1,context);
  17408. QVariant value= argument<QVariant> (2,context);
  17409. int role= argument<int> (3,context);
  17410. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17411. QModelIndex cell= model->index(row,column);
  17412. model->setData(cell,value,role);
  17413. self->update(cell);
  17414. return QScriptValue();
  17415. }
  17416. /*:266*//*267:*/
  17417. #line 6445 "./typica.w"
  17418. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  17419. {
  17420. QTableView*self= getself<QTableView*> (context);
  17421. int row= argument<int> (0,context);
  17422. int column= argument<int> (1,context);
  17423. int role= argument<int> (2,context);
  17424. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17425. QModelIndex cell= model->index(row,column);
  17426. QVariant value= model->data(cell,role);
  17427. QScriptValue retval= engine->newVariant(value);
  17428. retval.setProperty("value",QScriptValue(value.toString()));
  17429. return retval;
  17430. }
  17431. /*:267*//*268:*/
  17432. #line 6465 "./typica.w"
  17433. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  17434. {
  17435. QTableView*self= getself<QTableView*> (context);
  17436. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17437. model->clear();
  17438. return QScriptValue();
  17439. }
  17440. /*:268*//*269:*/
  17441. #line 6477 "./typica.w"
  17442. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  17443. {
  17444. QTableView*self= getself<QTableView*> (context);
  17445. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17446. int row= argument<int> (0,context);
  17447. return engine->newVariant(model->removeRow(row));
  17448. }
  17449. /*:269*//*270:*/
  17450. #line 6490 "./typica.w"
  17451. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  17452. {
  17453. QTableView*self= getself<QTableView*> (context);
  17454. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  17455. QVariant value= argument<QVariant> (0,context);
  17456. int column= argument<int> (1,context);
  17457. return engine->newVariant(model->findData(value,column));
  17458. }
  17459. /*:270*//*271:*/
  17460. #line 6503 "./typica.w"
  17461. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  17462. {
  17463. setQWidgetProperties(value,engine);
  17464. value.setProperty("columnArray",
  17465. engine->newFunction(SaltTable_columnArray));
  17466. value.setProperty("quotedColumnArray",
  17467. engine->newFunction(SaltTable_quotedColumnArray));
  17468. value.setProperty("bindableColumnArray",
  17469. engine->newFunction(SaltTable_bindableColumnArray));
  17470. value.setProperty("bindableQuotedColumnArray",
  17471. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  17472. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  17473. value.setProperty("data",engine->newFunction(SaltTable_data));
  17474. value.setProperty("model",engine->newFunction(SaltTable_model));
  17475. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  17476. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  17477. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  17478. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  17479. }
  17480. /*:271*//*273:*/
  17481. #line 6540 "./typica.w"
  17482. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  17483. {
  17484. setQComboBoxProperties(value,engine);
  17485. }
  17486. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  17487. {
  17488. setQWidgetProperties(value,engine);
  17489. value.setProperty("currentData",
  17490. engine->newFunction(QComboBox_currentData));
  17491. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  17492. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  17493. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  17494. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  17495. }
  17496. QScriptValue QComboBox_currentData(QScriptContext*context,
  17497. QScriptEngine*engine)
  17498. {
  17499. QComboBox*self= getself<QComboBox*> (context);
  17500. return QScriptValue(engine,
  17501. self->itemData(self->currentIndex()).toString());
  17502. }
  17503. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  17504. {
  17505. QComboBox*self= getself<QComboBox*> (context);
  17506. self->addItem(argument<QString> (0,context));
  17507. return QScriptValue();
  17508. }
  17509. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  17510. {
  17511. QComboBox*self= getself<QComboBox*> (context);
  17512. self->setModel(argument<QAbstractItemModel*> (0,context));
  17513. return QScriptValue();
  17514. }
  17515. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  17516. {
  17517. QComboBox*self= getself<QComboBox*> (context);
  17518. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  17519. }
  17520. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  17521. {
  17522. QComboBox*self= getself<QComboBox*> (context);
  17523. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  17524. }
  17525. #line 1 "./abouttypica.w"
  17526. /*:273*//*286:*/
  17527. #line 401 "./units.w"
  17528. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
  17529. {
  17530. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  17531. argument<Units::Unit> (1,context),
  17532. argument<Units::Unit> (2,context)));
  17533. }
  17534. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  17535. QScriptEngine*)
  17536. {
  17537. return QScriptValue(Units::convertRelativeTemperature(
  17538. argument<double> (0,context),
  17539. argument<Units::Unit> (1,context),
  17540. argument<Units::Unit> (2,context)));
  17541. }
  17542. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
  17543. {
  17544. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  17545. }
  17546. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
  17547. {
  17548. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  17549. argument<Units::Unit> (1,context),
  17550. argument<Units::Unit> (2,context)));
  17551. }
  17552. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
  17553. {
  17554. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  17555. }
  17556. /*:286*//*289:*/
  17557. #line 449 "./units.w"
  17558. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  17559. {
  17560. return engine->newVariant(QVariant(value));
  17561. }
  17562. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  17563. {
  17564. value= sv.toVariant().value<Units::Unit> ();
  17565. }
  17566. /*:289*//*299:*/
  17567. #line 149 "./measurement.w"
  17568. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine)
  17569. {
  17570. QScriptValue object;
  17571. if(context->argumentCount()==2||context->argumentCount()==3)
  17572. {
  17573. double measurement= argument<double> (0,context);
  17574. QTime timestamp= argument<QTime> (1,context);
  17575. Units::Unit unit= Units::Fahrenheit;
  17576. if(context->argumentCount()==3)
  17577. {
  17578. unit= argument<Units::Unit> (2,context);
  17579. }
  17580. object= engine->toScriptValue<Measurement> (Measurement(measurement,timestamp,unit));
  17581. setMeasurementProperties(object,engine);
  17582. }
  17583. else
  17584. {
  17585. context->throwError("Incorrect number of arguments passed to "
  17586. "Measurement::Measurement(). This method takes two "
  17587. "or three arguments.");
  17588. }
  17589. return object;
  17590. }
  17591. /*:299*//*300:*/
  17592. #line 176 "./measurement.w"
  17593. void setMeasurementProperties(QScriptValue,QScriptEngine*)
  17594. {
  17595. }
  17596. /*:300*//*301:*/
  17597. #line 184 "./measurement.w"
  17598. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement)
  17599. {
  17600. QVariant var;
  17601. var.setValue(measurement);
  17602. return engine->newVariant(var);
  17603. }
  17604. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement)
  17605. {
  17606. measurement= value.toVariant().value<Measurement> ();
  17607. }
  17608. #line 6609 "./typica.w"
  17609. /*:301*//*319:*/
  17610. #line 7187 "./typica.w"
  17611. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  17612. {
  17613. QScriptValue object;
  17614. if(context->argumentCount()==1)
  17615. {
  17616. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  17617. QScriptEngine::ScriptOwnership);
  17618. setDAQProperties(object,engine);
  17619. }
  17620. else if(context->argumentCount()==2)
  17621. {
  17622. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  17623. argument<QString> (1,context)),
  17624. QScriptEngine::ScriptOwnership);
  17625. setDAQProperties(object,engine);
  17626. }
  17627. else
  17628. {
  17629. context->throwError("Incorrect number of arguments passed to DAQ"
  17630. "constructor. The DAQ constructor takes one"
  17631. "string as an argument specifying a device name."
  17632. "Example: Dev1");
  17633. }
  17634. return object;
  17635. }
  17636. /*:319*//*320:*/
  17637. #line 7217 "./typica.w"
  17638. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  17639. {
  17640. setQObjectProperties(value,engine);
  17641. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  17642. }
  17643. /*:320*//*321:*/
  17644. #line 7227 "./typica.w"
  17645. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  17646. {
  17647. DAQ*self= getself<DAQ*> (context);
  17648. QScriptValue object;
  17649. if(self)
  17650. {
  17651. object=
  17652. engine->newQObject(self->newChannel(argument<int> (0,context),
  17653. argument<int> (1,context)));
  17654. setChannelProperties(object,engine);
  17655. }
  17656. return object;
  17657. }
  17658. /*:321*//*328:*/
  17659. #line 7383 "./typica.w"
  17660. QScriptValue constructFakeDAQ(QScriptContext*context,
  17661. QScriptEngine*engine)
  17662. {
  17663. QScriptValue object;
  17664. if(context->argumentCount()==1)
  17665. {
  17666. object=
  17667. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  17668. QScriptEngine::ScriptOwnership);
  17669. setFakeDAQProperties(object,engine);
  17670. }
  17671. else
  17672. {
  17673. context->throwError("Incorrect number of arguments passed to DAQ"
  17674. "constructor. The DAQ constructor takes one"
  17675. "string as an argument specifying a device name."
  17676. "Example: Dev1");
  17677. }
  17678. return object;
  17679. }
  17680. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  17681. {
  17682. setQObjectProperties(value,engine);
  17683. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  17684. }
  17685. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  17686. {
  17687. FakeDAQ*self= getself<FakeDAQ*> (context);
  17688. QScriptValue object;
  17689. if(self)
  17690. {
  17691. object=
  17692. engine->newQObject(self->newChannel(argument<int> (0,context),
  17693. argument<int> (1,context)));
  17694. setChannelProperties(object,engine);
  17695. }
  17696. return object;
  17697. }
  17698. /*:328*//*332:*/
  17699. #line 7474 "./typica.w"
  17700. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  17701. {
  17702. setQObjectProperties(value,engine);
  17703. }
  17704. /*:332*//*339:*/
  17705. #line 7666 "./typica.w"
  17706. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  17707. {
  17708. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  17709. setLinearCalibratorProperties(object,engine);
  17710. return object;
  17711. }
  17712. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  17713. {
  17714. setQObjectProperties(value,engine);
  17715. }
  17716. /*:339*//*344:*/
  17717. #line 7804 "./typica.w"
  17718. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  17719. {
  17720. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  17721. setLinearSplineInterpolatorProperties(object,engine);
  17722. return object;
  17723. }
  17724. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  17725. {
  17726. setQObjectProperties(value,engine);
  17727. }
  17728. /*:344*//*354:*/
  17729. #line 8013 "./typica.w"
  17730. QScriptValue constructTemperatureDisplay(QScriptContext*,
  17731. QScriptEngine*engine)
  17732. {
  17733. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  17734. setTemperatureDisplayProperties(object,engine);
  17735. return object;
  17736. }
  17737. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  17738. {
  17739. setQLCDNumberProperties(value,engine);
  17740. value.setProperty("setDisplayUnits",
  17741. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  17742. }
  17743. /*:354*//*355:*/
  17744. #line 8037 "./typica.w"
  17745. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  17746. {
  17747. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  17748. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  17749. return QScriptValue();
  17750. }
  17751. /*:355*//*362:*/
  17752. #line 8174 "./typica.w"
  17753. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  17754. QScriptEngine*engine)
  17755. {
  17756. QScriptValue object=
  17757. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  17758. setMeasurementTimeOffsetProperties(object,engine);
  17759. return object;
  17760. }
  17761. void setMeasurementTimeOffsetProperties(QScriptValue value,
  17762. QScriptEngine*engine)
  17763. {
  17764. setQObjectProperties(value,engine);
  17765. }
  17766. /*:362*//*367:*/
  17767. #line 8283 "./typica.w"
  17768. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  17769. {
  17770. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  17771. return object;
  17772. }
  17773. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  17774. {
  17775. setQObjectProperties(value,engine);
  17776. }
  17777. /*:367*//*372:*/
  17778. #line 8380 "./typica.w"
  17779. QScriptValue constructZeroEmitter(QScriptContext*context,
  17780. QScriptEngine*engine)
  17781. {
  17782. QScriptValue object=
  17783. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  17784. setZeroEmitterProperties(object,engine);
  17785. return object;
  17786. }
  17787. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  17788. {
  17789. setQObjectProperties(value,engine);
  17790. }
  17791. /*:372*//*377:*/
  17792. #line 8460 "./typica.w"
  17793. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  17794. QScriptEngine*engine)
  17795. {
  17796. QScriptValue object=
  17797. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  17798. setMeasurementAdapterProperties(object,engine);
  17799. return object;
  17800. }
  17801. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  17802. {
  17803. setQObjectProperties(value,engine);
  17804. }
  17805. /*:377*//*394:*/
  17806. #line 8922 "./typica.w"
  17807. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  17808. {
  17809. QScriptValue object= engine->newQObject(new GraphView);
  17810. setGraphViewProperties(object,engine);
  17811. return object;
  17812. }
  17813. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  17814. {
  17815. setQGraphicsViewProperties(value,engine);
  17816. }
  17817. /*:394*//*417:*/
  17818. #line 9560 "./typica.w"
  17819. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  17820. {
  17821. QScriptValue object= engine->newQObject(new ZoomLog);
  17822. setZoomLogProperties(object,engine);
  17823. return object;
  17824. }
  17825. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  17826. {
  17827. setQTableViewProperties(value,engine);
  17828. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  17829. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  17830. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  17831. value.setProperty("restoreState",
  17832. engine->newFunction(ZoomLog_restoreState));
  17833. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  17834. value.setProperty("saveTemporary",
  17835. engine->newFunction(ZoomLog_saveTemporary));
  17836. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  17837. }
  17838. /*:417*//*418:*/
  17839. #line 9587 "./typica.w"
  17840. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  17841. {
  17842. ZoomLog*self= getself<ZoomLog*> (context);
  17843. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  17844. return QScriptValue(engine,retval);
  17845. }
  17846. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  17847. {
  17848. ZoomLog*self= getself<ZoomLog*> (context);
  17849. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  17850. return QScriptValue(engine,retval);
  17851. }
  17852. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  17853. QScriptEngine*engine)
  17854. {
  17855. ZoomLog*self= getself<ZoomLog*> (context);
  17856. QString filename= QDir::tempPath();
  17857. filename.append("/");
  17858. filename.append(QUuid::createUuid().toString());
  17859. filename.append(".xml");
  17860. QFile*file= new QFile(filename);
  17861. self->saveXML(file);
  17862. file->close();
  17863. delete file;
  17864. return QScriptValue(engine,filename);
  17865. }
  17866. /*:418*//*419:*/
  17867. #line 9635 "./typica.w"
  17868. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  17869. {
  17870. ZoomLog*self= getself<ZoomLog*> (context);
  17871. QString key= argument<QString> (0,context);
  17872. int columns= argument<int> (1,context);
  17873. QSettings settings;
  17874. for(int i= 0;i<columns;i++)
  17875. {
  17876. if(self->columnWidth(i))
  17877. {
  17878. settings.beginGroup(key);
  17879. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  17880. settings.endGroup();
  17881. }
  17882. }
  17883. return QScriptValue();
  17884. }
  17885. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  17886. {
  17887. ZoomLog*self= getself<ZoomLog*> (context);
  17888. QString key= argument<QString> (0,context);
  17889. int columns= argument<int> (1,context);
  17890. QSettings settings;
  17891. for(int i= 0;i<columns;i++)
  17892. {
  17893. settings.beginGroup(key);
  17894. self->setColumnWidth(i,
  17895. settings.value(QString("%1").arg(i),80).toInt());
  17896. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  17897. {
  17898. self->setColumnWidth(i,80);
  17899. }
  17900. settings.endGroup();
  17901. }
  17902. return QScriptValue();
  17903. }
  17904. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  17905. {
  17906. ZoomLog*self= getself<ZoomLog*> (context);
  17907. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  17908. }
  17909. /*:419*//*420:*/
  17910. #line 9688 "./typica.w"
  17911. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  17912. {
  17913. ZoomLog*self= getself<ZoomLog*> (context);
  17914. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  17915. return QScriptValue();
  17916. }
  17917. /*:420*//*455:*/
  17918. #line 10508 "./typica.w"
  17919. QScriptValue constructAnnotationButton(QScriptContext*context,
  17920. QScriptEngine*engine)
  17921. {
  17922. QScriptValue object=
  17923. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  17924. setAnnotationButtonProperties(object,engine);
  17925. return object;
  17926. }
  17927. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  17928. {
  17929. setQPushButtonProperties(value,engine);
  17930. }
  17931. /*:455*//*463:*/
  17932. #line 10651 "./typica.w"
  17933. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  17934. QScriptEngine*engine)
  17935. {
  17936. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  17937. argument<QString> (0,context),argument<QString> (1,context)));
  17938. setAnnotationSpinBoxProperties(object,engine);
  17939. return object;
  17940. }
  17941. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  17942. {
  17943. setQDoubleSpinBoxProperties(value,engine);
  17944. }
  17945. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  17946. {
  17947. setQAbstractSpinBoxProperties(value,engine);
  17948. }
  17949. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  17950. {
  17951. setQWidgetProperties(value,engine);
  17952. }
  17953. /*:463*//*484:*/
  17954. #line 11074 "./typica.w"
  17955. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  17956. {
  17957. QScriptValue object= engine->newQObject(new TimerDisplay);
  17958. setTimerDisplayProperties(object,engine);
  17959. return object;
  17960. }
  17961. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  17962. {
  17963. setQLCDNumberProperties(value,engine);
  17964. value.setProperty("setTimerMode",engine->newFunction(TimerDisplay_setTimerMode));
  17965. }
  17966. /*:484*//*485:*/
  17967. #line 11093 "./typica.w"
  17968. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*)
  17969. {
  17970. TimerDisplay*self= getself<TimerDisplay*> (context);
  17971. if(self)
  17972. {
  17973. switch(argument<int> (0,context))
  17974. {
  17975. case 0:
  17976. self->setMode(TimerDisplay::CountUp);
  17977. break;
  17978. case 1:
  17979. self->setMode(TimerDisplay::CountDown);
  17980. break;
  17981. case 2:
  17982. self->setMode(TimerDisplay::Clock);
  17983. break;
  17984. default:
  17985. break;
  17986. }
  17987. }
  17988. return QScriptValue();
  17989. }
  17990. /*:485*//*512:*/
  17991. #line 11599 "./typica.w"
  17992. QScriptValue constructWidgetDecorator(QScriptContext*context,
  17993. QScriptEngine*engine)
  17994. {
  17995. QWidget*widget= argument<QWidget*> (0,context);
  17996. QString text= argument<QString> (1,context);
  17997. Qt::Orientations orientation;
  17998. switch(argument<int> (2,context))
  17999. {
  18000. case 2:
  18001. orientation= Qt::Vertical;
  18002. break;
  18003. default:
  18004. orientation= Qt::Horizontal;
  18005. break;
  18006. }
  18007. QScriptValue object=
  18008. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  18009. setWidgetDecoratorProperties(object,engine);
  18010. return object;
  18011. }
  18012. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  18013. {
  18014. setQWidgetProperties(value,engine);
  18015. }
  18016. /*:512*//*525:*/
  18017. #line 11880 "./typica.w"
  18018. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  18019. {
  18020. QScriptValue object= engine->newQObject(new LogEditWindow);
  18021. return object;
  18022. }
  18023. /*:525*//*544:*/
  18024. #line 12407 "./typica.w"
  18025. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  18026. {
  18027. QIODevice*device= argument<QIODevice*> (0,context);
  18028. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  18029. argument<int> (1,context)));
  18030. object.setProperty("input",engine->newFunction(XMLInput_input));
  18031. return object;
  18032. }
  18033. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  18034. {
  18035. XMLInput*self= getself<XMLInput*> (context);
  18036. self->input();
  18037. return QScriptValue();
  18038. }
  18039. /*:544*//*558:*/
  18040. #line 157 "./webview.w"
  18041. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  18042. {
  18043. QScriptValue object= engine->newQObject(new TypicaWebView);
  18044. setQWebViewProperties(object,engine);
  18045. return object;
  18046. }
  18047. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  18048. {
  18049. setQWidgetProperties(value,engine);
  18050. }
  18051. /*:558*//*559:*/
  18052. #line 174 "./webview.w"
  18053. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  18054. QStack<QLayout*> *layoutStack)
  18055. {
  18056. TypicaWebView*view= new TypicaWebView;
  18057. if(element.hasAttribute("id"))
  18058. {
  18059. view->setObjectName(element.attribute("id"));
  18060. }
  18061. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18062. layout->addWidget(view);
  18063. }
  18064. /*:559*//*564:*/
  18065. #line 225 "./webview.w"
  18066. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  18067. {
  18068. QVariant var;
  18069. var.setValue(element);
  18070. QScriptValue object= engine->newVariant(var);
  18071. return object;
  18072. }
  18073. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  18074. {
  18075. element= value.toVariant().value<QWebElement> ();
  18076. }
  18077. /*:564*//*569:*/
  18078. #line 290 "./webview.w"
  18079. template<> QWebElement argument(int arg,QScriptContext*context)
  18080. {
  18081. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  18082. }
  18083. /*:569*//*570:*/
  18084. #line 299 "./webview.w"
  18085. QScriptValue constructWebElement(QScriptContext*context,
  18086. QScriptEngine*engine)
  18087. {
  18088. QWebElement element= argument<QWebElement> (0,context);
  18089. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  18090. return object;
  18091. }
  18092. /*:570*//*638:*/
  18093. #line 13760 "./typica.w"
  18094. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  18095. {
  18096. QScriptValue object= engine->newQObject(new SqlQueryView);
  18097. setSqlQueryViewProperties(object,engine);
  18098. return object;
  18099. }
  18100. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  18101. {
  18102. setQTableViewProperties(value,engine);
  18103. value.setProperty("setHeaderData",
  18104. engine->newFunction(SqlQueryView_setHeaderData));
  18105. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  18106. }
  18107. /*:638*//*639:*/
  18108. #line 13778 "./typica.w"
  18109. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  18110. {
  18111. SqlQueryView*self= getself<SqlQueryView*> (context);
  18112. QString query= argument<QString> (0,context);
  18113. self->setQuery(query);
  18114. self->reset();
  18115. return QScriptValue();
  18116. }
  18117. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  18118. QScriptEngine*)
  18119. {
  18120. SqlQueryView*self= getself<SqlQueryView*> (context);
  18121. int section= argument<int> (0,context);
  18122. QString data= argument<QString> (1,context);
  18123. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  18124. return QScriptValue();
  18125. }
  18126. /*:639*//*647:*/
  18127. #line 13987 "./typica.w"
  18128. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  18129. QStack<QLayout*> *layoutStack)
  18130. {
  18131. QTextEdit*widget= new QTextEdit;
  18132. if(element.hasAttribute("id"))
  18133. {
  18134. widget->setObjectName(element.attribute("id"));
  18135. }
  18136. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18137. layout->addWidget(widget);
  18138. QTextDocument*document= new QTextDocument;
  18139. QFont defaultFont;
  18140. defaultFont.setPointSize(11);
  18141. document->setDefaultFont(defaultFont);
  18142. QTextCursor cursor(document);
  18143. /*648:*/
  18144. #line 14010 "./typica.w"
  18145. QDomNodeList children= element.childNodes();
  18146. for(int i= 0;i<children.count();i++)
  18147. {
  18148. QDomNode current;
  18149. QDomElement currentElement;
  18150. current= children.at(i);
  18151. if(current.isElement())
  18152. {
  18153. currentElement= current.toElement();
  18154. /*649:*/
  18155. #line 14027 "./typica.w"
  18156. if(currentElement.tagName()=="style")
  18157. {
  18158. document->setDefaultStyleSheet(currentElement.text());
  18159. }
  18160. /*:649*//*650:*/
  18161. #line 14038 "./typica.w"
  18162. if(currentElement.tagName()=="html")
  18163. {
  18164. cursor.insertHtml(currentElement.text());
  18165. }
  18166. /*:650*//*651:*/
  18167. #line 14048 "./typica.w"
  18168. if(currentElement.tagName()=="text")
  18169. {
  18170. cursor.insertText(currentElement.text());
  18171. }
  18172. /*:651*//*652:*/
  18173. #line 14058 "./typica.w"
  18174. if(currentElement.tagName()=="table")
  18175. {
  18176. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  18177. ReportTable*table= new ReportTable(frame,currentElement);
  18178. table->setParent(widget);
  18179. if(currentElement.hasAttribute("id"))
  18180. {
  18181. table->setObjectName(currentElement.attribute("id"));
  18182. }
  18183. }
  18184. /*:652*/
  18185. #line 14020 "./typica.w"
  18186. }
  18187. }
  18188. /*:648*/
  18189. #line 14003 "./typica.w"
  18190. widget->setDocument(document);
  18191. }
  18192. /*:647*//*663:*/
  18193. #line 14271 "./typica.w"
  18194. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  18195. {
  18196. QTextEdit*self= getself<QTextEdit*> (context);
  18197. QTextDocument*document= self->document();
  18198. QPrinter printer;
  18199. QPrintDialog printwindow(&printer,self);
  18200. if(printwindow.exec()!=QDialog::Accepted)
  18201. {
  18202. return QScriptValue();
  18203. }
  18204. document->print(&printer);
  18205. return QScriptValue();
  18206. }
  18207. /*:663*//*664:*/
  18208. #line 14289 "./typica.w"
  18209. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  18210. {
  18211. setQAbstractScrollAreaProperties(value,engine);
  18212. value.setProperty("print",engine->newFunction(QTextEdit_print));
  18213. }
  18214. #line 1 "./daterangeselector.w"
  18215. /*:664*//*683:*/
  18216. #line 461 "./daterangeselector.w"
  18217. void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
  18218. QStack<QLayout*> *layoutStack)
  18219. {
  18220. DateRangeSelector*widget= new DateRangeSelector;
  18221. if(element.hasAttribute("id"))
  18222. {
  18223. widget->setObjectName(element.attribute("id"));
  18224. }
  18225. if(element.hasAttribute("initial"))
  18226. {
  18227. widget->setCurrentIndex(element.attribute("initial").toInt());
  18228. }
  18229. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18230. layout->addWidget(widget);
  18231. }
  18232. /*:683*//*694:*/
  18233. #line 14469 "./typica.w"
  18234. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  18235. QStack<QLayout*> *layoutStack)
  18236. {
  18237. FormArray*widget= new FormArray(element);
  18238. if(element.hasAttribute("id"))
  18239. {
  18240. widget->setObjectName(element.attribute("id"));
  18241. }
  18242. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18243. layout->addWidget(widget);
  18244. }
  18245. /*:694*//*715:*/
  18246. #line 15056 "./typica.w"
  18247. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  18248. QStack<QLayout*> *layoutStack)
  18249. {
  18250. ScaleControl*scale= new ScaleControl;
  18251. if(element.hasAttribute("id"))
  18252. {
  18253. scale->setObjectName(element.attribute("id"));
  18254. }
  18255. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18256. layout->addWidget(scale);
  18257. }
  18258. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  18259. QStack<QLayout*> *layoutStack)
  18260. {
  18261. IntensityControl*scale= new IntensityControl;
  18262. if(element.hasAttribute("id"))
  18263. {
  18264. scale->setObjectName(element.attribute("id"));
  18265. }
  18266. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18267. layout->addWidget(scale);
  18268. }
  18269. /*:715*//*741:*/
  18270. #line 15646 "./typica.w"
  18271. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  18272. {
  18273. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  18274. setDeviceTreeModelProperties(object,engine);
  18275. return object;
  18276. }
  18277. /*:741*//*743:*/
  18278. #line 15669 "./typica.w"
  18279. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  18280. {
  18281. setQAbstractItemModelProperties(value,engine);
  18282. value.setProperty("referenceElement",
  18283. engine->newFunction(DeviceTreeModel_referenceElement));
  18284. }
  18285. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  18286. {
  18287. setQObjectProperties(value,engine);
  18288. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  18289. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  18290. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  18291. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  18292. }
  18293. /*:743*//*744:*/
  18294. #line 15696 "./typica.w"
  18295. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  18296. QScriptEngine*engine)
  18297. {
  18298. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  18299. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  18300. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  18301. QDomElement node;
  18302. QVariantMap retval;
  18303. retval.insert("driver",referenceElement.attribute("driver"));
  18304. for(int i= 0;i<configData.size();i++)
  18305. {
  18306. node= configData.at(i).toElement();
  18307. retval.insert(node.attribute("name"),node.attribute("value"));
  18308. }
  18309. return engine->toScriptValue(retval);
  18310. }
  18311. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  18312. {
  18313. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18314. QModelIndex index= argument<QModelIndex> (0,context);
  18315. int role= argument<int> (1,context);
  18316. return engine->toScriptValue(model->data(index,role));
  18317. }
  18318. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  18319. {
  18320. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18321. int row= 0;
  18322. int column= 0;
  18323. QModelIndex index;
  18324. if(context->argumentCount()> 1)
  18325. {
  18326. row= argument<int> (0,context);
  18327. column= argument<int> (1,context);
  18328. }
  18329. if(context->argumentCount()> 2)
  18330. {
  18331. index= argument<QModelIndex> (2,context);
  18332. }
  18333. QModelIndex retval= model->index(row,column,index);
  18334. return engine->toScriptValue(retval);
  18335. }
  18336. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  18337. QScriptEngine*)
  18338. {
  18339. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18340. QModelIndex index;
  18341. if(context->argumentCount()==1)
  18342. {
  18343. index= argument<QModelIndex> (0,context);
  18344. }
  18345. return QScriptValue(model->rowCount(index));
  18346. }
  18347. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  18348. QScriptEngine*engine)
  18349. {
  18350. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  18351. QModelIndex index;
  18352. if(context->argumentCount()==1)
  18353. {
  18354. index= argument<QModelIndex> (0,context);
  18355. }
  18356. return QScriptValue(engine,model->hasChildren(index));
  18357. }
  18358. /*:744*//*747:*/
  18359. #line 15780 "./typica.w"
  18360. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  18361. {
  18362. QVariant var;
  18363. var.setValue(index);
  18364. QScriptValue object= engine->newVariant(var);
  18365. return object;
  18366. }
  18367. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  18368. {
  18369. index= value.toVariant().value<QModelIndex> ();
  18370. }
  18371. /*:747*//*763:*/
  18372. #line 16078 "./typica.w"
  18373. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  18374. QScriptEngine*engine)
  18375. {
  18376. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  18377. return object;
  18378. }
  18379. /*:763*//*834:*/
  18380. #line 47 "./settings.w"
  18381. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  18382. {
  18383. QScriptValue object= engine->newQObject(new SettingsWindow);
  18384. return object;
  18385. }
  18386. /*:834*//*859:*/
  18387. #line 18728 "./typica.w"
  18388. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  18389. {
  18390. QScriptValue object;
  18391. if(context->argumentCount()==2)
  18392. {
  18393. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  18394. argument<QModelIndex> (1,context)),
  18395. QScriptEngine::ScriptOwnership);
  18396. setModbusRTUDeviceProperties(object,engine);
  18397. }
  18398. else
  18399. {
  18400. context->throwError("Incorrect number of arguments passed to "
  18401. "ModbusRTUDevice constructor. This takes the configuration model "
  18402. "and an index.");
  18403. }
  18404. return object;
  18405. }
  18406. /*:859*//*860:*/
  18407. #line 18750 "./typica.w"
  18408. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  18409. {
  18410. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  18411. QScriptValue object;
  18412. if(self)
  18413. {
  18414. if(self->channels.size()> 0)
  18415. {
  18416. object= engine->newQObject(self->channels.at(0));
  18417. setChannelProperties(object,engine);
  18418. }
  18419. }
  18420. return object;
  18421. }
  18422. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  18423. {
  18424. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  18425. QScriptValue object;
  18426. if(self)
  18427. {
  18428. if(self->channels.size()> 1)
  18429. {
  18430. object= engine->newQObject(self->channels.at(1));
  18431. setChannelProperties(object,engine);
  18432. }
  18433. }
  18434. return object;
  18435. }
  18436. /*:860*//*861:*/
  18437. #line 18783 "./typica.w"
  18438. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  18439. {
  18440. setQObjectProperties(value,engine);
  18441. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  18442. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  18443. }
  18444. /*:861*//*879:*/
  18445. #line 357 "./unsupportedserial.w"
  18446. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine)
  18447. {
  18448. QModelIndex deviceIndex= argument<QModelIndex> (0,context);
  18449. JavaScriptDevice*device= new JavaScriptDevice(deviceIndex,engine);
  18450. QScriptValue object= engine->newQObject(device);
  18451. setQObjectProperties(object,engine);
  18452. object.setProperty("getChannel",engine->newFunction(JavaScriptDevice_getChannel));
  18453. return object;
  18454. }
  18455. /*:879*//*884:*/
  18456. #line 430 "./unsupportedserial.w"
  18457. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine)
  18458. {
  18459. JavaScriptDevice*self= getself<JavaScriptDevice*> (context);
  18460. QScriptValue object;
  18461. if(self)
  18462. {
  18463. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  18464. setChannelProperties(object,engine);
  18465. }
  18466. return object;
  18467. }
  18468. /*:884*//*891:*/
  18469. #line 630 "./unsupportedserial.w"
  18470. QScriptValue getMeasurementTimestamp(QScriptContext*,QScriptEngine*engine)
  18471. {
  18472. return engine->toScriptValue<QTime> (QTime::currentTime());
  18473. }
  18474. /*:891*//*895:*/
  18475. #line 667 "./unsupportedserial.w"
  18476. QScriptValue constructSerialPort(QScriptContext*,QScriptEngine*engine)
  18477. {
  18478. QScriptValue object= engine->newQObject(new QextSerialPort());
  18479. setSerialPortProperties(object,engine);
  18480. return object;
  18481. }
  18482. /*:895*//*896:*/
  18483. #line 678 "./unsupportedserial.w"
  18484. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine)
  18485. {
  18486. setQIODeviceProperties(value,engine);
  18487. value.setProperty("flush",engine->newFunction(SerialPort_flush));
  18488. }
  18489. /*:896*//*897:*/
  18490. #line 687 "./unsupportedserial.w"
  18491. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*)
  18492. {
  18493. QextSerialPort*self= getself<QextSerialPort*> (context);
  18494. self->flush();
  18495. return QScriptValue();
  18496. }
  18497. /*:897*//*900:*/
  18498. #line 721 "./unsupportedserial.w"
  18499. void setQTimerProperties(QScriptValue value,QScriptEngine*engine)
  18500. {
  18501. setQObjectProperties(value,engine);
  18502. }
  18503. QScriptValue constructQTimer(QScriptContext*,QScriptEngine*engine)
  18504. {
  18505. QScriptValue object= engine->newQObject(new QTimer);
  18506. setQTimerProperties(object,engine);
  18507. return object;
  18508. }
  18509. #line 19334 "./typica.w"
  18510. #line 1 "./phidgets.w"
  18511. /*:900*//*921:*/
  18512. #line 463 "./phidgets.w"
  18513. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine)
  18514. {
  18515. if(context->argumentCount()!=1)
  18516. {
  18517. context->throwError("Incorrect number of arguments passed to "
  18518. "PhidgetsTemperatureSensor constructor. This takes "
  18519. "a QModelIndex.");
  18520. }
  18521. QScriptValue object= engine->newQObject(new PhidgetsTemperatureSensor(argument<QModelIndex> (0,context)),QScriptEngine::ScriptOwnership);
  18522. setQObjectProperties(object,engine);
  18523. object.setProperty("getChannel",engine->newFunction(Phidgets_getChannel));
  18524. return object;
  18525. }
  18526. /*:921*//*922:*/
  18527. #line 480 "./phidgets.w"
  18528. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine)
  18529. {
  18530. PhidgetsTemperatureSensor*self= getself<PhidgetsTemperatureSensor*> (context);
  18531. QScriptValue object;
  18532. if(self)
  18533. {
  18534. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  18535. setChannelProperties(object,engine);
  18536. }
  18537. return object;
  18538. }
  18539. #line 19336 "./typica.w"
  18540. /*:922*//*954:*/
  18541. #line 151 "./rate.w"
  18542. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  18543. {
  18544. int cachetime= 1;
  18545. int scaletime= 1;
  18546. if(context->argumentCount()> 0)
  18547. {
  18548. cachetime= argument<int> (0,context);
  18549. if(context->argumentCount()> 1)
  18550. {
  18551. scaletime= argument<int> (1,context);
  18552. }
  18553. }
  18554. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  18555. setRateOfChangeProperties(object,engine);
  18556. return object;
  18557. }
  18558. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  18559. {
  18560. setQObjectProperties(value,engine);
  18561. }
  18562. /*:954*//*979:*/
  18563. #line 614 "./dataqsdk.w"
  18564. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  18565. {
  18566. QScriptValue object;
  18567. if(context->argumentCount()==1)
  18568. {
  18569. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  18570. QScriptEngine::ScriptOwnership);
  18571. setDataqSdkDeviceProperties(object,engine);
  18572. }
  18573. else
  18574. {
  18575. context->throwError("Incorrect number of arguments passed to "
  18576. "DataqSdkDevice. The constructor takes one string "
  18577. "as an argument specifying a device name. "
  18578. "Example: Dev1");
  18579. }
  18580. return object;
  18581. }
  18582. /*:979*//*980:*/
  18583. #line 637 "./dataqsdk.w"
  18584. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  18585. {
  18586. setQObjectProperties(value,engine);
  18587. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  18588. }
  18589. /*:980*//*981:*/
  18590. #line 647 "./dataqsdk.w"
  18591. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  18592. {
  18593. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  18594. QScriptValue object;
  18595. if(self)
  18596. {
  18597. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  18598. setChannelProperties(object,engine);
  18599. }
  18600. return object;
  18601. }
  18602. /*:981*//*1006:*/
  18603. #line 80 "./scales.w"
  18604. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  18605. {
  18606. QScriptValue object;
  18607. QString labelText= "";
  18608. if(context->argumentCount()==1)
  18609. {
  18610. labelText= argument<QString> (0,context);
  18611. }
  18612. object= engine->newQObject(new DragLabel(labelText));
  18613. setDragLabelProperties(object,engine);
  18614. return object;
  18615. }
  18616. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  18617. {
  18618. setQLabelProperties(value,engine);
  18619. }
  18620. /*:1006*//*1016:*/
  18621. #line 272 "./scales.w"
  18622. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  18623. {
  18624. return engine->newVariant(QVariant((int)(value)));
  18625. }
  18626. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  18627. {
  18628. value= (BaudRateType)(sv.toVariant().toInt());
  18629. }
  18630. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  18631. {
  18632. return engine->newVariant(QVariant((int)(value)));
  18633. }
  18634. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  18635. {
  18636. value= (DataBitsType)(sv.toVariant().toInt());
  18637. }
  18638. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  18639. {
  18640. return engine->newVariant(QVariant((int)(value)));
  18641. }
  18642. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  18643. {
  18644. value= (ParityType)(sv.toVariant().toInt());
  18645. }
  18646. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  18647. {
  18648. return engine->newVariant(QVariant((int)(value)));
  18649. }
  18650. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  18651. {
  18652. value= (StopBitsType)(sv.toVariant().toInt());
  18653. }
  18654. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  18655. {
  18656. return engine->newVariant(QVariant((int)(value)));
  18657. }
  18658. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  18659. {
  18660. value= (FlowType)(sv.toVariant().toInt());
  18661. }
  18662. /*:1016*//*1019:*/
  18663. #line 341 "./scales.w"
  18664. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  18665. {
  18666. setQIODeviceProperties(value,engine);
  18667. }
  18668. /*:1019*//*1020:*/
  18669. #line 349 "./scales.w"
  18670. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  18671. {
  18672. QScriptValue object;
  18673. if(context->argumentCount()==1)
  18674. {
  18675. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  18676. setSerialScaleProperties(object,engine);
  18677. }
  18678. else
  18679. {
  18680. context->throwError("Incorrect number of arguments passed to "
  18681. "SerialScale. The constructor takes one string "
  18682. "as an argument specifying a port name.");
  18683. }
  18684. return object;
  18685. }
  18686. /*:1020*//*1042:*/
  18687. #line 278 "./valueannotation.w"
  18688. QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
  18689. {
  18690. QScriptValue object= engine->newQObject(new ValueAnnotation);
  18691. setValueAnnotationProperties(object,engine);
  18692. return object;
  18693. }
  18694. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  18695. {
  18696. setQObjectProperties(value,engine);
  18697. }
  18698. #line 19983 "./typica.w"
  18699. /*:1042*/
  18700. #line 530 "./typica.w"
  18701. /*617:*/
  18702. #line 13395 "./typica.w"
  18703. void messageFileOutput(QtMsgType,const char*msg)
  18704. {
  18705. QFile output("Typica-"+QDate::currentDate().toString("yyyy-MM-dd")+".log");
  18706. output.open(QIODevice::WriteOnly|QIODevice::Append);
  18707. QTextStream outstream(&output);
  18708. outstream<<msg<<"\r\n";
  18709. }
  18710. /*:617*/
  18711. #line 531 "./typica.w"
  18712. /*614:*/
  18713. #line 13356 "./typica.w"
  18714. int main(int argc,char**argv)
  18715. {
  18716. int*c= &argc;
  18717. Application app(*c,argv);
  18718. QSettings settings;
  18719. /*615:*/
  18720. #line 13382 "./typica.w"
  18721. if(settings.value("settings/advanced/logging",false).toBool())
  18722. {
  18723. qInstallMsgHandler(messageFileOutput);
  18724. }
  18725. /*:615*/
  18726. #line 13362 "./typica.w"
  18727. /*618:*/
  18728. #line 13408 "./typica.w"
  18729. QStringList themeSearchPath= QIcon::themeSearchPaths();
  18730. themeSearchPath.append(":/resources/icons/tango");
  18731. QIcon::setThemeSearchPaths(themeSearchPath);
  18732. QIcon::setThemeName(":/resources/icons/tango");
  18733. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  18734. /*:618*/
  18735. #line 13363 "./typica.w"
  18736. /*619:*/
  18737. #line 13428 "./typica.w"
  18738. QFile entypo(":/resources/fonts/entypo.ttf");
  18739. entypo.open(QIODevice::ReadOnly);
  18740. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  18741. entypo.close();
  18742. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  18743. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  18744. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  18745. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  18746. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  18747. /*:619*/
  18748. #line 13364 "./typica.w"
  18749. /*773:*/
  18750. #line 16368 "./typica.w"
  18751. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  18752. /*:773*//*783:*/
  18753. #line 16610 "./typica.w"
  18754. app.registerDeviceConfigurationWidget("nidaqmxbase",
  18755. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  18756. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  18757. NiDaqMxBase9211ConfWidget::staticMetaObject);
  18758. app.registerDeviceConfigurationWidget("ni9211seriestc",
  18759. Ni9211TcConfWidget::staticMetaObject);
  18760. /*:783*//*791:*/
  18761. #line 16841 "./typica.w"
  18762. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  18763. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  18764. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  18765. /*:791*//*815:*/
  18766. #line 17806 "./typica.w"
  18767. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  18768. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  18769. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  18770. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  18771. /*:815*//*820:*/
  18772. #line 17891 "./typica.w"
  18773. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  18774. /*:820*//*823:*/
  18775. #line 17961 "./typica.w"
  18776. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  18777. /*:823*//*826:*/
  18778. #line 18088 "./typica.w"
  18779. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  18780. #line 1 "./freeannotation.w"
  18781. /*:826*//*830:*/
  18782. #line 57 "./freeannotation.w"
  18783. app.registerDeviceConfigurationWidget("freeannotation",
  18784. FreeAnnotationConfWidget::staticMetaObject);
  18785. #line 18092 "./typica.w"
  18786. #line 1 "./settings.w"
  18787. /*:830*//*864:*/
  18788. #line 19324 "./typica.w"
  18789. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  18790. /*:864*//*874:*/
  18791. #line 264 "./unsupportedserial.w"
  18792. app.registerDeviceConfigurationWidget("unsupporteddevicechannel",
  18793. UnsupportedDeviceChannelConfWidget::staticMetaObject);
  18794. app.registerDeviceConfigurationWidget("unsupporteddevice",
  18795. UnsupportedSerialDeviceConfWidget::staticMetaObject);
  18796. /*:874*//*908:*/
  18797. #line 181 "./phidgets.w"
  18798. app.registerDeviceConfigurationWidget("phidgets1048",
  18799. PhidgetsTemperatureSensorConfWidget::staticMetaObject);
  18800. app.registerDeviceConfigurationWidget("phidgets1048channel",
  18801. PhidgetTemperatureSensorChannelConfWidget::staticMetaObject);
  18802. /*:908*//*928:*/
  18803. #line 19458 "./typica.w"
  18804. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  18805. /*:928*//*931:*/
  18806. #line 19518 "./typica.w"
  18807. app.registerDeviceConfigurationWidget("coolingtimer",
  18808. CoolingTimerConfWidget::staticMetaObject);
  18809. /*:931*//*936:*/
  18810. #line 19777 "./typica.w"
  18811. app.registerDeviceConfigurationWidget("rangetimer",
  18812. RangeTimerConfWidget::staticMetaObject);
  18813. /*:936*//*941:*/
  18814. #line 19878 "./typica.w"
  18815. app.registerDeviceConfigurationWidget("multirangetimer",
  18816. MultiRangeTimerConfWidget::staticMetaObject);
  18817. /*:941*//*946:*/
  18818. #line 19973 "./typica.w"
  18819. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  18820. #line 1 "./rate.w"
  18821. /*:946*//*958:*/
  18822. #line 253 "./rate.w"
  18823. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  18824. /*:958*//*999:*/
  18825. #line 1233 "./dataqsdk.w"
  18826. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  18827. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  18828. DataqSdkChannelConfWidget::staticMetaObject);
  18829. /*:999*//*1024:*/
  18830. #line 490 "./scales.w"
  18831. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  18832. /*:1024*//*1032:*/
  18833. #line 138 "./valueannotation.w"
  18834. app.registerDeviceConfigurationWidget("valueannotation",
  18835. ValueAnnotationConfWidget::staticMetaObject);
  18836. /*:1032*/
  18837. #line 13366 "./typica.w"
  18838. /*620:*/
  18839. #line 13445 "./typica.w"
  18840. if(settings.value("database/exists","false").toString()=="true")
  18841. {
  18842. /*625:*/
  18843. #line 13574 "./typica.w"
  18844. QSqlDatabase database=
  18845. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  18846. database.setConnectOptions("application_name=Typica");
  18847. database.setHostName(settings.value("database/hostname").toString());
  18848. database.setPort(settings.value("database/portnumber",5432).toInt());
  18849. database.setDatabaseName(settings.value("database/dbname").toString());
  18850. database.setUserName(settings.value("database/user").toString());
  18851. database.setPassword(settings.value("database/password").toString());
  18852. if(!database.open())
  18853. {
  18854. settings.setValue("database/exists","false");
  18855. }
  18856. else
  18857. {
  18858. database.close();
  18859. }
  18860. /*:625*/
  18861. #line 13448 "./typica.w"
  18862. }
  18863. if(settings.value("database/exists","false").toString()=="false")
  18864. {
  18865. /*624:*/
  18866. #line 13565 "./typica.w"
  18867. SqlConnectionSetup dialog;
  18868. dialog.exec();
  18869. /*:624*/
  18870. #line 13452 "./typica.w"
  18871. }
  18872. /*:620*/
  18873. #line 13367 "./typica.w"
  18874. /*189:*/
  18875. #line 4332 "./typica.w"
  18876. QStringList arguments= QCoreApplication::arguments();
  18877. int position= arguments.indexOf("-c");
  18878. QString filename= QString();
  18879. if(position!=-1)
  18880. {
  18881. if(arguments.size()>=position+1)
  18882. {
  18883. filename= arguments.at(position+1);
  18884. }
  18885. }
  18886. if(filename.isEmpty())
  18887. {
  18888. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  18889. settings.value("config","").toString());
  18890. }
  18891. QDir directory;
  18892. if(!filename.isEmpty())
  18893. {
  18894. QFile file(filename);
  18895. QFileInfo info(filename);
  18896. directory= info.dir();
  18897. QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
  18898. QTranslator*configtr= new QTranslator;
  18899. if(configtr->load(QString("config.%1").arg(QLocale::system().name()),
  18900. QString("%1/Translations").arg(directory.canonicalPath())))
  18901. {
  18902. QCoreApplication::installTranslator(configtr);
  18903. }
  18904. settings.setValue("config",directory.path());
  18905. if(file.open(QIODevice::ReadOnly))
  18906. {
  18907. app.configuration()->setContent(&file,true);
  18908. }
  18909. }
  18910. /*190:*/
  18911. #line 4373 "./typica.w"
  18912. QDomElement root= app.configuration()->documentElement();
  18913. QDomNodeList children= root.childNodes();
  18914. QString replacementDoc;
  18915. QDomDocument includedDoc;
  18916. QDomDocumentFragment fragment;
  18917. for(int i= 0;i<children.size();i++)
  18918. {
  18919. QDomNode currentNode= children.at(i);
  18920. QDomElement currentElement;
  18921. if(currentNode.nodeName()=="include")
  18922. {
  18923. currentElement= currentNode.toElement();
  18924. if(currentElement.hasAttribute("src"))
  18925. {
  18926. replacementDoc= directory.path();
  18927. replacementDoc.append('/');
  18928. replacementDoc.append(currentElement.attribute("src"));
  18929. QFile doc(replacementDoc);
  18930. if(doc.open(QIODevice::ReadOnly))
  18931. {
  18932. includedDoc.setContent(&doc,true);
  18933. fragment= includedDoc.createDocumentFragment();
  18934. fragment.appendChild(includedDoc.documentElement());
  18935. root.replaceChild(fragment,currentNode);
  18936. doc.close();
  18937. }
  18938. }
  18939. }
  18940. }
  18941. /*:190*/
  18942. #line 4367 "./typica.w"
  18943. /*:189*/
  18944. #line 13368 "./typica.w"
  18945. /*7:*/
  18946. #line 660 "./typica.w"
  18947. QScriptEngine*engine= new QScriptEngine;
  18948. QScriptValue constructor;
  18949. QScriptValue value;
  18950. /*:7*//*17:*/
  18951. #line 857 "./typica.w"
  18952. constructor= engine->newFunction(constructQWidget);
  18953. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  18954. engine->globalObject().setProperty("QWidget",value);
  18955. /*:17*//*21:*/
  18956. #line 944 "./typica.w"
  18957. constructor= engine->newFunction(displayWarning);
  18958. engine->globalObject().setProperty("displayWarning",constructor);
  18959. constructor= engine->newFunction(displayError);
  18960. engine->globalObject().setProperty("displayError",constructor);
  18961. /*:21*//*31:*/
  18962. #line 1150 "./typica.w"
  18963. constructor= engine->newFunction(constructQMainWindow);
  18964. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  18965. constructor);
  18966. engine->globalObject().setProperty("QMainWindow",value);
  18967. /*:31*//*42:*/
  18968. #line 1355 "./typica.w"
  18969. constructor= engine->newFunction(constructQFrame);
  18970. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  18971. engine->globalObject().setProperty("QFrame",value);
  18972. /*:42*//*45:*/
  18973. #line 1388 "./typica.w"
  18974. constructor= engine->newFunction(constructQLabel);
  18975. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  18976. engine->globalObject().setProperty("QLabel",value);
  18977. /*:45*//*48:*/
  18978. #line 1431 "./typica.w"
  18979. constructor= engine->newFunction(constructQSvgWidget);
  18980. value= engine->newQMetaObject(&QSvgWidget::staticMetaObject,constructor);
  18981. engine->globalObject().setProperty("QSvgWidget",value);
  18982. /*:48*//*54:*/
  18983. #line 1513 "./typica.w"
  18984. constructor= engine->newFunction(constructQLineEdit);
  18985. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  18986. engine->globalObject().setProperty("QLineEdit",value);
  18987. /*:54*//*58:*/
  18988. #line 1560 "./typica.w"
  18989. constructor= engine->newFunction(constructQSplitter);
  18990. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  18991. engine->globalObject().setProperty("QSplitter",value);
  18992. /*:58*//*66:*/
  18993. #line 1749 "./typica.w"
  18994. constructor= engine->newFunction(constructQBoxLayout);
  18995. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  18996. engine->globalObject().setProperty("QBoxLayout",value);
  18997. /*:66*//*70:*/
  18998. #line 1861 "./typica.w"
  18999. constructor= engine->newFunction(constructQAction);
  19000. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  19001. engine->globalObject().setProperty("QAction",value);
  19002. /*:70*//*73:*/
  19003. #line 1920 "./typica.w"
  19004. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  19005. value.setProperty("getOpenFileName",
  19006. engine->newFunction(QFileDialog_getOpenFileName));
  19007. value.setProperty("getSaveFileName",
  19008. engine->newFunction(QFileDialog_getSaveFileName));
  19009. engine->globalObject().setProperty("QFileDialog",value);
  19010. /*:73*//*78:*/
  19011. #line 2038 "./typica.w"
  19012. constructor= engine->newFunction(constructQFile);
  19013. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  19014. engine->globalObject().setProperty("QFile",value);
  19015. /*:78*//*89:*/
  19016. #line 2256 "./typica.w"
  19017. constructor= engine->newFunction(constructQProcess);
  19018. value= engine->newQMetaObject(&QProcess::staticMetaObject,constructor);
  19019. engine->globalObject().setProperty("QProcess",value);
  19020. /*:89*//*98:*/
  19021. #line 2405 "./typica.w"
  19022. qScriptRegisterMetaType(engine,QByteArray_toScriptValue,QByteArray_fromScriptValue);
  19023. constructor= engine->newFunction(constructQByteArray);
  19024. engine->globalObject().setProperty("QByteArray",constructor);
  19025. /*:98*//*110:*/
  19026. #line 2647 "./typica.w"
  19027. engine->globalObject().setProperty("bytesFromInt8",engine->newFunction(bytesFromInt8));
  19028. engine->globalObject().setProperty("bytesFromInt16",engine->newFunction(bytesFromInt16));
  19029. engine->globalObject().setProperty("bytesFromInt32",engine->newFunction(bytesFromInt32));
  19030. engine->globalObject().setProperty("bytesFromFloat",engine->newFunction(bytesFromFloat));
  19031. engine->globalObject().setProperty("bytesFromDouble",engine->newFunction(bytesFromDouble));
  19032. /*:110*//*113:*/
  19033. #line 2750 "./typica.w"
  19034. constructor= engine->newFunction(constructQBuffer);
  19035. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  19036. engine->globalObject().setProperty("QBuffer",value);
  19037. /*:113*//*116:*/
  19038. #line 2799 "./typica.w"
  19039. constructor= engine->newFunction(constructXQuery);
  19040. engine->globalObject().setProperty("XQuery",constructor);
  19041. /*:116*//*122:*/
  19042. #line 2901 "./typica.w"
  19043. constructor= engine->newFunction(constructXmlWriter);
  19044. engine->globalObject().setProperty("XmlWriter",constructor);
  19045. /*:122*//*131:*/
  19046. #line 3107 "./typica.w"
  19047. constructor= engine->newFunction(constructXmlReader);
  19048. engine->globalObject().setProperty("XmlReader",constructor);
  19049. /*:131*//*138:*/
  19050. #line 3231 "./typica.w"
  19051. value= engine->newQObject(&settings);
  19052. setQSettingsProperties(value,engine);
  19053. engine->globalObject().setProperty("QSettings",value);
  19054. /*:138*//*142:*/
  19055. #line 3312 "./typica.w"
  19056. constructor= engine->newFunction(constructQLCDNumber);
  19057. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  19058. engine->globalObject().setProperty("QLCDNumber",value);
  19059. /*:142*//*145:*/
  19060. #line 3368 "./typica.w"
  19061. constructor= engine->newFunction(constructQTime);
  19062. engine->globalObject().setProperty("QTime",constructor);
  19063. /*:145*//*167:*/
  19064. #line 3881 "./typica.w"
  19065. constructor= engine->newFunction(constructQPushButton);
  19066. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  19067. engine->globalObject().setProperty("QPushButton",value);
  19068. /*:167*//*174:*/
  19069. #line 3992 "./typica.w"
  19070. constructor= engine->newFunction(constructQSqlQuery);
  19071. engine->globalObject().setProperty("QSqlQuery",constructor);
  19072. /*:174*//*181:*/
  19073. #line 4156 "./typica.w"
  19074. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  19075. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  19076. engine->globalObject().setProperty("sqlToArray",
  19077. engine->newFunction(sqlToArray));
  19078. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  19079. engine->globalObject().setProperty("annotationFromRecord",
  19080. engine->newFunction(annotationFromRecord));
  19081. engine->globalObject().setProperty("setTabOrder",
  19082. engine->newFunction(setTabOrder));
  19083. engine->globalObject().setProperty("saveFileFromDatabase",
  19084. engine->newFunction(saveFileFromDatabase));
  19085. engine->globalObject().setProperty("TTR",engine->newFunction(scriptTr));
  19086. /*:181*//*194:*/
  19087. #line 4540 "./typica.w"
  19088. engine->globalObject().setProperty("createWindow",
  19089. engine->newFunction(createWindow));
  19090. engine->globalObject().setProperty("createReport",
  19091. engine->newFunction(createReport));
  19092. /*:194*//*259:*/
  19093. #line 6178 "./typica.w"
  19094. engine->globalObject().setProperty("findChildObject",
  19095. engine->newFunction(findChildObject));
  19096. /*:259*//*285:*/
  19097. #line 389 "./units.w"
  19098. value= engine->newQMetaObject(&Units::staticMetaObject);
  19099. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  19100. value.setProperty("convertRelativeTemperature",
  19101. engine->newFunction(Units_convertRelativeTemperature));
  19102. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  19103. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  19104. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  19105. engine->globalObject().setProperty("Units",value);
  19106. /*:285*//*290:*/
  19107. #line 462 "./units.w"
  19108. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  19109. #line 6602 "./typica.w"
  19110. /*:290*//*298:*/
  19111. #line 141 "./measurement.w"
  19112. constructor= engine->newFunction(constructMeasurement);
  19113. engine->globalObject().setProperty("Measurement",constructor);
  19114. qScriptRegisterMetaType(engine,Measurement_toScriptValue,Measurement_fromScriptValue);
  19115. /*:298*//*318:*/
  19116. #line 7173 "./typica.w"
  19117. constructor= engine->newFunction(constructDAQ);
  19118. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  19119. value.setProperty("Fahrenheit",Units::Fahrenheit);
  19120. value.setProperty("Celsius",Units::Celsius);
  19121. value.setProperty("Kelvin",Units::Kelvin);
  19122. value.setProperty("Rankine",Units::Rankine);
  19123. engine->globalObject().setProperty("DAQ",value);
  19124. /*:318*//*327:*/
  19125. #line 7375 "./typica.w"
  19126. constructor= engine->newFunction(constructFakeDAQ);
  19127. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  19128. engine->globalObject().setProperty("FakeDAQ",value);
  19129. /*:327*//*338:*/
  19130. #line 7658 "./typica.w"
  19131. constructor= engine->newFunction(constructLinearCalibrator);
  19132. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  19133. constructor);
  19134. engine->globalObject().setProperty("LinearCalibrator",value);
  19135. /*:338*//*343:*/
  19136. #line 7797 "./typica.w"
  19137. constructor= engine->newFunction(constructLinearSplineInterpolator);
  19138. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  19139. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  19140. /*:343*//*353:*/
  19141. #line 8005 "./typica.w"
  19142. constructor= engine->newFunction(constructTemperatureDisplay);
  19143. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  19144. constructor);
  19145. engine->globalObject().setProperty("TemperatureDisplay",value);
  19146. /*:353*//*361:*/
  19147. #line 8163 "./typica.w"
  19148. constructor= engine->newFunction(constructMeasurementTimeOffset);
  19149. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  19150. constructor);
  19151. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  19152. /*:361*//*366:*/
  19153. #line 8274 "./typica.w"
  19154. constructor= engine->newFunction(constructThresholdDetector);
  19155. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  19156. engine->globalObject().setProperty("ThresholdDetector",value);
  19157. /*:366*//*371:*/
  19158. #line 8373 "./typica.w"
  19159. constructor= engine->newFunction(constructZeroEmitter);
  19160. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  19161. engine->globalObject().setProperty("ZeroEmitter",value);
  19162. /*:371*//*376:*/
  19163. #line 8452 "./typica.w"
  19164. constructor= engine->newFunction(constructMeasurementAdapter);
  19165. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  19166. constructor);
  19167. engine->globalObject().setProperty("MeasurementAdapter",value);
  19168. /*:376*//*393:*/
  19169. #line 8915 "./typica.w"
  19170. constructor= engine->newFunction(constructGraphView);
  19171. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  19172. engine->globalObject().setProperty("GraphView",value);
  19173. /*:393*//*416:*/
  19174. #line 9552 "./typica.w"
  19175. constructor= engine->newFunction(constructZoomLog);
  19176. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  19177. engine->globalObject().setProperty("ZoomLog",value);
  19178. /*:416*//*454:*/
  19179. #line 10500 "./typica.w"
  19180. constructor= engine->newFunction(constructAnnotationButton);
  19181. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  19182. constructor);
  19183. engine->globalObject().setProperty("AnnotationButton",value);
  19184. /*:454*//*462:*/
  19185. #line 10642 "./typica.w"
  19186. constructor= engine->newFunction(constructAnnotationSpinBox);
  19187. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  19188. constructor);
  19189. engine->globalObject().setProperty("AnnotationSpinBox",value);
  19190. /*:462*//*483:*/
  19191. #line 11067 "./typica.w"
  19192. constructor= engine->newFunction(constructTimerDisplay);
  19193. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  19194. engine->globalObject().setProperty("TimerDisplay",value);
  19195. /*:483*//*511:*/
  19196. #line 11591 "./typica.w"
  19197. constructor= engine->newFunction(constructWidgetDecorator);
  19198. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  19199. engine->globalObject().setProperty("WidgetDecorator",value);
  19200. /*:511*//*524:*/
  19201. #line 11873 "./typica.w"
  19202. constructor= engine->newFunction(constructLogEditWindow);
  19203. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  19204. engine->globalObject().setProperty("LogEditWindow",value);
  19205. /*:524*//*543:*/
  19206. #line 12400 "./typica.w"
  19207. constructor= engine->newFunction(constructXMLInput);
  19208. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  19209. engine->globalObject().setProperty("XMLInput",value);
  19210. /*:543*//*557:*/
  19211. #line 149 "./webview.w"
  19212. constructor= engine->newFunction(constructWebView);
  19213. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  19214. engine->globalObject().setProperty("WebView",value);
  19215. /*:557*//*565:*/
  19216. #line 241 "./webview.w"
  19217. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  19218. /*:565*//*568:*/
  19219. #line 283 "./webview.w"
  19220. constructor= engine->newFunction(constructWebElement);
  19221. engine->globalObject().setProperty("WebElement",constructor);
  19222. /*:568*//*579:*/
  19223. #line 12643 "./typica.w"
  19224. value= engine->newQObject(AppInstance);
  19225. engine->globalObject().setProperty("Application",value);
  19226. /*:579*//*637:*/
  19227. #line 13752 "./typica.w"
  19228. constructor= engine->newFunction(constructSqlQueryView);
  19229. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  19230. engine->globalObject().setProperty("SqlQueryView",value);
  19231. /*:637*//*742:*/
  19232. #line 15656 "./typica.w"
  19233. constructor= engine->newFunction(constructDeviceTreeModel);
  19234. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  19235. constructor);
  19236. engine->globalObject().setProperty("DeviceTreeModel",value);
  19237. /*:742*//*748:*/
  19238. #line 15796 "./typica.w"
  19239. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  19240. /*:748*//*764:*/
  19241. #line 16088 "./typica.w"
  19242. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  19243. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  19244. constructor);
  19245. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  19246. /*:764*//*835:*/
  19247. #line 56 "./settings.w"
  19248. constructor= engine->newFunction(constructSettingsWindow);
  19249. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  19250. engine->globalObject().setProperty("SettingsWindow",value);
  19251. #line 1 "./graphsettings.w"
  19252. /*:835*//*858:*/
  19253. #line 18719 "./typica.w"
  19254. constructor= engine->newFunction(constructModbusRTUDevice);
  19255. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  19256. engine->globalObject().setProperty("ModbusRTUDevice",value);
  19257. /*:858*//*878:*/
  19258. #line 350 "./unsupportedserial.w"
  19259. engine->globalObject().setProperty("createDevice",
  19260. engine->newFunction(createDevice));
  19261. /*:878*//*890:*/
  19262. #line 622 "./unsupportedserial.w"
  19263. engine->globalObject().setProperty("getMeasurementTimestamp",
  19264. engine->newFunction(getMeasurementTimestamp));
  19265. /*:890*//*894:*/
  19266. #line 658 "./unsupportedserial.w"
  19267. constructor= engine->newFunction(constructSerialPort);
  19268. value= engine->newQMetaObject(&QextSerialPort::staticMetaObject,constructor);
  19269. engine->globalObject().setProperty("SerialPort",value);
  19270. /*:894*//*899:*/
  19271. #line 713 "./unsupportedserial.w"
  19272. constructor= engine->newFunction(constructQTimer);
  19273. value= engine->newQMetaObject(&QTimer::staticMetaObject,constructor);
  19274. engine->globalObject().setProperty("Timer",value);
  19275. /*:899*//*919:*/
  19276. #line 450 "./phidgets.w"
  19277. constructor= engine->newFunction(constructPhidgetsTemperatureSensor);
  19278. value= engine->newQMetaObject(&PhidgetsTemperatureSensor::staticMetaObject,constructor);
  19279. engine->globalObject().setProperty("PhidgetsTemperatureSensor",value);
  19280. /*:919*//*953:*/
  19281. #line 144 "./rate.w"
  19282. constructor= engine->newFunction(constructRateOfChange);
  19283. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  19284. engine->globalObject().setProperty("RateOfChange",value);
  19285. /*:953*//*978:*/
  19286. #line 604 "./dataqsdk.w"
  19287. constructor= engine->newFunction(constructDataqSdkDevice);
  19288. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  19289. engine->globalObject().setProperty("DataqSdkDevice",value);
  19290. /*:978*//*1005:*/
  19291. #line 73 "./scales.w"
  19292. constructor= engine->newFunction(constructDragLabel);
  19293. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  19294. engine->globalObject().setProperty("DragLabel",value);
  19295. /*:1005*//*1013:*/
  19296. #line 239 "./scales.w"
  19297. constructor= engine->newFunction(constructSerialScale);
  19298. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  19299. engine->globalObject().setProperty("SerialScale",value);
  19300. /*:1013*//*1017:*/
  19301. #line 325 "./scales.w"
  19302. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  19303. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  19304. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  19305. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  19306. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  19307. /*:1017*//*1041:*/
  19308. #line 271 "./valueannotation.w"
  19309. constructor= engine->newFunction(constructValueAnnotation);
  19310. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  19311. engine->globalObject().setProperty("ValueAnnotation",value);
  19312. /*:1041*/
  19313. #line 13369 "./typica.w"
  19314. app.engine= engine;
  19315. /*191:*/
  19316. #line 4421 "./typica.w"
  19317. QString styleText;
  19318. QString programText;
  19319. QDomElement currentElement;
  19320. for(int i= 0;i<children.size();i++)
  19321. {
  19322. QDomNode currentNode= children.at(i);
  19323. if(currentNode.nodeName()=="style")
  19324. {
  19325. currentElement= currentNode.toElement();
  19326. styleText.append(currentElement.text());
  19327. }
  19328. else if(currentNode.nodeName()=="program")
  19329. {
  19330. currentElement= currentNode.toElement();
  19331. programText.append(currentElement.text());
  19332. }
  19333. }
  19334. app.setStyleSheet(styleText);
  19335. QScriptValue result= engine->evaluate(programText);
  19336. /*192:*/
  19337. #line 4446 "./typica.w"
  19338. if(engine->hasUncaughtException())
  19339. {
  19340. int line= engine->uncaughtExceptionLineNumber();
  19341. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  19342. result.toString();
  19343. QString trace;
  19344. foreach(trace,engine->uncaughtExceptionBacktrace())
  19345. {
  19346. qDebug()<<trace;
  19347. }
  19348. }
  19349. /*:192*/
  19350. #line 4441 "./typica.w"
  19351. /*:191*/
  19352. #line 13371 "./typica.w"
  19353. int retval= app.exec();
  19354. delete engine;
  19355. return retval;
  19356. }
  19357. /*:614*/
  19358. #line 532 "./typica.w"
  19359. #include "moc_typica.cpp"
  19360. /*:3*/